KallistiOS git master
Independent SDK for the Sega Dreamcast
Loading...
Searching...
No Matches
Events

Events pertaining to the DC's System ASIC More...

Topics

 Event Codes
 Values for various Holly event codes
 
 IRQ Levels
 values for the various ASIC event IRQ levels
 
 Registers
 Addresses for various ASIC eveng registers
 

Files

file  asic.h
 Dreamcast ASIC event handling support.
 

Typedefs

typedef void(* asic_evt_handler) (uint32_t code, void *data)
 ASIC event handler type.
 

Functions

void asic_evt_set_handler (uint16_t code, asic_evt_handler handler, void *data)
 Set or remove an ASIC handler.
 
int asic_evt_request_threaded_handler (uint16_t code, asic_evt_handler handler, void *data, void(*ack_and_mask)(uint16_t), void(*unmask)(uint16_t))
 Register a threaded handler with the given ASIC event.
 
void asic_evt_remove_handler (uint16_t code)
 Unregister any handler set to the given ASIC event.
 
void asic_evt_disable_all (void)
 Disable all ASIC events.
 
void asic_evt_disable (uint16_t code, uint8_t irqlevel)
 Disable one ASIC event.
 
void asic_evt_enable (uint16_t code, uint8_t irqlevel)
 Enable an ASIC event.
 

Detailed Description

Events pertaining to the DC's System ASIC

Typedef Documentation

◆ asic_evt_handler

typedef void(* asic_evt_handler) (uint32_t code, void *data)

ASIC event handler type.

Any event handlers registered must be of this type. These will be run in an interrupt context, so don't try anything funny.

Parameters
codeThe ASIC event code that generated this event.
dataThe user pointer that was passed to asic_evt_set_handler.
See also
Event Codes

Function Documentation

◆ asic_evt_disable()

void asic_evt_disable ( uint16_t code,
uint8_t irqlevel )

Disable one ASIC event.

This function will disable the hook for a specified code that was registered at the given IRQ level. Generally, you will never have to do this yourself unless you're adding in some new functionality.

Parameters
codeThe ASIC event code to unhook (see Event Codes).
irqlevelThe IRQ level it was hooked on (see IRQ Levels).

◆ asic_evt_disable_all()

void asic_evt_disable_all ( void )

Disable all ASIC events.

This function will disable hooks for every event that has been hooked. In order to reinstate them, you must individually re-enable them. Not a very good idea to be doing this normally.

◆ asic_evt_enable()

void asic_evt_enable ( uint16_t code,
uint8_t irqlevel )

Enable an ASIC event.

This function will enable the hook for a specified code and register it at the given IRQ level. You should only register each event at a max of one IRQ level (this will not check that for you), and this does not actually set the hook function for the event, you must do that separately with asic_evt_set_handler(). Generally, unless you're adding in new functionality, you'll never have to do this.

Parameters
codeThe ASIC event code to hook (see Event Codes).
irqlevelThe IRQ level to hook on (see IRQ Levels).

◆ asic_evt_remove_handler()

void asic_evt_remove_handler ( uint16_t code)

Unregister any handler set to the given ASIC event.

Parameters
codeThe ASIC event code to unhook (see Event Codes).

◆ asic_evt_request_threaded_handler()

int asic_evt_request_threaded_handler ( uint16_t code,
asic_evt_handler handler,
void * data,
void(* ack_and_mask )(uint16_t),
void(* unmask )(uint16_t) )

Register a threaded handler with the given ASIC event.

This function will spawn a thread, that will sleep until notified when an event happens. It will then call the handler. As the handler is not called in an interrupt context, it can hold locks, and even sleep.

Parameters
codeThe ASIC event code to hook (see Event Codes).
handlerThe function to call when the event happens.
dataA user pointer that will be passed to the callback.
ack_and_maskAn optional function that will be called by the real interrupt handler, to acknowledge and mask the interrupt, so that it won't trigger again while the threaded handler is running.
unmaskAn optional function that will be called by the thread after the handler function returned, to re-enable the interrupt.

◆ asic_evt_set_handler()

void asic_evt_set_handler ( uint16_t code,
asic_evt_handler handler,
void * data )

Set or remove an ASIC handler.

This function will register an event handler for a given event code, or if the handler is NULL, unregister any that is currently registered.

Parameters
codeThe ASIC event code to hook (see Event Codes).
handlerThe function to call when the event happens.
dataA user pointer that will be passed to the callback.