Program the control the fischertechnik robo interface or intelligent interface via tcp socket or via a java gui.
ROBO_TX_FW.h@0:7f26f0680202, 2010-12-31 (annotated)
- Committer:
- networker
- Date:
- Fri Dec 31 14:01:14 2010 +0000
- Revision:
- 0:7f26f0680202
initial release: comprises ftlib (no usb), ft-over-ip socket server, and the http server (the html page and java jar I still have to publish somewhere)
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
networker | 0:7f26f0680202 | 1 | //============================================================================= |
networker | 0:7f26f0680202 | 2 | // Description | Header file with definition of the software interface |
networker | 0:7f26f0680202 | 3 | // | to the ROBO TX Controller firmware. |
networker | 0:7f26f0680202 | 4 | // | Can be used for building C-programs which can run |
networker | 0:7f26f0680202 | 5 | // | under control of the ROBO TX Controller firmware in |
networker | 0:7f26f0680202 | 6 | // | download (local) mode or for building PC-programs which |
networker | 0:7f26f0680202 | 7 | // | can communicate with the ROBO TX Controller firmware in |
networker | 0:7f26f0680202 | 8 | // | online mode. |
networker | 0:7f26f0680202 | 9 | // | |
networker | 0:7f26f0680202 | 10 | // Copyright | � 2009 MSC Vertriebs GmbH, Germany. |
networker | 0:7f26f0680202 | 11 | // | |
networker | 0:7f26f0680202 | 12 | // | This software is distributed in the hope that it will be useful, |
networker | 0:7f26f0680202 | 13 | // | but WITHOUT ANY WARRANTY; without even the implied warranty of |
networker | 0:7f26f0680202 | 14 | // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
networker | 0:7f26f0680202 | 15 | //============================================================================= |
networker | 0:7f26f0680202 | 16 | |
networker | 0:7f26f0680202 | 17 | #ifndef __ROBO_TX_FW_H__ |
networker | 0:7f26f0680202 | 18 | #define __ROBO_TX_FW_H__ |
networker | 0:7f26f0680202 | 19 | |
networker | 0:7f26f0680202 | 20 | |
networker | 0:7f26f0680202 | 21 | #define N_CNT 4 // number of counters |
networker | 0:7f26f0680202 | 22 | #define N_PWM_CHAN 8 // number of PWM channels |
networker | 0:7f26f0680202 | 23 | #define N_MOTOR 4 // number of motors |
networker | 0:7f26f0680202 | 24 | #define N_UNI 8 // number of universal inputs |
networker | 0:7f26f0680202 | 25 | |
networker | 0:7f26f0680202 | 26 | // 5kOhm range |
networker | 0:7f26f0680202 | 27 | #define R_MIN 10 // [Ohm] |
networker | 0:7f26f0680202 | 28 | #define R_MAX 4999 // [Ohm] |
networker | 0:7f26f0680202 | 29 | #define R_OVR 5000 // [Ohm] overload |
networker | 0:7f26f0680202 | 30 | |
networker | 0:7f26f0680202 | 31 | // 10V range |
networker | 0:7f26f0680202 | 32 | #define U_MIN 0 // [mV] |
networker | 0:7f26f0680202 | 33 | #define U_MAX 9999 // [mV] |
networker | 0:7f26f0680202 | 34 | #define U_OVR 10000 // [mV] overload |
networker | 0:7f26f0680202 | 35 | |
networker | 0:7f26f0680202 | 36 | // Ultrasonic Sensor range |
networker | 0:7f26f0680202 | 37 | #define ULTRASONIC_MIN 2 // [cm] |
networker | 0:7f26f0680202 | 38 | #define ULTRASONIC_MAX 1023 // [cm] |
networker | 0:7f26f0680202 | 39 | #define ULTRASONIC_OVR 1024 // [cm] overload |
networker | 0:7f26f0680202 | 40 | #define NO_ULTRASONIC 4096 // not present |
networker | 0:7f26f0680202 | 41 | |
networker | 0:7f26f0680202 | 42 | // Motor outputs PWM values range |
networker | 0:7f26f0680202 | 43 | #define DUTY_MIN 0 |
networker | 0:7f26f0680202 | 44 | #define DUTY_MAX 512 |
networker | 0:7f26f0680202 | 45 | |
networker | 0:7f26f0680202 | 46 | // Length of strings |
networker | 0:7f26f0680202 | 47 | #define DEV_NAME_LEN_MAX 16 // "ROBO TX-xxxxxxxx" |
networker | 0:7f26f0680202 | 48 | #define BLUETOOTH_ADDR_LEN 17 // "xx:xx:xx:xx:xx:xx" |
networker | 0:7f26f0680202 | 49 | #define DISPL_MSG_LEN_MAX 64 // max length of a pop-up display message |
networker | 0:7f26f0680202 | 50 | |
networker | 0:7f26f0680202 | 51 | |
networker | 0:7f26f0680202 | 52 | // Identifiers of the Transfer Area |
networker | 0:7f26f0680202 | 53 | enum ta_id_e |
networker | 0:7f26f0680202 | 54 | { |
networker | 0:7f26f0680202 | 55 | TA_LOCAL = 0, // Transfer Area for local Controller. Corresponds to the Controller |
networker | 0:7f26f0680202 | 56 | // on which program is currently running in download (local) mode or |
networker | 0:7f26f0680202 | 57 | // to the remotely controlled Controller (seen from controlled device, |
networker | 0:7f26f0680202 | 58 | // not from controlling device) in online mode. |
networker | 0:7f26f0680202 | 59 | TA_EXT_1, // Transfer Area for Extension 1 Controller |
networker | 0:7f26f0680202 | 60 | TA_EXT_2, // Transfer Area for Extension 2 Controller |
networker | 0:7f26f0680202 | 61 | TA_EXT_3, // Transfer Area for Extension 3 Controller |
networker | 0:7f26f0680202 | 62 | TA_EXT_4, // Transfer Area for Extension 4 Controller |
networker | 0:7f26f0680202 | 63 | TA_EXT_5, // Transfer Area for Extension 5 Controller |
networker | 0:7f26f0680202 | 64 | TA_EXT_6, // Transfer Area for Extension 6 Controller |
networker | 0:7f26f0680202 | 65 | TA_EXT_7, // Transfer Area for Extension 7 Controller |
networker | 0:7f26f0680202 | 66 | TA_EXT_8, // Transfer Area for Extension 8 Controller |
networker | 0:7f26f0680202 | 67 | TA_COUNT // Number of Transfer Areas in array = 9 |
networker | 0:7f26f0680202 | 68 | }; |
networker | 0:7f26f0680202 | 69 | |
networker | 0:7f26f0680202 | 70 | #define N_EXT (TA_COUNT - 1) // Number of extension Controllers = 8 |
networker | 0:7f26f0680202 | 71 | |
networker | 0:7f26f0680202 | 72 | |
networker | 0:7f26f0680202 | 73 | // Device (Controller) functioning modes |
networker | 0:7f26f0680202 | 74 | enum dev_mode_e |
networker | 0:7f26f0680202 | 75 | { |
networker | 0:7f26f0680202 | 76 | DEV_MODE_LOCAL = 0, |
networker | 0:7f26f0680202 | 77 | DEV_MODE_ONLINE, |
networker | 0:7f26f0680202 | 78 | DEV_MODE_INVALID |
networker | 0:7f26f0680202 | 79 | }; |
networker | 0:7f26f0680202 | 80 | |
networker | 0:7f26f0680202 | 81 | |
networker | 0:7f26f0680202 | 82 | // State of connection to an extension device (Controller) |
networker | 0:7f26f0680202 | 83 | enum ext_dev_connect_state_e |
networker | 0:7f26f0680202 | 84 | { |
networker | 0:7f26f0680202 | 85 | EXT_DEV_OFFLINE = 0, |
networker | 0:7f26f0680202 | 86 | EXT_DEV_ONLINE, |
networker | 0:7f26f0680202 | 87 | EXT_DEV_INVALID |
networker | 0:7f26f0680202 | 88 | }; |
networker | 0:7f26f0680202 | 89 | |
networker | 0:7f26f0680202 | 90 | |
networker | 0:7f26f0680202 | 91 | // Modes of universal inputs |
networker | 0:7f26f0680202 | 92 | enum input_mode_e |
networker | 0:7f26f0680202 | 93 | { |
networker | 0:7f26f0680202 | 94 | MODE_U = 0, |
networker | 0:7f26f0680202 | 95 | MODE_R = 1, |
networker | 0:7f26f0680202 | 96 | MODE_ULTRASONIC = 3, |
networker | 0:7f26f0680202 | 97 | MODE_INVALID |
networker | 0:7f26f0680202 | 98 | }; |
networker | 0:7f26f0680202 | 99 | |
networker | 0:7f26f0680202 | 100 | |
networker | 0:7f26f0680202 | 101 | // Program states |
networker | 0:7f26f0680202 | 102 | enum pgm_state_e |
networker | 0:7f26f0680202 | 103 | { |
networker | 0:7f26f0680202 | 104 | PGM_STATE_INVALID = 0, |
networker | 0:7f26f0680202 | 105 | PGM_STATE_RUN, |
networker | 0:7f26f0680202 | 106 | PGM_STATE_STOP |
networker | 0:7f26f0680202 | 107 | }; |
networker | 0:7f26f0680202 | 108 | |
networker | 0:7f26f0680202 | 109 | |
networker | 0:7f26f0680202 | 110 | // Timer units for GetSystemTime hook function |
networker | 0:7f26f0680202 | 111 | enum TimerUnit |
networker | 0:7f26f0680202 | 112 | { |
networker | 0:7f26f0680202 | 113 | TIMER_UNIT_INVALID = 0, |
networker | 0:7f26f0680202 | 114 | TIMER_UNIT_SECONDS = 2, |
networker | 0:7f26f0680202 | 115 | TIMER_UNIT_MILLISECONDS = 3, |
networker | 0:7f26f0680202 | 116 | TIMER_UNIT_MICROSECONDS = 4 |
networker | 0:7f26f0680202 | 117 | }; |
networker | 0:7f26f0680202 | 118 | |
networker | 0:7f26f0680202 | 119 | |
networker | 0:7f26f0680202 | 120 | //============================================================================= |
networker | 0:7f26f0680202 | 121 | // Structures for Transfer Area (TA) |
networker | 0:7f26f0680202 | 122 | //============================================================================= |
networker | 0:7f26f0680202 | 123 | |
networker | 0:7f26f0680202 | 124 | |
networker | 0:7f26f0680202 | 125 | // Program information, 8 bytes |
networker | 0:7f26f0680202 | 126 | typedef struct |
networker | 0:7f26f0680202 | 127 | { |
networker | 0:7f26f0680202 | 128 | char * name; // Name of a program with a full path, for example, "/ramdisk/Program_1" |
networker | 0:7f26f0680202 | 129 | UINT8 state; // enum pgm_state_e |
networker | 0:7f26f0680202 | 130 | char reserved[3]; |
networker | 0:7f26f0680202 | 131 | } PGM_INFO; |
networker | 0:7f26f0680202 | 132 | |
networker | 0:7f26f0680202 | 133 | |
networker | 0:7f26f0680202 | 134 | // Display message, 36 bytes. Used to show pop-up message box on the boards display |
networker | 0:7f26f0680202 | 135 | typedef struct |
networker | 0:7f26f0680202 | 136 | { |
networker | 0:7f26f0680202 | 137 | unsigned char id; // Should be increased by 1 each time a new pop-up message is to be shown |
networker | 0:7f26f0680202 | 138 | char text[DISPL_MSG_LEN_MAX + 1]; |
networker | 0:7f26f0680202 | 139 | char reserved[2]; |
networker | 0:7f26f0680202 | 140 | } DISPLAY_MSG; |
networker | 0:7f26f0680202 | 141 | |
networker | 0:7f26f0680202 | 142 | |
networker | 0:7f26f0680202 | 143 | // Display frame, 8 bytes. Used to refresh boards display with a bitmap image frame |
networker | 0:7f26f0680202 | 144 | typedef struct |
networker | 0:7f26f0680202 | 145 | { |
networker | 0:7f26f0680202 | 146 | unsigned char * frame; // Contents of a frame as a 128x64 pixels bitmap |
networker | 0:7f26f0680202 | 147 | UINT16 id; // Should be increased by 1 each time a new display frame is to be shown |
networker | 0:7f26f0680202 | 148 | BOOL16 is_pgm_master_of_display; // ++ if program wants to have control over display, |
networker | 0:7f26f0680202 | 149 | // i.e. image frame is displayed over firmware menus; |
networker | 0:7f26f0680202 | 150 | // -- if program wants to return control over display |
networker | 0:7f26f0680202 | 151 | // to the firmware menus |
networker | 0:7f26f0680202 | 152 | } DISPLAY_FRAME; |
networker | 0:7f26f0680202 | 153 | |
networker | 0:7f26f0680202 | 154 | |
networker | 0:7f26f0680202 | 155 | // Version structure definition, 4 bytes |
networker | 0:7f26f0680202 | 156 | typedef union |
networker | 0:7f26f0680202 | 157 | { |
networker | 0:7f26f0680202 | 158 | unsigned long abcd; |
networker | 0:7f26f0680202 | 159 | struct |
networker | 0:7f26f0680202 | 160 | { |
networker | 0:7f26f0680202 | 161 | unsigned char a; |
networker | 0:7f26f0680202 | 162 | unsigned char b; |
networker | 0:7f26f0680202 | 163 | unsigned char c; |
networker | 0:7f26f0680202 | 164 | unsigned char d; |
networker | 0:7f26f0680202 | 165 | } part; |
networker | 0:7f26f0680202 | 166 | } FT_VER; |
networker | 0:7f26f0680202 | 167 | |
networker | 0:7f26f0680202 | 168 | |
networker | 0:7f26f0680202 | 169 | // Versions of hardware and firmware components, 16 bytes |
networker | 0:7f26f0680202 | 170 | typedef struct |
networker | 0:7f26f0680202 | 171 | { |
networker | 0:7f26f0680202 | 172 | FT_VER hardware; // Version of hardware (hardware.part.a = 'A' or 'B' or 'C') |
networker | 0:7f26f0680202 | 173 | FT_VER firmware; // Version of firmware ("V %d.%02d, DLL %d", firmware.part.c, |
networker | 0:7f26f0680202 | 174 | // firmware.part.d, firmware.part.b) |
networker | 0:7f26f0680202 | 175 | FT_VER ta; // Version of transfer area ("V %d.%02d", ta.part.c, ta.part.d) |
networker | 0:7f26f0680202 | 176 | char reserved[4]; |
networker | 0:7f26f0680202 | 177 | } FT_VERSION; |
networker | 0:7f26f0680202 | 178 | |
networker | 0:7f26f0680202 | 179 | |
networker | 0:7f26f0680202 | 180 | // Info structure, 64 bytes |
networker | 0:7f26f0680202 | 181 | typedef struct |
networker | 0:7f26f0680202 | 182 | { |
networker | 0:7f26f0680202 | 183 | char device_name[DEV_NAME_LEN_MAX + 1]; // Controller name |
networker | 0:7f26f0680202 | 184 | char bt_addr[BLUETOOTH_ADDR_LEN + 1]; // Bluetooth address as a string |
networker | 0:7f26f0680202 | 185 | char reserved; |
networker | 0:7f26f0680202 | 186 | unsigned long ta_array_start_addr; |
networker | 0:7f26f0680202 | 187 | unsigned long pgm_area_start_addr; |
networker | 0:7f26f0680202 | 188 | unsigned long pgm_area_size; |
networker | 0:7f26f0680202 | 189 | FT_VERSION version; |
networker | 0:7f26f0680202 | 190 | } TA_INFO; |
networker | 0:7f26f0680202 | 191 | |
networker | 0:7f26f0680202 | 192 | |
networker | 0:7f26f0680202 | 193 | // State structure, 36 bytes |
networker | 0:7f26f0680202 | 194 | typedef struct |
networker | 0:7f26f0680202 | 195 | { |
networker | 0:7f26f0680202 | 196 | // Used by local program |
networker | 0:7f26f0680202 | 197 | BOOL8 pgm_initialized; |
networker | 0:7f26f0680202 | 198 | char reserved_1[7]; |
networker | 0:7f26f0680202 | 199 | |
networker | 0:7f26f0680202 | 200 | // Public state info |
networker | 0:7f26f0680202 | 201 | BOOL8 dev_mode; // enum dev_mode_e |
networker | 0:7f26f0680202 | 202 | UCHAR8 id; // Should be increased by 1 each time something (except id fields) |
networker | 0:7f26f0680202 | 203 | // is changed in this state structure |
networker | 0:7f26f0680202 | 204 | UCHAR8 info_id; // Should be increased by 1 each time something is changed in info structure |
networker | 0:7f26f0680202 | 205 | UCHAR8 config_id; // Should be increased by 1 each time something is changed in config structure |
networker | 0:7f26f0680202 | 206 | BOOL8 ext_dev_connect_state[N_EXT]; // enum ext_dev_connect_state_e |
networker | 0:7f26f0680202 | 207 | char reserved_2[8]; |
networker | 0:7f26f0680202 | 208 | PGM_INFO local_pgm; // Corresponds to the program currently being in the program memory |
networker | 0:7f26f0680202 | 209 | } TA_STATE; |
networker | 0:7f26f0680202 | 210 | |
networker | 0:7f26f0680202 | 211 | |
networker | 0:7f26f0680202 | 212 | // Universal inputs configuration, 4 bytes |
networker | 0:7f26f0680202 | 213 | typedef struct |
networker | 0:7f26f0680202 | 214 | { |
networker | 0:7f26f0680202 | 215 | UINT8 mode; // enum input_mode_e |
networker | 0:7f26f0680202 | 216 | BOOL8 digital; // FALSE = analog input, TRUE = digital input |
networker | 0:7f26f0680202 | 217 | unsigned char reserved[2]; |
networker | 0:7f26f0680202 | 218 | } UNI_CONFIG; |
networker | 0:7f26f0680202 | 219 | |
networker | 0:7f26f0680202 | 220 | |
networker | 0:7f26f0680202 | 221 | // Counter inputs configuration, 4 bytes |
networker | 0:7f26f0680202 | 222 | typedef struct |
networker | 0:7f26f0680202 | 223 | { |
networker | 0:7f26f0680202 | 224 | UINT8 mode; // 0 = normal counter mode (change 0 -> 1 is counted) |
networker | 0:7f26f0680202 | 225 | // 1 = inverse counter mode (change 1 -> 0 is counted) |
networker | 0:7f26f0680202 | 226 | unsigned char reserved[3]; |
networker | 0:7f26f0680202 | 227 | } CNT_CONFIG; |
networker | 0:7f26f0680202 | 228 | |
networker | 0:7f26f0680202 | 229 | |
networker | 0:7f26f0680202 | 230 | // Config structure, 88 bytes |
networker | 0:7f26f0680202 | 231 | typedef struct |
networker | 0:7f26f0680202 | 232 | { |
networker | 0:7f26f0680202 | 233 | UINT8 pgm_state_req; // enum pgm_state_e, program state change request |
networker | 0:7f26f0680202 | 234 | char reserved_1[3]; |
networker | 0:7f26f0680202 | 235 | BOOL8 motor[N_MOTOR]; // TRUE = corresponding outputs are used as a pair of motor outputs M1...M4, |
networker | 0:7f26f0680202 | 236 | // FALSE = corresponding outputs are used as a pair of separate digital |
networker | 0:7f26f0680202 | 237 | // PWM outputs O1...O8 |
networker | 0:7f26f0680202 | 238 | UNI_CONFIG uni[N_UNI]; |
networker | 0:7f26f0680202 | 239 | CNT_CONFIG cnt[N_CNT]; |
networker | 0:7f26f0680202 | 240 | char reserved_2[32]; |
networker | 0:7f26f0680202 | 241 | } TA_CONFIG; |
networker | 0:7f26f0680202 | 242 | |
networker | 0:7f26f0680202 | 243 | |
networker | 0:7f26f0680202 | 244 | // Input structure, 44 bytes |
networker | 0:7f26f0680202 | 245 | typedef struct |
networker | 0:7f26f0680202 | 246 | { |
networker | 0:7f26f0680202 | 247 | INT16 uni[N_UNI]; // Current values of the universal inputs |
networker | 0:7f26f0680202 | 248 | INT16 cnt_in[N_CNT]; // Current levels (0 or 1) on the counter inputs according |
networker | 0:7f26f0680202 | 249 | // to their configuration (normal or inverse) |
networker | 0:7f26f0680202 | 250 | INT16 counter[N_CNT]; // Current values of the counter inputs |
networker | 0:7f26f0680202 | 251 | INT16 display_button_left; // Number of milliseconds during which the left display button |
networker | 0:7f26f0680202 | 252 | // is being kept pressed |
networker | 0:7f26f0680202 | 253 | INT16 display_button_right; // Number of milliseconds during which the right display button |
networker | 0:7f26f0680202 | 254 | // is being kept pressed |
networker | 0:7f26f0680202 | 255 | INT16 motor_pos_reached[N_MOTOR]; // Set to 1 by motor control if target position |
networker | 0:7f26f0680202 | 256 | // (distance from output structure) is reached |
networker | 0:7f26f0680202 | 257 | } TA_INPUT; |
networker | 0:7f26f0680202 | 258 | |
networker | 0:7f26f0680202 | 259 | |
networker | 0:7f26f0680202 | 260 | // Output structure, 36 bytes |
networker | 0:7f26f0680202 | 261 | typedef struct |
networker | 0:7f26f0680202 | 262 | { |
networker | 0:7f26f0680202 | 263 | BOOL8 cnt_reset[N_CNT]; // Counter reset requests |
networker | 0:7f26f0680202 | 264 | UINT8 master[N_MOTOR]; // If not 0, synchronize this channel with the given channel |
networker | 0:7f26f0680202 | 265 | // (1:channel 0, ...) |
networker | 0:7f26f0680202 | 266 | INT16 duty[N_PWM_CHAN]; // Selected motor outputs PWM values |
networker | 0:7f26f0680202 | 267 | UINT16 distance[N_MOTOR]; // Selected distance (counter value) at which motor shall stop |
networker | 0:7f26f0680202 | 268 | char reserved[4]; |
networker | 0:7f26f0680202 | 269 | } TA_OUTPUT; |
networker | 0:7f26f0680202 | 270 | |
networker | 0:7f26f0680202 | 271 | |
networker | 0:7f26f0680202 | 272 | // Display structure, 44 bytes |
networker | 0:7f26f0680202 | 273 | typedef struct |
networker | 0:7f26f0680202 | 274 | { |
networker | 0:7f26f0680202 | 275 | DISPLAY_MSG display_msg; |
networker | 0:7f26f0680202 | 276 | DISPLAY_FRAME display_frame; |
networker | 0:7f26f0680202 | 277 | } TA_DISPLAY; |
networker | 0:7f26f0680202 | 278 | |
networker | 0:7f26f0680202 | 279 | |
networker | 0:7f26f0680202 | 280 | // Change structure (only for ftMscLib), 8 bytes |
networker | 0:7f26f0680202 | 281 | typedef struct |
networker | 0:7f26f0680202 | 282 | { |
networker | 0:7f26f0680202 | 283 | char reserved_1[2]; |
networker | 0:7f26f0680202 | 284 | UINT8 ChangeStatus; // TRUE = there was a change in any of the following fields |
networker | 0:7f26f0680202 | 285 | UINT8 ChangeUni; // There was a change of the input value (bit 0 = I1, bit 1 = I2, ...) |
networker | 0:7f26f0680202 | 286 | UINT8 ChangeCntIn; // There was a change of the counter level (bit 0 = C1, bit 1 = C2, ...) |
networker | 0:7f26f0680202 | 287 | UINT8 ChangeCounter; // There was a change of the counter value (bit 0 = C1, bit 1 = C2, ...) |
networker | 0:7f26f0680202 | 288 | char reserved_2[2]; |
networker | 0:7f26f0680202 | 289 | } TA_CHANGE; |
networker | 0:7f26f0680202 | 290 | |
networker | 0:7f26f0680202 | 291 | |
networker | 0:7f26f0680202 | 292 | // 16-bit timers, 12 bytes |
networker | 0:7f26f0680202 | 293 | typedef struct |
networker | 0:7f26f0680202 | 294 | { |
networker | 0:7f26f0680202 | 295 | UINT16 Timer1ms; |
networker | 0:7f26f0680202 | 296 | UINT16 Timer10ms; |
networker | 0:7f26f0680202 | 297 | UINT16 Timer100ms; |
networker | 0:7f26f0680202 | 298 | UINT16 Timer1s; |
networker | 0:7f26f0680202 | 299 | UINT16 Timer10s; |
networker | 0:7f26f0680202 | 300 | UINT16 Timer1min; |
networker | 0:7f26f0680202 | 301 | } TA_TIMER; |
networker | 0:7f26f0680202 | 302 | |
networker | 0:7f26f0680202 | 303 | |
networker | 0:7f26f0680202 | 304 | struct ta_s; |
networker | 0:7f26f0680202 | 305 | |
networker | 0:7f26f0680202 | 306 | // Hook table with pointers to the firmware functions, |
networker | 0:7f26f0680202 | 307 | // that can be called by local program, 16 bytes |
networker | 0:7f26f0680202 | 308 | typedef struct |
networker | 0:7f26f0680202 | 309 | { |
networker | 0:7f26f0680202 | 310 | // Informs the calling program if it can still run (return TRUE) or should |
networker | 0:7f26f0680202 | 311 | // immediately return to the firmware in order not to destroy the multitasking |
networker | 0:7f26f0680202 | 312 | // mechanism of the firmware (return FALSE). |
networker | 0:7f26f0680202 | 313 | BOOL32 (*IsRunAllowed) (void); |
networker | 0:7f26f0680202 | 314 | // Returns system time in seconds, milliseconds or microseconds depending on the |
networker | 0:7f26f0680202 | 315 | // parameter unit. |
networker | 0:7f26f0680202 | 316 | UINT32 (*GetSystemTime) (enum TimerUnit unit); |
networker | 0:7f26f0680202 | 317 | // Display pop-up message on the display of the ROBO TX Controller. If p_msg |
networker | 0:7f26f0680202 | 318 | // is NULL, then all pop-up messages are removed from the display and its cache, |
networker | 0:7f26f0680202 | 319 | // and the main frame is displayed. |
networker | 0:7f26f0680202 | 320 | void (*DisplayMsg) (struct ta_s * p_ta, char * p_msg); |
networker | 0:7f26f0680202 | 321 | // Returns TRUE if display is currently being refreshed. A program should in such a |
networker | 0:7f26f0680202 | 322 | // case wait until the display finishes its refreshing before sending new output to it. |
networker | 0:7f26f0680202 | 323 | BOOL32 (*IsDisplayBeingRefreshed) (struct ta_s * p_ta); |
networker | 0:7f26f0680202 | 324 | } TA_HOOK_TABLE; |
networker | 0:7f26f0680202 | 325 | |
networker | 0:7f26f0680202 | 326 | |
networker | 0:7f26f0680202 | 327 | |
networker | 0:7f26f0680202 | 328 | // ============================================================================ |
networker | 0:7f26f0680202 | 329 | // Transfer Area (TA) of ROBO TX Controller (one element of TA array) |
networker | 0:7f26f0680202 | 330 | // ============================================================================ |
networker | 0:7f26f0680202 | 331 | #define RESERVED_1_SIZE 4 |
networker | 0:7f26f0680202 | 332 | #define RESERVED_2_SIZE 28 |
networker | 0:7f26f0680202 | 333 | #define RESERVED_3_SIZE \ |
networker | 0:7f26f0680202 | 334 | (512 - ( \ |
networker | 0:7f26f0680202 | 335 | sizeof(TA_INFO) + \ |
networker | 0:7f26f0680202 | 336 | sizeof(TA_STATE) + \ |
networker | 0:7f26f0680202 | 337 | sizeof(TA_CONFIG) + \ |
networker | 0:7f26f0680202 | 338 | sizeof(TA_INPUT) + \ |
networker | 0:7f26f0680202 | 339 | sizeof(TA_OUTPUT) + \ |
networker | 0:7f26f0680202 | 340 | sizeof(TA_DISPLAY) + \ |
networker | 0:7f26f0680202 | 341 | RESERVED_1_SIZE + \ |
networker | 0:7f26f0680202 | 342 | sizeof(TA_CHANGE) + \ |
networker | 0:7f26f0680202 | 343 | sizeof(TA_TIMER) + \ |
networker | 0:7f26f0680202 | 344 | RESERVED_2_SIZE + \ |
networker | 0:7f26f0680202 | 345 | sizeof(TA_HOOK_TABLE) \ |
networker | 0:7f26f0680202 | 346 | )) |
networker | 0:7f26f0680202 | 347 | |
networker | 0:7f26f0680202 | 348 | |
networker | 0:7f26f0680202 | 349 | typedef struct ta_s |
networker | 0:7f26f0680202 | 350 | { |
networker | 0:7f26f0680202 | 351 | TA_INFO info; // info structure |
networker | 0:7f26f0680202 | 352 | TA_STATE state; // state structure |
networker | 0:7f26f0680202 | 353 | TA_CONFIG config; // config structure |
networker | 0:7f26f0680202 | 354 | TA_INPUT input; // input structure |
networker | 0:7f26f0680202 | 355 | TA_OUTPUT output; // output structure |
networker | 0:7f26f0680202 | 356 | TA_DISPLAY display; // display structure |
networker | 0:7f26f0680202 | 357 | |
networker | 0:7f26f0680202 | 358 | char reserved_1[RESERVED_1_SIZE]; |
networker | 0:7f26f0680202 | 359 | |
networker | 0:7f26f0680202 | 360 | TA_CHANGE change; // change structure |
networker | 0:7f26f0680202 | 361 | TA_TIMER timer; // 16-bit timers |
networker | 0:7f26f0680202 | 362 | |
networker | 0:7f26f0680202 | 363 | char reserved_2[RESERVED_2_SIZE]; |
networker | 0:7f26f0680202 | 364 | |
networker | 0:7f26f0680202 | 365 | TA_HOOK_TABLE hook_table; // hook table with functions pointers |
networker | 0:7f26f0680202 | 366 | |
networker | 0:7f26f0680202 | 367 | char reserved_3[RESERVED_3_SIZE]; |
networker | 0:7f26f0680202 | 368 | } TA; |
networker | 0:7f26f0680202 | 369 | |
networker | 0:7f26f0680202 | 370 | |
networker | 0:7f26f0680202 | 371 | #endif // __ROBO_TX_FW_H__ |