Low level routines for LM32, including interrupt handling.
More...
#include <stdio.h>
#include <stdbool.h>
#include <stdint.h>
#include "util/macro.h"
Go to the source code of this file.
|
static void | __irqDisable () |
| Disables IRQ's on a global level. More...
|
|
static void | __irqEnable () |
| Enabled IRQ's on a global level. More...
|
|
static bool | __isIrqEnable () |
|
static void | __nop () |
| No-operation.
|
|
void | irqMaskSet (int irq, bool set) |
| Set/clear the interrupt mask for the specified IRQ. More...
|
|
bool | irqMaskGet (int irq) |
| Returns the current IRQ mask for the specified IRQ. More...
|
|
static uint32_t | cycCount () |
| Returns the value of the cycle counter.
|
|
void | reboot () |
| Soft reboot the LM32.
|
|
static uint32_t | ramSize () |
| Get the of the RAM. More...
|
|
static uint32_t | ramUsed () |
| Get the RAM used by variables (excluding stack). More...
|
|
static uint32_t | romSize () |
| Get the of the ROM. More...
|
|
static uint32_t | romUsed () |
| Get the ROM used by code, variables and constants. More...
|
|
|
uint32_t * | pState |
| Program state before IRQ. More...
|
|
volatile bool | inIrqContext |
| Returns whether or not we're in an IRQ context. More...
|
|
uint32_t | _end |
|
const uint8_t | _ram_offset |
|
const uint8_t | _ram_size |
|
const uint8_t | _rom_offset |
|
const uint8_t | _rom_end |
|
const uint8_t | _rom_size |
|
Low level routines for LM32, including interrupt handling.
Definition in file lm32.h.
#define IRQ_HANDLER |
( |
|
IRQ | ) |
_IRQ_HANDLER(IRQ) |
Defines an IRQ handler.
Should be used by the driver to capture IRQ's.
- Parameters
-
Definition at line 47 of file lm32.h.
static void __irqDisable |
( |
| ) |
|
|
inlinestatic |
Disables IRQ's on a global level.
It does not clear the interrupt masks, so when re-enabled all previously enabled IRQs will be handled.
Definition at line 62 of file lm32.h.
static void __irqEnable |
( |
| ) |
|
|
inlinestatic |
Enabled IRQ's on a global level.
Pending IRQs will be handled.
Definition at line 75 of file lm32.h.
bool irqMaskGet |
( |
int |
irq | ) |
|
Returns the current IRQ mask for the specified IRQ.
- Parameters
-
Definition at line 105 of file lm32.c.
void irqMaskSet |
( |
int |
irq, |
|
|
bool |
set |
|
) |
| |
Set/clear the interrupt mask for the specified IRQ.
- Parameters
-
irq | The IRQ to set or clear. |
set | When 0, clears the IRQ, when 1 sets it. |
Note that when enabling IRQ's, any pending IRQs may be activated.
Definition at line 77 of file lm32.c.
static uint32_t ramSize |
( |
| ) |
|
|
inlinestatic |
Get the of the RAM.
- Returns
- Size of RAM in bytes.
Definition at line 184 of file lm32.h.
static uint32_t ramUsed |
( |
| ) |
|
|
inlinestatic |
Get the RAM used by variables (excluding stack).
- Returns
- Used RAM in bytes.
Definition at line 194 of file lm32.h.
static uint32_t romSize |
( |
| ) |
|
|
inlinestatic |
Get the of the ROM.
- Returns
- Size of ROM in bytes.
Definition at line 207 of file lm32.h.
static uint32_t romUsed |
( |
| ) |
|
|
inlinestatic |
Get the ROM used by code, variables and constants.
- Returns
- Used ROM in bytes.
Definition at line 218 of file lm32.h.
volatile bool inIrqContext |
Returns whether or not we're in an IRQ context.
Do not write this value!
Definition at line 30 of file lm32.c.
Program state before IRQ.
For example, to get the program counter at interrupt, use this in an interrupt routine: uint32_t pcAtIrq = pState[PSTATE_RA];
Definition at line 28 of file lm32.c.