Program the control the fischertechnik robo interface or intelligent interface via tcp socket or via a java gui.
ROBO_TX_PRG.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 program. |
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. |
networker | 0:7f26f0680202 | 7 | // | |
networker | 0:7f26f0680202 | 8 | // Copyright | � 2009 MSC Vertriebs GmbH, Germany. |
networker | 0:7f26f0680202 | 9 | // | |
networker | 0:7f26f0680202 | 10 | // | This software is distributed in the hope that it will be useful, |
networker | 0:7f26f0680202 | 11 | // | but WITHOUT ANY WARRANTY; without even the implied warranty of |
networker | 0:7f26f0680202 | 12 | // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
networker | 0:7f26f0680202 | 13 | //============================================================================= |
networker | 0:7f26f0680202 | 14 | |
networker | 0:7f26f0680202 | 15 | #ifndef __ROBO_TX_PRG_H__ |
networker | 0:7f26f0680202 | 16 | #define __ROBO_TX_PRG_H__ |
networker | 0:7f26f0680202 | 17 | |
networker | 0:7f26f0680202 | 18 | #define CALL_CYCLE_MS 1 // firmware calls program each millisecond |
networker | 0:7f26f0680202 | 19 | |
networker | 0:7f26f0680202 | 20 | #define MIN(a, b) ((a <= b) ? a : b) |
networker | 0:7f26f0680202 | 21 | #define MAX(a, b) ((a >= b) ? a : b) |
networker | 0:7f26f0680202 | 22 | |
networker | 0:7f26f0680202 | 23 | #define TA_VERSION 0x08010101 // Transfer Area version. Is used by firmware to check if format of the |
networker | 0:7f26f0680202 | 24 | // Transfer Area used in program is the same as the one used in firmware. |
networker | 0:7f26f0680202 | 25 | |
networker | 0:7f26f0680202 | 26 | #define PRG_MEM_START 0x30700000 // start address of the program memory |
networker | 0:7f26f0680202 | 27 | #define PRG_MEM_SIZE 0x000D0000 // size of the program memory |
networker | 0:7f26f0680202 | 28 | |
networker | 0:7f26f0680202 | 29 | #define PRG_MAGIC 0x336699AA |
networker | 0:7f26f0680202 | 30 | |
networker | 0:7f26f0680202 | 31 | #if defined(__cplusplus) |
networker | 0:7f26f0680202 | 32 | #define NULL 0L |
networker | 0:7f26f0680202 | 33 | #else |
networker | 0:7f26f0680202 | 34 | #define NULL ((void *)0) |
networker | 0:7f26f0680202 | 35 | #endif |
networker | 0:7f26f0680202 | 36 | |
networker | 0:7f26f0680202 | 37 | #undef TRUE |
networker | 0:7f26f0680202 | 38 | #define TRUE (1 == 1) |
networker | 0:7f26f0680202 | 39 | |
networker | 0:7f26f0680202 | 40 | #undef FALSE |
networker | 0:7f26f0680202 | 41 | #define FALSE (!TRUE) |
networker | 0:7f26f0680202 | 42 | |
networker | 0:7f26f0680202 | 43 | #ifndef __cplusplus |
networker | 0:7f26f0680202 | 44 | typedef enum |
networker | 0:7f26f0680202 | 45 | { |
networker | 0:7f26f0680202 | 46 | false = FALSE, |
networker | 0:7f26f0680202 | 47 | true = TRUE |
networker | 0:7f26f0680202 | 48 | } bool; |
networker | 0:7f26f0680202 | 49 | #endif // __cplusplus |
networker | 0:7f26f0680202 | 50 | |
networker | 0:7f26f0680202 | 51 | typedef signed char CHAR8; |
networker | 0:7f26f0680202 | 52 | typedef unsigned char UCHAR8; |
networker | 0:7f26f0680202 | 53 | |
networker | 0:7f26f0680202 | 54 | typedef unsigned char BOOL8; // boolean variable (should be TRUE or FALSE) |
networker | 0:7f26f0680202 | 55 | typedef unsigned short BOOL16; // boolean variable (should be TRUE or FALSE) |
networker | 0:7f26f0680202 | 56 | typedef unsigned int BOOL32; // boolean variable (should be TRUE or FALSE) |
networker | 0:7f26f0680202 | 57 | |
networker | 0:7f26f0680202 | 58 | typedef signed char INT8; |
networker | 0:7f26f0680202 | 59 | typedef signed short INT16; |
networker | 0:7f26f0680202 | 60 | typedef signed int INT32; |
networker | 0:7f26f0680202 | 61 | |
networker | 0:7f26f0680202 | 62 | typedef unsigned char UINT8; |
networker | 0:7f26f0680202 | 63 | typedef unsigned short UINT16; |
networker | 0:7f26f0680202 | 64 | typedef unsigned int UINT32; |
networker | 0:7f26f0680202 | 65 | |
networker | 0:7f26f0680202 | 66 | #include "ROBO_TX_FW.h" |
networker | 0:7f26f0680202 | 67 | |
networker | 0:7f26f0680202 | 68 | // At the beginning of the program code should be this structure |
networker | 0:7f26f0680202 | 69 | struct prg_code_intro_s |
networker | 0:7f26f0680202 | 70 | { |
networker | 0:7f26f0680202 | 71 | unsigned long magic; // PRG_MAGIC |
networker | 0:7f26f0680202 | 72 | FT_VER ta_version; // TA_VERSION |
networker | 0:7f26f0680202 | 73 | unsigned long entry; // entry point of the program, usually address of |
networker | 0:7f26f0680202 | 74 | // the program dispatcher (PrgDisp) function |
networker | 0:7f26f0680202 | 75 | }; |
networker | 0:7f26f0680202 | 76 | |
networker | 0:7f26f0680202 | 77 | |
networker | 0:7f26f0680202 | 78 | // This function is called only once by the program dispatcher (PrgDisp) at the very first call |
networker | 0:7f26f0680202 | 79 | // of the program dispatcher by the firmware |
networker | 0:7f26f0680202 | 80 | void PrgInit |
networker | 0:7f26f0680202 | 81 | ( |
networker | 0:7f26f0680202 | 82 | TA * p_ta, // pointer to the array of transfer area parts |
networker | 0:7f26f0680202 | 83 | int n_ta // number of transfer area parts in array (equal to TA_COUNT) |
networker | 0:7f26f0680202 | 84 | ); |
networker | 0:7f26f0680202 | 85 | |
networker | 0:7f26f0680202 | 86 | |
networker | 0:7f26f0680202 | 87 | // This function is called periodically by the program dispatcher (PrgDisp) with the period |
networker | 0:7f26f0680202 | 88 | // of CALL_CYCLE_MS |
networker | 0:7f26f0680202 | 89 | int PrgTic |
networker | 0:7f26f0680202 | 90 | ( |
networker | 0:7f26f0680202 | 91 | TA * p_ta, // pointer to the array of transfer area parts |
networker | 0:7f26f0680202 | 92 | int n_ta // number of transfer area parts in array (equal to TA_COUNT) |
networker | 0:7f26f0680202 | 93 | ); |
networker | 0:7f26f0680202 | 94 | |
networker | 0:7f26f0680202 | 95 | |
networker | 0:7f26f0680202 | 96 | #endif // __ROBO_TX_PRG_H__ |