46 #include "sw/modules/types/src/types.h"
70 #define CAP1_BASE_ADDR (0x00006A00)
74 #define CAP2_BASE_ADDR (0x00006A20)
78 #define CAP3_BASE_ADDR (0x00006A40)
83 #define CAP_ECCTL1_FREESOFT_BITS (3 << 14)
87 #define CAP_ECCTL1_PRESCALE_BITS (31 << 9)
91 #define CAP_ECCTL1_CAPLDEN_BITS (1 << 8)
95 #define CAP_ECCTL1_CTRRST4_BITS (1 << 7)
99 #define CAP_ECCTL1_CAP4POL_BITS (1 << 6)
103 #define CAP_ECCTL1_CTRRST3_BITS (1 << 5)
107 #define CAP_ECCTL1_CAP3POL_BITS (1 << 4)
111 #define CAP_ECCTL1_CTRRST2_BITS (1 << 3)
115 #define CAP_ECCTL1_CAP2POL_BITS (1 << 2)
119 #define CAP_ECCTL1_CTRRST1_BITS (1 << 1)
123 #define CAP_ECCTL1_CAP1POL_BITS (1 << 0)
128 #define CAP_ECCTL2_APWMPOL_BITS (1 << 10)
132 #define CAP_ECCTL2_CAPAPWM_BITS (1 << 9)
136 #define CAP_ECCTL2_SWSYNC_BITS (1 << 8)
140 #define CAP_ECCTL2_SYNCOSEL_BITS (3 << 6)
144 #define CAP_ECCTL2_SYNCIEN_BITS (1 << 5)
148 #define CAP_ECCTL2_TSCTRSTOP_BITS (1 << 4)
152 #define CAP_ECCTL2_REARM_BITS (1 << 3)
156 #define CAP_ECCTL2_STOP_WRAP_BITS (3 << 1)
160 #define CAP_ECCTL2_CONTONESHOT_BITS (1 << 0)
165 #define CAP_ECCxxx_CTRCOMP_BITS (1 << 7)
169 #define CAP_ECCxxx_CTRPRD_BITS (1 << 6)
173 #define CAP_ECCxxx_CTROVF_BITS (1 << 5)
177 #define CAP_ECCxxx_CEVT4_BITS (1 << 4)
181 #define CAP_ECCxxx_CEVT3_BITS (1 << 3)
185 #define CAP_ECCxxx_CEVT2_BITS (1 << 2)
189 #define CAP_ECCxxx_CEVT1_BITS (1 << 1)
193 #define CAP_ECCxxx_INT_BITS (1 << 0)
497 cap->
CAP3 = shadowPeriod;
516 extern CAP_Handle
CAP_init(
void *pMemory,
const size_t numBytes);
525 #endif // end of _CAP_H_ definition
Sync In used for Sync Out.
void CAP_setModeApwm(CAP_Handle capHandle)
Sets capture peripheral up for APWM mode.
volatile uint32_t CAP4
Capture 4 Register.
volatile uint32_t CAP1
Capture 1 Register.
void CAP_disableInt(CAP_Handle capHandle, const CAP_Int_Type_e intType)
Disables capture (CAP) interrupt source.
void CAP_setModeCap(CAP_Handle capHandle)
Sets capture peripheral up for capture mode.
CTR = PRD used for Sync Out.
void CAP_enableSyncIn(CAP_Handle capHandle)
Enables counter synchronization.
volatile uint16_t ECEINT
Capture Interrupt Enable Register.
static uint32_t CAP_getCap3(CAP_Handle capHandle)
Gets the CAP3 register value.
Defines the capture (CAP) object.
void CAP_disableSyncIn(CAP_Handle capHandle)
Disables counter synchronization.
static void CAP_clearInt(CAP_Handle capHandle, const CAP_Int_Type_e intType)
Clears capture (CAP) interrupt flag.
volatile uint32_t CAP2
Capture 2 Register.
CAP_Prescale_e
Enumeration to define the capture (CAP) prescaler values.
struct _CAP_Obj_ * CAP_Handle
Defines the capture (CAP) handle.
struct _CAP_Obj_ CAP_Obj
Defines the capture (CAP) object.
Denotes CTR = PRD interrupt.
static void CAP_setApwmShadowPeriod(CAP_Handle capHandle, const uint32_t shadowPeriod)
Sets the APWM shadow period.
volatile uint32_t CAP3
Capture 3 Register.
Enable counter reset on capture event.
volatile uint16_t ECEFRC
Capture Interrupt Force Register.
void CAP_setCapEvtReset(CAP_Handle capHandle, const CAP_Event_e event, const CAP_Reset_e reset)
Sets the capture event counter reset configuration.
CAP_Int_Type_e
Enumeration to define the capture (CAP) interrupts.
volatile uint32_t TSCTR
Time-stamp Counter.
volatile uint32_t CTRPHS
Counter Phase Offset Value Register.
void CAP_setSyncOut(CAP_Handle capHandle, const CAP_SyncOut_e syncOut)
Set the sync out mode.
void CAP_enableCaptureLoad(CAP_Handle capHandle)
Enables loading of CAP1-4 on capture event.
Disable counter reset on capture event.
volatile uint16_t ECEFLG
Capture Interrupt Flag Register.
Stop/Wrap after Capture Event 2.
volatile uint16_t ECCTL1
Capture Control Register 1.
Denotes CTR = CMP interrupt.
void CAP_disableCaptureLoad(CAP_Handle capHandle)
Disables loading of CAP1-4 on capture event.
void CAP_setCapEvtPolarity(CAP_Handle capHandle, const CAP_Event_e event, const CAP_Polarity_e polarity)
Sets the capture event polarity.
Stop/Wrap after Capture Event 1.
void CAP_setStopWrap(CAP_Handle capHandle, const CAP_Stop_Wrap_e stopWrap)
Set the stop/wrap mode.
CAP_Stop_Wrap_e
Enumeration to define the capture (CAP) Stop/Wrap modes.
static uint32_t CAP_getCap1(CAP_Handle capHandle)
Gets the CAP1 register value.
void CAP_enableTimestampCounter(CAP_Handle capHandle)
Enables Time Stamp counter to running.
CAP_SyncOut_e
Enumeration to define the Sync Out options.
static uint32_t CAP_getCap2(CAP_Handle capHandle)
Gets the CAP2 register value.
static void CAP_setApwmCompare(CAP_Handle capHandle, const uint32_t compare)
Sets the APWM compare value.
#define CAP_ECCTL2_REARM_BITS
Defines the location of the REARM bits in the ECCTL2 register.
CAP_Polarity_e
Enumeration to define the capture (CAP) event polarities.
void CAP_disableTimestampCounter(CAP_Handle capHandle)
Disables Time Stamp counter from running.
CAP_Reset_e
Enumeration to define the capture (CAP) event resets.
static void CAP_rearm(CAP_Handle capHandle)
(Re-)Arm the capture module
CAP_RunMode_e
Enumeration to define the pulse width modulation (PWM) run modes.
volatile uint16_t ECCTL2
Capture Control Register 2.
static uint32_t CAP_getCap4(CAP_Handle capHandle)
Gets the CAP4 register value.
static void CAP_setApwmPeriod(CAP_Handle capHandle, const uint32_t period)
Sets the APWM period.
Denotes CTROVF interrupt.
CAP_Handle CAP_init(void *pMemory, const size_t numBytes)
Initializes the capture (CAP) object handle.
Stop/Wrap after Capture Event 3.
void CAP_enableInt(CAP_Handle capHandle, const CAP_Int_Type_e intType)
Enables capture (CAP) interrupt source.
volatile uint16_t ECECLR
Capture Interrupt Clear Register.
Stop/Wrap after Capture Event 4.
CAP_Event_e
Enumeration to define the capture (CAP) events.
volatile uint16_t Rsvd_1[8]
Reserved.
Denotes Capture global interrupt.
void CAP_setCapContinuous(CAP_Handle capHandle)
Sets up for continuous Capture.
void CAP_setCapOneShot(CAP_Handle capHandle)
Sets up for one-shot Capture.