layer1-api/include/superfemto.h

353 lines
14 KiB
C

#ifndef FemtoBts_H__
#define FemtoBts_H__
#define FEMTOBTS_API(x,y,z) ((x << 16) | (y << 8) | z)
#define FEMTOBTS_API_VERSION FEMTOBTS_API(2,6,0)
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
/****************************************************************************
* Includes *
****************************************************************************/
#include <stdint.h>
#include "gsml1const.h"
/****************************************************************************
* Const *
****************************************************************************/
/****************************************************************************
* Enum: FemtoBts_Status_t
************************************************************************//**
*
* Status used by the FemtoBts.
*
* @ingroup femtobts_api
*
****************************************************************************/
typedef GsmL1_Status_t FemtoBts_Status_t;
/****************************************************************************
* Enum : FemtoBts_PrimId_t
************************************************************************//**
*
* System management primitives.
*
* @ingroup femtobts_api
*
****************************************************************************/
typedef enum FemtoBts_PrimId_t
{
FemtoBts_PrimId_SystemInfoReq, ///< Request system information
FemtoBts_PrimId_SystemInfoCnf, ///< Confirm system information
FemtoBts_PrimId_SystemFailureInd, ///< System failure indication
FemtoBts_PrimId_ActivateRfReq, ///< Request activation of the RF section
FemtoBts_PrimId_ActivateRfCnf, ///< Confirm activation of the RF section
FemtoBts_PrimId_DeactivateRfReq, ///< Request deactivation of the RF section
FemtoBts_PrimId_DeactivateRfCnf, ///< Confirm deactivation of the RF section
FemtoBts_PrimId_SetTraceFlagsReq, ///< Set the verbosity of the system
FemtoBts_PrimId_RfClockInfoReq, ///< Request information about the RF clock sub-system
FemtoBts_PrimId_RfClockInfoCnf, ///< Returns the RF clock sub-system information
FemtoBts_PrimId_RfClockSetupReq, ///< Configure the RF clock sub-system
FemtoBts_PrimId_RfClockSetupCnf, ///< Confirm the configuration of the RF clock sub-system
FemtoBts_PrimId_Layer1ResetReq, ///< Trigger a reset of the GSM layer 1 library
FemtoBts_PrimId_Layer1ResetCnf, ///< Confirm that the GSM layer 1 library was reset
FemtoBts_PrimId_NUM
} FemtoBts_PrimId_t;
/****************************************************************************
* Types *
****************************************************************************/
/****************************************************************************
* Struct : FemtoBts_SystemInfoCnf_t
************************************************************************//**
*
* Structure is used to confirm the information about the system.
*
* @ingroup femtobts_api_prim_sys
*
****************************************************************************/
typedef struct FemtoBts_SystemInfoCnf
{
FemtoBts_Status_t status; ///< Status
struct
{
uint8_t major; ///< DSP firmware major version number
uint8_t minor; ///< DSP firmware minor version number
uint8_t build; ///< DSP firmware build version number
} dspVersion;
struct
{
uint8_t major; ///< FPGA firmware major version number
uint8_t minor; ///< FPGA firmware minor version number
uint8_t build; ///< FPGA firmware build version number
} fpgaVersion;
struct
{
uint8_t gsm850; ///< Support GSM-850 band (0:unsupported, 1:supported)
uint8_t gsm900; ///< Support GSM-900 band (0:unsupported, 1:supported)
uint8_t dcs1800; ///< Support GSM-1800 band (0:unsupported, 1:supported)
uint8_t pcs1900; ///< Support GSM-1900 band (0:unsupported, 1:supported)
} rfBand;
struct
{
uint8_t txvcxo; ///< TCVCXO presence flag
uint8_t ocvcxo; ///< OCVCXO presence flag
uint16_t u12ClkVc; ///< Current voltage control value
} rfClock;
} FemtoBts_SystemInfoCnf_t;
/****************************************************************************
* Struct : FemtoBts_SystemFailureInd_t
************************************************************************//**
*
* Structure is used to indicate a system failure.
*
* @ingroup femtobts_api_prim_sys
*
****************************************************************************/
typedef struct FemtoBts_SystemFailureInd
{
FemtoBts_Status_t status; ///< Status
} FemtoBts_SysemFailureInd_t;
/****************************************************************************
* Struct : FemtoBts_ActivateRfReq_t
************************************************************************//**
*
* This primitive is used to request the activation the RF section of the system.
*
* @ingroup femtobts_api
*
***************************************************************************/
typedef struct FemtoBts_ActivateRfReq
{
uint16_t u12ClkVc; /**< Initial clock voltage control value
or 0xFFFF to use the defaultvalue */
} FemtoBts_ActivateRfReq_t;
/****************************************************************************
* Struct : FemtoBts_ActivateRfCnf_t
************************************************************************//**
*
* This primitive is used to confirm the activation the RF section of the system.
*
* @ingroup femtobts_api
*
***************************************************************************/
typedef struct FemtoBts_ActivateRfCnf
{
FemtoBts_Status_t status; ///< Status
} FemtoBts_ActivateRfCnf_t;
/****************************************************************************
* Struct : FemtoBts_DeactivateRfCnf_t
************************************************************************//**
*
* This primitive is used to confirm the deactivation the RF section of the system.
*
* @ingroup femtobts_api
*
***************************************************************************/
typedef struct FemtoBts_DeactivateRfCnf
{
FemtoBts_Status_t status; ///< Status
} FemtoBts_DeactivateRfCnf_t;
/****************************************************************************
* Struct : FemtoBts_SetTraceFlagsReq_t
************************************************************************//**
*
* This primitive is used to setup the trace flag values.
*
* @ingroup femtobts_api_prim_dbg
*
***************************************************************************/
typedef struct FemtoBts_SetTraceFlagsReq
{
uint32_t u32Tf; ///< Trace flag level
} FemtoBts_SetTraceFlagsReq_t;
/****************************************************************************
* Struct : FemtoBts_RfClockInfoReq
************************************************************************//**
*
* This primitive is used to retrive information about the RF clock
*
* @ingroup femtobts_api_prim_dbg
*
***************************************************************************/
typedef struct FemtoBts_RfClockInfoReq
{
uint8_t u8RstClkErrCnt; ///< When set, it resets the clk error counter module
} FemtoBts_RfClockInfoReq_t;
/****************************************************************************
* Struct : FemtoBts_RfClockSetupReq
************************************************************************//**
*
* This primitive is used to configure the RF clock sub-system.
*
* @ingroup femtobts_api_prim_dbg
*
***************************************************************************/
typedef struct FemtoBts_RfClockSetupReq
{
uint16_t u12ClkVc; /**< Clock voltage control value (12 bits DAC). */
} FemtoBts_RfClockSetupReq_t;
/****************************************************************************
* Struct : FemtoBts_RfClockSetupCnf
************************************************************************//**
*
* This primitive is sent back to confirm the configuration of the RF clock sub-system.
*
* @ingroup femtobts_api_prim_dbg
*
***************************************************************************/
typedef struct FemtoBts_RfClockSetupCnf
{
FemtoBts_Status_t status; ///< Status of the RF-CLOCK-SETUP-REQ
} FemtoBts_RfClockSetupCnf_t;
/****************************************************************************
* Struct : FemtoBts_RfClockInfoCnf
************************************************************************//**
*
* This primitive is used to send back information on the RF clock sub-system.
*
* @ingroup femtobts_api_prim_dbg
*
***************************************************************************/
typedef struct FemtoBts_RfClockInfoCnf
{
uint8_t u8ClkErrValid; /**< Set when the parameter of this primitives are valid.
It won't be set if the system was unable to synchronize
to a surrounding basestation long enough */
float fClkErr; // Measured clock error (in ppm).
float fClkErrRes; /**< Indicates the resolution of the fErrPpm parameter (in ppm).
The resolution of the error depends on the period
(in frame) of the measurement. The longer the period,
the better is the resolution. */
} FemtoBts_RfClockInfoCnf_t;
/****************************************************************************
* Struct : FemtoBts_Layer1ResetReq_t
************************************************************************//**
*
* Structure is used to request a reset of the layer 1 module.
*
* @ingroup femtobts_api_prim_sys
*
****************************************************************************/
typedef struct FemtoBts_Layer1ResetReq
{
uint32_t u32Reserved;
} FemtoBts_Layer1ResetReq_t;
/****************************************************************************
* Struct : FemtoBts_Layer1ResetCnf_t
************************************************************************//**
*
* Structure is used to confirm the reset of the layer 1 module.
*
* @ingroup femtobts_api_prim_sys
*
****************************************************************************/
typedef struct FemtoBts_Layer1ResetCnf
{
GsmL1_Status_t status;
} FemtoBts_Layer1ResetCnf_t;
/****************************************************************************
* Struct : FemtoBts_Primt_t
************************************************************************//**
*
* System level primitive definition.
*
* @ingroup femtobts_api_prim_sys
*
****************************************************************************/
typedef struct FemtoBts_Prim
{
FemtoBts_PrimId_t id; ///< Primitive ID
union
{
FemtoBts_SystemInfoCnf_t systemInfoCnf; ///< Confirm system information
FemtoBts_SysemFailureInd_t sysemFailureInd; ///< System failure indication
FemtoBts_ActivateRfReq_t activateRfReq; ///< Request activation of the RF section
FemtoBts_ActivateRfCnf_t activateRfCnf; ///< Confirm activation of the RF section
FemtoBts_DeactivateRfCnf_t deactivateRfCnf; ///< Confirm deactivation of the RF section
FemtoBts_SetTraceFlagsReq_t setTraceFlagsReq; ///< Set the verbosity of the system
FemtoBts_RfClockInfoReq_t rfClockInfoReq; ///< Request information about the RF clock
FemtoBts_RfClockInfoCnf_t rfClockInfoCnf; ///< Returns information about the RF clock
FemtoBts_RfClockSetupReq_t rfClockSetupReq; ///< Setup the RF clock
FemtoBts_RfClockSetupCnf_t rfClockSetupCnf; ///< Confirm the setup of the RF clock
FemtoBts_Layer1ResetReq_t layer1ResetReq; ///< Request a reset of the layer 1 module
FemtoBts_Layer1ResetCnf_t layer1ResetCnf; ///< Conrifm that the layer 1 module was reset
} u;
} FemtoBts_Prim_t;
#ifdef _TMS320C6400
/****************************************************************************
* Public Functions *
****************************************************************************/
/****************************************************************************
* Function : FemtoBts_RxPrimCallback
************************************************************************//**
*
* FemtoBts primitive reception callback routine. Process primitives sent
* by the ARM processor.
*
* @param [in] pPrim
* Address of the buffer containing the received primitive.
*
* @return
* GsmL1_Status_Success or the error code
*
* @ingroup femtobts_api_prim_sys
*
****************************************************************************/
void FemtoBts_RxPrimCallback( FemtoBts_Prim_t *pPrim );
#endif // _TMS320C6400
#ifdef __cplusplus
}
#endif // extern "C"
#endif // FemtoBts_H__