1 /* -------------------------------- Arctic Core ------------------------------
2 * Arctic Core - the open source AUTOSAR platform http://arccore.com
4 * Copyright (C) 2009 ArcCore AB <contact@arccore.com>
6 * This source code is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published by the
8 * Free Software Foundation; See <http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt>.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * -------------------------------- Arctic Core ------------------------------*/
17 * Porting interface. Should really be called port.h or something.
\r
19 * The routines below + interrupt handing in Mcu_IntXX.c, should
\r
20 * be all that needs to be implemented for a new port.
26 #define STACK_PATTERN 0x42
31 * Swap context with a context. The difference between this
32 * function and Os_ArchSwapContext is that the later use
33 * the current stack. This one uses stack from context.
35 * @param old always NULL
36 * @param new Ptr to pcb.
37 * @param context Ptr to context
40 void Os_ArchSwapContextToW(void *old,void *new, void *context );
44 * Sets the current pcb
\r
46 * @param old - old ptr to pcb
\r
49 void Os_ArchSwapContext(void *old,void *new);
\r
52 * Swap context for the first time for a task
\r
54 * The only way to call this function right now is to:
\r
55 * Os_TaskSwapContextTo(NULL,<pcb>);
\r
57 void Os_ArchSwapContextTo(void *old,void *new);
\r
60 * Setup a pcb before use.
\r
62 * This function should setup:
\r
63 * - context marker( SC_PATTERN, LC_PATTERN )
\r
64 * - Arch specific register setup
\r
65 * - Check that the stack is suffient for the arch
\r
68 * @param pcb Ptr to pcb
70 void os_arch_setup_context( OsPcbType *pcb );
\r
73 * Get current stack pointer
\r
75 * @return current stack pointer
77 void *Os_ArchGetStackPtr( void );
\r
80 * Initialize the hardware.
\r
81 * This could be initialization of:
\r
82 * - interrupt controller
\r
85 void os_arch_init( void );
\r
88 * Function that is used when task entry is called for the
\r
89 * first time. For ports that don't support user mode it
\r
90 * should just call entry entry() function of the current task.
\r
92 * When user mode is supported a switch to user mode must be done
\r
93 * in some way. A trap maybe?
\r
95 void os_arch_first_call( void );
\r
99 * Get the small context size
\r
101 * @return The small context size in bytes
103 unsigned int Os_ArchGetScSize( void );
\r
105 void OsArch_SetTaskEntry(OsPcbType *pcbPtr );
109 void *os_arch_get_stack_usage( OsPcbType * );
\r
111 _Bool os_arch_stack_endmark_ok( OsPcbType *);