📄 port.h
字号:
* 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 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.
*/
#ifndef _X86ARCH_C
extern void p_pos_globalLock(int *flags);
#endif
#define POS_SCHED_LOCK p_pos_globalLock(&flags)
/** Scheduler unlocking.
* This is the counterpart macro of ::POS_SCHED_LOCK. It restores
* the saved processor flags and reenables the interrupts this way.
*/
#ifndef _X86ARCH_C
extern void p_pos_globalUnlock(int flags);
#endif
#define POS_SCHED_UNLOCK p_pos_globalUnlock(flags)
/** @} */
/*---------------------------------------------------------------------------
* FINDBIT - DEFINITIONS FOR GENERIC FILE fbit_gen.c
*-------------------------------------------------------------------------*/
/** @defgroup findbit 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 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 0 /* no stack needed for W32 */
/** Enable generic console output handshake.
* Please see description of function ::c_nos_putcharReady for details.
*/
#define NOSCFG_CONOUT_HANDSHAKE 0
/** 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 256
/** @} */
/*---------------------------------------------------------------------------
* 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
#define TASK_RESERVED_PORT_MEM 64
#define POS_USERTASKDATA \
char portmem[TASK_RESERVED_PORT_MEM];
#endif /* DOX */
/*---------------------------------------------------------------------------
* SOME SPECIAL FUNCTIONS
*-------------------------------------------------------------------------*/
#ifndef _X86ARCH_C
/* we support assertions */
#define HAVE_PLATFORM_ASSERT
extern void p_pos_assert(const char* text, const char *file, int line);
/* This function allows any MS Windows thread to call a pico]OS hardware
* interrupt handler function. Thus, it maps a usual MS Windows thread
* to a hardware interrupt from the view of pico]OS.
* Argument: Pointer to the interrupt handler to execute.
* Note: This function must only be called by pure Windows threads,
* it is not allowed to call this function from a pico]OS task.
*/
extern void callInterruptHandler( void (*handlerfunc)(void) );
/* Call this function to enter a critical section of code. This function
* works like the MS Windows function EnterCriticalSection(), but it is
* allowed to call this function from anywhere you want, whereas the
* MS Windows function can not be used in pico]OS tasks.
* A critical section must be left again by calling singleThreadExit().
*/
extern void singleThreadEnter(void);
/* This is the counterpart function of singleThreadEnter().
*/
extern void singleThreadExit(void);
/* Idle task hook function ("suspend" the CPU for low power mode)
*/
extern void p_pos_idleTaskHook(void);
#define HOOK_IDLETASK p_pos_idleTaskHook();
#endif
#endif /* _PORT_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -