• Ready for review
  • CAN Data Structures

    typedef struct { DWORD ID; // ID for CAN Bus Message Buffer If you use standard format ID must 11 bit // use extended frame ID can be 29 bit WORD wLen; // Message Buffer Length ,the max length is 8 bytes BYTE byIndex; // CAN Bus Message Buffer index for RX or TX BYTE byRW; // Read = CAN_READ or Write = CAN_WRITE CAN_FRAME_FORMAT format; // Frame format is standard or Frame format is standard CAN_RTR_FORMAT frame; // Indicate the trimission frame is Remote frame or Data frame WORD timestamp; // Message Buffer Length ,the max length is 8 bytes BYTE PRIO; // the transmission priority. DWORD AcceptMask; // Acceptance Mask for Buffer LPINT lpiResult; // Contains the result of last operation DWORD iTimeout; // DWORD status; // Status information BYTE data[8]; } CAN_PACKET, *PCAN_PACKET; typedef struct { INT32 iNumPackets; // Numer of mailboxes to be handeled by CANTransfer issued // with this transferblock (1 for MX28) CAN_PACKET CANPackets[64]; // Pointer to all mailboxes to be transferred. // Content will be transferred to/from mailbox } CAN_TRANSFER_BLOCK, *PCAN_TRANSFER_BLOCK; // CAN Transfer Block typedef struct { INT32 iNumPackets; CAN_PACKET CANPackets[64]; // may be modified to your needs INT32 iTransferStatus; } CAN_TRANSFER_BLOCK, *PCAN_TRANSFER_BLOCK; #define PACKET_STATUS_OVRRUN_MB 0x0100 #define PACKET_STATUS_OVRRUN_RAM 0x0200 #define PACKET_STATUS_READY 0x0080 #define PACKET_STATUS_OVRRUN 0x0040 #define PACKET_STATUS_NOTVALID 0x0020 typedef struct { DWORD ReceivedPackets; DWORD DeliveredPakets; DWORD GlobalMessageCount; DWORD MessagesDropped; DWORD LastControllerStatus; DWORD ErrorCounter; } CAN_STATUS, *PCAN_STATUS;