Lines Matching full:capture
61 struct pwm_numaker_capture_data capture[NUMAKER_PWM_CHANNEL_COUNT]; member
146 data->capture[pair].callback = cb; in pwm_numaker_configure_capture()
147 data->capture[pair].user_data = user_data; in pwm_numaker_configure_capture()
149 if (data->capture[pair].is_busy) { in pwm_numaker_configure_capture()
150 LOG_ERR("Capture already active on this channel %d", pair); in pwm_numaker_configure_capture()
154 LOG_ERR("Cannot capture both period and pulse width"); in pwm_numaker_configure_capture()
159 data->capture[pair].single_mode = false; in pwm_numaker_configure_capture()
161 data->capture[pair].single_mode = true; in pwm_numaker_configure_capture()
165 data->capture[pair].pulse_capture = false; in pwm_numaker_configure_capture()
168 data->capture[pair].curr_edge_mode = EPWM_CAPTURE_INT_FALLING_LATCH; in pwm_numaker_configure_capture()
169 data->capture[pair].next_edge_mode = EPWM_CAPTURE_INT_FALLING_LATCH; in pwm_numaker_configure_capture()
171 data->capture[pair].curr_edge_mode = EPWM_CAPTURE_INT_RISING_LATCH; in pwm_numaker_configure_capture()
172 data->capture[pair].next_edge_mode = EPWM_CAPTURE_INT_RISING_LATCH; in pwm_numaker_configure_capture()
175 data->capture[pair].pulse_capture = true; in pwm_numaker_configure_capture()
178 data->capture[pair].curr_edge_mode = EPWM_CAPTURE_INT_FALLING_LATCH; in pwm_numaker_configure_capture()
179 data->capture[pair].next_edge_mode = EPWM_CAPTURE_INT_RISING_LATCH; in pwm_numaker_configure_capture()
181 data->capture[pair].curr_edge_mode = EPWM_CAPTURE_INT_RISING_LATCH; in pwm_numaker_configure_capture()
182 data->capture[pair].next_edge_mode = EPWM_CAPTURE_INT_FALLING_LATCH; in pwm_numaker_configure_capture()
200 if (!data->capture[pair].callback) { in pwm_numaker_enable_capture()
201 LOG_ERR("PWM capture not configured"); in pwm_numaker_enable_capture()
205 if (data->capture[pair].is_busy) { in pwm_numaker_enable_capture()
206 LOG_ERR("Capture already active on this channel %d", pair); in pwm_numaker_enable_capture()
210 data->capture[pair].is_busy = true; in pwm_numaker_enable_capture()
212 /* Set capture configuration */ in pwm_numaker_enable_capture()
215 /* Enable Capture Function for EPWM */ in pwm_numaker_enable_capture()
225 EPWM_EnableCaptureInt(epwm, channel, data->capture[pair].curr_edge_mode); in pwm_numaker_enable_capture()
242 data->capture[channel].is_busy = false; in pwm_numaker_disable_capture()
255 * Get capture cycles between current channel edge until next chnannel edge.
256 * The capture period counter down count from 0x10000, and auto-reload to 0x10000
285 /* Wait for Capture Next Indicator */ in pwm_numaker_get_cap_cycle()
297 /* Clear Capture Falling and Rising Indicator */ in pwm_numaker_get_cap_cycle()
301 /* Get Capture Latch Counter Data */ in pwm_numaker_get_cap_cycle()
317 struct pwm_numaker_capture_data *capture; in pwm_numaker_channel_cap() local
324 capture = &data->capture[channel]; in pwm_numaker_channel_cap()
328 epwm, channel, data->capture[channel].curr_edge_mode, in pwm_numaker_channel_cap()
329 data->capture[channel].next_edge_mode, &cycles); in pwm_numaker_channel_cap()
330 if (capture->pulse_capture) { in pwm_numaker_channel_cap()
332 capture->callback(dev, channel, 0, cycles, status, capture->user_data); in pwm_numaker_channel_cap()
335 capture->callback(dev, channel, cycles, 0, status, capture->user_data); in pwm_numaker_channel_cap()
338 if (capture->single_mode) { in pwm_numaker_channel_cap()
341 data->capture[channel].is_busy = false; in pwm_numaker_channel_cap()
345 EPWM_EnableCaptureInt(epwm, channel, data->capture[channel].curr_edge_mode); in pwm_numaker_channel_cap()
346 /* data->capture[channel].is_busy = true; */ in pwm_numaker_channel_cap()
355 struct pwm_numaker_capture_data *capture; in pwm_numaker_isr() local
376 * until getting capture cycles. in pwm_numaker_isr()
380 if (cap_intsts != 0x00) { /* Capture Interrupt */ in pwm_numaker_isr()
386 capture = &data->capture[i]; in pwm_numaker_isr()
387 if (capture == NULL) { in pwm_numaker_isr()