jankos/ports.s
shockrah 897c23faca # Serial port configurations
* Implementing some serial port control in preparation to do debugging with bochs

* Changed naming of io to fb_ports to finally[tm] ports
2019-10-05 20:45:22 -07:00

46 lines
846 B
ArmAsm

; Helpers for frame buffer which pretty much have to to be
; written in asm
; COM1 Base Port
%define SERIAL_COM1_BASE 0x3F8
%define SERIAL_DATA_PORT(base) (base)
%define SERIAL_FIFO_COMMAND_PORT(base) (base+2)
%define SERIAL_LINE_COMMAND_PORT(base) (base+3)
%define SERIAL_MODEM_COMMAND_PORT(base) (base+4)
%define SERIAL_LINE_STATUS_PORT(base) (base+5)
%define SERIAL_DATA_
global serial_control
global serial_read_buffer
serial_control:
push ebp
mov ebp, esp
add esp, 0xc ; ebp + 2 local vars (32-bit kernel)
mov al, [esp+8]
mov dx, [esp+4]
out dx, al
mov esp, ebp
pop ebp
ret
; Read byte from serial port
serial_read_buffer:
push ebp
mov ebp, esp
push ebx
xor eax, eax
mov dx, [esp + 4] ; grab the address of the targeted port
in al, dx ; read byte from the port
mov esp, ebp
pop ebx
pop ebp
ret