2 * Copyright (c) 2007, IRTrans GmbH
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of IRTrans GmbH nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED BY IRTrans GmbH ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL IRTrans GmbH BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 #define F_ENABLEGROUP 0
35 #define F_VOLUMEMACRO 2
36 #define F_VOLUMEMACROD 3
42 #define IRDB_TYPEHEADER 9
43 #define IRDB_TYPEACTION 10
44 #define IRDB_TYPEACTION_1 11
45 #define IRDB_TYPEACTION_2 12
51 #define F_MAGIC 0x3542
53 #define COMPARE_LEN 128
62 #define TRANSM_MASK 124
66 #define TRANSM_EXT3 16
67 #define TRANSM_EXT4 32
68 #define TRANSM_INTERN 64
70 #define TRANSM_ALL TRANSM_MASK
80 #define TRANSM_MASK 48
81 #define TRANSM_INTERN 16
82 #define TRANSM_EXTERN 32
83 #define TRANSM_BOTH TRANSM_MASK
88 #define ACC_REPEAT 0xf
94 #define MACRO_TIMEOUT 500
97 // Remote = 0: Globale Informationen
106 byte trans_setup
[REMOTE_CNT
];
108 word target_mask
[REMOTE_CNT
];
109 word source_mask
[REMOTE_CNT
];
110 uint32_t group_flags
[REMOTE_CNT
];
114 FLASH_CONTENT f_content
;
115 word last_flashcommand
;
117 uint32_t last_command_time
;
118 uint32_t prekey_timeout
;
120 byte toggle_pos
[REMOTE_CNT
];
121 } FLASH_CONTENT_MEMORY
;
124 extern byte flash_mode
;
126 #define FLASH_MODE_TRANSLATOR 1
127 #define FLASH_MODE_IRDB 2
128 #define FLASH_MODE_IRDBAUX 4
129 #define FLASH_MODE_LAN_DB 8
130 #define FLASH_MODE_LANRELAIS 16
135 Alle Adressen relativ auf Nr. des Eintrags ??
140 hi: HASH_ENTRY für jedes IR Command -> PNT auf IRDB_IRCOMMAND
141 hc: HASH_ENTRY für jedes Command -> PNT auf IRDB_COMMAND
142 hr: HASH_ENTRY für jede Remote -> PNT auf IRDB_REMOTE
143 c: IRDB_COMMAND für jedes Command -> PNT auf IRDB_REMOTE + IRDB_TIMING + IRDB_IRCOMMAND
144 i: IRDB_IRCOMMAND für jedes Command -> PNT auf IRDB_COMMAND
162 byte low_commands
[50];
163 byte high_commands
[50];
169 word remote_hash_adr
;
172 word ircommand_hash_adr
;
173 byte return_stat_ok
[21];
174 byte return_stat_err
[21];
175 byte default_action
[100];
181 word remote_hash_adr
;
184 word ircommand_hash_adr
;
185 byte return_stat_ok
[21];
186 byte return_stat_err
[21];
187 byte default_action
[100];
195 IRDB_TABLE_SHORT table
;
212 FLASH_CONTENT_MEMORY translation_mem
;
213 IRDB_TABLE_SHORT irdb_mem
;
214 } FLASH_COMMON_HEADER_SHORT
;
217 FLASH_CONTENT_MEMORY translation_mem
;
219 } FLASH_COMMON_HEADER
;
222 extern FLASH_COMMON_HEADER f_common
;
224 extern FLASH_COMMON_HEADER_SHORT f_common
;
240 } IRDB_REMOTE_COMPACT
;
283 } IRDB_COMMAND_COMPACT
;
289 word pause_len
[TIME_LEN
];
290 word pulse_len
[TIME_LEN
];
305 #define ACTION_BINARY 1
306 #define ACTION_UDP_DEFAULT 2
307 #define ACTION_UDP_UDP 4
308 #define ACTION_UDP_AUX 8
310 #define ACTION_PORT 32
327 #define IRDB_REMOTE_LEN ((sizeof (IRDB_REMOTE) + 1) / 2)
328 #define IRDB_REMOTE_LEN_COMPACT (sizeof (IRDB_REMOTE_COMPACT) - 79)
329 #define IRDB_REMOTE_LEN_EX (sizeof (IRDB_REMOTE_EX) - 129)
330 #define IRDB_COMMAND_LEN ((sizeof (IRDB_COMMAND) + 1) / 2)
331 #define IRDB_COMMAND_LEN_COMPACT (sizeof (IRDB_COMMAND_COMPACT) - 19)
332 #define IRDB_COMMAND_LEN_1 ((sizeof (IRDB_COMMAND_1) + 1) / 2)
333 #define IRDB_HEADER_LEN ((sizeof (IRDB_HEADER) + 1) / 2)
334 #define IRDB_TIMING_LEN ((sizeof (IRDB_TIMING) + 1) / 2)
337 #define CONTENT_LEN ((sizeof (FLASH_CONTENT) + 1) / 2)
338 #define HASH_LEN ((sizeof (HASH_ENTRY) + 1) / 2)
348 byte accelerator_timeout
;
349 byte accelerator_repeat
;
363 byte accelerator_timeout
;
364 byte accelerator_repeat
;
377 byte accelerator_timeout
;
378 byte accelerator_repeat
;
400 void PutCRC(byte b
,CRC_BUFFER
*crcb
);
401 void CRCStart (CRC_BUFFER
*crcb
,byte init
);
402 void CRCSet (CRC_BUFFER
*crcb
,byte
*Data
, word Length
);
403 word
CRC (CRC_BUFFER
*crcb
);
407 void flash_lan (void);
408 void init_irdb (void);
409 void flash_init (void);
410 void flash_ioinit (void);
411 void read_flash_directory (void);
412 byte
flash_exec (byte adr
,byte data
[],byte len
,byte md
);
413 void load_flashcommand (word adr
,IRDATA
*ird
);
414 void send_flashcommand (FLASH_ENTRY
*fentry
,byte num
,byte md
);
415 word
find_flashentry (byte data
[],byte len
,word hpnt
,FLASH_ENTRY
*fentry
);
416 byte
compare_code (byte data
[],byte len
,word adr
,FLASH_ENTRY
*fentry
);
417 word
get_hashcode (byte data
[],byte len
);
418 void read_flashdata (byte
*pnt
,word adr
,word cnt
);
419 void write_flashdata (byte
*pnt
,word adr
,word cnt
);
420 void set_flashadr (word adr
);
421 void read_nextflashdata (byte
*pnt
,word cnt
);
422 void signal_error (void);
423 void set_commanddata (int pos
,IRDATA
*irpnt
);
424 void switch_relay (byte val
);
425 byte
irdb_findircommand (byte ircommand
[],byte irlen
,byte adr
,byte
*data
);
426 byte
irdb_send_string (byte
*str
,byte len
);
427 byte
irdb_send (byte remote
[],byte command
[],byte led
,word mask
,byte stat
);
428 byte
irdb_receive (byte ircommand
[],byte len
,IRRECEIVE
*ir
);
429 byte
irdb_format_receive (byte ircommand
[],byte len
,IRRECEIVE
*ir
,word adr
);
430 byte
udp_format_data (IRRECEIVE
*ir
,UDP_ASCII_RECEIVE
*data
,byte num
);
431 void ReadIRDataFlash (word iadr
,word tadr
);
432 word
_atoi (byte pnt
[]);
433 byte
irdb_findcommand (byte com
[],IRDB_REMOTE_EX
*irdb_rem
,IRDB_COMMAND_COMPACT
*irdb_com
);
434 void irdb_relais (IRRECEIVE
*ir
);