⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ser_drv.h

📁 nucleus 文件系统,内核和彩色图形系统,在小系统上非常好用
💻 H
字号:
#ifndef PORT_H
#define PORT_H

#define DRAGONBALL
/*
 * IMPORTANT:  The object libraries shipped with this distribution were built
 *             using the following compile options.  These options should not
 *             be removed and should be used when building code that links
 *             these object libraries.  Note as well that the NUMERIC_SECURE
 *	       compile option is used for numeric versions of these object
 *	       libraries.  This option is defined via the makefiles included
 *	       with this distribution.  To ensure that these options are 
 *	       defined when compiling user code, include this header file
 *	       or use the define option available for your specific compiler
 *
 *             Note as well that the libraries have been built using the SYN
 *             compile option to support systems with synthesized receivers.
 *             This compile option is not required and can be defined according
 *             to your specific system configuration.
 *
 *             Refer to the makefiles and documentation regarding builds of this
 *             software for more information on compile options.
 */
#define EXACT_CHAR_CNT
#define FILTER
#define EXPANDED
#define FLEXTIME

/*
 * All variable definitions in FLEXstack are defined with one of the
 * following typedef's. INT, UINT, CHAR, UCHAR are those native to
 * a specific processor.
 */
typedef int INT;
typedef char CHAR;
typedef unsigned int UINT;
typedef unsigned char UCHAR;

/*
 * The following typedef's must match the specified bit size regardless
 * of the processor, otherwise the code must be scrutinized.
 *
 * The ATTRIB_BUF define is for use by the FStkmGetAttrib() and
 * FStkmSetAttrib(). If set to 0, no copy operation is performed, only
 * a pointer is returned to the attributes in external memory. If set to 1,
 * a copy operation is performed from external memory to a local memory
 * buffer. This may be necessary for processors that cannot directly
 * address external memory if messages are stored there.
 */
#ifdef EXPANDED
#define ATTRIB_BUF  ((UVAR8 *)0)    /* no temp attrib buffer needed */
#else
#define ATTRIB_BUF  ((UVAR8 *)&gAttribute)  /* buffer for copy of attributes */
#endif

typedef char VAR8;
typedef unsigned char UVAR8;


#ifdef DRAGONBALL           /* DragonBall example */
#define MSBF
#define NO_MOD_ALIGN		/* no modulo alignment macro needed */
typedef UVAR8* ADDRESS;
typedef UVAR8* HANDLE;
typedef short VAR16;
typedef int VAR32;
typedef unsigned short UVAR16;
typedef unsigned int UVAR32;
/*
 * GLOBAL MACROS
 */
#define BSET(var,bit) (var |= (bit))
#define BCLR(var,bit) (var &= ~(bit))
#define BTST(var,bit) ((var&(bit)) ? 1 : 0)

#define PTR_SIZE    4       /* machine pointer size in bytes */
#define printf              /* override printf */
#define ATTRIB_BUF  ((UVAR8 *)0)	/* no temp attrib buffer needed */
#endif


/*
 * Bit Structure Definitions - For ANSI compatibility, all
 * bit definitions should be Unsigned Integer (UINT). Many
 * compilers produce more efficient code when a bit field
 * is defined with the smallest entity which will accomodate
 * the stated number of bits. The following bit fields
 * must not be smaller than the entity specified.
 *
 * Bit structures may also be defined most-significant-bit-
 * first or least-significant-bit-first with/without MSBF option.
 */
/*! ggw -- 7/21/98 -- added HC08 to conditional since COSMIC compiler
                      requires the NON-ANSI definitions !*/
#if defined(HC11) || defined(HC08)
typedef UVAR8  BSTR8;   /* HC11 example, no less than 8 bits */
typedef UVAR16 BSTR16;  /* HC11 example, no less than 16 bits */
typedef UVAR32 BSTR32;  /* HC11 example, no less than 32 bits */
typedef UINT   BPTR;    /* HC11 example, no less than pointer size */
#else
typedef UINT BSTR8;     /* ANSI C default */
typedef UINT BSTR16;    /* ANSI C default */
typedef UINT BSTR32;    /* ANSI C default */
typedef UINT BPTR;      /* ANSI C default */
#endif

/*
 * EOF_NODE_CHECK enables extra code to test for stranded nodes
 * on each occurrance of a Status packet with the end-of-frame
 * bit set. This is done by default on each addr/vect/addr
 * sequence on a per phase basis.
 *
#define EOF_NODE_CHECK
 */

/*
 * CMA_DEPTH sets the depth of the gCurrentMsg array. This must be
 * defined not less than 2 to create an array of admin node pointers
 * 2 deep for each of the 4 phases. This will use 8*<pointer size> bytes
 * of RAM. It is used by vector processing routines to index through
 * each phase list to match vector and message admin nodes. The second
 * index is used to save the second vector message packet admin mode.
 * The Message packet processing also uses this to store the admin
 * node pointer for the message Data packets. The Multiple Message-
 * Same Data requires multiple admin nodes to be active. The depth of
 * this array therefore determines the maximum number of Multiple
 * Messages with Same Data that can be processed.
 */
#define CMA_DEPTH   2       /* not less than 2 */

/*
 * Defines null pointer value
 */
#ifndef NULL
#define NULL 0
#endif

/*
 * Defines return type BOOLEAN (TRUE/FALSE)
 */
#define TRUE        1
#define FALSE       0

/*
 * Defines return type ERROR (SUCCESS/FAILED)
 */
#define SUCCESS     0
#define FAILED      1

/*
 * defines the API return disposition (SUCCESS/FAILED/error code)
 */
typedef UVAR8 ERROR;

/*
 * defines the API return disposition (TRUE/FALSE)
 */
typedef UVAR8 BOOLEAN;

/*
 * Set number of phases supported by this product,
 * determines the size of phase related arrays.
 */
#ifdef SINGLE_PHASE
#define NUMBER_OF_PHASES    1
#define PHASE               0
#else
#define NUMBER_OF_PHASES    4
#define PHASE               phase
#endif

/*
 * Remove hex/bin code on NUMERIC_ONLY
 */
#ifdef NUMERIC_ONLY
#define NUMERIC_SECURE
#endif

#ifdef RCA
#define TERM_MSGS
#endif

#define URX_READY               0x2000
#define URX_OVERRUN             0x0800
#define URX_FRAME_ERR           0x0400
#define URX_PARITY_ERR          0x0100

typedef struct UART_INIT_STRUCT
{
    unsigned    data_bits;
    unsigned    stop_bits;
    unsigned    parity;
    unsigned    baud_rate;
    unsigned    data_mode;

} UART_INIT;

/* UART function prototypes */
STATUS  UART_Init_Port();
VOID    UART_Put_Char(UNSIGNED_CHAR ch);
VOID    UART_Put_String(UNSIGNED_CHAR *ch);
STATUS  UART_Data_Ready(VOID);
CHAR    UART_Get_Char(VOID);
VOID    UART_LISR(INT vector);
VOID    UART_Set_Baud_Rate(UNSIGNED baud_rate);
STATUS  UART_Carrier(VOID);
VOID    UART_Set_DTR(INT toggle);

#endif   /* PORT_H */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -