mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-12 18:26:50 +00:00
Merge branch 'usb'
This commit is contained in:
commit
98371a9b4a
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@ -108,7 +108,8 @@
|
||||
"ahci.h": "c",
|
||||
"slab.h": "c",
|
||||
"boot_info.h": "c",
|
||||
"pci.h": "c"
|
||||
"pci.h": "c",
|
||||
"time.h": "c"
|
||||
},
|
||||
"C_Cpp.errorSquiggles": "Enabled",
|
||||
"esbonio.sphinx.confDir": ""
|
||||
|
@ -37,6 +37,14 @@ struct timespec
|
||||
*/
|
||||
extern int nanosleep(const struct timespec *rqtp, struct timespec *rmtp);
|
||||
|
||||
/**
|
||||
* @brief 睡眠指定时间
|
||||
*
|
||||
* @param usec 微秒
|
||||
* @return int
|
||||
*/
|
||||
extern int usleep(useconds_t usec);
|
||||
|
||||
/**
|
||||
* @brief 获取当前的CPU时间
|
||||
*
|
||||
|
@ -154,9 +154,10 @@ void system_initialize()
|
||||
|
||||
// fat32_init();
|
||||
HPET_enable();
|
||||
usb_init();
|
||||
|
||||
// 系统初始化到此结束,剩下的初始化功能应当放在初始内核线程中执行
|
||||
apic_timer_init();
|
||||
|
||||
}
|
||||
|
||||
//操作系统内核从这里开始执行
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include <common/compiler.h>
|
||||
#include <common/libELF/elf.h>
|
||||
#include <driver/video/video.h>
|
||||
#include <driver/usb/usb.h>
|
||||
#include <exception/gate.h>
|
||||
#include <filesystem/fat32/fat32.h>
|
||||
#include <mm/slab.h>
|
||||
@ -410,7 +411,10 @@ ul initial_kernel_thread(ul arg)
|
||||
// kinfo("initial proc running...\targ:%#018lx", arg);
|
||||
|
||||
fat32_init();
|
||||
usb_init();
|
||||
|
||||
|
||||
// 准备切换到用户态
|
||||
struct pt_regs *regs;
|
||||
|
||||
current_pcb->thread->rip = (ul)ret_from_system_call;
|
||||
|
@ -59,4 +59,20 @@ int nanosleep(const struct timespec *rqtp, struct timespec *rmtp)
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 睡眠指定时间
|
||||
*
|
||||
* @param usec 微秒
|
||||
* @return int
|
||||
*/
|
||||
int usleep(useconds_t usec)
|
||||
{
|
||||
struct timespec ts = {
|
||||
tv_sec : (long int)(usec / 1000000),
|
||||
tv_nsec : (long int)(usec % 1000000) * 1000UL
|
||||
};
|
||||
|
||||
return nanosleep(&ts, NULL);
|
||||
}
|
||||
|
@ -14,3 +14,10 @@
|
||||
*/
|
||||
int nanosleep(const struct timespec *rqtp, struct timespec *rmtp);
|
||||
|
||||
/**
|
||||
* @brief 睡眠指定时间
|
||||
*
|
||||
* @param usec 微秒
|
||||
* @return int
|
||||
*/
|
||||
int usleep(useconds_t usec);
|
Loading…
x
Reference in New Issue
Block a user