@@ -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
2314823147void 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) {
2530425303static 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
2538425383static 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) {
2541925418void EMAC0_IRQHandler(void);
2542025419static uint32_t s_rxno;
2542125420void 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))) &&
0 commit comments