unit PIC32MX_CAN_RawBuffers; // ****************************************************************************** // // * Copyright: // (c) Mustangpeak Software 2012. // // The contents of this file are subject to the GNU GPL v3 licence/ you maynot use // this file except in compliance with the License. You may obtain a copy of the // License at http://www.gnu.org/licenses/gpl.html // // * Revision History: // 2012-04-01: 1.0.0.0 Created // 2012-10-07: Version 1.0 // // * Description: // Implements a FIFO data structure for CAN Message Buffers // // ****************************************************************************** {$I Options.inc} const CAN_DIRECTION_WRITE = 0; CAN_DIRECTION_READ = 1; const FIFO_TX_LO_PRIORITY = 0; // FIFO 0 is the Lo Priorty Tx FIFO_TX_HI_PRIORITY = 1; // FIFO 1 is the Hi Priorty Tx FIFO_RX_FIFO_CAN = 2; // FIFO 2 is the Rx FIFO_RX_FIFO_OLCB = 3; // FIFO 2 is the Rx FIFO_TX_LO_PRIORITY_BUFFER_COUNT = 1; // Number of Buffers in the FIFO FIFO_TX_HI_PRIORITY_BUFFER_COUNT = 1; // Number of Buffers in the FIFO FIFO_RX_CAN_BUFFER_COUNT = 10; // Number of Buffers in the FIFO FIFO_RX_OLCB_BUFFER_COUNT = 10; // Number of Buffers in the FIFO type // *************************************************************************** // CAN Message Buffers in raw form that can be loaded into the CAN controller // registers // *************************************************************************** TCANRawBuffer = record Byte0 : Byte; Byte1 : Byte; Byte2 : Byte; Byte3 : Byte; Byte4 : Byte; Byte5 : Byte; Byte6 : Byte; Byte7 : Byte; Byte8 : Byte; Byte9 : Byte; Byte10 : Byte; Byte11 : Byte; Byte12 : Byte; Byte13 : Byte; Byte14 : Byte; Byte15 : Byte; end; PCANRawBuffer = ^TCANRawBuffer; const FIFO_BUFFER_TOTAL = FIFO_TX_LO_PRIORITY_BUFFER_COUNT + FIFO_TX_HI_PRIORITY_BUFFER_COUNT + FIFO_RX_CAN_BUFFER_COUNT + FIFO_RX_OLCB_BUFFER_COUNT; type TFIFOBufferArray = array[0..FIFO_BUFFER_TOTAL-1] of TCANRawBuffer; var FIFOBufferArray: TFIFOBufferArray; absolute $A0000000; implementation end.