comparison packages/io/serial/current/include/serial.h @ 86:6512add4f5d6 ecos-sw-2000-05-05

Merge from eCos master repository on 2000-05-05-07:47:05-BST
author jlarmour
date Fri, 05 May 2000 17:31:08 +0000
parents bf00f99aec69
children 6ed91473a1cd
comparison
equal deleted inserted replaced
85:142b52c7e568 86:6512add4f5d6
44 // ==================================================================== 44 // ====================================================================
45 45
46 // Serial I/O interfaces 46 // Serial I/O interfaces
47 47
48 #include <pkgconf/system.h> 48 #include <pkgconf/system.h>
49 #include <pkgconf/io_serial.h>
50
49 #include <cyg/infra/cyg_type.h> 51 #include <cyg/infra/cyg_type.h>
50 #include <cyg/io/io.h> 52 #include <cyg/io/io.h>
51 #include <cyg/io/serialio.h> 53 #include <cyg/io/serialio.h>
52 #include <cyg/hal/drv_api.h> 54 #include <cyg/hal/drv_api.h>
53 55
60 void (*serial_init)(serial_channel *chan); 62 void (*serial_init)(serial_channel *chan);
61 // Cause an additional character to be output if one is available 63 // Cause an additional character to be output if one is available
62 void (*xmt_char)(serial_channel *chan); 64 void (*xmt_char)(serial_channel *chan);
63 // Consume an input character 65 // Consume an input character
64 void (*rcv_char)(serial_channel *chan, unsigned char c); 66 void (*rcv_char)(serial_channel *chan, unsigned char c);
67
68 #ifdef CYGINT_IO_SERIAL_BLOCK_TRANSFER
69 // Request space for input characters
70 bool (*data_rcv_req)(serial_channel *chan, int avail,
71 int* space_avail, unsigned char** space);
72 // Receive operation completed
73 void (*data_rcv_done)(serial_channel *chan);
74 // Request characters for transmission
75 bool (*data_xmt_req)(serial_channel *chan, int space,
76 int* chars_avail, unsigned char** chars);
77 // Transmit operation completed
78 void (*data_xmt_done)(serial_channel *chan);
79 #endif // CYGINT_IO_SERIAL_BLOCK_TRANSFER
65 } serial_callbacks_t; 80 } serial_callbacks_t;
66 81
82 #ifdef CYGINT_IO_SERIAL_BLOCK_TRANSFER
83 #define SERIAL_CALLBACKS(_l,_init,_xmt_char,_rcv_char, _data_rcv_req, _data_rcv_done, _data_xmt_req, _data_xmt_done) \
84 serial_callbacks_t _l = { \
85 _init, \
86 _xmt_char, \
87 _rcv_char, \
88 _data_rcv_req, \
89 _data_rcv_done, \
90 _data_xmt_req, \
91 _data_xmt_done \
92 };
93 #else
67 #define SERIAL_CALLBACKS(_l,_init,_xmt_char,_rcv_char) \ 94 #define SERIAL_CALLBACKS(_l,_init,_xmt_char,_rcv_char) \
68 serial_callbacks_t _l = { \ 95 serial_callbacks_t _l = { \
69 _init, \ 96 _init, \
70 _xmt_char, \ 97 _xmt_char, \
71 _rcv_char \ 98 _rcv_char \
72 }; 99 };
100 #endif
73 101
74 extern serial_callbacks_t cyg_io_serial_callbacks; 102 extern serial_callbacks_t cyg_io_serial_callbacks;
75 103
76 typedef struct { 104 typedef struct {
77 unsigned char *data; 105 unsigned char *data;
80 int len; 108 int len;
81 int low_water; // Min space in buffer before restart 109 int low_water; // Min space in buffer before restart
82 cyg_drv_cond_t wait; 110 cyg_drv_cond_t wait;
83 cyg_drv_mutex_t lock; 111 cyg_drv_mutex_t lock;
84 bool waiting; 112 bool waiting;
113 #ifdef CYGOPT_IO_SERIAL_SUPPORT_NONBLOCKING
114 bool blocking;
115 #endif
85 volatile bool abort; // Set by an outsider to kill processing 116 volatile bool abort; // Set by an outsider to kill processing
86 volatile cyg_int32 pending; // This many bytes waiting to be sent 117 volatile cyg_int32 pending; // This many bytes waiting to be sent
87 } cbuf_t; 118 } cbuf_t;
88 119
89 #define CBUF_INIT(_data, _len) \ 120 #define CBUF_INIT(_data, _len) \