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

📄 header.h

📁 是一个手机功能的模拟程序
💻 H
字号:
/* 
+------------------------------------------------------------------------------
|  File:       header.h
+------------------------------------------------------------------------------
|  Copyright 2002 Texas Instruments Berlin, AG 
|                 All rights reserved. 
| 
|                 This file is confidential and a trade secret of Texas 
|                 Instruments Berlin, AG 
|                 The receipt of or possession of this file does not convey 
|                 any rights to reproduce or disclose its contents or to 
|                 manufacture, use, or sell anything it may describe, in 
|                 whole, or in part, without the specific written consent of 
|                 Texas Instruments Berlin, AG. 
+----------------------------------------------------------------------------- 
|  Purpose :  Common header types.
+----------------------------------------------------------------------------- 
*/ 

#ifndef __HEADER_H__
#define __HEADER_H__


/*
 * T_PRIM_HEADER
 *
 * Description :  This type definition defines the custom specific
 *                part of a primitive. All primitives have the
 *                general format: header followed by data. The
 *                header of a primitive is changeable according to
 *                the requirements of the target system.
 * Hints:         Only the operation code opc as a USHORT value must
 *                be present. For multi-instance protocol stacks
 *                the routing information must be include in the
 *                header (T_ROUTE route).
 */

#if !defined (T_SDU_DEFINED)

#define T_SDU_DEFINED

typedef struct
{
  USHORT l_buf;
  USHORT o_buf;
  UBYTE  buf[1];
} T_sdu;

#endif /* T_SDU_DEFINED */

/*
 * list of generic data descriptors
 */
typedef struct
{
  USHORT          list_len;       /* length in octets of whole data */
  ULONG           first;          /* "pointer" to  generic data descriptors */
} T_desc_list;

#define __T_desc_list__           /* to prevent double include in generated files */

/*
 * generic data descriptor
 */
#ifndef __T_desc__
#define __T_desc__                /* to prevent double include in generated files */

typedef struct
{
  ULONG           next;           /* next generic data descriptor   */
  USHORT          len;            /* length of content in octets    */
  UBYTE           buffer[1];      /* buffer content                 */
} T_desc;
#endif /* __T_desc__ */

#if !defined (T_FRAME_DESC_DEFINED)

#define T_FRAME_DESC_DEFINED

typedef struct
{
  UBYTE  *Adr[2];
  USHORT  Len[2];
} T_FRAME_DESC;

#endif /* T_FRAME_DESC_DEFINED */

#ifdef OPTION_MULTI_INSTANCES

typedef struct
{
  USHORT  inst_no;
  USHORT  chan_no;
  UBYTE   ts_no;
} T_ROUTE;

#endif

#if !defined (T_PRIM_HEADER_DEFINED)

#define T_PRIM_HEADER_DEFINED

/* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
   In the current implementation it is essential that the
   T_PRIM_HEADER type has the same size as the T_DP_HEADER
   type and that the element use_cnt is at the same position
   in both header types!
   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
typedef struct
{
  ULONG opc;         /* equal to int SignalCode            */
  ULONG len;         /* primitive length                   */
  ULONG use_cnt;    /* counter indicates cuurent number of users */
  T_sdu *sdu;        /* pointer to sdu struct if available */
  ULONG sh_offset;   /* offset of system header            */
  ULONG dph_offset;  /* offset of dynamic prim header      */
} T_PRIM_HEADER;

#endif /* T_PRIM_HEADER_DEFINED */

typedef struct _T_DP_HEADER
{
  ULONG magic_nr;    /* magic number is checked at each access */
  ULONG size;        /* available bytes in dynamic primitive partition */
  ULONG use_cnt;    /* counter indicates cuurent number of users */
  ULONG offset;      /* offset from partition begin to next free byte */
  ULONG est_size;    
  struct _T_DP_HEADER *next;
} T_DP_HEADER;

typedef struct
{
  int ref_cnt;      /* ref_cnt for MALLOC partitions */
} T_M_HEADER;

/*
 * flags in the opc
 */
#define TRACE_OPC             0x00000000
#define EXTENDED_OPC          0x80000000

#define SAP32_MASK      0x00007fff   /* UL/DL Bit Part of SAP Nr.*/
#define SAP16_MASK      0x7f00
#define PRIM32_MASK     0x00ff0000
#define PRIM16_MASK     0x00ff
#define OPC32BIT(opc)   (opc&EXTENDED_OPC)
/* 
 * for 16bit opcs SAP_NR() returns the same result as (opc & SAP_MASK) in the old style. 
 * No shift right is done, e.g. 0x4d00 is returned instead of 0x4d.
 * Also the UL/DL bit is part of the SAP to be downwards compatible with the
 * existing code in the xxx_pei.c modules.
 */
#define SAP_NR(opc)     (USHORT)((opc&0x80000000)?(opc&SAP32_MASK):(opc&SAP16_MASK))
#define PRIM_NR(opc)    (USHORT)((opc&0x80000000)?((opc&PRIM32_MASK)>>16):(opc&PRIM16_MASK))

#define PROCESS_NAMELEN         8

#define HANDLE_BIT           ((UBYTE)0x80)
#define HANDLE_MASK          ((UBYTE)0x7F)

typedef struct
{
  ULONG magic_nr;
  ULONG time;
  char  snd     [PROCESS_NAMELEN];
  char  rcv     [PROCESS_NAMELEN];
  char  org_rcv [PROCESS_NAMELEN];
} T_S_HEADER;

typedef struct
{
  T_PRIM_HEADER p_hdr;
  T_PRIM_HEADER *prim_ptr;
} T_PRIM_X;

#endif /* HEADER_H */

⌨️ 快捷键说明

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