IOMD device numbers under HAL
Jon Abbott (1421) 2651 posts |
On the System Device Numbers Wiki page it states:
It’s not obvious from that how you’d go about getting the HAL device numbers for IOMD devices. I’m guessing OS_Hardware is probably the correct method, but there’s no detail on what R0 bits 0-15 – device type should be. Is OS_Hardware the correct SWI I should be using? If so, what are the device types I need to call it with? The three IOMD devices I’m after are: 3 VSync Pulse |
Sprow (202) 1158 posts |
Use HAL_TimerDevice (via OS_Hardware) to ask for timer 1’s IRQ device number. |
Jon Abbott (1421) 2651 posts |
Thanks for that info, the next questions are: 1. Where do I find the values for “HALDeviceID_VDU_VIDC20” and “HALDeviceAudio_AudC” to pass to OS_Hardware? I searched the Wiki and even the OS source, but am still none the wiser! |
Jeffrey Lee (213) 6048 posts |
These are all defined in Kernel.hdr.HALDevice
That would be HAL timer 1 (HAL timers are numbered from zero, the same as IOMD timers) |
Jon Abbott (1421) 2651 posts |
I’m still none the wiser :/, how does that table translate to a value? |
Jeffrey Lee (213) 6048 posts |
HALDeviceID_VDU_VIDC20: This will correspond to calling OS_Hardware 4 with R0 = HALDeviceType_Video + HALDeviceVideo_VDU = &101 and looking for the value HALDeviceID_VDU_VIDC20 (= 3) in the device ID field (i.e. the first word of the device struct will be &30101) HALDeviceAudio_AudC: This will correspond to calling OS_Hardware 4 with R0 = HALDeviceType_Audio + HALDeviceAudio_AudC = &201. Since you aren’t looking for a specific audio device (since one doesn’t exist yet for IOMD) you can (probably) just use the first device which is returned by the call. |
Jon Abbott (1421) 2651 posts |
I’ve finally got around to coding IOMD RO5 support, but am having problems. How can I prevent the OS from actioning the IRQ’s and instead pass them to IRQ1v? Do I need to claim them via OS_ClaimDeviceVector* and then call IRQ1v manually? EDIT: I believe the problem I’m seeing is due to HAL_Timers now intercepting T1, where previously it would be passed to IRQ1v. * Claiming device 6 works, but relying on IRQ1v to be called when T1 triggers doesn’t. I could work around this by claiming device 6, calling IRQ1v and only passing to the OS if the game doesn’t action it. |