Rev 391 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 391 | Rev 392 | ||
|---|---|---|---|
| 1 | /* This file is automatically generated. Do not edit. */ |
1 | /* This file is automatically generated. Do not edit. */ |
| 2 | 2 | ||
| 3 | #ifndef BIOS_H_ |
3 | #ifndef BIOS_H_ |
| 4 | #define BIOS_H_ |
4 | #define BIOS_H_ |
| 5 | 5 | ||
| 6 | #ifndef CAN_H_ |
6 | #ifndef CAN_H_ |
| 7 | #define CAN_H_ |
7 | #define CAN_H_ |
| 8 | 8 | ||
| 9 | /*----------------------------------------------------------------------------- |
9 | /*----------------------------------------------------------------------------- |
| 10 | * Includes |
10 | * Includes |
| 11 | *---------------------------------------------------------------------------*/ |
11 | *---------------------------------------------------------------------------*/ |
| 12 | #include <inttypes.h> |
12 | #include <inttypes.h> |
| 13 | #include <drivers/can/canid.h> |
13 | #include <drivers/can/canid.h> |
| 14 | 14 | ||
| 15 | /*----------------------------------------------------------------------------- |
15 | /*----------------------------------------------------------------------------- |
| 16 | * Type Definitions |
16 | * Type Definitions |
| 17 | *---------------------------------------------------------------------------*/ |
17 | *---------------------------------------------------------------------------*/ |
| 18 | 18 | ||
| 19 | /** |
19 | /** |
| 20 | * CAN Return Type. Most CAN functions return one of these. |
20 | * CAN Return Type. Most CAN functions return one of these. |
| 21 | */ |
21 | */ |
| 22 | typedef enum { |
22 | typedef enum { |
| 23 | CAN_FAIL = -1, /* The function failed */ |
23 | CAN_FAIL = -1, /* The function failed */ |
| 24 | CAN_OK = 1, /* The function succeeded */ |
24 | CAN_OK = 1, /* The function succeeded */ |
| 25 | 25 | ||
| 26 | CAN_MSG_AVAILABLE = 2, /* Messsages are available */ |
26 | CAN_MSG_AVAILABLE = 2, /* Messsages are available */ |
| 27 | CAN_NO_MSG_AVAILABLE = -2, /* Messages are NOT available */ |
27 | CAN_NO_MSG_AVAILABLE = -2, /* Messages are NOT available */ |
| 28 | 28 | ||
| 29 | //CAN_CTRLERROR = -4 |
29 | //CAN_CTRLERROR = -4 |
| 30 | } Can_Return_t; |
30 | } Can_Return_t; |
| 31 | 31 | ||
| 32 | /** |
32 | /** |
| 33 | * CAN Message Type. Stores a complete CAN frame. |
33 | * CAN Message Type. Stores a complete CAN frame. |
| 34 | */ |
34 | */ |
| 35 | typedef struct { |
35 | typedef struct { |
| 36 | /* |
36 | /* |
| 37 | * ID section. Contains either 29bit ID or 11bit ID (depending on ExtendedFlag). |
37 | * ID section. Contains either 29bit ID or 11bit ID (depending on ExtendedFlag). |
| 38 | */ |
38 | */ |
| 39 | uint32_t Id; |
39 | uint32_t Id; |
| 40 | 40 | ||
| 41 | /* |
41 | /* |
| 42 | * DLC section. Contains the data length expressed in number of bytes. Range [0,8]. |
42 | * DLC section. Contains the data length expressed in number of bytes. Range [0,8]. |
| 43 | */ |
43 | */ |
| 44 | uint8_t DataLength; |
44 | uint8_t DataLength; |
| 45 | 45 | ||
| 46 | /** |
46 | /** |
| 47 | * Extended frame flag. Set to 1 if the ID is 29bit, or 0 if it is 11bit. |
47 | * Extended frame flag. Set to 1 if the ID is 29bit, or 0 if it is 11bit. |
| 48 | */ |
48 | */ |
| 49 | uint8_t ExtendedFlag; |
49 | uint8_t ExtendedFlag; |
| 50 | 50 | ||
| 51 | /** |
51 | /** |
| 52 | * Remote frame flag. Set to 1 if the frame is a remote frame. 0 otherwise. |
52 | * Remote frame flag. Set to 1 if the frame is a remote frame. 0 otherwise. |
| 53 | */ |
53 | */ |
| 54 | uint8_t RemoteFlag; |
54 | uint8_t RemoteFlag; |
| 55 | 55 | ||
| 56 | /* |
56 | /* |
| 57 | * DATA section. Contains the 8 data bytes. |
57 | * DATA section. Contains the 8 data bytes. |
| 58 | */ |
58 | */ |
| 59 | union { |
59 | union { |
| 60 | /* read as 8bit unsigned data */ |
60 | /* read as 8bit unsigned data */ |
| 61 | uint8_t bytes[8]; |
61 | uint8_t bytes[8]; |
| 62 | 62 | ||
| 63 | /* read as 16bit unsigned data */ |
63 | /* read as 16bit unsigned data */ |
| 64 | uint16_t words[4]; |
64 | uint16_t words[4]; |
| 65 | 65 | ||
| 66 | /* read as 32bit unsigned data */ |
66 | /* read as 32bit unsigned data */ |
| 67 | uint32_t dwords[2]; |
67 | uint32_t dwords[2]; |
| 68 | } Data; |
68 | } Data; |
| 69 | } Can_Message_t; |
69 | } Can_Message_t; |
| 70 | 70 | ||
| 71 | #endif /*CAN_H_*/ |
71 | #endif /*CAN_H_*/ |
| 72 | //--------------------------------------------------------------------------- |
72 | //--------------------------------------------------------------------------- |
| 73 | // Public declarations for the exported interface |
73 | // Public declarations for the exported interface |
| 74 | 74 | ||
| 75 | void BIOS_Reset(void); |
75 | void BIOS_Reset(void); |
| 76 | Can_Return_t BIOS_CanSend(Can_Message_t* msg); |
76 | Can_Return_t BIOS_CanSend(Can_Message_t* msg); |
| 77 | void (*BIOS_CanCallback)(Can_Message_t *msg); |
77 | void (*BIOS_CanCallback)(Can_Message_t *msg); |
| 78 | 78 | ||
| 79 | #endif /*BIOS_H_*/ |
79 | #endif /*BIOS_H_*/ |
| 80 | 80 | ||