libdragon
|
Joybus Subsystem. More...
Data Structures | |
struct | joybus_msg_t |
A message to be sent to JoyBus, with its completion callback. More... | |
Functions | |
void | __joybus_init (void) |
Initialize the joybus subsystem. | |
void | joybus_exec_async (const void *input, void(*callback)(uint64_t *output, void *ctx), void *ctx) |
Execute an asynchronous joybus message. More... | |
void | joybus_exec (const void *input, void *output) |
Write a 64-byte block of data to the PIF and read the 64-byte result. More... | |
Joybus Subsystem.
void joybus_exec_async | ( | const void * | input, |
void(*)(uint64_t *output, void *ctx) | callback, | ||
void * | ctx | ||
) |
Execute an asynchronous joybus message.
This function executes an asynchronous joybus protocol exchange, sending a message block (input), and receiving a reply (output). The message is sent in background and a completion function "callback" is called when the output is ready to be processed.
It is possible to schedule multiple joybus messages by calling this function multiple times. They will be automatically executed in order. The maximum number of pending messages at any given time is MAX_JOYBUS_MSGS.
[in] | input | The input block (must be of JOYBUS_BLOCK_SIZE bytes). No specific alignment is required for this data block. |
[in] | callback | A callback completion function that will be called when the joybus command is finished. The function will receive a pointer to the output buffer and the opaque pointer to the callback's context. Can be NULL if no callback is required. |
[in] | ctx | Context opaque pointer to pass to the callback. Can be NULL if no context is required. |