mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-03-27 09:32:28 +08:00
Change license, update Readme and fixed some compability issues
This commit is contained in:
@@ -1,11 +1,7 @@
|
||||
/*
|
||||
* File : drv_cache.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2019-03-11 JiCheng Adapt RT1020's IO MAP
|
||||
*/
|
||||
|
||||
#include <rthw.h>
|
||||
#include <rtthread.h>
|
||||
#include <rtdevice.h>
|
||||
@@ -55,21 +65,21 @@ static void _InitPins(void)
|
||||
{
|
||||
CLOCK_EnableClock(kCLOCK_Iomuxc);
|
||||
|
||||
IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B1_00_LPI2C1_SCL, 1);
|
||||
IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B1_01_LPI2C1_SDA, 1);
|
||||
IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B1_14_LPI2C1_SCL, 1);
|
||||
IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B1_15_LPI2C1_SDA, 1);
|
||||
|
||||
IOMUXC_SetPinConfig( IOMUXC_GPIO_AD_B1_00_LPI2C1_SCL, 0xD8B0u);
|
||||
IOMUXC_SetPinConfig( IOMUXC_GPIO_AD_B1_01_LPI2C1_SDA, 0xD8B0u);
|
||||
IOMUXC_SetPinConfig( IOMUXC_GPIO_AD_B1_14_LPI2C1_SCL, 0xD8B0u);
|
||||
IOMUXC_SetPinConfig( IOMUXC_GPIO_AD_B1_15_LPI2C1_SDA, 0xD8B0u);
|
||||
|
||||
IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B1_09_SAI1_MCLK, 1U);
|
||||
IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B1_13_SAI1_TX_DATA00, 1U);
|
||||
IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B1_14_SAI1_TX_BCLK, 1U);
|
||||
IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B1_15_SAI1_TX_SYNC, 1U);
|
||||
IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B1_00_SAI1_MCLK, 1U);
|
||||
IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B1_03_SAI1_TX_DATA00, 1U);
|
||||
IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B1_01_SAI1_TX_BCLK, 1U);
|
||||
IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B1_02_SAI1_TX_SYNC, 1U);
|
||||
|
||||
IOMUXC_SetPinConfig(IOMUXC_GPIO_AD_B1_09_SAI1_MCLK, 0x10B0u);
|
||||
IOMUXC_SetPinConfig(IOMUXC_GPIO_AD_B1_13_SAI1_TX_DATA00, 0x10B0u);
|
||||
IOMUXC_SetPinConfig(IOMUXC_GPIO_AD_B1_14_SAI1_TX_BCLK, 0x10B0u);
|
||||
IOMUXC_SetPinConfig(IOMUXC_GPIO_AD_B1_15_SAI1_TX_SYNC, 0x10B0u);
|
||||
IOMUXC_SetPinConfig(IOMUXC_GPIO_AD_B1_00_SAI1_MCLK, 0x10B0u);
|
||||
IOMUXC_SetPinConfig(IOMUXC_GPIO_AD_B1_03_SAI1_TX_DATA00, 0x10B0u);
|
||||
IOMUXC_SetPinConfig(IOMUXC_GPIO_AD_B1_01_SAI1_TX_BCLK, 0x10B0u);
|
||||
IOMUXC_SetPinConfig(IOMUXC_GPIO_AD_B1_02_SAI1_TX_SYNC, 0x10B0u);
|
||||
}
|
||||
|
||||
static void BOARD_EnableSaiMclkOutput(bool enable)
|
||||
|
||||
@@ -1,3 +1,11 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
*/
|
||||
#ifndef __DRV_CODEC_H__
|
||||
#define __DRV_CODEC_H__
|
||||
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
/*
|
||||
* File : application.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2017-06-08 tanek first implementation
|
||||
* 2019-03-11 JiCheng Adapt RT1020's IO MAP
|
||||
*/
|
||||
#include <rtthread.h>
|
||||
#include "board.h"
|
||||
@@ -386,13 +383,13 @@ static void _enet_config(void)
|
||||
/* Set SMI to get PHY link status. */
|
||||
sysClock = CLOCK_GetFreq(kCLOCK_AhbClk);
|
||||
|
||||
dbg_log(DBG_LOG, "deinit\n");
|
||||
LOG_D("deinit\n");
|
||||
ENET_Deinit(imxrt_eth_device.enet_base);
|
||||
dbg_log(DBG_LOG, "init\n");
|
||||
LOG_D("init\n");
|
||||
ENET_Init(imxrt_eth_device.enet_base, &imxrt_eth_device.enet_handle, &config, &buffConfig, &imxrt_eth_device.dev_addr[0], sysClock);
|
||||
dbg_log(DBG_LOG, "set call back\n");
|
||||
LOG_D("set call back\n");
|
||||
ENET_SetCallback(&imxrt_eth_device.enet_handle, _enet_callback, &imxrt_eth_device);
|
||||
dbg_log(DBG_LOG, "active read\n");
|
||||
LOG_D("active read\n");
|
||||
ENET_ActiveRead(imxrt_eth_device.enet_base);
|
||||
}
|
||||
|
||||
@@ -436,7 +433,7 @@ static void packet_dump(const char *msg, const struct pbuf *p)
|
||||
/* initialize the interface */
|
||||
static rt_err_t rt_imxrt_eth_init(rt_device_t dev)
|
||||
{
|
||||
dbg_log(DBG_LOG, "rt_imxrt_eth_init...\n");
|
||||
LOG_D("rt_imxrt_eth_init...\n");
|
||||
_enet_config();
|
||||
|
||||
return RT_EOK;
|
||||
@@ -444,33 +441,33 @@ static rt_err_t rt_imxrt_eth_init(rt_device_t dev)
|
||||
|
||||
static rt_err_t rt_imxrt_eth_open(rt_device_t dev, rt_uint16_t oflag)
|
||||
{
|
||||
dbg_log(DBG_LOG, "rt_imxrt_eth_open...\n");
|
||||
LOG_D("rt_imxrt_eth_open...\n");
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
static rt_err_t rt_imxrt_eth_close(rt_device_t dev)
|
||||
{
|
||||
dbg_log(DBG_LOG, "rt_imxrt_eth_close...\n");
|
||||
LOG_D("rt_imxrt_eth_close...\n");
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
static rt_size_t rt_imxrt_eth_read(rt_device_t dev, rt_off_t pos, void *buffer, rt_size_t size)
|
||||
{
|
||||
dbg_log(DBG_LOG, "rt_imxrt_eth_read...\n");
|
||||
LOG_D("rt_imxrt_eth_read...\n");
|
||||
rt_set_errno(-RT_ENOSYS);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static rt_size_t rt_imxrt_eth_write(rt_device_t dev, rt_off_t pos, const void *buffer, rt_size_t size)
|
||||
{
|
||||
dbg_log(DBG_LOG, "rt_imxrt_eth_write...\n");
|
||||
LOG_D("rt_imxrt_eth_write...\n");
|
||||
rt_set_errno(-RT_ENOSYS);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static rt_err_t rt_imxrt_eth_control(rt_device_t dev, int cmd, void *args)
|
||||
{
|
||||
dbg_log(DBG_LOG, "rt_imxrt_eth_control...\n");
|
||||
LOG_D("rt_imxrt_eth_control...\n");
|
||||
switch (cmd)
|
||||
{
|
||||
case NIOCTL_GADDR:
|
||||
@@ -679,7 +676,7 @@ rt_err_t rt_imxrt_eth_tx(rt_device_t dev, struct pbuf *p)
|
||||
RT_ASSERT(p != NULL);
|
||||
RT_ASSERT(enet_handle != RT_NULL);
|
||||
|
||||
dbg_log(DBG_LOG, "rt_imxrt_eth_tx: %d\n", p->len);
|
||||
LOG_D("rt_imxrt_eth_tx: %d\n", p->len);
|
||||
|
||||
#ifdef ETH_TX_DUMP
|
||||
packet_dump("send", p);
|
||||
@@ -733,18 +730,18 @@ struct pbuf *rt_imxrt_eth_rx(rt_device_t dev)
|
||||
}
|
||||
else
|
||||
{
|
||||
dbg_log(DBG_LOG, " A frame read failed\n");
|
||||
LOG_D(" A frame read failed\n");
|
||||
pbuf_free(p);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dbg_log(DBG_LOG, " pbuf_alloc faild\n");
|
||||
LOG_D(" pbuf_alloc faild\n");
|
||||
}
|
||||
}
|
||||
else if (status == kStatus_ENET_RxFrameError)
|
||||
{
|
||||
dbg_log(DBG_WARNING, "ENET_GetRxFrameSize: kStatus_ENET_RxFrameError\n");
|
||||
LOG_W("ENET_GetRxFrameSize: kStatus_ENET_RxFrameError\n");
|
||||
/* Update the received buffer when error happened. */
|
||||
/* Get the error information of the received g_frame. */
|
||||
ENET_GetRxErrBeforeReadFrame(enet_handle, error_statistic);
|
||||
@@ -782,20 +779,20 @@ static void phy_monitor_thread_entry(void *parameter)
|
||||
|
||||
if (kPHY_Speed10M == speed)
|
||||
{
|
||||
dbg_log(DBG_LOG, "10M\n");
|
||||
LOG_D("10M\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
dbg_log(DBG_LOG, "100M\n");
|
||||
LOG_D("100M\n");
|
||||
}
|
||||
|
||||
if (kPHY_HalfDuplex == duplex)
|
||||
{
|
||||
dbg_log(DBG_LOG, "half dumplex\n");
|
||||
LOG_D("half dumplex\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
dbg_log(DBG_LOG, "full dumplex\n");
|
||||
LOG_D("full dumplex\n");
|
||||
}
|
||||
|
||||
if ((imxrt_eth_device.speed != (enet_mii_speed_t)speed)
|
||||
@@ -804,19 +801,19 @@ static void phy_monitor_thread_entry(void *parameter)
|
||||
imxrt_eth_device.speed = (enet_mii_speed_t)speed;
|
||||
imxrt_eth_device.duplex = (enet_mii_duplex_t)duplex;
|
||||
|
||||
dbg_log(DBG_LOG, "link up, and update eth mode.\n");
|
||||
LOG_D("link up, and update eth mode.\n");
|
||||
rt_imxrt_eth_init((rt_device_t)&imxrt_eth_device);
|
||||
}
|
||||
else
|
||||
{
|
||||
dbg_log(DBG_LOG, "link up, eth not need re-config.\n");
|
||||
LOG_D("link up, eth not need re-config.\n");
|
||||
}
|
||||
dbg_log(DBG_LOG, "link up.\n");
|
||||
LOG_D("link up.\n");
|
||||
eth_device_linkchange(&imxrt_eth_device.parent, RT_TRUE);
|
||||
}
|
||||
else // link down
|
||||
{
|
||||
dbg_log(DBG_LOG, "link down.\n");
|
||||
LOG_D("link down.\n");
|
||||
eth_device_linkchange(&imxrt_eth_device.parent, RT_FALSE);
|
||||
}
|
||||
}
|
||||
@@ -858,20 +855,20 @@ static int rt_hw_imxrt_eth_init(void)
|
||||
imxrt_eth_device.parent.eth_rx = rt_imxrt_eth_rx;
|
||||
imxrt_eth_device.parent.eth_tx = rt_imxrt_eth_tx;
|
||||
|
||||
dbg_log(DBG_LOG, "sem init: tx_wait\r\n");
|
||||
LOG_D("sem init: tx_wait\r\n");
|
||||
/* init tx semaphore */
|
||||
rt_sem_init(&imxrt_eth_device.tx_wait, "tx_wait", 0, RT_IPC_FLAG_FIFO);
|
||||
|
||||
/* register eth device */
|
||||
dbg_log(DBG_LOG, "eth_device_init start\r\n");
|
||||
LOG_D("eth_device_init start\r\n");
|
||||
state = eth_device_init(&(imxrt_eth_device.parent), "e0");
|
||||
if (RT_EOK == state)
|
||||
{
|
||||
dbg_log(DBG_LOG, "eth_device_init success\r\n");
|
||||
LOG_D("eth_device_init success\r\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
dbg_log(DBG_LOG, "eth_device_init faild: %d\r\n", state);
|
||||
LOG_D("eth_device_init faild: %d\r\n", state);
|
||||
}
|
||||
|
||||
eth_device_linkchange(&imxrt_eth_device.parent, RT_FALSE);
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2018-07-05 ZYH the first version
|
||||
* 2019-03-11 JiCheng Remove section"itcm", use scatter file to allocate drv_flexspi.o to itcm
|
||||
*/
|
||||
#include <rtthread.h>
|
||||
#define PRINTF rt_kprintf
|
||||
|
||||
@@ -1,25 +1,12 @@
|
||||
/*
|
||||
* File : drv_hwtimer.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2017, RT-Thread Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2018-04-17 WangBing the first version.
|
||||
* 2019-03-11 JiCheng Change API name from rt1052 to rt1021
|
||||
*/
|
||||
|
||||
#include <rtthread.h>
|
||||
@@ -47,7 +34,7 @@ static void NVIC_Configuration(void)
|
||||
EnableIRQ(GPT1_IRQn);
|
||||
}
|
||||
|
||||
static rt_err_t rt1052_hwtimer_control(rt_hwtimer_t *timer, rt_uint32_t cmd, void *args)
|
||||
static rt_err_t rt1021_hwtimer_control(rt_hwtimer_t *timer, rt_uint32_t cmd, void *args)
|
||||
{
|
||||
rt_err_t err = RT_EOK;
|
||||
GPT_Type *hwtimer_dev;
|
||||
@@ -73,7 +60,7 @@ static rt_err_t rt1052_hwtimer_control(rt_hwtimer_t *timer, rt_uint32_t cmd, voi
|
||||
return err;
|
||||
}
|
||||
|
||||
static rt_uint32_t rt1052_hwtimer_count_get(rt_hwtimer_t *timer)
|
||||
static rt_uint32_t rt1021_hwtimer_count_get(rt_hwtimer_t *timer)
|
||||
{
|
||||
rt_uint32_t CurrentTimer_Count;
|
||||
GPT_Type *hwtimer_dev;
|
||||
@@ -86,7 +73,7 @@ static rt_uint32_t rt1052_hwtimer_count_get(rt_hwtimer_t *timer)
|
||||
return CurrentTimer_Count;
|
||||
}
|
||||
|
||||
static void rt1052_hwtimer_init(rt_hwtimer_t *timer, rt_uint32_t state)
|
||||
static void rt1021_hwtimer_init(rt_hwtimer_t *timer, rt_uint32_t state)
|
||||
{
|
||||
GPT_Type *hwtimer_dev;
|
||||
gpt_config_t gptConfig;
|
||||
@@ -108,7 +95,7 @@ static void rt1052_hwtimer_init(rt_hwtimer_t *timer, rt_uint32_t state)
|
||||
}
|
||||
}
|
||||
|
||||
static rt_err_t rt1052_hwtimer_start(rt_hwtimer_t *timer, rt_uint32_t cnt, rt_hwtimer_mode_t mode)
|
||||
static rt_err_t rt1021_hwtimer_start(rt_hwtimer_t *timer, rt_uint32_t cnt, rt_hwtimer_mode_t mode)
|
||||
{
|
||||
GPT_Type *hwtimer_dev;
|
||||
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
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
static void rt1052_hwtimer_stop(rt_hwtimer_t *timer)
|
||||
static void rt1021_hwtimer_stop(rt_hwtimer_t *timer)
|
||||
{
|
||||
GPT_Type *hwtimer_dev;
|
||||
hwtimer_dev = (GPT_Type *)timer->parent.user_data;
|
||||
@@ -138,16 +125,16 @@ static void rt1052_hwtimer_stop(rt_hwtimer_t *timer)
|
||||
GPT_StopTimer(hwtimer_dev);
|
||||
}
|
||||
|
||||
static const struct rt_hwtimer_ops rt1052_hwtimer_ops =
|
||||
static const struct rt_hwtimer_ops rt1021_hwtimer_ops =
|
||||
{
|
||||
rt1052_hwtimer_init,
|
||||
rt1052_hwtimer_start,
|
||||
rt1052_hwtimer_stop,
|
||||
rt1052_hwtimer_count_get,
|
||||
rt1052_hwtimer_control,
|
||||
rt1021_hwtimer_init,
|
||||
rt1021_hwtimer_start,
|
||||
rt1021_hwtimer_stop,
|
||||
rt1021_hwtimer_count_get,
|
||||
rt1021_hwtimer_control,
|
||||
};
|
||||
|
||||
static const struct rt_hwtimer_info rt1052_hwtimer_info =
|
||||
static const struct rt_hwtimer_info rt1021_hwtimer_info =
|
||||
{
|
||||
25000000, /* the maximum count frequency can be set */
|
||||
6103, /* the minimum count frequency can be set */
|
||||
@@ -157,12 +144,12 @@ static const struct rt_hwtimer_info rt1052_hwtimer_info =
|
||||
|
||||
static rt_hwtimer_t GPT_timer1;
|
||||
|
||||
int rt1052_hw_hwtimer_init(void)
|
||||
int rt1021_hw_hwtimer_init(void)
|
||||
{
|
||||
int ret = RT_EOK;
|
||||
|
||||
GPT_timer1.info = &rt1052_hwtimer_info;
|
||||
GPT_timer1.ops = &rt1052_hwtimer_ops;
|
||||
GPT_timer1.info = &rt1021_hwtimer_info;
|
||||
GPT_timer1.ops = &rt1021_hwtimer_ops;
|
||||
|
||||
rt_device_hwtimer_register(&GPT_timer1, "_timer", GPT1);
|
||||
|
||||
@@ -184,6 +171,6 @@ void GPT1_IRQHandler(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
INIT_DEVICE_EXPORT(rt1052_hw_hwtimer_init);
|
||||
INIT_DEVICE_EXPORT(rt1021_hw_hwtimer_init);
|
||||
|
||||
#endif /*RT_USING_HWTIMER*/
|
||||
|
||||
@@ -1,25 +1,12 @@
|
||||
/*
|
||||
* File : drv_hwtimer.h
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2017, RT-Thread Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2018-04-17 WangBing the first version.
|
||||
* 2019-03-11 JiCheng Change API name from rt1052 to rt1021
|
||||
*/
|
||||
|
||||
#ifndef __DRV_HWTIMER_H__
|
||||
@@ -28,7 +15,7 @@
|
||||
#include <rtthread.h>
|
||||
#include <rtdevice.h>
|
||||
|
||||
int rt1052_hw_hwtimer_init(void);
|
||||
int rt1021_hw_hwtimer_init(void);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,25 +1,13 @@
|
||||
/*
|
||||
* File : drv_i2c.c
|
||||
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2017-08-08 Yang the first version
|
||||
* 2018-03-24 LaiYiKeTang add hardware iic
|
||||
* 2019-03-11 JiCheng Adapt RT1020's IO MAP
|
||||
*/
|
||||
|
||||
#include <rtthread.h>
|
||||
@@ -44,7 +32,7 @@
|
||||
#define LPI2C_CLOCK_FREQUENCY ((CLOCK_GetFreq(kCLOCK_Usb1PllClk) / 8) / (LPI2C_CLOCK_SOURCE_DIVIDER))
|
||||
|
||||
#ifdef RT_USING_HW_I2C1
|
||||
static struct rt1052_i2c_bus lpi2c1 =
|
||||
static struct rt1021_i2c_bus lpi2c1 =
|
||||
{
|
||||
.I2C = LPI2C1,
|
||||
.device_name = I2C1BUS_NAME,
|
||||
@@ -52,7 +40,7 @@ static struct rt1052_i2c_bus lpi2c1 =
|
||||
#endif /* RT_USING_HW_I2C1 */
|
||||
|
||||
#ifdef RT_USING_HW_I2C2
|
||||
static struct rt1052_i2c_bus lpi2c2 =
|
||||
static struct rt1021_i2c_bus lpi2c2 =
|
||||
{
|
||||
.I2C = LPI2C2,
|
||||
.device_name = I2C2BUS_NAME,
|
||||
@@ -60,7 +48,7 @@ static struct rt1052_i2c_bus lpi2c2 =
|
||||
#endif /* RT_USING_HW_I2C2 */
|
||||
|
||||
#ifdef RT_USING_HW_I2C3
|
||||
static struct rt1052_i2c_bus lpi2c3 =
|
||||
static struct rt1021_i2c_bus lpi2c3 =
|
||||
{
|
||||
.I2C = LPI2C3,
|
||||
.device_name = I2C3BUS_NAME,
|
||||
@@ -68,7 +56,7 @@ static struct rt1052_i2c_bus lpi2c3 =
|
||||
#endif /* RT_USING_HW_I2C3 */
|
||||
|
||||
#ifdef RT_USING_HW_I2C4
|
||||
static struct rt1052_i2c_bus lpi2c4 =
|
||||
static struct rt1021_i2c_bus lpi2c4 =
|
||||
{
|
||||
.I2C = LPI2C4,
|
||||
.device_name = I2C4BUS_NAME,
|
||||
@@ -94,7 +82,7 @@ static const struct rt_i2c_bus_device_ops imxrt_i2c_ops =
|
||||
imxrt_i2c_bus_control,
|
||||
};
|
||||
|
||||
void imxrt_lpi2c_gpio_init(struct rt1052_i2c_bus *bus)
|
||||
void imxrt_lpi2c_gpio_init(struct rt1021_i2c_bus *bus)
|
||||
{
|
||||
if (bus->I2C == LPI2C1)
|
||||
{
|
||||
@@ -162,7 +150,7 @@ void imxrt_lpi2c_gpio_init(struct rt1052_i2c_bus *bus)
|
||||
}
|
||||
}
|
||||
|
||||
static rt_err_t imxrt_lpi2c_configure(struct rt1052_i2c_bus *bus, lpi2c_master_config_t *cfg)
|
||||
static rt_err_t imxrt_lpi2c_configure(struct rt1021_i2c_bus *bus, lpi2c_master_config_t *cfg)
|
||||
{
|
||||
RT_ASSERT(bus != RT_NULL);
|
||||
RT_ASSERT(cfg != RT_NULL);
|
||||
@@ -250,36 +238,36 @@ static rt_size_t imxrt_i2c_mst_xfer(struct rt_i2c_bus_device *bus,
|
||||
struct rt_i2c_msg msgs[],
|
||||
rt_uint32_t num)
|
||||
{
|
||||
struct rt1052_i2c_bus *rt1052_i2c;
|
||||
struct rt1021_i2c_bus *rt1021_i2c;
|
||||
rt_size_t i;
|
||||
RT_ASSERT(bus != RT_NULL);
|
||||
rt1052_i2c = (struct rt1052_i2c_bus *) bus;
|
||||
rt1021_i2c = (struct rt1021_i2c_bus *) bus;
|
||||
|
||||
rt1052_i2c->msg = msgs;
|
||||
rt1052_i2c->msg_ptr = 0;
|
||||
rt1052_i2c->msg_cnt = num;
|
||||
rt1052_i2c->dptr = 0;
|
||||
rt1021_i2c->msg = msgs;
|
||||
rt1021_i2c->msg_ptr = 0;
|
||||
rt1021_i2c->msg_cnt = num;
|
||||
rt1021_i2c->dptr = 0;
|
||||
|
||||
for (i = 0; i < num; i++)
|
||||
{
|
||||
if (rt1052_i2c->msg[i].flags & RT_I2C_RD)
|
||||
if (rt1021_i2c->msg[i].flags & RT_I2C_RD)
|
||||
{
|
||||
if (LPI2C_MasterStart(rt1052_i2c->I2C, rt1052_i2c->msg[i].addr, kLPI2C_Read) != kStatus_Success)
|
||||
if (LPI2C_MasterStart(rt1021_i2c->I2C, rt1021_i2c->msg[i].addr, kLPI2C_Read) != kStatus_Success)
|
||||
{
|
||||
i = 0;
|
||||
break;
|
||||
}
|
||||
if (LPI2C_MasterWaitForTxFifoAllEmpty(rt1052_i2c->I2C) != kStatus_Success)
|
||||
if (LPI2C_MasterWaitForTxFifoAllEmpty(rt1021_i2c->I2C) != kStatus_Success)
|
||||
{
|
||||
i = 0;
|
||||
break;
|
||||
}
|
||||
if (LPI2C_MasterReceive(rt1052_i2c->I2C, rt1052_i2c->msg[i].buf, rt1052_i2c->msg[i].len) != kStatus_Success)
|
||||
if (LPI2C_MasterReceive(rt1021_i2c->I2C, rt1021_i2c->msg[i].buf, rt1021_i2c->msg[i].len) != kStatus_Success)
|
||||
{
|
||||
i = 0;
|
||||
break;
|
||||
}
|
||||
if (LPI2C_MasterWaitForTxFifoAllEmpty(rt1052_i2c->I2C) != kStatus_Success)
|
||||
if (LPI2C_MasterWaitForTxFifoAllEmpty(rt1021_i2c->I2C) != kStatus_Success)
|
||||
{
|
||||
i = 0;
|
||||
break;
|
||||
@@ -287,22 +275,22 @@ static rt_size_t imxrt_i2c_mst_xfer(struct rt_i2c_bus_device *bus,
|
||||
}
|
||||
else
|
||||
{
|
||||
if (LPI2C_MasterStart(rt1052_i2c->I2C, rt1052_i2c->msg[i].addr, kLPI2C_Write) != kStatus_Success)
|
||||
if (LPI2C_MasterStart(rt1021_i2c->I2C, rt1021_i2c->msg[i].addr, kLPI2C_Write) != kStatus_Success)
|
||||
{
|
||||
i = 0;
|
||||
break;
|
||||
}
|
||||
if (LPI2C_MasterWaitForTxFifoAllEmpty(rt1052_i2c->I2C) != kStatus_Success)
|
||||
if (LPI2C_MasterWaitForTxFifoAllEmpty(rt1021_i2c->I2C) != kStatus_Success)
|
||||
{
|
||||
i = 0;
|
||||
break;
|
||||
}
|
||||
if (LPI2C_MasterSend(rt1052_i2c->I2C, rt1052_i2c->msg[i].buf, rt1052_i2c->msg[i].len) != kStatus_Success)
|
||||
if (LPI2C_MasterSend(rt1021_i2c->I2C, rt1021_i2c->msg[i].buf, rt1021_i2c->msg[i].len) != kStatus_Success)
|
||||
{
|
||||
i = 0;
|
||||
break;
|
||||
}
|
||||
if (LPI2C_MasterWaitForTxFifoAllEmpty(rt1052_i2c->I2C) != kStatus_Success)
|
||||
if (LPI2C_MasterWaitForTxFifoAllEmpty(rt1021_i2c->I2C) != kStatus_Success)
|
||||
{
|
||||
i = 0;
|
||||
break;
|
||||
@@ -310,15 +298,15 @@ static rt_size_t imxrt_i2c_mst_xfer(struct rt_i2c_bus_device *bus,
|
||||
}
|
||||
}
|
||||
i2c_dbg("send stop condition\n");
|
||||
if (LPI2C_MasterStop(rt1052_i2c->I2C) != kStatus_Success)
|
||||
if (LPI2C_MasterStop(rt1021_i2c->I2C) != kStatus_Success)
|
||||
{
|
||||
i = 0;
|
||||
}
|
||||
|
||||
rt1052_i2c->msg = RT_NULL;
|
||||
rt1052_i2c->msg_ptr = 0;
|
||||
rt1052_i2c->msg_cnt = 0;
|
||||
rt1052_i2c->dptr = 0;
|
||||
rt1021_i2c->msg = RT_NULL;
|
||||
rt1021_i2c->msg_ptr = 0;
|
||||
rt1021_i2c->msg_cnt = 0;
|
||||
rt1021_i2c->dptr = 0;
|
||||
return i;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
/*
|
||||
* File : drv_i2c.h
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2009, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
@@ -19,7 +15,7 @@
|
||||
#include <rtthread.h>
|
||||
#include <rtdevice.h>
|
||||
#include "board.h"
|
||||
struct rt1052_i2c_bus
|
||||
struct rt1021_i2c_bus
|
||||
{
|
||||
struct rt_i2c_bus_device parent;
|
||||
LPI2C_Type *I2C;
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
/*
|
||||
* File : drv_pcf8574.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006-2013, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
/*
|
||||
* File : drv_pcf8574.h
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006-2013, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,11 +1,7 @@
|
||||
/*
|
||||
* File : drv_pin.h
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006-2013, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
/*
|
||||
* File : drv_rtc.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006-2013, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2018-03-15 Liuguang the first version.
|
||||
* 2019-03-11 JiCheng Change the name from rt1052 to RT1021
|
||||
*/
|
||||
#include "drv_rtc.h"
|
||||
|
||||
@@ -62,7 +59,7 @@ static int set_timestamp(time_t timestamp)
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
static rt_err_t rt1052_hp_rtc_init(rt_device_t dev)
|
||||
static rt_err_t rt1021_hp_rtc_init(rt_device_t dev)
|
||||
{
|
||||
snvs_hp_rtc_config_t snvsRtcConfig;
|
||||
|
||||
@@ -74,27 +71,27 @@ static rt_err_t rt1052_hp_rtc_init(rt_device_t dev)
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
static rt_err_t rt1052_hp_rtc_open(rt_device_t dev, rt_uint16_t oflag)
|
||||
static rt_err_t rt1021_hp_rtc_open(rt_device_t dev, rt_uint16_t oflag)
|
||||
{
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
static rt_err_t rt1052_hp_rtc_close(rt_device_t dev)
|
||||
static rt_err_t rt1021_hp_rtc_close(rt_device_t dev)
|
||||
{
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
static rt_size_t rt1052_hp_rtc_read(rt_device_t dev, rt_off_t pos, void* buffer, rt_size_t size)
|
||||
static rt_size_t rt1021_hp_rtc_read(rt_device_t dev, rt_off_t pos, void* buffer, rt_size_t size)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static rt_size_t rt1052_hp_rtc_write(rt_device_t dev, rt_off_t pos, const void* buffer, rt_size_t size)
|
||||
static rt_size_t rt1021_hp_rtc_write(rt_device_t dev, rt_off_t pos, const void* buffer, rt_size_t size)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static rt_err_t rt1052_hp_rtc_control(rt_device_t dev, int cmd, void *args)
|
||||
static rt_err_t rt1021_hp_rtc_control(rt_device_t dev, int cmd, void *args)
|
||||
{
|
||||
RT_ASSERT(dev != RT_NULL);
|
||||
|
||||
@@ -122,12 +119,12 @@ static rt_err_t rt1052_hp_rtc_control(rt_device_t dev, int cmd, void *args)
|
||||
static struct rt_device device =
|
||||
{
|
||||
.type = RT_Device_Class_RTC,
|
||||
.init = rt1052_hp_rtc_init,
|
||||
.open = rt1052_hp_rtc_open,
|
||||
.close = rt1052_hp_rtc_close,
|
||||
.read = rt1052_hp_rtc_read,
|
||||
.write = rt1052_hp_rtc_write,
|
||||
.control = rt1052_hp_rtc_control,
|
||||
.init = rt1021_hp_rtc_init,
|
||||
.open = rt1021_hp_rtc_open,
|
||||
.close = rt1021_hp_rtc_close,
|
||||
.read = rt1021_hp_rtc_read,
|
||||
.write = rt1021_hp_rtc_write,
|
||||
.control = rt1021_hp_rtc_control,
|
||||
};
|
||||
|
||||
int rt_hw_hp_rtc_init(void)
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
/*
|
||||
* File : drv_rtc.h
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006-2013, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
|
||||
@@ -1,25 +1,12 @@
|
||||
/*
|
||||
* File : syscall_write.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2015, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2017-10-10 Tanek first version
|
||||
* 2019-03-11 JiCheng Adapt RT1020's IO MAP
|
||||
*/
|
||||
|
||||
#include <rtthread.h>
|
||||
@@ -480,19 +467,6 @@ static void log_toggle(int en)
|
||||
FINSH_FUNCTION_EXPORT(log_toggle, toglle log dumple);
|
||||
#endif
|
||||
|
||||
//static rt_int32_t _mmc_get_card_status(struct rt_mmcsd_host *host)
|
||||
//{
|
||||
// MMCSD_DGB("%s, start\n", __func__);
|
||||
// MMCSD_DGB("%s, end\n", __func__);
|
||||
//
|
||||
// return 0;
|
||||
//}
|
||||
//
|
||||
//static void _mmc_enable_sdio_irq(struct rt_mmcsd_host *host, rt_int32_t enable)
|
||||
//{
|
||||
//
|
||||
//}
|
||||
|
||||
static const struct rt_mmcsd_host_ops ops =
|
||||
{
|
||||
_mmc_request,
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
/*
|
||||
* File : board.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2009 RT-Thread Develop Team
|
||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2017-12-04 Tanek first implementation
|
||||
* 2019-03-11 JiCheng Adapt RT1020's IO MAP
|
||||
*/
|
||||
#include <stdint.h>
|
||||
#include <rthw.h>
|
||||
@@ -50,32 +47,6 @@ static void _clock_init(void)
|
||||
_WDWORD(0x400D8030,0x00002001);
|
||||
_WDWORD(0x400D8100,0x001d0000);
|
||||
_WDWORD(0x400FC014,0x00010D40);
|
||||
// // Enable SYS PLL
|
||||
// _WDWORD(0x400D8030,0x00002001);
|
||||
// do
|
||||
// {
|
||||
// reg = _RDWORD(0x400D8030);
|
||||
// }while((reg & 0x80000000) == 0);
|
||||
|
||||
// // Ungate SYS PLL PFD2
|
||||
// reg = _RDWORD(0x400D8100);
|
||||
// reg &= ~0x800000;
|
||||
// _WDWORD(0x400D8100,reg);
|
||||
|
||||
// // SEMC clock source selection.
|
||||
// // SDRAM running at 133Mhz
|
||||
// // CBCDR:
|
||||
// // SEMC_ALT_CLK_SEL: 0 PLL2 (SYS PLL) PFD2
|
||||
// // SEMC_CLK_SEL: 1 SEMC_ALT_CLK
|
||||
// // SEMC_PODF: 2 divide by 3
|
||||
// reg = _RDWORD(0x400FC014);
|
||||
// reg |= 0x20040;
|
||||
// _WDWORD(0x400FC014,reg);
|
||||
|
||||
// // Disable MPU which will be enabled by ROM to prevent code execution
|
||||
// reg = _RDWORD(0xE000ED94);
|
||||
// reg &= ~0x1;
|
||||
// _WDWORD(0xE000ED94, reg);
|
||||
}
|
||||
|
||||
static void _sdr_Init(void)
|
||||
@@ -219,5 +190,5 @@ int imxrt_sdram_init(void)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
INIT_PREV_EXPORT(imxrt_sdram_init);
|
||||
/*@}*/
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
/*
|
||||
* File : drv_spi_bus.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006-2013, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2018-03-27 Liuguang the first version.
|
||||
* 2019-03-11 JiCheng Adapt RT1020's IO MAP
|
||||
*/
|
||||
|
||||
#include "drv_spi_bus.h"
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
/*
|
||||
* File : drv_spi_bus.h
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006-2013, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
/*
|
||||
* File : drv_spi_flash.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006-2013, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
/*
|
||||
* File : drv_spi_flash.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006-2013, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
|
||||
@@ -1,16 +1,13 @@
|
||||
/*
|
||||
* File : drv_uart.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006-2013, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2017-10-10 Tanek the first version
|
||||
* 2018-03-17 laiyiketang Add other uart.
|
||||
* 2019-03-11 JiCheng Adapt RT1021's IO MAP
|
||||
*/
|
||||
#include <rtthread.h>
|
||||
#include "drv_uart.h"
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
/*
|
||||
* File : drv_uart.h
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2009, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2017-10-10 Tanek the first version
|
||||
* 2018-03-17 laiyiketang Add other uart.
|
||||
*/
|
||||
|
||||
#ifndef __DRV_UART_H__
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
/*
|
||||
* File : drv_usbc.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2009 RT-Thread Develop Team
|
||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
|
||||
@@ -15,7 +15,7 @@ BSP默认支持的i.MX RT1021处理器具备以下简要的特性:
|
||||
|
||||
## 2. 编译说明
|
||||
|
||||
i.MX RT1021板级包支持MDK5﹑IAR开发环境和GCC编译器,以下是具体版本信息:
|
||||
i.MX RT1020板级包支持MDK5﹑IAR开发环境和GCC编译器,以下是具体版本信息:
|
||||
|
||||
| IDE/编译器 | 已测试版本 |
|
||||
| ---------- | --------- |
|
||||
@@ -26,15 +26,11 @@ i.MX RT1021板级包支持MDK5﹑IAR开发环境和GCC编译器,以下是具
|
||||
|
||||
### 3.1 配置工程
|
||||
|
||||
i.MX RT1021 BSP支持多块开发板,包括官方开发板MIMXRT1020-EVK。如果不是基于官方开发板,那么需要重新配置并生成工程:
|
||||
|
||||
- 在bsp下打开env工具
|
||||
- 输入`menuconfig`命令,`RT1021 Board select (***)-->`选择正确的开发板。
|
||||
- 输入`scons --target=mdk5 -s`或`scons --target=iar`来生成需要的工程
|
||||
i.MX RT1020 BSP默认支持官方开发板MIMXRT1020-EVK。
|
||||
|
||||
### 3.2 下载和仿真
|
||||
|
||||
#### 3.2.1 MIMXRT1021-EVK
|
||||
#### 3.2.1 MIMXRT1020-EVK
|
||||
|
||||
EVK开发板有板载OpenSDA仿真器,仿真器还连接到i.MX RT1021的UART1。使用USB线连接电脑和仿真器的USB口(J23),就可以进行下载和仿真。在终端工具里打开仿真器的虚拟串口。
|
||||
|
||||
@@ -46,19 +42,22 @@ EVK开发板有板载OpenSDA仿真器,仿真器还连接到i.MX RT1021的UART1
|
||||
|
||||
\ | /
|
||||
- RT - Thread Operating System
|
||||
/ | \ 3.0.4 build May 2 2018
|
||||
2006 - 2018 Copyright by rt-thread team
|
||||
/ | \ 4.0.1 build Mar 11 2019
|
||||
2006 - 2019 Copyright by rt-thread team
|
||||
[I/FLEXSPI] NorFlash Init
|
||||
[I/FLEXSPI] Vendor ID: 0x15
|
||||
[I/FLEXSPI] NorFlash Init Done
|
||||
lwIP-2.0.2 initialized!
|
||||
using armcc, version: 5060750
|
||||
build time: May 2 2018 21:52:40
|
||||
build time: Mar 11 2019 22:24:46
|
||||
msh />[PHY] wait autonegotiation complete...
|
||||
SD card capacity 123904 KB
|
||||
probe mmcsd block device!
|
||||
found part[0], begin: 32256, size: 120.992MB
|
||||
[I/SDIO] SD card capacity 15558144 KB.
|
||||
found part[0], begin: 32256, size: 14.857GB
|
||||
File System initialized!
|
||||
[PHY] wait autonegotiation complete...
|
||||
```
|
||||
|
||||
|
||||
## 4. 驱动支持情况及计划
|
||||
|
||||
| 驱动 | 支持情况 | 备注 |
|
||||
@@ -76,7 +75,7 @@ File System initialized!
|
||||
## 5. 联系人信息
|
||||
|
||||
维护人:
|
||||
|
||||
- [JiCheng](https://github.com/jicheng0622)
|
||||
|
||||
## 6. 参考
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,50 +0,0 @@
|
||||
/*
|
||||
* File : clock.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2017-12-05 Tanek first version
|
||||
*/
|
||||
|
||||
#include <rtthread.h>
|
||||
|
||||
static void mem_dump(uint32_t buffer, uint32_t length)
|
||||
{
|
||||
uint32_t *buf = (uint32_t *)buffer;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < length / 4; i++)
|
||||
{
|
||||
rt_kprintf("0x%08X,", buf[i]);
|
||||
|
||||
if (i % 8 == 7)
|
||||
{
|
||||
rt_kprintf("\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
rt_kprintf(" ");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef RT_USING_FINSH
|
||||
#include <finsh.h>
|
||||
FINSH_FUNCTION_EXPORT(mem_dump, dump memory);
|
||||
#endif
|
||||
@@ -1,103 +0,0 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#include <rthw.h>
|
||||
#include <rtthread.h>
|
||||
|
||||
void mem_test(uint32_t address, uint32_t size )
|
||||
{
|
||||
uint32_t i;
|
||||
|
||||
rt_kprintf("memtest,address: 0x%08X size: 0x%08X\r\n", address, size);
|
||||
|
||||
/**< 8bit test */
|
||||
{
|
||||
uint8_t * p_uint8_t = (uint8_t *)address;
|
||||
for(i=0; i<size/sizeof(uint8_t); i++)
|
||||
{
|
||||
*p_uint8_t++ = (uint8_t)i;
|
||||
}
|
||||
|
||||
p_uint8_t = (uint8_t *)address;
|
||||
for(i=0; i<size/sizeof(uint8_t); i++)
|
||||
{
|
||||
if( *p_uint8_t != (uint8_t)i )
|
||||
{
|
||||
rt_kprintf("8bit test fail @ 0x%08X\r\nsystem halt!!!!!",(uint32_t)p_uint8_t);
|
||||
while(1);
|
||||
}
|
||||
p_uint8_t++;
|
||||
}
|
||||
rt_kprintf("8bit test pass!!\r\n");
|
||||
}
|
||||
|
||||
/**< 16bit test */
|
||||
{
|
||||
uint16_t * p_uint16_t = (uint16_t *)address;
|
||||
for(i=0; i<size/sizeof(uint16_t); i++)
|
||||
{
|
||||
*p_uint16_t++ = (uint16_t)i;
|
||||
}
|
||||
|
||||
p_uint16_t = (uint16_t *)address;
|
||||
for(i=0; i<size/sizeof(uint16_t); i++)
|
||||
{
|
||||
if( *p_uint16_t != (uint16_t)i )
|
||||
{
|
||||
rt_kprintf("16bit test fail @ 0x%08X\r\nsystem halt!!!!!",(uint32_t)p_uint16_t);
|
||||
while(1);
|
||||
}
|
||||
p_uint16_t++;
|
||||
}
|
||||
rt_kprintf("16bit test pass!!\r\n");
|
||||
}
|
||||
|
||||
/**< 32bit test */
|
||||
{
|
||||
uint32_t * p_uint32_t = (uint32_t *)address;
|
||||
for(i=0; i<size/sizeof(uint32_t); i++)
|
||||
{
|
||||
*p_uint32_t++ = (uint32_t)i;
|
||||
}
|
||||
|
||||
p_uint32_t = (uint32_t *)address;
|
||||
for(i=0; i<size/sizeof(uint32_t); i++)
|
||||
{
|
||||
if( *p_uint32_t != (uint32_t)i )
|
||||
{
|
||||
rt_kprintf("32bit test fail @ 0x%08X\r\nsystem halt!!!!!",(uint32_t)p_uint32_t);
|
||||
while(1);
|
||||
}
|
||||
p_uint32_t++;
|
||||
}
|
||||
rt_kprintf("32bit test pass!!\r\n");
|
||||
}
|
||||
|
||||
/**< 32bit Loopback test */
|
||||
{
|
||||
uint32_t * p_uint32_t = (uint32_t *)address;
|
||||
for(i=0; i<size/sizeof(uint32_t); i++)
|
||||
{
|
||||
*p_uint32_t = (uint32_t)p_uint32_t;
|
||||
p_uint32_t++;
|
||||
}
|
||||
|
||||
p_uint32_t = (uint32_t *)address;
|
||||
for(i=0; i<size/sizeof(uint32_t); i++)
|
||||
{
|
||||
if( *p_uint32_t != (uint32_t)p_uint32_t )
|
||||
{
|
||||
rt_kprintf("32bit Loopback test fail @ 0x%08X", (uint32_t)p_uint32_t);
|
||||
rt_kprintf(" data:0x%08X \r\n", (uint32_t)*p_uint32_t);
|
||||
rt_kprintf("system halt!!!!!",(uint32_t)p_uint32_t);
|
||||
while(1);
|
||||
}
|
||||
p_uint32_t++;
|
||||
}
|
||||
rt_kprintf("32bit Loopback test pass!!\r\n");
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef RT_USING_FINSH
|
||||
#include <finsh.h>
|
||||
FINSH_FUNCTION_EXPORT(mem_test, mem_test(0xA0000000, 0x00100000) );
|
||||
#endif
|
||||
@@ -1,15 +1,12 @@
|
||||
/*
|
||||
* File : board.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2009 RT-Thread Develop Team
|
||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2009-01-05 Bernard first implementation
|
||||
* 2019-03-11 JiCheng Change clock setting for RT1020
|
||||
*/
|
||||
#include <stdint.h>
|
||||
#include <rthw.h>
|
||||
|
||||
@@ -1,15 +1,11 @@
|
||||
/*
|
||||
* File : board.h
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2009, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2009-09-22 Bernard add board.h to this bsp
|
||||
* 2009-01-05 Bernard first implementation
|
||||
*/
|
||||
|
||||
// <<< Use Configuration Wizard in Context Menu >>>
|
||||
|
||||
@@ -43,7 +43,7 @@ if PLATFORM == 'gcc':
|
||||
DEVICE = ' -mcpu=cortex-m7 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections'
|
||||
CFLAGS = DEVICE + ' -std=c99 -Wall -D__FPU_PRESENT -eentry'
|
||||
AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb -D__START=entry'
|
||||
LFLAGS = DEVICE + ' -lm -lgcc -lc' + ' -nostartfiles -Wl,--gc-sections,-Map=rtthread-imxrt-gcc.map,-cref,-u,Reset_Handler -T flexspi_nor.ld'
|
||||
LFLAGS = DEVICE + ' -lm -lgcc -lc' + ' -nostartfiles -Wl,--gc-sections,-Map=rtthread.map,-cref,-u,Reset_Handler -T flexspi_nor.ld'
|
||||
|
||||
CPATH = ''
|
||||
LPATH = ''
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
</DaveTm>
|
||||
|
||||
<Target>
|
||||
<TargetName>RT-Thread IMXRT1021</TargetName>
|
||||
<TargetName>rtthread</TargetName>
|
||||
<ToolsetNumber>0x4</ToolsetNumber>
|
||||
<ToolsetName>ARM-ADS</ToolsetName>
|
||||
<TargetOption>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
<Targets>
|
||||
<Target>
|
||||
<TargetName>RT-Thread IMXRT1021</TargetName>
|
||||
<TargetName>rtthread</TargetName>
|
||||
<ToolsetNumber>0x4</ToolsetNumber>
|
||||
<ToolsetName>ARM-ADS</ToolsetName>
|
||||
<pCCUsed>5060528::V5.06 update 5 (build 528)::ARMCC</pCCUsed>
|
||||
|
||||
Reference in New Issue
Block a user