Lines Matching full:id

37 uint32_t bdma_stm32_id_to_channel(uint32_t id)  in bdma_stm32_id_to_channel()  argument
50 __ASSERT_NO_MSG(id < ARRAY_SIZE(channel_nr)); in bdma_stm32_id_to_channel()
52 return channel_nr[id]; in bdma_stm32_id_to_channel()
75 void bdma_stm32_clear_ht(BDMA_TypeDef *DMAx, uint32_t id) in bdma_stm32_clear_ht() argument
88 __ASSERT_NO_MSG(id < ARRAY_SIZE(func)); in bdma_stm32_clear_ht()
90 func[id](DMAx); in bdma_stm32_clear_ht()
93 void bdma_stm32_clear_tc(BDMA_TypeDef *DMAx, uint32_t id) in bdma_stm32_clear_tc() argument
106 __ASSERT_NO_MSG(id < ARRAY_SIZE(func)); in bdma_stm32_clear_tc()
108 func[id](DMAx); in bdma_stm32_clear_tc()
111 bool bdma_stm32_is_ht_active(BDMA_TypeDef *DMAx, uint32_t id) in bdma_stm32_is_ht_active() argument
124 __ASSERT_NO_MSG(id < ARRAY_SIZE(func)); in bdma_stm32_is_ht_active()
126 return func[id](DMAx); in bdma_stm32_is_ht_active()
129 bool bdma_stm32_is_tc_active(BDMA_TypeDef *DMAx, uint32_t id) in bdma_stm32_is_tc_active() argument
142 __ASSERT_NO_MSG(id < ARRAY_SIZE(func)); in bdma_stm32_is_tc_active()
144 return func[id](DMAx); in bdma_stm32_is_tc_active()
147 void bdma_stm32_clear_te(BDMA_TypeDef *DMAx, uint32_t id) in bdma_stm32_clear_te() argument
160 __ASSERT_NO_MSG(id < ARRAY_SIZE(func)); in bdma_stm32_clear_te()
162 func[id](DMAx); in bdma_stm32_clear_te()
165 void bdma_stm32_clear_gi(BDMA_TypeDef *DMAx, uint32_t id) in bdma_stm32_clear_gi() argument
178 __ASSERT_NO_MSG(id < ARRAY_SIZE(func)); in bdma_stm32_clear_gi()
180 func[id](DMAx); in bdma_stm32_clear_gi()
183 bool bdma_stm32_is_te_active(BDMA_TypeDef *DMAx, uint32_t id) in bdma_stm32_is_te_active() argument
196 __ASSERT_NO_MSG(id < ARRAY_SIZE(func)); in bdma_stm32_is_te_active()
198 return func[id](DMAx); in bdma_stm32_is_te_active()
201 bool bdma_stm32_is_gi_active(BDMA_TypeDef *DMAx, uint32_t id) in bdma_stm32_is_gi_active() argument
214 __ASSERT_NO_MSG(id < ARRAY_SIZE(func)); in bdma_stm32_is_gi_active()
216 return func[id](DMAx); in bdma_stm32_is_gi_active()
219 void stm32_bdma_dump_channel_irq(BDMA_TypeDef *dma, uint32_t id) in stm32_bdma_dump_channel_irq() argument
222 bdma_stm32_is_te_active(dma, id), in stm32_bdma_dump_channel_irq()
223 bdma_stm32_is_ht_active(dma, id), in stm32_bdma_dump_channel_irq()
224 bdma_stm32_is_tc_active(dma, id), in stm32_bdma_dump_channel_irq()
225 bdma_stm32_is_gi_active(dma, id)); in stm32_bdma_dump_channel_irq()
228 inline bool stm32_bdma_is_tc_irq_active(BDMA_TypeDef *dma, uint32_t id) in stm32_bdma_is_tc_irq_active() argument
230 return LL_BDMA_IsEnabledIT_TC(dma, bdma_stm32_id_to_channel(id)) && in stm32_bdma_is_tc_irq_active()
231 bdma_stm32_is_tc_active(dma, id); in stm32_bdma_is_tc_irq_active()
234 inline bool stm32_bdma_is_ht_irq_active(BDMA_TypeDef *dma, uint32_t id) in stm32_bdma_is_ht_irq_active() argument
236 return LL_BDMA_IsEnabledIT_HT(dma, bdma_stm32_id_to_channel(id)) && in stm32_bdma_is_ht_irq_active()
237 bdma_stm32_is_ht_active(dma, id); in stm32_bdma_is_ht_irq_active()
240 static inline bool stm32_bdma_is_te_irq_active(BDMA_TypeDef *dma, uint32_t id) in stm32_bdma_is_te_irq_active() argument
242 return LL_BDMA_IsEnabledIT_TE(dma, bdma_stm32_id_to_channel(id)) && in stm32_bdma_is_te_irq_active()
243 bdma_stm32_is_te_active(dma, id); in stm32_bdma_is_te_irq_active()
246 bool stm32_bdma_is_irq_active(BDMA_TypeDef *dma, uint32_t id) in stm32_bdma_is_irq_active() argument
248 return stm32_bdma_is_tc_irq_active(dma, id) || in stm32_bdma_is_irq_active()
249 stm32_bdma_is_ht_irq_active(dma, id) || in stm32_bdma_is_irq_active()
250 stm32_bdma_is_te_irq_active(dma, id); in stm32_bdma_is_irq_active()
253 void stm32_bdma_clear_channel_irq(BDMA_TypeDef *dma, uint32_t id) in stm32_bdma_clear_channel_irq() argument
255 bdma_stm32_clear_gi(dma, id); in stm32_bdma_clear_channel_irq()
256 bdma_stm32_clear_tc(dma, id); in stm32_bdma_clear_channel_irq()
257 bdma_stm32_clear_ht(dma, id); in stm32_bdma_clear_channel_irq()
258 bdma_stm32_clear_te(dma, id); in stm32_bdma_clear_channel_irq()
261 bool stm32_bdma_is_enabled_channel(BDMA_TypeDef *dma, uint32_t id) in stm32_bdma_is_enabled_channel() argument
263 if (LL_BDMA_IsEnabledChannel(dma, bdma_stm32_id_to_channel(id)) == 1) { in stm32_bdma_is_enabled_channel()
269 int stm32_bdma_disable_channel(BDMA_TypeDef *dma, uint32_t id) in stm32_bdma_disable_channel() argument
271 LL_BDMA_DisableChannel(dma, bdma_stm32_id_to_channel(id)); in stm32_bdma_disable_channel()
273 if (!LL_BDMA_IsEnabledChannel(dma, bdma_stm32_id_to_channel(id))) { in stm32_bdma_disable_channel()
280 void stm32_bdma_enable_channel(BDMA_TypeDef *dma, uint32_t id) in stm32_bdma_enable_channel() argument
282 LL_BDMA_EnableChannel(dma, bdma_stm32_id_to_channel(id)); in stm32_bdma_enable_channel()
285 static void bdma_stm32_dump_channel_irq(const struct device *dev, uint32_t id) in bdma_stm32_dump_channel_irq() argument
290 stm32_bdma_dump_channel_irq(dma, id); in bdma_stm32_dump_channel_irq()
293 static void bdma_stm32_clear_channel_irq(const struct device *dev, uint32_t id) in bdma_stm32_clear_channel_irq() argument
298 bdma_stm32_clear_tc(dma, id); in bdma_stm32_clear_channel_irq()
299 bdma_stm32_clear_ht(dma, id); in bdma_stm32_clear_channel_irq()
300 stm32_bdma_clear_channel_irq(dma, id); in bdma_stm32_clear_channel_irq()
303 static void bdma_stm32_irq_handler(const struct device *dev, uint32_t id) in bdma_stm32_irq_handler() argument
310 __ASSERT_NO_MSG(id < config->max_channels); in bdma_stm32_irq_handler()
312 channel = &config->channels[id]; in bdma_stm32_irq_handler()
320 bdma_stm32_clear_channel_irq(dev, id); in bdma_stm32_irq_handler()
327 callback_arg = id; in bdma_stm32_irq_handler()
334 /* the dma channel id is in range from 0..<dma-requests> */ in bdma_stm32_irq_handler()
335 if (stm32_bdma_is_ht_irq_active(dma, id)) { in bdma_stm32_irq_handler()
338 bdma_stm32_clear_ht(dma, id); in bdma_stm32_irq_handler()
341 } else if (stm32_bdma_is_tc_irq_active(dma, id)) { in bdma_stm32_irq_handler()
347 bdma_stm32_clear_tc(dma, id); in bdma_stm32_irq_handler()
352 bdma_stm32_dump_channel_irq(dev, id); in bdma_stm32_irq_handler()
353 bdma_stm32_clear_channel_irq(dev, id); in bdma_stm32_irq_handler()
443 static int bdma_stm32_disable_channel(BDMA_TypeDef *bdma, uint32_t id) in bdma_stm32_disable_channel() argument
448 if (stm32_bdma_disable_channel(bdma, id) == 0) { in bdma_stm32_disable_channel()
481 uint32_t id, in bdma_stm32_configure() argument
486 &dev_config->channels[id]; in bdma_stm32_configure()
494 if (id >= dev_config->max_channels) { in bdma_stm32_configure()
495 LOG_ERR("cannot configure the bdma channel %d.", id); in bdma_stm32_configure()
500 LOG_ERR("bdma channel %d is busy.", id); in bdma_stm32_configure()
504 if (bdma_stm32_disable_channel(bdma, id) != 0) { in bdma_stm32_configure()
505 LOG_ERR("could not disable bdma channel %d.", id); in bdma_stm32_configure()
509 bdma_stm32_clear_channel_irq(dev, id); in bdma_stm32_configure()
660 * the request ID is stored in the dma_slot in bdma_stm32_configure()
664 LL_BDMA_Init(bdma, bdma_stm32_id_to_channel(id), &BDMA_InitStruct); in bdma_stm32_configure()
666 LL_BDMA_EnableIT_TC(bdma, bdma_stm32_id_to_channel(id)); in bdma_stm32_configure()
670 LL_BDMA_EnableIT_HT(bdma, bdma_stm32_id_to_channel(id)); in bdma_stm32_configure()
676 BDMA_STM32_EXPORT_API int bdma_stm32_reload(const struct device *dev, uint32_t id, in bdma_stm32_reload() argument
684 if (id >= config->max_channels) { in bdma_stm32_reload()
688 channel = &config->channels[id]; in bdma_stm32_reload()
690 if (bdma_stm32_disable_channel(bdma, id) != 0) { in bdma_stm32_reload()
696 LL_BDMA_SetMemoryAddress(bdma, bdma_stm32_id_to_channel(id), src); in bdma_stm32_reload()
697 LL_BDMA_SetPeriphAddress(bdma, bdma_stm32_id_to_channel(id), dst); in bdma_stm32_reload()
701 LL_BDMA_SetPeriphAddress(bdma, bdma_stm32_id_to_channel(id), src); in bdma_stm32_reload()
702 LL_BDMA_SetMemoryAddress(bdma, bdma_stm32_id_to_channel(id), dst); in bdma_stm32_reload()
709 LL_BDMA_SetDataLength(bdma, bdma_stm32_id_to_channel(id), in bdma_stm32_reload()
712 LL_BDMA_SetDataLength(bdma, bdma_stm32_id_to_channel(id), in bdma_stm32_reload()
719 stm32_bdma_enable_channel(bdma, id); in bdma_stm32_reload()
724 BDMA_STM32_EXPORT_API int bdma_stm32_start(const struct device *dev, uint32_t id) in bdma_stm32_start() argument
731 if (id >= config->max_channels) { in bdma_stm32_start()
736 if (stm32_bdma_is_enabled_channel(bdma, id)) { in bdma_stm32_start()
741 channel = &config->channels[id]; in bdma_stm32_start()
744 bdma_stm32_clear_channel_irq(dev, id); in bdma_stm32_start()
745 stm32_bdma_enable_channel(bdma, id); in bdma_stm32_start()
750 BDMA_STM32_EXPORT_API int bdma_stm32_stop(const struct device *dev, uint32_t id) in bdma_stm32_stop() argument
753 struct bdma_stm32_channel *channel = &config->channels[id]; in bdma_stm32_stop()
756 if (id >= config->max_channels) { in bdma_stm32_stop()
761 if (!stm32_bdma_is_enabled_channel(bdma, id)) { in bdma_stm32_stop()
766 LL_BDMA_DisableIT_TC(bdma, bdma_stm32_id_to_channel(id)); in bdma_stm32_stop()
767 LL_BDMA_DisableIT_HT(bdma, bdma_stm32_id_to_channel(id)); in bdma_stm32_stop()
769 bdma_stm32_disable_channel(bdma, id); in bdma_stm32_stop()
770 bdma_stm32_clear_channel_irq(dev, id); in bdma_stm32_stop()
828 uint32_t id, struct dma_status *stat) in bdma_stm32_get_status() argument
834 if (id >= config->max_channels) { in bdma_stm32_get_status()
838 channel = &config->channels[id]; in bdma_stm32_get_status()
839 stat->pending_length = LL_BDMA_GetDataLength(bdma, bdma_stm32_id_to_channel(id)); in bdma_stm32_get_status()