layer1-api/include/gsml1types.h

218 lines
7.9 KiB
C

#ifndef GSML1TYPES_H__
#define GSML1TYPES_H__
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
/****************************************************************************
* Includes *
****************************************************************************/
#ifndef WIN32
#include <stdint.h>
#endif
#include "gsml1const.h"
/****************************************************************************
* Types *
****************************************************************************/
/****************************************************************************
* typedef : HANDLE
************************************************************************//**
*
* Generic type used to identify an entity.
*
* @ingroup gsml1_api_types
*
***************************************************************************/
typedef uint32_t HANDLE;
/****************************************************************************
* typedef : GsmL1_RxBurst
************************************************************************//**
*
* Individual physical channel message received from the demodulator.
*
* @ingroup gsml1_api_types
*
***************************************************************************/
typedef struct GsmL1_RxBurst_t
{
uint32_t u32Sync; ///< Synchronization word (Word 1)
uint32_t u22Fn : 24; ///< Frame number (Word 2 [0-23])
uint32_t u8Tn : 8; ///< Time slot number (Word 2 [24-32])
uint32_t u16DeviceId :16; ///< Device Id ( Word 3 [0-15] )
uint32_t u8AgcScaleFactor : 8; ///< Agc Gain applied to the burst sample is 2^(AGC_SCALE_FACTOR) ( Word 3 [16 - 23] )
uint32_t u8RfAtten : 8; ///< RF attenuator ( Word 3 [24 - 31] )
uint32_t u8BurstType : 8; ///< Burst type ( Word 4 [0-7] )
uint32_t u8RfSync : 8; ///< RF synchronization flag ( Word 4 [8 - 15] )
int32_t i16Offset : 16; ///< Burst offset ( Word 4 [16-31] )
float fRssi; ///< Received signal strength indicator in femtowatt( Word 5 )
union
{
float fLQ; ///< Link quality ( Word 6 [0 - 31] )
float fTsRssi; ///< Received training sequence signal strength indicator in femtowatt( Word 6 )
} u;
uint32_t u16XCorr : 16; ///< Correlation result ( Word 7 [0 - 15] )
uint32_t u16Arfcn : 16; ///< Arfcn (Set by the PhyRf layer ( Word 8 [0 - 15] )
GsmL1_Dir_t dir; ///< Direction ( Word 8 [0 - 31] )
//uint32_t u16Arfcn : 16; ///< Arfcn (Set by the PhyRf layer ( Word 8 [0 - 15] )
//uint32_t : 16; ///< Reserved bits ( Word 8, [16 - 31] )
int8_t pi8Burst[148]; ///< Burst data (148 bytes)
} GsmL1_RxBurst_t;
/****************************************************************************
* typedef : GsmL1_TxBurst
************************************************************************//**
*
* Individual physical channel message transmitted to the demodulator.
*
* @ingroup gsml1_api_types
*
* @note The [LB] tag means that this field is set in Dsp/Fpga loopback only
***************************************************************************/
typedef struct GsmL1_TxBurst_t
{
uint32_t u32Sync; ///< Synchronization word (Word 1 [0 - 31] )
uint32_t u22Fn : 24; ///< Frame number (Word 2 [0-23])
uint32_t u8Tn : 8; ///< Time slot number (Word 2 [24-32])
uint32_t u16DeviceId : 16; ///< Fpga device Id (Word 3 [0 - 15] )
uint32_t : 16; ///< Reserved bits ( Word 3 [16 - 31] )
uint32_t u8BurstType : 8; ///< Burst type ( Word 4 [0-7] )
uint32_t : 24; ///< Reserved bits ( Word 4 [8-31] )
uint32_t u32SubCh : 32; ///< Reserved bits ( Word 5 )
uint32_t : 32; ///< Reserved bits ( Word 6 )
uint32_t u16Arfcn : 16; ///< [LB] Absolute radio frequency channel number ( Word 8 [ 16-31 ] )
uint32_t : 16; ///< Reserved word ( Word 8 [ 0-15 ] )
GsmL1_Dir_t dir; ///< Direction ( Word 8 [0 - 31] )
int8_t pi8Burst[148]; ///< Burst data (148 bytes)
} GsmL1_TxBurst_t;
/****************************************************************************
* typedef : GsmL1_LogChParam_t
************************************************************************//**
*
* Logical channel configuration parameters
*
* @ingroup gsml1_api_prim_params
*
***************************************************************************/
typedef union
{
// RACH
struct
{
uint8_t u8Bsic; ///< Base Station Identity Code
} rach;
// AGCH
struct
{
uint8_t u8NbrOfAgch; /**< Number of AGCH blocks on a CCCH
@see BS_AG_BLKS_RES parameter in 3GPP TS 45_02 Section 7 Table 5 */
} agch;
// SACCH
struct
{
uint8_t u8MsPowerLevel; /**< Power level control
@see TS 3GPP 45.005 - 4.1.1 Mobile station output power */
} sacch;
// TCH
struct
{
GsmL1_AmrCmiPhase_t amrCmiPhase; ///< AMR Codec Mode Indication phase (downlink)
GsmL1_AmrCodecMode_t amrInitCodecMode; ///< AMR Initial Codec Mode
GsmL1_AmrCodec_t amrActiveCodecSet[4]; ///< AMR Active Codec Set
} tch;
// PRACH
struct
{
uint8_t u8Bsic; ///< Base Station Identity Code
} prach;
// PTCCH
struct
{
uint8_t u8Bsic; ///< Base Station Identity Code
} ptcch;
} GsmL1_LogChParam_t;
/****************************************************************************
* typedef : GsmL1_ConfigParam_t
************************************************************************//**
*
* Layer 1 configuration parameters
*
* @ingroup gsml1_api_prim_params
*
***************************************************************************/
typedef union
{
// Set the normal burst TSC of the specified RF device
struct
{
uint8_t u8NbTsc; ///< Normal burst training sequence code of the specified RF device
} setNbTsc;
// Set the TX power level of the specified RF device
struct
{
float fTxPowerLevel; ///< Transmitter power of the specified RF device
} setTxPowerLevel;
// Set the logical channel specific parameters
struct
{
GsmL1_Sapi_t sapi; ///< Service access point identifier
uint8_t u8Tn; ///< Time-slot [0..7]
GsmL1_SubCh_t subCh; ///< Sub-channel number (0x1F if not applicable)
GsmL1_Dir_t dir; ///< Direction path to configure
GsmL1_LogChParam_t logChParams; ///< Logical channel parameters
} setLogChParams;
///< Configure the ciphering parameters
struct
{
uint8_t u8Tn; ///< Time-slot [0..7]
GsmL1_SubCh_t subCh; ///< Sub-channel number (0x1F if not applicable)
GsmL1_Dir_t dir; ///< Direction path to configure
GsmL1_CipherId_t cipherId; ///< Ciphering algorithm
uint8_t u8Kc[8]; ///< 64-bit ciphering key
} setCipheringParams;
} GsmL1_ConfigParam_t;
#ifdef __cplusplus
}
#endif // extern "C"
#endif // GSML1TYPES_H__