Add static asserts and create slc.h header for descriptor struct
This commit is contained in:
parent
fd7745cdbc
commit
2b5d93baec
3 changed files with 45 additions and 28 deletions
|
@ -26,9 +26,11 @@ struct I2S_REGS {
|
|||
uint32_t volatile FIFO_CONF; // 0x20
|
||||
uint32_t volatile RX_EOF_NUM; // 0x24
|
||||
uint32_t volatile CONF_SINGLE_DATA; // 0x28
|
||||
uint32_t volatile CONF_CHANNELS; // 0x2c
|
||||
uint32_t volatile CONF_CHANNELS; // 0x2c
|
||||
};
|
||||
|
||||
_Static_assert(sizeof(struct I2S_REGS) == 0x30, "I2S_REGS is the wrong size");
|
||||
|
||||
/* Details for CONF register */
|
||||
|
||||
#define I2S_CONF_BCK_DIV_M 0x0000003f
|
||||
|
@ -120,9 +122,9 @@ struct I2S_REGS {
|
|||
#define I2S_FIFO_CONF_TX_FIFO_MOD_M 0x00000007
|
||||
#define I2S_FIFO_CONF_TX_FIFO_MOD_S 13
|
||||
#define I2S_FIFO_CONF_DESCRIPTOR_ENABLE BIT(12)
|
||||
#define I2S_FIFO_CONF_TX_DATA_NUM_M 0x0000003F
|
||||
#define I2S_FIFO_CONF_TX_DATA_NUM_M 0x0000003f
|
||||
#define I2S_FIFO_CONF_TX_DATA_NUM_S 6
|
||||
#define I2S_FIFO_CONF_RX_DATA_NUM_M 0x0000003F
|
||||
#define I2S_FIFO_CONF_RX_DATA_NUM_M 0x0000003f
|
||||
#define I2S_FIFO_CONF_RX_DATA_NUM_S 0
|
||||
|
||||
/* Details for CONF_CHANNEL register */
|
||||
|
|
37
core/include/esp/slc.h
Normal file
37
core/include/esp/slc.h
Normal file
|
@ -0,0 +1,37 @@
|
|||
/* esp/slc_regs.h
|
||||
*
|
||||
* ESP8266 SLC functions
|
||||
*/
|
||||
|
||||
#ifndef _ESP_SLC_H
|
||||
#define _ESP_SLC_H
|
||||
|
||||
#include "esp/slc_regs.h"
|
||||
|
||||
/* Memory layout for DMA transfer descriptors. */
|
||||
|
||||
struct SLCDescriptor
|
||||
{
|
||||
uint32_t flags;
|
||||
uint32_t buf_ptr;
|
||||
uint32_t next_link_ptr;
|
||||
};
|
||||
|
||||
#define SLC_DESCRIPTOR_FLAGS_BLOCKSIZE_M 0x00000fff
|
||||
#define SLC_DESCRIPTOR_FLAGS_BLOCKSIZE_S 0
|
||||
#define SLC_DESCRIPTOR_FLAGS_DATA_LENGTH_M 0x00000fff
|
||||
#define SLC_DESCRIPTOR_FLAGS_DATA_LENGTH_S 12
|
||||
#define SLC_DESCRIPTOR_FLAGS_SUB_SOF BIT(29)
|
||||
#define SLC_DESCRIPTOR_FLAGS_EOF BIT(30)
|
||||
#define SLC_DESCRIPTOR_FLAGS_OWNER BIT(31)
|
||||
|
||||
#define SLC_DESCRIPTOR_FLAGS(blocksize,datalen,sub_sof,eof,owner) ( \
|
||||
VAL2FIELD_M(SLC_DESCRIPTOR_FLAGS_BLOCKSIZE,blocksize)| \
|
||||
VAL2FIELD_M(SLC_DESCRIPTOR_FLAGS_DATA_LENGTH,datalen)| \
|
||||
((sub_sof)?SLC_DESCRIPTOR_FLAGS_SUB_SOF:0)| \
|
||||
((eof)?SLC_DESCRIPTOR_FLAGS_EOF:0)| \
|
||||
((owner)?SLC_DESCRIPTOR_FLAGS_OWNER:0) \
|
||||
)
|
||||
|
||||
|
||||
#endif /* _ESP_SLC_REGS_H */
|
|
@ -65,6 +65,8 @@ struct SLC_REGS {
|
|||
uint32_t volatile HOST_CONF_W5; // 0xbc
|
||||
};
|
||||
|
||||
_Static_assert(sizeof(struct SLC_REGS) == 0xc0, "SLC_REGS is the wrong size");
|
||||
|
||||
/* Details for CONF0 register */
|
||||
|
||||
#define SLC_CONF0_MODE_M 0x00000003
|
||||
|
@ -269,7 +271,7 @@ struct SLC_REGS {
|
|||
#define SLC_SDIO_STATUS_BUS_M 0x00000007
|
||||
#define SLC_SDIO_STATUS_BUS_S 12
|
||||
#define SLC_SDIO_STATUS_WAKEUP BIT(8)
|
||||
#define SLC_SDIO_STATUS_FUNC_M 0x0000000F
|
||||
#define SLC_SDIO_STATUS_FUNC_M 0x0000000f
|
||||
#define SLC_SDIO_STATUS_FUNC_S 4
|
||||
#define SLC_SDIO_STATUS_COMMAND_M 0x00000007
|
||||
#define SLC_SDIO_STATUS_COMMAND_S 0
|
||||
|
@ -284,28 +286,4 @@ struct SLC_REGS {
|
|||
#define SLC_RX_DESCRIPTOR_CONF_POP_IDLE_COUNT_M 0x0000ffff
|
||||
#define SLC_RX_DESCRIPTOR_CONF_POP_IDLE_COUNT_S 0
|
||||
|
||||
struct SLCDescriptor
|
||||
{
|
||||
uint32_t flags;
|
||||
uint32_t buf_ptr;
|
||||
uint32_t next_link_ptr;
|
||||
};
|
||||
|
||||
#define SLC_DESCRIPTOR_FLAGS_BLOCKSIZE_M 0x00000fff
|
||||
#define SLC_DESCRIPTOR_FLAGS_BLOCKSIZE_S 0
|
||||
#define SLC_DESCRIPTOR_FLAGS_DATA_LENGTH_M 0x00000fff
|
||||
#define SLC_DESCRIPTOR_FLAGS_DATA_LENGTH_S 12
|
||||
#define SLC_DESCRIPTOR_FLAGS_SUB_SOF BIT(29)
|
||||
#define SLC_DESCRIPTOR_FLAGS_EOF BIT(30)
|
||||
#define SLC_DESCRIPTOR_FLAGS_OWNER BIT(31)
|
||||
|
||||
#define SLC_DESCRIPTOR_FLAGS(blocksize,datalen,sub_sof,eof,owner) ( \
|
||||
(((blocksize)&SLC_DESCRIPTOR_FLAGS_BLOCKSIZE_M)<<SLC_DESCRIPTOR_FLAGS_BLOCKSIZE_S)| \
|
||||
(((datalen)&SLC_DESCRIPTOR_FLAGS_DATA_LENGTH_M)<<SLC_DESCRIPTOR_FLAGS_DATA_LENGTH_S)| \
|
||||
((sub_sof)?SLC_DESCRIPTOR_FLAGS_SUB_SOF:0)| \
|
||||
((eof)?SLC_DESCRIPTOR_FLAGS_EOF:0)| \
|
||||
((owner)?SLC_DESCRIPTOR_FLAGS_OWNER:0) \
|
||||
)
|
||||
|
||||
|
||||
#endif /* _ESP_SLC_REGS_H */
|
||||
|
|
Loading…
Reference in a new issue