mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-10 16:31:44 +00:00
Fix TM4C warnings on TI compiler (C89)
This commit is contained in:
1 parent
0d5cb5cbcc
commit
cac4b3e254
3 files changed
+14
-14
No files matched your search
+7
-7
@@ -23142,7 +23142,6 @@ static const char *mg_phy_id_to_str(uint16_t id1, uint16_t id2) {
|
|||||||
default:
|
default:
|
||||||
return "unknown";
|
return "unknown";
|
||||||
}
|
}
|
||||||
(void) id2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void mg_phy_init(struct mg_phy *phy, uint8_t phy_addr, uint8_t config) {
|
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) {
|
|||||||
uint8_t crs[] = {2, 3, 0, 1}; // EMAC->MACMIIAR::CR values
|
uint8_t crs[] = {2, 3, 0, 1}; // EMAC->MACMIIAR::CR values
|
||||||
uint8_t div[] = {16, 26, 42, 62}; // Respective HCLK dividers
|
uint8_t div[] = {16, 26, 42, 62}; // Respective HCLK dividers
|
||||||
uint32_t sysclk = get_sysclk(); // Guess system SYSCLK
|
uint32_t sysclk = get_sysclk(); // Guess system SYSCLK
|
||||||
int result = -1; // Invalid CR value
|
int i, result = -1; // Invalid CR value
|
||||||
if (sysclk < 25000000) {
|
if (sysclk < 25000000) {
|
||||||
MG_ERROR(("SYSCLK too low"));
|
MG_ERROR(("SYSCLK too low"));
|
||||||
} else {
|
} else {
|
||||||
for (int i = 0; i < 4; i++) {
|
for (i = 0; i < 4; i++) {
|
||||||
if (sysclk / div[i] <= 2375000UL /* 2.5MHz - 5% */) {
|
if (sysclk / div[i] <= 2375000UL /* 2.5MHz - 5% */) {
|
||||||
result = crs[i];
|
result = crs[i];
|
||||||
break;
|
break;
|
||||||
@@ -25304,10 +25303,11 @@ static int guess_mdc_cr(void) {
|
|||||||
static bool mg_tcpip_driver_tm4c_init(struct mg_tcpip_if *ifp) {
|
static bool mg_tcpip_driver_tm4c_init(struct mg_tcpip_if *ifp) {
|
||||||
struct mg_tcpip_driver_tm4c_data *d =
|
struct mg_tcpip_driver_tm4c_data *d =
|
||||||
(struct mg_tcpip_driver_tm4c_data *) ifp->driver_data;
|
(struct mg_tcpip_driver_tm4c_data *) ifp->driver_data;
|
||||||
|
int i;
|
||||||
s_ifp = ifp;
|
s_ifp = ifp;
|
||||||
|
|
||||||
// Init RX descriptors
|
// Init RX descriptors
|
||||||
for (int i = 0; i < ETH_DESC_CNT; i++) {
|
for (i = 0; i < ETH_DESC_CNT; i++) {
|
||||||
s_rxdesc[i][0] = MG_BIT(31); // Own
|
s_rxdesc[i][0] = MG_BIT(31); // Own
|
||||||
s_rxdesc[i][1] = sizeof(s_rxbuf[i]) | MG_BIT(14); // 2nd address chained
|
s_rxdesc[i][1] = sizeof(s_rxbuf[i]) | MG_BIT(14); // 2nd address chained
|
||||||
s_rxdesc[i][2] = (uint32_t) (uintptr_t) s_rxbuf[i]; // Point to data buffer
|
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) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Init TX descriptors
|
// Init TX descriptors
|
||||||
for (int i = 0; i < ETH_DESC_CNT; i++) {
|
for (i = 0; i < ETH_DESC_CNT; i++) {
|
||||||
s_txdesc[i][2] = (uint32_t) (uintptr_t) s_txbuf[i]; // Buf pointer
|
s_txdesc[i][2] = (uint32_t) (uintptr_t) s_txbuf[i]; // Buf pointer
|
||||||
s_txdesc[i][3] =
|
s_txdesc[i][3] =
|
||||||
(uint32_t) (uintptr_t) s_txdesc[(i + 1) % ETH_DESC_CNT]; // Chain
|
(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,
|
|||||||
EMAC->EMACDMARIS = MG_BIT(2) | MG_BIT(5); // Clear any prior TU/UNF
|
EMAC->EMACDMARIS = MG_BIT(2) | MG_BIT(5); // Clear any prior TU/UNF
|
||||||
EMAC->EMACTXPOLLD = 0; // and resume
|
EMAC->EMACTXPOLLD = 0; // and resume
|
||||||
return len;
|
return len;
|
||||||
(void) ifp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mg_tcpip_driver_tm4c_update_hash_table(struct mg_tcpip_if *ifp) {
|
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) {
|
|||||||
void EMAC0_IRQHandler(void);
|
void EMAC0_IRQHandler(void);
|
||||||
static uint32_t s_rxno;
|
static uint32_t s_rxno;
|
||||||
void EMAC0_IRQHandler(void) {
|
void EMAC0_IRQHandler(void) {
|
||||||
|
int i;
|
||||||
if (EMAC->EMACDMARIS & MG_BIT(6)) { // Frame received, loop
|
if (EMAC->EMACDMARIS & MG_BIT(6)) { // Frame received, loop
|
||||||
EMAC->EMACDMARIS = MG_BIT(16) | MG_BIT(6); // Clear flag
|
EMAC->EMACDMARIS = MG_BIT(16) | MG_BIT(6); // Clear flag
|
||||||
for (uint32_t i = 0; i < 10; i++) { // read as they arrive but not forever
|
for (i = 0; i < 10; i++) { // read as they arrive but not forever
|
||||||
if (s_rxdesc[s_rxno][0] & MG_BIT(31)) break; // exit when done
|
if (s_rxdesc[s_rxno][0] & MG_BIT(31)) break; // exit when done
|
||||||
if (((s_rxdesc[s_rxno][0] & (MG_BIT(8) | MG_BIT(9))) ==
|
if (((s_rxdesc[s_rxno][0] & (MG_BIT(8) | MG_BIT(9))) ==
|
||||||
(MG_BIT(8) | MG_BIT(9))) &&
|
(MG_BIT(8) | MG_BIT(9))) &&
|
||||||
|
|||||||
@@ -53,7 +53,6 @@ static const char *mg_phy_id_to_str(uint16_t id1, uint16_t id2) {
|
|||||||
default:
|
default:
|
||||||
return "unknown";
|
return "unknown";
|
||||||
}
|
}
|
||||||
(void) id2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void mg_phy_init(struct mg_phy *phy, uint8_t phy_addr, uint8_t config) {
|
void mg_phy_init(struct mg_phy *phy, uint8_t phy_addr, uint8_t config) {
|
||||||
|
|||||||
+7
-6
@@ -111,11 +111,11 @@ static int guess_mdc_cr(void) {
|
|||||||
uint8_t crs[] = {2, 3, 0, 1}; // EMAC->MACMIIAR::CR values
|
uint8_t crs[] = {2, 3, 0, 1}; // EMAC->MACMIIAR::CR values
|
||||||
uint8_t div[] = {16, 26, 42, 62}; // Respective HCLK dividers
|
uint8_t div[] = {16, 26, 42, 62}; // Respective HCLK dividers
|
||||||
uint32_t sysclk = get_sysclk(); // Guess system SYSCLK
|
uint32_t sysclk = get_sysclk(); // Guess system SYSCLK
|
||||||
int result = -1; // Invalid CR value
|
int i, result = -1; // Invalid CR value
|
||||||
if (sysclk < 25000000) {
|
if (sysclk < 25000000) {
|
||||||
MG_ERROR(("SYSCLK too low"));
|
MG_ERROR(("SYSCLK too low"));
|
||||||
} else {
|
} else {
|
||||||
for (int i = 0; i < 4; i++) {
|
for (i = 0; i < 4; i++) {
|
||||||
if (sysclk / div[i] <= 2375000UL /* 2.5MHz - 5% */) {
|
if (sysclk / div[i] <= 2375000UL /* 2.5MHz - 5% */) {
|
||||||
result = crs[i];
|
result = crs[i];
|
||||||
break;
|
break;
|
||||||
@@ -130,10 +130,11 @@ static int guess_mdc_cr(void) {
|
|||||||
static bool mg_tcpip_driver_tm4c_init(struct mg_tcpip_if *ifp) {
|
static bool mg_tcpip_driver_tm4c_init(struct mg_tcpip_if *ifp) {
|
||||||
struct mg_tcpip_driver_tm4c_data *d =
|
struct mg_tcpip_driver_tm4c_data *d =
|
||||||
(struct mg_tcpip_driver_tm4c_data *) ifp->driver_data;
|
(struct mg_tcpip_driver_tm4c_data *) ifp->driver_data;
|
||||||
|
int i;
|
||||||
s_ifp = ifp;
|
s_ifp = ifp;
|
||||||
|
|
||||||
// Init RX descriptors
|
// Init RX descriptors
|
||||||
for (int i = 0; i < ETH_DESC_CNT; i++) {
|
for (i = 0; i < ETH_DESC_CNT; i++) {
|
||||||
s_rxdesc[i][0] = MG_BIT(31); // Own
|
s_rxdesc[i][0] = MG_BIT(31); // Own
|
||||||
s_rxdesc[i][1] = sizeof(s_rxbuf[i]) | MG_BIT(14); // 2nd address chained
|
s_rxdesc[i][1] = sizeof(s_rxbuf[i]) | MG_BIT(14); // 2nd address chained
|
||||||
s_rxdesc[i][2] = (uint32_t) (uintptr_t) s_rxbuf[i]; // Point to data buffer
|
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) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Init TX descriptors
|
// Init TX descriptors
|
||||||
for (int i = 0; i < ETH_DESC_CNT; i++) {
|
for (i = 0; i < ETH_DESC_CNT; i++) {
|
||||||
s_txdesc[i][2] = (uint32_t) (uintptr_t) s_txbuf[i]; // Buf pointer
|
s_txdesc[i][2] = (uint32_t) (uintptr_t) s_txbuf[i]; // Buf pointer
|
||||||
s_txdesc[i][3] =
|
s_txdesc[i][3] =
|
||||||
(uint32_t) (uintptr_t) s_txdesc[(i + 1) % ETH_DESC_CNT]; // Chain
|
(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,
|
|||||||
EMAC->EMACDMARIS = MG_BIT(2) | MG_BIT(5); // Clear any prior TU/UNF
|
EMAC->EMACDMARIS = MG_BIT(2) | MG_BIT(5); // Clear any prior TU/UNF
|
||||||
EMAC->EMACTXPOLLD = 0; // and resume
|
EMAC->EMACTXPOLLD = 0; // and resume
|
||||||
return len;
|
return len;
|
||||||
(void) ifp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mg_tcpip_driver_tm4c_update_hash_table(struct mg_tcpip_if *ifp) {
|
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) {
|
|||||||
void EMAC0_IRQHandler(void);
|
void EMAC0_IRQHandler(void);
|
||||||
static uint32_t s_rxno;
|
static uint32_t s_rxno;
|
||||||
void EMAC0_IRQHandler(void) {
|
void EMAC0_IRQHandler(void) {
|
||||||
|
int i;
|
||||||
if (EMAC->EMACDMARIS & MG_BIT(6)) { // Frame received, loop
|
if (EMAC->EMACDMARIS & MG_BIT(6)) { // Frame received, loop
|
||||||
EMAC->EMACDMARIS = MG_BIT(16) | MG_BIT(6); // Clear flag
|
EMAC->EMACDMARIS = MG_BIT(16) | MG_BIT(6); // Clear flag
|
||||||
for (uint32_t i = 0; i < 10; i++) { // read as they arrive but not forever
|
for (i = 0; i < 10; i++) { // read as they arrive but not forever
|
||||||
if (s_rxdesc[s_rxno][0] & MG_BIT(31)) break; // exit when done
|
if (s_rxdesc[s_rxno][0] & MG_BIT(31)) break; // exit when done
|
||||||
if (((s_rxdesc[s_rxno][0] & (MG_BIT(8) | MG_BIT(9))) ==
|
if (((s_rxdesc[s_rxno][0] & (MG_BIT(8) | MG_BIT(9))) ==
|
||||||
(MG_BIT(8) | MG_BIT(9))) &&
|
(MG_BIT(8) | MG_BIT(9))) &&
|
||||||
|
|||||||
Reference in new issue
Block a user