Skip to content

Commit a509441

Browse files
committed
net: convert to using newly introduced integer sized types
Convert code to use u{8,16,32,64}_t and s{8,16,32,64}_t instead of C99 integer types. Jira: ZEP-2051 Change-Id: I4ec03eb2183d59ef86ea2c20d956e5d272656837 Signed-off-by: Kumar Gala <[email protected]>
1 parent 7f8d2d1 commit a509441

File tree

178 files changed

+3306
-3306
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

178 files changed

+3306
-3306
lines changed

drivers/ethernet/eth_dw.c

+16-16
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,23 @@
2323
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_ETHERNET_LEVEL
2424
#include <logging/sys_log.h>
2525

26-
static inline uint32_t eth_read(uint32_t base_addr, uint32_t offset)
26+
static inline u32_t eth_read(u32_t base_addr, u32_t offset)
2727
{
2828
return sys_read32(base_addr + offset);
2929
}
3030

31-
static inline void eth_write(uint32_t base_addr, uint32_t offset,
32-
uint32_t val)
31+
static inline void eth_write(u32_t base_addr, u32_t offset,
32+
u32_t val)
3333
{
3434
sys_write32(val, base_addr + offset);
3535
}
3636

3737
static void eth_rx(struct device *port)
3838
{
3939
struct eth_runtime *context = port->driver_data;
40-
uint32_t base_addr = context->base_addr;
40+
u32_t base_addr = context->base_addr;
4141
struct net_buf *buf;
42-
uint32_t frm_len = 0;
42+
u32_t frm_len = 0;
4343

4444
/* Check whether the RX descriptor is still owned by the device. If not,
4545
* process the received frame or an error that may have occurred.
@@ -97,7 +97,7 @@ static void eth_rx(struct device *port)
9797
static int eth_tx(struct device *port, struct net_buf *buf)
9898
{
9999
struct eth_runtime *context = port->driver_data;
100-
uint32_t base_addr = context->base_addr;
100+
u32_t base_addr = context->base_addr;
101101

102102
/* Wait until the TX descriptor is no longer owned by the device. */
103103
while (context->tx_desc.own == 1) {
@@ -135,8 +135,8 @@ static int eth_tx(struct device *port, struct net_buf *buf)
135135
static void eth_dw_isr(struct device *port)
136136
{
137137
struct eth_runtime *context = port->driver_data;
138-
uint32_t base_addr = context->base_addr;
139-
uint32_t int_status;
138+
u32_t base_addr = context->base_addr;
139+
u32_t int_status;
140140

141141
int_status = eth_read(base_addr, REG_ADDR_STATUS);
142142

@@ -186,14 +186,14 @@ static int eth_initialize(struct device *port)
186186
{
187187
struct eth_runtime *context = port->driver_data;
188188
const struct eth_config *config = port->config->config_info;
189-
uint32_t base_addr;
189+
u32_t base_addr;
190190

191191
union {
192192
struct {
193-
uint8_t bytes[6];
194-
uint8_t pad[2];
193+
u8_t bytes[6];
194+
u8_t pad[2];
195195
} __attribute__((packed));
196-
uint32_t words[2];
196+
u32_t words[2];
197197
} mac_addr;
198198

199199
if (!eth_setup(port))
@@ -214,7 +214,7 @@ static int eth_initialize(struct device *port)
214214
context->tx_desc.tdes0 = 0;
215215
context->tx_desc.tdes1 = 0;
216216

217-
context->tx_desc.buf1_ptr = (uint8_t *)context->tx_buf;
217+
context->tx_desc.buf1_ptr = (u8_t *)context->tx_buf;
218218
context->tx_desc.tx_end_of_ring = 1;
219219
context->tx_desc.first_seg_in_frm = 1;
220220
context->tx_desc.last_seg_in_frm = 1;
@@ -224,16 +224,16 @@ static int eth_initialize(struct device *port)
224224
context->rx_desc.rdes0 = 0;
225225
context->rx_desc.rdes1 = 0;
226226

227-
context->rx_desc.buf1_ptr = (uint8_t *)context->rx_buf;
227+
context->rx_desc.buf1_ptr = (u8_t *)context->rx_buf;
228228
context->rx_desc.own = 1;
229229
context->rx_desc.first_desc = 1;
230230
context->rx_desc.last_desc = 1;
231231
context->rx_desc.rx_buf1_sz = UIP_BUFSIZE;
232232
context->rx_desc.rx_end_of_ring = 1;
233233

234234
/* Install transmit and receive descriptors. */
235-
eth_write(base_addr, REG_ADDR_RX_DESC_LIST, (uint32_t)&context->rx_desc);
236-
eth_write(base_addr, REG_ADDR_TX_DESC_LIST, (uint32_t)&context->tx_desc);
235+
eth_write(base_addr, REG_ADDR_RX_DESC_LIST, (u32_t)&context->rx_desc);
236+
eth_write(base_addr, REG_ADDR_TX_DESC_LIST, (u32_t)&context->tx_desc);
237237

238238
eth_write(base_addr, REG_ADDR_MAC_CONF,
239239
/* Set the RMII speed to 100Mbps */

drivers/ethernet/eth_dw_priv.h

+69-69
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ extern "C" {
2323
typedef void (*eth_config_irq_t)(struct device *port);
2424

2525
struct eth_config {
26-
uint32_t irq_num;
26+
u32_t irq_num;
2727
eth_config_irq_t config_func;
2828

2929
#ifdef CONFIG_ETH_DW_SHARED_IRQ
@@ -46,118 +46,118 @@ struct eth_tx_desc {
4646
union {
4747
struct {
4848
/* Only valid in half-duplex mode. */
49-
uint32_t deferred_bit : 1;
50-
uint32_t err_underflow : 1;
51-
uint32_t err_excess_defer : 1;
52-
uint32_t coll_cnt_slot_num : 4;
53-
uint32_t vlan_frm : 1;
54-
uint32_t err_excess_coll : 1;
55-
uint32_t err_late_coll : 1;
56-
uint32_t err_no_carrier : 1;
57-
uint32_t err_carrier_loss : 1;
58-
uint32_t err_ip_payload : 1;
59-
uint32_t err_frm_flushed : 1;
60-
uint32_t err_jabber_tout : 1;
49+
u32_t deferred_bit : 1;
50+
u32_t err_underflow : 1;
51+
u32_t err_excess_defer : 1;
52+
u32_t coll_cnt_slot_num : 4;
53+
u32_t vlan_frm : 1;
54+
u32_t err_excess_coll : 1;
55+
u32_t err_late_coll : 1;
56+
u32_t err_no_carrier : 1;
57+
u32_t err_carrier_loss : 1;
58+
u32_t err_ip_payload : 1;
59+
u32_t err_frm_flushed : 1;
60+
u32_t err_jabber_tout : 1;
6161
/* OR of all other error bits. */
62-
uint32_t err_summary : 1;
63-
uint32_t err_ip_hdr : 1;
64-
uint32_t tx_timestamp_stat : 1;
65-
uint32_t vlan_ins_ctrl : 2;
66-
uint32_t addr2_chained : 1;
67-
uint32_t tx_end_of_ring : 1;
68-
uint32_t chksum_ins_ctrl : 2;
69-
uint32_t replace_crc : 1;
70-
uint32_t tx_timestamp_en : 1;
71-
uint32_t dis_pad : 1;
72-
uint32_t dis_crc : 1;
73-
uint32_t first_seg_in_frm : 1;
74-
uint32_t last_seg_in_frm : 1;
75-
uint32_t intr_on_complete : 1;
62+
u32_t err_summary : 1;
63+
u32_t err_ip_hdr : 1;
64+
u32_t tx_timestamp_stat : 1;
65+
u32_t vlan_ins_ctrl : 2;
66+
u32_t addr2_chained : 1;
67+
u32_t tx_end_of_ring : 1;
68+
u32_t chksum_ins_ctrl : 2;
69+
u32_t replace_crc : 1;
70+
u32_t tx_timestamp_en : 1;
71+
u32_t dis_pad : 1;
72+
u32_t dis_crc : 1;
73+
u32_t first_seg_in_frm : 1;
74+
u32_t last_seg_in_frm : 1;
75+
u32_t intr_on_complete : 1;
7676
/* When set, descriptor is owned by DMA. */
77-
uint32_t own : 1;
77+
u32_t own : 1;
7878
};
79-
uint32_t tdes0;
79+
u32_t tdes0;
8080
};
8181
/* Second word of transmit descriptor */
8282
union {
8383
struct {
84-
uint32_t tx_buf1_sz : 13;
85-
uint32_t : 3;
86-
uint32_t tx_buf2_sz : 13;
87-
uint32_t src_addr_ins_ctrl : 3;
84+
u32_t tx_buf1_sz : 13;
85+
u32_t : 3;
86+
u32_t tx_buf2_sz : 13;
87+
u32_t src_addr_ins_ctrl : 3;
8888
};
89-
uint32_t tdes1;
89+
u32_t tdes1;
9090
};
9191
/* Pointer to frame data buffer */
92-
uint8_t *buf1_ptr;
92+
u8_t *buf1_ptr;
9393
/* Unused, since this driver initializes only a single descriptor for each
9494
* direction.
9595
*/
96-
uint8_t *buf2_ptr;
96+
u8_t *buf2_ptr;
9797
};
9898

9999
/* Transmit descriptor */
100100
struct eth_rx_desc {
101101
/* First word of receive descriptor */
102102
union {
103103
struct {
104-
uint32_t ext_stat : 1;
105-
uint32_t err_crc : 1;
106-
uint32_t err_dribble_bit : 1;
107-
uint32_t err_rx_mii : 1;
108-
uint32_t err_rx_wdt : 1;
109-
uint32_t frm_type : 1;
110-
uint32_t err_late_coll : 1;
111-
uint32_t giant_frm : 1;
112-
uint32_t last_desc : 1;
113-
uint32_t first_desc : 1;
114-
uint32_t vlan_tag : 1;
115-
uint32_t err_overflow : 1;
116-
uint32_t length_err : 1;
117-
uint32_t s_addr_filt_fail : 1;
118-
uint32_t err_desc : 1;
119-
uint32_t err_summary : 1;
120-
uint32_t frm_len : 14;
121-
uint32_t d_addr_filt_fail : 1;
122-
uint32_t own : 1;
104+
u32_t ext_stat : 1;
105+
u32_t err_crc : 1;
106+
u32_t err_dribble_bit : 1;
107+
u32_t err_rx_mii : 1;
108+
u32_t err_rx_wdt : 1;
109+
u32_t frm_type : 1;
110+
u32_t err_late_coll : 1;
111+
u32_t giant_frm : 1;
112+
u32_t last_desc : 1;
113+
u32_t first_desc : 1;
114+
u32_t vlan_tag : 1;
115+
u32_t err_overflow : 1;
116+
u32_t length_err : 1;
117+
u32_t s_addr_filt_fail : 1;
118+
u32_t err_desc : 1;
119+
u32_t err_summary : 1;
120+
u32_t frm_len : 14;
121+
u32_t d_addr_filt_fail : 1;
122+
u32_t own : 1;
123123
};
124-
uint32_t rdes0;
124+
u32_t rdes0;
125125
};
126126
/* Second word of receive descriptor */
127127
union {
128128
struct {
129-
uint32_t rx_buf1_sz : 13;
130-
uint32_t : 1;
131-
uint32_t addr2_chained : 1;
132-
uint32_t rx_end_of_ring : 1;
133-
uint32_t rx_buf2_sz : 13;
134-
uint32_t : 2;
135-
uint32_t dis_int_compl : 1;
129+
u32_t rx_buf1_sz : 13;
130+
u32_t : 1;
131+
u32_t addr2_chained : 1;
132+
u32_t rx_end_of_ring : 1;
133+
u32_t rx_buf2_sz : 13;
134+
u32_t : 2;
135+
u32_t dis_int_compl : 1;
136136
};
137-
uint32_t rdes1;
137+
u32_t rdes1;
138138
};
139139
/* Pointer to frame data buffer */
140-
uint8_t *buf1_ptr;
140+
u8_t *buf1_ptr;
141141
/* Unused, since this driver initializes only a single descriptor for each
142142
* direction.
143143
*/
144-
uint8_t *buf2_ptr;
144+
u8_t *buf2_ptr;
145145
};
146146

147147
/* Driver metadata associated with each Ethernet device */
148148
struct eth_runtime {
149-
uint32_t base_addr;
149+
u32_t base_addr;
150150
#ifdef CONFIG_PCI
151151
struct pci_dev_info pci_dev;
152152
#endif /* CONFIG_PCI */
153153
/* Transmit descriptor */
154154
volatile struct eth_tx_desc tx_desc;
155155
/* Transmit DMA packet buffer */
156-
volatile uint8_t tx_buf[UIP_BUFSIZE];
156+
volatile u8_t tx_buf[UIP_BUFSIZE];
157157
/* Receive descriptor */
158158
volatile struct eth_rx_desc rx_desc;
159159
/* Receive DMA packet buffer */
160-
volatile uint8_t rx_buf[UIP_BUFSIZE];
160+
volatile u8_t rx_buf[UIP_BUFSIZE];
161161
};
162162

163163
#define MMC_DEFAULT_MASK 0xffffffff

0 commit comments

Comments
 (0)