Skip to content

Commit a7cbda5

Browse files
committed
Merge branch 'bugfix/fix_spi_doxygen_generation_problem' into 'master'
bugfix(spi): fix doxygen generation problem See merge request sdk/ESP8266_RTOS_SDK!752
2 parents 63b4aff + c39f73f commit a7cbda5

File tree

2 files changed

+47
-32
lines changed

2 files changed

+47
-32
lines changed

components/esp8266/driver/spi.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ static const char *TAG = "spi";
4646
#define spi_intr_disable() _xt_isr_mask(1 << ETS_SPI_INUM)
4747
#define spi_intr_register(a, b) _xt_isr_attach(ETS_SPI_INUM, (a), (b))
4848

49-
// SPI interrupt status register address definition for determining the interrupt source
49+
/* SPI interrupt status register address definition for determining the interrupt source */
5050
#define DPORT_SPI_INT_STATUS_REG 0x3ff00020
5151
#define DPORT_SPI_INT_STATUS_SPI0 BIT4
5252
#define DPORT_SPI_INT_STATUS_SPI1 BIT7
@@ -60,7 +60,7 @@ typedef struct {
6060

6161
static spi_object_t *spi_object[SPI_NUM_MAX] = {NULL, NULL};
6262

63-
// DRAM_ATTR is required to avoid SPI array placed in flash, due to accessed from ISR
63+
/* DRAM_ATTR is required to avoid SPI array placed in flash, due to accessed from ISR */
6464
static DRAM_ATTR spi_dev_t *const SPI[SPI_NUM_MAX] = {&SPI0, &SPI1};
6565

6666
esp_err_t spi_get_clk_div(spi_host_t host, spi_clk_div_t *clk_div)

components/esp8266/include/driver/spi.h

+45-30
Original file line numberDiff line numberDiff line change
@@ -23,42 +23,42 @@ extern "C" {
2323

2424
#define SPI_NUM_MAX 2
2525

26-
// SPI bus CPOL and CPHA definition
26+
/* SPI bus CPOL and CPHA definition */
2727
#define SPI_CPOL_LOW 0
2828
#define SPI_CPOL_HIGH 1
2929
#define SPI_CPHA_LOW 0
3030
#define SPI_CPHA_HIGH 1
3131

32-
// SPI bus data sequence definition
32+
/* SPI bus data sequence definition */
3333
#define SPI_BIT_ORDER_MSB_FIRST 1
3434
#define SPI_BIT_ORDER_LSB_FIRST 0
3535
#define SPI_BYTE_ORDER_MSB_FIRST 1
3636
#define SPI_BYTE_ORDER_LSB_FIRST 0
3737

38-
// SPI default bus interface parameter definition
39-
// CS_EN:1, MISO_EN:1, MOSI_EN:1, BYTE_TX_ORDER:1, BYTE_TX_ORDER:1, BIT_RX_ORDER:0, BIT_TX_ORDER:0, CPHA:0, CPOL:0
40-
#define SPI_DEFAULT_INTERFACE 0x1F0
38+
/* SPI default bus interface parameter definition */
39+
#define SPI_DEFAULT_INTERFACE 0x1F0 /* CS_EN:1, MISO_EN:1, MOSI_EN:1, BYTE_TX_ORDER:1, BYTE_TX_ORDER:1, BIT_RX_ORDER:0, BIT_TX_ORDER:0, CPHA:0, CPOL:0 */
4140

42-
// SPI master default interrupt enable definition
43-
// TRANS_DONE: true, WRITE_STATUS: false, READ_STATUS: false, WRITE_BUFFER: false, READ_BUFFER: false
44-
#define SPI_MASTER_DEFAULT_INTR_ENABLE 0x10
41+
/* SPI master default interrupt enable definition */
42+
#define SPI_MASTER_DEFAULT_INTR_ENABLE 0x10 /* TRANS_DONE: true, WRITE_STATUS: false, READ_STATUS: false, WRITE_BUFFER: false, READ_BUFFER: false */
4543

46-
// SPI slave default interrupt enable definition
47-
// TRANS_DONE: false, WRITE_STATUS: true, READ_STATUS: true, WRITE_BUFFER: true, READ_BUFFER: ture
48-
#define SPI_SLAVE_DEFAULT_INTR_ENABLE 0x0F
44+
/* SPI slave default interrupt enable definition */
45+
#define SPI_SLAVE_DEFAULT_INTR_ENABLE 0x0F /* TRANS_DONE: false, WRITE_STATUS: true, READ_STATUS: true, WRITE_BUFFER: true, READ_BUFFER: ture */
4946

50-
// SPI event definition
47+
/* SPI event definition */
5148
#define SPI_INIT_EVENT 0
5249
#define SPI_TRANS_START_EVENT 1
5350
#define SPI_TRANS_DONE_EVENT 2
5451
#define SPI_DEINIT_EVENT 3
5552

53+
/* SPI data cmd definition */
5654
#define SPI_MASTER_WRITE_DATA_TO_SLAVE_CMD 2
5755
#define SPI_MASTER_READ_DATA_FROM_SLAVE_CMD 3
5856

57+
/* SPI status cmd definition */
5958
#define SPI_MASTER_WRITE_STATUS_TO_SLAVE_CMD 1
6059
#define SPI_MASTER_READ_STATUS_FROM_SLAVE_CMD 4
6160

61+
/* SPI slave transfer done interrupt status definition */
6262
#define SPI_SLV_RD_BUF_DONE (BIT(0))
6363
#define SPI_SLV_WR_BUF_DONE (BIT(1))
6464
#define SPI_SLV_RD_STA_DONE (BIT(2))
@@ -67,14 +67,19 @@ extern "C" {
6767

6868
typedef void (*spi_event_callback_t)(int event, void *arg);
6969

70-
// ESP8266 has two hardware SPI, CSPI and HSPI. Currently, HSPI can be used arbitrarily.
71-
// SPI peripheral enumeration
70+
/**
71+
* @brief SPI peripheral enumeration
72+
*
73+
* @note ESP8266 has two hardware SPI, CSPI and HSPI. Currently, HSPI can be used arbitrarily.
74+
*/
7275
typedef enum {
7376
CSPI_HOST = 0,
7477
HSPI_HOST
7578
} spi_host_t;
7679

77-
// SPI clock division factor enumeration
80+
/**
81+
* @brief SPI clock division factor enumeration
82+
*/
7883
typedef enum {
7984
SPI_2MHz_DIV = 40,
8085
SPI_4MHz_DIV = 20,
@@ -87,13 +92,17 @@ typedef enum {
8792
SPI_80MHz_DIV = 1,
8893
} spi_clk_div_t;
8994

90-
// SPI working mode enumeration
95+
/**
96+
* @brief SPI working mode enumeration
97+
*/
9198
typedef enum {
9299
SPI_MASTER_MODE,
93100
SPI_SLAVE_MODE
94101
} spi_mode_t;
95102

96-
// SPI interrupt enable union type definition
103+
/**
104+
* @brief SPI interrupt enable union type definition
105+
*/
97106
typedef union {
98107
struct {
99108
uint32_t read_buffer: 1;
@@ -106,24 +115,28 @@ typedef union {
106115
uint32_t val;
107116
} spi_intr_enable_t;
108117

109-
// SPI bus interface parameter union type definition
118+
/**
119+
* @brief SPI bus interface parameter union type definition
120+
*/
110121
typedef union {
111122
struct {
112-
uint32_t cpol: 1; // Clock Polarity
113-
uint32_t cpha: 1; // Clock Phase
114-
uint32_t bit_tx_order: 1;
115-
uint32_t bit_rx_order: 1;
116-
uint32_t byte_tx_order: 1;
117-
uint32_t byte_rx_order: 1;
118-
uint32_t mosi_en: 1;
119-
uint32_t miso_en: 1;
120-
uint32_t cs_en: 1;
121-
uint32_t reserved9: 23;
123+
uint32_t cpol: 1; /*!< Clock Polarity */
124+
uint32_t cpha: 1; /*!< Clock Phase */
125+
uint32_t bit_tx_order: 1; /*!< Tx bit order */
126+
uint32_t bit_rx_order: 1; /*!< Rx bit order */
127+
uint32_t byte_tx_order: 1; /*!< Tx byte order */
128+
uint32_t byte_rx_order: 1; /*!< Rx byte order */
129+
uint32_t mosi_en: 1; /*!< MOSI line enable */
130+
uint32_t miso_en: 1; /*!< MISO line enable */
131+
uint32_t cs_en: 1; /*!< CS line enable */
132+
uint32_t reserved9: 23; /*!< resserved */
122133
};
123134
uint32_t val;
124135
} spi_interface_t;
125136

126-
// SPI transmission parameter structure type definition
137+
/**
138+
* @brief SPI transmission parameter structure type definition
139+
*/
127140
typedef struct {
128141
uint16_t *cmd;
129142
uint32_t *addr;
@@ -140,7 +153,9 @@ typedef struct {
140153
} bits;
141154
} spi_trans_t;
142155

143-
// SPI initialization parameter structure type definition
156+
/**
157+
* @brief SPI initialization parameter structure type definition
158+
*/
144159
typedef struct {
145160
spi_interface_t interface;
146161
spi_intr_enable_t intr_enable;

0 commit comments

Comments
 (0)