mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-23 03:53:26 +00:00
新版文件系统重构完成 (#198)
1.重构:VFS 2. 重构:ProcFS 3. 重构:DevFS 4. 重构:FAT32 5. 重构:AHCI驱动 6. 新增:RamFS 7. 新增:MountFS 8. 新增:FAT12 9. 新增:FAT16 10. 重构:设备抽象 Co-authored-by: guanjinquan <1666320330@qq.com> Co-authored-by: DaJiYuQia <88259094+DaJiYuQia@users.noreply.github.com>
This commit is contained in:
@ -4,7 +4,6 @@
|
||||
#include <mm/slab.h>
|
||||
#include <common/printk.h>
|
||||
#include <filesystem/vfs/VFS.h>
|
||||
#include <filesystem/devfs/devfs.h>
|
||||
#include <common/wait_queue.h>
|
||||
#include <common/spinlock.h>
|
||||
#include <common/kfifo.h>
|
||||
@ -14,6 +13,7 @@ static struct kfifo_t kb_buf;
|
||||
|
||||
// 缓冲区等待队列
|
||||
static wait_queue_node_t ps2_keyboard_wait_queue;
|
||||
extern void ps2_keyboard_register(struct vfs_file_operations_t *);
|
||||
|
||||
// 缓冲区读写锁
|
||||
static spinlock_t ps2_kb_buf_rw_lock;
|
||||
@ -48,7 +48,6 @@ hardware_intr_controller ps2_keyboard_intr_controller =
|
||||
*/
|
||||
long ps2_keyboard_open(struct vfs_index_node_t *inode, struct vfs_file_t *filp)
|
||||
{
|
||||
filp->private_data = &kb_buf;
|
||||
ps2_keyboard_reset_buffer(&kb_buf);
|
||||
return 0;
|
||||
}
|
||||
@ -62,7 +61,6 @@ long ps2_keyboard_open(struct vfs_index_node_t *inode, struct vfs_file_t *filp)
|
||||
*/
|
||||
long ps2_keyboard_close(struct vfs_index_node_t *inode, struct vfs_file_t *filp)
|
||||
{
|
||||
filp->private_data = NULL;
|
||||
ps2_keyboard_reset_buffer(&kb_buf);
|
||||
return 0;
|
||||
}
|
||||
@ -146,7 +144,7 @@ void ps2_keyboard_handler(ul irq_num, ul buf_vaddr, struct pt_regs *regs)
|
||||
{
|
||||
unsigned char x = io_in8(PORT_PS2_KEYBOARD_DATA);
|
||||
|
||||
uint8_t count = kfifo_in((struct kfifo_t*)buf_vaddr, &x, sizeof(unsigned char));
|
||||
uint8_t count = kfifo_in((struct kfifo_t *)buf_vaddr, &x, sizeof(unsigned char));
|
||||
if (count == 0)
|
||||
{
|
||||
kwarn("ps2 keyboard buffer full.");
|
||||
@ -205,7 +203,8 @@ void ps2_keyboard_init()
|
||||
// 先读一下键盘的数据,防止由于在键盘初始化之前,由于按键被按下从而导致接收不到中断。
|
||||
io_in8(PORT_PS2_KEYBOARD_DATA);
|
||||
// 将设备挂载到devfs
|
||||
devfs_register_device(DEV_TYPE_CHAR, CHAR_DEV_STYPE_PS2_KEYBOARD, &ps2_keyboard_fops, NULL);
|
||||
ps2_keyboard_register(&ps2_keyboard_fops);
|
||||
|
||||
kinfo("ps/2 keyboard registered.");
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user