summaryrefslogtreecommitdiff
path: root/bsp/frdm-k64f
diff options
context:
space:
mode:
Diffstat (limited to 'bsp/frdm-k64f')
-rw-r--r--bsp/frdm-k64f/applications/application.c2
-rw-r--r--bsp/frdm-k64f/applications/startup.c4
-rw-r--r--bsp/frdm-k64f/board/board.c6
-rw-r--r--bsp/frdm-k64f/board/board.h2
-rw-r--r--bsp/frdm-k64f/board/drv_emac.c108
-rw-r--r--bsp/frdm-k64f/board/drv_emac.h2
-rw-r--r--bsp/frdm-k64f/board/drv_uart.c4
-rw-r--r--bsp/frdm-k64f/board/drv_uart.h4
-rw-r--r--bsp/frdm-k64f/board/led.c2
-rw-r--r--bsp/frdm-k64f/board/led.h2
-rw-r--r--bsp/frdm-k64f/rtconfig.h46
11 files changed, 91 insertions, 91 deletions
diff --git a/bsp/frdm-k64f/applications/application.c b/bsp/frdm-k64f/applications/application.c
index 3d4448e2a5..bf65b21627 100644
--- a/bsp/frdm-k64f/applications/application.c
+++ b/bsp/frdm-k64f/applications/application.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/bsp/frdm-k64f/applications/startup.c b/bsp/frdm-k64f/applications/startup.c
index 3627cb993b..68e99d3df4 100644
--- a/bsp/frdm-k64f/applications/startup.c
+++ b/bsp/frdm-k64f/applications/startup.c
@@ -1,11 +1,11 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
- *
+ *
*/
#include <rthw.h>
diff --git a/bsp/frdm-k64f/board/board.c b/bsp/frdm-k64f/board/board.c
index 334f571d69..3e761beb0e 100644
--- a/bsp/frdm-k64f/board/board.c
+++ b/bsp/frdm-k64f/board/board.c
@@ -1,11 +1,11 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
- *
+ *
*/
#include <rthw.h>
@@ -69,7 +69,7 @@ void rt_hw_board_init()
{
/* NVIC Configuration */
NVIC_Configuration();
-
+
BOARD_BootClockRUN();
/* Configure the SysTick */
diff --git a/bsp/frdm-k64f/board/board.h b/bsp/frdm-k64f/board/board.h
index 7610ade1fe..5d43d1e382 100644
--- a/bsp/frdm-k64f/board/board.h
+++ b/bsp/frdm-k64f/board/board.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/bsp/frdm-k64f/board/drv_emac.c b/bsp/frdm-k64f/board/drv_emac.c
index 606c141545..7003bbdd74 100644
--- a/bsp/frdm-k64f/board/drv_emac.c
+++ b/bsp/frdm-k64f/board/drv_emac.c
@@ -1,6 +1,6 @@
/*
* COPYRIGHT (C) 2018, Real-Thread Information Technology Ltd
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* Change Logs:
* Date Author Notes
@@ -33,7 +33,7 @@
#define DEBUG_PRINTF(...)
#endif
-#define MAX_ADDR_LEN 6
+#define MAX_ADDR_LEN 6
#define ENET_RX_RING_LEN (16)
#define ENET_TX_RING_LEN (8)
@@ -45,17 +45,17 @@
#define ENET_RXBUFF_SIZE (ENET_FRAME_MAX_FRAMELEN)
#define ENET_TXBUFF_SIZE (ENET_FRAME_MAX_FRAMELEN)
#define ENET_ETH_MAX_FLEN (1522) // recommended size for a VLAN frame
-
+
struct emac_device
{
/* inherit from Ethernet device */
struct eth_device parent;
-
- ALIGN(64) enet_rx_bd_struct_t RxBuffDescrip[ENET_RX_RING_LEN];
- ALIGN(64) enet_tx_bd_struct_t TxBuffDescrip[ENET_TX_RING_LEN];
- ALIGN(64) uint8_t RxDataBuff[ENET_RX_RING_LEN * ENET_ALIGN(ENET_RXBUFF_SIZE)];
- ALIGN(64) uint8_t TxDataBuff[ENET_TX_RING_LEN * ENET_ALIGN(ENET_TXBUFF_SIZE)];
-
+
+ ALIGN(64) enet_rx_bd_struct_t RxBuffDescrip[ENET_RX_RING_LEN];
+ ALIGN(64) enet_tx_bd_struct_t TxBuffDescrip[ENET_TX_RING_LEN];
+ ALIGN(64) uint8_t RxDataBuff[ENET_RX_RING_LEN * ENET_ALIGN(ENET_RXBUFF_SIZE)];
+ ALIGN(64) uint8_t TxDataBuff[ENET_TX_RING_LEN * ENET_ALIGN(ENET_TXBUFF_SIZE)];
+
enet_handle_t enet_handle;
rt_uint8_t dev_addr[MAX_ADDR_LEN]; /* MAC address */
struct rt_semaphore tx_wait;
@@ -112,7 +112,7 @@ static void setup_enet_clock_init(void)
{
CLOCK_EnableClock(kCLOCK_PortC);
CLOCK_EnableClock(kCLOCK_PortB);
-
+
/* Select the Ethernet timestamp clock source */
CLOCK_SetEnetTime0Clock(0x2);
}
@@ -120,7 +120,7 @@ static void setup_enet_clock_init(void)
static void enet_mac_rx_isr(struct emac_device* emac)
{
rt_err_t result;
-
+
result = eth_device_ready(&(_emac.parent));
if( result != RT_EOK )
{
@@ -136,7 +136,7 @@ static void enet_mac_tx_isr(struct emac_device* emac)
static void ethernet_callback(ENET_Type *base, enet_handle_t *handle, enet_event_t event, void *param)
{
struct emac_device* emac = param;
-
+
switch (event)
{
case kENET_RxEvent:
@@ -154,7 +154,7 @@ static rt_err_t k64_emac_init(rt_device_t dev)
{
struct emac_device* emac = K64_EMAC_DEVICE(dev);
enet_handle_t * enet_handle = &emac->enet_handle;
-
+
bool link = false;
uint32_t phyAddr = 0;
phy_speed_t phy_speed;
@@ -167,7 +167,7 @@ static rt_err_t k64_emac_init(rt_device_t dev)
setup_enet_clock_init();
/* enable iomux and clock */
setup_k64_io_enet();
-
+
/* prepare the buffer configuration. */
buffCfg.rxBdNumber = ENET_RX_RING_LEN; /* Receive buffer descriptor number. */
buffCfg.txBdNumber = ENET_TX_RING_LEN; /* Transmit buffer descriptor number. */
@@ -177,12 +177,12 @@ static rt_err_t k64_emac_init(rt_device_t dev)
buffCfg.txBdStartAddrAlign = emac->TxBuffDescrip; /* Aligned transmit buffer descriptor start address. */
buffCfg.rxBufferAlign = emac->RxDataBuff; /* Receive data buffer start address. */
buffCfg.txBufferAlign = emac->TxDataBuff; /* Transmit data buffer start address. */
-
+
sysClock = CLOCK_GetFreq(kCLOCK_CoreSysClk);
DEBUG_PRINTF("sysClock: %d\n", sysClock);
-
+
ENET_GetDefaultConfig(&config);
-
+
PHY_Init(ENET, 0, CLOCK_GetFreq(kCLOCK_CoreSysClk));
if (PHY_GetLinkStatus(ENET, phyAddr, &link) == kStatus_Success)
{
@@ -191,7 +191,7 @@ static rt_err_t k64_emac_init(rt_device_t dev)
DEBUG_PRINTF("phy link up\n");
/* Get link information from PHY */
PHY_GetLinkSpeedDuplex(ENET, phyAddr, &phy_speed, &phy_duplex);
-
+
/* Change the MII speed and duplex for actual link status. */
config.miiSpeed = (enet_mii_speed_t)phy_speed;
config.miiDuplex = (enet_mii_duplex_t)phy_duplex;
@@ -205,7 +205,7 @@ static rt_err_t k64_emac_init(rt_device_t dev)
config.macSpecialConfig = kENET_ControlFlowControlEnable;
config.txAccelerConfig = 0;
config.rxAccelerConfig = kENET_RxAccelMacCheckEnabled;
-
+
ENET_Init(ENET, enet_handle, &config, &buffCfg, emac->dev_addr, sysClock);
ENET_SetCallback(enet_handle, ethernet_callback, emac);
ENET_ActiveRead(ENET);
@@ -214,7 +214,7 @@ static rt_err_t k64_emac_init(rt_device_t dev)
{
DEBUG_PRINTF("read phy failed\n");
}
-
+
return RT_EOK;
}
@@ -244,7 +244,7 @@ static rt_err_t k64_emac_control(rt_device_t dev, int cmd, void *args)
{
struct emac_device *emac;
- DEBUG_PRINTF("k64_emac_control\n");
+ DEBUG_PRINTF("k64_emac_control\n");
emac = K64_EMAC_DEVICE(dev);
RT_ASSERT(emac != RT_NULL);
@@ -270,14 +270,14 @@ static rt_err_t k64_emac_tx(rt_device_t dev, struct pbuf* p)
struct emac_device *emac = K64_EMAC_DEVICE(dev);
enet_handle_t * enet_handle = &emac->enet_handle;
-
+
RT_ASSERT(p != NULL);
- DEBUG_PRINTF("k64_emac_tx: %d\n", p->len);
+ DEBUG_PRINTF("k64_emac_tx: %d\n", p->len);
emac = K64_EMAC_DEVICE(dev);
RT_ASSERT(emac != RT_NULL);
-
+
#ifdef DRV_EMAC_RX_DUMP
{
int i;
@@ -290,10 +290,10 @@ static rt_err_t k64_emac_tx(rt_device_t dev, struct pbuf* p)
DEBUG_PRINTF("\n");
}
DEBUG_PRINTF("\n");
- }
+ }
#endif
-
+
do
{
result = ENET_SendFrame(ENET, enet_handle, p->payload, p->len);
@@ -313,17 +313,17 @@ struct pbuf *k64_emac_rx(rt_device_t dev)
uint32_t length = 0;
status_t status;
enet_data_error_stats_t eErrStatic;
-
+
struct pbuf* p = RT_NULL;
struct emac_device *emac = K64_EMAC_DEVICE(dev);
enet_handle_t * enet_handle = &emac->enet_handle;
RT_ASSERT(emac != RT_NULL);
DEBUG_PRINTF("k64_emac_rx\n");
-
+
/* Get the Frame size */
status = ENET_GetRxFrameSize(enet_handle, &length);
-
+
if (status == kStatus_ENET_RxFrameError)
{
/* Update the received buffer when error happened. */
@@ -331,19 +331,19 @@ struct pbuf *k64_emac_rx(rt_device_t dev)
ENET_GetRxErrBeforeReadFrame(enet_handle, &eErrStatic);
/* update the receive buffer. */
ENET_ReadFrame(ENET, enet_handle, NULL, 0);
-
+
DEBUG_PRINTF("receive frame faild\n");
-
+
return p;
}
-
+
/* Call ENET_ReadFrame when there is a received frame. */
if (length != 0)
{
/* Received valid frame. Deliver the rx buffer with the size equal to length. */
p = pbuf_alloc(PBUF_RAW, length, PBUF_POOL);
}
-
+
if (p != NULL)
{
status = ENET_ReadFrame(ENET, enet_handle, p->payload, length);
@@ -370,7 +370,7 @@ struct pbuf *k64_emac_rx(rt_device_t dev)
pbuf_free(p);
}
}
-
+
return p;
}
@@ -397,7 +397,7 @@ int drv_emac_hw_init(void)
/* init tx semaphore */
rt_sem_init(&_emac.tx_wait, "tx_wait", ENET_TX_RING_LEN - 1, RT_IPC_FLAG_FIFO);
-
+
/* register ETH device */
eth_device_init(&(_emac.parent), "e0");
@@ -409,15 +409,15 @@ INIT_DEVICE_EXPORT(drv_emac_hw_init);
long k64_dump_tx_bd(void)
{
- int i;
+ int i;
+
+ enet_tx_bd_struct_t *txbd = _emac.TxBuffDescrip;
- enet_tx_bd_struct_t *txbd = _emac.TxBuffDescrip;
+ for (i = 0; i < ENET_RX_RING_LEN; i++)
+ {
+ DEBUG_PRINTF("status: %04X, length: %04X, data: %08X\n", txbd[i].control, txbd[i].length, (uint32_t)txbd[i].buffer);
+ }
- for (i = 0; i < ENET_RX_RING_LEN; i++)
- {
- DEBUG_PRINTF("status: %04X, length: %04X, data: %08X\n", txbd[i].control, txbd[i].length, (uint32_t)txbd[i].buffer);
- }
-
return 0;
}
FINSH_FUNCTION_EXPORT(k64_dump_tx_bd, dump all receive buffer descriptor);
@@ -425,21 +425,21 @@ MSH_CMD_EXPORT(k64_dump_tx_bd, dump all receive buffer descriptor);
long k64_dump_rx_bd(void)
{
- int i;
- enet_rx_bd_struct_t *rxbd = _emac.RxBuffDescrip;
+ int i;
+ enet_rx_bd_struct_t *rxbd = _emac.RxBuffDescrip;
- for (i = 0; i < ENET_RX_RING_LEN; i++)
- {
- DEBUG_PRINTF("bd:%08X, ", (void *)&rxbd[i]);
- //rt_hw_cpu_dcache_ops(RT_HW_CACHE_INVALIDATE, (void *)&rxbd[i], sizeof(enet_rx_bd_struct_t));
- DEBUG_PRINTF("status:%04X, length:%04X, data:%08X ", rxbd[i].control, rxbd[i].length, (uint32_t)rxbd[i].buffer);
+ for (i = 0; i < ENET_RX_RING_LEN; i++)
+ {
+ DEBUG_PRINTF("bd:%08X, ", (void *)&rxbd[i]);
+ //rt_hw_cpu_dcache_ops(RT_HW_CACHE_INVALIDATE, (void *)&rxbd[i], sizeof(enet_rx_bd_struct_t));
+ DEBUG_PRINTF("status:%04X, length:%04X, data:%08X ", rxbd[i].control, rxbd[i].length, (uint32_t)rxbd[i].buffer);
#ifdef ENET_ENHANCEDBUFFERDESCRIPTOR_MODE
- DEBUG_PRINTF("ce:%04X/%04X/%04X ", rxbd[i].controlExtend0, rxbd[i].controlExtend1, rxbd[i].controlExtend2);
- DEBUG_PRINTF("crc:%04X, len:%04X, type:%04X, ts:%04X", rxbd[i].payloadCheckSum, rxbd[i].headerLength, rxbd[i].protocolTyte, rxbd[i].timestamp);
+ DEBUG_PRINTF("ce:%04X/%04X/%04X ", rxbd[i].controlExtend0, rxbd[i].controlExtend1, rxbd[i].controlExtend2);
+ DEBUG_PRINTF("crc:%04X, len:%04X, type:%04X, ts:%04X", rxbd[i].payloadCheckSum, rxbd[i].headerLength, rxbd[i].protocolTyte, rxbd[i].timestamp);
#endif
- DEBUG_PRINTF("\n");
- }
-
+ DEBUG_PRINTF("\n");
+ }
+
return 0;
}
FINSH_FUNCTION_EXPORT(k64_dump_rx_bd, dump all receive buffer descriptor);
diff --git a/bsp/frdm-k64f/board/drv_emac.h b/bsp/frdm-k64f/board/drv_emac.h
index e2d0ec8c8c..3a2e55e820 100644
--- a/bsp/frdm-k64f/board/drv_emac.h
+++ b/bsp/frdm-k64f/board/drv_emac.h
@@ -1,6 +1,6 @@
/*
* COPYRIGHT (C) 2018, Real-Thread Information Technology Ltd
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* Change Logs:
* Date Author Notes
diff --git a/bsp/frdm-k64f/board/drv_uart.c b/bsp/frdm-k64f/board/drv_uart.c
index c4a1da1013..5e0ec5c2e2 100644
--- a/bsp/frdm-k64f/board/drv_uart.c
+++ b/bsp/frdm-k64f/board/drv_uart.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
@@ -243,7 +243,7 @@ void rt_hw_uart_init(void)
config.parity = PARITY_NONE;
config.stop_bits = STOP_BITS_1;
config.invert = NRZ_NORMAL;
- config.bufsz = RT_SERIAL_RB_BUFSZ;
+ config.bufsz = RT_SERIAL_RB_BUFSZ;
_k64_serial.ops = &_k64_ops;
_k64_serial.config = config;
diff --git a/bsp/frdm-k64f/board/drv_uart.h b/bsp/frdm-k64f/board/drv_uart.h
index 7fd78c9a4e..4786d07e13 100644
--- a/bsp/frdm-k64f/board/drv_uart.h
+++ b/bsp/frdm-k64f/board/drv_uart.h
@@ -1,11 +1,11 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
- *
+ *
*/
#ifndef DRV_UART_H
diff --git a/bsp/frdm-k64f/board/led.c b/bsp/frdm-k64f/board/led.c
index aebea8bdce..e6951c8fdc 100644
--- a/bsp/frdm-k64f/board/led.c
+++ b/bsp/frdm-k64f/board/led.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/bsp/frdm-k64f/board/led.h b/bsp/frdm-k64f/board/led.h
index f1c62666d6..4e669e44c3 100644
--- a/bsp/frdm-k64f/board/led.h
+++ b/bsp/frdm-k64f/board/led.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/bsp/frdm-k64f/rtconfig.h b/bsp/frdm-k64f/rtconfig.h
index 6338b39edb..51afa56099 100644
--- a/bsp/frdm-k64f/rtconfig.h
+++ b/bsp/frdm-k64f/rtconfig.h
@@ -3,16 +3,16 @@
#define __RTTHREAD_CFG_H__
/* RT_NAME_MAX*/
-#define RT_NAME_MAX 8
+#define RT_NAME_MAX 8
/* RT_ALIGN_SIZE*/
-#define RT_ALIGN_SIZE 8
+#define RT_ALIGN_SIZE 8
/* PRIORITY_MAX */
-#define RT_THREAD_PRIORITY_MAX 32
+#define RT_THREAD_PRIORITY_MAX 32
/* Tick per Second */
-#define RT_TICK_PER_SECOND 100
+#define RT_TICK_PER_SECOND 100
/* SECTION: RT_DEBUG */
/* Thread Debug */
@@ -28,9 +28,9 @@
/* Using Software Timer */
/* #define RT_USING_TIMER_SOFT */
-#define RT_TIMER_THREAD_PRIO 4
-#define RT_TIMER_THREAD_STACK_SIZE 512
-#define RT_TIMER_TICK_PER_SECOND 10
+#define RT_TIMER_THREAD_PRIO 4
+#define RT_TIMER_THREAD_STACK_SIZE 512
+#define RT_TIMER_TICK_PER_SECOND 10
/* SECTION: IPC */
/* Using Semaphore*/
@@ -73,7 +73,7 @@
/* SECTION: Console options */
#define RT_USING_CONSOLE
/* the buffer size of console*/
-#define RT_CONSOLEBUF_SIZE 128
+#define RT_CONSOLEBUF_SIZE 128
/* SECTION: finsh, a C-Express shell */
#define RT_USING_FINSH
@@ -88,18 +88,18 @@
/* Reentrancy (thread safe) of the FatFs module. */
#define RT_DFS_ELM_REENTRANT
/* Number of volumes (logical drives) to be used. */
-#define RT_DFS_ELM_DRIVES 2
-/* #define RT_DFS_ELM_USE_LFN 1 */
-#define RT_DFS_ELM_MAX_LFN 255
+#define RT_DFS_ELM_DRIVES 2
+/* #define RT_DFS_ELM_USE_LFN 1 */
+#define RT_DFS_ELM_MAX_LFN 255
/* Maximum sector size to be handled. */
#define RT_DFS_ELM_MAX_SECTOR_SIZE 512
#define RT_USING_DFS_ROMFS
/* the max number of mounted filesystem */
-#define DFS_FILESYSTEMS_MAX 2
-/* the max number of opened files */
-#define DFS_FD_MAX 4
+#define DFS_FILESYSTEMS_MAX 2
+/* the max number of opened files */
+#define DFS_FD_MAX 4
/* SECTION: lwip, a lighwight TCP/IP protocol stack */
#define RT_USING_LWIP
@@ -115,7 +115,7 @@
#define RT_LWIP_DNS
/* the number of simulatenously active TCP connections*/
-#define RT_LWIP_TCP_PCB_NUM 5
+#define RT_LWIP_TCP_PCB_NUM 5
/* ip address of target */
#define RT_LWIP_IPADDR "192.168.1.201"
@@ -127,19 +127,19 @@
#define RT_LWIP_MSKADDR "255.255.255.0"
/* tcp thread options */
-#define RT_LWIP_TCPTHREAD_PRIORITY 12
-#define RT_LWIP_TCPTHREAD_MBOX_SIZE 4
-#define RT_LWIP_TCPTHREAD_STACKSIZE 1024
+#define RT_LWIP_TCPTHREAD_PRIORITY 12
+#define RT_LWIP_TCPTHREAD_MBOX_SIZE 4
+#define RT_LWIP_TCPTHREAD_STACKSIZE 1024
/* ethernet if thread options */
-#define RT_LWIP_ETHTHREAD_PRIORITY 15
-#define RT_LWIP_ETHTHREAD_MBOX_SIZE 4
-#define RT_LWIP_ETHTHREAD_STACKSIZE 512
+#define RT_LWIP_ETHTHREAD_PRIORITY 15
+#define RT_LWIP_ETHTHREAD_MBOX_SIZE 4
+#define RT_LWIP_ETHTHREAD_STACKSIZE 512
/* TCP sender buffer space */
-#define RT_LWIP_TCP_SND_BUF 8192
+#define RT_LWIP_TCP_SND_BUF 8192
/* TCP receive window. */
-#define RT_LWIP_TCP_WND 8192
+#define RT_LWIP_TCP_WND 8192
#define CHECKSUM_CHECK_TCP 0
#define CHECKSUM_CHECK_IP 0