diff --git a/include/superfemto.h b/include/superfemto.h index 55a2c6b..cd74a6e 100644 --- a/include/superfemto.h +++ b/include/superfemto.h @@ -13,7 +13,7 @@ #include "gsml1const.h" #define SUPERFEMTO_API(x,y,z) ((x << 16) | (y << 8) | z) -#define SUPERFEMTO_API_VERSION SUPERFEMTO_API(2,0,0) +#define SUPERFEMTO_API_VERSION SUPERFEMTO_API(2,1,0) /**************************************************************************** * Const * @@ -42,23 +42,54 @@ typedef GsmL1_Status_t SuperFemto_Status_t; ****************************************************************************/ typedef enum SuperFemto_PrimId_t { - SuperFemto_PrimId_SystemInfoReq, ///< Request system information - SuperFemto_PrimId_SystemInfoCnf, ///< Confirm system information - SuperFemto_PrimId_SystemFailureInd, ///< System failure indication - SuperFemto_PrimId_ActivateRfReq, ///< Request activation of the RF section - SuperFemto_PrimId_ActivateRfCnf, ///< Confirm activation of the RF section - SuperFemto_PrimId_DeactivateRfReq, ///< Request deactivation of the RF section - SuperFemto_PrimId_DeactivateRfCnf, ///< Confirm deactivation of the RF section - SuperFemto_PrimId_SetTraceFlagsReq, ///< Set the verbosity of the system - SuperFemto_PrimId_RfClockInfoReq, ///< Request information about the RF clock sub-system - SuperFemto_PrimId_RfClockInfoCnf, ///< Returns the RF clock sub-system information - SuperFemto_PrimId_RfClockSetupReq, ///< Configure the RF clock sub-system - SuperFemto_PrimId_RfClockSetupCnf, ///< Confirm the configuration of the RF clock sub-system - SuperFemto_PrimId_Layer1ResetReq, ///< Trigger a reset of the GSM layer 1 library - SuperFemto_PrimId_Layer1ResetCnf, ///< Confirm that the GSM layer 1 library was reset + SuperFemto_PrimId_SystemInfoReq, ///< REQ: System information + SuperFemto_PrimId_SystemInfoCnf, ///< CNF: System information + SuperFemto_PrimId_SystemFailureInd, ///< IND: System failure indication + SuperFemto_PrimId_ActivateRfReq, ///< REQ: Activation of the RF section + SuperFemto_PrimId_ActivateRfCnf, ///< CNF: Activation of the RF section + SuperFemto_PrimId_DeactivateRfReq, ///< REQ: Deactivation of the RF section + SuperFemto_PrimId_DeactivateRfCnf, ///< CNF: Deactivation of the RF section + SuperFemto_PrimId_SetTraceFlagsReq, ///< REQ: Set the verbosity of the system + SuperFemto_PrimId_RfClockInfoReq, ///< REQ: Information about the RF clock sub-system + SuperFemto_PrimId_RfClockInfoCnf, ///< CNF: Returns the RF clock sub-system information + SuperFemto_PrimId_RfClockSetupReq, ///< REQ: Configure the RF clock sub-system + SuperFemto_PrimId_RfClockSetupCnf, ///< CNF: Confirm the configuration of the RF clock sub-system + SuperFemto_PrimId_Layer1ResetReq, ///< REQ: Trigger a reset of the GSM layer 1 library + SuperFemto_PrimId_Layer1ResetCnf, ///< CNF: Confirm that the GSM layer 1 library was reset + SuperFemto_PrimId_GetTxCalibTblReq, ///< REQ: Get the TX gain calibration table + SuperFemto_PrimId_GetTxCalibTblCnf, ///< CNF: Returns TX gain calibration table + SuperFemto_PrimId_SetTxCalibTblReq, ///< REQ: Set the TX gain calibration table + SuperFemto_PrimId_SetTxCalibTblCnf, ///< CNF: Confirm the use of the new TX gain calibration table + SuperFemto_PrimId_GetRxCalibTblReq, ///< REQ: Get the RX level calibration table + SuperFemto_PrimId_GetRxCalibTblCnf, ///< CNF: Returns RX level calibration table + SuperFemto_PrimId_SetRxCalibTblReq, ///< REQ: Set the RX level calibration table + SuperFemto_PrimId_SetRxCalibTblCnf, ///< CNF: Confirm the use of the new RX level calibration table SuperFemto_PrimId_NUM } SuperFemto_PrimId_t; +/**************************************************************************** + * Enum : SuperFemto_ClkSrcId_t + ************************************************************************//** + * + * Clock source intifiers. + * + * @ingroup superfemto_api + * + ****************************************************************************/ +typedef enum SuperFemto_ClkSrcId_t +{ + // RF Diagnostic Primitives + SuperFemto_ClkSrcId_None = 0, ///< None + SuperFemto_ClkSrcId_Ocxo, ///< Optional on-board OCXO + SuperFemto_ClkSrcId_Tcxo, ///< Optional on-board TCXO + SuperFemto_ClkSrcId_External, ///< Multi-Trx external clock + SuperFemto_ClkSrcId_GpsPps, ///< GPS PPS + SuperFemto_ClkSrcId_Trx, ///< TRX clock + SuperFemto_ClkSrcId_Rx, ///< RX clock + SuperFemto_ClkSrcId_Edge, ///< Debug edge connector clock + SuperFemto_ClkSrcId_NetList ///< Network listening + +} SuperFemto_ClkSrcId_t; /**************************************************************************** * Types * @@ -141,14 +172,14 @@ typedef struct SuperFemto_ActivateRfReq struct { int iClkCor; ///< Clock correction value in PPB. - uint8_t u8ClkSrc; ///< Clock source (0:None, 1:OCXO, 2:TCXO, 3:External, 4:GPS PPS, 5:reserved, 6:RX) + SuperFemto_ClkSrcId_t clkSrc; ///< Clock source (0:None, 1:OCXO, 2:TCXO, 3:External, 4:GPS PPS, 5:reserved, 6:RX, 7:Edge) } rfTrx; // RX RF clock options struct { int iClkCor; ///< Clock calibration value in PPB. - uint8_t u8ClkSrc; ///< Clock source (0:None, 1:OCXO, 2:TCXO, 3:External, 4:GPS PPS, 5:TRX, 6:reserved) + SuperFemto_ClkSrcId_t clkSrc; ///< Clock source (0:None, 1:OCXO, 2:TCXO, 3:External, 4:GPS PPS, 5:TRX, 6:reserved, 7:Edge) } rfRx; } SuperFemto_ActivateRfReq_t; @@ -227,19 +258,19 @@ typedef struct SuperFemto_RfClockSetupReq struct { int iClkCor; ///< Clock correction value in PPB. - uint8_t u8ClkSrc; ///< Clock source (0:None, 1:OCXO, 2:TCXO, 3:External, 4:GPS PPS, 5:reserved, 6:RX) + SuperFemto_ClkSrcId_t clkSrc; ///< Clock source (0:None, 1:OCXO, 2:TCXO, 3:External, 4:GPS PPS, 5:reserved, 6:RX, 7:Edge) } rfTrx; // RX RF clock options struct { int iClkCor; ///< Clock calibration value in PPB. - uint8_t u8ClkSrc; ///< Clock source (0:None, 1:OCXO, 2:TCXO, 3:External, 4:GPS PPS, 5:TRX, 6:reserved) + SuperFemto_ClkSrcId_t clkSrc; ///< Clock source (0:None, 1:OCXO, 2:TCXO, 3:External, 4:GPS PPS, 5:TRX, 6:reserved, 7:Edge) } rfRx; // RF clock calibration struct { - uint8_t u8ClkSrc; ///< Reference clock source (0:Off, 1:OCXO, 2:TCXO, 3:External, 4:GPS PPS, 5:reserved, 6:reserved, 7:NL) + SuperFemto_ClkSrcId_t clkSrc; ///< Reference clock source (0:Off, 1:OCXO, 2:TCXO, 3:External, 4:GPS PPS, 5:reserved, 6:reserved, 7:Edge, 8:NL) } rfTrxClkCal; } SuperFemto_RfClockSetupReq_t; @@ -275,19 +306,19 @@ typedef struct SuperFemto_RfClockInfoCnf struct { int iClkCor; ///< Clock correction value in PPB. - uint8_t u8ClkSrc; ///< Clock source (0:None, 1:OCXO, 2:TCXO, 3:External, 4:GPS PPS, 5:reserved, 6:RX) + SuperFemto_ClkSrcId_t clkSrc; ///< Clock source (0:None, 1:OCXO, 2:TCXO, 3:External, 4:GPS PPS, 5:reserved, 6:RX, 7:Edge) } rfTrx; // RX RF clock options struct { int iClkCor; ///< Clock calibration value in PPB. - uint8_t u8ClkSrc; ///< Clock source (0:None, 1:OCXO, 2:TCXO, 3:External, 4:GPS PPS, 5:TRX, 6:reserved) + SuperFemto_ClkSrcId_t clkSrc; ///< Clock source (0:None, 1:OCXO, 2:TCXO, 3:External, 4:GPS PPS, 5:TRX, 6:reserved, 7:Edge) } rfRx; // RF clock calibration struct { - uint8_t u8ClkSrc; ///< Reference clock source (0:Off, 1:OCXO, 2:TCXO, 3:External, 4:GPS PPS, 5:reserved, 6:reserved, 7:NL) + SuperFemto_ClkSrcId_t clkSrc; ///< Reference clock source (0:Off, 1:OCXO, 2:TCXO, 3:External, 4:GPS PPS, 5:reserved, 6:reserved, 7:Edge, 8:NL) int iClkErr; ///< RF clock error (PPB). int iClkErrRes; ///< Clock error resolution (PPT). @@ -303,7 +334,7 @@ typedef struct SuperFemto_RfClockInfoCnf * * @ingroup superfemto_api_prim_sys * -****************************************************************************/ + ****************************************************************************/ typedef struct SuperFemto_Layer1ResetReq { uint32_t u32Reserved; @@ -318,13 +349,169 @@ typedef struct SuperFemto_Layer1ResetReq * * @ingroup superfemto_api_prim_sys * -****************************************************************************/ + ****************************************************************************/ typedef struct SuperFemto_Layer1ResetCnf { GsmL1_Status_t status; } SuperFemto_Layer1ResetCnf_t; +/**************************************************************************** + * Struct : SuperFemto_GetTxCalibTblReq_t + ************************************************************************//** + * + * Structure is used to get the TX gain calibration table. + * + * @ingroup superfemto_api_prim_sys + * + ****************************************************************************/ +typedef struct SuperFemto_GetTxCalibTblReq +{ + GsmL1_FreqBand_t freqBand; ///< GSM Frequency band + +} SuperFemto_GetTxCalibTblReq_t; + +/**************************************************************************** + * Struct : SuperFemto_GetTxCalibTblCnf_t + ************************************************************************//** + * + * Structure is used to returns the TX gain calibration table. + * + * TX_Gain = m[band] x (fTxPowerLevel + fGainCorrVsArfcn[band][arfcn]) + b[band] + * + * @ingroup superfemto_api_prim_sys + * + ****************************************************************************/ +typedef struct SuperFemto_GetTxCalibTblCnf +{ + GsmL1_Status_t status; + GsmL1_FreqBand_t freqBand; ///< GSM Frequency band + + float fGain[80]; ///< Gain setting for output level from +50dBm to -29 dBm + float fGainCorrVsArfcn[374]; /**< Gain correction (in dBm) for each ARFCN + for GSM-850 : 0=128, 1:129, ..., 123:251, [124-373]:unused + for GSM-900 : 0=955, 1:956, ..., 70:1, ..., 317:956, [318-373]:unused + for DCS-1800: 0=512, 1:513, ..., 373:885 + for PCS-1900: 0=512, 1:513, ..., 298:810, [299-373]:unused */ +} SuperFemto_GetTxCalibTblCnf_t; + +/**************************************************************************** + * Struct : SuperFemto_SetTxCalibTblReq_t + ************************************************************************//** + * + * Structure is used to set the TX gain calibration table. + * + * TX_Gain = m[band] x (fTxPowerLevel + fGainCorrVsArfcn[band][arfcn]) + b[band] + * + * @ingroup superfemto_api_prim_sys + * + ****************************************************************************/ +typedef struct SuperFemto_SetTxCalibTblReq +{ + GsmL1_FreqBand_t freqBand; ///< GSM Frequency band + + float fGain[80]; ///< Gain setting for output level from +50dBm to -29 dBm + float fGainCorrVsArfcn[374]; /***< Gain correction (in dBm) for each ARFCN + for GSM-850 : 0=128, 1:129, ..., 123:251, [124-373]:unused + for GSM-900 : 0=955, 1:956, ..., 70:1, ..., 317:956, [318-373]:unused + for DCS-1800: 0=512, 1:513, ..., 373:885 + for PCS-1900: 0=512, 1:513, ..., 298:810, [299-373]:unused */ +} SuperFemto_SetTxCalibTblReq_t; + +/**************************************************************************** + * Struct : SuperFemto_SetTxCalibTblCnf_t + ************************************************************************//** + * + * Structure is used to confirm the use of the new TX gain calibration table. + * + * @ingroup superfemto_api_prim_sys + * + ****************************************************************************/ +typedef struct SuperFemto_SetTxCalibTblCnf +{ + GsmL1_Status_t status; + GsmL1_FreqBand_t freqBand; ///< GSM Frequency band +} SuperFemto_SetTxCalibTblCnf_t; + +/**************************************************************************** + * Struct : SuperFemto_GetRxCalibTblReq_t + ************************************************************************//** + * + * Structure is used to get the RX level calibration table. + * + * @ingroup superfemto_api_prim_sys + * + ****************************************************************************/ +typedef struct SuperFemto_GetRxCalibTblReq +{ + GsmL1_FreqBand_t freqBand; ///< GSM Frequency band + uint8_t bUplink; ///< Direction (0:Downlink, 1:Uplink) + +} SuperFemto_GetRxCalibTblReq_t; + +/**************************************************************************** + * Struct : SuperFemto_GetRxCalibTblCnf_t + ************************************************************************//** + * + * Structure is used to returns the RX level calibration table. + * + * RSSI = RxLevel + fRssiCorrVsArfcn[band][arfcn] + * + * @ingroup superfemto_api_prim_sys + * + ****************************************************************************/ +typedef struct SuperFemto_GetRxCalibTblCnf +{ + GsmL1_Status_t status; + GsmL1_FreqBand_t freqBand; ///< GSM Frequency band + uint8_t bUplink; ///< Direction (0:Downlink, 1:Uplink) + + float fRssiCorrVsArfcn[374]; /***< RSSI correction (in dBm) for each ARFCN + for GSM-850 : 0=128, 1:129, ..., 123:251, [124-373]:unused + for GSM-900 : 0=955, 1:956, ..., 70:1, ..., 317:956, [318-373]:unused + for DCS-1800: 0=512, 1:513, ..., 373:885 + for PCS-1900: 0=512, 1:513, ..., 298:810, [299-373]:unused */ +} SuperFemto_GetRxCalibTblCnf_t; + +/**************************************************************************** + * Struct : SuperFemto_SetRxCalibTblReq_t + ************************************************************************//** + * + * Structure is used to set the RX level calibration table. + * + * RSSI = RxLevel + fRssiCorrVsArfcn[band][arfcn] + * + * @ingroup superfemto_api_prim_sys + * + ****************************************************************************/ +typedef struct SuperFemto_SetRxCalibTblReq +{ + GsmL1_FreqBand_t freqBand; ///< GSM Frequency band + uint8_t bUplink; ///< Direction (0:Downlink, 1:Uplink) + + float fRssiCorrVsArfcn[374]; /***< RSSI correction (in dBm) for each ARFCN + for GSM-850 : 0=128, 1:129, ..., 123:251, [124-373]:unused + for GSM-900 : 0=955, 1:956, ..., 70:1, ..., 317:956, [318-373]:unused + for DCS-1800: 0=512, 1:513, ..., 373:885 + for PCS-1900: 0=512, 1:513, ..., 298:810, [299-373]:unused */ +} SuperFemto_SetRxCalibTblReq_t; + +/**************************************************************************** + * Struct : SuperFemto_SetRxCalibTblCnf_t + ************************************************************************//** + * + * Structure is used to confirm the use of the new RX level calibration table. + * + * @ingroup superfemto_api_prim_sys + * + ****************************************************************************/ +typedef struct SuperFemto_SetRxCalibTblCnf +{ + GsmL1_Status_t status; + GsmL1_FreqBand_t freqBand; ///< GSM Frequency band + uint8_t bUplink; ///< Direction (0:Downlink, 1:Uplink) +} SuperFemto_SetRxCalibTblCnf_t; + /**************************************************************************** * Struct : SuperFemto_Primt_t ************************************************************************//** @@ -333,30 +520,38 @@ typedef struct SuperFemto_Layer1ResetCnf * * @ingroup superfemto_api_prim_sys * -****************************************************************************/ + ****************************************************************************/ typedef struct SuperFemto_Prim { - SuperFemto_PrimId_t id; ///< Primitive ID + SuperFemto_PrimId_t id; ///< Primitive ID union { - SuperFemto_SystemInfoCnf_t systemInfoCnf; ///< Confirm system information - SuperFemto_SysemFailureInd_t sysemFailureInd; ///< System failure indication - SuperFemto_ActivateRfReq_t activateRfReq; ///< Request activation of the RF section - SuperFemto_ActivateRfCnf_t activateRfCnf; ///< Confirm activation of the RF section - SuperFemto_DeactivateRfCnf_t deactivateRfCnf; ///< Confirm deactivation of the RF section - SuperFemto_SetTraceFlagsReq_t setTraceFlagsReq; ///< Set the verbosity of the system - SuperFemto_RfClockInfoReq_t rfClockInfoReq; ///< Request information about the RF clock - SuperFemto_RfClockInfoCnf_t rfClockInfoCnf; ///< Returns information about the RF clock - SuperFemto_RfClockSetupReq_t rfClockSetupReq; ///< Setup the RF clock - SuperFemto_RfClockSetupCnf_t rfClockSetupCnf; ///< Confirm the setup of the RF clock - SuperFemto_Layer1ResetReq_t layer1ResetReq; ///< Request a reset of the layer 1 module - SuperFemto_Layer1ResetCnf_t layer1ResetCnf; ///< Conrifm that the layer 1 module was reset + SuperFemto_SystemInfoCnf_t systemInfoCnf; ///< CNF: System information + SuperFemto_SysemFailureInd_t sysemFailureInd; ///< IND: System failure indication + SuperFemto_ActivateRfReq_t activateRfReq; ///< REQ: Activation of the RF section + SuperFemto_ActivateRfCnf_t activateRfCnf; ///< CNF: Activation of the RF section + SuperFemto_DeactivateRfCnf_t deactivateRfCnf; ///< CNF: Deactivation of the RF section + SuperFemto_SetTraceFlagsReq_t setTraceFlagsReq; ///< REQ: Set the verbosity of the system + SuperFemto_RfClockInfoReq_t rfClockInfoReq; ///< REQ: Information about the RF clock sub-system + SuperFemto_RfClockInfoCnf_t rfClockInfoCnf; ///< CNF: Returns the RF clock sub-system information + SuperFemto_RfClockSetupReq_t rfClockSetupReq; ///< REQ: Configure the RF clock sub-system + SuperFemto_RfClockSetupCnf_t rfClockSetupCnf; ///< CNF: Confirm the configuration of the RF clock sub-system + SuperFemto_Layer1ResetReq_t layer1ResetReq; ///< REQ: Trigger a reset of the GSM layer 1 module + SuperFemto_Layer1ResetCnf_t layer1ResetCnf; ///< CNF: Confirm that the GSM layer 1 module was reset + SuperFemto_GetTxCalibTblReq_t getTxCalibTblReq; ///< REQ: Get the TX gain calibration table + SuperFemto_GetTxCalibTblCnf_t getTxCalibTblCnf; ///< CNF: Returns TX gain calibration table + SuperFemto_SetTxCalibTblReq_t setTxCalibTblReq; ///< REQ: Set the TX gain calibration table + SuperFemto_SetTxCalibTblCnf_t setTxCalibTblCnf; ///< CNF: Confirm the use of the new TX gain calibration table + SuperFemto_GetRxCalibTblReq_t getRxCalibTblReq; ///< REQ: Get the RX level calibration table + SuperFemto_GetRxCalibTblCnf_t getRxCalibTblCnf; ///< CNF: Returns RX level calibration table + SuperFemto_SetRxCalibTblReq_t setRxCalibTblReq; ///< REQ: Set the RX level calibration table + SuperFemto_SetRxCalibTblCnf_t setRxCalibTblCnf; ///< CNF: Confirm the use of the new RX level calibration table } u; } SuperFemto_Prim_t; - + #ifdef _TMS320C6400 /****************************************************************************