@@ -60,7 +60,7 @@ extern "C" {
6060 [I2S_DIR_RX - 1] = { \
6161 [I2S_ETM_TASK_START] = I2S0_TASK_START_RX, \
6262 [I2S_ETM_TASK_STOP] = I2S0_TASK_STOP_RX, \
63- [I2S_ETM_TASK_SYNC_CHECK] = I2S0_TASK_SYNC_CHECK , \
63+ [I2S_ETM_TASK_SYNC_CHECK] = -1 , \
6464 }, \
6565 [I2S_DIR_TX - 1] = { \
6666 [I2S_ETM_TASK_START] = I2S0_TASK_START_TX, \
@@ -1245,6 +1245,113 @@ static inline uint32_t i2s_ll_tx_get_bclk_sync_count(i2s_dev_t *hw)
12451245 return hw -> bck_cnt .tx_bck_cnt ;
12461246}
12471247
1248+ /**
1249+ * @brief Enable TX FIFO synchronization hardware mode
1250+ *
1251+ * @param hw Peripheral I2S hardware instance address.
1252+ * @param enable Set true to enable hardware mode
1253+ */
1254+ __attribute__((always_inline ))
1255+ static inline void i2s_ll_tx_enable_hw_fifo_sync (i2s_dev_t * hw , bool enable )
1256+ {
1257+ hw -> hw_sync_conf .tx_hw_sync_en = enable ;
1258+ }
1259+
1260+ /**
1261+ * @brief Get TX FIFO synchronization difference count value
1262+ *
1263+ * @param hw Peripheral I2S hardware instance address.
1264+ * @return
1265+ * fifo count value
1266+ */
1267+ __attribute__((always_inline ))
1268+ static inline uint32_t i2s_ll_tx_get_fifo_sync_diff_count (i2s_dev_t * hw )
1269+ {
1270+ return hw -> cnt_diff .tx_cnt_diff ;
1271+ }
1272+
1273+ /**
1274+ * @brief Reset TX FIFO synchronization difference counter
1275+ *
1276+ * @param hw Peripheral I2S hardware instance address.
1277+ */
1278+ __attribute__((always_inline ))
1279+ static inline void i2s_ll_tx_reset_fifo_sync_diff_counter (i2s_dev_t * hw )
1280+ {
1281+ hw -> cnt_diff .tx_cnt_diff_rst = 1 ;
1282+ hw -> cnt_diff .tx_cnt_diff_rst = 0 ;
1283+ }
1284+
1285+ /**
1286+ * @brief Set TX FIFO synchronization difference counter software threshold
1287+ * @note It determines the up threshold that the hardware synchronize the data automatically.
1288+ * - If diff_count <= sw_threshold, the hardware will synchronize the data automatically.
1289+ * - If diff_count > sw_threshold, the automatic synchronization is not proper for this case,
1290+ * interrupt will be triggered to let the software decide how to handle this case.
1291+ *
1292+ * @param hw Peripheral I2S hardware instance address.
1293+ * @param thresh The threshold that send
1294+ */
1295+ __attribute__((always_inline ))
1296+ static inline void i2s_ll_tx_set_fifo_sync_diff_conter_sw_threshold (i2s_dev_t * hw , uint32_t thresh )
1297+ {
1298+ hw -> sync_sw_thres .tx_cnt_diff_sw_thres = thresh ;
1299+ }
1300+
1301+ /**
1302+ * @brief Set TX FIFO synchronization difference counter hardware threshold
1303+ * @note It determines the down threshold that the hardware synchronize the data automatically.
1304+ * - If diff_count < hw_threshold, synchronization check pass, do nothing
1305+ * - If diff_count >= hw_threshold, the hardware will synchronize the data automatically.
1306+ *
1307+ * @param hw Peripheral I2S hardware instance address.
1308+ * @param thresh The threshold that send
1309+ */
1310+ __attribute__((always_inline ))
1311+ static inline void i2s_ll_tx_set_fifo_sync_diff_conter_hw_threshold (i2s_dev_t * hw , uint32_t thresh )
1312+ {
1313+ hw -> sync_hw_thres .tx_cnt_diff_hw_thres = thresh ;
1314+ }
1315+
1316+ /**
1317+ * @brief Set TX FIFO synchronization hardware data supplementation mode
1318+ * @note It determines the supplementation data when the actual sent data is less than the `diff_count - threshold`
1319+ *
1320+ * @param hw Peripheral I2S hardware instance address.
1321+ * @param mode Data supplementation mode
1322+ * - 0: Supplement the last data
1323+ * - 1: Supplement the data configured in `hw_sync_data` reg
1324+ */
1325+ __attribute__((always_inline ))
1326+ static inline void i2s_ll_tx_set_hw_fifo_sync_suppl_mode (i2s_dev_t * hw , uint32_t mode )
1327+ {
1328+ hw -> hw_sync_conf .tx_hw_sync_suppl_mode = mode ;
1329+ }
1330+
1331+ /**
1332+ * @brief Set TX FIFO synchronization hardware supplementation data when `tx_hw_sync_suppl_mode` is 1
1333+ *
1334+ * @param hw Peripheral I2S hardware instance address.
1335+ * @param data Data to be supplemented when `tx_hw_sync_suppl_mode` is 1
1336+ */
1337+ __attribute__((always_inline ))
1338+ static inline void i2s_ll_tx_set_hw_fifo_sync_static_suppl_data (i2s_dev_t * hw , uint32_t data )
1339+ {
1340+ hw -> hw_sync_data .tx_hw_sync_suppl_data = data ;
1341+ }
1342+
1343+ /**
1344+ * @brief Set the TX ETM synchronization ideal count
1345+ *
1346+ * @param hw Peripheral I2S hardware instance address.
1347+ * @param ideal_cnt The ideal FIFO count when I2S_ETM_TASK_SYNC_CHECK triggered.
1348+ */
1349+ __attribute__((always_inline ))
1350+ static inline void i2s_ll_tx_set_etm_sync_ideal_cnt (i2s_dev_t * hw , uint32_t ideal_cnt )
1351+ {
1352+ hw -> ideal_cnt .tx_ideal_cnt = ideal_cnt ;
1353+ }
1354+
12481355/**
12491356 * @brief Set the TX ETM threshold of REACH_THRESH event
12501357 *
0 commit comments