eLua platform interface - CPU
Overview
This part of the platform interface groups functions related to the CPU and its functional modules (interrupt controller, memory controller and others).
Functions
int platform_cpu_set_global_interrupts( int status );
Set or clear the global interrupt flag of the CPU.
Arguments: status - PLATFORM_CPU_ENABLE to set the global interrupt flag or PLATFORM_CPU_DISABLE to clear the global interrupt flag.
Returns: the previous value of the global interrupt flag (1 if set, 0 otherwise).
int platform_cpu_get_global_interrupts();
Get the value of the global interrupt flag of the CPU.
Arguments: none.
Returns: the value of the global interrupt flag (1 if set, 0 otherwise).
int platform_cpu_set_interrupt( elua_int_id id, elua_int_resnum resnum, int status );
Enable or disable a specific CPU interrupt for a given resource ID.
Arguments:
- id - the interrupt ID, as defined in platform_conf.h.
- resnum - the resource ID.
- status - PLATFORM_CPU_ENABLE to enable the interrupt or PLATFORM_CPU_DISABLE$ to disable the interrupt.
Returns:
- PLATFORM_INT_INVALID - invalid interrupt ID
- PLATFORM_INT_NOT_HANDLED - this interrupt cannot be enabled/disabled
- PLATFORM_INT_BAD_RESNUM - this resource ID can't be used to enable/disable the interrupt
- the previous status of the interrupt (1 if enabled, 0 otherwise) if no error occured.
int platform_cpu_get_interrupt( elua_int_id id, elua_int_resnum resnum );
Get the interrupt enabled status of a specific CPU interrupt for a given resource ID.
Arguments:
- id - the interrupt ID, as defined in platform_conf.h
- resnum - the resource ID
Returns:
- PLATFORM_INT_INVALID - invalid interrupt ID
- PLATFORM_INT_NOT_HANDLED - this interrupt cannot be enabled/disabled
- PLATFORM_INT_BAD_RESNUM - this resource ID can't be used to enable/disable the interrupt
- the status of the interrupt (1 if enabled, 0 otherwise) if no error occured.
int platform_cpu_get_interrupt_flag( elua_int_id id, elua_int_resnum resnum, int clear );
Return the interrupt pending flag of a specific CPU interrupt or a given resource ID and optionally clear it.
Arguments:
- id - the interrupt ID, as defined in platform_conf.h.
- resnum - the resource ID.
- clear - 1 to clear the interrupt pending flag if it is set, 0 otherwise.
Returns:
- PLATFORM_INT_INVALID - invalid interrupt ID.
- PLATFORM_INT_NOT_HANDLED - this interrupt's flag cannot be read.
- PLATFORM_INT_BAD_RESNUM - this resource ID can't be used to read this interrupt's flag.
- the value of the interrupt pending flag if no error occured.
u32 platform_cpu_get_frequency();
Get the CPU frequency.
Arguments: none.
Returns: the CPU core frequency (in Hertz).