📄 nucleus.h
字号:
/*************************************************************************/
/* */
/* Copyright Mentor Graphics Corporation 2002 */
/* All Rights Reserved. */
/* */
/* THIS WORK CONTAINS TRADE SECRET AND PROPRIETARY INFORMATION WHICH IS */
/* THE PROPERTY OF MENTOR GRAPHICS CORPORATION OR ITS LICENSORS AND IS */
/* SUBJECT TO LICENSE TERMS. */
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* FILE NAME VERSION */
/* */
/* nucleus.h Nucleus PLUS\ARM PID\ADS 1.13.24 */
/* */
/* 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 */
/* */
/* W. Lamie 04-19-1994 Created R4xxx version 1.0 */
/* D. Lamie 04-30-1994 Verified version 1.0 */
/* C. Meredith 03-01-1994 Added logic to use the actual */
/* Nucleus PLUS data structures */
/* when NU_DEBUG flag is turned */
/* on, changed various function */
/* names due to re-organization */
/* of various files, added */
/* register variable capability, */
/* added two interrupt functions, */
/* and general cleanup, */
/* resulting in version 1.1 */
/* R. Pfaff - */
/* D. Lamie 03-18-1994 Verified version 1.1 */
/* U. Pollock 03-22-1996 Changed TCF_Current_HISR_Pointer */
/* to TCC_Current_HISR_Pointer in */
/* function mappings, */
/* Changed MBC_Mailbox_Pointers to */
/* NU_Mailbox_Pointers in */
/* function prototype list, */
/* resulting in version 1.1+2 */
/* (spr 40,51) */
/* M. Trippi 07-11-1996 Released version 1.2 */
/* M. Trippi 02-18-1997 Released version 1.3 */
/* M. Manning 03-04-1997 Released version 1.4 */
/* J. Bolton 08-26-1997 Released version 1.5 */
/* J. Bolton 10-08-1997 Released version 1.6 */
/* M. Kyle Craig 10-23-1997 Released version 1.7 */
/* G. Clark 01-30-1998 Released version 1.8 */
/* A. Bebawy 02-27-1998 Created and Verified version 1.9 */
/* A. Bebawy 03-27-1998 Created and Verified version 1.10*/
/* M. Kyle Craig 08-20-1998 Verified version 1.11 */
/* George Clark 01-21-1999 Verified version 1.12 */
/* George Clark 02-05-1999 Verified version 1.11.17 */
/* B. Whatley 08-12-1999 Released version 1.11.18 */
/* D. Phillips 01-18-2000 Updated port to new structuring */
/* scheme */
/* B. Whatley 01-25-2001 released version 1.13.20 */
/* D. Driscoll 05-22-2001 Released version 1.13.21, fixed */
/* spr 82,157, and 1051 */
/* C. Sheppard 10-15-2001 Released version 1.13.22 */
/* Fixed spr 633 */
/* J. Pregeant 04-17-2002 Released version 1.13.23 */
/* J. Pregeant 08-16-2002 Released version 1.13.24 */
/*************************************************************************/
/* Check to see if this file has been included already. */
#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
#ifndef NU_SUPERV_USER_MODE
#define NU_SUPERV_USER_MODE 0
#endif
#ifndef NU_MODULE_SUPPORT
#define NU_MODULE_SUPPORT 0
#endif
#ifndef NU_MMU_MODE
#define NU_MMU_MODE 0
#endif
/////////////////////////////////////////////////
#define NU_NO_ERROR_CHECKING
///////////////////////////////////////////////
/* Define the clock frequency that is used by the timer control unit (must be defined in hertz */
#define NU_System_Clock_Frequency 16000000
/* Define the interval between successive PLUS ticks (must be stated in units of microseconds) */
#define NU_PLUS_Tick_Rate 10000
/* Define the number of Nucleus PLUS ticks that will occur every second */
#define NU_PLUS_Ticks_Per_Second (1000000 / NU_PLUS_Tick_Rate)
/* 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 info */
#define NU_HW_Ticks_Per_Second (NU_System_Clock_Frequency/256)
/* 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.
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
/* This macro returns the value of the Nucleus timer (not the system clock) */
#define NU_Retrieve_Hardware_Clock(hw_tick) hw_tick = (UINT16)(*(UINT32 *)(0x01d50014))
/* Define standard data types. These definitions allow Nucleus PLUS to
perform in the same manner on different target platforms. */
typedef unsigned long UNSIGNED;
typedef long SIGNED;
typedef unsigned char DATA_ELEMENT;
typedef DATA_ELEMENT OPTION;
typedef int STATUS;
typedef unsigned char UNSIGNED_CHAR;
typedef char CHAR;
typedef int INT;
typedef unsigned long * UNSIGNED_PTR;
typedef unsigned char * BYTE_PTR;
#define VOID void
typedef char INT8;
typedef unsigned char UINT8;
typedef signed short INT16;
typedef unsigned short UINT16;
typedef signed long INT32;
typedef unsigned long UINT32;
/* 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
/* Describe the static base register, needed for calling services */
/* This also avoids allocating SB (=v6) to any other purpose. */
//__global_reg(6) void *sb;
/* 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 3
#define PAD_2 2
#define PAD_3 1
/* Define constants that are target dependent and/or are used for internal
purposes. */
#define NU_MIN_STACK_SIZE 240
#define NU_MAX_NAME 8
#define NU_MAX_VECTORS 25
#define NU_MAX_LISRS 25
/* Define constants for the number of UNSIGNED words in each of the basic
system data structures. */
#if ((NU_SUPERV_USER_MODE == 1)||(NU_MODULE_SUPPORT == 1))
#define NU_TASK_SIZE 44
#define NU_HISR_SIZE 24
#else
#define NU_TASK_SIZE 42
#define NU_HISR_SIZE 22
#endif
#define NU_MAILBOX_SIZE 13
#define NU_QUEUE_SIZE 18
#define NU_PIPE_SIZE 18
#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
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -