Kernel


Classes

class  miosix::InterruptDisableLock
class  miosix::InterruptEnableLock
class  miosix::PauseKernelLock
class  miosix::RestartKernelLock
class  miosix::Thread
class  miosix::GreaterPriority

Functions

void miosix::disable_interrupts ()
void miosix::enable_interrupts ()
void miosix::pause_kernel ()
void miosix::restart_kernel ()
bool miosix::are_interrupts_enabled ()
bool miosix::is_kernel_running ()
unsigned long long miosix::get_tick ()

Detailed Description

Miosix kernel API

The most useful part of this API is the Thread class that allows to create and manage threads.

A note on IRQ functions/methods:
Functions and methods that do not begin with IRQ cannot be called inside IRQ or when interrupts are disabled.
Functions and methods that begin with IRQ cannot be called outside IRQ or when interrupts are enabled.
When the kernel is paused, you must read the comment of the function to see if it can be called since there is no general rule.
Only recently (starting from Miosix 1.53) some of the functions designed to be called with kernel paused are marked with the PK prefix.


Function Documentation

bool miosix::are_interrupts_enabled (  ) 

Returns:
true if interrupts are enabled

void miosix::disable_interrupts (  ) 

Disable interrupts, if interrupts were enable prior to calling this function.

Please note that starting from Miosix 1.51 disableInterrupts() and enableInterrupts() can be nested. You can therefore call disableInterrupts() multiple times as long as each call is matched by a call to enableInterrupts().
This replaced disable_and_save_interrupts() and restore_interrupts()

disable_interrupts() cannot be called within an interrupt routine, but can be called before the kernel is started (and does nothing in this case)

void miosix::enable_interrupts (  ) 

Enable interrupts.
Please note that starting from Miosix 1.51 disableInterrupts() and enableInterrupts() can be nested. You can therefore call disableInterrupts() multiple times as long as each call is matched by a call to enableInterrupts().
This replaced disable_and_save_interrupts() and restore_interrupts()

enable_interrupts() cannot be called within an interrupt routine, but can be called before the kernel is started (and does nothing in this case)

unsigned long long miosix::get_tick (  ) 

Returns the current kernel tick.
Can be called also with interrupts disabled and/or kernel paused.

Returns:
current kernel tick

bool miosix::is_kernel_running (  ) 

Return true if kernel is running, false if it is not started, or paused.
Warning: disabling/enabling interrupts does not affect the result returned by this function.

Returns:
true if kernel is running (started && not paused)

void miosix::pause_kernel (  ) 

Pause the kernel.
Interrupts will continue to occur, but no preemption is possible. Call to this function are cumulative: if you call pause_kernel() two times, you need to call restart_kernel() two times.
Pausing the kernel must be avoided if possible because it is easy to cause deadlock. Calling file related functions (fopen, Directory::open() ...), serial port related functions (printf ...) or kernel functions that cannot be called when the kernel is paused will cause deadlock. Therefore, if possible, it is better to use a Mutex instead of pausing the kernel
This function is safe to be called even before the kernel is started. In this case it has no effect.

void miosix::restart_kernel (  ) 

Restart the kernel.
This function will yield immediately if a tick has been missed. Since calls to pause_kernel() are cumulative, if you call pause_kernel() two times, you need to call restart_kernel() two times.
This function is safe to be called even before the kernel is started. In this case it has no effect.


Generated on Mon Aug 30 00:05:00 2010 for Miosix by  doxygen 1.5.9