pico]OS  1.0.4
port.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2004-2012, Dennis Kuschel.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * 1. Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the distribution.
14  * 3. The name of the author may not be used to endorse or promote
15  * products derived from this software without specific prior written
16  * permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
19  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
22  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28  * OF THE POSSIBILITY OF SUCH DAMAGE.
29  *
30  */
31 
32 
45 #ifndef _PORT_H
46 #define _PORT_H
47 
48 
49 /*---------------------------------------------------------------------------
50  * ARCHITECTURE / CPU SPECIFIC SETTINGS
51  *-------------------------------------------------------------------------*/
52 
73 #define MVAR_t char
74 
82 #define MVAR_BITS 8 /* = (sizeof(MVAR_t) * 8) */
83 
91 #define MPTR_t long
92 
101 #define POSCFG_ALIGNMENT 2
102 
111 #define POSCFG_ISR_INTERRUPTABLE 0
112 
137 #define POSCFG_TASKSTACKTYPE 0
138 
144 #define POSCFG_CALLINITARCH 1
145 
153 #define POSCFG_PORTMUTEX 0
154 
161 #define POSCFG_DYNAMIC_MEMORY 0
162 
174 #define POSCFG_DYNAMIC_REFILL 0
175 
183 #define POS_MEM_ALLOC(bytes) nosMemAlloc(bytes)
184 
189 /*---------------------------------------------------------------------------
190  * LOCKING (DISABLE INTERRUPTS IN CRITICAL SECTIONS)
191  *-------------------------------------------------------------------------*/
192 
240 #define POSCFG_LOCK_USEFLAGS 0
241 
250 #define POSCFG_LOCK_FLAGSTYPE register VAR_t
251 
259 #ifdef GCC
260 #define POS_SCHED_LOCK asm volatile("pushf\n" "cli\n"::)
261 #else
262 #define POS_SCHED_LOCK asm { PUSHF; CLI }
263 #endif
264 
269 #ifdef GCC
270 #define POS_SCHED_UNLOCK asm volatile("popf\n"::)
271 #else
272 #define POS_SCHED_UNLOCK asm POPF
273 #endif
274 
289 #define POS_IRQ_DISABLE_ALL POS_SCHED_LOCK
290 
295 #define POS_IRQ_ENABLE_ALL POS_SCHED_UNLOCK
296 
301 /*---------------------------------------------------------------------------
302  * FINDBIT - DEFINITIONS FOR GENERIC FILE fbit_gen.c
303  *-------------------------------------------------------------------------*/
304 
337 #define POSCFG_FBIT_USE_LUTABLE 0
338 
344 #define POSCFG_FBIT_BITSHIFT 1
345 
350 /*---------------------------------------------------------------------------
351  * PORT DEPENDENT NANO LAYER CONFIGURATION
352  *-------------------------------------------------------------------------*/
353 
366 #define NOSCFG_STACK_GROWS_UP 0
367 
372 #define NOSCFG_DEFAULT_STACKSIZE 2048
373 
377 #define NOSCFG_CONOUT_HANDSHAKE 0
378 
386 #define NOSCFG_CONOUT_FIFOSIZE 256
387 
392 /*---------------------------------------------------------------------------
393  * USER DEFINED CONTENT OF TASK ENVIRONMENT
394  *-------------------------------------------------------------------------*/
395 
396 #if DOX!=0
397 
402 #define POS_USERTASKDATA void *stackptr;
403 #else
404 
405 /* Here is an example for different memory handling types:
406  */
407 
408 #if POSCFG_TASKSTACKTYPE == 0
409 
410 #define POS_USERTASKDATA \
411  void *stackptr;
412 
413 #elif POSCFG_TASKSTACKTYPE == 1
414 
415 #define POS_USERTASKDATA \
416  void *stackptr; \
417  void *stackroot;
418 
419 #elif POSCFG_TASKSTACKTYPE == 2
420 
421 #define FIXED_STACK_SIZE 0x0600
422 #define POS_USERTASKDATA \
423  void *stackptr; \
424  unsigned short stack[FIXED_STACK_SIZE];
425 
426 #endif
427 
428 #endif /* DOX */
429 
430 #endif /* _PORT_H */