diff --git a/doc/devices.md b/doc/devices.md new file mode 100644 index 00000000..2dd88fc0 --- /dev/null +++ b/doc/devices.md @@ -0,0 +1,100 @@ +# MOROS Devices + +```sh +write /dev/ata/ +write /dev/ata/0/ +write /dev/ata/0/0 -d ata-0-0 +write /dev/ata/0/1 -d ata-0-1 +write /dev/ata/1/ +write /dev/ata/1/0 -d ata-1-0 +write /dev/ata/1/1 -d ata-1-1 +write /dev/clk/ +write /dev/clk/boot -d clk-boot +write /dev/clk/epoch -d clk-epoch +write /dev/clk/rtc -d clk-rtc +write /dev/console -d console +write /dev/net/ +write /dev/net/tcp -d tcp +write /dev/net/udp -d udp +write /dev/null -d null +write /dev/random -d random +write /dev/speaker -d speaker +write /dev/vga/ +write /dev/vga/buffer -d vga-buffer +write /dev/vga/font -d vga-font +write /dev/vga/mode -d vga-mode +write /dev/vga/palette -d vga-palette +``` + +## Clocks + +Reading the number of seconds since boot: + +``` +> read /dev/clk/boot +89.570360 +``` + +Reading the number of seconds since Unix Epoch: + +``` +> read /dev/clk/epoch +1730398385.175973 +``` + +Reading the real time clock (RTC): + +``` +> read /dev/clk/rtc +2024-10-31 18:20:02 +``` + +Changing the system time: + +``` +> print "2025-01-01 00:00:00" => /dev/clk/rtc +[580.327629] RTC 2025-01-01 00:00:00 +0000 +``` + +## Network + +Opening `/dev/net/tcp` or `/dev/net/udp` with the `OPEN` syscall and the device +flag will return a file handle for a TCP or UDP socket supporting the standard +`READ` and `WRITE` syscalls after establishing a connection using the +`CONNECT`, or `LISTEN` and `ACCEPT` syscalls. + +## Speaker + +Playing a 440 Hz sound on the PC speaker: + +``` +> print 440 => /dev/speaker +``` + +Stopping the sound: + +``` +> print 0 => /dev/speaker +``` + +## VGA + +### Font + +Changing the VGA font: + +``` +> copy /ini/fonts/zap-light-8x16.psf /dev/vga/font +``` + +### Mode + +Changing the VGA mode: + +``` +> print 320x200 => /dev/vga/mode +``` + +### Palette + +### Buffer