ddf_io.h

来自「一个简单的小型操作系统」· C头文件 代码 · 共 147 行

H
147
字号

/*****************************************************************************
 * 
 * Module       : io.c
 * Description  : interface to the low level drivers. io conform
 *                with DDF 0.01 specification.
 * OS           : SLOS 0.09
 * Platform     : e7t
 * History      :
 *
 * 20th November 2001 Andrew N. Sloss
 * - created io.c from the DDF 0.01 test program
 *
 *****************************************************************************/

/*****************************************************************************
 * IMPORT 
 *****************************************************************************/

#include "ddf_frame.h"

/*****************************************************************************
 * ROUTINES 
 *****************************************************************************/

/* -- ioInitalizeDrivers ------------------------------------------------------
 *
 * Description  : initializes all the device driver in the device_treestr
 *
 * Parameters   : DDF does not take any parameter
 * Return       : none...
 * Notes        :
 * 
 */

void ioInitializeDrivers(void);

/* -- ioOpenDriver ------------------------------------------------------------
 * 
 * Description  : open a driver for access
 *
 * Parameters   : int *id - pointer the id 
 *              : unsigned major - major device i.e. DEVICE_SERIAL_E7T
 *              : unsigned minor - minor device i.e. COM1
 * Return       : device_treestr * ptr
 * Notes        :
 *
 */ 

device_treestr *ioOpenDriver(int *id,unsigned major,unsigned minor);

/* -- ioCloseDriver -----------------------------------------------------------
 * 
 * Description  : close a driver for access
 *
 * Parameters   : device_treestr * - pointer to device node. 
 *              : UID id - id of particular device
 * Return       : int 
 * Notes        : 
 *
 */ 

int ioCloseDriver(device_treestr *d, UID id);

/* -- ioBitWrite --------------------------------------------------------------
 * 
 * Description  : write a bit to the device
 *
 * Parameters   : device_treestr * - pointer to device node. 
 *              : UID id - id of particular device
 *              : BYTE bit - only least significant used
 * Return       : none...
 * Notes        : 
 *
 */ 

void ioWriteBit(device_treestr *d,UID id,BYTE bit);

/* -- ioBitRead ---------------------------------------------------------------
 * 
 * Description  : read a bit to the device
 *
 * Parameters   : device_treestr * - pointer to device node. 
 *              : UID id - id of particular device
 *              : BYTE bit - only least significant used
 * Return       : BYTE if = 255 then error
 * Notes        : 
 *
 */ 

BYTE ioReadBit(device_treestr *d,UID id);

/* -- ioWriteByte -------------------------------------------------------------
 * 
 * Description  : write a byte to the device
 *
 * Parameters   : device_treestr * - pointer to device node. 
 *              : UID id - id of particular device
 *              : BYTE byte - byte to be written
 * Return       : none...
 * Notes        : 
 *
 */ 

void ioWriteByte(device_treestr *d,UID id,BYTE byte);

/* -- ioReadByte --------------------------------------------------------------
 * 
 * Description  : read a byte to the device
 *
 * Parameters   : device_treestr * - pointer to device node. 
 *              : UID id - id of particular device
 * Return       : BYTE if = 255 then error
 * Notes        : 
 *
 */ 

BYTE ioReadByte(device_treestr *d,UID id);

/* -- ioWriteBlock ------------------------------------------------------------
 * 
 * Description  : write a block to the device
 *
 * Parameters   : device_treestr * - pointer to device node. 
 *              : UID id - id of particular device
 *              : block_data_t * block
 * Return       : none...
 * Notes        : 
 *
 */ 

void ioWriteBlock(device_treestr *d,UID id, block_data_t *block);

/* -- ioReadBlock -------------------------------------------------------------
 * 
 * Description  : read a block from a device
 *
 * Parameters   : device_treestr * - pointer to device node. 
 *              : UID id - id of particular device
 * Return       : block_data_t *
 * Notes        : 
 *
 */ 

block_data_t *ioReadBlock(device_treestr *d,UID id);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?