- 5
- 0
- 约2.99千字
- 约 10页
- 2018-12-31 发布于天津
- 举报
CS4101嵌入式系统概论IODrivers.ppt
CS4101 嵌入式系統概論I/O Drivers Prof. Chung-Ta King Department of Computer Science National Tsing Hua University, Taiwan (Materials from How to Develop I/O Drivers for MQX, Freescale MQX I/O Drivers Users Guide) Outline Basics of I/O device drivers Null driver Random number generator driver I/O Device Drivers Dynamically installed software packages that provide a direct interface to hardware Driver installation: Each device driver has a driver-specific installation function, io_device_install(), which is called in init_bsp.c under “mqx\source\bsp\” directory. The installation function then calls _io_dev_install() to register the device with MQX. To install a new device driver, the init_bsp.c needs to be modified and the BSP rebuilt I/O Device Drivers Device names Device name must end with :, e.g. _io_mfs_install(mfs1: ...) Characters following : are information passed to device driver by fopen() call, e.g., fopen(mfs1:bob.txt) opens file bob.txt on device mfs1: I/O device drivers provide following services: _io_device_open: required _io_device_close: required _io_device_read: optional _io_device_write: optional _io_device_ioctl: optional Null Driver The null device driver is an I/O device that functions as a device driver but does not perform any work. Code at “mqx\source\io\io_null\” Null Driver _mqx_uint _io_null_install(char_ptr identifier) /* “idetifier” identifies the device for fopen */ { _mqx_uint result; result = _io_dev_install(identifier, _io_null_open, _io_null_close, _io_null_read, _io_null_write, _io_null_ioctl, NULL); return result; } Null Driver /* This function is called when the user calls fopen. It prepares the driver for subsequent read, write, and ioctl operations.*/ _mqx_int _io_null_open(MQX_FILE_PTR fd_ptr, char_ptr open_name_ptr, char_ptr flags) { /* Nothing to do */ return(MQX_OK); } Null Driver _mqx_int _io_null_read(MQX_FILE_PTR fd_ptr, char_ptr data_ptr, _mqx_int num) { /*
您可能关注的文档
- 2600下方需震荡整固后市仍有反弹空间.PDF
- 3405工作面沿空留巷切顶爆破钻孔与高位瓦斯抽采钻孔的位.PDF
- 5403土建施工类.PDF
- A02-纳米材料与新能源.PDF
- ADI公司的革命性MEMS开关技术基本原理.PDF
- anditsSocialConsequence流行文化及其社会后果社会工.ppt
- and爄s爁or爑se爋utside炉he燯K爋nly.PDF
- AP化学和普高化学课程实施的对比与分析.PDF
- ArcSoft虹软彩信通用户手册.PDF
- askifyoucouldbringafriend.如果你必须在我之前死去,麻.ppt
- 25-26学年政治(部编版)选择性必修第二册课件:第1单元 周清1 民法中的人身权及财产权.pptx
- 25-26学年政治(部编版)选择性必修第二册课件:1.4.1 权利保障 于法有据.pptx
- 2025北京丰台区高二(上)期中地理(A卷)含答案.docx
- 2025北京三帆中学初三(上)开学考英语试题含答案.docx
- 2025北京一零一中初三9月月考语文试题含答案.docx
- 2025北京海淀区初三(上)期中道法试题含答案.docx
- 2025北京丰台区高一(上)期中政治(A卷)含答案.docx
- 25-26学年政治统编版必修4课件:3.3 唯物辩证法的实质与核心.pptx
- 25-26学年政治统编版必修4课件:7.2 正确认识中华传统文化.pptx
- 湖北省部分高中2026届高三上学期二模联考 历史试卷.docx
原创力文档

文档评论(0)