Milos RTOS v0.3.4a
Real Time Operating System
device.h File Reference
#include <plat_ostypes.h>
#include "ioctl.h"
#include "event.h"
#include "thread.h"
Include dependency graph for device.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  __deviceTag
 Device driver control block. More...

Defines

#define __DEV_NAMELEN   8
 Device name maximum length.
#define __DEV_RD_CR   0x01
 Read CR flag.
#define __DEV_RD_LF   0x02
 Read LF flag.
#define __DEV_RD_CRLF   0x03
 Read CR/LF flag.
#define __DEV_WR_CR   0x04
 Write CR flag.
#define __DEV_WR_LF   0x08
 Write LF flag.
#define __DEV_AUTOFLUSH   0x10
 Flush after write.
#define __DEV_WR_CRLF   0x0C
 Write CR/LF flag.
#define __DEV_OK   0
#define __DEV_ERROR   -1
#define __DEV_WRITE_ERROR   -2
#define __DEV_READ_ERROR   -3
#define __DEV_UNK_IOCTL   -4
#define __DEV_MEM_ERROR   -5
#define __DEV_TIMEOUT   -6
#define __DEV_BUSY   -7
#define __DEV_INVALID   -8
#define __DEV_NOT_READY   -9
#define __DEV_RXSIZE   0
 Retrieves the size of the RX buffer.
#define __DEV_TXSIZE   1
 Retrieves the size of the TX buffer.
#define __DEV_STREAM   1
 Device type STREAM.
#define __DEV_BLOCK   2
 Device type BLOCK.
#define __DEV_ETHER   3
 Device type NETWORK.
#define __DEV_PPP   4
 Device type PPP.
#define __DEV_DISK   5
 Device type DISK.
#define __DEV_IRDA   6
 Device type IRDA.
#define __DEV_BTH   7
 Device type BLUETOOTH.
#define __DEV_ADC   8
 Device type A/D converter.
#define __DEV_USART   9
 Device type USART.
#define __DEV_SPI   10
 Device type SPI.
#define __DEV_DISPLAY   11
 Device type display.
#define __DEV_I2C   12
 Device type I2C.
#define __DEV_SDIO   13
 Device type SDIO.
#define __DEV_USBH   14
 Device type USB host.
#define __DEV_USBD   15
 Device type USB device.
#define __DEV_USB_OTG   16
 Device type USB on-the-go.
#define __DEV_CFSD   17
 Device type Compact flash/SD.
#define __DEV_EEPROM   18
 Device type EEPROM memory.
#define __DEV_SOCKET   19
 Device type network socket.
#define __deviceInitialized(dv)   (dv->dv_initd)
#define __deviceOpened(dv)   (dv->dv_opcnt)

Typedefs

typedef i32__DEV_INIT )(struct __deviceTag *, __PVOID)
 Initializes the device.
typedef i32__DEV_DEINIT )(struct __deviceTag *)
 De-initializes the device.
typedef i32__DEV_IOCTL )(struct __deviceTag *, u32, u32, __PVOID, u32)
 IOCTL function.
typedef i32__DEV_OPEN )(struct __deviceTag *, u32)
 Opens the device.
typedef i32__DEV_CLOSE )(struct __deviceTag *)
 Closes the device.
typedef i32__DEV_READ )(struct __deviceTag *, __PVOID, u16)
 Reads from RX buffer.
typedef i32__DEV_WRITE )(struct __deviceTag *, __CONST __PVOID, u16)
 Writes to TX buffer.
typedef i32__DEV_FLUSH )(struct __deviceTag *)
 Flushes TX buffer.
typedef i32__DEV_SIZE )(struct __deviceTag *, u8)
 Retrieves TX/RX buffer size.
typedef i32__DEV_PLAT_IOCTL )(struct __deviceTag *, u32, u32, __PVOID, u32, __PVOID, u32)
 Platform-related IO control.
typedef struct __deviceTag __DEVICE
 Device driver control block.
typedef struct __deviceTag__PDEVICE

Functions

__PDEVICE __deviceGetList (__VOID)
 Returns the active devices list.
__PDEVICE __deviceFind (__CONST __PSTRING name)
 Find device by name.
i32 __deviceInit (__PDEVICE dv, __PVOID params, u32 mode)
 Initializes a device.
i32 __deviceDeinit (__PDEVICE dv)
 De-initializes a device.
i32 __deviceWriteLine (__PDEVICE dv, __CONST __PSTRING buf)
 Writes a line of text to the device.
i32 __deviceReadLine (__PDEVICE dv, __PSTRING buf, u16 qty)
 Reads a line of text from the device.
i32 __deviceIOCtl (__PDEVICE dv, u32 cmd, u32 param, __PVOID data, u32 len)
 Device IO Control function.
i32 __deviceOpen (__PDEVICE dv, u32 param)
 Opens a device.
i32 __deviceClose (__PDEVICE dv)
 Closes a device.
i32 __deviceRead (__PDEVICE dv, __PVOID buf, u16 qty)
 Reads from device.
i32 __deviceWrite (__PDEVICE dv, __CONST __PVOID buf, u16 qty)
 Writes to a device.
i32 __deviceFlush (__PDEVICE dv)
 Flushes device's TX buffer.
i32 __deviceSize (__PDEVICE dv, u8 mode)
 Get the remaining TX or RX bytes in the device's buffer.
__VOID __deviceAdd (__PDEVICE dv, u8 count)
 Add a device to the devices list.
__VOID __deviceRemove (__PDEVICE dv)
 Removes a device form the devices list.
__VOID __deviceDbgTermOutput (__VOID)
 All Data Structures Files Functions Variables Typedefs Defines