Skip to content

Commit 48ca812

Browse files
committed
Change license, update Readme and fixed some compability issues
1 parent 82cc9a9 commit 48ca812

33 files changed

+345
-1207
lines changed

bsp/imxrt/Libraries/imxrt1021/drivers/drv_cache.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
/*
2-
* File : drv_cache.c
3-
* This file is part of RT-Thread RTOS
4-
* COPYRIGHT (C) 2006, RT-Thread Development Team
2+
* Copyright (c) 2006-2018, RT-Thread Development Team
53
*
6-
* The license and distribution terms for this file may be
7-
* found in the file LICENSE in this distribution or at
8-
* http://www.rt-thread.org/license/LICENSE
4+
* SPDX-License-Identifier: Apache-2.0
95
*
106
* Change Logs:
117
* Date Author Notes

bsp/imxrt/Libraries/imxrt1021/drivers/drv_codec.c

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
/*
2+
* Copyright (c) 2006-2018, RT-Thread Development Team
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*
6+
* Change Logs:
7+
* Date Author Notes
8+
* 2019-03-11 JiCheng Adapt RT1020's IO MAP
9+
*/
10+
111
#include <rthw.h>
212
#include <rtthread.h>
313
#include <rtdevice.h>
@@ -55,21 +65,21 @@ static void _InitPins(void)
5565
{
5666
CLOCK_EnableClock(kCLOCK_Iomuxc);
5767

58-
IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B1_00_LPI2C1_SCL, 1);
59-
IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B1_01_LPI2C1_SDA, 1);
68+
IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B1_14_LPI2C1_SCL, 1);
69+
IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B1_15_LPI2C1_SDA, 1);
6070

61-
IOMUXC_SetPinConfig( IOMUXC_GPIO_AD_B1_00_LPI2C1_SCL, 0xD8B0u);
62-
IOMUXC_SetPinConfig( IOMUXC_GPIO_AD_B1_01_LPI2C1_SDA, 0xD8B0u);
71+
IOMUXC_SetPinConfig( IOMUXC_GPIO_AD_B1_14_LPI2C1_SCL, 0xD8B0u);
72+
IOMUXC_SetPinConfig( IOMUXC_GPIO_AD_B1_15_LPI2C1_SDA, 0xD8B0u);
6373

64-
IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B1_09_SAI1_MCLK, 1U);
65-
IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B1_13_SAI1_TX_DATA00, 1U);
66-
IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B1_14_SAI1_TX_BCLK, 1U);
67-
IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B1_15_SAI1_TX_SYNC, 1U);
74+
IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B1_00_SAI1_MCLK, 1U);
75+
IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B1_03_SAI1_TX_DATA00, 1U);
76+
IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B1_01_SAI1_TX_BCLK, 1U);
77+
IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B1_02_SAI1_TX_SYNC, 1U);
6878

69-
IOMUXC_SetPinConfig(IOMUXC_GPIO_AD_B1_09_SAI1_MCLK, 0x10B0u);
70-
IOMUXC_SetPinConfig(IOMUXC_GPIO_AD_B1_13_SAI1_TX_DATA00, 0x10B0u);
71-
IOMUXC_SetPinConfig(IOMUXC_GPIO_AD_B1_14_SAI1_TX_BCLK, 0x10B0u);
72-
IOMUXC_SetPinConfig(IOMUXC_GPIO_AD_B1_15_SAI1_TX_SYNC, 0x10B0u);
79+
IOMUXC_SetPinConfig(IOMUXC_GPIO_AD_B1_00_SAI1_MCLK, 0x10B0u);
80+
IOMUXC_SetPinConfig(IOMUXC_GPIO_AD_B1_03_SAI1_TX_DATA00, 0x10B0u);
81+
IOMUXC_SetPinConfig(IOMUXC_GPIO_AD_B1_01_SAI1_TX_BCLK, 0x10B0u);
82+
IOMUXC_SetPinConfig(IOMUXC_GPIO_AD_B1_02_SAI1_TX_SYNC, 0x10B0u);
7383
}
7484

7585
static void BOARD_EnableSaiMclkOutput(bool enable)

bsp/imxrt/Libraries/imxrt1021/drivers/drv_codec.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
/*
2+
* Copyright (c) 2006-2018, RT-Thread Development Team
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*
6+
* Change Logs:
7+
* Date Author Notes
8+
*/
19
#ifndef __DRV_CODEC_H__
210
#define __DRV_CODEC_H__
311

bsp/imxrt/Libraries/imxrt1021/drivers/drv_eth.c

Lines changed: 29 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
/*
2-
* File : application.c
3-
* This file is part of RT-Thread RTOS
4-
* COPYRIGHT (C) 2006, RT-Thread Development Team
2+
* Copyright (c) 2006-2018, RT-Thread Development Team
53
*
6-
* The license and distribution terms for this file may be
7-
* found in the file LICENSE in this distribution or at
8-
* http://www.rt-thread.org/license/LICENSE
4+
* SPDX-License-Identifier: Apache-2.0
95
*
106
* Change Logs:
117
* Date Author Notes
128
* 2017-06-08 tanek first implementation
9+
* 2019-03-11 JiCheng Adapt RT1020's IO MAP
1310
*/
1411
#include <rtthread.h>
1512
#include "board.h"
@@ -386,13 +383,13 @@ static void _enet_config(void)
386383
/* Set SMI to get PHY link status. */
387384
sysClock = CLOCK_GetFreq(kCLOCK_AhbClk);
388385

389-
dbg_log(DBG_LOG, "deinit\n");
386+
LOG_D("deinit\n");
390387
ENET_Deinit(imxrt_eth_device.enet_base);
391-
dbg_log(DBG_LOG, "init\n");
388+
LOG_D("init\n");
392389
ENET_Init(imxrt_eth_device.enet_base, &imxrt_eth_device.enet_handle, &config, &buffConfig, &imxrt_eth_device.dev_addr[0], sysClock);
393-
dbg_log(DBG_LOG, "set call back\n");
390+
LOG_D("set call back\n");
394391
ENET_SetCallback(&imxrt_eth_device.enet_handle, _enet_callback, &imxrt_eth_device);
395-
dbg_log(DBG_LOG, "active read\n");
392+
LOG_D("active read\n");
396393
ENET_ActiveRead(imxrt_eth_device.enet_base);
397394
}
398395

@@ -436,41 +433,41 @@ static void packet_dump(const char *msg, const struct pbuf *p)
436433
/* initialize the interface */
437434
static rt_err_t rt_imxrt_eth_init(rt_device_t dev)
438435
{
439-
dbg_log(DBG_LOG, "rt_imxrt_eth_init...\n");
436+
LOG_D("rt_imxrt_eth_init...\n");
440437
_enet_config();
441438

442439
return RT_EOK;
443440
}
444441

445442
static rt_err_t rt_imxrt_eth_open(rt_device_t dev, rt_uint16_t oflag)
446443
{
447-
dbg_log(DBG_LOG, "rt_imxrt_eth_open...\n");
444+
LOG_D("rt_imxrt_eth_open...\n");
448445
return RT_EOK;
449446
}
450447

451448
static rt_err_t rt_imxrt_eth_close(rt_device_t dev)
452449
{
453-
dbg_log(DBG_LOG, "rt_imxrt_eth_close...\n");
450+
LOG_D("rt_imxrt_eth_close...\n");
454451
return RT_EOK;
455452
}
456453

457454
static rt_size_t rt_imxrt_eth_read(rt_device_t dev, rt_off_t pos, void *buffer, rt_size_t size)
458455
{
459-
dbg_log(DBG_LOG, "rt_imxrt_eth_read...\n");
456+
LOG_D("rt_imxrt_eth_read...\n");
460457
rt_set_errno(-RT_ENOSYS);
461458
return 0;
462459
}
463460

464461
static rt_size_t rt_imxrt_eth_write(rt_device_t dev, rt_off_t pos, const void *buffer, rt_size_t size)
465462
{
466-
dbg_log(DBG_LOG, "rt_imxrt_eth_write...\n");
463+
LOG_D("rt_imxrt_eth_write...\n");
467464
rt_set_errno(-RT_ENOSYS);
468465
return 0;
469466
}
470467

471468
static rt_err_t rt_imxrt_eth_control(rt_device_t dev, int cmd, void *args)
472469
{
473-
dbg_log(DBG_LOG, "rt_imxrt_eth_control...\n");
470+
LOG_D("rt_imxrt_eth_control...\n");
474471
switch (cmd)
475472
{
476473
case NIOCTL_GADDR:
@@ -679,7 +676,7 @@ rt_err_t rt_imxrt_eth_tx(rt_device_t dev, struct pbuf *p)
679676
RT_ASSERT(p != NULL);
680677
RT_ASSERT(enet_handle != RT_NULL);
681678

682-
dbg_log(DBG_LOG, "rt_imxrt_eth_tx: %d\n", p->len);
679+
LOG_D("rt_imxrt_eth_tx: %d\n", p->len);
683680

684681
#ifdef ETH_TX_DUMP
685682
packet_dump("send", p);
@@ -733,18 +730,18 @@ struct pbuf *rt_imxrt_eth_rx(rt_device_t dev)
733730
}
734731
else
735732
{
736-
dbg_log(DBG_LOG, " A frame read failed\n");
733+
LOG_D(" A frame read failed\n");
737734
pbuf_free(p);
738735
}
739736
}
740737
else
741738
{
742-
dbg_log(DBG_LOG, " pbuf_alloc faild\n");
739+
LOG_D(" pbuf_alloc faild\n");
743740
}
744741
}
745742
else if (status == kStatus_ENET_RxFrameError)
746743
{
747-
dbg_log(DBG_WARNING, "ENET_GetRxFrameSize: kStatus_ENET_RxFrameError\n");
744+
LOG_W("ENET_GetRxFrameSize: kStatus_ENET_RxFrameError\n");
748745
/* Update the received buffer when error happened. */
749746
/* Get the error information of the received g_frame. */
750747
ENET_GetRxErrBeforeReadFrame(enet_handle, error_statistic);
@@ -782,20 +779,20 @@ static void phy_monitor_thread_entry(void *parameter)
782779

783780
if (kPHY_Speed10M == speed)
784781
{
785-
dbg_log(DBG_LOG, "10M\n");
782+
LOG_D("10M\n");
786783
}
787784
else
788785
{
789-
dbg_log(DBG_LOG, "100M\n");
786+
LOG_D("100M\n");
790787
}
791788

792789
if (kPHY_HalfDuplex == duplex)
793790
{
794-
dbg_log(DBG_LOG, "half dumplex\n");
791+
LOG_D("half dumplex\n");
795792
}
796793
else
797794
{
798-
dbg_log(DBG_LOG, "full dumplex\n");
795+
LOG_D("full dumplex\n");
799796
}
800797

801798
if ((imxrt_eth_device.speed != (enet_mii_speed_t)speed)
@@ -804,19 +801,19 @@ static void phy_monitor_thread_entry(void *parameter)
804801
imxrt_eth_device.speed = (enet_mii_speed_t)speed;
805802
imxrt_eth_device.duplex = (enet_mii_duplex_t)duplex;
806803

807-
dbg_log(DBG_LOG, "link up, and update eth mode.\n");
804+
LOG_D("link up, and update eth mode.\n");
808805
rt_imxrt_eth_init((rt_device_t)&imxrt_eth_device);
809806
}
810807
else
811808
{
812-
dbg_log(DBG_LOG, "link up, eth not need re-config.\n");
809+
LOG_D("link up, eth not need re-config.\n");
813810
}
814-
dbg_log(DBG_LOG, "link up.\n");
811+
LOG_D("link up.\n");
815812
eth_device_linkchange(&imxrt_eth_device.parent, RT_TRUE);
816813
}
817814
else // link down
818815
{
819-
dbg_log(DBG_LOG, "link down.\n");
816+
LOG_D("link down.\n");
820817
eth_device_linkchange(&imxrt_eth_device.parent, RT_FALSE);
821818
}
822819
}
@@ -858,20 +855,20 @@ static int rt_hw_imxrt_eth_init(void)
858855
imxrt_eth_device.parent.eth_rx = rt_imxrt_eth_rx;
859856
imxrt_eth_device.parent.eth_tx = rt_imxrt_eth_tx;
860857

861-
dbg_log(DBG_LOG, "sem init: tx_wait\r\n");
858+
LOG_D("sem init: tx_wait\r\n");
862859
/* init tx semaphore */
863860
rt_sem_init(&imxrt_eth_device.tx_wait, "tx_wait", 0, RT_IPC_FLAG_FIFO);
864861

865862
/* register eth device */
866-
dbg_log(DBG_LOG, "eth_device_init start\r\n");
863+
LOG_D("eth_device_init start\r\n");
867864
state = eth_device_init(&(imxrt_eth_device.parent), "e0");
868865
if (RT_EOK == state)
869866
{
870-
dbg_log(DBG_LOG, "eth_device_init success\r\n");
867+
LOG_D("eth_device_init success\r\n");
871868
}
872869
else
873870
{
874-
dbg_log(DBG_LOG, "eth_device_init faild: %d\r\n", state);
871+
LOG_D("eth_device_init faild: %d\r\n", state);
875872
}
876873

877874
eth_device_linkchange(&imxrt_eth_device.parent, RT_FALSE);

bsp/imxrt/Libraries/imxrt1021/drivers/drv_flexspi_nor.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* Change Logs:
77
* Date Author Notes
88
* 2018-07-05 ZYH the first version
9+
* 2019-03-11 JiCheng Remove section"itcm", use scatter file to allocate drv_flexspi.o to itcm
910
*/
1011
#include <rtthread.h>
1112
#define PRINTF rt_kprintf

bsp/imxrt/Libraries/imxrt1021/drivers/drv_hwtimer.c

Lines changed: 21 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,12 @@
11
/*
2-
* File : drv_hwtimer.c
3-
* This file is part of RT-Thread RTOS
4-
* COPYRIGHT (C) 2017, RT-Thread Development Team
5-
*
6-
* This program is free software; you can redistribute it and/or modify
7-
* it under the terms of the GNU General Public License as published by
8-
* the Free Software Foundation; either version 2 of the License, or
9-
* (at your option) any later version.
10-
*
11-
* This program is distributed in the hope that it will be useful,
12-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14-
* GNU General Public License for more details.
15-
*
16-
* You should have received a copy of the GNU General Public License along
17-
* with this program; if not, write to the Free Software Foundation, Inc.,
18-
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19-
*
2+
* Copyright (c) 2006-2018, RT-Thread Development Team
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*
206
* Change Logs:
217
* Date Author Notes
228
* 2018-04-17 WangBing the first version.
9+
* 2019-03-11 JiCheng Change API name from rt1052 to rt1021
2310
*/
2411

2512
#include <rtthread.h>
@@ -47,7 +34,7 @@ static void NVIC_Configuration(void)
4734
EnableIRQ(GPT1_IRQn);
4835
}
4936

50-
static rt_err_t rt1052_hwtimer_control(rt_hwtimer_t *timer, rt_uint32_t cmd, void *args)
37+
static rt_err_t rt1021_hwtimer_control(rt_hwtimer_t *timer, rt_uint32_t cmd, void *args)
5138
{
5239
rt_err_t err = RT_EOK;
5340
GPT_Type *hwtimer_dev;
@@ -73,7 +60,7 @@ static rt_err_t rt1052_hwtimer_control(rt_hwtimer_t *timer, rt_uint32_t cmd, voi
7360
return err;
7461
}
7562

76-
static rt_uint32_t rt1052_hwtimer_count_get(rt_hwtimer_t *timer)
63+
static rt_uint32_t rt1021_hwtimer_count_get(rt_hwtimer_t *timer)
7764
{
7865
rt_uint32_t CurrentTimer_Count;
7966
GPT_Type *hwtimer_dev;
@@ -86,7 +73,7 @@ static rt_uint32_t rt1052_hwtimer_count_get(rt_hwtimer_t *timer)
8673
return CurrentTimer_Count;
8774
}
8875

89-
static void rt1052_hwtimer_init(rt_hwtimer_t *timer, rt_uint32_t state)
76+
static void rt1021_hwtimer_init(rt_hwtimer_t *timer, rt_uint32_t state)
9077
{
9178
GPT_Type *hwtimer_dev;
9279
gpt_config_t gptConfig;
@@ -108,7 +95,7 @@ static void rt1052_hwtimer_init(rt_hwtimer_t *timer, rt_uint32_t state)
10895
}
10996
}
11097

111-
static rt_err_t rt1052_hwtimer_start(rt_hwtimer_t *timer, rt_uint32_t cnt, rt_hwtimer_mode_t mode)
98+
static rt_err_t rt1021_hwtimer_start(rt_hwtimer_t *timer, rt_uint32_t cnt, rt_hwtimer_mode_t mode)
11299
{
113100
GPT_Type *hwtimer_dev;
114101
hwtimer_dev = (GPT_Type *)timer->parent.user_data;
@@ -128,7 +115,7 @@ static rt_err_t rt1052_hwtimer_start(rt_hwtimer_t *timer, rt_uint32_t cnt, rt_hw
128115
return RT_EOK;
129116
}
130117

131-
static void rt1052_hwtimer_stop(rt_hwtimer_t *timer)
118+
static void rt1021_hwtimer_stop(rt_hwtimer_t *timer)
132119
{
133120
GPT_Type *hwtimer_dev;
134121
hwtimer_dev = (GPT_Type *)timer->parent.user_data;
@@ -138,16 +125,16 @@ static void rt1052_hwtimer_stop(rt_hwtimer_t *timer)
138125
GPT_StopTimer(hwtimer_dev);
139126
}
140127

141-
static const struct rt_hwtimer_ops rt1052_hwtimer_ops =
128+
static const struct rt_hwtimer_ops rt1021_hwtimer_ops =
142129
{
143-
rt1052_hwtimer_init,
144-
rt1052_hwtimer_start,
145-
rt1052_hwtimer_stop,
146-
rt1052_hwtimer_count_get,
147-
rt1052_hwtimer_control,
130+
rt1021_hwtimer_init,
131+
rt1021_hwtimer_start,
132+
rt1021_hwtimer_stop,
133+
rt1021_hwtimer_count_get,
134+
rt1021_hwtimer_control,
148135
};
149136

150-
static const struct rt_hwtimer_info rt1052_hwtimer_info =
137+
static const struct rt_hwtimer_info rt1021_hwtimer_info =
151138
{
152139
25000000, /* the maximum count frequency can be set */
153140
6103, /* the minimum count frequency can be set */
@@ -157,12 +144,12 @@ static const struct rt_hwtimer_info rt1052_hwtimer_info =
157144

158145
static rt_hwtimer_t GPT_timer1;
159146

160-
int rt1052_hw_hwtimer_init(void)
147+
int rt1021_hw_hwtimer_init(void)
161148
{
162149
int ret = RT_EOK;
163150

164-
GPT_timer1.info = &rt1052_hwtimer_info;
165-
GPT_timer1.ops = &rt1052_hwtimer_ops;
151+
GPT_timer1.info = &rt1021_hwtimer_info;
152+
GPT_timer1.ops = &rt1021_hwtimer_ops;
166153

167154
rt_device_hwtimer_register(&GPT_timer1, "_timer", GPT1);
168155

@@ -184,6 +171,6 @@ void GPT1_IRQHandler(void)
184171
#endif
185172
}
186173

187-
INIT_DEVICE_EXPORT(rt1052_hw_hwtimer_init);
174+
INIT_DEVICE_EXPORT(rt1021_hw_hwtimer_init);
188175

189176
#endif /*RT_USING_HWTIMER*/

0 commit comments

Comments
 (0)