i2s_dma: Implementation of I2S + DMA wrapper library
This commit is contained in:
parent
3dcc4f14a9
commit
27135d6252
6 changed files with 322 additions and 3 deletions
|
@ -37,6 +37,14 @@
|
|||
#define VAL2FIELD_M(fieldname, value) (((value) & fieldname##_M) << fieldname##_S)
|
||||
#define SET_FIELD_M(regbits, fieldname, value) (((regbits) & ~FIELD_MASK(fieldname)) | VAL2FIELD_M(fieldname, value))
|
||||
|
||||
/* Set bits in reg with specified mask.
|
||||
*/
|
||||
#define SET_MASK_BITS(reg, mask) (reg) |= (mask)
|
||||
|
||||
/* Clear bits in reg with specified mask
|
||||
*/
|
||||
#define CLEAR_MASK_BITS(reg, mask) (reg) &= ~(mask)
|
||||
|
||||
/* Use the IRAM macro to place functions into Instruction RAM (IRAM)
|
||||
instead of flash (aka irom).
|
||||
|
||||
|
|
|
@ -43,10 +43,17 @@ inline static esp_reg_t gpio_iomux_reg(const uint8_t gpio_number)
|
|||
return &(IOMUX.PIN[gpio_to_iomux(gpio_number)]);
|
||||
}
|
||||
|
||||
inline static void iomux_set_function(uint8_t iomux_num, uint32_t func)
|
||||
/**
|
||||
* Set IOMUX function.
|
||||
*
|
||||
* @param iomux_num Index of IOMUX register. Can be converted from GPIO number
|
||||
* with gpio_to_iomux.
|
||||
* @param iomux_func GPIO function definition IOMUX_GPIOn_FUNC_*
|
||||
*/
|
||||
inline static void iomux_set_function(uint8_t iomux_num, uint32_t iomux_func)
|
||||
{
|
||||
uint32_t prev = IOMUX.PIN[iomux_num] & ~IOMUX_PIN_FUNC_MASK;
|
||||
IOMUX.PIN[iomux_num] = IOMUX_FUNC(func) | prev;
|
||||
IOMUX.PIN[iomux_num] = iomux_func | prev;
|
||||
}
|
||||
|
||||
inline static void iomux_set_direction_flags(uint8_t iomux_num, uint32_t dir_flags)
|
||||
|
@ -76,7 +83,7 @@ inline static void iomux_set_gpio_function(uint8_t gpio_number, bool output_enab
|
|||
{
|
||||
const uint8_t iomux_num = gpio_to_iomux(gpio_number);
|
||||
const uint32_t func = iomux_num > 11 ? 0 : 3;
|
||||
iomux_set_function(iomux_num, func);
|
||||
iomux_set_function(iomux_num, IOMUX_FUNC(func));
|
||||
iomux_set_direction_flags(iomux_num, output_enable ? IOMUX_PIN_OUTPUT_ENABLE : 0);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue