www.pudn.com > EM4469firmware.zip > level4.h


/* 
*------------------------------------------------------------------------------- 
*--  RCSId: $Id: level4.h,v 0.17 2003-10-10 10:55:42+02 mjg Exp mjg $ 
*--         $Name:  $ 
*------------------------------------------------------------------------------- 
*-- level4.c - UART Communication Routines header file 
*------------------------------------------------------------------------------- 
*-- $Log: level4.h,v $ 
*-- Revision 0.17  2003-10-10 10:55:42+02  mjg 
*-- *** empty log message *** 
*-- 
*-- Revision 0.16  2003-08-21 16:00:21+02  mjg 
*-- RTF capture problem 
*-- 
*-- Revision 0.15  2003-08-20 10:53:20+02  mjg 
*-- to redesign SearchPattern 
*-- 
*-- Revision 0.14  2003-08-20 10:00:46+02  mjg 
*-- to add debug features 
*-- 
*-- Revision 0.13  2003-08-07 08:01:31+02  mjg 
*-- *** empty log message *** 
*-- 
*-- Revision 0.11  2003-07-22 13:27:45+02  mjg 
*-- cloned firmware 
*-- 
*------------------------------------------------------------------------------- 
*/ 
 
#ifndef __LEVEL4__ 
#define __LEVEL4__ 
 
//// to enable debug version, uncomment following:  
//#define DEBUG 
 
//constants---------------------------------------------------------- 
#define READER_RELEASE 0x10             //release 
#define READER_DATE      15 
#define READER_MONTH     10 
#define READER_YEAR       3 
#define READER_FAMILY     2 
 
//error list--------------------------------------------------------- 
#define UART_MESSAGE_OK          0x00 
#define ERR_ASIC_ANTENNA_FAULT   0x01 
#define ERR_UART_ERROR_FLAG      0x04 
#define ERR_UART_OVERFLOW        0x05 
#define ERR_UART_WRONG_ICMD      0x06 
#define ERR_UART_BAD_CRC         0x07 
#define ERR_UART_UNKNOWN_CMD     0x08 
#define ERR_UART_NO_ETX          0x09 
#define ERR_UART_INTERBYTE_ERR   0x0A 
#define ERR_EM4469_FLOWLINK_ERR  0x0B 
#define ERR_EM4469_WRONG_DE      0x0C 
#define ERR_EM4469_WRONG_DR      0x0D 
#define ERR_EM4469_PARITY_ERR    0x10 
#define ERR_EM4469_BAD_CONF_DATA 0x11 
#define ERR_EM4469_NACK          0x12 
#define ERR_EM4469_NEITHER_ACK   0x13 
#define ERR_EM4469_NO_VALID_DR   0x14 
#define ERR_EM4469_BAD_RAW       0x15 
 
//public variables--------------------------------------------------- 
 
extern uint8_t volatile uart_read_bytes;       //  
extern uint8_t volatile uart_read_msg_bytes;   // 
 
extern uint8_t volatile uart_command;          // command handshake value 
                                               // set by UART RECV 
                                               // reset by main() when done 
 
extern uint8_t read_tag_memory_word_address;   // address of Read cmd 
extern uint16_t read_tag_memory_word_low;      // Read Cmd content low 
extern uint16_t read_tag_memory_word_hi;       // Read Cmd content hi 
 
extern uint16_t write_tag_memory_word_address; // address of Write Tag cmd 
extern uint16_t write_tag_memory_word_low;     // low word of Write Tag cmd 
extern uint16_t write_tag_memory_word_hi;      // hi word of Write Tag cmd 
 
extern uint16_t write_tag_memory_login_low;    // low word of Login cmd 
extern uint16_t write_tag_memory_login_hi;     // hi word of Login cmd 
 
extern uint8_t write_tag_memory_forward_link;  // forward item of Forward link cmd 
 
extern uint16_t read_only_word_low;            // Read Only Cmd content low 
extern uint16_t read_only_word_hi;             // Read Only Cmd content hi 
 
 
extern uint8_t switch_coil_byte;               // switch item of Set Coil cmd 
 
extern uint8_t config_data_rate;               // see EM4469 spec 
extern uint8_t config_encoder;                 // see EM4469 spec 
extern uint8_t config_delayed;                 // see EM4469 spec 
extern uint8_t config_lwr;                     // see EM4469 spec 
extern uint8_t config_raw;                     // see EM4469 spec 
extern uint8_t config_forward_link;            // 0=4050 type, 1=other 
extern uint8_t config_write_conf;              // 1=write this configuration into the EEPROM 
 
extern uint8_t volatile read_pos;              // debug uart data ptr 
extern uint8_t * read_ptr;                     // debug uart read ptr 
 
extern uint8_t fwd_set_0;                      // forwadlink pulse length values to be set 
extern uint8_t fwd_set_A; 
extern uint8_t fwd_set_B; 
extern uint8_t fwd_set_C; 
extern uint8_t fwd_set_D; 
extern uint8_t fwd_set_E; 
extern uint8_t fwd_set_F; 
 
extern uint8_t debug_mode; 
 
//function declarations---------------------------------------------- 
 
extern void UARTIni(void);                    // initialization of UART 
 
extern uint8_t CheckIncommingMessage(void); 
 
extern void EmmitError(uint8_t err); 
 
//extern void SendResponse(void);                // Sends output buffer to serial port 
 
extern void FormatResponse_Short(uint8_t, uint8_t); //Formats the short type response into the output buffer 
 
extern void FormatResponse_Status(uint8_t); 
 
extern void FormatResponse_Word(uint8_t ack, uint8_t cmd, uint16_t word_low, uint16_t word_hi); 
 
extern void FormatResponse_AddrWord(uint8_t ack, uint8_t cmd, uint8_t address, uint16_t word_low, uint16_t word_hi); 
 
extern void FormatResponse_AutoDefaultRead(uint8_t ack, uint8_t cmd, uint8_t type, uint32_t byte, uint32_t word); 
 
//debug-------------------------------------------------------------- 
 
#define UART_OUT_BUFFER_SIZE 250           // outgoing data uart buffer reserved size 
extern uint8_t volatile uart_out_buffer[UART_OUT_BUFFER_SIZE];   // output buffer 
 
#endif // __LEVEL4__