[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[MiNT] Patch fec.xif: Read FireTOS params via correct interface, drop assigned but unused variables.
Hello,
this patch drops some assigned unused variables ( If you are using GCC
4.6 and find some more, please feel free to submit another patch, I can
not install gcc 4.6 and therefore I can not see these warnings).
The other part is the read of the MAC address, it should work now under
any circumstance.
Comment: Correctly read Flash parameters, drop assigned but unused
variables.
Greets,
m
Index: fec.c
===================================================================
RCS file: /mint/freemint/sys/sockets/xif/fec/fec.c,v
retrieving revision 1.1
diff -a -u -r1.1 fec.c
--- fec.c 11 Nov 2011 00:15:38 -0000 1.1
+++ fec.c 20 Nov 2011 17:38:26 -0000
@@ -40,6 +40,16 @@
#define ETH_MIN_FRM (ETH_HLEN + ETH_MIN_DLEN + ETH_CRC_LEN)
#define ETH_MTU (ETH_HLEN + ETH_MAX_DLEN)
+/* mode parameters for firetos_read_parameter: */
+#define CT60_MODE_READ 0
+
+/* type parameters for firetos_read_parameter: */
+#define CT60_MAC_ADDRESS 10L
+
+/* macro to read FireTOS parameters (named ct60_rw_parameter within FireTOS): */
+#define firetos_read_parameter(type_param, value )\
+ (long)trap_14_wwll( 0xc60b, CT60_MODE_READ, type_param, 0 )
+
/* ------------------------ Type definitions ------------------------------ */
typedef struct s_fec_if_priv
{
@@ -98,52 +108,21 @@
static long fec_ioctl (struct netif *, short, long);
static long fec_config (struct netif *, struct ifopt *);
-unsigned char *board_get_ethaddr(unsigned char *ethaddr);
-unsigned char *board_get_client(unsigned char *client);
-unsigned char *board_get_server(unsigned char *server);
-unsigned char *board_get_gateway(unsigned char *gateway);
-unsigned char *board_get_netmask(unsigned char *netmask);
+static unsigned char *board_get_ethaddr(unsigned char *ethaddr);
-unsigned char *board_get_ethaddr(unsigned char *ethaddr)
+unsigned char *board_get_ethaddr(unsigned char * ethaddr)
{
- int i;
- for(i = 0; i < 6; i++)
- ethaddr[i] = ((PARAM *)PARAMS_ADDRESS)->ethaddr[i];
+ unsigned long ethaddr_part;
+ ethaddr_part=(unsigned long)firetos_read_parameter(CT60_MAC_ADDRESS,0L);
+ ethaddr[0] = 0;
+ ethaddr[1] = 0xCF;
+ ethaddr[2] = 0x54;
+ ethaddr[3] = ( (ethaddr_part>>16) & 255 );
+ ethaddr[4] = ( (ethaddr_part>>8) & 255 );
+ ethaddr[5] = ( ethaddr_part &255 );
return ethaddr;
}
-unsigned char *board_get_client(unsigned char *client)
-{
- int i;
- for(i = 0; i < 4; i++)
- client[i] = ((PARAM *)PARAMS_ADDRESS)->client[i];
- return client;
-}
-
-unsigned char *board_get_server(unsigned char *server)
-{
- int i;
- for(i = 0; i < 4; i++)
- server[i] = ((PARAM *)PARAMS_ADDRESS)->server[i];
- return server;
-}
-
-unsigned char *board_get_gateway(unsigned char *gateway)
-{
- int i;
- for(i = 0; i < 4; i++)
- gateway[i] = ((PARAM *)PARAMS_ADDRESS)->gateway[i];
- return gateway;
-}
-
-unsigned char *board_get_netmask(unsigned char *netmask)
-{
- int i;
- for(i = 0; i < 4; i++)
- netmask[i] = ((PARAM *)PARAMS_ADDRESS)->netmask[i];
- return netmask;
-}
-
static char * dbgbuf[128];
void dbghex( char * str, unsigned long value )
{
@@ -660,14 +639,13 @@
fec_if_t *fecif = (fec_if_t *)nif->data;
uint8 ch = fecif->ch;
uint32 initiator;
- long result;
if( dma_get_channel( DMA_FEC_RX(ch) ) != -1 )
{
fec_rx_stop(fecif);
}
/* Make the initiator assignment */
- result = dma_set_initiator(DMA_FEC_RX(ch));
+ dma_set_initiator(DMA_FEC_RX(ch));
/* Grab the initiator number */
initiator = dma_get_initiator(DMA_FEC_RX(ch));
/* Determine the DMA channel running the task for the selected FEC */
@@ -675,7 +653,7 @@
#if RX_BUFFER_SIZE != 2048
#error "RX_BUFFER_SIZE must be set to 2048 for safe FEC operation"
#endif
- result = MCD_startDma(fecif->rx_dma_ch, (s8*)rxbd, 0, MCF_FEC_FECRFDR_ADDR(ch), 0, RX_BUFFER_SIZE,
+ MCD_startDma(fecif->rx_dma_ch, (s8*)rxbd, 0, MCF_FEC_FECRFDR_ADDR(ch), 0, RX_BUFFER_SIZE,
0, initiator, (long)pri,
(uint32)(MCD_FECRX_DMA | MCD_INTERRUPT | MCD_TT_FLAGS_CW | MCD_TT_FLAGS_RL | MCD_TT_FLAGS_SP),
(uint32)(MCD_NO_CSUM | MCD_NO_BYTE_SWAP)
@@ -868,7 +846,6 @@
fec_if_t *fecif = (fec_if_t *)nif->data;
uint8 ch = fecif->ch;
uint32 initiator;
- long result;
if( dma_get_channel( DMA_FEC_TX(ch) ) != -1 )
{
@@ -876,14 +853,14 @@
}
/* Make the initiator assignment */
- result = dma_set_initiator(DMA_FEC_TX(ch));
+ dma_set_initiator(DMA_FEC_TX(ch));
/* Grab the initiator number */
initiator = dma_get_initiator(DMA_FEC_TX(ch));
/* Determine the DMA channel running the task for the selected FEC */
fecif->tx_dma_ch = dma_set_channel(DMA_FEC_TX(ch), ch ? NULL : fec0_tx_frame);
/* Start the Tx DMA task */
- result = MCD_startDma(fecif->tx_dma_ch, txbd, 0, MCF_FEC_FECTFDR_ADDR(ch), 0, ETH_MTU, 0, initiator, (long)pri,
+ MCD_startDma(fecif->tx_dma_ch, txbd, 0, MCF_FEC_FECTFDR_ADDR(ch), 0, ETH_MTU, 0, initiator, (long)pri,
(uint32)(MCD_FECTX_DMA | MCD_INTERRUPT | MCD_TT_FLAGS_CW | MCD_TT_FLAGS_RL | MCD_TT_FLAGS_SP),
(uint32)(MCD_NO_CSUM | MCD_NO_BYTE_SWAP)
);