📄 nucleus.h
字号:
/*************************************************************************/
/* */
/* Copyright (c) 1993-2001 Accelerated Technology, Inc. */
/* */
/* PROPRIETARY RIGHTS of Accelerated Technology are involved in the */
/* subject matter of this material. All manufacturing, reproduction, */
/* use, and sales rights pertaining to this subject matter are governed */
/* by the license agreement. The recipient of this software implicitly */
/* accepts the terms of the license. */
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* FILE NAME VERSION */
/* */
/* nucleus.h Nucleus PLUS\MPC8245\Diab C/C++ 1.13.1 */
/* */
/* COMPONENT */
/* */
/* System Constants */
/* */
/* DESCRIPTION */
/* */
/* This file contains system constants common to both the */
/* application and the actual Nucleus PLUS components. This file */
/* also contains data structure definitions that hide internal */
/* information from the application. */
/* */
/* */
/* DATA STRUCTURES */
/* */
/* NU_DRIVER I/O Driver control block */
/* NU_EVENT_GROUP Event group control block */
/* NU_HISR HISR control block */
/* NU_MAILBOX Mailbox control block */
/* NU_MEMORY_POOL Memory Pool control block */
/* NU_PARTITION_POOL Partition Pool control block */
/* NU_PIPE Pipe control block */
/* NU_QUEUE Queue control block */
/* NU_SEMAPHORE Semaphore control block */
/* NU_TASK Task control block */
/* NU_TIMER Timer control block */
/* NU_PROTECT Protection structure */
/* */
/* FUNCTIONS */
/* */
/* None */
/* */
/* DEPENDENCIES */
/* */
/* None */
/* */
/* HISTORY */
/* */
/* NAME DATE REMARKS */
/* */
/* T. Weller 12\19\2001 Created inital version 1.13.1 */
/*************************************************************************/
/* Check to see if this file has been included already. */
#define NU_NO_ERROR_CHECKING
//#define NU_INLINE
#ifndef NUCLEUS
#ifdef __cplusplus
extern "C" { /* C declarations in C++ */
#endif
#define NUCLEUS
#define PLUS_1_11 1
#define PLUS_1_13 2
#define PLUS_VERSION_COMP PLUS_1_13
/* Define the clock frequency that is used by the timer control unit (must be
defined in hertz) On the SH this is the frequency of the periperal
clock and not the CPU. */
#define NU_System_Clock_Frequency 250000000
/* Define the number of Nucleus PLUS ticks that will occur every second.
By default, the PLUS timer goes off every 10ms, so the PLUS System Clock
ticks 100 times in a second. */
#define NU_PLUS_Ticks_Per_Second 100
/* Define the number of timer ticks that will occur every second. This is
usually the frequency of the timer used by the Nucleus clock. It may
be modified by a prescalar. See the INT assembler file for more
information about the clock */
#define NU_HW_Ticks_Per_Second (NU_System_Clock_Frequency / 16)
/* The number of timer ticks between Nucleus timer interrupts that increment
TMD_System_Clock. See timer initialization code for details about how to
determine this number. */
#define NU_HW_Ticks_Per_SW_Tick (NU_HW_Ticks_Per_Second / NU_PLUS_Ticks_Per_Second)
/* Define NU_COUNT_DOWN if the system timer counts down to 0. Undefine it if
the system timer counts up from 0. This macro is used to switch between
formulas to calculate the number of ticks since the systems started in
NU_Get_Clock */
#define NU_COUNT_DOWN
/* The Retrieve_Hardware_Clock assembler function is used to provide the
value of the hw_tick parameter in the NU_Retrieve_Hardware_Clock macro.
The 32-bit value returned is the current value of the Decrementer (DEC)
register. */
asm unsigned long Retrieve_Hardware_Clock(void)
{
! "r3" /* scratch register used */
mfdec r3 # move DEC value into r3 so it will be returned
};
/* This macro returns the value of the Nucleus timer (not the system clock)
in the 32-bit variable, hw_ticks. Some platforms may require more than a
single line of code. This macro is expanded by the compiler. If assembler
is required, enclose it in the compiler's assembler directive. */
#define NU_Retrieve_Hardware_Clock(hw_tick) hw_tick = Retrieve_Hardware_Clock()
/* Define standard data types. These definitions allow Nucleus PLUS to
perform in the same manner on different target platforms. */
/* Number of bytes : range */
typedef unsigned long UNSIGNED; /* 4 : 0 - 4,294,967,295 */
typedef long SIGNED; /* 4 : -2,147,483,648 - 2,147,483,648 */
typedef unsigned long DATA_ELEMENT;
typedef DATA_ELEMENT OPTION; /* 1 : 0 - 4,294,967,295 */
typedef int STATUS; /* 4 : -2,147,483,648 - 2,147,483,648 */
typedef unsigned char UNSIGNED_CHAR; /* 1 : 0 - 255 */
typedef char CHAR; /* 1 : -128 - 127 */
typedef int INT; /* 4 : -2,147,483,648 - 2,147,483,648 */
typedef void VOID;
typedef unsigned long * UNSIGNED_PTR; /* 4 : ???? */
typedef unsigned char * BYTE_PTR; /* 4 : ???? */
typedef char INT8; /* 1 : -128 - 127 */
typedef unsigned char UINT8; /* 1 : 0 - 255 */
typedef signed short INT16; /* 2 : 0 - 65,536 */
typedef unsigned short UINT16; /* 2 : -32,768 - 32,767 */
typedef signed long INT32; /* 4 : -2,147,483,648 - 2,147,483,648 */
typedef unsigned long UINT32; /* 4 : 0 - 4,294,967,295 */
/* Define register defines. R1, R2, R3, and R4 are used in the Nucleus PLUS
source code in front of variables that are referenced often. In some
ports, defining them as "register" will improve performance. */
#define R1 register
#define R2 register
#define R3 register
#define R4 register
/* Define the number of accesses required to read or write a pointer data
type. This value is used to make optimizations in some ports of Nucleus
PLUS. */
#define NU_POINTER_ACCESS 1
/* Define the padding required for usage of the DATA_ELEMENT type within
Nucleus PLUS structures. These values insure proper alignment for the
next structure member. */
#define PAD_1 0
#define PAD_2 0
#define PAD_3 0
/* Define constants that are target dependent and/or are used for internal
purposes. */
#define NU_MIN_STACK_SIZE 424
#define NU_MAX_NAME 8
#define NU_MAX_VECTORS 0x40
#define NU_MAX_LISRS 0x40
/* Define constants for the number of UNSIGNED words in each of the basic
system data structures. */
#define NU_TASK_SIZE 47
#define NU_HISR_SIZE 25
#define NU_MAILBOX_SIZE 14
#define NU_QUEUE_SIZE 19
#define NU_PIPE_SIZE 19
#define NU_SEMAPHORE_SIZE 10
#define NU_EVENT_GROUP_SIZE 9
#define NU_PARTITION_POOL_SIZE 15
#define NU_MEMORY_POOL_SIZE 17
#define NU_TIMER_SIZE 17
#define NU_PROTECT_SIZE 2
#define NU_DRIVER_SIZE 3
/* Define what an interrupt vector looks like on the target processor. */
typedef struct NU_VECTOR_STRUCT
{
VOID *pointer;
} NU_VECTOR;
/* Define constants for use in service parameters. */
#define NU_AND 2
#define NU_AND_CONSUME 3
#define NU_DISABLE_TIMER 4
#define NU_ENABLE_TIMER 5
#define NU_FALSE 0
#define NU_FIFO 6
#define NU_FIXED_SIZE 7
#define NU_NO_PREEMPT 8
#define NU_NO_START 9
#define NU_NO_SUSPEND 0
#define NU_NULL 0
#define NU_OR 0
#define NU_OR_CONSUME 1
#define NU_PREEMPT 10
#define NU_PRIORITY 11
#define NU_START 12
#define NU_SUSPEND 0xFFFFFFFFUL
#define NU_TRUE 1
#define NU_VARIABLE_SIZE 13
/* Define interrupt lockout and enable constants. */
#define NU_DISABLE_INTERRUPTS 0x0L
#define NU_ENABLE_INTERRUPTS 0x8000L
/* Define task suspension constants. */
#define NU_DRIVER_SUSPEND 10
#define NU_EVENT_SUSPEND 7
#define NU_FINISHED 11
#define NU_MAILBOX_SUSPEND 3
#define NU_MEMORY_SUSPEND 9
#define NU_PARTITION_SUSPEND 8
#define NU_PIPE_SUSPEND 5
#define NU_PURE_SUSPEND 1
#define NU_QUEUE_SUSPEND 4
#define NU_READY 0
#define NU_SEMAPHORE_SUSPEND 6
#define NU_SLEEP_SUSPEND 2
#define NU_TERMINATED 12
/* Define service completion status constants. */
#define NU_SUCCESS 0
#define NU_END_OF_LOG -1
#define NU_GROUP_DELETED -2
#define NU_INVALID_DELETE -3
#define NU_INVALID_DRIVER -4
#define NU_INVALID_ENABLE -5
#define NU_INVALID_ENTRY -6
#define NU_INVALID_FUNCTION -7
#define NU_INVALID_GROUP -8
#define NU_INVALID_HISR -9
#define NU_INVALID_MAILBOX -10
#define NU_INVALID_MEMORY -11
#define NU_INVALID_MESSAGE -12
#define NU_INVALID_OPERATION -13
#define NU_INVALID_PIPE -14
#define NU_INVALID_POINTER -15
#define NU_INVALID_POOL -16
#define NU_INVALID_PREEMPT -17
#define NU_INVALID_PRIORITY -18
#define NU_INVALID_QUEUE -19
#define NU_INVALID_RESUME -20
#define NU_INVALID_SEMAPHORE -21
#define NU_INVALID_SIZE -22
#define NU_INVALID_START -23
#define NU_INVALID_SUSPEND -24
#define NU_INVALID_TASK -25
#define NU_INVALID_TIMER -26
#define NU_INVALID_VECTOR -27
#define NU_MAILBOX_DELETED -28
#define NU_MAILBOX_EMPTY -29
#define NU_MAILBOX_FULL -30
#define NU_MAILBOX_RESET -31
#define NU_NO_MEMORY -32
#define NU_NO_MORE_LISRS -33
#define NU_NO_PARTITION -34
#define NU_NOT_DISABLED -35
#define NU_NOT_PRESENT -36
#define NU_NOT_REGISTERED -37
#define NU_NOT_TERMINATED -38
#define NU_PIPE_DELETED -39
#define NU_PIPE_EMPTY -40
#define NU_PIPE_FULL -41
#define NU_PIPE_RESET -42
#define NU_POOL_DELETED -43
#define NU_QUEUE_DELETED -44
#define NU_QUEUE_EMPTY -45
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -