libdragon
Functions
joybus_internal.h File Reference

Joybus internal API. More...

Go to the source code of this file.

Functions

void joybus_exec_async (const void *input, void(*callback)(uint64_t *output, void *ctx), void *ctx)
 Execute an asynchronous joybus message. More...
 

Detailed Description

Joybus internal API.

Function Documentation

◆ joybus_exec_async()

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.

Note
The callback function will be called under interrupt.
This function is not part of the public API yet because we want to evaluate the use of threading rather than asynchronous programming. It should only be used internally without exposing a asynchronous API externally.
Parameters
[in]inputThe input block (must be of JOYBUS_BLOCK_SIZE bytes). No specific alignment is required for this data block.
[in]callbackA 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]ctxContext opaque pointer to pass to the callback. Can be NULL if no context is required.