port.h

Go to the documentation of this file.
00001 /*
00002  *  Copyright (c) 2004-2006, Dennis Kuschel.
00003  *  All rights reserved. 
00004  *
00005  *  Redistribution and use in source and binary forms, with or without
00006  *  modification, are permitted provided that the following conditions
00007  *  are met:
00008  *
00009  *   1. Redistributions of source code must retain the above copyright
00010  *      notice, this list of conditions and the following disclaimer.
00011  *   2. Redistributions in binary form must reproduce the above copyright
00012  *      notice, this list of conditions and the following disclaimer in the
00013  *      documentation and/or other materials provided with the distribution.
00014  *   3. The name of the author may not be used to endorse or promote
00015  *      products derived from this software without specific prior written
00016  *      permission. 
00017  *
00018  *  THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
00019  *  OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00020  *  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00021  *  ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
00022  *  INDIRECT,  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00023  *  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00024  *  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00025  *  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
00026  *  STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00027  *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
00028  *  OF THE POSSIBILITY OF SUCH DAMAGE.
00029  *
00030  */
00031 
00032 
00045 #ifndef _PORT_H
00046 #define _PORT_H
00047 
00048 
00049 /*---------------------------------------------------------------------------
00050  *  ARCHITECTURE / CPU SPECIFIC SETTINGS
00051  *-------------------------------------------------------------------------*/
00052 
00073 #define MVAR_t                   char
00074 
00082 #define MVAR_BITS                8  /* = (sizeof(MVAR_t) * 8) */
00083 
00091 #define MPTR_t                   long
00092 
00101 #define POSCFG_ALIGNMENT         2
00102 
00111 #define POSCFG_ISR_INTERRUPTABLE 0
00112 
00137 #define POSCFG_TASKSTACKTYPE     0
00138 
00144 #define POSCFG_CALLINITARCH      1
00145 
00153 #define POSCFG_PORTMUTEX         0
00154 
00161 #define POSCFG_DYNAMIC_MEMORY    0
00162 
00174 #define POSCFG_DYNAMIC_REFILL    0
00175 
00183 #define POS_MEM_ALLOC(bytes)     nosMemAlloc(bytes)
00184 
00189 /*---------------------------------------------------------------------------
00190  *  LOCKING (DISABLE INTERRUPTS IN CRITICAL SECTIONS) 
00191  *-------------------------------------------------------------------------*/
00192 
00240 #define POSCFG_LOCK_USEFLAGS     0
00241 
00250 #define POSCFG_LOCK_FLAGSTYPE    register VAR_t
00251 
00259 #ifdef GCC
00260 #define POS_SCHED_LOCK           asm volatile("pushf\n" "cli\n"::)
00261 #else
00262 #define POS_SCHED_LOCK           asm { PUSHF; CLI }
00263 #endif
00264 
00269 #ifdef GCC
00270 #define POS_SCHED_UNLOCK         asm volatile("popf\n"::)
00271 #else
00272 #define POS_SCHED_UNLOCK         asm POPF
00273 #endif
00274 
00289 #define POS_IRQ_DISABLE_ALL      POS_SCHED_LOCK
00290 
00295 #define POS_IRQ_ENABLE_ALL       POS_SCHED_UNLOCK
00296 
00301 /*---------------------------------------------------------------------------
00302  *  FINDBIT - DEFINITIONS FOR GENERIC FILE fbit_gen.c
00303  *-------------------------------------------------------------------------*/
00304 
00337 #define POSCFG_FBIT_USE_LUTABLE      0
00338 
00344 #define POSCFG_FBIT_BITSHIFT         1
00345 
00350 /*---------------------------------------------------------------------------
00351  *  PORT DEPENDENT NANO LAYER CONFIGURATION
00352  *-------------------------------------------------------------------------*/
00353 
00366 #define NOSCFG_STACK_GROWS_UP        0
00367 
00372 #define NOSCFG_DEFAULT_STACKSIZE     2048
00373 
00377 #define NOSCFG_CONOUT_HANDSHAKE      0
00378 
00386 #define NOSCFG_CONOUT_FIFOSIZE       256
00387 
00392 /*---------------------------------------------------------------------------
00393  *  USER DEFINED CONTENT OF TASK ENVIRONMENT
00394  *-------------------------------------------------------------------------*/
00395 
00396 #if DOX!=0
00397 
00402 #define POS_USERTASKDATA  void *stackptr;
00403 #else
00404 
00405 /* Here is an example for different memory handling types:
00406  */
00407 
00408 #if POSCFG_TASKSTACKTYPE == 0
00409 
00410 #define POS_USERTASKDATA \
00411    void  *stackptr;
00412 
00413 #elif POSCFG_TASKSTACKTYPE == 1
00414 
00415 #define POS_USERTASKDATA \
00416    void  *stackptr; \
00417    void  *stackroot;
00418 
00419 #elif POSCFG_TASKSTACKTYPE == 2
00420 
00421 #define FIXED_STACK_SIZE 0x0600
00422 #define POS_USERTASKDATA \
00423    void  *stackptr; \
00424    unsigned short stack[FIXED_STACK_SIZE];
00425 
00426 #endif
00427 
00428 #endif /* DOX */
00429 
00430 #endif /* _PORT_H */

Generated on Sat Dec 8 14:53:02 2007 for pico]OS by  doxygen 1.5.4