Zephyr API Documentation 4.4.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
TI AM3352 EQEP counter

TI AM3352 EQEP counter device-specific API extension. More...

Files

file  ti_am3352_eqep.h
 Public API for TI AM3352 Enhanced Quadrature Encoder Pulse (EQEP) counter.

Data Structures

struct  ti_eqep_qep_cfg
 Configuration for QEP control register. More...
struct  ti_eqep_dec_cfg
 Configuration for decoder unit register. More...
struct  ti_eqep_cap_cfg
 Configuration for capture unit register. More...

Macros

#define TI_EQEP_ALARM_CHAN_NUM   (4)
 Number of EQEP alarm channels.

Enumerations

enum  ti_eqep_alarm_channel { TI_EQEP_ALARM_CHAN_COMPARE = 0 , TI_EQEP_ALARM_CHAN_STROBE = 1 , TI_EQEP_ALARM_CHAN_INDEX = 2 , TI_EQEP_ALARM_CHAN_TIMEOUT = 3 }
 EQEP Event Source Identifiers (Logical Channels). More...
enum  ti_eqep_reset_mode { TI_EQEP_RESET_MODE_INDEX = 0 , TI_EQEP_RESET_MODE_MAX = 1 , TI_EQEP_RESET_MODE_INDEX_ONCE = 2 , TI_EQEP_RESET_MODE_UNIT_TIME = 3 }
 Position counter reset mode. More...
enum  ti_eqep_index_latch { TI_EQEP_INDEX_LATCH_RESERVED = 0 , TI_EQEP_INDEX_LATCH_RISING = 1 , TI_EQEP_INDEX_LATCH_FALLING = 2 , TI_EQEP_INDEX_LATCH_MARKER = 3 }
 Index event latch mode. More...
enum  ti_eqep_strobe_latch { TI_EQEP_STROBE_LATCH_RISING = 0 , TI_EQEP_STROBE_LATCH_DIR = 1 }
 Strobe event latch mode. More...
enum  ti_eqep_capture_latch { TI_EQEP_CAPTURE_LATCH_CPU = 0 , TI_EQEP_CAPTURE_LATCH_TIMEOUT = 1 }
 Capture unit latch mode. More...
enum  ti_eqep_src { TI_EQEP_SRC_QUADRATURE = 0 , TI_EQEP_SRC_DIRECTION = 1 , TI_EQEP_SRC_UP = 2 , TI_EQEP_SRC_DOWN = 3 }
 Position counter source selection. More...
enum  ti_eqep_cap_clk_prescaler {
  TI_EQEP_CAP_CLK_DIV_1 = 0 , TI_EQEP_CAP_CLK_DIV_2 = 1 , TI_EQEP_CAP_CLK_DIV_4 = 2 , TI_EQEP_CAP_CLK_DIV_8 = 3 ,
  TI_EQEP_CAP_CLK_DIV_16 = 4 , TI_EQEP_CAP_CLK_DIV_32 = 5 , TI_EQEP_CAP_CLK_DIV_64 = 6 , TI_EQEP_CAP_CLK_DIV_128 = 7
}
 Capture timer clock prescaler values. More...
enum  ti_eqep_unit_pos_prescaler {
  TI_EQEP_UNIT_POS_DIV_1 = 0 , TI_EQEP_UNIT_POS_DIV_2 = 1 , TI_EQEP_UNIT_POS_DIV_4 = 2 , TI_EQEP_UNIT_POS_DIV_8 = 3 ,
  TI_EQEP_UNIT_POS_DIV_16 = 4 , TI_EQEP_UNIT_POS_DIV_32 = 5 , TI_EQEP_UNIT_POS_DIV_64 = 6 , TI_EQEP_UNIT_POS_DIV_128 = 7 ,
  TI_EQEP_UNIT_POS_DIV_256 = 8 , TI_EQEP_UNIT_POS_DIV_512 = 9 , TI_EQEP_UNIT_POS_DIV_1024 = 10 , TI_EQEP_UNIT_POS_DIV_2048 = 11
}
 Unit position event prescaler values. More...

Functions

void ti_eqep_configure_qep (const struct device *dev, const struct ti_eqep_qep_cfg *qep_cfg)
 Configure QEP Control.
void ti_eqep_configure_decoder (const struct device *dev, const struct ti_eqep_dec_cfg *dec_cfg)
 Configure Decoder Unit.
void ti_eqep_configure_capture (const struct device *dev, const struct ti_eqep_cap_cfg *cap_cfg)
 Configure Edge Capture Unit.
int ti_eqep_get_latched_capture_values (const struct device *dev, uint32_t *timer, uint32_t *period, bool scale)
 Get latched capture timer and period values.

Detailed Description

TI AM3352 EQEP counter device-specific API extension.

Since
4.4.0
Version
0.1.0

Macro Definition Documentation

◆ TI_EQEP_ALARM_CHAN_NUM

#define TI_EQEP_ALARM_CHAN_NUM   (4)

#include <zephyr/drivers/counter/ti_am3352_eqep.h>

Number of EQEP alarm channels.

Enumeration Type Documentation

◆ ti_eqep_alarm_channel

#include <zephyr/drivers/counter/ti_am3352_eqep.h>

EQEP Event Source Identifiers (Logical Channels).

These represent different interrupt sources within the EQEP peripheral, not independent hardware channels. Each corresponds to a distinct functional unit that can generate events and trigger callbacks through the counter API.

Enumerator
TI_EQEP_ALARM_CHAN_COMPARE 

Alarm for position compare unit.

TI_EQEP_ALARM_CHAN_STROBE 

Alarm for strobe event.

TI_EQEP_ALARM_CHAN_INDEX 

Alarm for index event.

TI_EQEP_ALARM_CHAN_TIMEOUT 

Alarm for unit timeout event.

◆ ti_eqep_cap_clk_prescaler

#include <zephyr/drivers/counter/ti_am3352_eqep.h>

Capture timer clock prescaler values.

Enumerator
TI_EQEP_CAP_CLK_DIV_1 

CAPCLK = EQEP_FICLK/1.

TI_EQEP_CAP_CLK_DIV_2 

CAPCLK = EQEP_FICLK/2.

TI_EQEP_CAP_CLK_DIV_4 

CAPCLK = EQEP_FICLK/4.

TI_EQEP_CAP_CLK_DIV_8 

CAPCLK = EQEP_FICLK/8.

TI_EQEP_CAP_CLK_DIV_16 

CAPCLK = EQEP_FICLK/16.

TI_EQEP_CAP_CLK_DIV_32 

CAPCLK = EQEP_FICLK/32.

TI_EQEP_CAP_CLK_DIV_64 

CAPCLK = EQEP_FICLK/64.

TI_EQEP_CAP_CLK_DIV_128 

CAPCLK = EQEP_FICLK/128.

◆ ti_eqep_capture_latch

#include <zephyr/drivers/counter/ti_am3352_eqep.h>

Capture unit latch mode.

Enumerator
TI_EQEP_CAPTURE_LATCH_CPU 

Latch capture timer and capture period on counter read.

TI_EQEP_CAPTURE_LATCH_TIMEOUT 

Latch counter, capture timer and capture period on timeout.

◆ ti_eqep_index_latch

#include <zephyr/drivers/counter/ti_am3352_eqep.h>

Index event latch mode.

Enumerator
TI_EQEP_INDEX_LATCH_RESERVED 

Reserved value.

TI_EQEP_INDEX_LATCH_RISING 

Latch counter on index's rising edge.

TI_EQEP_INDEX_LATCH_FALLING 

Latch counter on index's falling edge.

TI_EQEP_INDEX_LATCH_MARKER 

Latch counter and direction flag on index marker.

◆ ti_eqep_reset_mode

#include <zephyr/drivers/counter/ti_am3352_eqep.h>

Position counter reset mode.

Enumerator
TI_EQEP_RESET_MODE_INDEX 

Reset counter on index event.

TI_EQEP_RESET_MODE_MAX 

Reset counter after maximum value.

TI_EQEP_RESET_MODE_INDEX_ONCE 

Reset counter on only first index event.

TI_EQEP_RESET_MODE_UNIT_TIME 

Reset counter on unit timeout event.

◆ ti_eqep_src

#include <zephyr/drivers/counter/ti_am3352_eqep.h>

Position counter source selection.

Enumerator
TI_EQEP_SRC_QUADRATURE 

Quadrature Count Mode.

TI_EQEP_SRC_DIRECTION 

Direction Count Mode.

TI_EQEP_SRC_UP 

Up Count Mode.

TI_EQEP_SRC_DOWN 

Down Count Mode.

◆ ti_eqep_strobe_latch

#include <zephyr/drivers/counter/ti_am3352_eqep.h>

Strobe event latch mode.

Enumerator
TI_EQEP_STROBE_LATCH_RISING 

Latch counter on strobe's rising edge.

TI_EQEP_STROBE_LATCH_DIR 

Latch counter on strobe's rising edge if clockwise and falling edge if anti-clockwise.

◆ ti_eqep_unit_pos_prescaler

#include <zephyr/drivers/counter/ti_am3352_eqep.h>

Unit position event prescaler values.

Enumerator
TI_EQEP_UNIT_POS_DIV_1 

UPEVNT = QCLK/1.

TI_EQEP_UNIT_POS_DIV_2 

UPEVNT = QCLK/2.

TI_EQEP_UNIT_POS_DIV_4 

UPEVNT = QCLK/4.

TI_EQEP_UNIT_POS_DIV_8 

UPEVNT = QCLK/8.

TI_EQEP_UNIT_POS_DIV_16 

UPEVNT = QCLK/16.

TI_EQEP_UNIT_POS_DIV_32 

UPEVNT = QCLK/32.

TI_EQEP_UNIT_POS_DIV_64 

UPEVNT = QCLK/64.

TI_EQEP_UNIT_POS_DIV_128 

UPEVNT = QCLK/128.

TI_EQEP_UNIT_POS_DIV_256 

UPEVNT = QCLK/256.

TI_EQEP_UNIT_POS_DIV_512 

UPEVNT = QCLK/512.

TI_EQEP_UNIT_POS_DIV_1024 

UPEVNT = QCLK/1024.

TI_EQEP_UNIT_POS_DIV_2048 

UPEVNT = QCLK/2048.

Function Documentation

◆ ti_eqep_configure_capture()

void ti_eqep_configure_capture ( const struct device * dev,
const struct ti_eqep_cap_cfg * cap_cfg )

#include <zephyr/drivers/counter/ti_am3352_eqep.h>

Configure Edge Capture Unit.

Parameters
[in]devPointer to EQEP counter device
[in]cap_cfgPointer to edge capture configuration

◆ ti_eqep_configure_decoder()

void ti_eqep_configure_decoder ( const struct device * dev,
const struct ti_eqep_dec_cfg * dec_cfg )

#include <zephyr/drivers/counter/ti_am3352_eqep.h>

Configure Decoder Unit.

Parameters
[in]devPointer to EQEP counter device
[in]dec_cfgPointer to decoder configuration

◆ ti_eqep_configure_qep()

void ti_eqep_configure_qep ( const struct device * dev,
const struct ti_eqep_qep_cfg * qep_cfg )

#include <zephyr/drivers/counter/ti_am3352_eqep.h>

Configure QEP Control.

Parameters
[in]devPointer to EQEP counter device
[in]qep_cfgPointer to QEP control configuration

◆ ti_eqep_get_latched_capture_values()

int ti_eqep_get_latched_capture_values ( const struct device * dev,
uint32_t * timer,
uint32_t * period,
bool scale )

#include <zephyr/drivers/counter/ti_am3352_eqep.h>

Get latched capture timer and period values.

Parameters
[in]devPointer to EQEP counter device
[out]timerLatched capture timer value
[out]periodLatched capture period value
[in]scaleScale values by capture clock prescaler
Return values
0if success
-EINVALif out parameters are NULL
-ENOTSUPif capture unit is not enabled