ARM9教程DSP教程FPGA教程CPLD教程12A软硬件设计0229
// field and initialize the head, tail and busy fields to 0 typedef struct {
char * buffer; int buffer_size; int head; int tail;
} srl0_receive_buffer_t;
typedef struct {
char * buffer; int buffer_size; int head; int tail; int busy;
} srl0_transmit_buffer_t;
//.............................................................................. // Send byte - send immediately if possible, otherwise queue in buffer and // send in interrupt handler
void srl0_send_byte ( unsigned int base, unsigned char val, srl0_transmit_buffer_t *buffer );
//.............................................................................. // Receive byte - will return // 0 if no value in buf, // 1 if value in buf.
// Buffer is populated by interrupt handler
int srl0_receive_byte(srl0_receive_buffer_t *buffer, char *buf);
//..............................................................................