MIOS32_SYS


Defines

#define MEM32(addr)   (*((volatile u32 *)(addr)))
#define MEM16(addr)   (*((volatile u16 *)(addr)))
#define MEM8(addr)   (*((volatile u8 *)(addr)))
#define NUM_DMA_CHANNELS   8
#define MEM32(addr)   (*((volatile u32 *)(addr)))
#define MEM16(addr)   (*((volatile u16 *)(addr)))
#define MEM8(addr)   (*((volatile u8 *)(addr)))
#define EXT_CRYSTAL_FRQ   12000000
#define RTC_PREDIVIDER   (EXT_CRYSTAL_FRQ/128)

Functions

s32 MIOS32_SYS_Init (u32 mode)
s32 MIOS32_SYS_Reset (void)
u32 MIOS32_SYS_ChipIDGet (void)
u32 MIOS32_SYS_FlashSizeGet (void)
u32 MIOS32_SYS_RAMSizeGet (void)
s32 MIOS32_SYS_SerialNumberGet (char *str)
s32 MIOS32_SYS_TimeSet (mios32_sys_time_t t)
mios32_sys_time_t MIOS32_SYS_TimeGet (void)
s32 MIOS32_SYS_DMA_CallbackSet (u8 dma, u8 chn, void *callback)
void DMA_IRQHandler (void)

Variables

u32 mios32_sys_isr_vector
u32 mios32_sys_isr_vector

Detailed Description

System Initialisation for MIOS32

Define Documentation

#define EXT_CRYSTAL_FRQ   12000000

#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 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:

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:

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

mios32_sys_time_t MIOS32_SYS_TimeGet ( void   ) 

Returns the System Real Time (with mS accuracy)

Following example code converts the returned time into hours, minutes, seconds and milliseconds:

   mios32_sys_time_t t = MIOS32_SYS_TimeGet();
   int hours = t.seconds / 3600;
   int minutes = (t.seconds % 3600) / 60;
   int seconds = (t.seconds % 3600) % 60;
   int milliseconds = t.fraction_ms;
Returns:
the system time in a mios32_sys_time_t structure

s32 MIOS32_SYS_TimeSet ( mios32_sys_time_t  t  ) 

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:

   // set System Time to one hour and 30 minutes
   mios32_sys_time_t t = { .seconds=1*3600 + 30*60, .fraction_ms=0 };
   MIOS32_SYS_TimeSet(t);

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

u32 mios32_sys_isr_vector

u32 mios32_sys_isr_vector


Generated on Tue May 1 19:42:14 2012 for MIOS32 by  doxygen 1.4.7