Rev 1205 | Rev 2029 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 1205 | Rev 1909 | ||
|---|---|---|---|
| Line 114... | Line 114... | ||
| 114 | else |
114 | else |
| 115 | retval = StdCan_Ret_Fail; |
115 | retval = StdCan_Ret_Fail; |
| 116 | #endif |
116 | #endif |
| 117 | 117 | ||
| 118 | //TODO: Do something with the Node Descriptor. |
118 | //TODO: Do something with the Node Descriptor. |
| 119 | //(why have |
119 | //(why have constants passed as parameters? they are defined at compiletime /arune) |
| 120 | #if defined(_AVRLIB_BIOS_) |
120 | #if defined(_AVRLIB_BIOS_) |
| 121 | /* TODO: When a Tx queue is implemented, the startup message should |
121 | /* TODO: When a Tx queue is implemented, the startup message should |
| 122 | * be sent via StdCan_Put instead of directly to lower layer. |
122 | * be sent via StdCan_Put instead of directly to lower layer. |
| 123 | */ |
123 | */ |
| 124 | Can_Message_t Startup; |
124 | Can_Message_t Startup; |
| Line 127... | Line 127... | ||
| 127 | Startup.ExtendedFlag = 1; |
127 | Startup.ExtendedFlag = 1; |
| 128 | Startup.RemoteFlag = 0; |
128 | Startup.RemoteFlag = 0; |
| 129 | Startup.DataLength = 4; |
129 | Startup.DataLength = 4; |
| 130 | #ifdef MODULE_APPLICATION |
130 | #ifdef MODULE_APPLICATION |
| 131 | Startup.Id = (CAN_NMT << CAN_SHIFT_CLASS) | (CAN_NMT_APP_START << CAN_SHIFT_NMT_TYPE); |
131 | Startup.Id = (CAN_NMT << CAN_SHIFT_CLASS) | (CAN_NMT_APP_START << CAN_SHIFT_NMT_TYPE); |
| 132 | Startup.Data.bytes[0] = |
132 | Startup.Data.bytes[0] = BIOS_GetHwId()&0xff; |
| 133 | Startup.Data.bytes[1] = ( |
133 | Startup.Data.bytes[1] = (BIOS_GetHwId()>>8)&0xff; |
| 134 | Startup.Data.bytes[2] = ( |
134 | Startup.Data.bytes[2] = (BIOS_GetHwId()>>16)&0xff; |
| 135 | Startup.Data.bytes[3] = ( |
135 | Startup.Data.bytes[3] = (BIOS_GetHwId()>>24)&0xff; |
| 136 | #else |
136 | #else |
| 137 | Startup.Id = (CAN_NMT_APP_START << CAN_SHIFT_NMT_TYPE) | (NODE_ID << CAN_SHIFT_NMT_SID); |
137 | Startup.Id = (CAN_NMT_APP_START << CAN_SHIFT_NMT_TYPE) | (NODE_ID << CAN_SHIFT_NMT_SID); |
| 138 | Startup.Data.bytes[1] = APP_TYPE&0xff; |
138 | Startup.Data.bytes[1] = APP_TYPE&0xff; |
| 139 | Startup.Data.bytes[0] = (APP_TYPE>>8)&0xff; |
139 | Startup.Data.bytes[0] = (APP_TYPE>>8)&0xff; |
| 140 | Startup.Data.bytes[3] = APP_VERSION&0xff; |
140 | Startup.Data.bytes[3] = APP_VERSION&0xff; |
| Line 222... | Line 222... | ||
| 222 | Heartbeat.ExtendedFlag = 1; |
222 | Heartbeat.ExtendedFlag = 1; |
| 223 | Heartbeat.RemoteFlag = 0; |
223 | Heartbeat.RemoteFlag = 0; |
| 224 | #ifdef MODULE_APPLICATION |
224 | #ifdef MODULE_APPLICATION |
| 225 | Heartbeat.DataLength = 5; |
225 | Heartbeat.DataLength = 5; |
| 226 | Heartbeat.Id = (CAN_NMT << CAN_SHIFT_CLASS) | (CAN_NMT_HEARTBEAT << CAN_SHIFT_NMT_TYPE); |
226 | Heartbeat.Id = (CAN_NMT << CAN_SHIFT_CLASS) | (CAN_NMT_HEARTBEAT << CAN_SHIFT_NMT_TYPE); |
| - | 227 | uint32_t HwId=BIOS_GetHwId(); |
|
| 227 | Heartbeat.Data.bytes[0] = |
228 | Heartbeat.Data.bytes[0] = HwId&0xff; |
| 228 | Heartbeat.Data.bytes[1] = |
229 | Heartbeat.Data.bytes[1] = (HwId>>8)&0xff; |
| 229 | Heartbeat.Data.bytes[2] = |
230 | Heartbeat.Data.bytes[2] = (HwId>>16)&0xff; |
| 230 | Heartbeat.Data.bytes[3] = |
231 | Heartbeat.Data.bytes[3] = (HwId>>24)&0xff; |
| 231 | Heartbeat.Data.bytes[4] = NUMBER_OF_MODULES; |
232 | Heartbeat.Data.bytes[4] = NUMBER_OF_MODULES; |
| 232 | #else |
233 | #else |
| 233 | 234 | ||
| 234 | 235 | ||
| 235 | Heartbeat.DataLength = 0; |
236 | Heartbeat.DataLength = 0; |