CC13xx Driver Library
aux_tdc.h File Reference
#include <stdbool.h>
#include <stdint.h>
#include "../inc/hw_types.h"
#include "../inc/hw_memmap.h"
#include "../inc/hw_ints.h"
#include "../inc/hw_aux_tdc.h"
#include "debug.h"

Macros

#define AUX_TDC_BUSY   0x00000001
 
#define AUX_TDC_TIMEOUT   0x00000002
 
#define AUX_TDC_DONE   0x00000004
 
#define AUX_TDC_RUNSYNC   0x00000001
 
#define AUX_TDC_RUN   0x00000002
 
#define AUX_TDC_ABORT   0x00000003
 
#define AUXTDC_WAIT_START   (AUX_TDC_STAT_STATE_WAIT_START)
 
#define AUXTDC_WAIT_START_CNTEN   (AUX_TDC_STAT_STATE_WAIT_START_STOP_CNT_EN)
 
#define AUXTDC_IDLE   (AUX_TDC_STAT_STATE_IDLE)
 
#define AUXTDC_CLRCNT   (AUX_TDC_STAT_STATE_CLR_CNT)
 
#define AUXTDC_WAIT_STOP   (AUX_TDC_STAT_STATE_WAIT_STOP)
 
#define AUXTDC_WAIT_STOP_CNTDOWN   (AUX_TDC_STAT_STATE_WAIT_STOP_CNTDWN)
 
#define AUXTDC_GETRESULTS   (AUX_TDC_STAT_STATE_GET_RESULT)
 
#define AUXTDC_POR   (AUX_TDC_STAT_STATE_POR)
 
#define AUXTDC_WAIT_CLRCNT_DONE   (AUX_TDC_STAT_STATE_WAIT_CLR_CNT_DONE)
 
#define AUXTDC_START_FALL   (AUX_TDC_STAT_STATE_START_FALL)
 
#define AUXTDC_FORCE_STOP   (AUX_TDC_STAT_STATE_FORCE_STOP)
 
#define AUXTDC_STOPPOL_RIS   (AUX_TDC_TRIGSRC_STOP_POL_HIGH)
 
#define AUXTDC_STOPPOL_FALL   (AUX_TDC_TRIGSRC_STOP_POL_LOW)
 
#define AUXTDC_STOP_AUXIO0   (AUX_TDC_TRIGSRC_STOP_SRC_AUXIO0)
 
#define AUXTDC_STOP_AUXIO1   (AUX_TDC_TRIGSRC_STOP_SRC_AUXIO1)
 
#define AUXTDC_STOP_AUXIO2   (AUX_TDC_TRIGSRC_STOP_SRC_AUXIO2)
 
#define AUXTDC_STOP_AUXIO3   (AUX_TDC_TRIGSRC_STOP_SRC_AUXIO3)
 
#define AUXTDC_STOP_AUXIO4   (AUX_TDC_TRIGSRC_STOP_SRC_AUXIO4)
 
#define AUXTDC_STOP_AUXIO5   (AUX_TDC_TRIGSRC_STOP_SRC_AUXIO5)
 
#define AUXTDC_STOP_AUXIO6   (AUX_TDC_TRIGSRC_STOP_SRC_AUXIO6)
 
#define AUXTDC_STOP_AUXIO7   (AUX_TDC_TRIGSRC_STOP_SRC_AUXIO7)
 
#define AUXTDC_STOP_AUXIO8   (AUX_TDC_TRIGSRC_STOP_SRC_AUXIO8)
 
#define AUXTDC_STOP_AUXIO9   (AUX_TDC_TRIGSRC_STOP_SRC_AUXIO9)
 
#define AUXTDC_STOP_AUXIO10   (AUX_TDC_TRIGSRC_STOP_SRC_AUXIO10)
 
#define AUXTDC_STOP_AUXIO11   (AUX_TDC_TRIGSRC_STOP_SRC_AUXIO11)
 
#define AUXTDC_STOP_AUXIO12   (AUX_TDC_TRIGSRC_STOP_SRC_AUXIO12)
 
#define AUXTDC_STOP_AUXIO13   (AUX_TDC_TRIGSRC_STOP_SRC_AUXIO13)
 
#define AUXTDC_STOP_AUXIO14   (AUX_TDC_TRIGSRC_STOP_SRC_AUXIO14)
 
#define AUXTDC_STOP_AUXIO15   (AUX_TDC_TRIGSRC_STOP_SRC_AUXIO15)
 
#define AUXTDC_STOP_ADC_DONE   (AUX_TDC_TRIGSRC_STOP_SRC_ADC_DONE)
 
#define AUXTDC_STOP_ADC_FIFO_ALMOST_FULL   (AUX_TDC_TRIGSRC_STOP_SRC_ADC_FIFO_ALMOST_FULL)
 
#define AUXTDC_STOP_AON_PROG_WU   (AUX_TDC_TRIGSRC_STOP_SRC_AON_PROG_WU)
 
#define AUXTDC_STOP_AON_SW   (AUX_TDC_TRIGSRC_STOP_SRC_AON_SW)
 
#define AUXTDC_STOP_ISRC_RESET   (AUX_TDC_TRIGSRC_STOP_SRC_ISRC_RESET)
 
#define AUXTDC_STOP_OBSMUX0   (AUX_TDC_TRIGSRC_STOP_SRC_OBSMUX0)
 
#define AUXTDC_STOP_OBSMUX1   (AUX_TDC_TRIGSRC_STOP_SRC_OBSMUX1)
 
#define AUXTDC_STOP_SMPH_AUTOTAKE_DONE   (AUX_TDC_TRIGSRC_STOP_SRC_SMPH_AUTOTAKE_DONE)
 
#define AUXTDC_STOP_TDC_PRE   (AUX_TDC_TRIGSRC_STOP_SRC_TDC_PRE)
 
#define AUXTDC_STOP_TIMER0_EV   (AUX_TDC_TRIGSRC_STOP_SRC_TIMER0_EV)
 
#define AUXTDC_STOP_TIMER1_EV   (AUX_TDC_TRIGSRC_STOP_SRC_TIMER1_EV)
 
#define AUXTDC_STOP_AON_RTC_CH2   (AUX_TDC_TRIGSRC_STOP_SRC_AON_RTC_CH2)
 
#define AUXTDC_STOP_AUX_COMPA   (AUX_TDC_TRIGSRC_STOP_SRC_AUX_COMPA)
 
#define AUXTDC_STOP_AUX_COMPB   (AUX_TDC_TRIGSRC_STOP_SRC_AUX_COMPB)
 
#define AUXTDC_STOP_ACLK_REF   (AUX_TDC_TRIGSRC_STOP_SRC_ACLK_REF)
 
#define AUXTDC_STOP_MCU_EV   (AUX_TDC_TRIGSRC_STOP_SRC_MCU_EV)
 
#define AUXTDC_STARTPOL_RIS   (AUX_TDC_TRIGSRC_START_POL_HIGH)
 
#define AUXTDC_STARTPOL_FALL   (AUX_TDC_TRIGSRC_START_POL_LOW)
 
#define AUXTDC_START_AUXIO0   (AUX_TDC_TRIGSRC_START_SRC_AUXIO0)
 
#define AUXTDC_START_AUXIO1   (AUX_TDC_TRIGSRC_START_SRC_AUXIO1)
 
#define AUXTDC_START_AUXIO2   (AUX_TDC_TRIGSRC_START_SRC_AUXIO2)
 
#define AUXTDC_START_AUXIO3   (AUX_TDC_TRIGSRC_START_SRC_AUXIO3)
 
#define AUXTDC_START_AUXIO4   (AUX_TDC_TRIGSRC_START_SRC_AUXIO4)
 
#define AUXTDC_START_AUXIO5   (AUX_TDC_TRIGSRC_START_SRC_AUXIO5)
 
#define AUXTDC_START_AUXIO6   (AUX_TDC_TRIGSRC_START_SRC_AUXIO6)
 
#define AUXTDC_START_AUXIO7   (AUX_TDC_TRIGSRC_START_SRC_AUXIO7)
 
#define AUXTDC_START_AUXIO8   (AUX_TDC_TRIGSRC_START_SRC_AUXIO8)
 
#define AUXTDC_START_AUXIO9   (AUX_TDC_TRIGSRC_START_SRC_AUXIO9)
 
#define AUXTDC_START_AUXIO10   (AUX_TDC_TRIGSRC_START_SRC_AUXIO10)
 
#define AUXTDC_START_AUXIO11   (AUX_TDC_TRIGSRC_START_SRC_AUXIO11)
 
#define AUXTDC_START_AUXIO12   (AUX_TDC_TRIGSRC_START_SRC_AUXIO12)
 
#define AUXTDC_START_AUXIO13   (AUX_TDC_TRIGSRC_START_SRC_AUXIO13)
 
#define AUXTDC_START_AUXIO14   (AUX_TDC_TRIGSRC_START_SRC_AUXIO14)
 
#define AUXTDC_START_AUXIO15   (AUX_TDC_TRIGSRC_START_SRC_AUXIO15)
 
#define AUXTDC_START_ADC_DONE   (AUX_TDC_TRIGSRC_START_SRC_ADC_DONE)
 
#define AUXTDC_START_ADC_FIFO_ALMOST_FULL   (AUX_TDC_TRIGSRC_START_SRC_ADC_FIFO_ALMOST_FULL)
 
#define AUXTDC_START_AON_PROG_WU   (AUX_TDC_TRIGSRC_START_SRC_AON_PROG_WU)
 
#define AUXTDC_START_AON_SW   (AUX_TDC_TRIGSRC_START_SRC_AON_SW)
 
#define AUXTDC_START_ISRC_RESET   (AUX_TDC_TRIGSRC_START_SRC_ISRC_RESET)
 
#define AUXTDC_START_OBSMUX0   (AUX_TDC_TRIGSRC_START_SRC_OBSMUX0)
 
#define AUXTDC_START_OBSMUX1   (AUX_TDC_TRIGSRC_START_SRC_OBSMUX1)
 
#define AUXTDC_START_SMPH_AUTOTAKE_DONE   (AUX_TDC_TRIGSRC_START_SRC_SMPH_AUTOTAKE_DONE)
 
#define AUXTDC_START_TDC_PRE   (AUX_TDC_TRIGSRC_START_SRC_TDC_PRE)
 
#define AUXTDC_START_TIMER0_EV   (AUX_TDC_TRIGSRC_START_SRC_TIMER0_EV)
 
#define AUXTDC_START_TIMER1_EV   (AUX_TDC_TRIGSRC_START_SRC_TIMER1_EV)
 
#define AUXTDC_START_AON_RTC_CH2   (AUX_TDC_TRIGSRC_START_SRC_AON_RTC_CH2)
 
#define AUXTDC_START_AUX_COMPA   (AUX_TDC_TRIGSRC_START_SRC_AUX_COMPA)
 
#define AUXTDC_START_AUX_COMPB   (AUX_TDC_TRIGSRC_START_SRC_AUX_COMPB)
 
#define AUXTDC_START_ACLK_REF   (AUX_TDC_TRIGSRC_START_SRC_ACLK_REF)
 
#define AUXTDC_START_MCU_EV   (AUX_TDC_TRIGSRC_START_SRC_MCU_EV)
 
#define AUXTDC_SAT_4096   (AUX_TDC_SATCFG_LIMIT_R12)
 
#define AUXTDC_SAT_8192   (AUX_TDC_SATCFG_LIMIT_R13)
 
#define AUXTDC_SAT_16384   (AUX_TDC_SATCFG_LIMIT_R14)
 
#define AUXTDC_SAT_32768   (AUX_TDC_SATCFG_LIMIT_R15)
 
#define AUXTDC_SAT_65536   (AUX_TDC_SATCFG_LIMIT_R16)
 
#define AUXTDC_SAT_131072   (AUX_TDC_SATCFG_LIMIT_R17)
 
#define AUXTDC_SAT_262144   (AUX_TDC_SATCFG_LIMIT_R18)
 
#define AUXTDC_SAT_524288   (AUX_TDC_SATCFG_LIMIT_R19)
 
#define AUXTDC_SAT_1048576   (AUX_TDC_SATCFG_LIMIT_R20)
 
#define AUXTDC_SAT_2097152   (AUX_TDC_SATCFG_LIMIT_R21)
 
#define AUXTDC_SAT_4194304   (AUX_TDC_SATCFG_LIMIT_R22)
 
#define AUXTDC_SAT_8388608   (AUX_TDC_SATCFG_LIMIT_R23)
 
#define AUXTDC_SAT_16777216   (AUX_TDC_SATCFG_LIMIT_R24)
 
#define AUXTDC_NUM_SAT_VALS   16
 

Functions

static uint32_t AUXTDCStatusGet (uint32_t ui32Base)
 Get the status of the AUX TDC internal state machine. More...
 
void AUXTDCConfigSet (uint32_t ui32Base, uint32_t ui32StartCondition, uint32_t ui32StopCondition)
 Configure the operation of the AUX TDC. More...
 
static bool AUXTDCIdle (uint32_t ui32Base)
 Check if the AUX TDC is in idle mode. More...
 
static void AUXTDCEnable (uint32_t ui32Base, uint32_t ui32RunMode)
 Enable the AUX TDC for a measurement. More...
 
static void AUXTDCIdleForce (uint32_t ui32Base)
 Force the AUX TDC back to Idle mode. More...
 
uint32_t AUXTDCMeasurementDone (uint32_t ui32Base)
 Check if the AUX TDC is done measuring. More...
 
static uint32_t AUXTDCMeasurementGet (uint32_t ui32Base)
 Get the value of the latest measurement. More...
 
static void AUXTDCLimitSet (uint32_t ui32Base, uint32_t ui32Limit)
 Set the saturation limit of the measurement. More...
 
static uint32_t AUXTDCLimitGet (uint32_t ui32Base)
 Get the saturation limit of the measurement. More...
 
static bool AUXTDCCounterEnable (uint32_t ui32Base)
 Enables the counter if possible. More...
 
static bool AUXTDCCounterDisable (uint32_t ui32Base)
 Disables the counter if possible. More...
 
static bool AUXTDCCounterSet (uint32_t ui32Base, uint32_t ui32Events)
 Set the reset number of counter compare/stop event to ignore before taking a measurement. More...
 
static uint32_t AUXTDCCounterGet (uint32_t ui32Base)
 Get the current number of counter compare/stop event to ignore before taking a measurement. More...