00001
00023 #include "iom48.h"
00024 #include "inavr.h"
00025 #pragma language=extended
00026
00027 #define SOH 01
00028 #define EOT 04
00029 #define ACK 06
00030 #define NAK 21
00031 #define CRCCHR 'C'
00032
00033 #define TRUE 0x01
00034 #define FALSE 0x0
00035
00036 #define full 0xff
00037 #define empty 0x00
00038
00039 #define bad 0x00
00040 #define good 0x01
00041 #define dup 0x02
00042 #define end 0x03
00043 #define err 0x04
00044 #define out 0x05
00045
00046 #define DEBUG_PIN PORTD_Bit5 // spare pin used for debug signalling only
00047
00048
00049
00050
00051
00052 void receive(volatile unsigned char *bufptr1);
00053 void purge(void);
00054 void init(void);
00055 unsigned char validate_packet(unsigned char *bufptr, unsigned char *packet_number);
00056 void respond(unsigned char packet);
00057 void recv_wait(void);
00058 void sendc(void);
00059 int calcrc(unsigned char *ptr, int count);