MotorWare f2806x Driver API Documentation
Data Structures | Macros | Typedefs | Enumerations | Functions
cap.h File Reference

Contains public interface to various functions related to the Enhanced Capture (CAP) object. More...

#include "sw/modules/types/src/types.h"

Go to the source code of this file.

Data Structures

struct  _CAP_Obj_
 Defines the capture (CAP) object. More...
 

Macros

#define CAP1_BASE_ADDR   (0x00006A00)
 Defines the base address of the capture (CAP) 1 registers. More...
 
#define CAP2_BASE_ADDR   (0x00006A20)
 Defines the base address of the capture (CAP) 2 registers. More...
 
#define CAP3_BASE_ADDR   (0x00006A40)
 Defines the base address of the capture (CAP) 3 registers. More...
 
#define CAP_ECCTL1_FREESOFT_BITS   (3 << 14)
 Defines the location of the FREE/SOFT bits in the ECCTL1 register. More...
 
#define CAP_ECCTL1_PRESCALE_BITS   (31 << 9)
 Defines the location of the PRESCALE bits in the ECCTL1 register. More...
 
#define CAP_ECCTL1_CAPLDEN_BITS   (1 << 8)
 Defines the location of the CAPLDEN bits in the ECCTL1 register. More...
 
#define CAP_ECCTL1_CTRRST4_BITS   (1 << 7)
 Defines the location of the CTRRST4 bits in the ECCTL1 register. More...
 
#define CAP_ECCTL1_CAP4POL_BITS   (1 << 6)
 Defines the location of the CAP4POL bits in the ECCTL1 register. More...
 
#define CAP_ECCTL1_CTRRST3_BITS   (1 << 5)
 Defines the location of the CTRRST3 bits in the ECCTL1 register. More...
 
#define CAP_ECCTL1_CAP3POL_BITS   (1 << 4)
 Defines the location of the CAP3POL bits in the ECCTL1 register. More...
 
#define CAP_ECCTL1_CTRRST2_BITS   (1 << 3)
 Defines the location of the CTRRST2 bits in the ECCTL1 register. More...
 
#define CAP_ECCTL1_CAP2POL_BITS   (1 << 2)
 Defines the location of the CAP2POL bits in the ECCTL1 register. More...
 
#define CAP_ECCTL1_CTRRST1_BITS   (1 << 1)
 Defines the location of the CTRRST1 bits in the ECCTL1 register. More...
 
#define CAP_ECCTL1_CAP1POL_BITS   (1 << 0)
 Defines the location of the CAP1POL bits in the ECCTL1 register. More...
 
#define CAP_ECCTL2_APWMPOL_BITS   (1 << 10)
 Defines the location of the APWMPOL bits in the ECCTL2 register. More...
 
#define CAP_ECCTL2_CAPAPWM_BITS   (1 << 9)
 Defines the location of the CAP/APWM bits in the ECCTL2 register. More...
 
#define CAP_ECCTL2_SWSYNC_BITS   (1 << 8)
 Defines the location of the SWSYNC bits in the ECCTL2 register. More...
 
#define CAP_ECCTL2_SYNCOSEL_BITS   (3 << 6)
 Defines the location of the SYNCO_SEL bits in the ECCTL2 register. More...
 
#define CAP_ECCTL2_SYNCIEN_BITS   (1 << 5)
 Defines the location of the SYNCI_EN bits in the ECCTL2 register. More...
 
#define CAP_ECCTL2_TSCTRSTOP_BITS   (1 << 4)
 Defines the location of the TSCTRSTOP bits in the ECCTL2 register. More...
 
#define CAP_ECCTL2_REARM_BITS   (1 << 3)
 Defines the location of the REARM bits in the ECCTL2 register. More...
 
#define CAP_ECCTL2_STOP_WRAP_BITS   (3 << 1)
 Defines the location of the STOP_WRAP bits in the ECCTL2 register. More...
 
#define CAP_ECCTL2_CONTONESHOT_BITS   (1 << 0)
 Defines the location of the CONT/ONESHOT bits in the ECCTL2 register. More...
 
#define CAP_ECCxxx_CTRCOMP_BITS   (1 << 7)
 Defines the location of the CTR=COMP bits in the ECCxxx register. More...
 
#define CAP_ECCxxx_CTRPRD_BITS   (1 << 6)
 Defines the location of the CTR=PRD bits in the ECCxxx register. More...
 
#define CAP_ECCxxx_CTROVF_BITS   (1 << 5)
 Defines the location of the CTROVF bits in the ECCxxx register. More...
 
#define CAP_ECCxxx_CEVT4_BITS   (1 << 4)
 Defines the location of the CEVT4 bits in the ECCxxx register. More...
 
#define CAP_ECCxxx_CEVT3_BITS   (1 << 3)
 Defines the location of the CEVT4 bits in the ECCxxx register. More...
 
#define CAP_ECCxxx_CEVT2_BITS   (1 << 2)
 Defines the location of the CEVT4 bits in the ECCxxx register. More...
 
#define CAP_ECCxxx_CEVT1_BITS   (1 << 1)
 Defines the location of the CEVT4 bits in the ECCxxx register. More...
 
#define CAP_ECCxxx_INT_BITS   (1 << 0)
 Defines the location of the INT bits in the ECCxxx register. More...
 

Typedefs

typedef struct _CAP_Obj_ CAP_Obj
 Defines the capture (CAP) object. More...
 
typedef struct _CAP_Obj_CAP_Handle
 Defines the capture (CAP) handle. More...
 

Enumerations

enum  CAP_Int_Type_e {
  CAP_Int_Type_CTR_CMP = (1 << 7), CAP_Int_Type_CTR_PRD = (1 << 6), CAP_Int_Type_CTR_OVF = (1 << 5), CAP_Int_Type_CEVT4 = (1 << 4),
  CAP_Int_Type_CEVT3 = (1 << 3), CAP_Int_Type_CEVT2 = (1 << 2), CAP_Int_Type_CEVT1 = (1 << 1), CAP_Int_Type_Global = (1 << 0),
  CAP_Int_Type_All = 0x00FF
}
 Enumeration to define the capture (CAP) interrupts. More...
 
enum  CAP_Prescale_e {
  CAP_Prescale_By_1 = (0 << 9), CAP_Prescale_By_2 = (1 << 9), CAP_Prescale_By_4 = (2 << 9), CAP_Prescale_By_6 = (3 << 9),
  CAP_Prescale_By_8 = (4 << 9), CAP_Prescale_By_10 = (5 << 9), CAP_Prescale_By_12 = (6 << 9), CAP_Prescale_By_14 = (7 << 9),
  CAP_Prescale_By_16 = (8 << 9), CAP_Prescale_By_18 = (9 << 9), CAP_Prescale_By_20 = (10 << 9), CAP_Prescale_By_22 = (11 << 9),
  CAP_Prescale_By_24 = (12 << 9), CAP_Prescale_By_26 = (13 << 9), CAP_Prescale_By_28 = (14 << 9), CAP_Prescale_By_30 = (15 << 9),
  CAP_Prescale_By_32 = (16 << 9), CAP_Prescale_By_34 = (17 << 9), CAP_Prescale_By_36 = (18 << 9), CAP_Prescale_By_38 = (19 << 9),
  CAP_Prescale_By_40 = (20 << 9), CAP_Prescale_By_42 = (21 << 9), CAP_Prescale_By_44 = (22 << 9), CAP_Prescale_By_46 = (23 << 9),
  CAP_Prescale_By_48 = (24 << 9), CAP_Prescale_By_50 = (25 << 9), CAP_Prescale_By_52 = (26 << 9), CAP_Prescale_By_54 = (27 << 9),
  CAP_Prescale_By_56 = (28 << 9), CAP_Prescale_By_58 = (29 << 9), CAP_Prescale_By_60 = (30 << 9), CAP_Prescale_By_62 = (31 << 9)
}
 Enumeration to define the capture (CAP) prescaler values. More...
 
enum  CAP_RunMode_e { CAP_RunMode_HardStop = (0 << 14), CAP_RunMode_SoftStopAfterCycle = (1 << 14), CAP_RunMode_FreeRun = (2 << 14) }
 Enumeration to define the pulse width modulation (PWM) run modes. More...
 
enum  CAP_Stop_Wrap_e { CAP_Stop_Wrap_CEVT1 = (0 << 1), CAP_Stop_Wrap_CEVT2 = (1 << 1), CAP_Stop_Wrap_CEVT3 = (2 << 1), CAP_Stop_Wrap_CEVT4 = (3 << 1) }
 Enumeration to define the capture (CAP) Stop/Wrap modes. More...
 
enum  CAP_Event_e { CAP_Event_1 = 0, CAP_Event_2, CAP_Event_3, CAP_Event_4 }
 Enumeration to define the capture (CAP) events. More...
 
enum  CAP_Polarity_e { CAP_Polarity_Rising = 0, CAP_Polarity_Falling }
 Enumeration to define the capture (CAP) event polarities. More...
 
enum  CAP_Reset_e { CAP_Reset_Disable = 0, CAP_Reset_Enable }
 Enumeration to define the capture (CAP) event resets. More...
 
enum  CAP_SyncOut_e { CAP_SyncOut_SyncIn = (0 << 6), CAP_SyncOut_CTRPRD = (1 << 6), CAP_SyncOut_Disable = (2 << 6) }
 Enumeration to define the Sync Out options. More...
 

Functions

void CAP_setModeCap (CAP_Handle capHandle)
 Sets capture peripheral up for capture mode. More...
 
void CAP_setModeApwm (CAP_Handle capHandle)
 Sets capture peripheral up for APWM mode. More...
 
static void CAP_clearInt (CAP_Handle capHandle, const CAP_Int_Type_e intType)
 Clears capture (CAP) interrupt flag. More...
 
void CAP_disableCaptureLoad (CAP_Handle capHandle)
 Disables loading of CAP1-4 on capture event. More...
 
void CAP_disableInt (CAP_Handle capHandle, const CAP_Int_Type_e intType)
 Disables capture (CAP) interrupt source. More...
 
void CAP_disableSyncIn (CAP_Handle capHandle)
 Disables counter synchronization. More...
 
void CAP_disableTimestampCounter (CAP_Handle capHandle)
 Disables Time Stamp counter from running. More...
 
void CAP_enableCaptureLoad (CAP_Handle capHandle)
 Enables loading of CAP1-4 on capture event. More...
 
void CAP_enableInt (CAP_Handle capHandle, const CAP_Int_Type_e intType)
 Enables capture (CAP) interrupt source. More...
 
void CAP_enableSyncIn (CAP_Handle capHandle)
 Enables counter synchronization. More...
 
void CAP_enableTimestampCounter (CAP_Handle capHandle)
 Enables Time Stamp counter to running. More...
 
static uint32_t CAP_getCap1 (CAP_Handle capHandle)
 Gets the CAP1 register value. More...
 
static uint32_t CAP_getCap2 (CAP_Handle capHandle)
 Gets the CAP2 register value. More...
 
static uint32_t CAP_getCap3 (CAP_Handle capHandle)
 Gets the CAP3 register value. More...
 
static uint32_t CAP_getCap4 (CAP_Handle capHandle)
 Gets the CAP4 register value. More...
 
static void CAP_rearm (CAP_Handle capHandle)
 (Re-)Arm the capture module More...
 
void CAP_setCapEvtPolarity (CAP_Handle capHandle, const CAP_Event_e event, const CAP_Polarity_e polarity)
 Sets the capture event polarity. More...
 
void CAP_setCapEvtReset (CAP_Handle capHandle, const CAP_Event_e event, const CAP_Reset_e reset)
 Sets the capture event counter reset configuration. More...
 
void CAP_setCapContinuous (CAP_Handle capHandle)
 Sets up for continuous Capture. More...
 
void CAP_setCapOneShot (CAP_Handle capHandle)
 Sets up for one-shot Capture. More...
 
static void CAP_setApwmPeriod (CAP_Handle capHandle, const uint32_t period)
 Sets the APWM period. More...
 
static void CAP_setApwmCompare (CAP_Handle capHandle, const uint32_t compare)
 Sets the APWM compare value. More...
 
static void CAP_setApwmShadowPeriod (CAP_Handle capHandle, const uint32_t shadowPeriod)
 Sets the APWM shadow period. More...
 
void CAP_setStopWrap (CAP_Handle capHandle, const CAP_Stop_Wrap_e stopWrap)
 Set the stop/wrap mode. More...
 
void CAP_setSyncOut (CAP_Handle capHandle, const CAP_SyncOut_e syncOut)
 Set the sync out mode. More...
 
CAP_Handle CAP_init (void *pMemory, const size_t numBytes)
 Initializes the capture (CAP) object handle. More...
 

Detailed Description

Contains public interface to various functions related to the Enhanced Capture (CAP) object.

(C) Copyright 2015, Texas Instruments, Inc.

Definition in file cap.h.