remote.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2007, IRTrans GmbH
00003  * All rights reserved.
00004  *
00005  * Redistribution and use in source and binary forms, with or without 
00006  * modification, are permitted provided that the following conditions are met:
00007  *     * Redistributions of source code must retain the above copyright
00008  *       notice, this list of conditions and the following disclaimer. 
00009  *     * Redistributions in binary form must reproduce the above copyright
00010  *       notice, this list of conditions and the following disclaimer in the
00011  *       documentation and/or other materials provided with the distribution. 
00012  *     * Neither the name of IRTrans GmbH nor the
00013  *       names of its contributors may be used to endorse or promote products
00014  *       derived from this software without specific prior written permission. 
00015  *
00016  * THIS SOFTWARE IS PROVIDED BY IRTrans GmbH ``AS IS'' AND ANY
00017  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00018  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
00019  * DISCLAIMED. IN NO EVENT SHALL IRTrans GmbH BE LIABLE FOR ANY
00020  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00021  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
00022  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00023  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00024  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 
00025  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00026  */
00027 
00028 
00029 
00030 #ifdef WIN32
00031 typedef unsigned char uint8_t;
00032 typedef unsigned int uint32_t;
00033 typedef unsigned short uint16_t;
00034 
00035 typedef char int8_t;
00036 typedef short int16_t;
00037 typedef int int32_t;
00038 typedef unsigned int uint32_t;
00039 #endif
00040 
00041 #ifdef _HCS12
00042 
00043 typedef INT8 int8_t;
00044 typedef UINT8 uint8_t;
00045 
00046 typedef UINT16 uint16_t;
00047 typedef INT16 int16_t;
00048 
00049 typedef UINT32 uint32_t;
00050 
00051 #endif
00052 
00053 typedef uint8_t byte;
00054 typedef uint16_t word;
00055 
00056 #ifdef _HCS12
00057 #define CODE_LEN        174
00058 
00059 #else
00060 #ifndef AVR
00061 #pragma pack(1)
00062 #define CODE_LEN        176                                                     // 2 Byte mehr für String-Ende 0
00063 #else
00064 #ifdef REMOTECONTROL
00065 #define CODE_LEN        20
00066 #else
00067 #define CODE_LEN        174
00068 #endif
00069 #endif
00070 #endif
00071 
00072 
00073 #ifdef AMEX
00074 #define VCC_THRESHOLD   180
00075 #else
00076 #define VCC_THRESHOLD   210
00077 #endif
00078 
00079 #define LAN_TIMEOUT_VAL 60
00080 
00081 #define TIME_LEN                 8
00082 #define TIME_LEN_18             18
00083 #define TIME_LEN_SINGLE 20
00084 #define RAW_EXTRA       TIME_LEN * 4 + 2
00085 #define CODE_LENRAW     (CODE_LEN + RAW_EXTRA - 2)
00086 #define OLD_LENRAW      (CODE_LEN + (6 * 4 + 2) - 2)
00087 #define MAXLCDLEN 170
00088 #define CODE_LEN_SINGLE (CODE_LEN-10)
00089 #define CODE_LEN_18 (CODE_LEN-40)
00090 
00091 
00092 typedef struct {
00093         byte len;                                                       //      0
00094         byte checksumme;                                        //      1
00095         byte command;                                           //      2
00096 
00097         byte address;                                           //      3
00098         word target_mask;                                       //      4
00099 
00100         byte ir_length;                                         //      6
00101         byte transmit_freq;                                     //      7
00102         byte mode;                                                      //      8
00103 
00104         int16_t pause_len[TIME_LEN];            //      9
00105         int16_t pulse_len[TIME_LEN];            // 25
00106         byte time_cnt;                                          // 41
00107         byte ir_repeat;                                         // 42
00108         byte repeat_pause;                                      // 43
00109 
00110         byte data[CODE_LEN];                            // 44
00111 } IRDATA;
00112 
00113 typedef struct {
00114         byte len;                                                       //      0
00115         byte checksumme;                                        //      1
00116         byte command;                                           //      2
00117 
00118         byte address;                                           //      3
00119         word target_mask;                                       //      4
00120 
00121         byte ir_length;                                         //      6
00122         byte transmit_freq;                                     //      7
00123         byte mode;                                                      //      8
00124 
00125         int16_t pause_len[18];                          //      9
00126         int16_t pulse_len[18];                          // 45
00127         byte time_cnt;                                          // 81
00128         byte ir_repeat;                                         // 82
00129         byte repeat_pause;                                      // 83
00130 
00131         byte data[CODE_LEN_18];                         // 84
00132 } IRDATA_18;
00133 
00134 typedef struct {
00135         byte len;                                                       //      0
00136         byte checksumme;                                        //      1
00137         byte command;                                           //      2
00138 
00139         byte address;                                           //      3
00140         word target_mask;                                       //      4
00141 
00142         byte ir_length;                                         //      6
00143         byte transmit_freq;                                     //      7
00144         byte mode;                                                      //      8
00145 
00146         int16_t multi_len[TIME_LEN_SINGLE];     //      9
00147         int16_t single_len;                                     // 49
00148         byte time_cnt;                                          // 51
00149         byte ir_repeat;                                         // 52
00150         byte repeat_pause;                                      // 53
00151 
00152         byte data[CODE_LEN_SINGLE];                     // 54
00153 } IRDATA_SINGLE;
00154 
00155 typedef struct {
00156         byte len;                                                       //  0
00157         byte checksumme;                                        //  1
00158         byte command;                                           //  2
00159 
00160         byte address;                                           //  3
00161         word target_mask;                                       //  4
00162 
00163         byte ir_length;                                         //  6
00164         byte transmit_freq;                                     //  7
00165         byte mode;                                                      //  8
00166 
00167         byte data[CODE_LENRAW];                         //  9
00168 } IRRAW;
00169 
00170 typedef union {
00171         IRDATA          irdata;
00172         IRRAW           irraw;
00173         IRDATA_18       irdata18;
00174 } IRDATA_ALL;
00175 
00176 
00177 #ifndef AVR
00178 
00179 typedef struct {
00180         word crc;
00181         byte errcnt;
00182         byte dummy;
00183         byte cryptstart;
00184         byte cryptend;
00185         word magic;
00186         word pagesize;
00187         word pagecnt;
00188         word data[65536];
00189 } FLASH_IR_DATA;
00190 
00191 
00192 #define IR_MAGIC                                0x7a8e
00193 
00194 #endif
00195 
00196 #define VERSION_MAGIC_1                 0x39
00197 #define VERSION_MAGIC_2                 0x640b
00198 #define VERSION_MAGIC_3                 0xb3
00199 #define VERSION_MAGIC_4                 0x8b
00200 
00201 #define VERSION_MAGIC_CHECK             0xaa
00202 #define VERSION_MAGIC_CHECKR    0x68
00203 
00204 #define FLASH_TYPE_LAN                  0xff01
00205 #define FLASH_TYPE_IRDB                 0xff02
00206 #define FLASH_TYPE_IRDBAUX              0xff03
00207 
00208 #define SENDMASK_LEN  16
00209 
00210 #define COMMAND_LAN             200
00211 #define COMMAND_FLASH_START     201
00212 #define COMMAND_FLASH_DATA      202
00213 #define COMMAND_FLASH_END           203
00214 #define COMMAND_FLASH_ACK       204
00215 #define COMMAND_FLASH_CANCEL    205
00216 #define COMMAND_FLASH_HTML      206
00217 #define COMMAND_SEND_RS232      207
00218 #define COMMAND_FLASH_ACK_1     208
00219 #define COMMAND_FLASH_ACK_2     209
00220 #define COMMAND_FLASH_CRC       210
00221 #define COMMAND_FLASH_IR        211
00222 
00223 #define COMMAND_LAN_SENDSTRING  's' 
00224 #define COMMAND_LAN_PING        'p' 
00225 #define COMMAND_LAN_SENDCCF     'c' 
00226 
00227 
00228 
00229 
00230 #define RESULT_IR_BROADCAST                 230
00231 #define RESULT_GETVERSION               231
00232 #define RESULT_DEVSTATUS                    232
00233 #define RESULT_EEPROM                       233
00234 #define RESULT_RESET                    234
00235 #define RESULT_IRDBSTATUS               235
00236 #define RESULT_REMOTELIST               236
00237 #define RESULT_COMMANDLIST                  237
00238 #define RESULT_IR_RECEIVE               238
00239 #define RESULT_UDP_FORMAT                   239
00240 #define RESULT_FLASH                        240
00241 #define RESULT_ALIVE                        241
00242 #define RESULT_LEARN                        242
00243 #define RESULT_READ_EEPROM                  243
00244 #define RESULT_WAKE_ON_LAN                  244
00245 #define RESULT_PING_OK                      245
00246 #define RESULT_IR_HOSTBROADCAST         246
00247 #define RESULT_IR_BROADCAST_LED         247
00248 #define RESULT_AUX_FORMAT               248
00249 #define RESULT_ANALOG_INPUT                     249
00250 
00251 
00252 #define ADR_LANPARM             256
00253 #define LEN_LANPARM             (sizeof (LAN_PARAMETER)-3)                      // LEN = 21
00254 #define ADR_SYSPARM             (ADR_LANPARM+LEN_LANPARM)
00255 #define LEN_SYSPARM             (sizeof (SYS_PARAMETER)-4)                      // LEN = 191 -> capabilities not stored in EEPROM 
00256 #define ADR_WAKEMAC             (ADR_LANPARM+LEN_LANPARM+164)
00257 #define ADR_TIMER               (ADR_SYSPARM+LEN_SYSPARM)
00258 #define LEN_TIMER               sizeof (TIMER_ENTRY_GET)                        // LEN = 117
00259 
00260 #define MAX_1WIRE_ID    16
00261 
00262 typedef struct {
00263   uint8_t mode;
00264   uint8_t status;
00265   uint8_t year;
00266   uint8_t month;
00267   uint8_t day;
00268   uint8_t hour;
00269   uint8_t min;
00270   uint8_t weekday;
00271   uint32_t next_time;
00272 } TIMER_ENTRY;
00273 
00274 typedef struct {
00275   uint8_t len;
00276   TIMER_ENTRY tim;
00277         uint8_t remote[81];
00278         uint8_t ircommand[21];
00279         uint8_t ledselect;
00280         uint16_t  targetmask;
00281 } TIMER_ENTRY_GET;
00282   
00283 typedef struct {
00284         uint8_t         len;
00285         uint8_t      checksumme;
00286         uint8_t      command;
00287         uint8_t      mode;
00288   TIMER_ENTRY tim;
00289         uint8_t remote[81];
00290         uint8_t ircommand[21];
00291         uint8_t ledselect;
00292         uint16_t  targetmask;
00293 } TIMER_ENTRY_STORE;
00294 
00295 typedef struct {
00296         uint8_t len;
00297         uint8_t checksumme;
00298         uint8_t command;
00299 
00300         uint8_t cmd_str[80 + 20 + 10];
00301 } IRCOMMAND_STRING;
00302 
00303 
00304 typedef struct {
00305         uint8_t len;
00306         uint8_t checksumme;
00307         uint8_t command;
00308 
00309         uint8_t remote[81];
00310         uint8_t ircommand[121];
00311         uint16_t mask;
00312         uint8_t ledselect;
00313 } IRCOMMAND_BUF;
00314 
00315 typedef struct {
00316         uint8_t len;
00317         uint8_t checksumme;
00318         uint8_t command;
00319         uint8_t dummy;
00320 
00321         uint16_t start;
00322         uint8_t remote[81];
00323 } IRDBLIST_BUF;
00324 
00325 
00326 typedef struct {
00327         word adr;
00328         word len;
00329         word flash_adr;
00330         word page;
00331         word crc;
00332 } FLASH_BLOCK;
00333 
00334 typedef struct {
00335         word crc;
00336         word type;
00337         FLASH_BLOCK dir[12];
00338 } FLASH_TABLE;
00339 
00340 #define FLASH_TABLE_LEN ((sizeof (FLASH_TABLE) + 1) / 2)
00341 
00342 typedef struct {
00343         uint8_t netcommand;
00344   word    adr;
00345   word    len;
00346   uint8_t data[512];
00347 } IRDATA_LAN_FLASH;
00348 
00349 typedef struct {
00350         uint8_t netcommand;
00351         uint8_t mode;
00352         uint16_t timeout;
00353         uint32_t sendmask[SENDMASK_LEN];
00354         IRDATA ir_data;
00355 } IRDATA_LAN;
00356 
00357 typedef struct {
00358         uint8_t netcommand;
00359         uint8_t mode;
00360         uint16_t timeout;
00361         uint32_t sendmask[SENDMASK_LEN];
00362         IRDATA ir_data;
00363         byte buffer[256];
00364 } IRDATA_LAN_LARGE;
00365 
00366 typedef struct {
00367         uint8_t netcommand;
00368         IRDATA ir_data;
00369 } IRDATA_LAN_SHORT;
00370 
00371 typedef struct {
00372         byte len;
00373         byte checksumme;
00374         byte command;
00375         word adr;
00376         byte data[200];
00377 } IRDATA_EEPROM;
00378 
00379 typedef struct {
00380         uint8_t         netcommand;
00381         uint8_t         len;
00382         uint8_t         ir_version[8];
00383         uint32_t        ir_capabilities;
00384         uint32_t        ir_serno;
00385         uint8_t         lan_version[8];
00386         uint8_t         mac_adr[6];
00387 } GETVERSION_LAN;
00388 
00389 typedef struct {
00390         uint8_t         netcommand;
00391         uint8_t         len;
00392         uint8_t         ir_version[8];
00393         uint32_t        ir_capabilities;
00394         uint32_t        ir_serno;
00395         uint8_t         lan_version[8];
00396         uint8_t         mac_adr[6];
00397         uint32_t        ir_capabilities2;
00398         uint32_t        ir_capabilities3;
00399         uint32_t        ir_capabilities4;
00400 } GETVERSION_LAN_EX;
00401 
00402 typedef struct {
00403         uint8_t         netcommand;
00404         uint8_t         len;
00405         uint8_t         ir_version[8];
00406         uint32_t        ir_capabilities;
00407         uint32_t        ir_serno;
00408         uint8_t         lan_version[8];
00409         uint8_t         mac_adr[6];
00410         uint32_t        ir_capabilities2;
00411         uint32_t        ir_capabilities3;
00412         uint32_t        ir_capabilities4;
00413         uint8_t         extended_mode;
00414         uint8_t         extended_mode2;
00415         uint8_t         extended_mode_ex[2];
00416 } GETVERSION_LAN_EX2;
00417 
00418 typedef struct {
00419         uint32_t        access_ip[8];           // 0    // Erlaubte Input IPs
00420         uint32_t        access_mask[8];         // 32   // Netmask dazu
00421         uint32_t        ir_relay_from[16];      // 64   // IR Relay von diesen Adressen erlaubt
00422         uint32_t        ir_relay_to[8];         // 128  // Output wird zusätzlich zum Broadcast an diese IPs gesendet
00423         uint32_t        udp_str_adr;            // 160  
00424         uint8_t         wakeonlan_mac[6];       // 164  // Zielhost für WakeOnLAN Pakete (PowerOn)
00425         int8_t          password[12];           // 170
00426         uint8_t         broadcast_relay;        // 182
00427         uint8_t         udp_format_len;         // 183
00428         uint16_t        udp_port;                       // 184
00429         uint8_t         tz;                                     // 186
00430         uint32_t        ntp_ip;                         // 187
00431         uint32_t        ir_relay_led;           // 191
00432         uint32_t  capabilities;                 // 195
00433 } SYS_PARAMETER;
00434 
00435 typedef struct {
00436         uint8_t                 len;
00437         SYS_PARAMETER   sysparm;
00438 } SYS_PARAMETER_GET;
00439 
00440 typedef struct {
00441         uint8_t         len;
00442         byte      checksumme;
00443         byte      command;
00444         byte      mode;
00445         SYS_PARAMETER   sysparm;
00446 } SYS_PARAMETER_STORE;
00447 
00448 typedef struct {
00449         uint8_t         len;
00450         byte      checksumme;
00451         byte      command;
00452         byte      udplen;
00453         byte      str[100];
00454 } UDP_FORMAT_STORE;
00455 
00456 typedef struct {
00457         uint8_t         len;
00458         uint8_t         dhcp_flag;
00459         uint8_t         fallback_flag;
00460         uint8_t         mac_adr[6];
00461         uint32_t        ip_adr;
00462         uint32_t        ip_netmask;
00463         uint32_t        ip_gateway;
00464         uint8_t   eeprom_device_mode;
00465         uint8_t   eeprom_extended_mode;
00466         uint8_t   eeprom_extended_mode2;
00467 } LAN_PARAMETER;
00468 
00469 typedef struct {
00470         uint8_t         len;
00471         byte      checksumme;
00472         byte      command;
00473         uint8_t         dhcp_flag;
00474         uint8_t         fallback_flag;
00475         uint8_t         mac_adr[6];
00476         uint32_t        ip_adr;
00477         uint32_t        ip_netmask;
00478         uint32_t        ip_gateway;
00479 } LAN_PARAMETER_STORE;
00480 
00481 typedef struct {
00482         byte len;
00483         byte checksumme;
00484         byte command;
00485 
00486         byte address;
00487         word target_mask;
00488 
00489         byte ir_length;
00490         byte transmit_freq;
00491         byte mode;
00492 
00493         word pause_len[6];
00494         word pulse_len[6];
00495         byte time_cnt;
00496         byte ir_repeat;
00497         byte repeat_pause;
00498 
00499         byte data[CODE_LEN];
00500 } IRDATA3;
00501 
00502 typedef struct {
00503         byte len;
00504         byte checksumme;
00505         byte command;
00506 
00507         byte address;
00508         word target_mask;
00509 
00510         byte ir_length;
00511         byte transmit_freq;
00512         byte mode;
00513 
00514         byte data[MAXLCDLEN];
00515 } IRRAWLCD;
00516 
00517 typedef struct {
00518         uint8_t len;
00519         uint8_t count_buffer;
00520         int16_t offset;
00521         int16_t count_total;
00522         int8_t remotes[3][80];
00523 } REMOTEBUFFER_INT;
00524 
00525 typedef struct {
00526         uint8_t len;
00527         uint8_t count_buffer;
00528         int16_t offset;
00529         int16_t count_total;
00530         int8_t commands[12][20];
00531 } COMMANDBUFFER_INT;
00532 
00533 typedef struct {
00534         uint32_t target_mask;
00535         uint32_t source_mask;
00536         int8_t name[80];
00537 } REMOTELINE;
00538 
00539 typedef struct {
00540         uint32_t capabilities;
00541         uint32_t capabilities2;
00542         int8_t name[60];
00543         int8_t version[8];
00544         uint32_t capabilities3;
00545         uint32_t capabilities4;
00546         uint8_t extended_mode;
00547         uint8_t extended_mode2;
00548         uint8_t extended_mode_ex[2];
00549 } BUSLINE;
00550 
00551 typedef struct {
00552         int16_t statuslen;
00553         int16_t statustype;
00554   int16_t offset;
00555   int16_t count_buffer;
00556         int16_t count_total;
00557         int16_t count_remaining;
00558         int8_t  remotes[3][80];
00559 } REMOTEBUFFER_TCP;
00560 
00561 typedef struct {
00562         int16_t statuslen;
00563         int16_t statustype;
00564   int16_t offset;
00565   int16_t count_buffer;
00566         int16_t count_total;
00567         int16_t count_remaining;
00568         REMOTELINE remotes[3];
00569 } REMOTEBUFFER_SHORT;
00570 
00571 
00572 typedef struct {
00573         int16_t statuslen;
00574         int16_t statustype;
00575   int16_t offset;
00576   int16_t count_buffer;
00577         int16_t count_total;
00578         int16_t count_remaining;
00579         int8_t commands[12][20];
00580 } COMMANDBUFFER_SHORT;
00581 
00582 typedef struct {
00583         int16_t statuslen;
00584         int16_t statustype;
00585         uint8_t data[240];
00586 } LEARNBUFFER_TCP;
00587 
00588 
00589 #define BROADCAST_UDP           1
00590 #define BROADCAST_AUX           2
00591 
00592 typedef struct {
00593         uint8_t         len;
00594         uint8_t         modeflags;
00595         uint32_t        ip;
00596         uint16_t        port;
00597         uint8_t         data[10];
00598 } UDP_ASCII_RECEIVE;
00599 
00600 typedef struct {
00601         uint8_t len;
00602         uint16_t action_adr;
00603         uint16_t remote_adr;
00604         uint32_t ip;
00605         uint16_t port;
00606         uint8_t modeflags;
00607         uint8_t remote[80];
00608         uint8_t command[20];
00609         uint8_t ircommand[141];
00610 } IRRECEIVE;
00611 
00612 typedef struct {
00613         int16_t statuslen;
00614         int16_t statustype;
00615         int16_t adress;
00616     uint16_t command_num;
00617         int8_t remote[80];
00618         int8_t command[20];
00619         int8_t data[141];
00620 } NETWORKRECV_SHORT;
00621 
00622 
00623 typedef struct {
00624         uint8_t len;
00625         uint8_t mode[8];
00626         uint8_t value[8];
00627 } ANALOG_INPUTS;
00628 
00629 typedef struct {
00630         uint8_t len;
00631         uint8_t mode[MAX_1WIRE_ID];
00632         uint8_t id[MAX_1WIRE_ID][8];
00633 } ANALOG_INFO;
00634 
00635 typedef struct {
00636         uint8_t len;
00637         uint8_t mode[8];
00638         uint8_t dummy;
00639         int16_t value[8];
00640 } ANALOG_HIRES_INPUTS;
00641 
00642 
00643 typedef union {
00644         ANALOG_INPUTS           a_input;
00645         ANALOG_HIRES_INPUTS a_hires;
00646         ANALOG_INFO                     a_info;
00647 } ANALOG_DATA;
00648 
00649 typedef struct {
00650         uint8_t netcommand;
00651         ANALOG_DATA ad;
00652 } GET_ANALOG_DATA;
00653 
00654 
00655 typedef struct {
00656         uint8_t netcommand;
00657         ANALOG_INPUTS ai;
00658 } GET_ANALOG_INPUTS;
00659 
00660 
00661 // Mode Flags
00662 #define DEVMODE_PC                      0
00663 #define DEVMODE_SEND            1
00664 #define DEVMODE_IR                      2
00665 #define DEVMODE_SBUS            4
00666 #define DEVMODE_IGNORETOG       8
00667 #define DEVMODE_SBUSCODE        16
00668 #define DEVMODE_RAW                     32
00669 #define DEVMODE_SBUS_UART       64              // Set: SBUS läuft über UART
00670 #define DEVMODE_REPEAT          128
00671 
00672 // Extended Mode Flags
00673 #define INTERNAL_LEDS           1
00674 #define EXTERNAL_LEDS           2
00675 #define STANDARD_RCV            4
00676 #define HI_RCV                          8
00677 #define BO_MODE                         16
00678 #define SELF_REPEAT                     32
00679 #define INTERNAL_REPEAT         64
00680 #define RCV_NO_SORT                     128                     
00681 
00682 // Extended Mode2 Flags
00683 #define RCV_TOLERANCE_MASK      7                       // Bit 0-2
00684 #define RCV_TOLERANCE_64        0
00685 #define RCV_TOLERANCE_96        1
00686 #define RCV_TOLERANCE_140       2
00687 #define RCV_TOLERANCE_200       3
00688 #define INSTANT_REP_COUNT       8                       // Bit 3
00689 #define IR_FRAMELENGTH          16                      // Bit 4
00690 #define RS232_BAUD_MASK         96                      // Bit 5-6      
00691 #define RS232_RTS_CTS           128                     // Bit 7                
00692 
00693 // EX[0]
00694 #define LOW_RCV_MASK            7
00695 #define HI_RCV_MASK                     240
00696 
00697 // EX[1]
00698 #define RCV_TIMEOUT_MASK        255                     // Bit 0-7
00699 
00700 // EX[2]
00701 #define IDLE_TIMEOUT_MASK       7                       // Bit 0-2
00702 #define IDLE_TIMEOUT_1          0
00703 #define IDLE_TIMEOUT_2          1
00704 #define IDLE_TIMEOUT_4          2
00705 #define IDLE_TIMEOUT_5          3
00706 #define IDLE_TIMEOUT_6          4
00707 #define IDLE_TIMEOUT_8          5
00708 #define IDLE_TIMEOUT_10         6
00709 #define IDLE_TIMEOUT_15         7
00710 
00711 #define SBUS_BAUD_MASK          24                      // Bit 3-4
00712 #define SBUS_BAUD_4800          0
00713 #define SBUS_BAUD_9600          8
00714 #define SBUS_BAUD_19200         16
00715 #define SBUS_BAUD_38400         24
00716 
00717 #define IR_FILTER_MASK          224                     // Bit 5-7
00718 #define IR_FILTER_64            0
00719 #define IR_FILTER_120           32
00720 #define IR_FILTER_160           64
00721 #define IR_FILTER_280           96
00722 #define IR_FILTER_380           128
00723 #define IR_FILTER_480           160
00724 #define IR_FILTER_550           192
00725 #define IR_FILTER_800           224
00726 
00727 // EX[3]
00728 #define CHECK_RCMM                      1
00729 #define FORCE_RCMM                      2
00730 #define RCMM_TOGGLE                     4
00731 #define RSTEP_KEYBOARD          8
00732 
00733 // EX[4]
00734 #define TOGGLE_MAP_MASK         63                      // Map out Toggle Bits
00735 #define TOGGLE_MAP_LEN          128
00736 
00737 #define LRN_TIMEOUT_MASK        7                       // Maske beim Lernen 
00738 #define LRN_TIMEOUT_SELECT      8
00739 #define LRN_CALIBRATION         48
00740 #define LRN_RCV_SELECT          960
00741 #define LRN_RCV_56                      64
00742 #define LRN_RCV_38                      128
00743 #define LRN_RCV_455                     256
00744 #define LRN_RCV_455_PLASMA      320
00745 #define LRN_RCV_CARRIER         384
00746 #define LRN_RCV_EXTERNAL        512
00747 #define LRN_RCV_HI                      1024
00748 #define LRN_TOLERANCE           14336
00749 #define LRN_BO_MODE                     16384
00750 #define LRN_NOSORT                      32768
00751 
00752 #define LRN_TOGGLE_MAP          1
00753 
00754 #define LOCAL_MODE                      16
00755 #define RECEIVE_ALL                     17
00756 #define QUICK_MODE                      32
00757 #define RAW_MODE                        64
00758 #define REPEAT_MODE                     128
00759 #define IR_MODE                         256
00760 #define SBUS_MODE                       512
00761 #define INSTANT_MODE            1024
00762 #define IDLE_WAIT                       2048
00763 #define TOGGLE_MAP                      4096
00764 
00765 #define SPECIAL_RCV_MODE        31
00766 
00767 #define LONG_LEARN_MODE                         16
00768 #define RECEIVER_SELECT_MASK            96
00769 #define RECEIVER_SELECT_LOW                     32
00770 #define RECEIVER_SELECT_HI                      64
00771 //#define RECEIVER_SELECT_LEARNLOW      192
00772 //#define RECEIVER_SELECT_LEARNHI               224
00773 //#define RECEIVER_LEARN_CARRIER                512
00774 
00775 #define LONG_CODE_FLAG          128
00776 #define LONG_CODE_LEN           8
00777 #define USE_LONG_CODES          1
00778 #define LONG_CODE_MODE_CAL      2
00779 
00780 // Bereiche der Command Codes durch LEARN blockiert:
00781 //
00782 //  16 -  31
00783 //  48 -  63
00784 //      80 -  95
00785 // 112 - 128
00786 // 144 - 159
00787 // 176 - 191
00788 // 208 - 223
00789 // 240 - 255
00790 
00791 
00792 
00793 // Hier LEARN Command Codes
00794 #define SBUS_LEARN                      16
00795 #define HOST_LEARNIR            18
00796 #define SBUS_QUICKPARM          48
00797 #define HOST_LEARNIRQUICK       50
00798 #define SBUS_RAWMODE            80
00799 #define HOST_LEARNIRRAW         82
00800 #define SBUS_REPEATMODE         144
00801 #define HOST_LEARNIRREPEAT      146
00802 #define SBUS_RAWREPEATMODE              208
00803 #define HOST_LEARNIRRAWREPEAT   210
00804 
00805 
00806 // Hier Standard Command Codes
00807 #define SBUS_REPEAT                     1
00808 #define HOST_VERSION            2
00809 #define HOST_NETWORK_STATUS     3
00810 #define SBUS_SEND                       4
00811 #define SBUS_RESEND                     5
00812 #define HOST_SEND                       6
00813 #define HOST_RESEND                     7
00814 
00815 #define LAN_REPEAT                      32
00816 #define PUT_SERIAL_DATA         33
00817 #define READ_ANALOG_INPUTS      34
00818 
00819 #define ASCII_SEND                      100 // 'd'
00820 
00821 #define SBUS_RESET                      192
00822 #define SBUS_PING                       193
00823 #define SBUS_PONG                       194
00824 #define SBUS_PARAMETER          196
00825 #define HOST_SETMODE            197
00826 #define SET_ID                          199
00827 #define SET_TRANSLATE_DATA      200
00828 #define SBUS_TRANSLATE_DATA     201
00829 #define READ_TRANSLATE_DATA     202
00830 #define START_FLASH_MODE        203
00831 #define TRANSFER_FLASH          204
00832 #define SBUS_SET_MODE2          206
00833 #define HOST_SET_MODE2          207
00834 
00835 #define HOST_STORE_LANPARM      224
00836 #define HOST_READ_LANPARM       225
00837 #define HOST_STORE_FLASH        226
00838 #define HOST_READ_FLASH         227
00839 #define SEND_IRDB_STRING        228
00840 #define SEND_IRDB_BLOCK         229
00841 #define RESEND_IRDB_BLOCK       230
00842 #define IRDB_REMLIST            231
00843 #define IRDB_COMLIST            232
00844 //#define HOST_STORE_UDPSTR     233
00845 #define PING_IR_CONTROLLER      234
00846 #define SET_POWER_LED           235
00847 #define TEST_IRDB_BLOCK         236
00848 #define GET_TIMER_PARAMETER 237
00849 #define STORE_TIMER_PARAMETER 238
00850 
00851 
00852 #define SEND                            SBUS_SEND
00853 #define LEARN                           SBUS_LEARN
00854 #define SETMODE                         SBUS_PARAMETER
00855 
00856 #define ADRESS_MASK                     15
00857 #define ADRESS_LOCAL            16
00858 #define ADRESS_ALL                      32
00859 #define ADRESS_LAN                      64
00860 
00861 
00862 #define START_BIT                       1
00863 #define REPEAT_START            2
00864 #define START_MASK                      3
00865 #define RC5_DATA                        4
00866 #define RC6_DATA                        8
00867 #define IRDA_DATA                       12
00868 #define NO_TOGGLE                       2
00869 #define NO_TOGGLE_H                     64
00870 #define MACRO_DATA                      32
00871 
00872 #define SPECIAL_IR_FLAG         128
00873 #define SPECIAL_IR_MODE         159
00874 #define RAW_DATA                        16
00875 
00876 #define TIMECOUNT_18            128
00877 #define RCMM                            129
00878 // 130 frei
00879 #define PULSE_200                       131
00880 #define RECS80                          132
00881 #define RECS80_NO_TOGGLE        133
00882 #define RECS80_NO_TOGGLE_H      134
00883 
00884 #define OFFSET_TYP_TOGGLE       1
00885 
00886 #define LCD_BACKLIGHT           1
00887 #define LCD_TEXT                        2
00888 
00889 
00890 #define LCD_INIT                        4
00891 #define LCD_SETTIME                     8
00892 #define LCD_DISPLAYTIME         16
00893 #define LCD_DEFINECHAR          12
00894 #define LCD_BRIGHTNESS          20
00895 #define LCD_REFRESHDATE         24
00896 
00897 #define LCD_DATA                        32
00898 
00899 #define TEMP_GET                        1
00900 #define TEMP_RESET                      2
00901 #define TEMP_DATA                       64
00902 #define NON_IRMODE                      96
00903 
00904 #define SWITCH_DATA                     96
00905 
00906 #define SHORT_PULSE                     50
00907 #define IR_CORRECT_455          1                               // Entspricht 8 µs Korrektur
00908 
00909 #ifndef IR_CORRECT
00910 #define IR_CORRECT                      8                               // Entspricht 64 µs Korrektur
00911 #define IR_CORRECT_LOW          6                               // Entspricht 24 µs Korrektur für kurze Pulse
00912 #else
00913 #ifndef IR_CORRECT_LOW
00914 #define IR_CORRECT_LOW          0                               // Entspricht 24 µs Korrektur für kurze Pulse
00915 #endif
00916 #endif
00917 
00918 
00919 #define IR_TOLERANCE_BO         50                              // Entspricht 280 µs Toleranz
00920 #define IR_TOLERANCE            12                              // Entspricht  96 µs Toleranz
00921 #define RCX_TOLERANCE           25                              // Entspricht +/- 200 µs Toleranz
00922 #define MAX_IR_REPEAT           5
00923 #define RAW_TOLERANCE           15
00924 
00925 #define EXT_LED_SELECT_1        4
00926 #define EXT_LED_SELECT_2        8
00927 #define EXT_LED_SELECT_3        12
00928 #define EXT_LED_SELECT_4        16
00929 #define EXT_LED_SELECT_5        20
00930 #define EXT_LED_SELECT_6        24
00931 #define EXT_LED_SELECT_7        28
00932 #define EXT_LED_SELECT_8        32
00933 
00934 #define EXT_LED_SELECT_MASK     60
00935 
00936 
00937 
00938 
00939 #define START                   1
00940 #define REPEAT                  2
00941 
00942 
00943 typedef struct {
00944         byte sbus_len;
00945         byte sbus_checksumme;
00946         byte sbus_command;
00947         byte sbus_address;
00948         byte mode;
00949         word target_mask;
00950         byte hotcode_len;
00951         byte hotcode[CODE_LENRAW];
00952 } MODE_BUFFER;
00953 
00954 typedef struct {
00955         byte sbus_len;
00956         byte sbus_checksumme;
00957         byte sbus_command;
00958         byte sbus_address;
00959         byte mode;
00960         word target_mask;
00961         byte hotcode_len;
00962         byte extmode1;
00963         byte extmode2;
00964         byte extmode_ex0;
00965         byte extmode_ex1;
00966         char remote[81];
00967         char command[21];
00968 } MODE_BUFFER_LAN;
00969 
00970 typedef struct {
00971         byte device_mode;                       //  0
00972         word send_mask;                         //  1
00973         byte extended_mode;                     //  3
00974         byte extended_mode2;            //  4
00975         byte extended_mode_ex[8];       //  5
00976         byte hotcode_len;                       // 13
00977 } EEPROM_MEMORY;                                // 14
00978 
00979 typedef struct {
00980         byte sbus_len;
00981         byte sbus_checksumme;
00982         byte sbus_command;
00983         byte sbus_address;
00984         byte device_mode;
00985         word send_mask;
00986         byte extended_mode;
00987         byte extended_mode2;
00988         byte extended_mode_ex[8];
00989         byte version[10];
00990         uint32_t capabilities;
00991         uint32_t capabilities2;
00992         uint32_t capabilities3;
00993         uint32_t capabilities4;
00994         byte wake_mac[6];
00995         char remote[81];
00996         char command[21];
00997 } STATUS_LINE_EX;
00998 
00999 typedef struct {
01000         byte sbus_len;
01001         byte sbus_checksumme;
01002         byte sbus_command;
01003         byte sbus_address;
01004         byte device_mode;
01005         word send_mask;
01006         byte version[10];
01007         byte extended_mode;
01008         uint32_t capabilities;
01009         byte extended_mode2;
01010         byte extended_mode_ex[2];
01011         byte wake_mac[6];
01012         char remote[81];
01013         char command[21];
01014 } STATUS_LINE_EX_1;
01015 
01016 typedef struct {
01017         byte sbus_len;                                  //  0
01018         byte sbus_checksumme;                   //  1
01019         byte sbus_command;                              //  2
01020         byte sbus_address;                              //  3
01021         byte device_mode;                               //  4
01022         word send_mask;                                 //  5
01023         byte extended_mode;                             //  7
01024         byte extended_mode2;                    //  8
01025         byte extended_mode_ex[8];               //  9
01026         byte version[10];                               // 17
01027         uint32_t capabilities;                  // 27
01028         uint32_t capabilities2;                 // 31
01029         uint32_t capabilities3;                 // 35
01030         uint32_t capabilities4;                 // 39
01031         byte wake_mac[6];                               // 43
01032 } STATUS_LINE;                                          // 49
01033 
01034 typedef struct {
01035         byte sbus_len;
01036         byte sbus_checksumme;
01037         byte sbus_command;
01038         byte sbus_address;
01039         byte device_mode;
01040         word send_mask;
01041         byte version[10];
01042         byte extended_mode;
01043         uint32_t capabilities;
01044         byte extended_mode2;
01045         byte extended_mode_ex[2];
01046         byte wake_mac[6];
01047 } STATUS_LINE_5;
01048 
01049 typedef struct {
01050         byte sbus_len;
01051         byte sbus_checksumme;
01052         byte sbus_command;
01053         byte sbus_address;
01054         byte device_mode;
01055         word send_mask;
01056         byte version[10];
01057         byte extended_mode;
01058         uint32_t capabilities;
01059         byte extended_mode2;
01060 } STATUS_LINE_4;
01061 
01062 typedef struct {
01063         byte sbus_len;
01064         byte sbus_checksumme;
01065         byte sbus_command;
01066         byte sbus_address;
01067         byte device_mode;
01068         word send_mask;
01069         byte version[10];
01070         byte extended_mode;
01071         word capabilities;
01072 } STATUS_LINE_3;
01073 
01074 typedef struct {
01075         byte sbus_len;
01076         byte sbus_checksumme;
01077         byte sbus_command;
01078         byte sbus_address;
01079         byte device_mode;
01080         word send_mask;
01081         byte version[10];
01082         byte extended_mode;
01083 } STATUS_LINE_2;
01084 
01085 typedef struct {
01086         byte sbus_len;
01087         byte sbus_checksumme;
01088         byte sbus_command;
01089         byte sbus_address;
01090         byte device_mode;
01091         word send_mask;
01092         byte version[10];
01093 } STATUS_LINE_1;
01094 
01095 typedef struct {
01096         byte my_adress;
01097         STATUS_LINE stat[16];
01098 } STATUS_BUFFER;
01099 
01100 typedef struct {
01101         byte my_adress;
01102         STATUS_LINE_1 stat[16];
01103 } STATUS_BUFFER_1;
01104 
01105 typedef struct {
01106         byte my_adress;
01107         STATUS_LINE_2 stat[16];
01108 } STATUS_BUFFER_2;
01109 
01110 typedef struct {
01111         byte my_adress;
01112         STATUS_LINE_3 stat[16];
01113 } STATUS_BUFFER_3;
01114 
01115 typedef struct {
01116         byte my_adress;
01117         STATUS_LINE_4 stat[16];
01118 } STATUS_BUFFER_4;
01119 
01120 typedef struct {
01121         byte my_adress;
01122         STATUS_LINE_5 stat[16];
01123 } STATUS_BUFFER_5;
01124 
01125 typedef struct {
01126         uint8_t netcommand;
01127         STATUS_LINE_EX stat;
01128 } STATUS_LINE_LAN;
01129 
01130 typedef struct {
01131         uint8_t netcommand;
01132         STATUS_LINE_EX_1 stat;
01133 } STATUS_LINE_LAN_1;
01134 
01135 #define LOGIN_NEEDED      128
01136 #define DYNAMIC_LEN       64
01137 #define EXTERNAL_FILE     32
01138 #define RQ_DATA_CURRENT   16
01139 #define MENU_NEEDED       8
01140 
01141 #define CONTENT_MASK      7
01142 
01143 #define CONTENT_HTML      1
01144 #define CONTENT_PLAIN     2
01145 #define CONTENT_GIF       3
01146 #define CONTENT_JPEG      4
01147 
01148 
01149 typedef struct {
01150   char  name[23];
01151   byte  filetype;
01152   word  adr;
01153   word  len;
01154   uint32_t timestamp;
01155 } HTTP_DIRENTRY;
01156 
01157 typedef struct {
01158   word  count;
01159   word  magic;
01160   HTTP_DIRENTRY dir[1];
01161 } HTTP_DIRECTORY;
01162 
01163 #define IRTRANS_PORT    21000
01164 


ir_drivers
Author(s): Raul Perula-Martinez
autogenerated on Thu Apr 2 2015 03:06:05