The interface consists of three read/write access functions; read/write_hpic() accesses the HPI controller register. Typically the host uses write_hpic() to clear the HINT bit (writing a one to the bit) when the interrupt has been serviced.
The read/write_hpia() functions are used to read or set the address to the memory location which should be later read or written. Reading HPIA either returns HPIAR or HPIAW depending on if last access to HPID was a read or write. Setting HPIA sets both HPIAR and HPIAW.
Finally, to access the memory the read/write_hpid() functions are used. These functions have a autoincrement flag allowing the HPIAR or HPIAW to automatically increment the value with 4 after the access is finished.
All access functions assumes that the registers and data are represented in host endianness.
SIM_INTERFACE(hpi) { /* HCNTL = 0 */ uint32 (*read_hpic)(conf_object_t *obj); void (*write_hpic)(conf_object_t *obj, uint32 value); /* HCNTL = 1 */ uint32 (*read_hpia)(conf_object_t *obj); void (*write_hpia)(conf_object_t *obj, uint32 value); /* HCNTL = 1 (autoincrement == 0) */ /* HCNTL = 2 (autoincrement == 1) */ uint32 (*read_hpid)(conf_object_t *obj, int autoincrement); void (*write_hpid)(conf_object_t *obj, uint32 value, int autoincrement); }; #define HPI_INTERFACE "hpi"