Lines Matching refs:rmt_contex
49 #define RMT_ENTER_CRITICAL() portENTER_CRITICAL_SAFE(&(rmt_contex.rmt_spinlock))
50 #define RMT_EXIT_CRITICAL() portEXIT_CRITICAL_SAFE(&(rmt_contex.rmt_spinlock))
99 static rmt_contex_t rmt_contex = { variable
124 if (rmt_contex.rmt_module_enabled == false) { in rmt_module_enable()
127 rmt_contex.rmt_module_enabled = true; in rmt_module_enable()
136 if (rmt_contex.rmt_module_enabled == true) { in rmt_module_disable()
138 rmt_contex.rmt_module_enabled = false; in rmt_module_disable()
148 … rmt_ll_rx_set_channel_clock_div(rmt_contex.hal.regs, RMT_DECODE_RX_CHANNEL(channel), div_cnt); in rmt_set_clk_div()
150 rmt_ll_tx_set_channel_clock_div(rmt_contex.hal.regs, channel, div_cnt); in rmt_set_clk_div()
162 …*div_cnt = (uint8_t)rmt_ll_rx_get_channel_clock_div(rmt_contex.hal.regs, RMT_DECODE_RX_CHANNEL(cha… in rmt_get_clk_div()
164 *div_cnt = (uint8_t)rmt_ll_tx_get_channel_clock_div(rmt_contex.hal.regs, channel); in rmt_get_clk_div()
174 rmt_ll_rx_set_idle_thres(rmt_contex.hal.regs, RMT_DECODE_RX_CHANNEL(channel), thresh); in rmt_set_rx_idle_thresh()
184 … *thresh = (uint16_t)rmt_ll_rx_get_idle_thres(rmt_contex.hal.regs, RMT_DECODE_RX_CHANNEL(channel)); in rmt_get_rx_idle_thresh()
195 rmt_ll_rx_set_mem_blocks(rmt_contex.hal.regs, RMT_DECODE_RX_CHANNEL(channel), rmt_mem_num); in rmt_set_mem_block_num()
197 rmt_ll_tx_set_mem_blocks(rmt_contex.hal.regs, channel, rmt_mem_num); in rmt_set_mem_block_num()
209 …*rmt_mem_num = (uint8_t)rmt_ll_rx_get_mem_blocks(rmt_contex.hal.regs, RMT_DECODE_RX_CHANNEL(channe… in rmt_get_mem_block_num()
211 *rmt_mem_num = (uint8_t)rmt_ll_tx_get_mem_blocks(rmt_contex.hal.regs, channel); in rmt_get_mem_block_num()
223 rmt_ll_tx_set_carrier_high_low_ticks(rmt_contex.hal.regs, channel, high_level, low_level); in rmt_set_tx_carrier()
224 rmt_ll_tx_set_carrier_level(rmt_contex.hal.regs, channel, carrier_level); in rmt_set_tx_carrier()
225 rmt_ll_tx_enable_carrier_modulation(rmt_contex.hal.regs, channel, carrier_en); in rmt_set_tx_carrier()
234 rmt_ll_power_down_mem(rmt_contex.hal.regs, pd_en); in rmt_set_mem_pd()
243 *pd_en = rmt_ll_is_mem_power_down(rmt_contex.hal.regs); in rmt_get_mem_pd()
253 rmt_ll_tx_reset_pointer(rmt_contex.hal.regs, channel); in rmt_tx_start()
255 rmt_ll_clear_tx_end_interrupt(rmt_contex.hal.regs, channel); in rmt_tx_start()
257 if (!rmt_ll_is_tx_loop_enabled(rmt_contex.hal.regs, channel)) { in rmt_tx_start()
258 rmt_ll_enable_tx_end_interrupt(rmt_contex.hal.regs, channel, true); in rmt_tx_start()
261 rmt_ll_tx_reset_loop(rmt_contex.hal.regs, channel); in rmt_tx_start()
262 rmt_ll_tx_enable_loop_count(rmt_contex.hal.regs, channel, true); in rmt_tx_start()
263 rmt_ll_clear_tx_loop_interrupt(rmt_contex.hal.regs, channel); in rmt_tx_start()
264 rmt_ll_enable_tx_loop_interrupt(rmt_contex.hal.regs, channel, true); in rmt_tx_start()
267 rmt_ll_tx_start(rmt_contex.hal.regs, channel); in rmt_tx_start()
276 rmt_ll_tx_stop(rmt_contex.hal.regs, channel); in rmt_tx_stop()
277 rmt_ll_tx_reset_pointer(rmt_contex.hal.regs, channel); in rmt_tx_stop()
286 rmt_ll_rx_enable(rmt_contex.hal.regs, RMT_DECODE_RX_CHANNEL(channel), false); in rmt_rx_start()
288 rmt_ll_rx_reset_pointer(rmt_contex.hal.regs, RMT_DECODE_RX_CHANNEL(channel)); in rmt_rx_start()
290 rmt_ll_clear_rx_end_interrupt(rmt_contex.hal.regs, RMT_DECODE_RX_CHANNEL(channel)); in rmt_rx_start()
291 rmt_ll_enable_rx_end_interrupt(rmt_contex.hal.regs, RMT_DECODE_RX_CHANNEL(channel), true); in rmt_rx_start()
294 …const uint32_t item_block_len = rmt_ll_rx_get_mem_blocks(rmt_contex.hal.regs, RMT_DECODE_RX_CHANNE… in rmt_rx_start()
300 rmt_ll_rx_enable(rmt_contex.hal.regs, RMT_DECODE_RX_CHANNEL(channel), true); in rmt_rx_start()
309 rmt_ll_enable_rx_end_interrupt(rmt_contex.hal.regs, RMT_DECODE_RX_CHANNEL(channel), false); in rmt_rx_stop()
310 rmt_ll_rx_enable(rmt_contex.hal.regs, RMT_DECODE_RX_CHANNEL(channel), false); in rmt_rx_stop()
311 rmt_ll_rx_reset_pointer(rmt_contex.hal.regs, RMT_DECODE_RX_CHANNEL(channel)); in rmt_rx_stop()
313 rmt_ll_enable_rx_thres_interrupt(rmt_contex.hal.regs, RMT_DECODE_RX_CHANNEL(channel), false); in rmt_rx_stop()
323 rmt_ll_tx_reset_pointer(rmt_contex.hal.regs, channel); in rmt_tx_memory_reset()
332 rmt_ll_rx_reset_pointer(rmt_contex.hal.regs, RMT_DECODE_RX_CHANNEL(channel)); in rmt_rx_memory_reset()
342 rmt_ll_rx_set_mem_owner(rmt_contex.hal.regs, RMT_DECODE_RX_CHANNEL(channel), owner); in rmt_set_memory_owner()
352 …*owner = (rmt_mem_owner_t)rmt_ll_rx_get_mem_owner(rmt_contex.hal.regs, RMT_DECODE_RX_CHANNEL(chann… in rmt_get_memory_owner()
361 rmt_ll_tx_enable_loop(rmt_contex.hal.regs, channel, loop_en); in rmt_set_tx_loop_mode()
370 *loop_en = rmt_ll_is_tx_loop_enabled(rmt_contex.hal.regs, channel); in rmt_get_tx_loop_mode()
379 rmt_ll_rx_enable_filter(rmt_contex.hal.regs, RMT_DECODE_RX_CHANNEL(channel), rx_filter_en); in rmt_set_rx_filter()
380 rmt_ll_rx_set_filter_thres(rmt_contex.hal.regs, RMT_DECODE_RX_CHANNEL(channel), thresh); in rmt_set_rx_filter()
390 rmt_ll_set_group_clock_src(rmt_contex.hal.regs, channel, base_clk, 0, 0, 0); in rmt_set_source_clk()
399 *src_clk = (rmt_source_clk_t)rmt_ll_get_group_clock_src(rmt_contex.hal.regs, channel); in rmt_get_source_clk()
409 rmt_ll_tx_enable_idle(rmt_contex.hal.regs, channel, idle_out_en); in rmt_set_idle_level()
410 rmt_ll_tx_set_idle_level(rmt_contex.hal.regs, channel, level); in rmt_set_idle_level()
419 *idle_out_en = rmt_ll_is_tx_idle_enabled(rmt_contex.hal.regs, channel); in rmt_get_idle_level()
420 *level = rmt_ll_tx_get_idle_level(rmt_contex.hal.regs, channel); in rmt_get_idle_level()
430 *status = rmt_ll_rx_get_channel_status(rmt_contex.hal.regs, RMT_DECODE_RX_CHANNEL(channel)); in rmt_get_status()
432 *status = rmt_ll_tx_get_channel_status(rmt_contex.hal.regs, channel); in rmt_get_status()
441 rmt_ll_enable_interrupt(rmt_contex.hal.regs, mask, true); in rmt_set_intr_enable_mask()
448 rmt_ll_enable_interrupt(rmt_contex.hal.regs, mask, false); in rmt_clr_intr_enable_mask()
456 rmt_ll_enable_rx_end_interrupt(rmt_contex.hal.regs, RMT_DECODE_RX_CHANNEL(channel), en); in rmt_set_rx_intr_en()
466 …uint32_t item_block_len = rmt_ll_rx_get_mem_blocks(rmt_contex.hal.regs, RMT_DECODE_RX_CHANNEL(chan… in rmt_set_rx_thr_intr_en()
469 rmt_ll_rx_set_limit(rmt_contex.hal.regs, RMT_DECODE_RX_CHANNEL(channel), evt_thresh); in rmt_set_rx_thr_intr_en()
470 rmt_ll_enable_rx_thres_interrupt(rmt_contex.hal.regs, RMT_DECODE_RX_CHANNEL(channel), true); in rmt_set_rx_thr_intr_en()
474 … rmt_ll_enable_rx_thres_interrupt(rmt_contex.hal.regs, RMT_DECODE_RX_CHANNEL(channel), false); in rmt_set_rx_thr_intr_en()
486 rmt_ll_enable_rx_err_interrupt(rmt_contex.hal.regs, RMT_DECODE_RX_CHANNEL(channel), en); in rmt_set_err_intr_en()
488 rmt_ll_enable_tx_err_interrupt(rmt_contex.hal.regs, channel, en); in rmt_set_err_intr_en()
498 rmt_ll_enable_tx_end_interrupt(rmt_contex.hal.regs, channel, en); in rmt_set_tx_intr_en()
507 …uint32_t item_block_len = rmt_ll_tx_get_mem_blocks(rmt_contex.hal.regs, channel) * RMT_MEM_ITEM_NU… in rmt_set_tx_thr_intr_en()
510 rmt_ll_tx_set_limit(rmt_contex.hal.regs, channel, evt_thresh); in rmt_set_tx_thr_intr_en()
511 rmt_ll_enable_tx_thres_interrupt(rmt_contex.hal.regs, channel, true); in rmt_set_tx_thr_intr_en()
515 rmt_ll_enable_tx_thres_interrupt(rmt_contex.hal.regs, channel, false); in rmt_set_tx_thr_intr_en()
696 rmt_ll_write_memory(rmt_contex.hal.mem, channel, item, item_num, mem_offset); in rmt_fill_memory()
707 uint8_t mem_cnt = rmt_ll_tx_get_mem_blocks(rmt_contex.hal.regs, channel); in rmt_fill_tx_items()
716 …ESP_RETURN_ON_FALSE(rmt_contex.rmt_driver_channels == 0, ESP_FAIL, TAG, "RMT driver installed, can… in rmt_isr_register()
728 int block_num = rmt_ll_rx_get_mem_blocks(rmt_contex.hal.regs, channel); in rmt_rx_get_mem_len_in_isr()
758 rmt_ll_tx_reset_pointer(rmt_contex.hal.regs, channel); in rmt_driver_isr_default()
765 if (rmt_contex.rmt_tx_end_callback.function) { in rmt_driver_isr_default()
766 … rmt_contex.rmt_tx_end_callback.function(channel, rmt_contex.rmt_tx_end_callback.arg); in rmt_driver_isr_default()
804 rmt_ll_write_memory(rmt_contex.hal.mem, channel, &stop_data, 1, p_rmt->tx_offset); in rmt_driver_isr_default()
808 … rmt_ll_write_memory(rmt_contex.hal.mem, channel, &stop_data, 1, p_rmt->tx_offset + len_rem); in rmt_driver_isr_default()
828 rmt_ll_rx_enable(rmt_contex.hal.regs, channel, false); in rmt_driver_isr_default()
830 rmt_ll_rx_set_mem_owner(rmt_contex.hal.regs, channel, RMT_MEM_OWNER_SW); in rmt_driver_isr_default()
855 rmt_ll_rx_reset_pointer(rmt_contex.hal.regs, channel); in rmt_driver_isr_default()
856 rmt_ll_rx_set_mem_owner(rmt_contex.hal.regs, channel, RMT_MEM_OWNER_HW); in rmt_driver_isr_default()
857 rmt_ll_rx_enable(rmt_contex.hal.regs, channel, true); in rmt_driver_isr_default()
869 … int mem_item_size = rmt_ll_rx_get_mem_blocks(rmt_contex.hal.regs, channel) * RMT_MEM_ITEM_NUM; in rmt_driver_isr_default()
870 int rx_thres_lim = rmt_ll_rx_get_limit(rmt_contex.hal.regs, channel); in rmt_driver_isr_default()
873 rmt_ll_rx_set_mem_owner(rmt_contex.hal.regs, channel, RMT_MEM_OWNER_SW); in rmt_driver_isr_default()
875 rmt_ll_rx_set_mem_owner(rmt_contex.hal.regs, channel, RMT_MEM_OWNER_HW); in rmt_driver_isr_default()
899 rmt_ll_tx_stop(rmt_contex.hal.regs, channel); in rmt_driver_isr_default()
900 rmt_ll_tx_reset_pointer(rmt_contex.hal.regs, channel); in rmt_driver_isr_default()
904 if (rmt_contex.rmt_tx_end_callback.function) { in rmt_driver_isr_default()
905 … rmt_contex.rmt_tx_end_callback.function(channel, rmt_contex.rmt_tx_end_callback.arg); in rmt_driver_isr_default()
920 rmt_ll_rx_reset_pointer(rmt_contex.hal.regs, channel); in rmt_driver_isr_default()
922 … ESP_EARLY_LOGD(TAG, "status: 0x%08x", rmt_ll_rx_get_channel_status(rmt_contex.hal.regs, channel)); in rmt_driver_isr_default()
935 rmt_ll_tx_reset_pointer(rmt_contex.hal.regs, channel); in rmt_driver_isr_default()
937 … ESP_EARLY_LOGD(TAG, "status: 0x%08x", rmt_ll_tx_get_channel_status(rmt_contex.hal.regs, channel)); in rmt_driver_isr_default()
951 …ESP_RETURN_ON_FALSE(rmt_contex.rmt_driver_channels & BIT(channel), ESP_ERR_INVALID_STATE, TAG, "No… in rmt_driver_uninstall()
963 rmt_ll_enable_rx_end_interrupt(rmt_contex.hal.regs, RMT_DECODE_RX_CHANNEL(channel), 0); in rmt_driver_uninstall()
964 rmt_ll_enable_rx_err_interrupt(rmt_contex.hal.regs, RMT_DECODE_RX_CHANNEL(channel), 0); in rmt_driver_uninstall()
966 rmt_ll_enable_rx_thres_interrupt(rmt_contex.hal.regs, RMT_DECODE_RX_CHANNEL(channel), 0); in rmt_driver_uninstall()
969 rmt_ll_enable_tx_end_interrupt(rmt_contex.hal.regs, channel, 0); in rmt_driver_uninstall()
970 rmt_ll_enable_tx_err_interrupt(rmt_contex.hal.regs, channel, 0); in rmt_driver_uninstall()
971 rmt_ll_enable_tx_thres_interrupt(rmt_contex.hal.regs, channel, false); in rmt_driver_uninstall()
975 _lock_acquire_recursive(&(rmt_contex.rmt_driver_isr_lock)); in rmt_driver_uninstall()
976 rmt_contex.rmt_driver_channels &= ~BIT(channel); in rmt_driver_uninstall()
977 if (rmt_contex.rmt_driver_channels == 0) { in rmt_driver_uninstall()
980 err = rmt_isr_deregister(rmt_contex.rmt_driver_intr_handle); in rmt_driver_uninstall()
981 rmt_contex.rmt_driver_intr_handle = NULL; in rmt_driver_uninstall()
983 _lock_release_recursive(&(rmt_contex.rmt_driver_isr_lock)); in rmt_driver_uninstall()
1020 …ESP_RETURN_ON_FALSE((rmt_contex.rmt_driver_channels & BIT(channel)) == 0, ESP_ERR_INVALID_STATE, T… in rmt_driver_install()
1089 _lock_acquire_recursive(&(rmt_contex.rmt_driver_isr_lock)); in rmt_driver_install()
1091 if (rmt_contex.rmt_driver_channels == 0) { in rmt_driver_install()
1093 …err = rmt_isr_register(rmt_driver_isr_default, &rmt_contex.hal, intr_alloc_flags, &(rmt_contex.rmt… in rmt_driver_install()
1096 rmt_contex.rmt_driver_channels |= BIT(channel); in rmt_driver_install()
1098 _lock_release_recursive(&(rmt_contex.rmt_driver_isr_lock)); in rmt_driver_install()
1103 rmt_hal_rx_channel_reset(&rmt_contex.hal, RMT_DECODE_RX_CHANNEL(channel)); in rmt_driver_install()
1105 rmt_hal_tx_channel_reset(&rmt_contex.hal, channel); in rmt_driver_install()
1126 int block_num = rmt_ll_tx_get_mem_blocks(rmt_contex.hal.regs, channel); in rmt_write_items()
1144 rmt_ll_write_memory(rmt_contex.hal.mem, channel, &stop_data, 1, len_rem); in rmt_write_items()
1151 if (rmt_ll_is_tx_loop_enabled(rmt_contex.hal.regs, channel)) { in rmt_write_items()
1193 rmt_tx_end_callback_t previous = rmt_contex.rmt_tx_end_callback; in rmt_register_tx_end_callback()
1194 rmt_contex.rmt_tx_end_callback.function = function; in rmt_register_tx_end_callback()
1195 rmt_contex.rmt_tx_end_callback.arg = arg; in rmt_register_tx_end_callback()
1204 const uint32_t block_size = rmt_ll_tx_get_mem_blocks(rmt_contex.hal.regs, channel) * in rmt_translator_init()
1265 …const uint32_t item_block_len = rmt_ll_tx_get_mem_blocks(rmt_contex.hal.regs, channel) * RMT_MEM_I… in rmt_write_sample()
1280 rmt_ll_write_memory(rmt_contex.hal.mem, channel, &stop_data, 1, p_rmt->tx_len_rem); in rmt_write_sample()
1325 …*clock_hz = rmt_source_clk_hz / rmt_ll_rx_get_channel_clock_div(rmt_contex.hal.regs, RMT_DECODE_RX… in rmt_get_counter_clock()
1327 … *clock_hz = rmt_source_clk_hz / rmt_ll_tx_get_channel_clock_div(rmt_contex.hal.regs, channel); in rmt_get_counter_clock()
1338 rmt_ll_tx_enable_sync(rmt_contex.hal.regs, true); in rmt_add_channel_to_group()
1339 rmt_contex.synchro_channel_mask |= (1 << channel); in rmt_add_channel_to_group()
1340 rmt_ll_tx_add_to_sync_group(rmt_contex.hal.regs, channel); in rmt_add_channel_to_group()
1341 rmt_ll_tx_reset_channels_clock_div(rmt_contex.hal.regs, rmt_contex.synchro_channel_mask); in rmt_add_channel_to_group()
1350 rmt_contex.synchro_channel_mask &= ~(1 << channel); in rmt_remove_channel_from_group()
1351 rmt_ll_tx_remove_from_sync_group(rmt_contex.hal.regs, channel); in rmt_remove_channel_from_group()
1352 if (rmt_contex.synchro_channel_mask == 0) { in rmt_remove_channel_from_group()
1353 rmt_ll_tx_enable_sync(rmt_contex.hal.regs, false); in rmt_remove_channel_from_group()
1365 rmt_ll_rx_reset_pointer(rmt_contex.hal.regs, RMT_DECODE_RX_CHANNEL(channel)); in rmt_memory_rw_rst()
1367 rmt_ll_tx_reset_pointer(rmt_contex.hal.regs, channel); in rmt_memory_rw_rst()
1379 rmt_ll_tx_set_loop_count(rmt_contex.hal.regs, channel, count); in rmt_set_tx_loop_count()
1390 rmt_ll_tx_enable_loop_autostop(rmt_contex.hal.regs, channel, en); in rmt_enable_tx_loop_autostop()