Rev 867 | Details | Compare with Previous | Last modification | View Log | SVN | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 361 | andfri | 1 | #ifndef CANID_H_ |
| 2 | #define CANID_H_ |
||
| 3 | |||
| 4 | //--------------------------------------------------------------------------- |
||
| 5 | // CAN ID definitions |
||
| 6 | |||
| 7 | #define CAN_MASK_CLASS 0x1E000000 |
||
| 8 | #define CAN_SHIFT_CLASS 25 |
||
| 9 | //------------------------------------ |
||
| 804 | migan | 10 | #define CAN_NMT 0x00UL |
| 11 | #define CAN_MASK_NMT_TYPE 0x00FF0000 |
||
| 12 | #define CAN_SHIFT_NMT_TYPE 16 |
||
| 13 | #define CAN_MASK_NMT_SID 0x0000FF00 |
||
| 14 | #define CAN_SHIFT_NMT_SID 8 |
||
| 15 | #define CAN_MASK_NMT_RID 0x000000FF |
||
| 16 | #define CAN_SHIFT_NMT_RID 0 |
||
| 361 | andfri | 17 | #define CAN_NMT_TIME 0x00UL //D0:3 UNIX_TIME, D4:7 {YY:6, MM:4, DD:5, hh:5, mm:6, ss:6} |
| 18 | #define CAN_NMT_RESET 0x04UL |
||
| 804 | migan | 19 | #define CAN_NMT_BIOS_START 0x08UL //D0: VER7:0, D1:VER15:8, D2: 0 if no app, >0 if app |
| 20 | #define CAN_NMT_PGM_START 0x0CUL //D0: ADR7:0, D1:ADR15:8, D2:ADR23:16, D3:ADR31:24 |
||
| 21 | #define CAN_NMT_PGM_DATA 0x10UL //D0: OFS7:0, D1: OFS15:8, D(n+2): DATAn7:0 [n=0..x] [x=0..5] |
||
| 361 | andfri | 22 | #define CAN_NMT_PGM_END 0x14UL //D0: CRC7:0, D1: CRC15:8 |
| 804 | migan | 23 | #define CAN_NMT_PGM_COPY 0x18UL //D0: SRC7:0, D1:SRC15:8, D0: DST7:0, D1:DST15:8, D0: LEN7:0, D1:LEN15:8 |
| 361 | andfri | 24 | #define CAN_NMT_PGM_ACK 0x1CUL //D0: OFS7:0, D1: OFS15:8 |
| 804 | migan | 25 | #define CAN_NMT_PGM_NACK 0x20UL //D0: OFS7:0, D1: OFS15:8 |
| 26 | #define CAN_NMT_START_APP 0x24UL |
||
| 27 | #define CAN_NMT_APP_START 0x28UL //D0: ID7:0, D1:ID15:8, D2: VER7:0, D3:VER15:8 |
||
| 28 | #define CAN_NMT_HEARTBEAT 0x2CUL |
||
| 361 | andfri | 29 | //------------------------------------ |
| 804 | migan | 30 | |
| 31 | // This is old definitions, not needed for modulebased applications |
||
| 32 | #define CAN_SNS 0x02UL |
||
| 33 | #define CAN_MASK_SNS_TYPE 0x01FF8000 |
||
| 34 | #define CAN_SHIFT_SNS_TYPE 15 |
||
| 494 | arune | 35 | #define CAN_MASK_SNS_ID 0x00007E00 |
| 804 | migan | 36 | #define CAN_SHIFT_SNS_ID 9 |
| 37 | #define CAN_MASK_SNS_SID 0x000001FF |
||
| 38 | #define CAN_SHIFT_SNS_SID 0 |
||
| 39 | |||
| 40 | #define CAN_ACT 0x04UL |
||
| 41 | #define CAN_MASK_ACT_TYPE 0x01FF8000 |
||
| 42 | #define CAN_SHIFT_ACT_TYPE 15 |
||
| 494 | arune | 43 | #define CAN_MASK_ACT_ID 0x00007E00 |
| 804 | migan | 44 | #define CAN_SHIFT_ACT_ID 9 |
| 45 | #define CAN_MASK_ACT_SID 0x000001FF |
||
| 46 | #define CAN_SHIFT_ACT_SID 0 |
||
| 47 | |||
| 361 | andfri | 48 | #define CAN_PKT 0x06UL |
| 804 | migan | 49 | |
| 361 | andfri | 50 | #define CAN_CON 0x08UL |
| 804 | migan | 51 | |
| 361 | andfri | 52 | #define CAN_TST 0x0FUL |
| 804 | migan | 53 | //-------------------------------------------------------------------- |
| 361 | andfri | 54 | |
| 804 | migan | 55 | |
| 852 | migan | 56 | //--------------------------------------------------- // |
| 57 | // New class definitions for modulebased applications // |
||
| 58 | //--------------------------------------------------- // |
||
| 59 | |||
| 60 | // Module classes |
||
| 61 | //------------------------------------ |
||
| 804 | migan | 62 | #define CAN_CLASS_MODULE_NMT 0x0BUL // If we move the functionality for this to BIOS we should use CAN_NMT instead |
| 63 | #define CAN_CLASS_MODULE_ACT 0x0CUL |
||
| 64 | #define CAN_CLASS_MODULE_SNS 0x0DUL |
||
| 852 | migan | 65 | #define CAN_CLASS_MODULE_DEF 0x0EUL |
| 868 | migan | 66 | #define CAN_CLASS_MODULE_CON_OPEN 0x0FUL |
| 67 | #define CAN_CLASS_MODULE_CON 0x10UL |
||
| 852 | migan | 68 | |
| 69 | // Module frame direction |
||
| 801 | linlun | 70 | //------------------------------------ |
| 852 | migan | 71 | #define DIR_FROM_OWNER 1 // If a module sends a packet |
| 72 | #define DIR_TO_OWNER 0 // If a module sends a packet to another module |
||
| 804 | migan | 73 | |
| 852 | migan | 74 | // Module types |
| 801 | linlun | 75 | //------------------------------------ |
| 852 | migan | 76 | #define CAN_TYPE_MODULE_def_default 0x01 |
| 77 | #define CAN_TYPE_MODULE_sns_ds18x20 0x03 |
||
| 78 | #define CAN_TYPE_MODULE_sns_FOST02 0x05 |
||
| 79 | #define CAN_TYPE_MODULE_sns_BusVoltage 0x06 |
||
| 868 | migan | 80 | #define CAN_TYPE_MODULE_sns_SimpleDTMF 0x07 |
| 852 | migan | 81 | #define CAN_TYPE_MODULE_act_hd44789 0x04 |
| 831 | linlun | 82 | |
| 868 | migan | 83 | |
| 852 | migan | 84 | // Module commands |
| 85 | //------------------------------------ |
||
| 867 | linlun | 86 | //#define CAN_CMD_MODULE_NMT_LIST 0x00UL // Tell the application to report which modules it has |
| 801 | linlun | 87 | |
| 88 | |||
| 89 | |||
| 804 | migan | 90 | |
| 361 | andfri | 91 | //--------------------------------------------------------------------------- |
| 92 | // CAN ID definitions for NMT messages |
||
| 93 | |||
| 94 | #define CAN_ID_NMT_BIOS_START ((CAN_NMT << CAN_SHIFT_CLASS) \ |
||
| 804 | migan | 95 | | (CAN_NMT_BIOS_START << CAN_SHIFT_NMT_TYPE)) |
| 361 | andfri | 96 | #define CAN_ID_NMT_PGM_ACK ((CAN_NMT << CAN_SHIFT_CLASS) \ |
| 804 | migan | 97 | | (CAN_NMT_PGM_ACK << CAN_SHIFT_NMT_TYPE)) |
| 361 | andfri | 98 | #define CAN_ID_NMT_PGM_NACK ((CAN_NMT << CAN_SHIFT_CLASS) \ |
| 804 | migan | 99 | | (CAN_NMT_PGM_NACK << CAN_SHIFT_NMT_TYPE)) |
| 361 | andfri | 100 | |
| 487 | arune | 101 | #define CAN_APPTYPES_IRRECEIVER 0xf010 |
| 102 | #define CAN_APPTYPES_RELAY 0xf015 |
||
| 491 | eqlazer | 103 | #define CAN_APPTYPES_SERVO 0xf020 |
| 525 | arune | 104 | #define CAN_APPTYPES_SENSOR 0xf025 |
| 105 | #define CAN_APPTYPES_IRTRANSMITTER 0xf030 |
||
| 545 | noddan | 106 | #define CAN_APPTYPES_RGBLED 0xf035 |
| 735 | noddan | 107 | #define CAN_APPTYPES_FANCONTROLLER 0xf040 |
| 487 | arune | 108 | |
| 485 | arune | 109 | // CAN ID definitions for SNS messages |
| 648 | noddan | 110 | #define SNS_TYPE_STATUS 0x10L |
| 111 | #define SNS_TYPE_IR 0x12L |
||
| 112 | #define SNS_TYPE_TEMPERATURE 0x14L |
||
| 113 | #define SNS_TYPE_LIGHT 0x18L |
||
| 114 | #define SNS_TYPE_PHONENR 0x1aL |
||
| 115 | #define SNS_TYPE_PRESSURE 0x1bL |
||
| 116 | #define SNS_TYPE_VOLTAGE 0x1cL |
||
| 117 | #define SNS_TYPE_ROTSPEED 0x1dL |
||
| 652 | noddan | 118 | #define SNS_TYPE_VELOCITY 0x1eL |
| 119 | #define SNS_TYPE_FUELCONS 0x1fL |
||
| 440 | arune | 120 | |
| 619 | arune | 121 | |
| 525 | arune | 122 | #define SNS_ID_RELAY_STATUS 0x0BL |
| 123 | #define SNS_ID_SERVO_STATUS 0x0dL |
||
| 485 | arune | 124 | |
| 648 | noddan | 125 | //Definitions of precision of different sensors |
| 126 | #define SNS_DECPOINT_TEMPERATURE 0x04 |
||
| 127 | #define SNS_DECPOINT_PRESSURE 0x06 |
||
| 649 | noddan | 128 | #define SNS_DECPOINT_ROTSPEED 0x02 |
| 648 | noddan | 129 | #define SNS_DECPOINT_VOLTAGE 0x06 |
| 652 | noddan | 130 | #define SNS_DECPOINT_VELOCITY 0x02 |
| 131 | #define SNS_DECPOINT_FUELCONS 0x06 |
||
| 485 | arune | 132 | |
| 525 | arune | 133 | |
| 485 | arune | 134 | // CAN ID definitions for ACT messages |
| 735 | noddan | 135 | #define ACT_TYPE_RELAY 0x01L |
| 136 | #define ACT_TYPE_SERVO 0x02L |
||
| 137 | #define ACT_TYPE_RGBLED 0x03L |
||
| 138 | #define ACT_TYPE_IR 0x04L |
||
| 139 | #define ACT_TYPE_LCD 0x05L |
||
| 140 | #define ACT_TYPE_FAN 0x06L |
||
| 598 | arune | 141 | |
| 606 | noddan | 142 | |
| 143 | |||
| 361 | andfri | 144 | #endif /*CANID_H_*/ |