Initial commit
This commit is contained in:
51
kernel/drivers/ports.h
Normal file
51
kernel/drivers/ports.h
Normal file
@@ -0,0 +1,51 @@
|
||||
#ifndef MY_KERNEL_DRIVERS_PORT_H
|
||||
#define MY_KERNEL_DRIVERS_PORT_H
|
||||
|
||||
//http://www.osdever.net/FreeVGA/vga/crtcreg.htm#0A
|
||||
#define PORT_REG_SCREEN_CTRL 0x3d4
|
||||
#define PORT_REG_SCREEN_CTRL_CURSOR_H 0x0E
|
||||
#define PORT_REG_SCREEN_CTRL_CURSOR_L 0x0F
|
||||
#define PORT_REG_SCREEN_DATA 0x3d5
|
||||
|
||||
// https://wiki.osdev.org/Serial_Ports
|
||||
#define PORT_SERIAL_0 0x3f8
|
||||
#define PORT_SERIAL_1 0x2f8
|
||||
#define PORT_SERIAL_2 0x3e8
|
||||
#define PORT_SERIAL_3 0x2e8
|
||||
|
||||
#define PORT_SERIAL_DATA 0
|
||||
#define PORT_SERIAL_INTERRUPT 1
|
||||
#define PORT_SERIAL_DLAB_LSB 0
|
||||
#define PORT_SERIAL_DLAB_MSB 1
|
||||
#define PORT_SERIAL_INTERRUPT_ID_FIFO 2
|
||||
#define PORT_SERIAL_LINE_CONTROL 3
|
||||
#define PORT_SERIAL_MODEM_CONTROL 4
|
||||
#define PORT_SERIAL_LINE_STATUS 5
|
||||
#define PORT_SERIAL_MODEM_STATUS 6
|
||||
#define PORT_SERIAL_SCRATCH 6
|
||||
|
||||
// https://wiki.osdev.org/PIT
|
||||
#define PORT_PIT_COMMAND 0x43
|
||||
#define PIT_MODE_BIN 0x0
|
||||
#define PIT_MODE_HW_STROBE 0b0101
|
||||
#define PIT_MODE_SQUARE_WAVE 0b0110
|
||||
#define PIT_ACCESS_MODE_HL 0b000011
|
||||
#define PIT_CHANNEL_0 0b00000000
|
||||
#define PORT_PIT_DATA_0 0x40
|
||||
#define PORT_PIT_DATA_1 0x41
|
||||
#define PORT_PIT_DATA_3 0x42
|
||||
|
||||
// https://wiki.osdev.org/%228042%22_PS/2_Controller
|
||||
#define PORT_PS2_DATA 0x60
|
||||
#define PORT_PS2_STATUS 0x64
|
||||
#define PORT_PS2_COMMAND 0x64
|
||||
|
||||
unsigned char port_byte_in(unsigned short port);
|
||||
|
||||
void port_byte_out(unsigned short port, unsigned char data);
|
||||
|
||||
unsigned short port_word_in(unsigned short port);
|
||||
|
||||
void port_word_out(unsigned short port, unsigned short data);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user