📄 port.h
字号:
* interrupts. Much processors support a "push flags to stack" OP-Code
* for this purpose. When the operating system enters a critical section,
* it will push the processor flags to the stack and disables the interrupts.
* Then, when the operating system will left the critical section again,
* it simply restores the old processor state by popping the last
* 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.
*/
unsigned int p_asm_intsOff(void);
#define POS_SCHED_LOCK flags = p_asm_intsOff()
/** Scheduler unlocking.
* This is the counterpart macro of ::POS_SCHED_LOCK. It restores
* the saved processor flags and reenables the interrupts this way.
*/
void p_asm_intsOn(unsigned int savedflags);
#define POS_SCHED_UNLOCK p_asm_intsOn(flags)
/** @} */
/*---------------------------------------------------------------------------
* 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 16384
/** 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 20
/** @} */
/*---------------------------------------------------------------------------
* 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 some user data below. Only types 0 and 2 are supported. */
#if (POSCFG_TASKSTACKTYPE == 0)
#define POS_USERTASKDATA \
void *stackptr;
#elif (POSCFG_TASKSTACKTYPE == 1)
#error POSCFG_TASKSTACKTYPE = 1 is not supported by this port
#elif (POSCFG_TASKSTACKTYPE == 2)
#define FIXED_STACK_SIZE 0x2000
#define POS_USERTASKDATA \
void *stackptr; \
unsigned int stack[FIXED_STACK_SIZE / sizeof(unsigned int)];
#endif
#endif /* DOX */
/*---------------------------------------------------------------------------
* SOME DEFINES FOR TEST.C
*-------------------------------------------------------------------------*/
/* define print-string function for test.c */
extern void u_print(const char *str);
#define PRINTSTR(str) u_print(str)
/* The C main() function is not supported. We rename it here. */
#define main mainfunc
#endif /* _PORT_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -