37 #ifdef SERIAL_LINE_CONF_BUFSIZE
38 #define BUFSIZE SERIAL_LINE_CONF_BUFSIZE
43 #if (BUFSIZE & (BUFSIZE - 1)) != 0
44 #error SERIAL_LINE_CONF_BUFSIZE must be a power of two (i.e., 1, 2, 4, 8, 16, 32, 64, ...).
45 #error Change SERIAL_LINE_CONF_BUFSIZE in contiki-conf.h.
48 #define IGNORE_CHAR(c) (c == 0x0d)
52 static uint8_t rxbuf_data[BUFSIZE];
54 PROCESS(serial_line_process,
"Serial driver");
62 static uint8_t overflow = 0;
89 static char buf[BUFSIZE];
106 if(ptr < BUFSIZE-1) {
107 buf[ptr++] = (uint8_t)c;
113 buf[ptr++] = (uint8_t)
'\0';
132 serial_line_init(
void)
#define PROCESS_CURRENT()
Get a pointer to the currently running process.
int serial_line_input_byte(unsigned char c)
Get one byte of input from the serial driver.
void process_poll(struct process *p)
Request a process to be polled.
Header file for the ring buffer library
#define PROCESS_BEGIN()
Define the beginning of a process.
#define PROCESS_ERR_OK
Return value indicating that an operation was successful.
Structure that holds the state of a ring buffer.
#define NULL
The null pointer.
int ringbuf_get(struct ringbuf *r)
Get a byte from the ring buffer.
process_event_t process_alloc_event(void)
Allocate a global event number.
int process_post(struct process *p, process_event_t ev, process_data_t data)
Post an asynchronous event.
void ringbuf_init(struct ringbuf *r, uint8_t *dataptr, uint8_t size)
Initialize a ring buffer.
#define PROCESS_THREAD(name, ev, data)
Define the body of a process.
#define PROCESS_END()
Define the end of a process.
Generic serial I/O process header filer.
#define PROCESS_WAIT_EVENT_UNTIL(c)
Wait for an event to be posted to the process, with an extra condition.
tcirc_buf rxbuf
The RX circular buffer, for storing characters from serial port.
process_event_t serial_line_event_message
Event posted when a line of input has been received.
#define PROCESS(name, strname)
Declare a process.
void process_start(struct process *p, process_data_t data)
Start a process.
#define PROCESS_YIELD()
Yield the currently running process.
int ringbuf_put(struct ringbuf *r, uint8_t c)
Insert a byte into the ring buffer.