mirror of
https://github.com/IllusionMan1212/vitasdk-odin.git
synced 2026-10-24 02:12:38 +00:00
34 lines
1.4 KiB
Odin
34 lines
1.4 KiB
Odin
package i2c
|
|
|
|
import "core:c"
|
|
|
|
foreign import i2c "system:SceI2cForDriver_stub"
|
|
|
|
SceI2cErrorCode :: enum c.uint {
|
|
INVALID_BUS = 0x803F0300,
|
|
INVALID_SIZE = 0x803F0302,
|
|
INVALID_ADDR = 0x803F0303,
|
|
}
|
|
|
|
SceI2cDebugHandlers :: struct {
|
|
size: c.uint,
|
|
write_start: #type ^proc "c" (bus: c.int, addr: c.int, buffer: [^]c.uchar, size: c.int),
|
|
write_end: #type ^proc "c" (bus: c.int, error: c.int, result: c.int),
|
|
read_start: #type ^proc "c" (bus: c.int, addr: c.int, buffer: [^]c.uchar, size: c.int),
|
|
read_end: #type ^proc "c" (bus: c.int, error: c.int, result: c.int),
|
|
write_read_start: #type ^proc "c" (bus: c.int, write_addr: c.int, write_buffer: [^]c.uchar, write_size: c.int,
|
|
read_addr: c.uint, read_buffer: [^]c.uchar, read_size: c.int),
|
|
write_read_end: #type ^proc "c" (bus: c.int, error: c.int, result: c.int),
|
|
}
|
|
|
|
@(link_prefix = "ksceI2c")
|
|
foreign i2c {
|
|
Init :: proc(bus: c.int) -> c.int ---
|
|
Reset :: proc(bus: c.int) -> c.int ---
|
|
TransferRead :: proc(bus: c.int, addr: c.uint, buffer: [^]c.uchar, size: c.int) -> c.int ---
|
|
TransferWrite :: proc(bus: c.int, addr: c.uint, buffer: [^]c.uchar, size: c.int) -> c.int ---
|
|
TransferWriteRead :: proc(bus: c.int, write_addr: c.uint, write_buffer: [^]c.uchar, write_size: c.int, read_addr: c.uint, read_buffer: [^]c.uchar, read_size: c.int) -> c.int ---
|
|
|
|
SetDebugHandlers :: proc(bus: c.int, debug_handlers: ^SceI2cDebugHandlers) -> c.int ---
|
|
}
|