MIOS32_SYS
Detailed Description
System Initialisation for MIOS32
Define Documentation
#define EXT_CRYSTAL_FRQ 8000000 |
#define EXT_CRYSTAL_FRQ 12000000 |
#define MEM16 |
( |
addr |
|
) |
(*((volatile u16 *)(addr))) |
#define MEM16 |
( |
addr |
|
) |
(*((volatile u16 *)(addr))) |
#define MEM16 |
( |
addr |
|
) |
(*((volatile u16 *)(addr))) |
#define MEM32 |
( |
addr |
|
) |
(*((volatile u32 *)(addr))) |
#define MEM32 |
( |
addr |
|
) |
(*((volatile u32 *)(addr))) |
#define MEM32 |
( |
addr |
|
) |
(*((volatile u32 *)(addr))) |
#define MEM8 |
( |
addr |
|
) |
(*((volatile u8 *)(addr))) |
#define MEM8 |
( |
addr |
|
) |
(*((volatile u8 *)(addr))) |
#define MEM8 |
( |
addr |
|
) |
(*((volatile u8 *)(addr))) |
#define NUM_DMA_CHANNELS 8 |
#define RTC_PREDIVIDER (EXT_CRYSTAL_FRQ/128) |
Function Documentation
void DMA_IRQHandler |
( |
void |
|
) |
|
u32 MIOS32_SYS_ChipIDGet |
( |
void |
|
) |
|
Returns the Chip ID of the core
- Returns:
- the chip ID
s32 MIOS32_SYS_DMA_CallbackSet |
( |
u8 |
dma, |
|
|
u8 |
chn, |
|
|
void * |
callback | |
|
) |
| | |
Installs a DMA callback function which is invoked on DMA interrupts
Available for LTC17xx (and not STM32) since it only provides a single DMA interrupt which is shared by all channels.
- Parameters:
-
[in] | dma | the DMA number (currently always 0) |
[in] | chn | the DMA channel (0..7) |
[in] | callback | the callback function which will be invoked by DMA ISR |
- Returns:
- -1 if function not implemented for this MIOS32_PROCESSOR
-
-2 if invalid DMA number is selected
-
-2 if invalid DMA channel selected
u32 MIOS32_SYS_FlashSizeGet |
( |
void |
|
) |
|
Returns the Flash size of the core
- Returns:
- the Flash size in bytes
s32 MIOS32_SYS_Init |
( |
u32 |
mode |
) |
|
Initializes the System for MIOS32:
-
enables clock for IO ports
-
configures pull-ups for all IO pins
-
initializes PLL for 72 MHz @ 12 MHz ext. clock
(skipped if PLL already running - relevant for proper software reset, e.g. so that USB connection can survive)
-
sets base address of vector table
-
configures the suspend flags in DBGMCU_CR as specified in MIOS32_SYS_STM32_DBGMCU_CR (can be overruled in mios32_config.h) to simplify debugging via JTAG
-
enables the system realtime clock via MIOS32_SYS_Time_Init(0)
- Parameters:
-
[in] | mode | currently only mode 0 supported |
- Returns:
- < 0 if initialisation failed
u32 MIOS32_SYS_RAMSizeGet |
( |
void |
|
) |
|
Returns the (data) RAM size of the core
- Returns:
- the RAM size in bytes
s32 MIOS32_SYS_Reset |
( |
void |
|
) |
|
Shutdown MIOS32 and reset the microcontroller:
-
disable all RTOS tasks
-
print "Bootloader Mode " message if LCD enabled (since MIOS32 will enter this mode after reset)
-
wait until all MIDI OUT buffers are empty (TODO)
-
disable all interrupts
-
turn off all board LEDs
-
send all-0 to DOUT chain (TODO)
-
send all-0 to MF control chain (if enabled) (TODO)
-
reset STM32
- Returns:
- < 0 if reset failed
s32 MIOS32_SYS_SerialNumberGet |
( |
char * |
str |
) |
|
Returns the serial number as a string
- Parameters:
-
[out] | str | pointer to a string which can store at least 32 digits + zero terminator! (24 digits returned for STM32) |
- Returns:
- < 0 if feature not supported
Returns the System Real Time (with mS accuracy)
Following example code converts the returned time into hours, minutes, seconds and milliseconds:
- Returns:
- the system time in a mios32_sys_time_t structure
Initializes/Resets the System Real Time Clock, so that MIOS32_SYS_Time() can be used for microsecond accurate measurements.
The time can be re-initialized the following way:
After system reset it will always start with 0. A battery backup option is not supported by MIOS32
- Parameters:
-
[in] | t | the time in seconds + fraction part (mS)
Note that this format isn't completely compatible to the NTP timestamp format, as the fraction has only mS accuracy |
- Returns:
- < 0 if initialisation failed
Variable Documentation