]> Zhao Yanbai Git Server - kernel.git/commitdiff
修复未正确初始化8253的问题
authoracevest <zhaoyanbai@126.com>
Fri, 10 May 2024 14:01:50 +0000 (22:01 +0800)
committeracevest <zhaoyanbai@126.com>
Fri, 10 May 2024 14:01:50 +0000 (22:01 +0800)
kernel/clock.c

index 0bcd146a7b7d5df23e59082218c2572cd9f83681..6c7ac6316781e4d5a34211b10493d123e4ba2efa 100644 (file)
@@ -81,7 +81,7 @@ void setup_i8253(uint16_t hz) {
     const uint8_t read_write_latch = 3;  // 0 锁存数据供CPU读;1只读写低字节;2只读写高字节;3先读写低字节,后读写高字节
     const uint8_t mode = 2;  //
 
-    const uint8_t cmd = (counter_no << 6) | (read_write_latch << 4) || (mode << 1);  // 第0位为0表示二进制,为1表示BCD
+    const uint8_t cmd = (counter_no << 6) | (read_write_latch << 4) | (mode << 1);  // 第0位为0表示二进制,为1表示BCD
 
     const uint8_t i8253_cmd_port = 0x43;
     const uint8_t i8253_data_port = 0x40 + counter_no;