Miosix  2.0alpha1
Interfaces

Files

file  arch_registers.h
 
file  atomic_ops.h
 
file  bsp.h
 
file  delays.h
 
file  endianness.h
 
file  gpio.h
 
file  portability.h
 

Namespaces

 miosix
 

Macros

#define toLittleEndian16(x)   (x)
 
#define toLittleEndian32(x)   (x)
 
#define toLittleEndian64(x)   (x)
 
#define toBigEndian16(x)   swapBytes16(x)
 
#define toBigEndian32(x)   swapBytes32(x)
 
#define toBigEndian64(x)   swapBytes64(x)
 

Functions

void miosix::shutdown ()
 
void miosix::reboot ()
 
void miosix::delayMs (unsigned int mseconds)
 
void miosix::delayUs (unsigned int useconds)
 
__MIOSIX_INLINE unsigned short swapBytes16 (unsigned short x)
 
__MIOSIX_INLINE unsigned int swapBytes32 (unsigned int x)
 
__MIOSIX_INLINE unsigned long long swapBytes64 (unsigned long long x)
 

Detailed Description

Macro Definition Documentation

#define toBigEndian16 (   x)    swapBytes16(x)

Convert a (signed or unsigned) short int from the system representation to big endian

Parameters
xvalue to convert
Returns
value converted to big endian
#define toBigEndian32 (   x)    swapBytes32(x)

Convert a (signed or unsigned) int from the system representation to big endian

Parameters
xvalue to convert
Returns
value converted to big endian
#define toBigEndian64 (   x)    swapBytes64(x)

Convert a (signed or unsigned) long long from the system representation to big endian

Parameters
xvalue to convert
Returns
value converted to big endian
#define toLittleEndian16 (   x)    (x)

Convert a (signed or unsigned) short int from the system representation to little endian

Parameters
xvalue to convert
Returns
value converted to little endian
#define toLittleEndian32 (   x)    (x)

Convert a (signed or unsigned) int from the system representation to little endian

Parameters
xvalue to convert
Returns
value converted to little endian
#define toLittleEndian64 (   x)    (x)

Convert a (signed or unsigned) long long from the system representation to little endian

Parameters
xvalue to convert
Returns
value converted to little endian

Function Documentation

void miosix::delayMs ( unsigned int  mseconds)

Delay function. Accuracy depends on the underlying implementation which is architecture specific.
Delay time can be inaccurate if interrupts are enabled or the kernel is running due to time spent in interrupts and due to preemption.
It is implemented using busy wait, so can be safely used even when the kernel is paused or interrupts are disabled.
If the kernel is running it is highly recomended to use Thread::sleep since it gives CPU time to other threads and/or it puts the CPU in low power mode.

Parameters
msecondsmilliseconds to wait
void miosix::delayUs ( unsigned int  useconds)

Delay function. Accuracy depends on the underlying implementation which is architecture specific.
Delay time can be inaccurate if interrupts are enabled or the kernel is running due to time spent in interrupts and due to preemption.
It is implemented using busy wait, so can be safely used even when the kernel is paused or interrupts are disabled.

Parameters
usecondsmicroseconds to wait. Only values between 1 and 1000 are allowed. For greater delays use Thread::sleep() or delayMs().
void miosix::reboot ( )

The difference between this function and miosix_private::IRQsystemReboot() is that this function disables filesystem (if enabled), serial port (if enabled) while miosix_private::system_reboot() does not do all these things. miosix_private::IRQsystemReboot() is designed to reboot the system when an unrecoverable error occurs, and is used primarily in kernel code, reboot() is designed to reboot the system in normal conditions.
This function does not return.
WARNING: close all files before using this function, since it unmounts the filesystem.

void miosix::shutdown ( )

This function disables filesystem (if enabled), serial port (if enabled) and shuts down the system, usually by putting the procesor in a deep sleep state.
The action to start a new boot is system-specific, can be for example a reset, powercycle or a special GPIO configured to wakeup the processor from deep sleep.
This function does not return.
WARNING: close all files before using this function, since it unmounts the filesystem.

unsigned short swapBytes16 ( unsigned short  x)
inline
Parameters
xan short int
Returns
the same short with its bytes swapped
unsigned int swapBytes32 ( unsigned int  x)
inline
Parameters
xan int
Returns
the same int with its bytes swapped
unsigned long long swapBytes64 ( unsigned long long  x)
inline
Parameters
xa long long
Returns
the same long long with its bytes swapped