mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-09-22 03:09:16 +08:00
Added device driver's IPC.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2098 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
@@ -5,6 +5,44 @@
|
||||
|
||||
#define RT_DEVICE(device) ((rt_device_t)device)
|
||||
|
||||
/* completion flag */
|
||||
struct rt_completion
|
||||
{
|
||||
rt_uint32_t flag;
|
||||
|
||||
/* suspended list */
|
||||
rt_list_t suspended_list;
|
||||
};
|
||||
|
||||
/* ring buffer */
|
||||
struct rt_ringbuffer
|
||||
{
|
||||
rt_uint16_t read_index, write_index;
|
||||
rt_uint8_t *buffer_ptr;
|
||||
rt_uint16_t buffer_size;
|
||||
};
|
||||
|
||||
/**
|
||||
* Completion
|
||||
*/
|
||||
void rt_completion_init(struct rt_completion* completion);
|
||||
rt_err_t rt_completion_wait(struct rt_completion* completion, rt_int32_t timeout);
|
||||
void rt_completion_done(struct rt_completion* completion);
|
||||
|
||||
/**
|
||||
* DataLink for DeviceDriver
|
||||
*/
|
||||
|
||||
/**
|
||||
* RingBuffer for DeviceDriver
|
||||
*/
|
||||
void rt_ringbuffer_init(struct rt_ringbuffer* rb, rt_uint8_t *pool, rt_uint16_t size);
|
||||
rt_size_t rt_ringbuffer_put(struct rt_ringbuffer* rb, const rt_uint8_t *ptr, rt_uint16_t length);
|
||||
rt_size_t rt_ringbuffer_putchar(struct rt_ringbuffer* rb, const rt_uint8_t ch);
|
||||
rt_size_t rt_ringbuffer_get(struct rt_ringbuffer* rb, rt_uint8_t *ptr, rt_uint16_t length);
|
||||
rt_size_t rt_ringbuffer_available_size(struct rt_ringbuffer* rb);
|
||||
rt_size_t rt_ringbuffer_emptry_size(struct rt_ringbuffer* rb);
|
||||
|
||||
#ifdef RT_USING_SPI
|
||||
#include "drivers/spi.h"
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user