All pastes #1897314 Raw Edit

Serial Driver - H-File

public c v1 · immutable
#1897314 ·published 2010-07-09 15:57 UTC
rendered paste body
/* * Femto OS v 0.92 - Copyright (C) 2008-2010 Ruud Vlaming * * This file is part of the Femto OS distribution. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, version 3 of the License. * * 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program.  If not, see <http://www.gnu.org/licenses/>. * * Please note that, due to the GPLv3 license, for application of this * work and/or combined work in embedded systems special obligations apply. * If these are not to you liking, please know the Femto OS is dual * licensed. A commercial license and support are available. * See http://www.femtoos.org/ for details. */#ifndef CONFIG_TESTHELLOWORLD_H_#define CONFIG_TESTHELLOWORLD_H_/* Comments are in the config default file *//* ========================================================================= *//* SYSTEM CONFIGURATION ==================================================== *//* ========================================================================= */#define  cfgSysOptimized                         cfgFalse#define  cfgSysDebug                             cfgFalse#define  cfgSysInline                            cfgFalse#define  cfgSysFramePointerCounterMeasures       cfgFalse#define  cfgSysReduceProEpilogue                 cfgBikini#define  cfgSysRegisterCheckByte                 0xA5#define  cfgSysStackGrowthUp                     cfgFalse#define  cfgSysZeroPageStack                     cfgFalse#define  cfgSysClearUnusedR1                     cfgTrue#define  cfgSysSqueezeState                      defSysOptimized#define  cfgSysReuseOsStack                      cfgTrue#define  cfgSysClockDivider                      1#define  cfgSysSubTicksPerFullTick               32#define  cfgSysSubTickDivider                    256#define  cfgSysGCCstartup                        cfgKeep#define  cfgSysFsStorageSpace                    0/* ========================================================================= *//* INTERRUPT HANDLING ====================================================== *//* ========================================================================= */#define  cfgIntGlobalOnly                        cfgTrue// We make use of ISRs#define  cfgIntUserDefined                       cfgTrue#define  cfgIntSwitchUsesOSstack                 cfgFalse#define  cfgIntOsProtected                       cfgTrue#define  cfgIntTickTrack                         cfgFalse#define  cfgIntManualTicks                       cfgFalse/* ========================================================================= *//* QUALITY ASSURANCE ======================================================= *//* ========================================================================= */#define  cfgCheckSystem                          cfgTrue#define  cfgCheckReset                           cfgTrue#define  cfgCheckTrace                           cfgFalse#define  cfgCheckAlwaysFatal                     cfgFalse#define  cfgCheckWatermarks                      cfgFalse#define  cfgCheckOsStack                         cfgTrue#define  cfgCheckTaskStack                       cfgTrue#define  cfgCheckIsrStack                        cfgFalse#define  cfgCheckRegisters                       cfgTrue#define  cfgCheckTiming                          cfgFalse#define  cfgCheckQueuFilling                     cfgFalse// If you use taskQueuReadRequestOnName and have cfgCheckMethodUse// http://www.femtoos.org/code_config.html#1310  enabled, you will get a wrong// error message errSlotTypeMismatch// http://www.femtoos.org/code_errors.html#2012. This occurs up to// version 0.92 as described here// https://sourceforge.net/projects/femtoos/forums/forum/789278/topic/3684171?message=8339221. #define  cfgCheckMethodUse                       cfgFalse#define  cfgCheckApplication                     cfgFalse/* ========================================================================= *//* COMMON CAPABILITIES ===================================================== *//* ========================================================================= */#define  cfgUseEquidistantTicks                  cfgTrue#define  cfgUseDelay                             cfgTrue#define  cfgUseSuspendOnDelay                    cfgFalse// We use synchronization, single slot is sufficient for this example. Choose// a more complex one if you have to.#define  cfgUseSynchronization                   cfgSyncSingleSlot#define  cfgUseHierarchicalRoundRobin            cfgFalse#define  cfgUseNestedCriticals                   cfgFalse#define  cfgUsePrioritizedRelease                cfgFalse#define  cfgUsePriorityLifting                   cfgFalse#define  cfgUseTaskWatchdog                      cfgFalse#define  cfgUseCorrectWakeupTimes                cfgFalse// We use timeouts#define  cfgUseTimeout                           cfgTrue#define  cfgUseTasknames                         cfgFalse#define  cfgUseLowPowerSleep                     cfgFalse#define  cfgUseLowPowerOnDelay                   cfgFalse#define  cfgUseLowPowerDelayRelease              cfgFalse#define  cfgUseLoadMonitor                       cfgFalse#define  cfgUseFileSystem                        cfgFalse#define  cfgUseFileSystemConcurrentRead          cfgFalse#define  cfgUseFileSystemEconomyMode             cfgFalse#define  cfgUseFileSystemMaintainFAT             cfgFalse// We use events#define  cfgUseEvents                            cfgTrue#define  cfgUseEventsOnVariables                 cfgFalse/* ========================================================================= *//* CODE PARAMETERS ========================================================= *//* ========================================================================= */#define  cfgNumWatchdogDiv                       0#define  cfgNumMonitorDiv                        0#define  cfgNumSleepPeriod                       0#define  cfgNumSleepThreshold                    0#define  cfgNumGlobWidth                         0#define  cfgNumSwitchWidth                       0#define  cfgNumTickWidth                         0/* ========================================================================= *//* EXTERNAL CALLS ========================================================== *//* ========================================================================= */#define  callAppTick00                           cfgFalse#define  callAppTick08                           cfgFalse#define  callAppTick16                           cfgFalse#define  callAppTickSleep                        cfgFalse#define  callAppEnterIdle                        cfgFalse#define  callAppEnterSleep                       cfgFalse#define  callAppExitSleep                        cfgFalse#define  callAppBoot                             cfgTrue#define  callAppInit                             cfgFalse#define  callAppBark                             cfgFalse/* ========================================================================= *//* API INCLUSIONS ========================================================== *//* ========================================================================= *//* Standard functions ------------------------------------------------------ */// We need isrEndYield() to end our interrupts, so we need includeIsrEndYield,// so we need includeTaskYield.#define  includeTaskYield                        cfgTrue#define  includeTaskDelayFromNow                 cfgTrue#define  includeTaskDelayFromWake                cfgFalse#define  includeGenSuspend                       cfgFalse#define  includeTaskSuspend                      cfgFalse#define  includeGenResume                        cfgFalse#define  includeTaskSleep                        cfgFalse#define  includeTaskSleepAll                     cfgFalse#define  includeGenSetPriority                   cfgFalse#define  includeGenGetPriority                   cfgFalse#define  includeGenGetTickCount                  cfgFalse#define  includeGenAddtoTickCount                cfgFalse#define  includeGenGetLastWakeTime               cfgFalse#define  includeTaskFeedWatchdog                 cfgFalse#define  includeTaskKillWatchdog                 cfgFalse#define  includeGenGetTaskname                   cfgFalse#define  includeTaskTerminate                    cfgFalse#define  includeGenReboot                        cfgFalse#define  includeTaskRecreate                     cfgFalse#define  includeTaskRestart                      cfgFalse#define  includeGenLogTask                       cfgFalse#define  includeGenLogOs                         cfgFalse#define  includeGenTrace                         cfgFalse#define  includeGenPipeInt16                     cfgFalse#define  includeGenPassFlashString               cfgFalse/* Event functions --------------------------------------------------------- */// We ...#define  includeTaskWaitForEvents                cfgTrue// ... use ...#define  includeIsrFireEvent                     cfgTrue// ... events.#define  includeGenFireEvent                     cfgTrue#define  includeGenFireEventSet                  cfgFalse#define  includeGenCountEventBlocks              cfgFalse/* Synchronization functions ----------------------------------------------- */#define  includeTaskWaitForTasks                 cfgFalse#define  includeGenWaitRelease                   cfgFalse#define  includeTaskMutex                        cfgFalse// We use queues ...#define  includeTaskQueu                         cfgTrue/* Queu functions --------------------------------------------------------- */// ... for writing#define  includeGenQueuWrite                     cfgTrue// ... for reading#define  includeGenQueuRead                      cfgTrue#define  includeGenQueuUnwrite                   cfgFalse#define  includeGenQueuUnread                    cfgFalse#define  includeGenQueuClear                     cfgFalse#define  includeGenQueuPeek                      cfgFalse#define  includeGenQueuReadable                  cfgFalse#define  includeGenQueuWriteable                 cfgFalse#define  includeGenQueuFull                      cfgFalse#define  includeGenQueuEmpty                     cfgFalse/* File System functions --------------------------------------------------- */#define  includeTaskFileAccess                   cfgFalse#define  includeTaskFileFormat                   cfgFalse#define  includeTaskFileGetSize                  cfgFalse#define  includeTaskFileSetSize                  cfgFalse#define  includeTaskFileReadByte                 cfgFalse#define  includeTaskFileWriteByte                cfgFalse#define  includeTaskFileAppendByte               cfgFalse#define  includeTaskFileReadPipe                 cfgFalse#define  includeTaskFileWritePipe                cfgFalse#define  includeTaskFileReadBuffer               cfgFalse#define  includeTaskFileWriteBuffer              cfgFalse/* Protection functions ---------------------------------------------------- */#define  includeTaskProtectGlobalInterrupts      cfgFalse#define  includeTaskProtectSwitchTasks           cfgFalse#define  includeTaskProtectTickInterrupts        cfgFalse#define  includeTaskProtectGlobalCritical        cfgFalse#define  includeTaskProtectSwitchCritical        cfgFalse#define  includeTaskProtectTickCritical          cfgFalse/* ISR header/footer functions --------------------------------------------- */#define  includeIsrEnter                         cfgFalse#define  includeIsrExit                          cfgFalse// We need to enter the ISR in some way./// @ToDo: Isn't there any faster method or is it needed at all?#define  includeIsrBegin                         cfgTrue#define  includeIsrEndReturn                     cfgFalse// We need to exit the ISR in some way./// @ToDo: Isn't there any faster method or is it needed at all?#define  includeIsrEndYield                      cfgTrue#define  includeIsrStartLoad                     cfgFalse#define  includeIsrStopLoad                      cfgFalse/* Quality assurance functions --------------------------------------------- */#define  includeTaskStackCheck                   cfgFalse#define  includeIsrStackCheck                    cfgFalse/* ========================================================================= *//* TASK NAMES ============================================================== *//* ========================================================================= */// This task is responsible for the UART communication and part of the UART// driver#define  CN_00                                   SerialSend// This task periodically sends some test data and is just an exaple. You can// delete this task if you trust me that everything is working xD#define  CN_01                                   Main/* ========================================================================= *//* INCLUDE TASKS =========================================================== *//* ========================================================================= */// The serial driver should run from the beginning. This is not a big deal since// it mainly waits for an event.#define  TaskInclude_SerialSend                  cfgStartRunning// Our exaple task should send test data from the beginning.#define  TaskInclude_Main                        cfgStartRunning/* ========================================================================= *//* TASK CAPABILITIES ======================================================= *//* ========================================================================= */#define  CapabilitiesOverride                    cfgCapAll/* ========================================================================= *//* STACK SIZES ============================================================= *//* ========================================================================= */#define  StackSafety                             4// Use big stacks for an easy testing./// @ToDo: Calculate appropriate stack sizes#define  StackSizeOS                             250#define  StackSizeISR                            250#define  StackSizeShared                         250#define  StackSizeOverride                       120/* ========================================================================= *//* TIMES SLICES ============================================================ *//* ========================================================================= */#define  TimeSliceIdleTime                       cfgSysSubTicksPerFullTick/* ========================================================================= *//* RUNTIME TASK NAMES ====================================================== *//* ========================================================================= *//* ========================================================================= *//* TASK PRIORITIES ========================================================= *//* ========================================================================= */#define  PriorityOverride                        0/* ========================================================================= *//* REGISTER USE ============================================================ *//* ========================================================================= */#define  RegisterUse_SerialSend                  registersAll#define  RegisterUse_Main                        registersAll/* ========================================================================= *//* REGISTER CHECK ========================================================== *//* ========================================================================= */#define  RegisterCheckOverride                   registersAll/* ========================================================================= *//* INTERRUPT SETTING ======================================================= *//* ========================================================================= */#define  InterruptStartOverride                  cfgGlobSet | cfgTickSet/* ========================================================================= *//* EVENT NAMES ============================================================= *//* ========================================================================= */// We use one event for all UARTs on the chip to tell the SerialSend task that// it should wake up and look for transmitable data.#define EN_00                                    QueuSendEvent/* ========================================================================= *//* SLOT NAMES ============================================================== *//* ========================================================================= */// All data thast should be send over the UART 0 is qued in this FIFO.#define  SN_01                                   Uart0Buffer/* ========================================================================= *//* SLOT SIZES ============================================================== *//* ========================================================================= */// Hence we use single slot, we can use/need one byte of task's slot size.#define  SlotSize_SerialSend                     1// Hence we use single slot, we can use/need one byte of task's slot size.#define  SlotSize_Main                           1/* ========================================================================= *//* SLOT USAGE ============================================================== *//* ========================================================================= */// We use our UART 0 buffer as an FIFO queu. (This includes the locking// functionality of the queu)#define SlotUse_Uart0Buffer                      cfgUseAsQueu/* ========================================================================= *//* QUEU SIZES ============================================================== *//* ========================================================================= */// The size of the UART 0 buffer. This has to be at least as long as the number// of bytes which will be send with an serialPrintXXX method.#define QueuSize_Uart0Buffer             30/* ========================================================================= *//* FILE NAMES ============================================================== *//* ========================================================================= *//* ========================================================================= *//* FILE SIZES ============================================================== *//* ========================================================================= */#define  FileSpaceStandard                       0#endif /*CONFIG_TESTHELLOWORLD_H_*/