Program to control an accelerometer, motors and a rangefinder using the ScmRTOS ported to mbed. (Work in progress and buggy)
scmRTOS/scmRTOS_TARGET_CFG.h@0:9b057566f9ee, 2010-11-01 (annotated)
- Committer:
- jberry
- Date:
- Mon Nov 01 20:39:01 2010 +0000
- Revision:
- 0:9b057566f9ee
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jberry | 0:9b057566f9ee | 1 | //****************************************************************************** |
jberry | 0:9b057566f9ee | 2 | //* |
jberry | 0:9b057566f9ee | 3 | //* FULLNAME: Single-Chip Microcontroller Real-Time Operating System |
jberry | 0:9b057566f9ee | 4 | //* |
jberry | 0:9b057566f9ee | 5 | //* NICKNAME: scmRTOS |
jberry | 0:9b057566f9ee | 6 | //* |
jberry | 0:9b057566f9ee | 7 | //* PROCESSOR: ARM Cortex-M3 |
jberry | 0:9b057566f9ee | 8 | //* |
jberry | 0:9b057566f9ee | 9 | //* TOOLKIT: EWARM (IAR Systems) |
jberry | 0:9b057566f9ee | 10 | //* |
jberry | 0:9b057566f9ee | 11 | //* PURPOSE: Project Level Target Extensions Config |
jberry | 0:9b057566f9ee | 12 | //* |
jberry | 0:9b057566f9ee | 13 | //* Version: 3.10 |
jberry | 0:9b057566f9ee | 14 | //* |
jberry | 0:9b057566f9ee | 15 | //* $Revision: 196 $ |
jberry | 0:9b057566f9ee | 16 | //* $Date:: 2008-06-19 #$ |
jberry | 0:9b057566f9ee | 17 | //* |
jberry | 0:9b057566f9ee | 18 | //* Copyright (c) 2003-2010, Harry E. Zhurov |
jberry | 0:9b057566f9ee | 19 | //* |
jberry | 0:9b057566f9ee | 20 | //* Permission is hereby granted, free of charge, to any person |
jberry | 0:9b057566f9ee | 21 | //* obtaining a copy of this software and associated documentation |
jberry | 0:9b057566f9ee | 22 | //* files (the "Software"), to deal in the Software without restriction, |
jberry | 0:9b057566f9ee | 23 | //* including without limitation the rights to use, copy, modify, merge, |
jberry | 0:9b057566f9ee | 24 | //* publish, distribute, sublicense, and/or sell copies of the Software, |
jberry | 0:9b057566f9ee | 25 | //* and to permit persons to whom the Software is furnished to do so, |
jberry | 0:9b057566f9ee | 26 | //* subject to the following conditions: |
jberry | 0:9b057566f9ee | 27 | //* |
jberry | 0:9b057566f9ee | 28 | //* The above copyright notice and this permission notice shall be included |
jberry | 0:9b057566f9ee | 29 | //* in all copies or substantial portions of the Software. |
jberry | 0:9b057566f9ee | 30 | //* |
jberry | 0:9b057566f9ee | 31 | //* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
jberry | 0:9b057566f9ee | 32 | //* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
jberry | 0:9b057566f9ee | 33 | //* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
jberry | 0:9b057566f9ee | 34 | //* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY |
jberry | 0:9b057566f9ee | 35 | //* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
jberry | 0:9b057566f9ee | 36 | //* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH |
jberry | 0:9b057566f9ee | 37 | //* THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
jberry | 0:9b057566f9ee | 38 | //* |
jberry | 0:9b057566f9ee | 39 | //* ================================================================= |
jberry | 0:9b057566f9ee | 40 | //* See http://scmrtos.sourceforge.net for documentation, latest |
jberry | 0:9b057566f9ee | 41 | //* information, license and contact details. |
jberry | 0:9b057566f9ee | 42 | //* ================================================================= |
jberry | 0:9b057566f9ee | 43 | //* |
jberry | 0:9b057566f9ee | 44 | //****************************************************************************** |
jberry | 0:9b057566f9ee | 45 | //* mbed port by Igor Skochinsky |
jberry | 0:9b057566f9ee | 46 | |
jberry | 0:9b057566f9ee | 47 | #ifndef scmRTOS_TARGET_CFG_H |
jberry | 0:9b057566f9ee | 48 | #define scmRTOS_TARGET_CFG_H |
jberry | 0:9b057566f9ee | 49 | |
jberry | 0:9b057566f9ee | 50 | #include "device.h" |
jberry | 0:9b057566f9ee | 51 | |
jberry | 0:9b057566f9ee | 52 | // Define SysTick clock frequency and its interrupt rate in Hz. |
jberry | 0:9b057566f9ee | 53 | #define SYSTICKFREQ 100000000 |
jberry | 0:9b057566f9ee | 54 | #define SYSTICKINTRATE 1000 |
jberry | 0:9b057566f9ee | 55 | |
jberry | 0:9b057566f9ee | 56 | //------------------------------------------------------------------------------ |
jberry | 0:9b057566f9ee | 57 | // |
jberry | 0:9b057566f9ee | 58 | // System Timer stuff |
jberry | 0:9b057566f9ee | 59 | // |
jberry | 0:9b057566f9ee | 60 | // |
jberry | 0:9b057566f9ee | 61 | namespace OS |
jberry | 0:9b057566f9ee | 62 | { |
jberry | 0:9b057566f9ee | 63 | extern "C" void SysTick_Handler(); |
jberry | 0:9b057566f9ee | 64 | } |
jberry | 0:9b057566f9ee | 65 | |
jberry | 0:9b057566f9ee | 66 | #define LOCK_SYSTEM_TIMER() ( *CPU_SYSTICKCSR &= ~CPU_SYSTICKCSR_EINT ) |
jberry | 0:9b057566f9ee | 67 | #define UNLOCK_SYSTEM_TIMER() ( *CPU_SYSTICKCSR |= CPU_SYSTICKCSR_EINT ) |
jberry | 0:9b057566f9ee | 68 | |
jberry | 0:9b057566f9ee | 69 | //------------------------------------------------------------------------------ |
jberry | 0:9b057566f9ee | 70 | // |
jberry | 0:9b057566f9ee | 71 | // Context Switch ISR stuff |
jberry | 0:9b057566f9ee | 72 | // |
jberry | 0:9b057566f9ee | 73 | // |
jberry | 0:9b057566f9ee | 74 | namespace OS |
jberry | 0:9b057566f9ee | 75 | { |
jberry | 0:9b057566f9ee | 76 | #if scmRTOS_IDLE_HOOK_ENABLE == 1 |
jberry | 0:9b057566f9ee | 77 | void IdleProcessUserHook(); |
jberry | 0:9b057566f9ee | 78 | #endif |
jberry | 0:9b057566f9ee | 79 | |
jberry | 0:9b057566f9ee | 80 | #if scmRTOS_CONTEXT_SWITCH_SCHEME == 1 |
jberry | 0:9b057566f9ee | 81 | |
jberry | 0:9b057566f9ee | 82 | INLINE inline void RaiseContextSwitch() { *CPU_ICSR |= 0x10000000; } |
jberry | 0:9b057566f9ee | 83 | |
jberry | 0:9b057566f9ee | 84 | #define ENABLE_NESTED_INTERRUPTS() |
jberry | 0:9b057566f9ee | 85 | |
jberry | 0:9b057566f9ee | 86 | #if scmRTOS_SYSTIMER_NEST_INTS_ENABLE == 0 |
jberry | 0:9b057566f9ee | 87 | #define DISABLE_NESTED_INTERRUPTS() TCritSect cs |
jberry | 0:9b057566f9ee | 88 | #else |
jberry | 0:9b057566f9ee | 89 | #define DISABLE_NESTED_INTERRUPTS() |
jberry | 0:9b057566f9ee | 90 | #endif |
jberry | 0:9b057566f9ee | 91 | |
jberry | 0:9b057566f9ee | 92 | #else |
jberry | 0:9b057566f9ee | 93 | #error "Cortex-M3 port supports software interrupt switch method only!" |
jberry | 0:9b057566f9ee | 94 | |
jberry | 0:9b057566f9ee | 95 | #endif // scmRTOS_CONTEXT_SWITCH_SCHEME |
jberry | 0:9b057566f9ee | 96 | |
jberry | 0:9b057566f9ee | 97 | } |
jberry | 0:9b057566f9ee | 98 | //----------------------------------------------------------------------------- |
jberry | 0:9b057566f9ee | 99 | |
jberry | 0:9b057566f9ee | 100 | #endif // scmRTOS_TARGET_CFG_H |
jberry | 0:9b057566f9ee | 101 | //----------------------------------------------------------------------------- |
jberry | 0:9b057566f9ee | 102 |