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. 49 #define IGNORE_CHAR(c) (c == 0x0d) 57 static uint8_t rxbuf_data[BUFSIZE];
59 PROCESS(serial_line_process,
"Serial driver");
67 static uint8_t overflow = 0;
94 static char buf[BUFSIZE];
111 if(ptr < BUFSIZE-1) {
112 buf[ptr++] = (uint8_t)c;
118 buf[ptr++] = (uint8_t)
'\0';
137 serial_line_init(
void)
#define PROCESS(name, strname)
Declare a process.
#define PROCESS_BEGIN()
Define the beginning of a process.
#define PROCESS_END()
Define the end of a process.
int ringbuf_get(struct ringbuf *r)
Get a byte from the ring buffer.
#define PROCESS_WAIT_EVENT_UNTIL(c)
Wait for an event to be posted to the process, with an extra condition.
Header file for the ring buffer library
#define PROCESS_ERR_OK
Return value indicating that an operation was successful.
#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.
#define PROCESS_YIELD()
Yield the currently running process.
process_event_t process_alloc_event(void)
Allocate a global event number.
process_event_t serial_line_event_message
Event posted when a line of input has been received.
int process_post(struct process *p, process_event_t ev, process_data_t data)
Post an asynchronous event.
Generic serial I/O process header filer.
Structure that holds the state of a ring buffer.
PROCESS_THREAD(cc2538_rf_process, ev, data)
Implementation of the cc2538 RF driver process.
int ringbuf_put(struct ringbuf *r, uint8_t c)
Insert a byte into the ring buffer.
void ringbuf_init(struct ringbuf *r, uint8_t *dataptr, uint8_t size)
Initialize a ring buffer.
void process_start(struct process *p, process_data_t data)
Start a process.