AvRtos

AvRtos Documentation

!!! This page is still under construction !!!

This page provides you some informations to get the AvRtos real time kernel running very quickly.

Supported devices

  • Atmel AVR Atmega32
  • Atmel AT91SAM7 (ARM7TDMI)
  • Freescale K20-Family (ARM Cortex-M4)
  • NXP LPC15xx-Family (ARM Cortex-M3)
  • The Kernel

    The kernel is preemptive and priority based.

    To start the scheduler you have to call kernelStartScheduler()
    This function will initialize the kernel tick timer and creates the idle task. The function checks for the highest priority task in the system and perform a context switch to execute this task. You have to create all needed tasks before calling this function.

    Tasks

    A task is simply a function with a endless loop. Each task has it's own stack, where the current processor context will be saved to.

    To create a task you have to call the function taskCreate() and provide a buffer for the tasks stack.
    You have to be carefull by defining the stack size, because to small stack's can result in unpredictable system behaviour and maybe cause a system fault.

    A task can have the following states.

    Semaphores

    Semaphores can be used as synchronization object. You can inform a task about a occurred interrupt with semaphores or you can use it to synchronize different tasks.
    To create a semaphore simply call the API function semaphoreCreate().

    With the functions semaphoreGet() and semaphoreSet() you can change the semaphore value.
    If the value reached 0 and you try to get the semaphore, the calling task will be blocked for the time specified by timeoutTicks.

    Mutexes

    A mutex can be used for "MUtual EXclusion" and provide a priority inheritance mechanism. This means that a lower priority task that owns the mutex, can block a higher priority task.
    You should take care about this behaviour. Normally, this situation should never occur.

    The API functions for the mutexes can NOT be called from an interrupt service routine, because this may not make sense.

    To create a mutex simply call the API function mutexCreate()

    Getting the owner of a mutex and release the mutex again can be done by calling the API function mutexGet() and mutexGive().

    Queues

    Queues are other task synchronization objects. With queues you can send some data from one task to an other or from an interrupt to a task.

    To create a queue simply call the API function queueCreate()

    Sending a message or some data to a queue can be done by calling the API function queuePut(). If the queue is already full this function may block the calling task.

    Receiving a message or some data from a queue can be done by calling the API function queueGet(). If there are no data in the queue available this function will block calling task.

    Copyright © Harald Baumeister
    All rights reserved.

    This program is a free software. You can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation. Either version 2 of the License, or any later version.

    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY. Without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

    Website templates