Skip to content

Commit 2f190c8

Browse files
committed
[M487/NUC472] Fix tx frame length and remove GPL license
1 parent ef18db3 commit 2f190c8

File tree

7 files changed

+89
-182
lines changed

7 files changed

+89
-182
lines changed

features/netsocket/emac-drivers/TARGET_NUVOTON_EMAC/TARGET_M480/m480_eth.c

Lines changed: 11 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,18 @@
11
/*
2-
* Copyright (c) 2018 Nuvoton Technology Corp.
2+
* Copyright (c) 2018 Nuvoton Technology Corp.
3+
* Copyright (c) 2018 ARM Limited
34
*
4-
* See file CREDITS for list of people who contributed to this
5-
* project.
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
68
*
7-
* This program is free software; you can redistribute it and/or
8-
* modify it under the terms of the GNU General Public License as
9-
* published by the Free Software Foundation; either version 2 of
10-
* the License, or (at your option) any later version.
9+
* http://www.apache.org/licenses/LICENSE-2.0
1110
*
12-
* This program is distributed in the hope that it will be useful,
13-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15-
* GNU General Public License for more details.
16-
*
17-
* You should have received a copy of the GNU General Public License
18-
* along with this program; if not, write to the Free Software
19-
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
20-
* MA 02111-1307 USA
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
2116
*
2217
* Description: M480 MAC driver source file
2318
*/
@@ -297,36 +292,6 @@ void EMAC_RX_IRQHandler(void)
297292
if (nu_eth_txrx_cb != NULL) nu_eth_txrx_cb('R', nu_userData);
298293
}
299294

300-
#if 0
301-
void EMAC_RX_Action(void)
302-
{
303-
unsigned int cur_entry, status;
304-
do {
305-
306-
cur_entry = EMAC->CRXDSA;
307-
308-
if ((cur_entry == (uint32_t)cur_rx_desc_ptr) && (!(m_status & EMAC_INTSTS_RDUIF_Msk))) // cur_entry may equal to cur_rx_desc_ptr if RDU occures
309-
break;
310-
status = cur_rx_desc_ptr->status1;
311-
312-
if(status & OWNERSHIP_EMAC)
313-
break;
314-
315-
if (status & RXFD_RXGD) {
316-
// Lwip will invoke osMutexWait for resource protection, so ethernetif_input can't be called in EMAC_RX_IRQHandler.
317-
//ethernetif_input(status & 0xFFFF, cur_rx_desc_ptr->buf, cur_rx_desc_ptr->status2, (uint32_t)cur_rx_desc_ptr->next);
318-
319-
}
320-
321-
cur_rx_desc_ptr->status1 = OWNERSHIP_EMAC;
322-
cur_rx_desc_ptr = cur_rx_desc_ptr->next;
323-
324-
} while (1);
325-
326-
ETH_TRIGGER_RX();
327-
// eth_arch_tcpip_thread();
328-
}
329-
#endif
330295

331296
void numaker_eth_trigger_rx(void)
332297
{
@@ -349,8 +314,6 @@ int numaker_eth_get_rx_buf(uint16_t *len, uint8_t **buf)
349314
*buf = cur_rx_desc_ptr->buf;
350315
*len = status & 0xFFFF;
351316
}
352-
// cur_rx_desc_ptr->status1 = OWNERSHIP_EMAC;
353-
// cur_rx_desc_ptr = cur_rx_desc_ptr->next;
354317
return 0;
355318
}
356319

features/netsocket/emac-drivers/TARGET_NUVOTON_EMAC/TARGET_M480/m480_eth.h

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,18 @@
11
/*
2-
* Copyright (c) 2018 Nuvoton Technology Corp.
2+
* Copyright (c) 2018 Nuvoton Technology Corp.
3+
* Copyright (c) 2018 ARM Limited
34
*
4-
* See file CREDITS for list of people who contributed to this
5-
* project.
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
68
*
7-
* This program is free software; you can redistribute it and/or
8-
* modify it under the terms of the GNU General Public License as
9-
* published by the Free Software Foundation; either version 2 of
10-
* the License, or (at your option) any later version.
9+
* http://www.apache.org/licenses/LICENSE-2.0
1110
*
12-
* This program is distributed in the hope that it will be useful,
13-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15-
* GNU General Public License for more details.
16-
*
17-
* You should have received a copy of the GNU General Public License
18-
* along with this program; if not, write to the Free Software
19-
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
20-
* MA 02111-1307 USA
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
2116
*
2217
* Description: M480 EMAC driver header file
2318
*/

features/netsocket/emac-drivers/TARGET_NUVOTON_EMAC/TARGET_NUC472/nuc472_eth.c

Lines changed: 17 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,18 @@
11
/*
2-
* Copyright (c) 2018 Nuvoton Technology Corp.
2+
* Copyright (c) 2018 Nuvoton Technology Corp.
3+
* Copyright (c) 2018 ARM Limited
34
*
4-
* See file CREDITS for list of people who contributed to this
5-
* project.
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
68
*
7-
* This program is free software; you can redistribute it and/or
8-
* modify it under the terms of the GNU General Public License as
9-
* published by the Free Software Foundation; either version 2 of
10-
* the License, or (at your option) any later version.
9+
* http://www.apache.org/licenses/LICENSE-2.0
1110
*
12-
* This program is distributed in the hope that it will be useful,
13-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15-
* GNU General Public License for more details.
16-
*
17-
* You should have received a copy of the GNU General Public License
18-
* along with this program; if not, write to the Free Software
19-
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
20-
* MA 02111-1307 USA
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
2116
*
2217
* Description: NUC472 MAC driver source file
2318
*/
@@ -270,36 +265,6 @@ void EMAC_RX_IRQHandler(void)
270265
if (nu_eth_txrx_cb != NULL) nu_eth_txrx_cb('R', nu_userData);
271266
}
272267

273-
#if 0
274-
void EMAC_RX_Action(void)
275-
{
276-
unsigned int cur_entry, status;
277-
do {
278-
279-
cur_entry = EMAC->CRXDSA;
280-
281-
if ((cur_entry == (uint32_t)cur_rx_desc_ptr) && (!(m_status & EMAC_INTSTS_RDUIF_Msk))) // cur_entry may equal to cur_rx_desc_ptr if RDU occures
282-
break;
283-
status = cur_rx_desc_ptr->status1;
284-
285-
if(status & OWNERSHIP_EMAC)
286-
break;
287-
288-
if (status & RXFD_RXGD) {
289-
// Lwip will invoke osMutexWait for resource protection, so ethernetif_input can't be called in EMAC_RX_IRQHandler.
290-
//ethernetif_input(status & 0xFFFF, cur_rx_desc_ptr->buf, cur_rx_desc_ptr->status2, (uint32_t)cur_rx_desc_ptr->next);
291-
292-
}
293-
294-
cur_rx_desc_ptr->status1 = OWNERSHIP_EMAC;
295-
cur_rx_desc_ptr = cur_rx_desc_ptr->next;
296-
297-
} while (1);
298-
299-
ETH_TRIGGER_RX();
300-
// eth_arch_tcpip_thread();
301-
}
302-
#endif
303268

304269
void numaker_eth_trigger_rx(void)
305270
{
@@ -322,11 +287,15 @@ int numaker_eth_get_rx_buf(uint16_t *len, uint8_t **buf)
322287
*buf = cur_rx_desc_ptr->buf;
323288
*len = status & 0xFFFF;
324289
}
325-
cur_rx_desc_ptr->status1 = OWNERSHIP_EMAC;
326-
cur_rx_desc_ptr = cur_rx_desc_ptr->next;
327290
return 0;
328291
}
329292

293+
void numaker_eth_rx_next(void)
294+
{
295+
cur_rx_desc_ptr->status1 = OWNERSHIP_EMAC;
296+
cur_rx_desc_ptr = cur_rx_desc_ptr->next;
297+
}
298+
330299
void EMAC_TX_IRQHandler(void)
331300
{
332301
unsigned int cur_entry, status;

features/netsocket/emac-drivers/TARGET_NUVOTON_EMAC/TARGET_NUC472/nuc472_eth.h

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,18 @@
11
/*
2-
* Copyright (c) 2018 Nuvoton Technology Corp.
2+
* Copyright (c) 2018 Nuvoton Technology Corp.
3+
* Copyright (c) 2018 ARM Limited
34
*
4-
* See file CREDITS for list of people who contributed to this
5-
* project.
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
68
*
7-
* This program is free software; you can redistribute it and/or
8-
* modify it under the terms of the GNU General Public License as
9-
* published by the Free Software Foundation; either version 2 of
10-
* the License, or (at your option) any later version.
9+
* http://www.apache.org/licenses/LICENSE-2.0
1110
*
12-
* This program is distributed in the hope that it will be useful,
13-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15-
* GNU General Public License for more details.
16-
*
17-
* You should have received a copy of the GNU General Public License
18-
* along with this program; if not, write to the Free Software
19-
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
20-
* MA 02111-1307 USA
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
2116
*
2217
* Description: NUC472 EMAC driver header file
2318
*/

features/netsocket/emac-drivers/TARGET_NUVOTON_EMAC/numaker_emac.cpp

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,19 @@
11
/*
2-
* Copyright (c) 2018 Nuvoton Technology Corp.
2+
* Copyright (c) 2018 Nuvoton Technology Corp.
3+
* Copyright (c) 2018 ARM Limited
34
*
4-
* See file CREDITS for list of people who contributed to this
5-
* project.
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
68
*
7-
* This program is free software; you can redistribute it and/or
8-
* modify it under the terms of the GNU General Public License as
9-
* published by the Free Software Foundation; either version 2 of
10-
* the License, or (at your option) any later version.
9+
* http://www.apache.org/licenses/LICENSE-2.0
1110
*
12-
* This program is distributed in the hope that it will be useful,
13-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15-
* GNU General Public License for more details.
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
1616
*
17-
* You should have received a copy of the GNU General Public License
18-
* along with this program; if not, write to the Free Software
19-
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
20-
* MA 02111-1307 USA
2117
*
2218
* Description: NuMaker EMAC
2319
*/
@@ -34,7 +30,7 @@
3430
#include "netsocket/nsapi_types.h"
3531
#include "mbed_shared_queues.h"
3632

37-
#define NU_TRACE
33+
//#define NU_TRACE
3834

3935
#include "numaker_emac_config.h"
4036
#include "numaker_emac.h"
@@ -140,7 +136,6 @@ int NUMAKER_EMAC::low_level_input(emac_mem_buf_t **buf)
140136
if ( numaker_eth_get_rx_buf(&len, &buffer) != 0) {
141137
return -1;
142138
}
143-
144139
byteslefttocopy = len;
145140

146141
if (len > 0) {
@@ -156,10 +151,11 @@ int NUMAKER_EMAC::low_level_input(emac_mem_buf_t **buf)
156151
NU_DEBUGF(("offset=[%d], bytes-to-copy[%d]\r\n",bufferoffset,byteslefttocopy));
157152
/* Copy data in pbuf */
158153
memcpy(static_cast<uint8_t *>(memory_manager->get_ptr(q)) + payloadoffset, static_cast<uint8_t *>(buffer) + bufferoffset, byteslefttocopy);
154+
159155
bufferoffset = bufferoffset + byteslefttocopy;
160156
}
161157
}
162-
numaker_eth_rx_next();
158+
163159
return 0;
164160
}
165161

@@ -201,7 +197,7 @@ void NUMAKER_EMAC::packet_rx()
201197
NU_DEBUGF(("%s ... p=0x%x\r\n",__FUNCTION__,p));
202198
emac_link_input_cb(p);
203199
}
204-
// numaker_eth_rx_next();
200+
numaker_eth_rx_next();
205201
}
206202
numaker_eth_trigger_rx();
207203

@@ -263,9 +259,9 @@ bool NUMAKER_EMAC::link_out(emac_mem_buf_t *buf)
263259
bufferoffset = bufferoffset + byteslefttocopy;
264260
framelength = framelength + byteslefttocopy;
265261
}
266-
262+
267263
/* Prepare transmit descriptors to give to DMA */
268-
numaker_eth_trigger_tx(byteslefttocopy, NULL);
264+
numaker_eth_trigger_tx(framelength, NULL);
269265

270266
result = true;
271267

features/netsocket/emac-drivers/TARGET_NUVOTON_EMAC/numaker_emac_config.h

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,17 @@
1-
/*
2-
* Copyright (c) 2018 Nuvoton Technology Corp.
1+
/* Copyright (c) 2018 ARM Limited
32
*
4-
* See file CREDITS for list of people who contributed to this
5-
* project.
3+
* Licensed under the Apache License, Version 2.0 (the "License");
4+
* you may not use this file except in compliance with the License.
5+
* You may obtain a copy of the License at
66
*
7-
* This program is free software; you can redistribute it and/or
8-
* modify it under the terms of the GNU General Public License as
9-
* published by the Free Software Foundation; either version 2 of
10-
* the License, or (at your option) any later version.
7+
* http://www.apache.org/licenses/LICENSE-2.0
118
*
12-
* This program is distributed in the hope that it will be useful,
13-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15-
* GNU General Public License for more details.
9+
* Unless required by applicable law or agreed to in writing, software
10+
* distributed under the License is distributed on an "AS IS" BASIS,
11+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
* See the License for the specific language governing permissions and
13+
* limitations under the License.
1614
*
17-
* You should have received a copy of the GNU General Public License
18-
* along with this program; if not, write to the Free Software
19-
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
20-
* MA 02111-1307 USA
2115
*
2216
* Description: NuMaker EMAC Config header file
2317
*/

features/netsocket/emac-drivers/TARGET_NUVOTON_EMAC/numaker_eth_hal.h

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,20 @@
11
/*
2-
* Copyright (c) 2018 Nuvoton Technology Corp.
2+
* Copyright (c) 2018 Nuvoton Technology Corp.
3+
* Copyright (c) 2018 ARM Limited
34
*
4-
* See file CREDITS for list of people who contributed to this
5-
* project.
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
68
*
7-
* This program is free software; you can redistribute it and/or
8-
* modify it under the terms of the GNU General Public License as
9-
* published by the Free Software Foundation; either version 2 of
10-
* the License, or (at your option) any later version.
9+
* http://www.apache.org/licenses/LICENSE-2.0
1110
*
12-
* This program is distributed in the hope that it will be useful,
13-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15-
* GNU General Public License for more details.
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
1616
*
17-
* You should have received a copy of the GNU General Public License
18-
* along with this program; if not, write to the Free Software
19-
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
20-
* MA 02111-1307 USA
21-
*
22-
* Description: NUC472 EMAC driver header file
17+
* Description: NuMaker EMAC HAL header file
2318
*/
2419

2520
#ifndef NUMAKER_ETH_HAL_

0 commit comments

Comments
 (0)