Skip to content

Commit cac4b3e

Browse files
committed
Fix TM4C warnings on TI compiler (C89)
1 parent 0d5cb5c commit cac4b3e

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

mongoose.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23142,7 +23142,6 @@ static const char *mg_phy_id_to_str(uint16_t id1, uint16_t id2) {
2314223142
default:
2314323143
return "unknown";
2314423144
}
23145-
(void) id2;
2314623145
}
2314723146

2314823147
void mg_phy_init(struct mg_phy *phy, uint8_t phy_addr, uint8_t config) {
@@ -25285,11 +25284,11 @@ static int guess_mdc_cr(void) {
2528525284
uint8_t crs[] = {2, 3, 0, 1}; // EMAC->MACMIIAR::CR values
2528625285
uint8_t div[] = {16, 26, 42, 62}; // Respective HCLK dividers
2528725286
uint32_t sysclk = get_sysclk(); // Guess system SYSCLK
25288-
int result = -1; // Invalid CR value
25287+
int i, result = -1; // Invalid CR value
2528925288
if (sysclk < 25000000) {
2529025289
MG_ERROR(("SYSCLK too low"));
2529125290
} else {
25292-
for (int i = 0; i < 4; i++) {
25291+
for (i = 0; i < 4; i++) {
2529325292
if (sysclk / div[i] <= 2375000UL /* 2.5MHz - 5% */) {
2529425293
result = crs[i];
2529525294
break;
@@ -25304,10 +25303,11 @@ static int guess_mdc_cr(void) {
2530425303
static bool mg_tcpip_driver_tm4c_init(struct mg_tcpip_if *ifp) {
2530525304
struct mg_tcpip_driver_tm4c_data *d =
2530625305
(struct mg_tcpip_driver_tm4c_data *) ifp->driver_data;
25306+
int i;
2530725307
s_ifp = ifp;
2530825308

2530925309
// Init RX descriptors
25310-
for (int i = 0; i < ETH_DESC_CNT; i++) {
25310+
for (i = 0; i < ETH_DESC_CNT; i++) {
2531125311
s_rxdesc[i][0] = MG_BIT(31); // Own
2531225312
s_rxdesc[i][1] = sizeof(s_rxbuf[i]) | MG_BIT(14); // 2nd address chained
2531325313
s_rxdesc[i][2] = (uint32_t) (uintptr_t) s_rxbuf[i]; // Point to data buffer
@@ -25317,7 +25317,7 @@ static bool mg_tcpip_driver_tm4c_init(struct mg_tcpip_if *ifp) {
2531725317
}
2531825318

2531925319
// Init TX descriptors
25320-
for (int i = 0; i < ETH_DESC_CNT; i++) {
25320+
for (i = 0; i < ETH_DESC_CNT; i++) {
2532125321
s_txdesc[i][2] = (uint32_t) (uintptr_t) s_txbuf[i]; // Buf pointer
2532225322
s_txdesc[i][3] =
2532325323
(uint32_t) (uintptr_t) s_txdesc[(i + 1) % ETH_DESC_CNT]; // Chain
@@ -25378,7 +25378,6 @@ static size_t mg_tcpip_driver_tm4c_tx(const void *buf, size_t len,
2537825378
EMAC->EMACDMARIS = MG_BIT(2) | MG_BIT(5); // Clear any prior TU/UNF
2537925379
EMAC->EMACTXPOLLD = 0; // and resume
2538025380
return len;
25381-
(void) ifp;
2538225381
}
2538325382

2538425383
static void mg_tcpip_driver_tm4c_update_hash_table(struct mg_tcpip_if *ifp) {
@@ -25419,9 +25418,10 @@ static bool mg_tcpip_driver_tm4c_poll(struct mg_tcpip_if *ifp, bool s1) {
2541925418
void EMAC0_IRQHandler(void);
2542025419
static uint32_t s_rxno;
2542125420
void EMAC0_IRQHandler(void) {
25421+
int i;
2542225422
if (EMAC->EMACDMARIS & MG_BIT(6)) { // Frame received, loop
2542325423
EMAC->EMACDMARIS = MG_BIT(16) | MG_BIT(6); // Clear flag
25424-
for (uint32_t i = 0; i < 10; i++) { // read as they arrive but not forever
25424+
for (i = 0; i < 10; i++) { // read as they arrive but not forever
2542525425
if (s_rxdesc[s_rxno][0] & MG_BIT(31)) break; // exit when done
2542625426
if (((s_rxdesc[s_rxno][0] & (MG_BIT(8) | MG_BIT(9))) ==
2542725427
(MG_BIT(8) | MG_BIT(9))) &&

src/drivers/phy.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ static const char *mg_phy_id_to_str(uint16_t id1, uint16_t id2) {
5353
default:
5454
return "unknown";
5555
}
56-
(void) id2;
5756
}
5857

5958
void mg_phy_init(struct mg_phy *phy, uint8_t phy_addr, uint8_t config) {

src/drivers/tm4c.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,11 @@ static int guess_mdc_cr(void) {
111111
uint8_t crs[] = {2, 3, 0, 1}; // EMAC->MACMIIAR::CR values
112112
uint8_t div[] = {16, 26, 42, 62}; // Respective HCLK dividers
113113
uint32_t sysclk = get_sysclk(); // Guess system SYSCLK
114-
int result = -1; // Invalid CR value
114+
int i, result = -1; // Invalid CR value
115115
if (sysclk < 25000000) {
116116
MG_ERROR(("SYSCLK too low"));
117117
} else {
118-
for (int i = 0; i < 4; i++) {
118+
for (i = 0; i < 4; i++) {
119119
if (sysclk / div[i] <= 2375000UL /* 2.5MHz - 5% */) {
120120
result = crs[i];
121121
break;
@@ -130,10 +130,11 @@ static int guess_mdc_cr(void) {
130130
static bool mg_tcpip_driver_tm4c_init(struct mg_tcpip_if *ifp) {
131131
struct mg_tcpip_driver_tm4c_data *d =
132132
(struct mg_tcpip_driver_tm4c_data *) ifp->driver_data;
133+
int i;
133134
s_ifp = ifp;
134135

135136
// Init RX descriptors
136-
for (int i = 0; i < ETH_DESC_CNT; i++) {
137+
for (i = 0; i < ETH_DESC_CNT; i++) {
137138
s_rxdesc[i][0] = MG_BIT(31); // Own
138139
s_rxdesc[i][1] = sizeof(s_rxbuf[i]) | MG_BIT(14); // 2nd address chained
139140
s_rxdesc[i][2] = (uint32_t) (uintptr_t) s_rxbuf[i]; // Point to data buffer
@@ -143,7 +144,7 @@ static bool mg_tcpip_driver_tm4c_init(struct mg_tcpip_if *ifp) {
143144
}
144145

145146
// Init TX descriptors
146-
for (int i = 0; i < ETH_DESC_CNT; i++) {
147+
for (i = 0; i < ETH_DESC_CNT; i++) {
147148
s_txdesc[i][2] = (uint32_t) (uintptr_t) s_txbuf[i]; // Buf pointer
148149
s_txdesc[i][3] =
149150
(uint32_t) (uintptr_t) s_txdesc[(i + 1) % ETH_DESC_CNT]; // Chain
@@ -204,7 +205,6 @@ static size_t mg_tcpip_driver_tm4c_tx(const void *buf, size_t len,
204205
EMAC->EMACDMARIS = MG_BIT(2) | MG_BIT(5); // Clear any prior TU/UNF
205206
EMAC->EMACTXPOLLD = 0; // and resume
206207
return len;
207-
(void) ifp;
208208
}
209209

210210
static void mg_tcpip_driver_tm4c_update_hash_table(struct mg_tcpip_if *ifp) {
@@ -245,9 +245,10 @@ static bool mg_tcpip_driver_tm4c_poll(struct mg_tcpip_if *ifp, bool s1) {
245245
void EMAC0_IRQHandler(void);
246246
static uint32_t s_rxno;
247247
void EMAC0_IRQHandler(void) {
248+
int i;
248249
if (EMAC->EMACDMARIS & MG_BIT(6)) { // Frame received, loop
249250
EMAC->EMACDMARIS = MG_BIT(16) | MG_BIT(6); // Clear flag
250-
for (uint32_t i = 0; i < 10; i++) { // read as they arrive but not forever
251+
for (i = 0; i < 10; i++) { // read as they arrive but not forever
251252
if (s_rxdesc[s_rxno][0] & MG_BIT(31)) break; // exit when done
252253
if (((s_rxdesc[s_rxno][0] & (MG_BIT(8) | MG_BIT(9))) ==
253254
(MG_BIT(8) | MG_BIT(9))) &&

0 commit comments

Comments
 (0)