65#ifndef LIBBSP_ARM_BEAGLE_QEP_H
66#define LIBBSP_ARM_BEAGLE_QEP_H
72#define AM335X_EQEP_REGS (0x00000180)
73#define AM335X_EQEP_0_REGS (AM335X_PWMSS0_MMAP_ADDR + AM335X_EQEP_REGS)
74#define AM335X_EQEP_1_REGS (AM335X_PWMSS1_MMAP_ADDR + AM335X_EQEP_REGS)
75#define AM335X_EQEP_2_REGS (AM335X_PWMSS2_MMAP_ADDR + AM335X_EQEP_REGS)
78#define AM335x_EQEP_QPOSCNT 0x0
79#define AM335x_EQEP_QPOSINIT 0x4
80#define AM335x_EQEP_QPOSMAX 0x8
81#define AM335x_EQEP_QPOSCMP 0xC
82#define AM335x_EQEP_QPOSILAT 0x10
83#define AM335x_EQEP_QPOSSLAT 0x14
84#define AM335x_EQEP_QPOSLAT 0x18
85#define AM335x_EQEP_QUTMR 0x1C
86#define AM335x_EQEP_QUPRD 0x20
87#define AM335x_EQEP_QWDTMR 0x24
88#define AM335x_EQEP_QWDPRD 0x26
89#define AM335x_EQEP_QDECCTL 0x28
90#define AM335x_EQEP_QEPCTL 0x2A
91#define AM335x_EQEP_QCAPCTL 0x2C
92#define AM335x_EQEP_QPOSCTL 0x2E
93#define AM335x_EQEP_QEINT 0x30
94#define AM335x_EQEP_QFLG 0x32
95#define AM335x_EQEP_QCLR 0x34
96#define AM335x_EQEP_QFRC 0x36
97#define AM335x_EQEP_QEPSTS 0x38
98#define AM335x_EQEP_QCTMR 0x3A
99#define AM335x_EQEP_QCPRD 0x3C
100#define AM335x_EQEP_QCTMRLAT 0x3E
101#define AM335x_EQEP_QCPRDLAT 0x40
102#define AM335x_EQEP_REVID 0x5C
105#define AM335x_EQEP_QEPCTL_UTE (1 << 1)
106#define AM335x_EQEP_QEPCTL_QCLM (1 << 2)
107#define AM335x_EQEP_QEPCTL_PHEN (1 << 3)
108#define AM335x_EQEP_QEPCTL_IEL (1 << 4)
109#define AM335x_EQEP_QEPCTL_SWI (1 << 7)
110#define AM335x_EQEP_QEPCTL_PCRM (3 << 12)
111#define AM335x_EQEP_QDECCTL_QSRC (3 << 14)
112#define AM335x_EQEP_QDECCTL_XCR (1 << 11)
113#define AM335x_EQEP_QDECCTL_SWAP (1 << 10)
114#define AM335x_EQEP_QDECCTL_IGATE (1 << 9)
115#define AM335x_EQEP_QDECCTL_QAP (1 << 8)
116#define AM335x_EQEP_QDECCTL_QBP (1 << 7)
117#define AM335x_EQEP_QDECCTL_QIP (1 << 6)
118#define AM335x_EQEP_QDECCTL_QSP (1 << 5)
119#define AM335x_EQEP_CLK_EN (1 << 4)
120#define AM335x_EQEP_QEINT_UTO (1 << 11)
121#define AM335x_EQEP_QFLG_UTO (1 << 11)
122#define AM335x_EQEP_QFLG_MASK 0x0FFF
125#define BBB_P8_11_MUX_QEP 4
126#define BBB_P8_12_MUX_QEP 4
127#define BBB_P8_15_MUX_QEP 4
128#define BBB_P8_16_MUX_QEP 4
129#define BBB_P8_31_MUX_QEP 2
130#define BBB_P8_32_MUX_QEP 2
131#define BBB_P8_33_MUX_QEP 2
132#define BBB_P8_35_MUX_QEP 2
133#define BBB_P8_39_MUX_QEP 3
134#define BBB_P8_40_MUX_QEP 3
135#define BBB_P8_41_MUX_QEP 3
136#define BBB_P8_42_MUX_QEP 3
137#define BBB_P9_25_MUX_QEP 1
138#define BBB_P9_27_MUX_QEP 1
139#define BBB_P9_41_MUX_QEP 1
140#define BBB_P9_42_MUX_QEP 1
142#define NANO_SEC_PER_SEC 1000000000
145#define SYSCLKOUT 100000000
154 QUADRATURE_COUNT = 0,
246 const uint32_t mmio_base;
256 uint32_t swap_inputs;
ISR_Vector_number rtems_vector_number
This integer type represents interrupt vector numbers.
Definition: intr.h:102
rtems_status_code
This enumeration provides status codes for directives of the Classic API.
Definition: status.h:85
BBB_PWMSS
The set of possible PWM subsystem module.
Definition: pwmss.h:58
rtems_status_code beagle_qep_set_quadrature_mode(BBB_PWMSS pwmss_id, BBB_QEP_QUADRATURE_MODE mode)
Sets the quadrature mode to either absolute or relative.
Definition: qep.c:356
rtems_status_code beagle_qep_pinmux_setup(bbb_qep_pin pin_no, BBB_PWMSS pwmss_id, bool pullup_enable)
Configures a given pin for use with the eQEP function of the supplied PWMSS module.
Definition: qep.c:232
uint32_t beagle_eqep_get_timer_period(BBB_PWMSS pwmss_id)
Returns the the currently configured unit timer period.
Definition: qep.c:402
BBB_QEP_QUADRATURE_MODE beagle_qep_get_quadrature_mode(BBB_PWMSS pwmss_id)
Returns the currently configured quadrature mode - either absolute, or relative.
Definition: qep.c:390
rtems_status_code beagle_qep_set_position(BBB_PWMSS pwmss_id, uint32_t position)
Sets the initial position value of the eQEP function for the specified PWMSS module.
Definition: qep.c:318
rtems_status_code beagle_qep_disable(BBB_PWMSS pwmss_id)
Disables the eQEP module of the specified PWMSS unit.
Definition: qep.c:220
rtems_status_code beagle_qep_set_count_mode(BBB_PWMSS pwmss_id, BBB_QEP_COUNT_MODE mode)
Sets the count mode for the eQEP module.
Definition: qep.c:332
BBB_QEP_COUNT_MODE beagle_qep_get_count_mode(BBB_PWMSS pwmss_id)
Gets the currently configured count mode for the eQEP module.
Definition: qep.c:346
rtems_status_code beagle_eqep_set_timer_period(BBB_PWMSS pwmss_id, uint64_t period, bbb_eqep_timer_callback timer_callback, void *user)
Sets the unit timer period for the eQEP module. 0 = off, greater than zero sets the period.
Definition: qep.c:419
BBB_QEP_QUADRATURE_MODE
The set of possible modes for Quadrature decode.
Definition: qep.h:164
rtems_status_code beagle_qep_init(BBB_PWMSS pwmss_id)
Initialises the eQEP module of the specified PWMSS unit. This configures the clocks,...
Definition: qep.c:117
void(* bbb_eqep_timer_callback)(BBB_PWMSS, uint32_t position, void *user)
This function definition is used to declare a callback function that will be called by the interrupt ...
Definition: qep.h:212
rtems_status_code beagle_qep_enable(BBB_PWMSS pwmss_id)
Enables the eQEP module of the specified PWMSS unit.
Definition: qep.c:208
int32_t beagle_qep_get_position(BBB_PWMSS pwmss_id)
Returns the current position value of the eQEP function for the specified PWMSS module.
Definition: qep.c:299
BBB_QEP_COUNT_MODE
The set of possible eQEP Position Counter Input Modes.
Definition: qep.h:153
bbb_qep_pin
The set of possible eQEP input pins.
Definition: qep.h:173