Lines Matching refs:channel

78 static int pwm_numaker_set_cycles(const struct device *dev, uint32_t channel,  in pwm_numaker_set_cycles()  argument
84 uint32_t channel_mask = BIT(channel); in pwm_numaker_set_cycles()
86 LOG_DBG("Channel=0x%x, CAPIEN=0x%x, CAPIF=0x%x", channel, epwm->CAPIEN, in pwm_numaker_set_cycles()
91 epwm->POLCTL |= BIT(EPWM_POLCTL_PINV0_Pos + channel); in pwm_numaker_set_cycles()
93 epwm->POLCTL &= ~BIT(EPWM_POLCTL_PINV0_Pos + channel); in pwm_numaker_set_cycles()
105 EPWM_ConfigOutputChannel(epwm, channel, data->cycles_per_sec / period_cycles, in pwm_numaker_set_cycles()
117 LOG_DBG("Channel=0x%x, CAPIEN=0x%x, CAPIF=0x%x", channel, epwm->CAPIEN, epwm->CAPIF); in pwm_numaker_set_cycles()
122 static int pwm_numaker_get_cycles_per_sec(const struct device *dev, uint32_t channel, in pwm_numaker_get_cycles_per_sec() argument
128 ARG_UNUSED(channel); in pwm_numaker_get_cycles_per_sec()
137 static int pwm_numaker_configure_capture(const struct device *dev, uint32_t channel, in pwm_numaker_configure_capture() argument
142 uint32_t pair = channel; in pwm_numaker_configure_capture()
189 static int pwm_numaker_enable_capture(const struct device *dev, uint32_t channel) in pwm_numaker_enable_capture() argument
194 uint32_t pair = channel; in pwm_numaker_enable_capture()
195 uint32_t channel_mask = BIT(channel); in pwm_numaker_enable_capture()
213 EPWM_ConfigCaptureChannel(epwm, channel, unit_time_nsec, 0); in pwm_numaker_enable_capture()
221 EPWM_ClearCaptureIntFlag(epwm, channel, in pwm_numaker_enable_capture()
225 EPWM_EnableCaptureInt(epwm, channel, data->capture[pair].curr_edge_mode); in pwm_numaker_enable_capture()
227 LOG_DBG("Channel=0x%x, CAPIEN=0x%x, CAPIF=0x%x", channel, epwm->CAPIEN, in pwm_numaker_enable_capture()
233 static int pwm_numaker_disable_capture(const struct device *dev, uint32_t channel) in pwm_numaker_disable_capture() argument
238 uint32_t channel_mask = BIT(channel); in pwm_numaker_disable_capture()
242 data->capture[channel].is_busy = false; in pwm_numaker_disable_capture()
246 EPWM_DisableCaptureInt(epwm, channel, in pwm_numaker_disable_capture()
248 EPWM_ClearCaptureIntFlag(epwm, channel, in pwm_numaker_disable_capture()
258 static int pwm_numaker_get_cap_cycle(EPWM_T *epwm, uint32_t channel, uint32_t curr_edge, in pwm_numaker_get_cap_cycle() argument
272 EPWM_ClearPeriodIntFlag(epwm, channel); in pwm_numaker_get_cap_cycle()
276 next_if_mask = BIT(capif_base + channel); in pwm_numaker_get_cap_cycle()
278 LOG_DBG("Channel=0x%x, R-Cnt=0x%x, F-Cnt0x%x, CNT-0x%x", channel, in pwm_numaker_get_cap_cycle()
279 EPWM_GET_CAPTURE_RISING_DATA(epwm, channel), in pwm_numaker_get_cap_cycle()
280 EPWM_GET_CAPTURE_FALLING_DATA(epwm, channel), epwm->CNT[channel]); in pwm_numaker_get_cap_cycle()
282 ? EPWM_GET_CAPTURE_FALLING_DATA(epwm, channel) in pwm_numaker_get_cap_cycle()
283 : (uint16_t)EPWM_GET_CAPTURE_RISING_DATA(epwm, channel); in pwm_numaker_get_cap_cycle()
287 if (EPWM_GetPeriodIntFlag(epwm, channel)) { in pwm_numaker_get_cap_cycle()
288 EPWM_ClearPeriodIntFlag(epwm, channel); in pwm_numaker_get_cap_cycle()
298 EPWM_ClearCaptureIntFlag(epwm, channel, in pwm_numaker_get_cap_cycle()
303 ? (uint16_t)EPWM_GET_CAPTURE_FALLING_DATA(epwm, channel) in pwm_numaker_get_cap_cycle()
304 : (uint16_t)EPWM_GET_CAPTURE_RISING_DATA(epwm, channel); in pwm_numaker_get_cap_cycle()
314 static void pwm_numaker_channel_cap(const struct device *dev, EPWM_T *epwm, uint32_t channel) in pwm_numaker_channel_cap() argument
321 EPWM_DisableCaptureInt(epwm, channel, EPWM_CAPTURE_INT_RISING_LATCH | in pwm_numaker_channel_cap()
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()
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()
339 EPWM_DisableCaptureInt(epwm, channel, EPWM_CAPTURE_INT_RISING_LATCH | in pwm_numaker_channel_cap()
341 data->capture[channel].is_busy = false; in pwm_numaker_channel_cap()
343 EPWM_ClearCaptureIntFlag(epwm, channel, EPWM_CAPTURE_INT_FALLING_LATCH | in pwm_numaker_channel_cap()
345 EPWM_EnableCaptureInt(epwm, channel, data->capture[channel].curr_edge_mode); in pwm_numaker_channel_cap()