2024-07-14 13:11:28 +00:00
|
|
|
;; File: dev.inc
|
2024-07-21 16:14:38 +00:00
|
|
|
|
|
|
|
include 'at/cmos.inc'
|
|
|
|
include 'at/com.inc'
|
|
|
|
include 'at/ne2k.inc'
|
|
|
|
include 'at/pit.inc'
|
|
|
|
include 'at/kbd.inc'
|
|
|
|
include 'at/cga.inc'
|
2024-07-22 21:43:35 +00:00
|
|
|
include 'at/ata.inc'
|
2024-07-21 16:14:38 +00:00
|
|
|
include 'at/floppy.inc'
|
|
|
|
|
2024-07-14 13:11:28 +00:00
|
|
|
struc Device {
|
2024-07-17 07:41:36 +00:00
|
|
|
.name db 8 dup(?)
|
|
|
|
.init dd ?
|
2024-07-14 13:11:28 +00:00
|
|
|
}
|
2024-07-16 07:52:08 +00:00
|
|
|
DEFN Device
|
|
|
|
|
2024-07-24 13:24:52 +00:00
|
|
|
;; Struc: BlkDev
|
|
|
|
;;
|
|
|
|
;; .open - Open the device in preparation for I/O operations
|
|
|
|
;; .strategy - Start a read or write operation, and return immediately.
|
|
|
|
;; .close - Close a device.
|
|
|
|
;; .dump - Write all physical memory to the device.
|
|
|
|
;; .psize - Return the size of a disk-drive partition.
|
|
|
|
;;
|
2024-07-17 07:41:36 +00:00
|
|
|
struc BlkDev {
|
|
|
|
.open dd ?
|
|
|
|
.strategy dd ?
|
|
|
|
.ioctl dd ?
|
|
|
|
.close dd ?
|
|
|
|
.dump dd ?
|
|
|
|
.psize dd ?
|
|
|
|
}
|
|
|
|
|
2024-07-24 13:24:52 +00:00
|
|
|
;; Struc: CharDev
|
|
|
|
;;
|
|
|
|
;; .open - open the device.
|
|
|
|
;; .close - close the device..
|
|
|
|
;; .read - do an input operation.
|
|
|
|
;; .write - do an output operation.
|
|
|
|
;; .ioctl - do an I/O control operation.
|
|
|
|
;; .select - poll device for I/O readiness.
|
|
|
|
;; .stop - stop output on the device.
|
|
|
|
;; .mmap - map device offset to memory location
|
|
|
|
;; .reset - reinitialize device after a bus reset.
|
|
|
|
;;
|
2024-07-17 07:41:36 +00:00
|
|
|
struc CharDev {
|
|
|
|
.open dd ?
|
|
|
|
.close dd ?
|
|
|
|
.read dd ?
|
|
|
|
.write dd ?
|
|
|
|
.ioctl dd ?
|
|
|
|
.select dd ?
|
|
|
|
.stop dd ?
|
|
|
|
.mmap dd ?
|
|
|
|
.reset dd ?
|
|
|
|
}
|
|
|
|
|
|
|
|
aBlockDevices:
|
2024-07-21 16:14:38 +00:00
|
|
|
dd floppy_bdevsw
|
2024-07-24 13:24:52 +00:00
|
|
|
dd ata_bdevsw
|
2024-07-17 07:41:36 +00:00
|
|
|
.end:
|
|
|
|
|
|
|
|
aCharDevices:
|
2024-07-21 16:14:38 +00:00
|
|
|
dd console_cdevws
|
|
|
|
dd com_cdevsw
|
2024-07-17 07:41:36 +00:00
|
|
|
.end:
|
|
|
|
|
2024-07-16 07:52:08 +00:00
|
|
|
aDevices:
|
|
|
|
dd floppy_device
|
2024-07-17 07:41:36 +00:00
|
|
|
dd kbd_device
|
|
|
|
dd console_device
|
2024-07-19 07:53:03 +00:00
|
|
|
dd com_device
|
|
|
|
dd ne2k_device
|
2024-07-22 21:43:35 +00:00
|
|
|
dd ata_device
|
2024-07-16 07:52:08 +00:00
|
|
|
.end:
|
2024-07-14 13:11:28 +00:00
|
|
|
|
2024-07-24 13:24:52 +00:00
|
|
|
;; Function: dev_init
|
2024-07-16 06:29:16 +00:00
|
|
|
dev_init:
|
2024-07-16 07:52:08 +00:00
|
|
|
mov ecx, aDevices
|
|
|
|
@@:
|
|
|
|
mov eax, [ecx]
|
2024-07-17 07:41:36 +00:00
|
|
|
mov eax, [eax + Device.init]
|
2024-07-16 07:52:08 +00:00
|
|
|
push ecx
|
|
|
|
call eax
|
|
|
|
pop ecx
|
|
|
|
add ecx, 4
|
|
|
|
cmp ecx, aDevices.end
|
|
|
|
jb @b
|
|
|
|
|
2024-07-16 06:29:16 +00:00
|
|
|
ret
|