📄 port.h
字号:
* processor state from the stack. If interrupts where enabled before,
* it just became enabled now.<br>
*
* 3) There are some processors which have no OP-code for directly pushing
* the processor flags (=PSW, Processor Status Word) directly to the stack.
* For this processors, you can define a local variable which will hold
* the original PSW when the operating system enters the critical section.
* If your processor has enough general purpose register, you may define
* the variable as register variable for fastest possible access. This is
* truly better than pushing the flags to the stack.
* @{
*/
/** Enable local flags variable.
* When this define is set to 1, a user defined variable will be
* generated for storing the current processor state before
* disabling interrupts. Then the define ::POSCFG_LOCK_FLAGSTYPE
* must be set to the type of variable to be used for the flags.
*/
#define POSCFG_LOCK_USEFLAGS 1
/** Define variable type for the processor flags.
* If ::POSCFG_LOCK_USEFLAGS is set to 1, this define must be
* set to the variable type that shall be used for the
* processor flags. In this example, the variable definition
* "register VAR_t flags;" would be added to each function
* using the macros ::POS_SCHED_LOCK and ::POS_SCHED_UNLOCK.
*/
#define POSCFG_LOCK_FLAGSTYPE register unsigned int
/** Scheduler locking.
* Locking the scheduler for a short time is done by
* disabling the interrupts on the processor. This macro
* can contain a subroutine call or a piece of assembler
* code that stores the processor state and disables
* the interrupts. See ::POSCFG_LOCK_FLAGSTYPE for more details.
*/
#define POS_SCHED_LOCK flags = armEnterCritical()
/** Scheduler unlocking.
* This is the counterpart macro of ::POS_SCHED_LOCK. It restores
* the saved processor flags and reenables the interrupts this way.
*/
#define POS_SCHED_UNLOCK armExitCritical(flags)
unsigned int armEnterCritical(void);
void armExitCritical(unsigned int old_int);
/** @} */
/*---------------------------------------------------------------------------
* FINDBIT - DEFINITIONS FOR GENERIC FILE fbit_gen.c
*-------------------------------------------------------------------------*/
/** @defgroup findbit Configuration: Generic Findbit
* @ingroup configp
* The pico]OS is shipped with a generic file that implements variouse
* methods for finding the first and least significant bit set.
* This section contains switches for configuring the file fbit_gen.c.
* Please see the section <b>pico]OS Porting Information</b> for details
* about findbit.
* @{
*/
/** Generic finbit configuration, look-up table support.
* The findbit mechanism can be implemented as look-up table.<br>
*
* POSCFG_FBIT_USE_LUTABLE = 0:<br>
* Do not use look up tables. "findbit" is implemented as a function.
* (This does not increase code size through tables. Also
* some CPUs may execute program code faster from their caches
* than fetching data from big lookup tables.)
* Note: This is the only possible setting for
* systems with ::MVAR_BITS != 8 <br>
*
* POSCFG_FBIT_USE_LUTABLE = 1:<br>
* - When round robin scheduling is disabled, findbit is done
* by use of a 256 byte sized lookup table.
* - When round robin scheduling is enabled, findbit is implemented
* as a function and uses a 256 byte sized lookup table.<br>
*
* POSCFG_FBIT_USE_LUTABLE = 2:<br>
* This is only applicable for round robin scheduling.
* "findbit" is implemented as a two dimensional lookup table.
* This blows code size very much.
*/
#define POSCFG_FBIT_USE_LUTABLE 0
/** Generic finbit configuration, machine bit-shift ability.
* Some machines are very slow in doing bit-shifts. If your
* target is such a machine, you can define this parameter to
* zero to prevent findbit of doing excessive bitshifts.
*/
#define POSCFG_FBIT_BITSHIFT 1
/** @} */
/*---------------------------------------------------------------------------
* PORT DEPENDENT NANO LAYER CONFIGURATION
*-------------------------------------------------------------------------*/
/** @defgroup portnlcfg Configuration: Nano Layer Port
* @ingroup configp
* This section is used to configure port dependent
* settings for the nano layer. (file port.h)
* @{
*/
/** Set the direction the stack grows.
* When the processor stack grows from bottom to top, this define
* must be set to 1. On platforms where the stack grows from
* top to bottom, this define must be set to 0.
*/
#define NOSCFG_STACK_GROWS_UP 0
/** Set the default stack size.
* If the functions ::nosTaskCreate or ::nosInit are called with
* a stack size of zero, this value is taken as the default stack size.
*/
#define NOSCFG_DEFAULT_STACKSIZE 250
/** Enable generic console output handshake.
* Please see description of function ::c_nos_putcharReady for details.
*/
#define NOSCFG_CONOUT_HANDSHAKE 1
/** Set the size of the console output FIFO.
* If ::NOSCFG_CONOUT_HANDSHAKE is enabled, a FIFO buffer can be used
* to speed up console output and to reduce CPU usage. This option is
* useful when console output is done through a serial line that does
* not have a hardware FIFO. To enable the FIFO, set this define to
* the FIFO size in bytes. A zero will disable the FIFO buffer.
*/
#define NOSCFG_CONOUT_FIFOSIZE 80
/** @} */
/*---------------------------------------------------------------------------
* USER DEFINED CONTENT OF TASK ENVIRONMENT
*-------------------------------------------------------------------------*/
#if (DOX!=0)
/** @def POS_USERTASKDATA
* Add user defined data elements to the global task structure.
* Please see detailed description of ::POSTASK_t.
* @sa POSTASK_t
*/
#define POS_USERTASKDATA void *stackptr;
#else
#if (POSCFG_TASKSTACKTYPE == 0)
#define POS_USERTASKDATA \
void *stackptr;
#elif (POSCFG_TASKSTACKTYPE == 1)
#define POS_USERTASKDATA \
void *stackptr; \
void *stackstart;
#elif (POSCFG_TASKSTACKTYPE == 2)
/* context switch (stack frame): 72 bytes
* runtime lib + application : 100 bytes
*/
#define FIXED_STACK_SIZE 200
#define POS_USERTASKDATA \
void *stackptr; \
unsigned char stack[FIXED_STACK_SIZE];
#endif
#endif /* DOX */
/*---------------------------------------------------------------------------
* ADDITIONAL DEFINES FOR THIS PORT
*-------------------------------------------------------------------------*/
/* provide NULL pointer */
#ifndef NULL
#define NULL ((void*)0)
#endif
typedef void (*ArmIrqHandlerFunction)(int irq);
/** Set default interrupt handler, which is called when IRQ
* occurs and there is no handler within the port already.
* Handler is called with task context already saved and
* c_pos_intEnter called.
*/
void armSetDefaultIrqHandler(ArmIrqHandlerFunction func);
#endif /* _PORT_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -