summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvan Lojewski <github@meklort.com>2021-06-19 10:41:40 -0600
committerGitHub <noreply@github.com>2021-06-19 10:41:40 -0600
commit3b6030c82406e989ca2dd4bd50ab2e8008b40afd (patch)
treeefbbb07d47c950ea8743c537bf57ebac4241ff24
parentf49384858cb9919ef4e2ba1b1988d17bb2a2eb0f (diff)
downloadbcm5719-ortega-3b6030c82406e989ca2dd4bd50ab2e8008b40afd.tar.gz
bcm5719-ortega-3b6030c82406e989ca2dd4bd50ab2e8008b40afd.zip
Network: Clean up additional linting issues. (#229)
-rw-r--r--libs/Network/generic.c22
-rw-r--r--libs/Network/ports.c92
-rw-r--r--libs/Network/rx.c5
-rw-r--r--libs/Network/tx.c7
4 files changed, 70 insertions, 56 deletions
diff --git a/libs/Network/generic.c b/libs/Network/generic.c
index 8f976bf..768f36e 100644
--- a/libs/Network/generic.c
+++ b/libs/Network/generic.c
@@ -47,8 +47,8 @@
void Network_SetMACAddr(NetworkPort_t *port, uint16_t high, uint32_t low, uint32_t index, bool enabled)
{
- uint32_t match_high = (high << 16) | (low >> 16);
- uint16_t match_low = (low << 16);
+ uint32_t match_high = (high << 16u) | (low >> 16u);
+ uint16_t match_low = (low << 16u);
switch (index)
{
@@ -56,35 +56,35 @@ void Network_SetMACAddr(NetworkPort_t *port, uint16_t high, uint32_t low, uint32
APE_PERI.BmcToNcSourceMacMatch0High.r32 = match_high;
APE_PERI.BmcToNcSourceMacMatch0Low.r32 = match_low;
port->shm_channel->NcsiChannelMac0High.r32 = high;
- port->shm_channel->NcsiChannelMac0Mid.r32 = low >> 16;
- port->shm_channel->NcsiChannelMac0Low.r32 = low & 0xffff;
+ port->shm_channel->NcsiChannelMac0Mid.r32 = low >> 16u;
+ port->shm_channel->NcsiChannelMac0Low.r32 = low & 0xffffu;
break;
case 1:
APE_PERI.BmcToNcSourceMacMatch1High.r32 = match_high;
APE_PERI.BmcToNcSourceMacMatch1Low.r32 = match_low;
port->shm_channel->NcsiChannelMac1High.r32 = high;
- port->shm_channel->NcsiChannelMac1Mid.r32 = low >> 16;
- port->shm_channel->NcsiChannelMac1Low.r32 = low & 0xffff;
+ port->shm_channel->NcsiChannelMac1Mid.r32 = low >> 16u;
+ port->shm_channel->NcsiChannelMac1Low.r32 = low & 0xffffu;
break;
case 2:
APE_PERI.BmcToNcSourceMacMatch2High.r32 = match_high;
APE_PERI.BmcToNcSourceMacMatch2Low.r32 = match_low;
port->shm_channel->NcsiChannelMac2High.r32 = high;
- port->shm_channel->NcsiChannelMac2Mid.r32 = low >> 16;
- port->shm_channel->NcsiChannelMac2Low.r32 = low & 0xffff;
+ port->shm_channel->NcsiChannelMac2Mid.r32 = low >> 16u;
+ port->shm_channel->NcsiChannelMac2Low.r32 = low & 0xffffu;
break;
case 3:
APE_PERI.BmcToNcSourceMacMatch3High.r32 = match_high;
APE_PERI.BmcToNcSourceMacMatch3Low.r32 = match_low;
port->shm_channel->NcsiChannelMac3High.r32 = high;
- port->shm_channel->NcsiChannelMac3Mid.r32 = low >> 16;
- port->shm_channel->NcsiChannelMac3Low.r32 = low & 0xffff;
+ port->shm_channel->NcsiChannelMac3Mid.r32 = low >> 16u;
+ port->shm_channel->NcsiChannelMac3Low.r32 = low & 0xffffu;
break;
}
port->device->PerfectMatch1High.r32 = high;
port->device->PerfectMatch1Low.r32 = low;
-}
+} //lint !e818
diff --git a/libs/Network/ports.c b/libs/Network/ports.c
index bafc9bd..35658be 100644
--- a/libs/Network/ports.c
+++ b/libs/Network/ports.c
@@ -104,6 +104,9 @@ NetworkPort_t gPort0 = {
.r32 = 0,
},
#endif
+
+ .link_state_printed = false,
+ .network_resetting = false,
};
NetworkPort_t gPort1 = {
@@ -142,6 +145,9 @@ NetworkPort_t gPort1 = {
.r32 = 0,
},
#endif
+
+ .link_state_printed = false,
+ .network_resetting = false,
};
NetworkPort_t gPort2 = {
@@ -180,6 +186,9 @@ NetworkPort_t gPort2 = {
.r32 = APE_STATUS_2_PORT_2_GRC_RESET_MASK,
},
#endif
+
+ .link_state_printed = false,
+ .network_resetting = false,
};
NetworkPort_t gPort3 = {
@@ -218,6 +227,9 @@ NetworkPort_t gPort3 = {
.r32 = APE_STATUS_2_PORT_3_GRC_RESET_MASK,
},
#endif
+
+ .link_state_printed = false,
+ .network_resetting = false,
};
NetworkPort_t *Network_getPort(int i)
@@ -244,22 +256,22 @@ typedef struct
} FilterElementInit_t;
static const FilterElementInit_t gElementInit[32] = {
- [0] = {{0}},
- [1] = {{0}},
- [2] = {{0}},
- [3] = {{0}},
- [4] = {{0}},
- [5] = {{0}},
- [6] = {{0}},
- [7] = {{0}},
- [8] = {{0}},
- [9] = {{0}},
- [10] = {{0}},
- [11] = {{0}},
- [12] = {{0}},
- [13] = {{0}},
- [14] = {{0}},
- [15] = {{0}},
+ [0] = {{0}}, //lint !e708
+ [1] = {{0}}, //lint !e708
+ [2] = {{0}}, //lint !e708
+ [3] = {{0}}, //lint !e708
+ [4] = {{0}}, //lint !e708
+ [5] = {{0}}, //lint !e708
+ [6] = {{0}}, //lint !e708
+ [7] = {{0}}, //lint !e708
+ [8] = {{0}}, //lint !e708
+ [9] = {{0}}, //lint !e708
+ [10] = {{0}}, //lint !e708
+ [11] = {{0}}, //lint !e708
+ [12] = {{0}}, //lint !e708
+ [13] = {{0}}, //lint !e708
+ [14] = {{0}}, //lint !e708
+ [15] = {{0}}, //lint !e708
// 16: Check MAC address multicast bit not set.
[16] = {
@@ -281,8 +293,8 @@ static const FilterElementInit_t gElementInit[32] = {
.pat = {.r32 = 0x01000100},
},
- [17] = {{0}},
- [18] = {{0}},
+ [17] = {{0}}, //lint !e708
+ [18] = {{0}}, //lint !e708
// 19: Special VLAN match.
[19] = {
@@ -364,7 +376,7 @@ static const FilterElementInit_t gElementInit[32] = {
.pat = {.r32 = 0x0223FFFF},
},
- [23] = {{0}},
+ [23] = {{0}}, //lint !e708
// 24: ARP match.
[24] = {
@@ -534,7 +546,7 @@ typedef struct
} FilterRuleInit_t;
static const FilterRuleInit_t gRuleInit[32] = {
// S-0. Unused.
- [0] = {{0}},
+ [0] = {{0}}, //lint !e708
// S-1. ACTION=TO_APE_AND_HOST, COUNT=0, ENABLE=1, MASK=0x0003_0000.
[1] = {
@@ -585,13 +597,13 @@ static const FilterRuleInit_t gRuleInit[32] = {
},
// S-5. Not used, initialize to zero.
- [5] = {{0}},
+ [5] = {{0}}, //lint !e708
// S-6. Not used, initialize to zero.
- [6] = {{0}},
+ [6] = {{0}}, //lint !e708
// S-7. Not used, initialize to zero.
- [7] = {{0}},
+ [7] = {{0}}, //lint !e708
// S-8. Not used, initialize to zero.
- [8] = {{0}},
+ [8] = {{0}}, //lint !e708
// S-9. ACTION=TO_APE_AND_HOST, COUNT=2, ENABLE=recommend 1, MASK=0x3008_0000.
[9] = {
@@ -666,11 +678,11 @@ static const FilterRuleInit_t gRuleInit[32] = {
},
// S-15. Not used, initialize to zero.
- [15] = {{0}},
+ [15] = {{0}}, //lint !e708
// S-16. Not used, initialize to zero.
- [16] = {{0}},
+ [16] = {{0}}, //lint !e708
// S-17. Not used, initialize to zero.
- [17] = {{0}},
+ [17] = {{0}}, //lint !e708
// S-18. ACTION=TO_APE_AND_HOST, COUNT=2, ENABLE=recommend 1, MASK=0x8008_0000.
[18] = {
@@ -693,7 +705,7 @@ static const FilterRuleInit_t gRuleInit[32] = {
.reserved_30_19 = 0,
.Enable = 0,
}},
- .mask = {.r32 = (0x3)<<(2*0)},
+ .mask = {.r32 = (0x3)<<(2*0)}, //lint !e835 !e845
},
// S-20. ACTION=TO_APE_AND_HOST, COUNT=0, ENABLE=0, MASK=(0b11)<<(2*1).
@@ -781,7 +793,7 @@ static const FilterRuleInit_t gRuleInit[32] = {
},
// S-27. Not used, initialize to zero.
- [27] = {{0}},
+ [27] = {{0}}, //lint !e708
// S-28. ACTION=TO_APE_AND_HOST, COUNT=0, ENABLE=0, MASK=0x4010_0000.
[28] = {
@@ -852,7 +864,7 @@ void Network_InitFilters(NetworkPort_t *port)
port->filters->RuleConfiguration.r32 = 0;
#endif
-}
+} //lint !e818
void Network_resetTX(NetworkPort_t *port, reload_type_t reset_phy)
{
@@ -870,7 +882,7 @@ void Network_resetTX(NetworkPort_t *port, reload_type_t reset_phy)
txMode.bits.Enable = 1;
*(port->tx_mode) = txMode;
}
-}
+} //lint !e818
void Network_resetRX(NetworkPort_t *port, reload_type_t reset_phy)
{
@@ -888,7 +900,7 @@ void Network_resetRX(NetworkPort_t *port, reload_type_t reset_phy)
rxMode.bits.Enable = 1;
*(port->rx_mode) = rxMode;
}
-}
+} //lint !e818
bool Network_checkEnableState(NetworkPort_t *port)
{
@@ -905,13 +917,13 @@ bool Network_checkEnableState(NetworkPort_t *port)
}
return true;
-}
+} //lint !e818
void Network_setEnableState(NetworkPort_t *port)
{
APE.Mode.r32 |= port->APEModeEnable.r32;
APE.Mode2.r32 |= port->APEMode2Enable.r32;
-}
+} //lint !e818
void Network_InitPort(NetworkPort_t *port, reload_type_t reset_phy)
{
@@ -1065,7 +1077,7 @@ void Network_InitPort(NetworkPort_t *port, reload_type_t reset_phy)
linkStatus.bits.LinkSpeed10M_THalfDuplexCapable = stat.bits._10BASE_THalfDuplexCapable;
port->shm_channel->NcsiChannelStatus = linkStatus;
-}
+} //lint !e818
void Network_checkPortState(NetworkPort_t *port)
{
@@ -1126,7 +1138,9 @@ bool Network_updatePortState(NetworkPort_t *port)
// Select full/half duplex mode.
switch ((uint8_t)status.bits.AutoNegotiationHCD)
{
+ default:
case MII_AUXILIARY_STATUS_SUMMARY_AUTO_NEGOTIATION_HCD_NO_HCD:
+ printf("Unable to auto-negotiate link duplex mode.\n");
// Error
break;
@@ -1147,7 +1161,9 @@ bool Network_updatePortState(NetworkPort_t *port)
// Select Speed
switch ((uint8_t)status.bits.AutoNegotiationHCD)
{
+ default:
case MII_AUXILIARY_STATUS_SUMMARY_AUTO_NEGOTIATION_HCD_NO_HCD:
+ printf("Unable to auto-negotiate link speed.\n");
// Error
break;
@@ -1207,7 +1223,7 @@ bool Network_updatePortState(NetworkPort_t *port)
}
return updated;
-}
+} //lint !e818
void Network_resetLink(NetworkPort_t *port)
{
@@ -1215,7 +1231,7 @@ void Network_resetLink(NetworkPort_t *port)
APE_aquireLock();
MII_reset(port->device, phy);
APE_releaseLock();
-}
+} //lint !e818
bool Network_isLinkUp(NetworkPort_t *port)
{
@@ -1254,4 +1270,4 @@ bool Network_isLinkUp(NetworkPort_t *port)
}
return linkup;
-}
+} //lint !e818
diff --git a/libs/Network/rx.c b/libs/Network/rx.c
index 1dfdb69..b4cc1ca 100644
--- a/libs/Network/rx.c
+++ b/libs/Network/rx.c
@@ -47,7 +47,6 @@
#include <APE_RX_PORT0.h>
#include <Ethernet.h>
#include <Network.h>
-#include <types.h>
#ifdef CXX_SIMULATOR
#include <stdio.h>
@@ -137,7 +136,7 @@ bool Network_PassthroughRxPatcket(NetworkPort_t *port)
{
port->network_resetting = false;
-#if CXX_SIMULATOR
+#ifdef CXX_SIMULATOR
rxbuf.print();
#endif
@@ -161,7 +160,7 @@ bool Network_PassthroughRxPatcket(NetworkPort_t *port)
// printf(" Next Block %d\n", control.bits.next_block);
// printf(" First %d\n", control.bits.first);
// printf(" Not Last %d\n", control.bits.not_last);
-#if CXX_SIMULATOR
+#ifdef CXX_SIMULATOR
printf("%d bytes in block.\n", control.bits.payload_length);
#endif
int i;
diff --git a/libs/Network/tx.c b/libs/Network/tx.c
index d626d98..d5a51e0 100644
--- a/libs/Network/tx.c
+++ b/libs/Network/tx.c
@@ -47,7 +47,6 @@
#include <APE_TX_PORT0.h>
#include <Ethernet.h>
#include <Network.h>
-#include <types.h>
#ifdef CXX_SIMULATOR
#include <bcm5719-endian.h>
@@ -108,7 +107,7 @@ int32_t __attribute__((noinline)) Network_TX_allocateBlock(NetworkPort_t *port)
}
return block;
-}
+} //lint !e818
static uint32_t inline Network_TX_initFirstBlock(RegTX_PORTOut_t *block, uint32_t length, int32_t blocks, int32_t next_block, uint32_t *packet, bool big_endian)
{
@@ -150,14 +149,14 @@ static uint32_t inline Network_TX_initFirstBlock(RegTX_PORTOut_t *block, uint32_
{
if (big_endian)
{
-#if CXX_SIMULATOR
+#ifdef CXX_SIMULATOR
printf("1st[%d] = 0x%08X\n", i, be32toh(packet[i]));
#endif
block[TX_PORT_OUT_ALL_FIRST_PAYLOAD_WORD + i].r32 = be32toh(packet[i]);
}
else
{
-#if CXX_SIMULATOR
+#ifdef CXX_SIMULATOR
printf("1LE[%d] = 0x%08X\n", i, (packet[i]));
#endif
block[TX_PORT_OUT_ALL_FIRST_PAYLOAD_WORD + i].r32 = (packet[i]);
OpenPOWER on IntegriCloud