39 #include <ti/drivers/rf/RF.h> 41 #include <ti/devices/DeviceFamily.h> 42 #include "rfc_cmd_tof.h" 49 #define TOF_TIMEOUTVAL 0xFFFFFFFF 51 #define TOF_MAX_NUM_FREQ 20 53 #define TOF_SEEDLEN 32 55 #define TOF_COMPENSATION_NO_COMP 0 56 #define TOF_COMPENSATION_STIM_COMP 1 57 #define TOF_COMPENSATION_CORRELATOR_COMP 2 60 #define IRQN_PARTIAL_READ_READY 15 61 #define IRQN_DOUBLE_SYNCWORD_BUFFER_SWITCH 11 62 #define RF_EventPartialReadReady (1 << IRQN_PARTIAL_READ_READY) 63 #define RF_EventDoubleSyncWordBufferSwitch (1 << IRQN_DOUBLE_SYNCWORD_BUFFER_SWITCH) 65 #define TOF_FILL_BOTH_BUFF TOF_SEC_FILL_BOTH_BUFFS 66 #define TOF_FILL_1ST_BUFF TOF_SEC_FILL_1ST_BUFF 67 #define TOF_FILL_2ND_BUFF TOF_SEC_FILL_2ND_BUFF 70 #define syncWordBufferOneReady 0x01 71 #define syncWordBufferTwoReady 0x02 73 #define TICK_TO_METER (6.25 * 3) 75 #define TOF_PATCH_LOCATION 0x21000914 82 #define CMD_ENABLE_DBG_CMDID 0x602 83 #define CMD_ENABLE_DBG_CONFIG ((0<<14) | (1<<12) | (1<<11) | (2<<9) | (1<<8) | (1<<6)) 117 TOF_SYNC_WAIT_FOR_SYNC = 0,
118 TOF_SYNC_SYNCHRONIZED,
119 TOF_SYNC_OUT_OF_SYNC,
125 TOF_HANDSHAKE_STARTED = 0,
126 TOF_HANDSHAKE_IN_PROGRESS,
127 TOF_HANDSHAKE_RECOVERING,
128 TOF_HANDSHAKE_COMPLETE,
152 uint16_t *pFrequencies;
153 uint8_t freqChangePeriod;
157 ToF_Sample *pT1RSSIBuf;
158 uint16_t numSyncwordsPerBurst;
159 uint8_t slaveLqiFilter;
160 uint8_t postProcessLqiThresh;
161 uint16_t postProcessMagnRatio;
162 } ToF_Object, ToF_Struct, *ToF_Handle;
214 #ifdef RTLS_TOF_DEBUG 218 uint32_t numRecoveries;
219 uint32_t numSkippedRuns;
220 uint32_t numGoodTofRuns;
221 uint32_t numBadTofRuns;
223 uint32_t totalNumNOk;
224 uint32_t failedHandshakes;
225 } ToF_InternalStatistics;
TofSyncState_e currentSyncState
Current state of ToF Sync.
Definition: TOF.h:210
TOF Burst Stats Structure.
Definition: TOF.h:195
uint8_t TOF_getSeed(uint8_t *dst)
copy 32 byte seed into dst
RF_EventMask rfEvent
RF Event.
Definition: TOF.h:198
uint8_t * pTxBuf
Pointer to Tx buffer.
Definition: TOF.h:171
ToF_Status TOF_run(ToF_Handle handle, uint32_t nextTaskTime)
Start a ToF run.
int TOF_setSeed(uint8_t *newSeed)
call ToF Security module to restart the ctr drbg new 128-bit random seed
TofHandshakeState_e handshakeState
Holds the state of the Master<->Slave handshake (i.e if Master->Slave Slave->Master Master->Slave exc...
Definition: TOF.h:209
ToF_Handle TOF_open(ToF_Struct *tofStruct, ToF_Params *params)
Initiate RF ToF params and open RF driver.
uint16_t freq
Frequency.
Definition: TOF.h:188
uint8_t mask
Mask for the LFSR.
Definition: TOF.h:176
TOF Parameters Structure.
Definition: TOF.h:166
uint16_t syncTimeout
How long to wait for first sync word.
Definition: TOF.h:178
void TOF_getBurstStat(ToF_Handle handle, ToF_BurstStat **resultBuffer)
Get the result for the last ToF burst (run)
ToF_Role tofRole
Slave or master.
Definition: TOF.h:168
#define TOF_MAX_NUM_FREQ
Maximun number of frequencies.
Definition: TOF.h:51
void TOF_clearBuffers(ToF_Handle handle)
Clean buffers for the specified ToF Handle.
TOF Burst Stats Structure.
Definition: TOF.h:186
uint8_t * ToF_RX_Buf
Pointer to RX buffer.
Definition: TOF.h:139
uint32_t numOk
Number of good samples.
Definition: TOF.h:191
void TOF_roleSwitch(ToF_Role newRole)
Switch ToF role.
ToF_Sample * pT1RSSIBuf
Pointer to T1|RSSI result buffer.
Definition: TOF.h:169
uint16_t numSyncwordsPerBurst
Number of bursts to be made (same as sync word length if using single buffer)
Definition: TOF.h:170
void TOF_close(ToF_Handle handle)
Close the ToF and RF drivers.
uint8_t freqChangePeriod
How often should we change freq?
Definition: TOF.h:177
uint8_t slaveLqiFilter
Automatic filtering for ToF Slave role.
Definition: TOF.h:180
ToF_Role
Enumeration for TOF roles of operation.
Definition: TOF.h:100
double tick
Clock's time between ticks.
Definition: TOF.h:189
broadCast_t tofBroadcast
RF data.
Definition: TOF.h:211
tofSecCfgPrms_t tofSecurityParams
TOF Security Configuration Paramaters.
Definition: TOF.h:175
TofHandshakeState_e
TOF Handshake State.
Definition: TOF.h:123
uint8_t postProcessLqiThresh
LQI threshold used for onchip post processing.
Definition: TOF.h:181
uint8_t * ToF_TX_Buf
Pointer to TX buffer.
Definition: TOF.h:138
uint16_t internalCtr
Internal counter that counts how many ToF bursts (runs) we processed so far.
Definition: TOF.h:205
TOF Sync Structure.
Definition: TOF.h:203
ToF security module interface.
ToF Security Configuration Parameters.
Definition: tof_security.h:84
uint8_t lastBuffFilled
Holds the last buffer that was filled (in case ToF Security is using double buffer mode) ...
Definition: TOF.h:208
double tickVariance
Variance of tick value.
Definition: TOF.h:190
TOF_ApplicationCB pfnTofApplicationCB
Callback to application.
Definition: TOF.h:179
rfc_CMD_TOF_sample_extended_t ToF_Sample
TOF Sample.
Definition: TOF.h:133
uint16_t numBuffSwitchRemaining
Counts for the current ToF run, how many buffer switches are remaining until the run ends...
Definition: TOF.h:207
uint8_t numFreq
Number of frequencies in above list.
Definition: TOF.h:174
uint16_t * pFrequencies
Pointer to Frequencies.
Definition: TOF.h:173
uint32_t freq
Frequency.
Definition: TOF.h:197
uint16_t postProcessMagnRatio
Magnitude radio threshold used for onchip post processing.
Definition: TOF.h:182
uint8_t * pRxBuf
Pointer to Rx buffer.
Definition: TOF.h:172
uint16_t lastSharedCtr
Last instance of shared counter as captured by the RTLS Passive.
Definition: TOF.h:206
rfc_CMD_TOF_synthCal_t ToF_SynthCal
Pointer to frequency calibration struct, used for the pre-calibration of the synth.
Definition: TOF.h:136
uint32_t ratSyncTime
RAT Sync Time.
Definition: TOF.h:199
void(* TOF_ApplicationCB)(void)
Callback to a handler supplied by the application.
Definition: TOF.h:142
TofSyncState_e
TOF Sync State.
Definition: TOF.h:115
TofStatus_e
TOF Errors.
Definition: TOF.h:108