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

📄 device.h

📁 Bycore是一个嵌入式操作系统内核。Bycore包括内存管理、任务管理、中断管理、任务互斥、同步与通信管理等功能。Bycore全部由C语言完成
💻 H
字号:
/** *  device.h * *  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 __DEVICE_H__#define __DEVICE_H__#include "include/types.h"#include "include/list.h"#include "include/mem.h"#include "include/spinlock.h"#define DEVICE_NR 255  // Suport to 255 devices.typedef struct _device {    list_t link;    spinlock_t lock;    word_t used_cnt;    char_t *name;    char_t mid;    char_t sid;    char_t dev_type;    bool_t delete_flag;} device_t;// For dev_type#define CHDEV 0x01  // Char device.#define BLKDEV 0x02 // Block device.#define NETDEV 0x03 // network device.#define DEV_FALSE FALSE#define DEV_OK TRUE#define DEV_NO_MEM 0x2#define DEV_NO_DEVICE 0x3#define DEV_BUSY 0x4#define DEV_FREE 0x5typedef void (*device_init_func)(void);/* Initialize all devices. */void device_init(void);/* Char device register. */word_t char_device_register(device_t *dev,/* Pointer to device node */                            const char_t *Name,/* Device name */                            char_t Mid,/* Main ID */                            char_t Sid);/* Secondary ID *//* Open a device */device_t *device_open(const char_t *name);/* Close a device */void device_close(device_t *dev);/* Delete a device */device_t *device_delete(uword_t chdevMID, uword_t chdevSID);#endif

⌨️ 快捷键说明

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