⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 chdev.h

📁 Bycore是一个嵌入式操作系统内核。Bycore包括内存管理、任务管理、中断管理、任务互斥、同步与通信管理等功能。Bycore全部由C语言完成
💻 H
字号:
/** *  chdev.h - Driver model of char devices and related calls * *  Copyright (C) 2008  ZhangHu *  All rights reserved. *  E-MAIL: anmnmnly@gmail.com * *  This program is free software: you can redistribute it and/or modify *  it under the terms of the GNU General Public License as published by *  the Free Software Foundation, either version 3 of the License, or *  (at your option) any later version. * *  This program is distributed in the hope that it will be useful, *  but WITHOUT ANY WARRANTY; without even the implied warranty of *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the *  GNU General Public License for more details. * *  You should have received a copy of the GNU General Public License *  along with this program.  If not, see <http://www.gnu.org/licenses/>. */#ifndef __CHDEV_H__#define __CHDEV_H__#include "device.h"#include "include/sem.h"#include "hw_chdev.h"struct chdev_operations {    word_t(*open)(void);    word_t(*close)(void);    loff_t(*llseek)(loff_t loff);    word_t(*write)(const char_t *buf, uword_t len, loff_t loff);    word_t(*read)(char_t *buf, uword_t len, loff_t loff);    word_t(*ioctl)(uword_t cmd, void *arg); // return TRUE or FALSE    void (*release)(void); // Called before device unregister.};typedef struct _char_device {    device_t dev;  /* Device node */    loff_t loff;   /* Offset of read and write */    struct chdev_operations *op; /* Operations for char device */} chdev_t;/* Register a device to Bycore */word_t chdevRegister(char_t Mid, /* Main ID */                     char_t Sid, /* Secondary ID */                     const char_t *Name, /* Device name */                     struct chdev_operations *Operation);/* Unregister a device from Bycore */word_t chdevUnRegister(uword_t chdevMID, uword_t chdevSID);#endif

⌨️ 快捷键说明

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