From 2e9fc0c4ff6fadd62faac32a2604430b1c8a0ae3 Mon Sep 17 00:00:00 2001 From: tangyuxin Date: Mon, 1 Feb 2021 16:53:39 +0800 Subject: [PATCH 01/26] =?UTF-8?q?[libcpu][cm33]=20=E5=AE=89=E5=85=A8?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E7=9A=84=E5=87=BD=E6=95=B0=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E5=AE=8F=E8=BF=9B=E8=A1=8C=E9=9A=94=E7=A6=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libcpu/arm/cortex-m33/trustzone.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libcpu/arm/cortex-m33/trustzone.c b/libcpu/arm/cortex-m33/trustzone.c index 86654a7199..5f37ddbb8f 100644 --- a/libcpu/arm/cortex-m33/trustzone.c +++ b/libcpu/arm/cortex-m33/trustzone.c @@ -10,11 +10,19 @@ #include +#ifdef ARM_CM33_ENABLE_TRUSTZONE extern void TZ_InitContextSystem_S(void); extern rt_uint32_t TZ_AllocModuleContext_S (rt_uint32_t module); extern rt_uint32_t TZ_FreeModuleContext_S(rt_uint32_t id); extern rt_uint32_t TZ_LoadContext_S(rt_uint32_t id); extern rt_uint32_t TZ_StoreContext_S(rt_uint32_t id); +#else +void TZ_InitContextSystem_S(void){} +rt_uint32_t TZ_AllocModuleContext_S (rt_uint32_t module){return 0;} +rt_uint32_t TZ_FreeModuleContext_S(rt_uint32_t id) {return 0;} +rt_uint32_t TZ_LoadContext_S(rt_uint32_t id){return 0;}; +rt_uint32_t TZ_StoreContext_S(rt_uint32_t id){return 0;}; +#endif extern int tzcall(int id, rt_ubase_t arg0, rt_ubase_t arg1, rt_ubase_t arg2); #define TZ_INIT_CONTEXT_ID (0x1001) From 18ff046e7f3cc54d71147ec031d8f61acc7ffd2d Mon Sep 17 00:00:00 2001 From: LeeChunHei Date: Sat, 13 Feb 2021 17:50:45 +0800 Subject: [PATCH 02/26] change to correct username --- bsp/imxrt/libraries/MIMXRT1050/SConscript | 1 + bsp/imxrt/libraries/drivers/drv_pwm.c | 274 +++++++++++++++++++++- 2 files changed, 272 insertions(+), 3 deletions(-) diff --git a/bsp/imxrt/libraries/MIMXRT1050/SConscript b/bsp/imxrt/libraries/MIMXRT1050/SConscript index 6f871d6610..58d5ccef78 100644 --- a/bsp/imxrt/libraries/MIMXRT1050/SConscript +++ b/bsp/imxrt/libraries/MIMXRT1050/SConscript @@ -34,6 +34,7 @@ if GetDepend(['BSP_USING_HWTIMER']) or GetDepend(['BSP_USING_PWM']): if GetDepend(['BSP_USING_PWM']): src += ['MIMXRT1052/drivers/fsl_pwm.c'] + src += ['MIMXRT1052/drivers/fsl_qtmr.c'] if GetDepend(['BSP_USING_RTC']): src += ['MIMXRT1052/drivers/fsl_snvs_hp.c'] diff --git a/bsp/imxrt/libraries/drivers/drv_pwm.c b/bsp/imxrt/libraries/drivers/drv_pwm.c index fdfb8907f6..385846807b 100644 --- a/bsp/imxrt/libraries/drivers/drv_pwm.c +++ b/bsp/imxrt/libraries/drivers/drv_pwm.c @@ -16,8 +16,12 @@ #if !defined(BSP_USING_PWM1_CH0) && !defined(BSP_USING_PWM1_CH1) && !defined(BSP_USING_PWM1_CH2) && !defined(BSP_USING_PWM1_CH3) && \ !defined(BSP_USING_PWM2_CH0) && !defined(BSP_USING_PWM2_CH1) && !defined(BSP_USING_PWM2_CH2) && !defined(BSP_USING_PWM2_CH3) && \ !defined(BSP_USING_PWM3_CH0) && !defined(BSP_USING_PWM3_CH1) && !defined(BSP_USING_PWM3_CH2) && !defined(BSP_USING_PWM3_CH3) && \ - !defined(BSP_USING_PWM4_CH0) && !defined(BSP_USING_PWM4_CH1) && !defined(BSP_USING_PWM4_CH2) && !defined(BSP_USING_PWM4_CH3) -#error "Please define at least one BSP_USING_PWMx_CHx" + !defined(BSP_USING_PWM4_CH0) && !defined(BSP_USING_PWM4_CH1) && !defined(BSP_USING_PWM4_CH2) && !defined(BSP_USING_PWM4_CH3) && \ + !defined(BSP_USING_QTMR1_CH0) && !defined(BSP_USING_QTMR1_CH1) && !defined(BSP_USING_QTMR1_CH2) && !defined(BSP_USING_QTMR1_CH3) && \ + !defined(BSP_USING_QTMR2_CH0) && !defined(BSP_USING_QTMR2_CH1) && !defined(BSP_USING_QTMR2_CH2) && !defined(BSP_USING_QTMR2_CH3) && \ + !defined(BSP_USING_QTMR3_CH0) && !defined(BSP_USING_QTMR3_CH1) && !defined(BSP_USING_QTMR3_CH2) && !defined(BSP_USING_QTMR3_CH3) && \ + !defined(BSP_USING_QTMR4_CH0) && !defined(BSP_USING_QTMR4_CH1) && !defined(BSP_USING_QTMR4_CH2) && !defined(BSP_USING_QTMR4_CH3) +#error "Please define at least one BSP_USING_PWMx_CHx or BSP_USING_QTMRx_CHx" #endif #define LOG_TAG "drv.pwm" @@ -25,6 +29,9 @@ #include #include "fsl_pwm.h" +#if defined(FSL_FEATURE_SOC_TMR_COUNT) && FSL_FEATURE_SOC_TMR_COUNT > 0 + #include "fsl_qtmr.h" +#endif #include "drv_pwm.h" #define DEFAULT_PRE 5 @@ -317,6 +324,224 @@ static rt_err_t imxrt_pwm4_init(PWM_Type *base) #endif /* BSP_USING_PWM4 */ +static rt_err_t imxrt_drv_qtmr_control(struct rt_device_pwm *device, int cmd, void *arg); + +static struct rt_pwm_ops imxrt_drv_qtmr_ops = +{ + .control = imxrt_drv_qtmr_control +}; + +static rt_err_t imxrt_drv_qtmr_enable(struct rt_device_pwm *device, struct rt_pwm_configuration *configuration, rt_bool_t enable) +{ + TMR_Type *base; + base = (TMR_Type *)device->parent.user_data; + + if (!enable) + { + QTMR_StopTimer(base, configuration->channel); + base->CHANNEL[configuration->channel].SCTRL |= (TMR_SCTRL_FORCE_MASK | TMR_SCTRL_OEN_MASK); + } + else + { + QTMR_StartTimer(base, configuration->channel, kQTMR_PriSrcRiseEdge); + } + + return RT_EOK; +} + +static rt_err_t imxrt_drv_qtmr_get(struct rt_device_pwm *device, struct rt_pwm_configuration *configuration) +{ + TMR_Type *base; + rt_uint32_t high_count, low_count, clk_divider, clk_freq; + + base = (TMR_Type *)device->parent.user_data; + + low_count = base->CHANNEL[configuration->channel].COMP1; + high_count = base->CHANNEL[configuration->channel].COMP2; + clk_divider = 1 << (((base->CHANNEL[configuration->channel].CTRL & TMR_CTRL_PCS_MASK) >> TMR_CTRL_PCS_SHIFT) - 8); + clk_freq = CLOCK_GetFreq(kCLOCK_IpgClk) / clk_divider; + + configuration->period = 1000000000 / clk_freq * (high_count + low_count); + configuration->pulse = 1000000000 / clk_freq * high_count; + + return RT_EOK; +} + +static rt_err_t imxrt_drv_qtmr_set(struct rt_device_pwm *device, struct rt_pwm_configuration *configuration) +{ + RT_ASSERT(configuration->period > 0); + RT_ASSERT(configuration->pulse <= configuration->period); + + TMR_Type *base = (TMR_Type *)device->parent.user_data; + + rt_size_t clk_freq = CLOCK_GetFreq(kCLOCK_IpgClk) / (1 << (((base->CHANNEL[configuration->channel].CTRL & TMR_CTRL_PCS_MASK) >> TMR_CTRL_PCS_SHIFT) - 8)); + rt_size_t current_period_count = base->CHANNEL[configuration->channel].CMPLD1 + base->CHANNEL[configuration->channel].CMPLD2; + rt_size_t period_count = clk_freq / (1000000000 / configuration->period); + if (current_period_count == period_count) + { + rt_size_t high_count = period_count * configuration->pulse / configuration->period; + rt_size_t low_count = period_count - high_count; + base->CHANNEL[configuration->channel].CMPLD1 = (uint16_t)low_count; + base->CHANNEL[configuration->channel].CMPLD2 = (uint16_t)high_count; + } + else + { + rt_bool_t timer_is_on = base->CHANNEL[configuration->channel].CTRL & TMR_CTRL_CM_MASK; + rt_uint8_t duty = configuration->pulse * 100 / configuration->period; + QTMR_StopTimer(base, configuration->channel); + if (kStatus_Success != QTMR_SetupPwm(base, configuration->channel, 1000000000 / configuration->period, duty, DEFAULT_POLARITY, clk_freq)) + { + LOG_E(LOG_TAG" setup pwm failed \n"); + return RT_ERROR; + } + if (timer_is_on) + { + QTMR_StartTimer(base, configuration->channel, kQTMR_PriSrcRiseEdge); + } + } + + return RT_EOK; +} + +static rt_err_t imxrt_drv_qtmr_control(struct rt_device_pwm *device, int cmd, void *arg) +{ + struct rt_pwm_configuration *configuration = (struct rt_pwm_configuration *)arg; + + switch (cmd) + { + case PWM_CMD_ENABLE: + return imxrt_drv_qtmr_enable(device, configuration, RT_TRUE); + case PWM_CMD_DISABLE: + return imxrt_drv_qtmr_enable(device, configuration, RT_FALSE); + case PWM_CMD_SET: + return imxrt_drv_qtmr_set(device, configuration); + case PWM_CMD_GET: + return imxrt_drv_qtmr_get(device, configuration); + default: + return RT_EINVAL; + } +} + +static rt_err_t imxrt_drv_qtmr_init(TMR_Type *base, qtmr_channel_selection_t channel, uint16_t psc, uint32_t fre, uint8_t duty) +{ + qtmr_config_t qtmr_config; + rt_uint32_t qtmr_clock_freq; + QTMR_GetDefaultConfig(&qtmr_config); + + qtmr_config.primarySource = (qtmr_primary_count_source_t)(psc + 8); + qtmr_clock_freq = CLOCK_GetFreq(kCLOCK_IpgClk) / (1 << psc); + + QTMR_Init(base, channel, &qtmr_config); + + if (kStatus_Success != QTMR_SetupPwm(base, channel, fre, duty, DEFAULT_POLARITY, qtmr_clock_freq)) + { + LOG_E(LOG_TAG" setup pwm failed \n"); + return RT_ERROR; + } + + return RT_EOK; +} + +static rt_err_t imxrt_qtmr_init() +{ + TMR_Type *base_list[] = + { +#ifdef BSP_USING_QTMR1 + TMR1, +#endif +#ifdef BSP_USING_QTMR2 + TMR2, +#endif +#ifdef BSP_USING_QTMR3 + TMR3, +#endif +#ifdef BSP_USING_QTMR4 + TMR4, +#endif + }; + + rt_uint8_t channel_list[] = + { +#ifdef BSP_USING_QTMR1 +#ifdef BSP_USING_QTMR1_CH0 + 1 << 0 | +#endif +#ifdef BSP_USING_QTMR1_CH1 + 1 << 1 | +#endif +#ifdef BSP_USING_QTMR1_CH2 + 1 << 2 | +#endif +#ifdef BSP_USING_QTMR1_CH3 + 1 << 3 | +#endif + 0, +#endif +#ifdef BSP_USING_QTMR2 +#ifdef BSP_USING_QTMR2_CH0 + 1 << 0 | +#endif +#ifdef BSP_USING_QTMR2_CH1 + 1 << 1 | +#endif +#ifdef BSP_USING_QTMR2_CH2 + 1 << 2 | +#endif +#ifdef BSP_USING_QTMR2_CH3 + 1 << 3 | +#endif + 0, +#endif +#ifdef BSP_USING_QTMR3 +#ifdef BSP_USING_QTMR3_CH0 + 1 << 0 | +#endif +#ifdef BSP_USING_QTMR3_CH1 + 1 << 1 | +#endif +#ifdef BSP_USING_QTMR3_CH2 + 1 << 2 | +#endif +#ifdef BSP_USING_QTMR3_CH3 + 1 << 3 | +#endif + 0, +#endif +#ifdef BSP_USING_QTMR4 +#ifdef BSP_USING_QTMR4_CH0 + 1 << 0 | +#endif +#ifdef BSP_USING_QTMR4_CH1 + 1 << 1 | +#endif +#ifdef BSP_USING_QTMR4_CH2 + 1 << 2 | +#endif +#ifdef BSP_USING_QTMR4_CH3 + 1 << 3 | +#endif + 0, +#endif + }; + + for (rt_uint8_t i = 0; i < sizeof(base_list)/sizeof(TMR_Type *); ++i) + { + for (rt_uint8_t j = 0; j < 8; ++j) + { + if ((channel_list[i] >> j) & 1) + { + if (imxrt_drv_qtmr_init(base_list[i], j, DEFAULT_PRE, DEFAULT_FRE, DEFAULT_DUTY) != RT_EOK) + { + return -RT_ERROR; + } + } + } + } + return RT_EOK; +} + + + int rt_hw_pwm_init(void) { rt_err_t ret = RT_EOK; @@ -391,9 +616,52 @@ int rt_hw_pwm_init(void) } #endif /* BSP_USING_PWM4 */ +#if defined(BSP_USING_QTMR1) || defined(BSP_USING_QTMR2) || defined(BSP_USING_QTMR3) || defined(BSP_USING_QTMR4) + if (imxrt_qtmr_init() != RT_EOK) + { + LOG_E(LOG_TAG" init qtmr failed"); + } +#endif + +#ifdef BSP_USING_QTMR1 + static struct rt_device_pwm qtmr1_device; + ret = rt_device_pwm_register(&qtmr1_device, "pwm5", &imxrt_drv_qtmr_ops, TMR1); + if (ret != RT_EOK) + { + LOG_E("%s register failed", "pwm5"); + } +#endif /* BSP_USING_QTMR1 */ + +#ifdef BSP_USING_QTMR2 + static struct rt_device_pwm qtmr2_device; + ret = rt_device_pwm_register(&qtmr2_device, "pwm6", &imxrt_drv_qtmr_ops, TMR2); + if (ret != RT_EOK) + { + LOG_E("%s register failed", "pwm6"); + } +#endif /* BSP_USING_QTMR2 */ + +#ifdef BSP_USING_QTMR3 + static struct rt_device_pwm qtmr3_device; + ret = rt_device_pwm_register(&qtmr3_device, "pwm7", &imxrt_drv_qtmr_ops, TMR3); + if (ret != RT_EOK) + { + LOG_E("%s register failed", "pwm7"); + } +#endif /* BSP_USING_QTMR3 */ + +#ifdef BSP_USING_QTMR4 + static struct rt_device_pwm qtmr4_device; + ret = rt_device_pwm_register(&qtmr4_device, "pwm8", &imxrt_drv_qtmr_ops, TMR4); + if (ret != RT_EOK) + { + LOG_E("%s register failed", "pwm8"); + } +#endif /* BSP_USING_QTMR4 */ + return ret; } -INIT_DEVICE_EXPORT(rt_hw_pwm_init); +INIT_BOARD_EXPORT(rt_hw_pwm_init); #endif /* BSP_USING_PWM */ From 7c151557c3c3e62582bb0eb69fdcc0b61e960c57 Mon Sep 17 00:00:00 2001 From: LeeChunHei Date: Fri, 22 Jan 2021 11:13:08 +0800 Subject: [PATCH 03/26] Add pulse encoder and usb host to imxrt (not tested) --- bsp/imxrt/libraries/MIMXRT1050/SConscript | 10 + bsp/imxrt/libraries/drivers/SConscript | 13 +- .../libraries/drivers/usb/host/usb_host.h | 140 +- .../drivers/usb/host/usb_host_devices.c | 671 +++--- .../drivers/usb/host/usb_host_devices.h | 39 +- .../drivers/usb/host/usb_host_ehci.c | 1992 +++++++++-------- .../drivers/usb/host/usb_host_ehci.h | 188 +- .../libraries/drivers/usb/host/usb_host_hci.c | 342 +-- .../libraries/drivers/usb/host/usb_host_hci.h | 44 +- 9 files changed, 1877 insertions(+), 1562 deletions(-) diff --git a/bsp/imxrt/libraries/MIMXRT1050/SConscript b/bsp/imxrt/libraries/MIMXRT1050/SConscript index 6f871d6610..d1afb9bcf3 100644 --- a/bsp/imxrt/libraries/MIMXRT1050/SConscript +++ b/bsp/imxrt/libraries/MIMXRT1050/SConscript @@ -76,7 +76,17 @@ if GetDepend(['BSP_USING_DMA']): src += ['MIMXRT1052/drivers/fsl_edma.c'] src += ['MIMXRT1052/drivers/fsl_lpuart_edma.c'] src += ['MIMXRT1052/drivers/fsl_lpspi_edma.c'] + +if GetDepend(['BSP_USING_PULSE_ENCODER']): + src += ['MIMXRT1052/drivers/fsl_enc.c'] +#Adding this as XBAR is used in pin mux +src += ['MIMXRT1052/drivers/fsl_xbara.c'] +src += ['MIMXRT1052/drivers/fsl_xbarb.c'] + +#fsl os abstract files +src += ['MIMXRT1052/drivers/fsl_os_abstraction_rtthread.c'] +src += ['MIMXRT1052/drivers/generic_list.c'] group = DefineGroup('Libraries', src, depend = [''], CPPPATH = path) diff --git a/bsp/imxrt/libraries/drivers/SConscript b/bsp/imxrt/libraries/drivers/SConscript index 3328d2af08..6dc0bace0c 100644 --- a/bsp/imxrt/libraries/drivers/SConscript +++ b/bsp/imxrt/libraries/drivers/SConscript @@ -54,15 +54,22 @@ if GetDepend('BSP_USING_AUDIO'): if GetDepend('BSP_USING_SDIO'): src += ['drv_sdio.c'] - -if GetDepend('BSP_USING_USB_DEVICE'): + +if GetDepend('BSP_USING_PULSE_ENCODER'): + src += ['drv_pulse_encoder.c'] + +if GetDepend('RT_USING_USB_DEVICE'): src += ['drv_usbd.c'] src += Glob('usb/device/*.c') -if GetDepend('BSP_USING_USB_DEVICE'): +if GetDepend('RT_USING_USB_DEVICE') or GetDepend('RT_USING_USB_HOST'): src += Glob('usb/phy/*.c') CPPDEFINES += ['ENDIANNESS'] +if GetDepend('RT_USING_USB_HOST'): + src += ['drv_usbh.c'] + src += Glob('usb/host/*.c') + path = [cwd,cwd + '/config'] group = DefineGroup('Drivers', src, depend = [''], CPPPATH = path, CPPDEFINES=CPPDEFINES) diff --git a/bsp/imxrt/libraries/drivers/usb/host/usb_host.h b/bsp/imxrt/libraries/drivers/usb/host/usb_host.h index 53be402cd3..336c42b5f5 100644 --- a/bsp/imxrt/libraries/drivers/usb/host/usb_host.h +++ b/bsp/imxrt/libraries/drivers/usb/host/usb_host.h @@ -1,31 +1,9 @@ /* * Copyright (c) 2015 - 2016, Freescale Semiconductor, Inc. - * Copyright 2016 NXP + * Copyright 2016 - 2019 NXP + * All rights reserved. * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * o Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * o Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * o Neither the name of the copyright holder nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ #ifndef _USB_HOST_H_ @@ -34,6 +12,7 @@ #include #include #include +#include /******************************************************************************* * Definitions @@ -68,6 +47,16 @@ typedef enum _usb_host_event kUSB_HostEventDetach, /*!< Device is detached */ kUSB_HostEventEnumerationDone, /*!< Device's enumeration is done and the device is supported */ kUSB_HostEventNotSupported, /*!< Device's enumeration is done and the device is not supported */ + /*! Device's enumeration failed due to errors + * fail reason is put in the high 2 bytes of callback event code. + * kStatus_USB_TransferFailed - the transfer failed. + * kStatus_USB_TransferCancel - transfer is canceled by application. + * kStatus_USB_Error - parsing descriptor failed, the power cannot satisfy device's requirement, + * device addresss allocation failed, transfer is not enough + * or the transfer API failed. + * kStatus_USB_AllocFail - malloc failed. + */ + kUSB_HostEventEnumerationFail, #if ((defined(USB_HOST_CONFIG_LOW_POWER_MODE)) && (USB_HOST_CONFIG_LOW_POWER_MODE > 0U)) kUSB_HostEventNotSuspended, /*!< Suspend failed */ kUSB_HostEventSuspended, /*!< Suspend successful */ @@ -103,7 +92,60 @@ typedef enum _usb_host_dev_info kUSB_HostGetConfigurationDes, /*!< Device's configuration descriptor pointer */ kUSB_HostGetConfigurationLength, /*!< Device's configuration descriptor pointer */ } usb_host_dev_info_t; +/*! @brief Request type */ +typedef enum _usb_host_request_type +{ + kRequestDevice = 1U, /*!< Control request object is device */ + kRequestInterface, /*!< Control request object is interface */ + kRequestEndpoint, /*!< Control request object is endpoint */ +} usb_host_request_type_t; +/*! @brief For USB_REQUEST_STANDARD_GET_DESCRIPTOR and USB_REQUEST_STANDARD_SET_DESCRIPTOR */ +typedef struct _usb_host_process_descriptor_param +{ + uint8_t descriptorType; /*!< See the usb_spec.h, such as the USB_DESCRIPTOR_TYPE_DEVICE */ + uint8_t descriptorIndex; /*!< The descriptor index is used to select a specific descriptor (only for configuration + and string descriptors) when several descriptors of the same type are implemented in a + device */ + uint8_t languageId; /*!< It specifies the language ID for string descriptors or is reset to zero for other + descriptors */ + uint8_t *descriptorBuffer; /*!< Buffer pointer */ + uint16_t descriptorLength; /*!< Buffer data length */ +} usb_host_process_descriptor_param_t; +/*! @brief For USB_REQUEST_STANDARD_CLEAR_FEATURE and USB_REQUEST_STANDARD_SET_FEATURE */ +typedef struct _usb_host_process_feature_param +{ + uint8_t requestType; /*!< See the #usb_host_request_type_t */ + uint8_t featureSelector; /*!< Set/cleared feature */ + uint8_t interfaceOrEndpoint; /*!< Interface or end pointer */ +} usb_host_process_feature_param_t; +/*! @brief For USB_REQUEST_STANDARD_GET_INTERFACE */ +typedef struct _usb_host_get_interface_param +{ + uint8_t interface; /*!< Interface number */ + uint8_t *alternateInterfaceBuffer; /*!< Save the transfer result */ +} usb_host_get_interface_param_t; +/*! @brief For USB_REQUEST_STANDARD_GET_STATUS */ +typedef struct _usb_host_get_status_param +{ + uint16_t statusSelector; /*!< Interface number, the end pointer number or OTG status selector */ + uint8_t requestType; /*!< See the #usb_host_request_type_t */ + uint8_t *statusBuffer; /*!< Save the transfer result */ +} usb_host_get_status_param_t; + +/*! @brief For USB_REQUEST_STANDARD_SET_INTERFACE */ +typedef struct _usb_host_set_interface_param +{ + uint8_t alternateSetting; /*!< Alternate setting value */ + uint8_t interface; /*!< Interface number */ +} usb_host_set_interface_param_t; + +/*! @brief For USB_REQUEST_STANDARD_SYNCH_FRAME */ +typedef struct _usb_host_synch_frame_param +{ + uint8_t endpoint; /*!< Endpoint number */ + uint8_t *frameNumberBuffer; /*!< Frame number data buffer */ +} usb_host_synch_frame_param_t; /*! * @brief Host callback function typedef. * @@ -243,8 +285,8 @@ typedef struct _usb_host_pipe_init /*! @brief Cancel transfer parameter structure */ typedef struct _usb_host_cancel_param { - usb_host_pipe_handle pipeHandle; /*!< Cancelling pipe handle*/ - usb_host_transfer_t *transfer; /*!< Cancelling transfer*/ + usb_host_pipe_handle pipeHandle; /*!< Canceling pipe handle*/ + usb_host_transfer_t *transfer; /*!< Canceling transfer*/ } usb_host_cancel_param_t; /******************************************************************************* @@ -342,7 +384,7 @@ extern usb_status_t USB_HostHelperParseAlternateSetting(usb_host_interface_handl * @retval kStatus_USB_InvalidParameter The deviceHandle instance don't belong to hostHandle instance. */ extern usb_status_t USB_HostRemoveDevice(usb_host_handle hostHandle, usb_device_handle deviceHandle); - +#if (defined(USB_HOST_CONFIG_KHCI) && (USB_HOST_CONFIG_KHCI > 0U)) /*! * @brief KHCI task function. * @@ -353,7 +395,8 @@ extern usb_status_t USB_HostRemoveDevice(usb_host_handle hostHandle, usb_device_ * @param[in] hostHandle The host handle. */ extern void USB_HostKhciTaskFunction(void *hostHandle); - +#endif +#if (defined(USB_HOST_CONFIG_EHCI) && (USB_HOST_CONFIG_EHCI > 0U)) /*! * @brief EHCI task function. * @@ -364,7 +407,8 @@ extern void USB_HostKhciTaskFunction(void *hostHandle); * @param[in] hostHandle The host handle. */ extern void USB_HostEhciTaskFunction(void *hostHandle); - +#endif +#if (defined(USB_HOST_CONFIG_OHCI) && (USB_HOST_CONFIG_OHCI > 0U)) /*! * @brief OHCI task function. * @@ -375,7 +419,8 @@ extern void USB_HostEhciTaskFunction(void *hostHandle); * @param[in] hostHandle The host handle. */ extern void USB_HostOhciTaskFunction(void *hostHandle); - +#endif +#if (defined(USB_HOST_CONFIG_IP3516HS) && (USB_HOST_CONFIG_IP3516HS > 0U)) /*! * @brief IP3516HS task function. * @@ -386,7 +431,8 @@ extern void USB_HostOhciTaskFunction(void *hostHandle); * @param[in] hostHandle The host handle. */ extern void USB_HostIp3516HsTaskFunction(void *hostHandle); - +#endif +#if (defined(USB_HOST_CONFIG_KHCI) && (USB_HOST_CONFIG_KHCI > 0U)) /*! * @brief Device KHCI ISR function. * @@ -395,7 +441,8 @@ extern void USB_HostIp3516HsTaskFunction(void *hostHandle); * @param[in] hostHandle The host handle. */ extern void USB_HostKhciIsrFunction(void *hostHandle); - +#endif +#if (defined(USB_HOST_CONFIG_EHCI) && (USB_HOST_CONFIG_EHCI > 0U)) /*! * @brief Device EHCI ISR function. * @@ -404,7 +451,8 @@ extern void USB_HostKhciIsrFunction(void *hostHandle); * @param[in] hostHandle The host handle. */ extern void USB_HostEhciIsrFunction(void *hostHandle); - +#endif +#if (defined(USB_HOST_CONFIG_OHCI) && (USB_HOST_CONFIG_OHCI > 0U)) /*! * @brief Device OHCI ISR function. * @@ -413,7 +461,8 @@ extern void USB_HostEhciIsrFunction(void *hostHandle); * @param[in] hostHandle The host handle. */ extern void USB_HostOhciIsrFunction(void *hostHandle); - +#endif +#if (defined(USB_HOST_CONFIG_IP3516HS) && (USB_HOST_CONFIG_IP3516HS > 0U)) /*! * @brief Device IP3516HS ISR function. * @@ -422,7 +471,7 @@ extern void USB_HostOhciIsrFunction(void *hostHandle); * @param[in] hostHandle The host handle. */ extern void USB_HostIp3516HsIsrFunction(void *hostHandle); - +#endif /*! @}*/ /*! @@ -566,7 +615,7 @@ extern usb_status_t USB_HostFreeTransfer(usb_host_handle hostHandle, usb_host_tr * This function sends the USB standard request packet. * * @param[in] deviceHandle The device handle for control transfer. - * @param[in] usbRequest A USB standard request code. Se the usb_spec.h. + * @param[in] usbRequest A USB standard request code. See the usb_spec.h. * @param[in] transfer The used transfer. * @param[in] param The parameter structure is different for different request, see * usb_host_framework.h. @@ -694,10 +743,10 @@ extern usb_status_t USB_HostL1ResumeDeviceResquest(usb_host_handle hostHandle, /*! * @brief Update the lpm param. * - * The function is used to configuure the lpm token. + * The function is used to configure the lpm token. * * @param[in] hostHandle The host handle. - * @param[in] lpmParam HIRD vaule and whether enable remotewakeup. + * @param[in] lpmParam HIRD value and whether enable remotewakeup. * */ extern usb_status_t USB_HostL1SleepDeviceResquestConfig(usb_host_handle hostHandle, uint8_t *lpmParam); @@ -715,6 +764,19 @@ extern usb_status_t USB_HostUpdateHwTick(usb_host_handle hostHandle, uint64_t ti #endif +#if ((defined(USB_HOST_CONFIG_BATTERY_CHARGER)) && (USB_HOST_CONFIG_BATTERY_CHARGER > 0U)) +/*! + * @brief Set the charger type. It is only supported on RT600 currently. + * + * The set charger type becomes valid in next attach. + * + * @param[in] hostHandle The host handle. + * @param[in] type. + * + */ +extern usb_status_t USB_HostSetChargerType(usb_host_handle hostHandle, uint8_t type); +#endif + /*! @}*/ #ifdef __cplusplus diff --git a/bsp/imxrt/libraries/drivers/usb/host/usb_host_devices.c b/bsp/imxrt/libraries/drivers/usb/host/usb_host_devices.c index 42b16e071e..3d3813745b 100644 --- a/bsp/imxrt/libraries/drivers/usb/host/usb_host_devices.c +++ b/bsp/imxrt/libraries/drivers/usb/host/usb_host_devices.c @@ -1,46 +1,29 @@ /* * Copyright (c) 2015 - 2016, Freescale Semiconductor, Inc. - * Copyright 2016 NXP + * Copyright 2016,2019 NXP * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * o Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * o Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * o Neither the name of the copyright holder nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ +#include "fsl_os_abstraction.h" #include #include "usb_host.h" #include "usb_host_hci.h" #include "usb_host_devices.h" - +#include "usb_host_framework.h" #if ((defined USB_HOST_CONFIG_HUB) && (USB_HOST_CONFIG_HUB)) #include "usb_host_hub.h" +#include "usb_host_hub_app.h" #endif /* USB_HOST_CONFIG_HUB */ /******************************************************************************* * Definitions ******************************************************************************/ +#ifndef USB_HOST_CONFIG_MAX_CONFIGURATION_DESCRIPTOR_LENGTH +#define USB_HOST_CONFIG_MAX_CONFIGURATION_DESCRIPTOR_LENGTH (5000U) +#endif + /******************************************************************************* * Prototypes ******************************************************************************/ @@ -70,7 +53,7 @@ static usb_status_t USB_HostProcessState(usb_host_device_instance_t *deviceInsta * * @return kStatus_USB_Success or error codes */ -static usb_status_t USB_HostProcessCallback(usb_host_device_instance_t *deviceInstance); +static usb_status_t USB_HostProcessCallback(usb_host_device_instance_t *deviceInstance, uint32_t dataLength); /*! * @brief notify the application event, the callback is registered when initializing host. @@ -80,7 +63,10 @@ static usb_status_t USB_HostProcessCallback(usb_host_device_instance_t *deviceIn * * @return kStatus_USB_Success or error codes */ -static usb_status_t USB_HostNotifyDevice(usb_host_device_instance_t *deviceInstance, uint32_t eventCode); +static usb_status_t USB_HostNotifyDevice(usb_host_handle hostHandle, + usb_host_device_instance_t *deviceInstance, + uint32_t eventCode, + uint32_t eventParameter); /*! * @brief allocate one address. @@ -140,68 +126,57 @@ static usb_status_t USB_HostRemoveDeviceInstance(usb_host_handle hostHandle, usb */ static usb_status_t USB_HostControlBus(usb_host_handle hostHandle, uint8_t controlType); -extern usb_status_t USB_HostStandardSetGetDescriptor(usb_host_device_instance_t *deviceInstance, - usb_host_transfer_t *transfer, - void *param); -extern usb_status_t USB_HostStandardSetAddress(usb_host_device_instance_t *deviceInstance, - usb_host_transfer_t *transfer, - void *param); -extern usb_status_t USB_HostCh9RequestCommon(usb_host_device_instance_t *deviceInstance, - usb_host_transfer_t *transfer, - uint8_t *buffer, - uint32_t bufferLen); - #if ((defined USB_HOST_CONFIG_HUB) && (USB_HOST_CONFIG_HUB)) -extern usb_status_t USB_HostHubDeviceEvent(usb_host_handle hostHandle, - usb_device_handle deviceHandle, - usb_host_configuration_handle configurationHandle, - uint32_t eventCode); - -extern uint32_t USB_HostHubGetHsHubNumber(usb_host_handle hostHandle, uint8_t parentHubNo); - -extern uint32_t USB_HostHubGetHsHubPort(usb_host_handle hostHandle, uint8_t parentHubNo, uint8_t parentPortNo); - -extern usb_status_t USB_HostHubRemovePort(usb_host_handle hostHandle, uint8_t hubNumber, uint8_t portNumber); - #endif /******************************************************************************* * Variables ******************************************************************************/ -extern usb_host_instance_t g_UsbHostInstance[USB_HOST_CONFIG_MAX_HOST]; - /*! @brief enumeration step process array */ -static const usb_host_enum_process_entry_t s_EnumEntries[] = \ -{ +static const usb_host_enum_process_entry_t s_EnumEntries[] = { /* kStatus_dev_initial */ { - 0, 0, NULL, + kStatus_DEV_Notinit, + kStatus_DEV_Notinit, + NULL, }, /* kStatus_DEV_GetDes8 */ { - kStatus_DEV_SetAddress, kStatus_DEV_GetDes8, USB_HostProcessCallback, + kStatus_DEV_SetAddress, + kStatus_DEV_GetDes8, + USB_HostProcessCallback, }, /* kStatus_DEV_SetAddress */ { - kStatus_DEV_GetDes, kStatus_DEV_SetAddress, USB_HostProcessCallback, + kStatus_DEV_GetDes, + kStatus_DEV_SetAddress, + USB_HostProcessCallback, }, /* kStatus_DEV_GetDes */ { - kStatus_DEV_GetCfg9, kStatus_DEV_GetDes, NULL, + kStatus_DEV_GetCfg9, + kStatus_DEV_GetDes, + NULL, }, /* kStatus_DEV_GetCfg9 */ { - kStatus_DEV_GetCfg, kStatus_DEV_GetCfg9, USB_HostProcessCallback, + kStatus_DEV_GetCfg, + kStatus_DEV_GetCfg9, + USB_HostProcessCallback, }, /* kStatus_DEV_GetCfg */ { - kStatus_DEV_SetCfg, kStatus_DEV_GetCfg9, USB_HostProcessCallback, + kStatus_DEV_SetCfg, + kStatus_DEV_GetCfg9, + USB_HostProcessCallback, }, /* kStatus_DEV_SetCfg */ { - kStatus_DEV_EnumDone, kStatus_DEV_SetCfg, NULL, + kStatus_DEV_EnumDone, + kStatus_DEV_SetCfg, + NULL, }, }; @@ -211,69 +186,66 @@ static const usb_host_enum_process_entry_t s_EnumEntries[] = \ static void USB_HostEnumerationTransferCallback(void *param, usb_host_transfer_t *transfer, usb_status_t status) { - uint8_t nextStep = 0; + /* 0 - retry current transfer, 1 - transfer success process, + * 2 - retry whole process, 3 - fail process + */ + uint8_t nextStep = 0U; usb_host_device_instance_t *deviceInstance = (usb_host_device_instance_t *)param; + usb_status_t failReason = kStatus_USB_Success; + uint32_t dataLength; - USB_HostFreeTransfer(deviceInstance->hostHandle, transfer); /* free transfer */ + dataLength = transfer->transferSofar; + (void)USB_HostFreeTransfer(deviceInstance->hostHandle, transfer); /* free transfer */ if (status == kStatus_USB_Success) { - nextStep = 1; + nextStep = 1U; } else if (status == kStatus_USB_TransferStall) { #if ((defined USB_HOST_CONFIG_COMPLIANCE_TEST) && (USB_HOST_CONFIG_COMPLIANCE_TEST)) - usb_echo("no response from device\r\n"); -#endif /* USB_HOST_CONFIG_COMPLIANCE_TEST */ - if (deviceInstance->stallRetries > 0) /* retry same transfer when stall */ + (void)usb_echo("no response from device\r\n"); +#endif /* USB_HOST_CONFIG_COMPLIANCE_TEST */ + if (deviceInstance->stallRetries > 0U) /* retry same transfer when stall */ { + nextStep = 0U; deviceInstance->stallRetries--; } - else /* process next state when all retries stall */ + else { - nextStep = 1; + failReason = kStatus_USB_TransferFailed; + nextStep = 2U; } } else if (status == kStatus_USB_TransferCancel) { - return; + failReason = kStatus_USB_TransferCancel; + nextStep = 3U; } else { - if (deviceInstance->enumRetries > 0) /* next whole retry */ - { - deviceInstance->enumRetries--; - deviceInstance->stallRetries = USB_HOST_CONFIG_ENUMERATION_MAX_STALL_RETRIES; - deviceInstance->configurationValue = 0; - deviceInstance->state = kStatus_DEV_GetDes8; - } - else - { -#if ((defined USB_HOST_CONFIG_COMPLIANCE_TEST) && (USB_HOST_CONFIG_COMPLIANCE_TEST)) - usb_echo("Device No Response\r\n"); -#endif - return; - } + failReason = kStatus_USB_TransferFailed; + nextStep = 2U; } - if (nextStep == 1) + if (nextStep == 1U) { deviceInstance->stallRetries = USB_HOST_CONFIG_ENUMERATION_MAX_STALL_RETRIES; - if (s_EnumEntries[deviceInstance->state - 1].process == NULL) + if (s_EnumEntries[deviceInstance->state - 1U].process == NULL) { - deviceInstance->state = s_EnumEntries[deviceInstance->state - 1].successState; /* next state */ + deviceInstance->state = (uint8_t)s_EnumEntries[deviceInstance->state - 1U].successState; /* next state */ } else { - status = s_EnumEntries[deviceInstance->state - 1].process( - deviceInstance); /* process the previous state result */ + status = s_EnumEntries[deviceInstance->state - 1U].process( + deviceInstance, dataLength); /* process the previous state result */ if (status == kStatus_USB_Success) /* process success */ { - deviceInstance->state = s_EnumEntries[deviceInstance->state - 1].successState; + deviceInstance->state = (uint8_t)s_EnumEntries[deviceInstance->state - 1U].successState; } else if (status == kStatus_USB_Retry) /* need retry */ { - deviceInstance->state = s_EnumEntries[deviceInstance->state - 1].retryState; + deviceInstance->state = (uint8_t)s_EnumEntries[deviceInstance->state - 1U].retryState; } else if (status == kStatus_USB_NotSupported) /* device don't suport by the application */ { @@ -281,30 +253,48 @@ static void USB_HostEnumerationTransferCallback(void *param, usb_host_transfer_t } else /* process error, next retry */ { - if (deviceInstance->enumRetries > 0) /* next whole retry */ - { - deviceInstance->enumRetries--; - deviceInstance->stallRetries = USB_HOST_CONFIG_ENUMERATION_MAX_STALL_RETRIES; - deviceInstance->configurationValue = 0; - deviceInstance->state = kStatus_DEV_GetDes8; - } - else - { -#if ((defined USB_HOST_CONFIG_COMPLIANCE_TEST) && (USB_HOST_CONFIG_COMPLIANCE_TEST)) - usb_echo("Device No Response\r\n"); -#endif - return; /* unrecoverable fail */ - } + /* kStatus_USB_Error or kStatus_USB_AllocFail */ + failReason = status; + nextStep = 2U; } } } - if (USB_HostProcessState(deviceInstance) != kStatus_USB_Success) /* process the new state */ + if (nextStep == 2U) { -#ifdef HOST_ECHO - usb_echo("enumation setup error\r\n"); + if (deviceInstance->enumRetries > 0U) /* next whole retry */ + { + deviceInstance->enumRetries--; + deviceInstance->stallRetries = USB_HOST_CONFIG_ENUMERATION_MAX_STALL_RETRIES; + deviceInstance->configurationValue = 0U; + deviceInstance->state = (uint8_t)kStatus_DEV_GetDes8; + } + else + { +#if ((defined USB_HOST_CONFIG_COMPLIANCE_TEST) && (USB_HOST_CONFIG_COMPLIANCE_TEST)) + usb_echo("Device No Response\r\n"); #endif - return; + nextStep = 3U; + } + } + + /* process the state */ + if (nextStep != 3U) + { + if (USB_HostProcessState(deviceInstance) != kStatus_USB_Success) + { +#ifdef HOST_ECHO + usb_echo("enumation setup error\r\n"); +#endif + failReason = kStatus_USB_Error; + nextStep = 3U; + } + } + + if (nextStep == 3U) + { + (void)USB_HostNotifyDevice(deviceInstance->hostHandle, deviceInstance, (uint32_t)kUSB_HostEventEnumerationFail, + (uint32_t)failReason); } } @@ -313,9 +303,11 @@ static usb_status_t USB_HostProcessState(usb_host_device_instance_t *deviceInsta usb_status_t status = kStatus_USB_Success; usb_host_process_descriptor_param_t getDescriptorParam; usb_host_transfer_t *transfer; + usb_host_device_enumeration_status_t state; /* malloc transfer */ - if (deviceInstance->state != kStatus_DEV_EnumDone) + state = (usb_host_device_enumeration_status_t)deviceInstance->state; + if (state != kStatus_DEV_EnumDone) { if (USB_HostMallocTransfer(deviceInstance->hostHandle, &transfer) != kStatus_USB_Success) { @@ -324,29 +316,29 @@ static usb_status_t USB_HostProcessState(usb_host_device_instance_t *deviceInsta #endif return kStatus_USB_Error; } - transfer->callbackFn = USB_HostEnumerationTransferCallback; + transfer->callbackFn = USB_HostEnumerationTransferCallback; transfer->callbackParam = deviceInstance; /* reset transfer fields */ - transfer->setupPacket->bmRequestType = 0x00; - transfer->setupPacket->wIndex = 0; - transfer->setupPacket->wLength = 0; - transfer->setupPacket->wValue = 0; + transfer->setupPacket->bmRequestType = 0x00U; + transfer->setupPacket->wIndex = 0U; + transfer->setupPacket->wLength = 0U; + transfer->setupPacket->wValue = 0U; } - switch (deviceInstance->state) + switch (state) { case kStatus_DEV_GetDes8: case kStatus_DEV_GetDes: /* get descriptor state */ getDescriptorParam.descriptorLength = sizeof(usb_descriptor_device_t); - if (deviceInstance->state == kStatus_DEV_GetDes8) + if (deviceInstance->state == (uint8_t)kStatus_DEV_GetDes8) { - getDescriptorParam.descriptorLength = 8; + getDescriptorParam.descriptorLength = 8U; } getDescriptorParam.descriptorBuffer = (uint8_t *)deviceInstance->deviceDescriptor; - getDescriptorParam.descriptorType = USB_DESCRIPTOR_TYPE_DEVICE; - getDescriptorParam.descriptorIndex = 0; - getDescriptorParam.languageId = 0; + getDescriptorParam.descriptorType = USB_DESCRIPTOR_TYPE_DEVICE; + getDescriptorParam.descriptorIndex = 0U; + getDescriptorParam.languageId = 0U; transfer->setupPacket->bmRequestType |= USB_REQUEST_TYPE_DIR_IN; transfer->setupPacket->bRequest = USB_REQUEST_STANDARD_GET_DESCRIPTOR; @@ -359,10 +351,10 @@ static usb_status_t USB_HostProcessState(usb_host_device_instance_t *deviceInsta case kStatus_DEV_GetCfg9: /* get 9 bytes configuration state */ getDescriptorParam.descriptorBuffer = deviceInstance->enumBuffer; - getDescriptorParam.descriptorType = USB_DESCRIPTOR_TYPE_CONFIGURE; - getDescriptorParam.descriptorIndex = deviceInstance->configurationValue; + getDescriptorParam.descriptorType = USB_DESCRIPTOR_TYPE_CONFIGURE; + getDescriptorParam.descriptorIndex = deviceInstance->configurationValue; getDescriptorParam.descriptorLength = 9; - getDescriptorParam.languageId = 0; + getDescriptorParam.languageId = 0; transfer->setupPacket->bmRequestType |= USB_REQUEST_TYPE_DIR_IN; transfer->setupPacket->bRequest = USB_REQUEST_STANDARD_GET_DESCRIPTOR; @@ -371,10 +363,10 @@ static usb_status_t USB_HostProcessState(usb_host_device_instance_t *deviceInsta case kStatus_DEV_GetCfg: /* get configuration state */ getDescriptorParam.descriptorBuffer = deviceInstance->configurationDesc; - getDescriptorParam.descriptorType = USB_DESCRIPTOR_TYPE_CONFIGURE; - getDescriptorParam.descriptorIndex = deviceInstance->configurationValue; + getDescriptorParam.descriptorType = USB_DESCRIPTOR_TYPE_CONFIGURE; + getDescriptorParam.descriptorIndex = deviceInstance->configurationValue; getDescriptorParam.descriptorLength = deviceInstance->configurationLen; - getDescriptorParam.languageId = 0; + getDescriptorParam.languageId = 0; transfer->setupPacket->bmRequestType |= USB_REQUEST_TYPE_DIR_IN; transfer->setupPacket->bRequest = USB_REQUEST_STANDARD_GET_DESCRIPTOR; @@ -385,52 +377,71 @@ static usb_status_t USB_HostProcessState(usb_host_device_instance_t *deviceInsta transfer->setupPacket->wValue = USB_SHORT_TO_LITTLE_ENDIAN(deviceInstance->configuration.configurationDesc->bConfigurationValue); transfer->setupPacket->bRequest = USB_REQUEST_STANDARD_SET_CONFIGURATION; - status = USB_HostCh9RequestCommon(deviceInstance, transfer, NULL, 0); + status = USB_HostCh9RequestCommon(deviceInstance, transfer, NULL, 0); break; case kStatus_DEV_EnumDone: /* enumeration done state */ - status = USB_HostNotifyDevice(deviceInstance, - kUSB_HostEventEnumerationDone); /* notify device enumeration done */ + /* notify device enumeration done */ + status = USB_HostNotifyDevice(deviceInstance->hostHandle, deviceInstance, + (uint32_t)kUSB_HostEventEnumerationDone, (uint32_t)kStatus_USB_Success); if (status == kStatus_USB_Success) { - deviceInstance->state = kStatus_DEV_AppUsed; + deviceInstance->state = (uint8_t)kStatus_DEV_AppUsed; } break; default: + /*no action*/ break; } return status; } -static usb_status_t USB_HostProcessCallback(usb_host_device_instance_t *deviceInstance) +static usb_status_t USB_HostProcessCallback(usb_host_device_instance_t *deviceInstance, uint32_t dataLength) { usb_host_pipe_t *pipe = (usb_host_pipe_t *)deviceInstance->controlPipe; - usb_status_t status = kStatus_USB_Success; + usb_status_t status = kStatus_USB_Success; usb_descriptor_configuration_t *configureDesc; usb_host_instance_t *hostInstance = (usb_host_instance_t *)deviceInstance->hostHandle; + void *temp; + usb_host_device_enumeration_status_t state; - switch (deviceInstance->state) + state = (usb_host_device_enumeration_status_t)deviceInstance->state; + switch (state) { case kStatus_DEV_GetDes8: /* process get 8 bytes descriptor result */ + if (dataLength != 8u) + { + return kStatus_USB_Error; + } pipe->maxPacketSize = deviceInstance->deviceDescriptor->bMaxPacketSize0; - hostInstance->controllerTable->controllerIoctl( + /* the callbackFn is initialized in USB_HostGetControllerInterface */ + (void)hostInstance->controllerTable->controllerIoctl( hostInstance->controllerHandle, kUSB_HostUpdateControlPacketSize, deviceInstance->controlPipe); break; case kStatus_DEV_SetAddress: /* process set address result */ deviceInstance->setAddress = deviceInstance->allocatedAddress; - hostInstance->controllerTable->controllerIoctl( + /* the callbackFn is initialized in USB_HostGetControllerInterface */ + (void)hostInstance->controllerTable->controllerIoctl( hostInstance->controllerHandle, kUSB_HostUpdateControlEndpointAddress, deviceInstance->controlPipe); break; - case kStatus_DEV_GetDes: /* process set address result */ - /* NULL */ + case kStatus_DEV_GetDes: /* process get full device descriptor result */ + if (dataLength != sizeof(usb_descriptor_device_t)) + { + return kStatus_USB_Error; + } break; case kStatus_DEV_GetCfg9: /* process get 9 bytes configuration result */ - configureDesc = (usb_descriptor_configuration_t *)&deviceInstance->enumBuffer[0]; + if (dataLength != 9u) + { + return kStatus_USB_Error; + } + temp = (void *)&deviceInstance->enumBuffer[0]; + configureDesc = (usb_descriptor_configuration_t *)temp; deviceInstance->configurationLen = USB_SHORT_FROM_LITTLE_ENDIAN_ADDRESS(configureDesc->wTotalLength); if (deviceInstance->configurationDesc != NULL) @@ -438,19 +449,25 @@ static usb_status_t USB_HostProcessCallback(usb_host_device_instance_t *deviceIn #if ((defined(USB_HOST_CONFIG_BUFFER_PROPERTY_CACHEABLE)) && (USB_HOST_CONFIG_BUFFER_PROPERTY_CACHEABLE > 0U)) SDK_Free(deviceInstance->configurationDesc); #else - USB_OsaMemoryFree(deviceInstance->configurationDesc); + OSA_MemoryFree(deviceInstance->configurationDesc); #endif deviceInstance->configurationDesc = NULL; } + + /* fix misra 4.14 */ + if (deviceInstance->configurationLen > USB_HOST_CONFIG_MAX_CONFIGURATION_DESCRIPTOR_LENGTH) + { + return kStatus_USB_Error; + } /* for KHCI, the start address and the length should be 4 byte align */ - if ((deviceInstance->configurationLen & 0x03) != 0) + if ((deviceInstance->configurationLen & 0x03U) != 0U) { #if ((defined(USB_HOST_CONFIG_BUFFER_PROPERTY_CACHEABLE)) && (USB_HOST_CONFIG_BUFFER_PROPERTY_CACHEABLE > 0U)) deviceInstance->configurationDesc = - (uint8_t *)SDK_Malloc((deviceInstance->configurationLen & 0xFFFFFFFCu) + 4, USB_CACHE_LINESIZE); + (uint8_t *)SDK_Malloc((deviceInstance->configurationLen & 0xFFFCu) + 4, USB_CACHE_LINESIZE); #else deviceInstance->configurationDesc = - (uint8_t *)USB_OsaMemoryAllocate((deviceInstance->configurationLen & 0xFFFFFFFCu) + 4); + (uint8_t *)OSA_MemoryAllocate((((uint32_t)deviceInstance->configurationLen) & 0xFFFCU) + 4UL); #endif } else @@ -459,18 +476,22 @@ static usb_status_t USB_HostProcessCallback(usb_host_device_instance_t *deviceIn deviceInstance->configurationDesc = (uint8_t *)SDK_Malloc(deviceInstance->configurationLen, USB_CACHE_LINESIZE); #else - deviceInstance->configurationDesc = (uint8_t *)USB_OsaMemoryAllocate(deviceInstance->configurationLen); + deviceInstance->configurationDesc = (uint8_t *)OSA_MemoryAllocate(deviceInstance->configurationLen); #endif } if (deviceInstance->configurationDesc == NULL) { - return kStatus_USB_Error; + return kStatus_USB_AllocFail; } break; - case kStatus_DEV_GetCfg: /* process get cofiguration result */ - if (((usb_descriptor_configuration_t *)deviceInstance->configurationDesc)->bMaxPower > - USB_HOST_CONFIG_MAX_POWER) + case kStatus_DEV_GetCfg: /* process get configuration result */ + if (dataLength != deviceInstance->configurationLen) + { + return kStatus_USB_Error; + } + temp = (void *)deviceInstance->configurationDesc; + if (((usb_descriptor_configuration_t *)temp)->bMaxPower > USB_HOST_CONFIG_MAX_POWER) { return kStatus_USB_Error; } @@ -481,7 +502,8 @@ static usb_status_t USB_HostProcessCallback(usb_host_device_instance_t *deviceIn return kStatus_USB_Error; } - status = USB_HostNotifyDevice(deviceInstance, kUSB_HostEventAttach); + status = USB_HostNotifyDevice(deviceInstance->hostHandle, deviceInstance, (uint32_t)kUSB_HostEventAttach, + (uint32_t)kStatus_USB_Success); if (status != kStatus_USB_Success) { @@ -492,8 +514,9 @@ static usb_status_t USB_HostProcessCallback(usb_host_device_instance_t *deviceIn } else { - USB_HostNotifyDevice(deviceInstance, - kUSB_HostEventNotSupported); /* notify application device is not supported */ + /* notify application device is not supported */ + (void)USB_HostNotifyDevice(deviceInstance->hostHandle, deviceInstance, + (uint32_t)kUSB_HostEventNotSupported, (uint32_t)kStatus_USB_Success); return kStatus_USB_NotSupported; } } @@ -504,13 +527,17 @@ static usb_status_t USB_HostProcessCallback(usb_host_device_instance_t *deviceIn break; default: + /*no action*/ break; } return status; } -static usb_status_t USB_HostNotifyDevice(usb_host_device_instance_t *deviceInstance, uint32_t eventCode) +static usb_status_t USB_HostNotifyDevice(usb_host_handle hostHandle, + usb_host_device_instance_t *deviceInstance, + uint32_t eventCode, + uint32_t eventParameter) { usb_host_instance_t *hostInstance; usb_status_t status1 = kStatus_USB_Error; @@ -521,34 +548,37 @@ static usb_status_t USB_HostNotifyDevice(usb_host_device_instance_t *deviceInsta uint8_t interfaceIndex; #endif /* USB_HOST_CONFIG_HUB */ + eventCode = (((uint32_t)eventParameter << 16U) | (uint32_t)eventCode); + hostInstance = (usb_host_instance_t *)hostHandle; if (deviceInstance == NULL) { + (void)hostInstance->deviceCallback(NULL, NULL, eventCode); return kStatus_USB_InvalidHandle; } - hostInstance = (usb_host_instance_t *)deviceInstance->hostHandle; #if ((defined USB_HOST_CONFIG_HUB) && (USB_HOST_CONFIG_HUB)) - haveHub = 0; - haveNoHub = 0; - for (interfaceIndex = 0; interfaceIndex < deviceInstance->configuration.interfaceCount; ++interfaceIndex) + haveHub = 0U; + haveNoHub = 0U; + for (interfaceIndex = 0U; interfaceIndex < deviceInstance->configuration.interfaceCount; ++interfaceIndex) { if (((usb_descriptor_interface_t *)deviceInstance->configuration.interfaceList[interfaceIndex].interfaceDesc) ->bInterfaceClass == USB_HOST_HUB_CLASS_CODE) { - haveHub = 1; + haveHub = 1U; } else { - haveNoHub = 1; + haveNoHub = 1U; } } - if ((haveNoHub == 1) && (hostInstance->deviceCallback != NULL)) + if ((hostInstance->deviceCallback != NULL) && + ((haveNoHub == 1U) || (deviceInstance->configuration.interfaceCount == 0U))) { - status1 = hostInstance->deviceCallback(deviceInstance, &deviceInstance->configuration, - eventCode); /* notify application event */ + /* call host callback function, function is initialized in USB_HostInit */ + status1 = hostInstance->deviceCallback(deviceInstance, &deviceInstance->configuration, eventCode); } - if (haveHub) + if (0U != haveHub) { status2 = USB_HostHubDeviceEvent(hostInstance, deviceInstance, &deviceInstance->configuration, eventCode); /* notify hub event */ @@ -558,7 +588,7 @@ static usb_status_t USB_HostNotifyDevice(usb_host_device_instance_t *deviceInsta { return kStatus_USB_Success; } - else if (eventCode == kUSB_HostEventAttach) /* attach event */ + else if (eventCode == (uint32_t)kUSB_HostEventAttach) /* attach event */ { status1 = kStatus_USB_NotSupported; } @@ -569,8 +599,8 @@ static usb_status_t USB_HostNotifyDevice(usb_host_device_instance_t *deviceInsta #else if (hostInstance->deviceCallback != NULL) { - status1 = hostInstance->deviceCallback(deviceInstance, &deviceInstance->configuration, - eventCode); /* call host callback function */ + /* call host callback function, function is initialized in USB_HostInit */ + status1 = hostInstance->deviceCallback(deviceInstance, &deviceInstance->configuration, eventCode); } #endif return status1; @@ -578,24 +608,24 @@ static usb_status_t USB_HostNotifyDevice(usb_host_device_instance_t *deviceInsta static uint8_t USB_HostAllocateDeviceAddress(usb_host_instance_t *hostInstance) { - uint8_t address = 0; + uint8_t address = 0U; uint8_t addressIndex; uint8_t addressBitIndex; - for (addressIndex = 0; addressIndex < 8; ++addressIndex) /* find the idle address postion byte */ + for (addressIndex = 0U; addressIndex < 8U; ++addressIndex) /* find the idle address position byte */ { - if (hostInstance->addressBitMap[addressIndex] != 0xFF) + if (hostInstance->addressBitMap[addressIndex] != 0xFFU) { break; } } - if (addressIndex < 8) + if (addressIndex < 8U) { - for (addressBitIndex = 0; addressBitIndex < 8; ++addressBitIndex) /* find the idle address position bit */ + for (addressBitIndex = 0U; addressBitIndex < 8U; ++addressBitIndex) /* find the idle address position bit */ { - if (!(hostInstance->addressBitMap[addressIndex] & (0x01u << addressBitIndex))) + if (0U == (hostInstance->addressBitMap[addressIndex] & (0x01U << addressBitIndex))) { - hostInstance->addressBitMap[addressIndex] |= (0x01u << addressBitIndex); /* set the allocated bit */ - address = addressIndex * 8 + addressBitIndex + 1; /* the address minimum is 1 */ + hostInstance->addressBitMap[addressIndex] |= (0x01U << addressBitIndex); /* set the allocated bit */ + address = addressIndex * 8U + addressBitIndex + 1U; /* the address minimum is 1 */ break; } } @@ -605,10 +635,10 @@ static uint8_t USB_HostAllocateDeviceAddress(usb_host_instance_t *hostInstance) static void USB_HostReleaseDeviceAddress(usb_host_instance_t *hostInstance, uint8_t address) { - USB_HostLock(); - hostInstance->addressBitMap[(uint32_t)(address - 1) >> 3] &= - (~(0x01u << (((uint32_t)address - 1) & 0x07U))); /* reset the allocated bit */ - USB_HostUnlock(); + (void)USB_HostLock(); + hostInstance->addressBitMap[((uint32_t)address - 1U) >> 3U] &= + (~(0x01U << (((uint32_t)address - 1U) & 0x07U))); /* reset the allocated bit */ + (void)USB_HostUnlock(); } static usb_status_t USB_HostRemoveDeviceInstance(usb_host_handle hostHandle, usb_device_handle deviceHandle) @@ -640,7 +670,7 @@ static usb_status_t USB_HostRemoveDeviceInstance(usb_host_handle hostHandle, usb prevInstance->next = currentInstance->next; return kStatus_USB_Success; } - prevInstance = currentInstance; + prevInstance = currentInstance; currentInstance = currentInstance->next; } @@ -660,13 +690,13 @@ static void USB_HostReleaseDeviceResource(usb_host_instance_t *hostInstance, usb } #endif /* release device's address */ - if (deviceInstance->setAddress != 0) + if (deviceInstance->setAddress != 0U) { USB_HostReleaseDeviceAddress(hostInstance, deviceInstance->setAddress); } else { - if (deviceInstance->allocatedAddress != 0) + if (deviceInstance->allocatedAddress != 0U) { USB_HostReleaseDeviceAddress(hostInstance, deviceInstance->allocatedAddress); } @@ -675,7 +705,7 @@ static void USB_HostReleaseDeviceResource(usb_host_instance_t *hostInstance, usb /* close control pipe */ if (deviceInstance->controlPipe != NULL) { - USB_HostCancelTransfer(hostInstance, deviceInstance->controlPipe, NULL); + (void)USB_HostCancelTransfer(hostInstance, deviceInstance->controlPipe, NULL); if (USB_HostClosePipe(hostInstance, deviceInstance->controlPipe) != kStatus_USB_Success) { #ifdef HOST_ECHO @@ -691,7 +721,7 @@ static void USB_HostReleaseDeviceResource(usb_host_instance_t *hostInstance, usb #if ((defined(USB_HOST_CONFIG_BUFFER_PROPERTY_CACHEABLE)) && (USB_HOST_CONFIG_BUFFER_PROPERTY_CACHEABLE > 0U)) SDK_Free(deviceInstance->configurationDesc); #else - USB_OsaMemoryFree(deviceInstance->configurationDesc); + OSA_MemoryFree(deviceInstance->configurationDesc); #endif } @@ -701,20 +731,20 @@ static void USB_HostReleaseDeviceResource(usb_host_instance_t *hostInstance, usb #if ((defined(USB_HOST_CONFIG_BUFFER_PROPERTY_CACHEABLE)) && (USB_HOST_CONFIG_BUFFER_PROPERTY_CACHEABLE > 0U)) SDK_Free(deviceInstance->deviceDescriptor); #else - USB_OsaMemoryFree(deviceInstance->deviceDescriptor); + OSA_MemoryFree(deviceInstance->deviceDescriptor); #endif /* free device instance buffer */ - USB_OsaMemoryFree(deviceInstance); + OSA_MemoryFree(deviceInstance); #if ((defined USB_HOST_CONFIG_HUB) && (USB_HOST_CONFIG_HUB)) /* enable controller attach if root hub */ - if (level == 1) + if (level == 1U) { - USB_HostControlBus(hostInstance, kUSB_HostBusEnableAttach); + (void)USB_HostControlBus(hostInstance, (uint8_t)kUSB_HostBusEnableAttach); } #else /* enable controller attach */ - USB_HostControlBus(hostInstance, kUSB_HostBusEnableAttach); + USB_HostControlBus(hostInstance, (uint8_t)kUSB_HostBusEnableAttach); #endif } @@ -726,35 +756,39 @@ static usb_status_t USB_HostParseDeviceConfigurationDescriptor(usb_device_handle usb_host_interface_t *interfaceParse = NULL; usb_host_ep_t *epParse; uint8_t *buffer; + void *temp; if (deviceHandle == NULL) { return kStatus_USB_InvalidParameter; } - buffer = (uint8_t *)&deviceInstance->configuration; + temp = (void *)&deviceInstance->configuration; + buffer = (uint8_t *)temp; /* clear the previous parse result, note: end_pos means buffer index here*/ - for (endPos = 0; endPos < sizeof(usb_host_configuration_t); endPos++) + for (endPos = 0U; endPos < sizeof(usb_host_configuration_t); endPos++) { - buffer[endPos] = 0; + buffer[endPos] = 0U; } - for (endPos = 0; endPos < USB_HOST_CONFIG_CONFIGURATION_MAX_INTERFACE; ++endPos) + for (endPos = 0U; endPos < USB_HOST_CONFIG_CONFIGURATION_MAX_INTERFACE; ++endPos) { - deviceInstance->interfaceStatus[endPos] = 0; + deviceInstance->interfaceStatus[endPos] = 0U; } /* parse configuration descriptor */ - unionDes = (usb_descriptor_union_t *)deviceInstance->configurationDesc; - endPos = (uint32_t)(deviceInstance->configurationDesc + deviceInstance->configurationLen); + temp = (void *)deviceInstance->configurationDesc; + unionDes = (usb_descriptor_union_t *)temp; + endPos = (uint32_t)(deviceInstance->configurationDesc + deviceInstance->configurationLen); if ((unionDes->common.bLength == USB_DESCRIPTOR_LENGTH_CONFIGURE) && (unionDes->common.bDescriptorType == USB_DESCRIPTOR_TYPE_CONFIGURE)) { /* configuration descriptor */ - deviceInstance->configuration.configurationDesc = (usb_descriptor_configuration_t *)unionDes; + temp = (void *)unionDes; + deviceInstance->configuration.configurationDesc = (usb_descriptor_configuration_t *)temp; deviceInstance->configuration.configurationExtensionLength = 0; - deviceInstance->configuration.configurationExtension = NULL; - deviceInstance->configuration.interfaceCount = 0; + deviceInstance->configuration.configurationExtension = NULL; + deviceInstance->configuration.interfaceCount = 0; unionDes = (usb_descriptor_union_t *)((uint32_t)unionDes + unionDes->common.bLength); while ((uint32_t)unionDes < endPos) { @@ -764,8 +798,8 @@ static usb_status_t USB_HostParseDeviceConfigurationDescriptor(usb_device_handle { deviceInstance->configuration.configurationExtension = (uint8_t *)unionDes; } - if ((unionDes->common.bDescriptorType == 0x00) || - (unionDes->common.bLength == 0x00)) /* the descriptor data is wrong */ + if ((unionDes->common.bDescriptorType == 0x00U) || + (unionDes->common.bLength == 0x00U)) /* the descriptor data is wrong */ { return kStatus_USB_Error; } @@ -779,17 +813,17 @@ static usb_status_t USB_HostParseDeviceConfigurationDescriptor(usb_device_handle } /* interface descriptor */ - deviceInstance->configuration.interfaceCount = 0; + deviceInstance->configuration.interfaceCount = 0U; while ((uint32_t)unionDes < endPos) { if (unionDes->common.bDescriptorType == USB_DESCRIPTOR_TYPE_INTERFACE) { - if (unionDes->interface.bAlternateSetting == 0x00) + if (unionDes->interface.bAlternateSetting == 0x00U) { if (deviceInstance->configuration.interfaceCount >= USB_HOST_CONFIG_CONFIGURATION_MAX_INTERFACE) { -#ifdef HOST_ECHO - usb_echo( +#if (((defined USB_HOST_CONFIG_COMPLIANCE_TEST) && (USB_HOST_CONFIG_COMPLIANCE_TEST)) || defined(HOST_ECHO)) + (void)usb_echo( "Unsupported Device attached\r\n too many interfaces in one configuration, please increase " "the USB_HOST_CONFIG_CONFIGURATION_MAX_INTERFACE value\n"); #endif @@ -798,13 +832,13 @@ static usb_status_t USB_HostParseDeviceConfigurationDescriptor(usb_device_handle interfaceParse = &deviceInstance->configuration.interfaceList[deviceInstance->configuration.interfaceCount]; deviceInstance->configuration.interfaceCount++; - interfaceParse->alternateSettingNumber = 0; - interfaceParse->epCount = 0; - interfaceParse->interfaceDesc = &unionDes->interface; + interfaceParse->alternateSettingNumber = 0; + interfaceParse->epCount = 0; + interfaceParse->interfaceDesc = &unionDes->interface; interfaceParse->interfaceExtensionLength = 0; - interfaceParse->interfaceExtension = NULL; - interfaceParse->interfaceIndex = unionDes->interface.bInterfaceNumber; - if (unionDes->common.bLength == 0x00) /* the descriptor data is wrong */ + interfaceParse->interfaceExtension = NULL; + interfaceParse->interfaceIndex = unionDes->interface.bInterfaceNumber; + if (unionDes->common.bLength == 0x00U) /* the descriptor data is wrong */ { return kStatus_USB_Error; } @@ -818,8 +852,8 @@ static usb_status_t USB_HostParseDeviceConfigurationDescriptor(usb_device_handle { interfaceParse->interfaceExtension = (uint8_t *)unionDes; } - if ((unionDes->common.bDescriptorType == 0x00) || - (unionDes->common.bLength == 0x00)) /* the descriptor data is wrong */ + if ((unionDes->common.bDescriptorType == 0x00U) || + (unionDes->common.bLength == 0x00U)) /* the descriptor data is wrong */ { return kStatus_USB_Error; } @@ -833,7 +867,7 @@ static usb_status_t USB_HostParseDeviceConfigurationDescriptor(usb_device_handle } /* endpoint descriptor */ - if (interfaceParse->interfaceDesc->bNumEndpoints != 0) + if (interfaceParse->interfaceDesc->bNumEndpoints != 0U) { if ((unionDes->common.bDescriptorType != USB_DESCRIPTOR_TYPE_ENDPOINT) || (interfaceParse->interfaceDesc->bNumEndpoints > USB_HOST_CONFIG_INTERFACE_MAX_EP)) @@ -854,11 +888,13 @@ static usb_status_t USB_HostParseDeviceConfigurationDescriptor(usb_device_handle #endif return kStatus_USB_Error; } - epParse = (usb_host_ep_t *)&interfaceParse->epList[interfaceParse->epCount]; - epParse->epDesc = (usb_descriptor_endpoint_t *)unionDes; - epParse->epExtensionLength = 0; - epParse->epExtension = NULL; - if (unionDes->common.bLength == 0x00) /* the descriptor data is wrong */ + temp = (void *)&interfaceParse->epList[interfaceParse->epCount]; + epParse = (usb_host_ep_t *)temp; + temp = (void *)unionDes; + epParse->epDesc = (usb_descriptor_endpoint_t *)temp; + epParse->epExtensionLength = 0U; + epParse->epExtension = NULL; + if (unionDes->common.bLength == 0x00U) /* the descriptor data is wrong */ { return kStatus_USB_Error; } @@ -872,8 +908,8 @@ static usb_status_t USB_HostParseDeviceConfigurationDescriptor(usb_device_handle { epParse->epExtension = (uint8_t *)unionDes; } - if ((unionDes->common.bDescriptorType == 0x00) || - (unionDes->common.bLength == 0x00)) /* the descriptor data is wrong */ + if ((unionDes->common.bDescriptorType == 0x00U) || + (unionDes->common.bLength == 0x00U)) /* the descriptor data is wrong */ { return kStatus_USB_Error; } @@ -900,7 +936,7 @@ static usb_status_t USB_HostParseDeviceConfigurationDescriptor(usb_device_handle { interfaceParse->interfaceExtension = (uint8_t *)unionDes; } - if (unionDes->common.bLength == 0x00) /* the descriptor data is wrong */ + if (unionDes->common.bLength == 0x00U) /* the descriptor data is wrong */ { return kStatus_USB_Error; } @@ -910,8 +946,8 @@ static usb_status_t USB_HostParseDeviceConfigurationDescriptor(usb_device_handle { if (unionDes->common.bDescriptorType != USB_DESCRIPTOR_TYPE_INTERFACE) { - if ((unionDes->common.bDescriptorType == 0x00) || - (unionDes->common.bLength == 0x00)) /* the descriptor data is wrong */ + if ((unionDes->common.bDescriptorType == 0x00U) || + (unionDes->common.bLength == 0x00U)) /* the descriptor data is wrong */ { return kStatus_USB_Error; } @@ -932,9 +968,9 @@ static usb_status_t USB_HostParseDeviceConfigurationDescriptor(usb_device_handle } } - for (endPos = 0; endPos < deviceInstance->configuration.interfaceCount; ++endPos) + for (endPos = 0U; endPos < deviceInstance->configuration.interfaceCount; ++endPos) { - deviceInstance->interfaceStatus[endPos] = kStatus_interface_Attached; + deviceInstance->interfaceStatus[endPos] = (uint8_t)kStatus_interface_Attached; } return kStatus_USB_Success; @@ -988,28 +1024,29 @@ usb_status_t USB_HostAttachDevice(usb_host_handle hostHandle, #endif /* Allocate new device instance */ - newInstance = (usb_host_device_instance_t *)USB_OsaMemoryAllocate(sizeof(usb_host_device_instance_t)); + newInstance = (usb_host_device_instance_t *)OSA_MemoryAllocate(sizeof(usb_host_device_instance_t)); if (newInstance == NULL) { #ifdef HOST_ECHO usb_echo("allocate dev instance fail\r\n"); #endif + (void)USB_HostNotifyDevice(hostInstance, NULL, (uint32_t)kUSB_HostEventEnumerationFail, + (uint32_t)kStatus_USB_AllocFail); return kStatus_USB_AllocFail; } /* new instance fields init */ - newInstance->hostHandle = hostHandle; - newInstance->speed = speed; - newInstance->stallRetries = USB_HOST_CONFIG_ENUMERATION_MAX_STALL_RETRIES; - newInstance->enumRetries = USB_HOST_CONFIG_ENUMERATION_MAX_RETRIES; - newInstance->setAddress = 0; - newInstance->deviceAttachState = kStatus_device_Attached; + newInstance->hostHandle = hostHandle; + newInstance->speed = speed; + newInstance->stallRetries = USB_HOST_CONFIG_ENUMERATION_MAX_STALL_RETRIES; + newInstance->enumRetries = USB_HOST_CONFIG_ENUMERATION_MAX_RETRIES; + newInstance->setAddress = 0; + newInstance->deviceAttachState = (uint8_t)kStatus_device_Attached; #if ((defined(USB_HOST_CONFIG_BUFFER_PROPERTY_CACHEABLE)) && (USB_HOST_CONFIG_BUFFER_PROPERTY_CACHEABLE > 0U)) newInstance->deviceDescriptor = (usb_descriptor_device_t *)SDK_Malloc(sizeof(usb_descriptor_device_t) + 9, USB_CACHE_LINESIZE); #else - newInstance->deviceDescriptor = - (usb_descriptor_device_t *)USB_OsaMemoryAllocate(sizeof(usb_descriptor_device_t) + 9); + newInstance->deviceDescriptor = (usb_descriptor_device_t *)OSA_MemoryAllocate(sizeof(usb_descriptor_device_t) + 9U); #endif if (newInstance->deviceDescriptor == NULL) { @@ -1019,62 +1056,66 @@ usb_status_t USB_HostAttachDevice(usb_host_handle hostHandle, #if ((defined(USB_HOST_CONFIG_BUFFER_PROPERTY_CACHEABLE)) && (USB_HOST_CONFIG_BUFFER_PROPERTY_CACHEABLE > 0U)) SDK_Free(newInstance->deviceDescriptor); #else - USB_OsaMemoryFree(newInstance->deviceDescriptor); + OSA_MemoryFree(newInstance->deviceDescriptor); #endif - USB_OsaMemoryFree(newInstance); + OSA_MemoryFree(newInstance); + (void)USB_HostNotifyDevice(hostInstance, NULL, (uint32_t)kUSB_HostEventEnumerationFail, + (uint32_t)kStatus_USB_AllocFail); return kStatus_USB_AllocFail; } newInstance->enumBuffer = (uint8_t *)((uint8_t *)newInstance->deviceDescriptor + sizeof(usb_descriptor_device_t)); #if ((defined USB_HOST_CONFIG_HUB) && (USB_HOST_CONFIG_HUB)) - newInstance->hubNumber = hubNumber; + newInstance->hubNumber = hubNumber; newInstance->portNumber = portNumber; - newInstance->level = level; + newInstance->level = level; - if ((speed != USB_SPEED_HIGH) && (level > 1)) + if ((speed != USB_SPEED_HIGH) && (level > 1U)) { - newInstance->hsHubNumber = USB_HostHubGetHsHubNumber(hostHandle, hubNumber); - newInstance->hsHubPort = USB_HostHubGetHsHubPort(hostHandle, hubNumber, portNumber); + newInstance->hsHubNumber = (uint8_t)USB_HostHubGetHsHubNumber(hostHandle, hubNumber); + newInstance->hsHubPort = (uint8_t)USB_HostHubGetHsHubPort(hostHandle, hubNumber, portNumber); } else { newInstance->hsHubNumber = hubNumber; - newInstance->hsHubPort = portNumber; + newInstance->hsHubPort = portNumber; } #endif /* USB_HOST_CONFIG_HUB */ - USB_HostLock(); + (void)USB_HostLock(); /* allocate address && insert to the dev list */ address = USB_HostAllocateDeviceAddress(hostInstance); - if (address == 0) + if (address == 0U) { #ifdef HOST_ECHO usb_echo("allocate address fail\r\n"); #endif - USB_HostUnlock(); + (void)USB_HostUnlock(); #if ((defined(USB_HOST_CONFIG_BUFFER_PROPERTY_CACHEABLE)) && (USB_HOST_CONFIG_BUFFER_PROPERTY_CACHEABLE > 0U)) SDK_Free(newInstance->deviceDescriptor); #else - USB_OsaMemoryFree(newInstance->deviceDescriptor); + OSA_MemoryFree(newInstance->deviceDescriptor); #endif - USB_OsaMemoryFree(newInstance); + OSA_MemoryFree(newInstance); + (void)USB_HostNotifyDevice(hostInstance, NULL, (uint32_t)kUSB_HostEventEnumerationFail, + (uint32_t)kStatus_USB_Error); return kStatus_USB_Error; } newInstance->allocatedAddress = address; - newInstance->next = (usb_host_device_instance_t *)hostInstance->deviceList; + newInstance->next = (usb_host_device_instance_t *)hostInstance->deviceList; hostInstance->deviceList = newInstance; - newInstance->state = kStatus_DEV_Initial; - USB_HostUnlock(); + newInstance->state = (uint8_t)kStatus_DEV_Initial; + (void)USB_HostUnlock(); /* open control pipe */ - pipeInit.devInstance = newInstance; - pipeInit.pipeType = USB_ENDPOINT_CONTROL; - pipeInit.direction = 0; + pipeInit.devInstance = newInstance; + pipeInit.pipeType = USB_ENDPOINT_CONTROL; + pipeInit.direction = 0; pipeInit.endpointAddress = 0; - pipeInit.interval = 0; - pipeInit.maxPacketSize = 8; + pipeInit.interval = 0; + pipeInit.maxPacketSize = 8; pipeInit.numberPerUframe = 0; - pipeInit.nakCount = USB_HOST_CONFIG_MAX_NAK; + pipeInit.nakCount = USB_HOST_CONFIG_MAX_NAK; if (USB_HostOpenPipe(hostHandle, &newInstance->controlPipe, &pipeInit) != kStatus_USB_Success) { /* don't need release resource, resource is released when detach */ @@ -1082,15 +1123,22 @@ usb_status_t USB_HostAttachDevice(usb_host_handle hostHandle, #if ((defined(USB_HOST_CONFIG_BUFFER_PROPERTY_CACHEABLE)) && (USB_HOST_CONFIG_BUFFER_PROPERTY_CACHEABLE > 0U)) SDK_Free(newInstance->deviceDescriptor); #else - USB_OsaMemoryFree(newInstance->deviceDescriptor); + OSA_MemoryFree(newInstance->deviceDescriptor); #endif - USB_OsaMemoryFree(newInstance); + OSA_MemoryFree(newInstance); + (void)USB_HostNotifyDevice(hostInstance, NULL, (uint32_t)kUSB_HostEventEnumerationFail, + (uint32_t)kStatus_USB_Error); return kStatus_USB_Error; } /* start enumeration */ - newInstance->state = kStatus_DEV_GetDes8; - USB_HostProcessState(newInstance); /* process enumeration state machine */ + newInstance->state = (uint8_t)kStatus_DEV_GetDes8; + /* process enumeration state machine */ + if (USB_HostProcessState(newInstance) != kStatus_USB_Success) + { + (void)USB_HostNotifyDevice(hostInstance, newInstance, (uint32_t)kUSB_HostEventEnumerationFail, + (uint32_t)kStatus_USB_Error); + } *deviceHandle = newInstance; return kStatus_USB_Success; @@ -1106,7 +1154,7 @@ usb_status_t USB_HostDetachDevice(usb_host_handle hostHandle, uint8_t hubNumber, return kStatus_USB_InvalidHandle; } - USB_HostLock(); + (void)USB_HostLock(); /* search for device instance handle */ #if ((defined USB_HOST_CONFIG_HUB) && (USB_HOST_CONFIG_HUB)) deviceInstance = (usb_host_device_instance_t *)hostInstance->deviceList; @@ -1121,7 +1169,7 @@ usb_status_t USB_HostDetachDevice(usb_host_handle hostHandle, uint8_t hubNumber, #else deviceInstance = (usb_host_device_instance_t *)hostInstance->deviceList; #endif - USB_HostUnlock(); + (void)USB_HostUnlock(); if (deviceInstance != NULL) { return USB_HostDetachDeviceInternal(hostHandle, deviceInstance); /* device instance detach */ @@ -1132,31 +1180,33 @@ usb_status_t USB_HostDetachDevice(usb_host_handle hostHandle, uint8_t hubNumber, usb_status_t USB_HostDetachDeviceInternal(usb_host_handle hostHandle, usb_device_handle deviceHandle) { usb_host_device_instance_t *deviceInstance = (usb_host_device_instance_t *)deviceHandle; - usb_host_instance_t *hostInstance = (usb_host_instance_t *)hostHandle; + usb_host_instance_t *hostInstance = (usb_host_instance_t *)hostHandle; if ((hostHandle == NULL) || (deviceHandle == NULL)) { return kStatus_USB_InvalidHandle; } - deviceInstance->deviceAttachState = kStatus_device_Detached; /* mark the device is detached from host */ + deviceInstance->deviceAttachState = (uint8_t)kStatus_device_Detached; /* mark the device is detached from host */ - if (deviceInstance->state >= kStatus_DEV_Initial) /* device instance is valid */ + if (deviceInstance->state >= (uint8_t)kStatus_DEV_Initial) /* device instance is valid */ { /* detach internally */ - if (deviceInstance->state < kStatus_DEV_AppUsed) /* enumeration is not done */ + if (deviceInstance->state < (uint8_t)kStatus_DEV_AppUsed) /* enumeration is not done */ { if (deviceInstance->controlPipe != NULL) { - USB_HostCancelTransfer(hostInstance, deviceInstance->controlPipe, NULL); + (void)USB_HostCancelTransfer(hostInstance, deviceInstance->controlPipe, NULL); } /* remove device instance from host */ - USB_HostRemoveDeviceInstance(hostInstance, deviceInstance); + (void)USB_HostRemoveDeviceInstance(hostInstance, deviceInstance); USB_HostReleaseDeviceResource(hostInstance, deviceInstance); } - else /* enumeration has be done and notifed application */ + else /* enumeration has be done and notified application */ { - USB_HostNotifyDevice(deviceInstance, kUSB_HostEventDetach); /* notify application device detach */ + /* notify application device detach */ + (void)USB_HostNotifyDevice(hostInstance, deviceInstance, (uint32_t)kUSB_HostEventDetach, + (uint32_t)kStatus_USB_Success); } } @@ -1165,7 +1215,7 @@ usb_status_t USB_HostDetachDeviceInternal(usb_host_handle hostHandle, usb_device uint8_t USB_HostGetDeviceAttachState(usb_device_handle deviceHandle) { - return deviceHandle ? ((usb_host_device_instance_t *)deviceHandle)->deviceAttachState : 0x0; + return (NULL != deviceHandle) ? ((usb_host_device_instance_t *)deviceHandle)->deviceAttachState : 0x0U; } usb_status_t USB_HostValidateDevice(usb_host_handle hostHandle, usb_device_handle deviceHandle) @@ -1183,7 +1233,7 @@ usb_status_t USB_HostValidateDevice(usb_host_handle hostHandle, usb_device_handl searchDev = searchDev->next; } - if (searchDev) + if (NULL != searchDev) { return kStatus_USB_Success; } @@ -1192,14 +1242,14 @@ usb_status_t USB_HostValidateDevice(usb_host_handle hostHandle, usb_device_handl static usb_status_t USB_HostControlBus(usb_host_handle hostHandle, uint8_t controlType) { - usb_status_t status = kStatus_USB_Success; + usb_status_t status = kStatus_USB_Success; usb_host_instance_t *hostInstance = (usb_host_instance_t *)hostHandle; if (hostHandle == NULL) { return kStatus_USB_InvalidHandle; } - + /* the callbackFn is initialized in USB_HostGetControllerInterface */ status = hostInstance->controllerTable->controllerIoctl(hostInstance->controllerHandle, kUSB_HostBusControl, &controlType); @@ -1209,7 +1259,7 @@ static usb_status_t USB_HostControlBus(usb_host_handle hostHandle, uint8_t contr usb_status_t USB_HostOpenDeviceInterface(usb_device_handle deviceHandle, usb_host_interface_handle interfaceHandle) { usb_host_device_instance_t *deviceInstance = (usb_host_device_instance_t *)deviceHandle; - usb_host_instance_t *hostInstance = NULL; + usb_host_instance_t *hostInstance = NULL; uint8_t interfaceIndex; uint8_t index = 0; @@ -1219,11 +1269,11 @@ usb_status_t USB_HostOpenDeviceInterface(usb_device_handle deviceHandle, usb_hos } hostInstance = (usb_host_instance_t *)deviceInstance->hostHandle; - USB_HostLock(); + (void)USB_HostLock(); /* check host_instance valid? */ for (; index < USB_HOST_CONFIG_MAX_HOST; ++index) { - if ((g_UsbHostInstance[index].occupied == 1) && + if ((g_UsbHostInstance[index].occupied == 1U) && ((usb_host_instance_t *)(&g_UsbHostInstance[index]) == (hostInstance))) { break; @@ -1231,14 +1281,14 @@ usb_status_t USB_HostOpenDeviceInterface(usb_device_handle deviceHandle, usb_hos } if (index >= USB_HOST_CONFIG_MAX_HOST) { - USB_HostUnlock(); + (void)USB_HostUnlock(); return kStatus_USB_Error; } /* check deviceHandle valid? */ if (USB_HostValidateDevice(hostInstance, deviceHandle) != kStatus_USB_Success) { - USB_HostUnlock(); + (void)USB_HostUnlock(); return kStatus_USB_Error; } @@ -1247,11 +1297,11 @@ usb_status_t USB_HostOpenDeviceInterface(usb_device_handle deviceHandle, usb_hos { if (&deviceInstance->configuration.interfaceList[interfaceIndex] == interfaceHandle) { - deviceInstance->interfaceStatus[interfaceIndex] = kStatus_interface_Opened; + deviceInstance->interfaceStatus[interfaceIndex] = (uint8_t)kStatus_interface_Opened; break; } } - USB_HostUnlock(); + (void)USB_HostUnlock(); return kStatus_USB_Success; } @@ -1259,10 +1309,10 @@ usb_status_t USB_HostOpenDeviceInterface(usb_device_handle deviceHandle, usb_hos usb_status_t USB_HostCloseDeviceInterface(usb_device_handle deviceHandle, usb_host_interface_handle interfaceHandle) { usb_host_device_instance_t *deviceInstance = (usb_host_device_instance_t *)deviceHandle; - usb_host_instance_t *hostInstance = NULL; + usb_host_instance_t *hostInstance = NULL; uint8_t interfaceIndex; uint8_t removeLabel = 1; - uint8_t index = 0; + uint8_t index = 0; if (deviceHandle == NULL) { @@ -1270,11 +1320,11 @@ usb_status_t USB_HostCloseDeviceInterface(usb_device_handle deviceHandle, usb_ho } hostInstance = (usb_host_instance_t *)deviceInstance->hostHandle; - USB_HostLock(); + (void)USB_HostLock(); /* check host_instance valid? */ for (; index < USB_HOST_CONFIG_MAX_HOST; ++index) { - if ((g_UsbHostInstance[index].occupied == 1) && + if ((g_UsbHostInstance[index].occupied == 1U) && ((usb_host_instance_t *)(&g_UsbHostInstance[index]) == (hostInstance))) { break; @@ -1282,14 +1332,14 @@ usb_status_t USB_HostCloseDeviceInterface(usb_device_handle deviceHandle, usb_ho } if (index >= USB_HOST_CONFIG_MAX_HOST) { - USB_HostUnlock(); + (void)USB_HostUnlock(); return kStatus_USB_Error; } /* check deviceHandle valid? */ if (USB_HostValidateDevice(hostInstance, deviceHandle) != kStatus_USB_Success) { - USB_HostUnlock(); + (void)USB_HostUnlock(); return kStatus_USB_Error; } @@ -1300,32 +1350,32 @@ usb_status_t USB_HostCloseDeviceInterface(usb_device_handle deviceHandle, usb_ho { if (&deviceInstance->configuration.interfaceList[interfaceIndex] == interfaceHandle) { - deviceInstance->interfaceStatus[interfaceIndex] = kStatus_interface_Detached; + deviceInstance->interfaceStatus[interfaceIndex] = (uint8_t)kStatus_interface_Detached; break; } } } - if (deviceInstance->deviceAttachState == kStatus_device_Detached) /* device is removed from host */ + if (deviceInstance->deviceAttachState == (uint8_t)kStatus_device_Detached) /* device is removed from host */ { removeLabel = 1; /* check all the interfaces of the device are not opened */ for (interfaceIndex = 0; interfaceIndex < deviceInstance->configuration.interfaceCount; ++interfaceIndex) { - if (deviceInstance->interfaceStatus[interfaceIndex] == kStatus_interface_Opened) + if (deviceInstance->interfaceStatus[interfaceIndex] == (uint8_t)kStatus_interface_Opened) { - removeLabel = 0; + removeLabel = 0U; break; } } - if (removeLabel == 1) + if (removeLabel == 1U) { /* remove device instance from host */ - USB_HostRemoveDeviceInstance(hostInstance, deviceInstance); + (void)USB_HostRemoveDeviceInstance(hostInstance, deviceInstance); } - USB_HostUnlock(); + (void)USB_HostUnlock(); - if (removeLabel == 1) + if (removeLabel == 1U) { USB_HostReleaseDeviceResource((usb_host_instance_t *)deviceInstance->hostHandle, deviceInstance); /* release device resource */ @@ -1333,7 +1383,7 @@ usb_status_t USB_HostCloseDeviceInterface(usb_device_handle deviceHandle, usb_ho } else { - USB_HostUnlock(); + (void)USB_HostUnlock(); } return kStatus_USB_Success; @@ -1341,9 +1391,9 @@ usb_status_t USB_HostCloseDeviceInterface(usb_device_handle deviceHandle, usb_ho usb_status_t USB_HostRemoveDevice(usb_host_handle hostHandle, usb_device_handle deviceHandle) { - usb_host_instance_t *hostInstance = (usb_host_instance_t *)hostHandle; + usb_host_instance_t *hostInstance = (usb_host_instance_t *)hostHandle; usb_host_device_instance_t *deviceInstance = (usb_host_device_instance_t *)deviceHandle; - uint8_t interfaceIndex = 0; + uint8_t interfaceIndex = 0; #if ((defined USB_HOST_CONFIG_HUB) && (USB_HOST_CONFIG_HUB)) uint8_t level = 0; uint8_t devHubNo; @@ -1362,25 +1412,26 @@ usb_status_t USB_HostRemoveDevice(usb_host_handle hostHandle, usb_device_handle if (USB_HostValidateDevice(hostInstance, deviceInstance) == kStatus_USB_Success) /* device is valid */ { #if ((defined USB_HOST_CONFIG_HUB) && (USB_HOST_CONFIG_HUB)) - devHubNo = deviceInstance->hubNumber; + devHubNo = deviceInstance->hubNumber; devPortNo = deviceInstance->portNumber; - level = deviceInstance->level; + level = deviceInstance->level; #endif - deviceInstance->deviceAttachState = kStatus_device_Detached; - if (deviceInstance->state >= kStatus_DEV_Initial) /* device is valid */ + deviceInstance->deviceAttachState = (uint8_t)kStatus_device_Detached; + if (deviceInstance->state >= (uint8_t)kStatus_DEV_Initial) /* device is valid */ { - if (deviceInstance->state < kStatus_DEV_AppUsed) /* enumeraion is not done or application don't use */ + if (deviceInstance->state < + (uint8_t)kStatus_DEV_AppUsed) /* enumeration is not done or application don't use */ { /* detach internally */ - USB_HostDetachDeviceInternal(hostHandle, deviceHandle); + (void)USB_HostDetachDeviceInternal(hostHandle, deviceHandle); } else /* application use the device */ { - for (interfaceIndex = 0; interfaceIndex < deviceInstance->configuration.interfaceCount; + for (interfaceIndex = 0U; interfaceIndex < deviceInstance->configuration.interfaceCount; ++interfaceIndex) { - if (deviceInstance->interfaceStatus[interfaceIndex] == kStatus_interface_Opened) + if (deviceInstance->interfaceStatus[interfaceIndex] == (uint8_t)kStatus_interface_Opened) { #ifdef HOST_ECHO usb_echo("error: there is class instance that is not deinited\r\n"); @@ -1389,20 +1440,20 @@ usb_status_t USB_HostRemoveDevice(usb_host_handle hostHandle, usb_device_handle } } /* remove device instance from host */ - USB_HostRemoveDeviceInstance(hostInstance, deviceInstance); + (void)USB_HostRemoveDeviceInstance(hostInstance, deviceInstance); USB_HostReleaseDeviceResource(hostInstance, deviceInstance); /* release resource */ } } #if ((defined USB_HOST_CONFIG_HUB) && (USB_HOST_CONFIG_HUB)) - if (level == 1) + if (level == 1U) { - USB_HostControlBus(hostHandle, kUSB_HostBusReset); /* reset controller port */ - USB_HostControlBus(hostHandle, kUSB_HostBusRestart); /* restart controller port */ + (void)USB_HostControlBus(hostHandle, (uint8_t)kUSB_HostBusReset); /* reset controller port */ + (void)USB_HostControlBus(hostHandle, (uint8_t)kUSB_HostBusRestart); /* restart controller port */ } else { - USB_HostHubRemovePort(hostHandle, devHubNo, devPortNo); /* reset hub port */ + (void)USB_HostHubRemovePort(hostHandle, devHubNo, devPortNo); /* reset hub port */ } #else USB_HostControlBus(hostHandle, kUSB_HostBusReset); /* reset controller port */ diff --git a/bsp/imxrt/libraries/drivers/usb/host/usb_host_devices.h b/bsp/imxrt/libraries/drivers/usb/host/usb_host_devices.h index 422e876a12..84d5497c9f 100644 --- a/bsp/imxrt/libraries/drivers/usb/host/usb_host_devices.h +++ b/bsp/imxrt/libraries/drivers/usb/host/usb_host_devices.h @@ -1,31 +1,9 @@ /* * Copyright (c) 2015, Freescale Semiconductor, Inc. * Copyright 2016 NXP + * All rights reserved. * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * o Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * o Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * o Neither the name of the copyright holder nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ #ifndef _USB_HOST_DEV_MNG_H_ @@ -79,11 +57,11 @@ typedef struct _usb_host_device_instance usb_descriptor_device_t *deviceDescriptor; /*!< Standard device descriptor */ usb_host_pipe_handle controlPipe; /*!< Device's control pipe */ uint8_t *configurationDesc; /*!< Configuration descriptor pointer */ + uint8_t *enumBuffer; /*!< Buffer for enumeration */ uint16_t configurationLen; /*!< Configuration descriptor length */ - uint16_t configurationValue; /*!< Configuration index */ uint8_t interfaceStatus[USB_HOST_CONFIG_CONFIGURATION_MAX_INTERFACE]; /*!< Interfaces' status, please reference to #usb_host_interface_state_t */ - uint8_t *enumBuffer; /*!< Buffer for enumeration */ + uint8_t configurationValue; /*!< Configuration index */ uint8_t state; /*!< Device state for enumeration */ uint8_t enumRetries; /*!< Re-enumeration when error in control transfer */ uint8_t stallRetries; /*!< Re-transfer when stall */ @@ -104,11 +82,10 @@ typedef struct _usb_host_device_instance typedef struct _usb_host_enum_process_entry { - uint8_t successState; /*!< When the last step is successful, the next state value */ - uint8_t retryState; /*!< When the last step need retry, the next state value */ - usb_status_t (*process)(usb_host_device_instance_t *deviceInstance); /*!< When the last step transfer is done, the - function is used to process the transfer - data */ + usb_host_device_enumeration_status_t successState; /*!< When the last step is successful, the next state value */ + usb_host_device_enumeration_status_t retryState; /*!< When the last step need retry, the next state value */ + /*! When the last step transfer is done, the function is used to process the transfer data */ + usb_status_t (*process)(usb_host_device_instance_t *deviceInstance, uint32_t dataLength); } usb_host_enum_process_entry_t; /******************************************************************************* diff --git a/bsp/imxrt/libraries/drivers/usb/host/usb_host_ehci.c b/bsp/imxrt/libraries/drivers/usb/host/usb_host_ehci.c index 8a31514b3a..ffabb047fa 100644 --- a/bsp/imxrt/libraries/drivers/usb/host/usb_host_ehci.c +++ b/bsp/imxrt/libraries/drivers/usb/host/usb_host_ehci.c @@ -1,41 +1,23 @@ /* * Copyright (c) 2015 - 2016, Freescale Semiconductor, Inc. - * Copyright 2016 NXP + * Copyright 2016,2019 - 2020 NXP + * All rights reserved. * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * o Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * o Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * o Neither the name of the copyright holder nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ -#include +#include "fsl_os_abstraction.h" +#include #if ((defined USB_HOST_CONFIG_EHCI) && (USB_HOST_CONFIG_EHCI > 0U)) #include "usb_host.h" #include "usb_host_hci.h" #include "usb_host_devices.h" +#if ((defined USB_HOST_CONFIG_COMPLIANCE_TEST) && (USB_HOST_CONFIG_COMPLIANCE_TEST)) +#include "usb_host_framework.h" +#endif #include "fsl_device_registers.h" #include "usb_host_ehci.h" -#include "usb_phy.h" +#include #if ((defined USB_HOST_CONFIG_COMPLIANCE_TEST) && (USB_HOST_CONFIG_COMPLIANCE_TEST)) #include "usb_host.h" #endif @@ -44,22 +26,24 @@ * Definitions ******************************************************************************/ +#define USB_OSA_WAIT_TIMEOUT RT_WAITING_FOREVER + #if defined(USB_STACK_USE_DEDICATED_RAM) && (USB_STACK_USE_DEDICATED_RAM > 0U) #error The SOC does not suppoort dedicated RAM case. #endif -#define USB_HOST_EHCI_BANDWIDTH_DELAY (3500U) -#define USB_HOST_EHCI_BANDWIDTH_HUB_LS_SETUP (333U) +#define USB_HOST_EHCI_BANDWIDTH_DELAY (3500U) +#define USB_HOST_EHCI_BANDWIDTH_HUB_LS_SETUP (333U) #define USB_HOST_EHCI_BANDWIDTH_FRAME_TOTOAL_TIME (900U) #if ((defined USB_HOST_CONFIG_COMPLIANCE_TEST) && (USB_HOST_CONFIG_COMPLIANCE_TEST)) -#define USB_HOST_EHCI_TEST_DESCRIPTOR_LENGTH (18U) -#define USB_HOST_EHCI_PORTSC_PTC_J_STATE (0x01U) -#define USB_HOST_EHCI_PORTSC_PTC_K_STATE (0x02U) -#define USB_HOST_EHCI_PORTSC_PTC_SE0_NAK (0x03U) -#define USB_HOST_EHCI_PORTSC_PTC_PACKET (0x04U) +#define USB_HOST_EHCI_TEST_DESCRIPTOR_LENGTH (18U) +#define USB_HOST_EHCI_PORTSC_PTC_J_STATE (0x01U) +#define USB_HOST_EHCI_PORTSC_PTC_K_STATE (0x02U) +#define USB_HOST_EHCI_PORTSC_PTC_SE0_NAK (0x03U) +#define USB_HOST_EHCI_PORTSC_PTC_PACKET (0x04U) #define USB_HOST_EHCI_PORTSC_PTC_FORCE_ENABLE_HS (0x05U) #define USB_HOST_EHCI_PORTSC_PTC_FORCE_ENABLE_FS (0x06U) #define USB_HOST_EHCI_PORTSC_PTC_FORCE_ENABLE_LS (0x07U) @@ -102,7 +86,7 @@ static void USB_HostBandwidthFslsHostComputeCurrent(usb_host_ehci_instance_t *eh static void USB_HostBandwidthHsHostComputeCurrentFsls(usb_host_ehci_instance_t *ehciInstance, uint32_t hubNumber, uint16_t frameIndex, - uint8_t frameBandwidths[8]); + uint16_t frameBandwidths[8]); /*! * @brief compute current allocated HS bandwidth when ehci work as hi-speed host. @@ -113,7 +97,7 @@ static void USB_HostBandwidthHsHostComputeCurrentFsls(usb_host_ehci_instance_t * */ static void USB_HostBandwidthHsHostComputeCurrentHsAll(usb_host_ehci_instance_t *ehciInstance, uint16_t frameIndex, - uint8_t frameBandwidths[8]); + uint16_t frameBandwidths[8]); /*! * @brief allocate HS bandwidth when host work as high-speed host. @@ -586,71 +570,60 @@ extern usb_status_t USB_HostStandardSetGetDescriptor(usb_host_device_instance_t USB_RAM_ADDRESS_ALIGNMENT(4096) USB_CONTROLLER_DATA static uint8_t s_UsbHostEhciFrameList1[USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE * 4]; -#define USB_HOST_EHCI_FRAME_LIST_ARRAY \ - { \ - &s_UsbHostEhciFrameList1[0] \ - } +static uint8_t usbHostEhciFramListStatus[1] = {0}; USB_RAM_ADDRESS_ALIGNMENT(64) USB_CONTROLLER_DATA static usb_host_ehci_data_t s_UsbHostEhciData1; -#define USB_HOST_EHCI_DATA_ARRAY \ - { \ - &s_UsbHostEhciData1 \ - } -#elif(USB_HOST_CONFIG_EHCI == 2U) +#elif (USB_HOST_CONFIG_EHCI == 2U) USB_RAM_ADDRESS_ALIGNMENT(4096) USB_CONTROLLER_DATA static uint8_t s_UsbHostEhciFrameList1[USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE * 4]; USB_RAM_ADDRESS_ALIGNMENT(4096) USB_CONTROLLER_DATA static uint8_t s_UsbHostEhciFrameList2[USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE * 4]; -#define USB_HOST_EHCI_FRAME_LIST_ARRAY \ - { \ - &s_UsbHostEhciFrameList1[0], &s_UsbHostEhciFrameList2[0] \ - } +static uint8_t usbHostEhciFramListStatus[2] = {0, 0}; USB_RAM_ADDRESS_ALIGNMENT(64) USB_CONTROLLER_DATA static usb_host_ehci_data_t s_UsbHostEhciData1; USB_RAM_ADDRESS_ALIGNMENT(64) USB_CONTROLLER_DATA static usb_host_ehci_data_t s_UsbHostEhciData2; -#define USB_HOST_EHCI_DATA_ARRAY \ - { \ - &s_UsbHostEhciData1, &s_UsbHostEhciData2 \ - } #else #error "Please increase the instance count." #endif +#define USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE (1024U) +#define USB_HOST_EHCI_MAX_MICRFRAME_VALUE ((USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE << 3U) - 1U) -static uint8_t s_SlotMaxBandwidth[8] = {125, 125, 125, 125, 125, 125, 50, 0}; +static uint8_t s_SlotMaxBandwidth[8] = {125, 125, 125, 125, 125, 125, 50, 0}; +static uint8_t s_SlotMaxBandwidthHs[8] = {100, 100, 100, 100, 100, 100, 100, 100}; /******************************************************************************* * Code ******************************************************************************/ /*! -* @brief EHCI NC get USB NC bass address. -* -* This function is used to get USB NC bass address. -* -* @param[in] controllerId EHCI controller ID; See the #usb_controller_index_t. -* -* @retval USB NC bass address. -*/ + * @brief EHCI NC get USB NC bass address. + * + * This function is used to get USB NC bass address. + * + * @param[in] controllerId EHCI controller ID; See the #usb_controller_index_t. + * + * @retval USB NC bass address. + */ #if (defined(USB_HOST_CONFIG_LOW_POWER_MODE) && (USB_HOST_CONFIG_LOW_POWER_MODE > 0U)) #if (defined(FSL_FEATURE_SOC_USBNC_COUNT) && (FSL_FEATURE_SOC_USBNC_COUNT > 0U)) -void *USB_EhciNCGetBase(uint8_t controllerId) +static void *USB_EhciNCGetBase(uint8_t controllerId) { void *usbNCBase = NULL; #if ((defined FSL_FEATURE_SOC_USBNC_COUNT) && (FSL_FEATURE_SOC_USBNC_COUNT > 0U)) uint32_t instance; - uint32_t newinstance = 0; + uint32_t newinstance = 0; uint32_t usbnc_base_temp[] = USBNC_BASE_ADDRS; - uint32_t usbnc_base[] = USBNC_BASE_ADDRS; + uint32_t usbnc_base[] = USBNC_BASE_ADDRS; - if (controllerId < kUSB_ControllerEhci0) + if (controllerId < (uint8_t)kUSB_ControllerEhci0) { return NULL; } - controllerId = controllerId - kUSB_ControllerEhci0; + controllerId = controllerId - (uint8_t)kUSB_ControllerEhci0; for (instance = 0; instance < (sizeof(usbnc_base_temp) / sizeof(usbnc_base_temp[0])); instance++) { - if (usbnc_base_temp[instance]) + if (usbnc_base_temp[instance] != 0U) { usbnc_base[newinstance++] = usbnc_base_temp[instance]; } @@ -660,7 +633,7 @@ void *USB_EhciNCGetBase(uint8_t controllerId) return NULL; } - usbNCBase = (void *)usbnc_base[controllerId]; + usbNCBase = (void *)(uint8_t *)usbnc_base[controllerId]; #endif return usbNCBase; } @@ -729,19 +702,19 @@ static void USB_HostEhciTestSingleStepGetDeviceDesc(usb_host_ehci_instance_t *eh return; } - getDescriptorParam.descriptorLength = sizeof(usb_descriptor_device_t); - getDescriptorParam.descriptorLength = 18; - getDescriptorParam.descriptorBuffer = (uint8_t *)&deviceInstance->deviceDescriptor; - getDescriptorParam.descriptorType = USB_DESCRIPTOR_TYPE_DEVICE; - getDescriptorParam.descriptorIndex = 0; - getDescriptorParam.languageId = 0; - transfer->callbackFn = USB_HostEhciTestCallback; - transfer->callbackParam = ehciInstance->hostHandle; + getDescriptorParam.descriptorLength = sizeof(usb_descriptor_device_t); + getDescriptorParam.descriptorLength = 18; + getDescriptorParam.descriptorBuffer = (uint8_t *)&deviceInstance->deviceDescriptor; + getDescriptorParam.descriptorType = USB_DESCRIPTOR_TYPE_DEVICE; + getDescriptorParam.descriptorIndex = 0; + getDescriptorParam.languageId = 0; + transfer->callbackFn = USB_HostEhciTestCallback; + transfer->callbackParam = ehciInstance->hostHandle; transfer->setupPacket->bmRequestType = USB_REQUEST_TYPE_DIR_IN; - transfer->setupPacket->bRequest = USB_REQUEST_STANDARD_GET_DESCRIPTOR; - transfer->setupPacket->wIndex = 0; - transfer->setupPacket->wLength = 0; - transfer->setupPacket->wValue = 0; + transfer->setupPacket->bRequest = USB_REQUEST_STANDARD_GET_DESCRIPTOR; + transfer->setupPacket->wIndex = 0; + transfer->setupPacket->wLength = 0; + transfer->setupPacket->wValue = 0; USB_HostStandardSetGetDescriptor(deviceInstance, transfer, &getDescriptorParam); } @@ -774,8 +747,8 @@ static usb_status_t USB_HostEhciSingleStepQtdListInit(usb_host_ehci_instance_t * { qtdPointer->nextQtdPointer = (uint32_t)ehciInstance->ehciQtdHead; } - qtdPointer = ehciInstance->ehciQtdHead; - ehciInstance->ehciQtdHead = (usb_host_ehci_qtd_t *)qtdPointer->nextQtdPointer; + qtdPointer = ehciInstance->ehciQtdHead; + ehciInstance->ehciQtdHead = (usb_host_ehci_qtd_t *)qtdPointer->nextQtdPointer; qtdPointer->nextQtdPointer = 0; } while (--qtdNumber); } @@ -795,7 +768,7 @@ static usb_status_t USB_HostEhciSingleStepQtdListInit(usb_host_ehci_instance_t * qtdPointer->transferResults[0] = ((0x00000000 << EHCI_HOST_QTD_DT_SHIFT) | (8 << EHCI_HOST_QTD_TOTAL_BYTES_SHIFT) | (EHCI_HOST_PID_SETUP << EHCI_HOST_QTD_PID_CODE_SHIFT) | (EHCI_HOST_QTD_STATUS_ACTIVE_MASK)); - dataAddress = (uint32_t)(transfer->setupPacket); + dataAddress = (uint32_t)(transfer->setupPacket); qtdPointer->transferResults[1] = dataAddress; /* current offset is set too */ /* set buffer pointer no matter data length */ for (index = 0; index < 4; ++index) @@ -816,7 +789,7 @@ static usb_status_t USB_HostEhciSingleStepQtdListInit(usb_host_ehci_instance_t * ((0x00000001U << EHCI_HOST_QTD_DT_SHIFT) | (dataLength << EHCI_HOST_QTD_TOTAL_BYTES_SHIFT) | (EHCI_HOST_PID_IN << EHCI_HOST_QTD_PID_CODE_SHIFT) | (EHCI_HOST_QTD_STATUS_ACTIVE_MASK)); - dataAddress = (uint32_t)(transfer->transferBuffer); + dataAddress = (uint32_t)(transfer->transferBuffer); qtdPointer->transferResults[1] = dataAddress; /* current offset is set too */ /* set buffer pointer no matter data length */ for (index = 0; index < 4; ++index) @@ -848,24 +821,24 @@ static usb_status_t USB_HostEhciSingleStepQtdListInit(usb_host_ehci_instance_t * transfer->next = NULL; if (vltQhPointer->ehciTransferHead == NULL) { - transfer->next = NULL; + transfer->next = NULL; vltQhPointer->ehciTransferHead = vltQhPointer->ehciTransferTail = transfer; } else { - transfer->next = NULL; + transfer->next = NULL; vltQhPointer->ehciTransferTail->next = transfer; - vltQhPointer->ehciTransferTail = transfer; + vltQhPointer->ehciTransferTail = transfer; } USB_HostEhciLock(); /* link qtd to qh (link to end) */ entryPointer = &(vltQhPointer->nextQtdPointer); - dataAddress = *entryPointer; /* dataAddress variable means entry value here */ + dataAddress = *entryPointer; /* dataAddress variable means entry value here */ while ((dataAddress) && (!(dataAddress & EHCI_HOST_T_INVALID_VALUE))) { entryPointer = (volatile uint32_t *)dataAddress; - dataAddress = *entryPointer; + dataAddress = *entryPointer; } *entryPointer = (uint32_t)qtdPointer; USB_HostEhciUnlock(); @@ -888,11 +861,11 @@ static void USB_HostEhciTestSingleStepGetDeviceDescData(usb_host_ehci_instance_t { return; } - transfer->callbackFn = USB_HostEhciTestCallback; - transfer->callbackParam = ehciInstance->hostHandle; + transfer->callbackFn = USB_HostEhciTestCallback; + transfer->callbackParam = ehciInstance->hostHandle; transfer->setupPacket->bmRequestType = USB_REQUEST_TYPE_DIR_IN; - transfer->setupPacket->bRequest = USB_REQUEST_STANDARD_GET_DESCRIPTOR; - transfer->setupPacket->wLength = USB_SHORT_TO_LITTLE_ENDIAN(USB_HOST_EHCI_TEST_DESCRIPTOR_LENGTH); + transfer->setupPacket->bRequest = USB_REQUEST_STANDARD_GET_DESCRIPTOR; + transfer->setupPacket->wLength = USB_SHORT_TO_LITTLE_ENDIAN(USB_HOST_EHCI_TEST_DESCRIPTOR_LENGTH); transfer->setupPacket->wValue = USB_SHORT_TO_LITTLE_ENDIAN((uint16_t)((uint16_t)USB_DESCRIPTOR_TYPE_DEVICE << 8)); transfer->setupPacket->wIndex = 0; USB_HostEhciSingleStepQtdListInit(ehciInstance, (usb_host_ehci_pipe_t *)(deviceInstance->controlPipe), transfer, 1); @@ -907,8 +880,8 @@ static void USB_HostEhciTestSingleStepGetDeviceDescData(usb_host_ehci_instance_t { return; } - transfer->callbackFn = USB_HostEhciTestCallback; - transfer->callbackParam = ehciInstance->hostHandle; + transfer->callbackFn = USB_HostEhciTestCallback; + transfer->callbackParam = ehciInstance->hostHandle; transfer->transferBuffer = buffer; transfer->transferLength = USB_HOST_EHCI_TEST_DESCRIPTOR_LENGTH; USB_HostEhciSingleStepQtdListInit(ehciInstance, (usb_host_ehci_pipe_t *)(deviceInstance->controlPipe), transfer, 2); @@ -917,8 +890,8 @@ static void USB_HostEhciTestSingleStepGetDeviceDescData(usb_host_ehci_instance_t { return; } - transfer->callbackFn = USB_HostEhciTestCallback; - transfer->callbackParam = ehciInstance->hostHandle; + transfer->callbackFn = USB_HostEhciTestCallback; + transfer->callbackParam = ehciInstance->hostHandle; transfer->transferBuffer = NULL; transfer->transferLength = 0; USB_HostEhciSingleStepQtdListInit(ehciInstance, (usb_host_ehci_pipe_t *)(deviceInstance->controlPipe), transfer, 3); @@ -934,7 +907,7 @@ static void USB_HostEhciTestSingleStepGetDeviceDescData(usb_host_ehci_instance_t return; } -void USB_HostEhciTestModeInit(usb_device_handle deviceHandle) +static void USB_HostEhciTestModeInit(usb_device_handle deviceHandle) { uint32_t productId; usb_host_device_instance_t *deviceInstance = (usb_host_device_instance_t *)deviceHandle; @@ -975,6 +948,7 @@ void USB_HostEhciTestModeInit(usb_device_handle deviceHandle) USB_HostEhciTestSingleStepGetDeviceDescData(ehciInstance, deviceHandle); break; default: + /*no action */ break; } @@ -1014,60 +988,62 @@ static void USB_HostEhciResumeBus(usb_host_ehci_instance_t *ehciInstance) static uint32_t USB_HostBandwidthComputeTime(uint8_t speed, uint8_t pipeType, uint8_t direction, uint32_t dataLength) { - uint32_t result = (3167 + ((1000 * dataLength) * 7U * 8U / 6U)) / 1000; + uint32_t result = (3167U + ((1000U * dataLength) * 7U * 8U / 6U)) / 1000U; if (pipeType == USB_ENDPOINT_ISOCHRONOUS) /* iso */ { if (speed == USB_SPEED_HIGH) { - result = 38 * 8 * 2083 + 2083 * result + USB_HOST_EHCI_BANDWIDTH_DELAY; + result = 38U * 8U * 2083U + 2083U * result + USB_HOST_EHCI_BANDWIDTH_DELAY; } else if (speed == USB_SPEED_FULL) { if (direction == USB_IN) { - result = 7268000 + 83540 * result + USB_HOST_EHCI_BANDWIDTH_DELAY; + result = 7268000U + 83540U * result + USB_HOST_EHCI_BANDWIDTH_DELAY; } else { - result = 6265000 + 83540 * result + USB_HOST_EHCI_BANDWIDTH_DELAY; + result = 6265000U + 83540U * result + USB_HOST_EHCI_BANDWIDTH_DELAY; } } else { + /*no action*/ } } else /* interrupt */ { if (speed == USB_SPEED_HIGH) { - result = 55 * 8 * 2083 + 2083 * result + USB_HOST_EHCI_BANDWIDTH_DELAY; + result = 55U * 8U * 2083U + 2083U * result + USB_HOST_EHCI_BANDWIDTH_DELAY; } else if (speed == USB_SPEED_FULL) { - result = 9107000 + 83540 * result + USB_HOST_EHCI_BANDWIDTH_DELAY; + result = 9107000U + 83540U * result + USB_HOST_EHCI_BANDWIDTH_DELAY; } else if (speed == USB_SPEED_LOW) { if (direction == USB_IN) { - result = 64060000 + 2000 * USB_HOST_EHCI_BANDWIDTH_HUB_LS_SETUP + 676670 * result + + result = 64060000U + 2000U * USB_HOST_EHCI_BANDWIDTH_HUB_LS_SETUP + 676670U * result + USB_HOST_EHCI_BANDWIDTH_DELAY; } else { - result = 6265000 + 83540 * result + USB_HOST_EHCI_BANDWIDTH_DELAY; + result = 6265000U + 83540U * result + USB_HOST_EHCI_BANDWIDTH_DELAY; } } else { + /*no action*/ } } - result /= 1000000; - if (result == 0) + result /= 1000000U; + if (result == 0U) { - result = 1; + result = 1U; } return result; @@ -1078,7 +1054,7 @@ static void USB_HostBandwidthFslsHostComputeCurrent(usb_host_ehci_instance_t *eh uint16_t *frameBandwidth) { usb_host_ehci_pipe_t *ehciPipePointer; - + void *temp; /* clear the bandwidth */ *frameBandwidth = 0; @@ -1091,26 +1067,28 @@ static void USB_HostBandwidthFslsHostComputeCurrent(usb_host_ehci_instance_t *eh { /* does pipe allocate bandwidth in frameIndex frame? note: interval is power of 2. */ if ((frameIndex >= ehciPipePointer->startFrame) && - (!((uint32_t)(frameIndex - ehciPipePointer->startFrame) & - (uint32_t)(ehciPipePointer->pipeCommon.interval - 1)))) + (0U == ((uint32_t)((uint32_t)frameIndex - ehciPipePointer->startFrame) & + ((uint32_t)ehciPipePointer->pipeCommon.interval - 1U)))) { *frameBandwidth += ehciPipePointer->dataTime; } } - ehciPipePointer = (usb_host_ehci_pipe_t *)ehciPipePointer->pipeCommon.next; + temp = (void *)ehciPipePointer->pipeCommon.next; + ehciPipePointer = (usb_host_ehci_pipe_t *)temp; } } static void USB_HostBandwidthHsHostComputeCurrentFsls(usb_host_ehci_instance_t *ehciInstance, uint32_t hubNumber, uint16_t frameIndex, - uint8_t frameBandwidths[8]) + uint16_t frameBandwidths[8]) { usb_host_ehci_pipe_t *ehciPipePointer; uint8_t index; uint32_t deviceInfo; + void *temp; - for (index = 0; index < 8; ++index) + for (index = 0; index < 8U; ++index) { frameBandwidths[index] = 0; } @@ -1124,47 +1102,50 @@ static void USB_HostBandwidthHsHostComputeCurrentFsls(usb_host_ehci_instance_t * { /* compute FS/LS bandwidth that blong to same high-speed hub, because FS/LS bandwidth is allocated from * first parent high-speed hub */ - USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, - kUSB_HostGetDeviceHSHubNumber, &deviceInfo); + (void)USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, + (uint32_t)kUSB_HostGetDeviceHSHubNumber, &deviceInfo); if (deviceInfo != hubNumber) { - ehciPipePointer = (usb_host_ehci_pipe_t *)ehciPipePointer->pipeCommon.next; + temp = (void *)ehciPipePointer->pipeCommon.next; + ehciPipePointer = (usb_host_ehci_pipe_t *)temp; continue; } - USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, kUSB_HostGetDeviceSpeed, - &deviceInfo); + (void)USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, + (uint32_t)kUSB_HostGetDeviceSpeed, &deviceInfo); if (deviceInfo == USB_SPEED_HIGH) { - ehciPipePointer = (usb_host_ehci_pipe_t *)ehciPipePointer->pipeCommon.next; + temp = (void *)ehciPipePointer->pipeCommon.next; + ehciPipePointer = (usb_host_ehci_pipe_t *)temp; continue; } /* does pipe allocate bandwidth in frameIndex frame? note: interval is power of 2. */ if ((frameIndex >= ehciPipePointer->startFrame) && - (!((uint32_t)(frameIndex - ehciPipePointer->startFrame) & - (uint32_t)(ehciPipePointer->pipeCommon.interval - 1)))) + (0U == ((uint32_t)((uint32_t)frameIndex - ehciPipePointer->startFrame) & + ((uint32_t)ehciPipePointer->pipeCommon.interval - 1U)))) { if (ehciPipePointer->pipeCommon.pipeType == USB_ENDPOINT_ISOCHRONOUS) /* iso bandwidth is allocated once */ { - frameBandwidths[ehciPipePointer->startUframe + 1] += ehciPipePointer->dataTime; + frameBandwidths[ehciPipePointer->startUframe + 1U] += ehciPipePointer->dataTime; } else /* iso bandwidth is allocated three times */ { - frameBandwidths[ehciPipePointer->startUframe + 1] += ehciPipePointer->dataTime; - frameBandwidths[ehciPipePointer->startUframe + 2] += ehciPipePointer->dataTime; - frameBandwidths[ehciPipePointer->startUframe + 3] += ehciPipePointer->dataTime; + frameBandwidths[ehciPipePointer->startUframe + 1U] += ehciPipePointer->dataTime; + frameBandwidths[ehciPipePointer->startUframe + 2U] += ehciPipePointer->dataTime; + frameBandwidths[ehciPipePointer->startUframe + 3U] += ehciPipePointer->dataTime; } } } - ehciPipePointer = (usb_host_ehci_pipe_t *)ehciPipePointer->pipeCommon.next; + temp = (void *)ehciPipePointer->pipeCommon.next; + ehciPipePointer = (usb_host_ehci_pipe_t *)temp; } - for (index = 0; index < 7; ++index) /* */ + for (index = 0; index < 7U; ++index) /* */ { if (frameBandwidths[index] > s_SlotMaxBandwidth[index]) { - frameBandwidths[index + 1] += (frameBandwidths[index] - s_SlotMaxBandwidth[index]); + frameBandwidths[index + 1U] += (frameBandwidths[index] - s_SlotMaxBandwidth[index]); frameBandwidths[index] = s_SlotMaxBandwidth[index]; } } @@ -1172,14 +1153,14 @@ static void USB_HostBandwidthHsHostComputeCurrentFsls(usb_host_ehci_instance_t * static void USB_HostBandwidthHsHostComputeCurrentHsAll(usb_host_ehci_instance_t *ehciInstance, uint16_t frameIndex, - uint8_t frameBandwidths[8]) + uint16_t frameBandwidths[8]) { usb_host_ehci_pipe_t *ehciPipePointer; - uint8_t index; + uint16_t index; uint32_t deviceInfo; uint16_t frameInterval; - - for (index = 0; index < 8; ++index) + void *temp; + for (index = 0; index < 8U; ++index) { frameBandwidths[index] = 0; } @@ -1192,26 +1173,26 @@ static void USB_HostBandwidthHsHostComputeCurrentHsAll(usb_host_ehci_instance_t (ehciPipePointer->pipeCommon.pipeType == USB_ENDPOINT_INTERRUPT)) { frameInterval = ehciPipePointer->pipeCommon.interval; - USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, kUSB_HostGetDeviceSpeed, - &deviceInfo); + (void)USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, + (uint32_t)kUSB_HostGetDeviceSpeed, &deviceInfo); if (deviceInfo == USB_SPEED_HIGH) /* high-speed data bandwidth */ { /* frameInterval means micro-frame here */ if (frameIndex >= ehciPipePointer->startFrame) { - if ((frameInterval > 8) && - (frameIndex * 8 - ehciPipePointer->startFrame * 8 >= ehciPipePointer->startUframe)) + if ((frameInterval > 8U) && + (frameIndex * 8U - ehciPipePointer->startFrame * 8U >= ehciPipePointer->startUframe)) { - if (!((uint32_t)(frameIndex * 8 - ehciPipePointer->startFrame * 8 - - ehciPipePointer->startUframe) & - (uint32_t)(frameInterval - 1))) + if (0U == ((((uint32_t)frameIndex) * 8U - ehciPipePointer->startFrame * 8U - + ehciPipePointer->startUframe) & + ((uint32_t)frameInterval - 1U))) { frameBandwidths[ehciPipePointer->startUframe] += ehciPipePointer->dataTime; } } else { - for (index = ehciPipePointer->startUframe; index < 8; index += frameInterval) + for (index = ehciPipePointer->startUframe; index < 8U; index += frameInterval) { frameBandwidths[index] += ehciPipePointer->dataTime; } @@ -1221,17 +1202,18 @@ static void USB_HostBandwidthHsHostComputeCurrentHsAll(usb_host_ehci_instance_t else /* full-speed split bandwidth */ { if ((frameIndex >= ehciPipePointer->startFrame) && - (!((uint32_t)(frameIndex - ehciPipePointer->startFrame) & (uint32_t)(frameInterval - 1)))) + (0U == ((uint32_t)((uint32_t)frameIndex - ehciPipePointer->startFrame) & + (uint32_t)((uint32_t)frameInterval - 1U)))) { - for (index = 0; index < 8; ++index) + for (index = 0; index < 8U; ++index) { - if ((uint32_t)(ehciPipePointer->uframeSmask) & - (uint32_t)(0x01 << index)) /* start-split micro-frames */ + if (0U != ((uint32_t)(ehciPipePointer->uframeSmask) & + (uint32_t)(0x01UL << index))) /* start-split micro-frames */ { frameBandwidths[index] += ehciPipePointer->startSplitTime; } - if ((uint32_t)(ehciPipePointer->uframeCmask) & - (uint32_t)(0x01 << index)) /* complete-split micro-frames */ + if (0U != ((uint32_t)(ehciPipePointer->uframeCmask) & + (uint32_t)(0x01UL << index))) /* complete-split micro-frames */ { frameBandwidths[index] += ehciPipePointer->completeSplitTime; } @@ -1239,17 +1221,20 @@ static void USB_HostBandwidthHsHostComputeCurrentHsAll(usb_host_ehci_instance_t } } } - ehciPipePointer = (usb_host_ehci_pipe_t *)ehciPipePointer->pipeCommon.next; + temp = (void *)ehciPipePointer->pipeCommon.next; + ehciPipePointer = (usb_host_ehci_pipe_t *)temp; } +#if 0 for (index = 0; index < 7; ++index) /* */ { - if (frameBandwidths[index] > s_SlotMaxBandwidth[index]) + if (frameBandwidths[index] > s_SlotMaxBandwidthHs[index]) { - frameBandwidths[index + 1] += (frameBandwidths[index] - s_SlotMaxBandwidth[index]); - frameBandwidths[index] = s_SlotMaxBandwidth[index]; + frameBandwidths[index + 1] += (frameBandwidths[index] - s_SlotMaxBandwidthHs[index]); + frameBandwidths[index] = s_SlotMaxBandwidthHs[index]; } } +#endif } /*! @@ -1270,15 +1255,19 @@ static usb_status_t USB_HostBandwidthHsHostAllocateHsCommon(usb_host_ehci_instan uint16_t uframeIntervalIndex; uint16_t uframeIndex; uint16_t frameIndex; - uint8_t frameTimes[8]; + uint16_t frameTimes[8]; frameIndex = 0; + for (uint8_t i = 0; i < 8U; ++i) + { + frameTimes[i] = 0U; + } USB_HostBandwidthHsHostComputeCurrentHsAll( ehciInstance, frameIndex, frameTimes); /* compute the allocated bandwidths in the frameIndex frame */ for (uframeIntervalIndex = 0; (uframeIntervalIndex < uframeInterval); ++uframeIntervalIndex) /* start micro-frame */ { /* for all the micro-frame in interval uframeInterval */ - for (uframeIndex = uframeIntervalIndex; uframeIndex < (USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE * 8); + for (uframeIndex = uframeIntervalIndex; uframeIndex < (USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE * 8U); uframeIndex += uframeInterval) { if (frameIndex != (uframeIndex >> 3)) @@ -1288,13 +1277,13 @@ static usb_status_t USB_HostBandwidthHsHostAllocateHsCommon(usb_host_ehci_instan ehciInstance, frameIndex, frameTimes); /* compute the allocated bandwidths in the new frameIndex frame */ } - if (frameTimes[uframeIndex & 0x0007] + timeData > - s_SlotMaxBandwidth[(uframeIndex & 0x0007)]) /* micro-frame has enough idle bandwidth? */ + if (frameTimes[uframeIndex & 0x0007U] + timeData > + s_SlotMaxBandwidthHs[(uframeIndex & 0x0007U)]) /* micro-frame has enough idle bandwidth? */ { break; /* fail */ } } - if (uframeIndex >= (USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE * 8)) /* success? */ + if (uframeIndex >= (USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE * 8U)) /* success? */ { break; } @@ -1318,91 +1307,97 @@ static usb_status_t USB_HostBandwidthHsHostAllocateIso(usb_host_ehci_instance_t usb_host_ehci_pipe_t *ehciPipePointer) { usb_status_t status; - uint32_t deviceInfo; - uint32_t hubNumber; + uint32_t deviceInfo = 0; + uint32_t hubNumber = 0; uint16_t uframeIntervalIndex = 0; - uint16_t frameIntervalIndex = 0; + uint16_t frameIntervalIndex = 0; uint16_t frameIndex; uint16_t timeCompleteSplit; uint16_t timeStartSplit; uint32_t timeData; uint8_t SsCsNumber = 0; uint16_t frameInterval; - uint8_t frameTimes[8]; + uint16_t frameTimes[8]; uint8_t allocateOk = 1; - uint8_t index; + uint16_t index; - USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, kUSB_HostGetDeviceSpeed, - &deviceInfo); + for (uint8_t i = 0; i < 8U; ++i) + { + frameTimes[i] = 0U; + } + (void)USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, + (uint32_t)kUSB_HostGetDeviceSpeed, &deviceInfo); timeData = USB_HostBandwidthComputeTime( - deviceInfo, USB_ENDPOINT_ISOCHRONOUS, ehciPipePointer->pipeCommon.direction, - ehciPipePointer->pipeCommon.maxPacketSize * ehciPipePointer->pipeCommon.numberPerUframe); + (uint8_t)deviceInfo, USB_ENDPOINT_ISOCHRONOUS, ehciPipePointer->pipeCommon.direction, + (((uint32_t)ehciPipePointer->pipeCommon.maxPacketSize) * ehciPipePointer->pipeCommon.numberPerUframe)); /* pipe is high-speed */ if (deviceInfo == USB_SPEED_HIGH) { uframeIntervalIndex = 0; - status = USB_HostBandwidthHsHostAllocateHsCommon(ehciInstance, ehciPipePointer->uframeInterval, timeData, - &uframeIntervalIndex); + status = USB_HostBandwidthHsHostAllocateHsCommon(ehciInstance, ehciPipePointer->uframeInterval, + (uint16_t)timeData, &uframeIntervalIndex); if (status == kStatus_USB_Success) { - ehciPipePointer->startFrame = (uframeIntervalIndex / 8); - ehciPipePointer->startUframe = (uframeIntervalIndex & 0x0007); - ehciPipePointer->dataTime = timeData; + ehciPipePointer->startFrame = (uframeIntervalIndex / 8U); + ehciPipePointer->startUframe = (uint8_t)(uframeIntervalIndex & 0x0007U); + ehciPipePointer->dataTime = (uint16_t)timeData; return kStatus_USB_Success; } } else /* pipe is full-speed or low-speed */ { - USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, kUSB_HostGetHubThinkTime, - &deviceInfo); /* deviceInfo variable means hub think time */ - timeData += (deviceInfo * 7 / (6 * 12)); - USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, kUSB_HostGetDeviceHSHubNumber, - &hubNumber); + (void)USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, + (uint32_t)kUSB_HostGetHubThinkTime, + &deviceInfo); /* deviceInfo variable means hub think time */ + timeData += (deviceInfo * 7U / (6U * 12U)); + (void)USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, + (uint32_t)kUSB_HostGetDeviceHSHubNumber, &hubNumber); frameInterval = ehciPipePointer->pipeCommon.interval; /* compute start-split and complete-split bandwidth */ if (ehciPipePointer->pipeCommon.direction == USB_OUT) { - timeStartSplit = USB_HostBandwidthComputeTime(USB_SPEED_HIGH, USB_ENDPOINT_ISOCHRONOUS, USB_OUT, - ehciPipePointer->pipeCommon.maxPacketSize); + timeStartSplit = (uint16_t)USB_HostBandwidthComputeTime(USB_SPEED_HIGH, USB_ENDPOINT_ISOCHRONOUS, USB_OUT, + ehciPipePointer->pipeCommon.maxPacketSize); timeCompleteSplit = 0; } else { - timeStartSplit = USB_HostBandwidthComputeTime(USB_SPEED_HIGH, USB_ENDPOINT_ISOCHRONOUS, USB_IN, 1); - timeCompleteSplit = USB_HostBandwidthComputeTime(USB_SPEED_HIGH, USB_ENDPOINT_ISOCHRONOUS, USB_IN, - ehciPipePointer->pipeCommon.maxPacketSize); + timeStartSplit = + (uint16_t)USB_HostBandwidthComputeTime(USB_SPEED_HIGH, USB_ENDPOINT_ISOCHRONOUS, USB_IN, 1); + timeCompleteSplit = (uint16_t)USB_HostBandwidthComputeTime(USB_SPEED_HIGH, USB_ENDPOINT_ISOCHRONOUS, USB_IN, + ehciPipePointer->pipeCommon.maxPacketSize); } /* note: bandwidth must put in one frame */ - for (uframeIntervalIndex = 0; uframeIntervalIndex <= 5; ++uframeIntervalIndex) /* uframe interval */ + for (uframeIntervalIndex = 0U; uframeIntervalIndex <= 5U; ++uframeIntervalIndex) /* uframe interval */ { - for (frameIntervalIndex = 0; frameIntervalIndex < frameInterval; ++frameIntervalIndex) /* frame interval */ + for (frameIntervalIndex = 0U; frameIntervalIndex < frameInterval; ++frameIntervalIndex) /* frame interval */ { allocateOk = 1; for (frameIndex = frameIntervalIndex; frameIndex < USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE; frameIndex += frameInterval) /* check all the frames */ { /* compute start-split and complete-split number */ - SsCsNumber = (ehciPipePointer->pipeCommon.maxPacketSize + 187) / - 188; /* ss number for iso out; cs number for iso in */ + SsCsNumber = (uint8_t)((ehciPipePointer->pipeCommon.maxPacketSize + 187U) / + 188U); /* ss number for iso out; cs number for iso in */ if (ehciPipePointer->pipeCommon.direction == USB_OUT) /* ISO OUT */ { - if (uframeIntervalIndex + SsCsNumber > 8) + if (uframeIntervalIndex + SsCsNumber > 8U) { - allocateOk = 0; + allocateOk = 0U; } } else { - if (uframeIntervalIndex + 2 + SsCsNumber > - 8) /* ISO IN: there are two micro-frame interval between start-split and complete-split */ + if (uframeIntervalIndex + 2U + SsCsNumber > + 8U) /* ISO IN: there are two micro-frame interval between start-split and complete-split */ { - allocateOk = 0; + allocateOk = 0U; } } - if (allocateOk) + if (0U != allocateOk) { /* allocate start-split and complete-split bandwidth */ USB_HostBandwidthHsHostComputeCurrentHsAll(ehciInstance, frameIndex, frameTimes); @@ -1411,9 +1406,9 @@ static usb_status_t USB_HostBandwidthHsHostAllocateIso(usb_host_ehci_instance_t index = uframeIntervalIndex; for (; index < (uframeIntervalIndex + SsCsNumber); ++index) { - if (frameTimes[index] + timeStartSplit > s_SlotMaxBandwidth[index]) + if (frameTimes[index] + timeStartSplit > s_SlotMaxBandwidthHs[index]) { - allocateOk = 0; + allocateOk = 0U; break; } } @@ -1421,20 +1416,20 @@ static usb_status_t USB_HostBandwidthHsHostAllocateIso(usb_host_ehci_instance_t else /* ISO IN */ { index = uframeIntervalIndex; - if (frameTimes[index] + timeStartSplit > s_SlotMaxBandwidth[index]) + if (frameTimes[index] + timeStartSplit > s_SlotMaxBandwidthHs[index]) { - allocateOk = 0; + allocateOk = 0U; } - if (allocateOk) + if (0U != allocateOk) { index = uframeIntervalIndex + - 2; /* there are two micro-frames interval between start-split and complete-split */ - for (; index < (uframeIntervalIndex + 2 + SsCsNumber); ++index) + 2U; /* there are two micro-frames interval between start-split and complete-split */ + for (; index < (uframeIntervalIndex + 2U + SsCsNumber); ++index) { - if (frameTimes[index] + timeCompleteSplit > s_SlotMaxBandwidth[index]) + if (frameTimes[index] + timeCompleteSplit > s_SlotMaxBandwidthHs[index]) { - allocateOk = 0; + allocateOk = 0U; break; } } @@ -1443,18 +1438,18 @@ static usb_status_t USB_HostBandwidthHsHostAllocateIso(usb_host_ehci_instance_t } /* allocate data bandwidth */ - if (allocateOk) + if (0U != allocateOk) { USB_HostBandwidthHsHostComputeCurrentFsls(ehciInstance, hubNumber, frameIndex, frameTimes); - index = uframeIntervalIndex + 1; /* timeData bandwidth start position */ + index = uframeIntervalIndex + 1U; /* timeData bandwidth start position */ /* iso must occupy all the uframe bandwidth */ { deviceInfo = timeData; /* note: deviceInfo variable means bandwidth here */ - while ((index < 8) && (deviceInfo > s_SlotMaxBandwidth[index])) + while ((index < 8U) && (deviceInfo > s_SlotMaxBandwidth[index])) { - if (frameTimes[index] > 0) + if (frameTimes[index] > 0U) { - allocateOk = 0; + allocateOk = 0U; break; } else @@ -1465,16 +1460,16 @@ static usb_status_t USB_HostBandwidthHsHostAllocateIso(usb_host_ehci_instance_t } } } - if (allocateOk) + if (0U != allocateOk) { /* data bandwidth can be put in the frame? */ - index = uframeIntervalIndex + 1; /* timeData bandwidth start position */ - frameTimes[index] += timeData; - for (; index < 7; ++index) + index = uframeIntervalIndex + 1U; /* timeData bandwidth start position */ + frameTimes[index] += (uint16_t)timeData; + for (; index < 7U; ++index) { if (frameTimes[index] > s_SlotMaxBandwidth[index]) { - frameTimes[index + 1] += (frameTimes[index] - s_SlotMaxBandwidth[index]); + frameTimes[index + 1U] += (frameTimes[index] - s_SlotMaxBandwidth[index]); frameTimes[index] = s_SlotMaxBandwidth[index]; } else @@ -1488,45 +1483,45 @@ static usb_status_t USB_HostBandwidthHsHostAllocateIso(usb_host_ehci_instance_t } } - if (allocateOk) + if (0U != allocateOk) { break; } } - if (allocateOk) + if (0U != allocateOk) { break; } } - if (allocateOk) + if (0U != allocateOk) { break; } } - if (allocateOk) + if (0U != allocateOk) { - ehciPipePointer->startFrame = frameIntervalIndex; - ehciPipePointer->startUframe = uframeIntervalIndex; - ehciPipePointer->dataTime = timeData; - ehciPipePointer->startSplitTime = timeStartSplit; + ehciPipePointer->startFrame = frameIntervalIndex; + ehciPipePointer->startUframe = (uint8_t)uframeIntervalIndex; + ehciPipePointer->dataTime = (uint16_t)timeData; + ehciPipePointer->startSplitTime = timeStartSplit; ehciPipePointer->completeSplitTime = timeCompleteSplit; if (ehciPipePointer->pipeCommon.direction == USB_OUT) { index = uframeIntervalIndex; for (; index < (uframeIntervalIndex + SsCsNumber); ++index) { - ehciPipePointer->uframeSmask = (uint32_t)ehciPipePointer->uframeSmask | (uint32_t)(0x01 << index); + ehciPipePointer->uframeSmask = ehciPipePointer->uframeSmask | (uint8_t)(0x01UL << index); } } else { - index = uframeIntervalIndex; - ehciPipePointer->uframeSmask = (uint32_t)ehciPipePointer->uframeSmask | (uint32_t)(0x01 << index); - index = uframeIntervalIndex + 2; - for (; index < (uframeIntervalIndex + 2 + SsCsNumber); ++index) + index = uframeIntervalIndex; + ehciPipePointer->uframeSmask = ehciPipePointer->uframeSmask | (uint8_t)(0x01UL << index); + index = uframeIntervalIndex + 2U; + for (; index < (uframeIntervalIndex + 2U + SsCsNumber); ++index) { - ehciPipePointer->uframeCmask = (uint32_t)ehciPipePointer->uframeCmask | (uint32_t)(0x01 << index); + ehciPipePointer->uframeCmask = ehciPipePointer->uframeCmask | (uint8_t)(0x01UL << index); } } @@ -1543,92 +1538,100 @@ static usb_status_t USB_HostBandwidthHsHostAllocateInterrupt(usb_host_ehci_insta usb_host_ehci_pipe_t *ehciPipePointer) { usb_status_t status; - uint32_t deviceInfo; - uint32_t hubNumber; + uint32_t deviceInfo = 0; + uint32_t hubNumber = 0; uint16_t uframeIntervalIndex = 0; - uint16_t frameIntervalIndex = 0; + uint16_t frameIntervalIndex = 0; uint16_t frameIndex; uint16_t timeCompleteSplit; uint16_t timeStartSplit; uint32_t timeData; uint8_t SsCsNumber; uint16_t frameInterval; - uint8_t frameTimes[8]; + uint16_t frameTimes[8]; uint8_t allocateOk = 1; uint8_t index; - USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, kUSB_HostGetDeviceSpeed, - &deviceInfo); + for (uint8_t i = 0; i < 8U; ++i) + { + frameTimes[i] = 0U; + } + (void)USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, + (uint32_t)kUSB_HostGetDeviceSpeed, &deviceInfo); timeData = USB_HostBandwidthComputeTime( - deviceInfo, USB_ENDPOINT_INTERRUPT, ehciPipePointer->pipeCommon.direction, - ehciPipePointer->pipeCommon.maxPacketSize * ehciPipePointer->pipeCommon.numberPerUframe); + (uint8_t)deviceInfo, USB_ENDPOINT_INTERRUPT, ehciPipePointer->pipeCommon.direction, + (uint32_t)ehciPipePointer->pipeCommon.maxPacketSize * ehciPipePointer->pipeCommon.numberPerUframe); /* pipe is high-speed */ if (deviceInfo == USB_SPEED_HIGH) { uframeIntervalIndex = 0; - status = USB_HostBandwidthHsHostAllocateHsCommon(ehciInstance, ehciPipePointer->uframeInterval, timeData, - &uframeIntervalIndex); + status = USB_HostBandwidthHsHostAllocateHsCommon(ehciInstance, ehciPipePointer->uframeInterval, + (uint16_t)timeData, &uframeIntervalIndex); if (status == kStatus_USB_Success) { - ehciPipePointer->startFrame = (uframeIntervalIndex / 8); - ehciPipePointer->startUframe = (uframeIntervalIndex & 0x0007); + ehciPipePointer->startFrame = (uframeIntervalIndex / 8U); + ehciPipePointer->startUframe = (uint8_t)(uframeIntervalIndex & 0x0007U); /* for HS interrupt start transaction position */ - if (ehciPipePointer->uframeInterval >= 8) + if (ehciPipePointer->uframeInterval >= 8U) { - ehciPipePointer->uframeSmask = (0x01 << ehciPipePointer->startUframe); + ehciPipePointer->uframeSmask = (0x01U << ehciPipePointer->startUframe); } else { - ehciPipePointer->uframeSmask = 0x00u; - for (index = ehciPipePointer->startUframe; index < 8; index += ehciPipePointer->uframeInterval) + ehciPipePointer->uframeSmask = 0x00U; + for (index = ehciPipePointer->startUframe; index < 8U; + index += (uint8_t)ehciPipePointer->uframeInterval) { ehciPipePointer->uframeSmask |= (0x01U << index); } } - ehciPipePointer->dataTime = timeData; + ehciPipePointer->dataTime = (uint16_t)timeData; return kStatus_USB_Success; } } else /* pipe is full-speed or low-speed */ { - USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, kUSB_HostGetHubThinkTime, - &deviceInfo); - timeData += (deviceInfo * 7 / (6 * 12)); - USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, kUSB_HostGetDeviceHSHubNumber, - &hubNumber); + (void)USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, + (uint32_t)kUSB_HostGetHubThinkTime, &deviceInfo); + timeData += (deviceInfo * 7U / (6U * 12U)); + (void)USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, + (uint32_t)kUSB_HostGetDeviceHSHubNumber, &hubNumber); frameInterval = ehciPipePointer->pipeCommon.interval; - SsCsNumber = 3; /* complete split number */ + SsCsNumber = 3U; /* complete split number */ /* compute start-split and complete-split bandwidth */ if (ehciPipePointer->pipeCommon.direction == USB_OUT) { - timeStartSplit = USB_HostBandwidthComputeTime(USB_SPEED_HIGH, USB_ENDPOINT_INTERRUPT, USB_OUT, - ehciPipePointer->pipeCommon.maxPacketSize) + - USB_HostBandwidthComputeTime(USB_SPEED_HIGH, USB_ENDPOINT_INTERRUPT, USB_OUT, 1); - timeCompleteSplit = USB_HostBandwidthComputeTime(USB_SPEED_HIGH, USB_ENDPOINT_INTERRUPT, USB_OUT, 0); + timeStartSplit = (uint16_t)USB_HostBandwidthComputeTime(USB_SPEED_HIGH, USB_ENDPOINT_INTERRUPT, USB_OUT, + ehciPipePointer->pipeCommon.maxPacketSize); + timeStartSplit += + (uint16_t)USB_HostBandwidthComputeTime(USB_SPEED_HIGH, USB_ENDPOINT_INTERRUPT, USB_OUT, 1U); + timeCompleteSplit = + (uint16_t)USB_HostBandwidthComputeTime(USB_SPEED_HIGH, USB_ENDPOINT_INTERRUPT, USB_OUT, 0U); } else { - timeStartSplit = USB_HostBandwidthComputeTime(USB_SPEED_HIGH, USB_ENDPOINT_INTERRUPT, USB_IN, 1); - timeCompleteSplit = USB_HostBandwidthComputeTime(USB_SPEED_HIGH, USB_ENDPOINT_INTERRUPT, USB_IN, - ehciPipePointer->pipeCommon.maxPacketSize) + - USB_HostBandwidthComputeTime(USB_SPEED_HIGH, USB_ENDPOINT_INTERRUPT, USB_IN, 0); + timeStartSplit = (uint16_t)USB_HostBandwidthComputeTime(USB_SPEED_HIGH, USB_ENDPOINT_INTERRUPT, USB_IN, 1U); + timeCompleteSplit = (uint16_t)USB_HostBandwidthComputeTime(USB_SPEED_HIGH, USB_ENDPOINT_INTERRUPT, USB_IN, + ehciPipePointer->pipeCommon.maxPacketSize); + timeCompleteSplit += + (uint16_t)USB_HostBandwidthComputeTime(USB_SPEED_HIGH, USB_ENDPOINT_INTERRUPT, USB_IN, 0U); } /* note: bandwidth must put in one frame */ - for (uframeIntervalIndex = 0; uframeIntervalIndex <= 4; ++uframeIntervalIndex) /* uframe interval */ + for (uframeIntervalIndex = 0U; uframeIntervalIndex <= 4U; ++uframeIntervalIndex) /* uframe interval */ { - for (frameIntervalIndex = 0; frameIntervalIndex < frameInterval; ++frameIntervalIndex) /* frame interval */ + for (frameIntervalIndex = 0U; frameIntervalIndex < frameInterval; ++frameIntervalIndex) /* frame interval */ { - allocateOk = 1; + allocateOk = 1U; for (frameIndex = frameIntervalIndex; frameIndex < USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE; frameIndex += frameInterval) /* check all the frames */ { /* allocate data bandwidth */ USB_HostBandwidthHsHostComputeCurrentFsls(ehciInstance, hubNumber, frameIndex, frameTimes); - index = uframeIntervalIndex + 1; - for (; index <= (uframeIntervalIndex + 3); ++index) /* data bandwidth number is 3. + index = (uint8_t)(uframeIntervalIndex + 1U); + for (; index <= (uframeIntervalIndex + 3U); ++index) /* data bandwidth number is 3. uframeIntervalIndex don't exceed 4, so index cannot exceed 7 */ { @@ -1639,60 +1642,61 @@ static usb_status_t USB_HostBandwidthHsHostAllocateInterrupt(usb_host_ehci_insta } } - if (allocateOk) + if (0U != allocateOk) { USB_HostBandwidthHsHostComputeCurrentHsAll(ehciInstance, frameIndex, frameTimes); /* allocate start_split bandwidth */ - if (frameTimes[uframeIntervalIndex] + timeStartSplit > s_SlotMaxBandwidth[uframeIntervalIndex]) + if (frameTimes[uframeIntervalIndex] + timeStartSplit > + s_SlotMaxBandwidthHs[uframeIntervalIndex]) { - allocateOk = 0; + allocateOk = 0U; } - if (allocateOk) + if (0U != allocateOk) { /* allocate complete_split bandwidth */ - index = uframeIntervalIndex + 2; + index = (uint8_t)uframeIntervalIndex + 2U; /* complete-split number is normal 3. When uframeIntervalIndex is 4, complete-split number * is 2. */ - for (; (index <= (uframeIntervalIndex + 1 + SsCsNumber)) && (index < 8); ++index) + for (; (index <= (uframeIntervalIndex + 1U + SsCsNumber)) && (index < 8U); ++index) { - if (frameTimes[index] + timeCompleteSplit > s_SlotMaxBandwidth[index]) + if (frameTimes[index] + timeCompleteSplit > s_SlotMaxBandwidthHs[index]) { - allocateOk = 0; + allocateOk = 0U; break; } } } } - if (!allocateOk) + if (0U == allocateOk) { break; /* allocate fail */ } } - if (allocateOk) + if (0U != allocateOk) { break; } } - if (allocateOk) + if (0U != allocateOk) { break; } } - if (allocateOk) + if (0U != allocateOk) { - ehciPipePointer->startFrame = frameIntervalIndex; - ehciPipePointer->startUframe = uframeIntervalIndex; - ehciPipePointer->uframeSmask = (0x01 << ehciPipePointer->startUframe); - ehciPipePointer->uframeCmask = 0; - index = uframeIntervalIndex + 2; - for (; (index <= (uframeIntervalIndex + 1 + SsCsNumber)) && (index < 8); ++index) + ehciPipePointer->startFrame = frameIntervalIndex; + ehciPipePointer->startUframe = (uint8_t)uframeIntervalIndex; + ehciPipePointer->uframeSmask = (0x01u << ehciPipePointer->startUframe); + ehciPipePointer->uframeCmask = 0u; + index = (uint8_t)uframeIntervalIndex + 2u; + for (; (index <= (uframeIntervalIndex + 1u + SsCsNumber)) && (index < 8u); ++index) { - ehciPipePointer->uframeCmask = (uint32_t)ehciPipePointer->uframeCmask | (uint32_t)(0x01 << index); + ehciPipePointer->uframeCmask = ehciPipePointer->uframeCmask | (0x01U << index); } - ehciPipePointer->dataTime = timeData; - ehciPipePointer->startSplitTime = timeStartSplit; + ehciPipePointer->dataTime = (uint16_t)timeData; + ehciPipePointer->startSplitTime = timeStartSplit; ehciPipePointer->completeSplitTime = timeCompleteSplit; return kStatus_USB_Success; @@ -1706,17 +1710,18 @@ static usb_status_t USB_HostBandwidthFslsHostAllocate(usb_host_ehci_instance_t * usb_host_ehci_pipe_t *ehciPipePointer) { uint32_t FslsTime = 0; - uint32_t speed = 0; + uint32_t speed = 0; uint16_t uframeIntervalIndex; uint16_t frameIndex; uint16_t frameInterval; uint16_t frameTime; - USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, kUSB_HostGetHubThinkTime, - &FslsTime); - FslsTime += (FslsTime * 7 / (6 * 12)); - USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, kUSB_HostGetDeviceSpeed, &speed); - FslsTime = FslsTime + USB_HostBandwidthComputeTime(speed, ehciPipePointer->pipeCommon.pipeType, + (void)USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, + (uint32_t)kUSB_HostGetHubThinkTime, &FslsTime); + FslsTime += (FslsTime * 7U / (6U * 12U)); + (void)USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, + (uint32_t)kUSB_HostGetDeviceSpeed, &speed); + FslsTime = FslsTime + USB_HostBandwidthComputeTime((uint8_t)speed, ehciPipePointer->pipeCommon.pipeType, ehciPipePointer->pipeCommon.direction, ehciPipePointer->pipeCommon.maxPacketSize); @@ -1740,11 +1745,11 @@ static usb_status_t USB_HostBandwidthFslsHostAllocate(usb_host_ehci_instance_t * } if (uframeIntervalIndex < ehciPipePointer->uframeInterval) { - ehciPipePointer->startFrame = (uframeIntervalIndex >> 3); - ehciPipePointer->startUframe = (uframeIntervalIndex & 0x0007); + ehciPipePointer->startFrame = (uframeIntervalIndex >> 3); + ehciPipePointer->startUframe = (uint8_t)(uframeIntervalIndex & 0x0007U); ehciPipePointer->uframeSmask = 0; /* useless */ ehciPipePointer->uframeCmask = 0; - ehciPipePointer->dataTime = FslsTime; + ehciPipePointer->dataTime = (uint16_t)FslsTime; return kStatus_USB_Success; } @@ -1754,46 +1759,46 @@ static usb_status_t USB_HostBandwidthFslsHostAllocate(usb_host_ehci_instance_t * static uint8_t USB_HostEhciGet2PowerValue(uint8_t value) { - if ((value == 0) || (value == 1)) + if ((value == 0U) || (value == 1U)) { return value; } - if (value & 0xf0) + if (0U != (value & 0xf0U)) { - if (value & 0x80) + if (0U != (value & 0x80U)) { - return 128; + return 128U; } - else if (value & 0x40) + else if (0U != (value & 0x40U)) { - return 64; + return 64U; } - else if (value & 0x20) + else if (0U != (value & 0x20U)) { - return 32; + return 32U; } else { - return 16; + return 16U; } } else { - if (value & 0x08) + if (0U != (value & 0x08U)) { - return 8; + return 8U; } - else if (value & 0x04) + else if (0U != (value & 0x04U)) { - return 4; + return 4U; } - else if (value & 0x02) + else if (0U != (value & 0x02U)) { - return 2; + return 2U; } else { - return 1; + return 1U; } } } @@ -1801,8 +1806,9 @@ static uint8_t USB_HostEhciGet2PowerValue(uint8_t value) static void USB_HostEhciZeroMem(uint32_t *buffer, uint32_t length) { /* note: the zero unit is uint32_t */ - while (length--) + while (0U != length) { + length--; *buffer = 0; buffer++; } @@ -1811,24 +1817,24 @@ static void USB_HostEhciZeroMem(uint32_t *buffer, uint32_t length) static void USB_HostEhciDelay(USBHS_Type *ehciIpBase, uint32_t ms) { /* note: the max delay time cannot exceed half of max value (0x4000) */ - int32_t sofStart; - int32_t SofEnd; + uint32_t sofStart; + uint32_t SofEnd; uint32_t distance; - sofStart = (int32_t)(ehciIpBase->FRINDEX & EHCI_MAX_UFRAME_VALUE); + sofStart = (ehciIpBase->FRINDEX & EHCI_MAX_UFRAME_VALUE); do { - SofEnd = (int32_t)(ehciIpBase->FRINDEX & EHCI_MAX_UFRAME_VALUE); - distance = (uint32_t)(SofEnd - sofStart + EHCI_MAX_UFRAME_VALUE + 1); - } while ((distance & EHCI_MAX_UFRAME_VALUE) < (ms * 8)); /* compute the distance between sofStart and SofEnd */ + SofEnd = (ehciIpBase->FRINDEX & EHCI_MAX_UFRAME_VALUE); + distance = (SofEnd + EHCI_MAX_UFRAME_VALUE + 1U - sofStart); + } while ((distance & EHCI_MAX_UFRAME_VALUE) < (ms * 8U)); /* compute the distance between sofStart and SofEnd */ } static void USB_HostEhciStartAsync(usb_host_ehci_instance_t *ehciInstance) { uint32_t stateSync; - if (!(ehciInstance->ehciIpBase->USBSTS & USBHS_USBSTS_AS_MASK)) + if (0U == (ehciInstance->ehciIpBase->USBSTS & USBHS_USBSTS_AS_MASK)) { /* the status must be same when change USBCMD->ASE */ do @@ -1839,7 +1845,7 @@ static void USB_HostEhciStartAsync(usb_host_ehci_instance_t *ehciInstance) ehciInstance->ehciIpBase->ASYNCLISTADDR = (uint32_t)(ehciInstance->shedFirstQh); ehciInstance->ehciIpBase->USBCMD |= USBHS_USBCMD_ASE_MASK; - while (!(ehciInstance->ehciIpBase->USBSTS & USBHS_USBSTS_AS_MASK)) + while (0U == (ehciInstance->ehciIpBase->USBSTS & USBHS_USBSTS_AS_MASK)) { } } @@ -1857,7 +1863,7 @@ static void USB_HostEhciStopAsync(usb_host_ehci_instance_t *ehciInstance) } while ((stateSync == USBHS_USBSTS_AS_MASK) || (stateSync == USBHS_USBCMD_ASE_MASK)); ehciInstance->ehciIpBase->USBCMD &= (uint32_t)(~(uint32_t)USBHS_USBCMD_ASE_MASK); /* disable async schedule */ - while (ehciInstance->ehciIpBase->USBSTS & USBHS_USBSTS_AS_MASK) + while (0U != (ehciInstance->ehciIpBase->USBSTS & USBHS_USBSTS_AS_MASK)) { } } @@ -1866,7 +1872,7 @@ static void USB_HostEhciStartPeriodic(usb_host_ehci_instance_t *ehciInstance) { uint32_t stateSync; - if (!(ehciInstance->ehciIpBase->USBSTS & USBHS_USBSTS_PS_MASK)) + if (0U == (ehciInstance->ehciIpBase->USBSTS & USBHS_USBSTS_PS_MASK)) { /* the status must be same when change USBCMD->PSE */ do @@ -1875,11 +1881,11 @@ static void USB_HostEhciStartPeriodic(usb_host_ehci_instance_t *ehciInstance) (ehciInstance->ehciIpBase->USBCMD & USBHS_USBCMD_PSE_MASK)); } while ((stateSync == USBHS_USBSTS_PS_MASK) || (stateSync == USBHS_USBCMD_PSE_MASK)); ehciInstance->ehciIpBase->PERIODICLISTBASE = (uint32_t)(ehciInstance->ehciFrameList); - if (!(ehciInstance->ehciIpBase->USBCMD & USBHS_USBCMD_PSE_MASK)) + if (0U == (ehciInstance->ehciIpBase->USBCMD & USBHS_USBCMD_PSE_MASK)) { ehciInstance->ehciIpBase->USBCMD |= USBHS_USBCMD_PSE_MASK; /* start periodic schedule */ } - while (!(ehciInstance->ehciIpBase->USBSTS & USBHS_USBSTS_PS_MASK)) + while (0U == (ehciInstance->ehciIpBase->USBSTS & USBHS_USBSTS_PS_MASK)) { } } @@ -1898,7 +1904,7 @@ static void USB_HostEhciStopPeriodic(usb_host_ehci_instance_t *ehciInstance) } while ((stateSync == USBHS_USBSTS_PS_MASK) || (stateSync == USBHS_USBCMD_PSE_MASK)); ehciInstance->ehciIpBase->USBCMD &= (~USBHS_USBCMD_PSE_MASK); /* stop periodic schedule */ - while (ehciInstance->ehciIpBase->USBSTS & USBHS_USBSTS_PS_MASK) + while (0U != (ehciInstance->ehciIpBase->USBSTS & USBHS_USBSTS_PS_MASK)) { } } @@ -1908,7 +1914,7 @@ static usb_status_t USB_HostEhciQhQtdListInit(usb_host_ehci_instance_t *ehciInst usb_host_transfer_t *transfer) { volatile usb_host_ehci_qh_t *vltQhPointer; - usb_host_ehci_qtd_t *qtdPointer = NULL; + usb_host_ehci_qtd_t *qtdPointer = NULL; usb_host_ehci_qtd_t *BaseQtdPointer = NULL; volatile uint32_t *entryPointer; uint32_t qtdNumber; @@ -1921,19 +1927,23 @@ static usb_status_t USB_HostEhciQhQtdListInit(usb_host_ehci_instance_t *ehciInst if (ehciPipePointer->pipeCommon.pipeType == USB_ENDPOINT_CONTROL) { /* assume setup data don't exceed one qtd data size, one qtd can transfer least 16k data */ - if (transfer->transferLength == 0) + if (transfer->transferLength == 0U) { - qtdNumber = 2; + qtdNumber = 2U; } else { - qtdNumber = 3; + qtdNumber = 3U; } } else { - qtdNumber = - (((transfer->transferLength) & 0xFFFFC000U) >> 14) + (((transfer->transferLength) & 0x00003FFF) ? 1 : 0); + qtdNumber = (((transfer->transferLength) & 0xFFFFC000U) >> 14U) + + (0U != ((transfer->transferLength) & 0x00003FFFU) ? 1U : 0U); + if (0U == qtdNumber) + { + qtdNumber = 1U; + } } vltQhPointer = (volatile usb_host_ehci_qh_t *)ehciPipePointer->ehciQh; @@ -1941,20 +1951,21 @@ static usb_status_t USB_HostEhciQhQtdListInit(usb_host_ehci_instance_t *ehciInst USB_HostEhciLock(); if (qtdNumber <= ehciInstance->ehciQtdNumber) { - ehciInstance->ehciQtdNumber -= qtdNumber; + ehciInstance->ehciQtdNumber -= (uint8_t)qtdNumber; BaseQtdPointer = ehciInstance->ehciQtdHead; - qtdPointer = NULL; + qtdPointer = NULL; do { if (qtdPointer != NULL) { qtdPointer->nextQtdPointer = (uint32_t)ehciInstance->ehciQtdHead; } - qtdPointer = ehciInstance->ehciQtdHead; - ehciInstance->ehciQtdHead = (usb_host_ehci_qtd_t *)qtdPointer->nextQtdPointer; + qtdPointer = ehciInstance->ehciQtdHead; + ehciInstance->ehciQtdHead = (usb_host_ehci_qtd_t *)qtdPointer->nextQtdPointer; qtdPointer->nextQtdPointer = 0; - } while (--qtdNumber); - if (ehciInstance->ehciQtdNumber == 0) + --qtdNumber; + } while (0U != qtdNumber); + if (ehciInstance->ehciQtdNumber == 0U) { ehciInstance->ehciQtdTail = NULL; } @@ -1970,34 +1981,34 @@ static usb_status_t USB_HostEhciQhQtdListInit(usb_host_ehci_instance_t *ehciInst if (ehciPipePointer->pipeCommon.pipeType == USB_ENDPOINT_CONTROL) { /* setup transaction qtd */ - qtdPointer = BaseQtdPointer; + qtdPointer = BaseQtdPointer; qtdPointer->alternateNextQtdPointer = EHCI_HOST_T_INVALID_VALUE; /* dt: need set; ioc: 0; C_Page: 0; PID Code: SETUP; Status: Active */ - qtdPointer->transferResults[0] = qtdPointer->transferResults[1] = 0; + qtdPointer->transferResults[1] = 0U; qtdPointer->transferResults[0] = - ((0x00000000 << EHCI_HOST_QTD_DT_SHIFT) | (8 << EHCI_HOST_QTD_TOTAL_BYTES_SHIFT) | + ((0x00000000UL << EHCI_HOST_QTD_DT_SHIFT) | (8UL << EHCI_HOST_QTD_TOTAL_BYTES_SHIFT) | (EHCI_HOST_PID_SETUP << EHCI_HOST_QTD_PID_CODE_SHIFT) | (EHCI_HOST_QTD_STATUS_ACTIVE_MASK)); - dataAddress = ((uint32_t)transfer->setupPacket); + dataAddress = ((uint32_t)transfer->setupPacket); qtdPointer->transferResults[1] = dataAddress; /* current offset is set too */ /* set buffer pointer no matter data length */ - for (index = 0; index < 4; ++index) + for (index = 0; index < 4U; ++index) { - qtdPointer->bufferPointers[index] = ((dataAddress + (index + 1) * 4 * 1024) & 0xFFFFF000U); + qtdPointer->bufferPointers[index] = ((dataAddress + ((uint32_t)index + 1U) * 4U * 1024U) & 0xFFFFF000U); } /* data transaction qtd */ dataLength = transfer->transferLength; - if (dataLength != 0) + if (dataLength != 0U) { qtdPointer = (usb_host_ehci_qtd_t *)(qtdPointer->nextQtdPointer); qtdPointer->alternateNextQtdPointer = EHCI_HOST_T_INVALID_VALUE; /* dt: need set; ioc: 0; C_Page: 0; PID Code: IN/OUT; Status: Active */ - qtdPointer->transferResults[0] = qtdPointer->transferResults[1] = 0; + qtdPointer->transferResults[1] = 0U; if (transfer->direction == USB_OUT) { qtdPointer->transferResults[0] = - ((0x00000001U << EHCI_HOST_QTD_DT_SHIFT) | (dataLength << EHCI_HOST_QTD_TOTAL_BYTES_SHIFT) | + ((0x00000001UL << EHCI_HOST_QTD_DT_SHIFT) | (dataLength << EHCI_HOST_QTD_TOTAL_BYTES_SHIFT) | (EHCI_HOST_PID_OUT << EHCI_HOST_QTD_PID_CODE_SHIFT) | (EHCI_HOST_QTD_STATUS_ACTIVE_MASK)); } else @@ -2007,24 +2018,24 @@ static usb_status_t USB_HostEhciQhQtdListInit(usb_host_ehci_instance_t *ehciInst (EHCI_HOST_PID_IN << EHCI_HOST_QTD_PID_CODE_SHIFT) | (EHCI_HOST_QTD_STATUS_ACTIVE_MASK)); } - dataAddress = (uint32_t)transfer->transferBuffer; + dataAddress = (uint32_t)transfer->transferBuffer; qtdPointer->transferResults[1] = dataAddress; /* current offset is set too */ /* set buffer pointer no matter data length */ - for (index = 0; index < 4; ++index) + for (index = 0; index < 4U; ++index) { - qtdPointer->bufferPointers[index] = ((dataAddress + (index + 1) * 4 * 1024) & 0xFFFFF000U); + qtdPointer->bufferPointers[index] = ((dataAddress + ((uint32_t)index + 1U) * 4U * 1024U) & 0xFFFFF000U); } } /* status transaction qtd */ - qtdPointer = (usb_host_ehci_qtd_t *)(qtdPointer->nextQtdPointer); + qtdPointer = (usb_host_ehci_qtd_t *)(qtdPointer->nextQtdPointer); qtdPointer->alternateNextQtdPointer = EHCI_HOST_T_INVALID_VALUE; /* dt: dont care; ioc: 1; C_Page: 0; PID Code: IN/OUT; Status: Active */ - qtdPointer->transferResults[0] = qtdPointer->transferResults[1] = 0; - if ((dataLength == 0) || (transfer->direction == USB_OUT)) + qtdPointer->transferResults[1] = 0; + if ((dataLength == 0U) || (transfer->direction == USB_OUT)) { qtdPointer->transferResults[0] = - ((0x00000001U << EHCI_HOST_QTD_DT_SHIFT) | (EHCI_HOST_PID_IN << EHCI_HOST_QTD_PID_CODE_SHIFT) | + ((0x00000001UL << EHCI_HOST_QTD_DT_SHIFT) | (EHCI_HOST_PID_IN << EHCI_HOST_QTD_PID_CODE_SHIFT) | (EHCI_HOST_QTD_IOC_MASK) | (EHCI_HOST_QTD_STATUS_ACTIVE_MASK)); } else @@ -2037,12 +2048,11 @@ static usb_status_t USB_HostEhciQhQtdListInit(usb_host_ehci_instance_t *ehciInst } else { - dataLength = transfer->transferLength; dataAddress = (uint32_t)transfer->transferBuffer; - qtdPointer = BaseQtdPointer; - while (1) + qtdPointer = BaseQtdPointer; + while (1U == 1U) { - endAddress = dataAddress + (16 * 1024); + endAddress = dataAddress + (16U * 1024U); if (endAddress > (uint32_t)(transfer->transferBuffer + transfer->transferLength)) { endAddress = (uint32_t)(transfer->transferBuffer + transfer->transferLength); @@ -2050,7 +2060,7 @@ static usb_status_t USB_HostEhciQhQtdListInit(usb_host_ehci_instance_t *ehciInst qtdPointer->alternateNextQtdPointer = EHCI_HOST_T_INVALID_VALUE; /* dt: set; ioc: 0; C_Page: 0; PID Code: IN/OUT; Status: Active */ - qtdPointer->transferResults[0] = qtdPointer->transferResults[1] = 0; + qtdPointer->transferResults[1] = 0U; if (transfer->direction == USB_OUT) { qtdPointer->transferResults[0] = @@ -2069,13 +2079,13 @@ static usb_status_t USB_HostEhciQhQtdListInit(usb_host_ehci_instance_t *ehciInst } qtdPointer->transferResults[1] = dataAddress; /* current offset is set too */ /* set buffer pointer no matter data length */ - for (index = 0; index < 4; ++index) + for (index = 0; index < 4U; ++index) { - qtdPointer->bufferPointers[index] = ((dataAddress + (index + 1) * 4 * 1024) & 0xFFFFF000U); + qtdPointer->bufferPointers[index] = ((dataAddress + ((uint32_t)index + 1U) * 4U * 1024U) & 0xFFFFF000U); } dataAddress = endAddress; /* for next qtd */ - if (qtdPointer->nextQtdPointer == 0) + if (qtdPointer->nextQtdPointer == 0U) { break; } @@ -2093,24 +2103,25 @@ static usb_status_t USB_HostEhciQhQtdListInit(usb_host_ehci_instance_t *ehciInst transfer->next = NULL; if (vltQhPointer->ehciTransferHead == NULL) { - transfer->next = NULL; - vltQhPointer->ehciTransferHead = vltQhPointer->ehciTransferTail = transfer; + transfer->next = NULL; + vltQhPointer->ehciTransferTail = transfer; + vltQhPointer->ehciTransferHead = transfer; } else { - transfer->next = NULL; + transfer->next = NULL; vltQhPointer->ehciTransferTail->next = transfer; - vltQhPointer->ehciTransferTail = transfer; + vltQhPointer->ehciTransferTail = transfer; } USB_HostEhciLock(); /* link qtd to qh (link to end) */ entryPointer = &(vltQhPointer->nextQtdPointer); - dataAddress = *entryPointer; /* dataAddress variable means entry value here */ - while ((dataAddress) && (!(dataAddress & EHCI_HOST_T_INVALID_VALUE))) + dataAddress = *entryPointer; /* dataAddress variable means entry value here */ + while ((0U != dataAddress) && (0U == (dataAddress & EHCI_HOST_T_INVALID_VALUE))) { entryPointer = (volatile uint32_t *)dataAddress; - dataAddress = *entryPointer; + dataAddress = *entryPointer; } *entryPointer = (uint32_t)BaseQtdPointer; USB_HostEhciUnlock(); @@ -2126,7 +2137,7 @@ static uint32_t USB_HostEhciQtdListRelease(usb_host_ehci_instance_t *ehciInstanc uint32_t length = 0; usb_host_ehci_qtd_t *qtdPointer; - ehciQtdEnd->nextQtdPointer = 0; + ehciQtdEnd->nextQtdPointer = 0U; /* compute remaining length */ qtdPointer = ehciQtdStart; @@ -2141,7 +2152,7 @@ static uint32_t USB_HostEhciQtdListRelease(usb_host_ehci_instance_t *ehciInstanc /* put releasing qtd to idle qtd list */ USB_HostEhciLock(); - if (ehciInstance->ehciQtdNumber == 0) + if (ehciInstance->ehciQtdNumber == 0U) { ehciInstance->ehciQtdHead = ehciQtdStart; ehciInstance->ehciQtdTail = ehciQtdEnd; @@ -2149,7 +2160,7 @@ static uint32_t USB_HostEhciQtdListRelease(usb_host_ehci_instance_t *ehciInstanc else { ehciInstance->ehciQtdTail->nextQtdPointer = (uint32_t)ehciQtdStart; - ehciInstance->ehciQtdTail = ehciQtdEnd; + ehciInstance->ehciQtdTail = ehciQtdEnd; } while (ehciQtdStart != ehciQtdEnd) @@ -2169,37 +2180,41 @@ static usb_status_t USB_HostEhciQhQtdListDeinit(usb_host_ehci_instance_t *ehciIn volatile usb_host_ehci_qh_t *vltQhPointer; usb_host_transfer_t *transfer; usb_host_transfer_t *nextTransfer; - uint8_t needStop = 0; + uint32_t currentQtdPointer; + uint8_t needStop = 0U; vltQhPointer = (volatile usb_host_ehci_qh_t *)ehciPipePointer->ehciQh; USB_HostEhciLock(); /* this API is called from APP, the host task may occupy to access the same resource */ /* remove qtd from qh */ - if ((!((uint32_t)vltQhPointer->nextQtdPointer & EHCI_HOST_T_INVALID_VALUE)) || - (!((uint32_t)vltQhPointer->currentQtdPointer & EHCI_HOST_T_INVALID_VALUE))) + /*for misra 13.5*/ + currentQtdPointer = vltQhPointer->currentQtdPointer; + if ((0U == ((uint32_t)vltQhPointer->nextQtdPointer & EHCI_HOST_T_INVALID_VALUE)) || + (0U == ((uint32_t)currentQtdPointer & EHCI_HOST_T_INVALID_VALUE))) { /* need stop async schedule */ - if ((!(vltQhPointer->horizontalLinkPointer & EHCI_HOST_T_INVALID_VALUE)) && + if ((0U == (vltQhPointer->horizontalLinkPointer & EHCI_HOST_T_INVALID_VALUE)) && (ehciPipePointer->pipeCommon.pipeType != USB_ENDPOINT_INTERRUPT)) { - needStop = 1; + needStop = 1U; } - if (needStop) + if (0U != needStop) { USB_HostEhciStopAsync(ehciInstance); } vltQhPointer->currentQtdPointer = EHCI_HOST_T_INVALID_VALUE; /* invalid current qtd */ - vltQhPointer->nextQtdPointer = EHCI_HOST_T_INVALID_VALUE; /* invalid next qtd */ + vltQhPointer->nextQtdPointer = EHCI_HOST_T_INVALID_VALUE; /* invalid next qtd */ vltQhPointer->transferOverlayResults[0] &= (~EHCI_HOST_QTD_STATUS_MASK); /* clear error status */ - if (needStop) + if (0U != needStop) { USB_HostEhciStartAsync(ehciInstance); } } /* remove transfer from the QH transfer list */ - transfer = vltQhPointer->ehciTransferHead; - vltQhPointer->ehciTransferHead = vltQhPointer->ehciTransferTail = NULL; + transfer = vltQhPointer->ehciTransferHead; + vltQhPointer->ehciTransferTail = NULL; + vltQhPointer->ehciTransferHead = NULL; USB_HostEhciUnlock(); /* release qtd and transfer callback*/ @@ -2210,8 +2225,9 @@ static usb_status_t USB_HostEhciQhQtdListDeinit(usb_host_ehci_instance_t *ehciIn USB_HostEhciQtdListRelease(ehciInstance, (usb_host_ehci_qtd_t *)(transfer->union1.unitHead), (usb_host_ehci_qtd_t *)(transfer->union2.unitTail)); transfer->transferSofar = (transfer->transferLength < transfer->transferSofar) ? - 0 : + 0U : (transfer->transferLength - transfer->transferSofar); + /* callback function is different from the current condition */ transfer->callbackFn(transfer->callbackParam, transfer, kStatus_USB_TransferCancel); transfer = nextTransfer; } @@ -2233,13 +2249,14 @@ static usb_status_t USB_HostEhciTransferQtdListDeinit(usb_host_ehci_instance_t * USB_HostEhciLock(); /* this API is called from APP, the host task may occupy to access the same resource */ /* remove qtd from qh */ - qhNextQtdValue = (uint32_t)vltQhPointer->currentQtdPointer; + qhNextQtdValue = (uint32_t)vltQhPointer->currentQtdPointer; qtdPointerEntry = *((uint32_t *)qhNextQtdValue + 2); /* note: qtdPointerEntry means qtd status */ - if ((qhNextQtdValue & EHCI_HOST_T_INVALID_VALUE) || (!(qtdPointerEntry & EHCI_HOST_QTD_STATUS_ACTIVE_MASK))) + if ((0U != (qhNextQtdValue & EHCI_HOST_T_INVALID_VALUE)) || + (0U == (qtdPointerEntry & EHCI_HOST_QTD_STATUS_ACTIVE_MASK))) { qhNextQtdValue = (uint32_t)vltQhPointer->nextQtdPointer; } - if (!(qhNextQtdValue & EHCI_HOST_T_INVALID_VALUE)) /* there is pending qtd in the qh */ + if (0U == (qhNextQtdValue & EHCI_HOST_T_INVALID_VALUE)) /* there is pending qtd in the qh */ { /* this qh don't schedule temporarily */ if (ehciPipePointer->pipeCommon.pipeType != USB_ENDPOINT_INTERRUPT) @@ -2255,11 +2272,11 @@ static usb_status_t USB_HostEhciTransferQtdListDeinit(usb_host_ehci_instance_t * /* remove qtd from qh one by one */ qtdPointerEntry = transfer->union1.unitHead; - while (1) + while (1U == 1U) { /* search qh's qtd list for qtdPointerEntry */ searchQtdEntryPointer = &qhNextQtdValue; - while (!((*searchQtdEntryPointer) & EHCI_HOST_T_INVALID_VALUE)) + while (0U == ((*searchQtdEntryPointer) & EHCI_HOST_T_INVALID_VALUE)) { if ((*searchQtdEntryPointer) == qtdPointerEntry) { @@ -2306,13 +2323,15 @@ static usb_status_t USB_HostEhciTransferQtdListDeinit(usb_host_ehci_instance_t * transfer->transferSofar = USB_HostEhciQtdListRelease(ehciInstance, (usb_host_ehci_qtd_t *)(transfer->union1.unitHead), (usb_host_ehci_qtd_t *)(transfer->union2.unitTail)); - transfer->transferSofar = - (transfer->transferLength < transfer->transferSofar) ? 0 : (transfer->transferLength - transfer->transferSofar); + transfer->transferSofar = (transfer->transferLength < transfer->transferSofar) ? + 0U : + (transfer->transferLength - transfer->transferSofar); + /* callback function is different from the current condition */ transfer->callbackFn(transfer->callbackParam, transfer, kStatus_USB_TransferCancel); /* start this qh schedule */ vltQhPointer->transferOverlayResults[0] &= (~EHCI_HOST_QTD_STATUS_MASK); /* clear error status */ - if ((qhNextQtdValue != 0) && (!(qhNextQtdValue & EHCI_HOST_T_INVALID_VALUE))) + if ((qhNextQtdValue != 0U) && (0U == (qhNextQtdValue & EHCI_HOST_T_INVALID_VALUE))) { vltQhPointer->nextQtdPointer = qhNextQtdValue; } @@ -2323,9 +2342,14 @@ static usb_status_t USB_HostEhciTransferQtdListDeinit(usb_host_ehci_instance_t * static usb_status_t USB_HostEhciQhInit(usb_host_ehci_instance_t *ehciInstance, usb_host_ehci_pipe_t *ehciPipePointer) { usb_host_ehci_qh_t *qhPointer = NULL; - uint32_t address, speed, portNumber, hubNumber; - uint32_t controlBits1 = 0; - uint32_t controlBits2 = 0; + uint32_t address = 0; + uint32_t speed = 0; + uint32_t portNumber = 0; + uint32_t hubNumber = 0; + ; + uint32_t controlBits1 = 0U; + uint32_t controlBits2 = 0U; + /* get qh */ USB_HostEhciLock(); if (ehciInstance->ehciQhList != NULL) @@ -2345,26 +2369,27 @@ static usb_status_t USB_HostEhciQhInit(usb_host_ehci_instance_t *ehciInstance, u ehciPipePointer->ehciQh = (void *)qhPointer; /* initialize qh */ - USB_HostEhciZeroMem((uint32_t *)qhPointer, sizeof(usb_host_ehci_qh_t) / 4); - qhPointer->horizontalLinkPointer = EHCI_HOST_T_INVALID_VALUE; - qhPointer->currentQtdPointer = EHCI_HOST_T_INVALID_VALUE; - qhPointer->nextQtdPointer = EHCI_HOST_T_INVALID_VALUE; + USB_HostEhciZeroMem((void *)qhPointer, sizeof(usb_host_ehci_qh_t) / 4U); + qhPointer->horizontalLinkPointer = EHCI_HOST_T_INVALID_VALUE; + qhPointer->currentQtdPointer = EHCI_HOST_T_INVALID_VALUE; + qhPointer->nextQtdPointer = EHCI_HOST_T_INVALID_VALUE; qhPointer->alternateNextQtdPointer = EHCI_HOST_T_INVALID_VALUE; - qhPointer->ehciPipePointer = ehciPipePointer; - qhPointer->timeOutLabel = 0; - qhPointer->timeOutValue = USB_HOST_EHCI_CONTROL_BULK_TIME_OUT_VALUE; - USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, kUSB_HostGetDeviceSpeed, &speed); + qhPointer->ehciPipePointer = ehciPipePointer; + qhPointer->timeOutLabel = 0; + qhPointer->timeOutValue = USB_HOST_EHCI_CONTROL_BULK_TIME_OUT_VALUE; + (void)USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, + (uint32_t)kUSB_HostGetDeviceSpeed, &speed); /* initialize staticEndpointStates[0] */ if (ehciPipePointer->pipeCommon.pipeType == USB_ENDPOINT_INTERRUPT) { /* Software should set the RL field to zero if the queue head is an interrupt endpoint. */ - controlBits1 |= ((0U << EHCI_HOST_QH_RL_SHIFT) & EHCI_HOST_QH_RL_MASK); + controlBits1 |= ((0UL << EHCI_HOST_QH_RL_SHIFT) & EHCI_HOST_QH_RL_MASK); } else { - if (ehciPipePointer->pipeCommon.nakCount >= 16) + if (ehciPipePointer->pipeCommon.nakCount >= 16U) { - controlBits1 |= ((15U << EHCI_HOST_QH_RL_SHIFT) & EHCI_HOST_QH_RL_MASK); + controlBits1 |= ((15UL << EHCI_HOST_QH_RL_SHIFT) & EHCI_HOST_QH_RL_MASK); } else { @@ -2376,15 +2401,15 @@ static usb_status_t USB_HostEhciQhInit(usb_host_ehci_instance_t *ehciInstance, u { if (speed != USB_SPEED_HIGH) { - controlBits1 |= (1 << EHCI_HOST_QH_C_SHIFT); + controlBits1 |= (1UL << EHCI_HOST_QH_C_SHIFT); } - controlBits1 |= (1 << EHCI_HOST_QH_DTC_SHIFT); + controlBits1 |= (1UL << EHCI_HOST_QH_DTC_SHIFT); } controlBits1 |= ((uint32_t)ehciPipePointer->pipeCommon.maxPacketSize << EHCI_HOST_QH_MAX_PACKET_LENGTH_SHIFT); controlBits1 |= (speed << EHCI_HOST_QH_EPS_SHIFT); controlBits1 |= ((uint32_t)ehciPipePointer->pipeCommon.endpointAddress << EHCI_HOST_QH_ENDPT_SHIFT); - USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, kUSB_HostGetDeviceAddress, - &address); + (void)USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, + (uint32_t)kUSB_HostGetDeviceAddress, &address); controlBits1 |= (address << EHCI_HOST_QH_DEVICE_ADDRESS_SHIFT); qhPointer->staticEndpointStates[0] = controlBits1; if (speed == USB_SPEED_HIGH) @@ -2393,22 +2418,22 @@ static usb_status_t USB_HostEhciQhInit(usb_host_ehci_instance_t *ehciInstance, u } else { - controlBits2 |= (0x00000001U << EHCI_HOST_QH_MULT_SHIFT); + controlBits2 |= (0x00000001UL << EHCI_HOST_QH_MULT_SHIFT); } /*initialize staticEndpointStates[1] */ if (speed != USB_SPEED_HIGH) { - USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, kUSB_HostGetDeviceHSHubNumber, - &hubNumber); - USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, kUSB_HostGetDeviceHSHubPort, - &portNumber); + (void)USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, + (uint32_t)kUSB_HostGetDeviceHSHubNumber, &hubNumber); + (void)USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, + (uint32_t)kUSB_HostGetDeviceHSHubPort, &portNumber); } else { - USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, kUSB_HostGetDeviceHubNumber, - &hubNumber); - USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, kUSB_HostGetDevicePortNumber, - &portNumber); + (void)USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, + (uint32_t)kUSB_HostGetDeviceHubNumber, &hubNumber); + (void)USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, + (uint32_t)kUSB_HostGetDevicePortNumber, &portNumber); } controlBits2 |= (portNumber << EHCI_HOST_QH_PORT_NUMBER_SHIFT); controlBits2 |= (hubNumber << EHCI_HOST_QH_HUB_ADDR_SHIFT); @@ -2425,12 +2450,12 @@ static usb_status_t USB_HostEhciQhDeinit(usb_host_ehci_instance_t *ehciInstance, qhPointer = (usb_host_ehci_qh_t *)ehciPipePointer->ehciQh; /* de-initialize qtd from qh */ - USB_HostEhciQhQtdListDeinit(ehciInstance, ehciPipePointer); + (void)USB_HostEhciQhQtdListDeinit(ehciInstance, ehciPipePointer); /* release QH */ USB_HostEhciLock(); qhPointer->horizontalLinkPointer = (uint32_t)ehciInstance->ehciQhList; - ehciInstance->ehciQhList = qhPointer; + ehciInstance->ehciQhList = qhPointer; USB_HostEhciUnlock(); return kStatus_USB_Success; @@ -2443,17 +2468,19 @@ static void USB_HostEhciAddQhToFrame(usb_host_ehci_instance_t *ehciInstance, { volatile uint32_t *frameEntryPointer; uint32_t frameEntryValue; + void *temp; /* search for the inserting point by interval */ - frameEntryPointer = (volatile uint32_t *)(&((uint32_t *)ehciInstance->ehciFrameList)[framePos]); - while (frameEntryPointer) + temp = (void *)ehciInstance->ehciFrameList; + frameEntryPointer = (volatile uint32_t *)(&((uint32_t *)temp)[framePos]); + while (NULL != frameEntryPointer) { frameEntryValue = *frameEntryPointer; - if (frameEntryValue & EHCI_HOST_T_INVALID_VALUE) + if (0U != (frameEntryValue & EHCI_HOST_T_INVALID_VALUE)) { /* insert into the end */ *((uint32_t *)entryPointerValue) = EHCI_HOST_T_INVALID_VALUE; - *frameEntryPointer = (entryPointerValue | EHCI_HOST_POINTER_TYPE_QH); + *frameEntryPointer = (entryPointerValue | EHCI_HOST_POINTER_TYPE_QH); break; } @@ -2467,7 +2494,7 @@ static void USB_HostEhciAddQhToFrame(usb_host_ehci_instance_t *ehciInstance, { /* insert into this point */ *((uint32_t *)entryPointerValue) = frameEntryValue; - *frameEntryPointer = (entryPointerValue | EHCI_HOST_POINTER_TYPE_QH); + *frameEntryPointer = (entryPointerValue | EHCI_HOST_POINTER_TYPE_QH); return; } else @@ -2483,14 +2510,15 @@ static void USB_HostEhciRemoveFromFrame(usb_host_ehci_instance_t *ehciInstance, { volatile uint32_t *frameEntryPointer; uint32_t frameEntryValue; - + void *temp; /* search for the qh/itd/sitd entry */ - frameEntryPointer = (volatile uint32_t *)(&((uint32_t *)ehciInstance->ehciFrameList)[framePos]); + temp = (void *)ehciInstance->ehciFrameList; + frameEntryPointer = (volatile uint32_t *)(&((uint32_t *)temp)[framePos]); - while (frameEntryPointer) + while (NULL != frameEntryPointer) { frameEntryValue = *frameEntryPointer; - if (frameEntryValue & EHCI_HOST_T_INVALID_VALUE) + if (0U != (frameEntryValue & EHCI_HOST_T_INVALID_VALUE)) { return; } @@ -2517,53 +2545,71 @@ static void USB_HostEhciLinkSitd(usb_host_ehci_instance_t *ehciInstance, usb_host_ehci_sitd_t *sitdPointer; uint32_t distance; uint32_t frameInterval; - int32_t shouldLinkFrame; - int32_t currentFrame; + uint32_t shouldLinkFrame; + uint32_t currentFrame; + void *temp; - frameInterval = (ehciPipePointer->uframeInterval >> 3); + frameInterval = ((uint32_t)ehciPipePointer->uframeInterval >> 3U); - if (isoPointer->lastLinkFrame == 0xFFFF) /* first link */ + if (isoPointer->lastLinkFrame == 0xFFFFU) /* first link */ { - currentFrame = ((ehciInstance->ehciIpBase->FRINDEX & EHCI_MAX_UFRAME_VALUE) >> 3); + currentFrame = ((ehciInstance->ehciIpBase->FRINDEX & USB_HOST_EHCI_MAX_MICRFRAME_VALUE) >> 3U); currentFrame = ((uint32_t)(currentFrame + USB_HOST_EHCI_ISO_BOUNCE_FRAME_NUMBER) & - (EHCI_MAX_UFRAME_VALUE >> 3)); /* add USB_HOST_EHCI_ISO_BOUNCE_FRAME_NUMBER */ + (USB_HOST_EHCI_MAX_MICRFRAME_VALUE >> 3U)); /* add USB_HOST_EHCI_ISO_BOUNCE_FRAME_NUMBER */ /* frame should align with interval */ - currentFrame -= ehciPipePointer->startFrame; - currentFrame = - ((uint32_t)(currentFrame + frameInterval - 1) & (~(frameInterval - 1))); /* frameInterval is power of 2 */ - currentFrame += ehciPipePointer->startFrame; + if (currentFrame <= ehciPipePointer->startFrame) + { + currentFrame = ehciPipePointer->startFrame; + } + else + { + currentFrame -= ehciPipePointer->startFrame; + currentFrame = ((currentFrame + frameInterval - 1U) & (~(frameInterval - 1U))); + currentFrame += ehciPipePointer->startFrame; + } } else { shouldLinkFrame = isoPointer->lastLinkFrame + frameInterval; /* continuous next should link frame */ - if (shouldLinkFrame > (int32_t)(EHCI_MAX_UFRAME_VALUE >> 3)) + if (shouldLinkFrame > USB_HOST_EHCI_MAX_MICRFRAME_VALUE >> 3U) { - shouldLinkFrame = shouldLinkFrame - ((EHCI_MAX_UFRAME_VALUE >> 3) + 1); + shouldLinkFrame = shouldLinkFrame - ((USB_HOST_EHCI_MAX_MICRFRAME_VALUE >> 3U) + 1U); } - currentFrame = ((ehciInstance->ehciIpBase->FRINDEX & EHCI_MAX_UFRAME_VALUE) >> 3); - distance = ((shouldLinkFrame - currentFrame + (EHCI_MAX_UFRAME_VALUE >> 3) + 1) & - (EHCI_MAX_UFRAME_VALUE >> 3)); /* get the distance from shouldLinkFrame to currentFrame */ + currentFrame = ((ehciInstance->ehciIpBase->FRINDEX & USB_HOST_EHCI_MAX_MICRFRAME_VALUE) >> 3U); + distance = + ((shouldLinkFrame + (USB_HOST_EHCI_MAX_MICRFRAME_VALUE >> 3U) + 1U - currentFrame) & + (USB_HOST_EHCI_MAX_MICRFRAME_VALUE >> 3)); /* get the distance from shouldLinkFrame to currentFrame */ /* shouldLinkFrame has add frameInterval, think about the align with interval, so here add (frameInterval * * 2) */ - if ((distance <= (USB_HOST_EHCI_ISO_BOUNCE_FRAME_NUMBER + frameInterval * 2)) && (distance > 0)) + if ((distance <= + (USB_HOST_EHCI_ISO_BOUNCE_FRAME_NUMBER + frameInterval * USB_HOST_EHCI_ISO_MAX_CONTINUOUS_TRANSFER)) && + (distance > 0U)) { currentFrame = shouldLinkFrame; } else /* re-link */ { currentFrame = - ((uint32_t)(currentFrame + USB_HOST_EHCI_ISO_BOUNCE_FRAME_NUMBER) & (EHCI_MAX_UFRAME_VALUE >> 3)); - if (currentFrame > (int32_t)(EHCI_MAX_UFRAME_VALUE >> 3)) + ((currentFrame + USB_HOST_EHCI_ISO_BOUNCE_FRAME_NUMBER) & (USB_HOST_EHCI_MAX_MICRFRAME_VALUE >> 3)); + + /*if (currentFrame > (USB_HOST_EHCI_MAX_MICRFRAME_VALUE >> 3)) { - currentFrame = currentFrame - ((EHCI_MAX_UFRAME_VALUE >> 3) + 1); - } + currentFrame = currentFrame - ((USB_HOST_EHCI_MAX_MICRFRAME_VALUE >> 3) + 1U); + }*/ /* frame should align with interval */ - currentFrame -= ehciPipePointer->startFrame; - currentFrame = ((uint32_t)(currentFrame + frameInterval - 1) & (~(frameInterval - 1))); - currentFrame += ehciPipePointer->startFrame; + if (currentFrame <= ehciPipePointer->startFrame) + { + currentFrame = ehciPipePointer->startFrame; + } + else + { + currentFrame -= ehciPipePointer->startFrame; + currentFrame = ((currentFrame + frameInterval - 1U) & (~(frameInterval - 1U))); + currentFrame += ehciPipePointer->startFrame; + } } } - if (currentFrame >= (int32_t)USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE) /* frame turn around */ + if (currentFrame >= USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE) /* frame turn around */ { shouldLinkFrame = (currentFrame - USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE); /* shouldLinkFrame means inserted frame position */ @@ -2574,14 +2620,14 @@ static void USB_HostEhciLinkSitd(usb_host_ehci_instance_t *ehciInstance, } sitdPointer = (usb_host_ehci_sitd_t *)startEntryPointer; - while (sitdPointer) + while (NULL != sitdPointer) { - sitdPointer->frameEntryIndex = shouldLinkFrame; + sitdPointer->frameEntryIndex = (uint16_t)shouldLinkFrame; /* add to frame list head */ - sitdPointer->nextLinkPointer = ((uint32_t *)ehciInstance->ehciFrameList)[shouldLinkFrame]; - ((uint32_t *)ehciInstance->ehciFrameList)[shouldLinkFrame] = - ((uint32_t)sitdPointer | EHCI_HOST_POINTER_TYPE_SITD); - if (sitdPointer->nextSitdIndex == 0xFF) /* 0xFF is invalid value */ + temp = (void *)ehciInstance->ehciFrameList; + sitdPointer->nextLinkPointer = ((uint32_t *)temp)[shouldLinkFrame]; + ((uint32_t *)temp)[shouldLinkFrame] = ((uint32_t)sitdPointer | EHCI_HOST_POINTER_TYPE_SITD); + if (sitdPointer->nextSitdIndex == 0xFFU) /* 0xFF is invalid value */ { break; } @@ -2589,17 +2635,17 @@ static void USB_HostEhciLinkSitd(usb_host_ehci_instance_t *ehciInstance, shouldLinkFrame += frameInterval; currentFrame += frameInterval; - if (shouldLinkFrame >= (int32_t)USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE) + if (shouldLinkFrame >= USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE) { shouldLinkFrame = (shouldLinkFrame - USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE); } } - if (currentFrame > (int32_t)(EHCI_MAX_UFRAME_VALUE >> 3)) + if (currentFrame > (USB_HOST_EHCI_MAX_MICRFRAME_VALUE >> 3)) { - currentFrame = currentFrame - ((EHCI_MAX_UFRAME_VALUE >> 3) + 1); + currentFrame = currentFrame - ((USB_HOST_EHCI_MAX_MICRFRAME_VALUE >> 3) + 1U); } - isoPointer->lastLinkFrame = currentFrame; /* save the last link frame value */ + isoPointer->lastLinkFrame = (uint16_t)currentFrame; /* save the last link frame value */ } static usb_status_t USB_HostEhciSitdArrayInit(usb_host_ehci_instance_t *ehciInstance, @@ -2612,33 +2658,35 @@ static usb_status_t USB_HostEhciSitdArrayInit(usb_host_ehci_instance_t *ehciInst uint32_t dataLength = 0; uint32_t sitdLength = 0; uint32_t dataBufferValue; - uint32_t hubNumber; - uint32_t portNumber; - uint32_t address; + uint32_t hubNumber = 0U; + uint32_t portNumber = 0U; + uint32_t address = 0U; uint32_t tmp; - uint8_t index; + uint32_t *temp; + uint32_t index; + int32_t tempIndex; + (void)USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, + (uint32_t)kUSB_HostGetDeviceAddress, &address); - USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, kUSB_HostGetDeviceAddress, - &address); - - sitdNumber = ((transfer->transferLength - 1 + (ehciPipePointer->pipeCommon.maxPacketSize)) / + sitdNumber = ((transfer->transferLength - 1U + (ehciPipePointer->pipeCommon.maxPacketSize)) / (ehciPipePointer->pipeCommon.maxPacketSize)); /* get sitd array */ - tmp = ehciPipePointer - ehciInstance->ehciPipeIndexBase; /* pipe index */ /* USB_HostEhciLock(); */ if (ehciInstance->ehciSitdNumber >= sitdNumber) { - sitdPointer = ehciInstance->ehciSitdList; + sitdPointer = ehciInstance->ehciSitdList; transfer->union1.unitHead = (uint32_t)sitdPointer; - for (index = 1; index < sitdNumber; ++index) + for (index = 1U; index < sitdNumber; ++index) { - sitdPointer->nextSitdIndex = - (((usb_host_ehci_sitd_t *)sitdPointer->nextLinkPointer) - ehciInstance->ehciSitdIndexBase); - sitdPointer = (usb_host_ehci_sitd_t *)sitdPointer->nextLinkPointer; + /*misra 10.8*/ + tempIndex = (((usb_host_ehci_sitd_t *)(sitdPointer->nextLinkPointer & 0xFFFFFFFEU)) - + ehciInstance->ehciSitdIndexBase); + sitdPointer->nextSitdIndex = (uint8_t)tempIndex; + sitdPointer = (usb_host_ehci_sitd_t *)(sitdPointer->nextLinkPointer & 0xFFFFFFFEU); } sitdPointer->nextSitdIndex = 0xFF; - ehciInstance->ehciSitdList = (usb_host_ehci_sitd_t *)sitdPointer->nextLinkPointer; - ehciInstance->ehciSitdNumber -= sitdNumber; + ehciInstance->ehciSitdList = (usb_host_ehci_sitd_t *)(sitdPointer->nextLinkPointer & 0xFFFFFFFEU); + ehciInstance->ehciSitdNumber -= (uint8_t)sitdNumber; } else { @@ -2648,15 +2696,16 @@ static usb_status_t USB_HostEhciSitdArrayInit(usb_host_ehci_instance_t *ehciInst /* USB_HostEhciUnlock(); */ transfer->union2.unitTail = (uint32_t)sitdPointer; /* initialize sitd array */ - USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, kUSB_HostGetDeviceHubNumber, - &hubNumber); - USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, kUSB_HostGetDevicePortNumber, - &portNumber); + (void)USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, + (uint32_t)kUSB_HostGetDeviceHubNumber, &hubNumber); + (void)USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, + (uint32_t)kUSB_HostGetDevicePortNumber, &portNumber); sitdPointer = (usb_host_ehci_sitd_t *)transfer->union1.unitHead; - dataLength = transfer->transferLength; - while (sitdNumber--) + dataLength = transfer->transferLength; + while (0U != sitdNumber) { - USB_HostEhciZeroMem((uint32_t *)sitdPointer, 7); + sitdNumber--; + USB_HostEhciZeroMem((void *)sitdPointer, 7); sitdLength = dataLength; if (sitdLength > ehciPipePointer->pipeCommon.maxPacketSize) { @@ -2665,7 +2714,7 @@ static usb_status_t USB_HostEhciSitdArrayInit(usb_host_ehci_instance_t *ehciInst dataBufferValue = (uint32_t)(transfer->transferBuffer + (transfer->transferLength - dataLength)); dataLength -= sitdLength; /* update left data length */ sitdPointer->transferResults[1] = dataBufferValue; - sitdPointer->transferResults[2] = ((dataBufferValue + 4 * 1024) & 0xFFFFF000U); + sitdPointer->transferResults[2] = ((dataBufferValue + 4U * 1024U) & 0xFFFFF000U); sitdPointer->endpointStates[0] = (((uint32_t)ehciPipePointer->pipeCommon.direction << EHCI_HOST_SITD_DIRECTION_SHIFT) | (portNumber << EHCI_HOST_SITD_PORT_NUMBER_SHIFT) | (hubNumber << EHCI_HOST_SITD_HUB_ADDR_SHIFT) | @@ -2679,14 +2728,14 @@ static usb_status_t USB_HostEhciSitdArrayInit(usb_host_ehci_instance_t *ehciInst sitdPointer->endpointStates[1] = (((uint32_t)ehciPipePointer->uframeCmask << EHCI_HOST_SITD_CMASK_SHIFT) | ((uint32_t)ehciPipePointer->uframeSmask << EHCI_HOST_SITD_SMASK_SHIFT)); - tmp = (sitdLength + 187) / 188; - if (tmp > 1) + tmp = (sitdLength + 187U) / 188U; + if (tmp > 1U) { - sitdPointer->transferResults[2] |= (0x01 << EHCI_HOST_SITD_TP_SHIFT); /* for iso split */ + sitdPointer->transferResults[2] |= (0x01U << EHCI_HOST_SITD_TP_SHIFT); /* for iso split */ } else { - sitdPointer->transferResults[2] |= (0x00 << EHCI_HOST_SITD_TP_SHIFT); /* for iso split */ + sitdPointer->transferResults[2] |= (0x00U << EHCI_HOST_SITD_TP_SHIFT); /* for iso split */ } sitdPointer->transferResults[2] |= (tmp << EHCI_HOST_SITD_TCOUNT_SHIFT); /* for iso split */ } @@ -2696,26 +2745,29 @@ static usb_status_t USB_HostEhciSitdArrayInit(usb_host_ehci_instance_t *ehciInst sitdPointer = (ehciInstance->ehciSitdIndexBase + sitdPointer->nextSitdIndex); } sitdPointer = (usb_host_ehci_sitd_t *)transfer->union2.unitTail; - sitdPointer->transferResults[0] |= (1U << EHCI_HOST_SITD_IOC_SHIFT); /* last set IOC */ + sitdPointer->transferResults[0] |= (1UL << EHCI_HOST_SITD_IOC_SHIFT); /* last set IOC */ /* link transfer to usb_host_ehci_iso_t transfer list */ isoPointer = (usb_host_ehci_iso_t *)ehciPipePointer->ehciQh; USB_HostEhciLock(); if (isoPointer->ehciTransferHead == NULL) { - transfer->next = NULL; - isoPointer->ehciTransferHead = isoPointer->ehciTransferTail = transfer; + transfer->next = NULL; + isoPointer->ehciTransferTail = transfer; + isoPointer->ehciTransferHead = transfer; } else { - transfer->next = NULL; + transfer->next = NULL; isoPointer->ehciTransferTail->next = transfer; - isoPointer->ehciTransferTail = transfer; + isoPointer->ehciTransferTail = transfer; } USB_HostEhciUnlock(); /* link itd to frame list (note: initialize frameEntryIndex)*/ - USB_HostEhciLinkSitd(ehciInstance, ehciPipePointer, (void *)transfer->union1.unitHead); + /*misra 11.6*/ + temp = (uint32_t *)(transfer->union1.unitHead); + USB_HostEhciLinkSitd(ehciInstance, ehciPipePointer, (void *)temp); return kStatus_USB_Success; } @@ -2725,9 +2777,9 @@ static uint32_t USB_HostEhciSitdArrayRelease(usb_host_ehci_instance_t *ehciInsta usb_host_ehci_sitd_t *endSitdPointer) { usb_host_ehci_sitd_t *sitdPointer = startSitdPointer; - uint32_t leftLength = 0; + uint32_t leftLength = 0; /* remove itd from frame list */ - while (1) + while (1U == 1U) { /* record the transfer's result length */ leftLength += @@ -2737,8 +2789,9 @@ static uint32_t USB_HostEhciSitdArrayRelease(usb_host_ehci_instance_t *ehciInsta /* release itd */ /* USB_HostEhciLock(); */ - sitdPointer->nextLinkPointer = (uint32_t)ehciInstance->ehciSitdList; - ehciInstance->ehciSitdList = sitdPointer; + /*set next link pointer to invalid in case hardware access invalid sitd structure in special case*/ + sitdPointer->nextLinkPointer = (((uint32_t)ehciInstance->ehciSitdList) | EHCI_HOST_T_INVALID_VALUE); + ehciInstance->ehciSitdList = sitdPointer; ehciInstance->ehciSitdNumber++; /* USB_HostEhciUnlock(); */ @@ -2762,8 +2815,9 @@ static usb_status_t USB_HostEhciSitdArrayDeinit(usb_host_ehci_instance_t *ehciIn /* firstly remove the transfer (because host task may occupy to access the resource) */ USB_HostEhciLock(); - transfer = isoPointer->ehciTransferHead; - isoPointer->ehciTransferHead = isoPointer->ehciTransferTail = NULL; + transfer = isoPointer->ehciTransferHead; + isoPointer->ehciTransferTail = NULL; + isoPointer->ehciTransferHead = NULL; USB_HostEhciUnlock(); while (transfer != NULL) @@ -2774,7 +2828,7 @@ static usb_status_t USB_HostEhciSitdArrayDeinit(usb_host_ehci_instance_t *ehciIn transfer->transferLength - USB_HostEhciSitdArrayRelease(ehciInstance, (usb_host_ehci_sitd_t *)transfer->union1.unitHead, (usb_host_ehci_sitd_t *)transfer->union2.unitTail); - /* transfer callback */ + /* callback function is different from the current condition */ transfer->callbackFn(transfer->callbackParam, transfer, kStatus_USB_TransferCancel); /* next transfer */ transfer = nextTransfer; @@ -2790,50 +2844,66 @@ static uint32_t USB_HostEhciGetItdLinkFrame(usb_host_ehci_instance_t *ehciInstan uint16_t startUframe, uint16_t uframeInterval) { - int32_t shouldLinkUframe; - int32_t currentUframe; - int32_t distance; + uint32_t shouldLinkUframe; + uint32_t currentUframe; + uint32_t distance; - if (lastLinkUframe != 0xFFFF) + if (lastLinkUframe != 0xFFFFU) { shouldLinkUframe = lastLinkUframe + uframeInterval; - if (shouldLinkUframe > (int32_t)EHCI_MAX_UFRAME_VALUE) + if (shouldLinkUframe > USB_HOST_EHCI_MAX_MICRFRAME_VALUE) { - shouldLinkUframe = shouldLinkUframe - (EHCI_MAX_UFRAME_VALUE + 1); + shouldLinkUframe = shouldLinkUframe - (USB_HOST_EHCI_MAX_MICRFRAME_VALUE + 1U); } - currentUframe = (ehciInstance->ehciIpBase->FRINDEX & EHCI_MAX_UFRAME_VALUE); - distance = ((shouldLinkUframe - currentUframe + EHCI_MAX_UFRAME_VALUE + 1) & - EHCI_MAX_UFRAME_VALUE); /* get the distance */ + currentUframe = (ehciInstance->ehciIpBase->FRINDEX & USB_HOST_EHCI_MAX_MICRFRAME_VALUE); + distance = ((shouldLinkUframe + USB_HOST_EHCI_MAX_MICRFRAME_VALUE + 1U - currentUframe) & + USB_HOST_EHCI_MAX_MICRFRAME_VALUE); /* get the distance */ /* shouldLinkUframe has add uframeInterval, think about the align with interval, so here add (uframeInterval * * 2) */ - if ((distance <= (int32_t)(USB_HOST_EHCI_ISO_BOUNCE_UFRAME_NUMBER + (uframeInterval * 2))) && (distance > 2)) + if ((distance <= ((uint32_t)USB_HOST_EHCI_ISO_BOUNCE_UFRAME_NUMBER + + ((uint32_t)uframeInterval * USB_HOST_EHCI_ISO_MAX_CONTINUOUS_TRANSFER))) && + (distance > 2U)) { currentUframe = shouldLinkUframe; } else /* re-link */ { currentUframe = - ((uint32_t)(currentUframe + USB_HOST_EHCI_ISO_BOUNCE_UFRAME_NUMBER) & EHCI_MAX_UFRAME_VALUE); - if (currentUframe > (int32_t)EHCI_MAX_UFRAME_VALUE) + ((currentUframe + USB_HOST_EHCI_ISO_BOUNCE_UFRAME_NUMBER) & USB_HOST_EHCI_MAX_MICRFRAME_VALUE); + /*if (currentUframe > USB_HOST_EHCI_MAX_MICRFRAME_VALUE) { - currentUframe = currentUframe - (EHCI_MAX_UFRAME_VALUE + 1); - } + currentUframe = currentUframe - (USB_HOST_EHCI_MAX_MICRFRAME_VALUE + 1U); + }*/ /* uframe should align with interval */ - currentUframe -= startUframe; - currentUframe = ((uint32_t)(currentUframe + uframeInterval - 1) & - (~((uint32_t)uframeInterval - 1))); /* uframeInterval is power of 2 */ - currentUframe += startUframe; + if (currentUframe <= startUframe) + { + currentUframe = startUframe; + } + else + { + currentUframe -= startUframe; + currentUframe = ((uint32_t)(currentUframe + uframeInterval) & + (~((uint32_t)uframeInterval - 1U))); /* uframeInterval is power of 2 */ + currentUframe += startUframe; + } } } else { - currentUframe = (ehciInstance->ehciIpBase->FRINDEX & EHCI_MAX_UFRAME_VALUE); - currentUframe = ((uint32_t)(currentUframe + USB_HOST_EHCI_ISO_BOUNCE_UFRAME_NUMBER) & EHCI_MAX_UFRAME_VALUE); + currentUframe = (ehciInstance->ehciIpBase->FRINDEX & USB_HOST_EHCI_MAX_MICRFRAME_VALUE); + currentUframe = ((currentUframe + USB_HOST_EHCI_ISO_BOUNCE_UFRAME_NUMBER) & USB_HOST_EHCI_MAX_MICRFRAME_VALUE); /* uframe should align with interval */ - currentUframe -= startUframe; - currentUframe = ((uint32_t)(currentUframe + uframeInterval - 1) & - (~((uint32_t)uframeInterval - 1))); /* uframeInterval is power of 2 */ - currentUframe += startUframe; + if (currentUframe <= startUframe) + { + currentUframe = startUframe; + } + else + { + currentUframe -= startUframe; + currentUframe = + ((currentUframe + uframeInterval) & (~(uframeInterval - 1U))); /* uframeInterval is power of 2 */ + currentUframe += startUframe; + } } return currentUframe; @@ -2845,27 +2915,29 @@ static usb_status_t USB_HostEhciItdArrayInit(usb_host_ehci_instance_t *ehciInsta { usb_host_ehci_iso_t *isoPointer; usb_host_ehci_itd_t *itdPointer = NULL; + usb_host_ehci_itd_t *itdHead = NULL; usb_host_ehci_itd_t *tmpItdPointer; uint32_t dataLength; /* the remaining data for sending */ uint32_t transactionLength; /* the initializing transaction descriptor data length */ uint32_t itdBufferValue; uint32_t itdBufferBaseValue; /* for calculating PG value */ - uint32_t address; + uint32_t address = 0U; uint32_t lastShouldLinkUframe; uint32_t linkUframe; - uint32_t minDataPerItd = ehciPipePointer->pipeCommon.numberPerUframe * ehciPipePointer->pipeCommon.maxPacketSize; + uint32_t minDataPerItd = + (uint32_t)ehciPipePointer->pipeCommon.numberPerUframe * ehciPipePointer->pipeCommon.maxPacketSize; uint8_t maxItdNumber; - uint8_t index = 0; + uint16_t index = 0; isoPointer = (usb_host_ehci_iso_t *)ehciPipePointer->ehciQh; - USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, kUSB_HostGetDeviceAddress, - &address); + (void)USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, + (uint32_t)kUSB_HostGetDeviceAddress, &address); /* max needed itd number, the actual needed number may be less because micro-frame interval may be less than 8 */ - maxItdNumber = ((transfer->transferLength - 1 + minDataPerItd) / minDataPerItd); - if (ehciPipePointer->uframeInterval < 8) + maxItdNumber = (uint8_t)((transfer->transferLength - 1U + minDataPerItd) / minDataPerItd); + if (ehciPipePointer->uframeInterval < 8U) { - maxItdNumber = ((maxItdNumber * ehciPipePointer->uframeInterval + 7) / 8) + 1; + maxItdNumber = (uint8_t)((maxItdNumber * ehciPipePointer->uframeInterval + 7U) / 8U) + 1U; } if (maxItdNumber > ehciInstance->ehciItdNumber) { @@ -2877,43 +2949,46 @@ static usb_status_t USB_HostEhciItdArrayInit(usb_host_ehci_instance_t *ehciInsta /* USB_HostEhciLock(); */ if (isoPointer->ehciTransferHead == NULL) { - isoPointer->ehciTransferHead = isoPointer->ehciTransferTail = transfer; + isoPointer->ehciTransferTail = transfer; + isoPointer->ehciTransferHead = transfer; } else { isoPointer->ehciTransferTail->next = transfer; - isoPointer->ehciTransferTail = transfer; + isoPointer->ehciTransferTail = transfer; } /* USB_HostEhciUnlock(); */ - dataLength = transfer->transferLength; - transfer->union1.unitHead = (uint32_t)NULL; + dataLength = transfer->transferLength; + transfer->union1.unitHead = 0U; /* get the link micro-frame */ lastShouldLinkUframe = USB_HostEhciGetItdLinkFrame( ehciInstance, isoPointer->lastLinkFrame, (uint16_t)((ehciPipePointer->startFrame << 3) + ehciPipePointer->startUframe), ehciPipePointer->uframeInterval); - if (lastShouldLinkUframe > EHCI_MAX_UFRAME_VALUE) + if (lastShouldLinkUframe > USB_HOST_EHCI_MAX_MICRFRAME_VALUE) { - linkUframe = lastShouldLinkUframe - (EHCI_MAX_UFRAME_VALUE + 1); + linkUframe = lastShouldLinkUframe - (USB_HOST_EHCI_MAX_MICRFRAME_VALUE + 1U); } else { linkUframe = lastShouldLinkUframe; } - while (dataLength) + itdHead = ehciInstance->ehciItdList; + while (0U != dataLength) { /* get one idle itd */ tmpItdPointer = ehciInstance->ehciItdList; - ehciInstance->ehciItdList = (usb_host_ehci_itd_t *)tmpItdPointer->nextLinkPointer; - ehciInstance->ehciItdNumber -= 1; if (tmpItdPointer == NULL) { return kStatus_USB_Error; /* this should not reach */ } + ehciInstance->ehciItdList = (usb_host_ehci_itd_t *)tmpItdPointer->nextItdPointer; + ehciInstance->ehciItdNumber -= 1U; + tmpItdPointer->nextItdPointer = NULL; /* use the itd */ - if (transfer->union1.unitHead == (uint32_t)NULL) /* first itd */ + if (transfer->union1.unitHead == 0U) /* first itd */ { transfer->union1.unitHead = (uint32_t)tmpItdPointer; } @@ -2924,11 +2999,11 @@ static usb_status_t USB_HostEhciItdArrayInit(usb_host_ehci_instance_t *ehciInsta itdPointer = tmpItdPointer; /* itd has been set to all zero when releasing */ - itdBufferBaseValue = itdBufferValue = - (uint32_t)(transfer->transferBuffer + (transfer->transferLength - dataLength)); - for (index = 0; index < 7; ++index) + itdBufferValue = (uint32_t)(transfer->transferBuffer + (transfer->transferLength - dataLength)); + itdBufferBaseValue = itdBufferValue; + for (index = 0; index < 7U; ++index) { - itdPointer->bufferPointers[index] = ((itdBufferBaseValue + (index * 4 * 1024)) & 0xFFFFF000U); + itdPointer->bufferPointers[index] = ((itdBufferBaseValue + ((uint32_t)index * 4U * 1024U)) & 0xFFFFF000U); } /* initialize iTD common fields */ itdPointer->bufferPointers[0] |= @@ -2939,7 +3014,7 @@ static usb_status_t USB_HostEhciItdArrayInit(usb_host_ehci_instance_t *ehciInsta ((uint32_t)ehciPipePointer->pipeCommon.maxPacketSize << EHCI_HOST_ITD_MAX_PACKET_SIZE_SHIFT)); itdPointer->bufferPointers[2] |= (ehciPipePointer->pipeCommon.numberPerUframe); /* initialize transaction descriptors */ - for (index = (linkUframe & 0x0007); index < 8; index += ehciPipePointer->uframeInterval) + for (index = (uint8_t)(linkUframe & 0x0007U); index < 8U; index += ehciPipePointer->uframeInterval) { transactionLength = ((dataLength > minDataPerItd) ? minDataPerItd : dataLength); /* initialize the uframeIndex's transaction descriptor in itd */ @@ -2951,7 +3026,7 @@ static usb_status_t USB_HostEhciItdArrayInit(usb_host_ehci_instance_t *ehciInsta (itdBufferValue & EHCI_HOST_ITD_TRANSACTION_OFFSET_MASK)); dataLength -= transactionLength; itdBufferValue += transactionLength; - if (dataLength <= 0) + if (dataLength <= 0U) { break; } @@ -2959,17 +3034,25 @@ static usb_status_t USB_HostEhciItdArrayInit(usb_host_ehci_instance_t *ehciInsta } transfer->union2.unitTail = (uint32_t)itdPointer; - itdPointer->transactions[index] |= (1 << EHCI_HOST_ITD_IOC_SHIFT); /* last set IOC */ + itdPointer->transactions[index] |= (1UL << EHCI_HOST_ITD_IOC_SHIFT); /* last set IOC */ + itdPointer = itdHead; /* link itd to frame list (note: initialize frameEntryIndex)*/ - while (itdPointer) + while (NULL != itdPointer) { - itdPointer->frameEntryIndex = linkUframe; - /* add to frame head */ - itdPointer->nextLinkPointer = ((uint32_t *)ehciInstance->ehciFrameList)[linkUframe >> 3]; - *(uint32_t *)((uint32_t *)ehciInstance->ehciFrameList)[linkUframe >> 3] = - ((uint32_t)itdPointer | EHCI_HOST_POINTER_TYPE_ITD); - itdPointer = itdPointer->nextItdPointer; + void *temp = (void *)ehciInstance->ehciFrameList; + uint32_t *linkPointer = &((uint32_t *)temp)[linkUframe >> 3]; + uint32_t linkValue = *linkPointer; + itdPointer->frameEntryIndex = linkUframe >> 3; + while ((0U == (linkValue & EHCI_HOST_T_INVALID_VALUE)) && + ((linkValue & EHCI_HOST_POINTER_TYPE_MASK) == EHCI_HOST_POINTER_TYPE_ITD)) + { + linkPointer = (uint32_t *)(linkValue & EHCI_HOST_POINTER_ADDRESS_MASK); + linkValue = *linkPointer; + } + itdPointer->nextLinkPointer = *linkPointer; + *linkPointer = ((uint32_t)itdPointer | EHCI_HOST_POINTER_TYPE_ITD); + itdPointer = itdPointer->nextItdPointer; if (itdPointer == NULL) { break; @@ -2983,11 +3066,11 @@ static usb_status_t USB_HostEhciItdArrayInit(usb_host_ehci_instance_t *ehciInsta } } - if (lastShouldLinkUframe > EHCI_MAX_UFRAME_VALUE) + if (lastShouldLinkUframe > USB_HOST_EHCI_MAX_MICRFRAME_VALUE) { - lastShouldLinkUframe = lastShouldLinkUframe - (EHCI_MAX_UFRAME_VALUE + 1); + lastShouldLinkUframe = lastShouldLinkUframe - (USB_HOST_EHCI_MAX_MICRFRAME_VALUE + 1U); } - isoPointer->lastLinkFrame = lastShouldLinkUframe; + isoPointer->lastLinkFrame = (uint16_t)lastShouldLinkUframe; return kStatus_USB_Success; } @@ -3001,23 +3084,24 @@ static uint32_t USB_HostEhciItdArrayRelease(usb_host_ehci_instance_t *ehciInstan uint32_t doneLength = 0; /* remove itd from frame list */ - while (1) + while (1U == 1U) { /* record the transfer's result length */ - for (index = 0; index < 8; ++index) + for (index = 0U; index < 8U; ++index) { doneLength += ((itdPointer->transactions[index] & EHCI_HOST_ITD_TRANSACTION_LEN_MASK) >> EHCI_HOST_ITD_TRANSACTION_LEN_SHIFT); } USB_HostEhciRemoveFromFrame(ehciInstance, (uint32_t)itdPointer, - itdPointer->frameEntryIndex); /* remove from the inserted frame list */ + (uint16_t)itdPointer->frameEntryIndex); /* remove from the inserted frame list */ /* release itd */ /* USB_HostEhciLock(); */ - USB_HostEhciZeroMem((uint32_t *)itdPointer, sizeof(usb_host_ehci_itd_t) >> 2); - itdPointer->nextLinkPointer = (uint32_t)ehciInstance->ehciItdList; - ehciInstance->ehciItdList = itdPointer; + /*set next link pointer to invalid in case hardware access invalid itd structure in special case*/ + itdPointer->nextLinkPointer = EHCI_HOST_T_INVALID_VALUE; + itdPointer->nextItdPointer = (usb_host_ehci_itd_t *)ehciInstance->ehciItdList; + ehciInstance->ehciItdList = itdPointer; ehciInstance->ehciItdNumber++; /* USB_HostEhciUnlock(); */ @@ -3041,14 +3125,15 @@ static usb_status_t USB_HostEhciItdArrayDeinit(usb_host_ehci_instance_t *ehciIns /* firstly remove the transfer (because host task may occupy to access the resource) */ USB_HostEhciLock(); - transfer = isoPointer->ehciTransferHead; - isoPointer->ehciTransferHead = isoPointer->ehciTransferTail = NULL; + transfer = isoPointer->ehciTransferHead; + isoPointer->ehciTransferTail = NULL; + isoPointer->ehciTransferHead = NULL; USB_HostEhciUnlock(); while (transfer != NULL) { nextTransfer = transfer->next; - doneLength = 0; + doneLength = 0; /* remove itd from frame list and release itd */ doneLength = USB_HostEhciItdArrayRelease(ehciInstance, (usb_host_ehci_itd_t *)transfer->union1.unitHead, (usb_host_ehci_itd_t *)transfer->union2.unitTail); @@ -3059,6 +3144,7 @@ static usb_status_t USB_HostEhciItdArrayDeinit(usb_host_ehci_instance_t *ehciIns doneLength = transfer->transferLength; } transfer->transferSofar = doneLength; + /* callback function is different from the current condition */ transfer->callbackFn(transfer->callbackParam, transfer, kStatus_USB_TransferCancel); /* next transfer */ @@ -3082,7 +3168,7 @@ static usb_status_t USB_HostEhciOpenControlBulk(usb_host_ehci_instance_t *ehciIn qhPointer = (usb_host_ehci_qh_t *)ehciPipePointer->ehciQh; /* add qh to async */ - qhPointer->horizontalLinkPointer = ehciInstance->shedFirstQh->horizontalLinkPointer; + qhPointer->horizontalLinkPointer = ehciInstance->shedFirstQh->horizontalLinkPointer; ehciInstance->shedFirstQh->horizontalLinkPointer = ((uint32_t)qhPointer | EHCI_HOST_POINTER_TYPE_QH); return kStatus_USB_Success; @@ -3093,10 +3179,11 @@ static usb_status_t USB_HostEhciCloseControlBulk(usb_host_ehci_instance_t *ehciI { volatile usb_host_ehci_qh_t *vltPrevQhPointer; uint32_t horizontalLinkValue; - + uint32_t *temp; /* remove qh from async schedule */ + temp = (uint32_t *)ehciPipePointer->ehciQh; if ((ehciInstance->shedFirstQh->horizontalLinkPointer & EHCI_HOST_POINTER_ADDRESS_MASK) == - (uint32_t)ehciPipePointer->ehciQh) /* the removing qh is the first qh in the async list */ + (uint32_t)temp) /* the removing qh is the first qh in the async list */ { USB_HostEhciStopAsync(ehciInstance); ehciInstance->shedFirstQh->horizontalLinkPointer = @@ -3110,8 +3197,8 @@ static usb_status_t USB_HostEhciCloseControlBulk(usb_host_ehci_instance_t *ehciI while (vltPrevQhPointer != NULL) { horizontalLinkValue = vltPrevQhPointer->horizontalLinkPointer; - if ((horizontalLinkValue & EHCI_HOST_T_INVALID_VALUE) || - ((horizontalLinkValue & EHCI_HOST_POINTER_ADDRESS_MASK) == (uint32_t)ehciPipePointer->ehciQh) || + if ((0U != (horizontalLinkValue & EHCI_HOST_T_INVALID_VALUE)) || + ((horizontalLinkValue & EHCI_HOST_POINTER_ADDRESS_MASK) == (uint32_t)temp) || ((horizontalLinkValue & EHCI_HOST_POINTER_ADDRESS_MASK) == (uint32_t)ehciInstance->shedFirstQh)) { break; @@ -3121,8 +3208,10 @@ static usb_status_t USB_HostEhciCloseControlBulk(usb_host_ehci_instance_t *ehciI } /* remove the qh from async list */ - if ((vltPrevQhPointer != NULL) && (!(horizontalLinkValue & EHCI_HOST_T_INVALID_VALUE)) && - ((horizontalLinkValue & EHCI_HOST_POINTER_ADDRESS_MASK) == (uint32_t)ehciPipePointer->ehciQh)) + /*for misra 11.6*/ + temp = (uint32_t *)ehciPipePointer->ehciQh; + if ((vltPrevQhPointer != NULL) && (0U == (horizontalLinkValue & EHCI_HOST_T_INVALID_VALUE)) && + ((horizontalLinkValue & EHCI_HOST_POINTER_ADDRESS_MASK) == (uint32_t)temp)) { USB_HostEhciStopAsync(ehciInstance); vltPrevQhPointer->horizontalLinkPointer = @@ -3140,6 +3229,7 @@ static usb_status_t USB_HostEhciOpenInterrupt(usb_host_ehci_instance_t *ehciInst { usb_status_t status = kStatus_USB_Success; uint32_t frameIndex; + uint32_t *temp; /* allocate bandwidth */ if (ehciInstance->firstDeviceSpeed == USB_SPEED_HIGH) @@ -3163,10 +3253,10 @@ static usb_status_t USB_HostEhciOpenInterrupt(usb_host_ehci_instance_t *ehciInst /* insert QH to frame list */ for (frameIndex = ehciPipePointer->startFrame; frameIndex < USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE; - frameIndex += (ehciPipePointer->uframeInterval / 8)) + frameIndex += (((uint32_t)ehciPipePointer->uframeInterval + 7U) / 8U)) { - USB_HostEhciAddQhToFrame(ehciInstance, (uint32_t)ehciPipePointer->ehciQh, frameIndex, - ehciPipePointer->uframeInterval); + temp = (uint32_t *)ehciPipePointer->ehciQh; + USB_HostEhciAddQhToFrame(ehciInstance, (uint32_t)temp, (uint16_t)frameIndex, ehciPipePointer->uframeInterval); } return kStatus_USB_Success; @@ -3176,12 +3266,13 @@ static usb_status_t USB_HostEhciCloseInterrupt(usb_host_ehci_instance_t *ehciIns usb_host_ehci_pipe_t *ehciPipePointer) { uint32_t frameIndex; - + uint32_t *temp; /* remove from frame list */ for (frameIndex = ehciPipePointer->startFrame; frameIndex < USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE; - frameIndex += (ehciPipePointer->uframeInterval / 8)) + frameIndex += (((uint32_t)ehciPipePointer->uframeInterval + 7U) / 8U)) { - USB_HostEhciRemoveFromFrame(ehciInstance, (uint32_t)ehciPipePointer->ehciQh, frameIndex); + temp = (uint32_t *)ehciPipePointer->ehciQh; + USB_HostEhciRemoveFromFrame(ehciInstance, (uint32_t)temp, (uint16_t)frameIndex); } ((usb_host_ehci_qh_t *)ehciPipePointer->ehciQh)->horizontalLinkPointer |= EHCI_HOST_T_INVALID_VALUE; /* invalid next qh link */ @@ -3219,11 +3310,11 @@ static usb_status_t USB_HostEhciOpenIso(usb_host_ehci_instance_t *ehciInstance, return kStatus_USB_Error; } USB_HostEhciLock(); - isoPointer = ehciInstance->ehciIsoList; + isoPointer = ehciInstance->ehciIsoList; ehciInstance->ehciIsoList = ehciInstance->ehciIsoList->next; USB_HostEhciUnlock(); isoPointer->lastLinkFrame = 0xFFFF; - ehciPipePointer->ehciQh = isoPointer; + ehciPipePointer->ehciQh = isoPointer; return status; } @@ -3231,31 +3322,32 @@ static usb_status_t USB_HostEhciOpenIso(usb_host_ehci_instance_t *ehciInstance, static usb_status_t USB_HostEhciCloseIso(usb_host_ehci_instance_t *ehciInstance, usb_host_ehci_pipe_t *ehciPipePointer) { usb_host_ehci_iso_t *isoPointer; - uint32_t speed; + uint32_t speed = 0U; isoPointer = (usb_host_ehci_iso_t *)ehciPipePointer->ehciQh; if (isoPointer->ehciTransferHead != NULL) { - USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, kUSB_HostGetDeviceSpeed, - &speed); + (void)USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, + (uint32_t)kUSB_HostGetDeviceSpeed, &speed); if (speed == USB_SPEED_HIGH) { #if ((defined USB_HOST_CONFIG_EHCI_MAX_ITD) && (USB_HOST_CONFIG_EHCI_MAX_ITD)) - USB_HostEhciItdArrayDeinit(ehciInstance, ehciPipePointer); /* de-initialize itd list and free them */ + (void)USB_HostEhciItdArrayDeinit(ehciInstance, ehciPipePointer); /* de-initialize itd list and free them */ #endif } else { #if ((defined USB_HOST_CONFIG_EHCI_MAX_SITD) && (USB_HOST_CONFIG_EHCI_MAX_SITD)) - USB_HostEhciSitdArrayDeinit(ehciInstance, ehciPipePointer); /* de-initialize sitd list and free them */ + (void)USB_HostEhciSitdArrayDeinit(ehciInstance, + ehciPipePointer); /* de-initialize sitd list and free them */ #endif } } /* release usb_host_ehci_iso_t */ USB_HostEhciLock(); - isoPointer->next = ehciInstance->ehciIsoList; + isoPointer->next = ehciInstance->ehciIsoList; ehciInstance->ehciIsoList = isoPointer; USB_HostEhciUnlock(); return kStatus_USB_Success; @@ -3267,17 +3359,17 @@ static usb_status_t USB_HostEhciResetIP(usb_host_ehci_instance_t *ehciInstance) { /* reset controller */ ehciInstance->ehciIpBase->USBCMD = USBHS_USBCMD_RST_MASK; - while (ehciInstance->ehciIpBase->USBCMD & USBHS_USBCMD_RST_MASK) + while (0U != (ehciInstance->ehciIpBase->USBCMD & USBHS_USBCMD_RST_MASK)) { } /* set host mode */ #if (ENDIANNESS == USB_LITTLE_ENDIAN) - ehciInstance->ehciIpBase->USBMODE |= 0x03; + ehciInstance->ehciIpBase->USBMODE |= 0x03U; #else - ehciInstance->ehciIpBase->USBMODE |= (0x03 | (0x01 << USBHS_USBMODE_ES_SHIFT)); + ehciInstance->ehciIpBase->USBMODE |= (0x03U | (0x01U << USBHS_USBMODE_ES_SHIFT)); #endif /* check frame list size */ - if (!(ehciInstance->ehciIpBase->HCCPARAMS & USBHS_HCCPARAMS_PFL_MASK)) + if (0U == (ehciInstance->ehciIpBase->HCCPARAMS & USBHS_HCCPARAMS_PFL_MASK)) { #if ((USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE < 8) || (USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE > 1024)) return kStatus_USB_Error; @@ -3293,7 +3385,7 @@ static usb_status_t USB_HostEhciStartIP(usb_host_ehci_instance_t *ehciInstance) { uint32_t tmp = 0; - if (ehciInstance->ehciIpBase->HCSPARAMS & USBHS_HCSPARAMS_PPC_MASK) /* Ports have power port switches */ + if (0U != (ehciInstance->ehciIpBase->HCSPARAMS & USBHS_HCSPARAMS_PPC_MASK)) /* Ports have power port switches */ { /* only has one port */ tmp = ehciInstance->ehciIpBase->PORTSC1; @@ -3302,41 +3394,41 @@ static usb_status_t USB_HostEhciStartIP(usb_host_ehci_instance_t *ehciInstance) } /* set frame list size */ - if (ehciInstance->ehciIpBase->HCCPARAMS & USBHS_HCCPARAMS_PFL_MASK) + if (0U != (ehciInstance->ehciIpBase->HCCPARAMS & USBHS_HCCPARAMS_PFL_MASK)) { #if (USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE <= 64) ehciInstance->ehciIpBase->USBCMD |= (USBHS_USBCMD_FS2_MASK); #if (USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE == 64) - ehciInstance->ehciIpBase->USBCMD |= (0x00 << USBHS_USBCMD_FS_SHIFT); -#elif(USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE == 32) - ehciInstance->ehciIpBase->USBCMD |= (0x01 << USBHS_USBCMD_FS_SHIFT); -#elif(USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE == 16) - ehciInstance->ehciIpBase->USBCMD |= (0x02 << USBHS_USBCMD_FS_SHIFT); -#elif(USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE == 8) - ehciInstance->ehciIpBase->USBCMD |= (0x03 << USBHS_USBCMD_FS_SHIFT); + ehciInstance->ehciIpBase->USBCMD |= (0x00U << USBHS_USBCMD_FS_SHIFT); +#elif (USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE == 32) + ehciInstance->ehciIpBase->USBCMD |= (0x01U << USBHS_USBCMD_FS_SHIFT); +#elif (USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE == 16) + ehciInstance->ehciIpBase->USBCMD |= (0x02U << USBHS_USBCMD_FS_SHIFT); +#elif (USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE == 8) + ehciInstance->ehciIpBase->USBCMD |= (0x03U << USBHS_USBCMD_FS_SHIFT); #endif #else #if (USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE == 1024) - ehciInstance->ehciIpBase->USBCMD |= (0x00 << USBHS_USBCMD_FS_SHIFT); -#elif(USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE == 512) - ehciInstance->ehciIpBase->USBCMD |= (0x01 << USBHS_USBCMD_FS_SHIFT); -#elif(USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE == 256) - ehciInstance->ehciIpBase->USBCMD |= (0x02 << USBHS_USBCMD_FS_SHIFT); -#elif(USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE == 128) - ehciInstance->ehciIpBase->USBCMD |= (0x03 << USBHS_USBCMD_FS_SHIFT); + ehciInstance->ehciIpBase->USBCMD |= (0x00U << USBHS_USBCMD_FS_SHIFT); +#elif (USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE == 512) + ehciInstance->ehciIpBase->USBCMD |= (0x01U << USBHS_USBCMD_FS_SHIFT); +#elif (USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE == 256) + ehciInstance->ehciIpBase->USBCMD |= (0x02U << USBHS_USBCMD_FS_SHIFT); +#elif (USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE == 128) + ehciInstance->ehciIpBase->USBCMD |= (0x03U << USBHS_USBCMD_FS_SHIFT); #endif #endif } /* start the controller */ - ehciInstance->ehciIpBase->USBCMD = USBHS_USBCMD_RS_MASK; + ehciInstance->ehciIpBase->USBCMD |= USBHS_USBCMD_RS_MASK; /* set timer0 */ - ehciInstance->ehciIpBase->GPTIMER0LD = (300 * 1000 - 1); /* 100ms */ + ehciInstance->ehciIpBase->GPTIMER0LD = (100U * 1000U - 1U); /* 100ms */ /* enable interrupt (USB interrupt enable + USB error interrupt enable + port change detect enable + system error * enable + interrupt on async advance enable) + general purpos Timer 0 Interrupt enable */ - ehciInstance->ehciIpBase->USBINTR |= (0x1000037); + ehciInstance->ehciIpBase->USBINTR |= (0x1000037U); return kStatus_USB_Success; } @@ -3349,7 +3441,7 @@ static usb_status_t USB_HostEhciCancelPipe(usb_host_ehci_instance_t *ehciInstanc #if (((defined USB_HOST_CONFIG_EHCI_MAX_ITD) && (USB_HOST_CONFIG_EHCI_MAX_ITD)) || \ ((defined USB_HOST_CONFIG_EHCI_MAX_SITD) && (USB_HOST_CONFIG_EHCI_MAX_SITD))) usb_host_ehci_iso_t *isoPointer; - uint32_t speed; + uint32_t speed = 0U; #endif uint8_t cancelPipe = 0; @@ -3368,24 +3460,24 @@ static usb_status_t USB_HostEhciCancelPipe(usb_host_ehci_instance_t *ehciInstanc if ((qhPointer->ehciTransferHead == transfer) && (qhPointer->ehciTransferHead == qhPointer->ehciTransferTail)) /* only has this one transfer */ { - cancelPipe = 1; + cancelPipe = 1U; } else { - cancelPipe = 0; + cancelPipe = 0U; } } else { - cancelPipe = 1; + cancelPipe = 1U; } - if (cancelPipe == 1) /* cancel all pipe */ + if (cancelPipe == 1U) /* cancel all pipe */ { - USB_HostEhciQhQtdListDeinit(ehciInstance, ehciPipePointer); /* release all the qtd */ + (void)USB_HostEhciQhQtdListDeinit(ehciInstance, ehciPipePointer); /* release all the qtd */ } else /* cancel one transfer */ { - USB_HostEhciTransferQtdListDeinit(ehciInstance, ehciPipePointer, transfer); + (void)USB_HostEhciTransferQtdListDeinit(ehciInstance, ehciPipePointer, transfer); } break; @@ -3398,24 +3490,25 @@ static usb_status_t USB_HostEhciCancelPipe(usb_host_ehci_instance_t *ehciInstanc return kStatus_USB_Success; } /* cancel all pipe, don't implement canceling transfer for iso */ - USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, kUSB_HostGetDeviceSpeed, - &speed); + (void)USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, + (uint32_t)kUSB_HostGetDeviceSpeed, &speed); if (speed == USB_SPEED_HIGH) { #if ((defined USB_HOST_CONFIG_EHCI_MAX_ITD) && (USB_HOST_CONFIG_EHCI_MAX_ITD)) - USB_HostEhciItdArrayDeinit(ehciInstance, ehciPipePointer); /* de-initialize itd */ + (void)USB_HostEhciItdArrayDeinit(ehciInstance, ehciPipePointer); /* de-initialize itd */ #endif } else { #if ((defined USB_HOST_CONFIG_EHCI_MAX_SITD) && (USB_HOST_CONFIG_EHCI_MAX_SITD)) - USB_HostEhciSitdArrayDeinit(ehciInstance, ehciPipePointer); /* de-initialize sitd */ + (void)USB_HostEhciSitdArrayDeinit(ehciInstance, ehciPipePointer); /* de-initialize sitd */ #endif } break; #endif default: + /*no action*/ break; } @@ -3426,26 +3519,26 @@ static usb_status_t USB_HostEhciControlBus(usb_host_ehci_instance_t *ehciInstanc { usb_status_t status = kStatus_USB_Success; uint32_t portScRegister; - - switch (busControl) + usb_host_bus_control_t controlCode = (usb_host_bus_control_t)busControl; + switch (controlCode) { case kUSB_HostBusReset: /* reset port */ portScRegister = ehciInstance->ehciIpBase->PORTSC1; portScRegister &= (~EHCI_PORTSC1_W1_BITS); ehciInstance->ehciIpBase->PORTSC1 = (portScRegister | USBHS_PORTSC1_PR_MASK); - while (ehciInstance->ehciIpBase->PORTSC1 & USBHS_PORTSC1_PR_MASK) + while (0U != (ehciInstance->ehciIpBase->PORTSC1 & USBHS_PORTSC1_PR_MASK)) { } break; case kUSB_HostBusRestart: - ehciInstance->deviceAttached = kEHCIDeviceDetached; + ehciInstance->deviceAttached = (uint8_t)kEHCIDeviceDetached; ehciInstance->ehciIpBase->USBINTR |= (USBHS_USBINTR_PCE_MASK); /* enable ehci port change interrupt */ break; case kUSB_HostBusEnableAttach: /* enable device attach */ - if (ehciInstance->deviceAttached == kEHCIDeviceDetached) + if (ehciInstance->deviceAttached == (uint8_t)kEHCIDeviceDetached) { ehciInstance->ehciIpBase->USBINTR |= (USBHS_USBINTR_PCE_MASK); /* enable ehci port change interrupt */ } @@ -3456,7 +3549,7 @@ static usb_status_t USB_HostEhciControlBus(usb_host_ehci_instance_t *ehciInstanc break; #if ((defined(USB_HOST_CONFIG_LOW_POWER_MODE)) && (USB_HOST_CONFIG_LOW_POWER_MODE > 0U)) case kUSB_HostBusSuspend: - if (ehciInstance->ehciIpBase->PORTSC1 && USBHS_PORTSC1_CCS_MASK) + if (0U != (ehciInstance->ehciIpBase->PORTSC1 & USBHS_PORTSC1_CCS_MASK)) { /* set timer1 */ ehciInstance->ehciIpBase->GPTIMER1LD = (1 * 1000); /* 1ms */ @@ -3465,9 +3558,9 @@ static usb_status_t USB_HostEhciControlBus(usb_host_ehci_instance_t *ehciInstanc USB_HostEhciStopAsync(ehciInstance); USB_HostEhciStopPeriodic(ehciInstance); - while (ehciInstance->ehciIpBase->USBSTS & (USBHS_USBSTS_PS_MASK | USBHS_USBSTS_AS_MASK)) + while (0U != (ehciInstance->ehciIpBase->USBSTS & (USBHS_USBSTS_PS_MASK | USBHS_USBSTS_AS_MASK))) { - __ASM("nop"); + __NOP(); } ehciInstance->ehciIpBase->PORTSC1 &= ~USBHS_PORTSC1_WKCN_MASK; ehciInstance->ehciIpBase->PORTSC1 |= USBHS_PORTSC1_WKDS_MASK; @@ -3485,7 +3578,7 @@ static usb_status_t USB_HostEhciControlBus(usb_host_ehci_instance_t *ehciInstanc case kUSB_HostBusResume: ehciInstance->ehciIpBase->PORTSC1 &= ~(USBHS_PORTSC1_SUSP_MASK); /* Clear Suspend bit */ ehciInstance->ehciIpBase->PORTSC1 &= ~USBHS_PORTSC1_PHCD_MASK; - if (ehciInstance->deviceAttached != kEHCIDeviceDetached) + if (ehciInstance->deviceAttached != (uint8_t)kEHCIDeviceDetached) { ehciInstance->busSuspendStatus = kBus_EhciStartResume; #if (defined(FSL_FEATURE_SOC_USBNC_COUNT) && (FSL_FEATURE_SOC_USBNC_COUNT > 0U)) @@ -3532,6 +3625,9 @@ void USB_HostEhciTransactionDone(usb_host_ehci_instance_t *ehciInstance) uint32_t dataLength; uint32_t speed; #endif + void *temp; + uint32_t transferResults; + uint32_t transferOverlayResults; ehciPipePointer = ehciInstance->ehciRunningPipeList; /* check all the running pipes */ while (ehciPipePointer != NULL) @@ -3542,43 +3638,45 @@ void USB_HostEhciTransactionDone(usb_host_ehci_instance_t *ehciInstance) case USB_ENDPOINT_INTERRUPT: case USB_ENDPOINT_CONTROL: vltQhPointer = (volatile usb_host_ehci_qh_t *)ehciPipePointer->ehciQh; /* pipe's qh */ - transfer = vltQhPointer->ehciTransferHead; /* qh's transfer */ + transfer = vltQhPointer->ehciTransferHead; /* qh's transfer */ while (transfer != NULL) { nextTransfer = transfer->next; /* normal case */ - vltQtdPointer = (volatile usb_host_ehci_qtd_t *)transfer->union2.unitTail; - if ((vltQtdPointer->transferResults[0] & (EHCI_HOST_QTD_IOC_MASK)) && - (!(vltQtdPointer->transferResults[0] & - EHCI_HOST_QTD_STATUS_ACTIVE_MASK))) /* transfer is done */ + vltQtdPointer = (volatile usb_host_ehci_qtd_t *)transfer->union2.unitTail; + transferResults = vltQtdPointer->transferResults[0]; + transferOverlayResults = vltQhPointer->transferOverlayResults[0]; + if ((0U != (transferResults & (EHCI_HOST_QTD_IOC_MASK))) && + (0U == (transferResults & EHCI_HOST_QTD_STATUS_ACTIVE_MASK))) /* transfer is done */ { - qtdStatus = (vltQtdPointer->transferResults[0] & EHCI_HOST_QTD_STATUS_ERROR_MASK); + qtdStatus = (transferResults & EHCI_HOST_QTD_STATUS_ERROR_MASK); transfer->transferSofar = USB_HostEhciQtdListRelease(ehciInstance, (usb_host_ehci_qtd_t *)(transfer->union1.unitHead), (usb_host_ehci_qtd_t *)(transfer->union2.unitTail)); transfer->transferSofar = (transfer->transferLength < transfer->transferSofar) ? - 0 : + 0U : (transfer->transferLength - transfer->transferSofar); vltQhPointer->ehciTransferHead = transfer->next; - vltQhPointer->timeOutLabel = 0; - vltQhPointer->timeOutValue = USB_HOST_EHCI_CONTROL_BULK_TIME_OUT_VALUE; - if (qtdStatus) /* has errors */ + vltQhPointer->timeOutLabel = 0U; + vltQhPointer->timeOutValue = USB_HOST_EHCI_CONTROL_BULK_TIME_OUT_VALUE; + if (0U != qtdStatus) /* has errors */ { - if (!(vltQhPointer->transferOverlayResults[0] & EHCI_HOST_QTD_STATUS_ACTIVE_MASK)) + if (0U == (transferOverlayResults & EHCI_HOST_QTD_STATUS_ACTIVE_MASK)) { vltQhPointer->transferOverlayResults[0] &= (~EHCI_HOST_QTD_STATUS_MASK); /* clear error status */ } - if (qtdStatus & EHCI_HOST_QH_STATUS_NOSTALL_ERROR_MASK) + if (0U != (qtdStatus & EHCI_HOST_QH_STATUS_NOSTALL_ERROR_MASK)) { + /* callback function is different from the current condition */ transfer->callbackFn(transfer->callbackParam, transfer, kStatus_USB_TransferFailed); /* transfer fail */ } else { - transfer->callbackFn(transfer->callbackParam, transfer, - kStatus_USB_TransferStall); /* transfer stall */ + /* callback function is different from the current condition */ + transfer->callbackFn(transfer->callbackParam, transfer, kStatus_USB_TransferStall); } } else @@ -3602,8 +3700,8 @@ void USB_HostEhciTransactionDone(usb_host_ehci_instance_t *ehciInstance) { break; } - ehciClearPipePointer = - (usb_host_ehci_pipe_t *)ehciClearPipePointer->pipeCommon.next; + temp = (void *)ehciClearPipePointer->pipeCommon.next; + ehciClearPipePointer = (usb_host_ehci_pipe_t *)temp; } if ((ehciClearPipePointer != NULL) && @@ -3614,18 +3712,19 @@ void USB_HostEhciTransactionDone(usb_host_ehci_instance_t *ehciInstance) ->transferOverlayResults[0] &= (~EHCI_HOST_QTD_DT_MASK); } } + /* callback function is different from the current condition */ transfer->callbackFn(transfer->callbackParam, transfer, kStatus_USB_Success); /* transfer success */ } } - else if ((!(vltQhPointer->transferOverlayResults[0] & EHCI_HOST_QTD_STATUS_ACTIVE_MASK)) && - (vltQhPointer->transferOverlayResults[0] & - EHCI_HOST_QH_STATUS_ERROR_MASK)) /* there is error and transfer is done */ + else if ((0U == (transferOverlayResults & EHCI_HOST_QTD_STATUS_ACTIVE_MASK)) && + (0U != (transferOverlayResults & + EHCI_HOST_QH_STATUS_ERROR_MASK))) /* there is error and transfer is done */ { - qtdStatus = (vltQhPointer->transferOverlayResults[0] & EHCI_HOST_QH_STATUS_ERROR_MASK); + qtdStatus = (vltQhPointer->transferOverlayResults[0] & EHCI_HOST_QH_STATUS_ERROR_MASK); vltQtdPointer = (volatile usb_host_ehci_qtd_t *)(vltQhPointer->currentQtdPointer); - if (((uint32_t)vltQtdPointer & EHCI_HOST_T_INVALID_VALUE) || + if ((0U != ((uint32_t)vltQtdPointer & EHCI_HOST_T_INVALID_VALUE)) || (vltQtdPointer == NULL)) /* the error status is unreasonable */ { vltQhPointer->transferOverlayResults[0] &= @@ -3634,13 +3733,13 @@ void USB_HostEhciTransactionDone(usb_host_ehci_instance_t *ehciInstance) else { /* remove qtd from qh */ - while ((vltQtdPointer != NULL) && (!(vltQtdPointer->transferResults[0] & - EHCI_HOST_QTD_IOC_MASK))) /* find the IOC qtd */ + while ((vltQtdPointer != NULL) && + (0U == (transferResults & EHCI_HOST_QTD_IOC_MASK))) /* find the IOC qtd */ { vltQtdPointer = (volatile usb_host_ehci_qtd_t *)vltQtdPointer->nextQtdPointer; } - vltQhPointer->nextQtdPointer = EHCI_HOST_T_INVALID_VALUE; + vltQhPointer->nextQtdPointer = EHCI_HOST_T_INVALID_VALUE; vltQhPointer->currentQtdPointer = EHCI_HOST_T_INVALID_VALUE; vltQhPointer->transferOverlayResults[0] &= (~EHCI_HOST_QTD_STATUS_MASK); /* clear error status */ @@ -3653,18 +3752,20 @@ void USB_HostEhciTransactionDone(usb_host_ehci_instance_t *ehciInstance) ehciInstance, (usb_host_ehci_qtd_t *)(transfer->union1.unitHead), (usb_host_ehci_qtd_t *)(transfer->union2.unitTail)); transfer->transferSofar = (transfer->transferLength < transfer->transferSofar) ? - 0 : + 0U : (transfer->transferLength - transfer->transferSofar); vltQhPointer->ehciTransferHead = transfer->next; - vltQhPointer->timeOutLabel = 0; - vltQhPointer->timeOutValue = USB_HOST_EHCI_CONTROL_BULK_TIME_OUT_VALUE; - if (qtdStatus & EHCI_HOST_QH_STATUS_NOSTALL_ERROR_MASK) + vltQhPointer->timeOutLabel = 0U; + vltQhPointer->timeOutValue = USB_HOST_EHCI_CONTROL_BULK_TIME_OUT_VALUE; + if (0U != (qtdStatus & EHCI_HOST_QH_STATUS_NOSTALL_ERROR_MASK)) { + /* callback function is different from the current condition */ transfer->callbackFn(transfer->callbackParam, transfer, kStatus_USB_TransferFailed); /* transfer fail */ } else { + /* callback function is different from the current condition */ transfer->callbackFn(transfer->callbackParam, transfer, kStatus_USB_TransferStall); /* transfer stall */ } @@ -3680,41 +3781,42 @@ void USB_HostEhciTransactionDone(usb_host_ehci_instance_t *ehciInstance) #if (((defined USB_HOST_CONFIG_EHCI_MAX_ITD) && (USB_HOST_CONFIG_EHCI_MAX_ITD)) || \ ((defined USB_HOST_CONFIG_EHCI_MAX_SITD) && (USB_HOST_CONFIG_EHCI_MAX_SITD))) case USB_ENDPOINT_ISOCHRONOUS: - qtdStatus = 0; /* qtdStatus means break here, because there is only one break in while for misra */ + qtdStatus = 0; /* qtdStatus means break here, because there is only one break in while for misra */ isoPointer = (usb_host_ehci_iso_t *)ehciPipePointer->ehciQh; /* pipe's usb_host_ehci_iso_t */ - transfer = isoPointer->ehciTransferHead; /* usb_host_ehci_iso_t's transfer */ + transfer = isoPointer->ehciTransferHead; /* usb_host_ehci_iso_t's transfer */ while (transfer != NULL) { nextTransfer = transfer->next; - USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, - kUSB_HostGetDeviceSpeed, &speed); + (void)USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, + (uint32_t)kUSB_HostGetDeviceSpeed, &speed); if (speed == USB_SPEED_HIGH) { #if ((defined USB_HOST_CONFIG_EHCI_MAX_ITD) && (USB_HOST_CONFIG_EHCI_MAX_ITD)) vltItdPointer = (volatile usb_host_ehci_itd_t *)(transfer->union2.unitTail); /* transfer's last itd */ - for (index = 0; index < 8; ++index) + for (index = 0; index < 8U; ++index) { - if (vltItdPointer->transactions[index] & EHCI_HOST_ITD_STATUS_ACTIVE_MASK) + if (0U != (vltItdPointer->transactions[index] & EHCI_HOST_ITD_STATUS_ACTIVE_MASK)) { break; } } - if (index == 8) /* transfer is done */ + if (index == 8U) /* transfer is done */ { /* remove itd from frame list and release itd */ - dataLength = USB_HostEhciItdArrayRelease(ehciInstance, + dataLength = USB_HostEhciItdArrayRelease(ehciInstance, (usb_host_ehci_itd_t *)transfer->union1.unitHead, (usb_host_ehci_itd_t *)transfer->union2.unitTail); - transfer->transferSofar = dataLength; + transfer->transferSofar = dataLength; isoPointer->ehciTransferHead = transfer->next; + /* callback function is different from the current condition */ transfer->callbackFn(transfer->callbackParam, transfer, kStatus_USB_Success); /* transfer callback success */ /* TODO: iso callback error */ } else { - qtdStatus = 1; /* break */ + qtdStatus = 1U; /* break */ } #endif } @@ -3723,26 +3825,27 @@ void USB_HostEhciTransactionDone(usb_host_ehci_instance_t *ehciInstance) #if ((defined USB_HOST_CONFIG_EHCI_MAX_SITD) && (USB_HOST_CONFIG_EHCI_MAX_SITD)) vltSitdPointer = (volatile usb_host_ehci_sitd_t *)(transfer->union2.unitTail); /* transfer's last sitd */ - if (!(vltSitdPointer->transferResults[0] & - EHCI_HOST_SITD_STATUS_ACTIVE_MASK)) /* transfer is done */ + if (0U == (vltSitdPointer->transferResults[0] & + EHCI_HOST_SITD_STATUS_ACTIVE_MASK)) /* transfer is done */ { /* remove sitd from frame list and release itd */ dataLength = USB_HostEhciSitdArrayRelease( ehciInstance, (usb_host_ehci_sitd_t *)transfer->union1.unitHead, (usb_host_ehci_sitd_t *)transfer->union2.unitTail); - transfer->transferSofar = dataLength; + transfer->transferSofar = transfer->transferLength - dataLength; isoPointer->ehciTransferHead = transfer->next; + /* callback function is different from the current condition */ transfer->callbackFn(transfer->callbackParam, transfer, kStatus_USB_Success); /* transfer callback success */ /* TODO: iso callback error */ } else { - qtdStatus = 1; /* break */ + qtdStatus = 1U; /* break */ } #endif } - if (qtdStatus == 1) + if (qtdStatus == 1U) { break; } @@ -3752,9 +3855,11 @@ void USB_HostEhciTransactionDone(usb_host_ehci_instance_t *ehciInstance) #endif default: + /*no action*/ break; } - ehciPipePointer = (usb_host_ehci_pipe_t *)ehciPipePointer->pipeCommon.next; + temp = (void *)ehciPipePointer->pipeCommon.next; + ehciPipePointer = (usb_host_ehci_pipe_t *)temp; } } @@ -3762,28 +3867,28 @@ static void USB_HostEhciPortChange(usb_host_ehci_instance_t *ehciInstance) { /* note: only has one port */ uint32_t portScRegister = ehciInstance->ehciIpBase->PORTSC1; - int32_t sofStart = 0; - int32_t sofCount = 0; + uint32_t sofStart = 0; + uint32_t sofCount = 0; uint32_t index; - if (portScRegister & USBHS_PORTSC1_CSC_MASK) /* connection status change */ + if (0U != (portScRegister & USBHS_PORTSC1_CSC_MASK)) /* connection status change */ { - sofStart = (int32_t)(ehciInstance->ehciIpBase->FRINDEX & EHCI_MAX_UFRAME_VALUE); + sofStart = (ehciInstance->ehciIpBase->FRINDEX & EHCI_MAX_UFRAME_VALUE); /* process CSC bit */ - while (1) + while (1U == 1U) { portScRegister = ehciInstance->ehciIpBase->PORTSC1; - if (portScRegister & USBHS_PORTSC1_CSC_MASK) + if (0U != (portScRegister & USBHS_PORTSC1_CSC_MASK)) { /* clear csc bit */ portScRegister = ehciInstance->ehciIpBase->PORTSC1; portScRegister &= (~EHCI_PORTSC1_W1_BITS); ehciInstance->ehciIpBase->PORTSC1 = (portScRegister | USBHS_PORTSC1_CSC_MASK); } - sofCount = (int32_t)(ehciInstance->ehciIpBase->FRINDEX & EHCI_MAX_UFRAME_VALUE); - if (((sofCount - sofStart + EHCI_MAX_UFRAME_VALUE + 1) & EHCI_MAX_UFRAME_VALUE) > - (1 * 8)) /* delay 1ms to clear CSC */ + sofCount = (ehciInstance->ehciIpBase->FRINDEX & EHCI_MAX_UFRAME_VALUE); + if (((sofCount + EHCI_MAX_UFRAME_VALUE + 1U - sofStart) & EHCI_MAX_UFRAME_VALUE) > + (1U * 8U)) /* delay 1ms to clear CSC */ { break; } @@ -3792,10 +3897,10 @@ static void USB_HostEhciPortChange(usb_host_ehci_instance_t *ehciInstance) /* process CCS bit */ portScRegister = ehciInstance->ehciIpBase->PORTSC1; - if (portScRegister & USBHS_PORTSC1_CCS_MASK) /* process attach */ + if (0U != (portScRegister & USBHS_PORTSC1_CCS_MASK)) /* process attach */ { - if ((ehciInstance->deviceAttached == kEHCIDevicePhyAttached) || - (ehciInstance->deviceAttached == kEHCIDeviceAttached)) + if ((ehciInstance->deviceAttached == (uint8_t)kEHCIDevicePhyAttached) || + (ehciInstance->deviceAttached == (uint8_t)kEHCIDeviceAttached)) { return; } @@ -3806,25 +3911,25 @@ static void USB_HostEhciPortChange(usb_host_ehci_instance_t *ehciInstance) for (index = 0; index < USB_HOST_EHCI_PORT_CONNECT_DEBOUNCE_DELAY; ++index) { USB_HostEhciDelay(ehciInstance->ehciIpBase, 1); - if (!(ehciInstance->ehciIpBase->PORTSC1 & USBHS_PORTSC1_CCS_MASK)) + if (0U == (ehciInstance->ehciIpBase->PORTSC1 & USBHS_PORTSC1_CCS_MASK)) { break; } } if (index < USB_HOST_EHCI_PORT_CONNECT_DEBOUNCE_DELAY) /* CCS is cleared */ { - ehciInstance->deviceAttached = kEHCIDeviceDetached; + ehciInstance->deviceAttached = (uint8_t)kEHCIDeviceDetached; return; } /* reset port */ portScRegister = ehciInstance->ehciIpBase->PORTSC1; portScRegister &= (~EHCI_PORTSC1_W1_BITS); ehciInstance->ehciIpBase->PORTSC1 = (portScRegister | USBHS_PORTSC1_PR_MASK); - while (ehciInstance->ehciIpBase->PORTSC1 & USBHS_PORTSC1_PR_MASK) + while (0U != (ehciInstance->ehciIpBase->PORTSC1 & USBHS_PORTSC1_PR_MASK)) { } ehciInstance->firstDeviceSpeed = - ((ehciInstance->ehciIpBase->PORTSC1 & USBHS_PORTSC1_PSPD_MASK) >> USBHS_PORTSC1_PSPD_SHIFT); + (uint8_t)((ehciInstance->ehciIpBase->PORTSC1 & USBHS_PORTSC1_PSPD_MASK) >> USBHS_PORTSC1_PSPD_SHIFT); /* enable ehci phy disconnection */ if (ehciInstance->firstDeviceSpeed == USB_SPEED_HIGH) { @@ -3834,16 +3939,16 @@ static void USB_HostEhciPortChange(usb_host_ehci_instance_t *ehciInstance) /* wait for reset */ USB_HostEhciDelay(ehciInstance->ehciIpBase, USB_HOST_EHCI_PORT_RESET_DELAY); /* process attach */ - USB_OsaEventSet(ehciInstance->taskEventHandle, EHCI_TASK_EVENT_DEVICE_ATTACH); + (void)OSA_EventSet(ehciInstance->taskEventHandle, EHCI_TASK_EVENT_DEVICE_ATTACH); /* gpt timer start */ ehciInstance->ehciIpBase->GPTIMER0CTL |= (USBHS_GPTIMER0CTL_RUN_MASK | USBHS_GPTIMER0CTL_MODE_MASK | USBHS_GPTIMER0CTL_RST_MASK); - ehciInstance->deviceAttached = kEHCIDevicePhyAttached; + ehciInstance->deviceAttached = (uint8_t)kEHCIDevicePhyAttached; } else { - if ((ehciInstance->deviceAttached == kEHCIDevicePhyAttached) || - (ehciInstance->deviceAttached == kEHCIDeviceAttached)) + if ((ehciInstance->deviceAttached == (uint8_t)kEHCIDevicePhyAttached) || + (ehciInstance->deviceAttached == (uint8_t)kEHCIDeviceAttached)) { #if ((defined(USB_HOST_CONFIG_LOW_POWER_MODE)) && (USB_HOST_CONFIG_LOW_POWER_MODE > 0U)) ehciInstance->busSuspendStatus = kBus_EhciIdle; @@ -3854,7 +3959,7 @@ static void USB_HostEhciPortChange(usb_host_ehci_instance_t *ehciInstance) /* disable async and periodic */ USB_HostEhciStopAsync(ehciInstance); USB_HostEhciStopPeriodic(ehciInstance); - USB_OsaEventSet(ehciInstance->taskEventHandle, EHCI_TASK_EVENT_DEVICE_DETACH); + (void)OSA_EventSet(ehciInstance->taskEventHandle, EHCI_TASK_EVENT_DEVICE_DETACH); } } } @@ -3862,11 +3967,12 @@ static void USB_HostEhciPortChange(usb_host_ehci_instance_t *ehciInstance) static void USB_HostEhciTimer0(usb_host_ehci_instance_t *ehciInstance) { volatile usb_host_ehci_qh_t *vltQhPointer; - volatile usb_host_ehci_qtd_t *vltQtdPointer; + usb_host_ehci_qtd_t *vltQtdPointer; usb_host_transfer_t *transfer; uint32_t backValue; - volatile uint32_t *totalBytesAddress = NULL; + volatile uint32_t *totalBytesAddress = NULL; usb_host_ehci_pipe_t *ehciPipePointer = ehciInstance->ehciRunningPipeList; + void *temp; uint8_t timeoutLabel; while (ehciPipePointer != NULL) @@ -3876,13 +3982,13 @@ static void USB_HostEhciTimer0(usb_host_ehci_instance_t *ehciInstance) case USB_ENDPOINT_BULK: case USB_ENDPOINT_CONTROL: vltQhPointer = (volatile usb_host_ehci_qh_t *)ehciPipePointer->ehciQh; /* pipe's qh */ - transfer = vltQhPointer->ehciTransferHead; /* qh's transfer */ + transfer = vltQhPointer->ehciTransferHead; /* qh's transfer */ if ((transfer != NULL)) /* there is transfering data */ { - timeoutLabel = 0; - if (ehciInstance->deviceAttached != kEHCIDeviceAttached) + timeoutLabel = 0U; + if (ehciInstance->deviceAttached != (uint8_t)kEHCIDeviceAttached) { - vltQtdPointer = (volatile usb_host_ehci_qtd_t *)transfer->union2.unitTail; + vltQtdPointer = (usb_host_ehci_qtd_t *)transfer->union2.unitTail; vltQhPointer->nextQtdPointer = EHCI_HOST_T_INVALID_VALUE; /* invalid next qtd */ vltQhPointer->transferOverlayResults[0] &= @@ -3891,15 +3997,15 @@ static void USB_HostEhciTimer0(usb_host_ehci_instance_t *ehciInstance) } else { - if (vltQhPointer->transferOverlayResults[0] & EHCI_HOST_QTD_STATUS_ACTIVE_MASK) + if (0U != (vltQhPointer->transferOverlayResults[0] & EHCI_HOST_QTD_STATUS_ACTIVE_MASK)) { - vltQtdPointer = (volatile usb_host_ehci_qtd_t *)vltQhPointer->currentQtdPointer; + vltQtdPointer = (usb_host_ehci_qtd_t *)vltQhPointer->currentQtdPointer; totalBytesAddress = &(vltQhPointer->transferOverlayResults[0]); } else { - vltQtdPointer = (volatile usb_host_ehci_qtd_t *)transfer->union2.unitTail; - totalBytesAddress = ((uint32_t *)vltQtdPointer + 2); + vltQtdPointer = (usb_host_ehci_qtd_t *)transfer->union2.unitTail; + totalBytesAddress = &(vltQtdPointer->transferResults[0]); } backValue = @@ -3908,7 +4014,7 @@ static void USB_HostEhciTimer0(usb_host_ehci_instance_t *ehciInstance) if (vltQhPointer->timeOutLabel != backValue) /* use total bytes to reflect the time out */ { vltQhPointer->timeOutValue = USB_HOST_EHCI_CONTROL_BULK_TIME_OUT_VALUE; - vltQhPointer->timeOutLabel = backValue; + vltQhPointer->timeOutLabel = (uint16_t)backValue; } else { @@ -3916,7 +4022,7 @@ static void USB_HostEhciTimer0(usb_host_ehci_instance_t *ehciInstance) * USB_HOST_EHCI_CONTROL_BULK_TIME_OUT_VALUE */ (vltQhPointer->timeOutValue)--; - if (vltQhPointer->timeOutValue == 0) + if (vltQhPointer->timeOutValue == 0U) { /* stop the qh schedule */ USB_HostEhciStopAsync(ehciInstance); @@ -3931,22 +4037,24 @@ static void USB_HostEhciTimer0(usb_host_ehci_instance_t *ehciInstance) vltQhPointer->transferOverlayResults[0] &= (~EHCI_HOST_QTD_STATUS_MASK); /* clear error status */ USB_HostEhciStartAsync(ehciInstance); - timeoutLabel = 1; + timeoutLabel = 1U; } } } } - if (timeoutLabel == 1) + if (timeoutLabel == 1U) { /* remove qtd from qh */ + temp = (void *)vltQhPointer->ehciTransferTail; while ((vltQtdPointer != NULL) && - (!(vltQtdPointer->transferResults[0] & EHCI_HOST_QTD_IOC_MASK)) && - (vltQtdPointer != (usb_host_ehci_qtd_t *)vltQhPointer->ehciTransferTail)) + (0U == (vltQtdPointer->transferResults[0] & EHCI_HOST_QTD_IOC_MASK)) && + (vltQtdPointer != (usb_host_ehci_qtd_t *)temp)) { - vltQtdPointer = (volatile usb_host_ehci_qtd_t *)vltQtdPointer->nextQtdPointer; + vltQtdPointer = (usb_host_ehci_qtd_t *)vltQtdPointer->nextQtdPointer; } - if ((vltQtdPointer != NULL) && (!(vltQtdPointer->nextQtdPointer & EHCI_HOST_T_INVALID_VALUE))) + if ((vltQtdPointer != NULL) && + (0U == (vltQtdPointer->nextQtdPointer & EHCI_HOST_T_INVALID_VALUE))) { vltQhPointer->nextQtdPointer = vltQtdPointer->nextQtdPointer; /* start qh if there are other qtd that don't belong to @@ -3956,38 +4064,41 @@ static void USB_HostEhciTimer0(usb_host_ehci_instance_t *ehciInstance) USB_HostEhciQtdListRelease(ehciInstance, (usb_host_ehci_qtd_t *)(transfer->union1.unitHead), (usb_host_ehci_qtd_t *)(transfer->union2.unitTail)); transfer->transferSofar = (transfer->transferLength < transfer->transferSofar) ? - 0 : + 0U : (transfer->transferLength - transfer->transferSofar); vltQhPointer->ehciTransferHead = transfer->next; - vltQhPointer->timeOutValue = USB_HOST_EHCI_CONTROL_BULK_TIME_OUT_VALUE; + vltQhPointer->timeOutValue = USB_HOST_EHCI_CONTROL_BULK_TIME_OUT_VALUE; + /* callback function is different from the current condition */ transfer->callbackFn(transfer->callbackParam, transfer, kStatus_USB_TransferFailed); } } break; default: + /*no action*/ break; } - ehciPipePointer = (usb_host_ehci_pipe_t *)ehciPipePointer->pipeCommon.next; + temp = (void *)ehciPipePointer->pipeCommon.next; + ehciPipePointer = (usb_host_ehci_pipe_t *)temp; } } #if ((defined(USB_HOST_CONFIG_LOW_POWER_MODE)) && (USB_HOST_CONFIG_LOW_POWER_MODE > 0U)) static void USB_HostEhciTimer1(usb_host_ehci_instance_t *ehciInstance) { - if (ehciInstance->deviceAttached != kEHCIDeviceDetached) + if (ehciInstance->deviceAttached != (uint8_t)kEHCIDeviceDetached) { if (kBus_EhciStartSuspend == ehciInstance->busSuspendStatus) { usb_host_instance_t *hostPointer = (usb_host_instance_t *)ehciInstance->hostHandle; - if (0 == ehciInstance->matchTick) + if (0U == ehciInstance->matchTick) { ehciInstance->matchTick = hostPointer->hwTick; } else { - if ((hostPointer->hwTick - ehciInstance->matchTick) >= 5) + if ((hostPointer->hwTick - ehciInstance->matchTick) >= 5U) { ehciInstance->ehciIpBase->USBCMD &= ~USBHS_USBCMD_RS_MASK; ehciInstance->ehciIpBase->USBSTS |= USBHS_USBSTS_SRI_MASK; @@ -4004,9 +4115,9 @@ static void USB_HostEhciTimer1(usb_host_ehci_instance_t *ehciInstance) ehciInstance->registerPhyBase->PWD = 0xFFFFFFFFU; - while (ehciInstance->registerPhyBase->CTRL & (USBPHY_CTRL_UTMI_SUSPENDM_MASK)) + while (0U != (ehciInstance->registerPhyBase->CTRL & (USBPHY_CTRL_UTMI_SUSPENDM_MASK))) { - __ASM("nop"); + __NOP(); } #if (defined(FSL_FEATURE_SOC_USBNC_COUNT) && (FSL_FEATURE_SOC_USBNC_COUNT > 0U)) @@ -4018,8 +4129,8 @@ static void USB_HostEhciTimer1(usb_host_ehci_instance_t *ehciInstance) ehciInstance->ehciIpBase->USBGENCTRL = USBHS_USBGENCTRL_WU_IE_MASK; #endif ehciInstance->registerPhyBase->CTRL |= USBPHY_CTRL_CLKGATE_MASK; - hostPointer->deviceCallback(hostPointer->suspendedDevice, NULL, - kUSB_HostEventSuspended); /* call host callback function */ + (void)hostPointer->deviceCallback(hostPointer->suspendedDevice, NULL, + kUSB_HostEventSuspended); /* call host callback function */ ehciInstance->busSuspendStatus = kBus_EhciSuspended; } } @@ -4027,17 +4138,17 @@ static void USB_HostEhciTimer1(usb_host_ehci_instance_t *ehciInstance) else if (kBus_EhciStartResume == ehciInstance->busSuspendStatus) { usb_host_instance_t *hostPointer = (usb_host_instance_t *)ehciInstance->hostHandle; - if (!(ehciInstance->ehciIpBase->PORTSC1 & USBHS_PORTSC1_FPR_MASK)) + if (0U == (ehciInstance->ehciIpBase->PORTSC1 & USBHS_PORTSC1_FPR_MASK)) { ehciInstance->ehciIpBase->PORTSC1 &= ~USBHS_PORTSC1_WKDS_MASK; - if (ehciInstance->ehciIpBase->PORTSC1 & USBHS_PORTSC1_CCS_MASK) + if (0U != (ehciInstance->ehciIpBase->PORTSC1 & USBHS_PORTSC1_CCS_MASK)) { USB_HostEhciStartAsync(ehciInstance); USB_HostEhciStartPeriodic(ehciInstance); } - hostPointer->deviceCallback(hostPointer->suspendedDevice, NULL, - kUSB_HostEventResumed); /* call host callback function */ - hostPointer->suspendedDevice = NULL; + (void)hostPointer->deviceCallback(hostPointer->suspendedDevice, NULL, + kUSB_HostEventResumed); /* call host callback function */ + hostPointer->suspendedDevice = NULL; ehciInstance->busSuspendStatus = kBus_EhciIdle; ehciInstance->ehciIpBase->USBINTR &= ~(USBHS_USBINTR_TIE1_MASK); } @@ -4059,30 +4170,31 @@ usb_status_t USB_HostEhciCreate(uint8_t controllerId, usb_host_controller_handle *controllerHandle) { uint32_t index = 0; - usb_osa_status_t osaStatus; + osa_status_t osaStatus; usb_host_ehci_instance_t *ehciInstance; uint32_t usbhsBaseAddrs[] = USBHS_BASE_ADDRS; - usb_host_ehci_data_t *usbHostEhciData[] = USB_HOST_EHCI_DATA_ARRAY; - uint8_t *usbHostEhciFrameList[] = USB_HOST_EHCI_FRAME_LIST_ARRAY; + usb_host_ehci_data_t *usbHostEhciData[USB_HOST_CONFIG_EHCI]; uint32_t *framePointer; + void *temp; + uint8_t instanceIndex = 0U; - if ((uint32_t)(controllerId - kUSB_ControllerEhci0) >= (sizeof(usbhsBaseAddrs) / sizeof(usbhsBaseAddrs[0]))) + if ((controllerId - (uint8_t)kUSB_ControllerEhci0) >= (sizeof(usbhsBaseAddrs) / sizeof(usbhsBaseAddrs[0]))) { return kStatus_USB_ControllerNotFound; } *controllerHandle = NULL; - ehciInstance = (usb_host_ehci_instance_t *)USB_OsaMemoryAllocate( + ehciInstance = (usb_host_ehci_instance_t *)OSA_MemoryAllocate( sizeof(usb_host_ehci_instance_t)); /* malloc host ehci instance */ if (ehciInstance == NULL) { return kStatus_USB_AllocFail; } - ehciInstance->controllerId = controllerId; - ehciInstance->hostHandle = upperLayerHandle; - ehciInstance->deviceAttached = kEHCIDeviceDetached; - ehciInstance->ehciIpBase = (USBHS_Type *) - usbhsBaseAddrs[controllerId - kUSB_ControllerEhci0]; /* operate ehci ip through the base address */ + ehciInstance->controllerId = controllerId; + ehciInstance->hostHandle = upperLayerHandle; + ehciInstance->deviceAttached = (uint8_t)kEHCIDeviceDetached; + ehciInstance->ehciIpBase = (USBHS_Type *) + usbhsBaseAddrs[controllerId - (uint8_t)kUSB_ControllerEhci0]; /* operate ehci ip through the base address */ #if ((defined(USB_HOST_CONFIG_LOW_POWER_MODE)) && (USB_HOST_CONFIG_LOW_POWER_MODE > 0U)) ehciInstance->busSuspendStatus = kBus_EhciIdle; @@ -4097,95 +4209,150 @@ usb_status_t USB_HostEhciCreate(uint8_t controllerId, #endif - if (USB_HostEhciResetIP(ehciInstance) != kStatus_USB_Success) /* reset ehci ip */ + if ((USB_HostEhciResetIP(ehciInstance) != kStatus_USB_Success) || + ((ehciInstance->controllerId < (uint8_t)kUSB_ControllerEhci0))) /* reset ehci ip */ { - USB_OsaMemoryFree(ehciInstance); + OSA_MemoryFree(ehciInstance); return kStatus_USB_Error; } - /* initialize ehci frame list */ - ehciInstance->ehciFrameList = usbHostEhciFrameList[ehciInstance->controllerId - kUSB_ControllerEhci0]; +#if (USB_HOST_CONFIG_EHCI == 1U) + if (0U == usbHostEhciFramListStatus[0]) + { + usbHostEhciFramListStatus[0] = 1U; + instanceIndex = 0U; + ehciInstance->ehciFrameList = &s_UsbHostEhciFrameList1[0]; + } +#elif (USB_HOST_CONFIG_EHCI == 2U) + if (0U == usbHostEhciFramListStatus[0]) + { + usbHostEhciFramListStatus[0] = 1U; + instanceIndex = 0U; + ehciInstance->ehciFrameList = &s_UsbHostEhciFrameList1[0]; + } + else if (0U == usbHostEhciFramListStatus[1]) + { + usbHostEhciFramListStatus[1] = 1U; + instanceIndex = 1U; + ehciInstance->ehciFrameList = &s_UsbHostEhciFrameList2[0]; + } + else + { + /*no action*/ + } +#endif + if (ehciInstance->ehciFrameList == NULL) + { + OSA_MemoryFree(ehciInstance); + return kStatus_USB_Error; + } - /* initialize ehci units */ - ehciInstance->ehciUnitBase = (uint32_t *)(usbHostEhciData[ehciInstance->controllerId - kUSB_ControllerEhci0]); +#if (USB_HOST_CONFIG_EHCI == 1U) + usbHostEhciData[0] = &s_UsbHostEhciData1; +#elif (USB_HOST_CONFIG_EHCI == 2U) + usbHostEhciData[0] = &s_UsbHostEhciData1; + usbHostEhciData[1] = &s_UsbHostEhciData2; +#else +#error "Please increase the instance count." +#endif + + temp = (void *)usbHostEhciData[instanceIndex]; + ehciInstance->ehciUnitBase = (uint32_t *)(temp); /* initialize qh/qtd/itd/sitd/iso list */ - ehciInstance->ehciQhList = (usb_host_ehci_qh_t *)((uint32_t)(ehciInstance->ehciUnitBase)); + ehciInstance->ehciQhList = (usb_host_ehci_qh_t *)((uint32_t)(ehciInstance->ehciUnitBase)); ehciInstance->ehciQtdHead = (usb_host_ehci_qtd_t *)((uint32_t)ehciInstance->ehciQhList + (sizeof(usb_host_ehci_qh_t) * USB_HOST_CONFIG_EHCI_MAX_QH)); ehciInstance->ehciItdList = (usb_host_ehci_itd_t *)((uint32_t)ehciInstance->ehciQtdHead + (sizeof(usb_host_ehci_qtd_t) * USB_HOST_CONFIG_EHCI_MAX_QTD)); - ehciInstance->ehciSitdList = ehciInstance->ehciSitdIndexBase = +#if ((defined(USB_HOST_CONFIG_EHCI_MAX_ITD)) && (USB_HOST_CONFIG_EHCI_MAX_ITD > 0U)) + /* If one ITD's first 32 bytes and next 32 bytes are in different 4K region, + * the ITD need move 32 bytes because the ITD cannot cross over 4K boundary. + */ + index = ((((((uint32_t)(ehciInstance->ehciItdList)) + 4095U) & 0xFFFFF000U) - + ((uint32_t)(ehciInstance->ehciItdList))) >> + 5U); + if (((index / 3U) < USB_HOST_CONFIG_EHCI_MAX_ITD) && ((index % 3U) == 1U)) + { + ehciInstance->ehciItdList = (usb_host_ehci_itd_t *)(((uint32_t)(ehciInstance->ehciItdList)) + 32U); + } +#endif + ehciInstance->ehciSitdIndexBase = (usb_host_ehci_sitd_t *)((uint32_t)ehciInstance->ehciItdList + (sizeof(usb_host_ehci_itd_t) * USB_HOST_CONFIG_EHCI_MAX_ITD)); - ehciInstance->ehciIsoList = (usb_host_ehci_iso_t *)((uint32_t)ehciInstance->ehciSitdList + + ehciInstance->ehciSitdList = ehciInstance->ehciSitdIndexBase; + ehciInstance->ehciIsoList = (usb_host_ehci_iso_t *)((uint32_t)ehciInstance->ehciSitdList + (sizeof(usb_host_ehci_sitd_t) * USB_HOST_CONFIG_EHCI_MAX_SITD)); ehciInstance->ehciPipeIndexBase = (usb_host_ehci_pipe_t *)((uint32_t)ehciInstance->ehciIsoList + (sizeof(usb_host_ehci_iso_t) * USB_HOST_EHCI_ISO_NUMBER)); - for (index = 1; index < USB_HOST_CONFIG_EHCI_MAX_QH; ++index) + for (index = 1U; index < USB_HOST_CONFIG_EHCI_MAX_QH; ++index) { - ehciInstance->ehciQhList[index - 1].horizontalLinkPointer = (uint32_t)(&ehciInstance->ehciQhList[index]); + ehciInstance->ehciQhList[index - 1U].horizontalLinkPointer = (uint32_t)(&ehciInstance->ehciQhList[index]); } - ehciInstance->ehciQhList[USB_HOST_CONFIG_EHCI_MAX_QH - 1].horizontalLinkPointer = (uint32_t)NULL; + ehciInstance->ehciQhList[USB_HOST_CONFIG_EHCI_MAX_QH - 1U].horizontalLinkPointer = 0U; for (index = 1; index < USB_HOST_CONFIG_EHCI_MAX_QTD; ++index) { - ehciInstance->ehciQtdHead[index - 1].nextQtdPointer = (uint32_t)(&ehciInstance->ehciQtdHead[index]); + ehciInstance->ehciQtdHead[index - 1U].nextQtdPointer = (uint32_t)(&ehciInstance->ehciQtdHead[index]); } - ehciInstance->ehciQtdNumber = USB_HOST_CONFIG_EHCI_MAX_QTD; - ehciInstance->ehciQtdHead[USB_HOST_CONFIG_EHCI_MAX_QTD - 1].nextQtdPointer = (uint32_t)NULL; - ehciInstance->ehciQtdTail = &ehciInstance->ehciQtdHead[USB_HOST_CONFIG_EHCI_MAX_QTD - 1]; + ehciInstance->ehciQtdNumber = USB_HOST_CONFIG_EHCI_MAX_QTD; + ehciInstance->ehciQtdHead[USB_HOST_CONFIG_EHCI_MAX_QTD - 1U].nextQtdPointer = 0U; + ehciInstance->ehciQtdTail = &ehciInstance->ehciQtdHead[USB_HOST_CONFIG_EHCI_MAX_QTD - 1U]; #if ((defined USB_HOST_CONFIG_EHCI_MAX_ITD) && (USB_HOST_CONFIG_EHCI_MAX_ITD)) for (index = 1; index < USB_HOST_CONFIG_EHCI_MAX_ITD; ++index) { - ehciInstance->ehciItdList[index - 1].nextLinkPointer = (uint32_t)(&ehciInstance->ehciItdList[index]); + ehciInstance->ehciItdList[index - 1U].nextItdPointer = + (usb_host_ehci_itd_t *)(&ehciInstance->ehciItdList[index]); } - ehciInstance->ehciItdNumber = USB_HOST_CONFIG_EHCI_MAX_ITD; - ehciInstance->ehciItdList[USB_HOST_CONFIG_EHCI_MAX_ITD - 1].nextLinkPointer = (uint32_t)NULL; + ehciInstance->ehciItdNumber = USB_HOST_CONFIG_EHCI_MAX_ITD; + ehciInstance->ehciItdList[USB_HOST_CONFIG_EHCI_MAX_ITD - 1U].nextItdPointer = NULL; #endif /* USB_HOST_CONFIG_EHCI_MAX_ITD */ #if ((defined USB_HOST_CONFIG_EHCI_MAX_SITD) && (USB_HOST_CONFIG_EHCI_MAX_SITD)) for (index = 1; index < USB_HOST_CONFIG_EHCI_MAX_SITD; ++index) { - ehciInstance->ehciSitdList[index - 1].nextLinkPointer = (uint32_t)(&ehciInstance->ehciSitdList[index]); + ehciInstance->ehciSitdList[index - 1U].nextLinkPointer = (uint32_t)(&ehciInstance->ehciSitdList[index]); } - ehciInstance->ehciSitdNumber = USB_HOST_CONFIG_EHCI_MAX_SITD; - ehciInstance->ehciSitdList[USB_HOST_CONFIG_EHCI_MAX_SITD - 1].nextLinkPointer = (uint32_t)NULL; + ehciInstance->ehciSitdNumber = USB_HOST_CONFIG_EHCI_MAX_SITD; + ehciInstance->ehciSitdList[USB_HOST_CONFIG_EHCI_MAX_SITD - 1U].nextLinkPointer = 0U; #endif /* USB_HOST_CONFIG_EHCI_MAX_SITD */ #if ((defined USB_HOST_CONFIG_EHCI_MAX_ITD) && (USB_HOST_CONFIG_EHCI_MAX_ITD)) for (index = 1; index < USB_HOST_EHCI_ISO_NUMBER; ++index) { - ehciInstance->ehciIsoList[index - 1].next = &ehciInstance->ehciIsoList[index]; + ehciInstance->ehciIsoList[index - 1U].next = &ehciInstance->ehciIsoList[index]; } - ehciInstance->ehciIsoList[USB_HOST_EHCI_ISO_NUMBER - 1].next = NULL; + ehciInstance->ehciIsoList[USB_HOST_EHCI_ISO_NUMBER - 1U].next = NULL; #endif /* initialize pipes */ ehciInstance->ehciPipeList = ehciInstance->ehciPipeIndexBase; for (index = 1; index < USB_HOST_CONFIG_MAX_PIPES; ++index) { - ehciInstance->ehciPipeList[index - 1].pipeCommon.next = (usb_host_pipe_t *)&ehciInstance->ehciPipeList[index]; + temp = (void *)&ehciInstance->ehciPipeList[index]; + ehciInstance->ehciPipeList[index - 1U].pipeCommon.next = (usb_host_pipe_t *)temp; } /* initialize mutext */ - osaStatus = USB_OsaMutexCreate(&ehciInstance->ehciMutex); - if (osaStatus != kStatus_USB_OSA_Success) + ehciInstance->ehciMutex = (osa_mutex_handle_t)(&ehciInstance->mutexBuffer[0]); + osaStatus = OSA_MutexCreate(ehciInstance->ehciMutex); + if (osaStatus != KOSA_StatusSuccess) { #ifdef HOST_ECHO usb_echo("ehci mutex init fail\r\n"); #endif - USB_OsaMemoryFree(ehciInstance); + OSA_MemoryFree(ehciInstance); return kStatus_USB_Error; } /* initialize task event */ - osaStatus = USB_OsaEventCreate(&ehciInstance->taskEventHandle, 1); - if (osaStatus != kStatus_USB_OSA_Success) + ehciInstance->taskEventHandle = (osa_event_handle_t)&ehciInstance->taskEventHandleBuffer[0]; + osaStatus = OSA_EventCreate(ehciInstance->taskEventHandle, 1); + if (osaStatus != KOSA_StatusSuccess) { #ifdef HOST_ECHO usb_echo("ehci event init fail\r\n"); #endif - USB_OsaMutexDestroy(ehciInstance->ehciMutex); - USB_OsaMemoryFree(ehciInstance); + (void)OSA_MutexDestroy(ehciInstance->ehciMutex); + OSA_MemoryFree(ehciInstance); return kStatus_USB_Error; } @@ -4193,22 +4360,23 @@ usb_status_t USB_HostEhciCreate(uint8_t controllerId, ehciInstance->shedFirstQh = ehciInstance->ehciQhList; ehciInstance->ehciQhList = (usb_host_ehci_qh_t *)(ehciInstance->ehciQhList->horizontalLinkPointer & EHCI_HOST_POINTER_ADDRESS_MASK); - ehciInstance->shedFirstQh->staticEndpointStates[0] |= (1 << EHCI_HOST_QH_H_SHIFT); /* first qh */ - ehciInstance->shedFirstQh->horizontalLinkPointer = EHCI_HOST_T_INVALID_VALUE; - ehciInstance->shedFirstQh->currentQtdPointer = EHCI_HOST_T_INVALID_VALUE; - ehciInstance->shedFirstQh->nextQtdPointer = EHCI_HOST_T_INVALID_VALUE; + ehciInstance->shedFirstQh->staticEndpointStates[0] |= (1UL << EHCI_HOST_QH_H_SHIFT); /* first qh */ + ehciInstance->shedFirstQh->horizontalLinkPointer = EHCI_HOST_T_INVALID_VALUE; + ehciInstance->shedFirstQh->currentQtdPointer = EHCI_HOST_T_INVALID_VALUE; + ehciInstance->shedFirstQh->nextQtdPointer = EHCI_HOST_T_INVALID_VALUE; ehciInstance->shedFirstQh->alternateNextQtdPointer = EHCI_HOST_T_INVALID_VALUE; ehciInstance->shedFirstQh->horizontalLinkPointer = (uint32_t)((uint32_t)(ehciInstance->shedFirstQh) | EHCI_HOST_POINTER_TYPE_QH); /* initialize periodic list */ - framePointer = (uint32_t *)ehciInstance->ehciFrameList; + temp = (void *)ehciInstance->ehciFrameList; + framePointer = (uint32_t *)temp; for (index = 0; index < USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE; ++index) { framePointer[index] = EHCI_HOST_T_INVALID_VALUE; } - USB_HostEhciStartIP(ehciInstance); /* start ehci ip */ + (void)USB_HostEhciStartIP(ehciInstance); /* start ehci ip */ *controllerHandle = ehciInstance; @@ -4223,10 +4391,29 @@ usb_status_t USB_HostEhciDestory(usb_host_controller_handle controllerHandle) ehciInstance->ehciIpBase->USBINTR = 0; /* stop the controller */ ehciInstance->ehciIpBase->USBCMD = 0; - /* free memory */ - USB_OsaMutexDestroy(ehciInstance->ehciMutex); - USB_OsaEventDestroy(ehciInstance->taskEventHandle); - USB_OsaMemoryFree(ehciInstance); +/* free memory */ +#if (USB_HOST_CONFIG_EHCI == 1U) + if (ehciInstance->ehciFrameList == &s_UsbHostEhciFrameList1[0]) + { + usbHostEhciFramListStatus[0] = 0; + } +#elif (USB_HOST_CONFIG_EHCI == 2U) + if (ehciInstance->ehciFrameList == &s_UsbHostEhciFrameList1[0]) + { + usbHostEhciFramListStatus[0] = 0; + } + else if (ehciInstance->ehciFrameList == &s_UsbHostEhciFrameList2[0]) + { + usbHostEhciFramListStatus[1] = 0; + } + else + { + /*no action*/ + } +#endif + (void)OSA_MutexDestroy(ehciInstance->ehciMutex); + (void)OSA_EventDestroy(ehciInstance->taskEventHandle); + OSA_MemoryFree(ehciInstance); return kStatus_USB_Success; } @@ -4237,15 +4424,17 @@ usb_status_t USB_HostEhciOpenPipe(usb_host_controller_handle controllerHandle, { usb_host_ehci_pipe_t *ehciPipePointer = NULL; usb_status_t status; - uint32_t speed; + uint32_t speed = 0; usb_host_ehci_instance_t *ehciInstance = (usb_host_ehci_instance_t *)controllerHandle; - + uint32_t val32; + void *temp; /* get one pipe */ USB_HostEhciLock(); if (ehciInstance->ehciPipeList != NULL) { - ehciPipePointer = ehciInstance->ehciPipeList; - ehciInstance->ehciPipeList = (usb_host_ehci_pipe_t *)ehciPipePointer->pipeCommon.next; + ehciPipePointer = ehciInstance->ehciPipeList; + temp = (void *)ehciPipePointer->pipeCommon.next; + ehciInstance->ehciPipeList = (usb_host_ehci_pipe_t *)temp; } USB_HostEhciUnlock(); if (ehciPipePointer == NULL) @@ -4257,43 +4446,53 @@ usb_status_t USB_HostEhciOpenPipe(usb_host_controller_handle controllerHandle, } /* initialize pipe informations */ - USB_HostEhciZeroMem((uint32_t *)ehciPipePointer, sizeof(usb_host_ehci_pipe_t) / 4); - ehciPipePointer->pipeCommon.deviceHandle = pipeInit->devInstance; + USB_HostEhciZeroMem((void *)ehciPipePointer, sizeof(usb_host_ehci_pipe_t) / 4U); + ehciPipePointer->pipeCommon.deviceHandle = pipeInit->devInstance; ehciPipePointer->pipeCommon.endpointAddress = pipeInit->endpointAddress; - ehciPipePointer->pipeCommon.direction = pipeInit->direction; - ehciPipePointer->pipeCommon.interval = pipeInit->interval; - ehciPipePointer->pipeCommon.maxPacketSize = pipeInit->maxPacketSize; - ehciPipePointer->pipeCommon.pipeType = pipeInit->pipeType; - ehciPipePointer->pipeCommon.numberPerUframe = pipeInit->numberPerUframe; - if (ehciPipePointer->pipeCommon.numberPerUframe == 0) + ehciPipePointer->pipeCommon.direction = pipeInit->direction; + ehciPipePointer->pipeCommon.interval = pipeInit->interval; + ehciPipePointer->pipeCommon.maxPacketSize = pipeInit->maxPacketSize; + ehciPipePointer->pipeCommon.pipeType = pipeInit->pipeType; + ehciPipePointer->pipeCommon.numberPerUframe = pipeInit->numberPerUframe + 1U; + if (ehciPipePointer->pipeCommon.numberPerUframe > 3U) { - ehciPipePointer->pipeCommon.numberPerUframe = 1; + ehciPipePointer->pipeCommon.numberPerUframe = 3U; } - ehciPipePointer->pipeCommon.nakCount = pipeInit->nakCount; - ehciPipePointer->pipeCommon.nextdata01 = 0; - ehciPipePointer->ehciQh = NULL; - USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, kUSB_HostGetDeviceSpeed, &speed); - if (ehciPipePointer->pipeCommon.pipeType == USB_ENDPOINT_ISOCHRONOUS) + ehciPipePointer->pipeCommon.nakCount = pipeInit->nakCount; + ehciPipePointer->pipeCommon.nextdata01 = 0U; + ehciPipePointer->ehciQh = NULL; + (void)USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, + (uint32_t)kUSB_HostGetDeviceSpeed, &speed); + if ((ehciPipePointer->pipeCommon.pipeType == USB_ENDPOINT_ISOCHRONOUS) || + (ehciPipePointer->pipeCommon.pipeType == USB_ENDPOINT_INTERRUPT)) { - ehciPipePointer->pipeCommon.interval = - (1 << (ehciPipePointer->pipeCommon.interval - 1)); /* iso interval is the power of 2 */ - } - else if (ehciPipePointer->pipeCommon.pipeType == USB_ENDPOINT_INTERRUPT) - { - if (speed == USB_SPEED_HIGH) + if (ehciPipePointer->pipeCommon.pipeType == USB_ENDPOINT_ISOCHRONOUS) { ehciPipePointer->pipeCommon.interval = - (1 << (ehciPipePointer->pipeCommon.interval - 1)); /* HS interrupt interval is the power of 2 */ + (uint16_t)(1UL << (ehciPipePointer->pipeCommon.interval - 1U)); /* iso interval is the power of 2 */ } else { - ehciPipePointer->pipeCommon.interval = USB_HostEhciGet2PowerValue( - ehciPipePointer->pipeCommon - .interval); /* FS/LS interrupt interval should be the power of 2, it is used for ehci bandwidth */ + if (speed == USB_SPEED_HIGH) + { + ehciPipePointer->pipeCommon.interval = (uint16_t)( + 1UL << (ehciPipePointer->pipeCommon.interval - 1U)); /* HS interrupt interval is the power of 2 */ + } + else + { + ehciPipePointer->pipeCommon.interval = USB_HostEhciGet2PowerValue( + (uint8_t)ehciPipePointer->pipeCommon.interval); /* FS/LS interrupt interval should be the power of + 2, it is used for ehci bandwidth */ + } + } + + if ((speed == USB_SPEED_HIGH) && (ehciPipePointer->pipeCommon.interval < 8U)) + { + val32 = ehciInstance->ehciIpBase->USBCMD; + val32 &= (~USBHS_USBCMD_ITC_MASK); + val32 |= USBHS_USBCMD_ITC((ehciPipePointer->pipeCommon.interval)); + ehciInstance->ehciIpBase->USBCMD = val32; } - } - else - { } /* save the micro-frame interval, it is convenient for the interval process */ @@ -4303,7 +4502,7 @@ usb_status_t USB_HostEhciOpenPipe(usb_host_controller_handle controllerHandle, } else { - ehciPipePointer->uframeInterval = 8 * ehciPipePointer->pipeCommon.interval; + ehciPipePointer->uframeInterval = 8U * ehciPipePointer->pipeCommon.interval; } /* open pipe */ @@ -4334,15 +4533,17 @@ usb_status_t USB_HostEhciOpenPipe(usb_host_controller_handle controllerHandle, { /* release pipe */ USB_HostEhciLock(); - ehciPipePointer->pipeCommon.next = (usb_host_pipe_t *)ehciInstance->ehciPipeList; - ehciInstance->ehciPipeList = ehciPipePointer; + temp = (void *)ehciInstance->ehciPipeList; + ehciPipePointer->pipeCommon.next = (usb_host_pipe_t *)temp; + ehciInstance->ehciPipeList = ehciPipePointer; USB_HostEhciUnlock(); return status; } /* add pipe to run pipe list */ USB_HostEhciLock(); - ehciPipePointer->pipeCommon.next = (usb_host_pipe_t *)ehciInstance->ehciRunningPipeList; + temp = (void *)ehciInstance->ehciRunningPipeList; + ehciPipePointer->pipeCommon.next = (usb_host_pipe_t *)temp; ehciInstance->ehciRunningPipeList = ehciPipePointer; USB_HostEhciUnlock(); @@ -4353,43 +4554,50 @@ usb_status_t USB_HostEhciOpenPipe(usb_host_controller_handle controllerHandle, usb_status_t USB_HostEhciClosePipe(usb_host_controller_handle controllerHandle, usb_host_pipe_handle pipeHandle) { usb_host_ehci_instance_t *ehciInstance = (usb_host_ehci_instance_t *)controllerHandle; - usb_host_ehci_pipe_t *ehciPipePointer = (usb_host_ehci_pipe_t *)pipeHandle; - usb_host_pipe_t *prevPointer = NULL; + usb_host_ehci_pipe_t *ehciPipePointer = (usb_host_ehci_pipe_t *)pipeHandle; + usb_host_pipe_t *prevPointer = NULL; + void *temp; + void *tempCurrent; switch (ehciPipePointer->pipeCommon.pipeType) { case USB_ENDPOINT_BULK: case USB_ENDPOINT_CONTROL: - USB_HostEhciCloseControlBulk(ehciInstance, ehciPipePointer); + (void)USB_HostEhciCloseControlBulk(ehciInstance, ehciPipePointer); break; case USB_ENDPOINT_INTERRUPT: - USB_HostEhciCloseInterrupt(ehciInstance, ehciPipePointer); + (void)USB_HostEhciCloseInterrupt(ehciInstance, ehciPipePointer); break; #if (((defined USB_HOST_CONFIG_EHCI_MAX_ITD) && (USB_HOST_CONFIG_EHCI_MAX_ITD)) || \ ((defined USB_HOST_CONFIG_EHCI_MAX_SITD) && (USB_HOST_CONFIG_EHCI_MAX_SITD))) case USB_ENDPOINT_ISOCHRONOUS: - USB_HostEhciCloseIso(ehciInstance, ehciPipePointer); + (void)USB_HostEhciCloseIso(ehciInstance, ehciPipePointer); break; #endif default: + /*no action*/ break; } /* delete pipe from run pipe list */ USB_HostEhciLock(); - prevPointer = (usb_host_pipe_t *)ehciInstance->ehciRunningPipeList; - if (prevPointer == (usb_host_pipe_t *)ehciPipePointer) + temp = (void *)ehciInstance->ehciRunningPipeList; + prevPointer = (usb_host_pipe_t *)temp; + tempCurrent = (void *)ehciPipePointer; + if (prevPointer == (usb_host_pipe_t *)tempCurrent) { - ehciInstance->ehciRunningPipeList = (usb_host_ehci_pipe_t *)(prevPointer->next); + temp = (void *)prevPointer->next; + ehciInstance->ehciRunningPipeList = (usb_host_ehci_pipe_t *)(temp); } else { while (prevPointer != NULL) { - if (prevPointer->next == (usb_host_pipe_t *)ehciPipePointer) + temp = (void *)ehciPipePointer; + if (prevPointer->next == (usb_host_pipe_t *)temp) { prevPointer->next = ehciPipePointer->pipeCommon.next; break; @@ -4404,8 +4612,9 @@ usb_status_t USB_HostEhciClosePipe(usb_host_controller_handle controllerHandle, /* release pipe */ USB_HostEhciLock(); - ehciPipePointer->pipeCommon.next = (usb_host_pipe_t *)ehciInstance->ehciPipeList; - ehciInstance->ehciPipeList = ehciPipePointer; + temp = (void *)ehciInstance->ehciPipeList; + ehciPipePointer->pipeCommon.next = (usb_host_pipe_t *)temp; + ehciInstance->ehciPipeList = ehciPipePointer; USB_HostEhciUnlock(); return kStatus_USB_Success; @@ -4416,11 +4625,11 @@ usb_status_t USB_HostEhciWritePipe(usb_host_controller_handle controllerHandle, usb_host_transfer_t *transfer) { usb_host_ehci_instance_t *ehciInstance = (usb_host_ehci_instance_t *)controllerHandle; - usb_host_ehci_pipe_t *ehciPipePointer = (usb_host_ehci_pipe_t *)pipeHandle; - usb_status_t status = kStatus_USB_Success; + usb_host_ehci_pipe_t *ehciPipePointer = (usb_host_ehci_pipe_t *)pipeHandle; + usb_status_t status = kStatus_USB_Success; #if (((defined USB_HOST_CONFIG_EHCI_MAX_ITD) && (USB_HOST_CONFIG_EHCI_MAX_ITD)) || \ ((defined USB_HOST_CONFIG_EHCI_MAX_SITD) && (USB_HOST_CONFIG_EHCI_MAX_SITD))) - uint32_t speed; + uint32_t speed = 0U; #endif switch (ehciPipePointer->pipeCommon.pipeType) @@ -4435,8 +4644,8 @@ usb_status_t USB_HostEhciWritePipe(usb_host_controller_handle controllerHandle, #if (((defined USB_HOST_CONFIG_EHCI_MAX_ITD) && (USB_HOST_CONFIG_EHCI_MAX_ITD)) || \ ((defined USB_HOST_CONFIG_EHCI_MAX_SITD) && (USB_HOST_CONFIG_EHCI_MAX_SITD))) case USB_ENDPOINT_ISOCHRONOUS: - USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, kUSB_HostGetDeviceSpeed, - &speed); + (void)USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, + (uint32_t)kUSB_HostGetDeviceSpeed, &speed); if (speed == USB_SPEED_HIGH) { #if ((defined USB_HOST_CONFIG_EHCI_MAX_ITD) && (USB_HOST_CONFIG_EHCI_MAX_ITD)) @@ -4455,6 +4664,7 @@ usb_status_t USB_HostEhciWritePipe(usb_host_controller_handle controllerHandle, #endif default: + /*no action*/ break; } return status; @@ -4469,22 +4679,22 @@ usb_status_t USB_HostEhciReadpipe(usb_host_controller_handle controllerHandle, usb_status_t USB_HostEhciIoctl(usb_host_controller_handle controllerHandle, uint32_t ioctlEvent, void *ioctlParam) { - usb_status_t status = kStatus_USB_Success; + usb_status_t status = kStatus_USB_Success; usb_host_ehci_instance_t *ehciInstance = (usb_host_ehci_instance_t *)controllerHandle; usb_host_cancel_param_t *param; usb_host_ehci_pipe_t *ehciPipePointer; volatile usb_host_ehci_qh_t *vltQhPointer; - uint32_t deviceAddress; - + uint32_t deviceAddress = 0; + usb_host_controller_control_t controlCode = (usb_host_controller_control_t)ioctlEvent; if (controllerHandle == NULL) { return kStatus_USB_InvalidHandle; } - switch (ioctlEvent) + switch (controlCode) { case kUSB_HostCancelTransfer: /* cancel pipe or one transfer */ - param = (usb_host_cancel_param_t *)ioctlParam; + param = (usb_host_cancel_param_t *)ioctlParam; status = USB_HostEhciCancelPipe(ehciInstance, (usb_host_ehci_pipe_t *)param->pipeHandle, param->transfer); break; @@ -4498,18 +4708,19 @@ usb_status_t USB_HostEhciIoctl(usb_host_controller_handle controllerHandle, uint case kUSB_HostUpdateControlEndpointAddress: ehciPipePointer = (usb_host_ehci_pipe_t *)ioctlParam; - vltQhPointer = (volatile usb_host_ehci_qh_t *)ehciPipePointer->ehciQh; + vltQhPointer = (volatile usb_host_ehci_qh_t *)ehciPipePointer->ehciQh; /* update address */ - USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, kUSB_HostGetDeviceAddress, - &deviceAddress); + (void)USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, + (uint32_t)kUSB_HostGetDeviceAddress, &deviceAddress); vltQhPointer->staticEndpointStates[0] |= deviceAddress; + USB_HostEhciDelay(ehciInstance->ehciIpBase, 2U); break; case kUSB_HostUpdateControlPacketSize: ehciPipePointer = (usb_host_ehci_pipe_t *)ioctlParam; - vltQhPointer = (volatile usb_host_ehci_qh_t *)ehciPipePointer->ehciQh; + vltQhPointer = (volatile usb_host_ehci_qh_t *)ehciPipePointer->ehciQh; USB_HostEhciLock(); - if (ehciInstance->ehciIpBase->USBSTS & USBHS_USBSTS_AS_MASK) + if (0U != (ehciInstance->ehciIpBase->USBSTS & USBHS_USBSTS_AS_MASK)) { USB_HostEhciStopAsync(ehciInstance); /* update max packet size */ @@ -4527,8 +4738,13 @@ usb_status_t USB_HostEhciIoctl(usb_host_controller_handle controllerHandle, uint } USB_HostEhciUnlock(); break; - +#if ((defined USB_HOST_CONFIG_COMPLIANCE_TEST) && (USB_HOST_CONFIG_COMPLIANCE_TEST)) + case kUSB_HostTestModeInit: /* test mode control */ + USB_HostEhciTestModeInit((usb_host_device_instance_t *)ioctlParam); + break; +#endif default: + status = kStatus_USB_NotSupported; break; } return status; @@ -4546,44 +4762,44 @@ void USB_HostEhciTaskFunction(void *hostHandle) } ehciInstance = (usb_host_ehci_instance_t *)((usb_host_instance_t *)hostHandle)->controllerHandle; - if (USB_OsaEventWait(ehciInstance->taskEventHandle, 0xFF, 0, 0, &bitSet) == - kStatus_USB_OSA_Success) /* wait all event */ + if (OSA_EventWait(ehciInstance->taskEventHandle, 0xFF, 0, USB_OSA_WAIT_TIMEOUT, &bitSet) == + KOSA_StatusSuccess) /* wait all event */ { - if (bitSet & EHCI_TASK_EVENT_PORT_CHANGE) /* port change */ + if (0U != (bitSet & EHCI_TASK_EVENT_PORT_CHANGE)) /* port change */ { USB_HostEhciPortChange(ehciInstance); } - if (bitSet & EHCI_TASK_EVENT_TIMER0) /* timer0 */ + if (0U != (bitSet & EHCI_TASK_EVENT_TIMER0)) /* timer0 */ { USB_HostEhciTimer0(ehciInstance); } #if ((defined(USB_HOST_CONFIG_LOW_POWER_MODE)) && (USB_HOST_CONFIG_LOW_POWER_MODE > 0U)) - if (bitSet & EHCI_TASK_EVENT_TIMER1) /* timer1 */ + if (0U != (bitSet & EHCI_TASK_EVENT_TIMER1)) /* timer1 */ { USB_HostEhciTimer1(ehciInstance); } #endif - if (ehciInstance->deviceAttached == kEHCIDeviceAttached) + if ((ehciInstance->deviceAttached == (uint8_t)kEHCIDeviceAttached)) { - if (bitSet & EHCI_TASK_EVENT_TRANSACTION_DONE) /* transaction done */ + if (0U != (bitSet & EHCI_TASK_EVENT_TRANSACTION_DONE)) /* transaction done */ { USB_HostEhciTransactionDone(ehciInstance); } - if (bitSet & EHCI_TASK_EVENT_DEVICE_DETACH) /* device detach */ + if (0U != (bitSet & EHCI_TASK_EVENT_DEVICE_DETACH)) /* device detach */ { ehciInstance->ehciIpBase->USBINTR &= (~USBHS_USBINTR_PCE_MASK); /* disable attach, enable when the detach process is done */ - ehciInstance->deviceAttached = kEHCIDeviceDetached; - USB_HostDetachDevice(ehciInstance->hostHandle, 0, 0); + ehciInstance->deviceAttached = (uint8_t)kEHCIDeviceDetached; + (void)USB_HostDetachDevice(ehciInstance->hostHandle, 0, 0); } } - else if (ehciInstance->deviceAttached != kEHCIDeviceAttached) + else if (ehciInstance->deviceAttached != (uint8_t)kEHCIDeviceAttached) { - if (bitSet & EHCI_TASK_EVENT_DEVICE_ATTACH) /* device is attached */ + if (0U != (bitSet & EHCI_TASK_EVENT_DEVICE_ATTACH)) /* device is attached */ { USB_HostEhciStartAsync(ehciInstance); USB_HostEhciStartPeriodic(ehciInstance); @@ -4591,12 +4807,13 @@ void USB_HostEhciTaskFunction(void *hostHandle) if (USB_HostAttachDevice(ehciInstance->hostHandle, ehciInstance->firstDeviceSpeed, 0, 0, 1, &deviceHandle) == kStatus_USB_Success) { - ehciInstance->deviceAttached = kEHCIDeviceAttached; + ehciInstance->deviceAttached = (uint8_t)kEHCIDeviceAttached; } } } else { + /*no action*/ } } } @@ -4616,18 +4833,18 @@ void USB_HostEhciIsrFunction(void *hostHandle) #if ((defined(USB_HOST_CONFIG_LOW_POWER_MODE)) && (USB_HOST_CONFIG_LOW_POWER_MODE > 0U)) #if (defined(FSL_FEATURE_SOC_USBNC_COUNT) && (FSL_FEATURE_SOC_USBNC_COUNT > 0U)) - if (ehciInstance->registerNcBase->USB_OTGn_CTRL & USBNC_USB_OTGn_CTRL_WIE_MASK) + if (0U != (ehciInstance->registerNcBase->USB_OTGn_CTRL & USBNC_USB_OTGn_CTRL_WIE_MASK)) { usb_host_instance_t *hostPointer = (usb_host_instance_t *)ehciInstance->hostHandle; ehciInstance->registerNcBase->USB_OTGn_CTRL &= ~USBNC_USB_OTGn_CTRL_WIE_MASK; - hostPointer->deviceCallback(hostPointer->suspendedDevice, NULL, - kUSB_HostEventDetectResume); /* call host callback function */ - - while (!(ehciInstance->registerNcBase->USB_OTGn_PHY_CTRL_0 & USBNC_USB_OTGn_PHY_CTRL_0_UTMI_CLK_VLD_MASK)) + (void)hostPointer->deviceCallback(hostPointer->suspendedDevice, NULL, + kUSB_HostEventDetectResume); /* call host callback function */ +#if (defined(USBNC_USB_OTGn_PHY_CTRL_0_UTMI_CLK_VLD_MASK)) + while (0U == (ehciInstance->registerNcBase->USB_OTGn_PHY_CTRL_0 & USBNC_USB_OTGn_PHY_CTRL_0_UTMI_CLK_VLD_MASK)) { } - - if (ehciInstance->ehciIpBase->PORTSC1 & USBHS_PORTSC1_CCS_MASK) +#endif + if (0U != (ehciInstance->ehciIpBase->PORTSC1 & USBHS_PORTSC1_CCS_MASK)) { USB_HostEhciStartAsync(ehciInstance); USB_HostEhciStartPeriodic(ehciInstance); @@ -4640,25 +4857,27 @@ void USB_HostEhciIsrFunction(void *hostHandle) } else { + /*no action*/ } } else { + /*no action*/ } #else - if (ehciInstance->ehciIpBase->USBGENCTRL & USBHS_USBGENCTRL_WU_IE_MASK) + if (0U != (ehciInstance->ehciIpBase->USBGENCTRL & USBHS_USBGENCTRL_WU_IE_MASK)) { usb_host_instance_t *hostPointer = (usb_host_instance_t *)ehciInstance->hostHandle; - hostPointer->deviceCallback(hostPointer->suspendedDevice, NULL, - kUSB_HostEventDetectResume); /* call host callback function */ + (void)hostPointer->deviceCallback(hostPointer->suspendedDevice, NULL, + kUSB_HostEventDetectResume); /* call host callback function */ - while (!(USBPHY->PLL_SIC & USBPHY_PLL_SIC_PLL_LOCK_MASK)) + while (0U == (USBPHY->PLL_SIC & USBPHY_PLL_SIC_PLL_LOCK_MASK)) { } ehciInstance->ehciIpBase->USBGENCTRL |= USBHS_USBGENCTRL_WU_INT_CLR_MASK; ehciInstance->ehciIpBase->USBGENCTRL &= ~USBHS_USBGENCTRL_WU_IE_MASK; - if (ehciInstance->ehciIpBase->PORTSC1 & USBHS_PORTSC1_CCS_MASK) + if (0U != (ehciInstance->ehciIpBase->PORTSC1 & USBHS_PORTSC1_CCS_MASK)) { USB_HostEhciStartAsync(ehciInstance); USB_HostEhciStartPeriodic(ehciInstance); @@ -4671,10 +4890,12 @@ void USB_HostEhciIsrFunction(void *hostHandle) } else { + /*no action*/ } } else { + /*no action*/ } #endif /* FSL_FEATURE_SOC_USBNC_COUNT */ @@ -4682,60 +4903,61 @@ void USB_HostEhciIsrFunction(void *hostHandle) interruptStatus = ehciInstance->ehciIpBase->USBSTS; interruptStatus &= ehciInstance->ehciIpBase->USBINTR; - while (interruptStatus) /* there are usb interrupts */ + while (0U != interruptStatus) /* there are usb interrupts */ { ehciInstance->ehciIpBase->USBSTS = interruptStatus; /* clear interrupt */ - if (interruptStatus & USBHS_USBSTS_SRI_MASK) /* SOF interrupt */ + if (0U != (interruptStatus & USBHS_USBSTS_SRI_MASK)) /* SOF interrupt */ { } - if (interruptStatus & USBHS_USBSTS_SEI_MASK) /* system error interrupt */ + if (0U != (interruptStatus & USBHS_USBSTS_SEI_MASK)) /* system error interrupt */ { } - if ((interruptStatus & USBHS_USBSTS_UI_MASK) || - (interruptStatus & USBHS_USBSTS_UEI_MASK)) /* USB interrupt or USB error interrupt */ + if ((0U != (interruptStatus & USBHS_USBSTS_UI_MASK)) || + (0U != (interruptStatus & USBHS_USBSTS_UEI_MASK))) /* USB interrupt or USB error interrupt */ { - USB_OsaEventSet(ehciInstance->taskEventHandle, EHCI_TASK_EVENT_TRANSACTION_DONE); + (void)OSA_EventSet(ehciInstance->taskEventHandle, EHCI_TASK_EVENT_TRANSACTION_DONE); } - if (interruptStatus & USBHS_USBSTS_PCI_MASK) /* port change detect interrupt */ + if (0U != (interruptStatus & USBHS_USBSTS_PCI_MASK)) /* port change detect interrupt */ { #if ((defined(USB_HOST_CONFIG_LOW_POWER_MODE)) && (USB_HOST_CONFIG_LOW_POWER_MODE > 0U)) usb_host_instance_t *hostPointer = (usb_host_instance_t *)ehciInstance->hostHandle; - if (ehciInstance->ehciIpBase->PORTSC1 & USBHS_PORTSC1_FPR_MASK) + if (0U != (ehciInstance->ehciIpBase->PORTSC1 & USBHS_PORTSC1_FPR_MASK)) { if (kBus_EhciStartSuspend == ehciInstance->busSuspendStatus) { - if (ehciInstance->ehciIpBase->PORTSC1 & USBHS_PORTSC1_CCS_MASK) + if (0U != (ehciInstance->ehciIpBase->PORTSC1 & USBHS_PORTSC1_CCS_MASK)) { USB_HostEhciStartAsync(ehciInstance); USB_HostEhciStartPeriodic(ehciInstance); } - hostPointer->deviceCallback(hostPointer->suspendedDevice, NULL, - kUSB_HostEventNotSuspended); /* call host callback function */ - hostPointer->suspendedDevice = NULL; + (void)hostPointer->deviceCallback(hostPointer->suspendedDevice, NULL, + kUSB_HostEventNotSuspended); /* call host callback function */ + hostPointer->suspendedDevice = NULL; ehciInstance->busSuspendStatus = kBus_EhciIdle; ehciInstance->ehciIpBase->USBINTR &= ~(USBHS_USBINTR_TIE1_MASK); } else { + /*no action */ } } #endif - USB_OsaEventSet(ehciInstance->taskEventHandle, EHCI_TASK_EVENT_PORT_CHANGE); + (void)OSA_EventSet(ehciInstance->taskEventHandle, EHCI_TASK_EVENT_PORT_CHANGE); } - if (interruptStatus & USBHS_USBSTS_TI0_MASK) /* timer 0 interrupt */ + if (0U != (interruptStatus & USBHS_USBSTS_TI0_MASK)) /* timer 0 interrupt */ { - USB_OsaEventSet(ehciInstance->taskEventHandle, EHCI_TASK_EVENT_TIMER0); + (void)OSA_EventSet(ehciInstance->taskEventHandle, EHCI_TASK_EVENT_TIMER0); } #if ((defined(USB_HOST_CONFIG_LOW_POWER_MODE)) && (USB_HOST_CONFIG_LOW_POWER_MODE > 0U)) - if (interruptStatus & USBHS_USBSTS_TI1_MASK) /* timer 1 interrupt */ + if (0U != (interruptStatus & USBHS_USBSTS_TI1_MASK)) /* timer 1 interrupt */ { - USB_OsaEventSet(ehciInstance->taskEventHandle, EHCI_TASK_EVENT_TIMER1); + (void)OSA_EventSet(ehciInstance->taskEventHandle, EHCI_TASK_EVENT_TIMER1); } #endif diff --git a/bsp/imxrt/libraries/drivers/usb/host/usb_host_ehci.h b/bsp/imxrt/libraries/drivers/usb/host/usb_host_ehci.h index 162d6576cd..5b47c31a41 100644 --- a/bsp/imxrt/libraries/drivers/usb/host/usb_host_ehci.h +++ b/bsp/imxrt/libraries/drivers/usb/host/usb_host_ehci.h @@ -1,31 +1,9 @@ /* * Copyright (c) 2015, Freescale Semiconductor, Inc. - * Copyright 2016 NXP + * Copyright 2016,2019 NXP + * All rights reserved. * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * o Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * o Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * o Neither the name of the copyright holder nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ #ifndef _USB_HOST_CONTROLLER_EHCI_H_ @@ -39,95 +17,95 @@ * Definitions ******************************************************************************/ /* EHCI host macros */ -#define EHCI_HOST_T_INVALID_VALUE (1U) -#define EHCI_HOST_POINTER_TYPE_ITD (0x00U) -#define EHCI_HOST_POINTER_TYPE_QH (0x00000002U) -#define EHCI_HOST_POINTER_TYPE_SITD (0x00000004U) -#define EHCI_HOST_POINTER_TYPE_FSTN (0x00000006U) -#define EHCI_HOST_POINTER_TYPE_MASK (0x00000006U) +#define EHCI_HOST_T_INVALID_VALUE (1U) +#define EHCI_HOST_POINTER_TYPE_ITD (0x00U) +#define EHCI_HOST_POINTER_TYPE_QH (0x00000002U) +#define EHCI_HOST_POINTER_TYPE_SITD (0x00000004U) +#define EHCI_HOST_POINTER_TYPE_FSTN (0x00000006U) +#define EHCI_HOST_POINTER_TYPE_MASK (0x00000006U) #define EHCI_HOST_POINTER_ADDRESS_MASK (0xFFFFFFE0U) -#define EHCI_HOST_PID_OUT (0U) -#define EHCI_HOST_PID_IN (1U) -#define EHCI_HOST_PID_SETUP (2U) +#define EHCI_HOST_PID_OUT (0UL) +#define EHCI_HOST_PID_IN (1UL) +#define EHCI_HOST_PID_SETUP (2UL) -#define EHCI_HOST_QH_RL_SHIFT (28U) -#define EHCI_HOST_QH_RL_MASK (0xF0000000U) -#define EHCI_HOST_QH_C_SHIFT (27U) -#define EHCI_HOST_QH_MAX_PACKET_LENGTH_SHIFT (16U) -#define EHCI_HOST_QH_MAX_PACKET_LENGTH_MASK (0x07FF0000U) -#define EHCI_HOST_QH_H_SHIFT (15U) -#define EHCI_HOST_QH_DTC_SHIFT (14U) -#define EHCI_HOST_QH_EPS_SHIFT (12U) -#define EHCI_HOST_QH_ENDPT_SHIFT (8U) -#define EHCI_HOST_QH_I_SHIFT (7U) -#define EHCI_HOST_QH_DEVICE_ADDRESS_SHIFT (0U) -#define EHCI_HOST_QH_MULT_SHIFT (30U) -#define EHCI_HOST_QH_PORT_NUMBER_SHIFT (23U) -#define EHCI_HOST_QH_HUB_ADDR_SHIFT (16U) -#define EHCI_HOST_QH_UFRAME_CMASK_SHIFT (8U) -#define EHCI_HOST_QH_UFRAME_SMASK_SHIFT (0U) -#define EHCI_HOST_QH_STATUS_ERROR_MASK (0x0000007EU) +#define EHCI_HOST_QH_RL_SHIFT (28U) +#define EHCI_HOST_QH_RL_MASK (0xF0000000U) +#define EHCI_HOST_QH_C_SHIFT (27U) +#define EHCI_HOST_QH_MAX_PACKET_LENGTH_SHIFT (16U) +#define EHCI_HOST_QH_MAX_PACKET_LENGTH_MASK (0x07FF0000U) +#define EHCI_HOST_QH_H_SHIFT (15U) +#define EHCI_HOST_QH_DTC_SHIFT (14U) +#define EHCI_HOST_QH_EPS_SHIFT (12U) +#define EHCI_HOST_QH_ENDPT_SHIFT (8U) +#define EHCI_HOST_QH_I_SHIFT (7U) +#define EHCI_HOST_QH_DEVICE_ADDRESS_SHIFT (0U) +#define EHCI_HOST_QH_MULT_SHIFT (30U) +#define EHCI_HOST_QH_PORT_NUMBER_SHIFT (23U) +#define EHCI_HOST_QH_HUB_ADDR_SHIFT (16U) +#define EHCI_HOST_QH_UFRAME_CMASK_SHIFT (8U) +#define EHCI_HOST_QH_UFRAME_SMASK_SHIFT (0U) +#define EHCI_HOST_QH_STATUS_ERROR_MASK (0x0000007EU) #define EHCI_HOST_QH_STATUS_NOSTALL_ERROR_MASK (0x0000003EU) -#define EHCI_HOST_QTD_DT_SHIFT (31U) -#define EHCI_HOST_QTD_DT_MASK (0x80000000U) -#define EHCI_HOST_QTD_TOTAL_BYTES_SHIFT (16U) -#define EHCI_HOST_QTD_TOTAL_BYTES_MASK (0x7FFF0000U) -#define EHCI_HOST_QTD_IOC_MASK (0x00008000U) -#define EHCI_HOST_QTD_C_PAGE_SHIFT (12U) -#define EHCI_HOST_QTD_CERR_SHIFT (10U) -#define EHCI_HOST_QTD_CERR_MAX_VALUE (0x00000003U) -#define EHCI_HOST_QTD_PID_CODE_SHIFT (8U) -#define EHCI_HOST_QTD_STATUS_SHIFT (0U) -#define EHCI_HOST_QTD_CURRENT_OFFSET_MASK (0x00000FFFU) -#define EHCI_HOST_QTD_BUFFER_POINTER_SHIFT (12U) -#define EHCI_HOST_QTD_STATUS_ACTIVE_MASK (0x00000080U) -#define EHCI_HOST_QTD_STATUS_MASK (0x000000ffU) -#define EHCI_HOST_QTD_STATUS_ERROR_MASK (0x0000007EU) +#define EHCI_HOST_QTD_DT_SHIFT (31U) +#define EHCI_HOST_QTD_DT_MASK (0x80000000U) +#define EHCI_HOST_QTD_TOTAL_BYTES_SHIFT (16U) +#define EHCI_HOST_QTD_TOTAL_BYTES_MASK (0x7FFF0000U) +#define EHCI_HOST_QTD_IOC_MASK (0x00008000U) +#define EHCI_HOST_QTD_C_PAGE_SHIFT (12U) +#define EHCI_HOST_QTD_CERR_SHIFT (10U) +#define EHCI_HOST_QTD_CERR_MAX_VALUE (0x00000003UL) +#define EHCI_HOST_QTD_PID_CODE_SHIFT (8U) +#define EHCI_HOST_QTD_STATUS_SHIFT (0U) +#define EHCI_HOST_QTD_CURRENT_OFFSET_MASK (0x00000FFFU) +#define EHCI_HOST_QTD_BUFFER_POINTER_SHIFT (12U) +#define EHCI_HOST_QTD_STATUS_ACTIVE_MASK (0x00000080U) +#define EHCI_HOST_QTD_STATUS_MASK (0x000000ffU) +#define EHCI_HOST_QTD_STATUS_ERROR_MASK (0x0000007EU) #define EHCI_HOST_QTD_STATUS_STALL_ERROR_MASK (0x00000040U) -#define EHCI_HOST_ITD_STATUS_ACTIVE_MASK (0x80000000U) -#define EHCI_HOST_ITD_TRANSACTION_LEN_SHIFT (16U) -#define EHCI_HOST_ITD_TRANSACTION_LEN_MASK (0x0FFF0000U) -#define EHCI_HOST_ITD_IOC_SHIFT (15U) -#define EHCI_HOST_ITD_PG_SHIFT (12U) +#define EHCI_HOST_ITD_STATUS_ACTIVE_MASK (0x80000000U) +#define EHCI_HOST_ITD_TRANSACTION_LEN_SHIFT (16U) +#define EHCI_HOST_ITD_TRANSACTION_LEN_MASK (0x0FFF0000U) +#define EHCI_HOST_ITD_IOC_SHIFT (15U) +#define EHCI_HOST_ITD_PG_SHIFT (12U) #define EHCI_HOST_ITD_TRANSACTION_OFFSET_SHIFT (0U) -#define EHCI_HOST_ITD_TRANSACTION_OFFSET_MASK (0x00000FFFU) -#define EHCI_HOST_ITD_BUFFER_POINTER_SHIFT (12U) -#define EHCI_HOST_ITD_ENDPT_SHIFT (8U) -#define EHCI_HOST_ITD_DEVICE_ADDRESS_SHIFT (0U) -#define EHCI_HOST_ITD_MAX_PACKET_SIZE_SHIFT (0U) -#define EHCI_HOST_ITD_MULT_SHIFT (0U) -#define EHCI_HOST_ITD_DIRECTION_SHIFT (11U) +#define EHCI_HOST_ITD_TRANSACTION_OFFSET_MASK (0x00000FFFU) +#define EHCI_HOST_ITD_BUFFER_POINTER_SHIFT (12U) +#define EHCI_HOST_ITD_ENDPT_SHIFT (8U) +#define EHCI_HOST_ITD_DEVICE_ADDRESS_SHIFT (0U) +#define EHCI_HOST_ITD_MAX_PACKET_SIZE_SHIFT (0U) +#define EHCI_HOST_ITD_MULT_SHIFT (0U) +#define EHCI_HOST_ITD_DIRECTION_SHIFT (11U) -#define EHCI_HOST_SITD_STATUS_ACTIVE_MASK (0x00000080U) -#define EHCI_HOST_SITD_DIRECTION_SHIFT (31U) -#define EHCI_HOST_SITD_PORT_NUMBER_SHIFT (24U) -#define EHCI_HOST_SITD_HUB_ADDR_SHIFT (16U) -#define EHCI_HOST_SITD_ENDPT_SHIFT (8U) +#define EHCI_HOST_SITD_STATUS_ACTIVE_MASK (0x00000080U) +#define EHCI_HOST_SITD_DIRECTION_SHIFT (31U) +#define EHCI_HOST_SITD_PORT_NUMBER_SHIFT (24U) +#define EHCI_HOST_SITD_HUB_ADDR_SHIFT (16U) +#define EHCI_HOST_SITD_ENDPT_SHIFT (8U) #define EHCI_HOST_SITD_DEVICE_ADDRESS_SHIFT (0U) -#define EHCI_HOST_SITD_CMASK_SHIFT (8U) -#define EHCI_HOST_SITD_SMASK_SHIFT (0U) -#define EHCI_HOST_SITD_TOTAL_BYTES_SHIFT (16U) -#define EHCI_HOST_SITD_TOTAL_BYTES_MASK (0x03FF0000U) -#define EHCI_HOST_SITD_TP_SHIFT (3U) -#define EHCI_HOST_SITD_TCOUNT_SHIFT (0U) -#define EHCI_HOST_SITD_IOC_SHIFT (31U) +#define EHCI_HOST_SITD_CMASK_SHIFT (8U) +#define EHCI_HOST_SITD_SMASK_SHIFT (0U) +#define EHCI_HOST_SITD_TOTAL_BYTES_SHIFT (16U) +#define EHCI_HOST_SITD_TOTAL_BYTES_MASK (0x03FF0000U) +#define EHCI_HOST_SITD_TP_SHIFT (3U) +#define EHCI_HOST_SITD_TCOUNT_SHIFT (0U) +#define EHCI_HOST_SITD_IOC_SHIFT (31U) /* register related MACROs */ -#define EHCI_PORTSC1_W1_BITS (0x0000002AU) +#define EHCI_PORTSC1_W1_BITS (0x0000002AU) #define EHCI_MAX_UFRAME_VALUE (0x00003FFFU) /* task event */ -#define EHCI_TASK_EVENT_DEVICE_ATTACH (0x01U) +#define EHCI_TASK_EVENT_DEVICE_ATTACH (0x01U) #define EHCI_TASK_EVENT_TRANSACTION_DONE (0x02U) -#define EHCI_TASK_EVENT_DEVICE_DETACH (0x04U) -#define EHCI_TASK_EVENT_PORT_CHANGE (0x08U) -#define EHCI_TASK_EVENT_TIMER0 (0x10U) -#define EHCI_TASK_EVENT_TIMER1 (0x20U) +#define EHCI_TASK_EVENT_DEVICE_DETACH (0x04U) +#define EHCI_TASK_EVENT_PORT_CHANGE (0x08U) +#define EHCI_TASK_EVENT_TIMER0 (0x10U) +#define EHCI_TASK_EVENT_TIMER1 (0x20U) -#define USB_HostEhciLock() USB_OsaMutexLock(ehciInstance->ehciMutex) -#define USB_HostEhciUnlock() USB_OsaMutexUnlock(ehciInstance->ehciMutex) +#define USB_HostEhciLock() (void)OSA_MutexLock(ehciInstance->ehciMutex, USB_OSA_WAIT_TIMEOUT) +#define USB_HostEhciUnlock() (void)OSA_MutexUnlock(ehciInstance->ehciMutex) /******************************************************************************* * KHCI driver public structures, enumerations, macros, functions @@ -144,6 +122,8 @@ #define USB_HOST_EHCI_PORT_CONNECT_DEBOUNCE_DELAY (101U) /*! @brief Delay for port reset */ #define USB_HOST_EHCI_PORT_RESET_DELAY (11U) +/*! @brief The MAX continuous transfers that application can send. */ +#define USB_HOST_EHCI_ISO_MAX_CONTINUOUS_TRANSFER (8U) /*! @brief The SITD inserts a frame interval for putting more SITD continuously. * There is an interval when an application sends two FS/LS ISO transfers. * When the interval is less than the macro, the two transfers are continuous in the frame list. Otherwise, the two @@ -171,7 +151,7 @@ */ #define USB_HOST_EHCI_ISO_BOUNCE_UFRAME_NUMBER (16U) /*! @brief Control or bulk transaction timeout value (unit: 100 ms) */ -#define USB_HOST_EHCI_CONTROL_BULK_TIME_OUT_VALUE (20U) +#define USB_HOST_EHCI_CONTROL_BULK_TIME_OUT_VALUE (50U) #if ((defined(USB_HOST_CONFIG_LOW_POWER_MODE)) && (USB_HOST_CONFIG_LOW_POWER_MODE > 0U)) typedef enum _bus_ehci_suspend_request_state @@ -323,8 +303,10 @@ typedef struct _usb_host_ehci_instance usb_host_ehci_pipe_t *ehciPipeIndexBase; /*!< Pipe buffer's start pointer*/ usb_host_ehci_pipe_t *ehciPipeList; /*!< Idle pipe list pointer*/ usb_host_ehci_pipe_t *ehciRunningPipeList; /*!< Running pipe list pointer*/ - usb_osa_mutex_handle ehciMutex; /*!< EHCI mutex*/ - usb_osa_event_handle taskEventHandle; /*!< EHCI task event*/ + osa_mutex_handle_t ehciMutex; /*!< EHCI mutex*/ + uint32_t mutexBuffer[(OSA_MUTEX_HANDLE_SIZE + 3) / 4]; /*!< The mutex buffer. */ + osa_event_handle_t taskEventHandle; /*!< EHCI task event*/ + uint32_t taskEventHandleBuffer[(OSA_EVENT_HANDLE_SIZE + 3) / 4]; /*!< EHCI task event handle buffer*/ #if ((defined(USB_HOST_CONFIG_LOW_POWER_MODE)) && (USB_HOST_CONFIG_LOW_POWER_MODE > 0U)) uint64_t matchTick; USBPHY_Type *registerPhyBase; /*!< The base address of the PHY register */ @@ -355,6 +337,10 @@ typedef struct _usb_host_ehci_data #endif #if ((defined(USB_HOST_CONFIG_EHCI_MAX_ITD)) && (USB_HOST_CONFIG_EHCI_MAX_ITD > 0U)) usb_host_ehci_itd_t ehciItd[USB_HOST_CONFIG_EHCI_MAX_ITD]; /*!< Idle ITD list array*/ + /* add additional 32bytes because the itd cannot cross over 4K boundary, + * If one ITD cross over 4K boundary, the code will move 32 bytes for ITD. + */ + uint32_t reserved[8]; #endif #if ((defined(USB_HOST_CONFIG_EHCI_MAX_SITD)) && (USB_HOST_CONFIG_EHCI_MAX_SITD > 0U)) usb_host_ehci_sitd_t ehciSitd[USB_HOST_CONFIG_EHCI_MAX_SITD]; /*!< Idle SITD list array*/ diff --git a/bsp/imxrt/libraries/drivers/usb/host/usb_host_hci.c b/bsp/imxrt/libraries/drivers/usb/host/usb_host_hci.c index 927bf8bd9c..b7305dd89f 100644 --- a/bsp/imxrt/libraries/drivers/usb/host/usb_host_hci.c +++ b/bsp/imxrt/libraries/drivers/usb/host/usb_host_hci.c @@ -1,34 +1,13 @@ /* * Copyright (c) 2015 - 2016, Freescale Semiconductor, Inc. - * Copyright 2016 NXP + * Copyright 2016 - 2019 NXP + * All rights reserved. * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * o Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * o Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * o Neither the name of the copyright holder nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ -#include +#include +#include #include "fsl_common.h" #include "usb_host.h" #include "usb_host_hci.h" @@ -42,16 +21,24 @@ * Definitions ******************************************************************************/ +/* Component ID definition, used by tools. */ +#ifndef FSL_COMPONENT_ID +#define FSL_COMPONENT_ID "middleware.usb.host_stack" +#endif + +#if defined __CORTEX_M && (__CORTEX_M == 7U) +#if (defined(USB_HOST_CONFIG_BUFFER_PROPERTY_CACHEABLE) && (USB_HOST_CONFIG_BUFFER_PROPERTY_CACHEABLE > 0U)) +#warning USB_HOST_CONFIG_BUFFER_PROPERTY_CACHEABLE is not supported. +#endif +#endif + /******************************************************************************* * Prototypes ******************************************************************************/ #if ((defined USB_HOST_CONFIG_HUB) && (USB_HOST_CONFIG_HUB)) -extern uint32_t USB_HostHubGetTotalThinkTime(usb_host_handle hostHandle, uint8_t parentHubNo); - -extern usb_status_t USB_HostHubSuspendDevice(usb_host_handle hostHandle); - -extern usb_status_t USB_HostHubResumeDevice(usb_host_handle hostHandle); +#include "usb_host_hub.h" +#include "usb_host_hub_app.h" #endif /*! @@ -77,15 +64,6 @@ static void USB_HostReleaseInstance(usb_host_instance_t *hostInstance); static void USB_HostGetControllerInterface(uint8_t controllerId, const usb_host_controller_interface_t **controllerTable); -#if ((defined USB_HOST_CONFIG_COMPLIANCE_TEST) && (USB_HOST_CONFIG_COMPLIANCE_TEST)) -#if ((defined USB_HOST_CONFIG_EHCI) && (USB_HOST_CONFIG_EHCI)) -extern void USB_HostEhciTestModeInit(usb_device_handle devHandle); -#endif /* USB_HOST_CONFIG_COMPLIANCE_TEST */ -#if ((defined USB_HOST_CONFIG_IP3516HS) && (USB_HOST_CONFIG_IP3516HS)) -extern void USB_HostIp3516HsTestModeInit(usb_device_handle devHandle); -#endif /* USB_HOST_CONFIG_COMPLIANCE_TEST */ -#endif /* USB_HOST_CONFIG_EHCI */ - /******************************************************************************* * Variables ******************************************************************************/ @@ -94,8 +72,7 @@ usb_host_instance_t g_UsbHostInstance[USB_HOST_CONFIG_MAX_HOST]; #if ((defined USB_HOST_CONFIG_EHCI) && (USB_HOST_CONFIG_EHCI)) #include "usb_host_ehci.h" -static const usb_host_controller_interface_t s_EhciInterface = \ -{ +static const usb_host_controller_interface_t s_EhciInterface = { USB_HostEhciCreate, USB_HostEhciDestory, USB_HostEhciOpenPipe, USB_HostEhciClosePipe, USB_HostEhciWritePipe, USB_HostEhciReadpipe, USB_HostEhciIoctl, }; @@ -103,8 +80,7 @@ static const usb_host_controller_interface_t s_EhciInterface = \ #if ((defined USB_HOST_CONFIG_KHCI) && (USB_HOST_CONFIG_KHCI)) #include "usb_host_khci.h" -static const usb_host_controller_interface_t s_KhciInterface = \ -{ +static const usb_host_controller_interface_t s_KhciInterface = { USB_HostKhciCreate, USB_HostKhciDestory, USB_HostKhciOpenPipe, USB_HostKhciClosePipe, USB_HostKhciWritePipe, USB_HostKhciReadpipe, USB_HostKciIoctl, }; @@ -112,8 +88,7 @@ static const usb_host_controller_interface_t s_KhciInterface = \ #if ((defined USB_HOST_CONFIG_OHCI) && (USB_HOST_CONFIG_OHCI > 0U)) #include "usb_host_ohci.h" -static const usb_host_controller_interface_t s_OhciInterface = \ -{ +static const usb_host_controller_interface_t s_OhciInterface = { USB_HostOhciCreate, USB_HostOhciDestory, USB_HostOhciOpenPipe, USB_HostOhciClosePipe, USB_HostOhciWritePipe, USB_HostOhciReadPipe, USB_HostOhciIoctl, }; @@ -121,65 +96,67 @@ static const usb_host_controller_interface_t s_OhciInterface = \ #if ((defined USB_HOST_CONFIG_IP3516HS) && (USB_HOST_CONFIG_IP3516HS > 0U)) #include "usb_host_ip3516hs.h" -static const usb_host_controller_interface_t s_Ip3516HsInterface = \ -{ +static const usb_host_controller_interface_t s_Ip3516HsInterface = { USB_HostIp3516HsCreate, USB_HostIp3516HsDestory, USB_HostIp3516HsOpenPipe, USB_HostIp3516HsClosePipe, USB_HostIp3516HsWritePipe, USB_HostIp3516HsReadPipe, USB_HostIp3516HsIoctl, }; #endif /* USB_HOST_CONFIG_IP3516HS */ -USB_DMA_NONINIT_DATA_ALIGN(USB_DATA_ALIGN_SIZE) static uint8_t s_Setupbuffer[USB_HOST_CONFIG_MAX_HOST][USB_HOST_CONFIG_MAX_TRANSFERS][USB_DATA_ALIGN_SIZE_MULTIPLE(8)]; +USB_DMA_NONINIT_DATA_ALIGN(USB_DATA_ALIGN_SIZE) +static uint8_t s_Setupbuffer[USB_HOST_CONFIG_MAX_HOST][USB_HOST_CONFIG_MAX_TRANSFERS][USB_DATA_ALIGN_SIZE_MULTIPLE(8)]; /******************************************************************************* -* Code -******************************************************************************/ + * Code + ******************************************************************************/ #if ((defined USB_HOST_CONFIG_COMPLIANCE_TEST) && (USB_HOST_CONFIG_COMPLIANCE_TEST)) /*FUNCTION*---------------------------------------------------------------- -* -* Function Name : usb_test_mode_init -* Returned Value : None -* Comments : -* This function is called by common class to initialize the class driver. It -* is called in response to a select interface call by application -* -*END*--------------------------------------------------------------------*/ + * + * Function Name : usb_test_mode_init + * Returned Value : None + * Comments : + * This function is called by common class to initialize the class driver. It + * is called in response to a select interface call by application + * + *END*--------------------------------------------------------------------*/ usb_status_t USB_HostTestModeInit(usb_device_handle deviceHandle) { #if (((defined USB_HOST_CONFIG_EHCI) && (USB_HOST_CONFIG_EHCI)) || \ ((defined USB_HOST_CONFIG_IP3516HS) && (USB_HOST_CONFIG_IP3516HS))) usb_host_device_instance_t *deviceInstance = (usb_host_device_instance_t *)deviceHandle; - usb_host_instance_t *hostInstance = (usb_host_instance_t *)deviceInstance->hostHandle; + usb_host_instance_t *hostInstance = (usb_host_instance_t *)deviceInstance->hostHandle; #endif uint32_t productId; uint32_t vendorId; - usb_echo("usb host test init\r\n"); - USB_HostHelperGetPeripheralInformation(deviceHandle, kUSB_HostGetDevicePID, &productId); - USB_HostHelperGetPeripheralInformation(deviceHandle, kUSB_HostGetDeviceVID, &vendorId); - usb_echo(" vendor id :0x%x product id:0x%x \r\n", vendorId, productId); + (void)usb_echo("usb host test init\r\n"); + (void)USB_HostHelperGetPeripheralInformation(deviceHandle, (uint32_t)kUSB_HostGetDevicePID, &productId); + (void)USB_HostHelperGetPeripheralInformation(deviceHandle, (uint32_t)kUSB_HostGetDeviceVID, &vendorId); + (void)usb_echo(" vendor id :0x%x product id:0x%x \r\n", vendorId, productId); - if ((productId != 0x0200U) && (productId != 0x0101) && (productId != 0x0102) && (productId != 0x0103) && - (productId != 0x0104) && (productId != 0x0105) && (productId != 0x0106) && (productId != 0x0107) && - (productId != 0x0108)) + if ((productId != 0x0200U) && (productId != 0x0101U) && (productId != 0x0102U) && (productId != 0x0103U) && + (productId != 0x0104U) && (productId != 0x0105U) && (productId != 0x0106U) && (productId != 0x0107U) && + (productId != 0x0108U)) { - usb_echo("Unsupported Device\r\n"); + (void)usb_echo("Unsupported Device\r\n"); } if (productId == 0x0200U) { - usb_echo("PET test device attached\r\n"); + (void)usb_echo("PET test device attached\r\n"); } else { #if ((defined USB_HOST_CONFIG_EHCI) && (USB_HOST_CONFIG_EHCI)) if (hostInstance->controllerTable == &s_EhciInterface) { - USB_HostEhciTestModeInit(deviceHandle); + (void)hostInstance->controllerTable->controllerIoctl(hostInstance->controllerHandle, kUSB_HostTestModeInit, + (void *)deviceHandle); } -#elif((defined USB_HOST_CONFIG_IP3516HS) && (USB_HOST_CONFIG_IP3516HS)) +#elif ((defined USB_HOST_CONFIG_IP3516HS) && (USB_HOST_CONFIG_IP3516HS)) if (hostInstance->controllerTable == &s_Ip3516HsInterface) { - USB_HostIp3516HsTestModeInit(deviceHandle); + (void)hostInstance->controllerTable->controllerIoctl(hostInstance->controllerHandle, kUSB_HostTestModeInit, + (void *)deviceHandle); } #endif } @@ -190,13 +167,14 @@ usb_status_t USB_HostTestModeInit(usb_device_handle deviceHandle) static usb_host_instance_t *USB_HostGetInstance(void) { - uint8_t i = 0; + uint8_t i = 0; uint32_t index = 0; - USB_OSA_SR_ALLOC(); - USB_OSA_ENTER_CRITICAL(); + void *temp; + OSA_SR_ALLOC(); + OSA_ENTER_CRITICAL(); for (; i < USB_HOST_CONFIG_MAX_HOST; i++) { - if (g_UsbHostInstance[i].occupied != 1) + if (g_UsbHostInstance[i].occupied != 1U) { uint8_t *buffer = (uint8_t *)&g_UsbHostInstance[i]; for (uint32_t j = 0U; j < sizeof(usb_host_instance_t); j++) @@ -204,53 +182,53 @@ static usb_host_instance_t *USB_HostGetInstance(void) buffer[j] = 0x00U; } g_UsbHostInstance[i].occupied = 1; - USB_OSA_EXIT_CRITICAL(); + OSA_EXIT_CRITICAL(); for (index = 0; index < USB_HOST_CONFIG_MAX_TRANSFERS; ++index) { - g_UsbHostInstance[i].transferList[index].setupPacket = - (usb_setup_struct_t *)&(s_Setupbuffer[i][index][0]); + temp = (void *)&(s_Setupbuffer[i][index][0]); + g_UsbHostInstance[i].transferList[index].setupPacket = (usb_setup_struct_t *)temp; } return &g_UsbHostInstance[i]; } } - USB_OSA_EXIT_CRITICAL(); + OSA_EXIT_CRITICAL(); return NULL; } static void USB_HostReleaseInstance(usb_host_instance_t *hostInstance) { - USB_OSA_SR_ALLOC(); - USB_OSA_ENTER_CRITICAL(); + OSA_SR_ALLOC(); + OSA_ENTER_CRITICAL(); hostInstance->occupied = 0; - USB_OSA_EXIT_CRITICAL(); + OSA_EXIT_CRITICAL(); } static void USB_HostGetControllerInterface(uint8_t controllerId, const usb_host_controller_interface_t **controllerTable) { #if ((defined USB_HOST_CONFIG_KHCI) && (USB_HOST_CONFIG_KHCI)) - if (controllerId == kUSB_ControllerKhci0) + if (controllerId == (uint8_t)kUSB_ControllerKhci0) { *controllerTable = &s_KhciInterface; } #endif /* USB_HOST_CONFIG_KHCI */ #if ((defined USB_HOST_CONFIG_EHCI) && (USB_HOST_CONFIG_EHCI)) - if ((controllerId == kUSB_ControllerEhci0) || (controllerId == kUSB_ControllerEhci1)) + if ((controllerId == (uint8_t)kUSB_ControllerEhci0) || (controllerId == (uint8_t)kUSB_ControllerEhci1)) { *controllerTable = &s_EhciInterface; } #endif /* USB_HOST_CONFIG_EHCI */ #if ((defined USB_HOST_CONFIG_OHCI) && (USB_HOST_CONFIG_OHCI > 0U)) - if (controllerId == kUSB_ControllerOhci0) + if (controllerId == (uint8_t)kUSB_ControllerOhci0) { *controllerTable = &s_OhciInterface; } #endif /* USB_HOST_CONFIG_OHCI */ #if ((defined USB_HOST_CONFIG_IP3516HS) && (USB_HOST_CONFIG_IP3516HS > 0U)) - if (controllerId == kUSB_ControllerIp3516Hs0) + if (controllerId == (uint8_t)kUSB_ControllerIp3516Hs0) { *controllerTable = &s_Ip3516HsInterface; } @@ -259,10 +237,10 @@ static void USB_HostGetControllerInterface(uint8_t controllerId, usb_status_t USB_HostInit(uint8_t controllerId, usb_host_handle *hostHandle, host_callback_t callbackFn) { - usb_status_t status = kStatus_USB_Success; + usb_status_t status = kStatus_USB_Success; usb_host_instance_t *hostInstance = NULL; usb_host_transfer_t *transferPrev = NULL; - uint8_t i = 0; + uint8_t i = 0; hostInstance = USB_HostGetInstance(); /* get one host instance */ if (hostInstance == NULL) @@ -291,10 +269,11 @@ usb_status_t USB_HostInit(uint8_t controllerId, usb_host_handle *hostHandle, hos } /* HOST instance init*/ - hostInstance->controllerId = controllerId; + hostInstance->controllerId = controllerId; hostInstance->deviceCallback = callbackFn; - hostInstance->deviceList = NULL; - if (kStatus_USB_OSA_Success != USB_OsaMutexCreate(&hostInstance->hostMutex)) + hostInstance->deviceList = NULL; + hostInstance->hostMutex = (osa_mutex_handle_t)(&hostInstance->mutexBuffer[0]); + if (KOSA_StatusSuccess != OSA_MutexCreate(hostInstance->hostMutex)) { USB_HostReleaseInstance(hostInstance); #ifdef HOST_ECHO @@ -306,19 +285,19 @@ usb_status_t USB_HostInit(uint8_t controllerId, usb_host_handle *hostHandle, hos /* initialize transfer list */ hostInstance->transferHead = &hostInstance->transferList[0]; - transferPrev = hostInstance->transferHead; + transferPrev = hostInstance->transferHead; for (i = 1; i < USB_HOST_CONFIG_MAX_TRANSFERS; ++i) { transferPrev->next = &hostInstance->transferList[i]; - transferPrev = transferPrev->next; + transferPrev = transferPrev->next; } - /* controller create */ + /* controller create, the callbackFn is initialized in USB_HostGetControllerInterface */ status = hostInstance->controllerTable->controllerCreate(controllerId, hostInstance, &(hostInstance->controllerHandle)); if ((status != kStatus_USB_Success) || (hostInstance->controllerHandle == NULL)) { - USB_OsaMutexDestroy(hostInstance->hostMutex); + (void)OSA_MutexDestroy(hostInstance->hostMutex); USB_HostReleaseInstance(hostInstance); #ifdef HOST_ECHO usb_echo("host init: controller init fail\r\n"); @@ -332,8 +311,8 @@ usb_status_t USB_HostInit(uint8_t controllerId, usb_host_handle *hostHandle, hos usb_status_t USB_HostDeinit(usb_host_handle hostHandle) { - usb_status_t status = kStatus_USB_Success; - usb_host_instance_t *hostInstance = (usb_host_instance_t *)hostHandle; + usb_status_t status = kStatus_USB_Success; + usb_host_instance_t *hostInstance = (usb_host_instance_t *)hostHandle; usb_host_device_instance_t *deviceInstance = NULL; if (hostHandle == NULL) @@ -346,23 +325,23 @@ usb_status_t USB_HostDeinit(usb_host_handle hostHandle) while (deviceInstance != NULL) { deviceInstance = (usb_host_device_instance_t *)hostInstance->deviceList; - USB_HostDetachDeviceInternal(hostHandle, deviceInstance); + (void)USB_HostDetachDeviceInternal(hostHandle, deviceInstance); } - /* controller instance destory */ - status = hostInstance->controllerTable->controllerDestory(hostInstance->controllerHandle); + /* controller instance destroy, the callbackFn is initialized in USB_HostGetControllerInterface */ + status = hostInstance->controllerTable->controllerDestory(hostInstance->controllerHandle); hostInstance->controllerHandle = NULL; if (status != kStatus_USB_Success) { #ifdef HOST_ECHO - usb_echo("host controller destory fail\r\n"); + usb_echo("host controller destroy fail\r\n"); #endif } /* resource release */ - if (hostInstance->hostMutex) + if (NULL != hostInstance->hostMutex) { - USB_OsaMutexDestroy(hostInstance->hostMutex); + (void)OSA_MutexDestroy(hostInstance->hostMutex); hostInstance->hostMutex = NULL; } USB_HostReleaseInstance(hostInstance); @@ -374,7 +353,7 @@ usb_status_t USB_HostOpenPipe(usb_host_handle hostHandle, usb_host_pipe_handle *pipeHandle, usb_host_pipe_init_t *pipeInit) { - usb_status_t status = kStatus_USB_Success; + usb_status_t status = kStatus_USB_Success; usb_host_instance_t *hostInstance = (usb_host_instance_t *)hostHandle; if ((hostHandle == NULL) || (pipeInit == NULL)) @@ -382,7 +361,7 @@ usb_status_t USB_HostOpenPipe(usb_host_handle hostHandle, return kStatus_USB_InvalidHandle; } - /* call controller open pipe interface */ + /* call controller open pipe interface, the callbackFn is initialized in USB_HostGetControllerInterface */ status = hostInstance->controllerTable->controllerOpenPipe(hostInstance->controllerHandle, pipeHandle, pipeInit); return status; @@ -390,7 +369,7 @@ usb_status_t USB_HostOpenPipe(usb_host_handle hostHandle, usb_status_t USB_HostClosePipe(usb_host_handle hostHandle, usb_host_pipe_handle pipeHandle) { - usb_status_t status = kStatus_USB_Success; + usb_status_t status = kStatus_USB_Success; usb_host_instance_t *hostInstance = (usb_host_instance_t *)hostHandle; if ((hostHandle == NULL) || (pipeHandle == NULL)) @@ -398,7 +377,7 @@ usb_status_t USB_HostClosePipe(usb_host_handle hostHandle, usb_host_pipe_handle return kStatus_USB_InvalidHandle; } - /* call controller close pipe interface */ + /* call controller close pipe interface, the callbackFn is initialized in USB_HostGetControllerInterface */ status = hostInstance->controllerTable->controllerClosePipe(hostInstance->controllerHandle, pipeHandle); return status; @@ -406,7 +385,7 @@ usb_status_t USB_HostClosePipe(usb_host_handle hostHandle, usb_host_pipe_handle usb_status_t USB_HostSend(usb_host_handle hostHandle, usb_host_pipe_handle pipeHandle, usb_host_transfer_t *transfer) { - usb_status_t status = kStatus_USB_Success; + usb_status_t status = kStatus_USB_Success; usb_host_instance_t *hostInstance = (usb_host_instance_t *)hostHandle; if ((hostHandle == NULL) || (pipeHandle == NULL) || (transfer == NULL)) @@ -416,9 +395,9 @@ usb_status_t USB_HostSend(usb_host_handle hostHandle, usb_host_pipe_handle pipeH /* initialize transfer */ transfer->transferSofar = 0; - transfer->direction = USB_OUT; + transfer->direction = USB_OUT; - USB_HostLock(); /* This api can be called by host task and app task */ + (void)USB_HostLock(); /* This api can be called by host task and app task */ /* keep this code: in normal situation application will guarantee the device is attached when call send/receive function */ #if 0 @@ -435,9 +414,10 @@ usb_status_t USB_HostSend(usb_host_handle hostHandle, usb_host_pipe_handle pipeH DCACHE_CleanByRange((uint32_t)transfer->transferBuffer, transfer->transferLength); } #endif + /* the callbackFn is initialized in USB_HostGetControllerInterface */ status = hostInstance->controllerTable->controllerWritePipe(hostInstance->controllerHandle, pipeHandle, transfer); - USB_HostUnlock(); + (void)USB_HostUnlock(); return status; } @@ -445,7 +425,7 @@ usb_status_t USB_HostSendSetup(usb_host_handle hostHandle, usb_host_pipe_handle pipeHandle, usb_host_transfer_t *transfer) { - usb_status_t status = kStatus_USB_Success; + usb_status_t status = kStatus_USB_Success; usb_host_instance_t *hostInstance = (usb_host_instance_t *)hostHandle; if ((hostHandle == NULL) || (pipeHandle == NULL) || (transfer == NULL)) @@ -455,8 +435,8 @@ usb_status_t USB_HostSendSetup(usb_host_handle hostHandle, /* initialize transfer */ transfer->transferSofar = 0; - transfer->next = NULL; - transfer->setupStatus = 0; + transfer->next = NULL; + transfer->setupStatus = 0; if ((transfer->setupPacket->bmRequestType & USB_REQUEST_TYPE_DIR_MASK) == USB_REQUEST_TYPE_DIR_IN) { transfer->direction = USB_IN; @@ -466,7 +446,7 @@ usb_status_t USB_HostSendSetup(usb_host_handle hostHandle, transfer->direction = USB_OUT; } - USB_HostLock(); /* This API can be called by host task and application task */ + (void)USB_HostLock(); /* This API can be called by host task and application task */ /* keep this code: in normal situation application will guarantee the device is attached when call send/receive function */ #if 0 @@ -484,15 +464,16 @@ usb_status_t USB_HostSendSetup(usb_host_handle hostHandle, DCACHE_CleanInvalidateByRange((uint32_t)transfer->transferBuffer, transfer->transferLength); } #endif + /* the callbackFn is initialized in USB_HostGetControllerInterface */ status = hostInstance->controllerTable->controllerWritePipe(hostInstance->controllerHandle, pipeHandle, transfer); - USB_HostUnlock(); + (void)USB_HostUnlock(); return status; } usb_status_t USB_HostRecv(usb_host_handle hostHandle, usb_host_pipe_handle pipeHandle, usb_host_transfer_t *transfer) { - usb_status_t status = kStatus_USB_Success; + usb_status_t status = kStatus_USB_Success; usb_host_instance_t *hostInstance = (usb_host_instance_t *)hostHandle; if ((hostHandle == NULL) || (pipeHandle == NULL) || (transfer == NULL)) @@ -502,9 +483,9 @@ usb_status_t USB_HostRecv(usb_host_handle hostHandle, usb_host_pipe_handle pipeH /* initialize transfer */ transfer->transferSofar = 0; - transfer->direction = USB_IN; + transfer->direction = USB_IN; - USB_HostLock(); /* This API can be called by host task and application task */ + (void)USB_HostLock(); /* This API can be called by host task and application task */ /* keep this code: in normal situation application will guarantee the device is attached when call send/receive function */ #if 0 @@ -521,9 +502,10 @@ usb_status_t USB_HostRecv(usb_host_handle hostHandle, usb_host_pipe_handle pipeH DCACHE_CleanInvalidateByRange((uint32_t)transfer->transferBuffer, transfer->transferLength); } #endif + /* the callbackFn is initialized in USB_HostGetControllerInterface */ status = hostInstance->controllerTable->controllerReadPipe(hostInstance->controllerHandle, pipeHandle, transfer); - USB_HostUnlock(); + (void)USB_HostUnlock(); return status; } @@ -531,7 +513,7 @@ usb_status_t USB_HostCancelTransfer(usb_host_handle hostHandle, usb_host_pipe_handle pipeHandle, usb_host_transfer_t *transfer) { - usb_status_t status = kStatus_USB_Success; + usb_status_t status = kStatus_USB_Success; usb_host_instance_t *hostInstance = (usb_host_instance_t *)hostHandle; usb_host_cancel_param_t cancelParam; @@ -542,9 +524,10 @@ usb_status_t USB_HostCancelTransfer(usb_host_handle hostHandle, /* initialize cancel parameter */ cancelParam.pipeHandle = pipeHandle; - cancelParam.transfer = transfer; + cancelParam.transfer = transfer; /* USB_HostLock(); This api can be called by host task and app task */ + /* the callbackFn is initialized in USB_HostGetControllerInterface */ status = hostInstance->controllerTable->controllerIoctl(hostInstance->controllerHandle, kUSB_HostCancelTransfer, &cancelParam); /* USB_HostUnlock(); */ @@ -562,18 +545,18 @@ usb_status_t USB_HostMallocTransfer(usb_host_handle hostHandle, usb_host_transfe } /* get one from the transfer_head */ - USB_HostLock(); + (void)USB_HostLock(); if (hostInstance->transferHead != NULL) { - *transfer = hostInstance->transferHead; + *transfer = hostInstance->transferHead; hostInstance->transferHead = hostInstance->transferHead->next; - USB_HostUnlock(); + (void)USB_HostUnlock(); return kStatus_USB_Success; } else { *transfer = NULL; - USB_HostUnlock(); + (void)USB_HostUnlock(); return kStatus_USB_Error; } } @@ -592,10 +575,10 @@ usb_status_t USB_HostFreeTransfer(usb_host_handle hostHandle, usb_host_transfer_ } /* release one to the transfer_head */ - USB_HostLock(); - transfer->next = hostInstance->transferHead; + (void)USB_HostLock(); + transfer->next = hostInstance->transferHead; hostInstance->transferHead = transfer; - USB_HostUnlock(); + (void)USB_HostUnlock(); return kStatus_USB_Success; } @@ -604,23 +587,28 @@ usb_status_t USB_HostHelperGetPeripheralInformation(usb_device_handle deviceHand uint32_t *infoValue) { usb_host_device_instance_t *deviceInstance = (usb_host_device_instance_t *)deviceHandle; + uint32_t *temp; + usb_host_dev_info_t devInfo; if ((deviceHandle == NULL) || (infoValue == NULL)) { return kStatus_USB_InvalidParameter; } - - switch (infoCode) + devInfo = (usb_host_dev_info_t)infoCode; + switch (devInfo) { case kUSB_HostGetDeviceAddress: /* device address */ + *infoValue = (uint32_t)deviceInstance->setAddress; break; case kUSB_HostGetDeviceControlPipe: /* device control pipe */ - *infoValue = (uint32_t)deviceInstance->controlPipe; + temp = (uint32_t *)deviceInstance->controlPipe; + *infoValue = (uint32_t)temp; break; case kUSB_HostGetHostHandle: /* device host handle */ - *infoValue = (uint32_t)deviceInstance->hostHandle; + temp = (uint32_t *)deviceInstance->hostHandle; + *infoValue = (uint32_t)temp; break; #if ((defined USB_HOST_CONFIG_HUB) && (USB_HOST_CONFIG_HUB)) @@ -685,7 +673,8 @@ usb_status_t USB_HostHelperGetPeripheralInformation(usb_device_handle deviceHand break; default: - return kStatus_USB_Error; + /*no action*/ + break; } return kStatus_USB_Success; @@ -698,26 +687,27 @@ usb_status_t USB_HostHelperParseAlternateSetting(usb_host_interface_handle inter uint32_t endPosition; usb_descriptor_union_t *unionDes; usb_host_ep_t *epParse; - + void *temp; if (interfaceHandle == NULL) { return kStatus_USB_InvalidHandle; } - if (alternateSetting == 0) + if (alternateSetting == 0U) { return kStatus_USB_InvalidParameter; } /* parse configuration descriptor */ - unionDes = (usb_descriptor_union_t *)((usb_host_interface_t *)interfaceHandle) - ->interfaceDesc; /* interface extend descriptor start */ + temp = (void *)((usb_host_interface_t *)interfaceHandle)->interfaceDesc; + ; + unionDes = (usb_descriptor_union_t *)temp; /* interface extend descriptor start */ endPosition = (uint32_t)unionDes + ((usb_host_interface_t *)interfaceHandle)->interfaceExtensionLength; /* interface extend descriptor end */ unionDes = (usb_descriptor_union_t *)((uint32_t)unionDes + unionDes->common.bLength); - /* search for the alternate setting interface descritpor */ + /* search for the alternate setting interface descriptor */ while ((uint32_t)unionDes < endPosition) { if (unionDes->interface.bDescriptorType == USB_DESCRIPTOR_TYPE_INTERFACE) @@ -742,12 +732,12 @@ usb_status_t USB_HostHelperParseAlternateSetting(usb_host_interface_handle inter } /* initialize interface handle structure instance */ - interface->interfaceDesc = &unionDes->interface; - interface->alternateSettingNumber = 0; - interface->epCount = 0; - interface->interfaceExtension = NULL; - interface->interfaceExtensionLength = 0; - interface->interfaceIndex = unionDes->interface.bInterfaceNumber; + interface->interfaceDesc = &unionDes->interface; + interface->alternateSettingNumber = 0U; + interface->epCount = 0U; + interface->interfaceExtension = NULL; + interface->interfaceExtensionLength = 0U; + interface->interfaceIndex = unionDes->interface.bInterfaceNumber; /* search for endpoint descriptor start position */ unionDes = (usb_descriptor_union_t *)((uint32_t)unionDes + unionDes->common.bLength); @@ -770,7 +760,7 @@ usb_status_t USB_HostHelperParseAlternateSetting(usb_host_interface_handle inter } /* parse endpoint descriptor */ - if (interface->interfaceDesc->bNumEndpoints != 0) + if (interface->interfaceDesc->bNumEndpoints != 0U) { if ((unionDes->common.bDescriptorType != USB_DESCRIPTOR_TYPE_ENDPOINT) || (interface->interfaceDesc->bNumEndpoints > USB_HOST_CONFIG_INTERFACE_MAX_EP)) @@ -790,11 +780,12 @@ usb_status_t USB_HostHelperParseAlternateSetting(usb_host_interface_handle inter #endif return kStatus_USB_Error; } - epParse = (usb_host_ep_t *)&interface->epList[interface->epCount]; - epParse->epDesc = (usb_descriptor_endpoint_t *)unionDes; + epParse = (usb_host_ep_t *)&interface->epList[interface->epCount]; + temp = (void *)unionDes; + epParse->epDesc = (usb_descriptor_endpoint_t *)temp; epParse->epExtensionLength = 0; - epParse->epExtension = NULL; - unionDes = (usb_descriptor_union_t *)((uint32_t)unionDes + unionDes->common.bLength); + epParse->epExtension = NULL; + unionDes = (usb_descriptor_union_t *)((uint32_t)unionDes + unionDes->common.bLength); while ((uint32_t)unionDes < endPosition) { if ((unionDes->common.bDescriptorType != USB_DESCRIPTOR_TYPE_ENDPOINT) && @@ -820,7 +811,7 @@ usb_status_t USB_HostHelperParseAlternateSetting(usb_host_interface_handle inter void USB_HostGetVersion(uint32_t *version) { - if (version) + if (NULL != version) { *version = (uint32_t)USB_MAKE_VERSION(USB_STACK_VERSION_MAJOR, USB_STACK_VERSION_MINOR, USB_STACK_VERSION_BUGFIX); @@ -828,12 +819,12 @@ void USB_HostGetVersion(uint32_t *version) } #if ((defined(USB_HOST_CONFIG_LOW_POWER_MODE)) && (USB_HOST_CONFIG_LOW_POWER_MODE > 0U)) -/* Send BUS or specific device suepend request */ +/* Send BUS or specific device suspend request */ usb_status_t USB_HostSuspendDeviceResquest(usb_host_handle hostHandle, usb_device_handle deviceHandle) { usb_host_instance_t *hostInstance; usb_host_device_instance_t *deviceInstance; - usb_status_t status = kStatus_USB_Error; + usb_status_t status = kStatus_USB_Error; usb_host_bus_control_t type = kUSB_HostBusSuspend; if (hostHandle == NULL) @@ -849,6 +840,7 @@ usb_status_t USB_HostSuspendDeviceResquest(usb_host_handle hostHandle, usb_devic #if ((defined USB_HOST_CONFIG_HUB) && (USB_HOST_CONFIG_HUB)) status = USB_HostHubSuspendDevice(hostInstance); #else + /* the callbackFn is initialized in USB_HostGetControllerInterface */ status = hostInstance->controllerTable->controllerIoctl(hostInstance->controllerHandle, kUSB_HostBusControl, &type); #endif @@ -857,11 +849,12 @@ usb_status_t USB_HostSuspendDeviceResquest(usb_host_handle hostHandle, usb_devic { #if ((defined USB_HOST_CONFIG_HUB) && (USB_HOST_CONFIG_HUB)) deviceInstance = (usb_host_device_instance_t *)deviceHandle; - if (0 == deviceInstance->hubNumber) + if (0U == deviceInstance->hubNumber) { #endif if (hostInstance->deviceList == deviceHandle) { + /* the callbackFn is initialized in USB_HostGetControllerInterface */ status = hostInstance->controllerTable->controllerIoctl(hostInstance->controllerHandle, kUSB_HostBusControl, &type); } @@ -888,7 +881,7 @@ usb_status_t USB_HostResumeDeviceResquest(usb_host_handle hostHandle, usb_device { usb_host_instance_t *hostInstance; usb_host_device_instance_t *deviceInstance; - usb_status_t status = kStatus_USB_Error; + usb_status_t status = kStatus_USB_Error; usb_host_bus_control_t type = kUSB_HostBusResume; if (hostHandle == NULL) @@ -905,6 +898,7 @@ usb_status_t USB_HostResumeDeviceResquest(usb_host_handle hostHandle, usb_device if (NULL == deviceHandle) { + /* the callbackFn is initialized in USB_HostGetControllerInterface */ status = hostInstance->controllerTable->controllerIoctl(hostInstance->controllerHandle, kUSB_HostBusControl, &type); } @@ -912,11 +906,12 @@ usb_status_t USB_HostResumeDeviceResquest(usb_host_handle hostHandle, usb_device { #if ((defined USB_HOST_CONFIG_HUB) && (USB_HOST_CONFIG_HUB)) deviceInstance = (usb_host_device_instance_t *)deviceHandle; - if (0 == deviceInstance->hubNumber) + if (0U == deviceInstance->hubNumber) { #endif if (hostInstance->deviceList == deviceHandle) { + /* the callbackFn is initialized in USB_HostGetControllerInterface */ status = hostInstance->controllerTable->controllerIoctl(hostInstance->controllerHandle, kUSB_HostBusControl, &type); } @@ -935,13 +930,13 @@ usb_status_t USB_HostResumeDeviceResquest(usb_host_handle hostHandle, usb_device return status; } #if ((defined(USB_HOST_CONFIG_LPM_L1)) && (USB_HOST_CONFIG_LPM_L1 > 0U)) -/* Send BUS or specific device suepend request */ +/* Send BUS or specific device suspend request */ usb_status_t USB_HostL1SleepDeviceResquest(usb_host_handle hostHandle, usb_device_handle deviceHandle, uint8_t sleepType) { usb_host_instance_t *hostInstance; - usb_status_t status = kStatus_USB_Error; + usb_status_t status = kStatus_USB_Error; usb_host_bus_control_t type = kUSB_HostBusL1Sleep; if (hostHandle == NULL) @@ -955,8 +950,9 @@ usb_status_t USB_HostL1SleepDeviceResquest(usb_host_handle hostHandle, if (1U == sleepType) { /*#if ((defined USB_HOST_CONFIG_HUB) && (USB_HOST_CONFIG_HUB))*/ - /*To do, implete hub L1 suspend device*/ + /*To do, incomplete hub L1 suspend device*/ /*#else*/ + /* the callbackFn is initialized in USB_HostGetControllerInterface */ status = hostInstance->controllerTable->controllerIoctl(hostInstance->controllerHandle, kUSB_HostBusControl, &type); /*#endif*/ @@ -968,6 +964,7 @@ usb_status_t USB_HostL1SleepDeviceResquest(usb_host_handle hostHandle, #endif if (hostInstance->deviceList == deviceHandle) { + /* the callbackFn is initialized in USB_HostGetControllerInterface */ status = hostInstance->controllerTable->controllerIoctl(hostInstance->controllerHandle, kUSB_HostBusControl, &type); } @@ -978,7 +975,7 @@ usb_status_t USB_HostL1SleepDeviceResquest(usb_host_handle hostHandle, } return status; } -/* Send BUS or specific device suepend request */ +/* Send BUS or specific device suspend request */ usb_status_t USB_HostL1SleepDeviceResquestConfig(usb_host_handle hostHandle, uint8_t *lpmParam) { usb_host_instance_t *hostInstance; @@ -989,7 +986,7 @@ usb_status_t USB_HostL1SleepDeviceResquestConfig(usb_host_handle hostHandle, uin return kStatus_USB_InvalidHandle; } hostInstance = (usb_host_instance_t *)hostHandle; - + /* the callbackFn is initialized in USB_HostGetControllerInterface */ status = hostInstance->controllerTable->controllerIoctl(hostInstance->controllerHandle, kUSB_HostL1Config, lpmParam); @@ -1003,7 +1000,7 @@ usb_status_t USB_HostL1ResumeDeviceResquest(usb_host_handle hostHandle, { usb_host_instance_t *hostInstance; - usb_status_t status = kStatus_USB_Error; + usb_status_t status = kStatus_USB_Error; usb_host_bus_control_t type = kUSB_HostBusL1Resume; if (hostHandle == NULL) @@ -1014,17 +1011,19 @@ usb_status_t USB_HostL1ResumeDeviceResquest(usb_host_handle hostHandle, if (1U == sleepType) { + /* the callbackFn is initialized in USB_HostGetControllerInterface */ status = hostInstance->controllerTable->controllerIoctl(hostInstance->controllerHandle, kUSB_HostBusControl, &type); } else { #if ((defined USB_HOST_CONFIG_HUB) && (USB_HOST_CONFIG_HUB)) -/*To do, if device hub number is 0, need suspend the bus ,else suspend the corresponding device*/ + /*To do, if device hub number is 0, need suspend the bus ,else suspend the corresponding device*/ #endif if (hostInstance->deviceList == deviceHandle) { + /* the callbackFn is initialized in USB_HostGetControllerInterface */ status = hostInstance->controllerTable->controllerIoctl(hostInstance->controllerHandle, kUSB_HostBusControl, &type); } @@ -1050,3 +1049,18 @@ usb_status_t USB_HostUpdateHwTick(usb_host_handle hostHandle, uint64_t tick) return status; } #endif + +#if ((defined(USB_HOST_CONFIG_BATTERY_CHARGER)) && (USB_HOST_CONFIG_BATTERY_CHARGER > 0U)) +usb_status_t USB_HostSetChargerType(usb_host_handle hostHandle, uint8_t type) +{ + usb_host_instance_t *hostInstance; + + if (hostHandle == NULL) + { + return kStatus_USB_InvalidHandle; + } + hostInstance = (usb_host_instance_t *)hostHandle; + return hostInstance->controllerTable->controllerIoctl(hostInstance->controllerHandle, kUSB_HostSetChargerType, + &type); +} +#endif diff --git a/bsp/imxrt/libraries/drivers/usb/host/usb_host_hci.h b/bsp/imxrt/libraries/drivers/usb/host/usb_host_hci.h index 26b6d4a9c5..6139d647c4 100644 --- a/bsp/imxrt/libraries/drivers/usb/host/usb_host_hci.h +++ b/bsp/imxrt/libraries/drivers/usb/host/usb_host_hci.h @@ -1,31 +1,9 @@ /* * Copyright (c) 2015, Freescale Semiconductor, Inc. - * Copyright 2016 NXP + * Copyright 2016 - 2019 NXP + * All rights reserved. * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * o Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * o Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * o Neither the name of the copyright holder nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ #ifndef _USB_HOST_HCI_H_ @@ -36,9 +14,9 @@ ******************************************************************************/ /*! @brief USB host lock */ -#define USB_HostLock() USB_OsaMutexLock(hostInstance->hostMutex) +#define USB_HostLock() OSA_MutexLock(hostInstance->hostMutex, RT_WAITING_FOREVER) /*! @brief USB host unlock */ -#define USB_HostUnlock() USB_OsaMutexUnlock(hostInstance->hostMutex) +#define USB_HostUnlock() OSA_MutexUnlock(hostInstance->hostMutex) /*! * @addtogroup usb_host_controller_driver @@ -56,6 +34,10 @@ typedef enum _usb_host_controller_control kUSB_HostPortAttachDisable, /*!< Disable the port attach event */ kUSB_HostPortAttachEnable, /*!< Enable the port attach event */ kUSB_HostL1Config, /*!< L1 suspend Bus control code */ + kUSB_HostSetChargerType, /*!< set charger type */ +#if ((defined USB_HOST_CONFIG_COMPLIANCE_TEST) && (USB_HOST_CONFIG_COMPLIANCE_TEST)) + kUSB_HostTestModeInit, /*!< intialize charger type */ +#endif } usb_host_controller_control_t; /*! @brief USB host controller bus control code */ @@ -97,7 +79,9 @@ typedef struct _usb_host_controller_interface uint32_t ioctlEvent, void *ioctlParam); /*!< Control a controller function prototype*/ } usb_host_controller_interface_t; - +#if ((defined USB_HOST_CONFIG_COMPLIANCE_TEST) && (USB_HOST_CONFIG_COMPLIANCE_TEST)) +usb_status_t USB_HostTestModeInit(usb_device_handle deviceHandle); +#endif /*! @}*/ /*! @@ -110,7 +94,8 @@ typedef struct _usb_host_instance { void *controllerHandle; /*!< The low level controller handle*/ host_callback_t deviceCallback; /*!< Device attach/detach callback*/ - usb_osa_mutex_handle hostMutex; /*!< Host layer mutex*/ + osa_mutex_handle_t hostMutex; /*!< Host layer mutex*/ + uint32_t mutexBuffer[(OSA_MUTEX_HANDLE_SIZE + 3) / 4]; /*!< Host layer mutex*/ usb_host_transfer_t transferList[USB_HOST_CONFIG_MAX_TRANSFERS]; /*!< Transfer resource*/ usb_host_transfer_t *transferHead; /*!< Idle transfer head*/ const usb_host_controller_interface_t *controllerTable; /*!< KHCI/EHCI interface*/ @@ -126,6 +111,7 @@ typedef struct _usb_host_instance uint8_t controllerId; /*!< The controller ID*/ } usb_host_instance_t; +extern usb_host_instance_t g_UsbHostInstance[USB_HOST_CONFIG_MAX_HOST]; /*! @}*/ #endif /* _USB_HOST_HCI_H_ */ From 75a4efc406892ea9735128d4d5b9286c67272f2d Mon Sep 17 00:00:00 2001 From: LeeChunHei Date: Fri, 22 Jan 2021 11:13:34 +0800 Subject: [PATCH 04/26] Add pulse encoder and usb host to imxrt (not tested) --- bsp/imxrt/imxrt1052-sc-internal/.config | 450 ++++ .../.vscode/c_cpp_properties.json | 18 + .../imxrt1052-sc-internal/.vscode/launch.json | 20 + bsp/imxrt/imxrt1052-sc-internal/Kconfig | 16 + bsp/imxrt/imxrt1052-sc-internal/README.md | 123 + bsp/imxrt/imxrt1052-sc-internal/SConscript | 14 + bsp/imxrt/imxrt1052-sc-internal/SConstruct | 71 + .../applications/SConscript | 16 + .../imxrt1052-sc-internal/applications/main.c | 30 + bsp/imxrt/imxrt1052-sc-internal/board/Kconfig | 240 ++ .../board/MCUX_Config/MCUX_Config.mex | 645 +++++ .../board/MCUX_Config/clock_config.c | 476 ++++ .../board/MCUX_Config/clock_config.h | 116 + .../board/MCUX_Config/pin_mux.c | 274 ++ .../board/MCUX_Config/pin_mux.h | 430 +++ .../imxrt1052-sc-internal/board/SConscript | 17 + bsp/imxrt/imxrt1052-sc-internal/board/board.c | 138 + bsp/imxrt/imxrt1052-sc-internal/board/board.h | 44 + .../board/linker_scripts/link.icf | 95 + .../board/linker_scripts/link.lds | 298 +++ .../board/linker_scripts/link.sct | 92 + .../imxrt1052-sc-internal/figures/board.png | Bin 0 -> 153492 bytes bsp/imxrt/imxrt1052-sc-internal/project.ewd | 1485 +++++++++++ bsp/imxrt/imxrt1052-sc-internal/project.ewp | 1274 +++++++++ bsp/imxrt/imxrt1052-sc-internal/project.eww | 10 + .../imxrt1052-sc-internal/project.uvoptx | 930 +++++++ .../imxrt1052-sc-internal/project.uvprojx | 724 +++++ bsp/imxrt/imxrt1052-sc-internal/rtconfig.h | 184 ++ bsp/imxrt/imxrt1052-sc-internal/rtconfig.py | 160 ++ bsp/imxrt/imxrt1052-sc-internal/template.ewd | 1485 +++++++++++ bsp/imxrt/imxrt1052-sc-internal/template.ewp | 1039 ++++++++ bsp/imxrt/imxrt1052-sc-internal/template.ewt | 2372 +++++++++++++++++ bsp/imxrt/imxrt1052-sc-internal/template.eww | 10 + .../imxrt1052-sc-internal/template.uvoptx | 182 ++ .../imxrt1052-sc-internal/template.uvprojx | 397 +++ .../imxrt1052-sc-internal/xip/SConscript | 18 + .../xip/fsl_flexspi_nor_boot.c | 51 + .../xip/fsl_flexspi_nor_boot.h | 122 + .../xip/fsl_flexspi_nor_config.c | 68 + .../xip/fsl_flexspi_nor_config.h | 268 ++ .../MIMXRT1052/drivers/fsl_os_abstraction.h | 813 ++++++ .../drivers/fsl_os_abstraction_config.h | 36 + .../drivers/fsl_os_abstraction_rtthread.c | 920 +++++++ .../drivers/fsl_os_abstraction_rtthread.h | 130 + .../MIMXRT1052/drivers/generic_list.c | 475 ++++ .../MIMXRT1052/drivers/generic_list.h | 203 ++ .../libraries/drivers/drv_pulse_encoder.c | 160 ++ bsp/imxrt/libraries/drivers/drv_usbh.c | 616 +++++ bsp/imxrt/libraries/drivers/drv_usbh.h | 22 + .../drivers/usb/host/usb_host_framework.c | 262 ++ .../drivers/usb/host/usb_host_framework.h | 131 + .../drivers/usb/include/usb_host_config.h | 282 ++ components/drivers/pm/debug.log | 0 53 files changed, 18452 insertions(+) create mode 100644 bsp/imxrt/imxrt1052-sc-internal/.config create mode 100644 bsp/imxrt/imxrt1052-sc-internal/.vscode/c_cpp_properties.json create mode 100644 bsp/imxrt/imxrt1052-sc-internal/.vscode/launch.json create mode 100644 bsp/imxrt/imxrt1052-sc-internal/Kconfig create mode 100644 bsp/imxrt/imxrt1052-sc-internal/README.md create mode 100644 bsp/imxrt/imxrt1052-sc-internal/SConscript create mode 100644 bsp/imxrt/imxrt1052-sc-internal/SConstruct create mode 100644 bsp/imxrt/imxrt1052-sc-internal/applications/SConscript create mode 100644 bsp/imxrt/imxrt1052-sc-internal/applications/main.c create mode 100644 bsp/imxrt/imxrt1052-sc-internal/board/Kconfig create mode 100644 bsp/imxrt/imxrt1052-sc-internal/board/MCUX_Config/MCUX_Config.mex create mode 100644 bsp/imxrt/imxrt1052-sc-internal/board/MCUX_Config/clock_config.c create mode 100644 bsp/imxrt/imxrt1052-sc-internal/board/MCUX_Config/clock_config.h create mode 100644 bsp/imxrt/imxrt1052-sc-internal/board/MCUX_Config/pin_mux.c create mode 100644 bsp/imxrt/imxrt1052-sc-internal/board/MCUX_Config/pin_mux.h create mode 100644 bsp/imxrt/imxrt1052-sc-internal/board/SConscript create mode 100644 bsp/imxrt/imxrt1052-sc-internal/board/board.c create mode 100644 bsp/imxrt/imxrt1052-sc-internal/board/board.h create mode 100644 bsp/imxrt/imxrt1052-sc-internal/board/linker_scripts/link.icf create mode 100644 bsp/imxrt/imxrt1052-sc-internal/board/linker_scripts/link.lds create mode 100644 bsp/imxrt/imxrt1052-sc-internal/board/linker_scripts/link.sct create mode 100644 bsp/imxrt/imxrt1052-sc-internal/figures/board.png create mode 100644 bsp/imxrt/imxrt1052-sc-internal/project.ewd create mode 100644 bsp/imxrt/imxrt1052-sc-internal/project.ewp create mode 100644 bsp/imxrt/imxrt1052-sc-internal/project.eww create mode 100644 bsp/imxrt/imxrt1052-sc-internal/project.uvoptx create mode 100644 bsp/imxrt/imxrt1052-sc-internal/project.uvprojx create mode 100644 bsp/imxrt/imxrt1052-sc-internal/rtconfig.h create mode 100644 bsp/imxrt/imxrt1052-sc-internal/rtconfig.py create mode 100644 bsp/imxrt/imxrt1052-sc-internal/template.ewd create mode 100644 bsp/imxrt/imxrt1052-sc-internal/template.ewp create mode 100644 bsp/imxrt/imxrt1052-sc-internal/template.ewt create mode 100644 bsp/imxrt/imxrt1052-sc-internal/template.eww create mode 100644 bsp/imxrt/imxrt1052-sc-internal/template.uvoptx create mode 100644 bsp/imxrt/imxrt1052-sc-internal/template.uvprojx create mode 100644 bsp/imxrt/imxrt1052-sc-internal/xip/SConscript create mode 100644 bsp/imxrt/imxrt1052-sc-internal/xip/fsl_flexspi_nor_boot.c create mode 100644 bsp/imxrt/imxrt1052-sc-internal/xip/fsl_flexspi_nor_boot.h create mode 100644 bsp/imxrt/imxrt1052-sc-internal/xip/fsl_flexspi_nor_config.c create mode 100644 bsp/imxrt/imxrt1052-sc-internal/xip/fsl_flexspi_nor_config.h create mode 100644 bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/drivers/fsl_os_abstraction.h create mode 100644 bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/drivers/fsl_os_abstraction_config.h create mode 100644 bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/drivers/fsl_os_abstraction_rtthread.c create mode 100644 bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/drivers/fsl_os_abstraction_rtthread.h create mode 100644 bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/drivers/generic_list.c create mode 100644 bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/drivers/generic_list.h create mode 100644 bsp/imxrt/libraries/drivers/drv_pulse_encoder.c create mode 100644 bsp/imxrt/libraries/drivers/drv_usbh.c create mode 100644 bsp/imxrt/libraries/drivers/drv_usbh.h create mode 100644 bsp/imxrt/libraries/drivers/usb/host/usb_host_framework.c create mode 100644 bsp/imxrt/libraries/drivers/usb/host/usb_host_framework.h create mode 100644 bsp/imxrt/libraries/drivers/usb/include/usb_host_config.h create mode 100644 components/drivers/pm/debug.log diff --git a/bsp/imxrt/imxrt1052-sc-internal/.config b/bsp/imxrt/imxrt1052-sc-internal/.config new file mode 100644 index 0000000000..8c9b6cfc6f --- /dev/null +++ b/bsp/imxrt/imxrt1052-sc-internal/.config @@ -0,0 +1,450 @@ +# +# Automatically generated file; DO NOT EDIT. +# RT-Thread Configuration +# + +# +# RT-Thread Kernel +# +CONFIG_RT_NAME_MAX=8 +# CONFIG_RT_USING_ARCH_DATA_TYPE is not set +# CONFIG_RT_USING_SMP is not set +CONFIG_RT_ALIGN_SIZE=4 +# CONFIG_RT_THREAD_PRIORITY_8 is not set +CONFIG_RT_THREAD_PRIORITY_32=y +# CONFIG_RT_THREAD_PRIORITY_256 is not set +CONFIG_RT_THREAD_PRIORITY_MAX=32 +CONFIG_RT_TICK_PER_SECOND=100 +CONFIG_RT_USING_OVERFLOW_CHECK=y +CONFIG_RT_USING_HOOK=y +CONFIG_RT_USING_IDLE_HOOK=y +CONFIG_RT_IDLE_HOOK_LIST_SIZE=4 +CONFIG_IDLE_THREAD_STACK_SIZE=256 +# CONFIG_RT_USING_TIMER_SOFT is not set +CONFIG_RT_DEBUG=y +CONFIG_RT_DEBUG_COLOR=y +# CONFIG_RT_DEBUG_INIT_CONFIG is not set +# CONFIG_RT_DEBUG_THREAD_CONFIG is not set +# CONFIG_RT_DEBUG_SCHEDULER_CONFIG is not set +# CONFIG_RT_DEBUG_IPC_CONFIG is not set +# CONFIG_RT_DEBUG_TIMER_CONFIG is not set +# CONFIG_RT_DEBUG_IRQ_CONFIG is not set +# CONFIG_RT_DEBUG_MEM_CONFIG is not set +# CONFIG_RT_DEBUG_SLAB_CONFIG is not set +# CONFIG_RT_DEBUG_MEMHEAP_CONFIG is not set +# CONFIG_RT_DEBUG_MODULE_CONFIG is not set + +# +# Inter-Thread communication +# +CONFIG_RT_USING_SEMAPHORE=y +CONFIG_RT_USING_MUTEX=y +CONFIG_RT_USING_EVENT=y +CONFIG_RT_USING_MAILBOX=y +CONFIG_RT_USING_MESSAGEQUEUE=y +# CONFIG_RT_USING_SIGNALS is not set + +# +# Memory Management +# +CONFIG_RT_USING_MEMPOOL=y +CONFIG_RT_USING_MEMHEAP=y +# CONFIG_RT_USING_NOHEAP is not set +# CONFIG_RT_USING_SMALL_MEM is not set +# CONFIG_RT_USING_SLAB is not set +CONFIG_RT_USING_MEMHEAP_AS_HEAP=y +# CONFIG_RT_USING_USERHEAP is not set +CONFIG_RT_USING_HEAP=y + +# +# Kernel Device Object +# +CONFIG_RT_USING_DEVICE=y +# CONFIG_RT_USING_DEVICE_OPS is not set +# CONFIG_RT_USING_INTERRUPT_INFO is not set +CONFIG_RT_USING_CONSOLE=y +CONFIG_RT_CONSOLEBUF_SIZE=128 +CONFIG_RT_CONSOLE_DEVICE_NAME="uart1" +CONFIG_RT_VER_NUM=0x40003 +# CONFIG_RT_USING_CPU_FFS is not set +# CONFIG_ARCH_CPU_STACK_GROWS_UPWARD is not set + +# +# RT-Thread Components +# +CONFIG_RT_USING_COMPONENTS_INIT=y +CONFIG_RT_USING_USER_MAIN=y +CONFIG_RT_MAIN_THREAD_STACK_SIZE=2048 +CONFIG_RT_MAIN_THREAD_PRIORITY=10 + +# +# C++ features +# +# CONFIG_RT_USING_CPLUSPLUS is not set + +# +# Command shell +# +CONFIG_RT_USING_FINSH=y +CONFIG_FINSH_THREAD_NAME="tshell" +CONFIG_FINSH_USING_HISTORY=y +CONFIG_FINSH_HISTORY_LINES=5 +CONFIG_FINSH_USING_SYMTAB=y +CONFIG_FINSH_USING_DESCRIPTION=y +# CONFIG_FINSH_ECHO_DISABLE_DEFAULT is not set +CONFIG_FINSH_THREAD_PRIORITY=20 +CONFIG_FINSH_THREAD_STACK_SIZE=4096 +CONFIG_FINSH_CMD_SIZE=80 +# CONFIG_FINSH_USING_AUTH is not set +CONFIG_FINSH_USING_MSH=y +CONFIG_FINSH_USING_MSH_DEFAULT=y +CONFIG_FINSH_USING_MSH_ONLY=y +CONFIG_FINSH_ARG_MAX=10 + +# +# Device virtual file system +# +CONFIG_RT_USING_DFS=y +CONFIG_DFS_USING_WORKDIR=y +CONFIG_DFS_FILESYSTEMS_MAX=2 +CONFIG_DFS_FILESYSTEM_TYPES_MAX=2 +CONFIG_DFS_FD_MAX=16 +# CONFIG_RT_USING_DFS_MNTTABLE is not set +# CONFIG_RT_USING_DFS_ELMFAT is not set +CONFIG_RT_USING_DFS_DEVFS=y +# CONFIG_RT_USING_DFS_ROMFS is not set +# CONFIG_RT_USING_DFS_RAMFS is not set +# CONFIG_RT_USING_DFS_UFFS is not set +# CONFIG_RT_USING_DFS_JFFS2 is not set + +# +# Device Drivers +# +CONFIG_RT_USING_DEVICE_IPC=y +CONFIG_RT_PIPE_BUFSZ=512 +# CONFIG_RT_USING_SYSTEM_WORKQUEUE is not set +CONFIG_RT_USING_SERIAL=y +CONFIG_RT_SERIAL_USING_DMA=y +CONFIG_RT_SERIAL_RB_BUFSZ=64 +# CONFIG_RT_USING_CAN is not set +# CONFIG_RT_USING_HWTIMER is not set +CONFIG_RT_USING_CPUTIME=y +# CONFIG_RT_USING_I2C is not set +# CONFIG_RT_USING_PHY is not set +CONFIG_RT_USING_PIN=y +# CONFIG_RT_USING_ADC is not set +# CONFIG_RT_USING_DAC is not set +# CONFIG_RT_USING_PWM is not set +# CONFIG_RT_USING_MTD_NOR is not set +# CONFIG_RT_USING_MTD_NAND is not set +# CONFIG_RT_USING_PM is not set +# CONFIG_RT_USING_RTC is not set +# CONFIG_RT_USING_SDIO is not set +# CONFIG_RT_USING_SPI is not set +# CONFIG_RT_USING_WDT is not set +# CONFIG_RT_USING_AUDIO is not set +# CONFIG_RT_USING_SENSOR is not set +# CONFIG_RT_USING_TOUCH is not set +# CONFIG_RT_USING_HWCRYPTO is not set +CONFIG_RT_USING_PULSE_ENCODER=y +# CONFIG_RT_USING_INPUT_CAPTURE is not set +# CONFIG_RT_USING_WIFI is not set + +# +# Using USB +# +CONFIG_RT_USING_USB_HOST=y +CONFIG_RT_USBH_MSTORAGE=y +CONFIG_UDISK_MOUNTPOINT="/" +# CONFIG_RT_USING_USB_DEVICE is not set +CONFIG_RT_USBD_THREAD_STACK_SZ=4096 + +# +# POSIX layer and C standard library +# +CONFIG_RT_USING_LIBC=y +# CONFIG_RT_USING_PTHREADS is not set +CONFIG_RT_USING_POSIX=y +# CONFIG_RT_USING_POSIX_MMAP is not set +# CONFIG_RT_USING_POSIX_TERMIOS is not set +# CONFIG_RT_USING_POSIX_GETLINE is not set +# CONFIG_RT_USING_POSIX_AIO is not set +# CONFIG_RT_USING_MODULE is not set + +# +# Network +# + +# +# Socket abstraction layer +# +# CONFIG_RT_USING_SAL is not set + +# +# Network interface device +# +# CONFIG_RT_USING_NETDEV is not set + +# +# light weight TCP/IP stack +# +# CONFIG_RT_USING_LWIP is not set + +# +# AT commands +# +# CONFIG_RT_USING_AT is not set + +# +# VBUS(Virtual Software BUS) +# +# CONFIG_RT_USING_VBUS is not set + +# +# Utilities +# +# CONFIG_RT_USING_RYM is not set +# CONFIG_RT_USING_ULOG is not set +# CONFIG_RT_USING_UTEST is not set + +# +# RT-Thread online packages +# + +# +# IoT - internet of things +# +# CONFIG_PKG_USING_PAHOMQTT is not set +# CONFIG_PKG_USING_WEBCLIENT is not set +# CONFIG_PKG_USING_WEBNET is not set +# CONFIG_PKG_USING_MONGOOSE is not set +# CONFIG_PKG_USING_MYMQTT is not set +# CONFIG_PKG_USING_MQTTCLIENT is not set +# CONFIG_PKG_USING_WEBTERMINAL is not set +# CONFIG_PKG_USING_CJSON is not set +# CONFIG_PKG_USING_JSMN is not set +# CONFIG_PKG_USING_LIBMODBUS is not set +# CONFIG_PKG_USING_FREEMODBUS is not set +# CONFIG_PKG_USING_LJSON is not set +# CONFIG_PKG_USING_EZXML is not set +# CONFIG_PKG_USING_NANOPB is not set + +# +# Wi-Fi +# + +# +# Marvell WiFi +# +# CONFIG_PKG_USING_WLANMARVELL is not set + +# +# Wiced WiFi +# +# CONFIG_PKG_USING_WLAN_WICED is not set +# CONFIG_PKG_USING_RW007 is not set +# CONFIG_PKG_USING_COAP is not set +# CONFIG_PKG_USING_NOPOLL is not set +# CONFIG_PKG_USING_NETUTILS is not set +# CONFIG_PKG_USING_PPP_DEVICE is not set +# CONFIG_PKG_USING_AT_DEVICE is not set +# CONFIG_PKG_USING_ATSRV_SOCKET is not set +# CONFIG_PKG_USING_WIZNET is not set + +# +# IoT Cloud +# +# CONFIG_PKG_USING_ONENET is not set +# CONFIG_PKG_USING_GAGENT_CLOUD is not set +# CONFIG_PKG_USING_ALI_IOTKIT is not set +# CONFIG_PKG_USING_AZURE is not set +# CONFIG_PKG_USING_TENCENT_IOTHUB is not set +# CONFIG_PKG_USING_JIOT-C-SDK is not set +# CONFIG_PKG_USING_UCLOUD_IOT_SDK is not set +# CONFIG_PKG_USING_NIMBLE is not set +# CONFIG_PKG_USING_OTA_DOWNLOADER is not set +# CONFIG_PKG_USING_IPMSG is not set +# CONFIG_PKG_USING_LSSDP is not set +# CONFIG_PKG_USING_AIRKISS_OPEN is not set +# CONFIG_PKG_USING_LIBRWS is not set +# CONFIG_PKG_USING_TCPSERVER is not set +# CONFIG_PKG_USING_PROTOBUF_C is not set +# CONFIG_PKG_USING_ONNX_PARSER is not set +# CONFIG_PKG_USING_ONNX_BACKEND is not set +# CONFIG_PKG_USING_DLT645 is not set +# CONFIG_PKG_USING_QXWZ is not set +# CONFIG_PKG_USING_SMTP_CLIENT is not set +# CONFIG_PKG_USING_ABUP_FOTA is not set +# CONFIG_PKG_USING_LIBCURL2RTT is not set +# CONFIG_PKG_USING_CAPNP is not set +# CONFIG_PKG_USING_RT_CJSON_TOOLS is not set +# CONFIG_PKG_USING_AGILE_TELNET is not set + +# +# security packages +# +# CONFIG_PKG_USING_MBEDTLS is not set +# CONFIG_PKG_USING_libsodium is not set +# CONFIG_PKG_USING_TINYCRYPT is not set +# CONFIG_PKG_USING_TFM is not set + +# +# language packages +# +# CONFIG_PKG_USING_LUA is not set +# CONFIG_PKG_USING_JERRYSCRIPT is not set +# CONFIG_PKG_USING_MICROPYTHON is not set + +# +# multimedia packages +# +# CONFIG_PKG_USING_OPENMV is not set +# CONFIG_PKG_USING_MUPDF is not set +# CONFIG_PKG_USING_STEMWIN is not set +# CONFIG_PKG_USING_WAVPLAYER is not set +# CONFIG_PKG_USING_TJPGD is not set + +# +# tools packages +# +# CONFIG_PKG_USING_CMBACKTRACE is not set +# CONFIG_PKG_USING_EASYFLASH is not set +# CONFIG_PKG_USING_EASYLOGGER is not set +# CONFIG_PKG_USING_SYSTEMVIEW is not set +# CONFIG_PKG_USING_RDB is not set +# CONFIG_PKG_USING_QRCODE is not set +# CONFIG_PKG_USING_ULOG_EASYFLASH is not set +# CONFIG_PKG_USING_ADBD is not set +# CONFIG_PKG_USING_COREMARK is not set +# CONFIG_PKG_USING_DHRYSTONE is not set +# CONFIG_PKG_USING_NR_MICRO_SHELL is not set +# CONFIG_PKG_USING_CHINESE_FONT_LIBRARY is not set +# CONFIG_PKG_USING_LUNAR_CALENDAR is not set +# CONFIG_PKG_USING_BS8116A is not set + +# +# system packages +# +# CONFIG_PKG_USING_GUIENGINE is not set +# CONFIG_PKG_USING_CAIRO is not set +# CONFIG_PKG_USING_PIXMAN is not set +# CONFIG_PKG_USING_LWEXT4 is not set +# CONFIG_PKG_USING_PARTITION is not set +# CONFIG_PKG_USING_FAL is not set +# CONFIG_PKG_USING_SQLITE is not set +# CONFIG_PKG_USING_RTI is not set +# CONFIG_PKG_USING_LITTLEVGL2RTT is not set +# CONFIG_PKG_USING_CMSIS is not set +# CONFIG_PKG_USING_DFS_YAFFS is not set +# CONFIG_PKG_USING_LITTLEFS is not set +# CONFIG_PKG_USING_THREAD_POOL is not set +# CONFIG_PKG_USING_ROBOTS is not set +# CONFIG_PKG_USING_EV is not set +# CONFIG_PKG_USING_SYSWATCH is not set + +# +# peripheral libraries and drivers +# +# CONFIG_PKG_USING_SENSORS_DRIVERS is not set +# CONFIG_PKG_USING_REALTEK_AMEBA is not set +# CONFIG_PKG_USING_SHT2X is not set +# CONFIG_PKG_USING_SHT3X is not set +# CONFIG_PKG_USING_STM32_SDIO is not set +# CONFIG_PKG_USING_ICM20608 is not set +# CONFIG_PKG_USING_U8G2 is not set +# CONFIG_PKG_USING_BUTTON is not set +# CONFIG_PKG_USING_PCF8574 is not set +# CONFIG_PKG_USING_SX12XX is not set +# CONFIG_PKG_USING_SIGNAL_LED is not set +# CONFIG_PKG_USING_LEDBLINK is not set +# CONFIG_PKG_USING_LITTLED is not set +# CONFIG_PKG_USING_WM_LIBRARIES is not set +# CONFIG_PKG_USING_KENDRYTE_SDK is not set +# CONFIG_PKG_USING_INFRARED is not set +# CONFIG_PKG_USING_ROSSERIAL is not set +# CONFIG_PKG_USING_AGILE_BUTTON is not set +# CONFIG_PKG_USING_AGILE_LED is not set +# CONFIG_PKG_USING_AT24CXX is not set +# CONFIG_PKG_USING_MOTIONDRIVER2RTT is not set +# CONFIG_PKG_USING_AD7746 is not set +# CONFIG_PKG_USING_PCA9685 is not set +# CONFIG_PKG_USING_I2C_TOOLS is not set +# CONFIG_PKG_USING_NRF24L01 is not set +# CONFIG_PKG_USING_TOUCH_DRIVERS is not set +# CONFIG_PKG_USING_MAX17048 is not set +# CONFIG_PKG_USING_RPLIDAR is not set +# CONFIG_PKG_USING_AS608 is not set +# CONFIG_PKG_USING_RC522 is not set +# CONFIG_PKG_USING_EMBARC_BSP is not set + +# +# miscellaneous packages +# +# CONFIG_PKG_USING_LIBCSV is not set +# CONFIG_PKG_USING_OPTPARSE is not set +# CONFIG_PKG_USING_FASTLZ is not set +# CONFIG_PKG_USING_MINILZO is not set +# CONFIG_PKG_USING_QUICKLZ is not set +# CONFIG_PKG_USING_MULTIBUTTON is not set +# CONFIG_PKG_USING_FLEXIBLE_BUTTON is not set +# CONFIG_PKG_USING_CANFESTIVAL is not set +# CONFIG_PKG_USING_ZLIB is not set +# CONFIG_PKG_USING_DSTR is not set +# CONFIG_PKG_USING_TINYFRAME is not set +# CONFIG_PKG_USING_KENDRYTE_DEMO is not set +# CONFIG_PKG_USING_DIGITALCTRL is not set +# CONFIG_PKG_USING_UPACKER is not set +# CONFIG_PKG_USING_UPARAM is not set + +# +# samples: kernel and components samples +# +# CONFIG_PKG_USING_KERNEL_SAMPLES is not set +# CONFIG_PKG_USING_FILESYSTEM_SAMPLES is not set +# CONFIG_PKG_USING_NETWORK_SAMPLES is not set +# CONFIG_PKG_USING_PERIPHERAL_SAMPLES is not set +# CONFIG_PKG_USING_HELLO is not set +# CONFIG_PKG_USING_VI is not set +# CONFIG_PKG_USING_NNOM is not set +# CONFIG_PKG_USING_LIBANN is not set +# CONFIG_PKG_USING_ELAPACK is not set +# CONFIG_PKG_USING_ARMv7M_DWT is not set +# CONFIG_PKG_USING_VT100 is not set +# CONFIG_PKG_USING_ULAPACK is not set +# CONFIG_PKG_USING_UKAL is not set + +# +# Hardware Drivers Config +# +CONFIG_SOC_IMXRT1052CVL5B=y + +# +# On-chip Peripheral Drivers +# +# CONFIG_BSP_USING_DMA is not set +CONFIG_BSP_USING_GPIO=y +CONFIG_BSP_USING_LPUART=y +CONFIG_BSP_USING_LPUART1=y +# CONFIG_BSP_LPUART1_RX_USING_DMA is not set +# CONFIG_BSP_LPUART1_TX_USING_DMA is not set +# CONFIG_BSP_USING_LPUART4 is not set +# CONFIG_BSP_USING_PWM is not set +# CONFIG_BSP_USING_I2C is not set +# CONFIG_BSP_USING_SPI is not set +CONFIG_BSP_USING_PULSE_ENCODER=y +CONFIG_BSP_USING_PULSE_ENCODER1=y +CONFIG_BSP_USING_USB=y +CONFIG_BSP_USING_USB0=y +CONFIG_BSP_USB0_HOST=y +# CONFIG_BSP_USB0_DEVICE is not set +# CONFIG_BSP_USING_USB1 is not set + +# +# Onboard Peripheral Drivers +# +# CONFIG_BSP_USING_SDRAM is not set +# CONFIG_BSP_USING_MPU6050 is not set + +# +# Board extended module Drivers +# diff --git a/bsp/imxrt/imxrt1052-sc-internal/.vscode/c_cpp_properties.json b/bsp/imxrt/imxrt1052-sc-internal/.vscode/c_cpp_properties.json new file mode 100644 index 0000000000..aeaa491edc --- /dev/null +++ b/bsp/imxrt/imxrt1052-sc-internal/.vscode/c_cpp_properties.json @@ -0,0 +1,18 @@ +{ + "configurations": [ + { + "name": "Win32", + "includePath": [ + "${workspaceFolder}/**" + ], + "defines": [ + "_DEBUG", + "UNICODE", + "_UNICODE" + ], + "intelliSenseMode": "gcc-x64", + "compilerPath": "C:/Program Files (x86)/GNU Arm Embedded Toolchain/9 2020-q2-update/bin/arm-none-eabi-gcc.exe" + } + ], + "version": 4 +} \ No newline at end of file diff --git a/bsp/imxrt/imxrt1052-sc-internal/.vscode/launch.json b/bsp/imxrt/imxrt1052-sc-internal/.vscode/launch.json new file mode 100644 index 0000000000..19a408f93f --- /dev/null +++ b/bsp/imxrt/imxrt1052-sc-internal/.vscode/launch.json @@ -0,0 +1,20 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Cortex Debug", + "cwd": "${workspaceRoot}", + "executable": "./rtthread.elf", + "request": "launch", + "type": "cortex-debug", + "servertype": "jlink", + "serverpath": "C:/Program Files (x86)/SEGGER/JLink/JLinkGDBServerCL.exe", + "device": "MCIMXRT1052QSPI", + "runToMain": true, + "interface": "swd" + } + ] +} \ No newline at end of file diff --git a/bsp/imxrt/imxrt1052-sc-internal/Kconfig b/bsp/imxrt/imxrt1052-sc-internal/Kconfig new file mode 100644 index 0000000000..c9221717cb --- /dev/null +++ b/bsp/imxrt/imxrt1052-sc-internal/Kconfig @@ -0,0 +1,16 @@ +mainmenu "RT-Thread Configuration" + +config RTT_DIR + string + option env="RTT_ROOT" + default "../../.." + +config PKGS_DIR + string + option env="PKGS_ROOT" + default "packages" + +source "$RTT_DIR/Kconfig" +source "$PKGS_DIR/Kconfig" +source "../libraries/Kconfig" +source "board/Kconfig" diff --git a/bsp/imxrt/imxrt1052-sc-internal/README.md b/bsp/imxrt/imxrt1052-sc-internal/README.md new file mode 100644 index 0000000000..476a9528f2 --- /dev/null +++ b/bsp/imxrt/imxrt1052-sc-internal/README.md @@ -0,0 +1,123 @@ +# BSP README 模板 + +## 简介 + +本文档为 xxx 开发板的 BSP (板级支持包) 说明。 + +主要内容如下: + +- 开发板资源介绍 +- BSP 快速上手 +- 进阶使用方法 + +通过阅读快速上手章节开发者可以快速地上手该 BSP,将 RT-Thread 运行在开发板上。在进阶使用指南章节,将会介绍更多高级功能,帮助开发者利用 RT-Thread 驱动更多板载资源。 + +## 开发板介绍 + +【此处简单介绍一下开发板】 + +开发板外观如下图所示: + +![board](figures/board.png) + +该开发板常用 **板载资源** 如下: + +- MCU:MIMXRT105xxx,主频 xxxMHz,xxxKB FLASH ,xxxKB RAM +- 外部 RAM:型号,xMB +- 外部 FLASH:型号,xMB +- 常用外设 + - LED:x个,DS0(红色,PB1),DS1(绿色,PB0) + - 按键:x个,K0(兼具唤醒功能,PA0),K1(PC13) +- 常用接口:USB 转串口、SD 卡接口、以太网接口、LCD 接口等 +- 调试接口,标准 JTAG/SWD + +开发板更多详细信息请参考【厂商名】 [xxx开发板介绍](https://xxx)。 + +## 外设支持 + +本 BSP 目前对外设的支持情况如下: + +| **板载外设** | **支持情况** | **备注** | +| :----------------- | :----------: | :------------------------------------- | +| USB 转串口 | 支持 | | +| SPI Flash | 支持 | | +| 以太网 | 支持 | | +| SD卡 | 暂不支持 | | +| CAN | 暂不支持 | | +| **片上外设** | **支持情况** | **备注** | +| GPIO | 支持 | PA0, PA1... PK15 ---> PIN: 0, 1...176 | +| UART | 支持 | UART1/x/x | +| SPI | 支持 | SPI1/x/x | +| I2C | 支持 | 软件 I2C | +| SDIO | 暂不支持 | 即将支持 | +| RTC | 暂不支持 | 即将支持 | +| PWM | 暂不支持 | 即将支持 | +| USB Device | 暂不支持 | 即将支持 | +| USB Host | 暂不支持 | 即将支持 | +| IWG | 暂不支持 | 即将支持 | +| **扩展模块** | **支持情况** | **备注** | +| xxx 模块 | 支持 | | + +## 使用说明 + +使用说明分为如下两个章节: + +- 快速上手 + + 本章节是为刚接触 RT-Thread 的新手准备的使用说明,遵循简单的步骤即可将 RT-Thread 操作系统运行在该开发板上,看到实验效果 。 + +- 进阶使用 + + 本章节是为需要在 RT-Thread 操作系统上使用更多开发板资源的开发者准备的。通过使用 ENV 工具对 BSP 进行配置,可以开启更多板载资源,实现更多高级功能。 + + +### 快速上手 + +本 BSP 为开发者提供 MDK4、MDK5 和 IAR 工程,并且支持 GCC 开发环境。下面以 MDK5 开发环境为例,介绍如何将系统运行起来。 + +#### 硬件连接 + +使用数据线连接开发板到 PC,打开电源开关。 + +#### 编译下载 + +双击 project.uvprojx 文件,打开 MDK5 工程,编译并下载程序到开发板。 + +> 工程默认配置使用 xxx 仿真器下载程序,在通过 xxx 连接开发板的基础上,点击下载按钮即可下载程序到开发板 + +#### 运行结果 + +下载程序成功之后,系统会自动运行,【这里写开发板运行起来之后的现象,如:LED 闪烁等】。 + +连接开发板对应串口到 PC , 在终端工具里打开相应的串口(115200-8-1-N),复位设备后,可以看到 RT-Thread 的输出信息: + +```bash + \ | / +- RT - Thread Operating System + / | \ 3.1.1 build Nov 19 2018 + 2006 - 2018 Copyright by rt-thread team +msh > +``` +### 进阶使用 + +此 BSP 默认只开启了 GPIO 和 串口1 的功能,如果需使用 SD 卡、Flash 等更多高级功能,需要利用 ENV 工具对BSP 进行配置,步骤如下: + +1. 在 bsp 下打开 env 工具。 + +2. 输入`menuconfig`命令配置工程,配置好之后保存退出。 + +3. 输入`pkgs --update`命令更新软件包。 + +4. 输入`scons --target=mdk4/mdk5/iar` 命令重新生成工程。 + +本章节更多详细的介绍请参考 [IMXRT 系列 BSP 外设驱动使用教程](../docs/IMXRT系列BSP外设驱动使用教程.md)。 + +## 注意事项 + +- xxx + +## 联系人信息 + +维护人: + +- [xxx](https://个人主页), 邮箱: \ No newline at end of file diff --git a/bsp/imxrt/imxrt1052-sc-internal/SConscript b/bsp/imxrt/imxrt1052-sc-internal/SConscript new file mode 100644 index 0000000000..c7ef7659ec --- /dev/null +++ b/bsp/imxrt/imxrt1052-sc-internal/SConscript @@ -0,0 +1,14 @@ +# for module compiling +import os +from building import * + +cwd = GetCurrentDir() +objs = [] +list = os.listdir(cwd) + +for d in list: + path = os.path.join(cwd, d) + if os.path.isfile(os.path.join(path, 'SConscript')): + objs = objs + SConscript(os.path.join(d, 'SConscript')) + +Return('objs') diff --git a/bsp/imxrt/imxrt1052-sc-internal/SConstruct b/bsp/imxrt/imxrt1052-sc-internal/SConstruct new file mode 100644 index 0000000000..9e5cd55bc0 --- /dev/null +++ b/bsp/imxrt/imxrt1052-sc-internal/SConstruct @@ -0,0 +1,71 @@ +import os +import sys +import rtconfig + +if os.getenv('RTT_ROOT'): + RTT_ROOT = os.getenv('RTT_ROOT') +else: + RTT_ROOT = os.path.normpath(os.getcwd() + '/../../..') + +sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools')] +try: + from building import * +except: + print('Cannot found RT-Thread root directory, please check RTT_ROOT') + print(RTT_ROOT) + exit(-1) + +TARGET = 'rtthread.' + rtconfig.TARGET_EXT +DefaultEnvironment(tools=[]) +if rtconfig.PLATFORM == 'armcc': + env = Environment(tools = ['mingw'], + AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS, + CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS, + CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS, + AR = rtconfig.AR, ARFLAGS = '-rc', + LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS, + # overwrite cflags, because cflags has '--C99' + CXXCOM = '$CXX -o $TARGET --cpp -c $CXXFLAGS $_CCCOMCOM $SOURCES') +else: + env = Environment(tools = ['mingw'], + AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS, + CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS, + CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS, + AR = rtconfig.AR, ARFLAGS = '-rc', + LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS, + CXXCOM = '$CXX -o $TARGET -c $CXXFLAGS $_CCCOMCOM $SOURCES') + +env.PrependENVPath('PATH', rtconfig.EXEC_PATH) + +if rtconfig.PLATFORM == 'iar': + env.Replace(CCCOM = ['$CC $CCFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -o $TARGET $SOURCES']) + env.Replace(ARFLAGS = ['']) + env.Replace(LINKCOM = env["LINKCOM"] + ' --map rtthread.map') + +Export('RTT_ROOT') +Export('rtconfig') + +SDK_ROOT = os.path.abspath('./') + +if os.path.exists(SDK_ROOT + '/libraries'): + libraries_path_prefix = SDK_ROOT + '/libraries' +else: + libraries_path_prefix = os.path.dirname(SDK_ROOT) + '/libraries' + +SDK_LIB = libraries_path_prefix +Export('SDK_LIB') + +# prepare building environment +objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=False) + +imxrt_library = 'MIMXRT1050' +rtconfig.BSP_LIBRARY_TYPE = imxrt_library + +# include libraries +objs.extend(SConscript(os.path.join(libraries_path_prefix, imxrt_library, 'SConscript'))) + +# include drivers +objs.extend(SConscript(os.path.join(libraries_path_prefix, 'drivers', 'SConscript'))) + +# make a building +DoBuilding(TARGET, objs) diff --git a/bsp/imxrt/imxrt1052-sc-internal/applications/SConscript b/bsp/imxrt/imxrt1052-sc-internal/applications/SConscript new file mode 100644 index 0000000000..78952a658e --- /dev/null +++ b/bsp/imxrt/imxrt1052-sc-internal/applications/SConscript @@ -0,0 +1,16 @@ +import rtconfig +from building import * + +cwd = GetCurrentDir() +src = Glob('*.c') +CPPPATH = [cwd] + +# add for startup script +if rtconfig.CROSS_TOOL == 'gcc': + CPPDEFINES = ['__START=entry'] +else: + CPPDEFINES = [] + +group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH, CPPDEFINES=CPPDEFINES) + +Return('group') diff --git a/bsp/imxrt/imxrt1052-sc-internal/applications/main.c b/bsp/imxrt/imxrt1052-sc-internal/applications/main.c new file mode 100644 index 0000000000..4365059073 --- /dev/null +++ b/bsp/imxrt/imxrt1052-sc-internal/applications/main.c @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2006-2018, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2019-04-29 tyustli first version + */ + +#include +#include "drv_gpio.h" + +/* defined the LED pin: GPIO1_IO9 */ +#define LED0_PIN GET_PIN(1, 9) + +int main(void) +{ + /* set LED0 pin mode to output */ + rt_pin_mode(LED0_PIN, PIN_MODE_OUTPUT); + + while (1) + { + rt_pin_write(LED0_PIN, PIN_HIGH); + rt_thread_mdelay(500); + rt_pin_write(LED0_PIN, PIN_LOW); + rt_thread_mdelay(500); + } +} + diff --git a/bsp/imxrt/imxrt1052-sc-internal/board/Kconfig b/bsp/imxrt/imxrt1052-sc-internal/board/Kconfig new file mode 100644 index 0000000000..896a652279 --- /dev/null +++ b/bsp/imxrt/imxrt1052-sc-internal/board/Kconfig @@ -0,0 +1,240 @@ +menu "Hardware Drivers Config" + +config SOC_IMXRT1052CVL5B + bool + select SOC_MIMXRT1050_SERIES + select RT_USING_COMPONENTS_INIT + select RT_USING_USER_MAIN + default y + +menu "On-chip Peripheral Drivers" + + config BSP_USING_DMA + bool "Enable DMA" + default n + + config BSP_USING_GPIO + bool "Enable GPIO" + select RT_USING_PIN + default y + + menuconfig BSP_USING_LPUART + bool "Enable UART" + select RT_USING_SERIAL + default y + + if BSP_USING_LPUART + config BSP_USING_LPUART1 + bool "Enable LPUART1" + default y + + config BSP_LPUART1_RX_USING_DMA + bool "Enable LPUART1 RX DMA" + depends on BSP_USING_LPUART1 + select BSP_USING_DMA + select RT_SERIAL_USING_DMA + default n + + config BSP_LPUART1_RX_DMA_CHANNEL + depends on BSP_LPUART1_RX_USING_DMA + int "Set LPUART1 RX DMA channel (0-32)" + default 0 + + config BSP_LPUART1_TX_USING_DMA + bool "Enable LPUART1 TX DMA" + depends on BSP_USING_LPUART1 + select BSP_USING_DMA + select RT_SERIAL_USING_DMA + default n + + config BSP_LPUART1_TX_DMA_CHANNEL + depends on BSP_LPUART1_TX_USING_DMA + int "Set LPUART1 TX DMA channel (0-32)" + default 1 + config BSP_USING_LPUART4 + bool "Enable LPUART4" + default y + + config BSP_LPUART4_RX_USING_DMA + bool "Enable LPUART4 RX DMA" + depends on BSP_USING_LPUART4 + select BSP_USING_DMA + select RT_SERIAL_USING_DMA + default n + + config BSP_LPUART4_RX_DMA_CHANNEL + depends on BSP_LPUART4_RX_USING_DMA + int "Set LPUART4 RX DMA channel (0-32)" + default 0 + + config BSP_LPUART4_TX_USING_DMA + bool "Enable LPUART4 TX DMA" + depends on BSP_USING_LPUART4 + select BSP_USING_DMA + select RT_SERIAL_USING_DMA + default n + + config BSP_LPUART4_TX_DMA_CHANNEL + depends on BSP_LPUART4_TX_USING_DMA + int "Set LPUART4 TX DMA channel (0-32)" + default 1 + endif + + menuconfig BSP_USING_PWM + bool "Enable PWM" + default n + select RT_USING_PWM + if BSP_USING_PWM + menuconfig BSP_USING_PWM2 + bool "Enable output pwm2" + default n + if BSP_USING_PWM2 + config BSP_USING_PWM2_CH0 + bool "Enable PWM2 channel0" + default n + config BSP_USING_PWM2_CH1 + bool "Enable PWM2 channel1" + default n + config BSP_USING_PWM2_CH2 + bool "Enable PWM2 channel2" + default n + config BSP_USING_PWM2_CH3 + bool "Enable PWM2 channel3" + default n + endif + endif + + menuconfig BSP_USING_I2C + bool "Enable I2C" + select RT_USING_I2C + default n + if BSP_USING_I2C + menuconfig BSP_USING_I2C1 + bool "Enable I2C1" + default n + if BSP_USING_I2C1 + choice + prompt "Select I2C1 badurate" + default HW_I2C1_BADURATE_100kHZ + + config HW_I2C1_BADURATE_100kHZ + bool "Badurate 100kHZ" + + config HW_I2C1_BADURATE_400kHZ + bool "Badurate 400kHZ" + endchoice + endif + menuconfig BSP_USING_I2C2 + bool "Enable I2C2" + default n + if BSP_USING_I2C2 + choice + prompt "Select I2C2 badurate" + default HW_I2C2_BADURATE_100kHZ + + config HW_I2C2_BADURATE_100kHZ + bool "Badurate 100kHZ" + + config HW_I2C2_BADURATE_400kHZ + bool "Badurate 400kHZ" + endchoice + endif + endif + + menuconfig BSP_USING_SPI + bool "Enable SPI" + select RT_USING_SPI + select RT_USING_PIN + default n + + if BSP_USING_SPI + config BSP_USING_SPI4 + bool "Enable SPI4" + default n + + config BSP_SPI4_USING_DMA + bool "Enable SPI4 DMA xfer" + depends on BSP_USING_SPI4 + select BSP_USING_DMA + default n + + config BSP_SPI4_RX_DMA_CHANNEL + depends on BSP_SPI4_USING_DMA + int "Set SPI4 RX DMA channel (0-32)" + default 4 + + config BSP_SPI4_TX_DMA_CHANNEL + depends on BSP_SPI4_USING_DMA + int "Set SPI4 TX DMA channel (0-32)" + default 5 + endif + + menuconfig BSP_USING_PULSE_ENCODER + bool "Enable Pulse Encoder" + select RT_USING_PULSE_ENCODER + default n + + if BSP_USING_PULSE_ENCODER + config BSP_USING_PULSE_ENCODER1 + bool "Enable PULSE_ENCODER1" + default n + endif + + menuconfig BSP_USING_USB + bool "Enable USB" + default n + if BSP_USING_USB + config BSP_USING_USB0 + bool "Enable USB0" + default n + choice + prompt "Select USB0 Role" + depends on BSP_USING_USB0 + default BSP_USB0_HOST + + config BSP_USB0_HOST + bool "Host" + select RT_USING_USB_HOST + + config BSP_USB0_DEVICE + bool "Device" + select RT_USING_USB_DEVICE + endchoice + config BSP_USING_USB1 + bool "Enable USB1" + default n + choice + prompt "Select USB1 Role" + depends on BSP_USING_USB1 + default BSP_USB1_HOST + + config BSP_USB1_HOST + bool "Host" + select RT_USING_USB_HOST + + config BSP_USB1_DEVICE + bool "Device" + select RT_USING_USB_DEVICE + endchoice + endif +endmenu + +menu "Onboard Peripheral Drivers" + + config BSP_USING_SDRAM + bool "Enable SDRAM" + default n + + config BSP_USING_MPU6050 + bool "Enable MPU6050 (I2C1:J11 --> SCL; K11 --> SDA)" + select BSP_USING_I2C1 + select PKG_USING_MPU6XXX + default n + +endmenu + +menu "Board extended module Drivers" + +endmenu + +endmenu diff --git a/bsp/imxrt/imxrt1052-sc-internal/board/MCUX_Config/MCUX_Config.mex b/bsp/imxrt/imxrt1052-sc-internal/board/MCUX_Config/MCUX_Config.mex new file mode 100644 index 0000000000..bdb810467f --- /dev/null +++ b/bsp/imxrt/imxrt1052-sc-internal/board/MCUX_Config/MCUX_Config.mex @@ -0,0 +1,645 @@ + + + + MIMXRT1052xxxxB + MIMXRT1052DVL6B + IMXRT1050-EVKB + A + ksdk2_0 + + + + + + + false + false + false + + + + + + + + + 9.0.0 + + + + + + + + + + + Configures pin routing and optionally pin electrical features. + + false + core0 + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 9.0.0 + + + + + + + + + true + + + + + INPUT + + + + + true + + + + + OUTPUT + + + + + true + + + + + INPUT + + + + + true + + + + + OUTPUT + + + + + true + + + + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + + + + + N/A + + + + + + + + true + + + + + 2.2.4 + + + + + true + + + + + 2.1.5 + + + + + + + + + 9.0.0 + + + + + + + + + 0 + + + + + true + + + + + true + + + + + 0 + + + + + true + + + + + true + + + + + 0 + + + + + true + + + + + true + + + + + 0 + + + + + true + + + + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + N/A + + + + + + + + + \ No newline at end of file diff --git a/bsp/imxrt/imxrt1052-sc-internal/board/MCUX_Config/clock_config.c b/bsp/imxrt/imxrt1052-sc-internal/board/MCUX_Config/clock_config.c new file mode 100644 index 0000000000..57750fdc73 --- /dev/null +++ b/bsp/imxrt/imxrt1052-sc-internal/board/MCUX_Config/clock_config.c @@ -0,0 +1,476 @@ +/* + * How to setup clock using clock driver functions: + * + * 1. Call CLOCK_InitXXXPLL() to configure corresponding PLL clock. + * + * 2. Call CLOCK_InitXXXpfd() to configure corresponding PLL pfd clock. + * + * 3. Call CLOCK_SetMux() to configure corresponding clock source for target clock out. + * + * 4. Call CLOCK_SetDiv() to configure corresponding clock divider for target clock out. + * + * 5. Call CLOCK_SetXtalFreq() to set XTAL frequency based on board settings. + * + */ + +/* TEXT BELOW IS USED AS SETTING FOR TOOLS ************************************* +!!GlobalInfo +product: Clocks v7.0 +processor: MIMXRT1052xxxxB +package_id: MIMXRT1052DVL6B +mcu_data: ksdk2_0 +processor_version: 9.0.0 +board: IMXRT1050-EVKB + * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/ + +#include "clock_config.h" +#include "fsl_iomuxc.h" + +/******************************************************************************* + * Definitions + ******************************************************************************/ + +/******************************************************************************* + * Variables + ******************************************************************************/ +/* System clock frequency. */ +extern uint32_t SystemCoreClock; + +/******************************************************************************* + ************************ BOARD_InitBootClocks function ************************ + ******************************************************************************/ +void BOARD_InitBootClocks(void) +{ + BOARD_BootClockRUN(); +} + +/******************************************************************************* + ********************** Configuration BOARD_BootClockRUN *********************** + ******************************************************************************/ +/* TEXT BELOW IS USED AS SETTING FOR TOOLS ************************************* +!!Configuration +name: BOARD_BootClockRUN +called_from_default_init: true +outputs: +- {id: AHB_CLK_ROOT.outFreq, value: 600 MHz} +- {id: CAN_CLK_ROOT.outFreq, value: 40 MHz} +- {id: CKIL_SYNC_CLK_ROOT.outFreq, value: 32.768 kHz} +- {id: CLK_1M.outFreq, value: 1 MHz} +- {id: CLK_24M.outFreq, value: 24 MHz} +- {id: CSI_CLK_ROOT.outFreq, value: 60 MHz} +- {id: ENET1_TX_CLK.outFreq, value: 2.4 MHz} +- {id: ENET_125M_CLK.outFreq, value: 2.4 MHz} +- {id: ENET_25M_REF_CLK.outFreq, value: 1.2 MHz} +- {id: FLEXIO1_CLK_ROOT.outFreq, value: 30 MHz} +- {id: FLEXIO2_CLK_ROOT.outFreq, value: 30 MHz} +- {id: FLEXSPI_CLK_ROOT.outFreq, value: 2880/11 MHz} +- {id: GPT1_ipg_clk_highfreq.outFreq, value: 75 MHz} +- {id: GPT2_ipg_clk_highfreq.outFreq, value: 75 MHz} +- {id: IPG_CLK_ROOT.outFreq, value: 150 MHz} +- {id: LCDIF_CLK_ROOT.outFreq, value: 67.5/7 MHz} +- {id: LPI2C_CLK_ROOT.outFreq, value: 60 MHz} +- {id: LPSPI_CLK_ROOT.outFreq, value: 105.6 MHz} +- {id: LVDS1_CLK.outFreq, value: 1.2 GHz} +- {id: MQS_MCLK.outFreq, value: 1080/17 MHz} +- {id: PERCLK_CLK_ROOT.outFreq, value: 75 MHz} +- {id: PLL7_MAIN_CLK.outFreq, value: 480 MHz} +- {id: SAI1_CLK_ROOT.outFreq, value: 1080/17 MHz} +- {id: SAI1_MCLK1.outFreq, value: 1080/17 MHz} +- {id: SAI1_MCLK2.outFreq, value: 1080/17 MHz} +- {id: SAI1_MCLK3.outFreq, value: 30 MHz} +- {id: SAI2_CLK_ROOT.outFreq, value: 1080/17 MHz} +- {id: SAI2_MCLK1.outFreq, value: 1080/17 MHz} +- {id: SAI2_MCLK3.outFreq, value: 30 MHz} +- {id: SAI3_CLK_ROOT.outFreq, value: 1080/17 MHz} +- {id: SAI3_MCLK1.outFreq, value: 1080/17 MHz} +- {id: SAI3_MCLK3.outFreq, value: 30 MHz} +- {id: SEMC_CLK_ROOT.outFreq, value: 75 MHz} +- {id: SPDIF0_CLK_ROOT.outFreq, value: 30 MHz} +- {id: TRACE_CLK_ROOT.outFreq, value: 352/3 MHz} +- {id: UART_CLK_ROOT.outFreq, value: 80 MHz} +- {id: USBPHY1_CLK.outFreq, value: 480 MHz} +- {id: USBPHY2_CLK.outFreq, value: 480 MHz} +- {id: USDHC1_CLK_ROOT.outFreq, value: 158.4 MHz} +- {id: USDHC2_CLK_ROOT.outFreq, value: 158.4 MHz} +settings: +- {id: CCM.AHB_PODF.scale, value: '1', locked: true} +- {id: CCM.ARM_PODF.scale, value: '2', locked: true} +- {id: CCM.CSI_CLK_SEL.sel, value: CCM.PLL3_SW_120M_CLK_DIV} +- {id: CCM.CSI_PODF.scale, value: '2', locked: true} +- {id: CCM.FLEXSPI_PODF.scale, value: '1', locked: true} +- {id: CCM.FLEXSPI_SEL.sel, value: CCM_ANALOG.PLL3_PFD0_CLK} +- {id: CCM.LCDIF_PODF.scale, value: '8', locked: true} +- {id: CCM.LCDIF_PRED.scale, value: '7', locked: true} +- {id: CCM.LPSPI_PODF.scale, value: '5', locked: true} +- {id: CCM.PERCLK_PODF.scale, value: '2', locked: true} +- {id: CCM.SEMC_PODF.scale, value: '8'} +- {id: CCM.TRACE_PODF.scale, value: '3', locked: true} +- {id: CCM_ANALOG.PLL1_BYPASS.sel, value: CCM_ANALOG.PLL1} +- {id: CCM_ANALOG.PLL1_PREDIV.scale, value: '1', locked: true} +- {id: CCM_ANALOG.PLL1_VDIV.scale, value: '50', locked: true} +- {id: CCM_ANALOG.PLL2.denom, value: '1', locked: true} +- {id: CCM_ANALOG.PLL2.num, value: '0', locked: true} +- {id: CCM_ANALOG.PLL2_BYPASS.sel, value: CCM_ANALOG.PLL2_OUT_CLK} +- {id: CCM_ANALOG.PLL2_PFD0_BYPASS.sel, value: CCM_ANALOG.PLL2_PFD0} +- {id: CCM_ANALOG.PLL2_PFD1_BYPASS.sel, value: CCM_ANALOG.PLL2_PFD1} +- {id: CCM_ANALOG.PLL2_PFD2_BYPASS.sel, value: CCM_ANALOG.PLL2_PFD2} +- {id: CCM_ANALOG.PLL2_PFD2_DIV.scale, value: '30'} +- {id: CCM_ANALOG.PLL2_PFD3_BYPASS.sel, value: CCM_ANALOG.PLL2_PFD3} +- {id: CCM_ANALOG.PLL3_BYPASS.sel, value: CCM_ANALOG.PLL3} +- {id: CCM_ANALOG.PLL3_PFD0_BYPASS.sel, value: CCM_ANALOG.PLL3_PFD0} +- {id: CCM_ANALOG.PLL3_PFD0_DIV.scale, value: '33', locked: true} +- {id: CCM_ANALOG.PLL3_PFD0_MUL.scale, value: '18', locked: true} +- {id: CCM_ANALOG.PLL3_PFD1_BYPASS.sel, value: CCM_ANALOG.PLL3_PFD1} +- {id: CCM_ANALOG.PLL3_PFD2_BYPASS.sel, value: CCM_ANALOG.PLL3_PFD2} +- {id: CCM_ANALOG.PLL3_PFD3_BYPASS.sel, value: CCM_ANALOG.PLL3_PFD3} +- {id: CCM_ANALOG.PLL4.denom, value: '50'} +- {id: CCM_ANALOG.PLL4.div, value: '47'} +- {id: CCM_ANALOG.PLL5.denom, value: '1'} +- {id: CCM_ANALOG.PLL5.div, value: '40'} +- {id: CCM_ANALOG.PLL5.num, value: '0'} +- {id: CCM_ANALOG.PLL7_BYPASS.sel, value: CCM_ANALOG.PLL7} +- {id: CCM_ANALOG_PLL_ENET_POWERDOWN_CFG, value: 'Yes'} +- {id: CCM_ANALOG_PLL_USB1_EN_USB_CLKS_CFG, value: Enabled} +- {id: CCM_ANALOG_PLL_USB1_EN_USB_CLKS_OUT_CFG, value: Enabled} +- {id: CCM_ANALOG_PLL_USB1_POWER_CFG, value: 'Yes'} +- {id: CCM_ANALOG_PLL_USB2_EN_USB_CLKS_CFG, value: Enabled} +- {id: CCM_ANALOG_PLL_USB2_EN_USB_CLKS_OUT_CFG, value: Enabled} +- {id: CCM_ANALOG_PLL_USB2_POWER_CFG, value: 'Yes'} +sources: +- {id: XTALOSC24M.RTC_OSC.outFreq, value: 32.768 kHz, enabled: true} + * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/ + +/******************************************************************************* + * Variables for BOARD_BootClockRUN configuration + ******************************************************************************/ +const clock_arm_pll_config_t armPllConfig_BOARD_BootClockRUN = + { + .loopDivider = 100, /* PLL loop divider, Fout = Fin * 50 */ + .src = 0, /* Bypass clock source, 0 - OSC 24M, 1 - CLK1_P and CLK1_N */ + }; +const clock_sys_pll_config_t sysPllConfig_BOARD_BootClockRUN = + { + .loopDivider = 1, /* PLL loop divider, Fout = Fin * ( 20 + loopDivider*2 + numerator / denominator ) */ + .numerator = 0, /* 30 bit numerator of fractional loop divider */ + .denominator = 1, /* 30 bit denominator of fractional loop divider */ + .src = 0, /* Bypass clock source, 0 - OSC 24M, 1 - CLK1_P and CLK1_N */ + }; +const clock_usb_pll_config_t usb1PllConfig_BOARD_BootClockRUN = + { + .loopDivider = 0, /* PLL loop divider, Fout = Fin * 20 */ + .src = 0, /* Bypass clock source, 0 - OSC 24M, 1 - CLK1_P and CLK1_N */ + }; +const clock_usb_pll_config_t usb2PllConfig_BOARD_BootClockRUN = + { + .loopDivider = 0, /* PLL loop divider, Fout = Fin * 20 */ + .src = 0, /* Bypass clock source, 0 - OSC 24M, 1 - CLK1_P and CLK1_N */ + }; +/******************************************************************************* + * Code for BOARD_BootClockRUN configuration + ******************************************************************************/ +void BOARD_BootClockRUN(void) +{ + /* Init RTC OSC clock frequency. */ + CLOCK_SetRtcXtalFreq(32768U); + /* Enable 1MHz clock output. */ + XTALOSC24M->OSC_CONFIG2 |= XTALOSC24M_OSC_CONFIG2_ENABLE_1M_MASK; + /* Use free 1MHz clock output. */ + XTALOSC24M->OSC_CONFIG2 &= ~XTALOSC24M_OSC_CONFIG2_MUX_1M_MASK; + /* Set XTAL 24MHz clock frequency. */ + CLOCK_SetXtalFreq(24000000U); + /* Enable XTAL 24MHz clock source. */ + CLOCK_InitExternalClk(0); + /* Enable internal RC. */ + CLOCK_InitRcOsc24M(); + /* Switch clock source to external OSC. */ + CLOCK_SwitchOsc(kCLOCK_XtalOsc); + /* Set Oscillator ready counter value. */ + CCM->CCR = (CCM->CCR & (~CCM_CCR_OSCNT_MASK)) | CCM_CCR_OSCNT(127); + /* Setting PeriphClk2Mux and PeriphMux to provide stable clock before PLLs are initialed */ + CLOCK_SetMux(kCLOCK_PeriphClk2Mux, 1); /* Set PERIPH_CLK2 MUX to OSC */ + CLOCK_SetMux(kCLOCK_PeriphMux, 1); /* Set PERIPH_CLK MUX to PERIPH_CLK2 */ + /* Setting the VDD_SOC to 1.275V. It is necessary to config AHB to 600Mhz. */ + DCDC->REG3 = (DCDC->REG3 & (~DCDC_REG3_TRG_MASK)) | DCDC_REG3_TRG(0x13); + /* Waiting for DCDC_STS_DC_OK bit is asserted */ + while (DCDC_REG0_STS_DC_OK_MASK != (DCDC_REG0_STS_DC_OK_MASK & DCDC->REG0)) + { + } + /* Set AHB_PODF. */ + CLOCK_SetDiv(kCLOCK_AhbDiv, 0); + /* Disable IPG clock gate. */ + CLOCK_DisableClock(kCLOCK_Adc1); + CLOCK_DisableClock(kCLOCK_Adc2); + CLOCK_DisableClock(kCLOCK_Xbar1); + CLOCK_DisableClock(kCLOCK_Xbar2); + CLOCK_DisableClock(kCLOCK_Xbar3); + /* Set IPG_PODF. */ + CLOCK_SetDiv(kCLOCK_IpgDiv, 3); + /* Set ARM_PODF. */ + CLOCK_SetDiv(kCLOCK_ArmDiv, 1); + /* Set PERIPH_CLK2_PODF. */ + CLOCK_SetDiv(kCLOCK_PeriphClk2Div, 0); + /* Disable PERCLK clock gate. */ + CLOCK_DisableClock(kCLOCK_Gpt1); + CLOCK_DisableClock(kCLOCK_Gpt1S); + CLOCK_DisableClock(kCLOCK_Gpt2); + CLOCK_DisableClock(kCLOCK_Gpt2S); + CLOCK_DisableClock(kCLOCK_Pit); + /* Set PERCLK_PODF. */ + CLOCK_SetDiv(kCLOCK_PerclkDiv, 1); + /* Disable USDHC1 clock gate. */ + CLOCK_DisableClock(kCLOCK_Usdhc1); + /* Set USDHC1_PODF. */ + CLOCK_SetDiv(kCLOCK_Usdhc1Div, 1); + /* Set Usdhc1 clock source. */ + CLOCK_SetMux(kCLOCK_Usdhc1Mux, 0); + /* Disable USDHC2 clock gate. */ + CLOCK_DisableClock(kCLOCK_Usdhc2); + /* Set USDHC2_PODF. */ + CLOCK_SetDiv(kCLOCK_Usdhc2Div, 1); + /* Set Usdhc2 clock source. */ + CLOCK_SetMux(kCLOCK_Usdhc2Mux, 0); + /* In SDK projects, SDRAM (configured by SEMC) will be initialized in either debug script or dcd. + * With this macro SKIP_SYSCLK_INIT, system pll (selected to be SEMC source clock in SDK projects) will be left unchanged. + * Note: If another clock source is selected for SEMC, user may want to avoid changing that clock as well.*/ +#ifndef SKIP_SYSCLK_INIT + /* Disable Semc clock gate. */ + CLOCK_DisableClock(kCLOCK_Semc); + /* Set SEMC_PODF. */ + CLOCK_SetDiv(kCLOCK_SemcDiv, 7); + /* Set Semc alt clock source. */ + CLOCK_SetMux(kCLOCK_SemcAltMux, 0); + /* Set Semc clock source. */ + CLOCK_SetMux(kCLOCK_SemcMux, 0); +#endif + /* In SDK projects, external flash (configured by FLEXSPI) will be initialized by dcd. + * With this macro XIP_EXTERNAL_FLASH, usb1 pll (selected to be FLEXSPI clock source in SDK projects) will be left unchanged. + * Note: If another clock source is selected for FLEXSPI, user may want to avoid changing that clock as well.*/ +#if !(defined(XIP_EXTERNAL_FLASH) && (XIP_EXTERNAL_FLASH == 1)) + /* Disable Flexspi clock gate. */ + CLOCK_DisableClock(kCLOCK_FlexSpi); + /* Set FLEXSPI_PODF. */ + CLOCK_SetDiv(kCLOCK_FlexspiDiv, 0); + /* Set Flexspi clock source. */ + CLOCK_SetMux(kCLOCK_FlexspiMux, 3); +#endif + /* Disable CSI clock gate. */ + CLOCK_DisableClock(kCLOCK_Csi); + /* Set CSI_PODF. */ + CLOCK_SetDiv(kCLOCK_CsiDiv, 1); + /* Set Csi clock source. */ + CLOCK_SetMux(kCLOCK_CsiMux, 2); + /* Disable LPSPI clock gate. */ + CLOCK_DisableClock(kCLOCK_Lpspi1); + CLOCK_DisableClock(kCLOCK_Lpspi2); + CLOCK_DisableClock(kCLOCK_Lpspi3); + CLOCK_DisableClock(kCLOCK_Lpspi4); + /* Set LPSPI_PODF. */ + CLOCK_SetDiv(kCLOCK_LpspiDiv, 4); + /* Set Lpspi clock source. */ + CLOCK_SetMux(kCLOCK_LpspiMux, 2); + /* Disable TRACE clock gate. */ + CLOCK_DisableClock(kCLOCK_Trace); + /* Set TRACE_PODF. */ + CLOCK_SetDiv(kCLOCK_TraceDiv, 2); + /* Set Trace clock source. */ + CLOCK_SetMux(kCLOCK_TraceMux, 2); + /* Disable SAI1 clock gate. */ + CLOCK_DisableClock(kCLOCK_Sai1); + /* Set SAI1_CLK_PRED. */ + CLOCK_SetDiv(kCLOCK_Sai1PreDiv, 3); + /* Set SAI1_CLK_PODF. */ + CLOCK_SetDiv(kCLOCK_Sai1Div, 1); + /* Set Sai1 clock source. */ + CLOCK_SetMux(kCLOCK_Sai1Mux, 0); + /* Disable SAI2 clock gate. */ + CLOCK_DisableClock(kCLOCK_Sai2); + /* Set SAI2_CLK_PRED. */ + CLOCK_SetDiv(kCLOCK_Sai2PreDiv, 3); + /* Set SAI2_CLK_PODF. */ + CLOCK_SetDiv(kCLOCK_Sai2Div, 1); + /* Set Sai2 clock source. */ + CLOCK_SetMux(kCLOCK_Sai2Mux, 0); + /* Disable SAI3 clock gate. */ + CLOCK_DisableClock(kCLOCK_Sai3); + /* Set SAI3_CLK_PRED. */ + CLOCK_SetDiv(kCLOCK_Sai3PreDiv, 3); + /* Set SAI3_CLK_PODF. */ + CLOCK_SetDiv(kCLOCK_Sai3Div, 1); + /* Set Sai3 clock source. */ + CLOCK_SetMux(kCLOCK_Sai3Mux, 0); + /* Disable Lpi2c clock gate. */ + CLOCK_DisableClock(kCLOCK_Lpi2c1); + CLOCK_DisableClock(kCLOCK_Lpi2c2); + CLOCK_DisableClock(kCLOCK_Lpi2c3); + /* Set LPI2C_CLK_PODF. */ + CLOCK_SetDiv(kCLOCK_Lpi2cDiv, 0); + /* Set Lpi2c clock source. */ + CLOCK_SetMux(kCLOCK_Lpi2cMux, 0); + /* Disable CAN clock gate. */ + CLOCK_DisableClock(kCLOCK_Can1); + CLOCK_DisableClock(kCLOCK_Can2); + CLOCK_DisableClock(kCLOCK_Can1S); + CLOCK_DisableClock(kCLOCK_Can2S); + /* Set CAN_CLK_PODF. */ + CLOCK_SetDiv(kCLOCK_CanDiv, 1); + /* Set Can clock source. */ + CLOCK_SetMux(kCLOCK_CanMux, 2); + /* Disable UART clock gate. */ + CLOCK_DisableClock(kCLOCK_Lpuart1); + CLOCK_DisableClock(kCLOCK_Lpuart2); + CLOCK_DisableClock(kCLOCK_Lpuart3); + CLOCK_DisableClock(kCLOCK_Lpuart4); + CLOCK_DisableClock(kCLOCK_Lpuart5); + CLOCK_DisableClock(kCLOCK_Lpuart6); + CLOCK_DisableClock(kCLOCK_Lpuart7); + CLOCK_DisableClock(kCLOCK_Lpuart8); + /* Set UART_CLK_PODF. */ + CLOCK_SetDiv(kCLOCK_UartDiv, 0); + /* Set Uart clock source. */ + CLOCK_SetMux(kCLOCK_UartMux, 0); + /* Disable LCDIF clock gate. */ + CLOCK_DisableClock(kCLOCK_LcdPixel); + /* Set LCDIF_PRED. */ + CLOCK_SetDiv(kCLOCK_LcdifPreDiv, 6); + /* Set LCDIF_CLK_PODF. */ + CLOCK_SetDiv(kCLOCK_LcdifDiv, 7); + /* Set Lcdif pre clock source. */ + CLOCK_SetMux(kCLOCK_LcdifPreMux, 5); + /* Disable SPDIF clock gate. */ + CLOCK_DisableClock(kCLOCK_Spdif); + /* Set SPDIF0_CLK_PRED. */ + CLOCK_SetDiv(kCLOCK_Spdif0PreDiv, 1); + /* Set SPDIF0_CLK_PODF. */ + CLOCK_SetDiv(kCLOCK_Spdif0Div, 7); + /* Set Spdif clock source. */ + CLOCK_SetMux(kCLOCK_SpdifMux, 3); + /* Disable Flexio1 clock gate. */ + CLOCK_DisableClock(kCLOCK_Flexio1); + /* Set FLEXIO1_CLK_PRED. */ + CLOCK_SetDiv(kCLOCK_Flexio1PreDiv, 1); + /* Set FLEXIO1_CLK_PODF. */ + CLOCK_SetDiv(kCLOCK_Flexio1Div, 7); + /* Set Flexio1 clock source. */ + CLOCK_SetMux(kCLOCK_Flexio1Mux, 3); + /* Disable Flexio2 clock gate. */ + CLOCK_DisableClock(kCLOCK_Flexio2); + /* Set FLEXIO2_CLK_PRED. */ + CLOCK_SetDiv(kCLOCK_Flexio2PreDiv, 1); + /* Set FLEXIO2_CLK_PODF. */ + CLOCK_SetDiv(kCLOCK_Flexio2Div, 7); + /* Set Flexio2 clock source. */ + CLOCK_SetMux(kCLOCK_Flexio2Mux, 3); + /* Set Pll3 sw clock source. */ + CLOCK_SetMux(kCLOCK_Pll3SwMux, 0); + /* Init ARM PLL. */ + CLOCK_InitArmPll(&armPllConfig_BOARD_BootClockRUN); + /* In SDK projects, SDRAM (configured by SEMC) will be initialized in either debug script or dcd. + * With this macro SKIP_SYSCLK_INIT, system pll (selected to be SEMC source clock in SDK projects) will be left unchanged. + * Note: If another clock source is selected for SEMC, user may want to avoid changing that clock as well.*/ +#ifndef SKIP_SYSCLK_INIT +#if defined(XIP_BOOT_HEADER_DCD_ENABLE) && (XIP_BOOT_HEADER_DCD_ENABLE == 1) + #warning "SKIP_SYSCLK_INIT should be defined to keep system pll (selected to be SEMC source clock in SDK projects) unchanged." +#endif + /* Init System PLL. */ + CLOCK_InitSysPll(&sysPllConfig_BOARD_BootClockRUN); + /* Init System pfd0. */ + CLOCK_InitSysPfd(kCLOCK_Pfd0, 27); + /* Init System pfd1. */ + CLOCK_InitSysPfd(kCLOCK_Pfd1, 16); + /* Init System pfd2. */ + CLOCK_InitSysPfd(kCLOCK_Pfd2, 30); + /* Init System pfd3. */ + CLOCK_InitSysPfd(kCLOCK_Pfd3, 16); + /* Disable pfd offset. */ + CCM_ANALOG->PLL_SYS &= ~CCM_ANALOG_PLL_SYS_PFD_OFFSET_EN_MASK; +#endif + /* In SDK projects, external flash (configured by FLEXSPI) will be initialized by dcd. + * With this macro XIP_EXTERNAL_FLASH, usb1 pll (selected to be FLEXSPI clock source in SDK projects) will be left unchanged. + * Note: If another clock source is selected for FLEXSPI, user may want to avoid changing that clock as well.*/ +#if !(defined(XIP_EXTERNAL_FLASH) && (XIP_EXTERNAL_FLASH == 1)) + /* Init Usb1 PLL. */ + CLOCK_InitUsb1Pll(&usb1PllConfig_BOARD_BootClockRUN); + /* Init Usb1 pfd0. */ + CLOCK_InitUsb1Pfd(kCLOCK_Pfd0, 33); + /* Init Usb1 pfd1. */ + CLOCK_InitUsb1Pfd(kCLOCK_Pfd1, 16); + /* Init Usb1 pfd2. */ + CLOCK_InitUsb1Pfd(kCLOCK_Pfd2, 17); + /* Init Usb1 pfd3. */ + CLOCK_InitUsb1Pfd(kCLOCK_Pfd3, 19); +#endif + /* DeInit Audio PLL. */ + CLOCK_DeinitAudioPll(); + /* Bypass Audio PLL. */ + CLOCK_SetPllBypass(CCM_ANALOG, kCLOCK_PllAudio, 1); + /* Set divider for Audio PLL. */ + CCM_ANALOG->MISC2 &= ~CCM_ANALOG_MISC2_AUDIO_DIV_LSB_MASK; + CCM_ANALOG->MISC2 &= ~CCM_ANALOG_MISC2_AUDIO_DIV_MSB_MASK; + /* Enable Audio PLL output. */ + CCM_ANALOG->PLL_AUDIO |= CCM_ANALOG_PLL_AUDIO_ENABLE_MASK; + /* DeInit Video PLL. */ + CLOCK_DeinitVideoPll(); + /* Bypass Video PLL. */ + CCM_ANALOG->PLL_VIDEO |= CCM_ANALOG_PLL_VIDEO_BYPASS_MASK; + /* Set divider for Video PLL. */ + CCM_ANALOG->MISC2 = (CCM_ANALOG->MISC2 & (~CCM_ANALOG_MISC2_VIDEO_DIV_MASK)) | CCM_ANALOG_MISC2_VIDEO_DIV(0); + /* Enable Video PLL output. */ + CCM_ANALOG->PLL_VIDEO |= CCM_ANALOG_PLL_VIDEO_ENABLE_MASK; + /* DeInit Enet PLL. */ + CLOCK_DeinitEnetPll(); + /* Bypass Enet PLL. */ + CLOCK_SetPllBypass(CCM_ANALOG, kCLOCK_PllEnet, 1); + /* Set Enet output divider. */ + CCM_ANALOG->PLL_ENET = (CCM_ANALOG->PLL_ENET & (~CCM_ANALOG_PLL_ENET_DIV_SELECT_MASK)) | CCM_ANALOG_PLL_ENET_DIV_SELECT(1); + /* Enable Enet output. */ + CCM_ANALOG->PLL_ENET |= CCM_ANALOG_PLL_ENET_ENABLE_MASK; + /* Enable Enet25M output. */ + CCM_ANALOG->PLL_ENET |= CCM_ANALOG_PLL_ENET_ENET_25M_REF_EN_MASK; + /* Init Usb2 PLL. */ + CLOCK_InitUsb2Pll(&usb2PllConfig_BOARD_BootClockRUN); + /* Set preperiph clock source. */ + CLOCK_SetMux(kCLOCK_PrePeriphMux, 3); + /* Set periph clock source. */ + CLOCK_SetMux(kCLOCK_PeriphMux, 0); + /* Set periph clock2 clock source. */ + CLOCK_SetMux(kCLOCK_PeriphClk2Mux, 0); + /* Set per clock source. */ + CLOCK_SetMux(kCLOCK_PerclkMux, 0); + /* Set lvds1 clock source. */ + CCM_ANALOG->MISC1 = (CCM_ANALOG->MISC1 & (~CCM_ANALOG_MISC1_LVDS1_CLK_SEL_MASK)) | CCM_ANALOG_MISC1_LVDS1_CLK_SEL(0); + /* Set clock out1 divider. */ + CCM->CCOSR = (CCM->CCOSR & (~CCM_CCOSR_CLKO1_DIV_MASK)) | CCM_CCOSR_CLKO1_DIV(0); + /* Set clock out1 source. */ + CCM->CCOSR = (CCM->CCOSR & (~CCM_CCOSR_CLKO1_SEL_MASK)) | CCM_CCOSR_CLKO1_SEL(1); + /* Set clock out2 divider. */ + CCM->CCOSR = (CCM->CCOSR & (~CCM_CCOSR_CLKO2_DIV_MASK)) | CCM_CCOSR_CLKO2_DIV(0); + /* Set clock out2 source. */ + CCM->CCOSR = (CCM->CCOSR & (~CCM_CCOSR_CLKO2_SEL_MASK)) | CCM_CCOSR_CLKO2_SEL(18); + /* Set clock out1 drives clock out1. */ + CCM->CCOSR &= ~CCM_CCOSR_CLK_OUT_SEL_MASK; + /* Disable clock out1. */ + CCM->CCOSR &= ~CCM_CCOSR_CLKO1_EN_MASK; + /* Disable clock out2. */ + CCM->CCOSR &= ~CCM_CCOSR_CLKO2_EN_MASK; + /* Set SAI1 MCLK1 clock source. */ + IOMUXC_SetSaiMClkClockSource(IOMUXC_GPR, kIOMUXC_GPR_SAI1MClk1Sel, 0); + /* Set SAI1 MCLK2 clock source. */ + IOMUXC_SetSaiMClkClockSource(IOMUXC_GPR, kIOMUXC_GPR_SAI1MClk2Sel, 0); + /* Set SAI1 MCLK3 clock source. */ + IOMUXC_SetSaiMClkClockSource(IOMUXC_GPR, kIOMUXC_GPR_SAI1MClk3Sel, 0); + /* Set SAI2 MCLK3 clock source. */ + IOMUXC_SetSaiMClkClockSource(IOMUXC_GPR, kIOMUXC_GPR_SAI2MClk3Sel, 0); + /* Set SAI3 MCLK3 clock source. */ + IOMUXC_SetSaiMClkClockSource(IOMUXC_GPR, kIOMUXC_GPR_SAI3MClk3Sel, 0); + /* Set MQS configuration. */ + IOMUXC_MQSConfig(IOMUXC_GPR,kIOMUXC_MqsPwmOverSampleRate32, 0); + /* Set ENET Tx clock source. */ + IOMUXC_EnableMode(IOMUXC_GPR, kIOMUXC_GPR_ENET1RefClkMode, false); + /* Set GPT1 High frequency reference clock source. */ + IOMUXC_GPR->GPR5 &= ~IOMUXC_GPR_GPR5_VREF_1M_CLK_GPT1_MASK; + /* Set GPT2 High frequency reference clock source. */ + IOMUXC_GPR->GPR5 &= ~IOMUXC_GPR_GPR5_VREF_1M_CLK_GPT2_MASK; + /* Set SystemCoreClock variable. */ + SystemCoreClock = BOARD_BOOTCLOCKRUN_CORE_CLOCK; +} + diff --git a/bsp/imxrt/imxrt1052-sc-internal/board/MCUX_Config/clock_config.h b/bsp/imxrt/imxrt1052-sc-internal/board/MCUX_Config/clock_config.h new file mode 100644 index 0000000000..9fc20d196d --- /dev/null +++ b/bsp/imxrt/imxrt1052-sc-internal/board/MCUX_Config/clock_config.h @@ -0,0 +1,116 @@ +#ifndef _CLOCK_CONFIG_H_ +#define _CLOCK_CONFIG_H_ + +#include "fsl_common.h" + +/******************************************************************************* + * Definitions + ******************************************************************************/ +#define BOARD_XTAL0_CLK_HZ 24000000U /*!< Board xtal0 frequency in Hz */ + +#define BOARD_XTAL32K_CLK_HZ 32768U /*!< Board xtal32k frequency in Hz */ +/******************************************************************************* + ************************ BOARD_InitBootClocks function ************************ + ******************************************************************************/ + +#if defined(__cplusplus) +extern "C" { +#endif /* __cplusplus*/ + +/*! + * @brief This function executes default configuration of clocks. + * + */ +void BOARD_InitBootClocks(void); + +#if defined(__cplusplus) +} +#endif /* __cplusplus*/ + +/******************************************************************************* + ********************** Configuration BOARD_BootClockRUN *********************** + ******************************************************************************/ +/******************************************************************************* + * Definitions for BOARD_BootClockRUN configuration + ******************************************************************************/ +#define BOARD_BOOTCLOCKRUN_CORE_CLOCK 600000000U /*!< Core clock frequency: 600000000Hz */ + +/* Clock outputs (values are in Hz): */ +#define BOARD_BOOTCLOCKRUN_AHB_CLK_ROOT 600000000UL +#define BOARD_BOOTCLOCKRUN_CAN_CLK_ROOT 40000000UL +#define BOARD_BOOTCLOCKRUN_CKIL_SYNC_CLK_ROOT 32768UL +#define BOARD_BOOTCLOCKRUN_CLKO1_CLK 0UL +#define BOARD_BOOTCLOCKRUN_CLKO2_CLK 0UL +#define BOARD_BOOTCLOCKRUN_CLK_1M 1000000UL +#define BOARD_BOOTCLOCKRUN_CLK_24M 24000000UL +#define BOARD_BOOTCLOCKRUN_CSI_CLK_ROOT 60000000UL +#define BOARD_BOOTCLOCKRUN_ENET1_TX_CLK 2400000UL +#define BOARD_BOOTCLOCKRUN_ENET_125M_CLK 2400000UL +#define BOARD_BOOTCLOCKRUN_ENET_25M_REF_CLK 1200000UL +#define BOARD_BOOTCLOCKRUN_FLEXIO1_CLK_ROOT 30000000UL +#define BOARD_BOOTCLOCKRUN_FLEXIO2_CLK_ROOT 30000000UL +#define BOARD_BOOTCLOCKRUN_FLEXSPI_CLK_ROOT 261818181UL +#define BOARD_BOOTCLOCKRUN_GPT1_IPG_CLK_HIGHFREQ 75000000UL +#define BOARD_BOOTCLOCKRUN_GPT2_IPG_CLK_HIGHFREQ 75000000UL +#define BOARD_BOOTCLOCKRUN_IPG_CLK_ROOT 150000000UL +#define BOARD_BOOTCLOCKRUN_LCDIF_CLK_ROOT 9642857UL +#define BOARD_BOOTCLOCKRUN_LPI2C_CLK_ROOT 60000000UL +#define BOARD_BOOTCLOCKRUN_LPSPI_CLK_ROOT 105600000UL +#define BOARD_BOOTCLOCKRUN_LVDS1_CLK 1200000000UL +#define BOARD_BOOTCLOCKRUN_MQS_MCLK 63529411UL +#define BOARD_BOOTCLOCKRUN_PERCLK_CLK_ROOT 75000000UL +#define BOARD_BOOTCLOCKRUN_PLL7_MAIN_CLK 480000000UL +#define BOARD_BOOTCLOCKRUN_SAI1_CLK_ROOT 63529411UL +#define BOARD_BOOTCLOCKRUN_SAI1_MCLK1 63529411UL +#define BOARD_BOOTCLOCKRUN_SAI1_MCLK2 63529411UL +#define BOARD_BOOTCLOCKRUN_SAI1_MCLK3 30000000UL +#define BOARD_BOOTCLOCKRUN_SAI2_CLK_ROOT 63529411UL +#define BOARD_BOOTCLOCKRUN_SAI2_MCLK1 63529411UL +#define BOARD_BOOTCLOCKRUN_SAI2_MCLK2 0UL +#define BOARD_BOOTCLOCKRUN_SAI2_MCLK3 30000000UL +#define BOARD_BOOTCLOCKRUN_SAI3_CLK_ROOT 63529411UL +#define BOARD_BOOTCLOCKRUN_SAI3_MCLK1 63529411UL +#define BOARD_BOOTCLOCKRUN_SAI3_MCLK2 0UL +#define BOARD_BOOTCLOCKRUN_SAI3_MCLK3 30000000UL +#define BOARD_BOOTCLOCKRUN_SEMC_CLK_ROOT 75000000UL +#define BOARD_BOOTCLOCKRUN_SPDIF0_CLK_ROOT 30000000UL +#define BOARD_BOOTCLOCKRUN_SPDIF0_EXTCLK_OUT 0UL +#define BOARD_BOOTCLOCKRUN_TRACE_CLK_ROOT 117333333UL +#define BOARD_BOOTCLOCKRUN_UART_CLK_ROOT 80000000UL +#define BOARD_BOOTCLOCKRUN_USBPHY1_CLK 480000000UL +#define BOARD_BOOTCLOCKRUN_USBPHY2_CLK 480000000UL +#define BOARD_BOOTCLOCKRUN_USDHC1_CLK_ROOT 158400000UL +#define BOARD_BOOTCLOCKRUN_USDHC2_CLK_ROOT 158400000UL + +/*! @brief Arm PLL set for BOARD_BootClockRUN configuration. + */ +extern const clock_arm_pll_config_t armPllConfig_BOARD_BootClockRUN; +/*! @brief Usb1 PLL set for BOARD_BootClockRUN configuration. + */ +extern const clock_usb_pll_config_t usb1PllConfig_BOARD_BootClockRUN; +/*! @brief Usb2 PLL set for BOARD_BootClockRUN configuration. + */ +extern const clock_usb_pll_config_t usb2PllConfig_BOARD_BootClockRUN; +/*! @brief Sys PLL for BOARD_BootClockRUN configuration. + */ +extern const clock_sys_pll_config_t sysPllConfig_BOARD_BootClockRUN; + +/******************************************************************************* + * API for BOARD_BootClockRUN configuration + ******************************************************************************/ +#if defined(__cplusplus) +extern "C" { +#endif /* __cplusplus*/ + +/*! + * @brief This function executes configuration of clocks. + * + */ +void BOARD_BootClockRUN(void); + +#if defined(__cplusplus) +} +#endif /* __cplusplus*/ + +#endif /* _CLOCK_CONFIG_H_ */ + diff --git a/bsp/imxrt/imxrt1052-sc-internal/board/MCUX_Config/pin_mux.c b/bsp/imxrt/imxrt1052-sc-internal/board/MCUX_Config/pin_mux.c new file mode 100644 index 0000000000..adfacaa39c --- /dev/null +++ b/bsp/imxrt/imxrt1052-sc-internal/board/MCUX_Config/pin_mux.c @@ -0,0 +1,274 @@ +/*********************************************************************************************************************** + * This file was generated by the MCUXpresso Config Tools. Any manual edits made to this file + * will be overwritten if the respective MCUXpresso Config Tools is used to update this file. + **********************************************************************************************************************/ + +/* + * TEXT BELOW IS USED AS SETTING FOR TOOLS ************************************* +!!GlobalInfo +product: Pins v9.0 +processor: MIMXRT1052xxxxB +package_id: MIMXRT1052DVL6B +mcu_data: ksdk2_0 +processor_version: 9.0.0 +board: IMXRT1050-EVKB +pin_labels: +- {pin_num: G11, pin_signal: GPIO_AD_B0_03, label: BSP_BEEP} +- {pin_num: L13, pin_signal: GPIO_AD_B1_10, label: BSP_RS485_RE, identifier: CSI_D7} +- {pin_num: J13, pin_signal: GPIO_AD_B1_11, label: BSP_DS18B20, identifier: CSI_D6} +- {pin_num: K12, pin_signal: GPIO_AD_B1_05, label: BSP_AP3216C_INT, identifier: CSI_MCLK} + * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS *********** + */ + +#include "fsl_common.h" +#include "fsl_xbara.h" +#include "fsl_iomuxc.h" +#include "fsl_gpio.h" +#include "pin_mux.h" + +/* FUNCTION ************************************************************************************************************ + * + * Function Name : BOARD_InitBootPins + * Description : Calls initialization functions. + * + * END ****************************************************************************************************************/ +void BOARD_InitBootPins(void) { +} + +/* + * TEXT BELOW IS USED AS SETTING FOR TOOLS ************************************* +BOARD_InitPins: +- options: {callFromInitBoot: 'false', coreID: core0, enableClock: 'true'} +- pin_list: + - {pin_num: K14, peripheral: LPUART1, signal: TX, pin_signal: GPIO_AD_B0_12} + - {pin_num: L14, peripheral: LPUART1, signal: RX, pin_signal: GPIO_AD_B0_13} + - {pin_num: J1, peripheral: USDHC1, signal: 'usdhc_data, 0', pin_signal: GPIO_SD_B0_02} + - {pin_num: K1, peripheral: USDHC1, signal: 'usdhc_data, 1', pin_signal: GPIO_SD_B0_03} + - {pin_num: H2, peripheral: USDHC1, signal: 'usdhc_data, 2', pin_signal: GPIO_SD_B0_04} + - {pin_num: J2, peripheral: USDHC1, signal: 'usdhc_data, 3', pin_signal: GPIO_SD_B0_05} + - {pin_num: J3, peripheral: USDHC1, signal: usdhc_clk, pin_signal: GPIO_SD_B0_01} + - {pin_num: J4, peripheral: USDHC1, signal: usdhc_cmd, pin_signal: GPIO_SD_B0_00} + - {pin_num: D13, peripheral: USDHC1, signal: usdhc_cd_b, pin_signal: GPIO_B1_12} + - {pin_num: M3, peripheral: PWM2, signal: 'A, 3', pin_signal: GPIO_SD_B1_02} + - {pin_num: L5, peripheral: GPIO3, signal: 'gpio_io, 00', pin_signal: GPIO_SD_B1_00, direction: OUTPUT, gpio_init_state: 'true', software_input_on: Enable, open_drain: Enable} + - {pin_num: M5, peripheral: GPIO3, signal: 'gpio_io, 01', pin_signal: GPIO_SD_B1_01, direction: OUTPUT, gpio_init_state: 'true', software_input_on: Enable, open_drain: Enable} + - {pin_num: J14, peripheral: CSI, signal: 'csi_data, 02', pin_signal: GPIO_AD_B1_15} + - {pin_num: G12, peripheral: CSI, signal: 'csi_data, 03', pin_signal: GPIO_AD_B1_14} + - {pin_num: H11, peripheral: CSI, signal: 'csi_data, 04', pin_signal: GPIO_AD_B1_13} + - {pin_num: H12, peripheral: CSI, signal: 'csi_data, 05', pin_signal: GPIO_AD_B1_12} + - {pin_num: J13, peripheral: CSI, signal: 'csi_data, 06', pin_signal: GPIO_AD_B1_11} + - {pin_num: L13, peripheral: CSI, signal: 'csi_data, 07', pin_signal: GPIO_AD_B1_10} + - {pin_num: M13, peripheral: CSI, signal: 'csi_data, 08', pin_signal: GPIO_AD_B1_09} + - {pin_num: H13, peripheral: CSI, signal: 'csi_data, 09', pin_signal: GPIO_AD_B1_08} + - {pin_num: L12, peripheral: CSI, signal: csi_pixclk, pin_signal: GPIO_AD_B1_04} + - {pin_num: K10, peripheral: CSI, signal: csi_hsync, pin_signal: GPIO_AD_B1_07} + - {pin_num: J12, peripheral: CSI, signal: csi_vsync, pin_signal: GPIO_AD_B1_06} + - {pin_num: H14, peripheral: ADC1, signal: 'IN, 3', pin_signal: GPIO_AD_B0_14} + - {pin_num: M12, peripheral: ADC1, signal: 'IN, 8', pin_signal: GPIO_AD_B1_03} + - {pin_num: L11, peripheral: ADC1, signal: 'IN, 7', pin_signal: GPIO_AD_B1_02} + - {pin_num: K11, peripheral: LPI2C1, signal: SDA, pin_signal: GPIO_AD_B1_01} + - {pin_num: J11, peripheral: LPI2C1, signal: SCL, pin_signal: GPIO_AD_B1_00} + - {pin_num: A12, peripheral: GPIO2, signal: 'gpio_io, 24', pin_signal: GPIO_B1_08, direction: INPUT} + - {pin_num: B12, peripheral: GPIO2, signal: 'gpio_io, 23', pin_signal: GPIO_B1_07, direction: INPUT} + - {pin_num: A13, peripheral: GPIO2, signal: 'gpio_io, 25', pin_signal: GPIO_B1_09, direction: INPUT} + - {pin_num: A8, peripheral: PWM2, signal: 'A, 0', pin_signal: GPIO_B0_06} + - {pin_num: A9, peripheral: PWM2, signal: 'B, 0', pin_signal: GPIO_B0_07} + - {pin_num: B9, peripheral: PWM2, signal: 'A, 1', pin_signal: GPIO_B0_08} + - {pin_num: C9, peripheral: PWM2, signal: 'B, 1', pin_signal: GPIO_B0_09} + - {pin_num: D9, peripheral: PWM2, signal: 'A, 2', pin_signal: GPIO_B0_10} + - {pin_num: A10, peripheral: PWM2, signal: 'B, 2', pin_signal: GPIO_B0_11, identifier: ''} + - {pin_num: C10, peripheral: GPIO2, signal: 'gpio_io, 12', pin_signal: GPIO_B0_12, direction: OUTPUT} + - {pin_num: B13, peripheral: GPIO2, signal: 'gpio_io, 26', pin_signal: GPIO_B1_10, direction: INPUT} + - {pin_num: E7, peripheral: LPSPI4, signal: SDI, pin_signal: GPIO_B0_01} + - {pin_num: E8, peripheral: LPSPI4, signal: SDO, pin_signal: GPIO_B0_02} + - {pin_num: D8, peripheral: LPSPI4, signal: SCK, pin_signal: GPIO_B0_03} + - {pin_num: D7, peripheral: LPSPI4, signal: PCS0, pin_signal: GPIO_B0_00} + - {pin_num: D11, peripheral: LPSPI4, signal: PCS1, pin_signal: GPIO_B1_03} + - {pin_num: C11, peripheral: LPSPI4, signal: PCS2, pin_signal: GPIO_B1_02} + - {pin_num: C13, peripheral: GPIO2, signal: 'gpio_io, 27', pin_signal: GPIO_B1_11, direction: OUTPUT} + - {pin_num: C12, peripheral: GPIO2, signal: 'gpio_io, 22', pin_signal: GPIO_B1_06, direction: OUTPUT} + - {pin_num: E12, peripheral: GPIO2, signal: 'gpio_io, 20', pin_signal: GPIO_B1_04, direction: OUTPUT} + - {pin_num: D12, peripheral: GPIO2, signal: 'gpio_io, 21', pin_signal: GPIO_B1_05, direction: INPUT} + - {pin_num: D10, peripheral: ENC1, signal: 'PHASE, A', pin_signal: GPIO_B0_13} + - {pin_num: E10, peripheral: ENC1, signal: 'PHASE, B', pin_signal: GPIO_B0_14} + - {pin_num: A11, peripheral: LPUART4, signal: TX, pin_signal: GPIO_B1_00} + - {pin_num: B11, peripheral: LPUART4, signal: RX, pin_signal: GPIO_B1_01} + * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS *********** + */ + +/* FUNCTION ************************************************************************************************************ + * + * Function Name : BOARD_InitPins + * Description : Configures pin routing and optionally pin electrical features. + * + * END ****************************************************************************************************************/ +void BOARD_InitPins(void) { + CLOCK_EnableClock(kCLOCK_Iomuxc); + CLOCK_EnableClock(kCLOCK_Xbar1); + + /* GPIO configuration of LCDIF_D8 on GPIO_B0_12 (pin C10) */ + gpio_pin_config_t LCDIF_D8_config = { + .direction = kGPIO_DigitalOutput, + .outputLogic = 0U, + .interruptMode = kGPIO_NoIntmode + }; + /* Initialize GPIO functionality on GPIO_B0_12 (pin C10) */ + GPIO_PinInit(GPIO2, 12U, &LCDIF_D8_config); + + /* GPIO configuration of ENET_RXD0 on GPIO_B1_04 (pin E12) */ + gpio_pin_config_t ENET_RXD0_config = { + .direction = kGPIO_DigitalOutput, + .outputLogic = 0U, + .interruptMode = kGPIO_NoIntmode + }; + /* Initialize GPIO functionality on GPIO_B1_04 (pin E12) */ + GPIO_PinInit(GPIO2, 20U, &ENET_RXD0_config); + + /* GPIO configuration of ENET_RXD1 on GPIO_B1_05 (pin D12) */ + gpio_pin_config_t ENET_RXD1_config = { + .direction = kGPIO_DigitalInput, + .outputLogic = 0U, + .interruptMode = kGPIO_NoIntmode + }; + /* Initialize GPIO functionality on GPIO_B1_05 (pin D12) */ + GPIO_PinInit(GPIO2, 21U, &ENET_RXD1_config); + + /* GPIO configuration of ENET_CRS_DV on GPIO_B1_06 (pin C12) */ + gpio_pin_config_t ENET_CRS_DV_config = { + .direction = kGPIO_DigitalOutput, + .outputLogic = 0U, + .interruptMode = kGPIO_NoIntmode + }; + /* Initialize GPIO functionality on GPIO_B1_06 (pin C12) */ + GPIO_PinInit(GPIO2, 22U, &ENET_CRS_DV_config); + + /* GPIO configuration of ENET_TXD0 on GPIO_B1_07 (pin B12) */ + gpio_pin_config_t ENET_TXD0_config = { + .direction = kGPIO_DigitalInput, + .outputLogic = 0U, + .interruptMode = kGPIO_NoIntmode + }; + /* Initialize GPIO functionality on GPIO_B1_07 (pin B12) */ + GPIO_PinInit(GPIO2, 23U, &ENET_TXD0_config); + + /* GPIO configuration of ENET_TXD1 on GPIO_B1_08 (pin A12) */ + gpio_pin_config_t ENET_TXD1_config = { + .direction = kGPIO_DigitalInput, + .outputLogic = 0U, + .interruptMode = kGPIO_NoIntmode + }; + /* Initialize GPIO functionality on GPIO_B1_08 (pin A12) */ + GPIO_PinInit(GPIO2, 24U, &ENET_TXD1_config); + + /* GPIO configuration of ENET_TXEN on GPIO_B1_09 (pin A13) */ + gpio_pin_config_t ENET_TXEN_config = { + .direction = kGPIO_DigitalInput, + .outputLogic = 0U, + .interruptMode = kGPIO_NoIntmode + }; + /* Initialize GPIO functionality on GPIO_B1_09 (pin A13) */ + GPIO_PinInit(GPIO2, 25U, &ENET_TXEN_config); + + /* GPIO configuration of ENET_TX_CLK on GPIO_B1_10 (pin B13) */ + gpio_pin_config_t ENET_TX_CLK_config = { + .direction = kGPIO_DigitalInput, + .outputLogic = 0U, + .interruptMode = kGPIO_NoIntmode + }; + /* Initialize GPIO functionality on GPIO_B1_10 (pin B13) */ + GPIO_PinInit(GPIO2, 26U, &ENET_TX_CLK_config); + + /* GPIO configuration of ENET_RXER on GPIO_B1_11 (pin C13) */ + gpio_pin_config_t ENET_RXER_config = { + .direction = kGPIO_DigitalOutput, + .outputLogic = 0U, + .interruptMode = kGPIO_NoIntmode + }; + /* Initialize GPIO functionality on GPIO_B1_11 (pin C13) */ + GPIO_PinInit(GPIO2, 27U, &ENET_RXER_config); + + /* GPIO configuration of FlexSPI_D3_B on GPIO_SD_B1_00 (pin L5) */ + gpio_pin_config_t FlexSPI_D3_B_config = { + .direction = kGPIO_DigitalOutput, + .outputLogic = 1U, + .interruptMode = kGPIO_NoIntmode + }; + /* Initialize GPIO functionality on GPIO_SD_B1_00 (pin L5) */ + GPIO_PinInit(GPIO3, 0U, &FlexSPI_D3_B_config); + + /* GPIO configuration of FlexSPI_D2_B on GPIO_SD_B1_01 (pin M5) */ + gpio_pin_config_t FlexSPI_D2_B_config = { + .direction = kGPIO_DigitalOutput, + .outputLogic = 1U, + .interruptMode = kGPIO_NoIntmode + }; + /* Initialize GPIO functionality on GPIO_SD_B1_01 (pin M5) */ + GPIO_PinInit(GPIO3, 1U, &FlexSPI_D2_B_config); + + IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B0_12_LPUART1_TX, 0U); + IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B0_13_LPUART1_RX, 0U); + IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B0_14_GPIO1_IO14, 0U); + IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B1_00_LPI2C1_SCL, 0U); + IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B1_01_LPI2C1_SDA, 0U); + IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B1_02_GPIO1_IO18, 0U); + IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B1_03_GPIO1_IO19, 0U); + IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B1_04_CSI_PIXCLK, 0U); + IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B1_06_CSI_VSYNC, 0U); + IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B1_07_CSI_HSYNC, 0U); + IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B1_08_CSI_DATA09, 0U); + IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B1_09_CSI_DATA08, 0U); + IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B1_10_CSI_DATA07, 0U); + IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B1_11_CSI_DATA06, 0U); + IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B1_12_CSI_DATA05, 0U); + IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B1_13_CSI_DATA04, 0U); + IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B1_14_CSI_DATA03, 0U); + IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B1_15_CSI_DATA02, 0U); + IOMUXC_SetPinMux(IOMUXC_GPIO_B0_00_LPSPI4_PCS0, 0U); + IOMUXC_SetPinMux(IOMUXC_GPIO_B0_01_LPSPI4_SDI, 0U); + IOMUXC_SetPinMux(IOMUXC_GPIO_B0_02_LPSPI4_SDO, 0U); + IOMUXC_SetPinMux(IOMUXC_GPIO_B0_03_LPSPI4_SCK, 0U); + IOMUXC_SetPinMux(IOMUXC_GPIO_B0_06_FLEXPWM2_PWMA00, 0U); + IOMUXC_SetPinMux(IOMUXC_GPIO_B0_07_FLEXPWM2_PWMB00, 0U); + IOMUXC_SetPinMux(IOMUXC_GPIO_B0_08_FLEXPWM2_PWMA01, 0U); + IOMUXC_SetPinMux(IOMUXC_GPIO_B0_09_FLEXPWM2_PWMB01, 0U); + IOMUXC_SetPinMux(IOMUXC_GPIO_B0_10_FLEXPWM2_PWMA02, 0U); + IOMUXC_SetPinMux(IOMUXC_GPIO_B0_11_FLEXPWM2_PWMB02, 0U); + IOMUXC_SetPinMux(IOMUXC_GPIO_B0_12_GPIO2_IO12, 0U); + IOMUXC_SetPinMux(IOMUXC_GPIO_B0_13_XBAR1_INOUT11, 0U); + IOMUXC_SetPinMux(IOMUXC_GPIO_B0_14_XBAR1_INOUT12, 0U); + IOMUXC_SetPinMux(IOMUXC_GPIO_B1_00_LPUART4_TX, 0U); + IOMUXC_SetPinMux(IOMUXC_GPIO_B1_01_LPUART4_RX, 0U); + IOMUXC_SetPinMux(IOMUXC_GPIO_B1_02_LPSPI4_PCS2, 0U); + IOMUXC_SetPinMux(IOMUXC_GPIO_B1_03_LPSPI4_PCS1, 0U); + IOMUXC_SetPinMux(IOMUXC_GPIO_B1_04_GPIO2_IO20, 0U); + IOMUXC_SetPinMux(IOMUXC_GPIO_B1_05_GPIO2_IO21, 0U); + IOMUXC_SetPinMux(IOMUXC_GPIO_B1_06_GPIO2_IO22, 0U); + IOMUXC_SetPinMux(IOMUXC_GPIO_B1_07_GPIO2_IO23, 0U); + IOMUXC_SetPinMux(IOMUXC_GPIO_B1_08_GPIO2_IO24, 0U); + IOMUXC_SetPinMux(IOMUXC_GPIO_B1_09_GPIO2_IO25, 0U); + IOMUXC_SetPinMux(IOMUXC_GPIO_B1_10_GPIO2_IO26, 0U); + IOMUXC_SetPinMux(IOMUXC_GPIO_B1_11_GPIO2_IO27, 0U); + IOMUXC_SetPinMux(IOMUXC_GPIO_B1_12_USDHC1_CD_B, 0U); + IOMUXC_SetPinMux(IOMUXC_GPIO_SD_B0_00_USDHC1_CMD, 0U); + IOMUXC_SetPinMux(IOMUXC_GPIO_SD_B0_01_USDHC1_CLK, 0U); + IOMUXC_SetPinMux(IOMUXC_GPIO_SD_B0_02_USDHC1_DATA0, 0U); + IOMUXC_SetPinMux(IOMUXC_GPIO_SD_B0_03_USDHC1_DATA1, 0U); + IOMUXC_SetPinMux(IOMUXC_GPIO_SD_B0_04_USDHC1_DATA2, 0U); + IOMUXC_SetPinMux(IOMUXC_GPIO_SD_B0_05_USDHC1_DATA3, 0U); + IOMUXC_SetPinMux(IOMUXC_GPIO_SD_B1_00_GPIO3_IO00, 1U); + IOMUXC_SetPinMux(IOMUXC_GPIO_SD_B1_01_GPIO3_IO01, 1U); + IOMUXC_SetPinMux(IOMUXC_GPIO_SD_B1_02_FLEXPWM2_PWMA03, 0U); + IOMUXC_GPR->GPR6 = ((IOMUXC_GPR->GPR6 & + (~(IOMUXC_GPR_GPR6_IOMUXC_XBAR_DIR_SEL_11_MASK | IOMUXC_GPR_GPR6_IOMUXC_XBAR_DIR_SEL_12_MASK))) + | IOMUXC_GPR_GPR6_IOMUXC_XBAR_DIR_SEL_11(0x00U) + | IOMUXC_GPR_GPR6_IOMUXC_XBAR_DIR_SEL_12(0x00U) + ); + XBARA_SetSignalsConnection(XBARA1, kXBARA1_InputIomuxXbarInout11, kXBARA1_OutputEnc1PhaseAInput); + XBARA_SetSignalsConnection(XBARA1, kXBARA1_InputIomuxXbarInout12, kXBARA1_OutputEnc1PhaseBInput); + IOMUXC_SetPinConfig(IOMUXC_GPIO_SD_B1_00_GPIO3_IO00, 0x18B0U); + IOMUXC_SetPinConfig(IOMUXC_GPIO_SD_B1_01_GPIO3_IO01, 0x18B0U); +} + +/*********************************************************************************************************************** + * EOF + **********************************************************************************************************************/ diff --git a/bsp/imxrt/imxrt1052-sc-internal/board/MCUX_Config/pin_mux.h b/bsp/imxrt/imxrt1052-sc-internal/board/MCUX_Config/pin_mux.h new file mode 100644 index 0000000000..a3200aac96 --- /dev/null +++ b/bsp/imxrt/imxrt1052-sc-internal/board/MCUX_Config/pin_mux.h @@ -0,0 +1,430 @@ +/*********************************************************************************************************************** + * This file was generated by the MCUXpresso Config Tools. Any manual edits made to this file + * will be overwritten if the respective MCUXpresso Config Tools is used to update this file. + **********************************************************************************************************************/ + +#ifndef _PIN_MUX_H_ +#define _PIN_MUX_H_ + +/*********************************************************************************************************************** + * Definitions + **********************************************************************************************************************/ + +/*! @brief Direction type */ +typedef enum _pin_mux_direction +{ + kPIN_MUX_DirectionInput = 0U, /* Input direction */ + kPIN_MUX_DirectionOutput = 1U, /* Output direction */ + kPIN_MUX_DirectionInputOrOutput = 2U /* Input or output direction */ +} pin_mux_direction_t; + +/*! + * @addtogroup pin_mux + * @{ + */ + +/*********************************************************************************************************************** + * API + **********************************************************************************************************************/ + +#if defined(__cplusplus) +extern "C" { +#endif + +/*! + * @brief Calls initialization functions. + * + */ +void BOARD_InitBootPins(void); + +/* GPIO_AD_B0_12 (coord K14), UART1_TXD */ +/* Routed pin properties */ +#define BOARD_INITPINS_UART1_TXD_PERIPHERAL LPUART1 /*!< Peripheral name */ +#define BOARD_INITPINS_UART1_TXD_SIGNAL TX /*!< Signal name */ + +/* GPIO_AD_B0_13 (coord L14), UART1_RXD */ +/* Routed pin properties */ +#define BOARD_INITPINS_UART1_RXD_PERIPHERAL LPUART1 /*!< Peripheral name */ +#define BOARD_INITPINS_UART1_RXD_SIGNAL RX /*!< Signal name */ + +/* GPIO_SD_B0_02 (coord J1), SD1_D0/J24[4]/SPI_MOSI/PWM */ +/* Routed pin properties */ +#define BOARD_INITPINS_SD1_D0_PERIPHERAL USDHC1 /*!< Peripheral name */ +#define BOARD_INITPINS_SD1_D0_SIGNAL usdhc_data /*!< Signal name */ +#define BOARD_INITPINS_SD1_D0_CHANNEL 0U /*!< Signal channel */ + +/* GPIO_SD_B0_03 (coord K1), SD1_D1/J24[5]/SPI_MISO */ +/* Routed pin properties */ +#define BOARD_INITPINS_SD1_D1_PERIPHERAL USDHC1 /*!< Peripheral name */ +#define BOARD_INITPINS_SD1_D1_SIGNAL usdhc_data /*!< Signal name */ +#define BOARD_INITPINS_SD1_D1_CHANNEL 1U /*!< Signal channel */ + +/* GPIO_SD_B0_04 (coord H2), SD1_D2 */ +/* Routed pin properties */ +#define BOARD_INITPINS_SD1_D2_PERIPHERAL USDHC1 /*!< Peripheral name */ +#define BOARD_INITPINS_SD1_D2_SIGNAL usdhc_data /*!< Signal name */ +#define BOARD_INITPINS_SD1_D2_CHANNEL 2U /*!< Signal channel */ + +/* GPIO_SD_B0_05 (coord J2), SD1_D3 */ +/* Routed pin properties */ +#define BOARD_INITPINS_SD1_D3_PERIPHERAL USDHC1 /*!< Peripheral name */ +#define BOARD_INITPINS_SD1_D3_SIGNAL usdhc_data /*!< Signal name */ +#define BOARD_INITPINS_SD1_D3_CHANNEL 3U /*!< Signal channel */ + +/* GPIO_SD_B0_01 (coord J3), SD1_CLK/J24[3] */ +/* Routed pin properties */ +#define BOARD_INITPINS_SD1_CLK_PERIPHERAL USDHC1 /*!< Peripheral name */ +#define BOARD_INITPINS_SD1_CLK_SIGNAL usdhc_clk /*!< Signal name */ + +/* GPIO_SD_B0_00 (coord J4), SD1_CMD/J24[6] */ +/* Routed pin properties */ +#define BOARD_INITPINS_SD1_CMD_PERIPHERAL USDHC1 /*!< Peripheral name */ +#define BOARD_INITPINS_SD1_CMD_SIGNAL usdhc_cmd /*!< Signal name */ + +/* GPIO_B1_12 (coord D13), SD_CD_SW */ +/* Routed pin properties */ +#define BOARD_INITPINS_SD_CD_SW_PERIPHERAL USDHC1 /*!< Peripheral name */ +#define BOARD_INITPINS_SD_CD_SW_SIGNAL usdhc_cd_b /*!< Signal name */ + +/* GPIO_SD_B1_02 (coord M3), FlexSPI_D1_B */ +/* Routed pin properties */ +#define BOARD_INITPINS_FlexSPI_D1_B_PERIPHERAL PWM2 /*!< Peripheral name */ +#define BOARD_INITPINS_FlexSPI_D1_B_SIGNAL A /*!< Signal name */ +#define BOARD_INITPINS_FlexSPI_D1_B_CHANNEL 3U /*!< Signal channel */ + +/* GPIO_SD_B1_00 (coord L5), FlexSPI_D3_B */ +/* Routed pin properties */ +#define BOARD_INITPINS_FlexSPI_D3_B_PERIPHERAL GPIO3 /*!< Peripheral name */ +#define BOARD_INITPINS_FlexSPI_D3_B_SIGNAL gpio_io /*!< Signal name */ +#define BOARD_INITPINS_FlexSPI_D3_B_CHANNEL 0U /*!< Signal channel */ + +/* Symbols to be used with GPIO driver */ +#define BOARD_INITPINS_FlexSPI_D3_B_GPIO GPIO3 /*!< GPIO peripheral base pointer */ +#define BOARD_INITPINS_FlexSPI_D3_B_GPIO_PIN 0U /*!< GPIO pin number */ +#define BOARD_INITPINS_FlexSPI_D3_B_GPIO_PIN_MASK (1U << 0U) /*!< GPIO pin mask */ +#define BOARD_INITPINS_FlexSPI_D3_B_PORT GPIO3 /*!< PORT peripheral base pointer */ +#define BOARD_INITPINS_FlexSPI_D3_B_PIN 0U /*!< PORT pin number */ +#define BOARD_INITPINS_FlexSPI_D3_B_PIN_MASK (1U << 0U) /*!< PORT pin mask */ + +/* GPIO_SD_B1_01 (coord M5), FlexSPI_D2_B */ +/* Routed pin properties */ +#define BOARD_INITPINS_FlexSPI_D2_B_PERIPHERAL GPIO3 /*!< Peripheral name */ +#define BOARD_INITPINS_FlexSPI_D2_B_SIGNAL gpio_io /*!< Signal name */ +#define BOARD_INITPINS_FlexSPI_D2_B_CHANNEL 1U /*!< Signal channel */ + +/* Symbols to be used with GPIO driver */ +#define BOARD_INITPINS_FlexSPI_D2_B_GPIO GPIO3 /*!< GPIO peripheral base pointer */ +#define BOARD_INITPINS_FlexSPI_D2_B_GPIO_PIN 1U /*!< GPIO pin number */ +#define BOARD_INITPINS_FlexSPI_D2_B_GPIO_PIN_MASK (1U << 1U) /*!< GPIO pin mask */ +#define BOARD_INITPINS_FlexSPI_D2_B_PORT GPIO3 /*!< PORT peripheral base pointer */ +#define BOARD_INITPINS_FlexSPI_D2_B_PIN 1U /*!< PORT pin number */ +#define BOARD_INITPINS_FlexSPI_D2_B_PIN_MASK (1U << 1U) /*!< PORT pin mask */ + +/* GPIO_AD_B1_15 (coord J14), SAI1_TX_SYNC/CSI_D2/J35[6]/U13[13] */ +/* Routed pin properties */ +#define BOARD_INITPINS_CSI_D2_PERIPHERAL CSI /*!< Peripheral name */ +#define BOARD_INITPINS_CSI_D2_SIGNAL csi_data /*!< Signal name */ +#define BOARD_INITPINS_CSI_D2_CHANNEL 2U /*!< Signal channel */ + +/* GPIO_AD_B1_14 (coord G12), SAI1_TX_BCLK/CSI_D3/J35[4]/U13[12] */ +/* Routed pin properties */ +#define BOARD_INITPINS_CSI_D3_PERIPHERAL CSI /*!< Peripheral name */ +#define BOARD_INITPINS_CSI_D3_SIGNAL csi_data /*!< Signal name */ +#define BOARD_INITPINS_CSI_D3_CHANNEL 3U /*!< Signal channel */ + +/* GPIO_AD_B1_13 (coord H11), SAI1_TXD/CSI_D4/J35[3]/U13[14] */ +/* Routed pin properties */ +#define BOARD_INITPINS_CSI_D4_PERIPHERAL CSI /*!< Peripheral name */ +#define BOARD_INITPINS_CSI_D4_SIGNAL csi_data /*!< Signal name */ +#define BOARD_INITPINS_CSI_D4_CHANNEL 4U /*!< Signal channel */ + +/* GPIO_AD_B1_12 (coord H12), SAI1_RXD/CSI_D5/J35[5]/U13[16] */ +/* Routed pin properties */ +#define BOARD_INITPINS_CSI_D5_PERIPHERAL CSI /*!< Peripheral name */ +#define BOARD_INITPINS_CSI_D5_SIGNAL csi_data /*!< Signal name */ +#define BOARD_INITPINS_CSI_D5_CHANNEL 5U /*!< Signal channel */ + +/* GPIO_AD_B1_11 (coord J13), BSP_DS18B20 */ +/* Routed pin properties */ +#define BOARD_INITPINS_CSI_D6_PERIPHERAL CSI /*!< Peripheral name */ +#define BOARD_INITPINS_CSI_D6_SIGNAL csi_data /*!< Signal name */ +#define BOARD_INITPINS_CSI_D6_CHANNEL 6U /*!< Signal channel */ + +/* GPIO_AD_B1_10 (coord L13), BSP_RS485_RE */ +/* Routed pin properties */ +#define BOARD_INITPINS_CSI_D7_PERIPHERAL CSI /*!< Peripheral name */ +#define BOARD_INITPINS_CSI_D7_SIGNAL csi_data /*!< Signal name */ +#define BOARD_INITPINS_CSI_D7_CHANNEL 7U /*!< Signal channel */ + +/* GPIO_AD_B1_09 (coord M13), SAI1_MCLK/CSI_D8/J35[11] */ +/* Routed pin properties */ +#define BOARD_INITPINS_CSI_D8_PERIPHERAL CSI /*!< Peripheral name */ +#define BOARD_INITPINS_CSI_D8_SIGNAL csi_data /*!< Signal name */ +#define BOARD_INITPINS_CSI_D8_CHANNEL 8U /*!< Signal channel */ + +/* GPIO_AD_B1_08 (coord H13), AUD_INT/CSI_D9//J35[13]/J22[4] */ +/* Routed pin properties */ +#define BOARD_INITPINS_CSI_D9_PERIPHERAL CSI /*!< Peripheral name */ +#define BOARD_INITPINS_CSI_D9_SIGNAL csi_data /*!< Signal name */ +#define BOARD_INITPINS_CSI_D9_CHANNEL 9U /*!< Signal channel */ + +/* GPIO_AD_B1_04 (coord L12), CSI_PIXCLK/J35[8]/J23[3] */ +/* Routed pin properties */ +#define BOARD_INITPINS_CSI_PIXCLK_PERIPHERAL CSI /*!< Peripheral name */ +#define BOARD_INITPINS_CSI_PIXCLK_SIGNAL csi_pixclk /*!< Signal name */ + +/* GPIO_AD_B1_07 (coord K10), CSI_HSYNC/J35[16]/J22[1]/UART_RX */ +/* Routed pin properties */ +#define BOARD_INITPINS_CSI_HSYNC_PERIPHERAL CSI /*!< Peripheral name */ +#define BOARD_INITPINS_CSI_HSYNC_SIGNAL csi_hsync /*!< Signal name */ + +/* GPIO_AD_B1_06 (coord J12), CSI_VSYNC/J35[18]/J22[2]/UART_TX */ +/* Routed pin properties */ +#define BOARD_INITPINS_CSI_VSYNC_PERIPHERAL CSI /*!< Peripheral name */ +#define BOARD_INITPINS_CSI_VSYNC_SIGNAL csi_vsync /*!< Signal name */ + +/* GPIO_AD_B0_14 (coord H14), CAN2_TX/U12[1] */ +/* Routed pin properties */ +#define BOARD_INITPINS_CAN2_TX_PERIPHERAL ADC1 /*!< Peripheral name */ +#define BOARD_INITPINS_CAN2_TX_SIGNAL IN /*!< Signal name */ +#define BOARD_INITPINS_CAN2_TX_CHANNEL 3U /*!< Signal channel */ + +/* GPIO_AD_B1_03 (coord M12), SPDIF_IN/J22[8] */ +/* Routed pin properties */ +#define BOARD_INITPINS_SPDIF_IN_PERIPHERAL ADC1 /*!< Peripheral name */ +#define BOARD_INITPINS_SPDIF_IN_SIGNAL IN /*!< Signal name */ +#define BOARD_INITPINS_SPDIF_IN_CHANNEL 8U /*!< Signal channel */ + +/* GPIO_AD_B1_02 (coord L11), SPDIF_OUT/J22[7] */ +/* Routed pin properties */ +#define BOARD_INITPINS_SPDIF_OUT_PERIPHERAL ADC1 /*!< Peripheral name */ +#define BOARD_INITPINS_SPDIF_OUT_SIGNAL IN /*!< Signal name */ +#define BOARD_INITPINS_SPDIF_OUT_CHANNEL 7U /*!< Signal channel */ + +/* GPIO_B1_08 (coord A12), ENET_TXD1 */ +/* Routed pin properties */ +#define BOARD_INITPINS_ENET_TXD1_PERIPHERAL GPIO2 /*!< Peripheral name */ +#define BOARD_INITPINS_ENET_TXD1_SIGNAL gpio_io /*!< Signal name */ +#define BOARD_INITPINS_ENET_TXD1_CHANNEL 24U /*!< Signal channel */ + +/* Symbols to be used with GPIO driver */ +#define BOARD_INITPINS_ENET_TXD1_GPIO GPIO2 /*!< GPIO peripheral base pointer */ +#define BOARD_INITPINS_ENET_TXD1_GPIO_PIN 24U /*!< GPIO pin number */ +#define BOARD_INITPINS_ENET_TXD1_GPIO_PIN_MASK (1U << 24U) /*!< GPIO pin mask */ +#define BOARD_INITPINS_ENET_TXD1_PORT GPIO2 /*!< PORT peripheral base pointer */ +#define BOARD_INITPINS_ENET_TXD1_PIN 24U /*!< PORT pin number */ +#define BOARD_INITPINS_ENET_TXD1_PIN_MASK (1U << 24U) /*!< PORT pin mask */ + +/* GPIO_B1_07 (coord B12), ENET_TXD0 */ +/* Routed pin properties */ +#define BOARD_INITPINS_ENET_TXD0_PERIPHERAL GPIO2 /*!< Peripheral name */ +#define BOARD_INITPINS_ENET_TXD0_SIGNAL gpio_io /*!< Signal name */ +#define BOARD_INITPINS_ENET_TXD0_CHANNEL 23U /*!< Signal channel */ + +/* Symbols to be used with GPIO driver */ +#define BOARD_INITPINS_ENET_TXD0_GPIO GPIO2 /*!< GPIO peripheral base pointer */ +#define BOARD_INITPINS_ENET_TXD0_GPIO_PIN 23U /*!< GPIO pin number */ +#define BOARD_INITPINS_ENET_TXD0_GPIO_PIN_MASK (1U << 23U) /*!< GPIO pin mask */ +#define BOARD_INITPINS_ENET_TXD0_PORT GPIO2 /*!< PORT peripheral base pointer */ +#define BOARD_INITPINS_ENET_TXD0_PIN 23U /*!< PORT pin number */ +#define BOARD_INITPINS_ENET_TXD0_PIN_MASK (1U << 23U) /*!< PORT pin mask */ + +/* GPIO_B1_09 (coord A13), ENET_TXEN */ +/* Routed pin properties */ +#define BOARD_INITPINS_ENET_TXEN_PERIPHERAL GPIO2 /*!< Peripheral name */ +#define BOARD_INITPINS_ENET_TXEN_SIGNAL gpio_io /*!< Signal name */ +#define BOARD_INITPINS_ENET_TXEN_CHANNEL 25U /*!< Signal channel */ + +/* Symbols to be used with GPIO driver */ +#define BOARD_INITPINS_ENET_TXEN_GPIO GPIO2 /*!< GPIO peripheral base pointer */ +#define BOARD_INITPINS_ENET_TXEN_GPIO_PIN 25U /*!< GPIO pin number */ +#define BOARD_INITPINS_ENET_TXEN_GPIO_PIN_MASK (1U << 25U) /*!< GPIO pin mask */ +#define BOARD_INITPINS_ENET_TXEN_PORT GPIO2 /*!< PORT peripheral base pointer */ +#define BOARD_INITPINS_ENET_TXEN_PIN 25U /*!< PORT pin number */ +#define BOARD_INITPINS_ENET_TXEN_PIN_MASK (1U << 25U) /*!< PORT pin mask */ + +/* GPIO_B0_06 (coord A8), LCDIF_D2/BT_CFG[2] */ +/* Routed pin properties */ +#define BOARD_INITPINS_LCDIF_D2_PERIPHERAL PWM2 /*!< Peripheral name */ +#define BOARD_INITPINS_LCDIF_D2_SIGNAL A /*!< Signal name */ +#define BOARD_INITPINS_LCDIF_D2_CHANNEL 0U /*!< Signal channel */ + +/* GPIO_B0_07 (coord A9), LCDIF_D3/BT_CFG[3] */ +/* Routed pin properties */ +#define BOARD_INITPINS_LCDIF_D3_PERIPHERAL PWM2 /*!< Peripheral name */ +#define BOARD_INITPINS_LCDIF_D3_SIGNAL B /*!< Signal name */ +#define BOARD_INITPINS_LCDIF_D3_CHANNEL 0U /*!< Signal channel */ + +/* GPIO_B0_08 (coord B9), LCDIF_D4/BT_CFG[4] */ +/* Routed pin properties */ +#define BOARD_INITPINS_LCDIF_D4_PERIPHERAL PWM2 /*!< Peripheral name */ +#define BOARD_INITPINS_LCDIF_D4_SIGNAL A /*!< Signal name */ +#define BOARD_INITPINS_LCDIF_D4_CHANNEL 1U /*!< Signal channel */ + +/* GPIO_B0_09 (coord C9), LCDIF_D5/BT_CFG[5] */ +/* Routed pin properties */ +#define BOARD_INITPINS_LCDIF_D5_PERIPHERAL PWM2 /*!< Peripheral name */ +#define BOARD_INITPINS_LCDIF_D5_SIGNAL B /*!< Signal name */ +#define BOARD_INITPINS_LCDIF_D5_CHANNEL 1U /*!< Signal channel */ + +/* GPIO_B0_10 (coord D9), LCDIF_D6/BT_CFG[6] */ +/* Routed pin properties */ +#define BOARD_INITPINS_LCDIF_D6_PERIPHERAL PWM2 /*!< Peripheral name */ +#define BOARD_INITPINS_LCDIF_D6_SIGNAL A /*!< Signal name */ +#define BOARD_INITPINS_LCDIF_D6_CHANNEL 2U /*!< Signal channel */ + +/* GPIO_B0_12 (coord C10), LCDIF_D8/BT_CFG[8] */ +/* Routed pin properties */ +#define BOARD_INITPINS_LCDIF_D8_PERIPHERAL GPIO2 /*!< Peripheral name */ +#define BOARD_INITPINS_LCDIF_D8_SIGNAL gpio_io /*!< Signal name */ +#define BOARD_INITPINS_LCDIF_D8_CHANNEL 12U /*!< Signal channel */ + +/* Symbols to be used with GPIO driver */ +#define BOARD_INITPINS_LCDIF_D8_GPIO GPIO2 /*!< GPIO peripheral base pointer */ +#define BOARD_INITPINS_LCDIF_D8_GPIO_PIN 12U /*!< GPIO pin number */ +#define BOARD_INITPINS_LCDIF_D8_GPIO_PIN_MASK (1U << 12U) /*!< GPIO pin mask */ +#define BOARD_INITPINS_LCDIF_D8_PORT GPIO2 /*!< PORT peripheral base pointer */ +#define BOARD_INITPINS_LCDIF_D8_PIN 12U /*!< PORT pin number */ +#define BOARD_INITPINS_LCDIF_D8_PIN_MASK (1U << 12U) /*!< PORT pin mask */ + +/* GPIO_B1_10 (coord B13), ENET_TX_CLK */ +/* Routed pin properties */ +#define BOARD_INITPINS_ENET_TX_CLK_PERIPHERAL GPIO2 /*!< Peripheral name */ +#define BOARD_INITPINS_ENET_TX_CLK_SIGNAL gpio_io /*!< Signal name */ +#define BOARD_INITPINS_ENET_TX_CLK_CHANNEL 26U /*!< Signal channel */ + +/* Symbols to be used with GPIO driver */ +#define BOARD_INITPINS_ENET_TX_CLK_GPIO GPIO2 /*!< GPIO peripheral base pointer */ +#define BOARD_INITPINS_ENET_TX_CLK_GPIO_PIN 26U /*!< GPIO pin number */ +#define BOARD_INITPINS_ENET_TX_CLK_GPIO_PIN_MASK (1U << 26U) /*!< GPIO pin mask */ +#define BOARD_INITPINS_ENET_TX_CLK_PORT GPIO2 /*!< PORT peripheral base pointer */ +#define BOARD_INITPINS_ENET_TX_CLK_PIN 26U /*!< PORT pin number */ +#define BOARD_INITPINS_ENET_TX_CLK_PIN_MASK (1U << 26U) /*!< PORT pin mask */ + +/* GPIO_B0_01 (coord E7), LCDIF_ENABLE */ +/* Routed pin properties */ +#define BOARD_INITPINS_LCDIF_ENABLE_PERIPHERAL LPSPI4 /*!< Peripheral name */ +#define BOARD_INITPINS_LCDIF_ENABLE_SIGNAL SDI /*!< Signal name */ + +/* GPIO_B0_02 (coord E8), LCDIF_HSYNC */ +/* Routed pin properties */ +#define BOARD_INITPINS_LCDIF_HSYNC_PERIPHERAL LPSPI4 /*!< Peripheral name */ +#define BOARD_INITPINS_LCDIF_HSYNC_SIGNAL SDO /*!< Signal name */ + +/* GPIO_B0_03 (coord D8), LCDIF_VSYNC */ +/* Routed pin properties */ +#define BOARD_INITPINS_LCDIF_VSYNC_PERIPHERAL LPSPI4 /*!< Peripheral name */ +#define BOARD_INITPINS_LCDIF_VSYNC_SIGNAL SCK /*!< Signal name */ + +/* GPIO_B0_00 (coord D7), LCDIF_CLK */ +/* Routed pin properties */ +#define BOARD_INITPINS_LCDIF_CLK_PERIPHERAL LPSPI4 /*!< Peripheral name */ +#define BOARD_INITPINS_LCDIF_CLK_SIGNAL PCS0 /*!< Signal name */ + +/* GPIO_B1_03 (coord D11), LCDIF_D15 */ +/* Routed pin properties */ +#define BOARD_INITPINS_LCDIF_D15_PERIPHERAL LPSPI4 /*!< Peripheral name */ +#define BOARD_INITPINS_LCDIF_D15_SIGNAL PCS1 /*!< Signal name */ + +/* GPIO_B1_02 (coord C11), LCDIF_D14 */ +/* Routed pin properties */ +#define BOARD_INITPINS_LCDIF_D14_PERIPHERAL LPSPI4 /*!< Peripheral name */ +#define BOARD_INITPINS_LCDIF_D14_SIGNAL PCS2 /*!< Signal name */ + +/* GPIO_B1_11 (coord C13), ENET_RXER */ +/* Routed pin properties */ +#define BOARD_INITPINS_ENET_RXER_PERIPHERAL GPIO2 /*!< Peripheral name */ +#define BOARD_INITPINS_ENET_RXER_SIGNAL gpio_io /*!< Signal name */ +#define BOARD_INITPINS_ENET_RXER_CHANNEL 27U /*!< Signal channel */ + +/* Symbols to be used with GPIO driver */ +#define BOARD_INITPINS_ENET_RXER_GPIO GPIO2 /*!< GPIO peripheral base pointer */ +#define BOARD_INITPINS_ENET_RXER_GPIO_PIN 27U /*!< GPIO pin number */ +#define BOARD_INITPINS_ENET_RXER_GPIO_PIN_MASK (1U << 27U) /*!< GPIO pin mask */ +#define BOARD_INITPINS_ENET_RXER_PORT GPIO2 /*!< PORT peripheral base pointer */ +#define BOARD_INITPINS_ENET_RXER_PIN 27U /*!< PORT pin number */ +#define BOARD_INITPINS_ENET_RXER_PIN_MASK (1U << 27U) /*!< PORT pin mask */ + +/* GPIO_B1_06 (coord C12), ENET_CRS_DV */ +/* Routed pin properties */ +#define BOARD_INITPINS_ENET_CRS_DV_PERIPHERAL GPIO2 /*!< Peripheral name */ +#define BOARD_INITPINS_ENET_CRS_DV_SIGNAL gpio_io /*!< Signal name */ +#define BOARD_INITPINS_ENET_CRS_DV_CHANNEL 22U /*!< Signal channel */ + +/* Symbols to be used with GPIO driver */ +#define BOARD_INITPINS_ENET_CRS_DV_GPIO GPIO2 /*!< GPIO peripheral base pointer */ +#define BOARD_INITPINS_ENET_CRS_DV_GPIO_PIN 22U /*!< GPIO pin number */ +#define BOARD_INITPINS_ENET_CRS_DV_GPIO_PIN_MASK (1U << 22U) /*!< GPIO pin mask */ +#define BOARD_INITPINS_ENET_CRS_DV_PORT GPIO2 /*!< PORT peripheral base pointer */ +#define BOARD_INITPINS_ENET_CRS_DV_PIN 22U /*!< PORT pin number */ +#define BOARD_INITPINS_ENET_CRS_DV_PIN_MASK (1U << 22U) /*!< PORT pin mask */ + +/* GPIO_B1_04 (coord E12), ENET_RXD0 */ +/* Routed pin properties */ +#define BOARD_INITPINS_ENET_RXD0_PERIPHERAL GPIO2 /*!< Peripheral name */ +#define BOARD_INITPINS_ENET_RXD0_SIGNAL gpio_io /*!< Signal name */ +#define BOARD_INITPINS_ENET_RXD0_CHANNEL 20U /*!< Signal channel */ + +/* Symbols to be used with GPIO driver */ +#define BOARD_INITPINS_ENET_RXD0_GPIO GPIO2 /*!< GPIO peripheral base pointer */ +#define BOARD_INITPINS_ENET_RXD0_GPIO_PIN 20U /*!< GPIO pin number */ +#define BOARD_INITPINS_ENET_RXD0_GPIO_PIN_MASK (1U << 20U) /*!< GPIO pin mask */ +#define BOARD_INITPINS_ENET_RXD0_PORT GPIO2 /*!< PORT peripheral base pointer */ +#define BOARD_INITPINS_ENET_RXD0_PIN 20U /*!< PORT pin number */ +#define BOARD_INITPINS_ENET_RXD0_PIN_MASK (1U << 20U) /*!< PORT pin mask */ + +/* GPIO_B1_05 (coord D12), ENET_RXD1 */ +/* Routed pin properties */ +#define BOARD_INITPINS_ENET_RXD1_PERIPHERAL GPIO2 /*!< Peripheral name */ +#define BOARD_INITPINS_ENET_RXD1_SIGNAL gpio_io /*!< Signal name */ +#define BOARD_INITPINS_ENET_RXD1_CHANNEL 21U /*!< Signal channel */ + +/* Symbols to be used with GPIO driver */ +#define BOARD_INITPINS_ENET_RXD1_GPIO GPIO2 /*!< GPIO peripheral base pointer */ +#define BOARD_INITPINS_ENET_RXD1_GPIO_PIN 21U /*!< GPIO pin number */ +#define BOARD_INITPINS_ENET_RXD1_GPIO_PIN_MASK (1U << 21U) /*!< GPIO pin mask */ +#define BOARD_INITPINS_ENET_RXD1_PORT GPIO2 /*!< PORT peripheral base pointer */ +#define BOARD_INITPINS_ENET_RXD1_PIN 21U /*!< PORT pin number */ +#define BOARD_INITPINS_ENET_RXD1_PIN_MASK (1U << 21U) /*!< PORT pin mask */ + +/* GPIO_B0_13 (coord D10), LCDIF_D9/BT_CFG[9] */ +/* Routed pin properties */ +#define BOARD_INITPINS_LCDIF_D9_PERIPHERAL ENC1 /*!< Peripheral name */ +#define BOARD_INITPINS_LCDIF_D9_SIGNAL PHASE /*!< Signal name */ +#define BOARD_INITPINS_LCDIF_D9_CHANNEL A /*!< Signal channel */ + +/* GPIO_B0_14 (coord E10), LCDIF_D10/BT_CFG[10] */ +/* Routed pin properties */ +#define BOARD_INITPINS_LCDIF_D10_PERIPHERAL ENC1 /*!< Peripheral name */ +#define BOARD_INITPINS_LCDIF_D10_SIGNAL PHASE /*!< Signal name */ +#define BOARD_INITPINS_LCDIF_D10_CHANNEL B /*!< Signal channel */ + +/* GPIO_B1_00 (coord A11), LCDIF_D12 */ +/* Routed pin properties */ +#define BOARD_INITPINS_LCDIF_D12_PERIPHERAL LPUART4 /*!< Peripheral name */ +#define BOARD_INITPINS_LCDIF_D12_SIGNAL TX /*!< Signal name */ + +/* GPIO_B1_01 (coord B11), LCDIF_D13 */ +/* Routed pin properties */ +#define BOARD_INITPINS_LCDIF_D13_PERIPHERAL LPUART4 /*!< Peripheral name */ +#define BOARD_INITPINS_LCDIF_D13_SIGNAL RX /*!< Signal name */ + + +/*! + * @brief Configures pin routing and optionally pin electrical features. + * + */ +void BOARD_InitPins(void); + +#if defined(__cplusplus) +} +#endif + +/*! + * @} + */ +#endif /* _PIN_MUX_H_ */ + +/*********************************************************************************************************************** + * EOF + **********************************************************************************************************************/ diff --git a/bsp/imxrt/imxrt1052-sc-internal/board/SConscript b/bsp/imxrt/imxrt1052-sc-internal/board/SConscript new file mode 100644 index 0000000000..43d5d37a92 --- /dev/null +++ b/bsp/imxrt/imxrt1052-sc-internal/board/SConscript @@ -0,0 +1,17 @@ +from building import * + +cwd = GetCurrentDir() + +# add the general drivers. +src = Split(""" +board.c +MCUX_Config/clock_config.c +MCUX_Config/pin_mux.c +""") + +CPPPATH = [cwd,cwd + '/MCUX_Config',cwd + '/ports'] +CPPDEFINES = ['CPU_MIMXRT1052CVL5B', 'SKIP_SYSCLK_INIT', 'EVK_MCIMXRM', 'FSL_SDK_ENABLE_DRIVER_CACHE_CONTROL=1','XIP_EXTERNAL_FLASH=1','XIP_BOOT_HEADER_ENABLE=1'] + +group = DefineGroup('Drivers', src, depend = [''], CPPPATH = CPPPATH, CPPDEFINES=CPPDEFINES) + +Return('group') diff --git a/bsp/imxrt/imxrt1052-sc-internal/board/board.c b/bsp/imxrt/imxrt1052-sc-internal/board/board.c new file mode 100644 index 0000000000..e50e511070 --- /dev/null +++ b/bsp/imxrt/imxrt1052-sc-internal/board/board.c @@ -0,0 +1,138 @@ +/* + * Copyright (c) 2006-2018, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2009-01-05 Bernard first implementation + */ + +#include +#include +#include "board.h" +#include "pin_mux.h" + +#ifdef BSP_USING_DMA +#include "fsl_dmamux.h" +#include "fsl_edma.h" +#endif + +#define NVIC_PRIORITYGROUP_0 0x00000007U /*!< 0 bits for pre-emption priority + 4 bits for subpriority */ +#define NVIC_PRIORITYGROUP_1 0x00000006U /*!< 1 bits for pre-emption priority + 3 bits for subpriority */ +#define NVIC_PRIORITYGROUP_2 0x00000005U /*!< 2 bits for pre-emption priority + 2 bits for subpriority */ +#define NVIC_PRIORITYGROUP_3 0x00000004U /*!< 3 bits for pre-emption priority + 1 bits for subpriority */ +#define NVIC_PRIORITYGROUP_4 0x00000003U /*!< 4 bits for pre-emption priority + 0 bits for subpriority */ + +/* MPU configuration. */ +static void BOARD_ConfigMPU(void) +{ + /* Disable I cache and D cache */ + SCB_DisableICache(); + SCB_DisableDCache(); + + /* Disable MPU */ + ARM_MPU_Disable(); + + /* Region 0 setting */ + MPU->RBAR = ARM_MPU_RBAR(0, 0xC0000000U); + MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 2, 0, 0, 0, 0, ARM_MPU_REGION_SIZE_512MB); + + /* Region 1 setting */ + MPU->RBAR = ARM_MPU_RBAR(1, 0x80000000U); + MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 2, 0, 0, 0, 0, ARM_MPU_REGION_SIZE_1GB); + + /* Region 2 setting */ + // spi flash: normal type, cacheable, no bufferable, no shareable + MPU->RBAR = ARM_MPU_RBAR(2, 0x60000000U); + MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 0, 0, 1, 0, 0, ARM_MPU_REGION_SIZE_512MB); + + /* Region 3 setting */ + MPU->RBAR = ARM_MPU_RBAR(3, 0x00000000U); + MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 2, 0, 0, 0, 0, ARM_MPU_REGION_SIZE_1GB); + + /* Region 4 setting */ + MPU->RBAR = ARM_MPU_RBAR(4, 0x00000000U); + MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 0, 0, 1, 1, 0, ARM_MPU_REGION_SIZE_128KB); + + /* Region 5 setting */ + MPU->RBAR = ARM_MPU_RBAR(5, 0x20000000U); + MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 0, 0, 1, 1, 0, ARM_MPU_REGION_SIZE_128KB); + + /* Region 6 setting */ + MPU->RBAR = ARM_MPU_RBAR(6, 0x20200000U); + MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 0, 0, 1, 1, 0, ARM_MPU_REGION_SIZE_256KB); + +#if defined(BSP_USING_SDRAM) + /* Region 7 setting */ + MPU->RBAR = ARM_MPU_RBAR(7, 0x80000000U); + MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 0, 0, 1, 1, 0, ARM_MPU_REGION_SIZE_32MB); + + /* Region 8 setting */ + MPU->RBAR = ARM_MPU_RBAR(8, 0x81E00000U); + MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 1, 1, 0, 0, 0, ARM_MPU_REGION_SIZE_2MB); +#endif + + /* Enable MPU */ + ARM_MPU_Enable(MPU_CTRL_PRIVDEFENA_Msk); + + /* Enable I cache and D cache */ + SCB_EnableDCache(); + SCB_EnableICache(); +} + + +/* This is the timer interrupt service routine. */ +void SysTick_Handler(void) +{ + /* enter interrupt */ + rt_interrupt_enter(); + + rt_tick_increase(); + + /* leave interrupt */ + rt_interrupt_leave(); +} + +#ifdef BSP_USING_DMA +void imxrt_dma_init(void) +{ + edma_config_t config; + + DMAMUX_Init(DMAMUX); + EDMA_GetDefaultConfig(&config); + EDMA_Init(DMA0, &config); +} +#endif + +void rt_hw_board_init() +{ + BOARD_ConfigMPU(); + BOARD_InitPins(); + BOARD_BootClockRUN(); + + NVIC_SetPriorityGrouping(NVIC_PRIORITYGROUP_4); + SysTick_Config(SystemCoreClock / RT_TICK_PER_SECOND); + +#ifdef BSP_USING_DMA + imxrt_dma_init(); +#endif + +#ifdef RT_USING_HEAP + rt_system_heap_init((void *)HEAP_BEGIN, (void *)HEAP_END); +#endif + +#ifdef RT_USING_COMPONENTS_INIT + rt_components_board_init(); +#endif + +#ifdef RT_USING_CONSOLE + rt_console_set_device(RT_CONSOLE_DEVICE_NAME); +#endif +} + diff --git a/bsp/imxrt/imxrt1052-sc-internal/board/board.h b/bsp/imxrt/imxrt1052-sc-internal/board/board.h new file mode 100644 index 0000000000..dc1ff4b98a --- /dev/null +++ b/bsp/imxrt/imxrt1052-sc-internal/board/board.h @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2006-2018, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2009-09-22 Bernard add board.h to this bsp + */ + +// <<< Use Configuration Wizard in Context Menu >>> +#ifndef __BOARD_H__ +#define __BOARD_H__ + +#include "fsl_common.h" +#include "clock_config.h" + +#ifdef __CC_ARM +extern int Image$$RTT_HEAP$$ZI$$Base; +extern int Image$$RTT_HEAP$$ZI$$Limit; +#define HEAP_BEGIN (&Image$$RTT_HEAP$$ZI$$Base) +#define HEAP_END (&Image$$RTT_HEAP$$ZI$$Limit) + +#elif __ICCARM__ +#pragma section="HEAP" +#define HEAP_BEGIN (__segment_end("HEAP")) +extern void __RTT_HEAP_END; +#define HEAP_END (&__RTT_HEAP_END) + +#else +extern int heap_start; +extern int heap_end; +#define HEAP_BEGIN (&heap_start) +#define HEAP_END (&heap_end) +#endif + +#define HEAP_SIZE ((uint32_t)HEAP_END - (uint32_t)HEAP_BEGIN) + +#define BOARD_FLASH_SIZE (0x400000U) + +void rt_hw_board_init(void); + +#endif + diff --git a/bsp/imxrt/imxrt1052-sc-internal/board/linker_scripts/link.icf b/bsp/imxrt/imxrt1052-sc-internal/board/linker_scripts/link.icf new file mode 100644 index 0000000000..a022ded1d6 --- /dev/null +++ b/bsp/imxrt/imxrt1052-sc-internal/board/linker_scripts/link.icf @@ -0,0 +1,95 @@ +/* +** ################################################################### +** Processors: MIMXRT1052CVJ5B +** MIMXRT1052CVL5B +** MIMXRT1052DVJ6B +** MIMXRT1052DVL6B +** +** Compiler: IAR ANSI C/C++ Compiler for ARM +** Reference manual: IMXRT1050RM Rev.1, 03/2018 +** Version: rev. 1.0, 2018-09-21 +** Build: b180921 +** +** Abstract: +** Linker file for the IAR ANSI C/C++ Compiler for ARM +** +** Copyright 2016 Freescale Semiconductor, Inc. +** Copyright 2016-2018 NXP +** All rights reserved. +** +** SPDX-License-Identifier: BSD-3-Clause +** +** http: www.nxp.com +** mail: support@nxp.com +** +** ################################################################### +*/ + +define symbol m_interrupts_start = 0x60002000; +define symbol m_interrupts_end = 0x600023FF; + +define symbol m_text_start = 0x60002400; +define symbol m_text_end = 0x63FFFFFF; + +define symbol m_data_start = 0x20000000; +define symbol m_data_end = 0x2001FFFF; + +define symbol m_data2_start = 0x20200000; +define symbol m_data2_end = 0x2023FFFF; + +define exported symbol m_boot_hdr_conf_start = 0x60000000; +define symbol m_boot_hdr_ivt_start = 0x60001000; +define symbol m_boot_hdr_boot_data_start = 0x60001020; +define symbol m_boot_hdr_dcd_data_start = 0x60001030; + +/* Sizes */ +if (isdefinedsymbol(__stack_size__)) { + define symbol __size_cstack__ = __stack_size__; +} else { + define symbol __size_cstack__ = 0x0400; +} + +if (isdefinedsymbol(__heap_size__)) { + define symbol __size_heap__ = __heap_size__; +} else { + define symbol __size_heap__ = 0x0400; +} + +define exported symbol __VECTOR_TABLE = m_interrupts_start; +define exported symbol __VECTOR_RAM = m_interrupts_start; +define exported symbol __RAM_VECTOR_TABLE_SIZE = 0x0; +define exported symbol __RTT_HEAP_END = m_data2_end; + +define memory mem with size = 4G; +define region TEXT_region = mem:[from m_interrupts_start to m_interrupts_end] + | mem:[from m_text_start to m_text_end]; + +define region DATA_region = mem:[from m_data_start to m_data_end-__size_cstack__]; +define region DATA2_region = mem:[from m_data2_start to m_data2_end]; +define region CSTACK_region = mem:[from m_data_end-__size_cstack__+1 to m_data_end]; + +define block CSTACK with alignment = 8, size = __size_cstack__ { }; +define block HEAP with alignment = 8, size = __size_heap__ { }; +define block RW { readwrite }; +define block ZI { zi }; +define block NCACHE_VAR { section NonCacheable , section NonCacheable.init }; + +initialize by copy { readwrite, section .textrw }; +do not initialize { section .noinit }; + +place at address mem: m_interrupts_start { readonly section .intvec }; + +place at address mem:m_boot_hdr_conf_start { section .boot_hdr.conf }; +place at address mem:m_boot_hdr_ivt_start { section .boot_hdr.ivt }; +place at address mem:m_boot_hdr_boot_data_start { readonly section .boot_hdr.boot_data }; +place at address mem:m_boot_hdr_dcd_data_start { readonly section .boot_hdr.dcd_data }; + +keep{ section .boot_hdr.conf, section .boot_hdr.ivt, section .boot_hdr.boot_data, section .boot_hdr.dcd_data }; + +place in TEXT_region { readonly }; +place in DATA_region { block RW }; +place in DATA_region { block ZI }; +place in DATA_region { last block HEAP }; +place in DATA_region { block NCACHE_VAR }; +place in CSTACK_region { block CSTACK }; + diff --git a/bsp/imxrt/imxrt1052-sc-internal/board/linker_scripts/link.lds b/bsp/imxrt/imxrt1052-sc-internal/board/linker_scripts/link.lds new file mode 100644 index 0000000000..ec0c31b84b --- /dev/null +++ b/bsp/imxrt/imxrt1052-sc-internal/board/linker_scripts/link.lds @@ -0,0 +1,298 @@ +/* +** ################################################################### +** Processors: MIMXRT1052CVJ5B +** MIMXRT1052CVL5B +** MIMXRT1052DVJ6B +** MIMXRT1052DVL6B +** +** Compiler: GNU C Compiler +** Reference manual: IMXRT1050RM Rev.1, 03/2018 +** Version: rev. 0.1, 2017-01-10 +** Build: b180509 +** +** Abstract: +** Linker file for the GNU C Compiler +** +** The Clear BSD License +** Copyright 2016 Freescale Semiconductor, Inc. +** Copyright 2016-2018 NXP +** All rights reserved. +** +** Redistribution and use in source and binary forms, with or without +** modification, are permitted (subject to the limitations in the +** disclaimer below) provided that the following conditions are met: +** +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in the +** documentation and/or other materials provided with the distribution. +** +** * Neither the name of the copyright holder nor the names of its +** contributors may be used to endorse or promote products derived from +** this software without specific prior written permission. +** +** NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE +** GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT +** HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED +** WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +** MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +** BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +** WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +** OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +** IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +** +** http: www.nxp.com +** mail: support@nxp.com +** +** ################################################################### +*/ + +/* Entry Point */ +ENTRY(Reset_Handler) + +HEAP_SIZE = DEFINED(__heap_size__) ? __heap_size__ : 0x0400; +STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x0400; + +/* Specify the memory areas */ +MEMORY +{ + m_flash_config (RX) : ORIGIN = 0x60000000, LENGTH = 0x00001000 + m_ivt (RX) : ORIGIN = 0x60001000, LENGTH = 0x00001000 + m_interrupts (RX) : ORIGIN = 0x60002000, LENGTH = 0x00000400 + m_text (RX) : ORIGIN = 0x60002400, LENGTH = 0x03FFDC00 + m_data (RW) : ORIGIN = 0x20000000, LENGTH = 0x00020000 + m_data2 (RW) : ORIGIN = 0x20200000, LENGTH = 0x00040000 +} + +/* Define output sections */ +SECTIONS +{ + .flash_config : + { + . = ALIGN(4); + __FLASH_BASE = .; + KEEP(* (.boot_hdr.conf)) /* flash config section */ + . = ALIGN(4); + } > m_flash_config + + ivt_begin= ORIGIN(m_flash_config) + LENGTH(m_flash_config); + + .ivt : AT(ivt_begin) + { + . = ALIGN(4); + KEEP(* (.boot_hdr.ivt)) /* ivt section */ + KEEP(* (.boot_hdr.boot_data)) /* boot section */ + KEEP(* (.boot_hdr.dcd_data)) /* dcd section */ + . = ALIGN(4); + } > m_ivt + + /* The startup code goes first into internal RAM */ + .interrupts : + { + __VECTOR_TABLE = .; + . = ALIGN(4); + KEEP(*(.isr_vector)) /* Startup code */ + . = ALIGN(4); + } > m_interrupts + + __VECTOR_RAM = __VECTOR_TABLE; + __RAM_VECTOR_TABLE_SIZE_BYTES = 0x0; + + /* The program code and other data goes into internal RAM */ + .text : + { + . = ALIGN(4); + *(.text) /* .text sections (code) */ + *(.text*) /* .text* sections (code) */ + *(.rodata) /* .rodata sections (constants, strings, etc.) */ + *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ + *(.glue_7) /* glue arm to thumb code */ + *(.glue_7t) /* glue thumb to arm code */ + *(.eh_frame) + KEEP (*(.init)) + KEEP (*(.fini)) + . = ALIGN(4); + + /* section information for finsh shell */ + . = ALIGN(4); + __fsymtab_start = .; + KEEP(*(FSymTab)) + __fsymtab_end = .; + . = ALIGN(4); + __vsymtab_start = .; + KEEP(*(VSymTab)) + __vsymtab_end = .; + . = ALIGN(4); + + /* section information for initial. */ + . = ALIGN(4); + __rt_init_start = .; + KEEP(*(SORT(.rti_fn*))) + __rt_init_end = .; + } > m_text + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > m_text + + .ARM : + { + __exidx_start = .; + *(.ARM.exidx*) + __exidx_end = .; + } > m_text + + .ctors : + { + __CTOR_LIST__ = .; + /* gcc uses crtbegin.o to find the start of + the constructors, so we make sure it is + first. Because this is a wildcard, it + doesn't matter if the user does not + actually link against crtbegin.o; the + linker won't look for a file to match a + wildcard. The wildcard also means that it + doesn't matter which directory crtbegin.o + is in. */ + KEEP (*crtbegin.o(.ctors)) + KEEP (*crtbegin?.o(.ctors)) + /* We don't want to include the .ctor section from + from the crtend.o file until after the sorted ctors. + The .ctor section from the crtend file contains the + end of ctors marker and it must be last */ + KEEP (*(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*(.ctors)) + __CTOR_END__ = .; + } > m_text + + .dtors : + { + __DTOR_LIST__ = .; + KEEP (*crtbegin.o(.dtors)) + KEEP (*crtbegin?.o(.dtors)) + KEEP (*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*(.dtors)) + __DTOR_END__ = .; + } > m_text + + .preinit_array : + { + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP (*(.preinit_array*)) + PROVIDE_HIDDEN (__preinit_array_end = .); + } > m_text + + .init_array : + { + PROVIDE_HIDDEN (__init_array_start = .); + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array*)) + PROVIDE_HIDDEN (__init_array_end = .); + } > m_text + + .fini_array : + { + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP (*(SORT(.fini_array.*))) + KEEP (*(.fini_array*)) + PROVIDE_HIDDEN (__fini_array_end = .); + } > m_text + + __etext = .; /* define a global symbol at end of code */ + __DATA_ROM = .; /* Symbol is used by startup for data initialization */ + + .data : AT(__DATA_ROM) + { + . = ALIGN(4); + __DATA_RAM = .; + __data_start__ = .; /* create a global symbol at data start */ + *(m_usb_dma_init_data) + *(.data) /* .data sections */ + *(.data*) /* .data* sections */ + KEEP(*(.jcr*)) + . = ALIGN(4); + __data_end__ = .; /* define a global symbol at data end */ + } > m_data + + __NDATA_ROM = __DATA_ROM + (__data_end__ - __data_start__); + .ncache.init : AT(__NDATA_ROM) + { + __noncachedata_start__ = .; /* create a global symbol at ncache data start */ + *(NonCacheable.init) + . = ALIGN(4); + __noncachedata_init_end__ = .; /* create a global symbol at initialized ncache data end */ + } > m_data + . = __noncachedata_init_end__; + .ncache : + { + *(NonCacheable) + . = ALIGN(4); + __noncachedata_end__ = .; /* define a global symbol at ncache data end */ + } > m_data + + __DATA_END = __NDATA_ROM + (__noncachedata_init_end__ - __noncachedata_start__); + text_end = ORIGIN(m_text) + LENGTH(m_text); + ASSERT(__DATA_END <= text_end, "region m_text overflowed with text and data") + + /* Uninitialized data section */ + .bss : + { + /* This is used by the startup in order to initialize the .bss section */ + . = ALIGN(4); + __START_BSS = .; + __bss_start__ = .; + *(m_usb_dma_noninit_data) + *(.bss) + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + __END_BSS = .; + } > m_data + + .heap : + { + . = ALIGN(8); + __end__ = .; + PROVIDE(end = .); + __HeapBase = .; + . += HEAP_SIZE; + __HeapLimit = .; + __heap_limit = .; /* Add for _sbrk */ + } > m_data + + .stack : + { + . = ALIGN(8); + stack_start = .; + . += STACK_SIZE; + stack_end = .; + __StackTop = .; + } > m_data + + .RTT_HEAP : + { + heap_start = .; + . = ALIGN(8); + } > m_data + + PROVIDE(heap_end = ORIGIN(m_data) + LENGTH(m_data)); + + /* Initializes stack on the end of block */ + __StackLimit = __StackTop - STACK_SIZE; + PROVIDE(__stack = __StackTop); + + .ARM.attributes 0 : { *(.ARM.attributes) } + + ASSERT(__StackLimit >= __HeapLimit, "region m_data overflowed with stack and heap") +} + diff --git a/bsp/imxrt/imxrt1052-sc-internal/board/linker_scripts/link.sct b/bsp/imxrt/imxrt1052-sc-internal/board/linker_scripts/link.sct new file mode 100644 index 0000000000..f7ceb52456 --- /dev/null +++ b/bsp/imxrt/imxrt1052-sc-internal/board/linker_scripts/link.sct @@ -0,0 +1,92 @@ +#! armcc -E +/* +** ################################################################### +** Processors: MIMXRT1052CVJ5B +** MIMXRT1052CVL5B +** MIMXRT1052DVJ6B +** MIMXRT1052DVL6B +** +** Compiler: Keil ARM C/C++ Compiler +** Reference manual: IMXRT1050RM Rev.1, 03/2018 +** Version: rev. 1.0, 2018-09-21 +** Build: b180921 +** +** Abstract: +** Linker file for the Keil ARM C/C++ Compiler +** +** Copyright 2016 Freescale Semiconductor, Inc. +** Copyright 2016-2018 NXP +** All rights reserved. +** +** SPDX-License-Identifier: BSD-3-Clause +** +** http: www.nxp.com +** mail: support@nxp.com +** +** ################################################################### +*/ + +#define m_flash_config_start 0x60000000 +#define m_flash_config_size 0x00001000 + +#define m_ivt_start 0x60001000 +#define m_ivt_size 0x00001000 + +#define m_interrupts_start 0x60002000 +#define m_interrupts_size 0x00000400 + +#define m_text_start 0x60002400 +#define m_text_size 0x1fffdbff + +#define m_data_start 0x20000000 +#define m_data_size 0x00020000 + +#define m_data2_start 0x20200000 +#define m_data2_size 0x00040000 + +/* Sizes */ +#if (defined(__stack_size__)) + #define Stack_Size __stack_size__ +#else + #define Stack_Size 0x0400 +#endif + +#if (defined(__heap_size__)) + #define Heap_Size __heap_size__ +#else + #define Heap_Size 0x0400 +#endif + +#define RTT_HEAP_SIZE (m_data_size-ImageLength(RW_m_data)-ImageLength(ARM_LIB_HEAP)-ImageLength(ARM_LIB_STACK)) + +#if defined(XIP_BOOT_HEADER_ENABLE) && (XIP_BOOT_HEADER_ENABLE == 1) +LR_m_text m_flash_config_start m_text_start+m_text_size-m_flash_config_start { ; load region size_region + RW_m_config_text m_flash_config_start FIXED m_flash_config_size { ; load address = execution address + * (.boot_hdr.conf, +FIRST) + } + + RW_m_ivt_text m_ivt_start FIXED m_ivt_size { ; load address = execution address + * (.boot_hdr.ivt, +FIRST) + * (.boot_hdr.boot_data) + * (.boot_hdr.dcd_data) + } +#else +LR_m_text m_interrupts_start m_text_start+m_text_size-m_interrupts_start { ; load region size_region +#endif + VECTOR_ROM m_interrupts_start FIXED m_interrupts_size { ; load address = execution address + * (RESET,+FIRST) + } + ER_m_text m_text_start FIXED m_text_size { ; load address = execution address + * (InRoot$$Sections) + .ANY (+RO) + } + RW_m_data m_data_start m_data_size-Stack_Size-Heap_Size { ; RW data + .ANY (+RW +ZI) + * (NonCacheable.init) + * (NonCacheable) + } + ARM_LIB_HEAP +0 EMPTY Heap_Size { ; Heap region growing up + } + ARM_LIB_STACK +0 EMPTY Stack_Size{} ; Stack region growing down + RTT_HEAP +0 EMPTY RTT_HEAP_SIZE{} +} diff --git a/bsp/imxrt/imxrt1052-sc-internal/figures/board.png b/bsp/imxrt/imxrt1052-sc-internal/figures/board.png new file mode 100644 index 0000000000000000000000000000000000000000..91918bfd375500d0c7a3636cc6d4e9cfa87d89af GIT binary patch literal 153492 zcmZ^JXEc?1EScI}N5}&cKa6p(Q{0Ilr z^9c!F!(1LXeU|=+RWkfy2XhBYSzb-@{{H^eD|$voMgs!_CMKqPEOK@ZPHe~k3k%CF z7S{dkEw+pkww$|+j5G}m4feMTUOpi@Iv}=5KDJfa+js2mKM2aoDUgwoNz2HKh)HN@ zYJtFDAz=^?AD^U@G`4Os7Hk*m#|$SIAGUTJmd_aWmnf{z4Xnt0aS3UxpG(+kArcZ2 z*iOw{TwK`Z#c~SDSmE2)O5d?Heqq~I3xg!E-FvX@>mNUU?BeFGq^yV)ytcf&fUW$4 zm6grd#26bogzeg?uKxM$TULP&!sb?%msi)eb`IDIP)!}ZpP?c0N@`2sXP8HI+qQb+tQ_g<=yE&8(fbwm1ELMqQtumDjbUW)&PwMmN;g)P%fT zYH@nSz?xN1SX^0yW1O8+SlQ81m6eloGM|nx~Y8EJF%Go{C zw|uc~6e%U6@x#v}zpOPH79cJDzPTzbEGC*IU??T4Qbd4lH21x>l8~2&{rKEkT4K=3 zOfxnVvECvpR=6>EJk93V;_IxP_{)ibg|#X-@V>V8xP8if;P5^?{Fae%aUd};EIBFY zOR%36yJ1>)SBb-U<$S6BGt39b6C_uf6!=2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WfaoZY`EmWRCC6x}nW*J4kzxrWf=?EU$e9stMER~|A$dJ9u3oHviFf~HSAc?@d`iiRDEVBobX%L0f1R1CPH!Jug)ZfDq_T)?4U z`(6r~UGyu5WK!LS%Mi$)=uLk4Uj!FU+d5z>jLW#kqvRcZh_M*ynd#Q+INbXW+j83` literal 0 HcmV?d00001 diff --git a/bsp/imxrt/imxrt1052-sc-internal/project.ewd b/bsp/imxrt/imxrt1052-sc-internal/project.ewd new file mode 100644 index 0000000000..55328e709c --- /dev/null +++ b/bsp/imxrt/imxrt1052-sc-internal/project.ewd @@ -0,0 +1,1485 @@ + + + 3 + + rtthread + + ARM + + 1 + + C-SPY + 2 + + 30 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 1 + 1 + 1 + + + + + + + + CADI_ID + 2 + + 0 + 1 + 1 + + + + + + + + + CMSISDAP_ID + 2 + + 4 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + GDBSERVER_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + IJET_ID + 2 + + 8 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + JLINK_ID + 2 + + 16 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 2 + 1 + 1 + + + + + + + + + + NULINK_ID + 2 + + 0 + 1 + 1 + + + + + + + PEMICRO_ID + 2 + + 3 + 1 + 1 + + + + + + + + STLINK_ID + 2 + + 6 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 1 + + + + + + + + TIFET_ID + 2 + + 1 + 1 + 1 + + + + + + + + + + + + + + + + + + + XDS100_ID + 2 + + 8 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\FreeRtos\FreeRtosArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\HWRTOSplugin\HWRTOSplugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\Mbed\MbedArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\Mbed\MbedArmPlugin2.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\SMX\smxAwareIarArm8.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\SMX\smxAwareIarArm8BE.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin + 0 + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\TargetAccessServer\TargetAccessServer.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin + 0 + + + + diff --git a/bsp/imxrt/imxrt1052-sc-internal/project.ewp b/bsp/imxrt/imxrt1052-sc-internal/project.ewp new file mode 100644 index 0000000000..f5a716af31 --- /dev/null +++ b/bsp/imxrt/imxrt1052-sc-internal/project.ewp @@ -0,0 +1,1274 @@ + + 3 + + rtthread + + ARM + + 1 + + General + 3 + + 31 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 35 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 10 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OBJCOPY + 0 + + 1 + 1 + 1 + + + + + + + + + CUSTOM + 3 + + + + 0 + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + + + + + + ILINK + 0 + + 22 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IARCHIVE + 0 + + 0 + 1 + 1 + + + + + + + BILINK + 0 + + + + + Kernel + + $PROJ_DIR$\..\..\..\src\clock.c + + + $PROJ_DIR$\..\..\..\src\components.c + + + $PROJ_DIR$\..\..\..\src\cpu.c + + + $PROJ_DIR$\..\..\..\src\device.c + + + $PROJ_DIR$\..\..\..\src\idle.c + + + $PROJ_DIR$\..\..\..\src\ipc.c + + + $PROJ_DIR$\..\..\..\src\irq.c + + + $PROJ_DIR$\..\..\..\src\kservice.c + + + $PROJ_DIR$\..\..\..\src\memheap.c + + + $PROJ_DIR$\..\..\..\src\mempool.c + + + $PROJ_DIR$\..\..\..\src\object.c + + + $PROJ_DIR$\..\..\..\src\scheduler.c + + + $PROJ_DIR$\..\..\..\src\signal.c + + + $PROJ_DIR$\..\..\..\src\thread.c + + + $PROJ_DIR$\..\..\..\src\timer.c + + + + Applications + + $PROJ_DIR$\applications\main.c + + + + Drivers + + $PROJ_DIR$\board\board.c + + + $PROJ_DIR$\board\MCUX_Config\clock_config.c + + + $PROJ_DIR$\board\MCUX_Config\pin_mux.c + + + $PROJ_DIR$\..\Libraries\drivers\drv_gpio.c + + + $PROJ_DIR$\..\Libraries\drivers\drv_uart.c + + + + cpu + + $PROJ_DIR$\..\..\..\libcpu\arm\common\backtrace.c + + + $PROJ_DIR$\..\..\..\libcpu\arm\common\div0.c + + + $PROJ_DIR$\..\..\..\libcpu\arm\common\showmem.c + + + $PROJ_DIR$\..\..\..\libcpu\arm\cortex-m7\cpuport.c + + + $PROJ_DIR$\..\..\..\libcpu\arm\cortex-m7\context_iar.S + + + + DeviceDrivers + + $PROJ_DIR$\..\..\..\components\drivers\cputime\cputime.c + + + $PROJ_DIR$\..\..\..\components\drivers\misc\pin.c + + + $PROJ_DIR$\..\..\..\components\drivers\serial\serial.c + + + $PROJ_DIR$\..\..\..\components\drivers\src\completion.c + + + $PROJ_DIR$\..\..\..\components\drivers\src\dataqueue.c + + + $PROJ_DIR$\..\..\..\components\drivers\src\pipe.c + + + $PROJ_DIR$\..\..\..\components\drivers\src\ringblk_buf.c + + + $PROJ_DIR$\..\..\..\components\drivers\src\ringbuffer.c + + + $PROJ_DIR$\..\..\..\components\drivers\src\waitqueue.c + + + $PROJ_DIR$\..\..\..\components\drivers\src\workqueue.c + + + + finsh + + $PROJ_DIR$\..\..\..\components\finsh\shell.c + + + $PROJ_DIR$\..\..\..\components\finsh\symbol.c + + + $PROJ_DIR$\..\..\..\components\finsh\cmd.c + + + $PROJ_DIR$\..\..\..\components\finsh\msh.c + + + $PROJ_DIR$\..\..\..\components\finsh\msh_cmd.c + + + $PROJ_DIR$\..\..\..\components\finsh\msh_file.c + + + + libc + + $PROJ_DIR$\..\..\..\components\libc\compilers\common\gmtime_r.c + + + + dlib + + $PROJ_DIR$\..\..\..\components\libc\compilers\dlib\environ.c + + + $PROJ_DIR$\..\..\..\components\libc\compilers\dlib\libc.c + + + $PROJ_DIR$\..\..\..\components\libc\compilers\dlib\rmtx.c + + + $PROJ_DIR$\..\..\..\components\libc\compilers\dlib\stdio.c + + + $PROJ_DIR$\..\..\..\components\libc\compilers\dlib\syscall_close.c + + + $PROJ_DIR$\..\..\..\components\libc\compilers\dlib\syscall_lseek.c + + + $PROJ_DIR$\..\..\..\components\libc\compilers\dlib\syscall_mem.c + + + $PROJ_DIR$\..\..\..\components\libc\compilers\dlib\syscall_open.c + + + $PROJ_DIR$\..\..\..\components\libc\compilers\dlib\syscall_read.c + + + $PROJ_DIR$\..\..\..\components\libc\compilers\dlib\syscall_remove.c + + + $PROJ_DIR$\..\..\..\components\libc\compilers\dlib\syscall_write.c + + + $PROJ_DIR$\..\..\..\components\libc\compilers\dlib\time.c + + + + Libraries + + $PROJ_DIR$\..\Libraries\MIMXRT1050\MIMXRT1052\system_MIMXRT1052.c + + + $PROJ_DIR$\..\Libraries\MIMXRT1050\MIMXRT1052\drivers\fsl_common.c + + + $PROJ_DIR$\..\Libraries\MIMXRT1050\MIMXRT1052\drivers\fsl_clock.c + + + $PROJ_DIR$\..\Libraries\MIMXRT1050\MIMXRT1052\drivers\fsl_cache.c + + + $PROJ_DIR$\..\Libraries\MIMXRT1050\MIMXRT1052\iar\startup_MIMXRT1052.s + + + $PROJ_DIR$\..\Libraries\MIMXRT1050\MIMXRT1052\drivers\fsl_gpio.c + + + $PROJ_DIR$\..\Libraries\MIMXRT1050\MIMXRT1052\drivers\fsl_lpuart.c + + + diff --git a/bsp/imxrt/imxrt1052-sc-internal/project.eww b/bsp/imxrt/imxrt1052-sc-internal/project.eww new file mode 100644 index 0000000000..c2cb02eb1e --- /dev/null +++ b/bsp/imxrt/imxrt1052-sc-internal/project.eww @@ -0,0 +1,10 @@ + + + + + $WS_DIR$\project.ewp + + + + + diff --git a/bsp/imxrt/imxrt1052-sc-internal/project.uvoptx b/bsp/imxrt/imxrt1052-sc-internal/project.uvoptx new file mode 100644 index 0000000000..c1f392aa34 --- /dev/null +++ b/bsp/imxrt/imxrt1052-sc-internal/project.uvoptx @@ -0,0 +1,930 @@ + + + + 1.0 + +
    ### uVision Project, (C) Keil Software
    + + + *.c + *.s*; *.src; *.a* + *.obj; *.o + *.lib + *.txt; *.h; *.inc + *.plm + *.cpp + 0 + + + + 0 + 0 + + + + rtthread + 0x4 + ARM-ADS + + 12000000 + + 1 + 1 + 0 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\build\keil\List\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 8 + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 1 + 0 + 0 + 3 + + + + + + + + + + .\flexspi_nor.ini + BIN\CMSIS_AGDI.dll + + + + 0 + JL2CM3 + -U30000299 -O78 -S2 -ZTIFSpeedSel5000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST1 -N00("ARM CoreSight SW-DP") -D00(0BD11477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8001 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO15 -FD20000000 -FCF000 -FN1 -FF0MIMXRT105x_QuadSPI_4KB_SEC -FS060000000 -FL0800000 + + + 0 + CMSIS_AGDI + -X"Fire CMSIS-DAP" -UFS-00007888 -O974 -S0 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(0BD11477) -L00(0) -TO18 -TC10000000 -TP20 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20000000 -FCF000 -FN1 -FF0iMXRT1052_W25Q256JV_CFG_By_Fire -FS060000000 -FL02000000 + + + 0 + UL2CM3 + UL2CM3(-S0 -C0 -P0 -FD20000000 -FCF000 -FN1 -FF0MIMXRT105x_HYPER_256KB_SEC -FS060000000 -FL04000000 -FP0($$Device:MIMXRT1052$Flash\MIMXRT105x_HYPER_256KB_SEC.FLM)) + + + + + 0 + + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + 0 + 0 + 0 + + + + + + + + + + + + + Kernel + 0 + 0 + 0 + 0 + + 1 + 1 + 1 + 0 + 0 + 0 + ..\..\..\src\clock.c + clock.c + 0 + 0 + + + 1 + 2 + 1 + 0 + 0 + 0 + ..\..\..\src\components.c + components.c + 0 + 0 + + + 1 + 3 + 1 + 0 + 0 + 0 + ..\..\..\src\cpu.c + cpu.c + 0 + 0 + + + 1 + 4 + 1 + 0 + 0 + 0 + ..\..\..\src\device.c + device.c + 0 + 0 + + + 1 + 5 + 1 + 0 + 0 + 0 + ..\..\..\src\idle.c + idle.c + 0 + 0 + + + 1 + 6 + 1 + 0 + 0 + 0 + ..\..\..\src\ipc.c + ipc.c + 0 + 0 + + + 1 + 7 + 1 + 0 + 0 + 0 + ..\..\..\src\irq.c + irq.c + 0 + 0 + + + 1 + 8 + 1 + 0 + 0 + 0 + ..\..\..\src\kservice.c + kservice.c + 0 + 0 + + + 1 + 9 + 1 + 0 + 0 + 0 + ..\..\..\src\memheap.c + memheap.c + 0 + 0 + + + 1 + 10 + 1 + 0 + 0 + 0 + ..\..\..\src\mempool.c + mempool.c + 0 + 0 + + + 1 + 11 + 1 + 0 + 0 + 0 + ..\..\..\src\object.c + object.c + 0 + 0 + + + 1 + 12 + 1 + 0 + 0 + 0 + ..\..\..\src\scheduler.c + scheduler.c + 0 + 0 + + + 1 + 13 + 1 + 0 + 0 + 0 + ..\..\..\src\signal.c + signal.c + 0 + 0 + + + 1 + 14 + 1 + 0 + 0 + 0 + ..\..\..\src\thread.c + thread.c + 0 + 0 + + + 1 + 15 + 1 + 0 + 0 + 0 + ..\..\..\src\timer.c + timer.c + 0 + 0 + + + + + Applications + 0 + 0 + 0 + 0 + + 2 + 16 + 1 + 0 + 0 + 0 + applications\main.c + main.c + 0 + 0 + + + + + Drivers + 0 + 0 + 0 + 0 + + 3 + 17 + 1 + 0 + 0 + 0 + board\board.c + board.c + 0 + 0 + + + 3 + 18 + 1 + 0 + 0 + 0 + board\MCUX_Config\clock_config.c + clock_config.c + 0 + 0 + + + 3 + 19 + 1 + 0 + 0 + 0 + board\MCUX_Config\pin_mux.c + pin_mux.c + 0 + 0 + + + 3 + 20 + 1 + 0 + 0 + 0 + ..\Libraries\drivers\drv_gpio.c + drv_gpio.c + 0 + 0 + + + 3 + 21 + 1 + 0 + 0 + 0 + ..\Libraries\drivers\drv_uart.c + drv_uart.c + 0 + 0 + + + + + cpu + 0 + 0 + 0 + 0 + + 4 + 22 + 1 + 0 + 0 + 0 + ..\..\..\libcpu\arm\common\backtrace.c + backtrace.c + 0 + 0 + + + 4 + 23 + 1 + 0 + 0 + 0 + ..\..\..\libcpu\arm\common\div0.c + div0.c + 0 + 0 + + + 4 + 24 + 1 + 0 + 0 + 0 + ..\..\..\libcpu\arm\common\showmem.c + showmem.c + 0 + 0 + + + 4 + 25 + 1 + 0 + 0 + 0 + ..\..\..\libcpu\arm\cortex-m7\cpuport.c + cpuport.c + 0 + 0 + + + 4 + 26 + 2 + 0 + 0 + 0 + ..\..\..\libcpu\arm\cortex-m7\context_rvds.S + context_rvds.S + 0 + 0 + + + + + DeviceDrivers + 0 + 0 + 0 + 0 + + 5 + 27 + 1 + 0 + 0 + 0 + ..\..\..\components\drivers\cputime\cputime.c + cputime.c + 0 + 0 + + + 5 + 28 + 1 + 0 + 0 + 0 + ..\..\..\components\drivers\misc\pin.c + pin.c + 0 + 0 + + + 5 + 29 + 1 + 0 + 0 + 0 + ..\..\..\components\drivers\serial\serial.c + serial.c + 0 + 0 + + + 5 + 30 + 1 + 0 + 0 + 0 + ..\..\..\components\drivers\src\completion.c + completion.c + 0 + 0 + + + 5 + 31 + 1 + 0 + 0 + 0 + ..\..\..\components\drivers\src\dataqueue.c + dataqueue.c + 0 + 0 + + + 5 + 32 + 1 + 0 + 0 + 0 + ..\..\..\components\drivers\src\pipe.c + pipe.c + 0 + 0 + + + 5 + 33 + 1 + 0 + 0 + 0 + ..\..\..\components\drivers\src\ringblk_buf.c + ringblk_buf.c + 0 + 0 + + + 5 + 34 + 1 + 0 + 0 + 0 + ..\..\..\components\drivers\src\ringbuffer.c + ringbuffer.c + 0 + 0 + + + 5 + 35 + 1 + 0 + 0 + 0 + ..\..\..\components\drivers\src\waitqueue.c + waitqueue.c + 0 + 0 + + + 5 + 36 + 1 + 0 + 0 + 0 + ..\..\..\components\drivers\src\workqueue.c + workqueue.c + 0 + 0 + + + + + finsh + 0 + 0 + 0 + 0 + + 6 + 37 + 1 + 0 + 0 + 0 + ..\..\..\components\finsh\shell.c + shell.c + 0 + 0 + + + 6 + 38 + 1 + 0 + 0 + 0 + ..\..\..\components\finsh\symbol.c + symbol.c + 0 + 0 + + + 6 + 39 + 1 + 0 + 0 + 0 + ..\..\..\components\finsh\cmd.c + cmd.c + 0 + 0 + + + 6 + 40 + 1 + 0 + 0 + 0 + ..\..\..\components\finsh\msh.c + msh.c + 0 + 0 + + + 6 + 41 + 1 + 0 + 0 + 0 + ..\..\..\components\finsh\msh_cmd.c + msh_cmd.c + 0 + 0 + + + 6 + 42 + 1 + 0 + 0 + 0 + ..\..\..\components\finsh\msh_file.c + msh_file.c + 0 + 0 + + + + + libc + 0 + 0 + 0 + 0 + + 7 + 43 + 1 + 0 + 0 + 0 + ..\..\..\components\libc\compilers\armlibc\libc.c + libc.c + 0 + 0 + + + 7 + 44 + 1 + 0 + 0 + 0 + ..\..\..\components\libc\compilers\armlibc\mem_std.c + mem_std.c + 0 + 0 + + + 7 + 45 + 1 + 0 + 0 + 0 + ..\..\..\components\libc\compilers\armlibc\stubs.c + stubs.c + 0 + 0 + + + 7 + 46 + 1 + 0 + 0 + 0 + ..\..\..\components\libc\compilers\armlibc\time.c + time.c + 0 + 0 + + + 7 + 47 + 1 + 0 + 0 + 0 + ..\..\..\components\libc\compilers\common\gmtime_r.c + gmtime_r.c + 0 + 0 + + + + + Libraries + 0 + 0 + 0 + 0 + + 8 + 48 + 1 + 0 + 0 + 0 + ..\Libraries\MIMXRT1050\MIMXRT1052\system_MIMXRT1052.c + system_MIMXRT1052.c + 0 + 0 + + + 8 + 49 + 1 + 0 + 0 + 0 + ..\Libraries\MIMXRT1050\MIMXRT1052\drivers\fsl_common.c + fsl_common.c + 0 + 0 + + + 8 + 50 + 1 + 0 + 0 + 0 + ..\Libraries\MIMXRT1050\MIMXRT1052\drivers\fsl_clock.c + fsl_clock.c + 0 + 0 + + + 8 + 51 + 1 + 0 + 0 + 0 + ..\Libraries\MIMXRT1050\MIMXRT1052\drivers\fsl_cache.c + fsl_cache.c + 0 + 0 + + + 8 + 52 + 2 + 0 + 0 + 0 + ..\Libraries\MIMXRT1050\MIMXRT1052\arm\startup_MIMXRT1052.s + startup_MIMXRT1052.s + 0 + 0 + + + 8 + 53 + 1 + 0 + 0 + 0 + ..\Libraries\MIMXRT1050\MIMXRT1052\drivers\fsl_gpio.c + fsl_gpio.c + 0 + 0 + + + 8 + 54 + 1 + 0 + 0 + 0 + ..\Libraries\MIMXRT1050\MIMXRT1052\drivers\fsl_lpuart.c + fsl_lpuart.c + 0 + 0 + + + 8 + 55 + 1 + 0 + 0 + 0 + ..\Libraries\MIMXRT1050\MIMXRT1052\drivers\fsl_dmamux.c + fsl_dmamux.c + 0 + 0 + + + 8 + 56 + 1 + 0 + 0 + 0 + ..\Libraries\MIMXRT1050\MIMXRT1052\drivers\fsl_edma.c + fsl_edma.c + 0 + 0 + + + 8 + 57 + 1 + 0 + 0 + 0 + ..\Libraries\MIMXRT1050\MIMXRT1052\drivers\fsl_lpuart_edma.c + fsl_lpuart_edma.c + 0 + 0 + + + +
    diff --git a/bsp/imxrt/imxrt1052-sc-internal/project.uvprojx b/bsp/imxrt/imxrt1052-sc-internal/project.uvprojx new file mode 100644 index 0000000000..e15669351d --- /dev/null +++ b/bsp/imxrt/imxrt1052-sc-internal/project.uvprojx @@ -0,0 +1,724 @@ + + + + 2.1 + +
    ### uVision Project, (C) Keil Software
    + + + + rtthread + 0x4 + ARM-ADS + 5060750::V5.06 update 6 (build 750)::ARMCC + 0 + + + MIMXRT1052:M7 + NXP + NXP.iMXRT_DFP.1.0.3 + http://mcuxpresso.nxp.com/cmsis_pack/repo/ + IRAM(0x20000000,0x00060000) IRAM2(0x00000000,0x00020000) CPUTYPE("Cortex-M7") FPU3(SFPU) CLOCK(12000000) ELITTLE + + + UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0RT1050 -FS060000000 -FL04000000 -FP0($$Device:MIMXRT1052$Flash\RT1050.FLM)) + 0 + $$Device:MIMXRT1052$Device\Include\MIMXRT1052.h + + + + + + + + + + $$Device:MIMXRT1052$SVD\MIMXRT1052.svd + 0 + 0 + + + + + + + 0 + 0 + 0 + 0 + 1 + + .\build\keil\Obj\ + rtthread + 1 + 0 + 0 + 1 + 1 + .\build\keil\List\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 1 + 0 + fromelf --bin !L --output rtthread.bin + + 0 + 0 + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + + SARMCM3.DLL + -REMAP -MPU + DCM.DLL + -pCM7 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM7 + + + + 1 + 0 + 0 + 0 + 16 + + + + + 1 + 0 + 0 + 1 + 1 + 4099 + + 1 + BIN\CMSIS_AGDI.dll + "" () + + + + + 0 + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + "Cortex-M7" + + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 2 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x60000 + + + 1 + 0x0 + 0x8000 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x60000 + + + 0 + 0x0 + 0x20000 + + + + + + 1 + 3 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + + --library_interface=armcc --library_type=standardlib --diag_suppress=66,1296,186 + SKIP_SYSCLK_INIT, XIP_EXTERNAL_FLASH, CPU_MIMXRT1052CVL5B, FSL_SDK_ENABLE_DRIVER_CACHE_CONTROL, EVK_MCIMXRM, RT_USING_ARM_LIBC + + .;..\..\..\include;applications;board;board\MCUX_Config;board\ports;..\Libraries\drivers;..\Libraries\drivers\config;..\..\..\libcpu\arm\common;..\..\..\libcpu\arm\cortex-m7;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\..\..\components\finsh;..\..\..\components\libc\compilers\armlibc;..\..\..\components\libc\compilers\common;..\Libraries\MIMXRT1050\CMSIS\Include;..\Libraries\MIMXRT1050\MIMXRT1052;..\Libraries\MIMXRT1050\MIMXRT1052\drivers + + + + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x10000000 + + .\board\linker_scripts\link.sct + + + + + + + + + + + Kernel + + + clock.c + 1 + ..\..\..\src\clock.c + + + components.c + 1 + ..\..\..\src\components.c + + + cpu.c + 1 + ..\..\..\src\cpu.c + + + device.c + 1 + ..\..\..\src\device.c + + + idle.c + 1 + ..\..\..\src\idle.c + + + ipc.c + 1 + ..\..\..\src\ipc.c + + + irq.c + 1 + ..\..\..\src\irq.c + + + kservice.c + 1 + ..\..\..\src\kservice.c + + + memheap.c + 1 + ..\..\..\src\memheap.c + + + mempool.c + 1 + ..\..\..\src\mempool.c + + + object.c + 1 + ..\..\..\src\object.c + + + scheduler.c + 1 + ..\..\..\src\scheduler.c + + + signal.c + 1 + ..\..\..\src\signal.c + + + thread.c + 1 + ..\..\..\src\thread.c + + + timer.c + 1 + ..\..\..\src\timer.c + + + + + Applications + + + main.c + 1 + applications\main.c + + + + + Drivers + + + board.c + 1 + board\board.c + + + clock_config.c + 1 + board\MCUX_Config\clock_config.c + + + pin_mux.c + 1 + board\MCUX_Config\pin_mux.c + + + drv_gpio.c + 1 + ..\Libraries\drivers\drv_gpio.c + + + drv_uart.c + 1 + ..\Libraries\drivers\drv_uart.c + + + + + cpu + + + backtrace.c + 1 + ..\..\..\libcpu\arm\common\backtrace.c + + + div0.c + 1 + ..\..\..\libcpu\arm\common\div0.c + + + showmem.c + 1 + ..\..\..\libcpu\arm\common\showmem.c + + + cpuport.c + 1 + ..\..\..\libcpu\arm\cortex-m7\cpuport.c + + + context_rvds.S + 2 + ..\..\..\libcpu\arm\cortex-m7\context_rvds.S + + + + + DeviceDrivers + + + cputime.c + 1 + ..\..\..\components\drivers\cputime\cputime.c + + + pin.c + 1 + ..\..\..\components\drivers\misc\pin.c + + + serial.c + 1 + ..\..\..\components\drivers\serial\serial.c + + + completion.c + 1 + ..\..\..\components\drivers\src\completion.c + + + dataqueue.c + 1 + ..\..\..\components\drivers\src\dataqueue.c + + + pipe.c + 1 + ..\..\..\components\drivers\src\pipe.c + + + ringblk_buf.c + 1 + ..\..\..\components\drivers\src\ringblk_buf.c + + + ringbuffer.c + 1 + ..\..\..\components\drivers\src\ringbuffer.c + + + waitqueue.c + 1 + ..\..\..\components\drivers\src\waitqueue.c + + + workqueue.c + 1 + ..\..\..\components\drivers\src\workqueue.c + + + + + finsh + + + shell.c + 1 + ..\..\..\components\finsh\shell.c + + + symbol.c + 1 + ..\..\..\components\finsh\symbol.c + + + cmd.c + 1 + ..\..\..\components\finsh\cmd.c + + + msh.c + 1 + ..\..\..\components\finsh\msh.c + + + msh_cmd.c + 1 + ..\..\..\components\finsh\msh_cmd.c + + + msh_file.c + 1 + ..\..\..\components\finsh\msh_file.c + + + + + libc + + + libc.c + 1 + ..\..\..\components\libc\compilers\armlibc\libc.c + + + mem_std.c + 1 + ..\..\..\components\libc\compilers\armlibc\mem_std.c + + + stubs.c + 1 + ..\..\..\components\libc\compilers\armlibc\stubs.c + + + time.c + 1 + ..\..\..\components\libc\compilers\armlibc\time.c + + + gmtime_r.c + 1 + ..\..\..\components\libc\compilers\common\gmtime_r.c + + + + + Libraries + + + system_MIMXRT1052.c + 1 + ..\Libraries\MIMXRT1050\MIMXRT1052\system_MIMXRT1052.c + + + fsl_common.c + 1 + ..\Libraries\MIMXRT1050\MIMXRT1052\drivers\fsl_common.c + + + fsl_clock.c + 1 + ..\Libraries\MIMXRT1050\MIMXRT1052\drivers\fsl_clock.c + + + fsl_cache.c + 1 + ..\Libraries\MIMXRT1050\MIMXRT1052\drivers\fsl_cache.c + + + startup_MIMXRT1052.s + 2 + ..\Libraries\MIMXRT1050\MIMXRT1052\arm\startup_MIMXRT1052.s + + + fsl_gpio.c + 1 + ..\Libraries\MIMXRT1050\MIMXRT1052\drivers\fsl_gpio.c + + + fsl_lpuart.c + 1 + ..\Libraries\MIMXRT1050\MIMXRT1052\drivers\fsl_lpuart.c + + + fsl_dmamux.c + 1 + ..\Libraries\MIMXRT1050\MIMXRT1052\drivers\fsl_dmamux.c + + + fsl_edma.c + 1 + ..\Libraries\MIMXRT1050\MIMXRT1052\drivers\fsl_edma.c + + + fsl_lpuart_edma.c + 1 + ..\Libraries\MIMXRT1050\MIMXRT1052\drivers\fsl_lpuart_edma.c + + + + + + + + + + + + + + + + + + + + +
    diff --git a/bsp/imxrt/imxrt1052-sc-internal/rtconfig.h b/bsp/imxrt/imxrt1052-sc-internal/rtconfig.h new file mode 100644 index 0000000000..4d57ddbebc --- /dev/null +++ b/bsp/imxrt/imxrt1052-sc-internal/rtconfig.h @@ -0,0 +1,184 @@ +#ifndef RT_CONFIG_H__ +#define RT_CONFIG_H__ + +/* Automatically generated file; DO NOT EDIT. */ +/* RT-Thread Configuration */ + +/* RT-Thread Kernel */ + +#define RT_NAME_MAX 8 +#define RT_ALIGN_SIZE 4 +#define RT_THREAD_PRIORITY_32 +#define RT_THREAD_PRIORITY_MAX 32 +#define RT_TICK_PER_SECOND 100 +#define RT_USING_OVERFLOW_CHECK +#define RT_USING_HOOK +#define RT_USING_IDLE_HOOK +#define RT_IDLE_HOOK_LIST_SIZE 4 +#define IDLE_THREAD_STACK_SIZE 256 +#define RT_DEBUG +#define RT_DEBUG_COLOR + +/* Inter-Thread communication */ + +#define RT_USING_SEMAPHORE +#define RT_USING_MUTEX +#define RT_USING_EVENT +#define RT_USING_MAILBOX +#define RT_USING_MESSAGEQUEUE + +/* Memory Management */ + +#define RT_USING_MEMPOOL +#define RT_USING_MEMHEAP +#define RT_USING_MEMHEAP_AS_HEAP +#define RT_USING_HEAP + +/* Kernel Device Object */ + +#define RT_USING_DEVICE +#define RT_USING_CONSOLE +#define RT_CONSOLEBUF_SIZE 128 +#define RT_CONSOLE_DEVICE_NAME "uart1" +#define RT_VER_NUM 0x40003 + +/* RT-Thread Components */ + +#define RT_USING_COMPONENTS_INIT +#define RT_USING_USER_MAIN +#define RT_MAIN_THREAD_STACK_SIZE 2048 +#define RT_MAIN_THREAD_PRIORITY 10 + +/* C++ features */ + + +/* Command shell */ + +#define RT_USING_FINSH +#define FINSH_THREAD_NAME "tshell" +#define FINSH_USING_HISTORY +#define FINSH_HISTORY_LINES 5 +#define FINSH_USING_SYMTAB +#define FINSH_USING_DESCRIPTION +#define FINSH_THREAD_PRIORITY 20 +#define FINSH_THREAD_STACK_SIZE 4096 +#define FINSH_CMD_SIZE 80 +#define FINSH_USING_MSH +#define FINSH_USING_MSH_DEFAULT +#define FINSH_USING_MSH_ONLY +#define FINSH_ARG_MAX 10 + +/* Device virtual file system */ + +#define RT_USING_DFS +#define DFS_USING_WORKDIR +#define DFS_FILESYSTEMS_MAX 2 +#define DFS_FILESYSTEM_TYPES_MAX 2 +#define DFS_FD_MAX 16 +#define RT_USING_DFS_DEVFS + +/* Device Drivers */ + +#define RT_USING_DEVICE_IPC +#define RT_PIPE_BUFSZ 512 +#define RT_USING_SERIAL +#define RT_SERIAL_USING_DMA +#define RT_SERIAL_RB_BUFSZ 64 +#define RT_USING_CPUTIME +#define RT_USING_PIN +#define RT_USING_PULSE_ENCODER + +/* Using USB */ + +#define RT_USING_USB_HOST +#define RT_USBH_MSTORAGE +#define UDISK_MOUNTPOINT "/" +#define RT_USBD_THREAD_STACK_SZ 4096 + +/* POSIX layer and C standard library */ + +#define RT_USING_LIBC +#define RT_USING_POSIX + +/* Network */ + +/* Socket abstraction layer */ + + +/* Network interface device */ + + +/* light weight TCP/IP stack */ + + +/* AT commands */ + + +/* VBUS(Virtual Software BUS) */ + + +/* Utilities */ + + +/* RT-Thread online packages */ + +/* IoT - internet of things */ + + +/* Wi-Fi */ + +/* Marvell WiFi */ + + +/* Wiced WiFi */ + + +/* IoT Cloud */ + + +/* security packages */ + + +/* language packages */ + + +/* multimedia packages */ + + +/* tools packages */ + + +/* system packages */ + + +/* peripheral libraries and drivers */ + + +/* miscellaneous packages */ + + +/* samples: kernel and components samples */ + + +/* Hardware Drivers Config */ + +#define SOC_IMXRT1052CVL5B + +/* On-chip Peripheral Drivers */ + +#define BSP_USING_GPIO +#define BSP_USING_LPUART +#define BSP_USING_LPUART1 +#define BSP_USING_PULSE_ENCODER +#define BSP_USING_PULSE_ENCODER1 +#define BSP_USING_USB +#define BSP_USING_USB0 +#define BSP_USB0_HOST + +/* Onboard Peripheral Drivers */ + + +/* Board extended module Drivers */ + + +#endif diff --git a/bsp/imxrt/imxrt1052-sc-internal/rtconfig.py b/bsp/imxrt/imxrt1052-sc-internal/rtconfig.py new file mode 100644 index 0000000000..78851a42f7 --- /dev/null +++ b/bsp/imxrt/imxrt1052-sc-internal/rtconfig.py @@ -0,0 +1,160 @@ +import os +import sys + +# toolchains options +ARCH='arm' +CPU='cortex-m7' +CROSS_TOOL='gcc' + +# bsp lib config +BSP_LIBRARY_TYPE = None + +if os.getenv('RTT_CC'): + CROSS_TOOL = os.getenv('RTT_CC') +if os.getenv('RTT_ROOT'): + RTT_ROOT = os.getenv('RTT_ROOT') + +# cross_tool provides the cross compiler +# EXEC_PATH is the compiler execute path, for example, CodeSourcery, Keil MDK, IAR +if CROSS_TOOL == 'gcc': + PLATFORM = 'gcc' + EXEC_PATH = r'C:\Users\XXYYZZ' +elif CROSS_TOOL == 'keil': + PLATFORM = 'armcc' + EXEC_PATH = r'C:/Keil_v5' +elif CROSS_TOOL == 'iar': + PLATFORM = 'iar' + EXEC_PATH = r'C:/Program Files (x86)/IAR Systems/Embedded Workbench 8.0' + +if os.getenv('RTT_EXEC_PATH'): + EXEC_PATH = os.getenv('RTT_EXEC_PATH') + +BUILD = 'debug' +#BUILD = 'release' + +if PLATFORM == 'gcc': + PREFIX = 'arm-none-eabi-' + CC = PREFIX + 'gcc' + CXX = PREFIX + 'g++' + AS = PREFIX + 'gcc' + AR = PREFIX + 'ar' + LINK = PREFIX + 'gcc' + TARGET_EXT = 'elf' + SIZE = PREFIX + 'size' + OBJDUMP = PREFIX + 'objdump' + OBJCPY = PREFIX + 'objcopy' + STRIP = PREFIX + 'strip' + + DEVICE = ' -mcpu=' + CPU + ' -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections' + CFLAGS = DEVICE + ' -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.map,-cref,-u,Reset_Handler -T board/linker_scripts/link.lds' + + CPATH = '' + LPATH = '' + + if BUILD == 'debug': + CFLAGS += ' -gdwarf-2' + AFLAGS += ' -gdwarf-2' + CFLAGS += ' -O0' + else: + CFLAGS += ' -O2 -Os' + + POST_ACTION = OBJCPY + ' -O binary --remove-section=.boot_data --remove-section=.image_vertor_table --remove-section=.ncache $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n' + + # module setting + CXXFLAGS = ' -Woverloaded-virtual -fno-exceptions -fno-rtti ' + M_CFLAGS = CFLAGS + ' -mlong-calls -fPIC ' + M_CXXFLAGS = CXXFLAGS + ' -mlong-calls -fPIC' + M_LFLAGS = DEVICE + CXXFLAGS + ' -Wl,--gc-sections,-z,max-page-size=0x4' +\ + ' -shared -fPIC -nostartfiles -static-libgcc' + M_POST_ACTION = STRIP + ' -R .hash $TARGET\n' + SIZE + ' $TARGET \n' + +elif PLATFORM == 'armcc': + CC = 'armcc' + CXX = 'armcc' + AS = 'armasm' + AR = 'armar' + LINK = 'armlink' + TARGET_EXT = 'axf' + + DEVICE = ' --cpu ' + CPU + '.fp.sp' + CFLAGS = DEVICE + ' --apcs=interwork' + AFLAGS = DEVICE + LFLAGS = DEVICE + ' --libpath "' + EXEC_PATH + '\ARM\ARMCC\lib" --info sizes --info totals --info unused --info veneers --list rtthread.map --scatter "board\linker_scripts\link.sct"' + + CFLAGS += ' --diag_suppress=66,1296,186,6134' + CFLAGS += ' -I' + EXEC_PATH + '/ARM/RV31/INC' + LFLAGS += ' --libpath ' + EXEC_PATH + '/ARM/RV31/LIB' + + EXEC_PATH += '/arm/bin40/' + + if BUILD == 'debug': + CFLAGS += ' -g -O0' + AFLAGS += ' -g' + else: + CFLAGS += ' -O2' + + CXXFLAGS = CFLAGS + CFLAGS += ' --c99' + + POST_ACTION = 'fromelf -z $TARGET' + # POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET' + +elif PLATFORM == 'iar': + CC = 'iccarm' + CXX = 'iccarm' + AS = 'iasmarm' + AR = 'iarchive' + LINK = 'ilinkarm' + TARGET_EXT = 'out' + + DEVICE = ' -D__FPU_PRESENT' + + CFLAGS = DEVICE + CFLAGS += ' --diag_suppress Pa050' + CFLAGS += ' --no_cse' + CFLAGS += ' --no_unroll' + CFLAGS += ' --no_inline' + CFLAGS += ' --no_code_motion' + CFLAGS += ' --no_tbaa' + CFLAGS += ' --no_clustering' + CFLAGS += ' --no_scheduling' + CFLAGS += ' --debug' + CFLAGS += ' --endian=little' + CFLAGS += ' --cpu=' + CPU + CFLAGS += ' -e' + CFLAGS += ' --fpu=None' + CFLAGS += ' --dlib_config "' + EXEC_PATH + '/arm/INC/c/DLib_Config_Normal.h"' + CFLAGS += ' -Ol' + CFLAGS += ' --use_c++_inline' + + AFLAGS = '' + AFLAGS += ' -s+' + AFLAGS += ' -w+' + AFLAGS += ' -r' + AFLAGS += ' --cpu ' + CPU + AFLAGS += ' --fpu None' + + if BUILD == 'debug': + CFLAGS += ' --debug' + CFLAGS += ' -On' + else: + CFLAGS += ' -Oh' + + LFLAGS = ' --config "board/linker_scripts/link.icf"' + LFLAGS += ' --redirect _Printf=_PrintfTiny' + LFLAGS += ' --redirect _Scanf=_ScanfSmall' + LFLAGS += ' --entry __iar_program_start' + + CXXFLAGS = CFLAGS + + EXEC_PATH = EXEC_PATH + '/arm/bin/' + POST_ACTION = 'ielftool --bin $TARGET rtthread.bin' + +def dist_handle(BSP_ROOT, dist_dir): + import sys + cwd_path = os.getcwd() + sys.path.append(os.path.join(os.path.dirname(BSP_ROOT), 'tools')) + from sdk_dist import dist_do_building + dist_do_building(BSP_ROOT, dist_dir) \ No newline at end of file diff --git a/bsp/imxrt/imxrt1052-sc-internal/template.ewd b/bsp/imxrt/imxrt1052-sc-internal/template.ewd new file mode 100644 index 0000000000..1bccb036b3 --- /dev/null +++ b/bsp/imxrt/imxrt1052-sc-internal/template.ewd @@ -0,0 +1,1485 @@ + + + 3 + + rtthread + + ARM + + 1 + + C-SPY + 2 + + 30 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 1 + 1 + 1 + + + + + + + + CADI_ID + 2 + + 0 + 1 + 1 + + + + + + + + + CMSISDAP_ID + 2 + + 4 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + GDBSERVER_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + IJET_ID + 2 + + 8 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + JLINK_ID + 2 + + 16 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 2 + 1 + 1 + + + + + + + + + + NULINK_ID + 2 + + 0 + 1 + 1 + + + + + + + PEMICRO_ID + 2 + + 3 + 1 + 1 + + + + + + + + STLINK_ID + 2 + + 6 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 1 + + + + + + + + TIFET_ID + 2 + + 1 + 1 + 1 + + + + + + + + + + + + + + + + + + + XDS100_ID + 2 + + 8 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\FreeRtos\FreeRtosArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\HWRTOSplugin\HWRTOSplugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\Mbed\MbedArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\Mbed\MbedArmPlugin2.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\SMX\smxAwareIarArm8.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\SMX\smxAwareIarArm8BE.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin + 0 + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\TargetAccessServer\TargetAccessServer.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin + 0 + + + + diff --git a/bsp/imxrt/imxrt1052-sc-internal/template.ewp b/bsp/imxrt/imxrt1052-sc-internal/template.ewp new file mode 100644 index 0000000000..fb890850d1 --- /dev/null +++ b/bsp/imxrt/imxrt1052-sc-internal/template.ewp @@ -0,0 +1,1039 @@ + + + 3 + + rtthread + + ARM + + 1 + + General + 3 + + 31 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 35 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 10 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OBJCOPY + 0 + + 1 + 1 + 1 + + + + + + + + + CUSTOM + 3 + + + + 0 + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + + + + + + ILINK + 0 + + 22 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IARCHIVE + 0 + + 0 + 1 + 1 + + + + + + + BILINK + 0 + + + + diff --git a/bsp/imxrt/imxrt1052-sc-internal/template.ewt b/bsp/imxrt/imxrt1052-sc-internal/template.ewt new file mode 100644 index 0000000000..1201d37c24 --- /dev/null +++ b/bsp/imxrt/imxrt1052-sc-internal/template.ewt @@ -0,0 +1,2372 @@ + + + 3 + + rtthread + + ARM + + 1 + + C-STAT + 261 + + 261 + + 0 + + 1 + 600 + 0 + 2 + 0 + 1 + 100 + + + 1.5.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + RuntimeChecking + 0 + + 2 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + Release + + ARM + + 0 + + C-STAT + 261 + + 261 + + 0 + + 1 + 600 + 0 + 2 + 0 + 1 + 100 + + + 1.5.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + RuntimeChecking + 0 + + 2 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + diff --git a/bsp/imxrt/imxrt1052-sc-internal/template.eww b/bsp/imxrt/imxrt1052-sc-internal/template.eww new file mode 100644 index 0000000000..bd036bb4c9 --- /dev/null +++ b/bsp/imxrt/imxrt1052-sc-internal/template.eww @@ -0,0 +1,10 @@ + + + + + $WS_DIR$\template.ewp + + + + + diff --git a/bsp/imxrt/imxrt1052-sc-internal/template.uvoptx b/bsp/imxrt/imxrt1052-sc-internal/template.uvoptx new file mode 100644 index 0000000000..75f90396bc --- /dev/null +++ b/bsp/imxrt/imxrt1052-sc-internal/template.uvoptx @@ -0,0 +1,182 @@ + + + + 1.0 + +
    ### uVision Project, (C) Keil Software
    + + + *.c + *.s*; *.src; *.a* + *.obj; *.o + *.lib + *.txt; *.h; *.inc + *.plm + *.cpp + 0 + + + + 0 + 0 + + + + rtthread + 0x4 + ARM-ADS + + 12000000 + + 1 + 1 + 0 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\build\keil\List\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 8 + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 1 + 0 + 0 + 3 + + + + + + + + + + .\flexspi_nor.ini + BIN\CMSIS_AGDI.dll + + + + 0 + JL2CM3 + -U30000299 -O78 -S2 -ZTIFSpeedSel5000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST1 -N00("ARM CoreSight SW-DP") -D00(0BD11477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8001 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO15 -FD20000000 -FCF000 -FN1 -FF0MIMXRT105x_QuadSPI_4KB_SEC -FS060000000 -FL0800000 + + + 0 + CMSIS_AGDI + -X"Fire CMSIS-DAP" -UFS-00007888 -O974 -S0 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(0BD11477) -L00(0) -TO18 -TC10000000 -TP20 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20000000 -FCF000 -FN1 -FF0iMXRT1052_W25Q256JV_CFG_By_Fire -FS060000000 -FL02000000 + + + 0 + UL2CM3 + UL2CM3(-S0 -C0 -P0 -FD20000000 -FCF000 -FN1 -FF0MIMXRT105x_HYPER_256KB_SEC -FS060000000 -FL04000000 -FP0($$Device:MIMXRT1052$Flash\MIMXRT105x_HYPER_256KB_SEC.FLM)) + + + + + 0 + + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + 0 + 0 + 0 + + + + + + + + + + + +
    diff --git a/bsp/imxrt/imxrt1052-sc-internal/template.uvprojx b/bsp/imxrt/imxrt1052-sc-internal/template.uvprojx new file mode 100644 index 0000000000..80381b5045 --- /dev/null +++ b/bsp/imxrt/imxrt1052-sc-internal/template.uvprojx @@ -0,0 +1,397 @@ + + + + 2.1 + +
    ### uVision Project, (C) Keil Software
    + + + + rtthread + 0x4 + ARM-ADS + 5060750::V5.06 update 6 (build 750)::ARMCC + 0 + + + MIMXRT1052:M7 + NXP + NXP.iMXRT_DFP.1.0.3 + http://mcuxpresso.nxp.com/cmsis_pack/repo/ + IRAM(0x20000000,0x00060000) IRAM2(0x00000000,0x00020000) CPUTYPE("Cortex-M7") FPU3(SFPU) CLOCK(12000000) ELITTLE + + + UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0RT1050 -FS060000000 -FL04000000 -FP0($$Device:MIMXRT1052$Flash\RT1050.FLM)) + 0 + $$Device:MIMXRT1052$Device\Include\MIMXRT1052.h + + + + + + + + + + $$Device:MIMXRT1052$SVD\MIMXRT1052.svd + 0 + 0 + + + + + + + 0 + 0 + 0 + 0 + 1 + + .\build\keil\Obj\ + rtthread + 1 + 0 + 0 + 1 + 1 + .\build\keil\List\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 1 + 0 + fromelf --bin !L --output rtthread.bin + + 0 + 0 + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + + SARMCM3.DLL + -REMAP -MPU + DCM.DLL + -pCM7 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM7 + + + + 1 + 0 + 0 + 0 + 16 + + + + + 1 + 0 + 0 + 1 + 1 + 4099 + + 1 + BIN\CMSIS_AGDI.dll + "" () + + + + + 0 + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + "Cortex-M7" + + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 2 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x60000 + + + 1 + 0x0 + 0x8000 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x60000 + + + 0 + 0x0 + 0x20000 + + + + + + 1 + 3 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + + --library_interface=armcc --library_type=standardlib --diag_suppress=66,1296,186 + + + + + + + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x10000000 + + .\board\linker_scripts\link.sct + + + + + + + + + + + + + + + + + + + + + + + + +
    diff --git a/bsp/imxrt/imxrt1052-sc-internal/xip/SConscript b/bsp/imxrt/imxrt1052-sc-internal/xip/SConscript new file mode 100644 index 0000000000..4545f00874 --- /dev/null +++ b/bsp/imxrt/imxrt1052-sc-internal/xip/SConscript @@ -0,0 +1,18 @@ +Import('RTT_ROOT') +Import('rtconfig') +from building import * + +cwd = GetCurrentDir() +src = Glob('*.c') +CPPPATH = [cwd] + +if rtconfig.CROSS_TOOL == 'keil': + LINKFLAGS = '--keep=*(.boot_hdr.ivt)' + LINKFLAGS += '--keep=*(.boot_hdr.boot_data)' + LINKFLAGS += '--keep=*(.boot_hdr.dcd_data)' + LINKFLAGS += '--keep=*(.boot_hdr.conf)' +else: + LINKFLAGS = '' + +group = DefineGroup('xip', src, depend = [''], CPPPATH = CPPPATH, LINKFLAGS = LINKFLAGS) +Return('group') diff --git a/bsp/imxrt/imxrt1052-sc-internal/xip/fsl_flexspi_nor_boot.c b/bsp/imxrt/imxrt1052-sc-internal/xip/fsl_flexspi_nor_boot.c new file mode 100644 index 0000000000..41b273f70b --- /dev/null +++ b/bsp/imxrt/imxrt1052-sc-internal/xip/fsl_flexspi_nor_boot.c @@ -0,0 +1,51 @@ +/* + * Copyright 2017 NXP + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include "fsl_flexspi_nor_boot.h" + +/* Component ID definition, used by tools. */ +#ifndef FSL_COMPONENT_ID +#define FSL_COMPONENT_ID "platform.drivers.xip_device" +#endif + +#if defined(XIP_BOOT_HEADER_ENABLE) && (XIP_BOOT_HEADER_ENABLE == 1) +#if defined(__CC_ARM) || defined(__ARMCC_VERSION) || defined(__GNUC__) + __attribute__((section(".boot_hdr.ivt"))) +#elif defined(__ICCARM__) +#pragma location=".boot_hdr.ivt" +#endif +/************************************* + * IVT Data + *************************************/ +const ivt image_vector_table = { + IVT_HEADER, /* IVT Header */ + IMAGE_ENTRY_ADDRESS, /* Image Entry Function */ + IVT_RSVD, /* Reserved = 0 */ + (uint32_t)DCD_ADDRESS, /* Address where DCD information is stored */ + (uint32_t)BOOT_DATA_ADDRESS, /* Address where BOOT Data Structure is stored */ + (uint32_t)&image_vector_table, /* Pointer to IVT Self (absolute address */ + (uint32_t)CSF_ADDRESS, /* Address where CSF file is stored */ + IVT_RSVD /* Reserved = 0 */ +}; + +#if defined(__CC_ARM) || defined(__ARMCC_VERSION) || defined(__GNUC__) + __attribute__((section(".boot_hdr.boot_data"))) +#elif defined(__ICCARM__) +#pragma location=".boot_hdr.boot_data" +#endif +/************************************* + * Boot Data + *************************************/ +const BOOT_DATA_T boot_data = { + FLASH_BASE, /* boot start location */ + FLASH_SIZE, /* size */ + PLUGIN_FLAG, /* Plugin flag*/ + 0xFFFFFFFF /* empty - extra data word */ +}; +#endif + + diff --git a/bsp/imxrt/imxrt1052-sc-internal/xip/fsl_flexspi_nor_boot.h b/bsp/imxrt/imxrt1052-sc-internal/xip/fsl_flexspi_nor_boot.h new file mode 100644 index 0000000000..4870dfb4dc --- /dev/null +++ b/bsp/imxrt/imxrt1052-sc-internal/xip/fsl_flexspi_nor_boot.h @@ -0,0 +1,122 @@ +/* + * Copyright 2017 NXP + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef __FLEXSPI_NOR_BOOT_H__ +#define __FLEXSPI_NOR_BOOT_H__ + +#include +#include "board.h" + +/*! @name Driver version */ +/*@{*/ +/*! @brief XIP_DEVICE driver version 2.0.0. */ +#define FSL_XIP_DEVICE_DRIVER_VERSION (MAKE_VERSION(2, 0, 0)) +/*@}*/ + +/************************************* + * IVT Data + *************************************/ +typedef struct _ivt_ { + /** @ref hdr with tag #HAB_TAG_IVT, length and HAB version fields + * (see @ref data) + */ + uint32_t hdr; + /** Absolute address of the first instruction to execute from the + * image + */ + uint32_t entry; + /** Reserved in this version of HAB: should be NULL. */ + uint32_t reserved1; + /** Absolute address of the image DCD: may be NULL. */ + uint32_t dcd; + /** Absolute address of the Boot Data: may be NULL, but not interpreted + * any further by HAB + */ + uint32_t boot_data; + /** Absolute address of the IVT.*/ + uint32_t self; + /** Absolute address of the image CSF.*/ + uint32_t csf; + /** Reserved in this version of HAB: should be zero. */ + uint32_t reserved2; +} ivt; + +#define IVT_MAJOR_VERSION 0x4 +#define IVT_MAJOR_VERSION_SHIFT 0x4 +#define IVT_MAJOR_VERSION_MASK 0xF +#define IVT_MINOR_VERSION 0x1 +#define IVT_MINOR_VERSION_SHIFT 0x0 +#define IVT_MINOR_VERSION_MASK 0xF + +#define IVT_VERSION(major, minor) \ + ((((major) & IVT_MAJOR_VERSION_MASK) << IVT_MAJOR_VERSION_SHIFT) | \ + (((minor) & IVT_MINOR_VERSION_MASK) << IVT_MINOR_VERSION_SHIFT)) + +/* IVT header */ +#define IVT_TAG_HEADER 0xD1 /**< Image Vector Table */ +#define IVT_SIZE 0x2000 +#define IVT_PAR IVT_VERSION(IVT_MAJOR_VERSION, IVT_MINOR_VERSION) +#define IVT_HEADER (IVT_TAG_HEADER | (IVT_SIZE << 8) | (IVT_PAR << 24)) + +/* Set resume entry */ +#if defined(__CC_ARM) || defined(__ARMCC_VERSION) + extern uint32_t __Vectors[]; + extern uint32_t Image$$RW_m_config_text$$Base[]; +#define IMAGE_ENTRY_ADDRESS ((uint32_t)__Vectors) +#define FLASH_BASE ((uint32_t)Image$$RW_m_config_text$$Base) +#elif defined(__MCUXPRESSO) + extern uint32_t __Vectors[]; + extern uint32_t __boot_hdr_start__[]; +#define IMAGE_ENTRY_ADDRESS ((uint32_t)__Vectors) +#define FLASH_BASE ((uint32_t)__boot_hdr_start__) +#elif defined(__ICCARM__) + extern uint32_t __VECTOR_TABLE[]; + extern uint32_t m_boot_hdr_conf_start[]; +#define IMAGE_ENTRY_ADDRESS ((uint32_t)__VECTOR_TABLE) +#define FLASH_BASE ((uint32_t)m_boot_hdr_conf_start) +#elif defined(__GNUC__) + extern uint32_t __VECTOR_TABLE[]; + extern uint32_t __FLASH_BASE[]; +#define IMAGE_ENTRY_ADDRESS ((uint32_t)__VECTOR_TABLE) +#define FLASH_BASE ((uint32_t)__FLASH_BASE) +#endif + +#if defined(XIP_BOOT_HEADER_DCD_ENABLE) && (1 == XIP_BOOT_HEADER_DCD_ENABLE) +#define DCD_ADDRESS dcd_data +#else +#define DCD_ADDRESS 0 +#endif + +#define BOOT_DATA_ADDRESS &boot_data +#define CSF_ADDRESS 0 +#define IVT_RSVD (uint32_t)(0x00000000) + +/************************************* + * Boot Data + *************************************/ +typedef struct _boot_data_ { + uint32_t start; /* boot start location */ + uint32_t size; /* size */ + uint32_t plugin; /* plugin flag - 1 if downloaded application is plugin */ + uint32_t placeholder; /* placehoder to make even 0x10 size */ +}BOOT_DATA_T; + +#if defined(BOARD_FLASH_SIZE) +#define FLASH_SIZE BOARD_FLASH_SIZE +#else +#error "Please define macro BOARD_FLASH_SIZE" +#endif +#define PLUGIN_FLAG (uint32_t)0 + +/* External Variables */ +const BOOT_DATA_T boot_data; +#if defined(XIP_BOOT_HEADER_DCD_ENABLE) && (1 == XIP_BOOT_HEADER_DCD_ENABLE) +extern const uint8_t dcd_data[]; +#endif + +#endif /* __FLEXSPI_NOR_BOOT_H__ */ + diff --git a/bsp/imxrt/imxrt1052-sc-internal/xip/fsl_flexspi_nor_config.c b/bsp/imxrt/imxrt1052-sc-internal/xip/fsl_flexspi_nor_config.c new file mode 100644 index 0000000000..a85c871076 --- /dev/null +++ b/bsp/imxrt/imxrt1052-sc-internal/xip/fsl_flexspi_nor_config.c @@ -0,0 +1,68 @@ +/* + * Copyright 2017 NXP + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include "fsl_flexspi_nor_config.h" + +/* Component ID definition, used by tools. */ +#ifndef FSL_COMPONENT_ID +#define FSL_COMPONENT_ID "platform.drivers.xip_board" +#endif + +/******************************************************************************* + * Code + ******************************************************************************/ +#if defined(XIP_BOOT_HEADER_ENABLE) && (XIP_BOOT_HEADER_ENABLE == 1) +#if defined(__CC_ARM) || defined(__ARMCC_VERSION) || defined(__GNUC__) +__attribute__((section(".boot_hdr.conf"))) +#elif defined(__ICCARM__) +#pragma location = ".boot_hdr.conf" +#endif + +const flexspi_nor_config_t qspiflash_config = { + .memConfig = + { + .tag = FLEXSPI_CFG_BLK_TAG, + .version = FLEXSPI_CFG_BLK_VERSION, + .readSampleClkSrc = kFlexSPIReadSampleClk_LoopbackInternally, + .csHoldTime = 3u, + .csSetupTime = 3u, + + .deviceModeCfgEnable = true, + .deviceModeType = 1, //Quad enable command + .deviceModeSeq.seqNum = 1, + .deviceModeSeq.seqId = 4, + .deviceModeArg = 0x000200, //Set QE + .deviceType = kFlexSpiDeviceType_SerialNOR,//kFlexSpiDeviceType_SerialNOR, + + .sflashPadType = kSerialFlash_4Pads, + .serialClkFreq = kFlexSpiSerialClk_166MHz, // 80Mhz for winbond, 100Mhz for GD, 133Mhz for ISSI + .sflashA1Size = 32u * 1024u * 1024u, + .dataValidTime = {16u, 16u}, + + .lookupTable = + { + //Quad Input/Output read sequence + [0] = FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xEB, RADDR_SDR, FLEXSPI_4PAD, 0x18), + [1] = FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_4PAD, 0x06, READ_SDR, FLEXSPI_4PAD, 0x04), + [2] = FLEXSPI_LUT_SEQ(0, 0, 0, 0, 0, 0), + + //Read Status + [1*4] = FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x05, READ_SDR, FLEXSPI_1PAD, 0x04), + + //Write Enable + [3*4] = FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x06, STOP, FLEXSPI_1PAD, 0), + + //Write Status + [4*4] = FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x01, WRITE_SDR, FLEXSPI_1PAD, 0x04), + }, + }, + .pageSize = 512u, + .sectorSize = 256u * 1024u, + .blockSize = 256u * 1024u, + .isUniformBlockSize = true, +}; +#endif /* XIP_BOOT_HEADER_ENABLE */ diff --git a/bsp/imxrt/imxrt1052-sc-internal/xip/fsl_flexspi_nor_config.h b/bsp/imxrt/imxrt1052-sc-internal/xip/fsl_flexspi_nor_config.h new file mode 100644 index 0000000000..0e75d54268 --- /dev/null +++ b/bsp/imxrt/imxrt1052-sc-internal/xip/fsl_flexspi_nor_config.h @@ -0,0 +1,268 @@ +/* + * Copyright (c) 2016, Freescale Semiconductor, Inc. + * Copyright 2016-2017 NXP + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef __FSL_FLEXSPI_NOR_CONFIG__ +#define __FSL_FLEXSPI_NOR_CONFIG__ + +#include +#include +#include "fsl_common.h" + +/*! @name Driver version */ +/*@{*/ +/*! @brief XIP_BOARD driver version 2.0.0. */ +#define FSL_XIP_BOARD_DRIVER_VERSION (MAKE_VERSION(2, 0, 0)) +/*@}*/ + +/* FLEXSPI memory config block related defintions */ +#define FLEXSPI_CFG_BLK_TAG (0x42464346UL) // ascii "FCFB" Big Endian +#define FLEXSPI_CFG_BLK_VERSION (0x56010400UL) // V1.4.0 +#define FLEXSPI_CFG_BLK_SIZE (512) + +/* FLEXSPI Feature related definitions */ +#define FLEXSPI_FEATURE_HAS_PARALLEL_MODE 1 + +/* Lookup table related defintions */ +#define CMD_INDEX_READ 0 +#define CMD_INDEX_READSTATUS 1 +#define CMD_INDEX_WRITEENABLE 2 +#define CMD_INDEX_WRITE 4 + +#define CMD_LUT_SEQ_IDX_READ 0 +#define CMD_LUT_SEQ_IDX_READSTATUS 1 +#define CMD_LUT_SEQ_IDX_WRITEENABLE 3 +#define CMD_LUT_SEQ_IDX_WRITE 9 + +#define CMD_SDR 0x01 +#define CMD_DDR 0x21 +#define RADDR_SDR 0x02 +#define RADDR_DDR 0x22 +#define CADDR_SDR 0x03 +#define CADDR_DDR 0x23 +#define MODE1_SDR 0x04 +#define MODE1_DDR 0x24 +#define MODE2_SDR 0x05 +#define MODE2_DDR 0x25 +#define MODE4_SDR 0x06 +#define MODE4_DDR 0x26 +#define MODE8_SDR 0x07 +#define MODE8_DDR 0x27 +#define WRITE_SDR 0x08 +#define WRITE_DDR 0x28 +#define READ_SDR 0x09 +#define READ_DDR 0x29 +#define LEARN_SDR 0x0A +#define LEARN_DDR 0x2A +#define DATSZ_SDR 0x0B +#define DATSZ_DDR 0x2B +#define DUMMY_SDR 0x0C +#define DUMMY_DDR 0x2C +#define DUMMY_RWDS_SDR 0x0D +#define DUMMY_RWDS_DDR 0x2D +#define JMP_ON_CS 0x1F +#define STOP 0 + +#define FLEXSPI_1PAD 0 +#define FLEXSPI_2PAD 1 +#define FLEXSPI_4PAD 2 +#define FLEXSPI_8PAD 3 + +#define FLEXSPI_LUT_SEQ(cmd0, pad0, op0, cmd1, pad1, op1) \ + (FLEXSPI_LUT_OPERAND0(op0) | FLEXSPI_LUT_NUM_PADS0(pad0) | FLEXSPI_LUT_OPCODE0(cmd0) | FLEXSPI_LUT_OPERAND1(op1) | \ + FLEXSPI_LUT_NUM_PADS1(pad1) | FLEXSPI_LUT_OPCODE1(cmd1)) + +//!@brief Definitions for FlexSPI Serial Clock Frequency +typedef enum _FlexSpiSerialClockFreq +{ + kFlexSpiSerialClk_30MHz = 1, + kFlexSpiSerialClk_50MHz = 2, + kFlexSpiSerialClk_60MHz = 3, + kFlexSpiSerialClk_75MHz = 4, + kFlexSpiSerialClk_80MHz = 5, + kFlexSpiSerialClk_100MHz = 6, + kFlexSpiSerialClk_133MHz = 7, + kFlexSpiSerialClk_166MHz = 8, +} flexspi_serial_clk_freq_t; + +//!@brief FlexSPI clock configuration type +enum +{ + kFlexSpiClk_SDR, //!< Clock configure for SDR mode + kFlexSpiClk_DDR, //!< Clock configurat for DDR mode +}; + +//!@brief FlexSPI Read Sample Clock Source definition +typedef enum _FlashReadSampleClkSource +{ + kFlexSPIReadSampleClk_LoopbackInternally = 0, + kFlexSPIReadSampleClk_LoopbackFromDqsPad = 1, + kFlexSPIReadSampleClk_LoopbackFromSckPad = 2, + kFlexSPIReadSampleClk_ExternalInputFromDqsPad = 3, +} flexspi_read_sample_clk_t; + +//!@brief Misc feature bit definitions +enum +{ + kFlexSpiMiscOffset_DiffClkEnable = 0, //!< Bit for Differential clock enable + kFlexSpiMiscOffset_Ck2Enable = 1, //!< Bit for CK2 enable + kFlexSpiMiscOffset_ParallelEnable = 2, //!< Bit for Parallel mode enable + kFlexSpiMiscOffset_WordAddressableEnable = 3, //!< Bit for Word Addressable enable + kFlexSpiMiscOffset_SafeConfigFreqEnable = 4, //!< Bit for Safe Configuration Frequency enable + kFlexSpiMiscOffset_PadSettingOverrideEnable = 5, //!< Bit for Pad setting override enable + kFlexSpiMiscOffset_DdrModeEnable = 6, //!< Bit for DDR clock confiuration indication. +}; + +//!@brief Flash Type Definition +enum +{ + kFlexSpiDeviceType_SerialNOR = 1, //!< Flash devices are Serial NOR + kFlexSpiDeviceType_SerialNAND = 2, //!< Flash devices are Serial NAND + kFlexSpiDeviceType_SerialRAM = 3, //!< Flash devices are Serial RAM/HyperFLASH + kFlexSpiDeviceType_MCP_NOR_NAND = 0x12, //!< Flash device is MCP device, A1 is Serial NOR, A2 is Serial NAND + kFlexSpiDeviceType_MCP_NOR_RAM = 0x13, //!< Flash deivce is MCP device, A1 is Serial NOR, A2 is Serial RAMs +}; + +//!@brief Flash Pad Definitions +enum +{ + kSerialFlash_1Pad = 1, + kSerialFlash_2Pads = 2, + kSerialFlash_4Pads = 4, + kSerialFlash_8Pads = 8, +}; + +//!@brief FlexSPI LUT Sequence structure +typedef struct _lut_sequence +{ + uint8_t seqNum; //!< Sequence Number, valid number: 1-16 + uint8_t seqId; //!< Sequence Index, valid number: 0-15 + uint16_t reserved; +} flexspi_lut_seq_t; + +//!@brief Flash Configuration Command Type +enum +{ + kDeviceConfigCmdType_Generic, //!< Generic command, for example: configure dummy cycles, drive strength, etc + kDeviceConfigCmdType_QuadEnable, //!< Quad Enable command + kDeviceConfigCmdType_Spi2Xpi, //!< Switch from SPI to DPI/QPI/OPI mode + kDeviceConfigCmdType_Xpi2Spi, //!< Switch from DPI/QPI/OPI to SPI mode + kDeviceConfigCmdType_Spi2NoCmd, //!< Switch to 0-4-4/0-8-8 mode + kDeviceConfigCmdType_Reset, //!< Reset device command +}; + +//!@brief FlexSPI Memory Configuration Block +typedef struct _FlexSPIConfig +{ + uint32_t tag; //!< [0x000-0x003] Tag, fixed value 0x42464346UL + uint32_t version; //!< [0x004-0x007] Version,[31:24] -'V', [23:16] - Major, [15:8] - Minor, [7:0] - bugfix + uint32_t reserved0; //!< [0x008-0x00b] Reserved for future use + uint8_t readSampleClkSrc; //!< [0x00c-0x00c] Read Sample Clock Source, valid value: 0/1/3 + uint8_t csHoldTime; //!< [0x00d-0x00d] CS hold time, default value: 3 + uint8_t csSetupTime; //!< [0x00e-0x00e] CS setup time, default value: 3 + uint8_t columnAddressWidth; //!< [0x00f-0x00f] Column Address with, for HyperBus protocol, it is fixed to 3, For + //! Serial NAND, need to refer to datasheet + uint8_t deviceModeCfgEnable; //!< [0x010-0x010] Device Mode Configure enable flag, 1 - Enable, 0 - Disable + uint8_t deviceModeType; //!< [0x011-0x011] Specify the configuration command type:Quad Enable, DPI/QPI/OPI switch, + //! Generic configuration, etc. + uint16_t waitTimeCfgCommands; //!< [0x012-0x013] Wait time for all configuration commands, unit: 100us, Used for + //! DPI/QPI/OPI switch or reset command + flexspi_lut_seq_t deviceModeSeq; //!< [0x014-0x017] Device mode sequence info, [7:0] - LUT sequence id, [15:8] - LUt + //! sequence number, [31:16] Reserved + uint32_t deviceModeArg; //!< [0x018-0x01b] Argument/Parameter for device configuration + uint8_t configCmdEnable; //!< [0x01c-0x01c] Configure command Enable Flag, 1 - Enable, 0 - Disable + uint8_t configModeType[3]; //!< [0x01d-0x01f] Configure Mode Type, similar as deviceModeTpe + flexspi_lut_seq_t + configCmdSeqs[3]; //!< [0x020-0x02b] Sequence info for Device Configuration command, similar as deviceModeSeq + uint32_t reserved1; //!< [0x02c-0x02f] Reserved for future use + uint32_t configCmdArgs[3]; //!< [0x030-0x03b] Arguments/Parameters for device Configuration commands + uint32_t reserved2; //!< [0x03c-0x03f] Reserved for future use + uint32_t controllerMiscOption; //!< [0x040-0x043] Controller Misc Options, see Misc feature bit definitions for more + //! details + uint8_t deviceType; //!< [0x044-0x044] Device Type: See Flash Type Definition for more details + uint8_t sflashPadType; //!< [0x045-0x045] Serial Flash Pad Type: 1 - Single, 2 - Dual, 4 - Quad, 8 - Octal + uint8_t serialClkFreq; //!< [0x046-0x046] Serial Flash Frequencey, device specific definitions, See System Boot + //! Chapter for more details + uint8_t lutCustomSeqEnable; //!< [0x047-0x047] LUT customization Enable, it is required if the program/erase cannot + //! be done using 1 LUT sequence, currently, only applicable to HyperFLASH + uint32_t reserved3[2]; //!< [0x048-0x04f] Reserved for future use + uint32_t sflashA1Size; //!< [0x050-0x053] Size of Flash connected to A1 + uint32_t sflashA2Size; //!< [0x054-0x057] Size of Flash connected to A2 + uint32_t sflashB1Size; //!< [0x058-0x05b] Size of Flash connected to B1 + uint32_t sflashB2Size; //!< [0x05c-0x05f] Size of Flash connected to B2 + uint32_t csPadSettingOverride; //!< [0x060-0x063] CS pad setting override value + uint32_t sclkPadSettingOverride; //!< [0x064-0x067] SCK pad setting override value + uint32_t dataPadSettingOverride; //!< [0x068-0x06b] data pad setting override value + uint32_t dqsPadSettingOverride; //!< [0x06c-0x06f] DQS pad setting override value + uint32_t timeoutInMs; //!< [0x070-0x073] Timeout threshold for read status command + uint32_t commandInterval; //!< [0x074-0x077] CS deselect interval between two commands + uint16_t dataValidTime[2]; //!< [0x078-0x07b] CLK edge to data valid time for PORT A and PORT B, in terms of 0.1ns + uint16_t busyOffset; //!< [0x07c-0x07d] Busy offset, valid value: 0-31 + uint16_t busyBitPolarity; //!< [0x07e-0x07f] Busy flag polarity, 0 - busy flag is 1 when flash device is busy, 1 - + //! busy flag is 0 when flash device is busy + uint32_t lookupTable[64]; //!< [0x080-0x17f] Lookup table holds Flash command sequences + flexspi_lut_seq_t lutCustomSeq[12]; //!< [0x180-0x1af] Customizable LUT Sequences + uint32_t reserved4[4]; //!< [0x1b0-0x1bf] Reserved for future use +} flexspi_mem_config_t; + +/* */ +#define NOR_CMD_INDEX_READ CMD_INDEX_READ //!< 0 +#define NOR_CMD_INDEX_READSTATUS CMD_INDEX_READSTATUS //!< 1 +#define NOR_CMD_INDEX_WRITEENABLE CMD_INDEX_WRITEENABLE //!< 2 +#define NOR_CMD_INDEX_ERASESECTOR 3 //!< 3 +#define NOR_CMD_INDEX_PAGEPROGRAM CMD_INDEX_WRITE //!< 4 +#define NOR_CMD_INDEX_CHIPERASE 5 //!< 5 +#define NOR_CMD_INDEX_DUMMY 6 //!< 6 +#define NOR_CMD_INDEX_ERASEBLOCK 7 //!< 7 + +#define NOR_CMD_LUT_SEQ_IDX_READ CMD_LUT_SEQ_IDX_READ //!< 0 READ LUT sequence id in lookupTable stored in config block +#define NOR_CMD_LUT_SEQ_IDX_READSTATUS \ + CMD_LUT_SEQ_IDX_READSTATUS //!< 1 Read Status LUT sequence id in lookupTable stored in config block +#define NOR_CMD_LUT_SEQ_IDX_READSTATUS_XPI \ + 2 //!< 2 Read status DPI/QPI/OPI sequence id in lookupTable stored in config block +#define NOR_CMD_LUT_SEQ_IDX_WRITEENABLE \ + CMD_LUT_SEQ_IDX_WRITEENABLE //!< 3 Write Enable sequence id in lookupTable stored in config block +#define NOR_CMD_LUT_SEQ_IDX_WRITEENABLE_XPI \ + 4 //!< 4 Write Enable DPI/QPI/OPI sequence id in lookupTable stored in config block +#define NOR_CMD_LUT_SEQ_IDX_ERASESECTOR 5 //!< 5 Erase Sector sequence id in lookupTable stored in config block +#define NOR_CMD_LUT_SEQ_IDX_ERASEBLOCK 8 //!< 8 Erase Block sequence id in lookupTable stored in config block +#define NOR_CMD_LUT_SEQ_IDX_PAGEPROGRAM \ + CMD_LUT_SEQ_IDX_WRITE //!< 9 Program sequence id in lookupTable stored in config block +#define NOR_CMD_LUT_SEQ_IDX_CHIPERASE 11 //!< 11 Chip Erase sequence in lookupTable id stored in config block +#define NOR_CMD_LUT_SEQ_IDX_READ_SFDP 13 //!< 13 Read SFDP sequence in lookupTable id stored in config block +#define NOR_CMD_LUT_SEQ_IDX_RESTORE_NOCMD \ + 14 //!< 14 Restore 0-4-4/0-8-8 mode sequence id in lookupTable stored in config block +#define NOR_CMD_LUT_SEQ_IDX_EXIT_NOCMD \ + 15 //!< 15 Exit 0-4-4/0-8-8 mode sequence id in lookupTable stored in config blobk + +/* + * Serial NOR configuration block + */ +typedef struct _flexspi_nor_config +{ + flexspi_mem_config_t memConfig; //!< Common memory configuration info via FlexSPI + uint32_t pageSize; //!< Page size of Serial NOR + uint32_t sectorSize; //!< Sector size of Serial NOR + uint8_t ipcmdSerialClkFreq; //!< Clock frequency for IP command + uint8_t isUniformBlockSize; //!< Sector/Block size is the same + uint8_t reserved0[2]; //!< Reserved for future use + uint8_t serialNorType; //!< Serial NOR Flash type: 0/1/2/3 + uint8_t needExitNoCmdMode; //!< Need to exit NoCmd mode before other IP command + uint8_t halfClkForNonReadCmd; //!< Half the Serial Clock for non-read command: true/false + uint8_t needRestoreNoCmdMode; //!< Need to Restore NoCmd mode after IP commmand execution + uint32_t blockSize; //!< Block size + uint32_t reserve2[11]; //!< Reserved for future use +} flexspi_nor_config_t; + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +} +#endif +#endif /* __FSL_FLEXSPI_NOR_CONFIG__ */ diff --git a/bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/drivers/fsl_os_abstraction.h b/bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/drivers/fsl_os_abstraction.h new file mode 100644 index 0000000000..2ca7485a0c --- /dev/null +++ b/bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/drivers/fsl_os_abstraction.h @@ -0,0 +1,813 @@ +/* + * Copyright (c) 2015, Freescale Semiconductor, Inc. + * Copyright 2016-2020 NXP + * + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef _FSL_OS_ABSTRACTION_H_ +#define _FSL_OS_ABSTRACTION_H_ + +#include "fsl_common.h" +#include "fsl_os_abstraction_config.h" +#include "generic_list.h" + +/*! + * @addtogroup osa_adapter + * @{ + */ + +#ifdef __cplusplus +extern "C" { +#endif + +/******************************************************************************* + * Definitions + ******************************************************************************/ + +/*! @brief Type for the Task Priority*/ +typedef uint16_t osa_task_priority_t; +/*! @brief Type for a task handler */ +typedef void *osa_task_handle_t; +/*! @brief Type for the parameter to be passed to the task at its creation */ +typedef void *osa_task_param_t; +/*! @brief Type for task pointer. Task prototype declaration */ +typedef void (*osa_task_ptr_t)(osa_task_param_t task_param); +/*! @brief Type for the semaphore handler */ +typedef void *osa_semaphore_handle_t; +/*! @brief Type for the mutex handler */ +typedef void *osa_mutex_handle_t; +/*! @brief Type for the event handler */ +typedef void *osa_event_handle_t; +/*! @brief Type for an event flags group, bit 32 is reserved. */ +typedef uint32_t osa_event_flags_t; +/*! @brief Message definition. */ +typedef void *osa_msg_handle_t; +/*! @brief Type for the message queue handler */ +typedef void *osa_msgq_handle_t; +/*! @brief Type for the Timer handler */ +typedef void *osa_timer_handle_t; +/*! @brief Type for the Timer callback function pointer. */ +typedef void (*osa_timer_fct_ptr_t)(void const *argument); +/*! @brief Thread Definition structure contains startup information of a thread.*/ +typedef struct osa_task_def_tag +{ + osa_task_ptr_t pthread; /*!< start address of thread function*/ + uint32_t tpriority; /*!< initial thread priority*/ + uint32_t instances; /*!< maximum number of instances of that thread function*/ + uint32_t stacksize; /*!< stack size requirements in bytes; 0 is default stack size*/ + uint32_t *tstack; /*!< stack pointer*/ + void *tlink; /*!< link pointer*/ + uint8_t *tname; /*!< name pointer*/ + uint8_t useFloat; /*!< is use float*/ +} osa_task_def_t; +/*! @brief Thread Link Definition structure .*/ +typedef struct osa_thread_link_tag +{ + uint8_t link[12]; /*!< link*/ + osa_task_handle_t osThreadId; /*!< thread id*/ + osa_task_def_t *osThreadDefHandle; /*!< pointer of thread define handle*/ + uint32_t *osThreadStackHandle; /*!< pointer of thread stack handle*/ +} osa_thread_link_t, *osa_thread_link_handle_t; + +/*! @brief Definition structure contains timer parameters.*/ +typedef struct osa_time_def_tag +{ + osa_timer_fct_ptr_t pfCallback; /* < start address of a timer function */ + void *argument; /* < argument of a timer function */ +} osa_time_def_t; + +/*! @brief Type for the timer definition*/ +typedef enum _osa_timer +{ + KOSA_TimerOnce = 0, /*!< one-shot timer*/ + KOSA_TimerPeriodic = 1 /*!< repeating timer*/ +} osa_timer_t; + +/*! @brief Defines the return status of OSA's functions */ +typedef enum _osa_status +{ + KOSA_StatusSuccess = kStatus_Success, /*!< Success */ + KOSA_StatusError = MAKE_STATUS(kStatusGroup_OSA, 1), /*!< Failed */ + KOSA_StatusTimeout = MAKE_STATUS(kStatusGroup_OSA, 2), /*!< Timeout occurs while waiting */ + KOSA_StatusIdle = MAKE_STATUS(kStatusGroup_OSA, 3), /*!< Used for bare metal only, the wait object is not ready + and timeout still not occur */ +} osa_status_t; + +#ifdef USE_RTOS +#undef USE_RTOS +#endif + +#define USE_RTOS (1) +#if (defined(GENERIC_LIST_LIGHT) && (GENERIC_LIST_LIGHT > 0U)) +#define OSA_TASK_HANDLE_SIZE (12U) +#else +#define OSA_TASK_HANDLE_SIZE (16U) +#endif +#define OSA_EVENT_HANDLE_SIZE (8U) +#define OSA_SEM_HANDLE_SIZE (4U) +#define OSA_MUTEX_HANDLE_SIZE (4U) +#define OSA_MSGQ_HANDLE_SIZE (4U) +#define OSA_MSG_HANDLE_SIZE (0U) + +/*! @brief Priority setting for OSA. */ +#ifndef OSA_PRIORITY_IDLE +#define OSA_PRIORITY_IDLE (6) +#endif + +#ifndef OSA_PRIORITY_LOW +#define OSA_PRIORITY_LOW (5) +#endif + +#ifndef OSA_PRIORITY_BELOW_NORMAL +#define OSA_PRIORITY_BELOW_NORMAL (4) +#endif + +#ifndef OSA_PRIORITY_NORMAL +#define OSA_PRIORITY_NORMAL (3) +#endif + +#ifndef OSA_PRIORITY_ABOVE_NORMAL +#define OSA_PRIORITY_ABOVE_NORMAL (2) +#endif + +#ifndef OSA_PRIORITY_HIGH +#define OSA_PRIORITY_HIGH (1) +#endif + +#ifndef OSA_PRIORITY_REAL_TIME +#define OSA_PRIORITY_REAL_TIME (0) +#endif + +#ifndef OSA_TASK_PRIORITY_MAX +#define OSA_TASK_PRIORITY_MAX (0) +#endif + +#ifndef OSA_TASK_PRIORITY_MIN +#define OSA_TASK_PRIORITY_MIN (15) +#endif + +#define SIZE_IN_UINT32_UNITS(size) (((size) + sizeof(uint32_t) - 1) / sizeof(uint32_t)) + +/*! @brief Constant to pass as timeout value in order to wait indefinitely. */ +#define osaWaitForever_c ((uint32_t)(-1)) +#define osaEventFlagsAll_c ((osa_event_flags_t)(0x00FFFFFF)) +#define osThreadStackArray(name) osThread_##name##_stack +#define osThreadStackDef(name, stacksize, instances) \ + uint32_t osThreadStackArray(name)[SIZE_IN_UINT32_UNITS(stacksize) * (instances)]; + +/* ==== Thread Management ==== */ + +/* Create a Thread Definition with function, priority, and stack requirements. + * \param name name of the thread function. + * \param priority initial priority of the thread function. + * \param instances number of possible thread instances. + * \param stackSz stack size (in bytes) requirements for the thread function. + * \param useFloat + */ +#if defined(FSL_RTOS_MQX) +#define OSA_TASK_DEFINE(name, priority, instances, stackSz, useFloat) \ + osa_thread_link_t osThreadLink_##name[instances] = {0}; \ + osThreadStackDef(name, stackSz, instances) osa_task_def_t os_thread_def_##name = { \ + (name), (priority), (instances), (stackSz), osThreadStackArray(name), osThreadLink_##name, \ + (uint8_t *)#name, (useFloat)} +#elif defined(FSL_RTOS_UCOSII) +#if gTaskMultipleInstancesManagement_c +#define OSA_TASK_DEFINE(name, priority, instances, stackSz, useFloat) \ + osa_thread_link_t osThreadLink_##name[instances] = {0}; \ + osThreadStackDef(name, stackSz, instances) osa_task_def_t os_thread_def_##name = { \ + (name), (priority), (instances), (stackSz), osThreadStackArray(name), osThreadLink_##name, \ + (uint8_t *)#name, (useFloat)} +#else +#define OSA_TASK_DEFINE(name, priority, instances, stackSz, useFloat) \ + osThreadStackDef(name, stackSz, instances) osa_task_def_t os_thread_def_##name = { \ + (name), (priority), (instances), (stackSz), osThreadStackArray(name), NULL, (uint8_t *)#name, (useFloat)} +#endif +#else +#define OSA_TASK_DEFINE(name, priority, instances, stackSz, useFloat) \ + osa_task_def_t os_thread_def_##name = {(name), (priority), (instances), (stackSz), \ + NULL, NULL, (uint8_t *)#name, (useFloat)} +#endif +/* Access a Thread defintion. + * \param name name of the thread definition object. + */ +#define OSA_TASK(name) &os_thread_def_##name + +#define OSA_TASK_PROTO(name) externosa_task_def_t os_thread_def_##name +/* ==== Timer Management ==== + * Define a Timer object. + * \param name name of the timer object. + * \param function name of the timer call back function. + */ + +#define OSA_TIMER_DEF(name, function) osa_time_def_t os_timer_def_##name = {(function), NULL} + +/* Access a Timer definition. + * \param name name of the timer object. + */ +#define OSA_TIMER(name) &os_timer_def_##name + +/* ==== Buffer Definition ==== */ + +/*! + * @brief Defines the semaphore handle + * + * This macro is used to define a 4 byte aligned semaphore handle. + * Then use "(osa_semaphore_handle_t)name" to get the semaphore handle. + * + * The macro should be global and could be optional. You could also define semaphore handle by yourself. + * + * This is an example, + * @code + * OSA_SEMAPHORE_HANDLE_DEFINE(semaphoreHandle); + * @endcode + * + * @param name The name string of the semaphore handle. + */ +#define OSA_SEMAPHORE_HANDLE_DEFINE(name) \ + uint32_t name[(OSA_SEM_HANDLE_SIZE + sizeof(uint32_t) - 1U) / sizeof(uint32_t)] + +/*! + * @brief Defines the mutex handle + * + * This macro is used to define a 4 byte aligned mutex handle. + * Then use "(osa_mutex_handle_t)name" to get the mutex handle. + * + * The macro should be global and could be optional. You could also define mutex handle by yourself. + * + * This is an example, + * @code + * OSA_MUTEX_HANDLE_DEFINE(mutexHandle); + * @endcode + * + * @param name The name string of the mutex handle. + */ +#define OSA_MUTEX_HANDLE_DEFINE(name) uint32_t name[(OSA_MUTEX_HANDLE_SIZE + sizeof(uint32_t) - 1U) / sizeof(uint32_t)] + +/*! + * @brief Defines the event handle + * + * This macro is used to define a 4 byte aligned event handle. + * Then use "(osa_event_handle_t)name" to get the event handle. + * + * The macro should be global and could be optional. You could also define event handle by yourself. + * + * This is an example, + * @code + * OSA_EVENT_HANDLE_DEFINE(eventHandle); + * @endcode + * + * @param name The name string of the event handle. + */ +#define OSA_EVENT_HANDLE_DEFINE(name) uint32_t name[(OSA_EVENT_HANDLE_SIZE + sizeof(uint32_t) - 1U) / sizeof(uint32_t)] + +/*! + * @brief Defines the message queue handle + * + * This macro is used to define a 4 byte aligned message queue handle. + * Then use "(osa_msgq_handle_t)name" to get the message queue handle. + * + * The macro should be global and could be optional. You could also define message queue handle by yourself. + * + * This is an example, + * @code + * OSA_MSGQ_HANDLE_DEFINE(msgqHandle, 3, sizeof(msgStruct)); + * @endcode + * + * @param name The name string of the message queue handle. + * @param numberOfMsgs Number of messages. + * @param msgSize Message size. + * + */ + +/*< Macro For FREE_RTOS*/ +#define OSA_MSGQ_HANDLE_DEFINE(name, numberOfMsgs, msgSize) \ + uint32_t name[(OSA_MSGQ_HANDLE_SIZE + sizeof(uint32_t) - 1U) / sizeof(uint32_t)] + +/*! + * @brief Defines the TASK handle + * + * This macro is used to define a 4 byte aligned TASK handle. + * Then use "(osa_task_handle_t)name" to get the TASK handle. + * + * The macro should be global and could be optional. You could also define TASK handle by yourself. + * + * This is an example, + * @code + * OSA_TASK_HANDLE_DEFINE(taskHandle); + * @endcode + * + * @param name The name string of the TASK handle. + */ +#define OSA_TASK_HANDLE_DEFINE(name) uint32_t name[(OSA_TASK_HANDLE_SIZE + sizeof(uint32_t) - 1U) / sizeof(uint32_t)] + +#include "fsl_os_abstraction_rtthread.h" + +extern const uint8_t gUseRtos_c; + +/* + * alloc the temporary memory to store the status + */ +#define OSA_SR_ALLOC() uint32_t osaCurrentSr; +/* + * Enter critical mode + */ +#define OSA_ENTER_CRITICAL() OSA_EnterCritical(&osaCurrentSr) +/* + * Exit critical mode and retore the previous mode + */ +#define OSA_EXIT_CRITICAL() OSA_ExitCritical(osaCurrentSr) + +/******************************************************************************* + * API + ******************************************************************************/ + +/*! + * @brief Reserves the requested amount of memory in bytes. + * + * The function is used to reserve the requested amount of memory in bytes and initializes it to 0. + * + * @param length Amount of bytes to reserve. + * + * @return Pointer to the reserved memory. NULL if memory can't be allocated. + */ +void *OSA_MemoryAllocate(uint32_t length); + +/*! + * @brief Frees the memory previously reserved. + * + * The function is used to free the memory block previously reserved. + * + * @param p Pointer to the start of the memory block previously reserved. + * + */ +void OSA_MemoryFree(void *p); + +/*! + * @brief Enter critical with nesting mode. + * + * @param sr Store current status and return to caller. + */ +void OSA_EnterCritical(uint32_t *sr); + +/*! + * @brief Exit critical with nesting mode. + * + * @param sr Previous status to restore. + */ +void OSA_ExitCritical(uint32_t sr); + +/*! + * @name Task management + * @{ + */ + +/*! + * @brief Creates a task. + * + * This function is used to create task based on the resources defined + * by the macro OSA_TASK_DEFINE. + * + * Example below shows how to use this API to create the task handle. + * @code + * OSA_TASK_HANDLE_DEFINE(taskHandle); + * OSA_TASK_DEFINE( Job1, OSA_PRIORITY_HIGH, 1, 800, 0); + * OSA_TaskCreate((osa_task_handle_t)taskHandle, OSA_TASK(Job1), (osa_task_param_t)NULL); + * @endcode + * + * @param taskHandle Pointer to a memory space of size OSA_TASK_HANDLE_SIZE allocated by the caller, task handle. + * The handle should be 4 byte aligned, because unaligned access doesn't be supported on some devices. + * You can define the handle in the following two ways: + * #OSA_TASK_HANDLE_DEFINE(taskHandle); + * or + * uint32_t taskHandle[((OSA_TASK_HANDLE_SIZE + sizeof(uint32_t) - 1U) / sizeof(uint32_t))]; + * @param thread_def pointer to theosa_task_def_t structure which defines the task. + * @param task_param Pointer to be passed to the task when it is created. + * @retval KOSA_StatusSuccess The task is successfully created. + * @retval KOSA_StatusError The task can not be created. + */ +#if ((defined(FSL_OSA_TASK_ENABLE)) && (FSL_OSA_TASK_ENABLE > 0U)) +osa_status_t OSA_TaskCreate(osa_task_handle_t taskHandle, osa_task_def_t *thread_def, osa_task_param_t task_param); +#endif /* FSL_OSA_TASK_ENABLE */ + +/*! + * @brief Gets the handler of active task. + * + * @return Handler to current active task. + */ +#if ((defined(FSL_OSA_TASK_ENABLE)) && (FSL_OSA_TASK_ENABLE > 0U)) +osa_task_handle_t OSA_TaskGetCurrentHandle(void); +#endif /* FSL_OSA_TASK_ENABLE */ + +/*! + * @brief Puts the active task to the end of scheduler's queue. + * + * When a task calls this function, it gives up the CPU and puts itself to the + * end of a task ready list. + * + * @retval KOSA_StatusSuccess The function is called successfully. + * @retval KOSA_StatusError Error occurs with this function. + */ +#if ((defined(FSL_OSA_TASK_ENABLE)) && (FSL_OSA_TASK_ENABLE > 0U)) +osa_status_t OSA_TaskYield(void); +#endif /* FSL_OSA_TASK_ENABLE */ + +/*! + * @brief Gets the priority of a task. + * + * @param taskHandle The handler of the task whose priority is received. + * + * @return Task's priority. + */ +#if ((defined(FSL_OSA_TASK_ENABLE)) && (FSL_OSA_TASK_ENABLE > 0U)) +osa_task_priority_t OSA_TaskGetPriority(osa_task_handle_t taskHandle); +#endif /* FSL_OSA_TASK_ENABLE */ + +/*! + * @brief Sets the priority of a task. + * + * @param taskHandle The handler of the task whose priority is set. + * @param taskPriority The priority to set. + * + * @retval KOSA_StatusSuccess Task's priority is set successfully. + * @retval KOSA_StatusError Task's priority can not be set. + */ +#if ((defined(FSL_OSA_TASK_ENABLE)) && (FSL_OSA_TASK_ENABLE > 0U)) +osa_status_t OSA_TaskSetPriority(osa_task_handle_t taskHandle, osa_task_priority_t taskPriority); +#endif /* FSL_OSA_TASK_ENABLE */ + +/*! + * @brief Destroys a previously created task. + * + * @param taskHandle The handler of the task to destroy. + * + * @retval KOSA_StatusSuccess The task was successfully destroyed. + * @retval KOSA_StatusError Task destruction failed or invalid parameter. + */ +#if ((defined(FSL_OSA_TASK_ENABLE)) && (FSL_OSA_TASK_ENABLE > 0U)) +osa_status_t OSA_TaskDestroy(osa_task_handle_t taskHandle); +#endif /* FSL_OSA_TASK_ENABLE */ + +/*! + * @brief Creates a semaphore with a given value. + * + * This function creates a semaphore and sets the value to the parameter + * initValue. + * + * Example below shows how to use this API to create the semaphore handle. + * @code + * OSA_SEMAPHORE_HANDLE_DEFINE(semaphoreHandle); + * OSA_SemaphoreCreate((osa_semaphore_handle_t)semaphoreHandle, 0xff); + * @endcode + * + * @param semaphoreHandle Pointer to a memory space of size OSA_SEM_HANDLE_SIZE allocated by the caller. + * The handle should be 4 byte aligned, because unaligned access doesn't be supported on some devices. + * You can define the handle in the following two ways: + * #OSA_SEMAPHORE_HANDLE_DEFINE(semaphoreHandle); + * or + * uint32_t semaphoreHandle[((OSA_SEM_HANDLE_SIZE + sizeof(uint32_t) - 1U) / sizeof(uint32_t))]; + * @param initValue Initial value the semaphore will be set to. + * + * @retval KOSA_StatusSuccess the new semaphore if the semaphore is created successfully. + * @retval KOSA_StatusError if the semaphore can not be created. + */ +osa_status_t OSA_SemaphoreCreate(osa_semaphore_handle_t semaphoreHandle, uint32_t initValue); + +/*! + * @brief Destroys a previously created semaphore. + * + * @param semaphoreHandle The semaphore handle. + * The macro SEMAPHORE_HANDLE_BUFFER_GET is used to get the semaphore buffer pointer, + * and should not be used before the macro SEMAPHORE_HANDLE_BUFFER_DEFINE is used. + * + * @retval KOSA_StatusSuccess The semaphore is successfully destroyed. + * @retval KOSA_StatusError The semaphore can not be destroyed. + */ +osa_status_t OSA_SemaphoreDestroy(osa_semaphore_handle_t semaphoreHandle); + +/*! + * @brief Pending a semaphore with timeout. + * + * This function checks the semaphore's counting value. If it is positive, + * decreases it and returns KOSA_StatusSuccess. Otherwise, a timeout is used + * to wait. + * + * @param semaphoreHandle The semaphore handle. + * @param millisec The maximum number of milliseconds to wait if semaphore is not + * positive. Pass osaWaitForever_c to wait indefinitely, pass 0 + * will return KOSA_StatusTimeout immediately. + * + * @retval KOSA_StatusSuccess The semaphore is received. + * @retval KOSA_StatusTimeout The semaphore is not received within the specified 'timeout'. + * @retval KOSA_StatusError An incorrect parameter was passed. + */ +osa_status_t OSA_SemaphoreWait(osa_semaphore_handle_t semaphoreHandle, uint32_t millisec); + +/*! + * @brief Signals for someone waiting on the semaphore to wake up. + * + * Wakes up one task that is waiting on the semaphore. If no task is waiting, increases + * the semaphore's counting value. + * + * @param semaphoreHandle The semaphore handle to signal. + * + * @retval KOSA_StatusSuccess The semaphore is successfully signaled. + * @retval KOSA_StatusError The object can not be signaled or invalid parameter. + * + */ +osa_status_t OSA_SemaphorePost(osa_semaphore_handle_t semaphoreHandle); + +/*! + * @brief Create an unlocked mutex. + * + * This function creates a non-recursive mutex and sets it to unlocked status. + * + * Example below shows how to use this API to create the mutex handle. + * @code + * OSA_MUTEX_HANDLE_DEFINE(mutexHandle); + * OSA_MutexCreate((osa_mutex_handle_t)mutexHandle); + * @endcode + * + * @param mutexHandle Pointer to a memory space of size OSA_MUTEX_HANDLE_SIZE allocated by the caller. + * The handle should be 4 byte aligned, because unaligned access doesn't be supported on some devices. + * You can define the handle in the following two ways: + * #OSA_MUTEX_HANDLE_DEFINE(mutexHandle); + * or + * uint32_t mutexHandle[((OSA_MUTEX_HANDLE_SIZE + sizeof(uint32_t) - 1U) / sizeof(uint32_t))]; + * @retval KOSA_StatusSuccess the new mutex if the mutex is created successfully. + * @retval KOSA_StatusError if the mutex can not be created. + */ +osa_status_t OSA_MutexCreate(osa_mutex_handle_t mutexHandle); + +/*! + * @brief Waits for a mutex and locks it. + * + * This function checks the mutex's status. If it is unlocked, locks it and returns the + * KOSA_StatusSuccess. Otherwise, waits for a timeout in milliseconds to lock. + * + * @param mutexHandle The mutex handle. + * @param millisec The maximum number of milliseconds to wait for the mutex. + * If the mutex is locked, Pass the value osaWaitForever_c will + * wait indefinitely, pass 0 will return KOSA_StatusTimeout + * immediately. + * + * @retval KOSA_StatusSuccess The mutex is locked successfully. + * @retval KOSA_StatusTimeout Timeout occurred. + * @retval KOSA_StatusError Incorrect parameter was passed. + * + * @note This is non-recursive mutex, a task can not try to lock the mutex it has locked. + */ +osa_status_t OSA_MutexLock(osa_mutex_handle_t mutexHandle, uint32_t millisec); + +/*! + * @brief Unlocks a previously locked mutex. + * + * @param mutexHandle The mutex handle. + * + * @retval KOSA_StatusSuccess The mutex is successfully unlocked. + * @retval KOSA_StatusError The mutex can not be unlocked or invalid parameter. + */ +osa_status_t OSA_MutexUnlock(osa_mutex_handle_t mutexHandle); + +/*! + * @brief Destroys a previously created mutex. + * + * @param mutexHandle The mutex handle. + * + * @retval KOSA_StatusSuccess The mutex is successfully destroyed. + * @retval KOSA_StatusError The mutex can not be destroyed. + * + */ +osa_status_t OSA_MutexDestroy(osa_mutex_handle_t mutexHandle); + +/*! + * @brief Initializes an event object with all flags cleared. + * + * This function creates an event object and set its clear mode. If autoClear + * is 1, when a task gets the event flags, these flags will be + * cleared automatically. Otherwise these flags must + * be cleared manually. + * + * Example below shows how to use this API to create the event handle. + * @code + * OSA_EVENT_HANDLE_DEFINE(eventHandle); + * OSA_EventCreate((osa_event_handle_t)eventHandle, 0); + * @endcode + * + * @param eventHandle Pointer to a memory space of size OSA_EVENT_HANDLE_SIZE allocated by the caller. + * The handle should be 4 byte aligned, because unaligned access doesn't be supported on some devices. + * You can define the handle in the following two ways: + * #OSA_EVENT_HANDLE_DEFINE(eventHandle); + * or + * uint32_t eventHandle[((OSA_EVENT_HANDLE_SIZE + sizeof(uint32_t) - 1U) / sizeof(uint32_t))]; + * @param autoClear 1 The event is auto-clear. + * 0 The event manual-clear + * @retval KOSA_StatusSuccess the new event if the event is created successfully. + * @retval KOSA_StatusError if the event can not be created. + */ +osa_status_t OSA_EventCreate(osa_event_handle_t eventHandle, uint8_t autoClear); + +/*! + * @brief Sets one or more event flags. + * + * Sets specified flags of an event object. + * + * @param eventHandle The event handle. + * @param flagsToSet Flags to be set. + * + * @retval KOSA_StatusSuccess The flags were successfully set. + * @retval KOSA_StatusError An incorrect parameter was passed. + */ +osa_status_t OSA_EventSet(osa_event_handle_t eventHandle, osa_event_flags_t flagsToSet); + +/*! + * @brief Clears one or more flags. + * + * Clears specified flags of an event object. + * + * @param eventHandle The event handle. + * @param flagsToClear Flags to be clear. + * + * @retval KOSA_StatusSuccess The flags were successfully cleared. + * @retval KOSA_StatusError An incorrect parameter was passed. + */ +osa_status_t OSA_EventClear(osa_event_handle_t eventHandle, osa_event_flags_t flagsToClear); + +/*! + * @brief Get event's flags. + * + * Get specified flags of an event object. + * + * @param eventHandle The event handle. + * The macro EVENT_HANDLE_BUFFER_GET is used to get the event buffer pointer, + * and should not be used before the macro EVENT_HANDLE_BUFFER_DEFINE is used. + * @param flagsMask The flags user want to get are specified by this parameter. + * @param pFlagsOfEvent The event flags are obtained by this parameter. + * + * @retval KOSA_StatusSuccess The event flags were successfully got. + * @retval KOSA_StatusError An incorrect parameter was passed. + */ +osa_status_t OSA_EventGet(osa_event_handle_t eventHandle, + osa_event_flags_t flagsMask, + osa_event_flags_t *pFlagsOfEvent); + +/*! + * @brief Waits for specified event flags to be set. + * + * This function waits for a combination of flags to be set in an event object. + * Applications can wait for any/all bits to be set. Also this function could + * obtain the flags who wakeup the waiting task. + * + * @param eventHandle The event handle. + * @param flagsToWait Flags that to wait. + * @param waitAll Wait all flags or any flag to be set. + * @param millisec The maximum number of milliseconds to wait for the event. + * If the wait condition is not met, pass osaWaitForever_c will + * wait indefinitely, pass 0 will return KOSA_StatusTimeout + * immediately. + * @param pSetFlags Flags that wakeup the waiting task are obtained by this parameter. + * + * @retval KOSA_StatusSuccess The wait condition met and function returns successfully. + * @retval KOSA_StatusTimeout Has not met wait condition within timeout. + * @retval KOSA_StatusError An incorrect parameter was passed. + + * + * @note Please pay attention to the flags bit width, FreeRTOS uses the most + * significant 8 bis as control bits, so do not wait these bits while using + * FreeRTOS. + * + */ +osa_status_t OSA_EventWait(osa_event_handle_t eventHandle, + osa_event_flags_t flagsToWait, + uint8_t waitAll, + uint32_t millisec, + osa_event_flags_t *pSetFlags); + +/*! + * @brief Destroys a previously created event object. + * + * @param eventHandle The event handle. + * + * @retval KOSA_StatusSuccess The event is successfully destroyed. + * @retval KOSA_StatusError Event destruction failed. + */ +osa_status_t OSA_EventDestroy(osa_event_handle_t eventHandle); + +/*! + * @brief Initializes a message queue. + * + * This function allocates memory for and initializes a message queue. Message queue elements are hardcoded as void*. + * + * Example below shows how to use this API to create the massage queue handle. + * @code + * OSA_MSGQ_HANDLE_DEFINE(msgqHandle); + * OSA_MsgQCreate((osa_msgq_handle_t)msgqHandle, 5U, sizeof(msg)); + * @endcode + * + * @param msgqHandle Pointer to a memory space of size #(OSA_MSGQ_HANDLE_SIZE + msgNo*msgSize) on bare-matel + * and #(OSA_MSGQ_HANDLE_SIZE) on FreeRTOS allocated by the caller, message queue handle. + * The handle should be 4 byte aligned, because unaligned access doesn't be supported on some devices. + * You can define the handle in the following two ways: + * #OSA_MSGQ_HANDLE_DEFINE(msgqHandle); + * or + * For bm: uint32_t msgqHandle[((OSA_MSGQ_HANDLE_SIZE + msgNo*msgSize + sizeof(uint32_t) - 1U) / sizeof(uint32_t))]; + * For freertos: uint32_t msgqHandle[((OSA_MSGQ_HANDLE_SIZE + sizeof(uint32_t) - 1U) / sizeof(uint32_t))]; + * @param msgNo :number of messages the message queue should accommodate. + * @param msgSize :size of a single message structure. + * + * @retval KOSA_StatusSuccess Message queue successfully Create. + * @retval KOSA_StatusError Message queue create failure. + */ +osa_status_t OSA_MsgQCreate(osa_msgq_handle_t msgqHandle, uint32_t msgNo, uint32_t msgSize); + +/*! + * @brief Puts a message at the end of the queue. + * + * This function puts a message to the end of the message queue. If the queue + * is full, this function returns the KOSA_StatusError; + * + * @param msgqHandle Message Queue handler. + * @param pMessage Pointer to the message to be put into the queue. + * + * @retval KOSA_StatusSuccess Message successfully put into the queue. + * @retval KOSA_StatusError The queue was full or an invalid parameter was passed. + */ +osa_status_t OSA_MsgQPut(osa_msgq_handle_t msgqHandle, osa_msg_handle_t pMessage); + +/*! + * @brief Reads and remove a message at the head of the queue. + * + * This function gets a message from the head of the message queue. If the + * queue is empty, timeout is used to wait. + * + * @param msgqHandle Message Queue handler. + * @param pMessage Pointer to a memory to save the message. + * @param millisec The number of milliseconds to wait for a message. If the + * queue is empty, pass osaWaitForever_c will wait indefinitely, + * pass 0 will return KOSA_StatusTimeout immediately. + * + * @retval KOSA_StatusSuccess Message successfully obtained from the queue. + * @retval KOSA_StatusTimeout The queue remains empty after timeout. + * @retval KOSA_StatusError Invalid parameter. + */ +osa_status_t OSA_MsgQGet(osa_msgq_handle_t msgqHandle, osa_msg_handle_t pMessage, uint32_t millisec); + +/*! + * @brief Destroys a previously created queue. + * + * @param msgqHandle Message Queue handler. + * + * @retval KOSA_StatusSuccess The queue was successfully destroyed. + * @retval KOSA_StatusError Message queue destruction failed. + */ +osa_status_t OSA_MsgQDestroy(osa_msgq_handle_t msgqHandle); + +/*! + * @brief Enable all interrupts. + */ +void OSA_InterruptEnable(void); + +/*! + * @brief Disable all interrupts. + */ +void OSA_InterruptDisable(void); + +/*! + * @brief Enable all interrupts using PRIMASK. + */ +void OSA_EnableIRQGlobal(void); + +/*! + * @brief Disable all interrupts using PRIMASK. + */ +void OSA_DisableIRQGlobal(void); + +/*! + * @brief Delays execution for a number of milliseconds. + * + * @param millisec The time in milliseconds to wait. + */ +void OSA_TimeDelay(uint32_t millisec); + +/*! + * @brief This function gets current time in milliseconds. + * + * @retval current time in milliseconds + */ +uint32_t OSA_TimeGetMsec(void); + +/*! + * @brief Installs the interrupt handler. + * + * @param IRQNumber IRQ number of the interrupt. + * @param handler The interrupt handler to install. + */ +void OSA_InstallIntHandler(uint32_t IRQNumber, void (*handler)(void)); + +/*! @}*/ +#ifdef __cplusplus +} +#endif +/*! @}*/ +#endif diff --git a/bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/drivers/fsl_os_abstraction_config.h b/bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/drivers/fsl_os_abstraction_config.h new file mode 100644 index 0000000000..234cf972bc --- /dev/null +++ b/bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/drivers/fsl_os_abstraction_config.h @@ -0,0 +1,36 @@ +/*! + * Copyright (c) 2015, Freescale Semiconductor, Inc. + * Copyright 2016-2018 NXP + * + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef _FSL_OS_ABSTRACTION_CONFIG_H_ +#define _FSL_OS_ABSTRACTION_CONFIG_H_ + +#ifndef gMainThreadStackSize_c +#define gMainThreadStackSize_c 1024 +#endif + +#ifndef gMainThreadPriority_c +#define gMainThreadPriority_c 1 +#endif + +#ifndef gTaskMultipleInstancesManagement_c +#define gTaskMultipleInstancesManagement_c 0 +#endif + +/*! @brief Definition to determine whether enable OSA's TASK module. */ +#ifndef OSA_USED +#ifndef FSL_OSA_TASK_ENABLE +#define FSL_OSA_TASK_ENABLE 0U +#endif +#else +#if defined(FSL_OSA_TASK_ENABLE) +#undef FSL_OSA_TASK_ENABLE +#endif +#define FSL_OSA_TASK_ENABLE 1U +#endif /* OSA_USED */ + +#endif /* _FSL_OS_ABSTRACTION_CONFIG_H_ */ diff --git a/bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/drivers/fsl_os_abstraction_rtthread.c b/bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/drivers/fsl_os_abstraction_rtthread.c new file mode 100644 index 0000000000..7b53d023f8 --- /dev/null +++ b/bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/drivers/fsl_os_abstraction_rtthread.c @@ -0,0 +1,920 @@ +/*! ********************************************************************************* + * Copyright (c) 2015, Freescale Semiconductor, Inc. + * Copyright 2016-2017, 2019 NXP + * All rights reserved. + * + * + * This is the source file for the OS Abstraction layer for freertos. + * + * SPDX-License-Identifier: BSD-3-Clause + ********************************************************************************** */ + +/*! ********************************************************************************* +************************************************************************************* +* Include +************************************************************************************* +********************************************************************************** */ +#include "fsl_common.h" +#include "fsl_os_abstraction.h" +#include "fsl_os_abstraction_rtthread.h" +#include +#include "generic_list.h" + +/*! ********************************************************************************* +************************************************************************************* +* Private macros +************************************************************************************* +********************************************************************************** */ + +/* Weak function. */ +#if defined(__GNUC__) +#define __WEAK_FUNC __attribute__((weak)) +#elif defined(__ICCARM__) +#define __WEAK_FUNC __weak +#elif defined(__CC_ARM) || defined(__ARMCC_VERSION) +#define __WEAK_FUNC __attribute__((weak)) +#endif + +#define millisecToTicks(millisec) (((millisec)*configTICK_RATE_HZ + 999U) / 1000U) + +#ifdef DEBUG_ASSERT +#define OS_ASSERT(condition) \ + if (!(condition)) \ + while (1) \ + ; +#else +#define OS_ASSERT(condition) (void)(condition); +#endif + +/*! @brief Converts milliseconds to ticks*/ +#define MSEC_TO_TICK(msec) \ + (((uint32_t)(msec) + 500uL / (uint32_t)configTICK_RATE_HZ) * (uint32_t)configTICK_RATE_HZ / 1000uL) +#define TICKS_TO_MSEC(tick) ((uint32_t)((uint64_t)(tick)*1000uL / (uint64_t)configTICK_RATE_HZ)) +/************************************************************************************ +************************************************************************************* +* Private type definitions +************************************************************************************* +************************************************************************************/ +typedef struct osa_freertos_task +{ + list_element_t link; + rt_thread_t taskHandle; +} osa_freertos_task_t; + +typedef struct _osa_event_struct +{ + rt_event_t handle; /* The event handle */ + uint8_t autoClear; /*!< Auto clear or manual clear */ +} osa_event_struct_t; + +/*! @brief State structure for bm osa manager. */ +typedef struct _osa_state +{ +#if (defined(FSL_OSA_TASK_ENABLE) && (FSL_OSA_TASK_ENABLE > 0U)) + list_label_t taskList; + OSA_TASK_HANDLE_DEFINE(mainTaskHandle); +#endif + uint32_t basePriority; + int32_t basePriorityNesting; + uint32_t interruptDisableCount; +} osa_state_t; + +/*! ********************************************************************************* +************************************************************************************* +* Private prototypes +************************************************************************************* +********************************************************************************** */ +__WEAK_FUNC void main_task(void const *argument); +__WEAK_FUNC void main_task(void const *argument) +{ +} + +void startup_task(void *argument); + +/*! ********************************************************************************* +************************************************************************************* +* Public memory declarations +************************************************************************************* +********************************************************************************** */ +const uint8_t gUseRtos_c = USE_RTOS; // USE_RTOS = 0 for BareMetal and 1 for OS + +static osa_state_t s_osaState = {0}; +/*! ********************************************************************************* +************************************************************************************* +* Private memory declarations +************************************************************************************* +********************************************************************************** */ + +/*! ********************************************************************************* +************************************************************************************* +* Public functions +************************************************************************************* +********************************************************************************** */ +/*FUNCTION********************************************************************** + * + * Function Name : OSA_MemoryAllocate + * Description : Reserves the requested amount of memory in bytes. + * + *END**************************************************************************/ +void *OSA_MemoryAllocate(uint32_t length) +{ + void *p = rt_malloc(length); + + if (RT_NULL != p) + { + rt_memset(p, 0, length); + } + + return p; +} + +/*FUNCTION********************************************************************** + * + * Function Name : OSA_MemoryFree + * Description : Frees the memory previously reserved. + * + *END**************************************************************************/ +void OSA_MemoryFree(void *p) +{ + rt_free(p); +} + +void OSA_EnterCritical(uint32_t *sr) +{ + if (rt_thread_self() != RT_NULL) + rt_enter_critical(); +} + +void OSA_ExitCritical(uint32_t sr) +{ + if (rt_thread_self() != RT_NULL) + rt_exit_critical(); +} + +/*FUNCTION********************************************************************** + * + * Function Name : startup_task + * Description : Wrapper over main_task.. + * + *END**************************************************************************/ +void startup_task(void *argument) +{ + main_task(argument); +} + +/*FUNCTION********************************************************************** + * + * Function Name : OSA_TaskGetCurrentHandle + * Description : This function is used to get current active task's handler. + * + *END**************************************************************************/ +#if (defined(FSL_OSA_TASK_ENABLE) && (FSL_OSA_TASK_ENABLE > 0U)) +osa_task_handle_t OSA_TaskGetCurrentHandle(void) +{ + list_element_handle_t list_element; + osa_freertos_task_t *ptask; + + list_element = LIST_GetHead(&s_osaState.taskList); + while (NULL != list_element) + { + ptask = (osa_freertos_task_t *)(void *)list_element; + if (ptask->taskHandle == xTaskGetCurrentTaskHandle()) + { + return (osa_task_handle_t)ptask; + } + list_element = LIST_GetNext(list_element); + } + return NULL; +} +#endif + +/*FUNCTION********************************************************************** + * + * Function Name : OSA_TaskYield + * Description : When a task calls this function, it will give up CPU and put + * itself to the tail of ready list. + * + *END**************************************************************************/ +#if (defined(FSL_OSA_TASK_ENABLE) && (FSL_OSA_TASK_ENABLE > 0U)) +osa_status_t OSA_TaskYield(void) +{ + taskYIELD(); + return KOSA_StatusSuccess; +} +#endif + +/*FUNCTION********************************************************************** + * + * Function Name : OSA_TaskGetPriority + * Description : This function returns task's priority by task handler. + * + *END**************************************************************************/ +#if (defined(FSL_OSA_TASK_ENABLE) && (FSL_OSA_TASK_ENABLE > 0U)) +osa_task_priority_t OSA_TaskGetPriority(osa_task_handle_t taskHandle) +{ + assert(taskHandle); + osa_freertos_task_t *ptask = (osa_freertos_task_t *)taskHandle; + return (osa_task_priority_t)(PRIORITY_RTOS_TO_OSA(uxTaskPriorityGet(ptask->taskHandle))); +} +#endif + +/*FUNCTION********************************************************************** + * + * Function Name : OSA_TaskSetPriority + * Description : This function sets task's priority by task handler. + * + *END**************************************************************************/ +#if (defined(FSL_OSA_TASK_ENABLE) && (FSL_OSA_TASK_ENABLE > 0U)) +osa_status_t OSA_TaskSetPriority(osa_task_handle_t taskHandle, osa_task_priority_t taskPriority) +{ + assert(taskHandle); + osa_freertos_task_t *ptask = (osa_freertos_task_t *)taskHandle; + vTaskPrioritySet((task_handler_t)ptask->taskHandle, PRIORITY_OSA_TO_RTOS(taskPriority)); + return KOSA_StatusSuccess; +} +#endif + +/*FUNCTION********************************************************************** + * + * Function Name : OSA_TaskCreate + * Description : This function is used to create a task and make it ready. + * Param[in] : threadDef - Definition of the thread. + * task_param - Parameter to pass to the new thread. + * Return Thread handle of the new thread, or NULL if failed. + * + *END**************************************************************************/ +#if (defined(FSL_OSA_TASK_ENABLE) && (FSL_OSA_TASK_ENABLE > 0U)) +osa_status_t OSA_TaskCreate(osa_task_handle_t taskHandle, osa_task_def_t *thread_def, osa_task_param_t task_param) +{ + assert(sizeof(osa_freertos_task_t) == OSA_TASK_HANDLE_SIZE); + assert(taskHandle); + TaskHandle_t pxCreatedTask; + osa_freertos_task_t *ptask = (osa_freertos_task_t *)taskHandle; + + if (xTaskCreate((TaskFunction_t)thread_def->pthread, /* pointer to the task */ + (char const *)thread_def->tname, /* task name for kernel awareness debugging */ + (configSTACK_DEPTH_TYPE)thread_def->stacksize / sizeof(portSTACK_TYPE), /* task stack size */ + (task_param_t)task_param, /* optional task startup argument */ + PRIORITY_OSA_TO_RTOS(thread_def->tpriority), /* initial priority */ + &pxCreatedTask /* optional task handle to create */ + ) == pdPASS) + { + ptask->taskHandle = pxCreatedTask; + OSA_InterruptDisable(); + (void)LIST_AddTail(&s_osaState.taskList, (list_element_handle_t) & (ptask->link)); + OSA_InterruptEnable(); + return KOSA_StatusSuccess; + } + return KOSA_StatusError; +} +#endif + +/*FUNCTION********************************************************************** + * + * Function Name : OSA_TaskDestroy + * Description : This function destroy a task. + * Param[in] :taskHandle - Thread handle. + * Return KOSA_StatusSuccess if the task is destroied, otherwise return KOSA_StatusError. + * + *END**************************************************************************/ +#if (defined(FSL_OSA_TASK_ENABLE) && (FSL_OSA_TASK_ENABLE > 0U)) +osa_status_t OSA_TaskDestroy(osa_task_handle_t taskHandle) +{ + assert(taskHandle); + osa_freertos_task_t *ptask = (osa_freertos_task_t *)taskHandle; + osa_status_t status; + uint16_t oldPriority; + /*Change priority to avoid context switches*/ + oldPriority = OSA_TaskGetPriority(OSA_TaskGetCurrentHandle()); + (void)OSA_TaskSetPriority(OSA_TaskGetCurrentHandle(), OSA_PRIORITY_REAL_TIME); +#if INCLUDE_vTaskDelete /* vTaskDelete() enabled */ + vTaskDelete((task_handler_t)ptask->taskHandle); + status = KOSA_StatusSuccess; +#else + status = KOSA_StatusError; /* vTaskDelete() not available */ +#endif + (void)OSA_TaskSetPriority(OSA_TaskGetCurrentHandle(), oldPriority); + OSA_InterruptDisable(); + (void)LIST_RemoveElement(taskHandle); + OSA_InterruptEnable(); + return status; +} +#endif + +/*FUNCTION********************************************************************** + * + * Function Name : OSA_TimeDelay + * Description : This function is used to suspend the active thread for the given number of milliseconds. + * + *END**************************************************************************/ +void OSA_TimeDelay(uint32_t millisec) +{ + rt_thread_mdelay(millisec); +} +/*FUNCTION********************************************************************** + * + * Function Name : OSA_TimeGetMsec + * Description : This function gets current time in milliseconds. + * + *END**************************************************************************/ +uint32_t OSA_TimeGetMsec(void) +{ + return rt_tick_get_millisecond(); +} +/*FUNCTION********************************************************************** + * + * Function Name : OSA_SemaphoreCreate + * Description : This function is used to create a semaphore. + * Return : Semaphore handle of the new semaphore, or NULL if failed. + * + *END**************************************************************************/ +osa_status_t OSA_SemaphoreCreate(osa_semaphore_handle_t semaphoreHandle, uint32_t initValue) +{ + assert(sizeof(osa_semaphore_handle_t) == OSA_SEM_HANDLE_SIZE); + assert(semaphoreHandle); + + union + { + rt_sem_t sem; + uint32_t semhandle; + } xSemaHandle; + + xSemaHandle.sem = rt_sem_create("osa_sem", initValue, RT_IPC_FLAG_PRIO); + if (NULL != xSemaHandle.sem) + { + *(uint32_t *)semaphoreHandle = xSemaHandle.semhandle; + return KOSA_StatusSuccess; + } + return KOSA_StatusError; +} + +/*FUNCTION********************************************************************** + * + * Function Name : OSA_SemaphoreDestroy + * Description : This function is used to destroy a semaphore. + * Return : KOSA_StatusSuccess if the semaphore is destroyed successfully, otherwise return KOSA_StatusError. + * + *END**************************************************************************/ +osa_status_t OSA_SemaphoreDestroy(osa_semaphore_handle_t semaphoreHandle) +{ + assert(semaphoreHandle); + rt_sem_t sem = (rt_sem_t)(void *)(uint32_t *)(*(uint32_t *)semaphoreHandle); + + rt_sem_delete(sem); + return KOSA_StatusSuccess; +} + +/*FUNCTION********************************************************************** + * + * Function Name : OSA_SemaphoreWait + * Description : This function checks the semaphore's counting value, if it is + * positive, decreases it and returns KOSA_StatusSuccess, otherwise, timeout + * will be used for wait. The parameter timeout indicates how long should wait + * in milliseconds. Pass osaWaitForever_c to wait indefinitely, pass 0 will + * return KOSA_StatusTimeout immediately if semaphore is not positive. + * This function returns KOSA_StatusSuccess if the semaphore is received, returns + * KOSA_StatusTimeout if the semaphore is not received within the specified + * 'timeout', returns KOSA_StatusError if any errors occur during waiting. + * + *END**************************************************************************/ +osa_status_t OSA_SemaphoreWait(osa_semaphore_handle_t semaphoreHandle, uint32_t millisec) +{ + uint32_t timeoutTicks; + assert(semaphoreHandle); + rt_sem_t sem = (rt_sem_t)(void *)(uint32_t *)(*(uint32_t *)semaphoreHandle); + + /* Convert timeout from millisecond to tick. */ + if (millisec == osaWaitForever_c) + { + timeoutTicks = RT_WAITING_FOREVER; + } + else + { + timeoutTicks = rt_tick_from_millisecond(millisec); + } + + if (RT_EOK != rt_sem_take(sem, timeoutTicks)) + { + return KOSA_StatusTimeout; /* timeout */ + } + else + { + return KOSA_StatusSuccess; /* semaphore taken */ + } +} + +/*FUNCTION********************************************************************** + * + * Function Name : OSA_SemaphorePost + * Description : This function is used to wake up one task that wating on the + * semaphore. If no task is waiting, increase the semaphore. The function returns + * KOSA_StatusSuccess if the semaphre is post successfully, otherwise returns + * KOSA_StatusError. + * + *END**************************************************************************/ +osa_status_t OSA_SemaphorePost(osa_semaphore_handle_t semaphoreHandle) +{ + assert(semaphoreHandle); + osa_status_t status = KOSA_StatusError; + rt_sem_t sem = (rt_sem_t)(void *)(uint32_t *)(*(uint32_t *)semaphoreHandle); + rt_sem_release(sem); + return KOSA_StatusSuccess; +} + +/*FUNCTION********************************************************************** + * + * Function Name : OSA_MutexCreate + * Description : This function is used to create a mutex. + * Return : Mutex handle of the new mutex, or NULL if failed. + * + *END**************************************************************************/ +osa_status_t OSA_MutexCreate(osa_mutex_handle_t mutexHandle) +{ + assert(sizeof(osa_mutex_handle_t) == OSA_MUTEX_HANDLE_SIZE); + assert(mutexHandle); + + union + { + rt_mutex_t mutex; + uint32_t pmutexHandle; + } xMutexHandle; + + xMutexHandle.mutex = rt_mutex_create("osa_mutex", RT_IPC_FLAG_PRIO); + if (RT_NULL != xMutexHandle.mutex) + { + *(uint32_t *)mutexHandle = xMutexHandle.pmutexHandle; + return KOSA_StatusSuccess; + } + return KOSA_StatusError; +} + +/*FUNCTION********************************************************************** + * + * Function Name : OSA_MutexLock + * Description : This function checks the mutex's status, if it is unlocked, + * lock it and returns KOSA_StatusSuccess, otherwise, wait for the mutex. + * This function returns KOSA_StatusSuccess if the mutex is obtained, returns + * KOSA_StatusError if any errors occur during waiting. If the mutex has been + * locked, pass 0 as timeout will return KOSA_StatusTimeout immediately. + * + *END**************************************************************************/ +osa_status_t OSA_MutexLock(osa_mutex_handle_t mutexHandle, uint32_t millisec) +{ + assert(mutexHandle); + uint32_t timeoutTicks; + rt_mutex_t mutex = (rt_mutex_t)(void *)(uint32_t *)(*(uint32_t *)mutexHandle); + + /* Convert timeout from millisecond to tick. */ + if (millisec == osaWaitForever_c) + { + timeoutTicks = RT_WAITING_FOREVER; + } + else + { + timeoutTicks = rt_tick_from_millisecond(millisec); + } + + if (RT_EOK != rt_mutex_take(mutex, timeoutTicks)) + { + return KOSA_StatusTimeout; /* timeout */ + } + else + { + return KOSA_StatusSuccess; /* semaphore taken */ + } +} + +/*FUNCTION********************************************************************** + * + * Function Name : OSA_MutexUnlock + * Description : This function is used to unlock a mutex. + * + *END**************************************************************************/ +osa_status_t OSA_MutexUnlock(osa_mutex_handle_t mutexHandle) +{ + assert(mutexHandle); + rt_mutex_t mutex = (rt_mutex_t)(void *)(uint32_t *)(*(uint32_t *)mutexHandle); + rt_mutex_release(mutex); + return KOSA_StatusSuccess; +} + +/*FUNCTION********************************************************************** + * + * Function Name : OSA_MutexDestroy + * Description : This function is used to destroy a mutex. + * Return : KOSA_StatusSuccess if the lock object is destroyed successfully, otherwise return KOSA_StatusError. + * + *END**************************************************************************/ +osa_status_t OSA_MutexDestroy(osa_mutex_handle_t mutexHandle) +{ + assert(mutexHandle); + rt_mutex_t mutex = (rt_mutex_t)(void *)(uint32_t *)(*(uint32_t *)mutexHandle); + + rt_mutex_delete(mutex); + return KOSA_StatusSuccess; +} + +/*FUNCTION********************************************************************** + * + * Function Name : OSA_EventCreate + * Description : This function is used to create a event object. + * Return : Event handle of the new event, or NULL if failed. + * + *END**************************************************************************/ +osa_status_t OSA_EventCreate(osa_event_handle_t eventHandle, uint8_t autoClear) +{ + assert(eventHandle); + osa_event_struct_t *pEventStruct = (osa_event_struct_t *)eventHandle; + + pEventStruct->handle = rt_event_create("osa_event", RT_IPC_FLAG_PRIO); + if (RT_NULL != pEventStruct->handle) + { + pEventStruct->autoClear = autoClear; + } + else + { + return KOSA_StatusError; + } + return KOSA_StatusSuccess; +} + +/*FUNCTION********************************************************************** + * + * Function Name : OSA_EventSet + * Description : Set one or more event flags of an event object. + * Return : KOSA_StatusSuccess if set successfully, KOSA_StatusError if failed. + * + *END**************************************************************************/ +osa_status_t OSA_EventSet(osa_event_handle_t eventHandle, osa_event_flags_t flagsToSet) +{ + rt_bool_t taskToWake = RT_FALSE; + rt_err_t result; + assert(eventHandle); + osa_event_struct_t *pEventStruct = (osa_event_struct_t *)eventHandle; + + if (RT_NULL == pEventStruct->handle) + { + return KOSA_StatusError; + } + + rt_event_send(pEventStruct->handle, (rt_uint32_t)flagsToSet); + + (void)result; + return KOSA_StatusSuccess; +} + +/*FUNCTION********************************************************************** + * + * Function Name : OSA_EventClear + * Description : Clear one or more event flags of an event object. + * Return :KOSA_StatusSuccess if clear successfully, KOSA_StatusError if failed. + * + *END**************************************************************************/ +osa_status_t OSA_EventClear(osa_event_handle_t eventHandle, osa_event_flags_t flagsToClear) +{ + assert(eventHandle); + osa_event_struct_t *pEventStruct = (osa_event_struct_t *)eventHandle; + + if (RT_NULL == pEventStruct->handle) + { + return KOSA_StatusError; + } + + rt_uint32_t recved; + rt_event_recv(pEventStruct->handle, (rt_uint32_t)flagsToClear, RT_EVENT_FLAG_OR | RT_EVENT_FLAG_CLEAR, 0, &recved); + + return KOSA_StatusSuccess; +} + +/*FUNCTION********************************************************************** + * + * Function Name : OSA_EventGet + * Description : This function is used to get event's flags that specified by prameter + * flagsMask, and the flags (user specified) are obatianed by parameter pFlagsOfEvent. So + * you should pass the parameter 0xffffffff to specify you want to check all. + * Return :KOSA_StatusSuccess if event flags were successfully got, KOSA_StatusError if failed. + * + *END**************************************************************************/ +osa_status_t OSA_EventGet(osa_event_handle_t eventHandle, osa_event_flags_t flagsMask, osa_event_flags_t *pFlagsOfEvent) +{ + assert(eventHandle); + osa_event_struct_t *pEventStruct = (osa_event_struct_t *)eventHandle; + rt_uint32_t eventFlags; + + if (RT_NULL == pEventStruct->handle) + { + return KOSA_StatusError; + } + + if (RT_NULL == pFlagsOfEvent) + { + return KOSA_StatusError; + } + + if (RT_EOK != rt_event_recv(pEventStruct->handle, (rt_uint32_t)flagsMask, RT_EVENT_FLAG_OR, 0, &eventFlags)) + { + eventFlags = 0; + } + + *pFlagsOfEvent = (osa_event_flags_t)eventFlags & flagsMask; + + return KOSA_StatusSuccess; +} + +/*FUNCTION********************************************************************** + * + * Function Name : OSA_EventWait + * Description : This function checks the event's status, if it meets the wait + * condition, return KOSA_StatusSuccess, otherwise, timeout will be used for + * wait. The parameter timeout indicates how long should wait in milliseconds. + * Pass osaWaitForever_c to wait indefinitely, pass 0 will return the value + * KOSA_StatusTimeout immediately if wait condition is not met. The event flags + * will be cleared if the event is auto clear mode. Flags that wakeup waiting + * task could be obtained from the parameter setFlags. + * This function returns KOSA_StatusSuccess if wait condition is met, returns + * KOSA_StatusTimeout if wait condition is not met within the specified + * 'timeout', returns KOSA_StatusError if any errors occur during waiting. + * + *END**************************************************************************/ +osa_status_t OSA_EventWait(osa_event_handle_t eventHandle, + osa_event_flags_t flagsToWait, + uint8_t waitAll, + uint32_t millisec, + osa_event_flags_t *pSetFlags) +{ + assert(eventHandle); + rt_uint8_t option; + rt_uint32_t timeoutTicks; + rt_uint32_t flagsSave; + osa_event_struct_t *pEventStruct = (osa_event_struct_t *)eventHandle; + + /* Clean FreeRTOS cotrol flags */ + flagsToWait = flagsToWait & 0x00FFFFFFU; + if (RT_NULL == pEventStruct->handle) + { + return KOSA_StatusError; + } + + /* Convert timeout from millisecond to tick. */ + if (millisec == osaWaitForever_c) + { + timeoutTicks = RT_WAITING_FOREVER; + } + else + { + timeoutTicks = rt_tick_from_millisecond(millisec); + } + + if (pEventStruct->autoClear != 0U) + { + option |= RT_EVENT_FLAG_CLEAR; + } + option |= waitAll ? RT_EVENT_FLAG_AND : RT_EVENT_FLAG_AND;\ + + rt_err_t status = rt_event_recv(pEventStruct->handle, (rt_uint32_t)flagsToWait, option, timeoutTicks, &flagsSave); + + flagsSave &= (rt_uint32_t)flagsToWait; + if (RT_NULL != pSetFlags) + { + *pSetFlags = (osa_event_flags_t)flagsSave; + } + + if (RT_EOK != status) + { + return KOSA_StatusSuccess; + } + else + { + return KOSA_StatusTimeout; + } +} + +/*FUNCTION********************************************************************** + * + * Function Name : OSA_EventDestroy + * Description : This function is used to destroy a event object. Return + * KOSA_StatusSuccess if the event object is destroyed successfully, otherwise + * return KOSA_StatusError. + * + *END**************************************************************************/ +osa_status_t OSA_EventDestroy(osa_event_handle_t eventHandle) +{ + assert(eventHandle); + osa_event_struct_t *pEventStruct = (osa_event_struct_t *)eventHandle; + + if (RT_NULL == pEventStruct->handle) + { + return KOSA_StatusError; + } + rt_event_delete(pEventStruct->handle); + return KOSA_StatusSuccess; +} + +/*FUNCTION********************************************************************** + * + * Function Name : OSA_MsgQCreate + * Description : This function is used to create a message queue. + * Return : the handle to the message queue if create successfully, otherwise + * return NULL. + * + *END**************************************************************************/ +osa_status_t OSA_MsgQCreate(osa_msgq_handle_t msgqHandle, uint32_t msgNo, uint32_t msgSize) +{ + assert(sizeof(osa_msgq_handle_t) == OSA_MSGQ_HANDLE_SIZE); + assert(msgqHandle); + + union + { + rt_mq_t msgq; + uint32_t pmsgqHandle; + } xMsgqHandle; + + /* Create the message queue where the number and size is specified by msgNo and msgSize */ + xMsgqHandle.msgq = rt_mq_create("osa_mq", msgSize, msgNo, RT_IPC_FLAG_PRIO); + if (RT_NULL != xMsgqHandle.msgq) + { + *(uint32_t *)msgqHandle = xMsgqHandle.pmsgqHandle; + return KOSA_StatusSuccess; + } + return KOSA_StatusError; +} + +/*FUNCTION********************************************************************** + * + * Function Name : OSA_MsgQPut + * Description : This function is used to put a message to a message queue. + * Return : KOSA_StatusSuccess if the message is put successfully, otherwise return KOSA_StatusError. + * + *END**************************************************************************/ +osa_status_t OSA_MsgQPut(osa_msgq_handle_t msgqHandle, osa_msg_handle_t pMessage) +{ + assert(msgqHandle); + rt_bool_t taskToWake = RT_FALSE; + rt_mq_t handler = (rt_mq_t)(void *)(uint32_t *)(*(uint32_t *)msgqHandle); + + if (RT_EOK == rt_mq_send(handler, pMessage, handler->msg_size)) + { + return KOSA_StatusSuccess; + } + else + { + return KOSA_StatusError; + } +} + +/*FUNCTION********************************************************************** + * + * Function Name : OSA_MsgQGet + * Description : This function checks the queue's status, if it is not empty, + * get message from it and return KOSA_StatusSuccess, otherwise, timeout will + * be used for wait. The parameter timeout indicates how long should wait in + * milliseconds. Pass osaWaitForever_c to wait indefinitely, pass 0 will return + * KOSA_StatusTimeout immediately if queue is empty. + * This function returns KOSA_StatusSuccess if message is got successfully, + * returns KOSA_StatusTimeout if message queue is empty within the specified + * 'timeout', returns KOSA_StatusError if any errors occur during waiting. + * + *END**************************************************************************/ +osa_status_t OSA_MsgQGet(osa_msgq_handle_t msgqHandle, osa_msg_handle_t pMessage, uint32_t millisec) +{ + osa_status_t osaStatus; + assert(msgqHandle); + rt_mq_t handler = (rt_mq_t)(void *)(uint32_t *)(*(uint32_t *)msgqHandle); + + uint32_t timeoutTicks; + + if (millisec == osaWaitForever_c) + { + timeoutTicks = RT_WAITING_FOREVER; + } + else + { + timeoutTicks = rt_tick_from_millisecond(millisec); + } + if (RT_EOK != rt_mq_recv(handler, pMessage, handler->msg_size, timeoutTicks)) + { + osaStatus = KOSA_StatusTimeout; /* not able to send it to the queue? */ + } + else + { + osaStatus = KOSA_StatusSuccess; + } + return osaStatus; +} + +/*FUNCTION********************************************************************** + * + * Function Name : OSA_MsgQDestroy + * Description : This function is used to destroy the message queue. + * Return : KOSA_StatusSuccess if the message queue is destroyed successfully, otherwise return KOSA_StatusError. + * + *END**************************************************************************/ +osa_status_t OSA_MsgQDestroy(osa_msgq_handle_t msgqHandle) +{ + assert(msgqHandle); + rt_mq_t handler = (rt_mq_t)(void *)(uint32_t *)(*(uint32_t *)msgqHandle); + + rt_mq_delete(handler); + return KOSA_StatusSuccess; +} + +/*FUNCTION********************************************************************** + * + * Function Name : OSA_InterruptEnable + * Description : self explanatory. + * + *END**************************************************************************/ +void OSA_InterruptEnable(void) +{ + rt_exit_critical(); +} + +/*FUNCTION********************************************************************** + * + * Function Name : OSA_InterruptDisable + * Description : self explanatory. + * + *END**************************************************************************/ +void OSA_InterruptDisable(void) +{ + rt_enter_critical(); +} + +/*FUNCTION********************************************************************** + * + * Function Name : OSA_EnableIRQGlobal + * Description : enable interrupts using PRIMASK register. + * + *END**************************************************************************/ +void OSA_EnableIRQGlobal(void) +{ + if (s_osaState.interruptDisableCount > 0U) + { + s_osaState.interruptDisableCount--; + + if (0U == s_osaState.interruptDisableCount) + { + __enable_irq(); + } + /* call core API to enable the global interrupt*/ + } +} + +/*FUNCTION********************************************************************** + * + * Function Name : OSA_DisableIRQGlobal + * Description : disable interrupts using PRIMASK register. + * + *END**************************************************************************/ +void OSA_DisableIRQGlobal(void) +{ + /* call core API to disable the global interrupt*/ + __disable_irq(); + + /* update counter*/ + s_osaState.interruptDisableCount++; +} + +/*FUNCTION********************************************************************** + * + * Function Name : OSA_InstallIntHandler + * Description : This function is used to install interrupt handler. + * + *END**************************************************************************/ +void OSA_InstallIntHandler(uint32_t IRQNumber, void (*handler)(void)) +{ +#if defined(__IAR_SYSTEMS_ICC__) + _Pragma("diag_suppress = Pm138") +#endif +#if defined(ENABLE_RAM_VECTOR_TABLE) + (void) InstallIRQHandler((IRQn_Type)IRQNumber, (uint32_t) * (uint32_t *)&handler); +#endif /* ENABLE_RAM_VECTOR_TABLE. */ +#if defined(__IAR_SYSTEMS_ICC__) + _Pragma("diag_remark = PM138") +#endif +} + +/*!********************************************************************************* +************************************************************************************* +* Private functions +************************************************************************************* +********************************************************************************** */ +#if (defined(FSL_OSA_TASK_ENABLE) && (FSL_OSA_TASK_ENABLE > 0U)) + +static OSA_TASK_DEFINE(startup_task, gMainThreadPriority_c, 1, gMainThreadStackSize_c, 0); + +int main(void) +{ + extern void BOARD_InitHardware(void); + /* Initialize MCU clock */ + BOARD_InitHardware(); + LIST_Init((&s_osaState.taskList), 0); + + s_osaState.basePriorityNesting = 0; + s_osaState.interruptDisableCount = 0; + (void)OSA_TaskCreate((osa_task_handle_t)s_osaState.mainTaskHandle, OSA_TASK(startup_task), NULL); + + vTaskStartScheduler(); + return 0; +} +#endif /* FSL_OSA_TASK_ENABLE */ diff --git a/bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/drivers/fsl_os_abstraction_rtthread.h b/bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/drivers/fsl_os_abstraction_rtthread.h new file mode 100644 index 0000000000..40bd24271a --- /dev/null +++ b/bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/drivers/fsl_os_abstraction_rtthread.h @@ -0,0 +1,130 @@ +/*! ********************************************************************************* + * Copyright (c) 2013-2014, Freescale Semiconductor, Inc. + * Copyright 2016-2017 NXP + * All rights reserved. + * + * ile + * + * SPDX-License-Identifier: BSD-3-Clause + ********************************************************************************** */ +#if !defined(__FSL_OS_ABSTRACTION_RTTHREAD_H__) +#define __FSL_OS_ABSTRACTION_RTTHREAD_H__ + +#if defined(__IAR_SYSTEMS_ICC__) +/** + * Workaround to disable MISRA C message suppress warnings for IAR compiler. + */ +// http://supp.iar.com/Support/?note=24725 + +#define MISRAC_DISABLE \ + _Pragma( \ + "diag_suppress= \ + Pm001,Pm002,Pm003,Pm004,Pm005,Pm006,Pm007,Pm008,Pm009,Pm010,Pm011,\ + Pm012,Pm013,Pm014,Pm015,Pm016,Pm017,Pm018,Pm019,Pm020,Pm021,Pm022,\ + Pm023,Pm024,Pm025,Pm026,Pm027,Pm028,Pm029,Pm030,Pm031,Pm032,Pm033,\ + Pm034,Pm035,Pm036,Pm037,Pm038,Pm039,Pm040,Pm041,Pm042,Pm043,Pm044,\ + Pm045,Pm046,Pm047,Pm048,Pm049,Pm050,Pm051,Pm052,Pm053,Pm054,Pm055,\ + Pm056,Pm057,Pm058,Pm059,Pm060,Pm061,Pm062,Pm063,Pm064,Pm065,Pm066,\ + Pm067,Pm068,Pm069,Pm070,Pm071,Pm072,Pm073,Pm074,Pm075,Pm076,Pm077,\ + Pm078,Pm079,Pm080,Pm081,Pm082,Pm083,Pm084,Pm085,Pm086,Pm087,Pm088,\ + Pm089,Pm090,Pm091,Pm092,Pm093,Pm094,Pm095,Pm096,Pm097,Pm098,Pm099,\ + Pm100,Pm101,Pm102,Pm103,Pm104,Pm105,Pm106,Pm107,Pm108,Pm109,Pm110,\ + Pm111,Pm112,Pm113,Pm114,Pm115,Pm116,Pm117,Pm118,Pm119,Pm120,Pm121,\ + Pm122,Pm123,Pm124,Pm125,Pm126,Pm127,Pm128,Pm129,Pm130,Pm131,Pm132,\ + Pm133,Pm134,Pm135,Pm136,Pm137,Pm138,Pm139,Pm140,Pm141,Pm142,Pm143,\ + Pm144,Pm145,Pm146,Pm147,Pm148,Pm149,Pm150,Pm151,Pm152,Pm153,Pm154,\ + Pm155") + +#define MISRAC_ENABLE \ + _Pragma( \ + "diag_default= \ + Pm001,Pm002,Pm003,Pm004,Pm005,Pm006,Pm007,Pm008,Pm009,Pm010,Pm011,\ + Pm012,Pm013,Pm014,Pm015,Pm016,Pm017,Pm018,Pm019,Pm020,Pm021,Pm022,\ + Pm023,Pm024,Pm025,Pm026,Pm027,Pm028,Pm029,Pm030,Pm031,Pm032,Pm033,\ + Pm034,Pm035,Pm036,Pm037,Pm038,Pm039,Pm040,Pm041,Pm042,Pm043,Pm044,\ + Pm045,Pm046,Pm047,Pm048,Pm049,Pm050,Pm051,Pm052,Pm053,Pm054,Pm055,\ + Pm056,Pm057,Pm058,Pm059,Pm060,Pm061,Pm062,Pm063,Pm064,Pm065,Pm066,\ + Pm067,Pm068,Pm069,Pm070,Pm071,Pm072,Pm073,Pm074,Pm075,Pm076,Pm077,\ + Pm078,Pm079,Pm080,Pm081,Pm082,Pm083,Pm084,Pm085,Pm086,Pm087,Pm088,\ + Pm089,Pm090,Pm091,Pm092,Pm093,Pm094,Pm095,Pm096,Pm097,Pm098,Pm099,\ + Pm100,Pm101,Pm102,Pm103,Pm104,Pm105,Pm106,Pm107,Pm108,Pm109,Pm110,\ + Pm111,Pm112,Pm113,Pm114,Pm115,Pm116,Pm117,Pm118,Pm119,Pm120,Pm121,\ + Pm122,Pm123,Pm124,Pm125,Pm126,Pm127,Pm128,Pm129,Pm130,Pm131,Pm132,\ + Pm133,Pm134,Pm135,Pm136,Pm137,Pm138,Pm139,Pm140,Pm141,Pm142,Pm143,\ + Pm144,Pm145,Pm146,Pm147,Pm148,Pm149,Pm150,Pm151,Pm152,Pm153,Pm154,\ + Pm155") +#else +/* Empty MISRA C macros for other toolchains. */ +#define MISRAC_DISABLE +#define MISRAC_ENABLE +#endif + +MISRAC_DISABLE +#include +MISRAC_ENABLE + +/*! + * @addtogroup os_abstraction_free_rtos + * @{ + */ + +/******************************************************************************* + * Declarations + ******************************************************************************/ +/*! @brief Type for a task handler, returned by the OSA_TaskCreate function. */ +typedef rt_thread_t task_handler_t; + +/*! @brief Type for a task stack.*/ +typedef rt_uint32_t task_stack_t; + +/*! @brief Type for task parameter */ +typedef void *task_param_t; + +/*! @brief Type for an event flags object.*/ +typedef rt_uint32_t event_flags_t; + +/*! @brief Constant to pass as timeout value in order to wait indefinitely. */ +#define OSA_WAIT_FOREVER 0xFFFFFFFFU + +/*! @brief OSA's time range in millisecond, OSA time wraps if exceeds this value. */ +#define FSL_OSA_TIME_RANGE 0xFFFFFFFFU + +/*! @brief The default interrupt handler installed in vector table. */ +#define OSA_DEFAULT_INT_HANDLER ((osa_int_handler_t)(&DefaultISR)) + +extern void DefaultISR(void); + +/*! + * @name Thread management + * @{ + */ + +/*! + * @brief To provide unified task piority for upper layer, OSA layer makes conversion. + */ +#define PRIORITY_OSA_TO_RTOS(osa_prio) ((UBaseType_t)configMAX_PRIORITIES - (osa_prio)-2U) +#define PRIORITY_RTOS_TO_OSA(rtos_prio) ((UBaseType_t)configMAX_PRIORITIES - (rtos_prio)-2U) + +/* @}*/ + +/*! + * @name Message queues + * @{ + */ + +/*! + * @brief This macro statically reserves the memory required for the queue. + * + * @param name Identifier for the memory region. + * @param number Number of elements in the queue. + * @param size Size of every elements in words. + */ +#define MSG_QUEUE_DECLARE(name, number, size) msg_queue_t *name = NULL + +/* @}*/ + +/*! @}*/ +/*! @}*/ +/*! @}*/ + +#endif // __FSL_OS_ABSTRACTION_RTTHREAD_H__ diff --git a/bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/drivers/generic_list.c b/bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/drivers/generic_list.c new file mode 100644 index 0000000000..80dd21425d --- /dev/null +++ b/bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/drivers/generic_list.c @@ -0,0 +1,475 @@ +/* + * Copyright 2018-2019 NXP + * All rights reserved. + * + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +/*! ********************************************************************************* +************************************************************************************* +* Include +************************************************************************************* +********************************************************************************** */ +#include "generic_list.h" + +static list_status_t LIST_Error_Check(list_handle_t list, list_element_handle_t newElement) +{ + list_status_t listStatus = kLIST_Ok; + list_element_handle_t element = list->head; + + if ((list->max != 0U) && (list->max == list->size)) + { + listStatus = kLIST_Full; /*List is full*/ + } + else + { + while (element != NULL) /*Scan list*/ + { + /* Determine if element is duplicated */ + if (element == newElement) + { + listStatus = kLIST_DuplicateError; + break; + } + element = element->next; + } + } + + return listStatus; +} + +/*! ********************************************************************************* +************************************************************************************* +* Public functions +************************************************************************************* +********************************************************************************** */ +/*! ********************************************************************************* + * \brief Initialises the list descriptor. + * + * \param[in] list - LIST_ handle to init. + * max - Maximum number of elements in list. 0 for unlimited. + * + * \return void. + * + * \pre + * + * \post + * + * \remarks + * + ********************************************************************************** */ +void LIST_Init(list_handle_t list, uint32_t max) +{ + list->head = NULL; + list->tail = NULL; + list->max = (uint16_t)max; + list->size = 0; +} + +/*! ********************************************************************************* + * \brief Gets the list that contains the given element. + * + * \param[in] element - Handle of the element. + * + * \return NULL if element is orphan. + * Handle of the list the element is inserted into. + * + * \pre + * + * \post + * + * \remarks + * + ********************************************************************************** */ +list_handle_t LIST_GetList(list_element_handle_t element) +{ + return element->list; +} + +/*! ********************************************************************************* + * \brief Links element to the tail of the list. + * + * \param[in] list - ID of list to insert into. + * element - element to add + * + * \return kLIST_Full if list is full. + * kLIST_Ok if insertion was successful. + * + * \pre + * + * \post + * + * \remarks + * + ********************************************************************************** */ +list_status_t LIST_AddTail(list_handle_t list, list_element_handle_t element) +{ + uint32_t regPrimask = DisableGlobalIRQ(); + list_status_t listStatus = kLIST_Ok; + + listStatus = LIST_Error_Check(list, element); + if (listStatus == kLIST_Ok) /* Avoiding list status error */ + { + if (list->size == 0U) + { + list->head = element; + } + else + { + list->tail->next = element; + } +#if (defined(GENERIC_LIST_LIGHT) && (GENERIC_LIST_LIGHT > 0U)) +#else + element->prev = list->tail; +#endif + element->list = list; + element->next = NULL; + list->tail = element; + list->size++; + } + + EnableGlobalIRQ(regPrimask); + return listStatus; +} + +/*! ********************************************************************************* + * \brief Links element to the head of the list. + * + * \param[in] list - ID of list to insert into. + * element - element to add + * + * \return kLIST_Full if list is full. + * kLIST_Ok if insertion was successful. + * + * \pre + * + * \post + * + * \remarks + * + ********************************************************************************** */ +list_status_t LIST_AddHead(list_handle_t list, list_element_handle_t element) +{ + uint32_t regPrimask = DisableGlobalIRQ(); + list_status_t listStatus = kLIST_Ok; + + listStatus = LIST_Error_Check(list, element); + if (listStatus == kLIST_Ok) /* Avoiding list status error */ + { + /* Links element to the head of the list */ + if (list->size == 0U) + { + list->tail = element; + } +#if (defined(GENERIC_LIST_LIGHT) && (GENERIC_LIST_LIGHT > 0U)) +#else + else + { + list->head->prev = element; + } + element->prev = NULL; +#endif + element->list = list; + element->next = list->head; + list->head = element; + list->size++; + } + + EnableGlobalIRQ(regPrimask); + return listStatus; +} + +/*! ********************************************************************************* + * \brief Unlinks element from the head of the list. + * + * \param[in] list - ID of list to remove from. + * + * \return NULL if list is empty. + * ID of removed element(pointer) if removal was successful. + * + * \pre + * + * \post + * + * \remarks + * + ********************************************************************************** */ +list_element_handle_t LIST_RemoveHead(list_handle_t list) +{ + list_element_handle_t element; + + uint32_t regPrimask = DisableGlobalIRQ(); + + if ((NULL == list) || (list->size == 0U)) + { + element = NULL; /*LIST_ is empty*/ + } + else + { + element = list->head; + list->size--; + if (list->size == 0U) + { + list->tail = NULL; + } +#if (defined(GENERIC_LIST_LIGHT) && (GENERIC_LIST_LIGHT > 0U)) +#else + else + { + element->next->prev = NULL; + } +#endif + element->list = NULL; + list->head = element->next; /*Is NULL if element is head*/ + } + + EnableGlobalIRQ(regPrimask); + return element; +} + +/*! ********************************************************************************* + * \brief Gets head element ID. + * + * \param[in] list - ID of list. + * + * \return NULL if list is empty. + * ID of head element if list is not empty. + * + * \pre + * + * \post + * + * \remarks + * + ********************************************************************************** */ +list_element_handle_t LIST_GetHead(list_handle_t list) +{ + return list->head; +} + +/*! ********************************************************************************* + * \brief Gets next element ID. + * + * \param[in] element - ID of the element. + * + * \return NULL if element is tail. + * ID of next element if exists. + * + * \pre + * + * \post + * + * \remarks + * + ********************************************************************************** */ +list_element_handle_t LIST_GetNext(list_element_handle_t element) +{ + return element->next; +} + +/*! ********************************************************************************* + * \brief Gets previous element ID. + * + * \param[in] element - ID of the element. + * + * \return NULL if element is head. + * ID of previous element if exists. + * + * \pre + * + * \post + * + * \remarks + * + ********************************************************************************** */ +list_element_handle_t LIST_GetPrev(list_element_handle_t element) +{ +#if (defined(GENERIC_LIST_LIGHT) && (GENERIC_LIST_LIGHT > 0U)) + return NULL; +#else + return element->prev; +#endif +} + +/*! ********************************************************************************* + * \brief Unlinks an element from its list. + * + * \param[in] element - ID of the element to remove. + * + * \return kLIST_OrphanElement if element is not part of any list. + * kLIST_Ok if removal was successful. + * + * \pre + * + * \post + * + * \remarks + * + ********************************************************************************** */ +list_status_t LIST_RemoveElement(list_element_handle_t element) +{ + list_status_t listStatus = kLIST_Ok; + uint32_t regPrimask = DisableGlobalIRQ(); + + if (element->list == NULL) + { + listStatus = kLIST_OrphanElement; /*Element was previusly removed or never added*/ + } + else + { +#if (defined(GENERIC_LIST_LIGHT) && (GENERIC_LIST_LIGHT > 0U)) + list_element_handle_t element_list = element->list->head; + while (element_list) + { + if (element->list->head == element) + { + element->list->head = element_list->next; + break; + } + if (element_list->next == element) + { + element_list->next = element->next; + break; + } + element_list = element_list->next; + } +#else + if (element->prev == NULL) /*Element is head or solo*/ + { + element->list->head = element->next; /*is null if solo*/ + } + if (element->next == NULL) /*Element is tail or solo*/ + { + element->list->tail = element->prev; /*is null if solo*/ + } + if (element->prev != NULL) /*Element is not head*/ + { + element->prev->next = element->next; + } + if (element->next != NULL) /*Element is not tail*/ + { + element->next->prev = element->prev; + } +#endif + element->list->size--; + element->list = NULL; + } + + EnableGlobalIRQ(regPrimask); + return listStatus; +} + +/*! ********************************************************************************* + * \brief Links an element in the previous position relative to a given member + * of a list. + * + * \param[in] element - ID of a member of a list. + * newElement - new element to insert before the given member. + * + * \return kLIST_OrphanElement if element is not part of any list. + * kLIST_Full if list is full. + * kLIST_Ok if insertion was successful. + * + * \pre + * + * \post + * + * \remarks + * + ********************************************************************************** */ +list_status_t LIST_AddPrevElement(list_element_handle_t element, list_element_handle_t newElement) +{ + list_status_t listStatus = kLIST_Ok; + uint32_t regPrimask = DisableGlobalIRQ(); + + if (element->list == NULL) + { + listStatus = kLIST_OrphanElement; /*Element was previusly removed or never added*/ + } + else + { + listStatus = LIST_Error_Check(element->list, newElement); + if (listStatus == kLIST_Ok) + { +#if (defined(GENERIC_LIST_LIGHT) && (GENERIC_LIST_LIGHT > 0U)) + list_element_handle_t element_list = element->list->head; + while (element_list) + { + if ((element_list->next == element) || (element_list == element)) + { + if (element_list == element) + { + element->list->head = newElement; + } + else + { + element_list->next = newElement; + } + newElement->list = element->list; + newElement->next = element; + element->list->size++; + break; + } + element_list = element_list->next; + } + +#else + if (element->prev == NULL) /*Element is list head*/ + { + element->list->head = newElement; + } + else + { + element->prev->next = newElement; + } + newElement->list = element->list; + element->list->size++; + newElement->next = element; + newElement->prev = element->prev; + element->prev = newElement; +#endif + } + } + + EnableGlobalIRQ(regPrimask); + return listStatus; +} + +/*! ********************************************************************************* + * \brief Gets the current size of a list. + * + * \param[in] list - ID of the list. + * + * \return Current size of the list. + * + * \pre + * + * \post + * + * \remarks + * + ********************************************************************************** */ +uint32_t LIST_GetSize(list_handle_t list) +{ + return list->size; +} + +/*! ********************************************************************************* + * \brief Gets the number of free places in the list. + * + * \param[in] list - ID of the list. + * + * \return Available size of the list. + * + * \pre + * + * \post + * + * \remarks + * + ********************************************************************************** */ +uint32_t LIST_GetAvailableSize(list_handle_t list) +{ + return ((uint32_t)list->max - (uint32_t)list->size); /*Gets the number of free places in the list*/ +} diff --git a/bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/drivers/generic_list.h b/bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/drivers/generic_list.h new file mode 100644 index 0000000000..def00efe8e --- /dev/null +++ b/bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/drivers/generic_list.h @@ -0,0 +1,203 @@ +/* + * Copyright 2018-2020 NXP + * All rights reserved. + * + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef _GENERIC_LIST_H_ +#define _GENERIC_LIST_H_ + +#include "fsl_common.h" +/*! + * @addtogroup GenericList + * @{ + */ + +/*!********************************************************************************* +************************************************************************************* +* Include +************************************************************************************* +********************************************************************************** */ + +/*! ********************************************************************************* +************************************************************************************* +* Public macro definitions +************************************************************************************* +********************************************************************************** */ +#ifndef GENERIC_LIST_LIGHT +#define GENERIC_LIST_LIGHT (0) +#endif +/*! ********************************************************************************* +************************************************************************************* +* Public type definitions +************************************************************************************* +********************************************************************************** */ +/*! @brief The list status */ +typedef enum _list_status +{ + kLIST_Ok = kStatus_Success, /*!< Success */ + kLIST_DuplicateError = MAKE_STATUS(kStatusGroup_LIST, 1), /*!< Duplicate Error */ + kLIST_Full = MAKE_STATUS(kStatusGroup_LIST, 2), /*!< FULL */ + kLIST_Empty = MAKE_STATUS(kStatusGroup_LIST, 3), /*!< Empty */ + kLIST_OrphanElement = MAKE_STATUS(kStatusGroup_LIST, 4), /*!< Orphan Element */ + kLIST_NotSupport = MAKE_STATUS(kStatusGroup_LIST, 5), /*!< Not Support */ +} list_status_t; + +/*! @brief The list structure*/ +typedef struct list_label +{ + struct list_element_tag *head; /*!< list head */ + struct list_element_tag *tail; /*!< list tail */ + uint16_t size; /*!< list size */ + uint16_t max; /*!< list max number of elements */ +} list_label_t, *list_handle_t; +#if (defined(GENERIC_LIST_LIGHT) && (GENERIC_LIST_LIGHT > 0U)) +/*! @brief The list element*/ +typedef struct list_element_tag +{ + struct list_element_tag *next; /*!< next list element */ + struct list_label *list; /*!< pointer to the list */ +} list_element_t, *list_element_handle_t; +#else +/*! @brief The list element*/ +typedef struct list_element_tag +{ + struct list_element_tag *next; /*!< next list element */ + struct list_element_tag *prev; /*!< previous list element */ + struct list_label *list; /*!< pointer to the list */ +} list_element_t, *list_element_handle_t; +#endif +/*! ********************************************************************************* +************************************************************************************* +* Public prototypes +************************************************************************************* +********************************************************************************** */ +/******************************************************************************* + * API + ******************************************************************************/ + +#if defined(__cplusplus) +extern "C" { +#endif /* _cplusplus */ +/*! + * @brief Initialize the list. + * + * This function initialize the list. + * + * @param list - List handle to initialize. + * @param max - Maximum number of elements in list. 0 for unlimited. + */ +void LIST_Init(list_handle_t list, uint32_t max); + +/*! + * @brief Gets the list that contains the given element. + * + * + * @param element - Handle of the element. + * @retval NULL if element is orphan, Handle of the list the element is inserted into. + */ +list_handle_t LIST_GetList(list_element_handle_t element); + +/*! + * @brief Links element to the head of the list. + * + * @param list - Handle of the list. + * @param element - Handle of the element. + * @retval kLIST_Full if list is full, kLIST_Ok if insertion was successful. + */ +list_status_t LIST_AddHead(list_handle_t list, list_element_handle_t element); + +/*! + * @brief Links element to the tail of the list. + * + * @param list - Handle of the list. + * @param element - Handle of the element. + * @retval kLIST_Full if list is full, kLIST_Ok if insertion was successful. + */ +list_status_t LIST_AddTail(list_handle_t list, list_element_handle_t element); + +/*! + * @brief Unlinks element from the head of the list. + * + * @param list - Handle of the list. + * + * @retval NULL if list is empty, handle of removed element(pointer) if removal was successful. + */ +list_element_handle_t LIST_RemoveHead(list_handle_t list); + +/*! + * @brief Gets head element handle. + * + * @param list - Handle of the list. + * + * @retval NULL if list is empty, handle of removed element(pointer) if removal was successful. + */ +list_element_handle_t LIST_GetHead(list_handle_t list); + +/*! + * @brief Gets next element handle for given element handle. + * + * @param element - Handle of the element. + * + * @retval NULL if list is empty, handle of removed element(pointer) if removal was successful. + */ +list_element_handle_t LIST_GetNext(list_element_handle_t element); + +/*! + * @brief Gets previous element handle for given element handle. + * + * @param element - Handle of the element. + * + * @retval NULL if list is empty, handle of removed element(pointer) if removal was successful. + */ +list_element_handle_t LIST_GetPrev(list_element_handle_t element); + +/*! + * @brief Unlinks an element from its list. + * + * @param element - Handle of the element. + * + * @retval kLIST_OrphanElement if element is not part of any list. + * @retval kLIST_Ok if removal was successful. + */ +list_status_t LIST_RemoveElement(list_element_handle_t element); + +/*! + * @brief Links an element in the previous position relative to a given member of a list. + * + * @param list - Handle of the list. + * @param element - Handle of the element. + * @param newElement - New element to insert before the given member. + * + * @retval kLIST_OrphanElement if element is not part of any list. + * @retval kLIST_Ok if removal was successful. + */ +list_status_t LIST_AddPrevElement(list_element_handle_t element, list_element_handle_t newElement); + +/*! + * @brief Gets the current size of a list. + * + * @param list - Handle of the list. + * + * @retval Current size of the list. + */ +uint32_t LIST_GetSize(list_handle_t list); + +/*! + * @brief Gets the number of free places in the list. + * + * @param list - Handle of the list. + * + * @retval Available size of the list. + */ +uint32_t LIST_GetAvailableSize(list_handle_t list); + +/* @} */ + +#if defined(__cplusplus) +} +#endif +/*! @}*/ +#endif /*_GENERIC_LIST_H_*/ diff --git a/bsp/imxrt/libraries/drivers/drv_pulse_encoder.c b/bsp/imxrt/libraries/drivers/drv_pulse_encoder.c new file mode 100644 index 0000000000..176508ce48 --- /dev/null +++ b/bsp/imxrt/libraries/drivers/drv_pulse_encoder.c @@ -0,0 +1,160 @@ +/* + * Copyright (c) 2006-2018, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2019-08-23 balanceTWK first version + * 2021-01-19 Leslie Lee port to imxrt series + */ + +#include +#include +#ifdef BSP_USING_PULSE_ENCODER + +#include "fsl_common.h" +#include "fsl_enc.h" + +#define LOG_TAG "drv.pulse_encoder" +#include + +#if !defined(BSP_USING_PULSE_ENCODER1) && !defined(BSP_USING_PULSE_ENCODER2) && !defined(BSP_USING_PULSE_ENCODER3) \ + && !defined(BSP_USING_PULSE_ENCODER4) + #error "Please define at least one BSP_USING_PULSE_ENCODERx" + /* this driver can be disabled at menuconfig → RT-Thread Components → Device Drivers */ +#elif (defined(BSP_USING_PULSE_ENCODER2) || defined(BSP_USING_PULSE_ENCODER3) || defined(BSP_USING_PULSE_ENCODER4)) || defined(SOC_IMXRT1015_SERIES) + #error "IMXRT1015 had only one quadrature decoder module" +#elif (defined(BSP_USING_PULSE_ENCODER3) || defined(BSP_USING_PULSE_ENCODER4)) || defined(SOC_IMXRT1020_SERIES) + #error "IMXRT1020 had only two quadrature decoder module" +#endif + +enum +{ +#ifdef BSP_USING_PULSE_ENCODER1 + PULSE_ENCODER1_INDEX, +#endif +#ifdef BSP_USING_PULSE_ENCODER2 + PULSE_ENCODER2_INDEX, +#endif +#ifdef BSP_USING_PULSE_ENCODER3 + PULSE_ENCODER3_INDEX, +#endif +#ifdef BSP_USING_PULSE_ENCODER4 + PULSE_ENCODER4_INDEX, +#endif +}; + +struct imxrt_pulse_encoder_device +{ + struct rt_pulse_encoder_device pulse_encoder; + ENC_Type *base; + char *name; +}; +typedef struct imxrt_pulse_encoder_device imxrt_pulse_enccoder_device_t; + +static imxrt_pulse_enccoder_device_t imxrt_pulse_encoder_obj[] = +{ +#ifdef BSP_USING_PULSE_ENCODER1 + { + .base = ENC1, + .name = "pulse1" + }, +#endif +#ifdef BSP_USING_PULSE_ENCODER2 + { + .base = ENC2, + .name = "pulse2" + }, +#endif +#ifdef BSP_USING_PULSE_ENCODER3 + { + .base = ENC3, + .name = "pulse3" + }, +#endif +#ifdef BSP_USING_PULSE_ENCODER4 + { + .base = ENC4, + .name = "pulse4" + }, +#endif +}; + + + +rt_err_t pulse_encoder_init(struct rt_pulse_encoder_device *pulse_encoder) +{ + ENC_Type *base = ((imxrt_pulse_enccoder_device_t *)(pulse_encoder->parent.user_data))->base; + enc_config_t enc_config; + ENC_GetDefaultConfig(&enc_config); + ENC_Init(base, &enc_config); + ENC_DoSoftwareLoadInitialPositionValue(base); /* Update the position counter with initial value. */ + return RT_EOK; +} + +rt_err_t pulse_encoder_clear_count(struct rt_pulse_encoder_device *pulse_encoder) +{ + ENC_SetInitialPositionValue(((imxrt_pulse_enccoder_device_t *)(pulse_encoder->parent.user_data))->base, 0); + return RT_EOK; +} + +rt_int32_t pulse_encoder_get_count(struct rt_pulse_encoder_device *pulse_encoder) +{ + return (rt_int32_t)ENC_GetPositionValue(((imxrt_pulse_enccoder_device_t *)(pulse_encoder->parent.user_data))->base); +} + +rt_err_t pulse_encoder_control(struct rt_pulse_encoder_device *pulse_encoder, rt_uint32_t cmd, void *args) +{ + rt_err_t result; + + result = RT_EOK; + + switch (cmd) + { + case PULSE_ENCODER_CMD_ENABLE: + result = pulse_encoder->ops->init(pulse_encoder); + break; + case PULSE_ENCODER_CMD_DISABLE: + ENC_Deinit(((imxrt_pulse_enccoder_device_t *)(pulse_encoder->parent.user_data))->base); + break; + default: + result = -RT_ENOSYS; + break; + } + + return result; +} + +static const struct rt_pulse_encoder_ops _ops = +{ + .init = pulse_encoder_init, + .get_count = pulse_encoder_get_count, + .clear_count = pulse_encoder_clear_count, + .control = pulse_encoder_control, +}; + +int rt_hw_pulse_encoder_init(void) +{ + int i; + int result; + + result = RT_EOK; + for (i = 0; i < sizeof(imxrt_pulse_encoder_obj) / sizeof(imxrt_pulse_encoder_obj[0]); i++) + { + imxrt_pulse_encoder_obj[i].pulse_encoder.type = AB_PHASE_PULSE_ENCODER; + imxrt_pulse_encoder_obj[i].pulse_encoder.ops = &_ops; + imxrt_pulse_encoder_obj[i].pulse_encoder.parent.user_data = &(imxrt_pulse_encoder_obj[i]); + + if (rt_device_pulse_encoder_register(&imxrt_pulse_encoder_obj[i].pulse_encoder, imxrt_pulse_encoder_obj[i].name, &imxrt_pulse_encoder_obj[i]) != RT_EOK) + { + LOG_E("%s register failed", imxrt_pulse_encoder_obj[i].name); + result = -RT_ERROR; + } + } + + return result; +} +INIT_BOARD_EXPORT(rt_hw_pulse_encoder_init); + +#endif diff --git a/bsp/imxrt/libraries/drivers/drv_usbh.c b/bsp/imxrt/libraries/drivers/drv_usbh.c new file mode 100644 index 0000000000..150d87d6e0 --- /dev/null +++ b/bsp/imxrt/libraries/drivers/drv_usbh.c @@ -0,0 +1,616 @@ +/* + * Copyright (c) 2006-2018, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2017-10-30 ZYH the first version + * 2019-12-19 tyustli port to stm32 series + * 2021-01-19 Leslie Lee port to imxrt series + */ +#include + +#ifdef BSP_USING_USB_HOST +#include "drv_usbh.h" +#include +#include +#include +#include +#include +#include + + +/* USB PHY configuration */ +#ifndef BOARD_USB_PHY_D_CAL +#define BOARD_USB_PHY_D_CAL (0x0CU) +#endif +#ifndef BOARD_USB_PHY_TXCAL45DP +#define BOARD_USB_PHY_TXCAL45DP (0x06U) +#endif +#ifndef BOARD_USB_PHY_TXCAL45DM +#define BOARD_USB_PHY_TXCAL45DM (0x06U) +#endif + +enum +{ +#ifdef BSP_USB0_HOST + USBH0_INDEX, +#endif +#ifdef BSP_USB1_HOST + USBH1_INDEX, +#endif +}; + +struct imxrt_usb_host_pipe +{ + usb_host_pipe_handle pipe_handle; + struct rt_completion urb_completion; + usb_status_t transfer_status; +} + +struct imxrt_usb_host +{ + struct uhcd uhcd; + usb_host_handle host_handle; + usb_device_handle device_handle; + struct imxrt_usb_host_pipe pipes[16]; + volatile rt_bool_t connect_status; + char *name; +}; + +static struct imxrt_usb_host imxrt_usb_host_obj[] = +{ +#ifdef BSP_USB0_HOST + { + .connect_status = RT_FALSE, + .name = "usbh0" + }, +#endif +#ifdef BSP_USB1_HOST + { + .connect_status = RT_FALSE, + .name = "usbh1" + }, +#endif +}; + +static void _imxrt_usb_host_send_callback(void *param, usb_host_transfer_t *transfer, usb_status_t status) +{ + struct imxrt_usb_host_pipe *pipe = (struct imxrt_usb_host_pipe *)param; + pipe->transfer_status = status; + rt_completion_done(pipe->urb_completion); +} + + +/*! + * @brief Initializes USB specific setting that was not set by the Clocks tool. + */ +static void USB_HostClockInit(usb_controller_index_t controller_id) +{ + usb_phy_config_struct_t phyConfig = { + BOARD_USB_PHY_D_CAL, BOARD_USB_PHY_TXCAL45DP, BOARD_USB_PHY_TXCAL45DM, + }; + uint32_t notUsed = 0; + + if (controller_id == kUSB_ControllerEhci0) + { + CLOCK_EnableUsbhs0PhyPllClock(kCLOCK_Usbphy480M, 480000000U); + CLOCK_EnableUsbhs0Clock(kCLOCK_Usb480M, 480000000U); + } + else + { + CLOCK_EnableUsbhs1PhyPllClock(kCLOCK_Usbphy480M, 480000000U); + CLOCK_EnableUsbhs1Clock(kCLOCK_Usb480M, 480000000U); + } + + USB_EhciPhyInit(controller_id, notUsed, &phyConfig); +} + +/*! + * @brief Enables interrupt service routines for device. + */ +void USB_HostIsrEnable(usb_controller_index_t controller_id) +{ + uint8_t irqNumber; +#if ((defined USB_HOST_CONFIG_EHCI) && (USB_HOST_CONFIG_EHCI > 0U)) + IRQn_Type usbHOSTEhciIrq[] = USBHS_IRQS; + irqNumber = usbHOSTEhciIrq[controller_id - kUSB_ControllerEhci0]; +#endif +/* Install isr, set priority, and enable IRQ. */ +#if defined(__GIC_PRIO_BITS) + GIC_SetPriority((IRQn_Type)irqNumber, USB_HOST_INTERRUPT_PRIORITY); +#else + NVIC_SetPriority((IRQn_Type)irqNumber, USB_HOST_INTERRUPT_PRIORITY); +#endif + EnableIRQ((IRQn_Type)irqNumber); +} + +#ifdef BSP_USB0_HOST +void USB_OTG1_IRQHandler(void) +{ + /* enter interrupt */ + rt_interrupt_enter(); + + USB_HostEhciIsrFunction(imxrt_usb_host_obj[USBH0_INDEX].host_handle); + /* leave interrupt */ + rt_interrupt_leave(); +} + +static rt_err_t _ehci0_reset_port(rt_uint8_t port) +{ + RT_DEBUG_LOG(RT_DEBUG_USB, ("reset port\n")); + USB_HostEhciControlBus((usb_host_ehci_instance_t *)((usb_host_instance_t *)imxrt_usb_host_obj[USBH0_INDEX].host_handle)->controllerHandle, kUSB_HostBusReset); + return RT_EOK; +} + +static int _ehci0_pipe_xfer(upipe_t pipe, rt_uint8_t token, void *buffer, int nbytes, int timeouts) +{ + int timeout = timeouts; + + if (!imxrt_usb_host_obj[USBH0_INDEX].connect_status) + { + return -1; + } + usb_host_transfer_t *transfer; + if (imxrt_usb_host_obj[USBH0_INDEX].pipes[pipe->pipe_index].pipe_handle == NULL) + { + RT_DEBUG_LOG(RT_DEBUG_USB, ("error operation on null pipe\n")); + return -1; + } + if (USB_HostMallocTransfer(imxrt_usb_host_obj[USBH0_INDEX].host_handle, &transfer) != kStatus_USB_Success) + { + RT_DEBUG_LOG(RT_DEBUG_USB, ("error to get transfer\n")); + return -1; + } + transfer->transferBuffer = buffer; + transfer->transferLength = nbytes; + transfer->callbackFn = _imxrt_usb_host_send_callback; + transfer->callbackParam = &(imxrt_usb_host_obj[USBH0_INDEX].pipes[pipe->pipe_index]); + rt_completion_init(&(imxrt_usb_host_obj[USBH0_INDEX].pipes[pipe->pipe_index].urb_completion)); + if (USB_HostSend(imxrt_usb_host_obj[USBH0_INDEX].host_handle, imxrt_usb_host_obj[USBH0_INDEX].pipes[pipe->pipe_index].pipe_handle, transfer) != kStatus_USB_Success) + { + RT_DEBUG_LOG(RT_DEBUG_USB, ("usb host failed to send\n")); + (void)USB_HostFreeTransfer(imxrt_usb_host_obj[USBH0_INDEX].host_handle, transfer); + return -1; + } + if (-RT_ETIMEOUT == rt_completion_wait(&(imxrt_usb_host_obj[USBH0_INDEX].pipes[pipe->pipe_index].urb_completion), timeout)) + { + RT_DEBUG_LOG(RT_DEBUG_USB, ("usb transfer timeout\n")); + (void)USB_HostFreeTransfer(imxrt_usb_host_obj[USBH0_INDEX].host_handle, transfer); + return -1; + } + // rt_thread_mdelay(1); + switch (imxrt_usb_host_obj[USBH0_INDEX].pipes[pipe->pipe_index].transfer_status) + { + case kStatus_USB_Success: + { + RT_DEBUG_LOG(RT_DEBUG_USB, ("ok\n")); + pipe->status = UPIPE_STATUS_OK; + if (pipe->callback != RT_NULL) + { + pipe->callback(pipe); + } + size_t size = transfer.transferSofar; + (void)USB_HostFreeTransfer(imxrt_usb_host_obj[USBH0_INDEX].host_handle, transfer); + if (pipe->ep.bEndpointAddress & 0x80) + { + return size; + } + else if (pipe->ep.bEndpointAddress & 0x00) + { + return size; + } + return nbytes; + break; + } + case kStatus_USB_TransferStall: + { + RT_DEBUG_LOG(RT_DEBUG_USB, ("stall\n")); + pipe->status = UPIPE_STATUS_STALL; + if (pipe->callback != RT_NULL) + { + pipe->callback(pipe); + } + (void)USB_HostFreeTransfer(imxrt_usb_host_obj[USBH0_INDEX].host_handle, transfer); + return -1; + break; + } + case kStatus_USB_TransferFailed: + default: + { + RT_DEBUG_LOG(RT_DEBUG_USB, ("error\n")); + pipe->status = UPIPE_STATUS_ERROR; + if (pipe->callback != RT_NULL) + { + pipe->callback(pipe); + } + (void)USB_HostFreeTransfer(imxrt_usb_host_obj[USBH0_INDEX].host_handle, transfer); + return -1; + break; + } + } +} + +static rt_uint16_t _ehci0_pipe_index = 0; +static rt_uint8_t _ehci0_get_free_pipe_index(void) +{ + rt_uint8_t idx; + for (idx = 1; idx < 16; idx++) + { + if (!(_ehci0_pipe_index & (0x01 << idx))) + { + _ehci0_pipe_index |= (0x01 << idx); + return idx; + } + } + return 0xff; +} + +static void _ehci0_free_pipe_index(rt_uint8_t index) +{ + _ehci0_pipe_index &= ~(0x01 << index); +} + +static rt_err_t _ehci0_open_pipe(upipe_t pipe) +{ + pipe->pipe_index = _ehci0_get_free_pipe_index(); + if (pipe->pipe_index == 0xFF) + { + return -RT_ERROR; + } + usb_host_pipe_init_t pipe_init = + { + .devInstance = imxrt_usb_host_obj[USBH0_INDEX].device_handle, + .pipeType = pipe->ep.bmAttributes, + .direction = (pipe->ep.bEndpointAddress & USB_DIR_IN) ? USB_IN : USB_OUT, + .endpointAddress = (pipe->ep.bEndpointAddress & USB_DESCRIPTOR_ENDPOINT_ADDRESS_NUMBER_MASK), + .interval = pipe->ep.bInterval, + .maxPacketSize = (uint16_t)(pipe->ep.wMaxPacketSize & USB_DESCRIPTOR_ENDPOINT_MAXPACKETSIZE_SIZE_MASK), + .numberPerUframe = (uint8_t)(pipe->ep.wMaxPacketSize & USB_DESCRIPTOR_ENDPOINT_MAXPACKETSIZE_MULT_TRANSACTIONS_MASK), + .nakCount = USB_HOST_CONFIG_MAX_NAK, + }; + USB_HostOpenPipe(imxrt_usb_host_obj[USBH0_INDEX].host_handle, &imxrt_usb_host_obj[USBH0_INDEX].pipes[pipe->pipe_index].pipe_handle, &pipe_init); + return RT_EOK; +} + +static rt_err_t _ehci0_close_pipe(upipe_t pipe) +{ + (void)USB_HostClosePipe(imxrt_usb_host_obj[USBH0_INDEX].host_handle, imxrt_usb_host_obj[USBH0_INDEX].pipes[pipe->pipe_index].pipe_handle); + _ehci0_free_pipe_index(pipe->pipe_index); + return RT_EOK; +} + +static struct uhcd_ops _ehci0_uhcd_ops = +{ + _ehci0_reset_port, + _ehci0_pipe_xfer, + _ehci0_open_pipe, + _ehci0_close_pipe, +}; + +static usb_status_t usb0_host_callback(usb_device_handle handle, usb_host_configuration_handle config_handle, rt_uint32_t event_code) +{ + usb_status_t status0; + usb_status_t status = kStatus_USB_Success; + + switch (eventCode) + { + case kUSB_HostEventAttach: + if (!imxrt_usb_host_obj[USBH0_INDEX].connect_status) + { + imxrt_usb_host_obj[USBH0_INDEX].connect_status = RT_TRUE; + imxrt_usb_host_obj[USBH0_INDEX].device_handle = handle; + RT_DEBUG_LOG(RT_DEBUG_USB, ("usb connected\n")); + rt_usbh_root_hub_connect_handler(imxrt_usb_host_obj[USBH0_INDEX].uhcd, OTG_PORT, RT_FALSE); + } + break; + + case kUSB_HostEventNotSupported: + RT_DEBUG_LOG(RT_DEBUG_USB, ("usb device not supported\n")); + status = kStatus_USB_Error; + break; + + case kUSB_HostEventEnumerationDone: + RT_DEBUG_LOG(RT_DEBUG_USB, ("enumeration done\n")); + break; + + case kUSB_HostEventDetach: + if (imxrt_usb_host_obj[USBH0_INDEX].connect_status) + { + imxrt_usb_host_obj[USBH0_INDEX].connect_status = RT_FALSE; + imxrt_usb_host_obj[USBH0_INDEX].device_handle = handle; + RT_DEBUG_LOG(RT_DEBUG_USB, ("usb disconnnect\n")); + rt_usbh_root_hub_disconnect_handler(imxrt_usb_host_obj[USBH0_INDEX].uhcd, OTG_PORT); + } + break; + + default: + break; + } + return status; +} + +static rt_err_t _ehci0_usbh_init(rt_device_t device) +{ + USB_HostClockInit(kUSB_ControllerEhci0); + + if (kStatus_USB_Success == USB_HostInit(kUSB_ControllerEhci0, &imxrt_usb_host_obj[USBH0_INDEX].host_handle, usb0_host_callback)) + { + USB_HostIsrEnable(kUSB_ControllerEhci0); + } + else + { + rt_kprintf("USB_HostInit ehci0 error\r\n"); + return -RT_ERROR; + } + return RT_EOK; +} +#endif + +#ifdef BSP_USB1_HOST +void USB_OTG2_IRQHandler(void) +{ + /* enter interrupt */ + rt_interrupt_enter(); + + USB_HostEhciIsrFunction(imxrt_usb_host_obj[USBH1_INDEX].host_handle); + /* leave interrupt */ + rt_interrupt_leave(); +} + +static rt_err_t _ehci1_reset_port(rt_uint8_t port) +{ + RT_DEBUG_LOG(RT_DEBUG_USB, ("reset port\n")); + USB_HostEhciControlBus((usb_host_ehci_instance_t *)((usb_host_instance_t *)imxrt_usb_host_obj[USBH1_INDEX].host_handle)->controllerHandle, kUSB_HostBusReset); + return RT_EOK; +} + +static int _ehci1_pipe_xfer(upipe_t pipe, rt_uint8_t token, void *buffer, int nbytes, int timeouts) +{ + int timeout = timeouts; + + if (!imxrt_usb_host_obj[USBH1_INDEX].connect_status) + { + return -1; + } + usb_host_transfer_t *transfer; + if (imxrt_usb_host_obj[USBH1_INDEX].pipes[pipe->pipe_index].pipe_handle == NULL) + { + RT_DEBUG_LOG(RT_DEBUG_USB, ("error operation on null pipe\n")); + return -1; + } + if (USB_HostMallocTransfer(imxrt_usb_host_obj[USBH1_INDEX].host_handle, &transfer) != kStatus_USB_Success) + { + RT_DEBUG_LOG(RT_DEBUG_USB, ("error to get transfer\n")); + return -1; + } + transfer->transferBuffer = buffer; + transfer->transferLength = nbytes; + transfer->callbackFn = _imxrt_usb_host_send_callback; + transfer->callbackParam = &(imxrt_usb_host_obj[USBH1_INDEX].pipes[pipe->pipe_index]); + rt_completion_init(&(imxrt_usb_host_obj[USBH1_INDEX].pipes[pipe->pipe_index].urb_completion)); + if (USB_HostSend(imxrt_usb_host_obj[USBH1_INDEX].host_handle, imxrt_usb_host_obj[USBH1_INDEX].pipes[pipe->pipe_index].pipe_handle, transfer) != kStatus_USB_Success) + { + RT_DEBUG_LOG(RT_DEBUG_USB, ("usb host failed to send\n")); + (void)USB_HostFreeTransfer(imxrt_usb_host_obj[USBH1_INDEX].host_handle, transfer); + return -1; + } + if (-RT_ETIMEOUT == rt_completion_wait(&(imxrt_usb_host_obj[USBH1_INDEX].pipes[pipe->pipe_index].urb_completion), timeout)) + { + RT_DEBUG_LOG(RT_DEBUG_USB, ("usb transfer timeout\n")); + (void)USB_HostFreeTransfer(imxrt_usb_host_obj[USBH1_INDEX].host_handle, transfer); + return -1; + } + // rt_thread_mdelay(1); + switch (imxrt_usb_host_obj[USBH1_INDEX].pipes[pipe->pipe_index].transfer_status) + { + case kStatus_USB_Success: + { + RT_DEBUG_LOG(RT_DEBUG_USB, ("ok\n")); + pipe->status = UPIPE_STATUS_OK; + if (pipe->callback != RT_NULL) + { + pipe->callback(pipe); + } + size_t size = transfer.transferSofar; + (void)USB_HostFreeTransfer(imxrt_usb_host_obj[USBH1_INDEX].host_handle, transfer); + if (pipe->ep.bEndpointAddress & 0x80) + { + return size; + } + else if (pipe->ep.bEndpointAddress & 0x00) + { + return size; + } + return nbytes; + break; + } + case kStatus_USB_TransferStall: + { + RT_DEBUG_LOG(RT_DEBUG_USB, ("stall\n")); + pipe->status = UPIPE_STATUS_STALL; + if (pipe->callback != RT_NULL) + { + pipe->callback(pipe); + } + (void)USB_HostFreeTransfer(imxrt_usb_host_obj[USBH1_INDEX].host_handle, transfer); + return -1; + break; + } + case kStatus_USB_TransferFailed: + default: + { + RT_DEBUG_LOG(RT_DEBUG_USB, ("error\n")); + pipe->status = UPIPE_STATUS_ERROR; + if (pipe->callback != RT_NULL) + { + pipe->callback(pipe); + } + (void)USB_HostFreeTransfer(imxrt_usb_host_obj[USBH1_INDEX].host_handle, transfer); + return -1; + break; + } + } +} + +static rt_uint16_t _ehci1_pipe_index = 0; +static rt_uint8_t _ehci1_get_free_pipe_index(void) +{ + rt_uint8_t idx; + for (idx = 1; idx < 16; idx++) + { + if (!(_ehci1_pipe_index & (0x01 << idx))) + { + _ehci1_pipe_index |= (0x01 << idx); + return idx; + } + } + return 0xff; +} + +static void _ehci1_free_pipe_index(rt_uint8_t index) +{ + _ehci1_pipe_index &= ~(0x01 << index); +} + +static rt_err_t _ehci1_open_pipe(upipe_t pipe) +{ + pipe->pipe_index = _ehci1_get_free_pipe_index(); + if (pipe->pipe_index == 0xFF) + { + return -RT_ERROR; + } + usb_host_pipe_init_t pipe_init = + { + .devInstance = imxrt_usb_host_obj[USBH1_INDEX].device_handle, + .pipeType = pipe->ep.bmAttributes, + .direction = (pipe->ep.bEndpointAddress & USB_DIR_IN) ? USB_IN : USB_OUT, + .endpointAddress = (pipe->ep.bEndpointAddress & USB_DESCRIPTOR_ENDPOINT_ADDRESS_NUMBER_MASK), + .interval = pipe->ep.bInterval, + .maxPacketSize = (uint16_t)(pipe->ep.wMaxPacketSize & USB_DESCRIPTOR_ENDPOINT_MAXPACKETSIZE_SIZE_MASK), + .numberPerUframe = (uint8_t)(pipe->ep.wMaxPacketSize & USB_DESCRIPTOR_ENDPOINT_MAXPACKETSIZE_MULT_TRANSACTIONS_MASK), + .nakCount = USB_HOST_CONFIG_MAX_NAK, + }; + USB_HostOpenPipe(imxrt_usb_host_obj[USBH1_INDEX].host_handle, &imxrt_usb_host_obj[USBH1_INDEX].pipes[pipe->pipe_index].pipe_handle, &pipe_init); + return RT_EOK; +} + +static rt_err_t _ehci1_close_pipe(upipe_t pipe) +{ + (void)USB_HostClosePipe(imxrt_usb_host_obj[USBH1_INDEX].host_handle, imxrt_usb_host_obj[USBH1_INDEX].pipes[pipe->pipe_index].pipe_handle); + _ehci0_free_pipe_index(pipe->pipe_index); + return RT_EOK; +} + +static struct uhcd_ops _ehci1_uhcd_ops = +{ + _ehci1_reset_port, + _ehci1_pipe_xfer, + _ehci1_open_pipe, + _ehci1_close_pipe, +}; + +static usb_status_t usb1_host_callback(usb_device_handle handle, usb_host_configuration_handle config_handle, rt_uint32_t event_code) +{ + usb_status_t status0; + usb_status_t status = kStatus_USB_Success; + + switch (eventCode) + { + case kUSB_HostEventAttach: + if (!imxrt_usb_host_obj[USBH1_INDEX].connect_status) + { + imxrt_usb_host_obj[USBH1_INDEX].connect_status = RT_TRUE; + imxrt_usb_host_obj[USBH1_INDEX].device_handle = handle; + RT_DEBUG_LOG(RT_DEBUG_USB, ("usb connected\n")); + rt_usbh_root_hub_connect_handler(imxrt_usb_host_obj[USBH1_INDEX].uhcd, OTG_PORT, RT_FALSE); + } + break; + + case kUSB_HostEventNotSupported: + RT_DEBUG_LOG(RT_DEBUG_USB, ("usb device not supported\n")); + status = kStatus_USB_Error; + break; + + case kUSB_HostEventEnumerationDone: + RT_DEBUG_LOG(RT_DEBUG_USB, ("enumeration done\n")); + break; + + case kUSB_HostEventDetach: + if (imxrt_usb_host_obj[USBH1_INDEX].connect_status) + { + imxrt_usb_host_obj[USBH1_INDEX].connect_status = RT_FALSE; + imxrt_usb_host_obj[USBH1_INDEX].device_handle = handle; + RT_DEBUG_LOG(RT_DEBUG_USB, ("usb disconnnect\n")); + rt_usbh_root_hub_disconnect_handler(imxrt_usb_host_obj[USBH1_INDEX].uhcd, OTG_PORT); + } + break; + + default: + break; + } + return status; +} + +static rt_err_t _ehci1_usbh_init(rt_device_t device) +{ + USB_HostClockInit(kUSB_ControllerEhci1); + + if (kStatus_USB_Success == USB_HostInit(kUSB_ControllerEhci1, &imxrt_usb_host_obj[USBH1_INDEX].host_handle, usb1_host_callback)) + { + USB_HostIsrEnable(kUSB_ControllerEhci1); + } + else + { + rt_kprintf("USB_HostInit ehci1 error\r\n"); + return -RT_ERROR; + } + return RT_EOK; +} +#endif + +int imxrt_usbh_register(void) +{ + rt_err_t res = -RT_ERROR; + struct imxrt_usb_host *usb_host_obj; + +#ifdef BSP_USB0_HOST + usb_host_obj = &(imxrt_usb_host_obj[USBH0_INDEX]); + rt_memset((void *)(usb_host_obj->uhcd), 0, sizeof(struct uhcd)); + usb_host_obj->uhcd.parent.type = RT_Device_Class_USBHost; + usb_host_obj->uhcd.parent.init = _ehci0_usbh_init; + usb_host_obj->uhcd.user_data = usb_host_obj; + usb_host_obj->uhcd.ops = &_ehci0_uhcd_ops; + usb_host_obj->uhcd.num_port = OTG_PORT; + res = rt_device_register(&(usb_host_obj->uhcd.parent), usb_host_obj->name, RT_DEVICE_FLAG_DEACTIVATE); + if (res != RT_EOK) + { + rt_kprintf("register usb0 host failed res = %d\r\n", res); + return -RT_ERROR; + } + + rt_usb_host_init(); +#endif +#ifdef BSP_USB1_HOST + usb_host_obj = &(imxrt_usb_host_obj[USBH1_INDEX]); + rt_memset((void *)(usb_host_obj->uhcd), 0, sizeof(struct uhcd)); + usb_host_obj->uhcd.parent.type = RT_Device_Class_USBHost; + usb_host_obj->uhcd.parent.init = _ehci1_usbh_init; + usb_host_obj->uhcd.user_data = usb_host_obj; + usb_host_obj->uhcd.ops = &_ehci1_uhcd_ops; + usb_host_obj->uhcd.num_port = OTG_PORT; + res = rt_device_register(&(usb_host_obj->uhcd.parent), usb_host_obj->name, RT_DEVICE_FLAG_DEACTIVATE); + if (res != RT_EOK) + { + rt_kprintf("register usb0 host failed res = %d\r\n", res); + return -RT_ERROR; + } + + rt_usb_host_init(usb_host_obj->name); +#endif + return RT_EOK; +} +INIT_DEVICE_EXPORT(imxrt_usbh_register); + +#endif \ No newline at end of file diff --git a/bsp/imxrt/libraries/drivers/drv_usbh.h b/bsp/imxrt/libraries/drivers/drv_usbh.h new file mode 100644 index 0000000000..9cd4ee0e7d --- /dev/null +++ b/bsp/imxrt/libraries/drivers/drv_usbh.h @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2006-2018, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2017-12-12 ZYH the first version + * 2019-12-19 tyustli port to stm32 series + * 2021-01-19 Leslie Lee port to imxrt series + */ +#ifndef __DRV_USBH_H__ +#define __DRV_USBH_H__ +#include + +#define OTG_PORT 1 + +int imxrt_usbh_register(void); + +#endif + +/************* end of file ************/ diff --git a/bsp/imxrt/libraries/drivers/usb/host/usb_host_framework.c b/bsp/imxrt/libraries/drivers/usb/host/usb_host_framework.c new file mode 100644 index 0000000000..27d79a9d99 --- /dev/null +++ b/bsp/imxrt/libraries/drivers/usb/host/usb_host_framework.c @@ -0,0 +1,262 @@ +/* + * Copyright (c) 2015 - 2016, Freescale Semiconductor, Inc. + * Copyright 2016 NXP + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include +#include +#include "usb_host.h" +#include "usb_host_hci.h" +#include "usb_host_devices.h" +#include "usb_host_framework.h" +/******************************************************************************* + * Definitions + ******************************************************************************/ + +/* Component ID definition, used by tools. */ +#ifndef FSL_COMPONENT_ID +#define FSL_COMPONENT_ID "middleware.usb.host.fatfs_usb_stack" +#endif + +/******************************************************************************* + * Prototypes + ******************************************************************************/ + +/******************************************************************************* + * Variables + ******************************************************************************/ + +/******************************************************************************* + * Code + ******************************************************************************/ + +usb_status_t USB_HostCh9RequestCommon(usb_host_device_instance_t *deviceInstance, + usb_host_transfer_t *transfer, + uint8_t *buffer, + uint32_t bufferLen) +{ + /* initialize transfer */ + transfer->setupPacket->wLength = USB_SHORT_TO_LITTLE_ENDIAN((uint16_t)bufferLen); + transfer->transferBuffer = buffer; + transfer->transferLength = bufferLen; + + if (USB_HostSendSetup(deviceInstance->hostHandle, deviceInstance->controlPipe, transfer) != + kStatus_USB_Success) /* send setup transfer */ + { +#ifdef HOST_ECHO + usb_echo("failed for USB_HostSendSetup\r\n"); +#endif + (void)USB_HostFreeTransfer(deviceInstance->hostHandle, transfer); + return kStatus_USB_Error; + } + return kStatus_USB_Success; +} + +usb_status_t USB_HostStandardGetStatus(usb_host_device_instance_t *deviceInstance, + usb_host_transfer_t *transfer, + void *param) +{ + usb_host_get_status_param_t *statusParam; + uint8_t length; + + /* initialize transfer */ + statusParam = (usb_host_get_status_param_t *)param; + transfer->setupPacket->bmRequestType = USB_REQUEST_TYPE_DIR_IN | USB_REQUEST_TYPE_TYPE_STANDARD; + if (statusParam->requestType == (uint8_t)kRequestDevice) + { + transfer->setupPacket->bmRequestType |= USB_REQUEST_TYPE_RECIPIENT_DEVICE; + } + else if (statusParam->requestType == (uint8_t)kRequestInterface) + { + transfer->setupPacket->bmRequestType |= USB_REQUEST_TYPE_RECIPIENT_INTERFACE; + } + else + { + transfer->setupPacket->bmRequestType |= USB_REQUEST_TYPE_RECIPIENT_ENDPOINT; + } + transfer->setupPacket->wIndex = USB_SHORT_TO_LITTLE_ENDIAN(statusParam->statusSelector); + + length = 2; + if (statusParam->statusSelector == USB_REQUEST_STANDARD_GET_STATUS_OTG_STATUS_SELECTOR) + { + length = 1; + } + return USB_HostCh9RequestCommon(deviceInstance, transfer, statusParam->statusBuffer, length); +} + +usb_status_t USB_HostStandardSetClearFeature(usb_host_device_instance_t *deviceInstance, + usb_host_transfer_t *transfer, + void *param) +{ + usb_host_process_feature_param_t *featureParam; + + /* initialize transfer */ + featureParam = (usb_host_process_feature_param_t *)param; + if (featureParam->requestType == (uint8_t)kRequestDevice) + { + transfer->setupPacket->bmRequestType |= USB_REQUEST_TYPE_RECIPIENT_DEVICE; + } + else if (featureParam->requestType == (uint8_t)kRequestInterface) + { + transfer->setupPacket->bmRequestType |= USB_REQUEST_TYPE_RECIPIENT_INTERFACE; + } + else + { + transfer->setupPacket->bmRequestType |= USB_REQUEST_TYPE_RECIPIENT_ENDPOINT; + } + transfer->setupPacket->wValue = USB_SHORT_TO_LITTLE_ENDIAN(featureParam->featureSelector); + transfer->setupPacket->wIndex = USB_SHORT_TO_LITTLE_ENDIAN(featureParam->interfaceOrEndpoint); + + return USB_HostCh9RequestCommon(deviceInstance, transfer, NULL, 0); +} + +usb_status_t USB_HostStandardSetAddress(usb_host_device_instance_t *deviceInstance, + usb_host_transfer_t *transfer, + void *param) +{ + uint8_t address; + + /* initialize transfer */ + address = *(uint8_t *)param; + transfer->setupPacket->wValue = USB_SHORT_TO_LITTLE_ENDIAN(address); + + return USB_HostCh9RequestCommon(deviceInstance, transfer, NULL, 0); +} + +usb_status_t USB_HostStandardSetGetDescriptor(usb_host_device_instance_t *deviceInstance, + usb_host_transfer_t *transfer, + void *param) +{ + usb_host_process_descriptor_param_t *descriptorParam; + + /* initialize transfer */ + descriptorParam = (usb_host_process_descriptor_param_t *)param; + transfer->setupPacket->wValue = USB_SHORT_TO_LITTLE_ENDIAN( + (uint16_t)((uint16_t)descriptorParam->descriptorType << 8) | descriptorParam->descriptorIndex); + transfer->setupPacket->wIndex = USB_SHORT_TO_LITTLE_ENDIAN(descriptorParam->languageId); + return USB_HostCh9RequestCommon(deviceInstance, transfer, descriptorParam->descriptorBuffer, + descriptorParam->descriptorLength); +} + +usb_status_t USB_HostStandardGetInterface(usb_host_device_instance_t *deviceInstance, + usb_host_transfer_t *transfer, + void *param) +{ + usb_host_get_interface_param_t *interfaceParam; + + /* initialize transfer */ + interfaceParam = (usb_host_get_interface_param_t *)param; + transfer->setupPacket->bmRequestType |= USB_REQUEST_TYPE_DIR_IN; + transfer->setupPacket->bmRequestType |= USB_REQUEST_TYPE_RECIPIENT_INTERFACE; + transfer->setupPacket->wIndex = USB_SHORT_TO_LITTLE_ENDIAN(interfaceParam->interface); + + return USB_HostCh9RequestCommon(deviceInstance, transfer, interfaceParam->alternateInterfaceBuffer, 1); +} + +usb_status_t USB_HostStandardSetInterface(usb_host_device_instance_t *deviceInstance, + usb_host_transfer_t *transfer, + void *param) +{ + usb_host_set_interface_param_t *setParam; + + /* initialize transfer */ + setParam = (usb_host_set_interface_param_t *)param; + transfer->setupPacket->bmRequestType |= USB_REQUEST_TYPE_RECIPIENT_INTERFACE; + transfer->setupPacket->wIndex = USB_SHORT_TO_LITTLE_ENDIAN(setParam->interface); + transfer->setupPacket->wValue = USB_SHORT_TO_LITTLE_ENDIAN(setParam->alternateSetting); + + return USB_HostCh9RequestCommon(deviceInstance, transfer, NULL, 0); +} + +usb_status_t USB_HostStandardSyncFrame(usb_host_device_instance_t *deviceInstance, + usb_host_transfer_t *transfer, + void *param) +{ + usb_host_synch_frame_param_t *frameParam; + + /* initialize transfer */ + frameParam = (usb_host_synch_frame_param_t *)param; + transfer->setupPacket->bmRequestType |= USB_REQUEST_TYPE_DIR_IN; + transfer->setupPacket->bmRequestType |= USB_REQUEST_TYPE_RECIPIENT_ENDPOINT; + transfer->setupPacket->wIndex = USB_SHORT_TO_LITTLE_ENDIAN(frameParam->endpoint); + + return USB_HostCh9RequestCommon(deviceInstance, transfer, frameParam->frameNumberBuffer, 2); +} + +usb_status_t USB_HostRequestControl(usb_device_handle deviceHandle, + uint8_t usbRequest, + usb_host_transfer_t *transfer, + void *param) +{ + usb_host_device_instance_t *deviceInstance = (usb_host_device_instance_t *)deviceHandle; + usb_status_t status = kStatus_USB_Error; + + if (deviceHandle == NULL) + { + return kStatus_USB_InvalidHandle; + } + + /* reset transfer fields */ + transfer->setupPacket->bmRequestType = 0x00; + transfer->setupPacket->bRequest = usbRequest; + transfer->setupPacket->wIndex = 0; + transfer->setupPacket->wLength = 0; + transfer->setupPacket->wValue = 0; + + switch (usbRequest) + { + case USB_REQUEST_STANDARD_GET_STATUS: /* standard get status request */ + status = USB_HostStandardGetStatus(deviceInstance, transfer, param); + break; + + case USB_REQUEST_STANDARD_CLEAR_FEATURE: /* standard clear status request */ + case USB_REQUEST_STANDARD_SET_FEATURE: /* standard set feature request */ + status = USB_HostStandardSetClearFeature(deviceInstance, transfer, param); + break; + + case USB_REQUEST_STANDARD_SET_ADDRESS: /* standard set address request */ + status = USB_HostStandardSetAddress(deviceInstance, transfer, param); + break; + + case USB_REQUEST_STANDARD_GET_DESCRIPTOR: /* standard get descriptor request */ + case USB_REQUEST_STANDARD_SET_DESCRIPTOR: /* standard set descriptor request */ + if (usbRequest == USB_REQUEST_STANDARD_GET_DESCRIPTOR) + { + transfer->setupPacket->bmRequestType |= USB_REQUEST_TYPE_DIR_IN; + } + status = USB_HostStandardSetGetDescriptor(deviceInstance, transfer, param); + break; + + case USB_REQUEST_STANDARD_GET_CONFIGURATION: /* standard get configuration descriptor request */ + transfer->setupPacket->bmRequestType |= USB_REQUEST_TYPE_DIR_IN; + status = + USB_HostCh9RequestCommon((usb_host_device_instance_t *)deviceHandle, transfer, (uint8_t *)param, 1); + break; + + case USB_REQUEST_STANDARD_SET_CONFIGURATION: /* standard set configuration request */ + transfer->setupPacket->wValue = USB_SHORT_TO_LITTLE_ENDIAN(*((uint8_t *)param)); + status = USB_HostCh9RequestCommon((usb_host_device_instance_t *)deviceHandle, transfer, NULL, 0); + break; + + case USB_REQUEST_STANDARD_GET_INTERFACE: /* standard get interface request */ + status = USB_HostStandardGetInterface(deviceInstance, transfer, param); + break; + + case USB_REQUEST_STANDARD_SET_INTERFACE: /* standard set interface request */ + status = USB_HostStandardSetInterface(deviceInstance, transfer, param); + break; + + case USB_REQUEST_STANDARD_SYNCH_FRAME: /* standard synch frame request */ + status = USB_HostStandardSyncFrame(deviceInstance, transfer, param); + break; + + default: + /*no action*/ + break; + } + + return status; +} diff --git a/bsp/imxrt/libraries/drivers/usb/host/usb_host_framework.h b/bsp/imxrt/libraries/drivers/usb/host/usb_host_framework.h new file mode 100644 index 0000000000..53f618fdc3 --- /dev/null +++ b/bsp/imxrt/libraries/drivers/usb/host/usb_host_framework.h @@ -0,0 +1,131 @@ +/* + * Copyright (c) 2015 - 2016, Freescale Semiconductor, Inc. + * Copyright 2016 NXP + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef _USB_HOST_CH9_H_ +#define _USB_HOST_CH9_H_ + +/******************************************************************************* + * Definitions + ******************************************************************************/ + +/*! + * @addtogroup usb_host_drv + * @{ + */ + +/*! @}*/ + +/******************************************************************************* + * API + ******************************************************************************/ +/*! + * @brief standard control transfer common code. + * + * @param deviceInstance device instance handle. + * @param transfer transfer. + * @param buffer data buffer pointer. + * @param bufferLen data length. + * + * @return kStatus_USB_Success or error codes. + */ +usb_status_t USB_HostCh9RequestCommon(usb_host_device_instance_t *deviceInstance, + usb_host_transfer_t *transfer, + uint8_t *buffer, + uint32_t bufferLen); + +/*! + * @brief standard get status implementation. + * + * @param deviceInstance device instance handle. + * @param transfer transfer. + * @param param parameter. + * + * @return kStatus_USB_Success or error codes. + */ +usb_status_t USB_HostStandardGetStatus(usb_host_device_instance_t *deviceInstance, + usb_host_transfer_t *transfer, + void *param); + +/*! + * @brief standard set/clear feature implementation. + * + * @param deviceInstance device instance handle. + * @param transfer transfer. + * @param param parameter. + * + * @return kStatus_USB_Success or error codes. + */ +usb_status_t USB_HostStandardSetClearFeature(usb_host_device_instance_t *deviceInstance, + usb_host_transfer_t *transfer, + void *param); + +/*! + * @brief standard set address implementation. + * + * @param deviceInstance device instance handle. + * @param transfer transfer. + * @param param parameter. + * + * @return kStatus_USB_Success or error codes. + */ +usb_status_t USB_HostStandardSetAddress(usb_host_device_instance_t *deviceInstance, + usb_host_transfer_t *transfer, + void *param); + +/*! + * @brief standard set/get descriptor implementation. + * + * @param deviceInstance device instance handle. + * @param transfer transfer. + * @param param parameter. + * + * @return kStatus_USB_Success or error codes. + */ +usb_status_t USB_HostStandardSetGetDescriptor(usb_host_device_instance_t *deviceInstance, + usb_host_transfer_t *transfer, + void *param); + +/*! + * @brief standard get interface implementation. + * + * @param deviceInstance device instance handle. + * @param transfer transfer. + * @param param parameter. + * + * @return kStatus_USB_Success or error codes. + */ +usb_status_t USB_HostStandardGetInterface(usb_host_device_instance_t *deviceInstance, + usb_host_transfer_t *transfer, + void *param); + +/*! + * @brief standard set interface implementation. + * + * @param deviceInstance device instance handle. + * @param transfer transfer. + * @param param parameter. + * + * @return kStatus_USB_Success or error codes. + */ +usb_status_t USB_HostStandardSetInterface(usb_host_device_instance_t *deviceInstance, + usb_host_transfer_t *transfer, + void *param); + +/*! + * @brief standard sync frame implementation. + * + * @param deviceInstance device instance handle. + * @param transfer transfer. + * @param param parameter. + * + * @return kStatus_USB_Success or error codes. + */ +usb_status_t USB_HostStandardSyncFrame(usb_host_device_instance_t *deviceInstance, + usb_host_transfer_t *transfer, + void *param); +#endif /* _USB_HOST_CH9_H_ */ diff --git a/bsp/imxrt/libraries/drivers/usb/include/usb_host_config.h b/bsp/imxrt/libraries/drivers/usb/include/usb_host_config.h new file mode 100644 index 0000000000..aa00ce4a4f --- /dev/null +++ b/bsp/imxrt/libraries/drivers/usb/include/usb_host_config.h @@ -0,0 +1,282 @@ +/* + * Copyright 2015-2016, Freescale Semiconductor, Inc. + * Copyright 2016-2021 NXP + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of copyright holder nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __USB_HOST_CONFIG_H__ +#define __USB_HOST_CONFIG_H__ + +/* Host Controller Enable */ +/*! + * @brief host khci instance count, meantime it indicates khci enable or disabled. + * - if 0, host khci driver is disabled. + * - if greater than 0, host khci driver is enabled. + */ +#define USB_HOST_CONFIG_KHCI (0U) + +/*! + * @brief host ehci instance count, meantime it indicates ehci enable or disabled. + * - if 0, host ehci driver is disabled. + * - if greater than 0, host ehci driver is enabled. + */ +#define USB_HOST_CONFIG_EHCI (1U) + +/*! + * @brief host ohci instance count, meantime it indicates ohci enable or disabled. + * - if 0, host ohci driver is disabled. + * - if greater than 0, host ohci driver is enabled. + */ +#define USB_HOST_CONFIG_OHCI (0U) + +/*! + * @brief host ip3516hs instance count, meantime it indicates ohci enable or disabled. + * - if 0, host ip3516hs driver is disabled. + * - if greater than 0, host ip3516hs driver is enabled. + */ +#define USB_HOST_CONFIG_IP3516HS (0U) + +/* Common configuration macros for all controllers */ + +/*! + * @brief host driver instance max count. + * for example: 2 - one for khci, one for ehci. + */ +#define USB_HOST_CONFIG_MAX_HOST \ + (USB_HOST_CONFIG_KHCI + USB_HOST_CONFIG_EHCI + USB_HOST_CONFIG_OHCI + USB_HOST_CONFIG_IP3516HS) + +/*! + * @brief hub pipe max count. + * pipe is the host driver resource for device endpoint, one endpoint needs one pipe. + * @remarks A HUB usually uses two pipes. + */ +#define USB_HOST_CONFIG_HUB_MAX_PIPES (2U) + +/*! + * @brief host pipe max count. + * pipe is the host driver resource for device endpoint, one endpoint needs one pipe. + * @remarks Depends on the total number of device interfaces and HUB usage. + */ +#define USB_HOST_CONFIG_MAX_PIPES (USB_HOST_CONFIG_HUB_MAX_PIPES + 2U * USB_HOST_CONFIG_INTERFACE_MAX_EP) + +/*! + * @brief host transfer max count. + * transfer is the host driver resource for data transmission mission, one transmission mission needs one transfer. + * @remarks Depends on the total number of device interfaces. + */ +#define USB_HOST_CONFIG_MAX_TRANSFERS (USB_HOST_CONFIG_MAX_PIPES) + +/*! + * @brief the max endpoint for one interface. + * the max endpoint descriptor number that one interface descriptor contain. + */ +#define USB_HOST_CONFIG_INTERFACE_MAX_EP (4U) + +/*! + * @brief the max interface for one configuration. + * the max interface descriptor number that one configuration descriptor can contain. + */ +#define USB_HOST_CONFIG_CONFIGURATION_MAX_INTERFACE (5U) + +/*! + * @brief the max power for one device. + * the max power the host can provide for one device. + * Expressed in 2 mA units (i.e. 250 = 500 mA). + */ +#define USB_HOST_CONFIG_MAX_POWER (250U) + +/*! + * @brief the max retries for enumeration. + * retry time when enumeration fail. + */ +#define USB_HOST_CONFIG_ENUMERATION_MAX_RETRIES (3U) + +/*! + * @brief the max retries for enumeration setup stall. + * the max times for one transfer can stall. + */ +#define USB_HOST_CONFIG_ENUMERATION_MAX_STALL_RETRIES (1U) + +/*! + * @brief the max NAK count for one transaction. + * when nak count reach to the value, the transaction fail. + */ +#define USB_HOST_CONFIG_MAX_NAK (3000U) + +/*! @brief Whether the transfer buffer is cache-enabled or not. */ +#ifndef USB_HOST_CONFIG_BUFFER_PROPERTY_CACHEABLE +#define USB_HOST_CONFIG_BUFFER_PROPERTY_CACHEABLE (0U) +#endif +/*! @brief if 1, enable usb compliance test codes; if 0, disable usb compliance test codes. */ +#define USB_HOST_CONFIG_COMPLIANCE_TEST (0U) + +/*! @brief if 1, class driver clear stall automatically; if 0, class driver doesn't clear stall. */ +#define USB_HOST_CONFIG_CLASS_AUTO_CLEAR_STALL (0U) + +/* KHCI configuration */ +#if ((defined USB_HOST_CONFIG_KHCI) && (USB_HOST_CONFIG_KHCI)) + +/*! + * @brief khci dma align fix buffer size. + */ +#define USB_HOST_CONFIG_KHCI_DMA_ALIGN_BUFFER (64U) + +#endif + +/* EHCI configuration */ +#if ((defined USB_HOST_CONFIG_EHCI) && (USB_HOST_CONFIG_EHCI)) + +/*! + * @brief ehci periodic frame list size. + * the value can be 1024, 512, 256, 128, 64, 32, 16 or 8. + */ +#define USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE (1024U) + +/*! + * @brief ehci QH max count. + * @remarks Depends on the total number of device interfaces. + */ +#define USB_HOST_CONFIG_EHCI_MAX_QH (USB_HOST_CONFIG_MAX_PIPES) + +/*! + * @brief ehci QTD max count. + */ +#define USB_HOST_CONFIG_EHCI_MAX_QTD (USB_HOST_CONFIG_EHCI_MAX_QH) + +/*! + * @brief ehci ITD max count. + */ +#define USB_HOST_CONFIG_EHCI_MAX_ITD (USB_HOST_CONFIG_EHCI_MAX_SITD) + +/*! + * @brief ehci SITD max count. + * @remarks Depends on the total number of device interfaces that can have isochronous endpoints. + */ +#define USB_HOST_CONFIG_EHCI_MAX_SITD (2U * USB_HOST_CONFIG_INTERFACE_MAX_EP) + +#endif + +/* OHCI configuration */ +#if ((defined USB_HOST_CONFIG_OHCI) && (USB_HOST_CONFIG_OHCI)) + +/*! + * @brief ohci ED max count. + * @remarks Depends on the total number of device interfaces. + */ +#define USB_HOST_CONFIG_OHCI_MAX_ED (USB_HOST_CONFIG_MAX_PIPES) + +/*! + * @brief ohci GTD max count. + */ +#define USB_HOST_CONFIG_OHCI_MAX_GTD (USB_HOST_CONFIG_OHCI_MAX_ED) + +/*! + * @brief ohci ITD max count. + * @remarks Depends on the total number of device interfaces that can have isochronous endpoints. + */ +#define USB_HOST_CONFIG_OHCI_MAX_ITD (2U * USB_HOST_CONFIG_INTERFACE_MAX_EP) + +#endif + +/* OHCI configuration */ +#if ((defined USB_HOST_CONFIG_IP3516HS) && (USB_HOST_CONFIG_IP3516HS)) + +/*! + * @brief ohci PIPE max count. + * @remarks Depends on the total number of device interfaces. + */ +#define USB_HOST_CONFIG_IP3516HS_MAX_PIPE (USB_HOST_CONFIG_MAX_PIPES) + +/*! + * @brief ohci ED max count. + */ +#define USB_HOST_CONFIG_IP3516HS_MAX_ATL (32U) + +/*! + * @brief ohci GTD max count. + */ +#define USB_HOST_CONFIG_IP3516HS_MAX_INT (USB_HOST_CONFIG_IP3516HS_MAX_ATL) + +/*! + * @brief ohci ITD max count. + * @remarks Depends on the existence of device interfaces that can have isochronous endpoints. + */ +#define USB_HOST_CONFIG_IP3516HS_MAX_ISO (USB_HOST_CONFIG_IP3516HS_MAX_ATL) + +#endif + +/*! + * @brief host HUB class instance count, meantime it indicates HUB class enable or disabled. + * - if 0, host HUB class driver is disabled. + * - if greater than 0, host HUB class driver is enabled. + */ +#define USB_HOST_CONFIG_HUB (0U) + +/*! + * @brief host HID class instance count, meantime it indicates HID class enable or disabled. + * - if 0, host HID class driver is disabled. + * - if greater than 0, host HID class driver is enabled. + */ +#define USB_HOST_CONFIG_HID (0U) + +/*! + * @brief host MSD class instance count, meantime it indicates MSD class enable or disabled. + * - if 0, host MSD class driver is disabled. + * - if greater than 0, host MSD class driver is enabled. + */ +#define USB_HOST_CONFIG_MSD (0U) + +/*! + * @brief host CDC class instance count, meantime it indicates CDC class enable or disabled. + * - if 0, host CDC class driver is disabled. + * - if greater than 0, host CDC class driver is enabled. + */ +#define USB_HOST_CONFIG_CDC (1U) + +/*! + * @brief host AUDIO class instance count, meantime it indicates AUDIO class enable or disabled. + * - if 0, host AUDIO class driver is disabled. + * - if greater than 0, host AUDIO class driver is enabled. + */ +#define USB_HOST_CONFIG_AUDIO (0U) + +/*! + * @brief host PHDC class instance count, meantime it indicates PHDC class enable or disabled. + * - if 0, host PHDC class driver is disabled. + * - if greater than 0, host PHDC class driver is enabled. + */ +#define USB_HOST_CONFIG_PHDC (0U) + +/*! + * @brief host printer class instance count, meantime it indicates printer class enable or disabled. + * - if 0, host printer class driver is disabled. + * - if greater than 0, host printer class driver is enabled. + */ +#define USB_HOST_CONFIG_PRINTER (0U) + +#endif /* __USB_HOST_CONFIG_H__ */ diff --git a/components/drivers/pm/debug.log b/components/drivers/pm/debug.log new file mode 100644 index 0000000000..e69de29bb2 From fa5c8e15021e06ec9114e51da17b6aa8698b3ea9 Mon Sep 17 00:00:00 2001 From: LeeChunHei Date: Sat, 23 Jan 2021 12:32:47 +0800 Subject: [PATCH 05/26] modifly to use multi usb(not tested) --- bsp/imxrt/libraries/drivers/drv_usbh.c | 2 +- components/drivers/include/drivers/usb_host.h | 7 +++-- components/drivers/usb/usbhost/core/driver.c | 15 +++++++--- components/drivers/usb/usbhost/core/hub.c | 29 ++++++++++--------- components/drivers/usb/usbhost/core/usbhost.c | 6 ++-- 5 files changed, 34 insertions(+), 25 deletions(-) diff --git a/bsp/imxrt/libraries/drivers/drv_usbh.c b/bsp/imxrt/libraries/drivers/drv_usbh.c index 150d87d6e0..7362847eff 100644 --- a/bsp/imxrt/libraries/drivers/drv_usbh.c +++ b/bsp/imxrt/libraries/drivers/drv_usbh.c @@ -590,7 +590,7 @@ int imxrt_usbh_register(void) return -RT_ERROR; } - rt_usb_host_init(); + rt_usb_host_init(usb_host_obj->name); #endif #ifdef BSP_USB1_HOST usb_host_obj = &(imxrt_usb_host_obj[USBH1_INDEX]); diff --git a/components/drivers/include/drivers/usb_host.h b/components/drivers/include/drivers/usb_host.h index 2a68f4edb5..bd73c7d1d7 100644 --- a/components/drivers/include/drivers/usb_host.h +++ b/components/drivers/include/drivers/usb_host.h @@ -136,7 +136,8 @@ struct uhcd struct rt_device parent; uhcd_ops_t ops; rt_uint8_t num_ports; - uhub_t roothub; + uhub_t roothub; + struct rt_messagequeue *usb_mq; }; typedef struct uhcd* uhcd_t; @@ -163,7 +164,7 @@ struct uhost_msg typedef struct uhost_msg* uhost_msg_t; /* usb host system interface */ -rt_err_t rt_usb_host_init(void); +rt_err_t rt_usb_host_init(const char *name); void rt_usbh_hub_init(struct uhcd *hcd); /* usb host core interface */ @@ -203,7 +204,7 @@ rt_err_t rt_usbh_hub_clear_port_feature(uhub_t uhub, rt_uint16_t port, rt_err_t rt_usbh_hub_set_port_feature(uhub_t uhub, rt_uint16_t port, rt_uint16_t feature); rt_err_t rt_usbh_hub_reset_port(uhub_t uhub, rt_uint16_t port); -rt_err_t rt_usbh_event_signal(struct uhost_msg* msg); +rt_err_t rt_usbh_event_signal(uhcd_t uhcd, struct uhost_msg* msg); void rt_usbh_root_hub_connect_handler(struct uhcd *hcd, rt_uint8_t port, rt_bool_t isHS); diff --git a/components/drivers/usb/usbhost/core/driver.c b/components/drivers/usb/usbhost/core/driver.c index 37327108c1..871a7b578a 100644 --- a/components/drivers/usb/usbhost/core/driver.c +++ b/components/drivers/usb/usbhost/core/driver.c @@ -13,6 +13,7 @@ #include static rt_list_t _driver_list; +static rt_bool_t _driver_list_created = RT_FALSE; /** * This function will initilize the usb class driver related data structure, @@ -22,8 +23,11 @@ static rt_list_t _driver_list; */ rt_err_t rt_usbh_class_driver_init(void) { - rt_list_init(&_driver_list); - + if (_driver_list_created == RT_FALSE) + { + rt_list_init(&_driver_list); + _driver_list_created = RT_TRUE; + } return RT_EOK; } @@ -39,8 +43,11 @@ rt_err_t rt_usbh_class_driver_register(ucd_t drv) { if (drv == RT_NULL) return -RT_ERROR; - /* insert class driver into driver list */ - rt_list_insert_after(&_driver_list, &(drv->list)); + if (rt_usbh_class_driver_find(drv->class_code, drv->subclass_code) == RT_NULL) + { + /* insert class driver into driver list */ + rt_list_insert_after(&_driver_list, &(drv->list)); + } return RT_EOK; } diff --git a/components/drivers/usb/usbhost/core/hub.c b/components/drivers/usb/usbhost/core/hub.c index eefa571472..2a9fc20111 100644 --- a/components/drivers/usb/usbhost/core/hub.c +++ b/components/drivers/usb/usbhost/core/hub.c @@ -13,9 +13,9 @@ #define USB_THREAD_STACK_SIZE 4096 -static struct rt_messagequeue *usb_mq; +// static struct rt_messagequeue *usb_mq; static struct uclass_driver hub_driver; -static struct uhub root_hub; +// static struct uhub root_hub; static rt_err_t root_hub_ctrl(struct uhcd *hcd, rt_uint16_t port, rt_uint8_t cmd, void *args) { @@ -92,7 +92,7 @@ void rt_usbh_root_hub_connect_handler(struct uhcd *hcd, rt_uint8_t port, rt_bool { hcd->roothub->port_status[port - 1] |= PORT_LSDA; } - rt_usbh_event_signal(&msg); + rt_usbh_event_signal(hcd, &msg); } void rt_usbh_root_hub_disconnect_handler(struct uhcd *hcd, rt_uint8_t port) @@ -102,7 +102,7 @@ void rt_usbh_root_hub_disconnect_handler(struct uhcd *hcd, rt_uint8_t port) msg.content.hub = hcd->roothub; hcd->roothub->port_status[port - 1] |= PORT_CCSC; hcd->roothub->port_status[port - 1] &= ~PORT_CCS; - rt_usbh_event_signal(&msg); + rt_usbh_event_signal(hcd, &msg); } /** @@ -647,12 +647,13 @@ ucd_t rt_usbh_class_driver_hub(void) */ static void rt_usbh_hub_thread_entry(void* parameter) { + uhcd_t hcd = (uhcd_t)parameter; while(1) { struct uhost_msg msg; /* receive message */ - if(rt_mq_recv(usb_mq, &msg, sizeof(struct uhost_msg), RT_WAITING_FOREVER) + if(rt_mq_recv(hcd->usb_mq, &msg, sizeof(struct uhost_msg), RT_WAITING_FOREVER) != RT_EOK ) continue; //RT_DEBUG_LOG(RT_DEBUG_USB, ("msg type %d\n", msg.type)); @@ -679,12 +680,12 @@ static void rt_usbh_hub_thread_entry(void* parameter) * * @return the error code, RT_EOK on successfully. */ -rt_err_t rt_usbh_event_signal(struct uhost_msg* msg) +rt_err_t rt_usbh_event_signal(uhcd_t hcd, struct uhost_msg* msg) { RT_ASSERT(msg != RT_NULL); /* send message to usb message queue */ - rt_mq_send(usb_mq, (void*)msg, sizeof(struct uhost_msg)); + rt_mq_send(hcd->usb_mq, (void*)msg, sizeof(struct uhost_msg)); return RT_EOK; } @@ -698,16 +699,16 @@ rt_err_t rt_usbh_event_signal(struct uhost_msg* msg) void rt_usbh_hub_init(uhcd_t hcd) { rt_thread_t thread; - /* link root hub to hcd */ - root_hub.is_roothub = RT_TRUE; - hcd->roothub = &root_hub; - root_hub.hcd = hcd; - root_hub.num_ports = hcd->num_ports; + /* create root hub for hcd */ + hcd->roothub = rt_malloc(sizeof(struct uhub)); + hcd->roothub->is_roothub = RT_TRUE; + hcd->roothub->hcd = hcd; + hcd->roothub->num_ports = hcd->num_ports; /* create usb message queue */ - usb_mq = rt_mq_create("usbh", 32, 16, RT_IPC_FLAG_FIFO); + hcd->usb_mq = rt_mq_create(hcd->parent.parent.name, 32, 16, RT_IPC_FLAG_FIFO); /* create usb hub thread */ - thread = rt_thread_create("usbh", rt_usbh_hub_thread_entry, RT_NULL, + thread = rt_thread_create(hcd->parent.parent.name, rt_usbh_hub_thread_entry, hcd, USB_THREAD_STACK_SIZE, 8, 20); if(thread != RT_NULL) { diff --git a/components/drivers/usb/usbhost/core/usbhost.c b/components/drivers/usb/usbhost/core/usbhost.c index f0294238c4..b4caad710c 100644 --- a/components/drivers/usb/usbhost/core/usbhost.c +++ b/components/drivers/usb/usbhost/core/usbhost.c @@ -22,15 +22,15 @@ * * @return none. */ -rt_err_t rt_usb_host_init(void) +rt_err_t rt_usb_host_init(const char *name) { ucd_t drv; rt_device_t uhc; - uhc = rt_device_find(USB_HOST_CONTROLLER_NAME); + uhc = rt_device_find(name); if(uhc == RT_NULL) { - rt_kprintf("can't find usb host controller %s\n", USB_HOST_CONTROLLER_NAME); + rt_kprintf("can't find usb host controller %s\n", name); return -RT_ERROR; } From b51c6339f0f16e5780482b32d020db4f18642e0f Mon Sep 17 00:00:00 2001 From: LeeChunHei Date: Tue, 2 Feb 2021 11:28:03 +0800 Subject: [PATCH 06/26] finish testing --- bsp/imxrt/imxrt1052-sc-internal/.config | 450 ---- .../.vscode/c_cpp_properties.json | 18 - .../imxrt1052-sc-internal/.vscode/launch.json | 20 - bsp/imxrt/imxrt1052-sc-internal/Kconfig | 16 - bsp/imxrt/imxrt1052-sc-internal/README.md | 123 - bsp/imxrt/imxrt1052-sc-internal/SConscript | 14 - bsp/imxrt/imxrt1052-sc-internal/SConstruct | 71 - .../applications/SConscript | 16 - .../imxrt1052-sc-internal/applications/main.c | 30 - bsp/imxrt/imxrt1052-sc-internal/board/Kconfig | 240 -- .../board/MCUX_Config/MCUX_Config.mex | 645 ----- .../board/MCUX_Config/clock_config.c | 476 ---- .../board/MCUX_Config/clock_config.h | 116 - .../board/MCUX_Config/pin_mux.c | 274 -- .../board/MCUX_Config/pin_mux.h | 430 --- .../imxrt1052-sc-internal/board/SConscript | 17 - bsp/imxrt/imxrt1052-sc-internal/board/board.c | 138 - bsp/imxrt/imxrt1052-sc-internal/board/board.h | 44 - .../board/linker_scripts/link.icf | 95 - .../board/linker_scripts/link.lds | 298 --- .../board/linker_scripts/link.sct | 92 - .../imxrt1052-sc-internal/figures/board.png | Bin 153492 -> 0 bytes bsp/imxrt/imxrt1052-sc-internal/project.ewd | 1485 ----------- bsp/imxrt/imxrt1052-sc-internal/project.ewp | 1274 --------- bsp/imxrt/imxrt1052-sc-internal/project.eww | 10 - .../imxrt1052-sc-internal/project.uvoptx | 930 ------- .../imxrt1052-sc-internal/project.uvprojx | 724 ----- bsp/imxrt/imxrt1052-sc-internal/rtconfig.h | 184 -- bsp/imxrt/imxrt1052-sc-internal/rtconfig.py | 160 -- bsp/imxrt/imxrt1052-sc-internal/template.ewd | 1485 ----------- bsp/imxrt/imxrt1052-sc-internal/template.ewp | 1039 -------- bsp/imxrt/imxrt1052-sc-internal/template.ewt | 2372 ----------------- bsp/imxrt/imxrt1052-sc-internal/template.eww | 10 - .../imxrt1052-sc-internal/template.uvoptx | 182 -- .../imxrt1052-sc-internal/template.uvprojx | 397 --- .../imxrt1052-sc-internal/xip/SConscript | 18 - .../xip/fsl_flexspi_nor_boot.c | 51 - .../xip/fsl_flexspi_nor_boot.h | 122 - .../xip/fsl_flexspi_nor_config.c | 68 - .../xip/fsl_flexspi_nor_config.h | 268 -- .../drivers/fsl_os_abstraction_rtthread.c | 11 +- .../MIMXRT1052/gcc/startup_MIMXRT1052.S | 2 - bsp/imxrt/libraries/MIMXRT1050/SConscript | 3 - bsp/imxrt/libraries/drivers/SConscript | 2 +- bsp/imxrt/libraries/drivers/drv_usbh.c | 184 +- .../libraries/drivers/usb/host/usb_host.h | 1 - .../drivers/usb/host/usb_host_devices.c | 3 +- .../drivers/usb/host/usb_host_ehci.c | 50 +- .../drivers/usb/host/usb_host_ehci.h | 39 + .../drivers/usb/host/usb_host_framework.c | 1 - .../libraries/drivers/usb/host/usb_host_hci.c | 1 - .../libraries/drivers/usb/host/usb_host_hci.h | 2 +- bsp/imxrt/libraries/drivers/usb/include/usb.h | 1 + .../drivers/usb/include/usb_host_config.h | 161 +- .../libraries/drivers/usb/include/usb_misc.h | 336 ++- .../libraries/m480/rtt_port/drv_usbhost.c | 2 +- bsp/rx/applications/application.c | 2 +- bsp/stm32/libraries/HAL_Drivers/drv_usbh.c | 2 +- components/drivers/Kconfig | 8 + components/drivers/usb/usbhost/class/hid.c | 130 +- components/drivers/usb/usbhost/class/hid.h | 10 +- components/drivers/usb/usbhost/class/umouse.c | 25 +- components/drivers/usb/usbhost/core/hub.c | 1 + components/drivers/usb/usbhost/core/usbhost.c | 10 + 64 files changed, 575 insertions(+), 14814 deletions(-) delete mode 100644 bsp/imxrt/imxrt1052-sc-internal/.config delete mode 100644 bsp/imxrt/imxrt1052-sc-internal/.vscode/c_cpp_properties.json delete mode 100644 bsp/imxrt/imxrt1052-sc-internal/.vscode/launch.json delete mode 100644 bsp/imxrt/imxrt1052-sc-internal/Kconfig delete mode 100644 bsp/imxrt/imxrt1052-sc-internal/README.md delete mode 100644 bsp/imxrt/imxrt1052-sc-internal/SConscript delete mode 100644 bsp/imxrt/imxrt1052-sc-internal/SConstruct delete mode 100644 bsp/imxrt/imxrt1052-sc-internal/applications/SConscript delete mode 100644 bsp/imxrt/imxrt1052-sc-internal/applications/main.c delete mode 100644 bsp/imxrt/imxrt1052-sc-internal/board/Kconfig delete mode 100644 bsp/imxrt/imxrt1052-sc-internal/board/MCUX_Config/MCUX_Config.mex delete mode 100644 bsp/imxrt/imxrt1052-sc-internal/board/MCUX_Config/clock_config.c delete mode 100644 bsp/imxrt/imxrt1052-sc-internal/board/MCUX_Config/clock_config.h delete mode 100644 bsp/imxrt/imxrt1052-sc-internal/board/MCUX_Config/pin_mux.c delete mode 100644 bsp/imxrt/imxrt1052-sc-internal/board/MCUX_Config/pin_mux.h delete mode 100644 bsp/imxrt/imxrt1052-sc-internal/board/SConscript delete mode 100644 bsp/imxrt/imxrt1052-sc-internal/board/board.c delete mode 100644 bsp/imxrt/imxrt1052-sc-internal/board/board.h delete mode 100644 bsp/imxrt/imxrt1052-sc-internal/board/linker_scripts/link.icf delete mode 100644 bsp/imxrt/imxrt1052-sc-internal/board/linker_scripts/link.lds delete mode 100644 bsp/imxrt/imxrt1052-sc-internal/board/linker_scripts/link.sct delete mode 100644 bsp/imxrt/imxrt1052-sc-internal/figures/board.png delete mode 100644 bsp/imxrt/imxrt1052-sc-internal/project.ewd delete mode 100644 bsp/imxrt/imxrt1052-sc-internal/project.ewp delete mode 100644 bsp/imxrt/imxrt1052-sc-internal/project.eww delete mode 100644 bsp/imxrt/imxrt1052-sc-internal/project.uvoptx delete mode 100644 bsp/imxrt/imxrt1052-sc-internal/project.uvprojx delete mode 100644 bsp/imxrt/imxrt1052-sc-internal/rtconfig.h delete mode 100644 bsp/imxrt/imxrt1052-sc-internal/rtconfig.py delete mode 100644 bsp/imxrt/imxrt1052-sc-internal/template.ewd delete mode 100644 bsp/imxrt/imxrt1052-sc-internal/template.ewp delete mode 100644 bsp/imxrt/imxrt1052-sc-internal/template.ewt delete mode 100644 bsp/imxrt/imxrt1052-sc-internal/template.eww delete mode 100644 bsp/imxrt/imxrt1052-sc-internal/template.uvoptx delete mode 100644 bsp/imxrt/imxrt1052-sc-internal/template.uvprojx delete mode 100644 bsp/imxrt/imxrt1052-sc-internal/xip/SConscript delete mode 100644 bsp/imxrt/imxrt1052-sc-internal/xip/fsl_flexspi_nor_boot.c delete mode 100644 bsp/imxrt/imxrt1052-sc-internal/xip/fsl_flexspi_nor_boot.h delete mode 100644 bsp/imxrt/imxrt1052-sc-internal/xip/fsl_flexspi_nor_config.c delete mode 100644 bsp/imxrt/imxrt1052-sc-internal/xip/fsl_flexspi_nor_config.h diff --git a/bsp/imxrt/imxrt1052-sc-internal/.config b/bsp/imxrt/imxrt1052-sc-internal/.config deleted file mode 100644 index 8c9b6cfc6f..0000000000 --- a/bsp/imxrt/imxrt1052-sc-internal/.config +++ /dev/null @@ -1,450 +0,0 @@ -# -# Automatically generated file; DO NOT EDIT. -# RT-Thread Configuration -# - -# -# RT-Thread Kernel -# -CONFIG_RT_NAME_MAX=8 -# CONFIG_RT_USING_ARCH_DATA_TYPE is not set -# CONFIG_RT_USING_SMP is not set -CONFIG_RT_ALIGN_SIZE=4 -# CONFIG_RT_THREAD_PRIORITY_8 is not set -CONFIG_RT_THREAD_PRIORITY_32=y -# CONFIG_RT_THREAD_PRIORITY_256 is not set -CONFIG_RT_THREAD_PRIORITY_MAX=32 -CONFIG_RT_TICK_PER_SECOND=100 -CONFIG_RT_USING_OVERFLOW_CHECK=y -CONFIG_RT_USING_HOOK=y -CONFIG_RT_USING_IDLE_HOOK=y -CONFIG_RT_IDLE_HOOK_LIST_SIZE=4 -CONFIG_IDLE_THREAD_STACK_SIZE=256 -# CONFIG_RT_USING_TIMER_SOFT is not set -CONFIG_RT_DEBUG=y -CONFIG_RT_DEBUG_COLOR=y -# CONFIG_RT_DEBUG_INIT_CONFIG is not set -# CONFIG_RT_DEBUG_THREAD_CONFIG is not set -# CONFIG_RT_DEBUG_SCHEDULER_CONFIG is not set -# CONFIG_RT_DEBUG_IPC_CONFIG is not set -# CONFIG_RT_DEBUG_TIMER_CONFIG is not set -# CONFIG_RT_DEBUG_IRQ_CONFIG is not set -# CONFIG_RT_DEBUG_MEM_CONFIG is not set -# CONFIG_RT_DEBUG_SLAB_CONFIG is not set -# CONFIG_RT_DEBUG_MEMHEAP_CONFIG is not set -# CONFIG_RT_DEBUG_MODULE_CONFIG is not set - -# -# Inter-Thread communication -# -CONFIG_RT_USING_SEMAPHORE=y -CONFIG_RT_USING_MUTEX=y -CONFIG_RT_USING_EVENT=y -CONFIG_RT_USING_MAILBOX=y -CONFIG_RT_USING_MESSAGEQUEUE=y -# CONFIG_RT_USING_SIGNALS is not set - -# -# Memory Management -# -CONFIG_RT_USING_MEMPOOL=y -CONFIG_RT_USING_MEMHEAP=y -# CONFIG_RT_USING_NOHEAP is not set -# CONFIG_RT_USING_SMALL_MEM is not set -# CONFIG_RT_USING_SLAB is not set -CONFIG_RT_USING_MEMHEAP_AS_HEAP=y -# CONFIG_RT_USING_USERHEAP is not set -CONFIG_RT_USING_HEAP=y - -# -# Kernel Device Object -# -CONFIG_RT_USING_DEVICE=y -# CONFIG_RT_USING_DEVICE_OPS is not set -# CONFIG_RT_USING_INTERRUPT_INFO is not set -CONFIG_RT_USING_CONSOLE=y -CONFIG_RT_CONSOLEBUF_SIZE=128 -CONFIG_RT_CONSOLE_DEVICE_NAME="uart1" -CONFIG_RT_VER_NUM=0x40003 -# CONFIG_RT_USING_CPU_FFS is not set -# CONFIG_ARCH_CPU_STACK_GROWS_UPWARD is not set - -# -# RT-Thread Components -# -CONFIG_RT_USING_COMPONENTS_INIT=y -CONFIG_RT_USING_USER_MAIN=y -CONFIG_RT_MAIN_THREAD_STACK_SIZE=2048 -CONFIG_RT_MAIN_THREAD_PRIORITY=10 - -# -# C++ features -# -# CONFIG_RT_USING_CPLUSPLUS is not set - -# -# Command shell -# -CONFIG_RT_USING_FINSH=y -CONFIG_FINSH_THREAD_NAME="tshell" -CONFIG_FINSH_USING_HISTORY=y -CONFIG_FINSH_HISTORY_LINES=5 -CONFIG_FINSH_USING_SYMTAB=y -CONFIG_FINSH_USING_DESCRIPTION=y -# CONFIG_FINSH_ECHO_DISABLE_DEFAULT is not set -CONFIG_FINSH_THREAD_PRIORITY=20 -CONFIG_FINSH_THREAD_STACK_SIZE=4096 -CONFIG_FINSH_CMD_SIZE=80 -# CONFIG_FINSH_USING_AUTH is not set -CONFIG_FINSH_USING_MSH=y -CONFIG_FINSH_USING_MSH_DEFAULT=y -CONFIG_FINSH_USING_MSH_ONLY=y -CONFIG_FINSH_ARG_MAX=10 - -# -# Device virtual file system -# -CONFIG_RT_USING_DFS=y -CONFIG_DFS_USING_WORKDIR=y -CONFIG_DFS_FILESYSTEMS_MAX=2 -CONFIG_DFS_FILESYSTEM_TYPES_MAX=2 -CONFIG_DFS_FD_MAX=16 -# CONFIG_RT_USING_DFS_MNTTABLE is not set -# CONFIG_RT_USING_DFS_ELMFAT is not set -CONFIG_RT_USING_DFS_DEVFS=y -# CONFIG_RT_USING_DFS_ROMFS is not set -# CONFIG_RT_USING_DFS_RAMFS is not set -# CONFIG_RT_USING_DFS_UFFS is not set -# CONFIG_RT_USING_DFS_JFFS2 is not set - -# -# Device Drivers -# -CONFIG_RT_USING_DEVICE_IPC=y -CONFIG_RT_PIPE_BUFSZ=512 -# CONFIG_RT_USING_SYSTEM_WORKQUEUE is not set -CONFIG_RT_USING_SERIAL=y -CONFIG_RT_SERIAL_USING_DMA=y -CONFIG_RT_SERIAL_RB_BUFSZ=64 -# CONFIG_RT_USING_CAN is not set -# CONFIG_RT_USING_HWTIMER is not set -CONFIG_RT_USING_CPUTIME=y -# CONFIG_RT_USING_I2C is not set -# CONFIG_RT_USING_PHY is not set -CONFIG_RT_USING_PIN=y -# CONFIG_RT_USING_ADC is not set -# CONFIG_RT_USING_DAC is not set -# CONFIG_RT_USING_PWM is not set -# CONFIG_RT_USING_MTD_NOR is not set -# CONFIG_RT_USING_MTD_NAND is not set -# CONFIG_RT_USING_PM is not set -# CONFIG_RT_USING_RTC is not set -# CONFIG_RT_USING_SDIO is not set -# CONFIG_RT_USING_SPI is not set -# CONFIG_RT_USING_WDT is not set -# CONFIG_RT_USING_AUDIO is not set -# CONFIG_RT_USING_SENSOR is not set -# CONFIG_RT_USING_TOUCH is not set -# CONFIG_RT_USING_HWCRYPTO is not set -CONFIG_RT_USING_PULSE_ENCODER=y -# CONFIG_RT_USING_INPUT_CAPTURE is not set -# CONFIG_RT_USING_WIFI is not set - -# -# Using USB -# -CONFIG_RT_USING_USB_HOST=y -CONFIG_RT_USBH_MSTORAGE=y -CONFIG_UDISK_MOUNTPOINT="/" -# CONFIG_RT_USING_USB_DEVICE is not set -CONFIG_RT_USBD_THREAD_STACK_SZ=4096 - -# -# POSIX layer and C standard library -# -CONFIG_RT_USING_LIBC=y -# CONFIG_RT_USING_PTHREADS is not set -CONFIG_RT_USING_POSIX=y -# CONFIG_RT_USING_POSIX_MMAP is not set -# CONFIG_RT_USING_POSIX_TERMIOS is not set -# CONFIG_RT_USING_POSIX_GETLINE is not set -# CONFIG_RT_USING_POSIX_AIO is not set -# CONFIG_RT_USING_MODULE is not set - -# -# Network -# - -# -# Socket abstraction layer -# -# CONFIG_RT_USING_SAL is not set - -# -# Network interface device -# -# CONFIG_RT_USING_NETDEV is not set - -# -# light weight TCP/IP stack -# -# CONFIG_RT_USING_LWIP is not set - -# -# AT commands -# -# CONFIG_RT_USING_AT is not set - -# -# VBUS(Virtual Software BUS) -# -# CONFIG_RT_USING_VBUS is not set - -# -# Utilities -# -# CONFIG_RT_USING_RYM is not set -# CONFIG_RT_USING_ULOG is not set -# CONFIG_RT_USING_UTEST is not set - -# -# RT-Thread online packages -# - -# -# IoT - internet of things -# -# CONFIG_PKG_USING_PAHOMQTT is not set -# CONFIG_PKG_USING_WEBCLIENT is not set -# CONFIG_PKG_USING_WEBNET is not set -# CONFIG_PKG_USING_MONGOOSE is not set -# CONFIG_PKG_USING_MYMQTT is not set -# CONFIG_PKG_USING_MQTTCLIENT is not set -# CONFIG_PKG_USING_WEBTERMINAL is not set -# CONFIG_PKG_USING_CJSON is not set -# CONFIG_PKG_USING_JSMN is not set -# CONFIG_PKG_USING_LIBMODBUS is not set -# CONFIG_PKG_USING_FREEMODBUS is not set -# CONFIG_PKG_USING_LJSON is not set -# CONFIG_PKG_USING_EZXML is not set -# CONFIG_PKG_USING_NANOPB is not set - -# -# Wi-Fi -# - -# -# Marvell WiFi -# -# CONFIG_PKG_USING_WLANMARVELL is not set - -# -# Wiced WiFi -# -# CONFIG_PKG_USING_WLAN_WICED is not set -# CONFIG_PKG_USING_RW007 is not set -# CONFIG_PKG_USING_COAP is not set -# CONFIG_PKG_USING_NOPOLL is not set -# CONFIG_PKG_USING_NETUTILS is not set -# CONFIG_PKG_USING_PPP_DEVICE is not set -# CONFIG_PKG_USING_AT_DEVICE is not set -# CONFIG_PKG_USING_ATSRV_SOCKET is not set -# CONFIG_PKG_USING_WIZNET is not set - -# -# IoT Cloud -# -# CONFIG_PKG_USING_ONENET is not set -# CONFIG_PKG_USING_GAGENT_CLOUD is not set -# CONFIG_PKG_USING_ALI_IOTKIT is not set -# CONFIG_PKG_USING_AZURE is not set -# CONFIG_PKG_USING_TENCENT_IOTHUB is not set -# CONFIG_PKG_USING_JIOT-C-SDK is not set -# CONFIG_PKG_USING_UCLOUD_IOT_SDK is not set -# CONFIG_PKG_USING_NIMBLE is not set -# CONFIG_PKG_USING_OTA_DOWNLOADER is not set -# CONFIG_PKG_USING_IPMSG is not set -# CONFIG_PKG_USING_LSSDP is not set -# CONFIG_PKG_USING_AIRKISS_OPEN is not set -# CONFIG_PKG_USING_LIBRWS is not set -# CONFIG_PKG_USING_TCPSERVER is not set -# CONFIG_PKG_USING_PROTOBUF_C is not set -# CONFIG_PKG_USING_ONNX_PARSER is not set -# CONFIG_PKG_USING_ONNX_BACKEND is not set -# CONFIG_PKG_USING_DLT645 is not set -# CONFIG_PKG_USING_QXWZ is not set -# CONFIG_PKG_USING_SMTP_CLIENT is not set -# CONFIG_PKG_USING_ABUP_FOTA is not set -# CONFIG_PKG_USING_LIBCURL2RTT is not set -# CONFIG_PKG_USING_CAPNP is not set -# CONFIG_PKG_USING_RT_CJSON_TOOLS is not set -# CONFIG_PKG_USING_AGILE_TELNET is not set - -# -# security packages -# -# CONFIG_PKG_USING_MBEDTLS is not set -# CONFIG_PKG_USING_libsodium is not set -# CONFIG_PKG_USING_TINYCRYPT is not set -# CONFIG_PKG_USING_TFM is not set - -# -# language packages -# -# CONFIG_PKG_USING_LUA is not set -# CONFIG_PKG_USING_JERRYSCRIPT is not set -# CONFIG_PKG_USING_MICROPYTHON is not set - -# -# multimedia packages -# -# CONFIG_PKG_USING_OPENMV is not set -# CONFIG_PKG_USING_MUPDF is not set -# CONFIG_PKG_USING_STEMWIN is not set -# CONFIG_PKG_USING_WAVPLAYER is not set -# CONFIG_PKG_USING_TJPGD is not set - -# -# tools packages -# -# CONFIG_PKG_USING_CMBACKTRACE is not set -# CONFIG_PKG_USING_EASYFLASH is not set -# CONFIG_PKG_USING_EASYLOGGER is not set -# CONFIG_PKG_USING_SYSTEMVIEW is not set -# CONFIG_PKG_USING_RDB is not set -# CONFIG_PKG_USING_QRCODE is not set -# CONFIG_PKG_USING_ULOG_EASYFLASH is not set -# CONFIG_PKG_USING_ADBD is not set -# CONFIG_PKG_USING_COREMARK is not set -# CONFIG_PKG_USING_DHRYSTONE is not set -# CONFIG_PKG_USING_NR_MICRO_SHELL is not set -# CONFIG_PKG_USING_CHINESE_FONT_LIBRARY is not set -# CONFIG_PKG_USING_LUNAR_CALENDAR is not set -# CONFIG_PKG_USING_BS8116A is not set - -# -# system packages -# -# CONFIG_PKG_USING_GUIENGINE is not set -# CONFIG_PKG_USING_CAIRO is not set -# CONFIG_PKG_USING_PIXMAN is not set -# CONFIG_PKG_USING_LWEXT4 is not set -# CONFIG_PKG_USING_PARTITION is not set -# CONFIG_PKG_USING_FAL is not set -# CONFIG_PKG_USING_SQLITE is not set -# CONFIG_PKG_USING_RTI is not set -# CONFIG_PKG_USING_LITTLEVGL2RTT is not set -# CONFIG_PKG_USING_CMSIS is not set -# CONFIG_PKG_USING_DFS_YAFFS is not set -# CONFIG_PKG_USING_LITTLEFS is not set -# CONFIG_PKG_USING_THREAD_POOL is not set -# CONFIG_PKG_USING_ROBOTS is not set -# CONFIG_PKG_USING_EV is not set -# CONFIG_PKG_USING_SYSWATCH is not set - -# -# peripheral libraries and drivers -# -# CONFIG_PKG_USING_SENSORS_DRIVERS is not set -# CONFIG_PKG_USING_REALTEK_AMEBA is not set -# CONFIG_PKG_USING_SHT2X is not set -# CONFIG_PKG_USING_SHT3X is not set -# CONFIG_PKG_USING_STM32_SDIO is not set -# CONFIG_PKG_USING_ICM20608 is not set -# CONFIG_PKG_USING_U8G2 is not set -# CONFIG_PKG_USING_BUTTON is not set -# CONFIG_PKG_USING_PCF8574 is not set -# CONFIG_PKG_USING_SX12XX is not set -# CONFIG_PKG_USING_SIGNAL_LED is not set -# CONFIG_PKG_USING_LEDBLINK is not set -# CONFIG_PKG_USING_LITTLED is not set -# CONFIG_PKG_USING_WM_LIBRARIES is not set -# CONFIG_PKG_USING_KENDRYTE_SDK is not set -# CONFIG_PKG_USING_INFRARED is not set -# CONFIG_PKG_USING_ROSSERIAL is not set -# CONFIG_PKG_USING_AGILE_BUTTON is not set -# CONFIG_PKG_USING_AGILE_LED is not set -# CONFIG_PKG_USING_AT24CXX is not set -# CONFIG_PKG_USING_MOTIONDRIVER2RTT is not set -# CONFIG_PKG_USING_AD7746 is not set -# CONFIG_PKG_USING_PCA9685 is not set -# CONFIG_PKG_USING_I2C_TOOLS is not set -# CONFIG_PKG_USING_NRF24L01 is not set -# CONFIG_PKG_USING_TOUCH_DRIVERS is not set -# CONFIG_PKG_USING_MAX17048 is not set -# CONFIG_PKG_USING_RPLIDAR is not set -# CONFIG_PKG_USING_AS608 is not set -# CONFIG_PKG_USING_RC522 is not set -# CONFIG_PKG_USING_EMBARC_BSP is not set - -# -# miscellaneous packages -# -# CONFIG_PKG_USING_LIBCSV is not set -# CONFIG_PKG_USING_OPTPARSE is not set -# CONFIG_PKG_USING_FASTLZ is not set -# CONFIG_PKG_USING_MINILZO is not set -# CONFIG_PKG_USING_QUICKLZ is not set -# CONFIG_PKG_USING_MULTIBUTTON is not set -# CONFIG_PKG_USING_FLEXIBLE_BUTTON is not set -# CONFIG_PKG_USING_CANFESTIVAL is not set -# CONFIG_PKG_USING_ZLIB is not set -# CONFIG_PKG_USING_DSTR is not set -# CONFIG_PKG_USING_TINYFRAME is not set -# CONFIG_PKG_USING_KENDRYTE_DEMO is not set -# CONFIG_PKG_USING_DIGITALCTRL is not set -# CONFIG_PKG_USING_UPACKER is not set -# CONFIG_PKG_USING_UPARAM is not set - -# -# samples: kernel and components samples -# -# CONFIG_PKG_USING_KERNEL_SAMPLES is not set -# CONFIG_PKG_USING_FILESYSTEM_SAMPLES is not set -# CONFIG_PKG_USING_NETWORK_SAMPLES is not set -# CONFIG_PKG_USING_PERIPHERAL_SAMPLES is not set -# CONFIG_PKG_USING_HELLO is not set -# CONFIG_PKG_USING_VI is not set -# CONFIG_PKG_USING_NNOM is not set -# CONFIG_PKG_USING_LIBANN is not set -# CONFIG_PKG_USING_ELAPACK is not set -# CONFIG_PKG_USING_ARMv7M_DWT is not set -# CONFIG_PKG_USING_VT100 is not set -# CONFIG_PKG_USING_ULAPACK is not set -# CONFIG_PKG_USING_UKAL is not set - -# -# Hardware Drivers Config -# -CONFIG_SOC_IMXRT1052CVL5B=y - -# -# On-chip Peripheral Drivers -# -# CONFIG_BSP_USING_DMA is not set -CONFIG_BSP_USING_GPIO=y -CONFIG_BSP_USING_LPUART=y -CONFIG_BSP_USING_LPUART1=y -# CONFIG_BSP_LPUART1_RX_USING_DMA is not set -# CONFIG_BSP_LPUART1_TX_USING_DMA is not set -# CONFIG_BSP_USING_LPUART4 is not set -# CONFIG_BSP_USING_PWM is not set -# CONFIG_BSP_USING_I2C is not set -# CONFIG_BSP_USING_SPI is not set -CONFIG_BSP_USING_PULSE_ENCODER=y -CONFIG_BSP_USING_PULSE_ENCODER1=y -CONFIG_BSP_USING_USB=y -CONFIG_BSP_USING_USB0=y -CONFIG_BSP_USB0_HOST=y -# CONFIG_BSP_USB0_DEVICE is not set -# CONFIG_BSP_USING_USB1 is not set - -# -# Onboard Peripheral Drivers -# -# CONFIG_BSP_USING_SDRAM is not set -# CONFIG_BSP_USING_MPU6050 is not set - -# -# Board extended module Drivers -# diff --git a/bsp/imxrt/imxrt1052-sc-internal/.vscode/c_cpp_properties.json b/bsp/imxrt/imxrt1052-sc-internal/.vscode/c_cpp_properties.json deleted file mode 100644 index aeaa491edc..0000000000 --- a/bsp/imxrt/imxrt1052-sc-internal/.vscode/c_cpp_properties.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "configurations": [ - { - "name": "Win32", - "includePath": [ - "${workspaceFolder}/**" - ], - "defines": [ - "_DEBUG", - "UNICODE", - "_UNICODE" - ], - "intelliSenseMode": "gcc-x64", - "compilerPath": "C:/Program Files (x86)/GNU Arm Embedded Toolchain/9 2020-q2-update/bin/arm-none-eabi-gcc.exe" - } - ], - "version": 4 -} \ No newline at end of file diff --git a/bsp/imxrt/imxrt1052-sc-internal/.vscode/launch.json b/bsp/imxrt/imxrt1052-sc-internal/.vscode/launch.json deleted file mode 100644 index 19a408f93f..0000000000 --- a/bsp/imxrt/imxrt1052-sc-internal/.vscode/launch.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "name": "Cortex Debug", - "cwd": "${workspaceRoot}", - "executable": "./rtthread.elf", - "request": "launch", - "type": "cortex-debug", - "servertype": "jlink", - "serverpath": "C:/Program Files (x86)/SEGGER/JLink/JLinkGDBServerCL.exe", - "device": "MCIMXRT1052QSPI", - "runToMain": true, - "interface": "swd" - } - ] -} \ No newline at end of file diff --git a/bsp/imxrt/imxrt1052-sc-internal/Kconfig b/bsp/imxrt/imxrt1052-sc-internal/Kconfig deleted file mode 100644 index c9221717cb..0000000000 --- a/bsp/imxrt/imxrt1052-sc-internal/Kconfig +++ /dev/null @@ -1,16 +0,0 @@ -mainmenu "RT-Thread Configuration" - -config RTT_DIR - string - option env="RTT_ROOT" - default "../../.." - -config PKGS_DIR - string - option env="PKGS_ROOT" - default "packages" - -source "$RTT_DIR/Kconfig" -source "$PKGS_DIR/Kconfig" -source "../libraries/Kconfig" -source "board/Kconfig" diff --git a/bsp/imxrt/imxrt1052-sc-internal/README.md b/bsp/imxrt/imxrt1052-sc-internal/README.md deleted file mode 100644 index 476a9528f2..0000000000 --- a/bsp/imxrt/imxrt1052-sc-internal/README.md +++ /dev/null @@ -1,123 +0,0 @@ -# BSP README 模板 - -## 简介 - -本文档为 xxx 开发板的 BSP (板级支持包) 说明。 - -主要内容如下: - -- 开发板资源介绍 -- BSP 快速上手 -- 进阶使用方法 - -通过阅读快速上手章节开发者可以快速地上手该 BSP,将 RT-Thread 运行在开发板上。在进阶使用指南章节,将会介绍更多高级功能,帮助开发者利用 RT-Thread 驱动更多板载资源。 - -## 开发板介绍 - -【此处简单介绍一下开发板】 - -开发板外观如下图所示: - -![board](figures/board.png) - -该开发板常用 **板载资源** 如下: - -- MCU:MIMXRT105xxx,主频 xxxMHz,xxxKB FLASH ,xxxKB RAM -- 外部 RAM:型号,xMB -- 外部 FLASH:型号,xMB -- 常用外设 - - LED:x个,DS0(红色,PB1),DS1(绿色,PB0) - - 按键:x个,K0(兼具唤醒功能,PA0),K1(PC13) -- 常用接口:USB 转串口、SD 卡接口、以太网接口、LCD 接口等 -- 调试接口,标准 JTAG/SWD - -开发板更多详细信息请参考【厂商名】 [xxx开发板介绍](https://xxx)。 - -## 外设支持 - -本 BSP 目前对外设的支持情况如下: - -| **板载外设** | **支持情况** | **备注** | -| :----------------- | :----------: | :------------------------------------- | -| USB 转串口 | 支持 | | -| SPI Flash | 支持 | | -| 以太网 | 支持 | | -| SD卡 | 暂不支持 | | -| CAN | 暂不支持 | | -| **片上外设** | **支持情况** | **备注** | -| GPIO | 支持 | PA0, PA1... PK15 ---> PIN: 0, 1...176 | -| UART | 支持 | UART1/x/x | -| SPI | 支持 | SPI1/x/x | -| I2C | 支持 | 软件 I2C | -| SDIO | 暂不支持 | 即将支持 | -| RTC | 暂不支持 | 即将支持 | -| PWM | 暂不支持 | 即将支持 | -| USB Device | 暂不支持 | 即将支持 | -| USB Host | 暂不支持 | 即将支持 | -| IWG | 暂不支持 | 即将支持 | -| **扩展模块** | **支持情况** | **备注** | -| xxx 模块 | 支持 | | - -## 使用说明 - -使用说明分为如下两个章节: - -- 快速上手 - - 本章节是为刚接触 RT-Thread 的新手准备的使用说明,遵循简单的步骤即可将 RT-Thread 操作系统运行在该开发板上,看到实验效果 。 - -- 进阶使用 - - 本章节是为需要在 RT-Thread 操作系统上使用更多开发板资源的开发者准备的。通过使用 ENV 工具对 BSP 进行配置,可以开启更多板载资源,实现更多高级功能。 - - -### 快速上手 - -本 BSP 为开发者提供 MDK4、MDK5 和 IAR 工程,并且支持 GCC 开发环境。下面以 MDK5 开发环境为例,介绍如何将系统运行起来。 - -#### 硬件连接 - -使用数据线连接开发板到 PC,打开电源开关。 - -#### 编译下载 - -双击 project.uvprojx 文件,打开 MDK5 工程,编译并下载程序到开发板。 - -> 工程默认配置使用 xxx 仿真器下载程序,在通过 xxx 连接开发板的基础上,点击下载按钮即可下载程序到开发板 - -#### 运行结果 - -下载程序成功之后,系统会自动运行,【这里写开发板运行起来之后的现象,如:LED 闪烁等】。 - -连接开发板对应串口到 PC , 在终端工具里打开相应的串口(115200-8-1-N),复位设备后,可以看到 RT-Thread 的输出信息: - -```bash - \ | / -- RT - Thread Operating System - / | \ 3.1.1 build Nov 19 2018 - 2006 - 2018 Copyright by rt-thread team -msh > -``` -### 进阶使用 - -此 BSP 默认只开启了 GPIO 和 串口1 的功能,如果需使用 SD 卡、Flash 等更多高级功能,需要利用 ENV 工具对BSP 进行配置,步骤如下: - -1. 在 bsp 下打开 env 工具。 - -2. 输入`menuconfig`命令配置工程,配置好之后保存退出。 - -3. 输入`pkgs --update`命令更新软件包。 - -4. 输入`scons --target=mdk4/mdk5/iar` 命令重新生成工程。 - -本章节更多详细的介绍请参考 [IMXRT 系列 BSP 外设驱动使用教程](../docs/IMXRT系列BSP外设驱动使用教程.md)。 - -## 注意事项 - -- xxx - -## 联系人信息 - -维护人: - -- [xxx](https://个人主页), 邮箱: \ No newline at end of file diff --git a/bsp/imxrt/imxrt1052-sc-internal/SConscript b/bsp/imxrt/imxrt1052-sc-internal/SConscript deleted file mode 100644 index c7ef7659ec..0000000000 --- a/bsp/imxrt/imxrt1052-sc-internal/SConscript +++ /dev/null @@ -1,14 +0,0 @@ -# for module compiling -import os -from building import * - -cwd = GetCurrentDir() -objs = [] -list = os.listdir(cwd) - -for d in list: - path = os.path.join(cwd, d) - if os.path.isfile(os.path.join(path, 'SConscript')): - objs = objs + SConscript(os.path.join(d, 'SConscript')) - -Return('objs') diff --git a/bsp/imxrt/imxrt1052-sc-internal/SConstruct b/bsp/imxrt/imxrt1052-sc-internal/SConstruct deleted file mode 100644 index 9e5cd55bc0..0000000000 --- a/bsp/imxrt/imxrt1052-sc-internal/SConstruct +++ /dev/null @@ -1,71 +0,0 @@ -import os -import sys -import rtconfig - -if os.getenv('RTT_ROOT'): - RTT_ROOT = os.getenv('RTT_ROOT') -else: - RTT_ROOT = os.path.normpath(os.getcwd() + '/../../..') - -sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools')] -try: - from building import * -except: - print('Cannot found RT-Thread root directory, please check RTT_ROOT') - print(RTT_ROOT) - exit(-1) - -TARGET = 'rtthread.' + rtconfig.TARGET_EXT -DefaultEnvironment(tools=[]) -if rtconfig.PLATFORM == 'armcc': - env = Environment(tools = ['mingw'], - AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS, - CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS, - CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS, - AR = rtconfig.AR, ARFLAGS = '-rc', - LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS, - # overwrite cflags, because cflags has '--C99' - CXXCOM = '$CXX -o $TARGET --cpp -c $CXXFLAGS $_CCCOMCOM $SOURCES') -else: - env = Environment(tools = ['mingw'], - AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS, - CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS, - CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS, - AR = rtconfig.AR, ARFLAGS = '-rc', - LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS, - CXXCOM = '$CXX -o $TARGET -c $CXXFLAGS $_CCCOMCOM $SOURCES') - -env.PrependENVPath('PATH', rtconfig.EXEC_PATH) - -if rtconfig.PLATFORM == 'iar': - env.Replace(CCCOM = ['$CC $CCFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -o $TARGET $SOURCES']) - env.Replace(ARFLAGS = ['']) - env.Replace(LINKCOM = env["LINKCOM"] + ' --map rtthread.map') - -Export('RTT_ROOT') -Export('rtconfig') - -SDK_ROOT = os.path.abspath('./') - -if os.path.exists(SDK_ROOT + '/libraries'): - libraries_path_prefix = SDK_ROOT + '/libraries' -else: - libraries_path_prefix = os.path.dirname(SDK_ROOT) + '/libraries' - -SDK_LIB = libraries_path_prefix -Export('SDK_LIB') - -# prepare building environment -objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=False) - -imxrt_library = 'MIMXRT1050' -rtconfig.BSP_LIBRARY_TYPE = imxrt_library - -# include libraries -objs.extend(SConscript(os.path.join(libraries_path_prefix, imxrt_library, 'SConscript'))) - -# include drivers -objs.extend(SConscript(os.path.join(libraries_path_prefix, 'drivers', 'SConscript'))) - -# make a building -DoBuilding(TARGET, objs) diff --git a/bsp/imxrt/imxrt1052-sc-internal/applications/SConscript b/bsp/imxrt/imxrt1052-sc-internal/applications/SConscript deleted file mode 100644 index 78952a658e..0000000000 --- a/bsp/imxrt/imxrt1052-sc-internal/applications/SConscript +++ /dev/null @@ -1,16 +0,0 @@ -import rtconfig -from building import * - -cwd = GetCurrentDir() -src = Glob('*.c') -CPPPATH = [cwd] - -# add for startup script -if rtconfig.CROSS_TOOL == 'gcc': - CPPDEFINES = ['__START=entry'] -else: - CPPDEFINES = [] - -group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH, CPPDEFINES=CPPDEFINES) - -Return('group') diff --git a/bsp/imxrt/imxrt1052-sc-internal/applications/main.c b/bsp/imxrt/imxrt1052-sc-internal/applications/main.c deleted file mode 100644 index 4365059073..0000000000 --- a/bsp/imxrt/imxrt1052-sc-internal/applications/main.c +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2006-2018, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2019-04-29 tyustli first version - */ - -#include -#include "drv_gpio.h" - -/* defined the LED pin: GPIO1_IO9 */ -#define LED0_PIN GET_PIN(1, 9) - -int main(void) -{ - /* set LED0 pin mode to output */ - rt_pin_mode(LED0_PIN, PIN_MODE_OUTPUT); - - while (1) - { - rt_pin_write(LED0_PIN, PIN_HIGH); - rt_thread_mdelay(500); - rt_pin_write(LED0_PIN, PIN_LOW); - rt_thread_mdelay(500); - } -} - diff --git a/bsp/imxrt/imxrt1052-sc-internal/board/Kconfig b/bsp/imxrt/imxrt1052-sc-internal/board/Kconfig deleted file mode 100644 index 896a652279..0000000000 --- a/bsp/imxrt/imxrt1052-sc-internal/board/Kconfig +++ /dev/null @@ -1,240 +0,0 @@ -menu "Hardware Drivers Config" - -config SOC_IMXRT1052CVL5B - bool - select SOC_MIMXRT1050_SERIES - select RT_USING_COMPONENTS_INIT - select RT_USING_USER_MAIN - default y - -menu "On-chip Peripheral Drivers" - - config BSP_USING_DMA - bool "Enable DMA" - default n - - config BSP_USING_GPIO - bool "Enable GPIO" - select RT_USING_PIN - default y - - menuconfig BSP_USING_LPUART - bool "Enable UART" - select RT_USING_SERIAL - default y - - if BSP_USING_LPUART - config BSP_USING_LPUART1 - bool "Enable LPUART1" - default y - - config BSP_LPUART1_RX_USING_DMA - bool "Enable LPUART1 RX DMA" - depends on BSP_USING_LPUART1 - select BSP_USING_DMA - select RT_SERIAL_USING_DMA - default n - - config BSP_LPUART1_RX_DMA_CHANNEL - depends on BSP_LPUART1_RX_USING_DMA - int "Set LPUART1 RX DMA channel (0-32)" - default 0 - - config BSP_LPUART1_TX_USING_DMA - bool "Enable LPUART1 TX DMA" - depends on BSP_USING_LPUART1 - select BSP_USING_DMA - select RT_SERIAL_USING_DMA - default n - - config BSP_LPUART1_TX_DMA_CHANNEL - depends on BSP_LPUART1_TX_USING_DMA - int "Set LPUART1 TX DMA channel (0-32)" - default 1 - config BSP_USING_LPUART4 - bool "Enable LPUART4" - default y - - config BSP_LPUART4_RX_USING_DMA - bool "Enable LPUART4 RX DMA" - depends on BSP_USING_LPUART4 - select BSP_USING_DMA - select RT_SERIAL_USING_DMA - default n - - config BSP_LPUART4_RX_DMA_CHANNEL - depends on BSP_LPUART4_RX_USING_DMA - int "Set LPUART4 RX DMA channel (0-32)" - default 0 - - config BSP_LPUART4_TX_USING_DMA - bool "Enable LPUART4 TX DMA" - depends on BSP_USING_LPUART4 - select BSP_USING_DMA - select RT_SERIAL_USING_DMA - default n - - config BSP_LPUART4_TX_DMA_CHANNEL - depends on BSP_LPUART4_TX_USING_DMA - int "Set LPUART4 TX DMA channel (0-32)" - default 1 - endif - - menuconfig BSP_USING_PWM - bool "Enable PWM" - default n - select RT_USING_PWM - if BSP_USING_PWM - menuconfig BSP_USING_PWM2 - bool "Enable output pwm2" - default n - if BSP_USING_PWM2 - config BSP_USING_PWM2_CH0 - bool "Enable PWM2 channel0" - default n - config BSP_USING_PWM2_CH1 - bool "Enable PWM2 channel1" - default n - config BSP_USING_PWM2_CH2 - bool "Enable PWM2 channel2" - default n - config BSP_USING_PWM2_CH3 - bool "Enable PWM2 channel3" - default n - endif - endif - - menuconfig BSP_USING_I2C - bool "Enable I2C" - select RT_USING_I2C - default n - if BSP_USING_I2C - menuconfig BSP_USING_I2C1 - bool "Enable I2C1" - default n - if BSP_USING_I2C1 - choice - prompt "Select I2C1 badurate" - default HW_I2C1_BADURATE_100kHZ - - config HW_I2C1_BADURATE_100kHZ - bool "Badurate 100kHZ" - - config HW_I2C1_BADURATE_400kHZ - bool "Badurate 400kHZ" - endchoice - endif - menuconfig BSP_USING_I2C2 - bool "Enable I2C2" - default n - if BSP_USING_I2C2 - choice - prompt "Select I2C2 badurate" - default HW_I2C2_BADURATE_100kHZ - - config HW_I2C2_BADURATE_100kHZ - bool "Badurate 100kHZ" - - config HW_I2C2_BADURATE_400kHZ - bool "Badurate 400kHZ" - endchoice - endif - endif - - menuconfig BSP_USING_SPI - bool "Enable SPI" - select RT_USING_SPI - select RT_USING_PIN - default n - - if BSP_USING_SPI - config BSP_USING_SPI4 - bool "Enable SPI4" - default n - - config BSP_SPI4_USING_DMA - bool "Enable SPI4 DMA xfer" - depends on BSP_USING_SPI4 - select BSP_USING_DMA - default n - - config BSP_SPI4_RX_DMA_CHANNEL - depends on BSP_SPI4_USING_DMA - int "Set SPI4 RX DMA channel (0-32)" - default 4 - - config BSP_SPI4_TX_DMA_CHANNEL - depends on BSP_SPI4_USING_DMA - int "Set SPI4 TX DMA channel (0-32)" - default 5 - endif - - menuconfig BSP_USING_PULSE_ENCODER - bool "Enable Pulse Encoder" - select RT_USING_PULSE_ENCODER - default n - - if BSP_USING_PULSE_ENCODER - config BSP_USING_PULSE_ENCODER1 - bool "Enable PULSE_ENCODER1" - default n - endif - - menuconfig BSP_USING_USB - bool "Enable USB" - default n - if BSP_USING_USB - config BSP_USING_USB0 - bool "Enable USB0" - default n - choice - prompt "Select USB0 Role" - depends on BSP_USING_USB0 - default BSP_USB0_HOST - - config BSP_USB0_HOST - bool "Host" - select RT_USING_USB_HOST - - config BSP_USB0_DEVICE - bool "Device" - select RT_USING_USB_DEVICE - endchoice - config BSP_USING_USB1 - bool "Enable USB1" - default n - choice - prompt "Select USB1 Role" - depends on BSP_USING_USB1 - default BSP_USB1_HOST - - config BSP_USB1_HOST - bool "Host" - select RT_USING_USB_HOST - - config BSP_USB1_DEVICE - bool "Device" - select RT_USING_USB_DEVICE - endchoice - endif -endmenu - -menu "Onboard Peripheral Drivers" - - config BSP_USING_SDRAM - bool "Enable SDRAM" - default n - - config BSP_USING_MPU6050 - bool "Enable MPU6050 (I2C1:J11 --> SCL; K11 --> SDA)" - select BSP_USING_I2C1 - select PKG_USING_MPU6XXX - default n - -endmenu - -menu "Board extended module Drivers" - -endmenu - -endmenu diff --git a/bsp/imxrt/imxrt1052-sc-internal/board/MCUX_Config/MCUX_Config.mex b/bsp/imxrt/imxrt1052-sc-internal/board/MCUX_Config/MCUX_Config.mex deleted file mode 100644 index bdb810467f..0000000000 --- a/bsp/imxrt/imxrt1052-sc-internal/board/MCUX_Config/MCUX_Config.mex +++ /dev/null @@ -1,645 +0,0 @@ - - - - MIMXRT1052xxxxB - MIMXRT1052DVL6B - IMXRT1050-EVKB - A - ksdk2_0 - - - - - - - false - false - false - - - - - - - - - 9.0.0 - - - - - - - - - - - Configures pin routing and optionally pin electrical features. - - false - core0 - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 9.0.0 - - - - - - - - - true - - - - - INPUT - - - - - true - - - - - OUTPUT - - - - - true - - - - - INPUT - - - - - true - - - - - OUTPUT - - - - - true - - - - - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true - - - - - - - N/A - - - - - - - - true - - - - - 2.2.4 - - - - - true - - - - - 2.1.5 - - - - - - - - - 9.0.0 - - - - - - - - - 0 - - - - - true - - - - - true - - - - - 0 - - - - - true - - - - - true - - - - - 0 - - - - - true - - - - - true - - - - - 0 - - - - - true - - - - - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - N/A - - - - - - - - - \ No newline at end of file diff --git a/bsp/imxrt/imxrt1052-sc-internal/board/MCUX_Config/clock_config.c b/bsp/imxrt/imxrt1052-sc-internal/board/MCUX_Config/clock_config.c deleted file mode 100644 index 57750fdc73..0000000000 --- a/bsp/imxrt/imxrt1052-sc-internal/board/MCUX_Config/clock_config.c +++ /dev/null @@ -1,476 +0,0 @@ -/* - * How to setup clock using clock driver functions: - * - * 1. Call CLOCK_InitXXXPLL() to configure corresponding PLL clock. - * - * 2. Call CLOCK_InitXXXpfd() to configure corresponding PLL pfd clock. - * - * 3. Call CLOCK_SetMux() to configure corresponding clock source for target clock out. - * - * 4. Call CLOCK_SetDiv() to configure corresponding clock divider for target clock out. - * - * 5. Call CLOCK_SetXtalFreq() to set XTAL frequency based on board settings. - * - */ - -/* TEXT BELOW IS USED AS SETTING FOR TOOLS ************************************* -!!GlobalInfo -product: Clocks v7.0 -processor: MIMXRT1052xxxxB -package_id: MIMXRT1052DVL6B -mcu_data: ksdk2_0 -processor_version: 9.0.0 -board: IMXRT1050-EVKB - * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/ - -#include "clock_config.h" -#include "fsl_iomuxc.h" - -/******************************************************************************* - * Definitions - ******************************************************************************/ - -/******************************************************************************* - * Variables - ******************************************************************************/ -/* System clock frequency. */ -extern uint32_t SystemCoreClock; - -/******************************************************************************* - ************************ BOARD_InitBootClocks function ************************ - ******************************************************************************/ -void BOARD_InitBootClocks(void) -{ - BOARD_BootClockRUN(); -} - -/******************************************************************************* - ********************** Configuration BOARD_BootClockRUN *********************** - ******************************************************************************/ -/* TEXT BELOW IS USED AS SETTING FOR TOOLS ************************************* -!!Configuration -name: BOARD_BootClockRUN -called_from_default_init: true -outputs: -- {id: AHB_CLK_ROOT.outFreq, value: 600 MHz} -- {id: CAN_CLK_ROOT.outFreq, value: 40 MHz} -- {id: CKIL_SYNC_CLK_ROOT.outFreq, value: 32.768 kHz} -- {id: CLK_1M.outFreq, value: 1 MHz} -- {id: CLK_24M.outFreq, value: 24 MHz} -- {id: CSI_CLK_ROOT.outFreq, value: 60 MHz} -- {id: ENET1_TX_CLK.outFreq, value: 2.4 MHz} -- {id: ENET_125M_CLK.outFreq, value: 2.4 MHz} -- {id: ENET_25M_REF_CLK.outFreq, value: 1.2 MHz} -- {id: FLEXIO1_CLK_ROOT.outFreq, value: 30 MHz} -- {id: FLEXIO2_CLK_ROOT.outFreq, value: 30 MHz} -- {id: FLEXSPI_CLK_ROOT.outFreq, value: 2880/11 MHz} -- {id: GPT1_ipg_clk_highfreq.outFreq, value: 75 MHz} -- {id: GPT2_ipg_clk_highfreq.outFreq, value: 75 MHz} -- {id: IPG_CLK_ROOT.outFreq, value: 150 MHz} -- {id: LCDIF_CLK_ROOT.outFreq, value: 67.5/7 MHz} -- {id: LPI2C_CLK_ROOT.outFreq, value: 60 MHz} -- {id: LPSPI_CLK_ROOT.outFreq, value: 105.6 MHz} -- {id: LVDS1_CLK.outFreq, value: 1.2 GHz} -- {id: MQS_MCLK.outFreq, value: 1080/17 MHz} -- {id: PERCLK_CLK_ROOT.outFreq, value: 75 MHz} -- {id: PLL7_MAIN_CLK.outFreq, value: 480 MHz} -- {id: SAI1_CLK_ROOT.outFreq, value: 1080/17 MHz} -- {id: SAI1_MCLK1.outFreq, value: 1080/17 MHz} -- {id: SAI1_MCLK2.outFreq, value: 1080/17 MHz} -- {id: SAI1_MCLK3.outFreq, value: 30 MHz} -- {id: SAI2_CLK_ROOT.outFreq, value: 1080/17 MHz} -- {id: SAI2_MCLK1.outFreq, value: 1080/17 MHz} -- {id: SAI2_MCLK3.outFreq, value: 30 MHz} -- {id: SAI3_CLK_ROOT.outFreq, value: 1080/17 MHz} -- {id: SAI3_MCLK1.outFreq, value: 1080/17 MHz} -- {id: SAI3_MCLK3.outFreq, value: 30 MHz} -- {id: SEMC_CLK_ROOT.outFreq, value: 75 MHz} -- {id: SPDIF0_CLK_ROOT.outFreq, value: 30 MHz} -- {id: TRACE_CLK_ROOT.outFreq, value: 352/3 MHz} -- {id: UART_CLK_ROOT.outFreq, value: 80 MHz} -- {id: USBPHY1_CLK.outFreq, value: 480 MHz} -- {id: USBPHY2_CLK.outFreq, value: 480 MHz} -- {id: USDHC1_CLK_ROOT.outFreq, value: 158.4 MHz} -- {id: USDHC2_CLK_ROOT.outFreq, value: 158.4 MHz} -settings: -- {id: CCM.AHB_PODF.scale, value: '1', locked: true} -- {id: CCM.ARM_PODF.scale, value: '2', locked: true} -- {id: CCM.CSI_CLK_SEL.sel, value: CCM.PLL3_SW_120M_CLK_DIV} -- {id: CCM.CSI_PODF.scale, value: '2', locked: true} -- {id: CCM.FLEXSPI_PODF.scale, value: '1', locked: true} -- {id: CCM.FLEXSPI_SEL.sel, value: CCM_ANALOG.PLL3_PFD0_CLK} -- {id: CCM.LCDIF_PODF.scale, value: '8', locked: true} -- {id: CCM.LCDIF_PRED.scale, value: '7', locked: true} -- {id: CCM.LPSPI_PODF.scale, value: '5', locked: true} -- {id: CCM.PERCLK_PODF.scale, value: '2', locked: true} -- {id: CCM.SEMC_PODF.scale, value: '8'} -- {id: CCM.TRACE_PODF.scale, value: '3', locked: true} -- {id: CCM_ANALOG.PLL1_BYPASS.sel, value: CCM_ANALOG.PLL1} -- {id: CCM_ANALOG.PLL1_PREDIV.scale, value: '1', locked: true} -- {id: CCM_ANALOG.PLL1_VDIV.scale, value: '50', locked: true} -- {id: CCM_ANALOG.PLL2.denom, value: '1', locked: true} -- {id: CCM_ANALOG.PLL2.num, value: '0', locked: true} -- {id: CCM_ANALOG.PLL2_BYPASS.sel, value: CCM_ANALOG.PLL2_OUT_CLK} -- {id: CCM_ANALOG.PLL2_PFD0_BYPASS.sel, value: CCM_ANALOG.PLL2_PFD0} -- {id: CCM_ANALOG.PLL2_PFD1_BYPASS.sel, value: CCM_ANALOG.PLL2_PFD1} -- {id: CCM_ANALOG.PLL2_PFD2_BYPASS.sel, value: CCM_ANALOG.PLL2_PFD2} -- {id: CCM_ANALOG.PLL2_PFD2_DIV.scale, value: '30'} -- {id: CCM_ANALOG.PLL2_PFD3_BYPASS.sel, value: CCM_ANALOG.PLL2_PFD3} -- {id: CCM_ANALOG.PLL3_BYPASS.sel, value: CCM_ANALOG.PLL3} -- {id: CCM_ANALOG.PLL3_PFD0_BYPASS.sel, value: CCM_ANALOG.PLL3_PFD0} -- {id: CCM_ANALOG.PLL3_PFD0_DIV.scale, value: '33', locked: true} -- {id: CCM_ANALOG.PLL3_PFD0_MUL.scale, value: '18', locked: true} -- {id: CCM_ANALOG.PLL3_PFD1_BYPASS.sel, value: CCM_ANALOG.PLL3_PFD1} -- {id: CCM_ANALOG.PLL3_PFD2_BYPASS.sel, value: CCM_ANALOG.PLL3_PFD2} -- {id: CCM_ANALOG.PLL3_PFD3_BYPASS.sel, value: CCM_ANALOG.PLL3_PFD3} -- {id: CCM_ANALOG.PLL4.denom, value: '50'} -- {id: CCM_ANALOG.PLL4.div, value: '47'} -- {id: CCM_ANALOG.PLL5.denom, value: '1'} -- {id: CCM_ANALOG.PLL5.div, value: '40'} -- {id: CCM_ANALOG.PLL5.num, value: '0'} -- {id: CCM_ANALOG.PLL7_BYPASS.sel, value: CCM_ANALOG.PLL7} -- {id: CCM_ANALOG_PLL_ENET_POWERDOWN_CFG, value: 'Yes'} -- {id: CCM_ANALOG_PLL_USB1_EN_USB_CLKS_CFG, value: Enabled} -- {id: CCM_ANALOG_PLL_USB1_EN_USB_CLKS_OUT_CFG, value: Enabled} -- {id: CCM_ANALOG_PLL_USB1_POWER_CFG, value: 'Yes'} -- {id: CCM_ANALOG_PLL_USB2_EN_USB_CLKS_CFG, value: Enabled} -- {id: CCM_ANALOG_PLL_USB2_EN_USB_CLKS_OUT_CFG, value: Enabled} -- {id: CCM_ANALOG_PLL_USB2_POWER_CFG, value: 'Yes'} -sources: -- {id: XTALOSC24M.RTC_OSC.outFreq, value: 32.768 kHz, enabled: true} - * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/ - -/******************************************************************************* - * Variables for BOARD_BootClockRUN configuration - ******************************************************************************/ -const clock_arm_pll_config_t armPllConfig_BOARD_BootClockRUN = - { - .loopDivider = 100, /* PLL loop divider, Fout = Fin * 50 */ - .src = 0, /* Bypass clock source, 0 - OSC 24M, 1 - CLK1_P and CLK1_N */ - }; -const clock_sys_pll_config_t sysPllConfig_BOARD_BootClockRUN = - { - .loopDivider = 1, /* PLL loop divider, Fout = Fin * ( 20 + loopDivider*2 + numerator / denominator ) */ - .numerator = 0, /* 30 bit numerator of fractional loop divider */ - .denominator = 1, /* 30 bit denominator of fractional loop divider */ - .src = 0, /* Bypass clock source, 0 - OSC 24M, 1 - CLK1_P and CLK1_N */ - }; -const clock_usb_pll_config_t usb1PllConfig_BOARD_BootClockRUN = - { - .loopDivider = 0, /* PLL loop divider, Fout = Fin * 20 */ - .src = 0, /* Bypass clock source, 0 - OSC 24M, 1 - CLK1_P and CLK1_N */ - }; -const clock_usb_pll_config_t usb2PllConfig_BOARD_BootClockRUN = - { - .loopDivider = 0, /* PLL loop divider, Fout = Fin * 20 */ - .src = 0, /* Bypass clock source, 0 - OSC 24M, 1 - CLK1_P and CLK1_N */ - }; -/******************************************************************************* - * Code for BOARD_BootClockRUN configuration - ******************************************************************************/ -void BOARD_BootClockRUN(void) -{ - /* Init RTC OSC clock frequency. */ - CLOCK_SetRtcXtalFreq(32768U); - /* Enable 1MHz clock output. */ - XTALOSC24M->OSC_CONFIG2 |= XTALOSC24M_OSC_CONFIG2_ENABLE_1M_MASK; - /* Use free 1MHz clock output. */ - XTALOSC24M->OSC_CONFIG2 &= ~XTALOSC24M_OSC_CONFIG2_MUX_1M_MASK; - /* Set XTAL 24MHz clock frequency. */ - CLOCK_SetXtalFreq(24000000U); - /* Enable XTAL 24MHz clock source. */ - CLOCK_InitExternalClk(0); - /* Enable internal RC. */ - CLOCK_InitRcOsc24M(); - /* Switch clock source to external OSC. */ - CLOCK_SwitchOsc(kCLOCK_XtalOsc); - /* Set Oscillator ready counter value. */ - CCM->CCR = (CCM->CCR & (~CCM_CCR_OSCNT_MASK)) | CCM_CCR_OSCNT(127); - /* Setting PeriphClk2Mux and PeriphMux to provide stable clock before PLLs are initialed */ - CLOCK_SetMux(kCLOCK_PeriphClk2Mux, 1); /* Set PERIPH_CLK2 MUX to OSC */ - CLOCK_SetMux(kCLOCK_PeriphMux, 1); /* Set PERIPH_CLK MUX to PERIPH_CLK2 */ - /* Setting the VDD_SOC to 1.275V. It is necessary to config AHB to 600Mhz. */ - DCDC->REG3 = (DCDC->REG3 & (~DCDC_REG3_TRG_MASK)) | DCDC_REG3_TRG(0x13); - /* Waiting for DCDC_STS_DC_OK bit is asserted */ - while (DCDC_REG0_STS_DC_OK_MASK != (DCDC_REG0_STS_DC_OK_MASK & DCDC->REG0)) - { - } - /* Set AHB_PODF. */ - CLOCK_SetDiv(kCLOCK_AhbDiv, 0); - /* Disable IPG clock gate. */ - CLOCK_DisableClock(kCLOCK_Adc1); - CLOCK_DisableClock(kCLOCK_Adc2); - CLOCK_DisableClock(kCLOCK_Xbar1); - CLOCK_DisableClock(kCLOCK_Xbar2); - CLOCK_DisableClock(kCLOCK_Xbar3); - /* Set IPG_PODF. */ - CLOCK_SetDiv(kCLOCK_IpgDiv, 3); - /* Set ARM_PODF. */ - CLOCK_SetDiv(kCLOCK_ArmDiv, 1); - /* Set PERIPH_CLK2_PODF. */ - CLOCK_SetDiv(kCLOCK_PeriphClk2Div, 0); - /* Disable PERCLK clock gate. */ - CLOCK_DisableClock(kCLOCK_Gpt1); - CLOCK_DisableClock(kCLOCK_Gpt1S); - CLOCK_DisableClock(kCLOCK_Gpt2); - CLOCK_DisableClock(kCLOCK_Gpt2S); - CLOCK_DisableClock(kCLOCK_Pit); - /* Set PERCLK_PODF. */ - CLOCK_SetDiv(kCLOCK_PerclkDiv, 1); - /* Disable USDHC1 clock gate. */ - CLOCK_DisableClock(kCLOCK_Usdhc1); - /* Set USDHC1_PODF. */ - CLOCK_SetDiv(kCLOCK_Usdhc1Div, 1); - /* Set Usdhc1 clock source. */ - CLOCK_SetMux(kCLOCK_Usdhc1Mux, 0); - /* Disable USDHC2 clock gate. */ - CLOCK_DisableClock(kCLOCK_Usdhc2); - /* Set USDHC2_PODF. */ - CLOCK_SetDiv(kCLOCK_Usdhc2Div, 1); - /* Set Usdhc2 clock source. */ - CLOCK_SetMux(kCLOCK_Usdhc2Mux, 0); - /* In SDK projects, SDRAM (configured by SEMC) will be initialized in either debug script or dcd. - * With this macro SKIP_SYSCLK_INIT, system pll (selected to be SEMC source clock in SDK projects) will be left unchanged. - * Note: If another clock source is selected for SEMC, user may want to avoid changing that clock as well.*/ -#ifndef SKIP_SYSCLK_INIT - /* Disable Semc clock gate. */ - CLOCK_DisableClock(kCLOCK_Semc); - /* Set SEMC_PODF. */ - CLOCK_SetDiv(kCLOCK_SemcDiv, 7); - /* Set Semc alt clock source. */ - CLOCK_SetMux(kCLOCK_SemcAltMux, 0); - /* Set Semc clock source. */ - CLOCK_SetMux(kCLOCK_SemcMux, 0); -#endif - /* In SDK projects, external flash (configured by FLEXSPI) will be initialized by dcd. - * With this macro XIP_EXTERNAL_FLASH, usb1 pll (selected to be FLEXSPI clock source in SDK projects) will be left unchanged. - * Note: If another clock source is selected for FLEXSPI, user may want to avoid changing that clock as well.*/ -#if !(defined(XIP_EXTERNAL_FLASH) && (XIP_EXTERNAL_FLASH == 1)) - /* Disable Flexspi clock gate. */ - CLOCK_DisableClock(kCLOCK_FlexSpi); - /* Set FLEXSPI_PODF. */ - CLOCK_SetDiv(kCLOCK_FlexspiDiv, 0); - /* Set Flexspi clock source. */ - CLOCK_SetMux(kCLOCK_FlexspiMux, 3); -#endif - /* Disable CSI clock gate. */ - CLOCK_DisableClock(kCLOCK_Csi); - /* Set CSI_PODF. */ - CLOCK_SetDiv(kCLOCK_CsiDiv, 1); - /* Set Csi clock source. */ - CLOCK_SetMux(kCLOCK_CsiMux, 2); - /* Disable LPSPI clock gate. */ - CLOCK_DisableClock(kCLOCK_Lpspi1); - CLOCK_DisableClock(kCLOCK_Lpspi2); - CLOCK_DisableClock(kCLOCK_Lpspi3); - CLOCK_DisableClock(kCLOCK_Lpspi4); - /* Set LPSPI_PODF. */ - CLOCK_SetDiv(kCLOCK_LpspiDiv, 4); - /* Set Lpspi clock source. */ - CLOCK_SetMux(kCLOCK_LpspiMux, 2); - /* Disable TRACE clock gate. */ - CLOCK_DisableClock(kCLOCK_Trace); - /* Set TRACE_PODF. */ - CLOCK_SetDiv(kCLOCK_TraceDiv, 2); - /* Set Trace clock source. */ - CLOCK_SetMux(kCLOCK_TraceMux, 2); - /* Disable SAI1 clock gate. */ - CLOCK_DisableClock(kCLOCK_Sai1); - /* Set SAI1_CLK_PRED. */ - CLOCK_SetDiv(kCLOCK_Sai1PreDiv, 3); - /* Set SAI1_CLK_PODF. */ - CLOCK_SetDiv(kCLOCK_Sai1Div, 1); - /* Set Sai1 clock source. */ - CLOCK_SetMux(kCLOCK_Sai1Mux, 0); - /* Disable SAI2 clock gate. */ - CLOCK_DisableClock(kCLOCK_Sai2); - /* Set SAI2_CLK_PRED. */ - CLOCK_SetDiv(kCLOCK_Sai2PreDiv, 3); - /* Set SAI2_CLK_PODF. */ - CLOCK_SetDiv(kCLOCK_Sai2Div, 1); - /* Set Sai2 clock source. */ - CLOCK_SetMux(kCLOCK_Sai2Mux, 0); - /* Disable SAI3 clock gate. */ - CLOCK_DisableClock(kCLOCK_Sai3); - /* Set SAI3_CLK_PRED. */ - CLOCK_SetDiv(kCLOCK_Sai3PreDiv, 3); - /* Set SAI3_CLK_PODF. */ - CLOCK_SetDiv(kCLOCK_Sai3Div, 1); - /* Set Sai3 clock source. */ - CLOCK_SetMux(kCLOCK_Sai3Mux, 0); - /* Disable Lpi2c clock gate. */ - CLOCK_DisableClock(kCLOCK_Lpi2c1); - CLOCK_DisableClock(kCLOCK_Lpi2c2); - CLOCK_DisableClock(kCLOCK_Lpi2c3); - /* Set LPI2C_CLK_PODF. */ - CLOCK_SetDiv(kCLOCK_Lpi2cDiv, 0); - /* Set Lpi2c clock source. */ - CLOCK_SetMux(kCLOCK_Lpi2cMux, 0); - /* Disable CAN clock gate. */ - CLOCK_DisableClock(kCLOCK_Can1); - CLOCK_DisableClock(kCLOCK_Can2); - CLOCK_DisableClock(kCLOCK_Can1S); - CLOCK_DisableClock(kCLOCK_Can2S); - /* Set CAN_CLK_PODF. */ - CLOCK_SetDiv(kCLOCK_CanDiv, 1); - /* Set Can clock source. */ - CLOCK_SetMux(kCLOCK_CanMux, 2); - /* Disable UART clock gate. */ - CLOCK_DisableClock(kCLOCK_Lpuart1); - CLOCK_DisableClock(kCLOCK_Lpuart2); - CLOCK_DisableClock(kCLOCK_Lpuart3); - CLOCK_DisableClock(kCLOCK_Lpuart4); - CLOCK_DisableClock(kCLOCK_Lpuart5); - CLOCK_DisableClock(kCLOCK_Lpuart6); - CLOCK_DisableClock(kCLOCK_Lpuart7); - CLOCK_DisableClock(kCLOCK_Lpuart8); - /* Set UART_CLK_PODF. */ - CLOCK_SetDiv(kCLOCK_UartDiv, 0); - /* Set Uart clock source. */ - CLOCK_SetMux(kCLOCK_UartMux, 0); - /* Disable LCDIF clock gate. */ - CLOCK_DisableClock(kCLOCK_LcdPixel); - /* Set LCDIF_PRED. */ - CLOCK_SetDiv(kCLOCK_LcdifPreDiv, 6); - /* Set LCDIF_CLK_PODF. */ - CLOCK_SetDiv(kCLOCK_LcdifDiv, 7); - /* Set Lcdif pre clock source. */ - CLOCK_SetMux(kCLOCK_LcdifPreMux, 5); - /* Disable SPDIF clock gate. */ - CLOCK_DisableClock(kCLOCK_Spdif); - /* Set SPDIF0_CLK_PRED. */ - CLOCK_SetDiv(kCLOCK_Spdif0PreDiv, 1); - /* Set SPDIF0_CLK_PODF. */ - CLOCK_SetDiv(kCLOCK_Spdif0Div, 7); - /* Set Spdif clock source. */ - CLOCK_SetMux(kCLOCK_SpdifMux, 3); - /* Disable Flexio1 clock gate. */ - CLOCK_DisableClock(kCLOCK_Flexio1); - /* Set FLEXIO1_CLK_PRED. */ - CLOCK_SetDiv(kCLOCK_Flexio1PreDiv, 1); - /* Set FLEXIO1_CLK_PODF. */ - CLOCK_SetDiv(kCLOCK_Flexio1Div, 7); - /* Set Flexio1 clock source. */ - CLOCK_SetMux(kCLOCK_Flexio1Mux, 3); - /* Disable Flexio2 clock gate. */ - CLOCK_DisableClock(kCLOCK_Flexio2); - /* Set FLEXIO2_CLK_PRED. */ - CLOCK_SetDiv(kCLOCK_Flexio2PreDiv, 1); - /* Set FLEXIO2_CLK_PODF. */ - CLOCK_SetDiv(kCLOCK_Flexio2Div, 7); - /* Set Flexio2 clock source. */ - CLOCK_SetMux(kCLOCK_Flexio2Mux, 3); - /* Set Pll3 sw clock source. */ - CLOCK_SetMux(kCLOCK_Pll3SwMux, 0); - /* Init ARM PLL. */ - CLOCK_InitArmPll(&armPllConfig_BOARD_BootClockRUN); - /* In SDK projects, SDRAM (configured by SEMC) will be initialized in either debug script or dcd. - * With this macro SKIP_SYSCLK_INIT, system pll (selected to be SEMC source clock in SDK projects) will be left unchanged. - * Note: If another clock source is selected for SEMC, user may want to avoid changing that clock as well.*/ -#ifndef SKIP_SYSCLK_INIT -#if defined(XIP_BOOT_HEADER_DCD_ENABLE) && (XIP_BOOT_HEADER_DCD_ENABLE == 1) - #warning "SKIP_SYSCLK_INIT should be defined to keep system pll (selected to be SEMC source clock in SDK projects) unchanged." -#endif - /* Init System PLL. */ - CLOCK_InitSysPll(&sysPllConfig_BOARD_BootClockRUN); - /* Init System pfd0. */ - CLOCK_InitSysPfd(kCLOCK_Pfd0, 27); - /* Init System pfd1. */ - CLOCK_InitSysPfd(kCLOCK_Pfd1, 16); - /* Init System pfd2. */ - CLOCK_InitSysPfd(kCLOCK_Pfd2, 30); - /* Init System pfd3. */ - CLOCK_InitSysPfd(kCLOCK_Pfd3, 16); - /* Disable pfd offset. */ - CCM_ANALOG->PLL_SYS &= ~CCM_ANALOG_PLL_SYS_PFD_OFFSET_EN_MASK; -#endif - /* In SDK projects, external flash (configured by FLEXSPI) will be initialized by dcd. - * With this macro XIP_EXTERNAL_FLASH, usb1 pll (selected to be FLEXSPI clock source in SDK projects) will be left unchanged. - * Note: If another clock source is selected for FLEXSPI, user may want to avoid changing that clock as well.*/ -#if !(defined(XIP_EXTERNAL_FLASH) && (XIP_EXTERNAL_FLASH == 1)) - /* Init Usb1 PLL. */ - CLOCK_InitUsb1Pll(&usb1PllConfig_BOARD_BootClockRUN); - /* Init Usb1 pfd0. */ - CLOCK_InitUsb1Pfd(kCLOCK_Pfd0, 33); - /* Init Usb1 pfd1. */ - CLOCK_InitUsb1Pfd(kCLOCK_Pfd1, 16); - /* Init Usb1 pfd2. */ - CLOCK_InitUsb1Pfd(kCLOCK_Pfd2, 17); - /* Init Usb1 pfd3. */ - CLOCK_InitUsb1Pfd(kCLOCK_Pfd3, 19); -#endif - /* DeInit Audio PLL. */ - CLOCK_DeinitAudioPll(); - /* Bypass Audio PLL. */ - CLOCK_SetPllBypass(CCM_ANALOG, kCLOCK_PllAudio, 1); - /* Set divider for Audio PLL. */ - CCM_ANALOG->MISC2 &= ~CCM_ANALOG_MISC2_AUDIO_DIV_LSB_MASK; - CCM_ANALOG->MISC2 &= ~CCM_ANALOG_MISC2_AUDIO_DIV_MSB_MASK; - /* Enable Audio PLL output. */ - CCM_ANALOG->PLL_AUDIO |= CCM_ANALOG_PLL_AUDIO_ENABLE_MASK; - /* DeInit Video PLL. */ - CLOCK_DeinitVideoPll(); - /* Bypass Video PLL. */ - CCM_ANALOG->PLL_VIDEO |= CCM_ANALOG_PLL_VIDEO_BYPASS_MASK; - /* Set divider for Video PLL. */ - CCM_ANALOG->MISC2 = (CCM_ANALOG->MISC2 & (~CCM_ANALOG_MISC2_VIDEO_DIV_MASK)) | CCM_ANALOG_MISC2_VIDEO_DIV(0); - /* Enable Video PLL output. */ - CCM_ANALOG->PLL_VIDEO |= CCM_ANALOG_PLL_VIDEO_ENABLE_MASK; - /* DeInit Enet PLL. */ - CLOCK_DeinitEnetPll(); - /* Bypass Enet PLL. */ - CLOCK_SetPllBypass(CCM_ANALOG, kCLOCK_PllEnet, 1); - /* Set Enet output divider. */ - CCM_ANALOG->PLL_ENET = (CCM_ANALOG->PLL_ENET & (~CCM_ANALOG_PLL_ENET_DIV_SELECT_MASK)) | CCM_ANALOG_PLL_ENET_DIV_SELECT(1); - /* Enable Enet output. */ - CCM_ANALOG->PLL_ENET |= CCM_ANALOG_PLL_ENET_ENABLE_MASK; - /* Enable Enet25M output. */ - CCM_ANALOG->PLL_ENET |= CCM_ANALOG_PLL_ENET_ENET_25M_REF_EN_MASK; - /* Init Usb2 PLL. */ - CLOCK_InitUsb2Pll(&usb2PllConfig_BOARD_BootClockRUN); - /* Set preperiph clock source. */ - CLOCK_SetMux(kCLOCK_PrePeriphMux, 3); - /* Set periph clock source. */ - CLOCK_SetMux(kCLOCK_PeriphMux, 0); - /* Set periph clock2 clock source. */ - CLOCK_SetMux(kCLOCK_PeriphClk2Mux, 0); - /* Set per clock source. */ - CLOCK_SetMux(kCLOCK_PerclkMux, 0); - /* Set lvds1 clock source. */ - CCM_ANALOG->MISC1 = (CCM_ANALOG->MISC1 & (~CCM_ANALOG_MISC1_LVDS1_CLK_SEL_MASK)) | CCM_ANALOG_MISC1_LVDS1_CLK_SEL(0); - /* Set clock out1 divider. */ - CCM->CCOSR = (CCM->CCOSR & (~CCM_CCOSR_CLKO1_DIV_MASK)) | CCM_CCOSR_CLKO1_DIV(0); - /* Set clock out1 source. */ - CCM->CCOSR = (CCM->CCOSR & (~CCM_CCOSR_CLKO1_SEL_MASK)) | CCM_CCOSR_CLKO1_SEL(1); - /* Set clock out2 divider. */ - CCM->CCOSR = (CCM->CCOSR & (~CCM_CCOSR_CLKO2_DIV_MASK)) | CCM_CCOSR_CLKO2_DIV(0); - /* Set clock out2 source. */ - CCM->CCOSR = (CCM->CCOSR & (~CCM_CCOSR_CLKO2_SEL_MASK)) | CCM_CCOSR_CLKO2_SEL(18); - /* Set clock out1 drives clock out1. */ - CCM->CCOSR &= ~CCM_CCOSR_CLK_OUT_SEL_MASK; - /* Disable clock out1. */ - CCM->CCOSR &= ~CCM_CCOSR_CLKO1_EN_MASK; - /* Disable clock out2. */ - CCM->CCOSR &= ~CCM_CCOSR_CLKO2_EN_MASK; - /* Set SAI1 MCLK1 clock source. */ - IOMUXC_SetSaiMClkClockSource(IOMUXC_GPR, kIOMUXC_GPR_SAI1MClk1Sel, 0); - /* Set SAI1 MCLK2 clock source. */ - IOMUXC_SetSaiMClkClockSource(IOMUXC_GPR, kIOMUXC_GPR_SAI1MClk2Sel, 0); - /* Set SAI1 MCLK3 clock source. */ - IOMUXC_SetSaiMClkClockSource(IOMUXC_GPR, kIOMUXC_GPR_SAI1MClk3Sel, 0); - /* Set SAI2 MCLK3 clock source. */ - IOMUXC_SetSaiMClkClockSource(IOMUXC_GPR, kIOMUXC_GPR_SAI2MClk3Sel, 0); - /* Set SAI3 MCLK3 clock source. */ - IOMUXC_SetSaiMClkClockSource(IOMUXC_GPR, kIOMUXC_GPR_SAI3MClk3Sel, 0); - /* Set MQS configuration. */ - IOMUXC_MQSConfig(IOMUXC_GPR,kIOMUXC_MqsPwmOverSampleRate32, 0); - /* Set ENET Tx clock source. */ - IOMUXC_EnableMode(IOMUXC_GPR, kIOMUXC_GPR_ENET1RefClkMode, false); - /* Set GPT1 High frequency reference clock source. */ - IOMUXC_GPR->GPR5 &= ~IOMUXC_GPR_GPR5_VREF_1M_CLK_GPT1_MASK; - /* Set GPT2 High frequency reference clock source. */ - IOMUXC_GPR->GPR5 &= ~IOMUXC_GPR_GPR5_VREF_1M_CLK_GPT2_MASK; - /* Set SystemCoreClock variable. */ - SystemCoreClock = BOARD_BOOTCLOCKRUN_CORE_CLOCK; -} - diff --git a/bsp/imxrt/imxrt1052-sc-internal/board/MCUX_Config/clock_config.h b/bsp/imxrt/imxrt1052-sc-internal/board/MCUX_Config/clock_config.h deleted file mode 100644 index 9fc20d196d..0000000000 --- a/bsp/imxrt/imxrt1052-sc-internal/board/MCUX_Config/clock_config.h +++ /dev/null @@ -1,116 +0,0 @@ -#ifndef _CLOCK_CONFIG_H_ -#define _CLOCK_CONFIG_H_ - -#include "fsl_common.h" - -/******************************************************************************* - * Definitions - ******************************************************************************/ -#define BOARD_XTAL0_CLK_HZ 24000000U /*!< Board xtal0 frequency in Hz */ - -#define BOARD_XTAL32K_CLK_HZ 32768U /*!< Board xtal32k frequency in Hz */ -/******************************************************************************* - ************************ BOARD_InitBootClocks function ************************ - ******************************************************************************/ - -#if defined(__cplusplus) -extern "C" { -#endif /* __cplusplus*/ - -/*! - * @brief This function executes default configuration of clocks. - * - */ -void BOARD_InitBootClocks(void); - -#if defined(__cplusplus) -} -#endif /* __cplusplus*/ - -/******************************************************************************* - ********************** Configuration BOARD_BootClockRUN *********************** - ******************************************************************************/ -/******************************************************************************* - * Definitions for BOARD_BootClockRUN configuration - ******************************************************************************/ -#define BOARD_BOOTCLOCKRUN_CORE_CLOCK 600000000U /*!< Core clock frequency: 600000000Hz */ - -/* Clock outputs (values are in Hz): */ -#define BOARD_BOOTCLOCKRUN_AHB_CLK_ROOT 600000000UL -#define BOARD_BOOTCLOCKRUN_CAN_CLK_ROOT 40000000UL -#define BOARD_BOOTCLOCKRUN_CKIL_SYNC_CLK_ROOT 32768UL -#define BOARD_BOOTCLOCKRUN_CLKO1_CLK 0UL -#define BOARD_BOOTCLOCKRUN_CLKO2_CLK 0UL -#define BOARD_BOOTCLOCKRUN_CLK_1M 1000000UL -#define BOARD_BOOTCLOCKRUN_CLK_24M 24000000UL -#define BOARD_BOOTCLOCKRUN_CSI_CLK_ROOT 60000000UL -#define BOARD_BOOTCLOCKRUN_ENET1_TX_CLK 2400000UL -#define BOARD_BOOTCLOCKRUN_ENET_125M_CLK 2400000UL -#define BOARD_BOOTCLOCKRUN_ENET_25M_REF_CLK 1200000UL -#define BOARD_BOOTCLOCKRUN_FLEXIO1_CLK_ROOT 30000000UL -#define BOARD_BOOTCLOCKRUN_FLEXIO2_CLK_ROOT 30000000UL -#define BOARD_BOOTCLOCKRUN_FLEXSPI_CLK_ROOT 261818181UL -#define BOARD_BOOTCLOCKRUN_GPT1_IPG_CLK_HIGHFREQ 75000000UL -#define BOARD_BOOTCLOCKRUN_GPT2_IPG_CLK_HIGHFREQ 75000000UL -#define BOARD_BOOTCLOCKRUN_IPG_CLK_ROOT 150000000UL -#define BOARD_BOOTCLOCKRUN_LCDIF_CLK_ROOT 9642857UL -#define BOARD_BOOTCLOCKRUN_LPI2C_CLK_ROOT 60000000UL -#define BOARD_BOOTCLOCKRUN_LPSPI_CLK_ROOT 105600000UL -#define BOARD_BOOTCLOCKRUN_LVDS1_CLK 1200000000UL -#define BOARD_BOOTCLOCKRUN_MQS_MCLK 63529411UL -#define BOARD_BOOTCLOCKRUN_PERCLK_CLK_ROOT 75000000UL -#define BOARD_BOOTCLOCKRUN_PLL7_MAIN_CLK 480000000UL -#define BOARD_BOOTCLOCKRUN_SAI1_CLK_ROOT 63529411UL -#define BOARD_BOOTCLOCKRUN_SAI1_MCLK1 63529411UL -#define BOARD_BOOTCLOCKRUN_SAI1_MCLK2 63529411UL -#define BOARD_BOOTCLOCKRUN_SAI1_MCLK3 30000000UL -#define BOARD_BOOTCLOCKRUN_SAI2_CLK_ROOT 63529411UL -#define BOARD_BOOTCLOCKRUN_SAI2_MCLK1 63529411UL -#define BOARD_BOOTCLOCKRUN_SAI2_MCLK2 0UL -#define BOARD_BOOTCLOCKRUN_SAI2_MCLK3 30000000UL -#define BOARD_BOOTCLOCKRUN_SAI3_CLK_ROOT 63529411UL -#define BOARD_BOOTCLOCKRUN_SAI3_MCLK1 63529411UL -#define BOARD_BOOTCLOCKRUN_SAI3_MCLK2 0UL -#define BOARD_BOOTCLOCKRUN_SAI3_MCLK3 30000000UL -#define BOARD_BOOTCLOCKRUN_SEMC_CLK_ROOT 75000000UL -#define BOARD_BOOTCLOCKRUN_SPDIF0_CLK_ROOT 30000000UL -#define BOARD_BOOTCLOCKRUN_SPDIF0_EXTCLK_OUT 0UL -#define BOARD_BOOTCLOCKRUN_TRACE_CLK_ROOT 117333333UL -#define BOARD_BOOTCLOCKRUN_UART_CLK_ROOT 80000000UL -#define BOARD_BOOTCLOCKRUN_USBPHY1_CLK 480000000UL -#define BOARD_BOOTCLOCKRUN_USBPHY2_CLK 480000000UL -#define BOARD_BOOTCLOCKRUN_USDHC1_CLK_ROOT 158400000UL -#define BOARD_BOOTCLOCKRUN_USDHC2_CLK_ROOT 158400000UL - -/*! @brief Arm PLL set for BOARD_BootClockRUN configuration. - */ -extern const clock_arm_pll_config_t armPllConfig_BOARD_BootClockRUN; -/*! @brief Usb1 PLL set for BOARD_BootClockRUN configuration. - */ -extern const clock_usb_pll_config_t usb1PllConfig_BOARD_BootClockRUN; -/*! @brief Usb2 PLL set for BOARD_BootClockRUN configuration. - */ -extern const clock_usb_pll_config_t usb2PllConfig_BOARD_BootClockRUN; -/*! @brief Sys PLL for BOARD_BootClockRUN configuration. - */ -extern const clock_sys_pll_config_t sysPllConfig_BOARD_BootClockRUN; - -/******************************************************************************* - * API for BOARD_BootClockRUN configuration - ******************************************************************************/ -#if defined(__cplusplus) -extern "C" { -#endif /* __cplusplus*/ - -/*! - * @brief This function executes configuration of clocks. - * - */ -void BOARD_BootClockRUN(void); - -#if defined(__cplusplus) -} -#endif /* __cplusplus*/ - -#endif /* _CLOCK_CONFIG_H_ */ - diff --git a/bsp/imxrt/imxrt1052-sc-internal/board/MCUX_Config/pin_mux.c b/bsp/imxrt/imxrt1052-sc-internal/board/MCUX_Config/pin_mux.c deleted file mode 100644 index adfacaa39c..0000000000 --- a/bsp/imxrt/imxrt1052-sc-internal/board/MCUX_Config/pin_mux.c +++ /dev/null @@ -1,274 +0,0 @@ -/*********************************************************************************************************************** - * This file was generated by the MCUXpresso Config Tools. Any manual edits made to this file - * will be overwritten if the respective MCUXpresso Config Tools is used to update this file. - **********************************************************************************************************************/ - -/* - * TEXT BELOW IS USED AS SETTING FOR TOOLS ************************************* -!!GlobalInfo -product: Pins v9.0 -processor: MIMXRT1052xxxxB -package_id: MIMXRT1052DVL6B -mcu_data: ksdk2_0 -processor_version: 9.0.0 -board: IMXRT1050-EVKB -pin_labels: -- {pin_num: G11, pin_signal: GPIO_AD_B0_03, label: BSP_BEEP} -- {pin_num: L13, pin_signal: GPIO_AD_B1_10, label: BSP_RS485_RE, identifier: CSI_D7} -- {pin_num: J13, pin_signal: GPIO_AD_B1_11, label: BSP_DS18B20, identifier: CSI_D6} -- {pin_num: K12, pin_signal: GPIO_AD_B1_05, label: BSP_AP3216C_INT, identifier: CSI_MCLK} - * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS *********** - */ - -#include "fsl_common.h" -#include "fsl_xbara.h" -#include "fsl_iomuxc.h" -#include "fsl_gpio.h" -#include "pin_mux.h" - -/* FUNCTION ************************************************************************************************************ - * - * Function Name : BOARD_InitBootPins - * Description : Calls initialization functions. - * - * END ****************************************************************************************************************/ -void BOARD_InitBootPins(void) { -} - -/* - * TEXT BELOW IS USED AS SETTING FOR TOOLS ************************************* -BOARD_InitPins: -- options: {callFromInitBoot: 'false', coreID: core0, enableClock: 'true'} -- pin_list: - - {pin_num: K14, peripheral: LPUART1, signal: TX, pin_signal: GPIO_AD_B0_12} - - {pin_num: L14, peripheral: LPUART1, signal: RX, pin_signal: GPIO_AD_B0_13} - - {pin_num: J1, peripheral: USDHC1, signal: 'usdhc_data, 0', pin_signal: GPIO_SD_B0_02} - - {pin_num: K1, peripheral: USDHC1, signal: 'usdhc_data, 1', pin_signal: GPIO_SD_B0_03} - - {pin_num: H2, peripheral: USDHC1, signal: 'usdhc_data, 2', pin_signal: GPIO_SD_B0_04} - - {pin_num: J2, peripheral: USDHC1, signal: 'usdhc_data, 3', pin_signal: GPIO_SD_B0_05} - - {pin_num: J3, peripheral: USDHC1, signal: usdhc_clk, pin_signal: GPIO_SD_B0_01} - - {pin_num: J4, peripheral: USDHC1, signal: usdhc_cmd, pin_signal: GPIO_SD_B0_00} - - {pin_num: D13, peripheral: USDHC1, signal: usdhc_cd_b, pin_signal: GPIO_B1_12} - - {pin_num: M3, peripheral: PWM2, signal: 'A, 3', pin_signal: GPIO_SD_B1_02} - - {pin_num: L5, peripheral: GPIO3, signal: 'gpio_io, 00', pin_signal: GPIO_SD_B1_00, direction: OUTPUT, gpio_init_state: 'true', software_input_on: Enable, open_drain: Enable} - - {pin_num: M5, peripheral: GPIO3, signal: 'gpio_io, 01', pin_signal: GPIO_SD_B1_01, direction: OUTPUT, gpio_init_state: 'true', software_input_on: Enable, open_drain: Enable} - - {pin_num: J14, peripheral: CSI, signal: 'csi_data, 02', pin_signal: GPIO_AD_B1_15} - - {pin_num: G12, peripheral: CSI, signal: 'csi_data, 03', pin_signal: GPIO_AD_B1_14} - - {pin_num: H11, peripheral: CSI, signal: 'csi_data, 04', pin_signal: GPIO_AD_B1_13} - - {pin_num: H12, peripheral: CSI, signal: 'csi_data, 05', pin_signal: GPIO_AD_B1_12} - - {pin_num: J13, peripheral: CSI, signal: 'csi_data, 06', pin_signal: GPIO_AD_B1_11} - - {pin_num: L13, peripheral: CSI, signal: 'csi_data, 07', pin_signal: GPIO_AD_B1_10} - - {pin_num: M13, peripheral: CSI, signal: 'csi_data, 08', pin_signal: GPIO_AD_B1_09} - - {pin_num: H13, peripheral: CSI, signal: 'csi_data, 09', pin_signal: GPIO_AD_B1_08} - - {pin_num: L12, peripheral: CSI, signal: csi_pixclk, pin_signal: GPIO_AD_B1_04} - - {pin_num: K10, peripheral: CSI, signal: csi_hsync, pin_signal: GPIO_AD_B1_07} - - {pin_num: J12, peripheral: CSI, signal: csi_vsync, pin_signal: GPIO_AD_B1_06} - - {pin_num: H14, peripheral: ADC1, signal: 'IN, 3', pin_signal: GPIO_AD_B0_14} - - {pin_num: M12, peripheral: ADC1, signal: 'IN, 8', pin_signal: GPIO_AD_B1_03} - - {pin_num: L11, peripheral: ADC1, signal: 'IN, 7', pin_signal: GPIO_AD_B1_02} - - {pin_num: K11, peripheral: LPI2C1, signal: SDA, pin_signal: GPIO_AD_B1_01} - - {pin_num: J11, peripheral: LPI2C1, signal: SCL, pin_signal: GPIO_AD_B1_00} - - {pin_num: A12, peripheral: GPIO2, signal: 'gpio_io, 24', pin_signal: GPIO_B1_08, direction: INPUT} - - {pin_num: B12, peripheral: GPIO2, signal: 'gpio_io, 23', pin_signal: GPIO_B1_07, direction: INPUT} - - {pin_num: A13, peripheral: GPIO2, signal: 'gpio_io, 25', pin_signal: GPIO_B1_09, direction: INPUT} - - {pin_num: A8, peripheral: PWM2, signal: 'A, 0', pin_signal: GPIO_B0_06} - - {pin_num: A9, peripheral: PWM2, signal: 'B, 0', pin_signal: GPIO_B0_07} - - {pin_num: B9, peripheral: PWM2, signal: 'A, 1', pin_signal: GPIO_B0_08} - - {pin_num: C9, peripheral: PWM2, signal: 'B, 1', pin_signal: GPIO_B0_09} - - {pin_num: D9, peripheral: PWM2, signal: 'A, 2', pin_signal: GPIO_B0_10} - - {pin_num: A10, peripheral: PWM2, signal: 'B, 2', pin_signal: GPIO_B0_11, identifier: ''} - - {pin_num: C10, peripheral: GPIO2, signal: 'gpio_io, 12', pin_signal: GPIO_B0_12, direction: OUTPUT} - - {pin_num: B13, peripheral: GPIO2, signal: 'gpio_io, 26', pin_signal: GPIO_B1_10, direction: INPUT} - - {pin_num: E7, peripheral: LPSPI4, signal: SDI, pin_signal: GPIO_B0_01} - - {pin_num: E8, peripheral: LPSPI4, signal: SDO, pin_signal: GPIO_B0_02} - - {pin_num: D8, peripheral: LPSPI4, signal: SCK, pin_signal: GPIO_B0_03} - - {pin_num: D7, peripheral: LPSPI4, signal: PCS0, pin_signal: GPIO_B0_00} - - {pin_num: D11, peripheral: LPSPI4, signal: PCS1, pin_signal: GPIO_B1_03} - - {pin_num: C11, peripheral: LPSPI4, signal: PCS2, pin_signal: GPIO_B1_02} - - {pin_num: C13, peripheral: GPIO2, signal: 'gpio_io, 27', pin_signal: GPIO_B1_11, direction: OUTPUT} - - {pin_num: C12, peripheral: GPIO2, signal: 'gpio_io, 22', pin_signal: GPIO_B1_06, direction: OUTPUT} - - {pin_num: E12, peripheral: GPIO2, signal: 'gpio_io, 20', pin_signal: GPIO_B1_04, direction: OUTPUT} - - {pin_num: D12, peripheral: GPIO2, signal: 'gpio_io, 21', pin_signal: GPIO_B1_05, direction: INPUT} - - {pin_num: D10, peripheral: ENC1, signal: 'PHASE, A', pin_signal: GPIO_B0_13} - - {pin_num: E10, peripheral: ENC1, signal: 'PHASE, B', pin_signal: GPIO_B0_14} - - {pin_num: A11, peripheral: LPUART4, signal: TX, pin_signal: GPIO_B1_00} - - {pin_num: B11, peripheral: LPUART4, signal: RX, pin_signal: GPIO_B1_01} - * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS *********** - */ - -/* FUNCTION ************************************************************************************************************ - * - * Function Name : BOARD_InitPins - * Description : Configures pin routing and optionally pin electrical features. - * - * END ****************************************************************************************************************/ -void BOARD_InitPins(void) { - CLOCK_EnableClock(kCLOCK_Iomuxc); - CLOCK_EnableClock(kCLOCK_Xbar1); - - /* GPIO configuration of LCDIF_D8 on GPIO_B0_12 (pin C10) */ - gpio_pin_config_t LCDIF_D8_config = { - .direction = kGPIO_DigitalOutput, - .outputLogic = 0U, - .interruptMode = kGPIO_NoIntmode - }; - /* Initialize GPIO functionality on GPIO_B0_12 (pin C10) */ - GPIO_PinInit(GPIO2, 12U, &LCDIF_D8_config); - - /* GPIO configuration of ENET_RXD0 on GPIO_B1_04 (pin E12) */ - gpio_pin_config_t ENET_RXD0_config = { - .direction = kGPIO_DigitalOutput, - .outputLogic = 0U, - .interruptMode = kGPIO_NoIntmode - }; - /* Initialize GPIO functionality on GPIO_B1_04 (pin E12) */ - GPIO_PinInit(GPIO2, 20U, &ENET_RXD0_config); - - /* GPIO configuration of ENET_RXD1 on GPIO_B1_05 (pin D12) */ - gpio_pin_config_t ENET_RXD1_config = { - .direction = kGPIO_DigitalInput, - .outputLogic = 0U, - .interruptMode = kGPIO_NoIntmode - }; - /* Initialize GPIO functionality on GPIO_B1_05 (pin D12) */ - GPIO_PinInit(GPIO2, 21U, &ENET_RXD1_config); - - /* GPIO configuration of ENET_CRS_DV on GPIO_B1_06 (pin C12) */ - gpio_pin_config_t ENET_CRS_DV_config = { - .direction = kGPIO_DigitalOutput, - .outputLogic = 0U, - .interruptMode = kGPIO_NoIntmode - }; - /* Initialize GPIO functionality on GPIO_B1_06 (pin C12) */ - GPIO_PinInit(GPIO2, 22U, &ENET_CRS_DV_config); - - /* GPIO configuration of ENET_TXD0 on GPIO_B1_07 (pin B12) */ - gpio_pin_config_t ENET_TXD0_config = { - .direction = kGPIO_DigitalInput, - .outputLogic = 0U, - .interruptMode = kGPIO_NoIntmode - }; - /* Initialize GPIO functionality on GPIO_B1_07 (pin B12) */ - GPIO_PinInit(GPIO2, 23U, &ENET_TXD0_config); - - /* GPIO configuration of ENET_TXD1 on GPIO_B1_08 (pin A12) */ - gpio_pin_config_t ENET_TXD1_config = { - .direction = kGPIO_DigitalInput, - .outputLogic = 0U, - .interruptMode = kGPIO_NoIntmode - }; - /* Initialize GPIO functionality on GPIO_B1_08 (pin A12) */ - GPIO_PinInit(GPIO2, 24U, &ENET_TXD1_config); - - /* GPIO configuration of ENET_TXEN on GPIO_B1_09 (pin A13) */ - gpio_pin_config_t ENET_TXEN_config = { - .direction = kGPIO_DigitalInput, - .outputLogic = 0U, - .interruptMode = kGPIO_NoIntmode - }; - /* Initialize GPIO functionality on GPIO_B1_09 (pin A13) */ - GPIO_PinInit(GPIO2, 25U, &ENET_TXEN_config); - - /* GPIO configuration of ENET_TX_CLK on GPIO_B1_10 (pin B13) */ - gpio_pin_config_t ENET_TX_CLK_config = { - .direction = kGPIO_DigitalInput, - .outputLogic = 0U, - .interruptMode = kGPIO_NoIntmode - }; - /* Initialize GPIO functionality on GPIO_B1_10 (pin B13) */ - GPIO_PinInit(GPIO2, 26U, &ENET_TX_CLK_config); - - /* GPIO configuration of ENET_RXER on GPIO_B1_11 (pin C13) */ - gpio_pin_config_t ENET_RXER_config = { - .direction = kGPIO_DigitalOutput, - .outputLogic = 0U, - .interruptMode = kGPIO_NoIntmode - }; - /* Initialize GPIO functionality on GPIO_B1_11 (pin C13) */ - GPIO_PinInit(GPIO2, 27U, &ENET_RXER_config); - - /* GPIO configuration of FlexSPI_D3_B on GPIO_SD_B1_00 (pin L5) */ - gpio_pin_config_t FlexSPI_D3_B_config = { - .direction = kGPIO_DigitalOutput, - .outputLogic = 1U, - .interruptMode = kGPIO_NoIntmode - }; - /* Initialize GPIO functionality on GPIO_SD_B1_00 (pin L5) */ - GPIO_PinInit(GPIO3, 0U, &FlexSPI_D3_B_config); - - /* GPIO configuration of FlexSPI_D2_B on GPIO_SD_B1_01 (pin M5) */ - gpio_pin_config_t FlexSPI_D2_B_config = { - .direction = kGPIO_DigitalOutput, - .outputLogic = 1U, - .interruptMode = kGPIO_NoIntmode - }; - /* Initialize GPIO functionality on GPIO_SD_B1_01 (pin M5) */ - GPIO_PinInit(GPIO3, 1U, &FlexSPI_D2_B_config); - - IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B0_12_LPUART1_TX, 0U); - IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B0_13_LPUART1_RX, 0U); - IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B0_14_GPIO1_IO14, 0U); - IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B1_00_LPI2C1_SCL, 0U); - IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B1_01_LPI2C1_SDA, 0U); - IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B1_02_GPIO1_IO18, 0U); - IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B1_03_GPIO1_IO19, 0U); - IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B1_04_CSI_PIXCLK, 0U); - IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B1_06_CSI_VSYNC, 0U); - IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B1_07_CSI_HSYNC, 0U); - IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B1_08_CSI_DATA09, 0U); - IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B1_09_CSI_DATA08, 0U); - IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B1_10_CSI_DATA07, 0U); - IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B1_11_CSI_DATA06, 0U); - IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B1_12_CSI_DATA05, 0U); - IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B1_13_CSI_DATA04, 0U); - IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B1_14_CSI_DATA03, 0U); - IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B1_15_CSI_DATA02, 0U); - IOMUXC_SetPinMux(IOMUXC_GPIO_B0_00_LPSPI4_PCS0, 0U); - IOMUXC_SetPinMux(IOMUXC_GPIO_B0_01_LPSPI4_SDI, 0U); - IOMUXC_SetPinMux(IOMUXC_GPIO_B0_02_LPSPI4_SDO, 0U); - IOMUXC_SetPinMux(IOMUXC_GPIO_B0_03_LPSPI4_SCK, 0U); - IOMUXC_SetPinMux(IOMUXC_GPIO_B0_06_FLEXPWM2_PWMA00, 0U); - IOMUXC_SetPinMux(IOMUXC_GPIO_B0_07_FLEXPWM2_PWMB00, 0U); - IOMUXC_SetPinMux(IOMUXC_GPIO_B0_08_FLEXPWM2_PWMA01, 0U); - IOMUXC_SetPinMux(IOMUXC_GPIO_B0_09_FLEXPWM2_PWMB01, 0U); - IOMUXC_SetPinMux(IOMUXC_GPIO_B0_10_FLEXPWM2_PWMA02, 0U); - IOMUXC_SetPinMux(IOMUXC_GPIO_B0_11_FLEXPWM2_PWMB02, 0U); - IOMUXC_SetPinMux(IOMUXC_GPIO_B0_12_GPIO2_IO12, 0U); - IOMUXC_SetPinMux(IOMUXC_GPIO_B0_13_XBAR1_INOUT11, 0U); - IOMUXC_SetPinMux(IOMUXC_GPIO_B0_14_XBAR1_INOUT12, 0U); - IOMUXC_SetPinMux(IOMUXC_GPIO_B1_00_LPUART4_TX, 0U); - IOMUXC_SetPinMux(IOMUXC_GPIO_B1_01_LPUART4_RX, 0U); - IOMUXC_SetPinMux(IOMUXC_GPIO_B1_02_LPSPI4_PCS2, 0U); - IOMUXC_SetPinMux(IOMUXC_GPIO_B1_03_LPSPI4_PCS1, 0U); - IOMUXC_SetPinMux(IOMUXC_GPIO_B1_04_GPIO2_IO20, 0U); - IOMUXC_SetPinMux(IOMUXC_GPIO_B1_05_GPIO2_IO21, 0U); - IOMUXC_SetPinMux(IOMUXC_GPIO_B1_06_GPIO2_IO22, 0U); - IOMUXC_SetPinMux(IOMUXC_GPIO_B1_07_GPIO2_IO23, 0U); - IOMUXC_SetPinMux(IOMUXC_GPIO_B1_08_GPIO2_IO24, 0U); - IOMUXC_SetPinMux(IOMUXC_GPIO_B1_09_GPIO2_IO25, 0U); - IOMUXC_SetPinMux(IOMUXC_GPIO_B1_10_GPIO2_IO26, 0U); - IOMUXC_SetPinMux(IOMUXC_GPIO_B1_11_GPIO2_IO27, 0U); - IOMUXC_SetPinMux(IOMUXC_GPIO_B1_12_USDHC1_CD_B, 0U); - IOMUXC_SetPinMux(IOMUXC_GPIO_SD_B0_00_USDHC1_CMD, 0U); - IOMUXC_SetPinMux(IOMUXC_GPIO_SD_B0_01_USDHC1_CLK, 0U); - IOMUXC_SetPinMux(IOMUXC_GPIO_SD_B0_02_USDHC1_DATA0, 0U); - IOMUXC_SetPinMux(IOMUXC_GPIO_SD_B0_03_USDHC1_DATA1, 0U); - IOMUXC_SetPinMux(IOMUXC_GPIO_SD_B0_04_USDHC1_DATA2, 0U); - IOMUXC_SetPinMux(IOMUXC_GPIO_SD_B0_05_USDHC1_DATA3, 0U); - IOMUXC_SetPinMux(IOMUXC_GPIO_SD_B1_00_GPIO3_IO00, 1U); - IOMUXC_SetPinMux(IOMUXC_GPIO_SD_B1_01_GPIO3_IO01, 1U); - IOMUXC_SetPinMux(IOMUXC_GPIO_SD_B1_02_FLEXPWM2_PWMA03, 0U); - IOMUXC_GPR->GPR6 = ((IOMUXC_GPR->GPR6 & - (~(IOMUXC_GPR_GPR6_IOMUXC_XBAR_DIR_SEL_11_MASK | IOMUXC_GPR_GPR6_IOMUXC_XBAR_DIR_SEL_12_MASK))) - | IOMUXC_GPR_GPR6_IOMUXC_XBAR_DIR_SEL_11(0x00U) - | IOMUXC_GPR_GPR6_IOMUXC_XBAR_DIR_SEL_12(0x00U) - ); - XBARA_SetSignalsConnection(XBARA1, kXBARA1_InputIomuxXbarInout11, kXBARA1_OutputEnc1PhaseAInput); - XBARA_SetSignalsConnection(XBARA1, kXBARA1_InputIomuxXbarInout12, kXBARA1_OutputEnc1PhaseBInput); - IOMUXC_SetPinConfig(IOMUXC_GPIO_SD_B1_00_GPIO3_IO00, 0x18B0U); - IOMUXC_SetPinConfig(IOMUXC_GPIO_SD_B1_01_GPIO3_IO01, 0x18B0U); -} - -/*********************************************************************************************************************** - * EOF - **********************************************************************************************************************/ diff --git a/bsp/imxrt/imxrt1052-sc-internal/board/MCUX_Config/pin_mux.h b/bsp/imxrt/imxrt1052-sc-internal/board/MCUX_Config/pin_mux.h deleted file mode 100644 index a3200aac96..0000000000 --- a/bsp/imxrt/imxrt1052-sc-internal/board/MCUX_Config/pin_mux.h +++ /dev/null @@ -1,430 +0,0 @@ -/*********************************************************************************************************************** - * This file was generated by the MCUXpresso Config Tools. Any manual edits made to this file - * will be overwritten if the respective MCUXpresso Config Tools is used to update this file. - **********************************************************************************************************************/ - -#ifndef _PIN_MUX_H_ -#define _PIN_MUX_H_ - -/*********************************************************************************************************************** - * Definitions - **********************************************************************************************************************/ - -/*! @brief Direction type */ -typedef enum _pin_mux_direction -{ - kPIN_MUX_DirectionInput = 0U, /* Input direction */ - kPIN_MUX_DirectionOutput = 1U, /* Output direction */ - kPIN_MUX_DirectionInputOrOutput = 2U /* Input or output direction */ -} pin_mux_direction_t; - -/*! - * @addtogroup pin_mux - * @{ - */ - -/*********************************************************************************************************************** - * API - **********************************************************************************************************************/ - -#if defined(__cplusplus) -extern "C" { -#endif - -/*! - * @brief Calls initialization functions. - * - */ -void BOARD_InitBootPins(void); - -/* GPIO_AD_B0_12 (coord K14), UART1_TXD */ -/* Routed pin properties */ -#define BOARD_INITPINS_UART1_TXD_PERIPHERAL LPUART1 /*!< Peripheral name */ -#define BOARD_INITPINS_UART1_TXD_SIGNAL TX /*!< Signal name */ - -/* GPIO_AD_B0_13 (coord L14), UART1_RXD */ -/* Routed pin properties */ -#define BOARD_INITPINS_UART1_RXD_PERIPHERAL LPUART1 /*!< Peripheral name */ -#define BOARD_INITPINS_UART1_RXD_SIGNAL RX /*!< Signal name */ - -/* GPIO_SD_B0_02 (coord J1), SD1_D0/J24[4]/SPI_MOSI/PWM */ -/* Routed pin properties */ -#define BOARD_INITPINS_SD1_D0_PERIPHERAL USDHC1 /*!< Peripheral name */ -#define BOARD_INITPINS_SD1_D0_SIGNAL usdhc_data /*!< Signal name */ -#define BOARD_INITPINS_SD1_D0_CHANNEL 0U /*!< Signal channel */ - -/* GPIO_SD_B0_03 (coord K1), SD1_D1/J24[5]/SPI_MISO */ -/* Routed pin properties */ -#define BOARD_INITPINS_SD1_D1_PERIPHERAL USDHC1 /*!< Peripheral name */ -#define BOARD_INITPINS_SD1_D1_SIGNAL usdhc_data /*!< Signal name */ -#define BOARD_INITPINS_SD1_D1_CHANNEL 1U /*!< Signal channel */ - -/* GPIO_SD_B0_04 (coord H2), SD1_D2 */ -/* Routed pin properties */ -#define BOARD_INITPINS_SD1_D2_PERIPHERAL USDHC1 /*!< Peripheral name */ -#define BOARD_INITPINS_SD1_D2_SIGNAL usdhc_data /*!< Signal name */ -#define BOARD_INITPINS_SD1_D2_CHANNEL 2U /*!< Signal channel */ - -/* GPIO_SD_B0_05 (coord J2), SD1_D3 */ -/* Routed pin properties */ -#define BOARD_INITPINS_SD1_D3_PERIPHERAL USDHC1 /*!< Peripheral name */ -#define BOARD_INITPINS_SD1_D3_SIGNAL usdhc_data /*!< Signal name */ -#define BOARD_INITPINS_SD1_D3_CHANNEL 3U /*!< Signal channel */ - -/* GPIO_SD_B0_01 (coord J3), SD1_CLK/J24[3] */ -/* Routed pin properties */ -#define BOARD_INITPINS_SD1_CLK_PERIPHERAL USDHC1 /*!< Peripheral name */ -#define BOARD_INITPINS_SD1_CLK_SIGNAL usdhc_clk /*!< Signal name */ - -/* GPIO_SD_B0_00 (coord J4), SD1_CMD/J24[6] */ -/* Routed pin properties */ -#define BOARD_INITPINS_SD1_CMD_PERIPHERAL USDHC1 /*!< Peripheral name */ -#define BOARD_INITPINS_SD1_CMD_SIGNAL usdhc_cmd /*!< Signal name */ - -/* GPIO_B1_12 (coord D13), SD_CD_SW */ -/* Routed pin properties */ -#define BOARD_INITPINS_SD_CD_SW_PERIPHERAL USDHC1 /*!< Peripheral name */ -#define BOARD_INITPINS_SD_CD_SW_SIGNAL usdhc_cd_b /*!< Signal name */ - -/* GPIO_SD_B1_02 (coord M3), FlexSPI_D1_B */ -/* Routed pin properties */ -#define BOARD_INITPINS_FlexSPI_D1_B_PERIPHERAL PWM2 /*!< Peripheral name */ -#define BOARD_INITPINS_FlexSPI_D1_B_SIGNAL A /*!< Signal name */ -#define BOARD_INITPINS_FlexSPI_D1_B_CHANNEL 3U /*!< Signal channel */ - -/* GPIO_SD_B1_00 (coord L5), FlexSPI_D3_B */ -/* Routed pin properties */ -#define BOARD_INITPINS_FlexSPI_D3_B_PERIPHERAL GPIO3 /*!< Peripheral name */ -#define BOARD_INITPINS_FlexSPI_D3_B_SIGNAL gpio_io /*!< Signal name */ -#define BOARD_INITPINS_FlexSPI_D3_B_CHANNEL 0U /*!< Signal channel */ - -/* Symbols to be used with GPIO driver */ -#define BOARD_INITPINS_FlexSPI_D3_B_GPIO GPIO3 /*!< GPIO peripheral base pointer */ -#define BOARD_INITPINS_FlexSPI_D3_B_GPIO_PIN 0U /*!< GPIO pin number */ -#define BOARD_INITPINS_FlexSPI_D3_B_GPIO_PIN_MASK (1U << 0U) /*!< GPIO pin mask */ -#define BOARD_INITPINS_FlexSPI_D3_B_PORT GPIO3 /*!< PORT peripheral base pointer */ -#define BOARD_INITPINS_FlexSPI_D3_B_PIN 0U /*!< PORT pin number */ -#define BOARD_INITPINS_FlexSPI_D3_B_PIN_MASK (1U << 0U) /*!< PORT pin mask */ - -/* GPIO_SD_B1_01 (coord M5), FlexSPI_D2_B */ -/* Routed pin properties */ -#define BOARD_INITPINS_FlexSPI_D2_B_PERIPHERAL GPIO3 /*!< Peripheral name */ -#define BOARD_INITPINS_FlexSPI_D2_B_SIGNAL gpio_io /*!< Signal name */ -#define BOARD_INITPINS_FlexSPI_D2_B_CHANNEL 1U /*!< Signal channel */ - -/* Symbols to be used with GPIO driver */ -#define BOARD_INITPINS_FlexSPI_D2_B_GPIO GPIO3 /*!< GPIO peripheral base pointer */ -#define BOARD_INITPINS_FlexSPI_D2_B_GPIO_PIN 1U /*!< GPIO pin number */ -#define BOARD_INITPINS_FlexSPI_D2_B_GPIO_PIN_MASK (1U << 1U) /*!< GPIO pin mask */ -#define BOARD_INITPINS_FlexSPI_D2_B_PORT GPIO3 /*!< PORT peripheral base pointer */ -#define BOARD_INITPINS_FlexSPI_D2_B_PIN 1U /*!< PORT pin number */ -#define BOARD_INITPINS_FlexSPI_D2_B_PIN_MASK (1U << 1U) /*!< PORT pin mask */ - -/* GPIO_AD_B1_15 (coord J14), SAI1_TX_SYNC/CSI_D2/J35[6]/U13[13] */ -/* Routed pin properties */ -#define BOARD_INITPINS_CSI_D2_PERIPHERAL CSI /*!< Peripheral name */ -#define BOARD_INITPINS_CSI_D2_SIGNAL csi_data /*!< Signal name */ -#define BOARD_INITPINS_CSI_D2_CHANNEL 2U /*!< Signal channel */ - -/* GPIO_AD_B1_14 (coord G12), SAI1_TX_BCLK/CSI_D3/J35[4]/U13[12] */ -/* Routed pin properties */ -#define BOARD_INITPINS_CSI_D3_PERIPHERAL CSI /*!< Peripheral name */ -#define BOARD_INITPINS_CSI_D3_SIGNAL csi_data /*!< Signal name */ -#define BOARD_INITPINS_CSI_D3_CHANNEL 3U /*!< Signal channel */ - -/* GPIO_AD_B1_13 (coord H11), SAI1_TXD/CSI_D4/J35[3]/U13[14] */ -/* Routed pin properties */ -#define BOARD_INITPINS_CSI_D4_PERIPHERAL CSI /*!< Peripheral name */ -#define BOARD_INITPINS_CSI_D4_SIGNAL csi_data /*!< Signal name */ -#define BOARD_INITPINS_CSI_D4_CHANNEL 4U /*!< Signal channel */ - -/* GPIO_AD_B1_12 (coord H12), SAI1_RXD/CSI_D5/J35[5]/U13[16] */ -/* Routed pin properties */ -#define BOARD_INITPINS_CSI_D5_PERIPHERAL CSI /*!< Peripheral name */ -#define BOARD_INITPINS_CSI_D5_SIGNAL csi_data /*!< Signal name */ -#define BOARD_INITPINS_CSI_D5_CHANNEL 5U /*!< Signal channel */ - -/* GPIO_AD_B1_11 (coord J13), BSP_DS18B20 */ -/* Routed pin properties */ -#define BOARD_INITPINS_CSI_D6_PERIPHERAL CSI /*!< Peripheral name */ -#define BOARD_INITPINS_CSI_D6_SIGNAL csi_data /*!< Signal name */ -#define BOARD_INITPINS_CSI_D6_CHANNEL 6U /*!< Signal channel */ - -/* GPIO_AD_B1_10 (coord L13), BSP_RS485_RE */ -/* Routed pin properties */ -#define BOARD_INITPINS_CSI_D7_PERIPHERAL CSI /*!< Peripheral name */ -#define BOARD_INITPINS_CSI_D7_SIGNAL csi_data /*!< Signal name */ -#define BOARD_INITPINS_CSI_D7_CHANNEL 7U /*!< Signal channel */ - -/* GPIO_AD_B1_09 (coord M13), SAI1_MCLK/CSI_D8/J35[11] */ -/* Routed pin properties */ -#define BOARD_INITPINS_CSI_D8_PERIPHERAL CSI /*!< Peripheral name */ -#define BOARD_INITPINS_CSI_D8_SIGNAL csi_data /*!< Signal name */ -#define BOARD_INITPINS_CSI_D8_CHANNEL 8U /*!< Signal channel */ - -/* GPIO_AD_B1_08 (coord H13), AUD_INT/CSI_D9//J35[13]/J22[4] */ -/* Routed pin properties */ -#define BOARD_INITPINS_CSI_D9_PERIPHERAL CSI /*!< Peripheral name */ -#define BOARD_INITPINS_CSI_D9_SIGNAL csi_data /*!< Signal name */ -#define BOARD_INITPINS_CSI_D9_CHANNEL 9U /*!< Signal channel */ - -/* GPIO_AD_B1_04 (coord L12), CSI_PIXCLK/J35[8]/J23[3] */ -/* Routed pin properties */ -#define BOARD_INITPINS_CSI_PIXCLK_PERIPHERAL CSI /*!< Peripheral name */ -#define BOARD_INITPINS_CSI_PIXCLK_SIGNAL csi_pixclk /*!< Signal name */ - -/* GPIO_AD_B1_07 (coord K10), CSI_HSYNC/J35[16]/J22[1]/UART_RX */ -/* Routed pin properties */ -#define BOARD_INITPINS_CSI_HSYNC_PERIPHERAL CSI /*!< Peripheral name */ -#define BOARD_INITPINS_CSI_HSYNC_SIGNAL csi_hsync /*!< Signal name */ - -/* GPIO_AD_B1_06 (coord J12), CSI_VSYNC/J35[18]/J22[2]/UART_TX */ -/* Routed pin properties */ -#define BOARD_INITPINS_CSI_VSYNC_PERIPHERAL CSI /*!< Peripheral name */ -#define BOARD_INITPINS_CSI_VSYNC_SIGNAL csi_vsync /*!< Signal name */ - -/* GPIO_AD_B0_14 (coord H14), CAN2_TX/U12[1] */ -/* Routed pin properties */ -#define BOARD_INITPINS_CAN2_TX_PERIPHERAL ADC1 /*!< Peripheral name */ -#define BOARD_INITPINS_CAN2_TX_SIGNAL IN /*!< Signal name */ -#define BOARD_INITPINS_CAN2_TX_CHANNEL 3U /*!< Signal channel */ - -/* GPIO_AD_B1_03 (coord M12), SPDIF_IN/J22[8] */ -/* Routed pin properties */ -#define BOARD_INITPINS_SPDIF_IN_PERIPHERAL ADC1 /*!< Peripheral name */ -#define BOARD_INITPINS_SPDIF_IN_SIGNAL IN /*!< Signal name */ -#define BOARD_INITPINS_SPDIF_IN_CHANNEL 8U /*!< Signal channel */ - -/* GPIO_AD_B1_02 (coord L11), SPDIF_OUT/J22[7] */ -/* Routed pin properties */ -#define BOARD_INITPINS_SPDIF_OUT_PERIPHERAL ADC1 /*!< Peripheral name */ -#define BOARD_INITPINS_SPDIF_OUT_SIGNAL IN /*!< Signal name */ -#define BOARD_INITPINS_SPDIF_OUT_CHANNEL 7U /*!< Signal channel */ - -/* GPIO_B1_08 (coord A12), ENET_TXD1 */ -/* Routed pin properties */ -#define BOARD_INITPINS_ENET_TXD1_PERIPHERAL GPIO2 /*!< Peripheral name */ -#define BOARD_INITPINS_ENET_TXD1_SIGNAL gpio_io /*!< Signal name */ -#define BOARD_INITPINS_ENET_TXD1_CHANNEL 24U /*!< Signal channel */ - -/* Symbols to be used with GPIO driver */ -#define BOARD_INITPINS_ENET_TXD1_GPIO GPIO2 /*!< GPIO peripheral base pointer */ -#define BOARD_INITPINS_ENET_TXD1_GPIO_PIN 24U /*!< GPIO pin number */ -#define BOARD_INITPINS_ENET_TXD1_GPIO_PIN_MASK (1U << 24U) /*!< GPIO pin mask */ -#define BOARD_INITPINS_ENET_TXD1_PORT GPIO2 /*!< PORT peripheral base pointer */ -#define BOARD_INITPINS_ENET_TXD1_PIN 24U /*!< PORT pin number */ -#define BOARD_INITPINS_ENET_TXD1_PIN_MASK (1U << 24U) /*!< PORT pin mask */ - -/* GPIO_B1_07 (coord B12), ENET_TXD0 */ -/* Routed pin properties */ -#define BOARD_INITPINS_ENET_TXD0_PERIPHERAL GPIO2 /*!< Peripheral name */ -#define BOARD_INITPINS_ENET_TXD0_SIGNAL gpio_io /*!< Signal name */ -#define BOARD_INITPINS_ENET_TXD0_CHANNEL 23U /*!< Signal channel */ - -/* Symbols to be used with GPIO driver */ -#define BOARD_INITPINS_ENET_TXD0_GPIO GPIO2 /*!< GPIO peripheral base pointer */ -#define BOARD_INITPINS_ENET_TXD0_GPIO_PIN 23U /*!< GPIO pin number */ -#define BOARD_INITPINS_ENET_TXD0_GPIO_PIN_MASK (1U << 23U) /*!< GPIO pin mask */ -#define BOARD_INITPINS_ENET_TXD0_PORT GPIO2 /*!< PORT peripheral base pointer */ -#define BOARD_INITPINS_ENET_TXD0_PIN 23U /*!< PORT pin number */ -#define BOARD_INITPINS_ENET_TXD0_PIN_MASK (1U << 23U) /*!< PORT pin mask */ - -/* GPIO_B1_09 (coord A13), ENET_TXEN */ -/* Routed pin properties */ -#define BOARD_INITPINS_ENET_TXEN_PERIPHERAL GPIO2 /*!< Peripheral name */ -#define BOARD_INITPINS_ENET_TXEN_SIGNAL gpio_io /*!< Signal name */ -#define BOARD_INITPINS_ENET_TXEN_CHANNEL 25U /*!< Signal channel */ - -/* Symbols to be used with GPIO driver */ -#define BOARD_INITPINS_ENET_TXEN_GPIO GPIO2 /*!< GPIO peripheral base pointer */ -#define BOARD_INITPINS_ENET_TXEN_GPIO_PIN 25U /*!< GPIO pin number */ -#define BOARD_INITPINS_ENET_TXEN_GPIO_PIN_MASK (1U << 25U) /*!< GPIO pin mask */ -#define BOARD_INITPINS_ENET_TXEN_PORT GPIO2 /*!< PORT peripheral base pointer */ -#define BOARD_INITPINS_ENET_TXEN_PIN 25U /*!< PORT pin number */ -#define BOARD_INITPINS_ENET_TXEN_PIN_MASK (1U << 25U) /*!< PORT pin mask */ - -/* GPIO_B0_06 (coord A8), LCDIF_D2/BT_CFG[2] */ -/* Routed pin properties */ -#define BOARD_INITPINS_LCDIF_D2_PERIPHERAL PWM2 /*!< Peripheral name */ -#define BOARD_INITPINS_LCDIF_D2_SIGNAL A /*!< Signal name */ -#define BOARD_INITPINS_LCDIF_D2_CHANNEL 0U /*!< Signal channel */ - -/* GPIO_B0_07 (coord A9), LCDIF_D3/BT_CFG[3] */ -/* Routed pin properties */ -#define BOARD_INITPINS_LCDIF_D3_PERIPHERAL PWM2 /*!< Peripheral name */ -#define BOARD_INITPINS_LCDIF_D3_SIGNAL B /*!< Signal name */ -#define BOARD_INITPINS_LCDIF_D3_CHANNEL 0U /*!< Signal channel */ - -/* GPIO_B0_08 (coord B9), LCDIF_D4/BT_CFG[4] */ -/* Routed pin properties */ -#define BOARD_INITPINS_LCDIF_D4_PERIPHERAL PWM2 /*!< Peripheral name */ -#define BOARD_INITPINS_LCDIF_D4_SIGNAL A /*!< Signal name */ -#define BOARD_INITPINS_LCDIF_D4_CHANNEL 1U /*!< Signal channel */ - -/* GPIO_B0_09 (coord C9), LCDIF_D5/BT_CFG[5] */ -/* Routed pin properties */ -#define BOARD_INITPINS_LCDIF_D5_PERIPHERAL PWM2 /*!< Peripheral name */ -#define BOARD_INITPINS_LCDIF_D5_SIGNAL B /*!< Signal name */ -#define BOARD_INITPINS_LCDIF_D5_CHANNEL 1U /*!< Signal channel */ - -/* GPIO_B0_10 (coord D9), LCDIF_D6/BT_CFG[6] */ -/* Routed pin properties */ -#define BOARD_INITPINS_LCDIF_D6_PERIPHERAL PWM2 /*!< Peripheral name */ -#define BOARD_INITPINS_LCDIF_D6_SIGNAL A /*!< Signal name */ -#define BOARD_INITPINS_LCDIF_D6_CHANNEL 2U /*!< Signal channel */ - -/* GPIO_B0_12 (coord C10), LCDIF_D8/BT_CFG[8] */ -/* Routed pin properties */ -#define BOARD_INITPINS_LCDIF_D8_PERIPHERAL GPIO2 /*!< Peripheral name */ -#define BOARD_INITPINS_LCDIF_D8_SIGNAL gpio_io /*!< Signal name */ -#define BOARD_INITPINS_LCDIF_D8_CHANNEL 12U /*!< Signal channel */ - -/* Symbols to be used with GPIO driver */ -#define BOARD_INITPINS_LCDIF_D8_GPIO GPIO2 /*!< GPIO peripheral base pointer */ -#define BOARD_INITPINS_LCDIF_D8_GPIO_PIN 12U /*!< GPIO pin number */ -#define BOARD_INITPINS_LCDIF_D8_GPIO_PIN_MASK (1U << 12U) /*!< GPIO pin mask */ -#define BOARD_INITPINS_LCDIF_D8_PORT GPIO2 /*!< PORT peripheral base pointer */ -#define BOARD_INITPINS_LCDIF_D8_PIN 12U /*!< PORT pin number */ -#define BOARD_INITPINS_LCDIF_D8_PIN_MASK (1U << 12U) /*!< PORT pin mask */ - -/* GPIO_B1_10 (coord B13), ENET_TX_CLK */ -/* Routed pin properties */ -#define BOARD_INITPINS_ENET_TX_CLK_PERIPHERAL GPIO2 /*!< Peripheral name */ -#define BOARD_INITPINS_ENET_TX_CLK_SIGNAL gpio_io /*!< Signal name */ -#define BOARD_INITPINS_ENET_TX_CLK_CHANNEL 26U /*!< Signal channel */ - -/* Symbols to be used with GPIO driver */ -#define BOARD_INITPINS_ENET_TX_CLK_GPIO GPIO2 /*!< GPIO peripheral base pointer */ -#define BOARD_INITPINS_ENET_TX_CLK_GPIO_PIN 26U /*!< GPIO pin number */ -#define BOARD_INITPINS_ENET_TX_CLK_GPIO_PIN_MASK (1U << 26U) /*!< GPIO pin mask */ -#define BOARD_INITPINS_ENET_TX_CLK_PORT GPIO2 /*!< PORT peripheral base pointer */ -#define BOARD_INITPINS_ENET_TX_CLK_PIN 26U /*!< PORT pin number */ -#define BOARD_INITPINS_ENET_TX_CLK_PIN_MASK (1U << 26U) /*!< PORT pin mask */ - -/* GPIO_B0_01 (coord E7), LCDIF_ENABLE */ -/* Routed pin properties */ -#define BOARD_INITPINS_LCDIF_ENABLE_PERIPHERAL LPSPI4 /*!< Peripheral name */ -#define BOARD_INITPINS_LCDIF_ENABLE_SIGNAL SDI /*!< Signal name */ - -/* GPIO_B0_02 (coord E8), LCDIF_HSYNC */ -/* Routed pin properties */ -#define BOARD_INITPINS_LCDIF_HSYNC_PERIPHERAL LPSPI4 /*!< Peripheral name */ -#define BOARD_INITPINS_LCDIF_HSYNC_SIGNAL SDO /*!< Signal name */ - -/* GPIO_B0_03 (coord D8), LCDIF_VSYNC */ -/* Routed pin properties */ -#define BOARD_INITPINS_LCDIF_VSYNC_PERIPHERAL LPSPI4 /*!< Peripheral name */ -#define BOARD_INITPINS_LCDIF_VSYNC_SIGNAL SCK /*!< Signal name */ - -/* GPIO_B0_00 (coord D7), LCDIF_CLK */ -/* Routed pin properties */ -#define BOARD_INITPINS_LCDIF_CLK_PERIPHERAL LPSPI4 /*!< Peripheral name */ -#define BOARD_INITPINS_LCDIF_CLK_SIGNAL PCS0 /*!< Signal name */ - -/* GPIO_B1_03 (coord D11), LCDIF_D15 */ -/* Routed pin properties */ -#define BOARD_INITPINS_LCDIF_D15_PERIPHERAL LPSPI4 /*!< Peripheral name */ -#define BOARD_INITPINS_LCDIF_D15_SIGNAL PCS1 /*!< Signal name */ - -/* GPIO_B1_02 (coord C11), LCDIF_D14 */ -/* Routed pin properties */ -#define BOARD_INITPINS_LCDIF_D14_PERIPHERAL LPSPI4 /*!< Peripheral name */ -#define BOARD_INITPINS_LCDIF_D14_SIGNAL PCS2 /*!< Signal name */ - -/* GPIO_B1_11 (coord C13), ENET_RXER */ -/* Routed pin properties */ -#define BOARD_INITPINS_ENET_RXER_PERIPHERAL GPIO2 /*!< Peripheral name */ -#define BOARD_INITPINS_ENET_RXER_SIGNAL gpio_io /*!< Signal name */ -#define BOARD_INITPINS_ENET_RXER_CHANNEL 27U /*!< Signal channel */ - -/* Symbols to be used with GPIO driver */ -#define BOARD_INITPINS_ENET_RXER_GPIO GPIO2 /*!< GPIO peripheral base pointer */ -#define BOARD_INITPINS_ENET_RXER_GPIO_PIN 27U /*!< GPIO pin number */ -#define BOARD_INITPINS_ENET_RXER_GPIO_PIN_MASK (1U << 27U) /*!< GPIO pin mask */ -#define BOARD_INITPINS_ENET_RXER_PORT GPIO2 /*!< PORT peripheral base pointer */ -#define BOARD_INITPINS_ENET_RXER_PIN 27U /*!< PORT pin number */ -#define BOARD_INITPINS_ENET_RXER_PIN_MASK (1U << 27U) /*!< PORT pin mask */ - -/* GPIO_B1_06 (coord C12), ENET_CRS_DV */ -/* Routed pin properties */ -#define BOARD_INITPINS_ENET_CRS_DV_PERIPHERAL GPIO2 /*!< Peripheral name */ -#define BOARD_INITPINS_ENET_CRS_DV_SIGNAL gpio_io /*!< Signal name */ -#define BOARD_INITPINS_ENET_CRS_DV_CHANNEL 22U /*!< Signal channel */ - -/* Symbols to be used with GPIO driver */ -#define BOARD_INITPINS_ENET_CRS_DV_GPIO GPIO2 /*!< GPIO peripheral base pointer */ -#define BOARD_INITPINS_ENET_CRS_DV_GPIO_PIN 22U /*!< GPIO pin number */ -#define BOARD_INITPINS_ENET_CRS_DV_GPIO_PIN_MASK (1U << 22U) /*!< GPIO pin mask */ -#define BOARD_INITPINS_ENET_CRS_DV_PORT GPIO2 /*!< PORT peripheral base pointer */ -#define BOARD_INITPINS_ENET_CRS_DV_PIN 22U /*!< PORT pin number */ -#define BOARD_INITPINS_ENET_CRS_DV_PIN_MASK (1U << 22U) /*!< PORT pin mask */ - -/* GPIO_B1_04 (coord E12), ENET_RXD0 */ -/* Routed pin properties */ -#define BOARD_INITPINS_ENET_RXD0_PERIPHERAL GPIO2 /*!< Peripheral name */ -#define BOARD_INITPINS_ENET_RXD0_SIGNAL gpio_io /*!< Signal name */ -#define BOARD_INITPINS_ENET_RXD0_CHANNEL 20U /*!< Signal channel */ - -/* Symbols to be used with GPIO driver */ -#define BOARD_INITPINS_ENET_RXD0_GPIO GPIO2 /*!< GPIO peripheral base pointer */ -#define BOARD_INITPINS_ENET_RXD0_GPIO_PIN 20U /*!< GPIO pin number */ -#define BOARD_INITPINS_ENET_RXD0_GPIO_PIN_MASK (1U << 20U) /*!< GPIO pin mask */ -#define BOARD_INITPINS_ENET_RXD0_PORT GPIO2 /*!< PORT peripheral base pointer */ -#define BOARD_INITPINS_ENET_RXD0_PIN 20U /*!< PORT pin number */ -#define BOARD_INITPINS_ENET_RXD0_PIN_MASK (1U << 20U) /*!< PORT pin mask */ - -/* GPIO_B1_05 (coord D12), ENET_RXD1 */ -/* Routed pin properties */ -#define BOARD_INITPINS_ENET_RXD1_PERIPHERAL GPIO2 /*!< Peripheral name */ -#define BOARD_INITPINS_ENET_RXD1_SIGNAL gpio_io /*!< Signal name */ -#define BOARD_INITPINS_ENET_RXD1_CHANNEL 21U /*!< Signal channel */ - -/* Symbols to be used with GPIO driver */ -#define BOARD_INITPINS_ENET_RXD1_GPIO GPIO2 /*!< GPIO peripheral base pointer */ -#define BOARD_INITPINS_ENET_RXD1_GPIO_PIN 21U /*!< GPIO pin number */ -#define BOARD_INITPINS_ENET_RXD1_GPIO_PIN_MASK (1U << 21U) /*!< GPIO pin mask */ -#define BOARD_INITPINS_ENET_RXD1_PORT GPIO2 /*!< PORT peripheral base pointer */ -#define BOARD_INITPINS_ENET_RXD1_PIN 21U /*!< PORT pin number */ -#define BOARD_INITPINS_ENET_RXD1_PIN_MASK (1U << 21U) /*!< PORT pin mask */ - -/* GPIO_B0_13 (coord D10), LCDIF_D9/BT_CFG[9] */ -/* Routed pin properties */ -#define BOARD_INITPINS_LCDIF_D9_PERIPHERAL ENC1 /*!< Peripheral name */ -#define BOARD_INITPINS_LCDIF_D9_SIGNAL PHASE /*!< Signal name */ -#define BOARD_INITPINS_LCDIF_D9_CHANNEL A /*!< Signal channel */ - -/* GPIO_B0_14 (coord E10), LCDIF_D10/BT_CFG[10] */ -/* Routed pin properties */ -#define BOARD_INITPINS_LCDIF_D10_PERIPHERAL ENC1 /*!< Peripheral name */ -#define BOARD_INITPINS_LCDIF_D10_SIGNAL PHASE /*!< Signal name */ -#define BOARD_INITPINS_LCDIF_D10_CHANNEL B /*!< Signal channel */ - -/* GPIO_B1_00 (coord A11), LCDIF_D12 */ -/* Routed pin properties */ -#define BOARD_INITPINS_LCDIF_D12_PERIPHERAL LPUART4 /*!< Peripheral name */ -#define BOARD_INITPINS_LCDIF_D12_SIGNAL TX /*!< Signal name */ - -/* GPIO_B1_01 (coord B11), LCDIF_D13 */ -/* Routed pin properties */ -#define BOARD_INITPINS_LCDIF_D13_PERIPHERAL LPUART4 /*!< Peripheral name */ -#define BOARD_INITPINS_LCDIF_D13_SIGNAL RX /*!< Signal name */ - - -/*! - * @brief Configures pin routing and optionally pin electrical features. - * - */ -void BOARD_InitPins(void); - -#if defined(__cplusplus) -} -#endif - -/*! - * @} - */ -#endif /* _PIN_MUX_H_ */ - -/*********************************************************************************************************************** - * EOF - **********************************************************************************************************************/ diff --git a/bsp/imxrt/imxrt1052-sc-internal/board/SConscript b/bsp/imxrt/imxrt1052-sc-internal/board/SConscript deleted file mode 100644 index 43d5d37a92..0000000000 --- a/bsp/imxrt/imxrt1052-sc-internal/board/SConscript +++ /dev/null @@ -1,17 +0,0 @@ -from building import * - -cwd = GetCurrentDir() - -# add the general drivers. -src = Split(""" -board.c -MCUX_Config/clock_config.c -MCUX_Config/pin_mux.c -""") - -CPPPATH = [cwd,cwd + '/MCUX_Config',cwd + '/ports'] -CPPDEFINES = ['CPU_MIMXRT1052CVL5B', 'SKIP_SYSCLK_INIT', 'EVK_MCIMXRM', 'FSL_SDK_ENABLE_DRIVER_CACHE_CONTROL=1','XIP_EXTERNAL_FLASH=1','XIP_BOOT_HEADER_ENABLE=1'] - -group = DefineGroup('Drivers', src, depend = [''], CPPPATH = CPPPATH, CPPDEFINES=CPPDEFINES) - -Return('group') diff --git a/bsp/imxrt/imxrt1052-sc-internal/board/board.c b/bsp/imxrt/imxrt1052-sc-internal/board/board.c deleted file mode 100644 index e50e511070..0000000000 --- a/bsp/imxrt/imxrt1052-sc-internal/board/board.c +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright (c) 2006-2018, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2009-01-05 Bernard first implementation - */ - -#include -#include -#include "board.h" -#include "pin_mux.h" - -#ifdef BSP_USING_DMA -#include "fsl_dmamux.h" -#include "fsl_edma.h" -#endif - -#define NVIC_PRIORITYGROUP_0 0x00000007U /*!< 0 bits for pre-emption priority - 4 bits for subpriority */ -#define NVIC_PRIORITYGROUP_1 0x00000006U /*!< 1 bits for pre-emption priority - 3 bits for subpriority */ -#define NVIC_PRIORITYGROUP_2 0x00000005U /*!< 2 bits for pre-emption priority - 2 bits for subpriority */ -#define NVIC_PRIORITYGROUP_3 0x00000004U /*!< 3 bits for pre-emption priority - 1 bits for subpriority */ -#define NVIC_PRIORITYGROUP_4 0x00000003U /*!< 4 bits for pre-emption priority - 0 bits for subpriority */ - -/* MPU configuration. */ -static void BOARD_ConfigMPU(void) -{ - /* Disable I cache and D cache */ - SCB_DisableICache(); - SCB_DisableDCache(); - - /* Disable MPU */ - ARM_MPU_Disable(); - - /* Region 0 setting */ - MPU->RBAR = ARM_MPU_RBAR(0, 0xC0000000U); - MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 2, 0, 0, 0, 0, ARM_MPU_REGION_SIZE_512MB); - - /* Region 1 setting */ - MPU->RBAR = ARM_MPU_RBAR(1, 0x80000000U); - MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 2, 0, 0, 0, 0, ARM_MPU_REGION_SIZE_1GB); - - /* Region 2 setting */ - // spi flash: normal type, cacheable, no bufferable, no shareable - MPU->RBAR = ARM_MPU_RBAR(2, 0x60000000U); - MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 0, 0, 1, 0, 0, ARM_MPU_REGION_SIZE_512MB); - - /* Region 3 setting */ - MPU->RBAR = ARM_MPU_RBAR(3, 0x00000000U); - MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 2, 0, 0, 0, 0, ARM_MPU_REGION_SIZE_1GB); - - /* Region 4 setting */ - MPU->RBAR = ARM_MPU_RBAR(4, 0x00000000U); - MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 0, 0, 1, 1, 0, ARM_MPU_REGION_SIZE_128KB); - - /* Region 5 setting */ - MPU->RBAR = ARM_MPU_RBAR(5, 0x20000000U); - MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 0, 0, 1, 1, 0, ARM_MPU_REGION_SIZE_128KB); - - /* Region 6 setting */ - MPU->RBAR = ARM_MPU_RBAR(6, 0x20200000U); - MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 0, 0, 1, 1, 0, ARM_MPU_REGION_SIZE_256KB); - -#if defined(BSP_USING_SDRAM) - /* Region 7 setting */ - MPU->RBAR = ARM_MPU_RBAR(7, 0x80000000U); - MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 0, 0, 1, 1, 0, ARM_MPU_REGION_SIZE_32MB); - - /* Region 8 setting */ - MPU->RBAR = ARM_MPU_RBAR(8, 0x81E00000U); - MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 1, 1, 0, 0, 0, ARM_MPU_REGION_SIZE_2MB); -#endif - - /* Enable MPU */ - ARM_MPU_Enable(MPU_CTRL_PRIVDEFENA_Msk); - - /* Enable I cache and D cache */ - SCB_EnableDCache(); - SCB_EnableICache(); -} - - -/* This is the timer interrupt service routine. */ -void SysTick_Handler(void) -{ - /* enter interrupt */ - rt_interrupt_enter(); - - rt_tick_increase(); - - /* leave interrupt */ - rt_interrupt_leave(); -} - -#ifdef BSP_USING_DMA -void imxrt_dma_init(void) -{ - edma_config_t config; - - DMAMUX_Init(DMAMUX); - EDMA_GetDefaultConfig(&config); - EDMA_Init(DMA0, &config); -} -#endif - -void rt_hw_board_init() -{ - BOARD_ConfigMPU(); - BOARD_InitPins(); - BOARD_BootClockRUN(); - - NVIC_SetPriorityGrouping(NVIC_PRIORITYGROUP_4); - SysTick_Config(SystemCoreClock / RT_TICK_PER_SECOND); - -#ifdef BSP_USING_DMA - imxrt_dma_init(); -#endif - -#ifdef RT_USING_HEAP - rt_system_heap_init((void *)HEAP_BEGIN, (void *)HEAP_END); -#endif - -#ifdef RT_USING_COMPONENTS_INIT - rt_components_board_init(); -#endif - -#ifdef RT_USING_CONSOLE - rt_console_set_device(RT_CONSOLE_DEVICE_NAME); -#endif -} - diff --git a/bsp/imxrt/imxrt1052-sc-internal/board/board.h b/bsp/imxrt/imxrt1052-sc-internal/board/board.h deleted file mode 100644 index dc1ff4b98a..0000000000 --- a/bsp/imxrt/imxrt1052-sc-internal/board/board.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2006-2018, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2009-09-22 Bernard add board.h to this bsp - */ - -// <<< Use Configuration Wizard in Context Menu >>> -#ifndef __BOARD_H__ -#define __BOARD_H__ - -#include "fsl_common.h" -#include "clock_config.h" - -#ifdef __CC_ARM -extern int Image$$RTT_HEAP$$ZI$$Base; -extern int Image$$RTT_HEAP$$ZI$$Limit; -#define HEAP_BEGIN (&Image$$RTT_HEAP$$ZI$$Base) -#define HEAP_END (&Image$$RTT_HEAP$$ZI$$Limit) - -#elif __ICCARM__ -#pragma section="HEAP" -#define HEAP_BEGIN (__segment_end("HEAP")) -extern void __RTT_HEAP_END; -#define HEAP_END (&__RTT_HEAP_END) - -#else -extern int heap_start; -extern int heap_end; -#define HEAP_BEGIN (&heap_start) -#define HEAP_END (&heap_end) -#endif - -#define HEAP_SIZE ((uint32_t)HEAP_END - (uint32_t)HEAP_BEGIN) - -#define BOARD_FLASH_SIZE (0x400000U) - -void rt_hw_board_init(void); - -#endif - diff --git a/bsp/imxrt/imxrt1052-sc-internal/board/linker_scripts/link.icf b/bsp/imxrt/imxrt1052-sc-internal/board/linker_scripts/link.icf deleted file mode 100644 index a022ded1d6..0000000000 --- a/bsp/imxrt/imxrt1052-sc-internal/board/linker_scripts/link.icf +++ /dev/null @@ -1,95 +0,0 @@ -/* -** ################################################################### -** Processors: MIMXRT1052CVJ5B -** MIMXRT1052CVL5B -** MIMXRT1052DVJ6B -** MIMXRT1052DVL6B -** -** Compiler: IAR ANSI C/C++ Compiler for ARM -** Reference manual: IMXRT1050RM Rev.1, 03/2018 -** Version: rev. 1.0, 2018-09-21 -** Build: b180921 -** -** Abstract: -** Linker file for the IAR ANSI C/C++ Compiler for ARM -** -** Copyright 2016 Freescale Semiconductor, Inc. -** Copyright 2016-2018 NXP -** All rights reserved. -** -** SPDX-License-Identifier: BSD-3-Clause -** -** http: www.nxp.com -** mail: support@nxp.com -** -** ################################################################### -*/ - -define symbol m_interrupts_start = 0x60002000; -define symbol m_interrupts_end = 0x600023FF; - -define symbol m_text_start = 0x60002400; -define symbol m_text_end = 0x63FFFFFF; - -define symbol m_data_start = 0x20000000; -define symbol m_data_end = 0x2001FFFF; - -define symbol m_data2_start = 0x20200000; -define symbol m_data2_end = 0x2023FFFF; - -define exported symbol m_boot_hdr_conf_start = 0x60000000; -define symbol m_boot_hdr_ivt_start = 0x60001000; -define symbol m_boot_hdr_boot_data_start = 0x60001020; -define symbol m_boot_hdr_dcd_data_start = 0x60001030; - -/* Sizes */ -if (isdefinedsymbol(__stack_size__)) { - define symbol __size_cstack__ = __stack_size__; -} else { - define symbol __size_cstack__ = 0x0400; -} - -if (isdefinedsymbol(__heap_size__)) { - define symbol __size_heap__ = __heap_size__; -} else { - define symbol __size_heap__ = 0x0400; -} - -define exported symbol __VECTOR_TABLE = m_interrupts_start; -define exported symbol __VECTOR_RAM = m_interrupts_start; -define exported symbol __RAM_VECTOR_TABLE_SIZE = 0x0; -define exported symbol __RTT_HEAP_END = m_data2_end; - -define memory mem with size = 4G; -define region TEXT_region = mem:[from m_interrupts_start to m_interrupts_end] - | mem:[from m_text_start to m_text_end]; - -define region DATA_region = mem:[from m_data_start to m_data_end-__size_cstack__]; -define region DATA2_region = mem:[from m_data2_start to m_data2_end]; -define region CSTACK_region = mem:[from m_data_end-__size_cstack__+1 to m_data_end]; - -define block CSTACK with alignment = 8, size = __size_cstack__ { }; -define block HEAP with alignment = 8, size = __size_heap__ { }; -define block RW { readwrite }; -define block ZI { zi }; -define block NCACHE_VAR { section NonCacheable , section NonCacheable.init }; - -initialize by copy { readwrite, section .textrw }; -do not initialize { section .noinit }; - -place at address mem: m_interrupts_start { readonly section .intvec }; - -place at address mem:m_boot_hdr_conf_start { section .boot_hdr.conf }; -place at address mem:m_boot_hdr_ivt_start { section .boot_hdr.ivt }; -place at address mem:m_boot_hdr_boot_data_start { readonly section .boot_hdr.boot_data }; -place at address mem:m_boot_hdr_dcd_data_start { readonly section .boot_hdr.dcd_data }; - -keep{ section .boot_hdr.conf, section .boot_hdr.ivt, section .boot_hdr.boot_data, section .boot_hdr.dcd_data }; - -place in TEXT_region { readonly }; -place in DATA_region { block RW }; -place in DATA_region { block ZI }; -place in DATA_region { last block HEAP }; -place in DATA_region { block NCACHE_VAR }; -place in CSTACK_region { block CSTACK }; - diff --git a/bsp/imxrt/imxrt1052-sc-internal/board/linker_scripts/link.lds b/bsp/imxrt/imxrt1052-sc-internal/board/linker_scripts/link.lds deleted file mode 100644 index ec0c31b84b..0000000000 --- a/bsp/imxrt/imxrt1052-sc-internal/board/linker_scripts/link.lds +++ /dev/null @@ -1,298 +0,0 @@ -/* -** ################################################################### -** Processors: MIMXRT1052CVJ5B -** MIMXRT1052CVL5B -** MIMXRT1052DVJ6B -** MIMXRT1052DVL6B -** -** Compiler: GNU C Compiler -** Reference manual: IMXRT1050RM Rev.1, 03/2018 -** Version: rev. 0.1, 2017-01-10 -** Build: b180509 -** -** Abstract: -** Linker file for the GNU C Compiler -** -** The Clear BSD License -** Copyright 2016 Freescale Semiconductor, Inc. -** Copyright 2016-2018 NXP -** All rights reserved. -** -** Redistribution and use in source and binary forms, with or without -** modification, are permitted (subject to the limitations in the -** disclaimer below) provided that the following conditions are met: -** -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in the -** documentation and/or other materials provided with the distribution. -** -** * Neither the name of the copyright holder nor the names of its -** contributors may be used to endorse or promote products derived from -** this software without specific prior written permission. -** -** NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE -** GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT -** HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED -** WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -** MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR -** BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -** WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -** OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN -** IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -** -** http: www.nxp.com -** mail: support@nxp.com -** -** ################################################################### -*/ - -/* Entry Point */ -ENTRY(Reset_Handler) - -HEAP_SIZE = DEFINED(__heap_size__) ? __heap_size__ : 0x0400; -STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x0400; - -/* Specify the memory areas */ -MEMORY -{ - m_flash_config (RX) : ORIGIN = 0x60000000, LENGTH = 0x00001000 - m_ivt (RX) : ORIGIN = 0x60001000, LENGTH = 0x00001000 - m_interrupts (RX) : ORIGIN = 0x60002000, LENGTH = 0x00000400 - m_text (RX) : ORIGIN = 0x60002400, LENGTH = 0x03FFDC00 - m_data (RW) : ORIGIN = 0x20000000, LENGTH = 0x00020000 - m_data2 (RW) : ORIGIN = 0x20200000, LENGTH = 0x00040000 -} - -/* Define output sections */ -SECTIONS -{ - .flash_config : - { - . = ALIGN(4); - __FLASH_BASE = .; - KEEP(* (.boot_hdr.conf)) /* flash config section */ - . = ALIGN(4); - } > m_flash_config - - ivt_begin= ORIGIN(m_flash_config) + LENGTH(m_flash_config); - - .ivt : AT(ivt_begin) - { - . = ALIGN(4); - KEEP(* (.boot_hdr.ivt)) /* ivt section */ - KEEP(* (.boot_hdr.boot_data)) /* boot section */ - KEEP(* (.boot_hdr.dcd_data)) /* dcd section */ - . = ALIGN(4); - } > m_ivt - - /* The startup code goes first into internal RAM */ - .interrupts : - { - __VECTOR_TABLE = .; - . = ALIGN(4); - KEEP(*(.isr_vector)) /* Startup code */ - . = ALIGN(4); - } > m_interrupts - - __VECTOR_RAM = __VECTOR_TABLE; - __RAM_VECTOR_TABLE_SIZE_BYTES = 0x0; - - /* The program code and other data goes into internal RAM */ - .text : - { - . = ALIGN(4); - *(.text) /* .text sections (code) */ - *(.text*) /* .text* sections (code) */ - *(.rodata) /* .rodata sections (constants, strings, etc.) */ - *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ - *(.glue_7) /* glue arm to thumb code */ - *(.glue_7t) /* glue thumb to arm code */ - *(.eh_frame) - KEEP (*(.init)) - KEEP (*(.fini)) - . = ALIGN(4); - - /* section information for finsh shell */ - . = ALIGN(4); - __fsymtab_start = .; - KEEP(*(FSymTab)) - __fsymtab_end = .; - . = ALIGN(4); - __vsymtab_start = .; - KEEP(*(VSymTab)) - __vsymtab_end = .; - . = ALIGN(4); - - /* section information for initial. */ - . = ALIGN(4); - __rt_init_start = .; - KEEP(*(SORT(.rti_fn*))) - __rt_init_end = .; - } > m_text - - .ARM.extab : - { - *(.ARM.extab* .gnu.linkonce.armextab.*) - } > m_text - - .ARM : - { - __exidx_start = .; - *(.ARM.exidx*) - __exidx_end = .; - } > m_text - - .ctors : - { - __CTOR_LIST__ = .; - /* gcc uses crtbegin.o to find the start of - the constructors, so we make sure it is - first. Because this is a wildcard, it - doesn't matter if the user does not - actually link against crtbegin.o; the - linker won't look for a file to match a - wildcard. The wildcard also means that it - doesn't matter which directory crtbegin.o - is in. */ - KEEP (*crtbegin.o(.ctors)) - KEEP (*crtbegin?.o(.ctors)) - /* We don't want to include the .ctor section from - from the crtend.o file until after the sorted ctors. - The .ctor section from the crtend file contains the - end of ctors marker and it must be last */ - KEEP (*(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)) - KEEP (*(SORT(.ctors.*))) - KEEP (*(.ctors)) - __CTOR_END__ = .; - } > m_text - - .dtors : - { - __DTOR_LIST__ = .; - KEEP (*crtbegin.o(.dtors)) - KEEP (*crtbegin?.o(.dtors)) - KEEP (*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)) - KEEP (*(SORT(.dtors.*))) - KEEP (*(.dtors)) - __DTOR_END__ = .; - } > m_text - - .preinit_array : - { - PROVIDE_HIDDEN (__preinit_array_start = .); - KEEP (*(.preinit_array*)) - PROVIDE_HIDDEN (__preinit_array_end = .); - } > m_text - - .init_array : - { - PROVIDE_HIDDEN (__init_array_start = .); - KEEP (*(SORT(.init_array.*))) - KEEP (*(.init_array*)) - PROVIDE_HIDDEN (__init_array_end = .); - } > m_text - - .fini_array : - { - PROVIDE_HIDDEN (__fini_array_start = .); - KEEP (*(SORT(.fini_array.*))) - KEEP (*(.fini_array*)) - PROVIDE_HIDDEN (__fini_array_end = .); - } > m_text - - __etext = .; /* define a global symbol at end of code */ - __DATA_ROM = .; /* Symbol is used by startup for data initialization */ - - .data : AT(__DATA_ROM) - { - . = ALIGN(4); - __DATA_RAM = .; - __data_start__ = .; /* create a global symbol at data start */ - *(m_usb_dma_init_data) - *(.data) /* .data sections */ - *(.data*) /* .data* sections */ - KEEP(*(.jcr*)) - . = ALIGN(4); - __data_end__ = .; /* define a global symbol at data end */ - } > m_data - - __NDATA_ROM = __DATA_ROM + (__data_end__ - __data_start__); - .ncache.init : AT(__NDATA_ROM) - { - __noncachedata_start__ = .; /* create a global symbol at ncache data start */ - *(NonCacheable.init) - . = ALIGN(4); - __noncachedata_init_end__ = .; /* create a global symbol at initialized ncache data end */ - } > m_data - . = __noncachedata_init_end__; - .ncache : - { - *(NonCacheable) - . = ALIGN(4); - __noncachedata_end__ = .; /* define a global symbol at ncache data end */ - } > m_data - - __DATA_END = __NDATA_ROM + (__noncachedata_init_end__ - __noncachedata_start__); - text_end = ORIGIN(m_text) + LENGTH(m_text); - ASSERT(__DATA_END <= text_end, "region m_text overflowed with text and data") - - /* Uninitialized data section */ - .bss : - { - /* This is used by the startup in order to initialize the .bss section */ - . = ALIGN(4); - __START_BSS = .; - __bss_start__ = .; - *(m_usb_dma_noninit_data) - *(.bss) - *(.bss*) - *(COMMON) - . = ALIGN(4); - __bss_end__ = .; - __END_BSS = .; - } > m_data - - .heap : - { - . = ALIGN(8); - __end__ = .; - PROVIDE(end = .); - __HeapBase = .; - . += HEAP_SIZE; - __HeapLimit = .; - __heap_limit = .; /* Add for _sbrk */ - } > m_data - - .stack : - { - . = ALIGN(8); - stack_start = .; - . += STACK_SIZE; - stack_end = .; - __StackTop = .; - } > m_data - - .RTT_HEAP : - { - heap_start = .; - . = ALIGN(8); - } > m_data - - PROVIDE(heap_end = ORIGIN(m_data) + LENGTH(m_data)); - - /* Initializes stack on the end of block */ - __StackLimit = __StackTop - STACK_SIZE; - PROVIDE(__stack = __StackTop); - - .ARM.attributes 0 : { *(.ARM.attributes) } - - ASSERT(__StackLimit >= __HeapLimit, "region m_data overflowed with stack and heap") -} - diff --git a/bsp/imxrt/imxrt1052-sc-internal/board/linker_scripts/link.sct b/bsp/imxrt/imxrt1052-sc-internal/board/linker_scripts/link.sct deleted file mode 100644 index f7ceb52456..0000000000 --- a/bsp/imxrt/imxrt1052-sc-internal/board/linker_scripts/link.sct +++ /dev/null @@ -1,92 +0,0 @@ -#! armcc -E -/* -** ################################################################### -** Processors: MIMXRT1052CVJ5B -** MIMXRT1052CVL5B -** MIMXRT1052DVJ6B -** MIMXRT1052DVL6B -** -** Compiler: Keil ARM C/C++ Compiler -** Reference manual: IMXRT1050RM Rev.1, 03/2018 -** Version: rev. 1.0, 2018-09-21 -** Build: b180921 -** -** Abstract: -** Linker file for the Keil ARM C/C++ Compiler -** -** Copyright 2016 Freescale Semiconductor, Inc. -** Copyright 2016-2018 NXP -** All rights reserved. -** -** SPDX-License-Identifier: BSD-3-Clause -** -** http: www.nxp.com -** mail: support@nxp.com -** -** ################################################################### -*/ - -#define m_flash_config_start 0x60000000 -#define m_flash_config_size 0x00001000 - -#define m_ivt_start 0x60001000 -#define m_ivt_size 0x00001000 - -#define m_interrupts_start 0x60002000 -#define m_interrupts_size 0x00000400 - -#define m_text_start 0x60002400 -#define m_text_size 0x1fffdbff - -#define m_data_start 0x20000000 -#define m_data_size 0x00020000 - -#define m_data2_start 0x20200000 -#define m_data2_size 0x00040000 - -/* Sizes */ -#if (defined(__stack_size__)) - #define Stack_Size __stack_size__ -#else - #define Stack_Size 0x0400 -#endif - -#if (defined(__heap_size__)) - #define Heap_Size __heap_size__ -#else - #define Heap_Size 0x0400 -#endif - -#define RTT_HEAP_SIZE (m_data_size-ImageLength(RW_m_data)-ImageLength(ARM_LIB_HEAP)-ImageLength(ARM_LIB_STACK)) - -#if defined(XIP_BOOT_HEADER_ENABLE) && (XIP_BOOT_HEADER_ENABLE == 1) -LR_m_text m_flash_config_start m_text_start+m_text_size-m_flash_config_start { ; load region size_region - RW_m_config_text m_flash_config_start FIXED m_flash_config_size { ; load address = execution address - * (.boot_hdr.conf, +FIRST) - } - - RW_m_ivt_text m_ivt_start FIXED m_ivt_size { ; load address = execution address - * (.boot_hdr.ivt, +FIRST) - * (.boot_hdr.boot_data) - * (.boot_hdr.dcd_data) - } -#else -LR_m_text m_interrupts_start m_text_start+m_text_size-m_interrupts_start { ; load region size_region -#endif - VECTOR_ROM m_interrupts_start FIXED m_interrupts_size { ; load address = execution address - * (RESET,+FIRST) - } - ER_m_text m_text_start FIXED m_text_size { ; load address = execution address - * (InRoot$$Sections) - .ANY (+RO) - } - RW_m_data m_data_start m_data_size-Stack_Size-Heap_Size { ; RW data - .ANY (+RW +ZI) - * (NonCacheable.init) - * (NonCacheable) - } - ARM_LIB_HEAP +0 EMPTY Heap_Size { ; Heap region growing up - } - ARM_LIB_STACK +0 EMPTY Stack_Size{} ; Stack region growing down - RTT_HEAP +0 EMPTY RTT_HEAP_SIZE{} -} diff --git a/bsp/imxrt/imxrt1052-sc-internal/figures/board.png b/bsp/imxrt/imxrt1052-sc-internal/figures/board.png deleted file mode 100644 index 91918bfd375500d0c7a3636cc6d4e9cfa87d89af..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 153492 zcmZ^JXEc?1EScI}N5}&cKa6p(Q{0Ilr z^9c!F!(1LXeU|=+RWkfy2XhBYSzb-@{{H^eD|$voMgs!_CMKqPEOK@ZPHe~k3k%CF z7S{dkEw+pkww$|+j5G}m4feMTUOpi@Iv}=5KDJfa+js2mKM2aoDUgwoNz2HKh)HN@ zYJtFDAz=^?AD^U@G`4Os7Hk*m#|$SIAGUTJmd_aWmnf{z4Xnt0aS3UxpG(+kArcZ2 z*iOw{TwK`Z#c~SDSmE2)O5d?Heqq~I3xg!E-FvX@>mNUU?BeFGq^yV)ytcf&fUW$4 zm6grd#26bogzeg?uKxM$TULP&!sb?%msi)eb`IDIP)!}ZpP?c0N@`2sXP8HI+qQb+tQ_g<=yE&8(fbwm1ELMqQtumDjbUW)&PwMmN;g)P%fT zYH@nSz?xN1SX^0yW1O8+SlQ81m6eloGM|nx~Y8EJF%Go{C zw|uc~6e%U6@x#v}zpOPH79cJDzPTzbEGC*IU??T4Qbd4lH21x>l8~2&{rKEkT4K=3 zOfxnVvECvpR=6>EJk93V;_IxP_{)ibg|#X-@V>V8xP8if;P5^?{Fae%aUd};EIBFY zOR%36yJ1>)SBb-U<$S6BGt39b6C_uf6!=2a-vR#yG^a!Et}b`vmks&#Lu4{TSL zqI5_OjvYuVHg_>kuwi{7RfC1~5=&M>OwE06Z}Ewmsur9R@{%YMs{f)Ehn{1MXJOup zCw3s-o0IU8@-lGi;j^btAL2dgq6v|9*Nwz_pxr?cnfu6*_=!~BYhpR`Y_HW!i3z=? z0+l@6kZi&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a/bsp/imxrt/imxrt1052-sc-internal/project.ewd b/bsp/imxrt/imxrt1052-sc-internal/project.ewd deleted file mode 100644 index 55328e709c..0000000000 --- a/bsp/imxrt/imxrt1052-sc-internal/project.ewd +++ /dev/null @@ -1,1485 +0,0 @@ - - - 3 - - rtthread - - ARM - - 1 - - C-SPY - 2 - - 30 - 1 - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ARMSIM_ID - 2 - - 1 - 1 - 1 - - - - - - - - CADI_ID - 2 - - 0 - 1 - 1 - - - - - - - - - CMSISDAP_ID - 2 - - 4 - 1 - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - GDBSERVER_ID - 2 - - 0 - 1 - 1 - - - - - - - - - - - IJET_ID - 2 - - 8 - 1 - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - JLINK_ID - 2 - - 16 - 1 - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - LMIFTDI_ID - 2 - - 2 - 1 - 1 - - - - - - - - - - NULINK_ID - 2 - - 0 - 1 - 1 - - - - - - - PEMICRO_ID - 2 - - 3 - 1 - 1 - - - - - - - - STLINK_ID - 2 - - 6 - 1 - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - THIRDPARTY_ID - 2 - - 0 - 1 - 1 - - - - - - - - TIFET_ID - 2 - - 1 - 1 - 1 - - - - - - - - - - - - - - - - - - - XDS100_ID - 2 - - 8 - 1 - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\FreeRtos\FreeRtosArmPlugin.ENU.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\HWRTOSplugin\HWRTOSplugin.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\Mbed\MbedArmPlugin.ENU.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\Mbed\MbedArmPlugin2.ENU.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\SMX\smxAwareIarArm8.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\SMX\smxAwareIarArm8BE.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin - 0 - - - $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin - 1 - - - $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin - 0 - - - $EW_DIR$\common\plugins\TargetAccessServer\TargetAccessServer.ENU.ewplugin - 0 - - - $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin - 0 - - - - diff --git a/bsp/imxrt/imxrt1052-sc-internal/project.ewp b/bsp/imxrt/imxrt1052-sc-internal/project.ewp deleted file mode 100644 index f5a716af31..0000000000 --- a/bsp/imxrt/imxrt1052-sc-internal/project.ewp +++ /dev/null @@ -1,1274 +0,0 @@ - - 3 - - rtthread - - ARM - - 1 - - General - 3 - - 31 - 1 - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ICCARM - 2 - - 35 - 1 - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - AARM - 2 - - 10 - 1 - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - OBJCOPY - 0 - - 1 - 1 - 1 - - - - - - - - - CUSTOM - 3 - - - - 0 - - - - BICOMP - 0 - - - - BUILDACTION - 1 - - - - - - - ILINK - 0 - - 22 - 1 - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - IARCHIVE - 0 - - 0 - 1 - 1 - - - - - - - BILINK - 0 - - - - - Kernel - - $PROJ_DIR$\..\..\..\src\clock.c - - - $PROJ_DIR$\..\..\..\src\components.c - - - $PROJ_DIR$\..\..\..\src\cpu.c - - - $PROJ_DIR$\..\..\..\src\device.c - - - $PROJ_DIR$\..\..\..\src\idle.c - - - $PROJ_DIR$\..\..\..\src\ipc.c - - - $PROJ_DIR$\..\..\..\src\irq.c - - - $PROJ_DIR$\..\..\..\src\kservice.c - - - $PROJ_DIR$\..\..\..\src\memheap.c - - - $PROJ_DIR$\..\..\..\src\mempool.c - - - $PROJ_DIR$\..\..\..\src\object.c - - - $PROJ_DIR$\..\..\..\src\scheduler.c - - - $PROJ_DIR$\..\..\..\src\signal.c - - - $PROJ_DIR$\..\..\..\src\thread.c - - - $PROJ_DIR$\..\..\..\src\timer.c - - - - Applications - - $PROJ_DIR$\applications\main.c - - - - Drivers - - $PROJ_DIR$\board\board.c - - - $PROJ_DIR$\board\MCUX_Config\clock_config.c - - - $PROJ_DIR$\board\MCUX_Config\pin_mux.c - - - $PROJ_DIR$\..\Libraries\drivers\drv_gpio.c - - - $PROJ_DIR$\..\Libraries\drivers\drv_uart.c - - - - cpu - - $PROJ_DIR$\..\..\..\libcpu\arm\common\backtrace.c - - - $PROJ_DIR$\..\..\..\libcpu\arm\common\div0.c - - - $PROJ_DIR$\..\..\..\libcpu\arm\common\showmem.c - - - $PROJ_DIR$\..\..\..\libcpu\arm\cortex-m7\cpuport.c - - - $PROJ_DIR$\..\..\..\libcpu\arm\cortex-m7\context_iar.S - - - - DeviceDrivers - - $PROJ_DIR$\..\..\..\components\drivers\cputime\cputime.c - - - $PROJ_DIR$\..\..\..\components\drivers\misc\pin.c - - - $PROJ_DIR$\..\..\..\components\drivers\serial\serial.c - - - $PROJ_DIR$\..\..\..\components\drivers\src\completion.c - - - $PROJ_DIR$\..\..\..\components\drivers\src\dataqueue.c - - - $PROJ_DIR$\..\..\..\components\drivers\src\pipe.c - - - $PROJ_DIR$\..\..\..\components\drivers\src\ringblk_buf.c - - - $PROJ_DIR$\..\..\..\components\drivers\src\ringbuffer.c - - - $PROJ_DIR$\..\..\..\components\drivers\src\waitqueue.c - - - $PROJ_DIR$\..\..\..\components\drivers\src\workqueue.c - - - - finsh - - $PROJ_DIR$\..\..\..\components\finsh\shell.c - - - $PROJ_DIR$\..\..\..\components\finsh\symbol.c - - - $PROJ_DIR$\..\..\..\components\finsh\cmd.c - - - $PROJ_DIR$\..\..\..\components\finsh\msh.c - - - $PROJ_DIR$\..\..\..\components\finsh\msh_cmd.c - - - $PROJ_DIR$\..\..\..\components\finsh\msh_file.c - - - - libc - - $PROJ_DIR$\..\..\..\components\libc\compilers\common\gmtime_r.c - - - - dlib - - $PROJ_DIR$\..\..\..\components\libc\compilers\dlib\environ.c - - - $PROJ_DIR$\..\..\..\components\libc\compilers\dlib\libc.c - - - $PROJ_DIR$\..\..\..\components\libc\compilers\dlib\rmtx.c - - - $PROJ_DIR$\..\..\..\components\libc\compilers\dlib\stdio.c - - - $PROJ_DIR$\..\..\..\components\libc\compilers\dlib\syscall_close.c - - - $PROJ_DIR$\..\..\..\components\libc\compilers\dlib\syscall_lseek.c - - - $PROJ_DIR$\..\..\..\components\libc\compilers\dlib\syscall_mem.c - - - $PROJ_DIR$\..\..\..\components\libc\compilers\dlib\syscall_open.c - - - $PROJ_DIR$\..\..\..\components\libc\compilers\dlib\syscall_read.c - - - $PROJ_DIR$\..\..\..\components\libc\compilers\dlib\syscall_remove.c - - - $PROJ_DIR$\..\..\..\components\libc\compilers\dlib\syscall_write.c - - - $PROJ_DIR$\..\..\..\components\libc\compilers\dlib\time.c - - - - Libraries - - $PROJ_DIR$\..\Libraries\MIMXRT1050\MIMXRT1052\system_MIMXRT1052.c - - - $PROJ_DIR$\..\Libraries\MIMXRT1050\MIMXRT1052\drivers\fsl_common.c - - - $PROJ_DIR$\..\Libraries\MIMXRT1050\MIMXRT1052\drivers\fsl_clock.c - - - $PROJ_DIR$\..\Libraries\MIMXRT1050\MIMXRT1052\drivers\fsl_cache.c - - - $PROJ_DIR$\..\Libraries\MIMXRT1050\MIMXRT1052\iar\startup_MIMXRT1052.s - - - $PROJ_DIR$\..\Libraries\MIMXRT1050\MIMXRT1052\drivers\fsl_gpio.c - - - $PROJ_DIR$\..\Libraries\MIMXRT1050\MIMXRT1052\drivers\fsl_lpuart.c - - - diff --git a/bsp/imxrt/imxrt1052-sc-internal/project.eww b/bsp/imxrt/imxrt1052-sc-internal/project.eww deleted file mode 100644 index c2cb02eb1e..0000000000 --- a/bsp/imxrt/imxrt1052-sc-internal/project.eww +++ /dev/null @@ -1,10 +0,0 @@ - - - - - $WS_DIR$\project.ewp - - - - - diff --git a/bsp/imxrt/imxrt1052-sc-internal/project.uvoptx b/bsp/imxrt/imxrt1052-sc-internal/project.uvoptx deleted file mode 100644 index c1f392aa34..0000000000 --- a/bsp/imxrt/imxrt1052-sc-internal/project.uvoptx +++ /dev/null @@ -1,930 +0,0 @@ - - - - 1.0 - -
    ### uVision Project, (C) Keil Software
    - - - *.c - *.s*; *.src; *.a* - *.obj; *.o - *.lib - *.txt; *.h; *.inc - *.plm - *.cpp - 0 - - - - 0 - 0 - - - - rtthread - 0x4 - ARM-ADS - - 12000000 - - 1 - 1 - 0 - 1 - 0 - - - 1 - 65535 - 0 - 0 - 0 - - - 79 - 66 - 8 - .\build\keil\List\ - - - 1 - 1 - 1 - 0 - 1 - 1 - 0 - 1 - 0 - 0 - 0 - 0 - - - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 0 - 0 - - - 1 - 0 - 1 - - 8 - - 0 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 0 - 1 - 1 - 1 - 1 - 0 - 0 - 1 - 0 - 0 - 3 - - - - - - - - - - .\flexspi_nor.ini - BIN\CMSIS_AGDI.dll - - - - 0 - JL2CM3 - -U30000299 -O78 -S2 -ZTIFSpeedSel5000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST1 -N00("ARM CoreSight SW-DP") -D00(0BD11477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8001 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO15 -FD20000000 -FCF000 -FN1 -FF0MIMXRT105x_QuadSPI_4KB_SEC -FS060000000 -FL0800000 - - - 0 - CMSIS_AGDI - -X"Fire CMSIS-DAP" -UFS-00007888 -O974 -S0 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(0BD11477) -L00(0) -TO18 -TC10000000 -TP20 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20000000 -FCF000 -FN1 -FF0iMXRT1052_W25Q256JV_CFG_By_Fire -FS060000000 -FL02000000 - - - 0 - UL2CM3 - UL2CM3(-S0 -C0 -P0 -FD20000000 -FCF000 -FN1 -FF0MIMXRT105x_HYPER_256KB_SEC -FS060000000 -FL04000000 -FP0($$Device:MIMXRT1052$Flash\MIMXRT105x_HYPER_256KB_SEC.FLM)) - - - - - 0 - - - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - - - - 0 - 0 - 0 - - - - - - - - - - - - - Kernel - 0 - 0 - 0 - 0 - - 1 - 1 - 1 - 0 - 0 - 0 - ..\..\..\src\clock.c - clock.c - 0 - 0 - - - 1 - 2 - 1 - 0 - 0 - 0 - ..\..\..\src\components.c - components.c - 0 - 0 - - - 1 - 3 - 1 - 0 - 0 - 0 - ..\..\..\src\cpu.c - cpu.c - 0 - 0 - - - 1 - 4 - 1 - 0 - 0 - 0 - ..\..\..\src\device.c - device.c - 0 - 0 - - - 1 - 5 - 1 - 0 - 0 - 0 - ..\..\..\src\idle.c - idle.c - 0 - 0 - - - 1 - 6 - 1 - 0 - 0 - 0 - ..\..\..\src\ipc.c - ipc.c - 0 - 0 - - - 1 - 7 - 1 - 0 - 0 - 0 - ..\..\..\src\irq.c - irq.c - 0 - 0 - - - 1 - 8 - 1 - 0 - 0 - 0 - ..\..\..\src\kservice.c - kservice.c - 0 - 0 - - - 1 - 9 - 1 - 0 - 0 - 0 - ..\..\..\src\memheap.c - memheap.c - 0 - 0 - - - 1 - 10 - 1 - 0 - 0 - 0 - ..\..\..\src\mempool.c - mempool.c - 0 - 0 - - - 1 - 11 - 1 - 0 - 0 - 0 - ..\..\..\src\object.c - object.c - 0 - 0 - - - 1 - 12 - 1 - 0 - 0 - 0 - ..\..\..\src\scheduler.c - scheduler.c - 0 - 0 - - - 1 - 13 - 1 - 0 - 0 - 0 - ..\..\..\src\signal.c - signal.c - 0 - 0 - - - 1 - 14 - 1 - 0 - 0 - 0 - ..\..\..\src\thread.c - thread.c - 0 - 0 - - - 1 - 15 - 1 - 0 - 0 - 0 - ..\..\..\src\timer.c - timer.c - 0 - 0 - - - - - Applications - 0 - 0 - 0 - 0 - - 2 - 16 - 1 - 0 - 0 - 0 - applications\main.c - main.c - 0 - 0 - - - - - Drivers - 0 - 0 - 0 - 0 - - 3 - 17 - 1 - 0 - 0 - 0 - board\board.c - board.c - 0 - 0 - - - 3 - 18 - 1 - 0 - 0 - 0 - board\MCUX_Config\clock_config.c - clock_config.c - 0 - 0 - - - 3 - 19 - 1 - 0 - 0 - 0 - board\MCUX_Config\pin_mux.c - pin_mux.c - 0 - 0 - - - 3 - 20 - 1 - 0 - 0 - 0 - ..\Libraries\drivers\drv_gpio.c - drv_gpio.c - 0 - 0 - - - 3 - 21 - 1 - 0 - 0 - 0 - ..\Libraries\drivers\drv_uart.c - drv_uart.c - 0 - 0 - - - - - cpu - 0 - 0 - 0 - 0 - - 4 - 22 - 1 - 0 - 0 - 0 - ..\..\..\libcpu\arm\common\backtrace.c - backtrace.c - 0 - 0 - - - 4 - 23 - 1 - 0 - 0 - 0 - ..\..\..\libcpu\arm\common\div0.c - div0.c - 0 - 0 - - - 4 - 24 - 1 - 0 - 0 - 0 - ..\..\..\libcpu\arm\common\showmem.c - showmem.c - 0 - 0 - - - 4 - 25 - 1 - 0 - 0 - 0 - ..\..\..\libcpu\arm\cortex-m7\cpuport.c - cpuport.c - 0 - 0 - - - 4 - 26 - 2 - 0 - 0 - 0 - ..\..\..\libcpu\arm\cortex-m7\context_rvds.S - context_rvds.S - 0 - 0 - - - - - DeviceDrivers - 0 - 0 - 0 - 0 - - 5 - 27 - 1 - 0 - 0 - 0 - ..\..\..\components\drivers\cputime\cputime.c - cputime.c - 0 - 0 - - - 5 - 28 - 1 - 0 - 0 - 0 - ..\..\..\components\drivers\misc\pin.c - pin.c - 0 - 0 - - - 5 - 29 - 1 - 0 - 0 - 0 - ..\..\..\components\drivers\serial\serial.c - serial.c - 0 - 0 - - - 5 - 30 - 1 - 0 - 0 - 0 - ..\..\..\components\drivers\src\completion.c - completion.c - 0 - 0 - - - 5 - 31 - 1 - 0 - 0 - 0 - ..\..\..\components\drivers\src\dataqueue.c - dataqueue.c - 0 - 0 - - - 5 - 32 - 1 - 0 - 0 - 0 - ..\..\..\components\drivers\src\pipe.c - pipe.c - 0 - 0 - - - 5 - 33 - 1 - 0 - 0 - 0 - ..\..\..\components\drivers\src\ringblk_buf.c - ringblk_buf.c - 0 - 0 - - - 5 - 34 - 1 - 0 - 0 - 0 - ..\..\..\components\drivers\src\ringbuffer.c - ringbuffer.c - 0 - 0 - - - 5 - 35 - 1 - 0 - 0 - 0 - ..\..\..\components\drivers\src\waitqueue.c - waitqueue.c - 0 - 0 - - - 5 - 36 - 1 - 0 - 0 - 0 - ..\..\..\components\drivers\src\workqueue.c - workqueue.c - 0 - 0 - - - - - finsh - 0 - 0 - 0 - 0 - - 6 - 37 - 1 - 0 - 0 - 0 - ..\..\..\components\finsh\shell.c - shell.c - 0 - 0 - - - 6 - 38 - 1 - 0 - 0 - 0 - ..\..\..\components\finsh\symbol.c - symbol.c - 0 - 0 - - - 6 - 39 - 1 - 0 - 0 - 0 - ..\..\..\components\finsh\cmd.c - cmd.c - 0 - 0 - - - 6 - 40 - 1 - 0 - 0 - 0 - ..\..\..\components\finsh\msh.c - msh.c - 0 - 0 - - - 6 - 41 - 1 - 0 - 0 - 0 - ..\..\..\components\finsh\msh_cmd.c - msh_cmd.c - 0 - 0 - - - 6 - 42 - 1 - 0 - 0 - 0 - ..\..\..\components\finsh\msh_file.c - msh_file.c - 0 - 0 - - - - - libc - 0 - 0 - 0 - 0 - - 7 - 43 - 1 - 0 - 0 - 0 - ..\..\..\components\libc\compilers\armlibc\libc.c - libc.c - 0 - 0 - - - 7 - 44 - 1 - 0 - 0 - 0 - ..\..\..\components\libc\compilers\armlibc\mem_std.c - mem_std.c - 0 - 0 - - - 7 - 45 - 1 - 0 - 0 - 0 - ..\..\..\components\libc\compilers\armlibc\stubs.c - stubs.c - 0 - 0 - - - 7 - 46 - 1 - 0 - 0 - 0 - ..\..\..\components\libc\compilers\armlibc\time.c - time.c - 0 - 0 - - - 7 - 47 - 1 - 0 - 0 - 0 - ..\..\..\components\libc\compilers\common\gmtime_r.c - gmtime_r.c - 0 - 0 - - - - - Libraries - 0 - 0 - 0 - 0 - - 8 - 48 - 1 - 0 - 0 - 0 - ..\Libraries\MIMXRT1050\MIMXRT1052\system_MIMXRT1052.c - system_MIMXRT1052.c - 0 - 0 - - - 8 - 49 - 1 - 0 - 0 - 0 - ..\Libraries\MIMXRT1050\MIMXRT1052\drivers\fsl_common.c - fsl_common.c - 0 - 0 - - - 8 - 50 - 1 - 0 - 0 - 0 - ..\Libraries\MIMXRT1050\MIMXRT1052\drivers\fsl_clock.c - fsl_clock.c - 0 - 0 - - - 8 - 51 - 1 - 0 - 0 - 0 - ..\Libraries\MIMXRT1050\MIMXRT1052\drivers\fsl_cache.c - fsl_cache.c - 0 - 0 - - - 8 - 52 - 2 - 0 - 0 - 0 - ..\Libraries\MIMXRT1050\MIMXRT1052\arm\startup_MIMXRT1052.s - startup_MIMXRT1052.s - 0 - 0 - - - 8 - 53 - 1 - 0 - 0 - 0 - ..\Libraries\MIMXRT1050\MIMXRT1052\drivers\fsl_gpio.c - fsl_gpio.c - 0 - 0 - - - 8 - 54 - 1 - 0 - 0 - 0 - ..\Libraries\MIMXRT1050\MIMXRT1052\drivers\fsl_lpuart.c - fsl_lpuart.c - 0 - 0 - - - 8 - 55 - 1 - 0 - 0 - 0 - ..\Libraries\MIMXRT1050\MIMXRT1052\drivers\fsl_dmamux.c - fsl_dmamux.c - 0 - 0 - - - 8 - 56 - 1 - 0 - 0 - 0 - ..\Libraries\MIMXRT1050\MIMXRT1052\drivers\fsl_edma.c - fsl_edma.c - 0 - 0 - - - 8 - 57 - 1 - 0 - 0 - 0 - ..\Libraries\MIMXRT1050\MIMXRT1052\drivers\fsl_lpuart_edma.c - fsl_lpuart_edma.c - 0 - 0 - - - -
    diff --git a/bsp/imxrt/imxrt1052-sc-internal/project.uvprojx b/bsp/imxrt/imxrt1052-sc-internal/project.uvprojx deleted file mode 100644 index e15669351d..0000000000 --- a/bsp/imxrt/imxrt1052-sc-internal/project.uvprojx +++ /dev/null @@ -1,724 +0,0 @@ - - - - 2.1 - -
    ### uVision Project, (C) Keil Software
    - - - - rtthread - 0x4 - ARM-ADS - 5060750::V5.06 update 6 (build 750)::ARMCC - 0 - - - MIMXRT1052:M7 - NXP - NXP.iMXRT_DFP.1.0.3 - http://mcuxpresso.nxp.com/cmsis_pack/repo/ - IRAM(0x20000000,0x00060000) IRAM2(0x00000000,0x00020000) CPUTYPE("Cortex-M7") FPU3(SFPU) CLOCK(12000000) ELITTLE - - - UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0RT1050 -FS060000000 -FL04000000 -FP0($$Device:MIMXRT1052$Flash\RT1050.FLM)) - 0 - $$Device:MIMXRT1052$Device\Include\MIMXRT1052.h - - - - - - - - - - $$Device:MIMXRT1052$SVD\MIMXRT1052.svd - 0 - 0 - - - - - - - 0 - 0 - 0 - 0 - 1 - - .\build\keil\Obj\ - rtthread - 1 - 0 - 0 - 1 - 1 - .\build\keil\List\ - 1 - 0 - 0 - - 0 - 0 - - - 0 - 0 - 0 - 0 - - - 0 - 0 - - - 0 - 0 - 0 - 0 - - - 1 - 0 - fromelf --bin !L --output rtthread.bin - - 0 - 0 - 0 - 0 - - 0 - - - - 0 - 0 - 0 - 0 - 0 - 1 - 0 - 0 - 0 - 0 - 3 - - - 1 - - - SARMCM3.DLL - -REMAP -MPU - DCM.DLL - -pCM7 - SARMCM3.DLL - -MPU - TCM.DLL - -pCM7 - - - - 1 - 0 - 0 - 0 - 16 - - - - - 1 - 0 - 0 - 1 - 1 - 4099 - - 1 - BIN\CMSIS_AGDI.dll - "" () - - - - - 0 - - - - 0 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 0 - 1 - 1 - 0 - 1 - 1 - 0 - 0 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 0 - 0 - "Cortex-M7" - - 0 - 0 - 0 - 0 - 1 - 0 - 0 - 2 - 0 - 1 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 4 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 1 - 0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x20000000 - 0x60000 - - - 1 - 0x0 - 0x8000 - - - 0 - 0x0 - 0x0 - - - 1 - 0x0 - 0x0 - - - 1 - 0x0 - 0x0 - - - 1 - 0x0 - 0x0 - - - 1 - 0x0 - 0x0 - - - 1 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x20000000 - 0x60000 - - - 0 - 0x0 - 0x20000 - - - - - - 1 - 3 - 0 - 0 - 1 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 1 - 0 - 0 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - - --library_interface=armcc --library_type=standardlib --diag_suppress=66,1296,186 - SKIP_SYSCLK_INIT, XIP_EXTERNAL_FLASH, CPU_MIMXRT1052CVL5B, FSL_SDK_ENABLE_DRIVER_CACHE_CONTROL, EVK_MCIMXRM, RT_USING_ARM_LIBC - - .;..\..\..\include;applications;board;board\MCUX_Config;board\ports;..\Libraries\drivers;..\Libraries\drivers\config;..\..\..\libcpu\arm\common;..\..\..\libcpu\arm\cortex-m7;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\..\..\components\finsh;..\..\..\components\libc\compilers\armlibc;..\..\..\components\libc\compilers\common;..\Libraries\MIMXRT1050\CMSIS\Include;..\Libraries\MIMXRT1050\MIMXRT1052;..\Libraries\MIMXRT1050\MIMXRT1052\drivers - - - - 1 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - - - - - - - - - 0 - 0 - 0 - 0 - 1 - 0 - 0x00000000 - 0x10000000 - - .\board\linker_scripts\link.sct - - - - - - - - - - - Kernel - - - clock.c - 1 - ..\..\..\src\clock.c - - - components.c - 1 - ..\..\..\src\components.c - - - cpu.c - 1 - ..\..\..\src\cpu.c - - - device.c - 1 - ..\..\..\src\device.c - - - idle.c - 1 - ..\..\..\src\idle.c - - - ipc.c - 1 - ..\..\..\src\ipc.c - - - irq.c - 1 - ..\..\..\src\irq.c - - - kservice.c - 1 - ..\..\..\src\kservice.c - - - memheap.c - 1 - ..\..\..\src\memheap.c - - - mempool.c - 1 - ..\..\..\src\mempool.c - - - object.c - 1 - ..\..\..\src\object.c - - - scheduler.c - 1 - ..\..\..\src\scheduler.c - - - signal.c - 1 - ..\..\..\src\signal.c - - - thread.c - 1 - ..\..\..\src\thread.c - - - timer.c - 1 - ..\..\..\src\timer.c - - - - - Applications - - - main.c - 1 - applications\main.c - - - - - Drivers - - - board.c - 1 - board\board.c - - - clock_config.c - 1 - board\MCUX_Config\clock_config.c - - - pin_mux.c - 1 - board\MCUX_Config\pin_mux.c - - - drv_gpio.c - 1 - ..\Libraries\drivers\drv_gpio.c - - - drv_uart.c - 1 - ..\Libraries\drivers\drv_uart.c - - - - - cpu - - - backtrace.c - 1 - ..\..\..\libcpu\arm\common\backtrace.c - - - div0.c - 1 - ..\..\..\libcpu\arm\common\div0.c - - - showmem.c - 1 - ..\..\..\libcpu\arm\common\showmem.c - - - cpuport.c - 1 - ..\..\..\libcpu\arm\cortex-m7\cpuport.c - - - context_rvds.S - 2 - ..\..\..\libcpu\arm\cortex-m7\context_rvds.S - - - - - DeviceDrivers - - - cputime.c - 1 - ..\..\..\components\drivers\cputime\cputime.c - - - pin.c - 1 - ..\..\..\components\drivers\misc\pin.c - - - serial.c - 1 - ..\..\..\components\drivers\serial\serial.c - - - completion.c - 1 - ..\..\..\components\drivers\src\completion.c - - - dataqueue.c - 1 - ..\..\..\components\drivers\src\dataqueue.c - - - pipe.c - 1 - ..\..\..\components\drivers\src\pipe.c - - - ringblk_buf.c - 1 - ..\..\..\components\drivers\src\ringblk_buf.c - - - ringbuffer.c - 1 - ..\..\..\components\drivers\src\ringbuffer.c - - - waitqueue.c - 1 - ..\..\..\components\drivers\src\waitqueue.c - - - workqueue.c - 1 - ..\..\..\components\drivers\src\workqueue.c - - - - - finsh - - - shell.c - 1 - ..\..\..\components\finsh\shell.c - - - symbol.c - 1 - ..\..\..\components\finsh\symbol.c - - - cmd.c - 1 - ..\..\..\components\finsh\cmd.c - - - msh.c - 1 - ..\..\..\components\finsh\msh.c - - - msh_cmd.c - 1 - ..\..\..\components\finsh\msh_cmd.c - - - msh_file.c - 1 - ..\..\..\components\finsh\msh_file.c - - - - - libc - - - libc.c - 1 - ..\..\..\components\libc\compilers\armlibc\libc.c - - - mem_std.c - 1 - ..\..\..\components\libc\compilers\armlibc\mem_std.c - - - stubs.c - 1 - ..\..\..\components\libc\compilers\armlibc\stubs.c - - - time.c - 1 - ..\..\..\components\libc\compilers\armlibc\time.c - - - gmtime_r.c - 1 - ..\..\..\components\libc\compilers\common\gmtime_r.c - - - - - Libraries - - - system_MIMXRT1052.c - 1 - ..\Libraries\MIMXRT1050\MIMXRT1052\system_MIMXRT1052.c - - - fsl_common.c - 1 - ..\Libraries\MIMXRT1050\MIMXRT1052\drivers\fsl_common.c - - - fsl_clock.c - 1 - ..\Libraries\MIMXRT1050\MIMXRT1052\drivers\fsl_clock.c - - - fsl_cache.c - 1 - ..\Libraries\MIMXRT1050\MIMXRT1052\drivers\fsl_cache.c - - - startup_MIMXRT1052.s - 2 - ..\Libraries\MIMXRT1050\MIMXRT1052\arm\startup_MIMXRT1052.s - - - fsl_gpio.c - 1 - ..\Libraries\MIMXRT1050\MIMXRT1052\drivers\fsl_gpio.c - - - fsl_lpuart.c - 1 - ..\Libraries\MIMXRT1050\MIMXRT1052\drivers\fsl_lpuart.c - - - fsl_dmamux.c - 1 - ..\Libraries\MIMXRT1050\MIMXRT1052\drivers\fsl_dmamux.c - - - fsl_edma.c - 1 - ..\Libraries\MIMXRT1050\MIMXRT1052\drivers\fsl_edma.c - - - fsl_lpuart_edma.c - 1 - ..\Libraries\MIMXRT1050\MIMXRT1052\drivers\fsl_lpuart_edma.c - - - - - - - - - - - - - - - - - - - - -
    diff --git a/bsp/imxrt/imxrt1052-sc-internal/rtconfig.h b/bsp/imxrt/imxrt1052-sc-internal/rtconfig.h deleted file mode 100644 index 4d57ddbebc..0000000000 --- a/bsp/imxrt/imxrt1052-sc-internal/rtconfig.h +++ /dev/null @@ -1,184 +0,0 @@ -#ifndef RT_CONFIG_H__ -#define RT_CONFIG_H__ - -/* Automatically generated file; DO NOT EDIT. */ -/* RT-Thread Configuration */ - -/* RT-Thread Kernel */ - -#define RT_NAME_MAX 8 -#define RT_ALIGN_SIZE 4 -#define RT_THREAD_PRIORITY_32 -#define RT_THREAD_PRIORITY_MAX 32 -#define RT_TICK_PER_SECOND 100 -#define RT_USING_OVERFLOW_CHECK -#define RT_USING_HOOK -#define RT_USING_IDLE_HOOK -#define RT_IDLE_HOOK_LIST_SIZE 4 -#define IDLE_THREAD_STACK_SIZE 256 -#define RT_DEBUG -#define RT_DEBUG_COLOR - -/* Inter-Thread communication */ - -#define RT_USING_SEMAPHORE -#define RT_USING_MUTEX -#define RT_USING_EVENT -#define RT_USING_MAILBOX -#define RT_USING_MESSAGEQUEUE - -/* Memory Management */ - -#define RT_USING_MEMPOOL -#define RT_USING_MEMHEAP -#define RT_USING_MEMHEAP_AS_HEAP -#define RT_USING_HEAP - -/* Kernel Device Object */ - -#define RT_USING_DEVICE -#define RT_USING_CONSOLE -#define RT_CONSOLEBUF_SIZE 128 -#define RT_CONSOLE_DEVICE_NAME "uart1" -#define RT_VER_NUM 0x40003 - -/* RT-Thread Components */ - -#define RT_USING_COMPONENTS_INIT -#define RT_USING_USER_MAIN -#define RT_MAIN_THREAD_STACK_SIZE 2048 -#define RT_MAIN_THREAD_PRIORITY 10 - -/* C++ features */ - - -/* Command shell */ - -#define RT_USING_FINSH -#define FINSH_THREAD_NAME "tshell" -#define FINSH_USING_HISTORY -#define FINSH_HISTORY_LINES 5 -#define FINSH_USING_SYMTAB -#define FINSH_USING_DESCRIPTION -#define FINSH_THREAD_PRIORITY 20 -#define FINSH_THREAD_STACK_SIZE 4096 -#define FINSH_CMD_SIZE 80 -#define FINSH_USING_MSH -#define FINSH_USING_MSH_DEFAULT -#define FINSH_USING_MSH_ONLY -#define FINSH_ARG_MAX 10 - -/* Device virtual file system */ - -#define RT_USING_DFS -#define DFS_USING_WORKDIR -#define DFS_FILESYSTEMS_MAX 2 -#define DFS_FILESYSTEM_TYPES_MAX 2 -#define DFS_FD_MAX 16 -#define RT_USING_DFS_DEVFS - -/* Device Drivers */ - -#define RT_USING_DEVICE_IPC -#define RT_PIPE_BUFSZ 512 -#define RT_USING_SERIAL -#define RT_SERIAL_USING_DMA -#define RT_SERIAL_RB_BUFSZ 64 -#define RT_USING_CPUTIME -#define RT_USING_PIN -#define RT_USING_PULSE_ENCODER - -/* Using USB */ - -#define RT_USING_USB_HOST -#define RT_USBH_MSTORAGE -#define UDISK_MOUNTPOINT "/" -#define RT_USBD_THREAD_STACK_SZ 4096 - -/* POSIX layer and C standard library */ - -#define RT_USING_LIBC -#define RT_USING_POSIX - -/* Network */ - -/* Socket abstraction layer */ - - -/* Network interface device */ - - -/* light weight TCP/IP stack */ - - -/* AT commands */ - - -/* VBUS(Virtual Software BUS) */ - - -/* Utilities */ - - -/* RT-Thread online packages */ - -/* IoT - internet of things */ - - -/* Wi-Fi */ - -/* Marvell WiFi */ - - -/* Wiced WiFi */ - - -/* IoT Cloud */ - - -/* security packages */ - - -/* language packages */ - - -/* multimedia packages */ - - -/* tools packages */ - - -/* system packages */ - - -/* peripheral libraries and drivers */ - - -/* miscellaneous packages */ - - -/* samples: kernel and components samples */ - - -/* Hardware Drivers Config */ - -#define SOC_IMXRT1052CVL5B - -/* On-chip Peripheral Drivers */ - -#define BSP_USING_GPIO -#define BSP_USING_LPUART -#define BSP_USING_LPUART1 -#define BSP_USING_PULSE_ENCODER -#define BSP_USING_PULSE_ENCODER1 -#define BSP_USING_USB -#define BSP_USING_USB0 -#define BSP_USB0_HOST - -/* Onboard Peripheral Drivers */ - - -/* Board extended module Drivers */ - - -#endif diff --git a/bsp/imxrt/imxrt1052-sc-internal/rtconfig.py b/bsp/imxrt/imxrt1052-sc-internal/rtconfig.py deleted file mode 100644 index 78851a42f7..0000000000 --- a/bsp/imxrt/imxrt1052-sc-internal/rtconfig.py +++ /dev/null @@ -1,160 +0,0 @@ -import os -import sys - -# toolchains options -ARCH='arm' -CPU='cortex-m7' -CROSS_TOOL='gcc' - -# bsp lib config -BSP_LIBRARY_TYPE = None - -if os.getenv('RTT_CC'): - CROSS_TOOL = os.getenv('RTT_CC') -if os.getenv('RTT_ROOT'): - RTT_ROOT = os.getenv('RTT_ROOT') - -# cross_tool provides the cross compiler -# EXEC_PATH is the compiler execute path, for example, CodeSourcery, Keil MDK, IAR -if CROSS_TOOL == 'gcc': - PLATFORM = 'gcc' - EXEC_PATH = r'C:\Users\XXYYZZ' -elif CROSS_TOOL == 'keil': - PLATFORM = 'armcc' - EXEC_PATH = r'C:/Keil_v5' -elif CROSS_TOOL == 'iar': - PLATFORM = 'iar' - EXEC_PATH = r'C:/Program Files (x86)/IAR Systems/Embedded Workbench 8.0' - -if os.getenv('RTT_EXEC_PATH'): - EXEC_PATH = os.getenv('RTT_EXEC_PATH') - -BUILD = 'debug' -#BUILD = 'release' - -if PLATFORM == 'gcc': - PREFIX = 'arm-none-eabi-' - CC = PREFIX + 'gcc' - CXX = PREFIX + 'g++' - AS = PREFIX + 'gcc' - AR = PREFIX + 'ar' - LINK = PREFIX + 'gcc' - TARGET_EXT = 'elf' - SIZE = PREFIX + 'size' - OBJDUMP = PREFIX + 'objdump' - OBJCPY = PREFIX + 'objcopy' - STRIP = PREFIX + 'strip' - - DEVICE = ' -mcpu=' + CPU + ' -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections' - CFLAGS = DEVICE + ' -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.map,-cref,-u,Reset_Handler -T board/linker_scripts/link.lds' - - CPATH = '' - LPATH = '' - - if BUILD == 'debug': - CFLAGS += ' -gdwarf-2' - AFLAGS += ' -gdwarf-2' - CFLAGS += ' -O0' - else: - CFLAGS += ' -O2 -Os' - - POST_ACTION = OBJCPY + ' -O binary --remove-section=.boot_data --remove-section=.image_vertor_table --remove-section=.ncache $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n' - - # module setting - CXXFLAGS = ' -Woverloaded-virtual -fno-exceptions -fno-rtti ' - M_CFLAGS = CFLAGS + ' -mlong-calls -fPIC ' - M_CXXFLAGS = CXXFLAGS + ' -mlong-calls -fPIC' - M_LFLAGS = DEVICE + CXXFLAGS + ' -Wl,--gc-sections,-z,max-page-size=0x4' +\ - ' -shared -fPIC -nostartfiles -static-libgcc' - M_POST_ACTION = STRIP + ' -R .hash $TARGET\n' + SIZE + ' $TARGET \n' - -elif PLATFORM == 'armcc': - CC = 'armcc' - CXX = 'armcc' - AS = 'armasm' - AR = 'armar' - LINK = 'armlink' - TARGET_EXT = 'axf' - - DEVICE = ' --cpu ' + CPU + '.fp.sp' - CFLAGS = DEVICE + ' --apcs=interwork' - AFLAGS = DEVICE - LFLAGS = DEVICE + ' --libpath "' + EXEC_PATH + '\ARM\ARMCC\lib" --info sizes --info totals --info unused --info veneers --list rtthread.map --scatter "board\linker_scripts\link.sct"' - - CFLAGS += ' --diag_suppress=66,1296,186,6134' - CFLAGS += ' -I' + EXEC_PATH + '/ARM/RV31/INC' - LFLAGS += ' --libpath ' + EXEC_PATH + '/ARM/RV31/LIB' - - EXEC_PATH += '/arm/bin40/' - - if BUILD == 'debug': - CFLAGS += ' -g -O0' - AFLAGS += ' -g' - else: - CFLAGS += ' -O2' - - CXXFLAGS = CFLAGS - CFLAGS += ' --c99' - - POST_ACTION = 'fromelf -z $TARGET' - # POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET' - -elif PLATFORM == 'iar': - CC = 'iccarm' - CXX = 'iccarm' - AS = 'iasmarm' - AR = 'iarchive' - LINK = 'ilinkarm' - TARGET_EXT = 'out' - - DEVICE = ' -D__FPU_PRESENT' - - CFLAGS = DEVICE - CFLAGS += ' --diag_suppress Pa050' - CFLAGS += ' --no_cse' - CFLAGS += ' --no_unroll' - CFLAGS += ' --no_inline' - CFLAGS += ' --no_code_motion' - CFLAGS += ' --no_tbaa' - CFLAGS += ' --no_clustering' - CFLAGS += ' --no_scheduling' - CFLAGS += ' --debug' - CFLAGS += ' --endian=little' - CFLAGS += ' --cpu=' + CPU - CFLAGS += ' -e' - CFLAGS += ' --fpu=None' - CFLAGS += ' --dlib_config "' + EXEC_PATH + '/arm/INC/c/DLib_Config_Normal.h"' - CFLAGS += ' -Ol' - CFLAGS += ' --use_c++_inline' - - AFLAGS = '' - AFLAGS += ' -s+' - AFLAGS += ' -w+' - AFLAGS += ' -r' - AFLAGS += ' --cpu ' + CPU - AFLAGS += ' --fpu None' - - if BUILD == 'debug': - CFLAGS += ' --debug' - CFLAGS += ' -On' - else: - CFLAGS += ' -Oh' - - LFLAGS = ' --config "board/linker_scripts/link.icf"' - LFLAGS += ' --redirect _Printf=_PrintfTiny' - LFLAGS += ' --redirect _Scanf=_ScanfSmall' - LFLAGS += ' --entry __iar_program_start' - - CXXFLAGS = CFLAGS - - EXEC_PATH = EXEC_PATH + '/arm/bin/' - POST_ACTION = 'ielftool --bin $TARGET rtthread.bin' - -def dist_handle(BSP_ROOT, dist_dir): - import sys - cwd_path = os.getcwd() - sys.path.append(os.path.join(os.path.dirname(BSP_ROOT), 'tools')) - from sdk_dist import dist_do_building - dist_do_building(BSP_ROOT, dist_dir) \ No newline at end of file diff --git a/bsp/imxrt/imxrt1052-sc-internal/template.ewd b/bsp/imxrt/imxrt1052-sc-internal/template.ewd deleted file mode 100644 index 1bccb036b3..0000000000 --- a/bsp/imxrt/imxrt1052-sc-internal/template.ewd +++ /dev/null @@ -1,1485 +0,0 @@ - - - 3 - - rtthread - - ARM - - 1 - - C-SPY - 2 - - 30 - 1 - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ARMSIM_ID - 2 - - 1 - 1 - 1 - - - - - - - - CADI_ID - 2 - - 0 - 1 - 1 - - - - - - - - - CMSISDAP_ID - 2 - - 4 - 1 - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - GDBSERVER_ID - 2 - - 0 - 1 - 1 - - - - - - - - - - - IJET_ID - 2 - - 8 - 1 - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - JLINK_ID - 2 - - 16 - 1 - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - LMIFTDI_ID - 2 - - 2 - 1 - 1 - - - - - - - - - - NULINK_ID - 2 - - 0 - 1 - 1 - - - - - - - PEMICRO_ID - 2 - - 3 - 1 - 1 - - - - - - - - STLINK_ID - 2 - - 6 - 1 - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - THIRDPARTY_ID - 2 - - 0 - 1 - 1 - - - - - - - - TIFET_ID - 2 - - 1 - 1 - 1 - - - - - - - - - - - - - - - - - - - XDS100_ID - 2 - - 8 - 1 - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\FreeRtos\FreeRtosArmPlugin.ENU.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\HWRTOSplugin\HWRTOSplugin.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\Mbed\MbedArmPlugin.ENU.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\Mbed\MbedArmPlugin2.ENU.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\SMX\smxAwareIarArm8.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\SMX\smxAwareIarArm8BE.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin - 0 - - - $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin - 1 - - - $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin - 0 - - - $EW_DIR$\common\plugins\TargetAccessServer\TargetAccessServer.ENU.ewplugin - 0 - - - $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin - 0 - - - - diff --git a/bsp/imxrt/imxrt1052-sc-internal/template.ewp b/bsp/imxrt/imxrt1052-sc-internal/template.ewp deleted file mode 100644 index fb890850d1..0000000000 --- a/bsp/imxrt/imxrt1052-sc-internal/template.ewp +++ /dev/null @@ -1,1039 +0,0 @@ - - - 3 - - rtthread - - ARM - - 1 - - General - 3 - - 31 - 1 - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ICCARM - 2 - - 35 - 1 - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - AARM - 2 - - 10 - 1 - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - OBJCOPY - 0 - - 1 - 1 - 1 - - - - - - - - - CUSTOM - 3 - - - - 0 - - - - BICOMP - 0 - - - - BUILDACTION - 1 - - - - - - - ILINK - 0 - - 22 - 1 - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - IARCHIVE - 0 - - 0 - 1 - 1 - - - - - - - BILINK - 0 - - - - diff --git a/bsp/imxrt/imxrt1052-sc-internal/template.ewt b/bsp/imxrt/imxrt1052-sc-internal/template.ewt deleted file mode 100644 index 1201d37c24..0000000000 --- a/bsp/imxrt/imxrt1052-sc-internal/template.ewt +++ /dev/null @@ -1,2372 +0,0 @@ - - - 3 - - rtthread - - ARM - - 1 - - C-STAT - 261 - - 261 - - 0 - - 1 - 600 - 0 - 2 - 0 - 1 - 100 - - - 1.5.0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - RuntimeChecking - 0 - - 2 - 1 - 1 - - - - - - - - - - - - - - - - - - - - - - Release - - ARM - - 0 - - C-STAT - 261 - - 261 - - 0 - - 1 - 600 - 0 - 2 - 0 - 1 - 100 - - - 1.5.0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - RuntimeChecking - 0 - - 2 - 1 - 0 - - - - - - - - - - - - - - - - - - - - - diff --git a/bsp/imxrt/imxrt1052-sc-internal/template.eww b/bsp/imxrt/imxrt1052-sc-internal/template.eww deleted file mode 100644 index bd036bb4c9..0000000000 --- a/bsp/imxrt/imxrt1052-sc-internal/template.eww +++ /dev/null @@ -1,10 +0,0 @@ - - - - - $WS_DIR$\template.ewp - - - - - diff --git a/bsp/imxrt/imxrt1052-sc-internal/template.uvoptx b/bsp/imxrt/imxrt1052-sc-internal/template.uvoptx deleted file mode 100644 index 75f90396bc..0000000000 --- a/bsp/imxrt/imxrt1052-sc-internal/template.uvoptx +++ /dev/null @@ -1,182 +0,0 @@ - - - - 1.0 - -
    ### uVision Project, (C) Keil Software
    - - - *.c - *.s*; *.src; *.a* - *.obj; *.o - *.lib - *.txt; *.h; *.inc - *.plm - *.cpp - 0 - - - - 0 - 0 - - - - rtthread - 0x4 - ARM-ADS - - 12000000 - - 1 - 1 - 0 - 1 - 0 - - - 1 - 65535 - 0 - 0 - 0 - - - 79 - 66 - 8 - .\build\keil\List\ - - - 1 - 1 - 1 - 0 - 1 - 1 - 0 - 1 - 0 - 0 - 0 - 0 - - - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 0 - 0 - - - 1 - 0 - 1 - - 8 - - 0 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 0 - 1 - 1 - 1 - 1 - 0 - 0 - 1 - 0 - 0 - 3 - - - - - - - - - - .\flexspi_nor.ini - BIN\CMSIS_AGDI.dll - - - - 0 - JL2CM3 - -U30000299 -O78 -S2 -ZTIFSpeedSel5000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST1 -N00("ARM CoreSight SW-DP") -D00(0BD11477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8001 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO15 -FD20000000 -FCF000 -FN1 -FF0MIMXRT105x_QuadSPI_4KB_SEC -FS060000000 -FL0800000 - - - 0 - CMSIS_AGDI - -X"Fire CMSIS-DAP" -UFS-00007888 -O974 -S0 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(0BD11477) -L00(0) -TO18 -TC10000000 -TP20 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20000000 -FCF000 -FN1 -FF0iMXRT1052_W25Q256JV_CFG_By_Fire -FS060000000 -FL02000000 - - - 0 - UL2CM3 - UL2CM3(-S0 -C0 -P0 -FD20000000 -FCF000 -FN1 -FF0MIMXRT105x_HYPER_256KB_SEC -FS060000000 -FL04000000 -FP0($$Device:MIMXRT1052$Flash\MIMXRT105x_HYPER_256KB_SEC.FLM)) - - - - - 0 - - - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - - - - 0 - 0 - 0 - - - - - - - - - - - -
    diff --git a/bsp/imxrt/imxrt1052-sc-internal/template.uvprojx b/bsp/imxrt/imxrt1052-sc-internal/template.uvprojx deleted file mode 100644 index 80381b5045..0000000000 --- a/bsp/imxrt/imxrt1052-sc-internal/template.uvprojx +++ /dev/null @@ -1,397 +0,0 @@ - - - - 2.1 - -
    ### uVision Project, (C) Keil Software
    - - - - rtthread - 0x4 - ARM-ADS - 5060750::V5.06 update 6 (build 750)::ARMCC - 0 - - - MIMXRT1052:M7 - NXP - NXP.iMXRT_DFP.1.0.3 - http://mcuxpresso.nxp.com/cmsis_pack/repo/ - IRAM(0x20000000,0x00060000) IRAM2(0x00000000,0x00020000) CPUTYPE("Cortex-M7") FPU3(SFPU) CLOCK(12000000) ELITTLE - - - UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0RT1050 -FS060000000 -FL04000000 -FP0($$Device:MIMXRT1052$Flash\RT1050.FLM)) - 0 - $$Device:MIMXRT1052$Device\Include\MIMXRT1052.h - - - - - - - - - - $$Device:MIMXRT1052$SVD\MIMXRT1052.svd - 0 - 0 - - - - - - - 0 - 0 - 0 - 0 - 1 - - .\build\keil\Obj\ - rtthread - 1 - 0 - 0 - 1 - 1 - .\build\keil\List\ - 1 - 0 - 0 - - 0 - 0 - - - 0 - 0 - 0 - 0 - - - 0 - 0 - - - 0 - 0 - 0 - 0 - - - 1 - 0 - fromelf --bin !L --output rtthread.bin - - 0 - 0 - 0 - 0 - - 0 - - - - 0 - 0 - 0 - 0 - 0 - 1 - 0 - 0 - 0 - 0 - 3 - - - 1 - - - SARMCM3.DLL - -REMAP -MPU - DCM.DLL - -pCM7 - SARMCM3.DLL - -MPU - TCM.DLL - -pCM7 - - - - 1 - 0 - 0 - 0 - 16 - - - - - 1 - 0 - 0 - 1 - 1 - 4099 - - 1 - BIN\CMSIS_AGDI.dll - "" () - - - - - 0 - - - - 0 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 0 - 1 - 1 - 0 - 1 - 1 - 0 - 0 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 0 - 0 - "Cortex-M7" - - 0 - 0 - 0 - 0 - 1 - 0 - 0 - 2 - 0 - 1 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 4 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 1 - 0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x20000000 - 0x60000 - - - 1 - 0x0 - 0x8000 - - - 0 - 0x0 - 0x0 - - - 1 - 0x0 - 0x0 - - - 1 - 0x0 - 0x0 - - - 1 - 0x0 - 0x0 - - - 1 - 0x0 - 0x0 - - - 1 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x20000000 - 0x60000 - - - 0 - 0x0 - 0x20000 - - - - - - 1 - 3 - 0 - 0 - 1 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 1 - 0 - 0 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - - --library_interface=armcc --library_type=standardlib --diag_suppress=66,1296,186 - - - - - - - 1 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - - - - - - - - - 0 - 0 - 0 - 0 - 1 - 0 - 0x00000000 - 0x10000000 - - .\board\linker_scripts\link.sct - - - - - - - - - - - - - - - - - - - - - - - - -
    diff --git a/bsp/imxrt/imxrt1052-sc-internal/xip/SConscript b/bsp/imxrt/imxrt1052-sc-internal/xip/SConscript deleted file mode 100644 index 4545f00874..0000000000 --- a/bsp/imxrt/imxrt1052-sc-internal/xip/SConscript +++ /dev/null @@ -1,18 +0,0 @@ -Import('RTT_ROOT') -Import('rtconfig') -from building import * - -cwd = GetCurrentDir() -src = Glob('*.c') -CPPPATH = [cwd] - -if rtconfig.CROSS_TOOL == 'keil': - LINKFLAGS = '--keep=*(.boot_hdr.ivt)' - LINKFLAGS += '--keep=*(.boot_hdr.boot_data)' - LINKFLAGS += '--keep=*(.boot_hdr.dcd_data)' - LINKFLAGS += '--keep=*(.boot_hdr.conf)' -else: - LINKFLAGS = '' - -group = DefineGroup('xip', src, depend = [''], CPPPATH = CPPPATH, LINKFLAGS = LINKFLAGS) -Return('group') diff --git a/bsp/imxrt/imxrt1052-sc-internal/xip/fsl_flexspi_nor_boot.c b/bsp/imxrt/imxrt1052-sc-internal/xip/fsl_flexspi_nor_boot.c deleted file mode 100644 index 41b273f70b..0000000000 --- a/bsp/imxrt/imxrt1052-sc-internal/xip/fsl_flexspi_nor_boot.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2017 NXP - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#include "fsl_flexspi_nor_boot.h" - -/* Component ID definition, used by tools. */ -#ifndef FSL_COMPONENT_ID -#define FSL_COMPONENT_ID "platform.drivers.xip_device" -#endif - -#if defined(XIP_BOOT_HEADER_ENABLE) && (XIP_BOOT_HEADER_ENABLE == 1) -#if defined(__CC_ARM) || defined(__ARMCC_VERSION) || defined(__GNUC__) - __attribute__((section(".boot_hdr.ivt"))) -#elif defined(__ICCARM__) -#pragma location=".boot_hdr.ivt" -#endif -/************************************* - * IVT Data - *************************************/ -const ivt image_vector_table = { - IVT_HEADER, /* IVT Header */ - IMAGE_ENTRY_ADDRESS, /* Image Entry Function */ - IVT_RSVD, /* Reserved = 0 */ - (uint32_t)DCD_ADDRESS, /* Address where DCD information is stored */ - (uint32_t)BOOT_DATA_ADDRESS, /* Address where BOOT Data Structure is stored */ - (uint32_t)&image_vector_table, /* Pointer to IVT Self (absolute address */ - (uint32_t)CSF_ADDRESS, /* Address where CSF file is stored */ - IVT_RSVD /* Reserved = 0 */ -}; - -#if defined(__CC_ARM) || defined(__ARMCC_VERSION) || defined(__GNUC__) - __attribute__((section(".boot_hdr.boot_data"))) -#elif defined(__ICCARM__) -#pragma location=".boot_hdr.boot_data" -#endif -/************************************* - * Boot Data - *************************************/ -const BOOT_DATA_T boot_data = { - FLASH_BASE, /* boot start location */ - FLASH_SIZE, /* size */ - PLUGIN_FLAG, /* Plugin flag*/ - 0xFFFFFFFF /* empty - extra data word */ -}; -#endif - - diff --git a/bsp/imxrt/imxrt1052-sc-internal/xip/fsl_flexspi_nor_boot.h b/bsp/imxrt/imxrt1052-sc-internal/xip/fsl_flexspi_nor_boot.h deleted file mode 100644 index 4870dfb4dc..0000000000 --- a/bsp/imxrt/imxrt1052-sc-internal/xip/fsl_flexspi_nor_boot.h +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Copyright 2017 NXP - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#ifndef __FLEXSPI_NOR_BOOT_H__ -#define __FLEXSPI_NOR_BOOT_H__ - -#include -#include "board.h" - -/*! @name Driver version */ -/*@{*/ -/*! @brief XIP_DEVICE driver version 2.0.0. */ -#define FSL_XIP_DEVICE_DRIVER_VERSION (MAKE_VERSION(2, 0, 0)) -/*@}*/ - -/************************************* - * IVT Data - *************************************/ -typedef struct _ivt_ { - /** @ref hdr with tag #HAB_TAG_IVT, length and HAB version fields - * (see @ref data) - */ - uint32_t hdr; - /** Absolute address of the first instruction to execute from the - * image - */ - uint32_t entry; - /** Reserved in this version of HAB: should be NULL. */ - uint32_t reserved1; - /** Absolute address of the image DCD: may be NULL. */ - uint32_t dcd; - /** Absolute address of the Boot Data: may be NULL, but not interpreted - * any further by HAB - */ - uint32_t boot_data; - /** Absolute address of the IVT.*/ - uint32_t self; - /** Absolute address of the image CSF.*/ - uint32_t csf; - /** Reserved in this version of HAB: should be zero. */ - uint32_t reserved2; -} ivt; - -#define IVT_MAJOR_VERSION 0x4 -#define IVT_MAJOR_VERSION_SHIFT 0x4 -#define IVT_MAJOR_VERSION_MASK 0xF -#define IVT_MINOR_VERSION 0x1 -#define IVT_MINOR_VERSION_SHIFT 0x0 -#define IVT_MINOR_VERSION_MASK 0xF - -#define IVT_VERSION(major, minor) \ - ((((major) & IVT_MAJOR_VERSION_MASK) << IVT_MAJOR_VERSION_SHIFT) | \ - (((minor) & IVT_MINOR_VERSION_MASK) << IVT_MINOR_VERSION_SHIFT)) - -/* IVT header */ -#define IVT_TAG_HEADER 0xD1 /**< Image Vector Table */ -#define IVT_SIZE 0x2000 -#define IVT_PAR IVT_VERSION(IVT_MAJOR_VERSION, IVT_MINOR_VERSION) -#define IVT_HEADER (IVT_TAG_HEADER | (IVT_SIZE << 8) | (IVT_PAR << 24)) - -/* Set resume entry */ -#if defined(__CC_ARM) || defined(__ARMCC_VERSION) - extern uint32_t __Vectors[]; - extern uint32_t Image$$RW_m_config_text$$Base[]; -#define IMAGE_ENTRY_ADDRESS ((uint32_t)__Vectors) -#define FLASH_BASE ((uint32_t)Image$$RW_m_config_text$$Base) -#elif defined(__MCUXPRESSO) - extern uint32_t __Vectors[]; - extern uint32_t __boot_hdr_start__[]; -#define IMAGE_ENTRY_ADDRESS ((uint32_t)__Vectors) -#define FLASH_BASE ((uint32_t)__boot_hdr_start__) -#elif defined(__ICCARM__) - extern uint32_t __VECTOR_TABLE[]; - extern uint32_t m_boot_hdr_conf_start[]; -#define IMAGE_ENTRY_ADDRESS ((uint32_t)__VECTOR_TABLE) -#define FLASH_BASE ((uint32_t)m_boot_hdr_conf_start) -#elif defined(__GNUC__) - extern uint32_t __VECTOR_TABLE[]; - extern uint32_t __FLASH_BASE[]; -#define IMAGE_ENTRY_ADDRESS ((uint32_t)__VECTOR_TABLE) -#define FLASH_BASE ((uint32_t)__FLASH_BASE) -#endif - -#if defined(XIP_BOOT_HEADER_DCD_ENABLE) && (1 == XIP_BOOT_HEADER_DCD_ENABLE) -#define DCD_ADDRESS dcd_data -#else -#define DCD_ADDRESS 0 -#endif - -#define BOOT_DATA_ADDRESS &boot_data -#define CSF_ADDRESS 0 -#define IVT_RSVD (uint32_t)(0x00000000) - -/************************************* - * Boot Data - *************************************/ -typedef struct _boot_data_ { - uint32_t start; /* boot start location */ - uint32_t size; /* size */ - uint32_t plugin; /* plugin flag - 1 if downloaded application is plugin */ - uint32_t placeholder; /* placehoder to make even 0x10 size */ -}BOOT_DATA_T; - -#if defined(BOARD_FLASH_SIZE) -#define FLASH_SIZE BOARD_FLASH_SIZE -#else -#error "Please define macro BOARD_FLASH_SIZE" -#endif -#define PLUGIN_FLAG (uint32_t)0 - -/* External Variables */ -const BOOT_DATA_T boot_data; -#if defined(XIP_BOOT_HEADER_DCD_ENABLE) && (1 == XIP_BOOT_HEADER_DCD_ENABLE) -extern const uint8_t dcd_data[]; -#endif - -#endif /* __FLEXSPI_NOR_BOOT_H__ */ - diff --git a/bsp/imxrt/imxrt1052-sc-internal/xip/fsl_flexspi_nor_config.c b/bsp/imxrt/imxrt1052-sc-internal/xip/fsl_flexspi_nor_config.c deleted file mode 100644 index a85c871076..0000000000 --- a/bsp/imxrt/imxrt1052-sc-internal/xip/fsl_flexspi_nor_config.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright 2017 NXP - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#include "fsl_flexspi_nor_config.h" - -/* Component ID definition, used by tools. */ -#ifndef FSL_COMPONENT_ID -#define FSL_COMPONENT_ID "platform.drivers.xip_board" -#endif - -/******************************************************************************* - * Code - ******************************************************************************/ -#if defined(XIP_BOOT_HEADER_ENABLE) && (XIP_BOOT_HEADER_ENABLE == 1) -#if defined(__CC_ARM) || defined(__ARMCC_VERSION) || defined(__GNUC__) -__attribute__((section(".boot_hdr.conf"))) -#elif defined(__ICCARM__) -#pragma location = ".boot_hdr.conf" -#endif - -const flexspi_nor_config_t qspiflash_config = { - .memConfig = - { - .tag = FLEXSPI_CFG_BLK_TAG, - .version = FLEXSPI_CFG_BLK_VERSION, - .readSampleClkSrc = kFlexSPIReadSampleClk_LoopbackInternally, - .csHoldTime = 3u, - .csSetupTime = 3u, - - .deviceModeCfgEnable = true, - .deviceModeType = 1, //Quad enable command - .deviceModeSeq.seqNum = 1, - .deviceModeSeq.seqId = 4, - .deviceModeArg = 0x000200, //Set QE - .deviceType = kFlexSpiDeviceType_SerialNOR,//kFlexSpiDeviceType_SerialNOR, - - .sflashPadType = kSerialFlash_4Pads, - .serialClkFreq = kFlexSpiSerialClk_166MHz, // 80Mhz for winbond, 100Mhz for GD, 133Mhz for ISSI - .sflashA1Size = 32u * 1024u * 1024u, - .dataValidTime = {16u, 16u}, - - .lookupTable = - { - //Quad Input/Output read sequence - [0] = FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xEB, RADDR_SDR, FLEXSPI_4PAD, 0x18), - [1] = FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_4PAD, 0x06, READ_SDR, FLEXSPI_4PAD, 0x04), - [2] = FLEXSPI_LUT_SEQ(0, 0, 0, 0, 0, 0), - - //Read Status - [1*4] = FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x05, READ_SDR, FLEXSPI_1PAD, 0x04), - - //Write Enable - [3*4] = FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x06, STOP, FLEXSPI_1PAD, 0), - - //Write Status - [4*4] = FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x01, WRITE_SDR, FLEXSPI_1PAD, 0x04), - }, - }, - .pageSize = 512u, - .sectorSize = 256u * 1024u, - .blockSize = 256u * 1024u, - .isUniformBlockSize = true, -}; -#endif /* XIP_BOOT_HEADER_ENABLE */ diff --git a/bsp/imxrt/imxrt1052-sc-internal/xip/fsl_flexspi_nor_config.h b/bsp/imxrt/imxrt1052-sc-internal/xip/fsl_flexspi_nor_config.h deleted file mode 100644 index 0e75d54268..0000000000 --- a/bsp/imxrt/imxrt1052-sc-internal/xip/fsl_flexspi_nor_config.h +++ /dev/null @@ -1,268 +0,0 @@ -/* - * Copyright (c) 2016, Freescale Semiconductor, Inc. - * Copyright 2016-2017 NXP - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#ifndef __FSL_FLEXSPI_NOR_CONFIG__ -#define __FSL_FLEXSPI_NOR_CONFIG__ - -#include -#include -#include "fsl_common.h" - -/*! @name Driver version */ -/*@{*/ -/*! @brief XIP_BOARD driver version 2.0.0. */ -#define FSL_XIP_BOARD_DRIVER_VERSION (MAKE_VERSION(2, 0, 0)) -/*@}*/ - -/* FLEXSPI memory config block related defintions */ -#define FLEXSPI_CFG_BLK_TAG (0x42464346UL) // ascii "FCFB" Big Endian -#define FLEXSPI_CFG_BLK_VERSION (0x56010400UL) // V1.4.0 -#define FLEXSPI_CFG_BLK_SIZE (512) - -/* FLEXSPI Feature related definitions */ -#define FLEXSPI_FEATURE_HAS_PARALLEL_MODE 1 - -/* Lookup table related defintions */ -#define CMD_INDEX_READ 0 -#define CMD_INDEX_READSTATUS 1 -#define CMD_INDEX_WRITEENABLE 2 -#define CMD_INDEX_WRITE 4 - -#define CMD_LUT_SEQ_IDX_READ 0 -#define CMD_LUT_SEQ_IDX_READSTATUS 1 -#define CMD_LUT_SEQ_IDX_WRITEENABLE 3 -#define CMD_LUT_SEQ_IDX_WRITE 9 - -#define CMD_SDR 0x01 -#define CMD_DDR 0x21 -#define RADDR_SDR 0x02 -#define RADDR_DDR 0x22 -#define CADDR_SDR 0x03 -#define CADDR_DDR 0x23 -#define MODE1_SDR 0x04 -#define MODE1_DDR 0x24 -#define MODE2_SDR 0x05 -#define MODE2_DDR 0x25 -#define MODE4_SDR 0x06 -#define MODE4_DDR 0x26 -#define MODE8_SDR 0x07 -#define MODE8_DDR 0x27 -#define WRITE_SDR 0x08 -#define WRITE_DDR 0x28 -#define READ_SDR 0x09 -#define READ_DDR 0x29 -#define LEARN_SDR 0x0A -#define LEARN_DDR 0x2A -#define DATSZ_SDR 0x0B -#define DATSZ_DDR 0x2B -#define DUMMY_SDR 0x0C -#define DUMMY_DDR 0x2C -#define DUMMY_RWDS_SDR 0x0D -#define DUMMY_RWDS_DDR 0x2D -#define JMP_ON_CS 0x1F -#define STOP 0 - -#define FLEXSPI_1PAD 0 -#define FLEXSPI_2PAD 1 -#define FLEXSPI_4PAD 2 -#define FLEXSPI_8PAD 3 - -#define FLEXSPI_LUT_SEQ(cmd0, pad0, op0, cmd1, pad1, op1) \ - (FLEXSPI_LUT_OPERAND0(op0) | FLEXSPI_LUT_NUM_PADS0(pad0) | FLEXSPI_LUT_OPCODE0(cmd0) | FLEXSPI_LUT_OPERAND1(op1) | \ - FLEXSPI_LUT_NUM_PADS1(pad1) | FLEXSPI_LUT_OPCODE1(cmd1)) - -//!@brief Definitions for FlexSPI Serial Clock Frequency -typedef enum _FlexSpiSerialClockFreq -{ - kFlexSpiSerialClk_30MHz = 1, - kFlexSpiSerialClk_50MHz = 2, - kFlexSpiSerialClk_60MHz = 3, - kFlexSpiSerialClk_75MHz = 4, - kFlexSpiSerialClk_80MHz = 5, - kFlexSpiSerialClk_100MHz = 6, - kFlexSpiSerialClk_133MHz = 7, - kFlexSpiSerialClk_166MHz = 8, -} flexspi_serial_clk_freq_t; - -//!@brief FlexSPI clock configuration type -enum -{ - kFlexSpiClk_SDR, //!< Clock configure for SDR mode - kFlexSpiClk_DDR, //!< Clock configurat for DDR mode -}; - -//!@brief FlexSPI Read Sample Clock Source definition -typedef enum _FlashReadSampleClkSource -{ - kFlexSPIReadSampleClk_LoopbackInternally = 0, - kFlexSPIReadSampleClk_LoopbackFromDqsPad = 1, - kFlexSPIReadSampleClk_LoopbackFromSckPad = 2, - kFlexSPIReadSampleClk_ExternalInputFromDqsPad = 3, -} flexspi_read_sample_clk_t; - -//!@brief Misc feature bit definitions -enum -{ - kFlexSpiMiscOffset_DiffClkEnable = 0, //!< Bit for Differential clock enable - kFlexSpiMiscOffset_Ck2Enable = 1, //!< Bit for CK2 enable - kFlexSpiMiscOffset_ParallelEnable = 2, //!< Bit for Parallel mode enable - kFlexSpiMiscOffset_WordAddressableEnable = 3, //!< Bit for Word Addressable enable - kFlexSpiMiscOffset_SafeConfigFreqEnable = 4, //!< Bit for Safe Configuration Frequency enable - kFlexSpiMiscOffset_PadSettingOverrideEnable = 5, //!< Bit for Pad setting override enable - kFlexSpiMiscOffset_DdrModeEnable = 6, //!< Bit for DDR clock confiuration indication. -}; - -//!@brief Flash Type Definition -enum -{ - kFlexSpiDeviceType_SerialNOR = 1, //!< Flash devices are Serial NOR - kFlexSpiDeviceType_SerialNAND = 2, //!< Flash devices are Serial NAND - kFlexSpiDeviceType_SerialRAM = 3, //!< Flash devices are Serial RAM/HyperFLASH - kFlexSpiDeviceType_MCP_NOR_NAND = 0x12, //!< Flash device is MCP device, A1 is Serial NOR, A2 is Serial NAND - kFlexSpiDeviceType_MCP_NOR_RAM = 0x13, //!< Flash deivce is MCP device, A1 is Serial NOR, A2 is Serial RAMs -}; - -//!@brief Flash Pad Definitions -enum -{ - kSerialFlash_1Pad = 1, - kSerialFlash_2Pads = 2, - kSerialFlash_4Pads = 4, - kSerialFlash_8Pads = 8, -}; - -//!@brief FlexSPI LUT Sequence structure -typedef struct _lut_sequence -{ - uint8_t seqNum; //!< Sequence Number, valid number: 1-16 - uint8_t seqId; //!< Sequence Index, valid number: 0-15 - uint16_t reserved; -} flexspi_lut_seq_t; - -//!@brief Flash Configuration Command Type -enum -{ - kDeviceConfigCmdType_Generic, //!< Generic command, for example: configure dummy cycles, drive strength, etc - kDeviceConfigCmdType_QuadEnable, //!< Quad Enable command - kDeviceConfigCmdType_Spi2Xpi, //!< Switch from SPI to DPI/QPI/OPI mode - kDeviceConfigCmdType_Xpi2Spi, //!< Switch from DPI/QPI/OPI to SPI mode - kDeviceConfigCmdType_Spi2NoCmd, //!< Switch to 0-4-4/0-8-8 mode - kDeviceConfigCmdType_Reset, //!< Reset device command -}; - -//!@brief FlexSPI Memory Configuration Block -typedef struct _FlexSPIConfig -{ - uint32_t tag; //!< [0x000-0x003] Tag, fixed value 0x42464346UL - uint32_t version; //!< [0x004-0x007] Version,[31:24] -'V', [23:16] - Major, [15:8] - Minor, [7:0] - bugfix - uint32_t reserved0; //!< [0x008-0x00b] Reserved for future use - uint8_t readSampleClkSrc; //!< [0x00c-0x00c] Read Sample Clock Source, valid value: 0/1/3 - uint8_t csHoldTime; //!< [0x00d-0x00d] CS hold time, default value: 3 - uint8_t csSetupTime; //!< [0x00e-0x00e] CS setup time, default value: 3 - uint8_t columnAddressWidth; //!< [0x00f-0x00f] Column Address with, for HyperBus protocol, it is fixed to 3, For - //! Serial NAND, need to refer to datasheet - uint8_t deviceModeCfgEnable; //!< [0x010-0x010] Device Mode Configure enable flag, 1 - Enable, 0 - Disable - uint8_t deviceModeType; //!< [0x011-0x011] Specify the configuration command type:Quad Enable, DPI/QPI/OPI switch, - //! Generic configuration, etc. - uint16_t waitTimeCfgCommands; //!< [0x012-0x013] Wait time for all configuration commands, unit: 100us, Used for - //! DPI/QPI/OPI switch or reset command - flexspi_lut_seq_t deviceModeSeq; //!< [0x014-0x017] Device mode sequence info, [7:0] - LUT sequence id, [15:8] - LUt - //! sequence number, [31:16] Reserved - uint32_t deviceModeArg; //!< [0x018-0x01b] Argument/Parameter for device configuration - uint8_t configCmdEnable; //!< [0x01c-0x01c] Configure command Enable Flag, 1 - Enable, 0 - Disable - uint8_t configModeType[3]; //!< [0x01d-0x01f] Configure Mode Type, similar as deviceModeTpe - flexspi_lut_seq_t - configCmdSeqs[3]; //!< [0x020-0x02b] Sequence info for Device Configuration command, similar as deviceModeSeq - uint32_t reserved1; //!< [0x02c-0x02f] Reserved for future use - uint32_t configCmdArgs[3]; //!< [0x030-0x03b] Arguments/Parameters for device Configuration commands - uint32_t reserved2; //!< [0x03c-0x03f] Reserved for future use - uint32_t controllerMiscOption; //!< [0x040-0x043] Controller Misc Options, see Misc feature bit definitions for more - //! details - uint8_t deviceType; //!< [0x044-0x044] Device Type: See Flash Type Definition for more details - uint8_t sflashPadType; //!< [0x045-0x045] Serial Flash Pad Type: 1 - Single, 2 - Dual, 4 - Quad, 8 - Octal - uint8_t serialClkFreq; //!< [0x046-0x046] Serial Flash Frequencey, device specific definitions, See System Boot - //! Chapter for more details - uint8_t lutCustomSeqEnable; //!< [0x047-0x047] LUT customization Enable, it is required if the program/erase cannot - //! be done using 1 LUT sequence, currently, only applicable to HyperFLASH - uint32_t reserved3[2]; //!< [0x048-0x04f] Reserved for future use - uint32_t sflashA1Size; //!< [0x050-0x053] Size of Flash connected to A1 - uint32_t sflashA2Size; //!< [0x054-0x057] Size of Flash connected to A2 - uint32_t sflashB1Size; //!< [0x058-0x05b] Size of Flash connected to B1 - uint32_t sflashB2Size; //!< [0x05c-0x05f] Size of Flash connected to B2 - uint32_t csPadSettingOverride; //!< [0x060-0x063] CS pad setting override value - uint32_t sclkPadSettingOverride; //!< [0x064-0x067] SCK pad setting override value - uint32_t dataPadSettingOverride; //!< [0x068-0x06b] data pad setting override value - uint32_t dqsPadSettingOverride; //!< [0x06c-0x06f] DQS pad setting override value - uint32_t timeoutInMs; //!< [0x070-0x073] Timeout threshold for read status command - uint32_t commandInterval; //!< [0x074-0x077] CS deselect interval between two commands - uint16_t dataValidTime[2]; //!< [0x078-0x07b] CLK edge to data valid time for PORT A and PORT B, in terms of 0.1ns - uint16_t busyOffset; //!< [0x07c-0x07d] Busy offset, valid value: 0-31 - uint16_t busyBitPolarity; //!< [0x07e-0x07f] Busy flag polarity, 0 - busy flag is 1 when flash device is busy, 1 - - //! busy flag is 0 when flash device is busy - uint32_t lookupTable[64]; //!< [0x080-0x17f] Lookup table holds Flash command sequences - flexspi_lut_seq_t lutCustomSeq[12]; //!< [0x180-0x1af] Customizable LUT Sequences - uint32_t reserved4[4]; //!< [0x1b0-0x1bf] Reserved for future use -} flexspi_mem_config_t; - -/* */ -#define NOR_CMD_INDEX_READ CMD_INDEX_READ //!< 0 -#define NOR_CMD_INDEX_READSTATUS CMD_INDEX_READSTATUS //!< 1 -#define NOR_CMD_INDEX_WRITEENABLE CMD_INDEX_WRITEENABLE //!< 2 -#define NOR_CMD_INDEX_ERASESECTOR 3 //!< 3 -#define NOR_CMD_INDEX_PAGEPROGRAM CMD_INDEX_WRITE //!< 4 -#define NOR_CMD_INDEX_CHIPERASE 5 //!< 5 -#define NOR_CMD_INDEX_DUMMY 6 //!< 6 -#define NOR_CMD_INDEX_ERASEBLOCK 7 //!< 7 - -#define NOR_CMD_LUT_SEQ_IDX_READ CMD_LUT_SEQ_IDX_READ //!< 0 READ LUT sequence id in lookupTable stored in config block -#define NOR_CMD_LUT_SEQ_IDX_READSTATUS \ - CMD_LUT_SEQ_IDX_READSTATUS //!< 1 Read Status LUT sequence id in lookupTable stored in config block -#define NOR_CMD_LUT_SEQ_IDX_READSTATUS_XPI \ - 2 //!< 2 Read status DPI/QPI/OPI sequence id in lookupTable stored in config block -#define NOR_CMD_LUT_SEQ_IDX_WRITEENABLE \ - CMD_LUT_SEQ_IDX_WRITEENABLE //!< 3 Write Enable sequence id in lookupTable stored in config block -#define NOR_CMD_LUT_SEQ_IDX_WRITEENABLE_XPI \ - 4 //!< 4 Write Enable DPI/QPI/OPI sequence id in lookupTable stored in config block -#define NOR_CMD_LUT_SEQ_IDX_ERASESECTOR 5 //!< 5 Erase Sector sequence id in lookupTable stored in config block -#define NOR_CMD_LUT_SEQ_IDX_ERASEBLOCK 8 //!< 8 Erase Block sequence id in lookupTable stored in config block -#define NOR_CMD_LUT_SEQ_IDX_PAGEPROGRAM \ - CMD_LUT_SEQ_IDX_WRITE //!< 9 Program sequence id in lookupTable stored in config block -#define NOR_CMD_LUT_SEQ_IDX_CHIPERASE 11 //!< 11 Chip Erase sequence in lookupTable id stored in config block -#define NOR_CMD_LUT_SEQ_IDX_READ_SFDP 13 //!< 13 Read SFDP sequence in lookupTable id stored in config block -#define NOR_CMD_LUT_SEQ_IDX_RESTORE_NOCMD \ - 14 //!< 14 Restore 0-4-4/0-8-8 mode sequence id in lookupTable stored in config block -#define NOR_CMD_LUT_SEQ_IDX_EXIT_NOCMD \ - 15 //!< 15 Exit 0-4-4/0-8-8 mode sequence id in lookupTable stored in config blobk - -/* - * Serial NOR configuration block - */ -typedef struct _flexspi_nor_config -{ - flexspi_mem_config_t memConfig; //!< Common memory configuration info via FlexSPI - uint32_t pageSize; //!< Page size of Serial NOR - uint32_t sectorSize; //!< Sector size of Serial NOR - uint8_t ipcmdSerialClkFreq; //!< Clock frequency for IP command - uint8_t isUniformBlockSize; //!< Sector/Block size is the same - uint8_t reserved0[2]; //!< Reserved for future use - uint8_t serialNorType; //!< Serial NOR Flash type: 0/1/2/3 - uint8_t needExitNoCmdMode; //!< Need to exit NoCmd mode before other IP command - uint8_t halfClkForNonReadCmd; //!< Half the Serial Clock for non-read command: true/false - uint8_t needRestoreNoCmdMode; //!< Need to Restore NoCmd mode after IP commmand execution - uint32_t blockSize; //!< Block size - uint32_t reserve2[11]; //!< Reserved for future use -} flexspi_nor_config_t; - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} -#endif -#endif /* __FSL_FLEXSPI_NOR_CONFIG__ */ diff --git a/bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/drivers/fsl_os_abstraction_rtthread.c b/bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/drivers/fsl_os_abstraction_rtthread.c index 7b53d023f8..afef3d5fca 100644 --- a/bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/drivers/fsl_os_abstraction_rtthread.c +++ b/bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/drivers/fsl_os_abstraction_rtthread.c @@ -415,7 +415,6 @@ osa_status_t OSA_SemaphoreWait(osa_semaphore_handle_t semaphoreHandle, uint32_t osa_status_t OSA_SemaphorePost(osa_semaphore_handle_t semaphoreHandle) { assert(semaphoreHandle); - osa_status_t status = KOSA_StatusError; rt_sem_t sem = (rt_sem_t)(void *)(uint32_t *)(*(uint32_t *)semaphoreHandle); rt_sem_release(sem); return KOSA_StatusSuccess; @@ -547,7 +546,6 @@ osa_status_t OSA_EventCreate(osa_event_handle_t eventHandle, uint8_t autoClear) *END**************************************************************************/ osa_status_t OSA_EventSet(osa_event_handle_t eventHandle, osa_event_flags_t flagsToSet) { - rt_bool_t taskToWake = RT_FALSE; rt_err_t result; assert(eventHandle); osa_event_struct_t *pEventStruct = (osa_event_struct_t *)eventHandle; @@ -643,7 +641,7 @@ osa_status_t OSA_EventWait(osa_event_handle_t eventHandle, osa_event_flags_t *pSetFlags) { assert(eventHandle); - rt_uint8_t option; + rt_uint8_t option = 0; rt_uint32_t timeoutTicks; rt_uint32_t flagsSave; osa_event_struct_t *pEventStruct = (osa_event_struct_t *)eventHandle; @@ -669,7 +667,7 @@ osa_status_t OSA_EventWait(osa_event_handle_t eventHandle, { option |= RT_EVENT_FLAG_CLEAR; } - option |= waitAll ? RT_EVENT_FLAG_AND : RT_EVENT_FLAG_AND;\ + option |= waitAll ? RT_EVENT_FLAG_AND : RT_EVENT_FLAG_OR; rt_err_t status = rt_event_recv(pEventStruct->handle, (rt_uint32_t)flagsToWait, option, timeoutTicks, &flagsSave); @@ -681,11 +679,11 @@ osa_status_t OSA_EventWait(osa_event_handle_t eventHandle, if (RT_EOK != status) { - return KOSA_StatusSuccess; + return KOSA_StatusTimeout; } else { - return KOSA_StatusTimeout; + return KOSA_StatusSuccess; } } @@ -749,7 +747,6 @@ osa_status_t OSA_MsgQCreate(osa_msgq_handle_t msgqHandle, uint32_t msgNo, uint32 osa_status_t OSA_MsgQPut(osa_msgq_handle_t msgqHandle, osa_msg_handle_t pMessage) { assert(msgqHandle); - rt_bool_t taskToWake = RT_FALSE; rt_mq_t handler = (rt_mq_t)(void *)(uint32_t *)(*(uint32_t *)msgqHandle); if (RT_EOK == rt_mq_send(handler, pMessage, handler->msg_size)) diff --git a/bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/gcc/startup_MIMXRT1052.S b/bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/gcc/startup_MIMXRT1052.S index 73003ff20c..ae0f797605 100644 --- a/bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/gcc/startup_MIMXRT1052.S +++ b/bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/gcc/startup_MIMXRT1052.S @@ -367,7 +367,6 @@ Reset_Handler: blt .LC4 #endif /* __STARTUP_INITIALIZE_NONCACHEDATA */ -#ifdef __STARTUP_CLEAR_BSS /* This part of work usually is done in C library startup code. Otherwise, * define this macro to enable it in this startup. * @@ -385,7 +384,6 @@ Reset_Handler: itt lt strlt r0, [r1], #4 blt .LC5 -#endif /* __STARTUP_CLEAR_BSS */ cpsie i /* Unmask interrupts */ #ifndef __START diff --git a/bsp/imxrt/libraries/MIMXRT1050/SConscript b/bsp/imxrt/libraries/MIMXRT1050/SConscript index d1afb9bcf3..77cf8dd78d 100644 --- a/bsp/imxrt/libraries/MIMXRT1050/SConscript +++ b/bsp/imxrt/libraries/MIMXRT1050/SConscript @@ -52,9 +52,6 @@ if GetDepend(['BSP_USING_SDRAM']): if GetDepend(['BSP_USING_LCD']): src += ['MIMXRT1052/drivers/fsl_elcdif.c'] -if GetDepend(['RT_USING_USB_HOST']) or GetDepend(['RT_USING_USB_DEVICE']): - src += ['MIMXRT1052/drivers/fsl_usdhc.c'] - if GetDepend(['BSP_USING_CAN']): src += ['MIMXRT1052/drivers/fsl_flexcan.c'] diff --git a/bsp/imxrt/libraries/drivers/SConscript b/bsp/imxrt/libraries/drivers/SConscript index 6dc0bace0c..6cca919f10 100644 --- a/bsp/imxrt/libraries/drivers/SConscript +++ b/bsp/imxrt/libraries/drivers/SConscript @@ -64,7 +64,7 @@ if GetDepend('RT_USING_USB_DEVICE'): if GetDepend('RT_USING_USB_DEVICE') or GetDepend('RT_USING_USB_HOST'): src += Glob('usb/phy/*.c') - CPPDEFINES += ['ENDIANNESS'] + CPPDEFINES += ['ENDIANNESS','USE_RTOS'] if GetDepend('RT_USING_USB_HOST'): src += ['drv_usbh.c'] diff --git a/bsp/imxrt/libraries/drivers/drv_usbh.c b/bsp/imxrt/libraries/drivers/drv_usbh.c index 7362847eff..a7e0ad6062 100644 --- a/bsp/imxrt/libraries/drivers/drv_usbh.c +++ b/bsp/imxrt/libraries/drivers/drv_usbh.c @@ -11,13 +11,14 @@ */ #include -#ifdef BSP_USING_USB_HOST +#if defined(BSP_USB0_HOST) || defined(BSP_USB1_HOST) #include "drv_usbh.h" #include #include #include #include #include +#include #include @@ -32,6 +33,8 @@ #define BOARD_USB_PHY_TXCAL45DM (0x06U) #endif +#define USB_HOST_INTERRUPT_PRIORITY 3 + enum { #ifdef BSP_USB0_HOST @@ -47,7 +50,7 @@ struct imxrt_usb_host_pipe usb_host_pipe_handle pipe_handle; struct rt_completion urb_completion; usb_status_t transfer_status; -} +}; struct imxrt_usb_host { @@ -79,7 +82,7 @@ static void _imxrt_usb_host_send_callback(void *param, usb_host_transfer_t *tran { struct imxrt_usb_host_pipe *pipe = (struct imxrt_usb_host_pipe *)param; pipe->transfer_status = status; - rt_completion_done(pipe->urb_completion); + rt_completion_done(&pipe->urb_completion); } @@ -104,7 +107,7 @@ static void USB_HostClockInit(usb_controller_index_t controller_id) CLOCK_EnableUsbhs1Clock(kCLOCK_Usb480M, 480000000U); } - USB_EhciPhyInit(controller_id, notUsed, &phyConfig); + USB_EhciPhyInit(controller_id, 24000000U, &phyConfig); } /*! @@ -139,11 +142,13 @@ void USB_OTG1_IRQHandler(void) static rt_err_t _ehci0_reset_port(rt_uint8_t port) { - RT_DEBUG_LOG(RT_DEBUG_USB, ("reset port\n")); - USB_HostEhciControlBus((usb_host_ehci_instance_t *)((usb_host_instance_t *)imxrt_usb_host_obj[USBH0_INDEX].host_handle)->controllerHandle, kUSB_HostBusReset); + // No reset port function available return RT_EOK; } +static uint8_t _ehci0_pipe_buf[64]; +static uint8_t _ehci0_pipe_idx; + static int _ehci0_pipe_xfer(upipe_t pipe, rt_uint8_t token, void *buffer, int nbytes, int timeouts) { int timeout = timeouts; @@ -165,22 +170,64 @@ static int _ehci0_pipe_xfer(upipe_t pipe, rt_uint8_t token, void *buffer, int nb } transfer->transferBuffer = buffer; transfer->transferLength = nbytes; + transfer->transferSofar = 0; transfer->callbackFn = _imxrt_usb_host_send_callback; transfer->callbackParam = &(imxrt_usb_host_obj[USBH0_INDEX].pipes[pipe->pipe_index]); + transfer->direction = (pipe->ep.bEndpointAddress & USB_DIR_IN) ? USB_IN : USB_OUT; + if (pipe->ep.bmAttributes == USB_ENDPOINT_CONTROL) + { + if (token == USBH_PID_SETUP) + { + struct urequest *setup = (struct urequest *)buffer; + transfer->setupStatus = 0; + transfer->setupPacket->bmRequestType = setup->request_type; + transfer->setupPacket->bRequest = setup->bRequest; + transfer->setupPacket->wIndex = setup->wIndex; + transfer->setupPacket->wLength = setup->wLength; + transfer->setupPacket->wValue = setup->wValue; + transfer->transferBuffer = RT_NULL; + transfer->transferLength = 0; + transfer->next = RT_NULL; + if ((transfer->setupPacket->bmRequestType & USB_REQUEST_TYPE_DIR_MASK) == USB_REQUEST_TYPE_DIR_IN) + { + transfer->direction = USB_IN; + transfer->transferBuffer = _ehci0_pipe_buf; + transfer->transferLength = setup->wLength; + _ehci0_pipe_idx = 0; + } + else + { + transfer->direction = USB_OUT; + } + } + else + { + rt_memcpy(buffer, _ehci0_pipe_buf + _ehci0_pipe_idx, nbytes); + imxrt_usb_host_obj[USBH0_INDEX].pipes[pipe->pipe_index].transfer_status = kStatus_USB_Success; + transfer->transferSofar = nbytes; + _ehci0_pipe_idx += nbytes; + if (_ehci0_pipe_idx >= 64) + { + _ehci0_pipe_idx = 0; + } + goto _ehci0_pipe_xfer_finish; + } + + } rt_completion_init(&(imxrt_usb_host_obj[USBH0_INDEX].pipes[pipe->pipe_index].urb_completion)); - if (USB_HostSend(imxrt_usb_host_obj[USBH0_INDEX].host_handle, imxrt_usb_host_obj[USBH0_INDEX].pipes[pipe->pipe_index].pipe_handle, transfer) != kStatus_USB_Success) + if (USB_HostEhciWritePipe(((usb_host_instance_t *)imxrt_usb_host_obj[USBH0_INDEX].host_handle)->controllerHandle, imxrt_usb_host_obj[USBH0_INDEX].pipes[pipe->pipe_index].pipe_handle, transfer) != kStatus_USB_Success) { RT_DEBUG_LOG(RT_DEBUG_USB, ("usb host failed to send\n")); (void)USB_HostFreeTransfer(imxrt_usb_host_obj[USBH0_INDEX].host_handle, transfer); return -1; } - if (-RT_ETIMEOUT == rt_completion_wait(&(imxrt_usb_host_obj[USBH0_INDEX].pipes[pipe->pipe_index].urb_completion), timeout)) + if (-RT_ETIMEOUT == rt_completion_wait(&(imxrt_usb_host_obj[USBH0_INDEX].pipes[pipe->pipe_index].urb_completion), RT_WAITING_FOREVER)) { RT_DEBUG_LOG(RT_DEBUG_USB, ("usb transfer timeout\n")); (void)USB_HostFreeTransfer(imxrt_usb_host_obj[USBH0_INDEX].host_handle, transfer); return -1; } - // rt_thread_mdelay(1); + _ehci0_pipe_xfer_finish: switch (imxrt_usb_host_obj[USBH0_INDEX].pipes[pipe->pipe_index].transfer_status) { case kStatus_USB_Success: @@ -191,7 +238,7 @@ static int _ehci0_pipe_xfer(upipe_t pipe, rt_uint8_t token, void *buffer, int nb { pipe->callback(pipe); } - size_t size = transfer.transferSofar; + size_t size = transfer->transferSofar; (void)USB_HostFreeTransfer(imxrt_usb_host_obj[USBH0_INDEX].host_handle, transfer); if (pipe->ep.bEndpointAddress & 0x80) { @@ -291,10 +338,9 @@ static struct uhcd_ops _ehci0_uhcd_ops = static usb_status_t usb0_host_callback(usb_device_handle handle, usb_host_configuration_handle config_handle, rt_uint32_t event_code) { - usb_status_t status0; usb_status_t status = kStatus_USB_Success; - switch (eventCode) + switch (event_code) { case kUSB_HostEventAttach: if (!imxrt_usb_host_obj[USBH0_INDEX].connect_status) @@ -302,13 +348,12 @@ static usb_status_t usb0_host_callback(usb_device_handle handle, usb_host_config imxrt_usb_host_obj[USBH0_INDEX].connect_status = RT_TRUE; imxrt_usb_host_obj[USBH0_INDEX].device_handle = handle; RT_DEBUG_LOG(RT_DEBUG_USB, ("usb connected\n")); - rt_usbh_root_hub_connect_handler(imxrt_usb_host_obj[USBH0_INDEX].uhcd, OTG_PORT, RT_FALSE); + rt_usbh_root_hub_connect_handler(&(imxrt_usb_host_obj[USBH0_INDEX].uhcd), OTG_PORT, RT_TRUE); } break; case kUSB_HostEventNotSupported: RT_DEBUG_LOG(RT_DEBUG_USB, ("usb device not supported\n")); - status = kStatus_USB_Error; break; case kUSB_HostEventEnumerationDone: @@ -321,7 +366,8 @@ static usb_status_t usb0_host_callback(usb_device_handle handle, usb_host_config imxrt_usb_host_obj[USBH0_INDEX].connect_status = RT_FALSE; imxrt_usb_host_obj[USBH0_INDEX].device_handle = handle; RT_DEBUG_LOG(RT_DEBUG_USB, ("usb disconnnect\n")); - rt_usbh_root_hub_disconnect_handler(imxrt_usb_host_obj[USBH0_INDEX].uhcd, OTG_PORT); + rt_usbh_root_hub_disconnect_handler(&(imxrt_usb_host_obj[USBH0_INDEX].uhcd), OTG_PORT); + (void)USB_HostCloseDeviceInterface(handle, NULL); } break; @@ -331,12 +377,24 @@ static usb_status_t usb0_host_callback(usb_device_handle handle, usb_host_config return status; } +rt_thread_t usbh0_thread; + +static void _ehci0_usbh_thread(void* param) +{ + while (1) + { + USB_HostEhciTaskFunction(imxrt_usb_host_obj[USBH0_INDEX].host_handle); + } +} + static rt_err_t _ehci0_usbh_init(rt_device_t device) { USB_HostClockInit(kUSB_ControllerEhci0); if (kStatus_USB_Success == USB_HostInit(kUSB_ControllerEhci0, &imxrt_usb_host_obj[USBH0_INDEX].host_handle, usb0_host_callback)) - { + { + usbh0_thread = rt_thread_create("ehci0", _ehci0_usbh_thread, RT_NULL, 500, 4, 9999999); + rt_thread_startup(usbh0_thread); USB_HostIsrEnable(kUSB_ControllerEhci0); } else @@ -361,11 +419,13 @@ void USB_OTG2_IRQHandler(void) static rt_err_t _ehci1_reset_port(rt_uint8_t port) { - RT_DEBUG_LOG(RT_DEBUG_USB, ("reset port\n")); - USB_HostEhciControlBus((usb_host_ehci_instance_t *)((usb_host_instance_t *)imxrt_usb_host_obj[USBH1_INDEX].host_handle)->controllerHandle, kUSB_HostBusReset); + // No reset port function available return RT_EOK; } +static uint8_t _ehci1_pipe_buf[64]; +static uint8_t _ehci1_pipe_idx; + static int _ehci1_pipe_xfer(upipe_t pipe, rt_uint8_t token, void *buffer, int nbytes, int timeouts) { int timeout = timeouts; @@ -387,22 +447,65 @@ static int _ehci1_pipe_xfer(upipe_t pipe, rt_uint8_t token, void *buffer, int nb } transfer->transferBuffer = buffer; transfer->transferLength = nbytes; + transfer->transferSofar = 0; transfer->callbackFn = _imxrt_usb_host_send_callback; transfer->callbackParam = &(imxrt_usb_host_obj[USBH1_INDEX].pipes[pipe->pipe_index]); + transfer->direction = (pipe->ep.bEndpointAddress & USB_DIR_IN) ? USB_IN : USB_OUT; + if (pipe->ep.bmAttributes == USB_ENDPOINT_CONTROL) + { + if (token == USBH_PID_SETUP) + { + struct urequest *setup = (struct urequest *)buffer; + transfer->setupStatus = 0; + transfer->setupPacket->bmRequestType = setup->request_type; + transfer->setupPacket->bRequest = setup->bRequest; + transfer->setupPacket->wIndex = setup->wIndex; + transfer->setupPacket->wLength = setup->wLength; + transfer->setupPacket->wValue = setup->wValue; + transfer->transferBuffer = RT_NULL; + transfer->transferLength = 0; + transfer->next = RT_NULL; + if ((transfer->setupPacket->bmRequestType & USB_REQUEST_TYPE_DIR_MASK) == USB_REQUEST_TYPE_DIR_IN) + { + transfer->direction = USB_IN; + transfer->transferBuffer = _ehci1_pipe_buf; + transfer->transferLength = setup->wLength; + _ehci1_pipe_idx = 0; + } + else + { + transfer->direction = USB_OUT; + } + } + else + { + rt_memcpy(buffer, _ehci1_pipe_buf + _ehci1_pipe_idx, nbytes); + imxrt_usb_host_obj[USBH1_INDEX].pipes[pipe->pipe_index].transfer_status = kStatus_USB_Success; + transfer->transferSofar = nbytes; + _ehci1_pipe_idx += nbytes; + if (_ehci1_pipe_idx >= 64) + { + _ehci1_pipe_idx = 0; + } + goto _ehci1_pipe_xfer_finish; + } + + } rt_completion_init(&(imxrt_usb_host_obj[USBH1_INDEX].pipes[pipe->pipe_index].urb_completion)); - if (USB_HostSend(imxrt_usb_host_obj[USBH1_INDEX].host_handle, imxrt_usb_host_obj[USBH1_INDEX].pipes[pipe->pipe_index].pipe_handle, transfer) != kStatus_USB_Success) + if (USB_HostEhciWritePipe(((usb_host_instance_t *)imxrt_usb_host_obj[USBH1_INDEX].host_handle)->controllerHandle, imxrt_usb_host_obj[USBH1_INDEX].pipes[pipe->pipe_index].pipe_handle, transfer) != kStatus_USB_Success) { RT_DEBUG_LOG(RT_DEBUG_USB, ("usb host failed to send\n")); (void)USB_HostFreeTransfer(imxrt_usb_host_obj[USBH1_INDEX].host_handle, transfer); return -1; } - if (-RT_ETIMEOUT == rt_completion_wait(&(imxrt_usb_host_obj[USBH1_INDEX].pipes[pipe->pipe_index].urb_completion), timeout)) + if (-RT_ETIMEOUT == rt_completion_wait(&(imxrt_usb_host_obj[USBH1_INDEX].pipes[pipe->pipe_index].urb_completion), RT_WAITING_FOREVER)) { RT_DEBUG_LOG(RT_DEBUG_USB, ("usb transfer timeout\n")); (void)USB_HostFreeTransfer(imxrt_usb_host_obj[USBH1_INDEX].host_handle, transfer); return -1; } // rt_thread_mdelay(1); + _ehci1_pipe_xfer_finish: switch (imxrt_usb_host_obj[USBH1_INDEX].pipes[pipe->pipe_index].transfer_status) { case kStatus_USB_Success: @@ -413,7 +516,7 @@ static int _ehci1_pipe_xfer(upipe_t pipe, rt_uint8_t token, void *buffer, int nb { pipe->callback(pipe); } - size_t size = transfer.transferSofar; + size_t size = transfer->transferSofar; (void)USB_HostFreeTransfer(imxrt_usb_host_obj[USBH1_INDEX].host_handle, transfer); if (pipe->ep.bEndpointAddress & 0x80) { @@ -499,7 +602,7 @@ static rt_err_t _ehci1_open_pipe(upipe_t pipe) static rt_err_t _ehci1_close_pipe(upipe_t pipe) { (void)USB_HostClosePipe(imxrt_usb_host_obj[USBH1_INDEX].host_handle, imxrt_usb_host_obj[USBH1_INDEX].pipes[pipe->pipe_index].pipe_handle); - _ehci0_free_pipe_index(pipe->pipe_index); + _ehci1_free_pipe_index(pipe->pipe_index); return RT_EOK; } @@ -513,10 +616,9 @@ static struct uhcd_ops _ehci1_uhcd_ops = static usb_status_t usb1_host_callback(usb_device_handle handle, usb_host_configuration_handle config_handle, rt_uint32_t event_code) { - usb_status_t status0; usb_status_t status = kStatus_USB_Success; - switch (eventCode) + switch (event_code) { case kUSB_HostEventAttach: if (!imxrt_usb_host_obj[USBH1_INDEX].connect_status) @@ -524,13 +626,12 @@ static usb_status_t usb1_host_callback(usb_device_handle handle, usb_host_config imxrt_usb_host_obj[USBH1_INDEX].connect_status = RT_TRUE; imxrt_usb_host_obj[USBH1_INDEX].device_handle = handle; RT_DEBUG_LOG(RT_DEBUG_USB, ("usb connected\n")); - rt_usbh_root_hub_connect_handler(imxrt_usb_host_obj[USBH1_INDEX].uhcd, OTG_PORT, RT_FALSE); + rt_usbh_root_hub_connect_handler(&(imxrt_usb_host_obj[USBH1_INDEX].uhcd), OTG_PORT, RT_TRUE); } break; case kUSB_HostEventNotSupported: RT_DEBUG_LOG(RT_DEBUG_USB, ("usb device not supported\n")); - status = kStatus_USB_Error; break; case kUSB_HostEventEnumerationDone: @@ -543,7 +644,8 @@ static usb_status_t usb1_host_callback(usb_device_handle handle, usb_host_config imxrt_usb_host_obj[USBH1_INDEX].connect_status = RT_FALSE; imxrt_usb_host_obj[USBH1_INDEX].device_handle = handle; RT_DEBUG_LOG(RT_DEBUG_USB, ("usb disconnnect\n")); - rt_usbh_root_hub_disconnect_handler(imxrt_usb_host_obj[USBH1_INDEX].uhcd, OTG_PORT); + rt_usbh_root_hub_disconnect_handler(&(imxrt_usb_host_obj[USBH1_INDEX].uhcd), OTG_PORT); + (void)USB_HostCloseDeviceInterface(handle, NULL); } break; @@ -553,12 +655,24 @@ static usb_status_t usb1_host_callback(usb_device_handle handle, usb_host_config return status; } +rt_thread_t usbh1_thread; + +static void _ehci1_usbh_thread(void* param) +{ + while (1) + { + USB_HostEhciTaskFunction(imxrt_usb_host_obj[USBH1_INDEX].host_handle); + } +} + static rt_err_t _ehci1_usbh_init(rt_device_t device) { USB_HostClockInit(kUSB_ControllerEhci1); if (kStatus_USB_Success == USB_HostInit(kUSB_ControllerEhci1, &imxrt_usb_host_obj[USBH1_INDEX].host_handle, usb1_host_callback)) - { + { + usbh1_thread = rt_thread_create("ehci1", _ehci1_usbh_thread, RT_NULL, 500, 4, 9999999); + rt_thread_startup(usbh1_thread); USB_HostIsrEnable(kUSB_ControllerEhci1); } else @@ -577,29 +691,29 @@ int imxrt_usbh_register(void) #ifdef BSP_USB0_HOST usb_host_obj = &(imxrt_usb_host_obj[USBH0_INDEX]); - rt_memset((void *)(usb_host_obj->uhcd), 0, sizeof(struct uhcd)); + rt_memset((void *)(&(usb_host_obj->uhcd)), 0, sizeof(struct uhcd)); usb_host_obj->uhcd.parent.type = RT_Device_Class_USBHost; usb_host_obj->uhcd.parent.init = _ehci0_usbh_init; - usb_host_obj->uhcd.user_data = usb_host_obj; + usb_host_obj->uhcd.parent.user_data = usb_host_obj; usb_host_obj->uhcd.ops = &_ehci0_uhcd_ops; - usb_host_obj->uhcd.num_port = OTG_PORT; + usb_host_obj->uhcd.num_ports = OTG_PORT; res = rt_device_register(&(usb_host_obj->uhcd.parent), usb_host_obj->name, RT_DEVICE_FLAG_DEACTIVATE); if (res != RT_EOK) { rt_kprintf("register usb0 host failed res = %d\r\n", res); return -RT_ERROR; } - + rt_usb_host_init(usb_host_obj->name); #endif #ifdef BSP_USB1_HOST usb_host_obj = &(imxrt_usb_host_obj[USBH1_INDEX]); - rt_memset((void *)(usb_host_obj->uhcd), 0, sizeof(struct uhcd)); + rt_memset((void *)(&(usb_host_obj->uhcd)), 0, sizeof(struct uhcd)); usb_host_obj->uhcd.parent.type = RT_Device_Class_USBHost; usb_host_obj->uhcd.parent.init = _ehci1_usbh_init; - usb_host_obj->uhcd.user_data = usb_host_obj; + usb_host_obj->uhcd.parent.user_data = usb_host_obj; usb_host_obj->uhcd.ops = &_ehci1_uhcd_ops; - usb_host_obj->uhcd.num_port = OTG_PORT; + usb_host_obj->uhcd.num_ports = OTG_PORT; res = rt_device_register(&(usb_host_obj->uhcd.parent), usb_host_obj->name, RT_DEVICE_FLAG_DEACTIVATE); if (res != RT_EOK) { diff --git a/bsp/imxrt/libraries/drivers/usb/host/usb_host.h b/bsp/imxrt/libraries/drivers/usb/host/usb_host.h index 336c42b5f5..6d9167ceac 100644 --- a/bsp/imxrt/libraries/drivers/usb/host/usb_host.h +++ b/bsp/imxrt/libraries/drivers/usb/host/usb_host.h @@ -12,7 +12,6 @@ #include #include #include -#include /******************************************************************************* * Definitions diff --git a/bsp/imxrt/libraries/drivers/usb/host/usb_host_devices.c b/bsp/imxrt/libraries/drivers/usb/host/usb_host_devices.c index 3d3813745b..2bbc89233a 100644 --- a/bsp/imxrt/libraries/drivers/usb/host/usb_host_devices.c +++ b/bsp/imxrt/libraries/drivers/usb/host/usb_host_devices.c @@ -5,8 +5,7 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "fsl_os_abstraction.h" -#include +#include #include "usb_host.h" #include "usb_host_hci.h" #include "usb_host_devices.h" diff --git a/bsp/imxrt/libraries/drivers/usb/host/usb_host_ehci.c b/bsp/imxrt/libraries/drivers/usb/host/usb_host_ehci.c index ffabb047fa..58059e033d 100644 --- a/bsp/imxrt/libraries/drivers/usb/host/usb_host_ehci.c +++ b/bsp/imxrt/libraries/drivers/usb/host/usb_host_ehci.c @@ -6,7 +6,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "fsl_os_abstraction.h" #include #if ((defined USB_HOST_CONFIG_EHCI) && (USB_HOST_CONFIG_EHCI > 0U)) #include "usb_host.h" @@ -26,8 +25,6 @@ * Definitions ******************************************************************************/ -#define USB_OSA_WAIT_TIMEOUT RT_WAITING_FOREVER - #if defined(USB_STACK_USE_DEDICATED_RAM) && (USB_STACK_USE_DEDICATED_RAM > 0U) #error The SOC does not suppoort dedicated RAM case. @@ -159,13 +156,6 @@ static void USB_HostEhciZeroMem(uint32_t *buffer, uint32_t length); */ static void USB_HostEhciDelay(USBHS_Type *ehciIpBase, uint32_t ms); -/*! - * @brief host ehci start async schedule. - * - * @param ehciInstance ehci instance pointer. - */ -static void USB_HostEhciStartAsync(usb_host_ehci_instance_t *ehciInstance); - /*! * @brief host ehci stop async schedule. * @@ -173,13 +163,6 @@ static void USB_HostEhciStartAsync(usb_host_ehci_instance_t *ehciInstance); */ static void USB_HostEhciStopAsync(usb_host_ehci_instance_t *ehciInstance); -/*! - * @brief host ehci start periodic schedule. - * - * @param ehciInstance ehci instance pointer. - */ -static void USB_HostEhciStartPeriodic(usb_host_ehci_instance_t *ehciInstance); - /*! * @brief host ehci stop periodic schedule. * @@ -499,16 +482,6 @@ static usb_status_t USB_HostEhciCancelPipe(usb_host_ehci_instance_t *ehciInstanc usb_host_ehci_pipe_t *ehciPipePointer, usb_host_transfer_t *transfer); -/*! - * @brief control ehci bus. - * - * @param ehciInstance ehci instance pointer. - * @param bus_control control code. - * - * @return kStatus_USB_Success or error codes. - */ -static usb_status_t USB_HostEhciControlBus(usb_host_ehci_instance_t *ehciInstance, uint8_t busControl); - /*! * @brief ehci transaction done process function. * @@ -516,20 +489,7 @@ static usb_status_t USB_HostEhciControlBus(usb_host_ehci_instance_t *ehciInstanc */ void USB_HostEhciTransactionDone(usb_host_ehci_instance_t *ehciInstance); -/*! - * @brief ehci port change interrupt process function. - * - * @param ehciInstance ehci instance pointer. - */ -static void USB_HostEhciPortChange(usb_host_ehci_instance_t *ehciInstance); -/*! - * @brief ehci timer0 interrupt process function. - * cancel control/bulk transfer that time out. - * - * @param ehciInstance ehci instance pointer. - */ -static void USB_HostEhciTimer0(usb_host_ehci_instance_t *ehciInstance); #if ((defined(USB_HOST_CONFIG_LOW_POWER_MODE)) && (USB_HOST_CONFIG_LOW_POWER_MODE > 0U)) /*! @@ -1830,7 +1790,7 @@ static void USB_HostEhciDelay(USBHS_Type *ehciIpBase, uint32_t ms) } while ((distance & EHCI_MAX_UFRAME_VALUE) < (ms * 8U)); /* compute the distance between sofStart and SofEnd */ } -static void USB_HostEhciStartAsync(usb_host_ehci_instance_t *ehciInstance) +void USB_HostEhciStartAsync(usb_host_ehci_instance_t *ehciInstance) { uint32_t stateSync; @@ -1868,7 +1828,7 @@ static void USB_HostEhciStopAsync(usb_host_ehci_instance_t *ehciInstance) } } -static void USB_HostEhciStartPeriodic(usb_host_ehci_instance_t *ehciInstance) +void USB_HostEhciStartPeriodic(usb_host_ehci_instance_t *ehciInstance) { uint32_t stateSync; @@ -3515,7 +3475,7 @@ static usb_status_t USB_HostEhciCancelPipe(usb_host_ehci_instance_t *ehciInstanc return kStatus_USB_Success; } -static usb_status_t USB_HostEhciControlBus(usb_host_ehci_instance_t *ehciInstance, uint8_t busControl) +usb_status_t USB_HostEhciControlBus(usb_host_ehci_instance_t *ehciInstance, uint8_t busControl) { usb_status_t status = kStatus_USB_Success; uint32_t portScRegister; @@ -3863,7 +3823,7 @@ void USB_HostEhciTransactionDone(usb_host_ehci_instance_t *ehciInstance) } } -static void USB_HostEhciPortChange(usb_host_ehci_instance_t *ehciInstance) +void USB_HostEhciPortChange(usb_host_ehci_instance_t *ehciInstance) { /* note: only has one port */ uint32_t portScRegister = ehciInstance->ehciIpBase->PORTSC1; @@ -3964,7 +3924,7 @@ static void USB_HostEhciPortChange(usb_host_ehci_instance_t *ehciInstance) } } -static void USB_HostEhciTimer0(usb_host_ehci_instance_t *ehciInstance) +void USB_HostEhciTimer0(usb_host_ehci_instance_t *ehciInstance) { volatile usb_host_ehci_qh_t *vltQhPointer; usb_host_ehci_qtd_t *vltQtdPointer; diff --git a/bsp/imxrt/libraries/drivers/usb/host/usb_host_ehci.h b/bsp/imxrt/libraries/drivers/usb/host/usb_host_ehci.h index 5b47c31a41..5aea41c147 100644 --- a/bsp/imxrt/libraries/drivers/usb/host/usb_host_ehci.h +++ b/bsp/imxrt/libraries/drivers/usb/host/usb_host_ehci.h @@ -474,6 +474,45 @@ extern usb_status_t USB_HostEhciIoctl(usb_host_controller_handle controllerHandl uint32_t ioctlEvent, void *ioctlParam); +/*! + * @brief control ehci bus. + * + * @param ehciInstance ehci instance pointer. + * @param bus_control control code. + * + * @return kStatus_USB_Success or error codes. + */ +extern usb_status_t USB_HostEhciControlBus(usb_host_ehci_instance_t *ehciInstance, uint8_t busControl); + +/*! + * @brief ehci port change interrupt process function. + * + * @param ehciInstance ehci instance pointer. + */ +extern void USB_HostEhciPortChange(usb_host_ehci_instance_t *ehciInstance); + +/*! + * @brief ehci timer0 interrupt process function. + * cancel control/bulk transfer that time out. + * + * @param ehciInstance ehci instance pointer. + */ +extern void USB_HostEhciTimer0(usb_host_ehci_instance_t *ehciInstance); + +/*! + * @brief host ehci start async schedule. + * + * @param ehciInstance ehci instance pointer. + */ +extern void USB_HostEhciStartAsync(usb_host_ehci_instance_t *ehciInstance); + +/*! + * @brief host ehci start periodic schedule. + * + * @param ehciInstance ehci instance pointer. + */ +extern void USB_HostEhciStartPeriodic(usb_host_ehci_instance_t *ehciInstance); + /*! @}*/ #ifdef __cplusplus diff --git a/bsp/imxrt/libraries/drivers/usb/host/usb_host_framework.c b/bsp/imxrt/libraries/drivers/usb/host/usb_host_framework.c index 27d79a9d99..b45612289d 100644 --- a/bsp/imxrt/libraries/drivers/usb/host/usb_host_framework.c +++ b/bsp/imxrt/libraries/drivers/usb/host/usb_host_framework.c @@ -7,7 +7,6 @@ */ #include -#include #include "usb_host.h" #include "usb_host_hci.h" #include "usb_host_devices.h" diff --git a/bsp/imxrt/libraries/drivers/usb/host/usb_host_hci.c b/bsp/imxrt/libraries/drivers/usb/host/usb_host_hci.c index b7305dd89f..1409868b7b 100644 --- a/bsp/imxrt/libraries/drivers/usb/host/usb_host_hci.c +++ b/bsp/imxrt/libraries/drivers/usb/host/usb_host_hci.c @@ -7,7 +7,6 @@ */ #include -#include #include "fsl_common.h" #include "usb_host.h" #include "usb_host_hci.h" diff --git a/bsp/imxrt/libraries/drivers/usb/host/usb_host_hci.h b/bsp/imxrt/libraries/drivers/usb/host/usb_host_hci.h index 6139d647c4..c1450dde38 100644 --- a/bsp/imxrt/libraries/drivers/usb/host/usb_host_hci.h +++ b/bsp/imxrt/libraries/drivers/usb/host/usb_host_hci.h @@ -14,7 +14,7 @@ ******************************************************************************/ /*! @brief USB host lock */ -#define USB_HostLock() OSA_MutexLock(hostInstance->hostMutex, RT_WAITING_FOREVER) +#define USB_HostLock() OSA_MutexLock(hostInstance->hostMutex, USB_OSA_WAIT_TIMEOUT) /*! @brief USB host unlock */ #define USB_HostUnlock() OSA_MutexUnlock(hostInstance->hostMutex) diff --git a/bsp/imxrt/libraries/drivers/usb/include/usb.h b/bsp/imxrt/libraries/drivers/usb/include/usb.h index 256896b472..a219f10cec 100644 --- a/bsp/imxrt/libraries/drivers/usb/include/usb.h +++ b/bsp/imxrt/libraries/drivers/usb/include/usb.h @@ -34,6 +34,7 @@ #include #include #include +#include #include "usb_misc.h" #include "usb_spec.h" diff --git a/bsp/imxrt/libraries/drivers/usb/include/usb_host_config.h b/bsp/imxrt/libraries/drivers/usb/include/usb_host_config.h index aa00ce4a4f..8990136352 100644 --- a/bsp/imxrt/libraries/drivers/usb/include/usb_host_config.h +++ b/bsp/imxrt/libraries/drivers/usb/include/usb_host_config.h @@ -1,63 +1,40 @@ /* - * Copyright 2015-2016, Freescale Semiconductor, Inc. - * Copyright 2016-2021 NXP + * Copyright (c) 2015 - 2016, Freescale Semiconductor, Inc. + * Copyright 2016 - 2019 NXP * All rights reserved. * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * 3. Neither the name of copyright holder nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ -#ifndef __USB_HOST_CONFIG_H__ -#define __USB_HOST_CONFIG_H__ +#ifndef _USB_HOST_CONFIG_H_ +#define _USB_HOST_CONFIG_H_ /* Host Controller Enable */ /*! - * @brief host khci instance count, meantime it indicates khci enable or disabled. - * - if 0, host khci driver is disabled. - * - if greater than 0, host khci driver is enabled. + * @brief host khci instance count, meantime it indicates khci enable or disable. + * - if 0, host khci driver is disable. + * - if greater than 0, host khci driver is enable. */ #define USB_HOST_CONFIG_KHCI (0U) /*! - * @brief host ehci instance count, meantime it indicates ehci enable or disabled. - * - if 0, host ehci driver is disabled. - * - if greater than 0, host ehci driver is enabled. + * @brief host ehci instance count, meantime it indicates ehci enable or disable. + * - if 0, host ehci driver is disable. + * - if greater than 0, host ehci driver is enable. */ -#define USB_HOST_CONFIG_EHCI (1U) +#define USB_HOST_CONFIG_EHCI (2U) /*! - * @brief host ohci instance count, meantime it indicates ohci enable or disabled. - * - if 0, host ohci driver is disabled. - * - if greater than 0, host ohci driver is enabled. + * @brief host ohci instance count, meantime it indicates ohci enable or disable. + * - if 0, host ohci driver is disable. + * - if greater than 0, host ohci driver is enable. */ #define USB_HOST_CONFIG_OHCI (0U) /*! - * @brief host ip3516hs instance count, meantime it indicates ohci enable or disabled. - * - if 0, host ip3516hs driver is disabled. - * - if greater than 0, host ip3516hs driver is enabled. + * @brief host ip3516hs instance count, meantime it indicates ohci enable or disable. + * - if 0, host ip3516hs driver is disable. + * - if greater than 0, host ip3516hs driver is enable. */ #define USB_HOST_CONFIG_IP3516HS (0U) @@ -70,26 +47,17 @@ #define USB_HOST_CONFIG_MAX_HOST \ (USB_HOST_CONFIG_KHCI + USB_HOST_CONFIG_EHCI + USB_HOST_CONFIG_OHCI + USB_HOST_CONFIG_IP3516HS) -/*! - * @brief hub pipe max count. - * pipe is the host driver resource for device endpoint, one endpoint needs one pipe. - * @remarks A HUB usually uses two pipes. - */ -#define USB_HOST_CONFIG_HUB_MAX_PIPES (2U) - /*! * @brief host pipe max count. - * pipe is the host driver resource for device endpoint, one endpoint needs one pipe. - * @remarks Depends on the total number of device interfaces and HUB usage. + * pipe is the host driver resource for device endpoint, one endpoint need one pipe. */ -#define USB_HOST_CONFIG_MAX_PIPES (USB_HOST_CONFIG_HUB_MAX_PIPES + 2U * USB_HOST_CONFIG_INTERFACE_MAX_EP) +#define USB_HOST_CONFIG_MAX_PIPES (16U) /*! * @brief host transfer max count. - * transfer is the host driver resource for data transmission mission, one transmission mission needs one transfer. - * @remarks Depends on the total number of device interfaces. + * transfer is the host driver resource for data transmission mission, one transmission mission need one transfer. */ -#define USB_HOST_CONFIG_MAX_TRANSFERS (USB_HOST_CONFIG_MAX_PIPES) +#define USB_HOST_CONFIG_MAX_TRANSFERS (16U) /*! * @brief the max endpoint for one interface. @@ -106,7 +74,6 @@ /*! * @brief the max power for one device. * the max power the host can provide for one device. - * Expressed in 2 mA units (i.e. 250 = 500 mA). */ #define USB_HOST_CONFIG_MAX_POWER (250U) @@ -135,7 +102,7 @@ /*! @brief if 1, enable usb compliance test codes; if 0, disable usb compliance test codes. */ #define USB_HOST_CONFIG_COMPLIANCE_TEST (0U) -/*! @brief if 1, class driver clear stall automatically; if 0, class driver doesn't clear stall. */ +/*! @brief if 1, class driver clear stall automatically; if 0, class driver don't clear stall. */ #define USB_HOST_CONFIG_CLASS_AUTO_CLEAR_STALL (0U) /* KHCI configuration */ @@ -159,25 +126,23 @@ /*! * @brief ehci QH max count. - * @remarks Depends on the total number of device interfaces. */ -#define USB_HOST_CONFIG_EHCI_MAX_QH (USB_HOST_CONFIG_MAX_PIPES) +#define USB_HOST_CONFIG_EHCI_MAX_QH (8U) /*! * @brief ehci QTD max count. */ -#define USB_HOST_CONFIG_EHCI_MAX_QTD (USB_HOST_CONFIG_EHCI_MAX_QH) +#define USB_HOST_CONFIG_EHCI_MAX_QTD (8U) /*! * @brief ehci ITD max count. */ -#define USB_HOST_CONFIG_EHCI_MAX_ITD (USB_HOST_CONFIG_EHCI_MAX_SITD) +#define USB_HOST_CONFIG_EHCI_MAX_ITD (0U) /*! * @brief ehci SITD max count. - * @remarks Depends on the total number of device interfaces that can have isochronous endpoints. */ -#define USB_HOST_CONFIG_EHCI_MAX_SITD (2U * USB_HOST_CONFIG_INTERFACE_MAX_EP) +#define USB_HOST_CONFIG_EHCI_MAX_SITD (0U) #endif @@ -186,31 +151,25 @@ /*! * @brief ohci ED max count. - * @remarks Depends on the total number of device interfaces. */ -#define USB_HOST_CONFIG_OHCI_MAX_ED (USB_HOST_CONFIG_MAX_PIPES) +#define USB_HOST_CONFIG_OHCI_MAX_ED (8U) /*! * @brief ohci GTD max count. */ -#define USB_HOST_CONFIG_OHCI_MAX_GTD (USB_HOST_CONFIG_OHCI_MAX_ED) +#define USB_HOST_CONFIG_OHCI_MAX_GTD (8U) /*! * @brief ohci ITD max count. - * @remarks Depends on the total number of device interfaces that can have isochronous endpoints. */ -#define USB_HOST_CONFIG_OHCI_MAX_ITD (2U * USB_HOST_CONFIG_INTERFACE_MAX_EP) +#define USB_HOST_CONFIG_OHCI_MAX_ITD (8U) #endif /* OHCI configuration */ #if ((defined USB_HOST_CONFIG_IP3516HS) && (USB_HOST_CONFIG_IP3516HS)) -/*! - * @brief ohci PIPE max count. - * @remarks Depends on the total number of device interfaces. - */ -#define USB_HOST_CONFIG_IP3516HS_MAX_PIPE (USB_HOST_CONFIG_MAX_PIPES) +#define USB_HOST_CONFIG_IP3516HS_MAX_PIPE (32U) /*! * @brief ohci ED max count. @@ -220,63 +179,69 @@ /*! * @brief ohci GTD max count. */ -#define USB_HOST_CONFIG_IP3516HS_MAX_INT (USB_HOST_CONFIG_IP3516HS_MAX_ATL) +#define USB_HOST_CONFIG_IP3516HS_MAX_INT (32U) /*! * @brief ohci ITD max count. - * @remarks Depends on the existence of device interfaces that can have isochronous endpoints. */ -#define USB_HOST_CONFIG_IP3516HS_MAX_ISO (USB_HOST_CONFIG_IP3516HS_MAX_ATL) +#define USB_HOST_CONFIG_IP3516HS_MAX_ISO (0U) #endif /*! - * @brief host HUB class instance count, meantime it indicates HUB class enable or disabled. - * - if 0, host HUB class driver is disabled. - * - if greater than 0, host HUB class driver is enabled. + * @brief host HUB class instance count, meantime it indicates HUB class enable or disable. + * - if 0, host HUB class driver is disable. + * - if greater than 0, host HUB class driver is enable. */ #define USB_HOST_CONFIG_HUB (0U) /*! - * @brief host HID class instance count, meantime it indicates HID class enable or disabled. - * - if 0, host HID class driver is disabled. - * - if greater than 0, host HID class driver is enabled. + * @brief host HID class instance count, meantime it indicates HID class enable or disable. + * - if 0, host HID class driver is disable. + * - if greater than 0, host HID class driver is enable. */ #define USB_HOST_CONFIG_HID (0U) /*! - * @brief host MSD class instance count, meantime it indicates MSD class enable or disabled. - * - if 0, host MSD class driver is disabled. - * - if greater than 0, host MSD class driver is enabled. + * @brief host MSD class instance count, meantime it indicates MSD class enable or disable. + * - if 0, host MSD class driver is disable. + * - if greater than 0, host MSD class driver is enable. */ #define USB_HOST_CONFIG_MSD (0U) /*! - * @brief host CDC class instance count, meantime it indicates CDC class enable or disabled. - * - if 0, host CDC class driver is disabled. - * - if greater than 0, host CDC class driver is enabled. + * @brief host CDC class instance count, meantime it indicates CDC class enable or disable. + * - if 0, host CDC class driver is disable. + * - if greater than 0, host CDC class driver is enable. */ -#define USB_HOST_CONFIG_CDC (1U) +#define USB_HOST_CONFIG_CDC (0U) /*! - * @brief host AUDIO class instance count, meantime it indicates AUDIO class enable or disabled. - * - if 0, host AUDIO class driver is disabled. - * - if greater than 0, host AUDIO class driver is enabled. + * @brief host AUDIO class instance count, meantime it indicates AUDIO class enable or disable. + * - if 0, host AUDIO class driver is disable. + * - if greater than 0, host AUDIO class driver is enable. */ #define USB_HOST_CONFIG_AUDIO (0U) /*! - * @brief host PHDC class instance count, meantime it indicates PHDC class enable or disabled. - * - if 0, host PHDC class driver is disabled. - * - if greater than 0, host PHDC class driver is enabled. + * @brief host PHDC class instance count, meantime it indicates PHDC class enable or disable. + * - if 0, host PHDC class driver is disable. + * - if greater than 0, host PHDC class driver is enable. */ #define USB_HOST_CONFIG_PHDC (0U) /*! - * @brief host printer class instance count, meantime it indicates printer class enable or disabled. - * - if 0, host printer class driver is disabled. - * - if greater than 0, host printer class driver is enabled. + * @brief host printer class instance count, meantime it indicates printer class enable or disable. + * - if 0, host printer class driver is disable. + * - if greater than 0, host printer class driver is enable. */ #define USB_HOST_CONFIG_PRINTER (0U) -#endif /* __USB_HOST_CONFIG_H__ */ +/*! + * @brief host charger detect enable or disable. It is only supported on RT600 currently. + * - if 0, host charger detect is disable. + * - if greater than 0, host charger detect is enable. + */ +#define USB_HOST_CONFIG_BATTERY_CHARGER (0U) + +#endif /* _USB_HOST_CONFIG_H_ */ diff --git a/bsp/imxrt/libraries/drivers/usb/include/usb_misc.h b/bsp/imxrt/libraries/drivers/usb/include/usb_misc.h index 4e65cfa94b..df12d6cd1d 100644 --- a/bsp/imxrt/libraries/drivers/usb/include/usb_misc.h +++ b/bsp/imxrt/libraries/drivers/usb/include/usb_misc.h @@ -1,46 +1,34 @@ /* * Copyright (c) 2015 - 2016, Freescale Semiconductor, Inc. - * Copyright 2016 NXP + * Copyright 2016, 2019 NXP + * All rights reserved. * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * o Redistributions of source code must retain the above copyright notice, this list - * of conditions and the following disclaimer. - * - * o Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * o Neither the name of the copyright holder nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: BSD-3-Clause */ #ifndef __USB_MISC_H__ #define __USB_MISC_H__ -#ifndef ENDIANNESS - -#error ENDIANNESS should be defined, and then rebulid the project. - -#endif - /******************************************************************************* * Definitions ******************************************************************************/ +/*! @brief Define big endian */ +#define USB_BIG_ENDIAN (0U) +/*! @brief Define little endian */ +#define USB_LITTLE_ENDIAN (1U) + +/*! @brief Define current endian */ +#ifndef ENDIANNESS +#define ENDIANNESS USB_LITTLE_ENDIAN +#endif +/*! @brief Define default timeout value */ +#if (defined(USE_RTOS) && (USE_RTOS > 0)) +#define USB_OSA_WAIT_TIMEOUT (osaWaitForever_c) +#else +#define USB_OSA_WAIT_TIMEOUT (0U) +#endif /* (defined(USE_RTOS) && (USE_RTOS > 0)) */ + /*! @brief Define USB printf */ #if defined(__cplusplus) extern "C" { @@ -52,10 +40,14 @@ extern int DbgConsole_Printf(const char *fmt_s, ...); } #endif /* __cplusplus */ +#ifndef __DSC__ #if defined(SDK_DEBUGCONSOLE) && (SDK_DEBUGCONSOLE < 1) #define usb_echo printf #else -#define usb_echo DbgConsole_Printf +#define usb_echo rt_kprintf +#endif +#else +#define usb_echo #endif #if defined(__ICCARM__) @@ -78,7 +70,7 @@ extern int DbgConsole_Printf(const char *fmt_s, ...); #define STRUCT_UNPACKED __attribute__((__packed__)) #endif -#elif defined(__CC_ARM) +#elif defined(__CC_ARM) || (defined(__ARMCC_VERSION)) #ifndef STRUCT_PACKED #define STRUCT_PACKED _Pragma("pack(1U)") @@ -112,7 +104,7 @@ extern int DbgConsole_Printf(const char *fmt_s, ...); #define USB_ASSIGN_VALUE_ADDRESS_LONG_BY_BYTE(n, m) \ { \ - *((uint8_t *)&(n)) = *((uint8_t *)&(m)); \ + *((uint8_t *)&(n)) = *((uint8_t *)&(m)); \ *((uint8_t *)&(n) + 1) = *((uint8_t *)&(m) + 1); \ *((uint8_t *)&(n) + 2) = *((uint8_t *)&(m) + 2); \ *((uint8_t *)&(n) + 3) = *((uint8_t *)&(m) + 3); \ @@ -120,13 +112,13 @@ extern int DbgConsole_Printf(const char *fmt_s, ...); #define USB_ASSIGN_VALUE_ADDRESS_SHORT_BY_BYTE(n, m) \ { \ - *((uint8_t *)&(n)) = *((uint8_t *)&(m)); \ + *((uint8_t *)&(n)) = *((uint8_t *)&(m)); \ *((uint8_t *)&(n) + 1) = *((uint8_t *)&(m) + 1); \ } #define USB_ASSIGN_MACRO_VALUE_ADDRESS_LONG_BY_BYTE(n, m) \ { \ - *((uint8_t *)&(n)) = (uint8_t)m; \ + *((uint8_t *)&(n)) = (uint8_t)m; \ *((uint8_t *)&(n) + 1) = (uint8_t)(m >> 8); \ *((uint8_t *)&(n) + 2) = (uint8_t)(m >> 16); \ *((uint8_t *)&(n) + 3) = (uint8_t)(m >> 24); \ @@ -134,7 +126,7 @@ extern int DbgConsole_Printf(const char *fmt_s, ...); #define USB_ASSIGN_MACRO_VALUE_ADDRESS_SHORT_BY_BYTE(n, m) \ { \ - *((uint8_t *)&(n)) = (uint8_t)m; \ + *((uint8_t *)&(n)) = (uint8_t)m; \ *((uint8_t *)&(n) + 1) = (uint8_t)(m >> 8); \ } @@ -150,65 +142,66 @@ extern int DbgConsole_Printf(const char *fmt_s, ...); #define USB_SHORT_FROM_BIG_ENDIAN(n) (n) #define USB_LONG_FROM_BIG_ENDIAN(n) (n) -#define USB_LONG_TO_LITTLE_ENDIAN_ADDRESS(n, m) \ - { \ - m[3] = ((n >> 24U) & 0xFFU); \ - m[2] = ((n >> 16U) & 0xFFU); \ - m[1] = ((n >> 8U) & 0xFFU); \ - m[0] = (n & 0xFFU); \ +#define USB_LONG_TO_LITTLE_ENDIAN_ADDRESS(n, m) \ + { \ + m[3] = (uint8_t)((((uint32_t)(n)) >> 24U) & 0xFFU); \ + m[2] = (uint8_t)((((uint32_t)(n)) >> 16U) & 0xFFU); \ + m[1] = (uint8_t)((((uint32_t)(n)) >> 8U) & 0xFFU); \ + m[0] = (uint8_t)(((uint32_t)(n)) & 0xFFU); \ } -#define USB_LONG_FROM_LITTLE_ENDIAN_ADDRESS(n) \ - ((uint32_t)((((uint8_t)n[3]) << 24U) | (((uint8_t)n[2]) << 16U) | (((uint8_t)n[1]) << 8U) | \ - (((uint8_t)n[0]) << 0U))) +#define USB_LONG_FROM_LITTLE_ENDIAN_ADDRESS(n) \ + ((uint32_t)((((uint32_t)n[3]) << 24U) | (((uint32_t)n[2]) << 16U) | (((uint32_t)n[1]) << 8U) | \ + (((uint32_t)n[0]) << 0U))) -#define USB_LONG_TO_BIG_ENDIAN_ADDRESS(n, m) \ - { \ - m[0] = ((n >> 24U) & 0xFFU); \ - m[1] = ((n >> 16U) & 0xFFU); \ - m[2] = ((n >> 8U) & 0xFFU); \ - m[3] = (n & 0xFFU); \ +#define USB_LONG_TO_BIG_ENDIAN_ADDRESS(n, m) \ + { \ + m[0] = ((((uint32_t)(n)) >> 24U) & 0xFFU); \ + m[1] = ((((uint32_t)(n)) >> 16U) & 0xFFU); \ + m[2] = ((((uint32_t)(n)) >> 8U) & 0xFFU); \ + m[3] = (((uint32_t)(n)) & 0xFFU); \ } -#define USB_LONG_FROM_BIG_ENDIAN_ADDRESS(n) \ - ((uint32_t)((((uint8_t)n[0]) << 24U) | (((uint8_t)n[1]) << 16U) | (((uint8_t)n[2]) << 8U) | \ - (((uint8_t)n[3]) << 0U))) +#define USB_LONG_FROM_BIG_ENDIAN_ADDRESS(n) \ + ((uint32_t)((((uint32_t)n[0]) << 24U) | (((uint32_t)n[1]) << 16U) | (((uint32_t)n[2]) << 8U) | \ + (((uint32_t)n[3]) << 0U))) -#define USB_SHORT_TO_LITTLE_ENDIAN_ADDRESS(n, m) \ - { \ - m[1] = ((n >> 8U) & 0xFFU); \ - m[0] = (n & 0xFFU); \ +#define USB_SHORT_TO_LITTLE_ENDIAN_ADDRESS(n, m) \ + { \ + m[1] = ((((uint16_t)(n)) >> 8U) & 0xFFU); \ + m[0] = (((uint16_t)(n)) & 0xFFU); \ } -#define USB_SHORT_FROM_LITTLE_ENDIAN_ADDRESS(n) ((uint32_t)((((uint8_t)n[1]) << 8U) | (((uint8_t)n[0]) << 0U))) +#define USB_SHORT_FROM_LITTLE_ENDIAN_ADDRESS(n) ((uint16_t)((((uint16_t)n[1]) << 8U) | (((uint16_t)n[0]) << 0U))) -#define USB_SHORT_TO_BIG_ENDIAN_ADDRESS(n, m) \ - { \ - m[0] = ((n >> 8U) & 0xFFU); \ - m[1] = (n & 0xFFU); \ +#define USB_SHORT_TO_BIG_ENDIAN_ADDRESS(n, m) \ + { \ + m[0] = ((((uint16_t)(n)) >> 8U) & 0xFFU); \ + m[1] = (((uint16_t)(n)) & 0xFFU); \ } -#define USB_SHORT_FROM_BIG_ENDIAN_ADDRESS(n) ((uint32_t)((((uint8_t)n[0]) << 8U) | (((uint8_t)n[1]) << 0U))) +#define USB_SHORT_FROM_BIG_ENDIAN_ADDRESS(n) ((uint16_t)((((uint16_t)n[0]) << 8U) | (((uint16_t)n[1]) << 0U))) -#define USB_LONG_TO_LITTLE_ENDIAN_DATA(n, m) \ - { \ - *((uint8_t *)&(m) + 3) = ((n >> 24U) & 0xFFU); \ - *((uint8_t *)&(m) + 2) = ((n >> 16U) & 0xFFU); \ - *((uint8_t *)&(m) + 1) = ((n >> 8U) & 0xFFU); \ - *((uint8_t *)&(m) + 0) = (n & 0xFFU); \ +#define USB_LONG_TO_LITTLE_ENDIAN_DATA(n, m) \ + { \ + *((uint8_t *)&(m) + 3) = ((((uint32_t)(n)) >> 24U) & 0xFFU); \ + *((uint8_t *)&(m) + 2) = ((((uint32_t)(n)) >> 16U) & 0xFFU); \ + *((uint8_t *)&(m) + 1) = ((((uint32_t)(n)) >> 8U) & 0xFFU); \ + *((uint8_t *)&(m) + 0) = (((uint32_t)(n)) & 0xFFU); \ } -#define USB_LONG_FROM_LITTLE_ENDIAN_DATA(n) \ - ((uint32_t)(((*((uint8_t *)&(n) + 3)) << 24U) | ((*((uint8_t *)&(n) + 2)) << 16U) | \ - ((*((uint8_t *)&(n) + 1)) << 8U) | ((*((uint8_t *)&(n))) << 0U))) +#define USB_LONG_FROM_LITTLE_ENDIAN_DATA(n) \ + ((uint32_t)(((uint32_t)(*((uint8_t *)&(n) + 3)) << 24U) | ((uint32_t)(*((uint8_t *)&(n) + 2)) << 16U) | \ + ((uint32_t)(*((uint8_t *)&(n) + 1)) << 8U) | ((uint32_t)(*((uint8_t *)&(n))) << 0U))) -#define USB_SHORT_TO_LITTLE_ENDIAN_DATA(n, m) \ - { \ - *((uint8_t *)&(m) + 1) = ((n >> 8U) & 0xFFU); \ - *((uint8_t *)&(m)) = ((n)&0xFFU); \ +#define USB_SHORT_TO_LITTLE_ENDIAN_DATA(n, m) \ + { \ + *((uint8_t *)&(m) + 1) = ((((uint16_t)(n)) >> 8U) & 0xFFU); \ + *((uint8_t *)&(m)) = ((((uint16_t)(n))) & 0xFFU); \ } -#define USB_SHORT_FROM_LITTLE_ENDIAN_DATA(n) ((uint32_t)(((*((uint8_t *)&(n) + 1)) << 8U) | ((*((uint8_t *)&(n)))))) +#define USB_SHORT_FROM_LITTLE_ENDIAN_DATA(n) \ + ((uint16_t)((uint16_t)(*((uint8_t *)&(n) + 1)) << 8U) | ((uint16_t)(*((uint8_t *)&(n))))) #else @@ -222,75 +215,76 @@ extern int DbgConsole_Printf(const char *fmt_s, ...); #define USB_SHORT_FROM_BIG_ENDIAN(n) SWAP2BYTE_CONST(n) #define USB_LONG_FROM_BIG_ENDIAN(n) SWAP4BYTE_CONST(n) -#define USB_LONG_TO_LITTLE_ENDIAN_ADDRESS(n, m) \ - { \ - m[3] = ((n >> 24U) & 0xFFU); \ - m[2] = ((n >> 16U) & 0xFFU); \ - m[1] = ((n >> 8U) & 0xFFU); \ - m[0] = (n & 0xFFU); \ +#define USB_LONG_TO_LITTLE_ENDIAN_ADDRESS(n, m) \ + { \ + m[3] = (uint8_t)((((uint32_t)(n)) >> 24U) & 0xFFU); \ + m[2] = (uint8_t)((((uint32_t)(n)) >> 16U) & 0xFFU); \ + m[1] = (uint8_t)((((uint32_t)(n)) >> 8U) & 0xFFU); \ + m[0] = (uint8_t)(((uint32_t)(n)) & 0xFFU); \ } -#define USB_LONG_FROM_LITTLE_ENDIAN_ADDRESS(n) \ - ((uint32_t)((((uint8_t)n[3]) << 24U) | (((uint8_t)n[2]) << 16U) | (((uint8_t)n[1]) << 8U) | \ - (((uint8_t)n[0]) << 0U))) +#define USB_LONG_FROM_LITTLE_ENDIAN_ADDRESS(n) \ + ((uint32_t)((((uint32_t)n[3]) << 24U) | (((uint32_t)n[2]) << 16U) | (((uint32_t)n[1]) << 8U) | \ + (((uint32_t)n[0]) << 0U))) -#define USB_LONG_TO_BIG_ENDIAN_ADDRESS(n, m) \ - { \ - m[0] = ((n >> 24U) & 0xFFU); \ - m[1] = ((n >> 16U) & 0xFFU); \ - m[2] = ((n >> 8U) & 0xFFU); \ - m[3] = (n & 0xFFU); \ +#define USB_LONG_TO_BIG_ENDIAN_ADDRESS(n, m) \ + { \ + m[0] = ((((uint32_t)(n)) >> 24U) & 0xFFU); \ + m[1] = ((((uint32_t)(n)) >> 16U) & 0xFFU); \ + m[2] = ((((uint32_t)(n)) >> 8U) & 0xFFU); \ + m[3] = (((uint32_t)(n)) & 0xFFU); \ } -#define USB_LONG_FROM_BIG_ENDIAN_ADDRESS(n) \ - ((uint32_t)((((uint8_t)n[0]) << 24U) | (((uint8_t)n[1]) << 16U) | (((uint8_t)n[2]) << 8U) | \ - (((uint8_t)n[3]) << 0U))) +#define USB_LONG_FROM_BIG_ENDIAN_ADDRESS(n) \ + ((uint32_t)((((uint32_t)n[0]) << 24U) | (((uint32_t)n[1]) << 16U) | (((uint32_t)n[2]) << 8U) | \ + (((uint32_t)n[3]) << 0U))) -#define USB_SHORT_TO_LITTLE_ENDIAN_ADDRESS(n, m) \ - { \ - m[1] = ((n >> 8U) & 0xFFU); \ - m[0] = (n & 0xFFU); \ +#define USB_SHORT_TO_LITTLE_ENDIAN_ADDRESS(n, m) \ + { \ + m[1] = ((((uint16_t)(n)) >> 8U) & 0xFFU); \ + m[0] = (((uint16_t)(n)) & 0xFFU); \ } -#define USB_SHORT_FROM_LITTLE_ENDIAN_ADDRESS(n) ((uint32_t)((((uint8_t)n[1]) << 8U) | (((uint8_t)n[0]) << 0U))) +#define USB_SHORT_FROM_LITTLE_ENDIAN_ADDRESS(n) ((uint16_t)((((uint16_t)n[1]) << 8U) | (((uint16_t)n[0]) << 0U))) -#define USB_SHORT_TO_BIG_ENDIAN_ADDRESS(n, m) \ - { \ - m[0] = ((n >> 8U) & 0xFFU); \ - m[1] = (n & 0xFFU); \ +#define USB_SHORT_TO_BIG_ENDIAN_ADDRESS(n, m) \ + { \ + m[0] = ((((uint16_t)(n)) >> 8U) & 0xFFU); \ + m[1] = (((uint16_t)(n)) & 0xFFU); \ } -#define USB_SHORT_FROM_BIG_ENDIAN_ADDRESS(n) ((uint32_t)((((uint8_t)n[0]) << 8U) | (((uint8_t)n[1]) << 0U))) +#define USB_SHORT_FROM_BIG_ENDIAN_ADDRESS(n) ((uint16_t)((((uint16_t)n[0]) << 8U) | (((uint16_t)n[1]) << 0U))) -#define USB_LONG_TO_LITTLE_ENDIAN_DATA(n, m) \ - { \ - *((uint8_t *)&(m) + 3) = ((n >> 24U) & 0xFFU); \ - *((uint8_t *)&(m) + 2) = ((n >> 16U) & 0xFFU); \ - *((uint8_t *)&(m) + 1) = ((n >> 8U) & 0xFFU); \ - *((uint8_t *)&(m) + 0) = (n & 0xFFU); \ +#define USB_LONG_TO_LITTLE_ENDIAN_DATA(n, m) \ + { \ + *((uint8_t *)&(m) + 3) = ((((uint32_t)(n)) >> 24U) & 0xFFU); \ + *((uint8_t *)&(m) + 2) = ((((uint32_t)(n)) >> 16U) & 0xFFU); \ + *((uint8_t *)&(m) + 1) = ((((uint32_t)(n)) >> 8U) & 0xFFU); \ + *((uint8_t *)&(m) + 0) = (((uint32_t)(n)) & 0xFFU); \ } -#define USB_LONG_FROM_LITTLE_ENDIAN_DATA(n) \ - ((uint32_t)(((*((uint8_t *)&(n) + 3)) << 24U) | ((*((uint8_t *)&(n) + 2)) << 16U) | \ - ((*((uint8_t *)&(n) + 1)) << 8U) | ((*((uint8_t *)&(n))) << 0U))) +#define USB_LONG_FROM_LITTLE_ENDIAN_DATA(n) \ + ((uint32_t)(((uint32_t)(*((uint8_t *)&(n) + 3)) << 24U) | ((uint32_t)(*((uint8_t *)&(n) + 2)) << 16U) | \ + ((uint32_t)(*((uint8_t *)&(n) + 1)) << 8U) | ((uint32_t)(*((uint8_t *)&(n))) << 0U))) -#define USB_SHORT_TO_LITTLE_ENDIAN_DATA(n, m) \ - { \ - *((uint8_t *)&(m) + 1) = ((n >> 8U) & 0xFFU); \ - *((uint8_t *)&(m)) = ((n)&0xFFU); \ +#define USB_SHORT_TO_LITTLE_ENDIAN_DATA(n, m) \ + { \ + *((uint8_t *)&(m) + 1) = ((((uint16_t)(n)) >> 8U) & 0xFFU); \ + *((uint8_t *)&(m)) = ((((uint16_t)(n))) & 0xFFU); \ } -#define USB_SHORT_FROM_LITTLE_ENDIAN_DATA(n) ((uint32_t)(((*((uint8_t *)&(n) + 1)) << 8U) | ((*((uint8_t *)&(n)))))) +#define USB_SHORT_FROM_LITTLE_ENDIAN_DATA(n) \ + ((uint16_t)(((uint16_t)(*(((uint8_t *)&(n)) + 1)) << 8U) | ((uint16_t)(*((uint8_t *)&(n)))))) #endif /* * The following MACROs (USB_GLOBAL, USB_BDT, USB_RAM_ADDRESS_ALIGNMENT, etc) are only used for USB device stack. - * The USB device global variables are put into the section m_usb_global and m_usb_bdt or the section - * .bss.m_usb_global and .bss.m_usb_bdt by using the MACRO USB_GLOBAL and USB_BDT. In this way, the USB device + * The USB device global variables are put into the section m_usb_global and m_usb_bdt + * by using the MACRO USB_GLOBAL and USB_BDT. In this way, the USB device * global variables can be linked into USB dedicated RAM by USB_STACK_USE_DEDICATED_RAM. * The MACRO USB_STACK_USE_DEDICATED_RAM is used to decide the USB stack uses dedicated RAM or not. The value of - * the marco can be set as 0, USB_STACK_DEDICATED_RAM_TYPE_BDT_GLOBAL, or USB_STACK_DEDICATED_RAM_TYPE_BDT. + * the macro can be set as 0, USB_STACK_DEDICATED_RAM_TYPE_BDT_GLOBAL, or USB_STACK_DEDICATED_RAM_TYPE_BDT. * The MACRO USB_STACK_DEDICATED_RAM_TYPE_BDT_GLOBAL means USB device global variables, including USB_BDT and * USB_GLOBAL, are put into the USB dedicated RAM. This feature can only be enabled when the USB dedicated RAM * is not less than 2K Bytes. @@ -313,40 +307,63 @@ _Pragma("diag_suppress=Pm120") #define USB_RAM_ADDRESS_ALIGNMENT(n) USB_ALIGN_PRAGMA(data_alignment = n) _Pragma("diag_suppress=Pm120") #define USB_LINK_SECTION_PART(str) _Pragma(#str) -#define USB_LINK_SECTION_SUB(sec) USB_LINK_SECTION_PART(location = #sec) +#define USB_LINK_DMA_INIT_DATA(sec) USB_LINK_SECTION_PART(location = #sec) #define USB_LINK_USB_GLOBAL _Pragma("location = \"m_usb_global\"") #define USB_LINK_USB_BDT _Pragma("location = \"m_usb_bdt\"") -#define USB_LINK_USB_GLOBAL_BSS _Pragma("location = \".bss.m_usb_global\"") -#define USB_LINK_USB_BDT_BSS _Pragma("location = \".bss.m_usb_bdt\"") +#define USB_LINK_USB_GLOBAL_BSS +#define USB_LINK_USB_BDT_BSS _Pragma("diag_default=Pm120") #define USB_LINK_DMA_NONINIT_DATA _Pragma("location = \"m_usb_dma_noninit_data\"") #define USB_LINK_NONCACHE_NONINIT_DATA _Pragma("location = \"NonCacheable\"") -#elif defined(__CC_ARM) +#elif defined(__CC_ARM) || (defined(__ARMCC_VERSION)) #define USB_WEAK_VAR __attribute__((weak)) -#define USB_WEAK_FUN __weak +#define USB_WEAK_FUN __attribute__((weak)) #define USB_RAM_ADDRESS_ALIGNMENT(n) __attribute__((aligned(n))) -#define USB_LINK_SECTION_SUB(sec) __attribute__((section(#sec))) +#define USB_LINK_DMA_INIT_DATA(sec) __attribute__((section(#sec))) +#if defined(__CC_ARM) #define USB_LINK_USB_GLOBAL __attribute__((section("m_usb_global"))) __attribute__((zero_init)) +#else +#define USB_LINK_USB_GLOBAL __attribute__((section(".bss.m_usb_global"))) +#endif +#if defined(__CC_ARM) #define USB_LINK_USB_BDT __attribute__((section("m_usb_bdt"))) __attribute__((zero_init)) -#define USB_LINK_USB_GLOBAL_BSS __attribute__((section(".bss.m_usb_global"))) __attribute__((zero_init)) -#define USB_LINK_USB_BDT_BSS __attribute__((section(".bss.m_usb_bdt"))) __attribute__((zero_init)) +#else +#define USB_LINK_USB_BDT __attribute__((section(".bss.m_usb_bdt"))) +#endif +#define USB_LINK_USB_GLOBAL_BSS +#define USB_LINK_USB_BDT_BSS +#if defined(__CC_ARM) #define USB_LINK_DMA_NONINIT_DATA __attribute__((section("m_usb_dma_noninit_data"))) __attribute__((zero_init)) +#else +#define USB_LINK_DMA_NONINIT_DATA __attribute__((section(".bss.m_usb_dma_noninit_data"))) +#endif +#if defined(__CC_ARM) #define USB_LINK_NONCACHE_NONINIT_DATA __attribute__((section("NonCacheable"))) __attribute__((zero_init)) +#else +#define USB_LINK_NONCACHE_NONINIT_DATA __attribute__((section(".bss.NonCacheable"))) +#endif #elif defined(__GNUC__) #define USB_WEAK_VAR __attribute__((weak)) #define USB_WEAK_FUN __attribute__((weak)) #define USB_RAM_ADDRESS_ALIGNMENT(n) __attribute__((aligned(n))) -#define USB_LINK_SECTION_SUB(sec) __attribute__((section(#sec))) +#define USB_LINK_DMA_INIT_DATA(sec) __attribute__((section(#sec))) #define USB_LINK_USB_GLOBAL __attribute__((section("m_usb_global, \"aw\", %nobits @"))) #define USB_LINK_USB_BDT __attribute__((section("m_usb_bdt, \"aw\", %nobits @"))) -#define USB_LINK_USB_GLOBAL_BSS __attribute__((section(".bss.m_usb_global, \"aw\", %nobits @"))) -#define USB_LINK_USB_BDT_BSS __attribute__((section(".bss.m_usb_bdt, \"aw\", %nobits @"))) +#define USB_LINK_USB_GLOBAL_BSS +#define USB_LINK_USB_BDT_BSS #define USB_LINK_DMA_NONINIT_DATA __attribute__((section("m_usb_dma_noninit_data, \"aw\", %nobits @"))) #define USB_LINK_NONCACHE_NONINIT_DATA __attribute__((section("NonCacheable, \"aw\", %nobits @"))) +#elif (defined(__DSC__) && defined(__CW__)) +#define MAX(a, b) (((a) > (b)) ? (a) : (b)) +#define USB_WEAK_VAR __attribute__((weak)) +#define USB_WEAK_FUN __attribute__((weak)) +#define USB_RAM_ADDRESS_ALIGNMENT(n) __attribute__((aligned(n))) +#define USB_LINK_USB_BDT_BSS +#define USB_LINK_USB_GLOBAL_BSS #else #error The tool-chain is not supported. #endif @@ -356,28 +373,32 @@ _Pragma("diag_suppress=Pm120") #if ((defined(FSL_FEATURE_L2CACHE_LINESIZE_BYTE)) && (defined(FSL_FEATURE_L1DCACHE_LINESIZE_BYTE))) #define USB_CACHE_LINESIZE MAX(FSL_FEATURE_L2CACHE_LINESIZE_BYTE, FSL_FEATURE_L1DCACHE_LINESIZE_BYTE) -#elif(defined(FSL_FEATURE_L2CACHE_LINESIZE_BYTE)) +#elif (defined(FSL_FEATURE_L2CACHE_LINESIZE_BYTE)) #define USB_CACHE_LINESIZE MAX(FSL_FEATURE_L2CACHE_LINESIZE_BYTE, 0) -#elif(defined(FSL_FEATURE_L1DCACHE_LINESIZE_BYTE)) +#elif (defined(FSL_FEATURE_L1DCACHE_LINESIZE_BYTE)) #define USB_CACHE_LINESIZE MAX(0, FSL_FEATURE_L1DCACHE_LINESIZE_BYTE) #else -#define USB_CACHE_LINESIZE 4 +#define USB_CACHE_LINESIZE 4U #endif #else -#define USB_CACHE_LINESIZE 4 +#define USB_CACHE_LINESIZE 4U #endif #if (((defined(USB_DEVICE_CONFIG_LPCIP3511FS)) && (USB_DEVICE_CONFIG_LPCIP3511FS > 0U)) || \ ((defined(USB_DEVICE_CONFIG_LPCIP3511HS)) && (USB_DEVICE_CONFIG_LPCIP3511HS > 0U))) -#define USB_DATA_ALIGN 64 +#define USB_DATA_ALIGN 64U #else -#define USB_DATA_ALIGN 4 +#define USB_DATA_ALIGN 4U #endif -#define USB_DATA_ALIGN_SIZE MAX(USB_CACHE_LINESIZE, USB_DATA_ALIGN) +#if (USB_CACHE_LINESIZE > USB_DATA_ALIGN) +#define USB_DATA_ALIGN_SIZE USB_CACHE_LINESIZE +#else +#define USB_DATA_ALIGN_SIZE USB_DATA_ALIGN +#endif -#define USB_DATA_ALIGN_SIZE_MULTIPLE(n) ((n + USB_DATA_ALIGN_SIZE - 1) & (~(USB_DATA_ALIGN_SIZE - 1))) +#define USB_DATA_ALIGN_SIZE_MULTIPLE(n) (((n) + USB_DATA_ALIGN_SIZE - 1U) & (~(USB_DATA_ALIGN_SIZE - 1U))) #if defined(USB_STACK_USE_DEDICATED_RAM) && (USB_STACK_USE_DEDICATED_RAM == USB_STACK_DEDICATED_RAM_TYPE_BDT_GLOBAL) @@ -387,13 +408,19 @@ _Pragma("diag_suppress=Pm120") #if (defined(USB_DEVICE_CONFIG_BUFFER_PROPERTY_CACHEABLE) && (USB_DEVICE_CONFIG_BUFFER_PROPERTY_CACHEABLE)) || \ (defined(USB_HOST_CONFIG_BUFFER_PROPERTY_CACHEABLE) && (USB_HOST_CONFIG_BUFFER_PROPERTY_CACHEABLE)) #define USB_DMA_DATA_NONINIT_SUB USB_LINK_DMA_NONINIT_DATA -#define USB_DMA_DATA_INIT_SUB USB_LINK_SECTION_SUB(m_usb_dma_init_data) +#define USB_DMA_DATA_INIT_SUB USB_LINK_DMA_INIT_DATA(m_usb_dma_init_data) +#define USB_CONTROLLER_DATA USB_LINK_NONCACHE_NONINIT_DATA +#else +#if (defined(DATA_SECTION_IS_CACHEABLE) && (DATA_SECTION_IS_CACHEABLE)) +#define USB_DMA_DATA_NONINIT_SUB USB_LINK_NONCACHE_NONINIT_DATA +#define USB_DMA_DATA_INIT_SUB USB_LINK_DMA_INIT_DATA(NonCacheable.init) #define USB_CONTROLLER_DATA USB_LINK_NONCACHE_NONINIT_DATA #else #define USB_DMA_DATA_NONINIT_SUB #define USB_DMA_DATA_INIT_SUB #define USB_CONTROLLER_DATA USB_LINK_USB_GLOBAL #endif +#endif #elif defined(USB_STACK_USE_DEDICATED_RAM) && (USB_STACK_USE_DEDICATED_RAM == USB_STACK_DEDICATED_RAM_TYPE_BDT) @@ -403,7 +430,13 @@ _Pragma("diag_suppress=Pm120") (defined(USB_HOST_CONFIG_BUFFER_PROPERTY_CACHEABLE) && (USB_HOST_CONFIG_BUFFER_PROPERTY_CACHEABLE)) #define USB_GLOBAL USB_LINK_DMA_NONINIT_DATA #define USB_DMA_DATA_NONINIT_SUB USB_LINK_DMA_NONINIT_DATA -#define USB_DMA_DATA_INIT_SUB USB_LINK_SECTION_SUB(m_usb_dma_init_data) +#define USB_DMA_DATA_INIT_SUB USB_LINK_DMA_INIT_DATA(m_usb_dma_init_data) +#define USB_CONTROLLER_DATA USB_LINK_NONCACHE_NONINIT_DATA +#else +#if (defined(DATA_SECTION_IS_CACHEABLE) && (DATA_SECTION_IS_CACHEABLE)) +#define USB_GLOBAL USB_LINK_NONCACHE_NONINIT_DATA +#define USB_DMA_DATA_NONINIT_SUB USB_LINK_NONCACHE_NONINIT_DATA +#define USB_DMA_DATA_INIT_SUB USB_LINK_DMA_INIT_DATA(NonCacheable.init) #define USB_CONTROLLER_DATA USB_LINK_NONCACHE_NONINIT_DATA #else #define USB_GLOBAL USB_LINK_USB_GLOBAL_BSS @@ -411,6 +444,7 @@ _Pragma("diag_suppress=Pm120") #define USB_DMA_DATA_INIT_SUB #define USB_CONTROLLER_DATA #endif +#endif #else @@ -420,9 +454,17 @@ _Pragma("diag_suppress=Pm120") #define USB_GLOBAL USB_LINK_DMA_NONINIT_DATA #define USB_BDT USB_LINK_NONCACHE_NONINIT_DATA #define USB_DMA_DATA_NONINIT_SUB USB_LINK_DMA_NONINIT_DATA -#define USB_DMA_DATA_INIT_SUB USB_LINK_SECTION_SUB(m_usb_dma_init_data) +#define USB_DMA_DATA_INIT_SUB USB_LINK_DMA_INIT_DATA(m_usb_dma_init_data) #define USB_CONTROLLER_DATA USB_LINK_NONCACHE_NONINIT_DATA +#else + +#if (defined(DATA_SECTION_IS_CACHEABLE) && (DATA_SECTION_IS_CACHEABLE)) +#define USB_GLOBAL USB_LINK_NONCACHE_NONINIT_DATA +#define USB_BDT USB_LINK_NONCACHE_NONINIT_DATA +#define USB_DMA_DATA_NONINIT_SUB USB_LINK_NONCACHE_NONINIT_DATA +#define USB_DMA_DATA_INIT_SUB USB_LINK_DMA_INIT_DATA(NonCacheable.init) +#define USB_CONTROLLER_DATA USB_LINK_NONCACHE_NONINIT_DATA #else #define USB_GLOBAL USB_LINK_USB_GLOBAL_BSS #define USB_BDT USB_LINK_USB_BDT_BSS @@ -433,6 +475,8 @@ _Pragma("diag_suppress=Pm120") #endif +#endif + #define USB_DMA_NONINIT_DATA_ALIGN(n) USB_RAM_ADDRESS_ALIGNMENT(n) USB_DMA_DATA_NONINIT_SUB #define USB_DMA_INIT_DATA_ALIGN(n) USB_RAM_ADDRESS_ALIGNMENT(n) USB_DMA_DATA_INIT_SUB diff --git a/bsp/nuvoton/libraries/m480/rtt_port/drv_usbhost.c b/bsp/nuvoton/libraries/m480/rtt_port/drv_usbhost.c index f168a3fcd4..a4999d48f8 100644 --- a/bsp/nuvoton/libraries/m480/rtt_port/drv_usbhost.c +++ b/bsp/nuvoton/libraries/m480/rtt_port/drv_usbhost.c @@ -840,7 +840,7 @@ int nu_usbh_register(void) RT_ASSERT(res == RT_EOK); /*initialize the usb host function */ - res = rt_usb_host_init(); + res = rt_usb_host_init("usbh"); RT_ASSERT(res == RT_EOK); #if defined(RT_USING_PM) diff --git a/bsp/rx/applications/application.c b/bsp/rx/applications/application.c index 4a6e250429..9ea0023015 100644 --- a/bsp/rx/applications/application.c +++ b/bsp/rx/applications/application.c @@ -130,7 +130,7 @@ void rt_init_thread_entry(void* parameter) #endif #ifdef RT_USING_USB_HOST - rt_usb_host_init(); + rt_usb_host_init("usbh"); #endif #ifdef RT_USING_FINSH diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_usbh.c b/bsp/stm32/libraries/HAL_Drivers/drv_usbh.c index 680a93e722..47b24fb950 100644 --- a/bsp/stm32/libraries/HAL_Drivers/drv_usbh.c +++ b/bsp/stm32/libraries/HAL_Drivers/drv_usbh.c @@ -241,7 +241,7 @@ int stm_usbh_register(void) return -RT_ERROR; } - rt_usb_host_init(); + rt_usb_host_init("usbh"); return RT_EOK; } diff --git a/components/drivers/Kconfig b/components/drivers/Kconfig index 006497519f..b0caabc73c 100755 --- a/components/drivers/Kconfig +++ b/components/drivers/Kconfig @@ -642,6 +642,14 @@ menu "Using USB" string "Udisk mount dir" default "/" endif + config RT_USBH_HID + bool "Enable HID Drivers" + default n + if RT_USBH_HID + config RT_USBH_HID_MOUSE + bool "Enable HID mouse protocol" + default n + endif endif config RT_USING_USB_DEVICE bool "Using USB device" diff --git a/components/drivers/usb/usbhost/class/hid.c b/components/drivers/usb/usbhost/class/hid.c index e16096877f..1abc82184f 100644 --- a/components/drivers/usb/usbhost/class/hid.c +++ b/components/drivers/usb/usbhost/class/hid.c @@ -26,7 +26,7 @@ static rt_list_t _protocal_list; * * @return the error code, RT_EOK on successfully. */ -rt_err_t rt_usbh_hid_set_idle(struct uintf* intf, int duration, int report_id) +rt_err_t rt_usbh_hid_set_idle(struct uhintf* intf, int duration, int report_id) { struct urequest setup; struct uinstance* device; @@ -40,14 +40,15 @@ rt_err_t rt_usbh_hid_set_idle(struct uintf* intf, int duration, int report_id) setup.request_type = USB_REQ_TYPE_DIR_OUT | USB_REQ_TYPE_CLASS | USB_REQ_TYPE_INTERFACE; - setup.request = USB_REQ_SET_IDLE; - setup.index = 0; - setup.length = 0; - setup.value = (duration << 8 )| report_id; + setup.bRequest = USB_REQ_SET_IDLE; + setup.wIndex = 0; + setup.wLength = 0; + setup.wValue = (duration << 8 )| report_id; - if(rt_usb_hcd_control_xfer(device->hcd, device, &setup, RT_NULL, 0, - timeout) == 0) return RT_EOK; - else return -RT_FALSE; + if (rt_usb_hcd_setup_xfer(device->hcd, device->pipe_ep0_out, &setup, timeout) == 8) + return RT_EOK; + else + return -RT_FALSE; } /** @@ -59,7 +60,7 @@ rt_err_t rt_usbh_hid_set_idle(struct uintf* intf, int duration, int report_id) * * @return the error code, RT_EOK on successfully. */ -rt_err_t rt_usbh_hid_get_report(struct uintf* intf, rt_uint8_t type, +rt_err_t rt_usbh_hid_get_report(struct uhintf* intf, rt_uint8_t type, rt_uint8_t id, rt_uint8_t *buffer, rt_size_t size) { struct urequest setup; @@ -74,14 +75,24 @@ rt_err_t rt_usbh_hid_get_report(struct uintf* intf, rt_uint8_t type, setup.request_type = USB_REQ_TYPE_DIR_IN | USB_REQ_TYPE_CLASS | USB_REQ_TYPE_INTERFACE; - setup.request = USB_REQ_GET_REPORT; - setup.index = intf->intf_desc->bInterfaceNumber; - setup.length = size; - setup.value = (type << 8 ) + id; + setup.bRequest = USB_REQ_GET_REPORT; + setup.wIndex = intf->intf_desc->bInterfaceNumber; + setup.wLength = size; + setup.wValue = (type << 8 ) + id; - if(rt_usb_hcd_control_xfer(device->hcd, device, &setup, buffer, size, - timeout) == size) return RT_EOK; - else return -RT_FALSE; + if (rt_usb_hcd_setup_xfer(device->hcd, device->pipe_ep0_out, &setup, timeout) == 8) + { + if (rt_usb_hcd_pipe_xfer(device->hcd, device->pipe_ep0_in, buffer, size, timeout) == size) + { + if (rt_usb_hcd_pipe_xfer(device->hcd, device->pipe_ep0_out, RT_NULL, 0, timeout) == 0) + { + return RT_EOK; + } + } + } + else + return -RT_FALSE; + return -RT_FALSE; } /** @@ -93,7 +104,7 @@ rt_err_t rt_usbh_hid_get_report(struct uintf* intf, rt_uint8_t type, * * @return the error code, RT_EOK on successfully. */ -rt_err_t rt_usbh_hid_set_report(struct uintf* intf, rt_uint8_t *buffer, rt_size_t size) +rt_err_t rt_usbh_hid_set_report(struct uhintf* intf, rt_uint8_t *buffer, rt_size_t size) { struct urequest setup; struct uinstance* device; @@ -107,14 +118,15 @@ rt_err_t rt_usbh_hid_set_report(struct uintf* intf, rt_uint8_t *buffer, rt_size_ setup.request_type = USB_REQ_TYPE_DIR_OUT | USB_REQ_TYPE_CLASS | USB_REQ_TYPE_INTERFACE; - setup.request = USB_REQ_SET_REPORT; - setup.index = intf->intf_desc->bInterfaceNumber; - setup.length = size; - setup.value = 0x02 << 8; + setup.bRequest = USB_REQ_SET_REPORT; + setup.wIndex = intf->intf_desc->bInterfaceNumber; + setup.wLength = size; + setup.wValue = 0x02 << 8; - if(rt_usb_hcd_control_xfer(device->hcd, device, &setup, buffer, size, - timeout) == size) return RT_EOK; - else return -RT_FALSE; + if (rt_usb_hcd_setup_xfer(device->hcd, device->pipe_ep0_out, &setup, timeout) == 8) + return RT_EOK; + else + return -RT_FALSE; } /** @@ -125,7 +137,7 @@ rt_err_t rt_usbh_hid_set_report(struct uintf* intf, rt_uint8_t *buffer, rt_size_ * * @return the error code, RT_EOK on successfully. */ -rt_err_t rt_usbh_hid_set_protocal(struct uintf* intf, int protocol) +rt_err_t rt_usbh_hid_set_protocal(struct uhintf* intf, int protocol) { struct urequest setup; struct uinstance* device; @@ -139,14 +151,15 @@ rt_err_t rt_usbh_hid_set_protocal(struct uintf* intf, int protocol) setup.request_type = USB_REQ_TYPE_DIR_OUT | USB_REQ_TYPE_CLASS | USB_REQ_TYPE_INTERFACE; - setup.request = USB_REQ_SET_PROTOCOL; - setup.index = 0; - setup.length = 0; - setup.value = protocol; + setup.bRequest = USB_REQ_SET_PROTOCOL; + setup.wIndex = 0; + setup.wLength = 0; + setup.wValue = protocol; - if(rt_usb_hcd_control_xfer(device->hcd, device, &setup, RT_NULL, 0, - timeout) == 0) return RT_EOK; - else return -RT_FALSE; + if (rt_usb_hcd_setup_xfer(device->hcd, device->pipe_ep0_out, &setup, timeout) == 8) + return RT_EOK; + else + return -RT_FALSE; } /** @@ -159,7 +172,7 @@ rt_err_t rt_usbh_hid_set_protocal(struct uintf* intf, int protocol) * * @return the error code, RT_EOK on successfully. */ -rt_err_t rt_usbh_hid_get_report_descriptor(struct uintf* intf, +rt_err_t rt_usbh_hid_get_report_descriptor(struct uhintf* intf, rt_uint8_t *buffer, rt_size_t size) { struct urequest setup; @@ -174,14 +187,24 @@ rt_err_t rt_usbh_hid_get_report_descriptor(struct uintf* intf, setup.request_type = USB_REQ_TYPE_DIR_IN | USB_REQ_TYPE_STANDARD| USB_REQ_TYPE_INTERFACE; - setup.request = USB_REQ_GET_DESCRIPTOR; - setup.index = 0; - setup.length = size; - setup.value = USB_DESC_TYPE_REPORT << 8; + setup.bRequest = USB_REQ_GET_DESCRIPTOR; + setup.wIndex = 0; + setup.wLength = size; + setup.wValue = USB_DESC_TYPE_REPORT << 8; - if(rt_usb_hcd_control_xfer(device->hcd, device, &setup, buffer, size, - timeout) == size) return RT_EOK; - else return -RT_FALSE; + if (rt_usb_hcd_setup_xfer(device->hcd, device->pipe_ep0_out, &setup, timeout) == 8) + { + if (rt_usb_hcd_pipe_xfer(device->hcd, device->pipe_ep0_in, buffer, size, timeout) == size) + { + if (rt_usb_hcd_pipe_xfer(device->hcd, device->pipe_ep0_out, RT_NULL, 0, timeout) == 0) + { + return RT_EOK; + } + } + } + else + return -RT_FALSE; + return -RT_FALSE; } /** @@ -220,16 +243,16 @@ static void rt_usbh_hid_callback(void* context) RT_ASSERT(context != RT_NULL); pipe = (upipe_t)context; - hid = (struct uhid*)pipe->intf->user_data; + hid = (struct uhid*)((struct uhintf*)pipe->inst)->user_data; /* invoke protocal callback function */ hid->protocal->callback((void*)hid); /* parameter check */ - RT_ASSERT(pipe->intf->device->hcd != RT_NULL); + RT_ASSERT(((struct uhintf*)pipe->inst)->device->hcd != RT_NULL); - rt_usb_hcd_int_xfer(pipe->intf->device->hcd, pipe, hid->buffer, - pipe->ep.wMaxPacketSize, timeout); + rt_usb_hcd_pipe_xfer(((struct uhintf*)pipe->inst)->device->hcd, pipe, + hid->buffer, pipe->ep.wMaxPacketSize, timeout); } /** @@ -268,9 +291,7 @@ static rt_err_t rt_usbh_hid_enable(void* arg) int i = 0, pro_id; uprotocal_t protocal; struct uhid* hid; - struct uintf* intf = (struct uintf*)arg; - int timeout = USB_TIMEOUT_BASIC; - upipe_t pipe; + struct uhintf* intf = (struct uhintf*)arg; /* parameter check */ if(intf == RT_NULL) @@ -319,19 +340,13 @@ static rt_err_t rt_usbh_hid_enable(void* arg) if(!(ep_desc->bEndpointAddress & USB_DIR_IN)) continue; ret = rt_usb_hcd_alloc_pipe(intf->device->hcd, &hid->pipe_in, - intf, ep_desc, rt_usbh_hid_callback); + intf, ep_desc); if(ret != RT_EOK) return ret; } /* initialize hid protocal */ - hid->protocal->init((void*)intf); - pipe = hid->pipe_in; + hid->protocal->init((void*)intf); - /* parameter check */ - RT_ASSERT(pipe->intf->device->hcd != RT_NULL); - - rt_usb_hcd_int_xfer(pipe->intf->device->hcd, hid->pipe_in, - hid->buffer, hid->pipe_in->ep.wMaxPacketSize, timeout); return RT_EOK; } @@ -346,7 +361,7 @@ static rt_err_t rt_usbh_hid_enable(void* arg) static rt_err_t rt_usbh_hid_disable(void* arg) { struct uhid* hid; - struct uintf* intf = (struct uintf*)arg; + struct uhintf* intf = (struct uhintf*)arg; RT_ASSERT(intf != RT_NULL); @@ -364,9 +379,6 @@ static rt_err_t rt_usbh_hid_disable(void* arg) /* free the hid instance */ rt_free(hid); } - - /* free the instance */ - rt_free(intf); return RT_EOK; } diff --git a/components/drivers/usb/usbhost/class/hid.h b/components/drivers/usb/usbhost/class/hid.h index 8e446c8cea..04c67aa42b 100644 --- a/components/drivers/usb/usbhost/class/hid.h +++ b/components/drivers/usb/usbhost/class/hid.h @@ -31,11 +31,11 @@ typedef struct uhid uhid_t; #define USB_HID_KEYBOARD 1 #define USB_HID_MOUSE 2 -rt_err_t rt_usbh_hid_set_idle(struct uintf* intf, int duration, int report_id); -rt_err_t rt_usbh_hid_get_report(struct uintf* intf, rt_uint8_t type, rt_uint8_t id, rt_uint8_t *buffer, rt_size_t size); -rt_err_t rt_usbh_hid_set_report(struct uintf* intf, rt_uint8_t *buffer, rt_size_t size); -rt_err_t rt_usbh_hid_set_protocal(struct uintf* intf, int protocol); -rt_err_t rt_usbh_hid_get_report_descriptor(struct uintf* intf, rt_uint8_t *buffer, rt_size_t size); +rt_err_t rt_usbh_hid_set_idle(struct uhintf* intf, int duration, int report_id); +rt_err_t rt_usbh_hid_get_report(struct uhintf* intf, rt_uint8_t type, rt_uint8_t id, rt_uint8_t *buffer, rt_size_t size); +rt_err_t rt_usbh_hid_set_report(struct uhintf* intf, rt_uint8_t *buffer, rt_size_t size); +rt_err_t rt_usbh_hid_set_protocal(struct uhintf* intf, int protocol); +rt_err_t rt_usbh_hid_get_report_descriptor(struct uhintf* intf, rt_uint8_t *buffer, rt_size_t size); rt_err_t rt_usbh_hid_protocal_register(uprotocal_t protocal); #endif diff --git a/components/drivers/usb/usbhost/class/umouse.c b/components/drivers/usb/usbhost/class/umouse.c index e769475a98..7f50c0451f 100644 --- a/components/drivers/usb/usbhost/class/umouse.c +++ b/components/drivers/usb/usbhost/class/umouse.c @@ -126,15 +126,36 @@ static rt_err_t rt_usbh_hid_mouse_callback(void* arg) return RT_EOK; } +rt_thread_t mouse_thread; +void mouse_task(void* param) +{ + struct uhintf* intf = (struct uhintf*)param; + while (1) + { + if (rt_usb_hcd_pipe_xfer(intf->device->hcd, ((struct uhid*)intf->user_data)->pipe_in, + ((struct uhid*)intf->user_data)->buffer, ((struct uhid*)intf->user_data)->pipe_in->ep.wMaxPacketSize, + USB_TIMEOUT_BASIC) == 0) + { + break; + } + + rt_usbh_hid_mouse_callback(intf->user_data); + } +} + + static rt_err_t rt_usbh_hid_mouse_init(void* arg) { - struct uintf* intf = (struct uintf*)arg; + struct uhintf* intf = (struct uhintf*)arg; RT_ASSERT(intf != RT_NULL); rt_usbh_hid_set_protocal(intf, 0); - rt_usbh_hid_set_idle(intf, 10, 0); + rt_usbh_hid_set_idle(intf, 0, 0); + + mouse_thread = rt_thread_create("mouse0", mouse_task, intf, 500, 8, 100); + rt_thread_startup(mouse_thread); RT_DEBUG_LOG(RT_DEBUG_USB, ("start usb mouse\n")); #ifdef RT_USING_RTGUI diff --git a/components/drivers/usb/usbhost/core/hub.c b/components/drivers/usb/usbhost/core/hub.c index 2a9fc20111..c0e025ba7e 100644 --- a/components/drivers/usb/usbhost/core/hub.c +++ b/components/drivers/usb/usbhost/core/hub.c @@ -701,6 +701,7 @@ void rt_usbh_hub_init(uhcd_t hcd) rt_thread_t thread; /* create root hub for hcd */ hcd->roothub = rt_malloc(sizeof(struct uhub)); + rt_memset(hcd->roothub, 0, sizeof(struct uhub)); hcd->roothub->is_roothub = RT_TRUE; hcd->roothub->hcd = hcd; hcd->roothub->num_ports = hcd->num_ports; diff --git a/components/drivers/usb/usbhost/core/usbhost.c b/components/drivers/usb/usbhost/core/usbhost.c index b4caad710c..b9e6a7a4b1 100644 --- a/components/drivers/usb/usbhost/core/usbhost.c +++ b/components/drivers/usb/usbhost/core/usbhost.c @@ -44,6 +44,16 @@ rt_err_t rt_usb_host_init(const char *name) /* register mass storage class driver */ drv = rt_usbh_class_driver_storage(); rt_usbh_class_driver_register(drv); +#endif +#ifdef RT_USBH_HID + /* register mass storage class driver */ + drv = rt_usbh_class_driver_hid(); + rt_usbh_class_driver_register(drv); +#ifdef RT_USBH_HID_MOUSE + uprotocal_t protocal; + protocal = rt_usbh_hid_protocal_mouse(); + rt_usbh_hid_protocal_register(protocal); +#endif #endif /* register hub class driver */ From 7e5034c67dfe507717e7bb3b267ee8f1b0e045a5 Mon Sep 17 00:00:00 2001 From: LeeChunHei Date: Sun, 14 Feb 2021 12:15:20 +0800 Subject: [PATCH 07/26] change to use non blocking api and use semaphore to sync the transfer --- bsp/imxrt/libraries/drivers/drv_spi.c | 32 ++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/bsp/imxrt/libraries/drivers/drv_spi.c b/bsp/imxrt/libraries/drivers/drv_spi.c index e0375166a2..75813e0eab 100644 --- a/bsp/imxrt/libraries/drivers/drv_spi.c +++ b/bsp/imxrt/libraries/drivers/drv_spi.c @@ -64,6 +64,8 @@ struct imxrt_spi char *bus_name; LPSPI_Type *base; struct rt_spi_bus spi_bus; + rt_sem_t xfer_sem; + lpspi_master_handle_t spi_normal; struct dma_config *dma; rt_uint8_t dma_flag; }; @@ -159,9 +161,18 @@ static void spi_get_dma_config(void) #endif } +void normal_xfer_callback(LPSPI_Type *base, lpspi_master_handle_t *handle, status_t status, void *userData) +{ + /* xfer complete callback */ + struct imxrt_spi *spi = (struct imxrt_spi *)userData; + rt_sem_release(spi->xfer_sem); +} + void edma_xfer_callback(LPSPI_Type *base, lpspi_master_edma_handle_t *handle, status_t status, void *userData) { /* xfer complete callback */ + struct imxrt_spi *spi = (struct imxrt_spi *)userData; + rt_sem_release(spi->xfer_sem); } rt_err_t rt_hw_spi_device_attach(const char *bus_name, const char *device_name, rt_uint32_t pin) @@ -217,6 +228,17 @@ static uint32_t imxrt_get_lpspi_freq(void) return freq; } +static void lpspi_normal_config(struct imxrt_spi *spi) +{ + RT_ASSERT(spi != RT_NULL); + + LPSPI_MasterTransferCreateHandle(spi->base, + &spi->spi_normal, + normal_xfer_callback, + spi); + LOG_D(LOG_TAG" %s normal config done\n", spi->bus_name); +} + static void lpspi_dma_config(struct imxrt_spi *spi) { RT_ASSERT(spi != RT_NULL); @@ -325,12 +347,13 @@ static rt_uint32_t spixfer(struct rt_spi_device *device, struct rt_spi_message * if(RT_FALSE == spi->dma_flag) { - status = LPSPI_MasterTransferBlocking(spi->base, &transfer); + status = LPSPI_MasterTransferNonBlocking(spi->base, &spi->spi_normal, &transfer); } else { status = LPSPI_MasterTransferEDMA(spi->base,&spi->dma->spi_edma,&transfer); } + rt_sem_take(spi->xfer_sem, RT_WAITING_FOREVER); if(message->cs_release) { @@ -369,6 +392,13 @@ int rt_hw_spi_bus_init(void) { lpspi_dma_config(&lpspis[i]); } + else + { + lpspi_normal_config(&lpspis[i]); + } + char sem_name[RT_NAME_MAX]; + rt_sprintf(sem_name, "%s_s", lpspis[i].bus_name); + lpspis[i].xfer_sem = rt_sem_create(sem_name, 0, RT_IPC_FLAG_PRIO); } return ret; From be864bcdd11e2b5e9708d95942193012cec21be9 Mon Sep 17 00:00:00 2001 From: tangyuxin <462747508@qq.com> Date: Sat, 20 Feb 2021 20:44:46 +0800 Subject: [PATCH 08/26] [ipc] fix IAR Compilation error --- src/ipc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ipc.c b/src/ipc.c index d037708979..37b05b9ae3 100755 --- a/src/ipc.c +++ b/src/ipc.c @@ -2203,7 +2203,7 @@ rt_err_t rt_mq_send_wait(rt_mq_t mq, } /* message queue is full */ - while ((msg = mq->msg_queue_free) == RT_NULL) + while ((msg = (struct rt_mq_message *)mq->msg_queue_free) == RT_NULL) { /* reset error number in thread */ thread->error = RT_EOK; From d06420e1d7eda43fb7e76a726be7ee4a06018ed0 Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Sun, 21 Feb 2021 17:25:36 +0800 Subject: [PATCH 09/26] implement getuid and getpid --- components/libc/compilers/armlibc/sys/unistd.h | 3 +++ components/libc/compilers/common/unistd.c | 12 ++++++++++++ components/libc/compilers/dlib/sys/unistd.h | 3 +++ 3 files changed, 18 insertions(+) diff --git a/components/libc/compilers/armlibc/sys/unistd.h b/components/libc/compilers/armlibc/sys/unistd.h index 73a73a267e..e1a1ad92f4 100644 --- a/components/libc/compilers/armlibc/sys/unistd.h +++ b/components/libc/compilers/armlibc/sys/unistd.h @@ -73,4 +73,7 @@ char * ttyname (int desc); unsigned int sleep(unsigned int seconds); int usleep(useconds_t usec); +uid_t getuid(void); +pid_t getpid(void); + #endif /* _SYS_UNISTD_H */ diff --git a/components/libc/compilers/common/unistd.c b/components/libc/compilers/common/unistd.c index 48e6beee4e..c7ad654da7 100644 --- a/components/libc/compilers/common/unistd.c +++ b/components/libc/compilers/common/unistd.c @@ -49,3 +49,15 @@ int usleep(useconds_t usec) return 0; } RTM_EXPORT(usleep); + +uid_t getuid(void) +{ + return -1; +} +RTM_EXPORT(getuid); + +pid_t getpid(void) +{ + return -1; +} +RTM_EXPORT(getuid); diff --git a/components/libc/compilers/dlib/sys/unistd.h b/components/libc/compilers/dlib/sys/unistd.h index 6d99cd6c55..5ca56ad136 100644 --- a/components/libc/compilers/dlib/sys/unistd.h +++ b/components/libc/compilers/dlib/sys/unistd.h @@ -47,4 +47,7 @@ char * ttyname (int desc); unsigned int sleep(unsigned int seconds); int usleep(useconds_t usec); +uid_t getuid(void); +pid_t getpid(void); + #endif /* _SYS_UNISTD_H */ From c13c00e45cb7af93c3e2b697555778844d1ebaec Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Sun, 21 Feb 2021 18:01:29 +0800 Subject: [PATCH 10/26] update --- .../libc/compilers/armlibc/sys/unistd.h | 6 +++- components/libc/compilers/common/unistd.c | 32 ++++++++++++++++--- components/libc/compilers/dlib/sys/unistd.h | 6 +++- 3 files changed, 38 insertions(+), 6 deletions(-) diff --git a/components/libc/compilers/armlibc/sys/unistd.h b/components/libc/compilers/armlibc/sys/unistd.h index e1a1ad92f4..ee1e1c4db9 100644 --- a/components/libc/compilers/armlibc/sys/unistd.h +++ b/components/libc/compilers/armlibc/sys/unistd.h @@ -73,7 +73,11 @@ char * ttyname (int desc); unsigned int sleep(unsigned int seconds); int usleep(useconds_t usec); -uid_t getuid(void); pid_t getpid(void); +pid_t getppid(void); +uid_t getuid(void); +uid_t geteuid(void); +gid_t getgid(void); +gid_t getegid(void); #endif /* _SYS_UNISTD_H */ diff --git a/components/libc/compilers/common/unistd.c b/components/libc/compilers/common/unistd.c index c7ad654da7..b3efc386e9 100644 --- a/components/libc/compilers/common/unistd.c +++ b/components/libc/compilers/common/unistd.c @@ -50,14 +50,38 @@ int usleep(useconds_t usec) } RTM_EXPORT(usleep); +pid_t getpid(void) +{ + return 0; +} +RTM_EXPORT(getpid); + +pid_t getppid(void) +{ + return 0; +} +RTM_EXPORT(getppid); + uid_t getuid(void) { - return -1; + return 0; } RTM_EXPORT(getuid); -pid_t getpid(void) +uid_t geteuid(void) { - return -1; + return 0; } -RTM_EXPORT(getuid); +RTM_EXPORT(geteuid); + +gid_t getgid(void) +{ + return 0; +} +RTM_EXPORT(getgid); + +gid_t getegid(void) +{ + return 0; +} +RTM_EXPORT(getegid); diff --git a/components/libc/compilers/dlib/sys/unistd.h b/components/libc/compilers/dlib/sys/unistd.h index 5ca56ad136..5b86822635 100644 --- a/components/libc/compilers/dlib/sys/unistd.h +++ b/components/libc/compilers/dlib/sys/unistd.h @@ -47,7 +47,11 @@ char * ttyname (int desc); unsigned int sleep(unsigned int seconds); int usleep(useconds_t usec); -uid_t getuid(void); pid_t getpid(void); +pid_t getppid(void); +uid_t getuid(void); +uid_t geteuid(void); +gid_t getgid(void); +gid_t getegid(void); #endif /* _SYS_UNISTD_H */ From 3ebb48fae1c7765670bf248c80e12e657aa4f040 Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Sun, 21 Feb 2021 18:05:47 +0800 Subject: [PATCH 11/26] add comment --- components/libc/compilers/common/unistd.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/components/libc/compilers/common/unistd.c b/components/libc/compilers/common/unistd.c index b3efc386e9..0966242e55 100644 --- a/components/libc/compilers/common/unistd.c +++ b/components/libc/compilers/common/unistd.c @@ -52,6 +52,7 @@ RTM_EXPORT(usleep); pid_t getpid(void) { + /*TODO*/ return 0; } RTM_EXPORT(getpid); @@ -64,24 +65,24 @@ RTM_EXPORT(getppid); uid_t getuid(void) { - return 0; + return 0; /*ROOT*/ } RTM_EXPORT(getuid); uid_t geteuid(void) { - return 0; + return 0; /*ROOT*/ } RTM_EXPORT(geteuid); gid_t getgid(void) { - return 0; + return 0; /*ROOT*/ } RTM_EXPORT(getgid); gid_t getegid(void) { - return 0; + return 0; /*ROOT*/ } RTM_EXPORT(getegid); From 19ef11201620038724b9ce0c464f63713134fc2b Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Sun, 21 Feb 2021 18:20:45 +0800 Subject: [PATCH 12/26] improve and beautify syscalls --- components/libc/compilers/armlibc/sys/types.h | 4 +- components/libc/compilers/dlib/sys/types.h | 4 +- components/libc/compilers/newlib/syscalls.c | 57 ++++++++++++------- 3 files changed, 42 insertions(+), 23 deletions(-) diff --git a/components/libc/compilers/armlibc/sys/types.h b/components/libc/compilers/armlibc/sys/types.h index 78fee1bb99..d1e457b36f 100644 --- a/components/libc/compilers/armlibc/sys/types.h +++ b/components/libc/compilers/armlibc/sys/types.h @@ -15,7 +15,9 @@ typedef int32_t clockid_t; typedef int32_t key_t; /* Used for interprocess communication. */ -typedef int32_t pid_t; /* Used for process IDs and process group IDs. */ +typedef int pid_t; /* Used for process IDs and process group IDs. */ +typedef unsigned short uid_t; +typedef unsigned short gid_t; #ifndef ARCH_CPU_64BIT typedef signed int ssize_t; /* Used for a count of bytes or an error indication. */ #else diff --git a/components/libc/compilers/dlib/sys/types.h b/components/libc/compilers/dlib/sys/types.h index 7dbeddcaa9..3af15ba251 100644 --- a/components/libc/compilers/dlib/sys/types.h +++ b/components/libc/compilers/dlib/sys/types.h @@ -14,7 +14,9 @@ typedef int32_t clockid_t; typedef int32_t key_t; /* Used for interprocess communication. */ -typedef int32_t pid_t; /* Used for process IDs and process group IDs. */ +typedef int pid_t; /* Used for process IDs and process group IDs. */ +typedef unsigned short uid_t; +typedef unsigned short gid_t; #ifndef ARCH_CPU_64BIT typedef signed int ssize_t; /* Used for a count of bytes or an error indication. */ #else diff --git a/components/libc/compilers/newlib/syscalls.c b/components/libc/compilers/newlib/syscalls.c index aee8ac360d..d751ab17b8 100644 --- a/components/libc/compilers/newlib/syscalls.c +++ b/components/libc/compilers/newlib/syscalls.c @@ -7,12 +7,13 @@ * Date Author Notes * 2021-02-11 Meco Man remove _gettimeofday_r() and _times_r() * 2020-02-13 Meco Man re-implement exit() and abort() + * 2020-02-21 Meco Man improve and beautify syscalls */ #include -#include -#include +#include #include +#include #include @@ -38,7 +39,9 @@ int _close_r(struct _reent *ptr, int fd) { #ifndef RT_USING_DFS - return 0; + /* return "not supported" */ + ptr->_errno = ENOTSUP; + return -1; #else return close(fd); #endif @@ -85,11 +88,11 @@ _getpid_r(struct _reent *ptr) int _isatty_r(struct _reent *ptr, int fd) { - if (fd >=0 && fd < 3) return 1; + if (fd >=0 && fd < 3) + return 1; - /* return "not supported" */ - ptr->_errno = ENOTSUP; - return -1; + ptr->_errno = ENOTTY ; + return 0; } int @@ -112,7 +115,9 @@ _off_t _lseek_r(struct _reent *ptr, int fd, _off_t pos, int whence) { #ifndef RT_USING_DFS - return 0; + /* return "not supported" */ + ptr->_errno = ENOTSUP; + return -1; #else _off_t rc; @@ -125,7 +130,9 @@ int _mkdir_r(struct _reent *ptr, const char *name, int mode) { #ifndef RT_USING_DFS - return 0; + /* return "not supported" */ + ptr->_errno = ENOTSUP; + return -1; #else int rc; @@ -138,7 +145,9 @@ int _open_r(struct _reent *ptr, const char *file, int flags, int mode) { #ifndef RT_USING_DFS - return 0; + /* return "not supported" */ + ptr->_errno = ENOTSUP; + return -1; #else int rc; @@ -151,7 +160,9 @@ _ssize_t _read_r(struct _reent *ptr, int fd, void *buf, size_t nbytes) { #ifndef RT_USING_DFS - return 0; + /* return "not supported" */ + ptr->_errno = ENOTSUP; + return -1; #else _ssize_t rc; @@ -164,7 +175,9 @@ int _rename_r(struct _reent *ptr, const char *old, const char *new) { #ifndef RT_USING_DFS - return 0; + /* return "not supported" */ + ptr->_errno = ENOTSUP; + return -1; #else int rc; @@ -184,7 +197,9 @@ int _stat_r(struct _reent *ptr, const char *file, struct stat *pstat) { #ifndef RT_USING_DFS - return 0; + /* return "not supported" */ + ptr->_errno = ENOTSUP; + return -1; #else int rc; @@ -197,6 +212,8 @@ int _unlink_r(struct _reent *ptr, const char *file) { #ifndef RT_USING_DFS + /* return "not supported" */ + ptr->_errno = ENOTSUP; return -1; #else return unlink(file); @@ -211,11 +228,11 @@ _wait_r(struct _reent *ptr, int *status) return -1; } -#ifdef RT_USING_DEVICE _ssize_t _write_r(struct _reent *ptr, int fd, const void *buf, size_t nbytes) { #ifndef RT_USING_DFS +#ifdef RT_USING_DEVICE if (fileno(stdout) == fd) { rt_device_t console; @@ -225,7 +242,11 @@ _write_r(struct _reent *ptr, int fd, const void *buf, size_t nbytes) } return 0; - +#else + /* return "not supported" */ + ptr->_errno = ENOTSUP; + return -1; +#endif /*RT_USING_DEVICE*/ #else _ssize_t rc; @@ -233,7 +254,6 @@ _write_r(struct _reent *ptr, int fd, const void *buf, size_t nbytes) return rc; #endif } -#endif /* Memory routine */ void * @@ -304,11 +324,6 @@ void __libc_init_array(void) /* we not use __libc init_aray to initialize C++ objects */ } -uid_t getuid(void) -{ - return 0; -} - mode_t umask(mode_t mask) { return 022; From 46b5eb378f6ea55963f5795762f2b7e5c97626f1 Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Mon, 22 Feb 2021 16:30:10 +0800 Subject: [PATCH 13/26] remove _getpid_r() --- components/libc/compilers/newlib/syscalls.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/components/libc/compilers/newlib/syscalls.c b/components/libc/compilers/newlib/syscalls.c index d751ab17b8..3eabad9b55 100644 --- a/components/libc/compilers/newlib/syscalls.c +++ b/components/libc/compilers/newlib/syscalls.c @@ -79,12 +79,6 @@ _fstat_r(struct _reent *ptr, int fd, struct stat *pstat) return -1; } -int -_getpid_r(struct _reent *ptr) -{ - return 0; -} - int _isatty_r(struct _reent *ptr, int fd) { @@ -335,7 +329,10 @@ int flock(int fd, int operation) } /* -These functions will be implemented and replaced by the 'common/time.c' file +These functions are implemented and replaced by the 'common/time.c' file int _gettimeofday_r(struct _reent *ptr, struct timeval *__tp, void *__tzp); _CLOCK_T_ _times_r(struct _reent *ptr, struct tms *ptms); + +These functions are implemented and replaced by the "common/unistd.c" file +int _getpid_r(struct _reent *ptr); */ From 69dc37e1aa8806d3ef17b8f6fa3d33284b26ef60 Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Mon, 22 Feb 2021 16:53:54 +0800 Subject: [PATCH 14/26] update --- components/libc/compilers/common/unistd.c | 8 +++++++- components/libc/compilers/newlib/syscalls.c | 10 +++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/components/libc/compilers/common/unistd.c b/components/libc/compilers/common/unistd.c index 0966242e55..7ecd455480 100644 --- a/components/libc/compilers/common/unistd.c +++ b/components/libc/compilers/common/unistd.c @@ -50,7 +50,13 @@ int usleep(useconds_t usec) } RTM_EXPORT(usleep); -pid_t getpid(void) +pid_t +#if defined (RT_USING_NEWLIB) +__rt_libc_getpid +#else +getpid +#endif +(void) { /*TODO*/ return 0; diff --git a/components/libc/compilers/newlib/syscalls.c b/components/libc/compilers/newlib/syscalls.c index 3eabad9b55..28e1808e3f 100644 --- a/components/libc/compilers/newlib/syscalls.c +++ b/components/libc/compilers/newlib/syscalls.c @@ -35,6 +35,13 @@ __errno () } #endif +int +_getpid_r(struct _reent *ptr) +{ + extern pid_t __rt_libc_getpid(void); + return __rt_libc_getpid(); +} + int _close_r(struct _reent *ptr, int fd) { @@ -332,7 +339,4 @@ int flock(int fd, int operation) These functions are implemented and replaced by the 'common/time.c' file int _gettimeofday_r(struct _reent *ptr, struct timeval *__tp, void *__tzp); _CLOCK_T_ _times_r(struct _reent *ptr, struct tms *ptms); - -These functions are implemented and replaced by the "common/unistd.c" file -int _getpid_r(struct _reent *ptr); */ From 19c8cab8bd4dcb9f0e36e4502d7a8ec7337d664b Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Mon, 22 Feb 2021 17:02:45 +0800 Subject: [PATCH 15/26] update --- components/libc/compilers/common/unistd.c | 8 +------- components/libc/compilers/newlib/syscalls.c | 3 +-- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/components/libc/compilers/common/unistd.c b/components/libc/compilers/common/unistd.c index 7ecd455480..0966242e55 100644 --- a/components/libc/compilers/common/unistd.c +++ b/components/libc/compilers/common/unistd.c @@ -50,13 +50,7 @@ int usleep(useconds_t usec) } RTM_EXPORT(usleep); -pid_t -#if defined (RT_USING_NEWLIB) -__rt_libc_getpid -#else -getpid -#endif -(void) +pid_t getpid(void) { /*TODO*/ return 0; diff --git a/components/libc/compilers/newlib/syscalls.c b/components/libc/compilers/newlib/syscalls.c index 28e1808e3f..45aa4a34de 100644 --- a/components/libc/compilers/newlib/syscalls.c +++ b/components/libc/compilers/newlib/syscalls.c @@ -38,8 +38,7 @@ __errno () int _getpid_r(struct _reent *ptr) { - extern pid_t __rt_libc_getpid(void); - return __rt_libc_getpid(); + return 0; } int From a40bf3b11d614daf827a0f9cc5a53d4d03f0123e Mon Sep 17 00:00:00 2001 From: LeeChunHei Date: Mon, 22 Feb 2021 22:17:07 +0800 Subject: [PATCH 16/26] adding option for using blocking spi transfer --- bsp/imxrt/libraries/drivers/drv_spi.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bsp/imxrt/libraries/drivers/drv_spi.c b/bsp/imxrt/libraries/drivers/drv_spi.c index 75813e0eab..4f042dc93f 100644 --- a/bsp/imxrt/libraries/drivers/drv_spi.c +++ b/bsp/imxrt/libraries/drivers/drv_spi.c @@ -347,7 +347,11 @@ static rt_uint32_t spixfer(struct rt_spi_device *device, struct rt_spi_message * if(RT_FALSE == spi->dma_flag) { +#ifdef(BSP_USING_BLOCKING_SPI) + status = LPSPI_MasterTransferBlocking(spi->base, &transfer); +#else status = LPSPI_MasterTransferNonBlocking(spi->base, &spi->spi_normal, &transfer); +#endif } else { From 4c32843d73f23656974bffb9621245361190ffed Mon Sep 17 00:00:00 2001 From: LeeChunHei Date: Mon, 22 Feb 2021 22:23:10 +0800 Subject: [PATCH 17/26] add minus sign for all RT_ERROR code --- bsp/imxrt/libraries/drivers/drv_pwm.c | 38 +++++++++++++-------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/bsp/imxrt/libraries/drivers/drv_pwm.c b/bsp/imxrt/libraries/drivers/drv_pwm.c index 385846807b..3f2a11b4e6 100644 --- a/bsp/imxrt/libraries/drivers/drv_pwm.c +++ b/bsp/imxrt/libraries/drivers/drv_pwm.c @@ -160,7 +160,7 @@ static rt_err_t imxrt_drv_pwm_init(PWM_Type *base, pwm_submodule_t pwm_submodule if (PWM_Init(base, pwm_submodule, &PwmConfig) == kStatus_Fail) { LOG_E("init pwm failed \n"); - return RT_ERROR; + return -RT_ERROR; } base->SM[fault_input].DISMAP[0] = 0x00; @@ -183,28 +183,28 @@ static rt_err_t imxrt_pwm1_init(PWM_Type *base) #ifdef BSP_USING_PWM1_CH0 if (imxrt_drv_pwm_init(base, kPWM_Module_0, DEFAULT_PRE, DEFAULT_FRE, DEFAULT_DUTY) != RT_EOK) { - return RT_ERROR; + return -RT_ERROR; } #endif /* BSP_USING_PWM1_CH0 */ #ifdef BSP_USING_PWM1_CH1 if (imxrt_drv_pwm_init(base, kPWM_Module_1, DEFAULT_PRE, DEFAULT_FRE, DEFAULT_DUTY) != RT_EOK) { - return RT_ERROR; + return -RT_ERROR; } #endif /* BSP_USING_PWM1_CH1 */ #ifdef BSP_USING_PWM1_CH2 if (imxrt_drv_pwm_init(base, kPWM_Module_2, DEFAULT_PRE, DEFAULT_FRE, DEFAULT_DUTY) != RT_EOK) { - return RT_ERROR; + return -RT_ERROR; } #endif /*BSP_USING_PWM1_CH2 */ #ifdef BSP_USING_PWM1_CH3 if (imxrt_drv_pwm_init(base, kPWM_Module_3, DEFAULT_PRE, DEFAULT_FRE, DEFAULT_DUTY) != RT_EOK) { - return RT_ERROR; + return -RT_ERROR; } #endif /* BSP_USING_PWM1_CH3 */ @@ -220,28 +220,28 @@ static rt_err_t imxrt_pwm2_init(PWM_Type *base) #ifdef BSP_USING_PWM2_CH0 if (imxrt_drv_pwm_init(base, kPWM_Module_0, DEFAULT_PRE, DEFAULT_FRE, DEFAULT_DUTY) != RT_EOK) { - return RT_ERROR; + return -RT_ERROR; } #endif /* BSP_USING_PWM2_CH0 */ #ifdef BSP_USING_PWM2_CH1 if (imxrt_drv_pwm_init(base, kPWM_Module_1, DEFAULT_PRE, DEFAULT_FRE, DEFAULT_DUTY) != RT_EOK) { - return RT_ERROR; + return -RT_ERROR; } #endif /* BSP_USING_PWM2_CH1 */ #ifdef BSP_USING_PWM2_CH2 if (imxrt_drv_pwm_init(base, kPWM_Module_2, DEFAULT_PRE, DEFAULT_FRE, DEFAULT_DUTY) != RT_EOK) { - return RT_ERROR; + return -RT_ERROR; } #endif /*BSP_USING_PWM2_CH2 */ #ifdef BSP_USING_PWM2_CH3 if (imxrt_drv_pwm_init(base, kPWM_Module_3, DEFAULT_PRE, DEFAULT_FRE, DEFAULT_DUTY) != RT_EOK) { - return RT_ERROR; + return -RT_ERROR; } #endif /* BSP_USING_PWM2_CH3 */ @@ -257,28 +257,28 @@ static rt_err_t imxrt_pwm3_init(PWM_Type *base) #ifdef BSP_USING_PWM3_CH0 if (imxrt_drv_pwm_init(base, kPWM_Module_0, DEFAULT_PRE, DEFAULT_FRE, DEFAULT_DUTY) != RT_EOK) { - return RT_ERROR; + return -RT_ERROR; } #endif /* BSP_USING_PWM3_CH0 */ #ifdef BSP_USING_PWM3_CH1 if (imxrt_drv_pwm_init(base, kPWM_Module_1, DEFAULT_PRE, DEFAULT_FRE, DEFAULT_DUTY) != RT_EOK) { - return RT_ERROR; + return -RT_ERROR; } #endif /* BSP_USING_PWM3_CH1 */ #ifdef BSP_USING_PWM3_CH2 if (imxrt_drv_pwm_init(base, kPWM_Module_2, DEFAULT_PRE, DEFAULT_FRE, DEFAULT_DUTY) != RT_EOK) { - return RT_ERROR; + return -RT_ERROR; } #endif /*BSP_USING_PWM3_CH2 */ #ifdef BSP_USING_PWM3_CH3 if (imxrt_drv_pwm_init(base, kPWM_Module_3, DEFAULT_PRE, DEFAULT_FRE, DEFAULT_DUTY) != RT_EOK) { - return RT_ERROR; + return -RT_ERROR; } #endif /* BSP_USING_PWM3_CH3 */ @@ -294,28 +294,28 @@ static rt_err_t imxrt_pwm4_init(PWM_Type *base) #ifdef BSP_USING_PWM4_CH0 if (imxrt_drv_pwm_init(base, kPWM_Module_0, DEFAULT_PRE, DEFAULT_FRE, DEFAULT_DUTY) != RT_EOK) { - return RT_ERROR; + return -RT_ERROR; } #endif /* BSP_USING_PWM4_CH0 */ #ifdef BSP_USING_PWM4_CH1 if (imxrt_drv_pwm_init(base, kPWM_Module_1, DEFAULT_PRE, DEFAULT_FRE, DEFAULT_DUTY) != RT_EOK) { - return RT_ERROR; + return -RT_ERROR; } #endif /* BSP_USING_PWM4_CH1 */ #ifdef BSP_USING_PWM4_CH2 if (imxrt_drv_pwm_init(base, kPWM_Module_2, DEFAULT_PRE, DEFAULT_FRE, DEFAULT_DUTY) != RT_EOK) { - return RT_ERROR; + return -RT_ERROR; } #endif /*BSP_USING_PWM4_CH2 */ #ifdef BSP_USING_PWM4_CH3 if (imxrt_drv_pwm_init(base, kPWM_Module_3, DEFAULT_PRE, DEFAULT_FRE, DEFAULT_DUTY) != RT_EOK) { - return RT_ERROR; + return -RT_ERROR; } #endif /* BSP_USING_PWM4_CH3 */ @@ -392,7 +392,7 @@ static rt_err_t imxrt_drv_qtmr_set(struct rt_device_pwm *device, struct rt_pwm_c if (kStatus_Success != QTMR_SetupPwm(base, configuration->channel, 1000000000 / configuration->period, duty, DEFAULT_POLARITY, clk_freq)) { LOG_E(LOG_TAG" setup pwm failed \n"); - return RT_ERROR; + return -RT_ERROR; } if (timer_is_on) { @@ -436,7 +436,7 @@ static rt_err_t imxrt_drv_qtmr_init(TMR_Type *base, qtmr_channel_selection_t cha if (kStatus_Success != QTMR_SetupPwm(base, channel, fre, duty, DEFAULT_POLARITY, qtmr_clock_freq)) { LOG_E(LOG_TAG" setup pwm failed \n"); - return RT_ERROR; + return -RT_ERROR; } return RT_EOK; From 6f0b8a5b7854c388d3480e40152dec39c90030d7 Mon Sep 17 00:00:00 2001 From: LeeChunHei Date: Mon, 22 Feb 2021 22:26:00 +0800 Subject: [PATCH 18/26] change the wrong syntax --- bsp/imxrt/libraries/drivers/drv_spi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bsp/imxrt/libraries/drivers/drv_spi.c b/bsp/imxrt/libraries/drivers/drv_spi.c index 4f042dc93f..04c9e94020 100644 --- a/bsp/imxrt/libraries/drivers/drv_spi.c +++ b/bsp/imxrt/libraries/drivers/drv_spi.c @@ -347,7 +347,7 @@ static rt_uint32_t spixfer(struct rt_spi_device *device, struct rt_spi_message * if(RT_FALSE == spi->dma_flag) { -#ifdef(BSP_USING_BLOCKING_SPI) +#ifdef BSP_USING_BLOCKING_SPI status = LPSPI_MasterTransferBlocking(spi->base, &transfer); #else status = LPSPI_MasterTransferNonBlocking(spi->base, &spi->spi_normal, &transfer); From 4426af03f8f93ecb1fd7926d18771de5d0dfe9df Mon Sep 17 00:00:00 2001 From: Bernard Xiong Date: Tue, 23 Feb 2021 09:44:27 +0800 Subject: [PATCH 19/26] =?UTF-8?q?Revert=20"=E6=B7=BB=E5=8A=A0imxrt?= =?UTF-8?q?=E7=9A=84pulse=20encoder=E5=92=8Cusb=20host=E9=A9=85=E5=8B=95"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MIMXRT1052/drivers/fsl_os_abstraction.h | 813 ------- .../drivers/fsl_os_abstraction_config.h | 36 - .../drivers/fsl_os_abstraction_rtthread.c | 917 -------- .../drivers/fsl_os_abstraction_rtthread.h | 130 -- .../MIMXRT1052/drivers/generic_list.c | 475 ---- .../MIMXRT1052/drivers/generic_list.h | 203 -- .../MIMXRT1052/gcc/startup_MIMXRT1052.S | 2 + bsp/imxrt/libraries/MIMXRT1050/SConscript | 13 +- bsp/imxrt/libraries/drivers/SConscript | 15 +- .../libraries/drivers/drv_pulse_encoder.c | 160 -- bsp/imxrt/libraries/drivers/drv_usbh.c | 730 ------ bsp/imxrt/libraries/drivers/drv_usbh.h | 22 - .../libraries/drivers/usb/host/usb_host.h | 139 +- .../drivers/usb/host/usb_host_devices.c | 678 +++--- .../drivers/usb/host/usb_host_devices.h | 39 +- .../drivers/usb/host/usb_host_ehci.c | 2038 ++++++++--------- .../drivers/usb/host/usb_host_ehci.h | 227 +- .../drivers/usb/host/usb_host_framework.c | 261 --- .../drivers/usb/host/usb_host_framework.h | 131 -- .../libraries/drivers/usb/host/usb_host_hci.c | 341 ++- .../libraries/drivers/usb/host/usb_host_hci.h | 44 +- bsp/imxrt/libraries/drivers/usb/include/usb.h | 1 - .../drivers/usb/include/usb_host_config.h | 247 -- .../libraries/drivers/usb/include/usb_misc.h | 336 ++- .../libraries/m480/rtt_port/drv_usbhost.c | 2 +- bsp/rx/applications/application.c | 2 +- bsp/stm32/libraries/HAL_Drivers/drv_usbh.c | 2 +- components/drivers/Kconfig | 8 - components/drivers/include/drivers/usb_host.h | 7 +- components/drivers/pm/debug.log | 0 components/drivers/usb/usbhost/class/hid.c | 130 +- components/drivers/usb/usbhost/class/hid.h | 10 +- components/drivers/usb/usbhost/class/umouse.c | 25 +- components/drivers/usb/usbhost/core/driver.c | 15 +- components/drivers/usb/usbhost/core/hub.c | 30 +- components/drivers/usb/usbhost/core/usbhost.c | 16 +- 36 files changed, 1854 insertions(+), 6391 deletions(-) delete mode 100644 bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/drivers/fsl_os_abstraction.h delete mode 100644 bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/drivers/fsl_os_abstraction_config.h delete mode 100644 bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/drivers/fsl_os_abstraction_rtthread.c delete mode 100644 bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/drivers/fsl_os_abstraction_rtthread.h delete mode 100644 bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/drivers/generic_list.c delete mode 100644 bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/drivers/generic_list.h delete mode 100644 bsp/imxrt/libraries/drivers/drv_pulse_encoder.c delete mode 100644 bsp/imxrt/libraries/drivers/drv_usbh.c delete mode 100644 bsp/imxrt/libraries/drivers/drv_usbh.h delete mode 100644 bsp/imxrt/libraries/drivers/usb/host/usb_host_framework.c delete mode 100644 bsp/imxrt/libraries/drivers/usb/host/usb_host_framework.h delete mode 100644 bsp/imxrt/libraries/drivers/usb/include/usb_host_config.h delete mode 100644 components/drivers/pm/debug.log diff --git a/bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/drivers/fsl_os_abstraction.h b/bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/drivers/fsl_os_abstraction.h deleted file mode 100644 index 2ca7485a0c..0000000000 --- a/bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/drivers/fsl_os_abstraction.h +++ /dev/null @@ -1,813 +0,0 @@ -/* - * Copyright (c) 2015, Freescale Semiconductor, Inc. - * Copyright 2016-2020 NXP - * - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#ifndef _FSL_OS_ABSTRACTION_H_ -#define _FSL_OS_ABSTRACTION_H_ - -#include "fsl_common.h" -#include "fsl_os_abstraction_config.h" -#include "generic_list.h" - -/*! - * @addtogroup osa_adapter - * @{ - */ - -#ifdef __cplusplus -extern "C" { -#endif - -/******************************************************************************* - * Definitions - ******************************************************************************/ - -/*! @brief Type for the Task Priority*/ -typedef uint16_t osa_task_priority_t; -/*! @brief Type for a task handler */ -typedef void *osa_task_handle_t; -/*! @brief Type for the parameter to be passed to the task at its creation */ -typedef void *osa_task_param_t; -/*! @brief Type for task pointer. Task prototype declaration */ -typedef void (*osa_task_ptr_t)(osa_task_param_t task_param); -/*! @brief Type for the semaphore handler */ -typedef void *osa_semaphore_handle_t; -/*! @brief Type for the mutex handler */ -typedef void *osa_mutex_handle_t; -/*! @brief Type for the event handler */ -typedef void *osa_event_handle_t; -/*! @brief Type for an event flags group, bit 32 is reserved. */ -typedef uint32_t osa_event_flags_t; -/*! @brief Message definition. */ -typedef void *osa_msg_handle_t; -/*! @brief Type for the message queue handler */ -typedef void *osa_msgq_handle_t; -/*! @brief Type for the Timer handler */ -typedef void *osa_timer_handle_t; -/*! @brief Type for the Timer callback function pointer. */ -typedef void (*osa_timer_fct_ptr_t)(void const *argument); -/*! @brief Thread Definition structure contains startup information of a thread.*/ -typedef struct osa_task_def_tag -{ - osa_task_ptr_t pthread; /*!< start address of thread function*/ - uint32_t tpriority; /*!< initial thread priority*/ - uint32_t instances; /*!< maximum number of instances of that thread function*/ - uint32_t stacksize; /*!< stack size requirements in bytes; 0 is default stack size*/ - uint32_t *tstack; /*!< stack pointer*/ - void *tlink; /*!< link pointer*/ - uint8_t *tname; /*!< name pointer*/ - uint8_t useFloat; /*!< is use float*/ -} osa_task_def_t; -/*! @brief Thread Link Definition structure .*/ -typedef struct osa_thread_link_tag -{ - uint8_t link[12]; /*!< link*/ - osa_task_handle_t osThreadId; /*!< thread id*/ - osa_task_def_t *osThreadDefHandle; /*!< pointer of thread define handle*/ - uint32_t *osThreadStackHandle; /*!< pointer of thread stack handle*/ -} osa_thread_link_t, *osa_thread_link_handle_t; - -/*! @brief Definition structure contains timer parameters.*/ -typedef struct osa_time_def_tag -{ - osa_timer_fct_ptr_t pfCallback; /* < start address of a timer function */ - void *argument; /* < argument of a timer function */ -} osa_time_def_t; - -/*! @brief Type for the timer definition*/ -typedef enum _osa_timer -{ - KOSA_TimerOnce = 0, /*!< one-shot timer*/ - KOSA_TimerPeriodic = 1 /*!< repeating timer*/ -} osa_timer_t; - -/*! @brief Defines the return status of OSA's functions */ -typedef enum _osa_status -{ - KOSA_StatusSuccess = kStatus_Success, /*!< Success */ - KOSA_StatusError = MAKE_STATUS(kStatusGroup_OSA, 1), /*!< Failed */ - KOSA_StatusTimeout = MAKE_STATUS(kStatusGroup_OSA, 2), /*!< Timeout occurs while waiting */ - KOSA_StatusIdle = MAKE_STATUS(kStatusGroup_OSA, 3), /*!< Used for bare metal only, the wait object is not ready - and timeout still not occur */ -} osa_status_t; - -#ifdef USE_RTOS -#undef USE_RTOS -#endif - -#define USE_RTOS (1) -#if (defined(GENERIC_LIST_LIGHT) && (GENERIC_LIST_LIGHT > 0U)) -#define OSA_TASK_HANDLE_SIZE (12U) -#else -#define OSA_TASK_HANDLE_SIZE (16U) -#endif -#define OSA_EVENT_HANDLE_SIZE (8U) -#define OSA_SEM_HANDLE_SIZE (4U) -#define OSA_MUTEX_HANDLE_SIZE (4U) -#define OSA_MSGQ_HANDLE_SIZE (4U) -#define OSA_MSG_HANDLE_SIZE (0U) - -/*! @brief Priority setting for OSA. */ -#ifndef OSA_PRIORITY_IDLE -#define OSA_PRIORITY_IDLE (6) -#endif - -#ifndef OSA_PRIORITY_LOW -#define OSA_PRIORITY_LOW (5) -#endif - -#ifndef OSA_PRIORITY_BELOW_NORMAL -#define OSA_PRIORITY_BELOW_NORMAL (4) -#endif - -#ifndef OSA_PRIORITY_NORMAL -#define OSA_PRIORITY_NORMAL (3) -#endif - -#ifndef OSA_PRIORITY_ABOVE_NORMAL -#define OSA_PRIORITY_ABOVE_NORMAL (2) -#endif - -#ifndef OSA_PRIORITY_HIGH -#define OSA_PRIORITY_HIGH (1) -#endif - -#ifndef OSA_PRIORITY_REAL_TIME -#define OSA_PRIORITY_REAL_TIME (0) -#endif - -#ifndef OSA_TASK_PRIORITY_MAX -#define OSA_TASK_PRIORITY_MAX (0) -#endif - -#ifndef OSA_TASK_PRIORITY_MIN -#define OSA_TASK_PRIORITY_MIN (15) -#endif - -#define SIZE_IN_UINT32_UNITS(size) (((size) + sizeof(uint32_t) - 1) / sizeof(uint32_t)) - -/*! @brief Constant to pass as timeout value in order to wait indefinitely. */ -#define osaWaitForever_c ((uint32_t)(-1)) -#define osaEventFlagsAll_c ((osa_event_flags_t)(0x00FFFFFF)) -#define osThreadStackArray(name) osThread_##name##_stack -#define osThreadStackDef(name, stacksize, instances) \ - uint32_t osThreadStackArray(name)[SIZE_IN_UINT32_UNITS(stacksize) * (instances)]; - -/* ==== Thread Management ==== */ - -/* Create a Thread Definition with function, priority, and stack requirements. - * \param name name of the thread function. - * \param priority initial priority of the thread function. - * \param instances number of possible thread instances. - * \param stackSz stack size (in bytes) requirements for the thread function. - * \param useFloat - */ -#if defined(FSL_RTOS_MQX) -#define OSA_TASK_DEFINE(name, priority, instances, stackSz, useFloat) \ - osa_thread_link_t osThreadLink_##name[instances] = {0}; \ - osThreadStackDef(name, stackSz, instances) osa_task_def_t os_thread_def_##name = { \ - (name), (priority), (instances), (stackSz), osThreadStackArray(name), osThreadLink_##name, \ - (uint8_t *)#name, (useFloat)} -#elif defined(FSL_RTOS_UCOSII) -#if gTaskMultipleInstancesManagement_c -#define OSA_TASK_DEFINE(name, priority, instances, stackSz, useFloat) \ - osa_thread_link_t osThreadLink_##name[instances] = {0}; \ - osThreadStackDef(name, stackSz, instances) osa_task_def_t os_thread_def_##name = { \ - (name), (priority), (instances), (stackSz), osThreadStackArray(name), osThreadLink_##name, \ - (uint8_t *)#name, (useFloat)} -#else -#define OSA_TASK_DEFINE(name, priority, instances, stackSz, useFloat) \ - osThreadStackDef(name, stackSz, instances) osa_task_def_t os_thread_def_##name = { \ - (name), (priority), (instances), (stackSz), osThreadStackArray(name), NULL, (uint8_t *)#name, (useFloat)} -#endif -#else -#define OSA_TASK_DEFINE(name, priority, instances, stackSz, useFloat) \ - osa_task_def_t os_thread_def_##name = {(name), (priority), (instances), (stackSz), \ - NULL, NULL, (uint8_t *)#name, (useFloat)} -#endif -/* Access a Thread defintion. - * \param name name of the thread definition object. - */ -#define OSA_TASK(name) &os_thread_def_##name - -#define OSA_TASK_PROTO(name) externosa_task_def_t os_thread_def_##name -/* ==== Timer Management ==== - * Define a Timer object. - * \param name name of the timer object. - * \param function name of the timer call back function. - */ - -#define OSA_TIMER_DEF(name, function) osa_time_def_t os_timer_def_##name = {(function), NULL} - -/* Access a Timer definition. - * \param name name of the timer object. - */ -#define OSA_TIMER(name) &os_timer_def_##name - -/* ==== Buffer Definition ==== */ - -/*! - * @brief Defines the semaphore handle - * - * This macro is used to define a 4 byte aligned semaphore handle. - * Then use "(osa_semaphore_handle_t)name" to get the semaphore handle. - * - * The macro should be global and could be optional. You could also define semaphore handle by yourself. - * - * This is an example, - * @code - * OSA_SEMAPHORE_HANDLE_DEFINE(semaphoreHandle); - * @endcode - * - * @param name The name string of the semaphore handle. - */ -#define OSA_SEMAPHORE_HANDLE_DEFINE(name) \ - uint32_t name[(OSA_SEM_HANDLE_SIZE + sizeof(uint32_t) - 1U) / sizeof(uint32_t)] - -/*! - * @brief Defines the mutex handle - * - * This macro is used to define a 4 byte aligned mutex handle. - * Then use "(osa_mutex_handle_t)name" to get the mutex handle. - * - * The macro should be global and could be optional. You could also define mutex handle by yourself. - * - * This is an example, - * @code - * OSA_MUTEX_HANDLE_DEFINE(mutexHandle); - * @endcode - * - * @param name The name string of the mutex handle. - */ -#define OSA_MUTEX_HANDLE_DEFINE(name) uint32_t name[(OSA_MUTEX_HANDLE_SIZE + sizeof(uint32_t) - 1U) / sizeof(uint32_t)] - -/*! - * @brief Defines the event handle - * - * This macro is used to define a 4 byte aligned event handle. - * Then use "(osa_event_handle_t)name" to get the event handle. - * - * The macro should be global and could be optional. You could also define event handle by yourself. - * - * This is an example, - * @code - * OSA_EVENT_HANDLE_DEFINE(eventHandle); - * @endcode - * - * @param name The name string of the event handle. - */ -#define OSA_EVENT_HANDLE_DEFINE(name) uint32_t name[(OSA_EVENT_HANDLE_SIZE + sizeof(uint32_t) - 1U) / sizeof(uint32_t)] - -/*! - * @brief Defines the message queue handle - * - * This macro is used to define a 4 byte aligned message queue handle. - * Then use "(osa_msgq_handle_t)name" to get the message queue handle. - * - * The macro should be global and could be optional. You could also define message queue handle by yourself. - * - * This is an example, - * @code - * OSA_MSGQ_HANDLE_DEFINE(msgqHandle, 3, sizeof(msgStruct)); - * @endcode - * - * @param name The name string of the message queue handle. - * @param numberOfMsgs Number of messages. - * @param msgSize Message size. - * - */ - -/*< Macro For FREE_RTOS*/ -#define OSA_MSGQ_HANDLE_DEFINE(name, numberOfMsgs, msgSize) \ - uint32_t name[(OSA_MSGQ_HANDLE_SIZE + sizeof(uint32_t) - 1U) / sizeof(uint32_t)] - -/*! - * @brief Defines the TASK handle - * - * This macro is used to define a 4 byte aligned TASK handle. - * Then use "(osa_task_handle_t)name" to get the TASK handle. - * - * The macro should be global and could be optional. You could also define TASK handle by yourself. - * - * This is an example, - * @code - * OSA_TASK_HANDLE_DEFINE(taskHandle); - * @endcode - * - * @param name The name string of the TASK handle. - */ -#define OSA_TASK_HANDLE_DEFINE(name) uint32_t name[(OSA_TASK_HANDLE_SIZE + sizeof(uint32_t) - 1U) / sizeof(uint32_t)] - -#include "fsl_os_abstraction_rtthread.h" - -extern const uint8_t gUseRtos_c; - -/* - * alloc the temporary memory to store the status - */ -#define OSA_SR_ALLOC() uint32_t osaCurrentSr; -/* - * Enter critical mode - */ -#define OSA_ENTER_CRITICAL() OSA_EnterCritical(&osaCurrentSr) -/* - * Exit critical mode and retore the previous mode - */ -#define OSA_EXIT_CRITICAL() OSA_ExitCritical(osaCurrentSr) - -/******************************************************************************* - * API - ******************************************************************************/ - -/*! - * @brief Reserves the requested amount of memory in bytes. - * - * The function is used to reserve the requested amount of memory in bytes and initializes it to 0. - * - * @param length Amount of bytes to reserve. - * - * @return Pointer to the reserved memory. NULL if memory can't be allocated. - */ -void *OSA_MemoryAllocate(uint32_t length); - -/*! - * @brief Frees the memory previously reserved. - * - * The function is used to free the memory block previously reserved. - * - * @param p Pointer to the start of the memory block previously reserved. - * - */ -void OSA_MemoryFree(void *p); - -/*! - * @brief Enter critical with nesting mode. - * - * @param sr Store current status and return to caller. - */ -void OSA_EnterCritical(uint32_t *sr); - -/*! - * @brief Exit critical with nesting mode. - * - * @param sr Previous status to restore. - */ -void OSA_ExitCritical(uint32_t sr); - -/*! - * @name Task management - * @{ - */ - -/*! - * @brief Creates a task. - * - * This function is used to create task based on the resources defined - * by the macro OSA_TASK_DEFINE. - * - * Example below shows how to use this API to create the task handle. - * @code - * OSA_TASK_HANDLE_DEFINE(taskHandle); - * OSA_TASK_DEFINE( Job1, OSA_PRIORITY_HIGH, 1, 800, 0); - * OSA_TaskCreate((osa_task_handle_t)taskHandle, OSA_TASK(Job1), (osa_task_param_t)NULL); - * @endcode - * - * @param taskHandle Pointer to a memory space of size OSA_TASK_HANDLE_SIZE allocated by the caller, task handle. - * The handle should be 4 byte aligned, because unaligned access doesn't be supported on some devices. - * You can define the handle in the following two ways: - * #OSA_TASK_HANDLE_DEFINE(taskHandle); - * or - * uint32_t taskHandle[((OSA_TASK_HANDLE_SIZE + sizeof(uint32_t) - 1U) / sizeof(uint32_t))]; - * @param thread_def pointer to theosa_task_def_t structure which defines the task. - * @param task_param Pointer to be passed to the task when it is created. - * @retval KOSA_StatusSuccess The task is successfully created. - * @retval KOSA_StatusError The task can not be created. - */ -#if ((defined(FSL_OSA_TASK_ENABLE)) && (FSL_OSA_TASK_ENABLE > 0U)) -osa_status_t OSA_TaskCreate(osa_task_handle_t taskHandle, osa_task_def_t *thread_def, osa_task_param_t task_param); -#endif /* FSL_OSA_TASK_ENABLE */ - -/*! - * @brief Gets the handler of active task. - * - * @return Handler to current active task. - */ -#if ((defined(FSL_OSA_TASK_ENABLE)) && (FSL_OSA_TASK_ENABLE > 0U)) -osa_task_handle_t OSA_TaskGetCurrentHandle(void); -#endif /* FSL_OSA_TASK_ENABLE */ - -/*! - * @brief Puts the active task to the end of scheduler's queue. - * - * When a task calls this function, it gives up the CPU and puts itself to the - * end of a task ready list. - * - * @retval KOSA_StatusSuccess The function is called successfully. - * @retval KOSA_StatusError Error occurs with this function. - */ -#if ((defined(FSL_OSA_TASK_ENABLE)) && (FSL_OSA_TASK_ENABLE > 0U)) -osa_status_t OSA_TaskYield(void); -#endif /* FSL_OSA_TASK_ENABLE */ - -/*! - * @brief Gets the priority of a task. - * - * @param taskHandle The handler of the task whose priority is received. - * - * @return Task's priority. - */ -#if ((defined(FSL_OSA_TASK_ENABLE)) && (FSL_OSA_TASK_ENABLE > 0U)) -osa_task_priority_t OSA_TaskGetPriority(osa_task_handle_t taskHandle); -#endif /* FSL_OSA_TASK_ENABLE */ - -/*! - * @brief Sets the priority of a task. - * - * @param taskHandle The handler of the task whose priority is set. - * @param taskPriority The priority to set. - * - * @retval KOSA_StatusSuccess Task's priority is set successfully. - * @retval KOSA_StatusError Task's priority can not be set. - */ -#if ((defined(FSL_OSA_TASK_ENABLE)) && (FSL_OSA_TASK_ENABLE > 0U)) -osa_status_t OSA_TaskSetPriority(osa_task_handle_t taskHandle, osa_task_priority_t taskPriority); -#endif /* FSL_OSA_TASK_ENABLE */ - -/*! - * @brief Destroys a previously created task. - * - * @param taskHandle The handler of the task to destroy. - * - * @retval KOSA_StatusSuccess The task was successfully destroyed. - * @retval KOSA_StatusError Task destruction failed or invalid parameter. - */ -#if ((defined(FSL_OSA_TASK_ENABLE)) && (FSL_OSA_TASK_ENABLE > 0U)) -osa_status_t OSA_TaskDestroy(osa_task_handle_t taskHandle); -#endif /* FSL_OSA_TASK_ENABLE */ - -/*! - * @brief Creates a semaphore with a given value. - * - * This function creates a semaphore and sets the value to the parameter - * initValue. - * - * Example below shows how to use this API to create the semaphore handle. - * @code - * OSA_SEMAPHORE_HANDLE_DEFINE(semaphoreHandle); - * OSA_SemaphoreCreate((osa_semaphore_handle_t)semaphoreHandle, 0xff); - * @endcode - * - * @param semaphoreHandle Pointer to a memory space of size OSA_SEM_HANDLE_SIZE allocated by the caller. - * The handle should be 4 byte aligned, because unaligned access doesn't be supported on some devices. - * You can define the handle in the following two ways: - * #OSA_SEMAPHORE_HANDLE_DEFINE(semaphoreHandle); - * or - * uint32_t semaphoreHandle[((OSA_SEM_HANDLE_SIZE + sizeof(uint32_t) - 1U) / sizeof(uint32_t))]; - * @param initValue Initial value the semaphore will be set to. - * - * @retval KOSA_StatusSuccess the new semaphore if the semaphore is created successfully. - * @retval KOSA_StatusError if the semaphore can not be created. - */ -osa_status_t OSA_SemaphoreCreate(osa_semaphore_handle_t semaphoreHandle, uint32_t initValue); - -/*! - * @brief Destroys a previously created semaphore. - * - * @param semaphoreHandle The semaphore handle. - * The macro SEMAPHORE_HANDLE_BUFFER_GET is used to get the semaphore buffer pointer, - * and should not be used before the macro SEMAPHORE_HANDLE_BUFFER_DEFINE is used. - * - * @retval KOSA_StatusSuccess The semaphore is successfully destroyed. - * @retval KOSA_StatusError The semaphore can not be destroyed. - */ -osa_status_t OSA_SemaphoreDestroy(osa_semaphore_handle_t semaphoreHandle); - -/*! - * @brief Pending a semaphore with timeout. - * - * This function checks the semaphore's counting value. If it is positive, - * decreases it and returns KOSA_StatusSuccess. Otherwise, a timeout is used - * to wait. - * - * @param semaphoreHandle The semaphore handle. - * @param millisec The maximum number of milliseconds to wait if semaphore is not - * positive. Pass osaWaitForever_c to wait indefinitely, pass 0 - * will return KOSA_StatusTimeout immediately. - * - * @retval KOSA_StatusSuccess The semaphore is received. - * @retval KOSA_StatusTimeout The semaphore is not received within the specified 'timeout'. - * @retval KOSA_StatusError An incorrect parameter was passed. - */ -osa_status_t OSA_SemaphoreWait(osa_semaphore_handle_t semaphoreHandle, uint32_t millisec); - -/*! - * @brief Signals for someone waiting on the semaphore to wake up. - * - * Wakes up one task that is waiting on the semaphore. If no task is waiting, increases - * the semaphore's counting value. - * - * @param semaphoreHandle The semaphore handle to signal. - * - * @retval KOSA_StatusSuccess The semaphore is successfully signaled. - * @retval KOSA_StatusError The object can not be signaled or invalid parameter. - * - */ -osa_status_t OSA_SemaphorePost(osa_semaphore_handle_t semaphoreHandle); - -/*! - * @brief Create an unlocked mutex. - * - * This function creates a non-recursive mutex and sets it to unlocked status. - * - * Example below shows how to use this API to create the mutex handle. - * @code - * OSA_MUTEX_HANDLE_DEFINE(mutexHandle); - * OSA_MutexCreate((osa_mutex_handle_t)mutexHandle); - * @endcode - * - * @param mutexHandle Pointer to a memory space of size OSA_MUTEX_HANDLE_SIZE allocated by the caller. - * The handle should be 4 byte aligned, because unaligned access doesn't be supported on some devices. - * You can define the handle in the following two ways: - * #OSA_MUTEX_HANDLE_DEFINE(mutexHandle); - * or - * uint32_t mutexHandle[((OSA_MUTEX_HANDLE_SIZE + sizeof(uint32_t) - 1U) / sizeof(uint32_t))]; - * @retval KOSA_StatusSuccess the new mutex if the mutex is created successfully. - * @retval KOSA_StatusError if the mutex can not be created. - */ -osa_status_t OSA_MutexCreate(osa_mutex_handle_t mutexHandle); - -/*! - * @brief Waits for a mutex and locks it. - * - * This function checks the mutex's status. If it is unlocked, locks it and returns the - * KOSA_StatusSuccess. Otherwise, waits for a timeout in milliseconds to lock. - * - * @param mutexHandle The mutex handle. - * @param millisec The maximum number of milliseconds to wait for the mutex. - * If the mutex is locked, Pass the value osaWaitForever_c will - * wait indefinitely, pass 0 will return KOSA_StatusTimeout - * immediately. - * - * @retval KOSA_StatusSuccess The mutex is locked successfully. - * @retval KOSA_StatusTimeout Timeout occurred. - * @retval KOSA_StatusError Incorrect parameter was passed. - * - * @note This is non-recursive mutex, a task can not try to lock the mutex it has locked. - */ -osa_status_t OSA_MutexLock(osa_mutex_handle_t mutexHandle, uint32_t millisec); - -/*! - * @brief Unlocks a previously locked mutex. - * - * @param mutexHandle The mutex handle. - * - * @retval KOSA_StatusSuccess The mutex is successfully unlocked. - * @retval KOSA_StatusError The mutex can not be unlocked or invalid parameter. - */ -osa_status_t OSA_MutexUnlock(osa_mutex_handle_t mutexHandle); - -/*! - * @brief Destroys a previously created mutex. - * - * @param mutexHandle The mutex handle. - * - * @retval KOSA_StatusSuccess The mutex is successfully destroyed. - * @retval KOSA_StatusError The mutex can not be destroyed. - * - */ -osa_status_t OSA_MutexDestroy(osa_mutex_handle_t mutexHandle); - -/*! - * @brief Initializes an event object with all flags cleared. - * - * This function creates an event object and set its clear mode. If autoClear - * is 1, when a task gets the event flags, these flags will be - * cleared automatically. Otherwise these flags must - * be cleared manually. - * - * Example below shows how to use this API to create the event handle. - * @code - * OSA_EVENT_HANDLE_DEFINE(eventHandle); - * OSA_EventCreate((osa_event_handle_t)eventHandle, 0); - * @endcode - * - * @param eventHandle Pointer to a memory space of size OSA_EVENT_HANDLE_SIZE allocated by the caller. - * The handle should be 4 byte aligned, because unaligned access doesn't be supported on some devices. - * You can define the handle in the following two ways: - * #OSA_EVENT_HANDLE_DEFINE(eventHandle); - * or - * uint32_t eventHandle[((OSA_EVENT_HANDLE_SIZE + sizeof(uint32_t) - 1U) / sizeof(uint32_t))]; - * @param autoClear 1 The event is auto-clear. - * 0 The event manual-clear - * @retval KOSA_StatusSuccess the new event if the event is created successfully. - * @retval KOSA_StatusError if the event can not be created. - */ -osa_status_t OSA_EventCreate(osa_event_handle_t eventHandle, uint8_t autoClear); - -/*! - * @brief Sets one or more event flags. - * - * Sets specified flags of an event object. - * - * @param eventHandle The event handle. - * @param flagsToSet Flags to be set. - * - * @retval KOSA_StatusSuccess The flags were successfully set. - * @retval KOSA_StatusError An incorrect parameter was passed. - */ -osa_status_t OSA_EventSet(osa_event_handle_t eventHandle, osa_event_flags_t flagsToSet); - -/*! - * @brief Clears one or more flags. - * - * Clears specified flags of an event object. - * - * @param eventHandle The event handle. - * @param flagsToClear Flags to be clear. - * - * @retval KOSA_StatusSuccess The flags were successfully cleared. - * @retval KOSA_StatusError An incorrect parameter was passed. - */ -osa_status_t OSA_EventClear(osa_event_handle_t eventHandle, osa_event_flags_t flagsToClear); - -/*! - * @brief Get event's flags. - * - * Get specified flags of an event object. - * - * @param eventHandle The event handle. - * The macro EVENT_HANDLE_BUFFER_GET is used to get the event buffer pointer, - * and should not be used before the macro EVENT_HANDLE_BUFFER_DEFINE is used. - * @param flagsMask The flags user want to get are specified by this parameter. - * @param pFlagsOfEvent The event flags are obtained by this parameter. - * - * @retval KOSA_StatusSuccess The event flags were successfully got. - * @retval KOSA_StatusError An incorrect parameter was passed. - */ -osa_status_t OSA_EventGet(osa_event_handle_t eventHandle, - osa_event_flags_t flagsMask, - osa_event_flags_t *pFlagsOfEvent); - -/*! - * @brief Waits for specified event flags to be set. - * - * This function waits for a combination of flags to be set in an event object. - * Applications can wait for any/all bits to be set. Also this function could - * obtain the flags who wakeup the waiting task. - * - * @param eventHandle The event handle. - * @param flagsToWait Flags that to wait. - * @param waitAll Wait all flags or any flag to be set. - * @param millisec The maximum number of milliseconds to wait for the event. - * If the wait condition is not met, pass osaWaitForever_c will - * wait indefinitely, pass 0 will return KOSA_StatusTimeout - * immediately. - * @param pSetFlags Flags that wakeup the waiting task are obtained by this parameter. - * - * @retval KOSA_StatusSuccess The wait condition met and function returns successfully. - * @retval KOSA_StatusTimeout Has not met wait condition within timeout. - * @retval KOSA_StatusError An incorrect parameter was passed. - - * - * @note Please pay attention to the flags bit width, FreeRTOS uses the most - * significant 8 bis as control bits, so do not wait these bits while using - * FreeRTOS. - * - */ -osa_status_t OSA_EventWait(osa_event_handle_t eventHandle, - osa_event_flags_t flagsToWait, - uint8_t waitAll, - uint32_t millisec, - osa_event_flags_t *pSetFlags); - -/*! - * @brief Destroys a previously created event object. - * - * @param eventHandle The event handle. - * - * @retval KOSA_StatusSuccess The event is successfully destroyed. - * @retval KOSA_StatusError Event destruction failed. - */ -osa_status_t OSA_EventDestroy(osa_event_handle_t eventHandle); - -/*! - * @brief Initializes a message queue. - * - * This function allocates memory for and initializes a message queue. Message queue elements are hardcoded as void*. - * - * Example below shows how to use this API to create the massage queue handle. - * @code - * OSA_MSGQ_HANDLE_DEFINE(msgqHandle); - * OSA_MsgQCreate((osa_msgq_handle_t)msgqHandle, 5U, sizeof(msg)); - * @endcode - * - * @param msgqHandle Pointer to a memory space of size #(OSA_MSGQ_HANDLE_SIZE + msgNo*msgSize) on bare-matel - * and #(OSA_MSGQ_HANDLE_SIZE) on FreeRTOS allocated by the caller, message queue handle. - * The handle should be 4 byte aligned, because unaligned access doesn't be supported on some devices. - * You can define the handle in the following two ways: - * #OSA_MSGQ_HANDLE_DEFINE(msgqHandle); - * or - * For bm: uint32_t msgqHandle[((OSA_MSGQ_HANDLE_SIZE + msgNo*msgSize + sizeof(uint32_t) - 1U) / sizeof(uint32_t))]; - * For freertos: uint32_t msgqHandle[((OSA_MSGQ_HANDLE_SIZE + sizeof(uint32_t) - 1U) / sizeof(uint32_t))]; - * @param msgNo :number of messages the message queue should accommodate. - * @param msgSize :size of a single message structure. - * - * @retval KOSA_StatusSuccess Message queue successfully Create. - * @retval KOSA_StatusError Message queue create failure. - */ -osa_status_t OSA_MsgQCreate(osa_msgq_handle_t msgqHandle, uint32_t msgNo, uint32_t msgSize); - -/*! - * @brief Puts a message at the end of the queue. - * - * This function puts a message to the end of the message queue. If the queue - * is full, this function returns the KOSA_StatusError; - * - * @param msgqHandle Message Queue handler. - * @param pMessage Pointer to the message to be put into the queue. - * - * @retval KOSA_StatusSuccess Message successfully put into the queue. - * @retval KOSA_StatusError The queue was full or an invalid parameter was passed. - */ -osa_status_t OSA_MsgQPut(osa_msgq_handle_t msgqHandle, osa_msg_handle_t pMessage); - -/*! - * @brief Reads and remove a message at the head of the queue. - * - * This function gets a message from the head of the message queue. If the - * queue is empty, timeout is used to wait. - * - * @param msgqHandle Message Queue handler. - * @param pMessage Pointer to a memory to save the message. - * @param millisec The number of milliseconds to wait for a message. If the - * queue is empty, pass osaWaitForever_c will wait indefinitely, - * pass 0 will return KOSA_StatusTimeout immediately. - * - * @retval KOSA_StatusSuccess Message successfully obtained from the queue. - * @retval KOSA_StatusTimeout The queue remains empty after timeout. - * @retval KOSA_StatusError Invalid parameter. - */ -osa_status_t OSA_MsgQGet(osa_msgq_handle_t msgqHandle, osa_msg_handle_t pMessage, uint32_t millisec); - -/*! - * @brief Destroys a previously created queue. - * - * @param msgqHandle Message Queue handler. - * - * @retval KOSA_StatusSuccess The queue was successfully destroyed. - * @retval KOSA_StatusError Message queue destruction failed. - */ -osa_status_t OSA_MsgQDestroy(osa_msgq_handle_t msgqHandle); - -/*! - * @brief Enable all interrupts. - */ -void OSA_InterruptEnable(void); - -/*! - * @brief Disable all interrupts. - */ -void OSA_InterruptDisable(void); - -/*! - * @brief Enable all interrupts using PRIMASK. - */ -void OSA_EnableIRQGlobal(void); - -/*! - * @brief Disable all interrupts using PRIMASK. - */ -void OSA_DisableIRQGlobal(void); - -/*! - * @brief Delays execution for a number of milliseconds. - * - * @param millisec The time in milliseconds to wait. - */ -void OSA_TimeDelay(uint32_t millisec); - -/*! - * @brief This function gets current time in milliseconds. - * - * @retval current time in milliseconds - */ -uint32_t OSA_TimeGetMsec(void); - -/*! - * @brief Installs the interrupt handler. - * - * @param IRQNumber IRQ number of the interrupt. - * @param handler The interrupt handler to install. - */ -void OSA_InstallIntHandler(uint32_t IRQNumber, void (*handler)(void)); - -/*! @}*/ -#ifdef __cplusplus -} -#endif -/*! @}*/ -#endif diff --git a/bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/drivers/fsl_os_abstraction_config.h b/bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/drivers/fsl_os_abstraction_config.h deleted file mode 100644 index 234cf972bc..0000000000 --- a/bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/drivers/fsl_os_abstraction_config.h +++ /dev/null @@ -1,36 +0,0 @@ -/*! - * Copyright (c) 2015, Freescale Semiconductor, Inc. - * Copyright 2016-2018 NXP - * - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#ifndef _FSL_OS_ABSTRACTION_CONFIG_H_ -#define _FSL_OS_ABSTRACTION_CONFIG_H_ - -#ifndef gMainThreadStackSize_c -#define gMainThreadStackSize_c 1024 -#endif - -#ifndef gMainThreadPriority_c -#define gMainThreadPriority_c 1 -#endif - -#ifndef gTaskMultipleInstancesManagement_c -#define gTaskMultipleInstancesManagement_c 0 -#endif - -/*! @brief Definition to determine whether enable OSA's TASK module. */ -#ifndef OSA_USED -#ifndef FSL_OSA_TASK_ENABLE -#define FSL_OSA_TASK_ENABLE 0U -#endif -#else -#if defined(FSL_OSA_TASK_ENABLE) -#undef FSL_OSA_TASK_ENABLE -#endif -#define FSL_OSA_TASK_ENABLE 1U -#endif /* OSA_USED */ - -#endif /* _FSL_OS_ABSTRACTION_CONFIG_H_ */ diff --git a/bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/drivers/fsl_os_abstraction_rtthread.c b/bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/drivers/fsl_os_abstraction_rtthread.c deleted file mode 100644 index afef3d5fca..0000000000 --- a/bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/drivers/fsl_os_abstraction_rtthread.c +++ /dev/null @@ -1,917 +0,0 @@ -/*! ********************************************************************************* - * Copyright (c) 2015, Freescale Semiconductor, Inc. - * Copyright 2016-2017, 2019 NXP - * All rights reserved. - * - * - * This is the source file for the OS Abstraction layer for freertos. - * - * SPDX-License-Identifier: BSD-3-Clause - ********************************************************************************** */ - -/*! ********************************************************************************* -************************************************************************************* -* Include -************************************************************************************* -********************************************************************************** */ -#include "fsl_common.h" -#include "fsl_os_abstraction.h" -#include "fsl_os_abstraction_rtthread.h" -#include -#include "generic_list.h" - -/*! ********************************************************************************* -************************************************************************************* -* Private macros -************************************************************************************* -********************************************************************************** */ - -/* Weak function. */ -#if defined(__GNUC__) -#define __WEAK_FUNC __attribute__((weak)) -#elif defined(__ICCARM__) -#define __WEAK_FUNC __weak -#elif defined(__CC_ARM) || defined(__ARMCC_VERSION) -#define __WEAK_FUNC __attribute__((weak)) -#endif - -#define millisecToTicks(millisec) (((millisec)*configTICK_RATE_HZ + 999U) / 1000U) - -#ifdef DEBUG_ASSERT -#define OS_ASSERT(condition) \ - if (!(condition)) \ - while (1) \ - ; -#else -#define OS_ASSERT(condition) (void)(condition); -#endif - -/*! @brief Converts milliseconds to ticks*/ -#define MSEC_TO_TICK(msec) \ - (((uint32_t)(msec) + 500uL / (uint32_t)configTICK_RATE_HZ) * (uint32_t)configTICK_RATE_HZ / 1000uL) -#define TICKS_TO_MSEC(tick) ((uint32_t)((uint64_t)(tick)*1000uL / (uint64_t)configTICK_RATE_HZ)) -/************************************************************************************ -************************************************************************************* -* Private type definitions -************************************************************************************* -************************************************************************************/ -typedef struct osa_freertos_task -{ - list_element_t link; - rt_thread_t taskHandle; -} osa_freertos_task_t; - -typedef struct _osa_event_struct -{ - rt_event_t handle; /* The event handle */ - uint8_t autoClear; /*!< Auto clear or manual clear */ -} osa_event_struct_t; - -/*! @brief State structure for bm osa manager. */ -typedef struct _osa_state -{ -#if (defined(FSL_OSA_TASK_ENABLE) && (FSL_OSA_TASK_ENABLE > 0U)) - list_label_t taskList; - OSA_TASK_HANDLE_DEFINE(mainTaskHandle); -#endif - uint32_t basePriority; - int32_t basePriorityNesting; - uint32_t interruptDisableCount; -} osa_state_t; - -/*! ********************************************************************************* -************************************************************************************* -* Private prototypes -************************************************************************************* -********************************************************************************** */ -__WEAK_FUNC void main_task(void const *argument); -__WEAK_FUNC void main_task(void const *argument) -{ -} - -void startup_task(void *argument); - -/*! ********************************************************************************* -************************************************************************************* -* Public memory declarations -************************************************************************************* -********************************************************************************** */ -const uint8_t gUseRtos_c = USE_RTOS; // USE_RTOS = 0 for BareMetal and 1 for OS - -static osa_state_t s_osaState = {0}; -/*! ********************************************************************************* -************************************************************************************* -* Private memory declarations -************************************************************************************* -********************************************************************************** */ - -/*! ********************************************************************************* -************************************************************************************* -* Public functions -************************************************************************************* -********************************************************************************** */ -/*FUNCTION********************************************************************** - * - * Function Name : OSA_MemoryAllocate - * Description : Reserves the requested amount of memory in bytes. - * - *END**************************************************************************/ -void *OSA_MemoryAllocate(uint32_t length) -{ - void *p = rt_malloc(length); - - if (RT_NULL != p) - { - rt_memset(p, 0, length); - } - - return p; -} - -/*FUNCTION********************************************************************** - * - * Function Name : OSA_MemoryFree - * Description : Frees the memory previously reserved. - * - *END**************************************************************************/ -void OSA_MemoryFree(void *p) -{ - rt_free(p); -} - -void OSA_EnterCritical(uint32_t *sr) -{ - if (rt_thread_self() != RT_NULL) - rt_enter_critical(); -} - -void OSA_ExitCritical(uint32_t sr) -{ - if (rt_thread_self() != RT_NULL) - rt_exit_critical(); -} - -/*FUNCTION********************************************************************** - * - * Function Name : startup_task - * Description : Wrapper over main_task.. - * - *END**************************************************************************/ -void startup_task(void *argument) -{ - main_task(argument); -} - -/*FUNCTION********************************************************************** - * - * Function Name : OSA_TaskGetCurrentHandle - * Description : This function is used to get current active task's handler. - * - *END**************************************************************************/ -#if (defined(FSL_OSA_TASK_ENABLE) && (FSL_OSA_TASK_ENABLE > 0U)) -osa_task_handle_t OSA_TaskGetCurrentHandle(void) -{ - list_element_handle_t list_element; - osa_freertos_task_t *ptask; - - list_element = LIST_GetHead(&s_osaState.taskList); - while (NULL != list_element) - { - ptask = (osa_freertos_task_t *)(void *)list_element; - if (ptask->taskHandle == xTaskGetCurrentTaskHandle()) - { - return (osa_task_handle_t)ptask; - } - list_element = LIST_GetNext(list_element); - } - return NULL; -} -#endif - -/*FUNCTION********************************************************************** - * - * Function Name : OSA_TaskYield - * Description : When a task calls this function, it will give up CPU and put - * itself to the tail of ready list. - * - *END**************************************************************************/ -#if (defined(FSL_OSA_TASK_ENABLE) && (FSL_OSA_TASK_ENABLE > 0U)) -osa_status_t OSA_TaskYield(void) -{ - taskYIELD(); - return KOSA_StatusSuccess; -} -#endif - -/*FUNCTION********************************************************************** - * - * Function Name : OSA_TaskGetPriority - * Description : This function returns task's priority by task handler. - * - *END**************************************************************************/ -#if (defined(FSL_OSA_TASK_ENABLE) && (FSL_OSA_TASK_ENABLE > 0U)) -osa_task_priority_t OSA_TaskGetPriority(osa_task_handle_t taskHandle) -{ - assert(taskHandle); - osa_freertos_task_t *ptask = (osa_freertos_task_t *)taskHandle; - return (osa_task_priority_t)(PRIORITY_RTOS_TO_OSA(uxTaskPriorityGet(ptask->taskHandle))); -} -#endif - -/*FUNCTION********************************************************************** - * - * Function Name : OSA_TaskSetPriority - * Description : This function sets task's priority by task handler. - * - *END**************************************************************************/ -#if (defined(FSL_OSA_TASK_ENABLE) && (FSL_OSA_TASK_ENABLE > 0U)) -osa_status_t OSA_TaskSetPriority(osa_task_handle_t taskHandle, osa_task_priority_t taskPriority) -{ - assert(taskHandle); - osa_freertos_task_t *ptask = (osa_freertos_task_t *)taskHandle; - vTaskPrioritySet((task_handler_t)ptask->taskHandle, PRIORITY_OSA_TO_RTOS(taskPriority)); - return KOSA_StatusSuccess; -} -#endif - -/*FUNCTION********************************************************************** - * - * Function Name : OSA_TaskCreate - * Description : This function is used to create a task and make it ready. - * Param[in] : threadDef - Definition of the thread. - * task_param - Parameter to pass to the new thread. - * Return Thread handle of the new thread, or NULL if failed. - * - *END**************************************************************************/ -#if (defined(FSL_OSA_TASK_ENABLE) && (FSL_OSA_TASK_ENABLE > 0U)) -osa_status_t OSA_TaskCreate(osa_task_handle_t taskHandle, osa_task_def_t *thread_def, osa_task_param_t task_param) -{ - assert(sizeof(osa_freertos_task_t) == OSA_TASK_HANDLE_SIZE); - assert(taskHandle); - TaskHandle_t pxCreatedTask; - osa_freertos_task_t *ptask = (osa_freertos_task_t *)taskHandle; - - if (xTaskCreate((TaskFunction_t)thread_def->pthread, /* pointer to the task */ - (char const *)thread_def->tname, /* task name for kernel awareness debugging */ - (configSTACK_DEPTH_TYPE)thread_def->stacksize / sizeof(portSTACK_TYPE), /* task stack size */ - (task_param_t)task_param, /* optional task startup argument */ - PRIORITY_OSA_TO_RTOS(thread_def->tpriority), /* initial priority */ - &pxCreatedTask /* optional task handle to create */ - ) == pdPASS) - { - ptask->taskHandle = pxCreatedTask; - OSA_InterruptDisable(); - (void)LIST_AddTail(&s_osaState.taskList, (list_element_handle_t) & (ptask->link)); - OSA_InterruptEnable(); - return KOSA_StatusSuccess; - } - return KOSA_StatusError; -} -#endif - -/*FUNCTION********************************************************************** - * - * Function Name : OSA_TaskDestroy - * Description : This function destroy a task. - * Param[in] :taskHandle - Thread handle. - * Return KOSA_StatusSuccess if the task is destroied, otherwise return KOSA_StatusError. - * - *END**************************************************************************/ -#if (defined(FSL_OSA_TASK_ENABLE) && (FSL_OSA_TASK_ENABLE > 0U)) -osa_status_t OSA_TaskDestroy(osa_task_handle_t taskHandle) -{ - assert(taskHandle); - osa_freertos_task_t *ptask = (osa_freertos_task_t *)taskHandle; - osa_status_t status; - uint16_t oldPriority; - /*Change priority to avoid context switches*/ - oldPriority = OSA_TaskGetPriority(OSA_TaskGetCurrentHandle()); - (void)OSA_TaskSetPriority(OSA_TaskGetCurrentHandle(), OSA_PRIORITY_REAL_TIME); -#if INCLUDE_vTaskDelete /* vTaskDelete() enabled */ - vTaskDelete((task_handler_t)ptask->taskHandle); - status = KOSA_StatusSuccess; -#else - status = KOSA_StatusError; /* vTaskDelete() not available */ -#endif - (void)OSA_TaskSetPriority(OSA_TaskGetCurrentHandle(), oldPriority); - OSA_InterruptDisable(); - (void)LIST_RemoveElement(taskHandle); - OSA_InterruptEnable(); - return status; -} -#endif - -/*FUNCTION********************************************************************** - * - * Function Name : OSA_TimeDelay - * Description : This function is used to suspend the active thread for the given number of milliseconds. - * - *END**************************************************************************/ -void OSA_TimeDelay(uint32_t millisec) -{ - rt_thread_mdelay(millisec); -} -/*FUNCTION********************************************************************** - * - * Function Name : OSA_TimeGetMsec - * Description : This function gets current time in milliseconds. - * - *END**************************************************************************/ -uint32_t OSA_TimeGetMsec(void) -{ - return rt_tick_get_millisecond(); -} -/*FUNCTION********************************************************************** - * - * Function Name : OSA_SemaphoreCreate - * Description : This function is used to create a semaphore. - * Return : Semaphore handle of the new semaphore, or NULL if failed. - * - *END**************************************************************************/ -osa_status_t OSA_SemaphoreCreate(osa_semaphore_handle_t semaphoreHandle, uint32_t initValue) -{ - assert(sizeof(osa_semaphore_handle_t) == OSA_SEM_HANDLE_SIZE); - assert(semaphoreHandle); - - union - { - rt_sem_t sem; - uint32_t semhandle; - } xSemaHandle; - - xSemaHandle.sem = rt_sem_create("osa_sem", initValue, RT_IPC_FLAG_PRIO); - if (NULL != xSemaHandle.sem) - { - *(uint32_t *)semaphoreHandle = xSemaHandle.semhandle; - return KOSA_StatusSuccess; - } - return KOSA_StatusError; -} - -/*FUNCTION********************************************************************** - * - * Function Name : OSA_SemaphoreDestroy - * Description : This function is used to destroy a semaphore. - * Return : KOSA_StatusSuccess if the semaphore is destroyed successfully, otherwise return KOSA_StatusError. - * - *END**************************************************************************/ -osa_status_t OSA_SemaphoreDestroy(osa_semaphore_handle_t semaphoreHandle) -{ - assert(semaphoreHandle); - rt_sem_t sem = (rt_sem_t)(void *)(uint32_t *)(*(uint32_t *)semaphoreHandle); - - rt_sem_delete(sem); - return KOSA_StatusSuccess; -} - -/*FUNCTION********************************************************************** - * - * Function Name : OSA_SemaphoreWait - * Description : This function checks the semaphore's counting value, if it is - * positive, decreases it and returns KOSA_StatusSuccess, otherwise, timeout - * will be used for wait. The parameter timeout indicates how long should wait - * in milliseconds. Pass osaWaitForever_c to wait indefinitely, pass 0 will - * return KOSA_StatusTimeout immediately if semaphore is not positive. - * This function returns KOSA_StatusSuccess if the semaphore is received, returns - * KOSA_StatusTimeout if the semaphore is not received within the specified - * 'timeout', returns KOSA_StatusError if any errors occur during waiting. - * - *END**************************************************************************/ -osa_status_t OSA_SemaphoreWait(osa_semaphore_handle_t semaphoreHandle, uint32_t millisec) -{ - uint32_t timeoutTicks; - assert(semaphoreHandle); - rt_sem_t sem = (rt_sem_t)(void *)(uint32_t *)(*(uint32_t *)semaphoreHandle); - - /* Convert timeout from millisecond to tick. */ - if (millisec == osaWaitForever_c) - { - timeoutTicks = RT_WAITING_FOREVER; - } - else - { - timeoutTicks = rt_tick_from_millisecond(millisec); - } - - if (RT_EOK != rt_sem_take(sem, timeoutTicks)) - { - return KOSA_StatusTimeout; /* timeout */ - } - else - { - return KOSA_StatusSuccess; /* semaphore taken */ - } -} - -/*FUNCTION********************************************************************** - * - * Function Name : OSA_SemaphorePost - * Description : This function is used to wake up one task that wating on the - * semaphore. If no task is waiting, increase the semaphore. The function returns - * KOSA_StatusSuccess if the semaphre is post successfully, otherwise returns - * KOSA_StatusError. - * - *END**************************************************************************/ -osa_status_t OSA_SemaphorePost(osa_semaphore_handle_t semaphoreHandle) -{ - assert(semaphoreHandle); - rt_sem_t sem = (rt_sem_t)(void *)(uint32_t *)(*(uint32_t *)semaphoreHandle); - rt_sem_release(sem); - return KOSA_StatusSuccess; -} - -/*FUNCTION********************************************************************** - * - * Function Name : OSA_MutexCreate - * Description : This function is used to create a mutex. - * Return : Mutex handle of the new mutex, or NULL if failed. - * - *END**************************************************************************/ -osa_status_t OSA_MutexCreate(osa_mutex_handle_t mutexHandle) -{ - assert(sizeof(osa_mutex_handle_t) == OSA_MUTEX_HANDLE_SIZE); - assert(mutexHandle); - - union - { - rt_mutex_t mutex; - uint32_t pmutexHandle; - } xMutexHandle; - - xMutexHandle.mutex = rt_mutex_create("osa_mutex", RT_IPC_FLAG_PRIO); - if (RT_NULL != xMutexHandle.mutex) - { - *(uint32_t *)mutexHandle = xMutexHandle.pmutexHandle; - return KOSA_StatusSuccess; - } - return KOSA_StatusError; -} - -/*FUNCTION********************************************************************** - * - * Function Name : OSA_MutexLock - * Description : This function checks the mutex's status, if it is unlocked, - * lock it and returns KOSA_StatusSuccess, otherwise, wait for the mutex. - * This function returns KOSA_StatusSuccess if the mutex is obtained, returns - * KOSA_StatusError if any errors occur during waiting. If the mutex has been - * locked, pass 0 as timeout will return KOSA_StatusTimeout immediately. - * - *END**************************************************************************/ -osa_status_t OSA_MutexLock(osa_mutex_handle_t mutexHandle, uint32_t millisec) -{ - assert(mutexHandle); - uint32_t timeoutTicks; - rt_mutex_t mutex = (rt_mutex_t)(void *)(uint32_t *)(*(uint32_t *)mutexHandle); - - /* Convert timeout from millisecond to tick. */ - if (millisec == osaWaitForever_c) - { - timeoutTicks = RT_WAITING_FOREVER; - } - else - { - timeoutTicks = rt_tick_from_millisecond(millisec); - } - - if (RT_EOK != rt_mutex_take(mutex, timeoutTicks)) - { - return KOSA_StatusTimeout; /* timeout */ - } - else - { - return KOSA_StatusSuccess; /* semaphore taken */ - } -} - -/*FUNCTION********************************************************************** - * - * Function Name : OSA_MutexUnlock - * Description : This function is used to unlock a mutex. - * - *END**************************************************************************/ -osa_status_t OSA_MutexUnlock(osa_mutex_handle_t mutexHandle) -{ - assert(mutexHandle); - rt_mutex_t mutex = (rt_mutex_t)(void *)(uint32_t *)(*(uint32_t *)mutexHandle); - rt_mutex_release(mutex); - return KOSA_StatusSuccess; -} - -/*FUNCTION********************************************************************** - * - * Function Name : OSA_MutexDestroy - * Description : This function is used to destroy a mutex. - * Return : KOSA_StatusSuccess if the lock object is destroyed successfully, otherwise return KOSA_StatusError. - * - *END**************************************************************************/ -osa_status_t OSA_MutexDestroy(osa_mutex_handle_t mutexHandle) -{ - assert(mutexHandle); - rt_mutex_t mutex = (rt_mutex_t)(void *)(uint32_t *)(*(uint32_t *)mutexHandle); - - rt_mutex_delete(mutex); - return KOSA_StatusSuccess; -} - -/*FUNCTION********************************************************************** - * - * Function Name : OSA_EventCreate - * Description : This function is used to create a event object. - * Return : Event handle of the new event, or NULL if failed. - * - *END**************************************************************************/ -osa_status_t OSA_EventCreate(osa_event_handle_t eventHandle, uint8_t autoClear) -{ - assert(eventHandle); - osa_event_struct_t *pEventStruct = (osa_event_struct_t *)eventHandle; - - pEventStruct->handle = rt_event_create("osa_event", RT_IPC_FLAG_PRIO); - if (RT_NULL != pEventStruct->handle) - { - pEventStruct->autoClear = autoClear; - } - else - { - return KOSA_StatusError; - } - return KOSA_StatusSuccess; -} - -/*FUNCTION********************************************************************** - * - * Function Name : OSA_EventSet - * Description : Set one or more event flags of an event object. - * Return : KOSA_StatusSuccess if set successfully, KOSA_StatusError if failed. - * - *END**************************************************************************/ -osa_status_t OSA_EventSet(osa_event_handle_t eventHandle, osa_event_flags_t flagsToSet) -{ - rt_err_t result; - assert(eventHandle); - osa_event_struct_t *pEventStruct = (osa_event_struct_t *)eventHandle; - - if (RT_NULL == pEventStruct->handle) - { - return KOSA_StatusError; - } - - rt_event_send(pEventStruct->handle, (rt_uint32_t)flagsToSet); - - (void)result; - return KOSA_StatusSuccess; -} - -/*FUNCTION********************************************************************** - * - * Function Name : OSA_EventClear - * Description : Clear one or more event flags of an event object. - * Return :KOSA_StatusSuccess if clear successfully, KOSA_StatusError if failed. - * - *END**************************************************************************/ -osa_status_t OSA_EventClear(osa_event_handle_t eventHandle, osa_event_flags_t flagsToClear) -{ - assert(eventHandle); - osa_event_struct_t *pEventStruct = (osa_event_struct_t *)eventHandle; - - if (RT_NULL == pEventStruct->handle) - { - return KOSA_StatusError; - } - - rt_uint32_t recved; - rt_event_recv(pEventStruct->handle, (rt_uint32_t)flagsToClear, RT_EVENT_FLAG_OR | RT_EVENT_FLAG_CLEAR, 0, &recved); - - return KOSA_StatusSuccess; -} - -/*FUNCTION********************************************************************** - * - * Function Name : OSA_EventGet - * Description : This function is used to get event's flags that specified by prameter - * flagsMask, and the flags (user specified) are obatianed by parameter pFlagsOfEvent. So - * you should pass the parameter 0xffffffff to specify you want to check all. - * Return :KOSA_StatusSuccess if event flags were successfully got, KOSA_StatusError if failed. - * - *END**************************************************************************/ -osa_status_t OSA_EventGet(osa_event_handle_t eventHandle, osa_event_flags_t flagsMask, osa_event_flags_t *pFlagsOfEvent) -{ - assert(eventHandle); - osa_event_struct_t *pEventStruct = (osa_event_struct_t *)eventHandle; - rt_uint32_t eventFlags; - - if (RT_NULL == pEventStruct->handle) - { - return KOSA_StatusError; - } - - if (RT_NULL == pFlagsOfEvent) - { - return KOSA_StatusError; - } - - if (RT_EOK != rt_event_recv(pEventStruct->handle, (rt_uint32_t)flagsMask, RT_EVENT_FLAG_OR, 0, &eventFlags)) - { - eventFlags = 0; - } - - *pFlagsOfEvent = (osa_event_flags_t)eventFlags & flagsMask; - - return KOSA_StatusSuccess; -} - -/*FUNCTION********************************************************************** - * - * Function Name : OSA_EventWait - * Description : This function checks the event's status, if it meets the wait - * condition, return KOSA_StatusSuccess, otherwise, timeout will be used for - * wait. The parameter timeout indicates how long should wait in milliseconds. - * Pass osaWaitForever_c to wait indefinitely, pass 0 will return the value - * KOSA_StatusTimeout immediately if wait condition is not met. The event flags - * will be cleared if the event is auto clear mode. Flags that wakeup waiting - * task could be obtained from the parameter setFlags. - * This function returns KOSA_StatusSuccess if wait condition is met, returns - * KOSA_StatusTimeout if wait condition is not met within the specified - * 'timeout', returns KOSA_StatusError if any errors occur during waiting. - * - *END**************************************************************************/ -osa_status_t OSA_EventWait(osa_event_handle_t eventHandle, - osa_event_flags_t flagsToWait, - uint8_t waitAll, - uint32_t millisec, - osa_event_flags_t *pSetFlags) -{ - assert(eventHandle); - rt_uint8_t option = 0; - rt_uint32_t timeoutTicks; - rt_uint32_t flagsSave; - osa_event_struct_t *pEventStruct = (osa_event_struct_t *)eventHandle; - - /* Clean FreeRTOS cotrol flags */ - flagsToWait = flagsToWait & 0x00FFFFFFU; - if (RT_NULL == pEventStruct->handle) - { - return KOSA_StatusError; - } - - /* Convert timeout from millisecond to tick. */ - if (millisec == osaWaitForever_c) - { - timeoutTicks = RT_WAITING_FOREVER; - } - else - { - timeoutTicks = rt_tick_from_millisecond(millisec); - } - - if (pEventStruct->autoClear != 0U) - { - option |= RT_EVENT_FLAG_CLEAR; - } - option |= waitAll ? RT_EVENT_FLAG_AND : RT_EVENT_FLAG_OR; - - rt_err_t status = rt_event_recv(pEventStruct->handle, (rt_uint32_t)flagsToWait, option, timeoutTicks, &flagsSave); - - flagsSave &= (rt_uint32_t)flagsToWait; - if (RT_NULL != pSetFlags) - { - *pSetFlags = (osa_event_flags_t)flagsSave; - } - - if (RT_EOK != status) - { - return KOSA_StatusTimeout; - } - else - { - return KOSA_StatusSuccess; - } -} - -/*FUNCTION********************************************************************** - * - * Function Name : OSA_EventDestroy - * Description : This function is used to destroy a event object. Return - * KOSA_StatusSuccess if the event object is destroyed successfully, otherwise - * return KOSA_StatusError. - * - *END**************************************************************************/ -osa_status_t OSA_EventDestroy(osa_event_handle_t eventHandle) -{ - assert(eventHandle); - osa_event_struct_t *pEventStruct = (osa_event_struct_t *)eventHandle; - - if (RT_NULL == pEventStruct->handle) - { - return KOSA_StatusError; - } - rt_event_delete(pEventStruct->handle); - return KOSA_StatusSuccess; -} - -/*FUNCTION********************************************************************** - * - * Function Name : OSA_MsgQCreate - * Description : This function is used to create a message queue. - * Return : the handle to the message queue if create successfully, otherwise - * return NULL. - * - *END**************************************************************************/ -osa_status_t OSA_MsgQCreate(osa_msgq_handle_t msgqHandle, uint32_t msgNo, uint32_t msgSize) -{ - assert(sizeof(osa_msgq_handle_t) == OSA_MSGQ_HANDLE_SIZE); - assert(msgqHandle); - - union - { - rt_mq_t msgq; - uint32_t pmsgqHandle; - } xMsgqHandle; - - /* Create the message queue where the number and size is specified by msgNo and msgSize */ - xMsgqHandle.msgq = rt_mq_create("osa_mq", msgSize, msgNo, RT_IPC_FLAG_PRIO); - if (RT_NULL != xMsgqHandle.msgq) - { - *(uint32_t *)msgqHandle = xMsgqHandle.pmsgqHandle; - return KOSA_StatusSuccess; - } - return KOSA_StatusError; -} - -/*FUNCTION********************************************************************** - * - * Function Name : OSA_MsgQPut - * Description : This function is used to put a message to a message queue. - * Return : KOSA_StatusSuccess if the message is put successfully, otherwise return KOSA_StatusError. - * - *END**************************************************************************/ -osa_status_t OSA_MsgQPut(osa_msgq_handle_t msgqHandle, osa_msg_handle_t pMessage) -{ - assert(msgqHandle); - rt_mq_t handler = (rt_mq_t)(void *)(uint32_t *)(*(uint32_t *)msgqHandle); - - if (RT_EOK == rt_mq_send(handler, pMessage, handler->msg_size)) - { - return KOSA_StatusSuccess; - } - else - { - return KOSA_StatusError; - } -} - -/*FUNCTION********************************************************************** - * - * Function Name : OSA_MsgQGet - * Description : This function checks the queue's status, if it is not empty, - * get message from it and return KOSA_StatusSuccess, otherwise, timeout will - * be used for wait. The parameter timeout indicates how long should wait in - * milliseconds. Pass osaWaitForever_c to wait indefinitely, pass 0 will return - * KOSA_StatusTimeout immediately if queue is empty. - * This function returns KOSA_StatusSuccess if message is got successfully, - * returns KOSA_StatusTimeout if message queue is empty within the specified - * 'timeout', returns KOSA_StatusError if any errors occur during waiting. - * - *END**************************************************************************/ -osa_status_t OSA_MsgQGet(osa_msgq_handle_t msgqHandle, osa_msg_handle_t pMessage, uint32_t millisec) -{ - osa_status_t osaStatus; - assert(msgqHandle); - rt_mq_t handler = (rt_mq_t)(void *)(uint32_t *)(*(uint32_t *)msgqHandle); - - uint32_t timeoutTicks; - - if (millisec == osaWaitForever_c) - { - timeoutTicks = RT_WAITING_FOREVER; - } - else - { - timeoutTicks = rt_tick_from_millisecond(millisec); - } - if (RT_EOK != rt_mq_recv(handler, pMessage, handler->msg_size, timeoutTicks)) - { - osaStatus = KOSA_StatusTimeout; /* not able to send it to the queue? */ - } - else - { - osaStatus = KOSA_StatusSuccess; - } - return osaStatus; -} - -/*FUNCTION********************************************************************** - * - * Function Name : OSA_MsgQDestroy - * Description : This function is used to destroy the message queue. - * Return : KOSA_StatusSuccess if the message queue is destroyed successfully, otherwise return KOSA_StatusError. - * - *END**************************************************************************/ -osa_status_t OSA_MsgQDestroy(osa_msgq_handle_t msgqHandle) -{ - assert(msgqHandle); - rt_mq_t handler = (rt_mq_t)(void *)(uint32_t *)(*(uint32_t *)msgqHandle); - - rt_mq_delete(handler); - return KOSA_StatusSuccess; -} - -/*FUNCTION********************************************************************** - * - * Function Name : OSA_InterruptEnable - * Description : self explanatory. - * - *END**************************************************************************/ -void OSA_InterruptEnable(void) -{ - rt_exit_critical(); -} - -/*FUNCTION********************************************************************** - * - * Function Name : OSA_InterruptDisable - * Description : self explanatory. - * - *END**************************************************************************/ -void OSA_InterruptDisable(void) -{ - rt_enter_critical(); -} - -/*FUNCTION********************************************************************** - * - * Function Name : OSA_EnableIRQGlobal - * Description : enable interrupts using PRIMASK register. - * - *END**************************************************************************/ -void OSA_EnableIRQGlobal(void) -{ - if (s_osaState.interruptDisableCount > 0U) - { - s_osaState.interruptDisableCount--; - - if (0U == s_osaState.interruptDisableCount) - { - __enable_irq(); - } - /* call core API to enable the global interrupt*/ - } -} - -/*FUNCTION********************************************************************** - * - * Function Name : OSA_DisableIRQGlobal - * Description : disable interrupts using PRIMASK register. - * - *END**************************************************************************/ -void OSA_DisableIRQGlobal(void) -{ - /* call core API to disable the global interrupt*/ - __disable_irq(); - - /* update counter*/ - s_osaState.interruptDisableCount++; -} - -/*FUNCTION********************************************************************** - * - * Function Name : OSA_InstallIntHandler - * Description : This function is used to install interrupt handler. - * - *END**************************************************************************/ -void OSA_InstallIntHandler(uint32_t IRQNumber, void (*handler)(void)) -{ -#if defined(__IAR_SYSTEMS_ICC__) - _Pragma("diag_suppress = Pm138") -#endif -#if defined(ENABLE_RAM_VECTOR_TABLE) - (void) InstallIRQHandler((IRQn_Type)IRQNumber, (uint32_t) * (uint32_t *)&handler); -#endif /* ENABLE_RAM_VECTOR_TABLE. */ -#if defined(__IAR_SYSTEMS_ICC__) - _Pragma("diag_remark = PM138") -#endif -} - -/*!********************************************************************************* -************************************************************************************* -* Private functions -************************************************************************************* -********************************************************************************** */ -#if (defined(FSL_OSA_TASK_ENABLE) && (FSL_OSA_TASK_ENABLE > 0U)) - -static OSA_TASK_DEFINE(startup_task, gMainThreadPriority_c, 1, gMainThreadStackSize_c, 0); - -int main(void) -{ - extern void BOARD_InitHardware(void); - /* Initialize MCU clock */ - BOARD_InitHardware(); - LIST_Init((&s_osaState.taskList), 0); - - s_osaState.basePriorityNesting = 0; - s_osaState.interruptDisableCount = 0; - (void)OSA_TaskCreate((osa_task_handle_t)s_osaState.mainTaskHandle, OSA_TASK(startup_task), NULL); - - vTaskStartScheduler(); - return 0; -} -#endif /* FSL_OSA_TASK_ENABLE */ diff --git a/bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/drivers/fsl_os_abstraction_rtthread.h b/bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/drivers/fsl_os_abstraction_rtthread.h deleted file mode 100644 index 40bd24271a..0000000000 --- a/bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/drivers/fsl_os_abstraction_rtthread.h +++ /dev/null @@ -1,130 +0,0 @@ -/*! ********************************************************************************* - * Copyright (c) 2013-2014, Freescale Semiconductor, Inc. - * Copyright 2016-2017 NXP - * All rights reserved. - * - * ile - * - * SPDX-License-Identifier: BSD-3-Clause - ********************************************************************************** */ -#if !defined(__FSL_OS_ABSTRACTION_RTTHREAD_H__) -#define __FSL_OS_ABSTRACTION_RTTHREAD_H__ - -#if defined(__IAR_SYSTEMS_ICC__) -/** - * Workaround to disable MISRA C message suppress warnings for IAR compiler. - */ -// http://supp.iar.com/Support/?note=24725 - -#define MISRAC_DISABLE \ - _Pragma( \ - "diag_suppress= \ - Pm001,Pm002,Pm003,Pm004,Pm005,Pm006,Pm007,Pm008,Pm009,Pm010,Pm011,\ - Pm012,Pm013,Pm014,Pm015,Pm016,Pm017,Pm018,Pm019,Pm020,Pm021,Pm022,\ - Pm023,Pm024,Pm025,Pm026,Pm027,Pm028,Pm029,Pm030,Pm031,Pm032,Pm033,\ - Pm034,Pm035,Pm036,Pm037,Pm038,Pm039,Pm040,Pm041,Pm042,Pm043,Pm044,\ - Pm045,Pm046,Pm047,Pm048,Pm049,Pm050,Pm051,Pm052,Pm053,Pm054,Pm055,\ - Pm056,Pm057,Pm058,Pm059,Pm060,Pm061,Pm062,Pm063,Pm064,Pm065,Pm066,\ - Pm067,Pm068,Pm069,Pm070,Pm071,Pm072,Pm073,Pm074,Pm075,Pm076,Pm077,\ - Pm078,Pm079,Pm080,Pm081,Pm082,Pm083,Pm084,Pm085,Pm086,Pm087,Pm088,\ - Pm089,Pm090,Pm091,Pm092,Pm093,Pm094,Pm095,Pm096,Pm097,Pm098,Pm099,\ - Pm100,Pm101,Pm102,Pm103,Pm104,Pm105,Pm106,Pm107,Pm108,Pm109,Pm110,\ - Pm111,Pm112,Pm113,Pm114,Pm115,Pm116,Pm117,Pm118,Pm119,Pm120,Pm121,\ - Pm122,Pm123,Pm124,Pm125,Pm126,Pm127,Pm128,Pm129,Pm130,Pm131,Pm132,\ - Pm133,Pm134,Pm135,Pm136,Pm137,Pm138,Pm139,Pm140,Pm141,Pm142,Pm143,\ - Pm144,Pm145,Pm146,Pm147,Pm148,Pm149,Pm150,Pm151,Pm152,Pm153,Pm154,\ - Pm155") - -#define MISRAC_ENABLE \ - _Pragma( \ - "diag_default= \ - Pm001,Pm002,Pm003,Pm004,Pm005,Pm006,Pm007,Pm008,Pm009,Pm010,Pm011,\ - Pm012,Pm013,Pm014,Pm015,Pm016,Pm017,Pm018,Pm019,Pm020,Pm021,Pm022,\ - Pm023,Pm024,Pm025,Pm026,Pm027,Pm028,Pm029,Pm030,Pm031,Pm032,Pm033,\ - Pm034,Pm035,Pm036,Pm037,Pm038,Pm039,Pm040,Pm041,Pm042,Pm043,Pm044,\ - Pm045,Pm046,Pm047,Pm048,Pm049,Pm050,Pm051,Pm052,Pm053,Pm054,Pm055,\ - Pm056,Pm057,Pm058,Pm059,Pm060,Pm061,Pm062,Pm063,Pm064,Pm065,Pm066,\ - Pm067,Pm068,Pm069,Pm070,Pm071,Pm072,Pm073,Pm074,Pm075,Pm076,Pm077,\ - Pm078,Pm079,Pm080,Pm081,Pm082,Pm083,Pm084,Pm085,Pm086,Pm087,Pm088,\ - Pm089,Pm090,Pm091,Pm092,Pm093,Pm094,Pm095,Pm096,Pm097,Pm098,Pm099,\ - Pm100,Pm101,Pm102,Pm103,Pm104,Pm105,Pm106,Pm107,Pm108,Pm109,Pm110,\ - Pm111,Pm112,Pm113,Pm114,Pm115,Pm116,Pm117,Pm118,Pm119,Pm120,Pm121,\ - Pm122,Pm123,Pm124,Pm125,Pm126,Pm127,Pm128,Pm129,Pm130,Pm131,Pm132,\ - Pm133,Pm134,Pm135,Pm136,Pm137,Pm138,Pm139,Pm140,Pm141,Pm142,Pm143,\ - Pm144,Pm145,Pm146,Pm147,Pm148,Pm149,Pm150,Pm151,Pm152,Pm153,Pm154,\ - Pm155") -#else -/* Empty MISRA C macros for other toolchains. */ -#define MISRAC_DISABLE -#define MISRAC_ENABLE -#endif - -MISRAC_DISABLE -#include -MISRAC_ENABLE - -/*! - * @addtogroup os_abstraction_free_rtos - * @{ - */ - -/******************************************************************************* - * Declarations - ******************************************************************************/ -/*! @brief Type for a task handler, returned by the OSA_TaskCreate function. */ -typedef rt_thread_t task_handler_t; - -/*! @brief Type for a task stack.*/ -typedef rt_uint32_t task_stack_t; - -/*! @brief Type for task parameter */ -typedef void *task_param_t; - -/*! @brief Type for an event flags object.*/ -typedef rt_uint32_t event_flags_t; - -/*! @brief Constant to pass as timeout value in order to wait indefinitely. */ -#define OSA_WAIT_FOREVER 0xFFFFFFFFU - -/*! @brief OSA's time range in millisecond, OSA time wraps if exceeds this value. */ -#define FSL_OSA_TIME_RANGE 0xFFFFFFFFU - -/*! @brief The default interrupt handler installed in vector table. */ -#define OSA_DEFAULT_INT_HANDLER ((osa_int_handler_t)(&DefaultISR)) - -extern void DefaultISR(void); - -/*! - * @name Thread management - * @{ - */ - -/*! - * @brief To provide unified task piority for upper layer, OSA layer makes conversion. - */ -#define PRIORITY_OSA_TO_RTOS(osa_prio) ((UBaseType_t)configMAX_PRIORITIES - (osa_prio)-2U) -#define PRIORITY_RTOS_TO_OSA(rtos_prio) ((UBaseType_t)configMAX_PRIORITIES - (rtos_prio)-2U) - -/* @}*/ - -/*! - * @name Message queues - * @{ - */ - -/*! - * @brief This macro statically reserves the memory required for the queue. - * - * @param name Identifier for the memory region. - * @param number Number of elements in the queue. - * @param size Size of every elements in words. - */ -#define MSG_QUEUE_DECLARE(name, number, size) msg_queue_t *name = NULL - -/* @}*/ - -/*! @}*/ -/*! @}*/ -/*! @}*/ - -#endif // __FSL_OS_ABSTRACTION_RTTHREAD_H__ diff --git a/bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/drivers/generic_list.c b/bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/drivers/generic_list.c deleted file mode 100644 index 80dd21425d..0000000000 --- a/bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/drivers/generic_list.c +++ /dev/null @@ -1,475 +0,0 @@ -/* - * Copyright 2018-2019 NXP - * All rights reserved. - * - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/*! ********************************************************************************* -************************************************************************************* -* Include -************************************************************************************* -********************************************************************************** */ -#include "generic_list.h" - -static list_status_t LIST_Error_Check(list_handle_t list, list_element_handle_t newElement) -{ - list_status_t listStatus = kLIST_Ok; - list_element_handle_t element = list->head; - - if ((list->max != 0U) && (list->max == list->size)) - { - listStatus = kLIST_Full; /*List is full*/ - } - else - { - while (element != NULL) /*Scan list*/ - { - /* Determine if element is duplicated */ - if (element == newElement) - { - listStatus = kLIST_DuplicateError; - break; - } - element = element->next; - } - } - - return listStatus; -} - -/*! ********************************************************************************* -************************************************************************************* -* Public functions -************************************************************************************* -********************************************************************************** */ -/*! ********************************************************************************* - * \brief Initialises the list descriptor. - * - * \param[in] list - LIST_ handle to init. - * max - Maximum number of elements in list. 0 for unlimited. - * - * \return void. - * - * \pre - * - * \post - * - * \remarks - * - ********************************************************************************** */ -void LIST_Init(list_handle_t list, uint32_t max) -{ - list->head = NULL; - list->tail = NULL; - list->max = (uint16_t)max; - list->size = 0; -} - -/*! ********************************************************************************* - * \brief Gets the list that contains the given element. - * - * \param[in] element - Handle of the element. - * - * \return NULL if element is orphan. - * Handle of the list the element is inserted into. - * - * \pre - * - * \post - * - * \remarks - * - ********************************************************************************** */ -list_handle_t LIST_GetList(list_element_handle_t element) -{ - return element->list; -} - -/*! ********************************************************************************* - * \brief Links element to the tail of the list. - * - * \param[in] list - ID of list to insert into. - * element - element to add - * - * \return kLIST_Full if list is full. - * kLIST_Ok if insertion was successful. - * - * \pre - * - * \post - * - * \remarks - * - ********************************************************************************** */ -list_status_t LIST_AddTail(list_handle_t list, list_element_handle_t element) -{ - uint32_t regPrimask = DisableGlobalIRQ(); - list_status_t listStatus = kLIST_Ok; - - listStatus = LIST_Error_Check(list, element); - if (listStatus == kLIST_Ok) /* Avoiding list status error */ - { - if (list->size == 0U) - { - list->head = element; - } - else - { - list->tail->next = element; - } -#if (defined(GENERIC_LIST_LIGHT) && (GENERIC_LIST_LIGHT > 0U)) -#else - element->prev = list->tail; -#endif - element->list = list; - element->next = NULL; - list->tail = element; - list->size++; - } - - EnableGlobalIRQ(regPrimask); - return listStatus; -} - -/*! ********************************************************************************* - * \brief Links element to the head of the list. - * - * \param[in] list - ID of list to insert into. - * element - element to add - * - * \return kLIST_Full if list is full. - * kLIST_Ok if insertion was successful. - * - * \pre - * - * \post - * - * \remarks - * - ********************************************************************************** */ -list_status_t LIST_AddHead(list_handle_t list, list_element_handle_t element) -{ - uint32_t regPrimask = DisableGlobalIRQ(); - list_status_t listStatus = kLIST_Ok; - - listStatus = LIST_Error_Check(list, element); - if (listStatus == kLIST_Ok) /* Avoiding list status error */ - { - /* Links element to the head of the list */ - if (list->size == 0U) - { - list->tail = element; - } -#if (defined(GENERIC_LIST_LIGHT) && (GENERIC_LIST_LIGHT > 0U)) -#else - else - { - list->head->prev = element; - } - element->prev = NULL; -#endif - element->list = list; - element->next = list->head; - list->head = element; - list->size++; - } - - EnableGlobalIRQ(regPrimask); - return listStatus; -} - -/*! ********************************************************************************* - * \brief Unlinks element from the head of the list. - * - * \param[in] list - ID of list to remove from. - * - * \return NULL if list is empty. - * ID of removed element(pointer) if removal was successful. - * - * \pre - * - * \post - * - * \remarks - * - ********************************************************************************** */ -list_element_handle_t LIST_RemoveHead(list_handle_t list) -{ - list_element_handle_t element; - - uint32_t regPrimask = DisableGlobalIRQ(); - - if ((NULL == list) || (list->size == 0U)) - { - element = NULL; /*LIST_ is empty*/ - } - else - { - element = list->head; - list->size--; - if (list->size == 0U) - { - list->tail = NULL; - } -#if (defined(GENERIC_LIST_LIGHT) && (GENERIC_LIST_LIGHT > 0U)) -#else - else - { - element->next->prev = NULL; - } -#endif - element->list = NULL; - list->head = element->next; /*Is NULL if element is head*/ - } - - EnableGlobalIRQ(regPrimask); - return element; -} - -/*! ********************************************************************************* - * \brief Gets head element ID. - * - * \param[in] list - ID of list. - * - * \return NULL if list is empty. - * ID of head element if list is not empty. - * - * \pre - * - * \post - * - * \remarks - * - ********************************************************************************** */ -list_element_handle_t LIST_GetHead(list_handle_t list) -{ - return list->head; -} - -/*! ********************************************************************************* - * \brief Gets next element ID. - * - * \param[in] element - ID of the element. - * - * \return NULL if element is tail. - * ID of next element if exists. - * - * \pre - * - * \post - * - * \remarks - * - ********************************************************************************** */ -list_element_handle_t LIST_GetNext(list_element_handle_t element) -{ - return element->next; -} - -/*! ********************************************************************************* - * \brief Gets previous element ID. - * - * \param[in] element - ID of the element. - * - * \return NULL if element is head. - * ID of previous element if exists. - * - * \pre - * - * \post - * - * \remarks - * - ********************************************************************************** */ -list_element_handle_t LIST_GetPrev(list_element_handle_t element) -{ -#if (defined(GENERIC_LIST_LIGHT) && (GENERIC_LIST_LIGHT > 0U)) - return NULL; -#else - return element->prev; -#endif -} - -/*! ********************************************************************************* - * \brief Unlinks an element from its list. - * - * \param[in] element - ID of the element to remove. - * - * \return kLIST_OrphanElement if element is not part of any list. - * kLIST_Ok if removal was successful. - * - * \pre - * - * \post - * - * \remarks - * - ********************************************************************************** */ -list_status_t LIST_RemoveElement(list_element_handle_t element) -{ - list_status_t listStatus = kLIST_Ok; - uint32_t regPrimask = DisableGlobalIRQ(); - - if (element->list == NULL) - { - listStatus = kLIST_OrphanElement; /*Element was previusly removed or never added*/ - } - else - { -#if (defined(GENERIC_LIST_LIGHT) && (GENERIC_LIST_LIGHT > 0U)) - list_element_handle_t element_list = element->list->head; - while (element_list) - { - if (element->list->head == element) - { - element->list->head = element_list->next; - break; - } - if (element_list->next == element) - { - element_list->next = element->next; - break; - } - element_list = element_list->next; - } -#else - if (element->prev == NULL) /*Element is head or solo*/ - { - element->list->head = element->next; /*is null if solo*/ - } - if (element->next == NULL) /*Element is tail or solo*/ - { - element->list->tail = element->prev; /*is null if solo*/ - } - if (element->prev != NULL) /*Element is not head*/ - { - element->prev->next = element->next; - } - if (element->next != NULL) /*Element is not tail*/ - { - element->next->prev = element->prev; - } -#endif - element->list->size--; - element->list = NULL; - } - - EnableGlobalIRQ(regPrimask); - return listStatus; -} - -/*! ********************************************************************************* - * \brief Links an element in the previous position relative to a given member - * of a list. - * - * \param[in] element - ID of a member of a list. - * newElement - new element to insert before the given member. - * - * \return kLIST_OrphanElement if element is not part of any list. - * kLIST_Full if list is full. - * kLIST_Ok if insertion was successful. - * - * \pre - * - * \post - * - * \remarks - * - ********************************************************************************** */ -list_status_t LIST_AddPrevElement(list_element_handle_t element, list_element_handle_t newElement) -{ - list_status_t listStatus = kLIST_Ok; - uint32_t regPrimask = DisableGlobalIRQ(); - - if (element->list == NULL) - { - listStatus = kLIST_OrphanElement; /*Element was previusly removed or never added*/ - } - else - { - listStatus = LIST_Error_Check(element->list, newElement); - if (listStatus == kLIST_Ok) - { -#if (defined(GENERIC_LIST_LIGHT) && (GENERIC_LIST_LIGHT > 0U)) - list_element_handle_t element_list = element->list->head; - while (element_list) - { - if ((element_list->next == element) || (element_list == element)) - { - if (element_list == element) - { - element->list->head = newElement; - } - else - { - element_list->next = newElement; - } - newElement->list = element->list; - newElement->next = element; - element->list->size++; - break; - } - element_list = element_list->next; - } - -#else - if (element->prev == NULL) /*Element is list head*/ - { - element->list->head = newElement; - } - else - { - element->prev->next = newElement; - } - newElement->list = element->list; - element->list->size++; - newElement->next = element; - newElement->prev = element->prev; - element->prev = newElement; -#endif - } - } - - EnableGlobalIRQ(regPrimask); - return listStatus; -} - -/*! ********************************************************************************* - * \brief Gets the current size of a list. - * - * \param[in] list - ID of the list. - * - * \return Current size of the list. - * - * \pre - * - * \post - * - * \remarks - * - ********************************************************************************** */ -uint32_t LIST_GetSize(list_handle_t list) -{ - return list->size; -} - -/*! ********************************************************************************* - * \brief Gets the number of free places in the list. - * - * \param[in] list - ID of the list. - * - * \return Available size of the list. - * - * \pre - * - * \post - * - * \remarks - * - ********************************************************************************** */ -uint32_t LIST_GetAvailableSize(list_handle_t list) -{ - return ((uint32_t)list->max - (uint32_t)list->size); /*Gets the number of free places in the list*/ -} diff --git a/bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/drivers/generic_list.h b/bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/drivers/generic_list.h deleted file mode 100644 index def00efe8e..0000000000 --- a/bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/drivers/generic_list.h +++ /dev/null @@ -1,203 +0,0 @@ -/* - * Copyright 2018-2020 NXP - * All rights reserved. - * - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#ifndef _GENERIC_LIST_H_ -#define _GENERIC_LIST_H_ - -#include "fsl_common.h" -/*! - * @addtogroup GenericList - * @{ - */ - -/*!********************************************************************************* -************************************************************************************* -* Include -************************************************************************************* -********************************************************************************** */ - -/*! ********************************************************************************* -************************************************************************************* -* Public macro definitions -************************************************************************************* -********************************************************************************** */ -#ifndef GENERIC_LIST_LIGHT -#define GENERIC_LIST_LIGHT (0) -#endif -/*! ********************************************************************************* -************************************************************************************* -* Public type definitions -************************************************************************************* -********************************************************************************** */ -/*! @brief The list status */ -typedef enum _list_status -{ - kLIST_Ok = kStatus_Success, /*!< Success */ - kLIST_DuplicateError = MAKE_STATUS(kStatusGroup_LIST, 1), /*!< Duplicate Error */ - kLIST_Full = MAKE_STATUS(kStatusGroup_LIST, 2), /*!< FULL */ - kLIST_Empty = MAKE_STATUS(kStatusGroup_LIST, 3), /*!< Empty */ - kLIST_OrphanElement = MAKE_STATUS(kStatusGroup_LIST, 4), /*!< Orphan Element */ - kLIST_NotSupport = MAKE_STATUS(kStatusGroup_LIST, 5), /*!< Not Support */ -} list_status_t; - -/*! @brief The list structure*/ -typedef struct list_label -{ - struct list_element_tag *head; /*!< list head */ - struct list_element_tag *tail; /*!< list tail */ - uint16_t size; /*!< list size */ - uint16_t max; /*!< list max number of elements */ -} list_label_t, *list_handle_t; -#if (defined(GENERIC_LIST_LIGHT) && (GENERIC_LIST_LIGHT > 0U)) -/*! @brief The list element*/ -typedef struct list_element_tag -{ - struct list_element_tag *next; /*!< next list element */ - struct list_label *list; /*!< pointer to the list */ -} list_element_t, *list_element_handle_t; -#else -/*! @brief The list element*/ -typedef struct list_element_tag -{ - struct list_element_tag *next; /*!< next list element */ - struct list_element_tag *prev; /*!< previous list element */ - struct list_label *list; /*!< pointer to the list */ -} list_element_t, *list_element_handle_t; -#endif -/*! ********************************************************************************* -************************************************************************************* -* Public prototypes -************************************************************************************* -********************************************************************************** */ -/******************************************************************************* - * API - ******************************************************************************/ - -#if defined(__cplusplus) -extern "C" { -#endif /* _cplusplus */ -/*! - * @brief Initialize the list. - * - * This function initialize the list. - * - * @param list - List handle to initialize. - * @param max - Maximum number of elements in list. 0 for unlimited. - */ -void LIST_Init(list_handle_t list, uint32_t max); - -/*! - * @brief Gets the list that contains the given element. - * - * - * @param element - Handle of the element. - * @retval NULL if element is orphan, Handle of the list the element is inserted into. - */ -list_handle_t LIST_GetList(list_element_handle_t element); - -/*! - * @brief Links element to the head of the list. - * - * @param list - Handle of the list. - * @param element - Handle of the element. - * @retval kLIST_Full if list is full, kLIST_Ok if insertion was successful. - */ -list_status_t LIST_AddHead(list_handle_t list, list_element_handle_t element); - -/*! - * @brief Links element to the tail of the list. - * - * @param list - Handle of the list. - * @param element - Handle of the element. - * @retval kLIST_Full if list is full, kLIST_Ok if insertion was successful. - */ -list_status_t LIST_AddTail(list_handle_t list, list_element_handle_t element); - -/*! - * @brief Unlinks element from the head of the list. - * - * @param list - Handle of the list. - * - * @retval NULL if list is empty, handle of removed element(pointer) if removal was successful. - */ -list_element_handle_t LIST_RemoveHead(list_handle_t list); - -/*! - * @brief Gets head element handle. - * - * @param list - Handle of the list. - * - * @retval NULL if list is empty, handle of removed element(pointer) if removal was successful. - */ -list_element_handle_t LIST_GetHead(list_handle_t list); - -/*! - * @brief Gets next element handle for given element handle. - * - * @param element - Handle of the element. - * - * @retval NULL if list is empty, handle of removed element(pointer) if removal was successful. - */ -list_element_handle_t LIST_GetNext(list_element_handle_t element); - -/*! - * @brief Gets previous element handle for given element handle. - * - * @param element - Handle of the element. - * - * @retval NULL if list is empty, handle of removed element(pointer) if removal was successful. - */ -list_element_handle_t LIST_GetPrev(list_element_handle_t element); - -/*! - * @brief Unlinks an element from its list. - * - * @param element - Handle of the element. - * - * @retval kLIST_OrphanElement if element is not part of any list. - * @retval kLIST_Ok if removal was successful. - */ -list_status_t LIST_RemoveElement(list_element_handle_t element); - -/*! - * @brief Links an element in the previous position relative to a given member of a list. - * - * @param list - Handle of the list. - * @param element - Handle of the element. - * @param newElement - New element to insert before the given member. - * - * @retval kLIST_OrphanElement if element is not part of any list. - * @retval kLIST_Ok if removal was successful. - */ -list_status_t LIST_AddPrevElement(list_element_handle_t element, list_element_handle_t newElement); - -/*! - * @brief Gets the current size of a list. - * - * @param list - Handle of the list. - * - * @retval Current size of the list. - */ -uint32_t LIST_GetSize(list_handle_t list); - -/*! - * @brief Gets the number of free places in the list. - * - * @param list - Handle of the list. - * - * @retval Available size of the list. - */ -uint32_t LIST_GetAvailableSize(list_handle_t list); - -/* @} */ - -#if defined(__cplusplus) -} -#endif -/*! @}*/ -#endif /*_GENERIC_LIST_H_*/ diff --git a/bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/gcc/startup_MIMXRT1052.S b/bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/gcc/startup_MIMXRT1052.S index ae0f797605..73003ff20c 100644 --- a/bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/gcc/startup_MIMXRT1052.S +++ b/bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/gcc/startup_MIMXRT1052.S @@ -367,6 +367,7 @@ Reset_Handler: blt .LC4 #endif /* __STARTUP_INITIALIZE_NONCACHEDATA */ +#ifdef __STARTUP_CLEAR_BSS /* This part of work usually is done in C library startup code. Otherwise, * define this macro to enable it in this startup. * @@ -384,6 +385,7 @@ Reset_Handler: itt lt strlt r0, [r1], #4 blt .LC5 +#endif /* __STARTUP_CLEAR_BSS */ cpsie i /* Unmask interrupts */ #ifndef __START diff --git a/bsp/imxrt/libraries/MIMXRT1050/SConscript b/bsp/imxrt/libraries/MIMXRT1050/SConscript index 0d90aeebfc..58d5ccef78 100644 --- a/bsp/imxrt/libraries/MIMXRT1050/SConscript +++ b/bsp/imxrt/libraries/MIMXRT1050/SConscript @@ -53,6 +53,9 @@ if GetDepend(['BSP_USING_SDRAM']): if GetDepend(['BSP_USING_LCD']): src += ['MIMXRT1052/drivers/fsl_elcdif.c'] +if GetDepend(['RT_USING_USB_HOST']) or GetDepend(['RT_USING_USB_DEVICE']): + src += ['MIMXRT1052/drivers/fsl_usdhc.c'] + if GetDepend(['BSP_USING_CAN']): src += ['MIMXRT1052/drivers/fsl_flexcan.c'] @@ -74,17 +77,7 @@ if GetDepend(['BSP_USING_DMA']): src += ['MIMXRT1052/drivers/fsl_edma.c'] src += ['MIMXRT1052/drivers/fsl_lpuart_edma.c'] src += ['MIMXRT1052/drivers/fsl_lpspi_edma.c'] - -if GetDepend(['BSP_USING_PULSE_ENCODER']): - src += ['MIMXRT1052/drivers/fsl_enc.c'] -#Adding this as XBAR is used in pin mux -src += ['MIMXRT1052/drivers/fsl_xbara.c'] -src += ['MIMXRT1052/drivers/fsl_xbarb.c'] - -#fsl os abstract files -src += ['MIMXRT1052/drivers/fsl_os_abstraction_rtthread.c'] -src += ['MIMXRT1052/drivers/generic_list.c'] group = DefineGroup('Libraries', src, depend = [''], CPPPATH = path) diff --git a/bsp/imxrt/libraries/drivers/SConscript b/bsp/imxrt/libraries/drivers/SConscript index 6cca919f10..3328d2af08 100644 --- a/bsp/imxrt/libraries/drivers/SConscript +++ b/bsp/imxrt/libraries/drivers/SConscript @@ -54,22 +54,15 @@ if GetDepend('BSP_USING_AUDIO'): if GetDepend('BSP_USING_SDIO'): src += ['drv_sdio.c'] - -if GetDepend('BSP_USING_PULSE_ENCODER'): - src += ['drv_pulse_encoder.c'] - -if GetDepend('RT_USING_USB_DEVICE'): + +if GetDepend('BSP_USING_USB_DEVICE'): src += ['drv_usbd.c'] src += Glob('usb/device/*.c') -if GetDepend('RT_USING_USB_DEVICE') or GetDepend('RT_USING_USB_HOST'): +if GetDepend('BSP_USING_USB_DEVICE'): src += Glob('usb/phy/*.c') - CPPDEFINES += ['ENDIANNESS','USE_RTOS'] + CPPDEFINES += ['ENDIANNESS'] -if GetDepend('RT_USING_USB_HOST'): - src += ['drv_usbh.c'] - src += Glob('usb/host/*.c') - path = [cwd,cwd + '/config'] group = DefineGroup('Drivers', src, depend = [''], CPPPATH = path, CPPDEFINES=CPPDEFINES) diff --git a/bsp/imxrt/libraries/drivers/drv_pulse_encoder.c b/bsp/imxrt/libraries/drivers/drv_pulse_encoder.c deleted file mode 100644 index 176508ce48..0000000000 --- a/bsp/imxrt/libraries/drivers/drv_pulse_encoder.c +++ /dev/null @@ -1,160 +0,0 @@ -/* - * Copyright (c) 2006-2018, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2019-08-23 balanceTWK first version - * 2021-01-19 Leslie Lee port to imxrt series - */ - -#include -#include -#ifdef BSP_USING_PULSE_ENCODER - -#include "fsl_common.h" -#include "fsl_enc.h" - -#define LOG_TAG "drv.pulse_encoder" -#include - -#if !defined(BSP_USING_PULSE_ENCODER1) && !defined(BSP_USING_PULSE_ENCODER2) && !defined(BSP_USING_PULSE_ENCODER3) \ - && !defined(BSP_USING_PULSE_ENCODER4) - #error "Please define at least one BSP_USING_PULSE_ENCODERx" - /* this driver can be disabled at menuconfig → RT-Thread Components → Device Drivers */ -#elif (defined(BSP_USING_PULSE_ENCODER2) || defined(BSP_USING_PULSE_ENCODER3) || defined(BSP_USING_PULSE_ENCODER4)) || defined(SOC_IMXRT1015_SERIES) - #error "IMXRT1015 had only one quadrature decoder module" -#elif (defined(BSP_USING_PULSE_ENCODER3) || defined(BSP_USING_PULSE_ENCODER4)) || defined(SOC_IMXRT1020_SERIES) - #error "IMXRT1020 had only two quadrature decoder module" -#endif - -enum -{ -#ifdef BSP_USING_PULSE_ENCODER1 - PULSE_ENCODER1_INDEX, -#endif -#ifdef BSP_USING_PULSE_ENCODER2 - PULSE_ENCODER2_INDEX, -#endif -#ifdef BSP_USING_PULSE_ENCODER3 - PULSE_ENCODER3_INDEX, -#endif -#ifdef BSP_USING_PULSE_ENCODER4 - PULSE_ENCODER4_INDEX, -#endif -}; - -struct imxrt_pulse_encoder_device -{ - struct rt_pulse_encoder_device pulse_encoder; - ENC_Type *base; - char *name; -}; -typedef struct imxrt_pulse_encoder_device imxrt_pulse_enccoder_device_t; - -static imxrt_pulse_enccoder_device_t imxrt_pulse_encoder_obj[] = -{ -#ifdef BSP_USING_PULSE_ENCODER1 - { - .base = ENC1, - .name = "pulse1" - }, -#endif -#ifdef BSP_USING_PULSE_ENCODER2 - { - .base = ENC2, - .name = "pulse2" - }, -#endif -#ifdef BSP_USING_PULSE_ENCODER3 - { - .base = ENC3, - .name = "pulse3" - }, -#endif -#ifdef BSP_USING_PULSE_ENCODER4 - { - .base = ENC4, - .name = "pulse4" - }, -#endif -}; - - - -rt_err_t pulse_encoder_init(struct rt_pulse_encoder_device *pulse_encoder) -{ - ENC_Type *base = ((imxrt_pulse_enccoder_device_t *)(pulse_encoder->parent.user_data))->base; - enc_config_t enc_config; - ENC_GetDefaultConfig(&enc_config); - ENC_Init(base, &enc_config); - ENC_DoSoftwareLoadInitialPositionValue(base); /* Update the position counter with initial value. */ - return RT_EOK; -} - -rt_err_t pulse_encoder_clear_count(struct rt_pulse_encoder_device *pulse_encoder) -{ - ENC_SetInitialPositionValue(((imxrt_pulse_enccoder_device_t *)(pulse_encoder->parent.user_data))->base, 0); - return RT_EOK; -} - -rt_int32_t pulse_encoder_get_count(struct rt_pulse_encoder_device *pulse_encoder) -{ - return (rt_int32_t)ENC_GetPositionValue(((imxrt_pulse_enccoder_device_t *)(pulse_encoder->parent.user_data))->base); -} - -rt_err_t pulse_encoder_control(struct rt_pulse_encoder_device *pulse_encoder, rt_uint32_t cmd, void *args) -{ - rt_err_t result; - - result = RT_EOK; - - switch (cmd) - { - case PULSE_ENCODER_CMD_ENABLE: - result = pulse_encoder->ops->init(pulse_encoder); - break; - case PULSE_ENCODER_CMD_DISABLE: - ENC_Deinit(((imxrt_pulse_enccoder_device_t *)(pulse_encoder->parent.user_data))->base); - break; - default: - result = -RT_ENOSYS; - break; - } - - return result; -} - -static const struct rt_pulse_encoder_ops _ops = -{ - .init = pulse_encoder_init, - .get_count = pulse_encoder_get_count, - .clear_count = pulse_encoder_clear_count, - .control = pulse_encoder_control, -}; - -int rt_hw_pulse_encoder_init(void) -{ - int i; - int result; - - result = RT_EOK; - for (i = 0; i < sizeof(imxrt_pulse_encoder_obj) / sizeof(imxrt_pulse_encoder_obj[0]); i++) - { - imxrt_pulse_encoder_obj[i].pulse_encoder.type = AB_PHASE_PULSE_ENCODER; - imxrt_pulse_encoder_obj[i].pulse_encoder.ops = &_ops; - imxrt_pulse_encoder_obj[i].pulse_encoder.parent.user_data = &(imxrt_pulse_encoder_obj[i]); - - if (rt_device_pulse_encoder_register(&imxrt_pulse_encoder_obj[i].pulse_encoder, imxrt_pulse_encoder_obj[i].name, &imxrt_pulse_encoder_obj[i]) != RT_EOK) - { - LOG_E("%s register failed", imxrt_pulse_encoder_obj[i].name); - result = -RT_ERROR; - } - } - - return result; -} -INIT_BOARD_EXPORT(rt_hw_pulse_encoder_init); - -#endif diff --git a/bsp/imxrt/libraries/drivers/drv_usbh.c b/bsp/imxrt/libraries/drivers/drv_usbh.c deleted file mode 100644 index a7e0ad6062..0000000000 --- a/bsp/imxrt/libraries/drivers/drv_usbh.c +++ /dev/null @@ -1,730 +0,0 @@ -/* - * Copyright (c) 2006-2018, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2017-10-30 ZYH the first version - * 2019-12-19 tyustli port to stm32 series - * 2021-01-19 Leslie Lee port to imxrt series - */ -#include - -#if defined(BSP_USB0_HOST) || defined(BSP_USB1_HOST) -#include "drv_usbh.h" -#include -#include -#include -#include -#include -#include -#include - - -/* USB PHY configuration */ -#ifndef BOARD_USB_PHY_D_CAL -#define BOARD_USB_PHY_D_CAL (0x0CU) -#endif -#ifndef BOARD_USB_PHY_TXCAL45DP -#define BOARD_USB_PHY_TXCAL45DP (0x06U) -#endif -#ifndef BOARD_USB_PHY_TXCAL45DM -#define BOARD_USB_PHY_TXCAL45DM (0x06U) -#endif - -#define USB_HOST_INTERRUPT_PRIORITY 3 - -enum -{ -#ifdef BSP_USB0_HOST - USBH0_INDEX, -#endif -#ifdef BSP_USB1_HOST - USBH1_INDEX, -#endif -}; - -struct imxrt_usb_host_pipe -{ - usb_host_pipe_handle pipe_handle; - struct rt_completion urb_completion; - usb_status_t transfer_status; -}; - -struct imxrt_usb_host -{ - struct uhcd uhcd; - usb_host_handle host_handle; - usb_device_handle device_handle; - struct imxrt_usb_host_pipe pipes[16]; - volatile rt_bool_t connect_status; - char *name; -}; - -static struct imxrt_usb_host imxrt_usb_host_obj[] = -{ -#ifdef BSP_USB0_HOST - { - .connect_status = RT_FALSE, - .name = "usbh0" - }, -#endif -#ifdef BSP_USB1_HOST - { - .connect_status = RT_FALSE, - .name = "usbh1" - }, -#endif -}; - -static void _imxrt_usb_host_send_callback(void *param, usb_host_transfer_t *transfer, usb_status_t status) -{ - struct imxrt_usb_host_pipe *pipe = (struct imxrt_usb_host_pipe *)param; - pipe->transfer_status = status; - rt_completion_done(&pipe->urb_completion); -} - - -/*! - * @brief Initializes USB specific setting that was not set by the Clocks tool. - */ -static void USB_HostClockInit(usb_controller_index_t controller_id) -{ - usb_phy_config_struct_t phyConfig = { - BOARD_USB_PHY_D_CAL, BOARD_USB_PHY_TXCAL45DP, BOARD_USB_PHY_TXCAL45DM, - }; - uint32_t notUsed = 0; - - if (controller_id == kUSB_ControllerEhci0) - { - CLOCK_EnableUsbhs0PhyPllClock(kCLOCK_Usbphy480M, 480000000U); - CLOCK_EnableUsbhs0Clock(kCLOCK_Usb480M, 480000000U); - } - else - { - CLOCK_EnableUsbhs1PhyPllClock(kCLOCK_Usbphy480M, 480000000U); - CLOCK_EnableUsbhs1Clock(kCLOCK_Usb480M, 480000000U); - } - - USB_EhciPhyInit(controller_id, 24000000U, &phyConfig); -} - -/*! - * @brief Enables interrupt service routines for device. - */ -void USB_HostIsrEnable(usb_controller_index_t controller_id) -{ - uint8_t irqNumber; -#if ((defined USB_HOST_CONFIG_EHCI) && (USB_HOST_CONFIG_EHCI > 0U)) - IRQn_Type usbHOSTEhciIrq[] = USBHS_IRQS; - irqNumber = usbHOSTEhciIrq[controller_id - kUSB_ControllerEhci0]; -#endif -/* Install isr, set priority, and enable IRQ. */ -#if defined(__GIC_PRIO_BITS) - GIC_SetPriority((IRQn_Type)irqNumber, USB_HOST_INTERRUPT_PRIORITY); -#else - NVIC_SetPriority((IRQn_Type)irqNumber, USB_HOST_INTERRUPT_PRIORITY); -#endif - EnableIRQ((IRQn_Type)irqNumber); -} - -#ifdef BSP_USB0_HOST -void USB_OTG1_IRQHandler(void) -{ - /* enter interrupt */ - rt_interrupt_enter(); - - USB_HostEhciIsrFunction(imxrt_usb_host_obj[USBH0_INDEX].host_handle); - /* leave interrupt */ - rt_interrupt_leave(); -} - -static rt_err_t _ehci0_reset_port(rt_uint8_t port) -{ - // No reset port function available - return RT_EOK; -} - -static uint8_t _ehci0_pipe_buf[64]; -static uint8_t _ehci0_pipe_idx; - -static int _ehci0_pipe_xfer(upipe_t pipe, rt_uint8_t token, void *buffer, int nbytes, int timeouts) -{ - int timeout = timeouts; - - if (!imxrt_usb_host_obj[USBH0_INDEX].connect_status) - { - return -1; - } - usb_host_transfer_t *transfer; - if (imxrt_usb_host_obj[USBH0_INDEX].pipes[pipe->pipe_index].pipe_handle == NULL) - { - RT_DEBUG_LOG(RT_DEBUG_USB, ("error operation on null pipe\n")); - return -1; - } - if (USB_HostMallocTransfer(imxrt_usb_host_obj[USBH0_INDEX].host_handle, &transfer) != kStatus_USB_Success) - { - RT_DEBUG_LOG(RT_DEBUG_USB, ("error to get transfer\n")); - return -1; - } - transfer->transferBuffer = buffer; - transfer->transferLength = nbytes; - transfer->transferSofar = 0; - transfer->callbackFn = _imxrt_usb_host_send_callback; - transfer->callbackParam = &(imxrt_usb_host_obj[USBH0_INDEX].pipes[pipe->pipe_index]); - transfer->direction = (pipe->ep.bEndpointAddress & USB_DIR_IN) ? USB_IN : USB_OUT; - if (pipe->ep.bmAttributes == USB_ENDPOINT_CONTROL) - { - if (token == USBH_PID_SETUP) - { - struct urequest *setup = (struct urequest *)buffer; - transfer->setupStatus = 0; - transfer->setupPacket->bmRequestType = setup->request_type; - transfer->setupPacket->bRequest = setup->bRequest; - transfer->setupPacket->wIndex = setup->wIndex; - transfer->setupPacket->wLength = setup->wLength; - transfer->setupPacket->wValue = setup->wValue; - transfer->transferBuffer = RT_NULL; - transfer->transferLength = 0; - transfer->next = RT_NULL; - if ((transfer->setupPacket->bmRequestType & USB_REQUEST_TYPE_DIR_MASK) == USB_REQUEST_TYPE_DIR_IN) - { - transfer->direction = USB_IN; - transfer->transferBuffer = _ehci0_pipe_buf; - transfer->transferLength = setup->wLength; - _ehci0_pipe_idx = 0; - } - else - { - transfer->direction = USB_OUT; - } - } - else - { - rt_memcpy(buffer, _ehci0_pipe_buf + _ehci0_pipe_idx, nbytes); - imxrt_usb_host_obj[USBH0_INDEX].pipes[pipe->pipe_index].transfer_status = kStatus_USB_Success; - transfer->transferSofar = nbytes; - _ehci0_pipe_idx += nbytes; - if (_ehci0_pipe_idx >= 64) - { - _ehci0_pipe_idx = 0; - } - goto _ehci0_pipe_xfer_finish; - } - - } - rt_completion_init(&(imxrt_usb_host_obj[USBH0_INDEX].pipes[pipe->pipe_index].urb_completion)); - if (USB_HostEhciWritePipe(((usb_host_instance_t *)imxrt_usb_host_obj[USBH0_INDEX].host_handle)->controllerHandle, imxrt_usb_host_obj[USBH0_INDEX].pipes[pipe->pipe_index].pipe_handle, transfer) != kStatus_USB_Success) - { - RT_DEBUG_LOG(RT_DEBUG_USB, ("usb host failed to send\n")); - (void)USB_HostFreeTransfer(imxrt_usb_host_obj[USBH0_INDEX].host_handle, transfer); - return -1; - } - if (-RT_ETIMEOUT == rt_completion_wait(&(imxrt_usb_host_obj[USBH0_INDEX].pipes[pipe->pipe_index].urb_completion), RT_WAITING_FOREVER)) - { - RT_DEBUG_LOG(RT_DEBUG_USB, ("usb transfer timeout\n")); - (void)USB_HostFreeTransfer(imxrt_usb_host_obj[USBH0_INDEX].host_handle, transfer); - return -1; - } - _ehci0_pipe_xfer_finish: - switch (imxrt_usb_host_obj[USBH0_INDEX].pipes[pipe->pipe_index].transfer_status) - { - case kStatus_USB_Success: - { - RT_DEBUG_LOG(RT_DEBUG_USB, ("ok\n")); - pipe->status = UPIPE_STATUS_OK; - if (pipe->callback != RT_NULL) - { - pipe->callback(pipe); - } - size_t size = transfer->transferSofar; - (void)USB_HostFreeTransfer(imxrt_usb_host_obj[USBH0_INDEX].host_handle, transfer); - if (pipe->ep.bEndpointAddress & 0x80) - { - return size; - } - else if (pipe->ep.bEndpointAddress & 0x00) - { - return size; - } - return nbytes; - break; - } - case kStatus_USB_TransferStall: - { - RT_DEBUG_LOG(RT_DEBUG_USB, ("stall\n")); - pipe->status = UPIPE_STATUS_STALL; - if (pipe->callback != RT_NULL) - { - pipe->callback(pipe); - } - (void)USB_HostFreeTransfer(imxrt_usb_host_obj[USBH0_INDEX].host_handle, transfer); - return -1; - break; - } - case kStatus_USB_TransferFailed: - default: - { - RT_DEBUG_LOG(RT_DEBUG_USB, ("error\n")); - pipe->status = UPIPE_STATUS_ERROR; - if (pipe->callback != RT_NULL) - { - pipe->callback(pipe); - } - (void)USB_HostFreeTransfer(imxrt_usb_host_obj[USBH0_INDEX].host_handle, transfer); - return -1; - break; - } - } -} - -static rt_uint16_t _ehci0_pipe_index = 0; -static rt_uint8_t _ehci0_get_free_pipe_index(void) -{ - rt_uint8_t idx; - for (idx = 1; idx < 16; idx++) - { - if (!(_ehci0_pipe_index & (0x01 << idx))) - { - _ehci0_pipe_index |= (0x01 << idx); - return idx; - } - } - return 0xff; -} - -static void _ehci0_free_pipe_index(rt_uint8_t index) -{ - _ehci0_pipe_index &= ~(0x01 << index); -} - -static rt_err_t _ehci0_open_pipe(upipe_t pipe) -{ - pipe->pipe_index = _ehci0_get_free_pipe_index(); - if (pipe->pipe_index == 0xFF) - { - return -RT_ERROR; - } - usb_host_pipe_init_t pipe_init = - { - .devInstance = imxrt_usb_host_obj[USBH0_INDEX].device_handle, - .pipeType = pipe->ep.bmAttributes, - .direction = (pipe->ep.bEndpointAddress & USB_DIR_IN) ? USB_IN : USB_OUT, - .endpointAddress = (pipe->ep.bEndpointAddress & USB_DESCRIPTOR_ENDPOINT_ADDRESS_NUMBER_MASK), - .interval = pipe->ep.bInterval, - .maxPacketSize = (uint16_t)(pipe->ep.wMaxPacketSize & USB_DESCRIPTOR_ENDPOINT_MAXPACKETSIZE_SIZE_MASK), - .numberPerUframe = (uint8_t)(pipe->ep.wMaxPacketSize & USB_DESCRIPTOR_ENDPOINT_MAXPACKETSIZE_MULT_TRANSACTIONS_MASK), - .nakCount = USB_HOST_CONFIG_MAX_NAK, - }; - USB_HostOpenPipe(imxrt_usb_host_obj[USBH0_INDEX].host_handle, &imxrt_usb_host_obj[USBH0_INDEX].pipes[pipe->pipe_index].pipe_handle, &pipe_init); - return RT_EOK; -} - -static rt_err_t _ehci0_close_pipe(upipe_t pipe) -{ - (void)USB_HostClosePipe(imxrt_usb_host_obj[USBH0_INDEX].host_handle, imxrt_usb_host_obj[USBH0_INDEX].pipes[pipe->pipe_index].pipe_handle); - _ehci0_free_pipe_index(pipe->pipe_index); - return RT_EOK; -} - -static struct uhcd_ops _ehci0_uhcd_ops = -{ - _ehci0_reset_port, - _ehci0_pipe_xfer, - _ehci0_open_pipe, - _ehci0_close_pipe, -}; - -static usb_status_t usb0_host_callback(usb_device_handle handle, usb_host_configuration_handle config_handle, rt_uint32_t event_code) -{ - usb_status_t status = kStatus_USB_Success; - - switch (event_code) - { - case kUSB_HostEventAttach: - if (!imxrt_usb_host_obj[USBH0_INDEX].connect_status) - { - imxrt_usb_host_obj[USBH0_INDEX].connect_status = RT_TRUE; - imxrt_usb_host_obj[USBH0_INDEX].device_handle = handle; - RT_DEBUG_LOG(RT_DEBUG_USB, ("usb connected\n")); - rt_usbh_root_hub_connect_handler(&(imxrt_usb_host_obj[USBH0_INDEX].uhcd), OTG_PORT, RT_TRUE); - } - break; - - case kUSB_HostEventNotSupported: - RT_DEBUG_LOG(RT_DEBUG_USB, ("usb device not supported\n")); - break; - - case kUSB_HostEventEnumerationDone: - RT_DEBUG_LOG(RT_DEBUG_USB, ("enumeration done\n")); - break; - - case kUSB_HostEventDetach: - if (imxrt_usb_host_obj[USBH0_INDEX].connect_status) - { - imxrt_usb_host_obj[USBH0_INDEX].connect_status = RT_FALSE; - imxrt_usb_host_obj[USBH0_INDEX].device_handle = handle; - RT_DEBUG_LOG(RT_DEBUG_USB, ("usb disconnnect\n")); - rt_usbh_root_hub_disconnect_handler(&(imxrt_usb_host_obj[USBH0_INDEX].uhcd), OTG_PORT); - (void)USB_HostCloseDeviceInterface(handle, NULL); - } - break; - - default: - break; - } - return status; -} - -rt_thread_t usbh0_thread; - -static void _ehci0_usbh_thread(void* param) -{ - while (1) - { - USB_HostEhciTaskFunction(imxrt_usb_host_obj[USBH0_INDEX].host_handle); - } -} - -static rt_err_t _ehci0_usbh_init(rt_device_t device) -{ - USB_HostClockInit(kUSB_ControllerEhci0); - - if (kStatus_USB_Success == USB_HostInit(kUSB_ControllerEhci0, &imxrt_usb_host_obj[USBH0_INDEX].host_handle, usb0_host_callback)) - { - usbh0_thread = rt_thread_create("ehci0", _ehci0_usbh_thread, RT_NULL, 500, 4, 9999999); - rt_thread_startup(usbh0_thread); - USB_HostIsrEnable(kUSB_ControllerEhci0); - } - else - { - rt_kprintf("USB_HostInit ehci0 error\r\n"); - return -RT_ERROR; - } - return RT_EOK; -} -#endif - -#ifdef BSP_USB1_HOST -void USB_OTG2_IRQHandler(void) -{ - /* enter interrupt */ - rt_interrupt_enter(); - - USB_HostEhciIsrFunction(imxrt_usb_host_obj[USBH1_INDEX].host_handle); - /* leave interrupt */ - rt_interrupt_leave(); -} - -static rt_err_t _ehci1_reset_port(rt_uint8_t port) -{ - // No reset port function available - return RT_EOK; -} - -static uint8_t _ehci1_pipe_buf[64]; -static uint8_t _ehci1_pipe_idx; - -static int _ehci1_pipe_xfer(upipe_t pipe, rt_uint8_t token, void *buffer, int nbytes, int timeouts) -{ - int timeout = timeouts; - - if (!imxrt_usb_host_obj[USBH1_INDEX].connect_status) - { - return -1; - } - usb_host_transfer_t *transfer; - if (imxrt_usb_host_obj[USBH1_INDEX].pipes[pipe->pipe_index].pipe_handle == NULL) - { - RT_DEBUG_LOG(RT_DEBUG_USB, ("error operation on null pipe\n")); - return -1; - } - if (USB_HostMallocTransfer(imxrt_usb_host_obj[USBH1_INDEX].host_handle, &transfer) != kStatus_USB_Success) - { - RT_DEBUG_LOG(RT_DEBUG_USB, ("error to get transfer\n")); - return -1; - } - transfer->transferBuffer = buffer; - transfer->transferLength = nbytes; - transfer->transferSofar = 0; - transfer->callbackFn = _imxrt_usb_host_send_callback; - transfer->callbackParam = &(imxrt_usb_host_obj[USBH1_INDEX].pipes[pipe->pipe_index]); - transfer->direction = (pipe->ep.bEndpointAddress & USB_DIR_IN) ? USB_IN : USB_OUT; - if (pipe->ep.bmAttributes == USB_ENDPOINT_CONTROL) - { - if (token == USBH_PID_SETUP) - { - struct urequest *setup = (struct urequest *)buffer; - transfer->setupStatus = 0; - transfer->setupPacket->bmRequestType = setup->request_type; - transfer->setupPacket->bRequest = setup->bRequest; - transfer->setupPacket->wIndex = setup->wIndex; - transfer->setupPacket->wLength = setup->wLength; - transfer->setupPacket->wValue = setup->wValue; - transfer->transferBuffer = RT_NULL; - transfer->transferLength = 0; - transfer->next = RT_NULL; - if ((transfer->setupPacket->bmRequestType & USB_REQUEST_TYPE_DIR_MASK) == USB_REQUEST_TYPE_DIR_IN) - { - transfer->direction = USB_IN; - transfer->transferBuffer = _ehci1_pipe_buf; - transfer->transferLength = setup->wLength; - _ehci1_pipe_idx = 0; - } - else - { - transfer->direction = USB_OUT; - } - } - else - { - rt_memcpy(buffer, _ehci1_pipe_buf + _ehci1_pipe_idx, nbytes); - imxrt_usb_host_obj[USBH1_INDEX].pipes[pipe->pipe_index].transfer_status = kStatus_USB_Success; - transfer->transferSofar = nbytes; - _ehci1_pipe_idx += nbytes; - if (_ehci1_pipe_idx >= 64) - { - _ehci1_pipe_idx = 0; - } - goto _ehci1_pipe_xfer_finish; - } - - } - rt_completion_init(&(imxrt_usb_host_obj[USBH1_INDEX].pipes[pipe->pipe_index].urb_completion)); - if (USB_HostEhciWritePipe(((usb_host_instance_t *)imxrt_usb_host_obj[USBH1_INDEX].host_handle)->controllerHandle, imxrt_usb_host_obj[USBH1_INDEX].pipes[pipe->pipe_index].pipe_handle, transfer) != kStatus_USB_Success) - { - RT_DEBUG_LOG(RT_DEBUG_USB, ("usb host failed to send\n")); - (void)USB_HostFreeTransfer(imxrt_usb_host_obj[USBH1_INDEX].host_handle, transfer); - return -1; - } - if (-RT_ETIMEOUT == rt_completion_wait(&(imxrt_usb_host_obj[USBH1_INDEX].pipes[pipe->pipe_index].urb_completion), RT_WAITING_FOREVER)) - { - RT_DEBUG_LOG(RT_DEBUG_USB, ("usb transfer timeout\n")); - (void)USB_HostFreeTransfer(imxrt_usb_host_obj[USBH1_INDEX].host_handle, transfer); - return -1; - } - // rt_thread_mdelay(1); - _ehci1_pipe_xfer_finish: - switch (imxrt_usb_host_obj[USBH1_INDEX].pipes[pipe->pipe_index].transfer_status) - { - case kStatus_USB_Success: - { - RT_DEBUG_LOG(RT_DEBUG_USB, ("ok\n")); - pipe->status = UPIPE_STATUS_OK; - if (pipe->callback != RT_NULL) - { - pipe->callback(pipe); - } - size_t size = transfer->transferSofar; - (void)USB_HostFreeTransfer(imxrt_usb_host_obj[USBH1_INDEX].host_handle, transfer); - if (pipe->ep.bEndpointAddress & 0x80) - { - return size; - } - else if (pipe->ep.bEndpointAddress & 0x00) - { - return size; - } - return nbytes; - break; - } - case kStatus_USB_TransferStall: - { - RT_DEBUG_LOG(RT_DEBUG_USB, ("stall\n")); - pipe->status = UPIPE_STATUS_STALL; - if (pipe->callback != RT_NULL) - { - pipe->callback(pipe); - } - (void)USB_HostFreeTransfer(imxrt_usb_host_obj[USBH1_INDEX].host_handle, transfer); - return -1; - break; - } - case kStatus_USB_TransferFailed: - default: - { - RT_DEBUG_LOG(RT_DEBUG_USB, ("error\n")); - pipe->status = UPIPE_STATUS_ERROR; - if (pipe->callback != RT_NULL) - { - pipe->callback(pipe); - } - (void)USB_HostFreeTransfer(imxrt_usb_host_obj[USBH1_INDEX].host_handle, transfer); - return -1; - break; - } - } -} - -static rt_uint16_t _ehci1_pipe_index = 0; -static rt_uint8_t _ehci1_get_free_pipe_index(void) -{ - rt_uint8_t idx; - for (idx = 1; idx < 16; idx++) - { - if (!(_ehci1_pipe_index & (0x01 << idx))) - { - _ehci1_pipe_index |= (0x01 << idx); - return idx; - } - } - return 0xff; -} - -static void _ehci1_free_pipe_index(rt_uint8_t index) -{ - _ehci1_pipe_index &= ~(0x01 << index); -} - -static rt_err_t _ehci1_open_pipe(upipe_t pipe) -{ - pipe->pipe_index = _ehci1_get_free_pipe_index(); - if (pipe->pipe_index == 0xFF) - { - return -RT_ERROR; - } - usb_host_pipe_init_t pipe_init = - { - .devInstance = imxrt_usb_host_obj[USBH1_INDEX].device_handle, - .pipeType = pipe->ep.bmAttributes, - .direction = (pipe->ep.bEndpointAddress & USB_DIR_IN) ? USB_IN : USB_OUT, - .endpointAddress = (pipe->ep.bEndpointAddress & USB_DESCRIPTOR_ENDPOINT_ADDRESS_NUMBER_MASK), - .interval = pipe->ep.bInterval, - .maxPacketSize = (uint16_t)(pipe->ep.wMaxPacketSize & USB_DESCRIPTOR_ENDPOINT_MAXPACKETSIZE_SIZE_MASK), - .numberPerUframe = (uint8_t)(pipe->ep.wMaxPacketSize & USB_DESCRIPTOR_ENDPOINT_MAXPACKETSIZE_MULT_TRANSACTIONS_MASK), - .nakCount = USB_HOST_CONFIG_MAX_NAK, - }; - USB_HostOpenPipe(imxrt_usb_host_obj[USBH1_INDEX].host_handle, &imxrt_usb_host_obj[USBH1_INDEX].pipes[pipe->pipe_index].pipe_handle, &pipe_init); - return RT_EOK; -} - -static rt_err_t _ehci1_close_pipe(upipe_t pipe) -{ - (void)USB_HostClosePipe(imxrt_usb_host_obj[USBH1_INDEX].host_handle, imxrt_usb_host_obj[USBH1_INDEX].pipes[pipe->pipe_index].pipe_handle); - _ehci1_free_pipe_index(pipe->pipe_index); - return RT_EOK; -} - -static struct uhcd_ops _ehci1_uhcd_ops = -{ - _ehci1_reset_port, - _ehci1_pipe_xfer, - _ehci1_open_pipe, - _ehci1_close_pipe, -}; - -static usb_status_t usb1_host_callback(usb_device_handle handle, usb_host_configuration_handle config_handle, rt_uint32_t event_code) -{ - usb_status_t status = kStatus_USB_Success; - - switch (event_code) - { - case kUSB_HostEventAttach: - if (!imxrt_usb_host_obj[USBH1_INDEX].connect_status) - { - imxrt_usb_host_obj[USBH1_INDEX].connect_status = RT_TRUE; - imxrt_usb_host_obj[USBH1_INDEX].device_handle = handle; - RT_DEBUG_LOG(RT_DEBUG_USB, ("usb connected\n")); - rt_usbh_root_hub_connect_handler(&(imxrt_usb_host_obj[USBH1_INDEX].uhcd), OTG_PORT, RT_TRUE); - } - break; - - case kUSB_HostEventNotSupported: - RT_DEBUG_LOG(RT_DEBUG_USB, ("usb device not supported\n")); - break; - - case kUSB_HostEventEnumerationDone: - RT_DEBUG_LOG(RT_DEBUG_USB, ("enumeration done\n")); - break; - - case kUSB_HostEventDetach: - if (imxrt_usb_host_obj[USBH1_INDEX].connect_status) - { - imxrt_usb_host_obj[USBH1_INDEX].connect_status = RT_FALSE; - imxrt_usb_host_obj[USBH1_INDEX].device_handle = handle; - RT_DEBUG_LOG(RT_DEBUG_USB, ("usb disconnnect\n")); - rt_usbh_root_hub_disconnect_handler(&(imxrt_usb_host_obj[USBH1_INDEX].uhcd), OTG_PORT); - (void)USB_HostCloseDeviceInterface(handle, NULL); - } - break; - - default: - break; - } - return status; -} - -rt_thread_t usbh1_thread; - -static void _ehci1_usbh_thread(void* param) -{ - while (1) - { - USB_HostEhciTaskFunction(imxrt_usb_host_obj[USBH1_INDEX].host_handle); - } -} - -static rt_err_t _ehci1_usbh_init(rt_device_t device) -{ - USB_HostClockInit(kUSB_ControllerEhci1); - - if (kStatus_USB_Success == USB_HostInit(kUSB_ControllerEhci1, &imxrt_usb_host_obj[USBH1_INDEX].host_handle, usb1_host_callback)) - { - usbh1_thread = rt_thread_create("ehci1", _ehci1_usbh_thread, RT_NULL, 500, 4, 9999999); - rt_thread_startup(usbh1_thread); - USB_HostIsrEnable(kUSB_ControllerEhci1); - } - else - { - rt_kprintf("USB_HostInit ehci1 error\r\n"); - return -RT_ERROR; - } - return RT_EOK; -} -#endif - -int imxrt_usbh_register(void) -{ - rt_err_t res = -RT_ERROR; - struct imxrt_usb_host *usb_host_obj; - -#ifdef BSP_USB0_HOST - usb_host_obj = &(imxrt_usb_host_obj[USBH0_INDEX]); - rt_memset((void *)(&(usb_host_obj->uhcd)), 0, sizeof(struct uhcd)); - usb_host_obj->uhcd.parent.type = RT_Device_Class_USBHost; - usb_host_obj->uhcd.parent.init = _ehci0_usbh_init; - usb_host_obj->uhcd.parent.user_data = usb_host_obj; - usb_host_obj->uhcd.ops = &_ehci0_uhcd_ops; - usb_host_obj->uhcd.num_ports = OTG_PORT; - res = rt_device_register(&(usb_host_obj->uhcd.parent), usb_host_obj->name, RT_DEVICE_FLAG_DEACTIVATE); - if (res != RT_EOK) - { - rt_kprintf("register usb0 host failed res = %d\r\n", res); - return -RT_ERROR; - } - - rt_usb_host_init(usb_host_obj->name); -#endif -#ifdef BSP_USB1_HOST - usb_host_obj = &(imxrt_usb_host_obj[USBH1_INDEX]); - rt_memset((void *)(&(usb_host_obj->uhcd)), 0, sizeof(struct uhcd)); - usb_host_obj->uhcd.parent.type = RT_Device_Class_USBHost; - usb_host_obj->uhcd.parent.init = _ehci1_usbh_init; - usb_host_obj->uhcd.parent.user_data = usb_host_obj; - usb_host_obj->uhcd.ops = &_ehci1_uhcd_ops; - usb_host_obj->uhcd.num_ports = OTG_PORT; - res = rt_device_register(&(usb_host_obj->uhcd.parent), usb_host_obj->name, RT_DEVICE_FLAG_DEACTIVATE); - if (res != RT_EOK) - { - rt_kprintf("register usb0 host failed res = %d\r\n", res); - return -RT_ERROR; - } - - rt_usb_host_init(usb_host_obj->name); -#endif - return RT_EOK; -} -INIT_DEVICE_EXPORT(imxrt_usbh_register); - -#endif \ No newline at end of file diff --git a/bsp/imxrt/libraries/drivers/drv_usbh.h b/bsp/imxrt/libraries/drivers/drv_usbh.h deleted file mode 100644 index 9cd4ee0e7d..0000000000 --- a/bsp/imxrt/libraries/drivers/drv_usbh.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (c) 2006-2018, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2017-12-12 ZYH the first version - * 2019-12-19 tyustli port to stm32 series - * 2021-01-19 Leslie Lee port to imxrt series - */ -#ifndef __DRV_USBH_H__ -#define __DRV_USBH_H__ -#include - -#define OTG_PORT 1 - -int imxrt_usbh_register(void); - -#endif - -/************* end of file ************/ diff --git a/bsp/imxrt/libraries/drivers/usb/host/usb_host.h b/bsp/imxrt/libraries/drivers/usb/host/usb_host.h index 6d9167ceac..53be402cd3 100644 --- a/bsp/imxrt/libraries/drivers/usb/host/usb_host.h +++ b/bsp/imxrt/libraries/drivers/usb/host/usb_host.h @@ -1,9 +1,31 @@ /* * Copyright (c) 2015 - 2016, Freescale Semiconductor, Inc. - * Copyright 2016 - 2019 NXP - * All rights reserved. + * Copyright 2016 NXP * - * SPDX-License-Identifier: BSD-3-Clause + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * o Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * o Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * o Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef _USB_HOST_H_ @@ -46,16 +68,6 @@ typedef enum _usb_host_event kUSB_HostEventDetach, /*!< Device is detached */ kUSB_HostEventEnumerationDone, /*!< Device's enumeration is done and the device is supported */ kUSB_HostEventNotSupported, /*!< Device's enumeration is done and the device is not supported */ - /*! Device's enumeration failed due to errors - * fail reason is put in the high 2 bytes of callback event code. - * kStatus_USB_TransferFailed - the transfer failed. - * kStatus_USB_TransferCancel - transfer is canceled by application. - * kStatus_USB_Error - parsing descriptor failed, the power cannot satisfy device's requirement, - * device addresss allocation failed, transfer is not enough - * or the transfer API failed. - * kStatus_USB_AllocFail - malloc failed. - */ - kUSB_HostEventEnumerationFail, #if ((defined(USB_HOST_CONFIG_LOW_POWER_MODE)) && (USB_HOST_CONFIG_LOW_POWER_MODE > 0U)) kUSB_HostEventNotSuspended, /*!< Suspend failed */ kUSB_HostEventSuspended, /*!< Suspend successful */ @@ -91,60 +103,7 @@ typedef enum _usb_host_dev_info kUSB_HostGetConfigurationDes, /*!< Device's configuration descriptor pointer */ kUSB_HostGetConfigurationLength, /*!< Device's configuration descriptor pointer */ } usb_host_dev_info_t; -/*! @brief Request type */ -typedef enum _usb_host_request_type -{ - kRequestDevice = 1U, /*!< Control request object is device */ - kRequestInterface, /*!< Control request object is interface */ - kRequestEndpoint, /*!< Control request object is endpoint */ -} usb_host_request_type_t; -/*! @brief For USB_REQUEST_STANDARD_GET_DESCRIPTOR and USB_REQUEST_STANDARD_SET_DESCRIPTOR */ -typedef struct _usb_host_process_descriptor_param -{ - uint8_t descriptorType; /*!< See the usb_spec.h, such as the USB_DESCRIPTOR_TYPE_DEVICE */ - uint8_t descriptorIndex; /*!< The descriptor index is used to select a specific descriptor (only for configuration - and string descriptors) when several descriptors of the same type are implemented in a - device */ - uint8_t languageId; /*!< It specifies the language ID for string descriptors or is reset to zero for other - descriptors */ - uint8_t *descriptorBuffer; /*!< Buffer pointer */ - uint16_t descriptorLength; /*!< Buffer data length */ -} usb_host_process_descriptor_param_t; -/*! @brief For USB_REQUEST_STANDARD_CLEAR_FEATURE and USB_REQUEST_STANDARD_SET_FEATURE */ -typedef struct _usb_host_process_feature_param -{ - uint8_t requestType; /*!< See the #usb_host_request_type_t */ - uint8_t featureSelector; /*!< Set/cleared feature */ - uint8_t interfaceOrEndpoint; /*!< Interface or end pointer */ -} usb_host_process_feature_param_t; -/*! @brief For USB_REQUEST_STANDARD_GET_INTERFACE */ -typedef struct _usb_host_get_interface_param -{ - uint8_t interface; /*!< Interface number */ - uint8_t *alternateInterfaceBuffer; /*!< Save the transfer result */ -} usb_host_get_interface_param_t; -/*! @brief For USB_REQUEST_STANDARD_GET_STATUS */ -typedef struct _usb_host_get_status_param -{ - uint16_t statusSelector; /*!< Interface number, the end pointer number or OTG status selector */ - uint8_t requestType; /*!< See the #usb_host_request_type_t */ - uint8_t *statusBuffer; /*!< Save the transfer result */ -} usb_host_get_status_param_t; - -/*! @brief For USB_REQUEST_STANDARD_SET_INTERFACE */ -typedef struct _usb_host_set_interface_param -{ - uint8_t alternateSetting; /*!< Alternate setting value */ - uint8_t interface; /*!< Interface number */ -} usb_host_set_interface_param_t; - -/*! @brief For USB_REQUEST_STANDARD_SYNCH_FRAME */ -typedef struct _usb_host_synch_frame_param -{ - uint8_t endpoint; /*!< Endpoint number */ - uint8_t *frameNumberBuffer; /*!< Frame number data buffer */ -} usb_host_synch_frame_param_t; /*! * @brief Host callback function typedef. * @@ -284,8 +243,8 @@ typedef struct _usb_host_pipe_init /*! @brief Cancel transfer parameter structure */ typedef struct _usb_host_cancel_param { - usb_host_pipe_handle pipeHandle; /*!< Canceling pipe handle*/ - usb_host_transfer_t *transfer; /*!< Canceling transfer*/ + usb_host_pipe_handle pipeHandle; /*!< Cancelling pipe handle*/ + usb_host_transfer_t *transfer; /*!< Cancelling transfer*/ } usb_host_cancel_param_t; /******************************************************************************* @@ -383,7 +342,7 @@ extern usb_status_t USB_HostHelperParseAlternateSetting(usb_host_interface_handl * @retval kStatus_USB_InvalidParameter The deviceHandle instance don't belong to hostHandle instance. */ extern usb_status_t USB_HostRemoveDevice(usb_host_handle hostHandle, usb_device_handle deviceHandle); -#if (defined(USB_HOST_CONFIG_KHCI) && (USB_HOST_CONFIG_KHCI > 0U)) + /*! * @brief KHCI task function. * @@ -394,8 +353,7 @@ extern usb_status_t USB_HostRemoveDevice(usb_host_handle hostHandle, usb_device_ * @param[in] hostHandle The host handle. */ extern void USB_HostKhciTaskFunction(void *hostHandle); -#endif -#if (defined(USB_HOST_CONFIG_EHCI) && (USB_HOST_CONFIG_EHCI > 0U)) + /*! * @brief EHCI task function. * @@ -406,8 +364,7 @@ extern void USB_HostKhciTaskFunction(void *hostHandle); * @param[in] hostHandle The host handle. */ extern void USB_HostEhciTaskFunction(void *hostHandle); -#endif -#if (defined(USB_HOST_CONFIG_OHCI) && (USB_HOST_CONFIG_OHCI > 0U)) + /*! * @brief OHCI task function. * @@ -418,8 +375,7 @@ extern void USB_HostEhciTaskFunction(void *hostHandle); * @param[in] hostHandle The host handle. */ extern void USB_HostOhciTaskFunction(void *hostHandle); -#endif -#if (defined(USB_HOST_CONFIG_IP3516HS) && (USB_HOST_CONFIG_IP3516HS > 0U)) + /*! * @brief IP3516HS task function. * @@ -430,8 +386,7 @@ extern void USB_HostOhciTaskFunction(void *hostHandle); * @param[in] hostHandle The host handle. */ extern void USB_HostIp3516HsTaskFunction(void *hostHandle); -#endif -#if (defined(USB_HOST_CONFIG_KHCI) && (USB_HOST_CONFIG_KHCI > 0U)) + /*! * @brief Device KHCI ISR function. * @@ -440,8 +395,7 @@ extern void USB_HostIp3516HsTaskFunction(void *hostHandle); * @param[in] hostHandle The host handle. */ extern void USB_HostKhciIsrFunction(void *hostHandle); -#endif -#if (defined(USB_HOST_CONFIG_EHCI) && (USB_HOST_CONFIG_EHCI > 0U)) + /*! * @brief Device EHCI ISR function. * @@ -450,8 +404,7 @@ extern void USB_HostKhciIsrFunction(void *hostHandle); * @param[in] hostHandle The host handle. */ extern void USB_HostEhciIsrFunction(void *hostHandle); -#endif -#if (defined(USB_HOST_CONFIG_OHCI) && (USB_HOST_CONFIG_OHCI > 0U)) + /*! * @brief Device OHCI ISR function. * @@ -460,8 +413,7 @@ extern void USB_HostEhciIsrFunction(void *hostHandle); * @param[in] hostHandle The host handle. */ extern void USB_HostOhciIsrFunction(void *hostHandle); -#endif -#if (defined(USB_HOST_CONFIG_IP3516HS) && (USB_HOST_CONFIG_IP3516HS > 0U)) + /*! * @brief Device IP3516HS ISR function. * @@ -470,7 +422,7 @@ extern void USB_HostOhciIsrFunction(void *hostHandle); * @param[in] hostHandle The host handle. */ extern void USB_HostIp3516HsIsrFunction(void *hostHandle); -#endif + /*! @}*/ /*! @@ -614,7 +566,7 @@ extern usb_status_t USB_HostFreeTransfer(usb_host_handle hostHandle, usb_host_tr * This function sends the USB standard request packet. * * @param[in] deviceHandle The device handle for control transfer. - * @param[in] usbRequest A USB standard request code. See the usb_spec.h. + * @param[in] usbRequest A USB standard request code. Se the usb_spec.h. * @param[in] transfer The used transfer. * @param[in] param The parameter structure is different for different request, see * usb_host_framework.h. @@ -742,10 +694,10 @@ extern usb_status_t USB_HostL1ResumeDeviceResquest(usb_host_handle hostHandle, /*! * @brief Update the lpm param. * - * The function is used to configure the lpm token. + * The function is used to configuure the lpm token. * * @param[in] hostHandle The host handle. - * @param[in] lpmParam HIRD value and whether enable remotewakeup. + * @param[in] lpmParam HIRD vaule and whether enable remotewakeup. * */ extern usb_status_t USB_HostL1SleepDeviceResquestConfig(usb_host_handle hostHandle, uint8_t *lpmParam); @@ -763,19 +715,6 @@ extern usb_status_t USB_HostUpdateHwTick(usb_host_handle hostHandle, uint64_t ti #endif -#if ((defined(USB_HOST_CONFIG_BATTERY_CHARGER)) && (USB_HOST_CONFIG_BATTERY_CHARGER > 0U)) -/*! - * @brief Set the charger type. It is only supported on RT600 currently. - * - * The set charger type becomes valid in next attach. - * - * @param[in] hostHandle The host handle. - * @param[in] type. - * - */ -extern usb_status_t USB_HostSetChargerType(usb_host_handle hostHandle, uint8_t type); -#endif - /*! @}*/ #ifdef __cplusplus diff --git a/bsp/imxrt/libraries/drivers/usb/host/usb_host_devices.c b/bsp/imxrt/libraries/drivers/usb/host/usb_host_devices.c index 2bbc89233a..42b16e071e 100644 --- a/bsp/imxrt/libraries/drivers/usb/host/usb_host_devices.c +++ b/bsp/imxrt/libraries/drivers/usb/host/usb_host_devices.c @@ -1,28 +1,46 @@ /* * Copyright (c) 2015 - 2016, Freescale Semiconductor, Inc. - * Copyright 2016,2019 NXP + * Copyright 2016 NXP * - * SPDX-License-Identifier: BSD-3-Clause + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * o Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * o Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * o Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include +#include #include "usb_host.h" #include "usb_host_hci.h" #include "usb_host_devices.h" -#include "usb_host_framework.h" + #if ((defined USB_HOST_CONFIG_HUB) && (USB_HOST_CONFIG_HUB)) #include "usb_host_hub.h" -#include "usb_host_hub_app.h" #endif /* USB_HOST_CONFIG_HUB */ /******************************************************************************* * Definitions ******************************************************************************/ -#ifndef USB_HOST_CONFIG_MAX_CONFIGURATION_DESCRIPTOR_LENGTH -#define USB_HOST_CONFIG_MAX_CONFIGURATION_DESCRIPTOR_LENGTH (5000U) -#endif - /******************************************************************************* * Prototypes ******************************************************************************/ @@ -52,7 +70,7 @@ static usb_status_t USB_HostProcessState(usb_host_device_instance_t *deviceInsta * * @return kStatus_USB_Success or error codes */ -static usb_status_t USB_HostProcessCallback(usb_host_device_instance_t *deviceInstance, uint32_t dataLength); +static usb_status_t USB_HostProcessCallback(usb_host_device_instance_t *deviceInstance); /*! * @brief notify the application event, the callback is registered when initializing host. @@ -62,10 +80,7 @@ static usb_status_t USB_HostProcessCallback(usb_host_device_instance_t *deviceIn * * @return kStatus_USB_Success or error codes */ -static usb_status_t USB_HostNotifyDevice(usb_host_handle hostHandle, - usb_host_device_instance_t *deviceInstance, - uint32_t eventCode, - uint32_t eventParameter); +static usb_status_t USB_HostNotifyDevice(usb_host_device_instance_t *deviceInstance, uint32_t eventCode); /*! * @brief allocate one address. @@ -125,57 +140,68 @@ static usb_status_t USB_HostRemoveDeviceInstance(usb_host_handle hostHandle, usb */ static usb_status_t USB_HostControlBus(usb_host_handle hostHandle, uint8_t controlType); +extern usb_status_t USB_HostStandardSetGetDescriptor(usb_host_device_instance_t *deviceInstance, + usb_host_transfer_t *transfer, + void *param); +extern usb_status_t USB_HostStandardSetAddress(usb_host_device_instance_t *deviceInstance, + usb_host_transfer_t *transfer, + void *param); +extern usb_status_t USB_HostCh9RequestCommon(usb_host_device_instance_t *deviceInstance, + usb_host_transfer_t *transfer, + uint8_t *buffer, + uint32_t bufferLen); + #if ((defined USB_HOST_CONFIG_HUB) && (USB_HOST_CONFIG_HUB)) +extern usb_status_t USB_HostHubDeviceEvent(usb_host_handle hostHandle, + usb_device_handle deviceHandle, + usb_host_configuration_handle configurationHandle, + uint32_t eventCode); + +extern uint32_t USB_HostHubGetHsHubNumber(usb_host_handle hostHandle, uint8_t parentHubNo); + +extern uint32_t USB_HostHubGetHsHubPort(usb_host_handle hostHandle, uint8_t parentHubNo, uint8_t parentPortNo); + +extern usb_status_t USB_HostHubRemovePort(usb_host_handle hostHandle, uint8_t hubNumber, uint8_t portNumber); + #endif /******************************************************************************* * Variables ******************************************************************************/ +extern usb_host_instance_t g_UsbHostInstance[USB_HOST_CONFIG_MAX_HOST]; + /*! @brief enumeration step process array */ -static const usb_host_enum_process_entry_t s_EnumEntries[] = { +static const usb_host_enum_process_entry_t s_EnumEntries[] = \ +{ /* kStatus_dev_initial */ { - kStatus_DEV_Notinit, - kStatus_DEV_Notinit, - NULL, + 0, 0, NULL, }, /* kStatus_DEV_GetDes8 */ { - kStatus_DEV_SetAddress, - kStatus_DEV_GetDes8, - USB_HostProcessCallback, + kStatus_DEV_SetAddress, kStatus_DEV_GetDes8, USB_HostProcessCallback, }, /* kStatus_DEV_SetAddress */ { - kStatus_DEV_GetDes, - kStatus_DEV_SetAddress, - USB_HostProcessCallback, + kStatus_DEV_GetDes, kStatus_DEV_SetAddress, USB_HostProcessCallback, }, /* kStatus_DEV_GetDes */ { - kStatus_DEV_GetCfg9, - kStatus_DEV_GetDes, - NULL, + kStatus_DEV_GetCfg9, kStatus_DEV_GetDes, NULL, }, /* kStatus_DEV_GetCfg9 */ { - kStatus_DEV_GetCfg, - kStatus_DEV_GetCfg9, - USB_HostProcessCallback, + kStatus_DEV_GetCfg, kStatus_DEV_GetCfg9, USB_HostProcessCallback, }, /* kStatus_DEV_GetCfg */ { - kStatus_DEV_SetCfg, - kStatus_DEV_GetCfg9, - USB_HostProcessCallback, + kStatus_DEV_SetCfg, kStatus_DEV_GetCfg9, USB_HostProcessCallback, }, /* kStatus_DEV_SetCfg */ { - kStatus_DEV_EnumDone, - kStatus_DEV_SetCfg, - NULL, + kStatus_DEV_EnumDone, kStatus_DEV_SetCfg, NULL, }, }; @@ -185,66 +211,69 @@ static const usb_host_enum_process_entry_t s_EnumEntries[] = { static void USB_HostEnumerationTransferCallback(void *param, usb_host_transfer_t *transfer, usb_status_t status) { - /* 0 - retry current transfer, 1 - transfer success process, - * 2 - retry whole process, 3 - fail process - */ - uint8_t nextStep = 0U; + uint8_t nextStep = 0; usb_host_device_instance_t *deviceInstance = (usb_host_device_instance_t *)param; - usb_status_t failReason = kStatus_USB_Success; - uint32_t dataLength; - dataLength = transfer->transferSofar; - (void)USB_HostFreeTransfer(deviceInstance->hostHandle, transfer); /* free transfer */ + USB_HostFreeTransfer(deviceInstance->hostHandle, transfer); /* free transfer */ if (status == kStatus_USB_Success) { - nextStep = 1U; + nextStep = 1; } else if (status == kStatus_USB_TransferStall) { #if ((defined USB_HOST_CONFIG_COMPLIANCE_TEST) && (USB_HOST_CONFIG_COMPLIANCE_TEST)) - (void)usb_echo("no response from device\r\n"); -#endif /* USB_HOST_CONFIG_COMPLIANCE_TEST */ - if (deviceInstance->stallRetries > 0U) /* retry same transfer when stall */ + usb_echo("no response from device\r\n"); +#endif /* USB_HOST_CONFIG_COMPLIANCE_TEST */ + if (deviceInstance->stallRetries > 0) /* retry same transfer when stall */ { - nextStep = 0U; deviceInstance->stallRetries--; } - else + else /* process next state when all retries stall */ { - failReason = kStatus_USB_TransferFailed; - nextStep = 2U; + nextStep = 1; } } else if (status == kStatus_USB_TransferCancel) { - failReason = kStatus_USB_TransferCancel; - nextStep = 3U; + return; } else { - failReason = kStatus_USB_TransferFailed; - nextStep = 2U; - } - - if (nextStep == 1U) - { - deviceInstance->stallRetries = USB_HOST_CONFIG_ENUMERATION_MAX_STALL_RETRIES; - if (s_EnumEntries[deviceInstance->state - 1U].process == NULL) + if (deviceInstance->enumRetries > 0) /* next whole retry */ { - deviceInstance->state = (uint8_t)s_EnumEntries[deviceInstance->state - 1U].successState; /* next state */ + deviceInstance->enumRetries--; + deviceInstance->stallRetries = USB_HOST_CONFIG_ENUMERATION_MAX_STALL_RETRIES; + deviceInstance->configurationValue = 0; + deviceInstance->state = kStatus_DEV_GetDes8; } else { - status = s_EnumEntries[deviceInstance->state - 1U].process( - deviceInstance, dataLength); /* process the previous state result */ +#if ((defined USB_HOST_CONFIG_COMPLIANCE_TEST) && (USB_HOST_CONFIG_COMPLIANCE_TEST)) + usb_echo("Device No Response\r\n"); +#endif + return; + } + } + + if (nextStep == 1) + { + deviceInstance->stallRetries = USB_HOST_CONFIG_ENUMERATION_MAX_STALL_RETRIES; + if (s_EnumEntries[deviceInstance->state - 1].process == NULL) + { + deviceInstance->state = s_EnumEntries[deviceInstance->state - 1].successState; /* next state */ + } + else + { + status = s_EnumEntries[deviceInstance->state - 1].process( + deviceInstance); /* process the previous state result */ if (status == kStatus_USB_Success) /* process success */ { - deviceInstance->state = (uint8_t)s_EnumEntries[deviceInstance->state - 1U].successState; + deviceInstance->state = s_EnumEntries[deviceInstance->state - 1].successState; } else if (status == kStatus_USB_Retry) /* need retry */ { - deviceInstance->state = (uint8_t)s_EnumEntries[deviceInstance->state - 1U].retryState; + deviceInstance->state = s_EnumEntries[deviceInstance->state - 1].retryState; } else if (status == kStatus_USB_NotSupported) /* device don't suport by the application */ { @@ -252,48 +281,30 @@ static void USB_HostEnumerationTransferCallback(void *param, usb_host_transfer_t } else /* process error, next retry */ { - /* kStatus_USB_Error or kStatus_USB_AllocFail */ - failReason = status; - nextStep = 2U; + if (deviceInstance->enumRetries > 0) /* next whole retry */ + { + deviceInstance->enumRetries--; + deviceInstance->stallRetries = USB_HOST_CONFIG_ENUMERATION_MAX_STALL_RETRIES; + deviceInstance->configurationValue = 0; + deviceInstance->state = kStatus_DEV_GetDes8; + } + else + { +#if ((defined USB_HOST_CONFIG_COMPLIANCE_TEST) && (USB_HOST_CONFIG_COMPLIANCE_TEST)) + usb_echo("Device No Response\r\n"); +#endif + return; /* unrecoverable fail */ + } } } } - if (nextStep == 2U) + if (USB_HostProcessState(deviceInstance) != kStatus_USB_Success) /* process the new state */ { - if (deviceInstance->enumRetries > 0U) /* next whole retry */ - { - deviceInstance->enumRetries--; - deviceInstance->stallRetries = USB_HOST_CONFIG_ENUMERATION_MAX_STALL_RETRIES; - deviceInstance->configurationValue = 0U; - deviceInstance->state = (uint8_t)kStatus_DEV_GetDes8; - } - else - { -#if ((defined USB_HOST_CONFIG_COMPLIANCE_TEST) && (USB_HOST_CONFIG_COMPLIANCE_TEST)) - usb_echo("Device No Response\r\n"); -#endif - nextStep = 3U; - } - } - - /* process the state */ - if (nextStep != 3U) - { - if (USB_HostProcessState(deviceInstance) != kStatus_USB_Success) - { #ifdef HOST_ECHO - usb_echo("enumation setup error\r\n"); + usb_echo("enumation setup error\r\n"); #endif - failReason = kStatus_USB_Error; - nextStep = 3U; - } - } - - if (nextStep == 3U) - { - (void)USB_HostNotifyDevice(deviceInstance->hostHandle, deviceInstance, (uint32_t)kUSB_HostEventEnumerationFail, - (uint32_t)failReason); + return; } } @@ -302,11 +313,9 @@ static usb_status_t USB_HostProcessState(usb_host_device_instance_t *deviceInsta usb_status_t status = kStatus_USB_Success; usb_host_process_descriptor_param_t getDescriptorParam; usb_host_transfer_t *transfer; - usb_host_device_enumeration_status_t state; /* malloc transfer */ - state = (usb_host_device_enumeration_status_t)deviceInstance->state; - if (state != kStatus_DEV_EnumDone) + if (deviceInstance->state != kStatus_DEV_EnumDone) { if (USB_HostMallocTransfer(deviceInstance->hostHandle, &transfer) != kStatus_USB_Success) { @@ -315,29 +324,29 @@ static usb_status_t USB_HostProcessState(usb_host_device_instance_t *deviceInsta #endif return kStatus_USB_Error; } - transfer->callbackFn = USB_HostEnumerationTransferCallback; + transfer->callbackFn = USB_HostEnumerationTransferCallback; transfer->callbackParam = deviceInstance; /* reset transfer fields */ - transfer->setupPacket->bmRequestType = 0x00U; - transfer->setupPacket->wIndex = 0U; - transfer->setupPacket->wLength = 0U; - transfer->setupPacket->wValue = 0U; + transfer->setupPacket->bmRequestType = 0x00; + transfer->setupPacket->wIndex = 0; + transfer->setupPacket->wLength = 0; + transfer->setupPacket->wValue = 0; } - switch (state) + switch (deviceInstance->state) { case kStatus_DEV_GetDes8: case kStatus_DEV_GetDes: /* get descriptor state */ getDescriptorParam.descriptorLength = sizeof(usb_descriptor_device_t); - if (deviceInstance->state == (uint8_t)kStatus_DEV_GetDes8) + if (deviceInstance->state == kStatus_DEV_GetDes8) { - getDescriptorParam.descriptorLength = 8U; + getDescriptorParam.descriptorLength = 8; } getDescriptorParam.descriptorBuffer = (uint8_t *)deviceInstance->deviceDescriptor; - getDescriptorParam.descriptorType = USB_DESCRIPTOR_TYPE_DEVICE; - getDescriptorParam.descriptorIndex = 0U; - getDescriptorParam.languageId = 0U; + getDescriptorParam.descriptorType = USB_DESCRIPTOR_TYPE_DEVICE; + getDescriptorParam.descriptorIndex = 0; + getDescriptorParam.languageId = 0; transfer->setupPacket->bmRequestType |= USB_REQUEST_TYPE_DIR_IN; transfer->setupPacket->bRequest = USB_REQUEST_STANDARD_GET_DESCRIPTOR; @@ -350,10 +359,10 @@ static usb_status_t USB_HostProcessState(usb_host_device_instance_t *deviceInsta case kStatus_DEV_GetCfg9: /* get 9 bytes configuration state */ getDescriptorParam.descriptorBuffer = deviceInstance->enumBuffer; - getDescriptorParam.descriptorType = USB_DESCRIPTOR_TYPE_CONFIGURE; - getDescriptorParam.descriptorIndex = deviceInstance->configurationValue; + getDescriptorParam.descriptorType = USB_DESCRIPTOR_TYPE_CONFIGURE; + getDescriptorParam.descriptorIndex = deviceInstance->configurationValue; getDescriptorParam.descriptorLength = 9; - getDescriptorParam.languageId = 0; + getDescriptorParam.languageId = 0; transfer->setupPacket->bmRequestType |= USB_REQUEST_TYPE_DIR_IN; transfer->setupPacket->bRequest = USB_REQUEST_STANDARD_GET_DESCRIPTOR; @@ -362,10 +371,10 @@ static usb_status_t USB_HostProcessState(usb_host_device_instance_t *deviceInsta case kStatus_DEV_GetCfg: /* get configuration state */ getDescriptorParam.descriptorBuffer = deviceInstance->configurationDesc; - getDescriptorParam.descriptorType = USB_DESCRIPTOR_TYPE_CONFIGURE; - getDescriptorParam.descriptorIndex = deviceInstance->configurationValue; + getDescriptorParam.descriptorType = USB_DESCRIPTOR_TYPE_CONFIGURE; + getDescriptorParam.descriptorIndex = deviceInstance->configurationValue; getDescriptorParam.descriptorLength = deviceInstance->configurationLen; - getDescriptorParam.languageId = 0; + getDescriptorParam.languageId = 0; transfer->setupPacket->bmRequestType |= USB_REQUEST_TYPE_DIR_IN; transfer->setupPacket->bRequest = USB_REQUEST_STANDARD_GET_DESCRIPTOR; @@ -376,71 +385,52 @@ static usb_status_t USB_HostProcessState(usb_host_device_instance_t *deviceInsta transfer->setupPacket->wValue = USB_SHORT_TO_LITTLE_ENDIAN(deviceInstance->configuration.configurationDesc->bConfigurationValue); transfer->setupPacket->bRequest = USB_REQUEST_STANDARD_SET_CONFIGURATION; - status = USB_HostCh9RequestCommon(deviceInstance, transfer, NULL, 0); + status = USB_HostCh9RequestCommon(deviceInstance, transfer, NULL, 0); break; case kStatus_DEV_EnumDone: /* enumeration done state */ - /* notify device enumeration done */ - status = USB_HostNotifyDevice(deviceInstance->hostHandle, deviceInstance, - (uint32_t)kUSB_HostEventEnumerationDone, (uint32_t)kStatus_USB_Success); + status = USB_HostNotifyDevice(deviceInstance, + kUSB_HostEventEnumerationDone); /* notify device enumeration done */ if (status == kStatus_USB_Success) { - deviceInstance->state = (uint8_t)kStatus_DEV_AppUsed; + deviceInstance->state = kStatus_DEV_AppUsed; } break; default: - /*no action*/ break; } return status; } -static usb_status_t USB_HostProcessCallback(usb_host_device_instance_t *deviceInstance, uint32_t dataLength) +static usb_status_t USB_HostProcessCallback(usb_host_device_instance_t *deviceInstance) { usb_host_pipe_t *pipe = (usb_host_pipe_t *)deviceInstance->controlPipe; - usb_status_t status = kStatus_USB_Success; + usb_status_t status = kStatus_USB_Success; usb_descriptor_configuration_t *configureDesc; usb_host_instance_t *hostInstance = (usb_host_instance_t *)deviceInstance->hostHandle; - void *temp; - usb_host_device_enumeration_status_t state; - state = (usb_host_device_enumeration_status_t)deviceInstance->state; - switch (state) + switch (deviceInstance->state) { case kStatus_DEV_GetDes8: /* process get 8 bytes descriptor result */ - if (dataLength != 8u) - { - return kStatus_USB_Error; - } pipe->maxPacketSize = deviceInstance->deviceDescriptor->bMaxPacketSize0; - /* the callbackFn is initialized in USB_HostGetControllerInterface */ - (void)hostInstance->controllerTable->controllerIoctl( + hostInstance->controllerTable->controllerIoctl( hostInstance->controllerHandle, kUSB_HostUpdateControlPacketSize, deviceInstance->controlPipe); break; case kStatus_DEV_SetAddress: /* process set address result */ deviceInstance->setAddress = deviceInstance->allocatedAddress; - /* the callbackFn is initialized in USB_HostGetControllerInterface */ - (void)hostInstance->controllerTable->controllerIoctl( + hostInstance->controllerTable->controllerIoctl( hostInstance->controllerHandle, kUSB_HostUpdateControlEndpointAddress, deviceInstance->controlPipe); break; - case kStatus_DEV_GetDes: /* process get full device descriptor result */ - if (dataLength != sizeof(usb_descriptor_device_t)) - { - return kStatus_USB_Error; - } + case kStatus_DEV_GetDes: /* process set address result */ + /* NULL */ break; case kStatus_DEV_GetCfg9: /* process get 9 bytes configuration result */ - if (dataLength != 9u) - { - return kStatus_USB_Error; - } - temp = (void *)&deviceInstance->enumBuffer[0]; - configureDesc = (usb_descriptor_configuration_t *)temp; + configureDesc = (usb_descriptor_configuration_t *)&deviceInstance->enumBuffer[0]; deviceInstance->configurationLen = USB_SHORT_FROM_LITTLE_ENDIAN_ADDRESS(configureDesc->wTotalLength); if (deviceInstance->configurationDesc != NULL) @@ -448,25 +438,19 @@ static usb_status_t USB_HostProcessCallback(usb_host_device_instance_t *deviceIn #if ((defined(USB_HOST_CONFIG_BUFFER_PROPERTY_CACHEABLE)) && (USB_HOST_CONFIG_BUFFER_PROPERTY_CACHEABLE > 0U)) SDK_Free(deviceInstance->configurationDesc); #else - OSA_MemoryFree(deviceInstance->configurationDesc); + USB_OsaMemoryFree(deviceInstance->configurationDesc); #endif deviceInstance->configurationDesc = NULL; } - - /* fix misra 4.14 */ - if (deviceInstance->configurationLen > USB_HOST_CONFIG_MAX_CONFIGURATION_DESCRIPTOR_LENGTH) - { - return kStatus_USB_Error; - } /* for KHCI, the start address and the length should be 4 byte align */ - if ((deviceInstance->configurationLen & 0x03U) != 0U) + if ((deviceInstance->configurationLen & 0x03) != 0) { #if ((defined(USB_HOST_CONFIG_BUFFER_PROPERTY_CACHEABLE)) && (USB_HOST_CONFIG_BUFFER_PROPERTY_CACHEABLE > 0U)) deviceInstance->configurationDesc = - (uint8_t *)SDK_Malloc((deviceInstance->configurationLen & 0xFFFCu) + 4, USB_CACHE_LINESIZE); + (uint8_t *)SDK_Malloc((deviceInstance->configurationLen & 0xFFFFFFFCu) + 4, USB_CACHE_LINESIZE); #else deviceInstance->configurationDesc = - (uint8_t *)OSA_MemoryAllocate((((uint32_t)deviceInstance->configurationLen) & 0xFFFCU) + 4UL); + (uint8_t *)USB_OsaMemoryAllocate((deviceInstance->configurationLen & 0xFFFFFFFCu) + 4); #endif } else @@ -475,22 +459,18 @@ static usb_status_t USB_HostProcessCallback(usb_host_device_instance_t *deviceIn deviceInstance->configurationDesc = (uint8_t *)SDK_Malloc(deviceInstance->configurationLen, USB_CACHE_LINESIZE); #else - deviceInstance->configurationDesc = (uint8_t *)OSA_MemoryAllocate(deviceInstance->configurationLen); + deviceInstance->configurationDesc = (uint8_t *)USB_OsaMemoryAllocate(deviceInstance->configurationLen); #endif } if (deviceInstance->configurationDesc == NULL) { - return kStatus_USB_AllocFail; + return kStatus_USB_Error; } break; - case kStatus_DEV_GetCfg: /* process get configuration result */ - if (dataLength != deviceInstance->configurationLen) - { - return kStatus_USB_Error; - } - temp = (void *)deviceInstance->configurationDesc; - if (((usb_descriptor_configuration_t *)temp)->bMaxPower > USB_HOST_CONFIG_MAX_POWER) + case kStatus_DEV_GetCfg: /* process get cofiguration result */ + if (((usb_descriptor_configuration_t *)deviceInstance->configurationDesc)->bMaxPower > + USB_HOST_CONFIG_MAX_POWER) { return kStatus_USB_Error; } @@ -501,8 +481,7 @@ static usb_status_t USB_HostProcessCallback(usb_host_device_instance_t *deviceIn return kStatus_USB_Error; } - status = USB_HostNotifyDevice(deviceInstance->hostHandle, deviceInstance, (uint32_t)kUSB_HostEventAttach, - (uint32_t)kStatus_USB_Success); + status = USB_HostNotifyDevice(deviceInstance, kUSB_HostEventAttach); if (status != kStatus_USB_Success) { @@ -513,9 +492,8 @@ static usb_status_t USB_HostProcessCallback(usb_host_device_instance_t *deviceIn } else { - /* notify application device is not supported */ - (void)USB_HostNotifyDevice(deviceInstance->hostHandle, deviceInstance, - (uint32_t)kUSB_HostEventNotSupported, (uint32_t)kStatus_USB_Success); + USB_HostNotifyDevice(deviceInstance, + kUSB_HostEventNotSupported); /* notify application device is not supported */ return kStatus_USB_NotSupported; } } @@ -526,17 +504,13 @@ static usb_status_t USB_HostProcessCallback(usb_host_device_instance_t *deviceIn break; default: - /*no action*/ break; } return status; } -static usb_status_t USB_HostNotifyDevice(usb_host_handle hostHandle, - usb_host_device_instance_t *deviceInstance, - uint32_t eventCode, - uint32_t eventParameter) +static usb_status_t USB_HostNotifyDevice(usb_host_device_instance_t *deviceInstance, uint32_t eventCode) { usb_host_instance_t *hostInstance; usb_status_t status1 = kStatus_USB_Error; @@ -547,37 +521,34 @@ static usb_status_t USB_HostNotifyDevice(usb_host_handle hostHandle, uint8_t interfaceIndex; #endif /* USB_HOST_CONFIG_HUB */ - eventCode = (((uint32_t)eventParameter << 16U) | (uint32_t)eventCode); - hostInstance = (usb_host_instance_t *)hostHandle; if (deviceInstance == NULL) { - (void)hostInstance->deviceCallback(NULL, NULL, eventCode); return kStatus_USB_InvalidHandle; } + hostInstance = (usb_host_instance_t *)deviceInstance->hostHandle; #if ((defined USB_HOST_CONFIG_HUB) && (USB_HOST_CONFIG_HUB)) - haveHub = 0U; - haveNoHub = 0U; - for (interfaceIndex = 0U; interfaceIndex < deviceInstance->configuration.interfaceCount; ++interfaceIndex) + haveHub = 0; + haveNoHub = 0; + for (interfaceIndex = 0; interfaceIndex < deviceInstance->configuration.interfaceCount; ++interfaceIndex) { if (((usb_descriptor_interface_t *)deviceInstance->configuration.interfaceList[interfaceIndex].interfaceDesc) ->bInterfaceClass == USB_HOST_HUB_CLASS_CODE) { - haveHub = 1U; + haveHub = 1; } else { - haveNoHub = 1U; + haveNoHub = 1; } } - if ((hostInstance->deviceCallback != NULL) && - ((haveNoHub == 1U) || (deviceInstance->configuration.interfaceCount == 0U))) + if ((haveNoHub == 1) && (hostInstance->deviceCallback != NULL)) { - /* call host callback function, function is initialized in USB_HostInit */ - status1 = hostInstance->deviceCallback(deviceInstance, &deviceInstance->configuration, eventCode); + status1 = hostInstance->deviceCallback(deviceInstance, &deviceInstance->configuration, + eventCode); /* notify application event */ } - if (0U != haveHub) + if (haveHub) { status2 = USB_HostHubDeviceEvent(hostInstance, deviceInstance, &deviceInstance->configuration, eventCode); /* notify hub event */ @@ -587,7 +558,7 @@ static usb_status_t USB_HostNotifyDevice(usb_host_handle hostHandle, { return kStatus_USB_Success; } - else if (eventCode == (uint32_t)kUSB_HostEventAttach) /* attach event */ + else if (eventCode == kUSB_HostEventAttach) /* attach event */ { status1 = kStatus_USB_NotSupported; } @@ -598,8 +569,8 @@ static usb_status_t USB_HostNotifyDevice(usb_host_handle hostHandle, #else if (hostInstance->deviceCallback != NULL) { - /* call host callback function, function is initialized in USB_HostInit */ - status1 = hostInstance->deviceCallback(deviceInstance, &deviceInstance->configuration, eventCode); + status1 = hostInstance->deviceCallback(deviceInstance, &deviceInstance->configuration, + eventCode); /* call host callback function */ } #endif return status1; @@ -607,24 +578,24 @@ static usb_status_t USB_HostNotifyDevice(usb_host_handle hostHandle, static uint8_t USB_HostAllocateDeviceAddress(usb_host_instance_t *hostInstance) { - uint8_t address = 0U; + uint8_t address = 0; uint8_t addressIndex; uint8_t addressBitIndex; - for (addressIndex = 0U; addressIndex < 8U; ++addressIndex) /* find the idle address position byte */ + for (addressIndex = 0; addressIndex < 8; ++addressIndex) /* find the idle address postion byte */ { - if (hostInstance->addressBitMap[addressIndex] != 0xFFU) + if (hostInstance->addressBitMap[addressIndex] != 0xFF) { break; } } - if (addressIndex < 8U) + if (addressIndex < 8) { - for (addressBitIndex = 0U; addressBitIndex < 8U; ++addressBitIndex) /* find the idle address position bit */ + for (addressBitIndex = 0; addressBitIndex < 8; ++addressBitIndex) /* find the idle address position bit */ { - if (0U == (hostInstance->addressBitMap[addressIndex] & (0x01U << addressBitIndex))) + if (!(hostInstance->addressBitMap[addressIndex] & (0x01u << addressBitIndex))) { - hostInstance->addressBitMap[addressIndex] |= (0x01U << addressBitIndex); /* set the allocated bit */ - address = addressIndex * 8U + addressBitIndex + 1U; /* the address minimum is 1 */ + hostInstance->addressBitMap[addressIndex] |= (0x01u << addressBitIndex); /* set the allocated bit */ + address = addressIndex * 8 + addressBitIndex + 1; /* the address minimum is 1 */ break; } } @@ -634,10 +605,10 @@ static uint8_t USB_HostAllocateDeviceAddress(usb_host_instance_t *hostInstance) static void USB_HostReleaseDeviceAddress(usb_host_instance_t *hostInstance, uint8_t address) { - (void)USB_HostLock(); - hostInstance->addressBitMap[((uint32_t)address - 1U) >> 3U] &= - (~(0x01U << (((uint32_t)address - 1U) & 0x07U))); /* reset the allocated bit */ - (void)USB_HostUnlock(); + USB_HostLock(); + hostInstance->addressBitMap[(uint32_t)(address - 1) >> 3] &= + (~(0x01u << (((uint32_t)address - 1) & 0x07U))); /* reset the allocated bit */ + USB_HostUnlock(); } static usb_status_t USB_HostRemoveDeviceInstance(usb_host_handle hostHandle, usb_device_handle deviceHandle) @@ -669,7 +640,7 @@ static usb_status_t USB_HostRemoveDeviceInstance(usb_host_handle hostHandle, usb prevInstance->next = currentInstance->next; return kStatus_USB_Success; } - prevInstance = currentInstance; + prevInstance = currentInstance; currentInstance = currentInstance->next; } @@ -689,13 +660,13 @@ static void USB_HostReleaseDeviceResource(usb_host_instance_t *hostInstance, usb } #endif /* release device's address */ - if (deviceInstance->setAddress != 0U) + if (deviceInstance->setAddress != 0) { USB_HostReleaseDeviceAddress(hostInstance, deviceInstance->setAddress); } else { - if (deviceInstance->allocatedAddress != 0U) + if (deviceInstance->allocatedAddress != 0) { USB_HostReleaseDeviceAddress(hostInstance, deviceInstance->allocatedAddress); } @@ -704,7 +675,7 @@ static void USB_HostReleaseDeviceResource(usb_host_instance_t *hostInstance, usb /* close control pipe */ if (deviceInstance->controlPipe != NULL) { - (void)USB_HostCancelTransfer(hostInstance, deviceInstance->controlPipe, NULL); + USB_HostCancelTransfer(hostInstance, deviceInstance->controlPipe, NULL); if (USB_HostClosePipe(hostInstance, deviceInstance->controlPipe) != kStatus_USB_Success) { #ifdef HOST_ECHO @@ -720,7 +691,7 @@ static void USB_HostReleaseDeviceResource(usb_host_instance_t *hostInstance, usb #if ((defined(USB_HOST_CONFIG_BUFFER_PROPERTY_CACHEABLE)) && (USB_HOST_CONFIG_BUFFER_PROPERTY_CACHEABLE > 0U)) SDK_Free(deviceInstance->configurationDesc); #else - OSA_MemoryFree(deviceInstance->configurationDesc); + USB_OsaMemoryFree(deviceInstance->configurationDesc); #endif } @@ -730,20 +701,20 @@ static void USB_HostReleaseDeviceResource(usb_host_instance_t *hostInstance, usb #if ((defined(USB_HOST_CONFIG_BUFFER_PROPERTY_CACHEABLE)) && (USB_HOST_CONFIG_BUFFER_PROPERTY_CACHEABLE > 0U)) SDK_Free(deviceInstance->deviceDescriptor); #else - OSA_MemoryFree(deviceInstance->deviceDescriptor); + USB_OsaMemoryFree(deviceInstance->deviceDescriptor); #endif /* free device instance buffer */ - OSA_MemoryFree(deviceInstance); + USB_OsaMemoryFree(deviceInstance); #if ((defined USB_HOST_CONFIG_HUB) && (USB_HOST_CONFIG_HUB)) /* enable controller attach if root hub */ - if (level == 1U) + if (level == 1) { - (void)USB_HostControlBus(hostInstance, (uint8_t)kUSB_HostBusEnableAttach); + USB_HostControlBus(hostInstance, kUSB_HostBusEnableAttach); } #else /* enable controller attach */ - USB_HostControlBus(hostInstance, (uint8_t)kUSB_HostBusEnableAttach); + USB_HostControlBus(hostInstance, kUSB_HostBusEnableAttach); #endif } @@ -755,39 +726,35 @@ static usb_status_t USB_HostParseDeviceConfigurationDescriptor(usb_device_handle usb_host_interface_t *interfaceParse = NULL; usb_host_ep_t *epParse; uint8_t *buffer; - void *temp; if (deviceHandle == NULL) { return kStatus_USB_InvalidParameter; } - temp = (void *)&deviceInstance->configuration; - buffer = (uint8_t *)temp; + buffer = (uint8_t *)&deviceInstance->configuration; /* clear the previous parse result, note: end_pos means buffer index here*/ - for (endPos = 0U; endPos < sizeof(usb_host_configuration_t); endPos++) + for (endPos = 0; endPos < sizeof(usb_host_configuration_t); endPos++) { - buffer[endPos] = 0U; + buffer[endPos] = 0; } - for (endPos = 0U; endPos < USB_HOST_CONFIG_CONFIGURATION_MAX_INTERFACE; ++endPos) + for (endPos = 0; endPos < USB_HOST_CONFIG_CONFIGURATION_MAX_INTERFACE; ++endPos) { - deviceInstance->interfaceStatus[endPos] = 0U; + deviceInstance->interfaceStatus[endPos] = 0; } /* parse configuration descriptor */ - temp = (void *)deviceInstance->configurationDesc; - unionDes = (usb_descriptor_union_t *)temp; - endPos = (uint32_t)(deviceInstance->configurationDesc + deviceInstance->configurationLen); + unionDes = (usb_descriptor_union_t *)deviceInstance->configurationDesc; + endPos = (uint32_t)(deviceInstance->configurationDesc + deviceInstance->configurationLen); if ((unionDes->common.bLength == USB_DESCRIPTOR_LENGTH_CONFIGURE) && (unionDes->common.bDescriptorType == USB_DESCRIPTOR_TYPE_CONFIGURE)) { /* configuration descriptor */ - temp = (void *)unionDes; - deviceInstance->configuration.configurationDesc = (usb_descriptor_configuration_t *)temp; + deviceInstance->configuration.configurationDesc = (usb_descriptor_configuration_t *)unionDes; deviceInstance->configuration.configurationExtensionLength = 0; - deviceInstance->configuration.configurationExtension = NULL; - deviceInstance->configuration.interfaceCount = 0; + deviceInstance->configuration.configurationExtension = NULL; + deviceInstance->configuration.interfaceCount = 0; unionDes = (usb_descriptor_union_t *)((uint32_t)unionDes + unionDes->common.bLength); while ((uint32_t)unionDes < endPos) { @@ -797,8 +764,8 @@ static usb_status_t USB_HostParseDeviceConfigurationDescriptor(usb_device_handle { deviceInstance->configuration.configurationExtension = (uint8_t *)unionDes; } - if ((unionDes->common.bDescriptorType == 0x00U) || - (unionDes->common.bLength == 0x00U)) /* the descriptor data is wrong */ + if ((unionDes->common.bDescriptorType == 0x00) || + (unionDes->common.bLength == 0x00)) /* the descriptor data is wrong */ { return kStatus_USB_Error; } @@ -812,17 +779,17 @@ static usb_status_t USB_HostParseDeviceConfigurationDescriptor(usb_device_handle } /* interface descriptor */ - deviceInstance->configuration.interfaceCount = 0U; + deviceInstance->configuration.interfaceCount = 0; while ((uint32_t)unionDes < endPos) { if (unionDes->common.bDescriptorType == USB_DESCRIPTOR_TYPE_INTERFACE) { - if (unionDes->interface.bAlternateSetting == 0x00U) + if (unionDes->interface.bAlternateSetting == 0x00) { if (deviceInstance->configuration.interfaceCount >= USB_HOST_CONFIG_CONFIGURATION_MAX_INTERFACE) { -#if (((defined USB_HOST_CONFIG_COMPLIANCE_TEST) && (USB_HOST_CONFIG_COMPLIANCE_TEST)) || defined(HOST_ECHO)) - (void)usb_echo( +#ifdef HOST_ECHO + usb_echo( "Unsupported Device attached\r\n too many interfaces in one configuration, please increase " "the USB_HOST_CONFIG_CONFIGURATION_MAX_INTERFACE value\n"); #endif @@ -831,13 +798,13 @@ static usb_status_t USB_HostParseDeviceConfigurationDescriptor(usb_device_handle interfaceParse = &deviceInstance->configuration.interfaceList[deviceInstance->configuration.interfaceCount]; deviceInstance->configuration.interfaceCount++; - interfaceParse->alternateSettingNumber = 0; - interfaceParse->epCount = 0; - interfaceParse->interfaceDesc = &unionDes->interface; + interfaceParse->alternateSettingNumber = 0; + interfaceParse->epCount = 0; + interfaceParse->interfaceDesc = &unionDes->interface; interfaceParse->interfaceExtensionLength = 0; - interfaceParse->interfaceExtension = NULL; - interfaceParse->interfaceIndex = unionDes->interface.bInterfaceNumber; - if (unionDes->common.bLength == 0x00U) /* the descriptor data is wrong */ + interfaceParse->interfaceExtension = NULL; + interfaceParse->interfaceIndex = unionDes->interface.bInterfaceNumber; + if (unionDes->common.bLength == 0x00) /* the descriptor data is wrong */ { return kStatus_USB_Error; } @@ -851,8 +818,8 @@ static usb_status_t USB_HostParseDeviceConfigurationDescriptor(usb_device_handle { interfaceParse->interfaceExtension = (uint8_t *)unionDes; } - if ((unionDes->common.bDescriptorType == 0x00U) || - (unionDes->common.bLength == 0x00U)) /* the descriptor data is wrong */ + if ((unionDes->common.bDescriptorType == 0x00) || + (unionDes->common.bLength == 0x00)) /* the descriptor data is wrong */ { return kStatus_USB_Error; } @@ -866,7 +833,7 @@ static usb_status_t USB_HostParseDeviceConfigurationDescriptor(usb_device_handle } /* endpoint descriptor */ - if (interfaceParse->interfaceDesc->bNumEndpoints != 0U) + if (interfaceParse->interfaceDesc->bNumEndpoints != 0) { if ((unionDes->common.bDescriptorType != USB_DESCRIPTOR_TYPE_ENDPOINT) || (interfaceParse->interfaceDesc->bNumEndpoints > USB_HOST_CONFIG_INTERFACE_MAX_EP)) @@ -887,13 +854,11 @@ static usb_status_t USB_HostParseDeviceConfigurationDescriptor(usb_device_handle #endif return kStatus_USB_Error; } - temp = (void *)&interfaceParse->epList[interfaceParse->epCount]; - epParse = (usb_host_ep_t *)temp; - temp = (void *)unionDes; - epParse->epDesc = (usb_descriptor_endpoint_t *)temp; - epParse->epExtensionLength = 0U; - epParse->epExtension = NULL; - if (unionDes->common.bLength == 0x00U) /* the descriptor data is wrong */ + epParse = (usb_host_ep_t *)&interfaceParse->epList[interfaceParse->epCount]; + epParse->epDesc = (usb_descriptor_endpoint_t *)unionDes; + epParse->epExtensionLength = 0; + epParse->epExtension = NULL; + if (unionDes->common.bLength == 0x00) /* the descriptor data is wrong */ { return kStatus_USB_Error; } @@ -907,8 +872,8 @@ static usb_status_t USB_HostParseDeviceConfigurationDescriptor(usb_device_handle { epParse->epExtension = (uint8_t *)unionDes; } - if ((unionDes->common.bDescriptorType == 0x00U) || - (unionDes->common.bLength == 0x00U)) /* the descriptor data is wrong */ + if ((unionDes->common.bDescriptorType == 0x00) || + (unionDes->common.bLength == 0x00)) /* the descriptor data is wrong */ { return kStatus_USB_Error; } @@ -935,7 +900,7 @@ static usb_status_t USB_HostParseDeviceConfigurationDescriptor(usb_device_handle { interfaceParse->interfaceExtension = (uint8_t *)unionDes; } - if (unionDes->common.bLength == 0x00U) /* the descriptor data is wrong */ + if (unionDes->common.bLength == 0x00) /* the descriptor data is wrong */ { return kStatus_USB_Error; } @@ -945,8 +910,8 @@ static usb_status_t USB_HostParseDeviceConfigurationDescriptor(usb_device_handle { if (unionDes->common.bDescriptorType != USB_DESCRIPTOR_TYPE_INTERFACE) { - if ((unionDes->common.bDescriptorType == 0x00U) || - (unionDes->common.bLength == 0x00U)) /* the descriptor data is wrong */ + if ((unionDes->common.bDescriptorType == 0x00) || + (unionDes->common.bLength == 0x00)) /* the descriptor data is wrong */ { return kStatus_USB_Error; } @@ -967,9 +932,9 @@ static usb_status_t USB_HostParseDeviceConfigurationDescriptor(usb_device_handle } } - for (endPos = 0U; endPos < deviceInstance->configuration.interfaceCount; ++endPos) + for (endPos = 0; endPos < deviceInstance->configuration.interfaceCount; ++endPos) { - deviceInstance->interfaceStatus[endPos] = (uint8_t)kStatus_interface_Attached; + deviceInstance->interfaceStatus[endPos] = kStatus_interface_Attached; } return kStatus_USB_Success; @@ -1023,29 +988,28 @@ usb_status_t USB_HostAttachDevice(usb_host_handle hostHandle, #endif /* Allocate new device instance */ - newInstance = (usb_host_device_instance_t *)OSA_MemoryAllocate(sizeof(usb_host_device_instance_t)); + newInstance = (usb_host_device_instance_t *)USB_OsaMemoryAllocate(sizeof(usb_host_device_instance_t)); if (newInstance == NULL) { #ifdef HOST_ECHO usb_echo("allocate dev instance fail\r\n"); #endif - (void)USB_HostNotifyDevice(hostInstance, NULL, (uint32_t)kUSB_HostEventEnumerationFail, - (uint32_t)kStatus_USB_AllocFail); return kStatus_USB_AllocFail; } /* new instance fields init */ - newInstance->hostHandle = hostHandle; - newInstance->speed = speed; - newInstance->stallRetries = USB_HOST_CONFIG_ENUMERATION_MAX_STALL_RETRIES; - newInstance->enumRetries = USB_HOST_CONFIG_ENUMERATION_MAX_RETRIES; - newInstance->setAddress = 0; - newInstance->deviceAttachState = (uint8_t)kStatus_device_Attached; + newInstance->hostHandle = hostHandle; + newInstance->speed = speed; + newInstance->stallRetries = USB_HOST_CONFIG_ENUMERATION_MAX_STALL_RETRIES; + newInstance->enumRetries = USB_HOST_CONFIG_ENUMERATION_MAX_RETRIES; + newInstance->setAddress = 0; + newInstance->deviceAttachState = kStatus_device_Attached; #if ((defined(USB_HOST_CONFIG_BUFFER_PROPERTY_CACHEABLE)) && (USB_HOST_CONFIG_BUFFER_PROPERTY_CACHEABLE > 0U)) newInstance->deviceDescriptor = (usb_descriptor_device_t *)SDK_Malloc(sizeof(usb_descriptor_device_t) + 9, USB_CACHE_LINESIZE); #else - newInstance->deviceDescriptor = (usb_descriptor_device_t *)OSA_MemoryAllocate(sizeof(usb_descriptor_device_t) + 9U); + newInstance->deviceDescriptor = + (usb_descriptor_device_t *)USB_OsaMemoryAllocate(sizeof(usb_descriptor_device_t) + 9); #endif if (newInstance->deviceDescriptor == NULL) { @@ -1055,66 +1019,62 @@ usb_status_t USB_HostAttachDevice(usb_host_handle hostHandle, #if ((defined(USB_HOST_CONFIG_BUFFER_PROPERTY_CACHEABLE)) && (USB_HOST_CONFIG_BUFFER_PROPERTY_CACHEABLE > 0U)) SDK_Free(newInstance->deviceDescriptor); #else - OSA_MemoryFree(newInstance->deviceDescriptor); + USB_OsaMemoryFree(newInstance->deviceDescriptor); #endif - OSA_MemoryFree(newInstance); - (void)USB_HostNotifyDevice(hostInstance, NULL, (uint32_t)kUSB_HostEventEnumerationFail, - (uint32_t)kStatus_USB_AllocFail); + USB_OsaMemoryFree(newInstance); return kStatus_USB_AllocFail; } newInstance->enumBuffer = (uint8_t *)((uint8_t *)newInstance->deviceDescriptor + sizeof(usb_descriptor_device_t)); #if ((defined USB_HOST_CONFIG_HUB) && (USB_HOST_CONFIG_HUB)) - newInstance->hubNumber = hubNumber; + newInstance->hubNumber = hubNumber; newInstance->portNumber = portNumber; - newInstance->level = level; + newInstance->level = level; - if ((speed != USB_SPEED_HIGH) && (level > 1U)) + if ((speed != USB_SPEED_HIGH) && (level > 1)) { - newInstance->hsHubNumber = (uint8_t)USB_HostHubGetHsHubNumber(hostHandle, hubNumber); - newInstance->hsHubPort = (uint8_t)USB_HostHubGetHsHubPort(hostHandle, hubNumber, portNumber); + newInstance->hsHubNumber = USB_HostHubGetHsHubNumber(hostHandle, hubNumber); + newInstance->hsHubPort = USB_HostHubGetHsHubPort(hostHandle, hubNumber, portNumber); } else { newInstance->hsHubNumber = hubNumber; - newInstance->hsHubPort = portNumber; + newInstance->hsHubPort = portNumber; } #endif /* USB_HOST_CONFIG_HUB */ - (void)USB_HostLock(); + USB_HostLock(); /* allocate address && insert to the dev list */ address = USB_HostAllocateDeviceAddress(hostInstance); - if (address == 0U) + if (address == 0) { #ifdef HOST_ECHO usb_echo("allocate address fail\r\n"); #endif - (void)USB_HostUnlock(); + USB_HostUnlock(); #if ((defined(USB_HOST_CONFIG_BUFFER_PROPERTY_CACHEABLE)) && (USB_HOST_CONFIG_BUFFER_PROPERTY_CACHEABLE > 0U)) SDK_Free(newInstance->deviceDescriptor); #else - OSA_MemoryFree(newInstance->deviceDescriptor); + USB_OsaMemoryFree(newInstance->deviceDescriptor); #endif - OSA_MemoryFree(newInstance); - (void)USB_HostNotifyDevice(hostInstance, NULL, (uint32_t)kUSB_HostEventEnumerationFail, - (uint32_t)kStatus_USB_Error); + USB_OsaMemoryFree(newInstance); return kStatus_USB_Error; } newInstance->allocatedAddress = address; - newInstance->next = (usb_host_device_instance_t *)hostInstance->deviceList; + newInstance->next = (usb_host_device_instance_t *)hostInstance->deviceList; hostInstance->deviceList = newInstance; - newInstance->state = (uint8_t)kStatus_DEV_Initial; - (void)USB_HostUnlock(); + newInstance->state = kStatus_DEV_Initial; + USB_HostUnlock(); /* open control pipe */ - pipeInit.devInstance = newInstance; - pipeInit.pipeType = USB_ENDPOINT_CONTROL; - pipeInit.direction = 0; + pipeInit.devInstance = newInstance; + pipeInit.pipeType = USB_ENDPOINT_CONTROL; + pipeInit.direction = 0; pipeInit.endpointAddress = 0; - pipeInit.interval = 0; - pipeInit.maxPacketSize = 8; + pipeInit.interval = 0; + pipeInit.maxPacketSize = 8; pipeInit.numberPerUframe = 0; - pipeInit.nakCount = USB_HOST_CONFIG_MAX_NAK; + pipeInit.nakCount = USB_HOST_CONFIG_MAX_NAK; if (USB_HostOpenPipe(hostHandle, &newInstance->controlPipe, &pipeInit) != kStatus_USB_Success) { /* don't need release resource, resource is released when detach */ @@ -1122,22 +1082,15 @@ usb_status_t USB_HostAttachDevice(usb_host_handle hostHandle, #if ((defined(USB_HOST_CONFIG_BUFFER_PROPERTY_CACHEABLE)) && (USB_HOST_CONFIG_BUFFER_PROPERTY_CACHEABLE > 0U)) SDK_Free(newInstance->deviceDescriptor); #else - OSA_MemoryFree(newInstance->deviceDescriptor); + USB_OsaMemoryFree(newInstance->deviceDescriptor); #endif - OSA_MemoryFree(newInstance); - (void)USB_HostNotifyDevice(hostInstance, NULL, (uint32_t)kUSB_HostEventEnumerationFail, - (uint32_t)kStatus_USB_Error); + USB_OsaMemoryFree(newInstance); return kStatus_USB_Error; } /* start enumeration */ - newInstance->state = (uint8_t)kStatus_DEV_GetDes8; - /* process enumeration state machine */ - if (USB_HostProcessState(newInstance) != kStatus_USB_Success) - { - (void)USB_HostNotifyDevice(hostInstance, newInstance, (uint32_t)kUSB_HostEventEnumerationFail, - (uint32_t)kStatus_USB_Error); - } + newInstance->state = kStatus_DEV_GetDes8; + USB_HostProcessState(newInstance); /* process enumeration state machine */ *deviceHandle = newInstance; return kStatus_USB_Success; @@ -1153,7 +1106,7 @@ usb_status_t USB_HostDetachDevice(usb_host_handle hostHandle, uint8_t hubNumber, return kStatus_USB_InvalidHandle; } - (void)USB_HostLock(); + USB_HostLock(); /* search for device instance handle */ #if ((defined USB_HOST_CONFIG_HUB) && (USB_HOST_CONFIG_HUB)) deviceInstance = (usb_host_device_instance_t *)hostInstance->deviceList; @@ -1168,7 +1121,7 @@ usb_status_t USB_HostDetachDevice(usb_host_handle hostHandle, uint8_t hubNumber, #else deviceInstance = (usb_host_device_instance_t *)hostInstance->deviceList; #endif - (void)USB_HostUnlock(); + USB_HostUnlock(); if (deviceInstance != NULL) { return USB_HostDetachDeviceInternal(hostHandle, deviceInstance); /* device instance detach */ @@ -1179,33 +1132,31 @@ usb_status_t USB_HostDetachDevice(usb_host_handle hostHandle, uint8_t hubNumber, usb_status_t USB_HostDetachDeviceInternal(usb_host_handle hostHandle, usb_device_handle deviceHandle) { usb_host_device_instance_t *deviceInstance = (usb_host_device_instance_t *)deviceHandle; - usb_host_instance_t *hostInstance = (usb_host_instance_t *)hostHandle; + usb_host_instance_t *hostInstance = (usb_host_instance_t *)hostHandle; if ((hostHandle == NULL) || (deviceHandle == NULL)) { return kStatus_USB_InvalidHandle; } - deviceInstance->deviceAttachState = (uint8_t)kStatus_device_Detached; /* mark the device is detached from host */ + deviceInstance->deviceAttachState = kStatus_device_Detached; /* mark the device is detached from host */ - if (deviceInstance->state >= (uint8_t)kStatus_DEV_Initial) /* device instance is valid */ + if (deviceInstance->state >= kStatus_DEV_Initial) /* device instance is valid */ { /* detach internally */ - if (deviceInstance->state < (uint8_t)kStatus_DEV_AppUsed) /* enumeration is not done */ + if (deviceInstance->state < kStatus_DEV_AppUsed) /* enumeration is not done */ { if (deviceInstance->controlPipe != NULL) { - (void)USB_HostCancelTransfer(hostInstance, deviceInstance->controlPipe, NULL); + USB_HostCancelTransfer(hostInstance, deviceInstance->controlPipe, NULL); } /* remove device instance from host */ - (void)USB_HostRemoveDeviceInstance(hostInstance, deviceInstance); + USB_HostRemoveDeviceInstance(hostInstance, deviceInstance); USB_HostReleaseDeviceResource(hostInstance, deviceInstance); } - else /* enumeration has be done and notified application */ + else /* enumeration has be done and notifed application */ { - /* notify application device detach */ - (void)USB_HostNotifyDevice(hostInstance, deviceInstance, (uint32_t)kUSB_HostEventDetach, - (uint32_t)kStatus_USB_Success); + USB_HostNotifyDevice(deviceInstance, kUSB_HostEventDetach); /* notify application device detach */ } } @@ -1214,7 +1165,7 @@ usb_status_t USB_HostDetachDeviceInternal(usb_host_handle hostHandle, usb_device uint8_t USB_HostGetDeviceAttachState(usb_device_handle deviceHandle) { - return (NULL != deviceHandle) ? ((usb_host_device_instance_t *)deviceHandle)->deviceAttachState : 0x0U; + return deviceHandle ? ((usb_host_device_instance_t *)deviceHandle)->deviceAttachState : 0x0; } usb_status_t USB_HostValidateDevice(usb_host_handle hostHandle, usb_device_handle deviceHandle) @@ -1232,7 +1183,7 @@ usb_status_t USB_HostValidateDevice(usb_host_handle hostHandle, usb_device_handl searchDev = searchDev->next; } - if (NULL != searchDev) + if (searchDev) { return kStatus_USB_Success; } @@ -1241,14 +1192,14 @@ usb_status_t USB_HostValidateDevice(usb_host_handle hostHandle, usb_device_handl static usb_status_t USB_HostControlBus(usb_host_handle hostHandle, uint8_t controlType) { - usb_status_t status = kStatus_USB_Success; + usb_status_t status = kStatus_USB_Success; usb_host_instance_t *hostInstance = (usb_host_instance_t *)hostHandle; if (hostHandle == NULL) { return kStatus_USB_InvalidHandle; } - /* the callbackFn is initialized in USB_HostGetControllerInterface */ + status = hostInstance->controllerTable->controllerIoctl(hostInstance->controllerHandle, kUSB_HostBusControl, &controlType); @@ -1258,7 +1209,7 @@ static usb_status_t USB_HostControlBus(usb_host_handle hostHandle, uint8_t contr usb_status_t USB_HostOpenDeviceInterface(usb_device_handle deviceHandle, usb_host_interface_handle interfaceHandle) { usb_host_device_instance_t *deviceInstance = (usb_host_device_instance_t *)deviceHandle; - usb_host_instance_t *hostInstance = NULL; + usb_host_instance_t *hostInstance = NULL; uint8_t interfaceIndex; uint8_t index = 0; @@ -1268,11 +1219,11 @@ usb_status_t USB_HostOpenDeviceInterface(usb_device_handle deviceHandle, usb_hos } hostInstance = (usb_host_instance_t *)deviceInstance->hostHandle; - (void)USB_HostLock(); + USB_HostLock(); /* check host_instance valid? */ for (; index < USB_HOST_CONFIG_MAX_HOST; ++index) { - if ((g_UsbHostInstance[index].occupied == 1U) && + if ((g_UsbHostInstance[index].occupied == 1) && ((usb_host_instance_t *)(&g_UsbHostInstance[index]) == (hostInstance))) { break; @@ -1280,14 +1231,14 @@ usb_status_t USB_HostOpenDeviceInterface(usb_device_handle deviceHandle, usb_hos } if (index >= USB_HOST_CONFIG_MAX_HOST) { - (void)USB_HostUnlock(); + USB_HostUnlock(); return kStatus_USB_Error; } /* check deviceHandle valid? */ if (USB_HostValidateDevice(hostInstance, deviceHandle) != kStatus_USB_Success) { - (void)USB_HostUnlock(); + USB_HostUnlock(); return kStatus_USB_Error; } @@ -1296,11 +1247,11 @@ usb_status_t USB_HostOpenDeviceInterface(usb_device_handle deviceHandle, usb_hos { if (&deviceInstance->configuration.interfaceList[interfaceIndex] == interfaceHandle) { - deviceInstance->interfaceStatus[interfaceIndex] = (uint8_t)kStatus_interface_Opened; + deviceInstance->interfaceStatus[interfaceIndex] = kStatus_interface_Opened; break; } } - (void)USB_HostUnlock(); + USB_HostUnlock(); return kStatus_USB_Success; } @@ -1308,10 +1259,10 @@ usb_status_t USB_HostOpenDeviceInterface(usb_device_handle deviceHandle, usb_hos usb_status_t USB_HostCloseDeviceInterface(usb_device_handle deviceHandle, usb_host_interface_handle interfaceHandle) { usb_host_device_instance_t *deviceInstance = (usb_host_device_instance_t *)deviceHandle; - usb_host_instance_t *hostInstance = NULL; + usb_host_instance_t *hostInstance = NULL; uint8_t interfaceIndex; uint8_t removeLabel = 1; - uint8_t index = 0; + uint8_t index = 0; if (deviceHandle == NULL) { @@ -1319,11 +1270,11 @@ usb_status_t USB_HostCloseDeviceInterface(usb_device_handle deviceHandle, usb_ho } hostInstance = (usb_host_instance_t *)deviceInstance->hostHandle; - (void)USB_HostLock(); + USB_HostLock(); /* check host_instance valid? */ for (; index < USB_HOST_CONFIG_MAX_HOST; ++index) { - if ((g_UsbHostInstance[index].occupied == 1U) && + if ((g_UsbHostInstance[index].occupied == 1) && ((usb_host_instance_t *)(&g_UsbHostInstance[index]) == (hostInstance))) { break; @@ -1331,14 +1282,14 @@ usb_status_t USB_HostCloseDeviceInterface(usb_device_handle deviceHandle, usb_ho } if (index >= USB_HOST_CONFIG_MAX_HOST) { - (void)USB_HostUnlock(); + USB_HostUnlock(); return kStatus_USB_Error; } /* check deviceHandle valid? */ if (USB_HostValidateDevice(hostInstance, deviceHandle) != kStatus_USB_Success) { - (void)USB_HostUnlock(); + USB_HostUnlock(); return kStatus_USB_Error; } @@ -1349,32 +1300,32 @@ usb_status_t USB_HostCloseDeviceInterface(usb_device_handle deviceHandle, usb_ho { if (&deviceInstance->configuration.interfaceList[interfaceIndex] == interfaceHandle) { - deviceInstance->interfaceStatus[interfaceIndex] = (uint8_t)kStatus_interface_Detached; + deviceInstance->interfaceStatus[interfaceIndex] = kStatus_interface_Detached; break; } } } - if (deviceInstance->deviceAttachState == (uint8_t)kStatus_device_Detached) /* device is removed from host */ + if (deviceInstance->deviceAttachState == kStatus_device_Detached) /* device is removed from host */ { removeLabel = 1; /* check all the interfaces of the device are not opened */ for (interfaceIndex = 0; interfaceIndex < deviceInstance->configuration.interfaceCount; ++interfaceIndex) { - if (deviceInstance->interfaceStatus[interfaceIndex] == (uint8_t)kStatus_interface_Opened) + if (deviceInstance->interfaceStatus[interfaceIndex] == kStatus_interface_Opened) { - removeLabel = 0U; + removeLabel = 0; break; } } - if (removeLabel == 1U) + if (removeLabel == 1) { /* remove device instance from host */ - (void)USB_HostRemoveDeviceInstance(hostInstance, deviceInstance); + USB_HostRemoveDeviceInstance(hostInstance, deviceInstance); } - (void)USB_HostUnlock(); + USB_HostUnlock(); - if (removeLabel == 1U) + if (removeLabel == 1) { USB_HostReleaseDeviceResource((usb_host_instance_t *)deviceInstance->hostHandle, deviceInstance); /* release device resource */ @@ -1382,7 +1333,7 @@ usb_status_t USB_HostCloseDeviceInterface(usb_device_handle deviceHandle, usb_ho } else { - (void)USB_HostUnlock(); + USB_HostUnlock(); } return kStatus_USB_Success; @@ -1390,9 +1341,9 @@ usb_status_t USB_HostCloseDeviceInterface(usb_device_handle deviceHandle, usb_ho usb_status_t USB_HostRemoveDevice(usb_host_handle hostHandle, usb_device_handle deviceHandle) { - usb_host_instance_t *hostInstance = (usb_host_instance_t *)hostHandle; + usb_host_instance_t *hostInstance = (usb_host_instance_t *)hostHandle; usb_host_device_instance_t *deviceInstance = (usb_host_device_instance_t *)deviceHandle; - uint8_t interfaceIndex = 0; + uint8_t interfaceIndex = 0; #if ((defined USB_HOST_CONFIG_HUB) && (USB_HOST_CONFIG_HUB)) uint8_t level = 0; uint8_t devHubNo; @@ -1411,26 +1362,25 @@ usb_status_t USB_HostRemoveDevice(usb_host_handle hostHandle, usb_device_handle if (USB_HostValidateDevice(hostInstance, deviceInstance) == kStatus_USB_Success) /* device is valid */ { #if ((defined USB_HOST_CONFIG_HUB) && (USB_HOST_CONFIG_HUB)) - devHubNo = deviceInstance->hubNumber; + devHubNo = deviceInstance->hubNumber; devPortNo = deviceInstance->portNumber; - level = deviceInstance->level; + level = deviceInstance->level; #endif - deviceInstance->deviceAttachState = (uint8_t)kStatus_device_Detached; - if (deviceInstance->state >= (uint8_t)kStatus_DEV_Initial) /* device is valid */ + deviceInstance->deviceAttachState = kStatus_device_Detached; + if (deviceInstance->state >= kStatus_DEV_Initial) /* device is valid */ { - if (deviceInstance->state < - (uint8_t)kStatus_DEV_AppUsed) /* enumeration is not done or application don't use */ + if (deviceInstance->state < kStatus_DEV_AppUsed) /* enumeraion is not done or application don't use */ { /* detach internally */ - (void)USB_HostDetachDeviceInternal(hostHandle, deviceHandle); + USB_HostDetachDeviceInternal(hostHandle, deviceHandle); } else /* application use the device */ { - for (interfaceIndex = 0U; interfaceIndex < deviceInstance->configuration.interfaceCount; + for (interfaceIndex = 0; interfaceIndex < deviceInstance->configuration.interfaceCount; ++interfaceIndex) { - if (deviceInstance->interfaceStatus[interfaceIndex] == (uint8_t)kStatus_interface_Opened) + if (deviceInstance->interfaceStatus[interfaceIndex] == kStatus_interface_Opened) { #ifdef HOST_ECHO usb_echo("error: there is class instance that is not deinited\r\n"); @@ -1439,20 +1389,20 @@ usb_status_t USB_HostRemoveDevice(usb_host_handle hostHandle, usb_device_handle } } /* remove device instance from host */ - (void)USB_HostRemoveDeviceInstance(hostInstance, deviceInstance); + USB_HostRemoveDeviceInstance(hostInstance, deviceInstance); USB_HostReleaseDeviceResource(hostInstance, deviceInstance); /* release resource */ } } #if ((defined USB_HOST_CONFIG_HUB) && (USB_HOST_CONFIG_HUB)) - if (level == 1U) + if (level == 1) { - (void)USB_HostControlBus(hostHandle, (uint8_t)kUSB_HostBusReset); /* reset controller port */ - (void)USB_HostControlBus(hostHandle, (uint8_t)kUSB_HostBusRestart); /* restart controller port */ + USB_HostControlBus(hostHandle, kUSB_HostBusReset); /* reset controller port */ + USB_HostControlBus(hostHandle, kUSB_HostBusRestart); /* restart controller port */ } else { - (void)USB_HostHubRemovePort(hostHandle, devHubNo, devPortNo); /* reset hub port */ + USB_HostHubRemovePort(hostHandle, devHubNo, devPortNo); /* reset hub port */ } #else USB_HostControlBus(hostHandle, kUSB_HostBusReset); /* reset controller port */ diff --git a/bsp/imxrt/libraries/drivers/usb/host/usb_host_devices.h b/bsp/imxrt/libraries/drivers/usb/host/usb_host_devices.h index 84d5497c9f..422e876a12 100644 --- a/bsp/imxrt/libraries/drivers/usb/host/usb_host_devices.h +++ b/bsp/imxrt/libraries/drivers/usb/host/usb_host_devices.h @@ -1,9 +1,31 @@ /* * Copyright (c) 2015, Freescale Semiconductor, Inc. * Copyright 2016 NXP - * All rights reserved. * - * SPDX-License-Identifier: BSD-3-Clause + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * o Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * o Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * o Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef _USB_HOST_DEV_MNG_H_ @@ -57,11 +79,11 @@ typedef struct _usb_host_device_instance usb_descriptor_device_t *deviceDescriptor; /*!< Standard device descriptor */ usb_host_pipe_handle controlPipe; /*!< Device's control pipe */ uint8_t *configurationDesc; /*!< Configuration descriptor pointer */ - uint8_t *enumBuffer; /*!< Buffer for enumeration */ uint16_t configurationLen; /*!< Configuration descriptor length */ + uint16_t configurationValue; /*!< Configuration index */ uint8_t interfaceStatus[USB_HOST_CONFIG_CONFIGURATION_MAX_INTERFACE]; /*!< Interfaces' status, please reference to #usb_host_interface_state_t */ - uint8_t configurationValue; /*!< Configuration index */ + uint8_t *enumBuffer; /*!< Buffer for enumeration */ uint8_t state; /*!< Device state for enumeration */ uint8_t enumRetries; /*!< Re-enumeration when error in control transfer */ uint8_t stallRetries; /*!< Re-transfer when stall */ @@ -82,10 +104,11 @@ typedef struct _usb_host_device_instance typedef struct _usb_host_enum_process_entry { - usb_host_device_enumeration_status_t successState; /*!< When the last step is successful, the next state value */ - usb_host_device_enumeration_status_t retryState; /*!< When the last step need retry, the next state value */ - /*! When the last step transfer is done, the function is used to process the transfer data */ - usb_status_t (*process)(usb_host_device_instance_t *deviceInstance, uint32_t dataLength); + uint8_t successState; /*!< When the last step is successful, the next state value */ + uint8_t retryState; /*!< When the last step need retry, the next state value */ + usb_status_t (*process)(usb_host_device_instance_t *deviceInstance); /*!< When the last step transfer is done, the + function is used to process the transfer + data */ } usb_host_enum_process_entry_t; /******************************************************************************* diff --git a/bsp/imxrt/libraries/drivers/usb/host/usb_host_ehci.c b/bsp/imxrt/libraries/drivers/usb/host/usb_host_ehci.c index 58059e033d..8a31514b3a 100644 --- a/bsp/imxrt/libraries/drivers/usb/host/usb_host_ehci.c +++ b/bsp/imxrt/libraries/drivers/usb/host/usb_host_ehci.c @@ -1,22 +1,41 @@ /* * Copyright (c) 2015 - 2016, Freescale Semiconductor, Inc. - * Copyright 2016,2019 - 2020 NXP - * All rights reserved. + * Copyright 2016 NXP * - * SPDX-License-Identifier: BSD-3-Clause + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * o Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * o Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * o Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include +#include #if ((defined USB_HOST_CONFIG_EHCI) && (USB_HOST_CONFIG_EHCI > 0U)) #include "usb_host.h" #include "usb_host_hci.h" #include "usb_host_devices.h" -#if ((defined USB_HOST_CONFIG_COMPLIANCE_TEST) && (USB_HOST_CONFIG_COMPLIANCE_TEST)) -#include "usb_host_framework.h" -#endif #include "fsl_device_registers.h" #include "usb_host_ehci.h" -#include +#include "usb_phy.h" #if ((defined USB_HOST_CONFIG_COMPLIANCE_TEST) && (USB_HOST_CONFIG_COMPLIANCE_TEST)) #include "usb_host.h" #endif @@ -31,16 +50,16 @@ #endif -#define USB_HOST_EHCI_BANDWIDTH_DELAY (3500U) -#define USB_HOST_EHCI_BANDWIDTH_HUB_LS_SETUP (333U) +#define USB_HOST_EHCI_BANDWIDTH_DELAY (3500U) +#define USB_HOST_EHCI_BANDWIDTH_HUB_LS_SETUP (333U) #define USB_HOST_EHCI_BANDWIDTH_FRAME_TOTOAL_TIME (900U) #if ((defined USB_HOST_CONFIG_COMPLIANCE_TEST) && (USB_HOST_CONFIG_COMPLIANCE_TEST)) -#define USB_HOST_EHCI_TEST_DESCRIPTOR_LENGTH (18U) -#define USB_HOST_EHCI_PORTSC_PTC_J_STATE (0x01U) -#define USB_HOST_EHCI_PORTSC_PTC_K_STATE (0x02U) -#define USB_HOST_EHCI_PORTSC_PTC_SE0_NAK (0x03U) -#define USB_HOST_EHCI_PORTSC_PTC_PACKET (0x04U) +#define USB_HOST_EHCI_TEST_DESCRIPTOR_LENGTH (18U) +#define USB_HOST_EHCI_PORTSC_PTC_J_STATE (0x01U) +#define USB_HOST_EHCI_PORTSC_PTC_K_STATE (0x02U) +#define USB_HOST_EHCI_PORTSC_PTC_SE0_NAK (0x03U) +#define USB_HOST_EHCI_PORTSC_PTC_PACKET (0x04U) #define USB_HOST_EHCI_PORTSC_PTC_FORCE_ENABLE_HS (0x05U) #define USB_HOST_EHCI_PORTSC_PTC_FORCE_ENABLE_FS (0x06U) #define USB_HOST_EHCI_PORTSC_PTC_FORCE_ENABLE_LS (0x07U) @@ -83,7 +102,7 @@ static void USB_HostBandwidthFslsHostComputeCurrent(usb_host_ehci_instance_t *eh static void USB_HostBandwidthHsHostComputeCurrentFsls(usb_host_ehci_instance_t *ehciInstance, uint32_t hubNumber, uint16_t frameIndex, - uint16_t frameBandwidths[8]); + uint8_t frameBandwidths[8]); /*! * @brief compute current allocated HS bandwidth when ehci work as hi-speed host. @@ -94,7 +113,7 @@ static void USB_HostBandwidthHsHostComputeCurrentFsls(usb_host_ehci_instance_t * */ static void USB_HostBandwidthHsHostComputeCurrentHsAll(usb_host_ehci_instance_t *ehciInstance, uint16_t frameIndex, - uint16_t frameBandwidths[8]); + uint8_t frameBandwidths[8]); /*! * @brief allocate HS bandwidth when host work as high-speed host. @@ -156,6 +175,13 @@ static void USB_HostEhciZeroMem(uint32_t *buffer, uint32_t length); */ static void USB_HostEhciDelay(USBHS_Type *ehciIpBase, uint32_t ms); +/*! + * @brief host ehci start async schedule. + * + * @param ehciInstance ehci instance pointer. + */ +static void USB_HostEhciStartAsync(usb_host_ehci_instance_t *ehciInstance); + /*! * @brief host ehci stop async schedule. * @@ -163,6 +189,13 @@ static void USB_HostEhciDelay(USBHS_Type *ehciIpBase, uint32_t ms); */ static void USB_HostEhciStopAsync(usb_host_ehci_instance_t *ehciInstance); +/*! + * @brief host ehci start periodic schedule. + * + * @param ehciInstance ehci instance pointer. + */ +static void USB_HostEhciStartPeriodic(usb_host_ehci_instance_t *ehciInstance); + /*! * @brief host ehci stop periodic schedule. * @@ -482,6 +515,16 @@ static usb_status_t USB_HostEhciCancelPipe(usb_host_ehci_instance_t *ehciInstanc usb_host_ehci_pipe_t *ehciPipePointer, usb_host_transfer_t *transfer); +/*! + * @brief control ehci bus. + * + * @param ehciInstance ehci instance pointer. + * @param bus_control control code. + * + * @return kStatus_USB_Success or error codes. + */ +static usb_status_t USB_HostEhciControlBus(usb_host_ehci_instance_t *ehciInstance, uint8_t busControl); + /*! * @brief ehci transaction done process function. * @@ -489,7 +532,20 @@ static usb_status_t USB_HostEhciCancelPipe(usb_host_ehci_instance_t *ehciInstanc */ void USB_HostEhciTransactionDone(usb_host_ehci_instance_t *ehciInstance); +/*! + * @brief ehci port change interrupt process function. + * + * @param ehciInstance ehci instance pointer. + */ +static void USB_HostEhciPortChange(usb_host_ehci_instance_t *ehciInstance); +/*! + * @brief ehci timer0 interrupt process function. + * cancel control/bulk transfer that time out. + * + * @param ehciInstance ehci instance pointer. + */ +static void USB_HostEhciTimer0(usb_host_ehci_instance_t *ehciInstance); #if ((defined(USB_HOST_CONFIG_LOW_POWER_MODE)) && (USB_HOST_CONFIG_LOW_POWER_MODE > 0U)) /*! @@ -530,60 +586,71 @@ extern usb_status_t USB_HostStandardSetGetDescriptor(usb_host_device_instance_t USB_RAM_ADDRESS_ALIGNMENT(4096) USB_CONTROLLER_DATA static uint8_t s_UsbHostEhciFrameList1[USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE * 4]; -static uint8_t usbHostEhciFramListStatus[1] = {0}; +#define USB_HOST_EHCI_FRAME_LIST_ARRAY \ + { \ + &s_UsbHostEhciFrameList1[0] \ + } USB_RAM_ADDRESS_ALIGNMENT(64) USB_CONTROLLER_DATA static usb_host_ehci_data_t s_UsbHostEhciData1; -#elif (USB_HOST_CONFIG_EHCI == 2U) +#define USB_HOST_EHCI_DATA_ARRAY \ + { \ + &s_UsbHostEhciData1 \ + } +#elif(USB_HOST_CONFIG_EHCI == 2U) USB_RAM_ADDRESS_ALIGNMENT(4096) USB_CONTROLLER_DATA static uint8_t s_UsbHostEhciFrameList1[USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE * 4]; USB_RAM_ADDRESS_ALIGNMENT(4096) USB_CONTROLLER_DATA static uint8_t s_UsbHostEhciFrameList2[USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE * 4]; -static uint8_t usbHostEhciFramListStatus[2] = {0, 0}; +#define USB_HOST_EHCI_FRAME_LIST_ARRAY \ + { \ + &s_UsbHostEhciFrameList1[0], &s_UsbHostEhciFrameList2[0] \ + } USB_RAM_ADDRESS_ALIGNMENT(64) USB_CONTROLLER_DATA static usb_host_ehci_data_t s_UsbHostEhciData1; USB_RAM_ADDRESS_ALIGNMENT(64) USB_CONTROLLER_DATA static usb_host_ehci_data_t s_UsbHostEhciData2; +#define USB_HOST_EHCI_DATA_ARRAY \ + { \ + &s_UsbHostEhciData1, &s_UsbHostEhciData2 \ + } #else #error "Please increase the instance count." #endif -#define USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE (1024U) -#define USB_HOST_EHCI_MAX_MICRFRAME_VALUE ((USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE << 3U) - 1U) -static uint8_t s_SlotMaxBandwidth[8] = {125, 125, 125, 125, 125, 125, 50, 0}; -static uint8_t s_SlotMaxBandwidthHs[8] = {100, 100, 100, 100, 100, 100, 100, 100}; +static uint8_t s_SlotMaxBandwidth[8] = {125, 125, 125, 125, 125, 125, 50, 0}; /******************************************************************************* * Code ******************************************************************************/ /*! - * @brief EHCI NC get USB NC bass address. - * - * This function is used to get USB NC bass address. - * - * @param[in] controllerId EHCI controller ID; See the #usb_controller_index_t. - * - * @retval USB NC bass address. - */ +* @brief EHCI NC get USB NC bass address. +* +* This function is used to get USB NC bass address. +* +* @param[in] controllerId EHCI controller ID; See the #usb_controller_index_t. +* +* @retval USB NC bass address. +*/ #if (defined(USB_HOST_CONFIG_LOW_POWER_MODE) && (USB_HOST_CONFIG_LOW_POWER_MODE > 0U)) #if (defined(FSL_FEATURE_SOC_USBNC_COUNT) && (FSL_FEATURE_SOC_USBNC_COUNT > 0U)) -static void *USB_EhciNCGetBase(uint8_t controllerId) +void *USB_EhciNCGetBase(uint8_t controllerId) { void *usbNCBase = NULL; #if ((defined FSL_FEATURE_SOC_USBNC_COUNT) && (FSL_FEATURE_SOC_USBNC_COUNT > 0U)) uint32_t instance; - uint32_t newinstance = 0; + uint32_t newinstance = 0; uint32_t usbnc_base_temp[] = USBNC_BASE_ADDRS; - uint32_t usbnc_base[] = USBNC_BASE_ADDRS; + uint32_t usbnc_base[] = USBNC_BASE_ADDRS; - if (controllerId < (uint8_t)kUSB_ControllerEhci0) + if (controllerId < kUSB_ControllerEhci0) { return NULL; } - controllerId = controllerId - (uint8_t)kUSB_ControllerEhci0; + controllerId = controllerId - kUSB_ControllerEhci0; for (instance = 0; instance < (sizeof(usbnc_base_temp) / sizeof(usbnc_base_temp[0])); instance++) { - if (usbnc_base_temp[instance] != 0U) + if (usbnc_base_temp[instance]) { usbnc_base[newinstance++] = usbnc_base_temp[instance]; } @@ -593,7 +660,7 @@ static void *USB_EhciNCGetBase(uint8_t controllerId) return NULL; } - usbNCBase = (void *)(uint8_t *)usbnc_base[controllerId]; + usbNCBase = (void *)usbnc_base[controllerId]; #endif return usbNCBase; } @@ -662,19 +729,19 @@ static void USB_HostEhciTestSingleStepGetDeviceDesc(usb_host_ehci_instance_t *eh return; } - getDescriptorParam.descriptorLength = sizeof(usb_descriptor_device_t); - getDescriptorParam.descriptorLength = 18; - getDescriptorParam.descriptorBuffer = (uint8_t *)&deviceInstance->deviceDescriptor; - getDescriptorParam.descriptorType = USB_DESCRIPTOR_TYPE_DEVICE; - getDescriptorParam.descriptorIndex = 0; - getDescriptorParam.languageId = 0; - transfer->callbackFn = USB_HostEhciTestCallback; - transfer->callbackParam = ehciInstance->hostHandle; + getDescriptorParam.descriptorLength = sizeof(usb_descriptor_device_t); + getDescriptorParam.descriptorLength = 18; + getDescriptorParam.descriptorBuffer = (uint8_t *)&deviceInstance->deviceDescriptor; + getDescriptorParam.descriptorType = USB_DESCRIPTOR_TYPE_DEVICE; + getDescriptorParam.descriptorIndex = 0; + getDescriptorParam.languageId = 0; + transfer->callbackFn = USB_HostEhciTestCallback; + transfer->callbackParam = ehciInstance->hostHandle; transfer->setupPacket->bmRequestType = USB_REQUEST_TYPE_DIR_IN; - transfer->setupPacket->bRequest = USB_REQUEST_STANDARD_GET_DESCRIPTOR; - transfer->setupPacket->wIndex = 0; - transfer->setupPacket->wLength = 0; - transfer->setupPacket->wValue = 0; + transfer->setupPacket->bRequest = USB_REQUEST_STANDARD_GET_DESCRIPTOR; + transfer->setupPacket->wIndex = 0; + transfer->setupPacket->wLength = 0; + transfer->setupPacket->wValue = 0; USB_HostStandardSetGetDescriptor(deviceInstance, transfer, &getDescriptorParam); } @@ -707,8 +774,8 @@ static usb_status_t USB_HostEhciSingleStepQtdListInit(usb_host_ehci_instance_t * { qtdPointer->nextQtdPointer = (uint32_t)ehciInstance->ehciQtdHead; } - qtdPointer = ehciInstance->ehciQtdHead; - ehciInstance->ehciQtdHead = (usb_host_ehci_qtd_t *)qtdPointer->nextQtdPointer; + qtdPointer = ehciInstance->ehciQtdHead; + ehciInstance->ehciQtdHead = (usb_host_ehci_qtd_t *)qtdPointer->nextQtdPointer; qtdPointer->nextQtdPointer = 0; } while (--qtdNumber); } @@ -728,7 +795,7 @@ static usb_status_t USB_HostEhciSingleStepQtdListInit(usb_host_ehci_instance_t * qtdPointer->transferResults[0] = ((0x00000000 << EHCI_HOST_QTD_DT_SHIFT) | (8 << EHCI_HOST_QTD_TOTAL_BYTES_SHIFT) | (EHCI_HOST_PID_SETUP << EHCI_HOST_QTD_PID_CODE_SHIFT) | (EHCI_HOST_QTD_STATUS_ACTIVE_MASK)); - dataAddress = (uint32_t)(transfer->setupPacket); + dataAddress = (uint32_t)(transfer->setupPacket); qtdPointer->transferResults[1] = dataAddress; /* current offset is set too */ /* set buffer pointer no matter data length */ for (index = 0; index < 4; ++index) @@ -749,7 +816,7 @@ static usb_status_t USB_HostEhciSingleStepQtdListInit(usb_host_ehci_instance_t * ((0x00000001U << EHCI_HOST_QTD_DT_SHIFT) | (dataLength << EHCI_HOST_QTD_TOTAL_BYTES_SHIFT) | (EHCI_HOST_PID_IN << EHCI_HOST_QTD_PID_CODE_SHIFT) | (EHCI_HOST_QTD_STATUS_ACTIVE_MASK)); - dataAddress = (uint32_t)(transfer->transferBuffer); + dataAddress = (uint32_t)(transfer->transferBuffer); qtdPointer->transferResults[1] = dataAddress; /* current offset is set too */ /* set buffer pointer no matter data length */ for (index = 0; index < 4; ++index) @@ -781,24 +848,24 @@ static usb_status_t USB_HostEhciSingleStepQtdListInit(usb_host_ehci_instance_t * transfer->next = NULL; if (vltQhPointer->ehciTransferHead == NULL) { - transfer->next = NULL; + transfer->next = NULL; vltQhPointer->ehciTransferHead = vltQhPointer->ehciTransferTail = transfer; } else { - transfer->next = NULL; + transfer->next = NULL; vltQhPointer->ehciTransferTail->next = transfer; - vltQhPointer->ehciTransferTail = transfer; + vltQhPointer->ehciTransferTail = transfer; } USB_HostEhciLock(); /* link qtd to qh (link to end) */ entryPointer = &(vltQhPointer->nextQtdPointer); - dataAddress = *entryPointer; /* dataAddress variable means entry value here */ + dataAddress = *entryPointer; /* dataAddress variable means entry value here */ while ((dataAddress) && (!(dataAddress & EHCI_HOST_T_INVALID_VALUE))) { entryPointer = (volatile uint32_t *)dataAddress; - dataAddress = *entryPointer; + dataAddress = *entryPointer; } *entryPointer = (uint32_t)qtdPointer; USB_HostEhciUnlock(); @@ -821,11 +888,11 @@ static void USB_HostEhciTestSingleStepGetDeviceDescData(usb_host_ehci_instance_t { return; } - transfer->callbackFn = USB_HostEhciTestCallback; - transfer->callbackParam = ehciInstance->hostHandle; + transfer->callbackFn = USB_HostEhciTestCallback; + transfer->callbackParam = ehciInstance->hostHandle; transfer->setupPacket->bmRequestType = USB_REQUEST_TYPE_DIR_IN; - transfer->setupPacket->bRequest = USB_REQUEST_STANDARD_GET_DESCRIPTOR; - transfer->setupPacket->wLength = USB_SHORT_TO_LITTLE_ENDIAN(USB_HOST_EHCI_TEST_DESCRIPTOR_LENGTH); + transfer->setupPacket->bRequest = USB_REQUEST_STANDARD_GET_DESCRIPTOR; + transfer->setupPacket->wLength = USB_SHORT_TO_LITTLE_ENDIAN(USB_HOST_EHCI_TEST_DESCRIPTOR_LENGTH); transfer->setupPacket->wValue = USB_SHORT_TO_LITTLE_ENDIAN((uint16_t)((uint16_t)USB_DESCRIPTOR_TYPE_DEVICE << 8)); transfer->setupPacket->wIndex = 0; USB_HostEhciSingleStepQtdListInit(ehciInstance, (usb_host_ehci_pipe_t *)(deviceInstance->controlPipe), transfer, 1); @@ -840,8 +907,8 @@ static void USB_HostEhciTestSingleStepGetDeviceDescData(usb_host_ehci_instance_t { return; } - transfer->callbackFn = USB_HostEhciTestCallback; - transfer->callbackParam = ehciInstance->hostHandle; + transfer->callbackFn = USB_HostEhciTestCallback; + transfer->callbackParam = ehciInstance->hostHandle; transfer->transferBuffer = buffer; transfer->transferLength = USB_HOST_EHCI_TEST_DESCRIPTOR_LENGTH; USB_HostEhciSingleStepQtdListInit(ehciInstance, (usb_host_ehci_pipe_t *)(deviceInstance->controlPipe), transfer, 2); @@ -850,8 +917,8 @@ static void USB_HostEhciTestSingleStepGetDeviceDescData(usb_host_ehci_instance_t { return; } - transfer->callbackFn = USB_HostEhciTestCallback; - transfer->callbackParam = ehciInstance->hostHandle; + transfer->callbackFn = USB_HostEhciTestCallback; + transfer->callbackParam = ehciInstance->hostHandle; transfer->transferBuffer = NULL; transfer->transferLength = 0; USB_HostEhciSingleStepQtdListInit(ehciInstance, (usb_host_ehci_pipe_t *)(deviceInstance->controlPipe), transfer, 3); @@ -867,7 +934,7 @@ static void USB_HostEhciTestSingleStepGetDeviceDescData(usb_host_ehci_instance_t return; } -static void USB_HostEhciTestModeInit(usb_device_handle deviceHandle) +void USB_HostEhciTestModeInit(usb_device_handle deviceHandle) { uint32_t productId; usb_host_device_instance_t *deviceInstance = (usb_host_device_instance_t *)deviceHandle; @@ -908,7 +975,6 @@ static void USB_HostEhciTestModeInit(usb_device_handle deviceHandle) USB_HostEhciTestSingleStepGetDeviceDescData(ehciInstance, deviceHandle); break; default: - /*no action */ break; } @@ -948,62 +1014,60 @@ static void USB_HostEhciResumeBus(usb_host_ehci_instance_t *ehciInstance) static uint32_t USB_HostBandwidthComputeTime(uint8_t speed, uint8_t pipeType, uint8_t direction, uint32_t dataLength) { - uint32_t result = (3167U + ((1000U * dataLength) * 7U * 8U / 6U)) / 1000U; + uint32_t result = (3167 + ((1000 * dataLength) * 7U * 8U / 6U)) / 1000; if (pipeType == USB_ENDPOINT_ISOCHRONOUS) /* iso */ { if (speed == USB_SPEED_HIGH) { - result = 38U * 8U * 2083U + 2083U * result + USB_HOST_EHCI_BANDWIDTH_DELAY; + result = 38 * 8 * 2083 + 2083 * result + USB_HOST_EHCI_BANDWIDTH_DELAY; } else if (speed == USB_SPEED_FULL) { if (direction == USB_IN) { - result = 7268000U + 83540U * result + USB_HOST_EHCI_BANDWIDTH_DELAY; + result = 7268000 + 83540 * result + USB_HOST_EHCI_BANDWIDTH_DELAY; } else { - result = 6265000U + 83540U * result + USB_HOST_EHCI_BANDWIDTH_DELAY; + result = 6265000 + 83540 * result + USB_HOST_EHCI_BANDWIDTH_DELAY; } } else { - /*no action*/ } } else /* interrupt */ { if (speed == USB_SPEED_HIGH) { - result = 55U * 8U * 2083U + 2083U * result + USB_HOST_EHCI_BANDWIDTH_DELAY; + result = 55 * 8 * 2083 + 2083 * result + USB_HOST_EHCI_BANDWIDTH_DELAY; } else if (speed == USB_SPEED_FULL) { - result = 9107000U + 83540U * result + USB_HOST_EHCI_BANDWIDTH_DELAY; + result = 9107000 + 83540 * result + USB_HOST_EHCI_BANDWIDTH_DELAY; } else if (speed == USB_SPEED_LOW) { if (direction == USB_IN) { - result = 64060000U + 2000U * USB_HOST_EHCI_BANDWIDTH_HUB_LS_SETUP + 676670U * result + + result = 64060000 + 2000 * USB_HOST_EHCI_BANDWIDTH_HUB_LS_SETUP + 676670 * result + USB_HOST_EHCI_BANDWIDTH_DELAY; } else { - result = 6265000U + 83540U * result + USB_HOST_EHCI_BANDWIDTH_DELAY; + result = 6265000 + 83540 * result + USB_HOST_EHCI_BANDWIDTH_DELAY; } } else { - /*no action*/ } } - result /= 1000000U; - if (result == 0U) + result /= 1000000; + if (result == 0) { - result = 1U; + result = 1; } return result; @@ -1014,7 +1078,7 @@ static void USB_HostBandwidthFslsHostComputeCurrent(usb_host_ehci_instance_t *eh uint16_t *frameBandwidth) { usb_host_ehci_pipe_t *ehciPipePointer; - void *temp; + /* clear the bandwidth */ *frameBandwidth = 0; @@ -1027,28 +1091,26 @@ static void USB_HostBandwidthFslsHostComputeCurrent(usb_host_ehci_instance_t *eh { /* does pipe allocate bandwidth in frameIndex frame? note: interval is power of 2. */ if ((frameIndex >= ehciPipePointer->startFrame) && - (0U == ((uint32_t)((uint32_t)frameIndex - ehciPipePointer->startFrame) & - ((uint32_t)ehciPipePointer->pipeCommon.interval - 1U)))) + (!((uint32_t)(frameIndex - ehciPipePointer->startFrame) & + (uint32_t)(ehciPipePointer->pipeCommon.interval - 1)))) { *frameBandwidth += ehciPipePointer->dataTime; } } - temp = (void *)ehciPipePointer->pipeCommon.next; - ehciPipePointer = (usb_host_ehci_pipe_t *)temp; + ehciPipePointer = (usb_host_ehci_pipe_t *)ehciPipePointer->pipeCommon.next; } } static void USB_HostBandwidthHsHostComputeCurrentFsls(usb_host_ehci_instance_t *ehciInstance, uint32_t hubNumber, uint16_t frameIndex, - uint16_t frameBandwidths[8]) + uint8_t frameBandwidths[8]) { usb_host_ehci_pipe_t *ehciPipePointer; uint8_t index; uint32_t deviceInfo; - void *temp; - for (index = 0; index < 8U; ++index) + for (index = 0; index < 8; ++index) { frameBandwidths[index] = 0; } @@ -1062,50 +1124,47 @@ static void USB_HostBandwidthHsHostComputeCurrentFsls(usb_host_ehci_instance_t * { /* compute FS/LS bandwidth that blong to same high-speed hub, because FS/LS bandwidth is allocated from * first parent high-speed hub */ - (void)USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, - (uint32_t)kUSB_HostGetDeviceHSHubNumber, &deviceInfo); + USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, + kUSB_HostGetDeviceHSHubNumber, &deviceInfo); if (deviceInfo != hubNumber) { - temp = (void *)ehciPipePointer->pipeCommon.next; - ehciPipePointer = (usb_host_ehci_pipe_t *)temp; + ehciPipePointer = (usb_host_ehci_pipe_t *)ehciPipePointer->pipeCommon.next; continue; } - (void)USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, - (uint32_t)kUSB_HostGetDeviceSpeed, &deviceInfo); + USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, kUSB_HostGetDeviceSpeed, + &deviceInfo); if (deviceInfo == USB_SPEED_HIGH) { - temp = (void *)ehciPipePointer->pipeCommon.next; - ehciPipePointer = (usb_host_ehci_pipe_t *)temp; + ehciPipePointer = (usb_host_ehci_pipe_t *)ehciPipePointer->pipeCommon.next; continue; } /* does pipe allocate bandwidth in frameIndex frame? note: interval is power of 2. */ if ((frameIndex >= ehciPipePointer->startFrame) && - (0U == ((uint32_t)((uint32_t)frameIndex - ehciPipePointer->startFrame) & - ((uint32_t)ehciPipePointer->pipeCommon.interval - 1U)))) + (!((uint32_t)(frameIndex - ehciPipePointer->startFrame) & + (uint32_t)(ehciPipePointer->pipeCommon.interval - 1)))) { if (ehciPipePointer->pipeCommon.pipeType == USB_ENDPOINT_ISOCHRONOUS) /* iso bandwidth is allocated once */ { - frameBandwidths[ehciPipePointer->startUframe + 1U] += ehciPipePointer->dataTime; + frameBandwidths[ehciPipePointer->startUframe + 1] += ehciPipePointer->dataTime; } else /* iso bandwidth is allocated three times */ { - frameBandwidths[ehciPipePointer->startUframe + 1U] += ehciPipePointer->dataTime; - frameBandwidths[ehciPipePointer->startUframe + 2U] += ehciPipePointer->dataTime; - frameBandwidths[ehciPipePointer->startUframe + 3U] += ehciPipePointer->dataTime; + frameBandwidths[ehciPipePointer->startUframe + 1] += ehciPipePointer->dataTime; + frameBandwidths[ehciPipePointer->startUframe + 2] += ehciPipePointer->dataTime; + frameBandwidths[ehciPipePointer->startUframe + 3] += ehciPipePointer->dataTime; } } } - temp = (void *)ehciPipePointer->pipeCommon.next; - ehciPipePointer = (usb_host_ehci_pipe_t *)temp; + ehciPipePointer = (usb_host_ehci_pipe_t *)ehciPipePointer->pipeCommon.next; } - for (index = 0; index < 7U; ++index) /* */ + for (index = 0; index < 7; ++index) /* */ { if (frameBandwidths[index] > s_SlotMaxBandwidth[index]) { - frameBandwidths[index + 1U] += (frameBandwidths[index] - s_SlotMaxBandwidth[index]); + frameBandwidths[index + 1] += (frameBandwidths[index] - s_SlotMaxBandwidth[index]); frameBandwidths[index] = s_SlotMaxBandwidth[index]; } } @@ -1113,14 +1172,14 @@ static void USB_HostBandwidthHsHostComputeCurrentFsls(usb_host_ehci_instance_t * static void USB_HostBandwidthHsHostComputeCurrentHsAll(usb_host_ehci_instance_t *ehciInstance, uint16_t frameIndex, - uint16_t frameBandwidths[8]) + uint8_t frameBandwidths[8]) { usb_host_ehci_pipe_t *ehciPipePointer; - uint16_t index; + uint8_t index; uint32_t deviceInfo; uint16_t frameInterval; - void *temp; - for (index = 0; index < 8U; ++index) + + for (index = 0; index < 8; ++index) { frameBandwidths[index] = 0; } @@ -1133,26 +1192,26 @@ static void USB_HostBandwidthHsHostComputeCurrentHsAll(usb_host_ehci_instance_t (ehciPipePointer->pipeCommon.pipeType == USB_ENDPOINT_INTERRUPT)) { frameInterval = ehciPipePointer->pipeCommon.interval; - (void)USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, - (uint32_t)kUSB_HostGetDeviceSpeed, &deviceInfo); + USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, kUSB_HostGetDeviceSpeed, + &deviceInfo); if (deviceInfo == USB_SPEED_HIGH) /* high-speed data bandwidth */ { /* frameInterval means micro-frame here */ if (frameIndex >= ehciPipePointer->startFrame) { - if ((frameInterval > 8U) && - (frameIndex * 8U - ehciPipePointer->startFrame * 8U >= ehciPipePointer->startUframe)) + if ((frameInterval > 8) && + (frameIndex * 8 - ehciPipePointer->startFrame * 8 >= ehciPipePointer->startUframe)) { - if (0U == ((((uint32_t)frameIndex) * 8U - ehciPipePointer->startFrame * 8U - - ehciPipePointer->startUframe) & - ((uint32_t)frameInterval - 1U))) + if (!((uint32_t)(frameIndex * 8 - ehciPipePointer->startFrame * 8 - + ehciPipePointer->startUframe) & + (uint32_t)(frameInterval - 1))) { frameBandwidths[ehciPipePointer->startUframe] += ehciPipePointer->dataTime; } } else { - for (index = ehciPipePointer->startUframe; index < 8U; index += frameInterval) + for (index = ehciPipePointer->startUframe; index < 8; index += frameInterval) { frameBandwidths[index] += ehciPipePointer->dataTime; } @@ -1162,18 +1221,17 @@ static void USB_HostBandwidthHsHostComputeCurrentHsAll(usb_host_ehci_instance_t else /* full-speed split bandwidth */ { if ((frameIndex >= ehciPipePointer->startFrame) && - (0U == ((uint32_t)((uint32_t)frameIndex - ehciPipePointer->startFrame) & - (uint32_t)((uint32_t)frameInterval - 1U)))) + (!((uint32_t)(frameIndex - ehciPipePointer->startFrame) & (uint32_t)(frameInterval - 1)))) { - for (index = 0; index < 8U; ++index) + for (index = 0; index < 8; ++index) { - if (0U != ((uint32_t)(ehciPipePointer->uframeSmask) & - (uint32_t)(0x01UL << index))) /* start-split micro-frames */ + if ((uint32_t)(ehciPipePointer->uframeSmask) & + (uint32_t)(0x01 << index)) /* start-split micro-frames */ { frameBandwidths[index] += ehciPipePointer->startSplitTime; } - if (0U != ((uint32_t)(ehciPipePointer->uframeCmask) & - (uint32_t)(0x01UL << index))) /* complete-split micro-frames */ + if ((uint32_t)(ehciPipePointer->uframeCmask) & + (uint32_t)(0x01 << index)) /* complete-split micro-frames */ { frameBandwidths[index] += ehciPipePointer->completeSplitTime; } @@ -1181,20 +1239,17 @@ static void USB_HostBandwidthHsHostComputeCurrentHsAll(usb_host_ehci_instance_t } } } - temp = (void *)ehciPipePointer->pipeCommon.next; - ehciPipePointer = (usb_host_ehci_pipe_t *)temp; + ehciPipePointer = (usb_host_ehci_pipe_t *)ehciPipePointer->pipeCommon.next; } -#if 0 for (index = 0; index < 7; ++index) /* */ { - if (frameBandwidths[index] > s_SlotMaxBandwidthHs[index]) + if (frameBandwidths[index] > s_SlotMaxBandwidth[index]) { - frameBandwidths[index + 1] += (frameBandwidths[index] - s_SlotMaxBandwidthHs[index]); - frameBandwidths[index] = s_SlotMaxBandwidthHs[index]; + frameBandwidths[index + 1] += (frameBandwidths[index] - s_SlotMaxBandwidth[index]); + frameBandwidths[index] = s_SlotMaxBandwidth[index]; } } -#endif } /*! @@ -1215,19 +1270,15 @@ static usb_status_t USB_HostBandwidthHsHostAllocateHsCommon(usb_host_ehci_instan uint16_t uframeIntervalIndex; uint16_t uframeIndex; uint16_t frameIndex; - uint16_t frameTimes[8]; + uint8_t frameTimes[8]; frameIndex = 0; - for (uint8_t i = 0; i < 8U; ++i) - { - frameTimes[i] = 0U; - } USB_HostBandwidthHsHostComputeCurrentHsAll( ehciInstance, frameIndex, frameTimes); /* compute the allocated bandwidths in the frameIndex frame */ for (uframeIntervalIndex = 0; (uframeIntervalIndex < uframeInterval); ++uframeIntervalIndex) /* start micro-frame */ { /* for all the micro-frame in interval uframeInterval */ - for (uframeIndex = uframeIntervalIndex; uframeIndex < (USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE * 8U); + for (uframeIndex = uframeIntervalIndex; uframeIndex < (USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE * 8); uframeIndex += uframeInterval) { if (frameIndex != (uframeIndex >> 3)) @@ -1237,13 +1288,13 @@ static usb_status_t USB_HostBandwidthHsHostAllocateHsCommon(usb_host_ehci_instan ehciInstance, frameIndex, frameTimes); /* compute the allocated bandwidths in the new frameIndex frame */ } - if (frameTimes[uframeIndex & 0x0007U] + timeData > - s_SlotMaxBandwidthHs[(uframeIndex & 0x0007U)]) /* micro-frame has enough idle bandwidth? */ + if (frameTimes[uframeIndex & 0x0007] + timeData > + s_SlotMaxBandwidth[(uframeIndex & 0x0007)]) /* micro-frame has enough idle bandwidth? */ { break; /* fail */ } } - if (uframeIndex >= (USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE * 8U)) /* success? */ + if (uframeIndex >= (USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE * 8)) /* success? */ { break; } @@ -1267,97 +1318,91 @@ static usb_status_t USB_HostBandwidthHsHostAllocateIso(usb_host_ehci_instance_t usb_host_ehci_pipe_t *ehciPipePointer) { usb_status_t status; - uint32_t deviceInfo = 0; - uint32_t hubNumber = 0; + uint32_t deviceInfo; + uint32_t hubNumber; uint16_t uframeIntervalIndex = 0; - uint16_t frameIntervalIndex = 0; + uint16_t frameIntervalIndex = 0; uint16_t frameIndex; uint16_t timeCompleteSplit; uint16_t timeStartSplit; uint32_t timeData; uint8_t SsCsNumber = 0; uint16_t frameInterval; - uint16_t frameTimes[8]; + uint8_t frameTimes[8]; uint8_t allocateOk = 1; - uint16_t index; + uint8_t index; - for (uint8_t i = 0; i < 8U; ++i) - { - frameTimes[i] = 0U; - } - (void)USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, - (uint32_t)kUSB_HostGetDeviceSpeed, &deviceInfo); + USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, kUSB_HostGetDeviceSpeed, + &deviceInfo); timeData = USB_HostBandwidthComputeTime( - (uint8_t)deviceInfo, USB_ENDPOINT_ISOCHRONOUS, ehciPipePointer->pipeCommon.direction, - (((uint32_t)ehciPipePointer->pipeCommon.maxPacketSize) * ehciPipePointer->pipeCommon.numberPerUframe)); + deviceInfo, USB_ENDPOINT_ISOCHRONOUS, ehciPipePointer->pipeCommon.direction, + ehciPipePointer->pipeCommon.maxPacketSize * ehciPipePointer->pipeCommon.numberPerUframe); /* pipe is high-speed */ if (deviceInfo == USB_SPEED_HIGH) { uframeIntervalIndex = 0; - status = USB_HostBandwidthHsHostAllocateHsCommon(ehciInstance, ehciPipePointer->uframeInterval, - (uint16_t)timeData, &uframeIntervalIndex); + status = USB_HostBandwidthHsHostAllocateHsCommon(ehciInstance, ehciPipePointer->uframeInterval, timeData, + &uframeIntervalIndex); if (status == kStatus_USB_Success) { - ehciPipePointer->startFrame = (uframeIntervalIndex / 8U); - ehciPipePointer->startUframe = (uint8_t)(uframeIntervalIndex & 0x0007U); - ehciPipePointer->dataTime = (uint16_t)timeData; + ehciPipePointer->startFrame = (uframeIntervalIndex / 8); + ehciPipePointer->startUframe = (uframeIntervalIndex & 0x0007); + ehciPipePointer->dataTime = timeData; return kStatus_USB_Success; } } else /* pipe is full-speed or low-speed */ { - (void)USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, - (uint32_t)kUSB_HostGetHubThinkTime, - &deviceInfo); /* deviceInfo variable means hub think time */ - timeData += (deviceInfo * 7U / (6U * 12U)); - (void)USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, - (uint32_t)kUSB_HostGetDeviceHSHubNumber, &hubNumber); + USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, kUSB_HostGetHubThinkTime, + &deviceInfo); /* deviceInfo variable means hub think time */ + timeData += (deviceInfo * 7 / (6 * 12)); + USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, kUSB_HostGetDeviceHSHubNumber, + &hubNumber); frameInterval = ehciPipePointer->pipeCommon.interval; /* compute start-split and complete-split bandwidth */ if (ehciPipePointer->pipeCommon.direction == USB_OUT) { - timeStartSplit = (uint16_t)USB_HostBandwidthComputeTime(USB_SPEED_HIGH, USB_ENDPOINT_ISOCHRONOUS, USB_OUT, - ehciPipePointer->pipeCommon.maxPacketSize); + timeStartSplit = USB_HostBandwidthComputeTime(USB_SPEED_HIGH, USB_ENDPOINT_ISOCHRONOUS, USB_OUT, + ehciPipePointer->pipeCommon.maxPacketSize); timeCompleteSplit = 0; } else { - timeStartSplit = - (uint16_t)USB_HostBandwidthComputeTime(USB_SPEED_HIGH, USB_ENDPOINT_ISOCHRONOUS, USB_IN, 1); - timeCompleteSplit = (uint16_t)USB_HostBandwidthComputeTime(USB_SPEED_HIGH, USB_ENDPOINT_ISOCHRONOUS, USB_IN, - ehciPipePointer->pipeCommon.maxPacketSize); + timeStartSplit = USB_HostBandwidthComputeTime(USB_SPEED_HIGH, USB_ENDPOINT_ISOCHRONOUS, USB_IN, 1); + timeCompleteSplit = USB_HostBandwidthComputeTime(USB_SPEED_HIGH, USB_ENDPOINT_ISOCHRONOUS, USB_IN, + ehciPipePointer->pipeCommon.maxPacketSize); } /* note: bandwidth must put in one frame */ - for (uframeIntervalIndex = 0U; uframeIntervalIndex <= 5U; ++uframeIntervalIndex) /* uframe interval */ + for (uframeIntervalIndex = 0; uframeIntervalIndex <= 5; ++uframeIntervalIndex) /* uframe interval */ { - for (frameIntervalIndex = 0U; frameIntervalIndex < frameInterval; ++frameIntervalIndex) /* frame interval */ + for (frameIntervalIndex = 0; frameIntervalIndex < frameInterval; ++frameIntervalIndex) /* frame interval */ { allocateOk = 1; for (frameIndex = frameIntervalIndex; frameIndex < USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE; frameIndex += frameInterval) /* check all the frames */ { /* compute start-split and complete-split number */ - SsCsNumber = (uint8_t)((ehciPipePointer->pipeCommon.maxPacketSize + 187U) / - 188U); /* ss number for iso out; cs number for iso in */ + SsCsNumber = (ehciPipePointer->pipeCommon.maxPacketSize + 187) / + 188; /* ss number for iso out; cs number for iso in */ if (ehciPipePointer->pipeCommon.direction == USB_OUT) /* ISO OUT */ { - if (uframeIntervalIndex + SsCsNumber > 8U) + if (uframeIntervalIndex + SsCsNumber > 8) { - allocateOk = 0U; + allocateOk = 0; } } else { - if (uframeIntervalIndex + 2U + SsCsNumber > - 8U) /* ISO IN: there are two micro-frame interval between start-split and complete-split */ + if (uframeIntervalIndex + 2 + SsCsNumber > + 8) /* ISO IN: there are two micro-frame interval between start-split and complete-split */ { - allocateOk = 0U; + allocateOk = 0; } } - if (0U != allocateOk) + if (allocateOk) { /* allocate start-split and complete-split bandwidth */ USB_HostBandwidthHsHostComputeCurrentHsAll(ehciInstance, frameIndex, frameTimes); @@ -1366,9 +1411,9 @@ static usb_status_t USB_HostBandwidthHsHostAllocateIso(usb_host_ehci_instance_t index = uframeIntervalIndex; for (; index < (uframeIntervalIndex + SsCsNumber); ++index) { - if (frameTimes[index] + timeStartSplit > s_SlotMaxBandwidthHs[index]) + if (frameTimes[index] + timeStartSplit > s_SlotMaxBandwidth[index]) { - allocateOk = 0U; + allocateOk = 0; break; } } @@ -1376,20 +1421,20 @@ static usb_status_t USB_HostBandwidthHsHostAllocateIso(usb_host_ehci_instance_t else /* ISO IN */ { index = uframeIntervalIndex; - if (frameTimes[index] + timeStartSplit > s_SlotMaxBandwidthHs[index]) + if (frameTimes[index] + timeStartSplit > s_SlotMaxBandwidth[index]) { - allocateOk = 0U; + allocateOk = 0; } - if (0U != allocateOk) + if (allocateOk) { index = uframeIntervalIndex + - 2U; /* there are two micro-frames interval between start-split and complete-split */ - for (; index < (uframeIntervalIndex + 2U + SsCsNumber); ++index) + 2; /* there are two micro-frames interval between start-split and complete-split */ + for (; index < (uframeIntervalIndex + 2 + SsCsNumber); ++index) { - if (frameTimes[index] + timeCompleteSplit > s_SlotMaxBandwidthHs[index]) + if (frameTimes[index] + timeCompleteSplit > s_SlotMaxBandwidth[index]) { - allocateOk = 0U; + allocateOk = 0; break; } } @@ -1398,18 +1443,18 @@ static usb_status_t USB_HostBandwidthHsHostAllocateIso(usb_host_ehci_instance_t } /* allocate data bandwidth */ - if (0U != allocateOk) + if (allocateOk) { USB_HostBandwidthHsHostComputeCurrentFsls(ehciInstance, hubNumber, frameIndex, frameTimes); - index = uframeIntervalIndex + 1U; /* timeData bandwidth start position */ + index = uframeIntervalIndex + 1; /* timeData bandwidth start position */ /* iso must occupy all the uframe bandwidth */ { deviceInfo = timeData; /* note: deviceInfo variable means bandwidth here */ - while ((index < 8U) && (deviceInfo > s_SlotMaxBandwidth[index])) + while ((index < 8) && (deviceInfo > s_SlotMaxBandwidth[index])) { - if (frameTimes[index] > 0U) + if (frameTimes[index] > 0) { - allocateOk = 0U; + allocateOk = 0; break; } else @@ -1420,16 +1465,16 @@ static usb_status_t USB_HostBandwidthHsHostAllocateIso(usb_host_ehci_instance_t } } } - if (0U != allocateOk) + if (allocateOk) { /* data bandwidth can be put in the frame? */ - index = uframeIntervalIndex + 1U; /* timeData bandwidth start position */ - frameTimes[index] += (uint16_t)timeData; - for (; index < 7U; ++index) + index = uframeIntervalIndex + 1; /* timeData bandwidth start position */ + frameTimes[index] += timeData; + for (; index < 7; ++index) { if (frameTimes[index] > s_SlotMaxBandwidth[index]) { - frameTimes[index + 1U] += (frameTimes[index] - s_SlotMaxBandwidth[index]); + frameTimes[index + 1] += (frameTimes[index] - s_SlotMaxBandwidth[index]); frameTimes[index] = s_SlotMaxBandwidth[index]; } else @@ -1443,45 +1488,45 @@ static usb_status_t USB_HostBandwidthHsHostAllocateIso(usb_host_ehci_instance_t } } - if (0U != allocateOk) + if (allocateOk) { break; } } - if (0U != allocateOk) + if (allocateOk) { break; } } - if (0U != allocateOk) + if (allocateOk) { break; } } - if (0U != allocateOk) + if (allocateOk) { - ehciPipePointer->startFrame = frameIntervalIndex; - ehciPipePointer->startUframe = (uint8_t)uframeIntervalIndex; - ehciPipePointer->dataTime = (uint16_t)timeData; - ehciPipePointer->startSplitTime = timeStartSplit; + ehciPipePointer->startFrame = frameIntervalIndex; + ehciPipePointer->startUframe = uframeIntervalIndex; + ehciPipePointer->dataTime = timeData; + ehciPipePointer->startSplitTime = timeStartSplit; ehciPipePointer->completeSplitTime = timeCompleteSplit; if (ehciPipePointer->pipeCommon.direction == USB_OUT) { index = uframeIntervalIndex; for (; index < (uframeIntervalIndex + SsCsNumber); ++index) { - ehciPipePointer->uframeSmask = ehciPipePointer->uframeSmask | (uint8_t)(0x01UL << index); + ehciPipePointer->uframeSmask = (uint32_t)ehciPipePointer->uframeSmask | (uint32_t)(0x01 << index); } } else { - index = uframeIntervalIndex; - ehciPipePointer->uframeSmask = ehciPipePointer->uframeSmask | (uint8_t)(0x01UL << index); - index = uframeIntervalIndex + 2U; - for (; index < (uframeIntervalIndex + 2U + SsCsNumber); ++index) + index = uframeIntervalIndex; + ehciPipePointer->uframeSmask = (uint32_t)ehciPipePointer->uframeSmask | (uint32_t)(0x01 << index); + index = uframeIntervalIndex + 2; + for (; index < (uframeIntervalIndex + 2 + SsCsNumber); ++index) { - ehciPipePointer->uframeCmask = ehciPipePointer->uframeCmask | (uint8_t)(0x01UL << index); + ehciPipePointer->uframeCmask = (uint32_t)ehciPipePointer->uframeCmask | (uint32_t)(0x01 << index); } } @@ -1498,100 +1543,92 @@ static usb_status_t USB_HostBandwidthHsHostAllocateInterrupt(usb_host_ehci_insta usb_host_ehci_pipe_t *ehciPipePointer) { usb_status_t status; - uint32_t deviceInfo = 0; - uint32_t hubNumber = 0; + uint32_t deviceInfo; + uint32_t hubNumber; uint16_t uframeIntervalIndex = 0; - uint16_t frameIntervalIndex = 0; + uint16_t frameIntervalIndex = 0; uint16_t frameIndex; uint16_t timeCompleteSplit; uint16_t timeStartSplit; uint32_t timeData; uint8_t SsCsNumber; uint16_t frameInterval; - uint16_t frameTimes[8]; + uint8_t frameTimes[8]; uint8_t allocateOk = 1; uint8_t index; - for (uint8_t i = 0; i < 8U; ++i) - { - frameTimes[i] = 0U; - } - (void)USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, - (uint32_t)kUSB_HostGetDeviceSpeed, &deviceInfo); + USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, kUSB_HostGetDeviceSpeed, + &deviceInfo); timeData = USB_HostBandwidthComputeTime( - (uint8_t)deviceInfo, USB_ENDPOINT_INTERRUPT, ehciPipePointer->pipeCommon.direction, - (uint32_t)ehciPipePointer->pipeCommon.maxPacketSize * ehciPipePointer->pipeCommon.numberPerUframe); + deviceInfo, USB_ENDPOINT_INTERRUPT, ehciPipePointer->pipeCommon.direction, + ehciPipePointer->pipeCommon.maxPacketSize * ehciPipePointer->pipeCommon.numberPerUframe); /* pipe is high-speed */ if (deviceInfo == USB_SPEED_HIGH) { uframeIntervalIndex = 0; - status = USB_HostBandwidthHsHostAllocateHsCommon(ehciInstance, ehciPipePointer->uframeInterval, - (uint16_t)timeData, &uframeIntervalIndex); + status = USB_HostBandwidthHsHostAllocateHsCommon(ehciInstance, ehciPipePointer->uframeInterval, timeData, + &uframeIntervalIndex); if (status == kStatus_USB_Success) { - ehciPipePointer->startFrame = (uframeIntervalIndex / 8U); - ehciPipePointer->startUframe = (uint8_t)(uframeIntervalIndex & 0x0007U); + ehciPipePointer->startFrame = (uframeIntervalIndex / 8); + ehciPipePointer->startUframe = (uframeIntervalIndex & 0x0007); /* for HS interrupt start transaction position */ - if (ehciPipePointer->uframeInterval >= 8U) + if (ehciPipePointer->uframeInterval >= 8) { - ehciPipePointer->uframeSmask = (0x01U << ehciPipePointer->startUframe); + ehciPipePointer->uframeSmask = (0x01 << ehciPipePointer->startUframe); } else { - ehciPipePointer->uframeSmask = 0x00U; - for (index = ehciPipePointer->startUframe; index < 8U; - index += (uint8_t)ehciPipePointer->uframeInterval) + ehciPipePointer->uframeSmask = 0x00u; + for (index = ehciPipePointer->startUframe; index < 8; index += ehciPipePointer->uframeInterval) { ehciPipePointer->uframeSmask |= (0x01U << index); } } - ehciPipePointer->dataTime = (uint16_t)timeData; + ehciPipePointer->dataTime = timeData; return kStatus_USB_Success; } } else /* pipe is full-speed or low-speed */ { - (void)USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, - (uint32_t)kUSB_HostGetHubThinkTime, &deviceInfo); - timeData += (deviceInfo * 7U / (6U * 12U)); - (void)USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, - (uint32_t)kUSB_HostGetDeviceHSHubNumber, &hubNumber); + USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, kUSB_HostGetHubThinkTime, + &deviceInfo); + timeData += (deviceInfo * 7 / (6 * 12)); + USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, kUSB_HostGetDeviceHSHubNumber, + &hubNumber); frameInterval = ehciPipePointer->pipeCommon.interval; - SsCsNumber = 3U; /* complete split number */ + SsCsNumber = 3; /* complete split number */ /* compute start-split and complete-split bandwidth */ if (ehciPipePointer->pipeCommon.direction == USB_OUT) { - timeStartSplit = (uint16_t)USB_HostBandwidthComputeTime(USB_SPEED_HIGH, USB_ENDPOINT_INTERRUPT, USB_OUT, - ehciPipePointer->pipeCommon.maxPacketSize); - timeStartSplit += - (uint16_t)USB_HostBandwidthComputeTime(USB_SPEED_HIGH, USB_ENDPOINT_INTERRUPT, USB_OUT, 1U); - timeCompleteSplit = - (uint16_t)USB_HostBandwidthComputeTime(USB_SPEED_HIGH, USB_ENDPOINT_INTERRUPT, USB_OUT, 0U); + timeStartSplit = USB_HostBandwidthComputeTime(USB_SPEED_HIGH, USB_ENDPOINT_INTERRUPT, USB_OUT, + ehciPipePointer->pipeCommon.maxPacketSize) + + USB_HostBandwidthComputeTime(USB_SPEED_HIGH, USB_ENDPOINT_INTERRUPT, USB_OUT, 1); + timeCompleteSplit = USB_HostBandwidthComputeTime(USB_SPEED_HIGH, USB_ENDPOINT_INTERRUPT, USB_OUT, 0); } else { - timeStartSplit = (uint16_t)USB_HostBandwidthComputeTime(USB_SPEED_HIGH, USB_ENDPOINT_INTERRUPT, USB_IN, 1U); - timeCompleteSplit = (uint16_t)USB_HostBandwidthComputeTime(USB_SPEED_HIGH, USB_ENDPOINT_INTERRUPT, USB_IN, - ehciPipePointer->pipeCommon.maxPacketSize); - timeCompleteSplit += - (uint16_t)USB_HostBandwidthComputeTime(USB_SPEED_HIGH, USB_ENDPOINT_INTERRUPT, USB_IN, 0U); + timeStartSplit = USB_HostBandwidthComputeTime(USB_SPEED_HIGH, USB_ENDPOINT_INTERRUPT, USB_IN, 1); + timeCompleteSplit = USB_HostBandwidthComputeTime(USB_SPEED_HIGH, USB_ENDPOINT_INTERRUPT, USB_IN, + ehciPipePointer->pipeCommon.maxPacketSize) + + USB_HostBandwidthComputeTime(USB_SPEED_HIGH, USB_ENDPOINT_INTERRUPT, USB_IN, 0); } /* note: bandwidth must put in one frame */ - for (uframeIntervalIndex = 0U; uframeIntervalIndex <= 4U; ++uframeIntervalIndex) /* uframe interval */ + for (uframeIntervalIndex = 0; uframeIntervalIndex <= 4; ++uframeIntervalIndex) /* uframe interval */ { - for (frameIntervalIndex = 0U; frameIntervalIndex < frameInterval; ++frameIntervalIndex) /* frame interval */ + for (frameIntervalIndex = 0; frameIntervalIndex < frameInterval; ++frameIntervalIndex) /* frame interval */ { - allocateOk = 1U; + allocateOk = 1; for (frameIndex = frameIntervalIndex; frameIndex < USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE; frameIndex += frameInterval) /* check all the frames */ { /* allocate data bandwidth */ USB_HostBandwidthHsHostComputeCurrentFsls(ehciInstance, hubNumber, frameIndex, frameTimes); - index = (uint8_t)(uframeIntervalIndex + 1U); - for (; index <= (uframeIntervalIndex + 3U); ++index) /* data bandwidth number is 3. + index = uframeIntervalIndex + 1; + for (; index <= (uframeIntervalIndex + 3); ++index) /* data bandwidth number is 3. uframeIntervalIndex don't exceed 4, so index cannot exceed 7 */ { @@ -1602,61 +1639,60 @@ static usb_status_t USB_HostBandwidthHsHostAllocateInterrupt(usb_host_ehci_insta } } - if (0U != allocateOk) + if (allocateOk) { USB_HostBandwidthHsHostComputeCurrentHsAll(ehciInstance, frameIndex, frameTimes); /* allocate start_split bandwidth */ - if (frameTimes[uframeIntervalIndex] + timeStartSplit > - s_SlotMaxBandwidthHs[uframeIntervalIndex]) + if (frameTimes[uframeIntervalIndex] + timeStartSplit > s_SlotMaxBandwidth[uframeIntervalIndex]) { - allocateOk = 0U; + allocateOk = 0; } - if (0U != allocateOk) + if (allocateOk) { /* allocate complete_split bandwidth */ - index = (uint8_t)uframeIntervalIndex + 2U; + index = uframeIntervalIndex + 2; /* complete-split number is normal 3. When uframeIntervalIndex is 4, complete-split number * is 2. */ - for (; (index <= (uframeIntervalIndex + 1U + SsCsNumber)) && (index < 8U); ++index) + for (; (index <= (uframeIntervalIndex + 1 + SsCsNumber)) && (index < 8); ++index) { - if (frameTimes[index] + timeCompleteSplit > s_SlotMaxBandwidthHs[index]) + if (frameTimes[index] + timeCompleteSplit > s_SlotMaxBandwidth[index]) { - allocateOk = 0U; + allocateOk = 0; break; } } } } - if (0U == allocateOk) + if (!allocateOk) { break; /* allocate fail */ } } - if (0U != allocateOk) + if (allocateOk) { break; } } - if (0U != allocateOk) + if (allocateOk) { break; } } - if (0U != allocateOk) + if (allocateOk) { - ehciPipePointer->startFrame = frameIntervalIndex; - ehciPipePointer->startUframe = (uint8_t)uframeIntervalIndex; - ehciPipePointer->uframeSmask = (0x01u << ehciPipePointer->startUframe); - ehciPipePointer->uframeCmask = 0u; - index = (uint8_t)uframeIntervalIndex + 2u; - for (; (index <= (uframeIntervalIndex + 1u + SsCsNumber)) && (index < 8u); ++index) + ehciPipePointer->startFrame = frameIntervalIndex; + ehciPipePointer->startUframe = uframeIntervalIndex; + ehciPipePointer->uframeSmask = (0x01 << ehciPipePointer->startUframe); + ehciPipePointer->uframeCmask = 0; + index = uframeIntervalIndex + 2; + for (; (index <= (uframeIntervalIndex + 1 + SsCsNumber)) && (index < 8); ++index) { - ehciPipePointer->uframeCmask = ehciPipePointer->uframeCmask | (0x01U << index); + ehciPipePointer->uframeCmask = (uint32_t)ehciPipePointer->uframeCmask | (uint32_t)(0x01 << index); } - ehciPipePointer->dataTime = (uint16_t)timeData; - ehciPipePointer->startSplitTime = timeStartSplit; + ehciPipePointer->dataTime = timeData; + ehciPipePointer->startSplitTime = timeStartSplit; ehciPipePointer->completeSplitTime = timeCompleteSplit; return kStatus_USB_Success; @@ -1670,18 +1706,17 @@ static usb_status_t USB_HostBandwidthFslsHostAllocate(usb_host_ehci_instance_t * usb_host_ehci_pipe_t *ehciPipePointer) { uint32_t FslsTime = 0; - uint32_t speed = 0; + uint32_t speed = 0; uint16_t uframeIntervalIndex; uint16_t frameIndex; uint16_t frameInterval; uint16_t frameTime; - (void)USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, - (uint32_t)kUSB_HostGetHubThinkTime, &FslsTime); - FslsTime += (FslsTime * 7U / (6U * 12U)); - (void)USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, - (uint32_t)kUSB_HostGetDeviceSpeed, &speed); - FslsTime = FslsTime + USB_HostBandwidthComputeTime((uint8_t)speed, ehciPipePointer->pipeCommon.pipeType, + USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, kUSB_HostGetHubThinkTime, + &FslsTime); + FslsTime += (FslsTime * 7 / (6 * 12)); + USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, kUSB_HostGetDeviceSpeed, &speed); + FslsTime = FslsTime + USB_HostBandwidthComputeTime(speed, ehciPipePointer->pipeCommon.pipeType, ehciPipePointer->pipeCommon.direction, ehciPipePointer->pipeCommon.maxPacketSize); @@ -1705,11 +1740,11 @@ static usb_status_t USB_HostBandwidthFslsHostAllocate(usb_host_ehci_instance_t * } if (uframeIntervalIndex < ehciPipePointer->uframeInterval) { - ehciPipePointer->startFrame = (uframeIntervalIndex >> 3); - ehciPipePointer->startUframe = (uint8_t)(uframeIntervalIndex & 0x0007U); + ehciPipePointer->startFrame = (uframeIntervalIndex >> 3); + ehciPipePointer->startUframe = (uframeIntervalIndex & 0x0007); ehciPipePointer->uframeSmask = 0; /* useless */ ehciPipePointer->uframeCmask = 0; - ehciPipePointer->dataTime = (uint16_t)FslsTime; + ehciPipePointer->dataTime = FslsTime; return kStatus_USB_Success; } @@ -1719,46 +1754,46 @@ static usb_status_t USB_HostBandwidthFslsHostAllocate(usb_host_ehci_instance_t * static uint8_t USB_HostEhciGet2PowerValue(uint8_t value) { - if ((value == 0U) || (value == 1U)) + if ((value == 0) || (value == 1)) { return value; } - if (0U != (value & 0xf0U)) + if (value & 0xf0) { - if (0U != (value & 0x80U)) + if (value & 0x80) { - return 128U; + return 128; } - else if (0U != (value & 0x40U)) + else if (value & 0x40) { - return 64U; + return 64; } - else if (0U != (value & 0x20U)) + else if (value & 0x20) { - return 32U; + return 32; } else { - return 16U; + return 16; } } else { - if (0U != (value & 0x08U)) + if (value & 0x08) { - return 8U; + return 8; } - else if (0U != (value & 0x04U)) + else if (value & 0x04) { - return 4U; + return 4; } - else if (0U != (value & 0x02U)) + else if (value & 0x02) { - return 2U; + return 2; } else { - return 1U; + return 1; } } } @@ -1766,9 +1801,8 @@ static uint8_t USB_HostEhciGet2PowerValue(uint8_t value) static void USB_HostEhciZeroMem(uint32_t *buffer, uint32_t length) { /* note: the zero unit is uint32_t */ - while (0U != length) + while (length--) { - length--; *buffer = 0; buffer++; } @@ -1777,24 +1811,24 @@ static void USB_HostEhciZeroMem(uint32_t *buffer, uint32_t length) static void USB_HostEhciDelay(USBHS_Type *ehciIpBase, uint32_t ms) { /* note: the max delay time cannot exceed half of max value (0x4000) */ - uint32_t sofStart; - uint32_t SofEnd; + int32_t sofStart; + int32_t SofEnd; uint32_t distance; - sofStart = (ehciIpBase->FRINDEX & EHCI_MAX_UFRAME_VALUE); + sofStart = (int32_t)(ehciIpBase->FRINDEX & EHCI_MAX_UFRAME_VALUE); do { - SofEnd = (ehciIpBase->FRINDEX & EHCI_MAX_UFRAME_VALUE); - distance = (SofEnd + EHCI_MAX_UFRAME_VALUE + 1U - sofStart); - } while ((distance & EHCI_MAX_UFRAME_VALUE) < (ms * 8U)); /* compute the distance between sofStart and SofEnd */ + SofEnd = (int32_t)(ehciIpBase->FRINDEX & EHCI_MAX_UFRAME_VALUE); + distance = (uint32_t)(SofEnd - sofStart + EHCI_MAX_UFRAME_VALUE + 1); + } while ((distance & EHCI_MAX_UFRAME_VALUE) < (ms * 8)); /* compute the distance between sofStart and SofEnd */ } -void USB_HostEhciStartAsync(usb_host_ehci_instance_t *ehciInstance) +static void USB_HostEhciStartAsync(usb_host_ehci_instance_t *ehciInstance) { uint32_t stateSync; - if (0U == (ehciInstance->ehciIpBase->USBSTS & USBHS_USBSTS_AS_MASK)) + if (!(ehciInstance->ehciIpBase->USBSTS & USBHS_USBSTS_AS_MASK)) { /* the status must be same when change USBCMD->ASE */ do @@ -1805,7 +1839,7 @@ void USB_HostEhciStartAsync(usb_host_ehci_instance_t *ehciInstance) ehciInstance->ehciIpBase->ASYNCLISTADDR = (uint32_t)(ehciInstance->shedFirstQh); ehciInstance->ehciIpBase->USBCMD |= USBHS_USBCMD_ASE_MASK; - while (0U == (ehciInstance->ehciIpBase->USBSTS & USBHS_USBSTS_AS_MASK)) + while (!(ehciInstance->ehciIpBase->USBSTS & USBHS_USBSTS_AS_MASK)) { } } @@ -1823,16 +1857,16 @@ static void USB_HostEhciStopAsync(usb_host_ehci_instance_t *ehciInstance) } while ((stateSync == USBHS_USBSTS_AS_MASK) || (stateSync == USBHS_USBCMD_ASE_MASK)); ehciInstance->ehciIpBase->USBCMD &= (uint32_t)(~(uint32_t)USBHS_USBCMD_ASE_MASK); /* disable async schedule */ - while (0U != (ehciInstance->ehciIpBase->USBSTS & USBHS_USBSTS_AS_MASK)) + while (ehciInstance->ehciIpBase->USBSTS & USBHS_USBSTS_AS_MASK) { } } -void USB_HostEhciStartPeriodic(usb_host_ehci_instance_t *ehciInstance) +static void USB_HostEhciStartPeriodic(usb_host_ehci_instance_t *ehciInstance) { uint32_t stateSync; - if (0U == (ehciInstance->ehciIpBase->USBSTS & USBHS_USBSTS_PS_MASK)) + if (!(ehciInstance->ehciIpBase->USBSTS & USBHS_USBSTS_PS_MASK)) { /* the status must be same when change USBCMD->PSE */ do @@ -1841,11 +1875,11 @@ void USB_HostEhciStartPeriodic(usb_host_ehci_instance_t *ehciInstance) (ehciInstance->ehciIpBase->USBCMD & USBHS_USBCMD_PSE_MASK)); } while ((stateSync == USBHS_USBSTS_PS_MASK) || (stateSync == USBHS_USBCMD_PSE_MASK)); ehciInstance->ehciIpBase->PERIODICLISTBASE = (uint32_t)(ehciInstance->ehciFrameList); - if (0U == (ehciInstance->ehciIpBase->USBCMD & USBHS_USBCMD_PSE_MASK)) + if (!(ehciInstance->ehciIpBase->USBCMD & USBHS_USBCMD_PSE_MASK)) { ehciInstance->ehciIpBase->USBCMD |= USBHS_USBCMD_PSE_MASK; /* start periodic schedule */ } - while (0U == (ehciInstance->ehciIpBase->USBSTS & USBHS_USBSTS_PS_MASK)) + while (!(ehciInstance->ehciIpBase->USBSTS & USBHS_USBSTS_PS_MASK)) { } } @@ -1864,7 +1898,7 @@ static void USB_HostEhciStopPeriodic(usb_host_ehci_instance_t *ehciInstance) } while ((stateSync == USBHS_USBSTS_PS_MASK) || (stateSync == USBHS_USBCMD_PSE_MASK)); ehciInstance->ehciIpBase->USBCMD &= (~USBHS_USBCMD_PSE_MASK); /* stop periodic schedule */ - while (0U != (ehciInstance->ehciIpBase->USBSTS & USBHS_USBSTS_PS_MASK)) + while (ehciInstance->ehciIpBase->USBSTS & USBHS_USBSTS_PS_MASK) { } } @@ -1874,7 +1908,7 @@ static usb_status_t USB_HostEhciQhQtdListInit(usb_host_ehci_instance_t *ehciInst usb_host_transfer_t *transfer) { volatile usb_host_ehci_qh_t *vltQhPointer; - usb_host_ehci_qtd_t *qtdPointer = NULL; + usb_host_ehci_qtd_t *qtdPointer = NULL; usb_host_ehci_qtd_t *BaseQtdPointer = NULL; volatile uint32_t *entryPointer; uint32_t qtdNumber; @@ -1887,23 +1921,19 @@ static usb_status_t USB_HostEhciQhQtdListInit(usb_host_ehci_instance_t *ehciInst if (ehciPipePointer->pipeCommon.pipeType == USB_ENDPOINT_CONTROL) { /* assume setup data don't exceed one qtd data size, one qtd can transfer least 16k data */ - if (transfer->transferLength == 0U) + if (transfer->transferLength == 0) { - qtdNumber = 2U; + qtdNumber = 2; } else { - qtdNumber = 3U; + qtdNumber = 3; } } else { - qtdNumber = (((transfer->transferLength) & 0xFFFFC000U) >> 14U) + - (0U != ((transfer->transferLength) & 0x00003FFFU) ? 1U : 0U); - if (0U == qtdNumber) - { - qtdNumber = 1U; - } + qtdNumber = + (((transfer->transferLength) & 0xFFFFC000U) >> 14) + (((transfer->transferLength) & 0x00003FFF) ? 1 : 0); } vltQhPointer = (volatile usb_host_ehci_qh_t *)ehciPipePointer->ehciQh; @@ -1911,21 +1941,20 @@ static usb_status_t USB_HostEhciQhQtdListInit(usb_host_ehci_instance_t *ehciInst USB_HostEhciLock(); if (qtdNumber <= ehciInstance->ehciQtdNumber) { - ehciInstance->ehciQtdNumber -= (uint8_t)qtdNumber; + ehciInstance->ehciQtdNumber -= qtdNumber; BaseQtdPointer = ehciInstance->ehciQtdHead; - qtdPointer = NULL; + qtdPointer = NULL; do { if (qtdPointer != NULL) { qtdPointer->nextQtdPointer = (uint32_t)ehciInstance->ehciQtdHead; } - qtdPointer = ehciInstance->ehciQtdHead; - ehciInstance->ehciQtdHead = (usb_host_ehci_qtd_t *)qtdPointer->nextQtdPointer; + qtdPointer = ehciInstance->ehciQtdHead; + ehciInstance->ehciQtdHead = (usb_host_ehci_qtd_t *)qtdPointer->nextQtdPointer; qtdPointer->nextQtdPointer = 0; - --qtdNumber; - } while (0U != qtdNumber); - if (ehciInstance->ehciQtdNumber == 0U) + } while (--qtdNumber); + if (ehciInstance->ehciQtdNumber == 0) { ehciInstance->ehciQtdTail = NULL; } @@ -1941,34 +1970,34 @@ static usb_status_t USB_HostEhciQhQtdListInit(usb_host_ehci_instance_t *ehciInst if (ehciPipePointer->pipeCommon.pipeType == USB_ENDPOINT_CONTROL) { /* setup transaction qtd */ - qtdPointer = BaseQtdPointer; + qtdPointer = BaseQtdPointer; qtdPointer->alternateNextQtdPointer = EHCI_HOST_T_INVALID_VALUE; /* dt: need set; ioc: 0; C_Page: 0; PID Code: SETUP; Status: Active */ - qtdPointer->transferResults[1] = 0U; + qtdPointer->transferResults[0] = qtdPointer->transferResults[1] = 0; qtdPointer->transferResults[0] = - ((0x00000000UL << EHCI_HOST_QTD_DT_SHIFT) | (8UL << EHCI_HOST_QTD_TOTAL_BYTES_SHIFT) | + ((0x00000000 << EHCI_HOST_QTD_DT_SHIFT) | (8 << EHCI_HOST_QTD_TOTAL_BYTES_SHIFT) | (EHCI_HOST_PID_SETUP << EHCI_HOST_QTD_PID_CODE_SHIFT) | (EHCI_HOST_QTD_STATUS_ACTIVE_MASK)); - dataAddress = ((uint32_t)transfer->setupPacket); + dataAddress = ((uint32_t)transfer->setupPacket); qtdPointer->transferResults[1] = dataAddress; /* current offset is set too */ /* set buffer pointer no matter data length */ - for (index = 0; index < 4U; ++index) + for (index = 0; index < 4; ++index) { - qtdPointer->bufferPointers[index] = ((dataAddress + ((uint32_t)index + 1U) * 4U * 1024U) & 0xFFFFF000U); + qtdPointer->bufferPointers[index] = ((dataAddress + (index + 1) * 4 * 1024) & 0xFFFFF000U); } /* data transaction qtd */ dataLength = transfer->transferLength; - if (dataLength != 0U) + if (dataLength != 0) { qtdPointer = (usb_host_ehci_qtd_t *)(qtdPointer->nextQtdPointer); qtdPointer->alternateNextQtdPointer = EHCI_HOST_T_INVALID_VALUE; /* dt: need set; ioc: 0; C_Page: 0; PID Code: IN/OUT; Status: Active */ - qtdPointer->transferResults[1] = 0U; + qtdPointer->transferResults[0] = qtdPointer->transferResults[1] = 0; if (transfer->direction == USB_OUT) { qtdPointer->transferResults[0] = - ((0x00000001UL << EHCI_HOST_QTD_DT_SHIFT) | (dataLength << EHCI_HOST_QTD_TOTAL_BYTES_SHIFT) | + ((0x00000001U << EHCI_HOST_QTD_DT_SHIFT) | (dataLength << EHCI_HOST_QTD_TOTAL_BYTES_SHIFT) | (EHCI_HOST_PID_OUT << EHCI_HOST_QTD_PID_CODE_SHIFT) | (EHCI_HOST_QTD_STATUS_ACTIVE_MASK)); } else @@ -1978,24 +2007,24 @@ static usb_status_t USB_HostEhciQhQtdListInit(usb_host_ehci_instance_t *ehciInst (EHCI_HOST_PID_IN << EHCI_HOST_QTD_PID_CODE_SHIFT) | (EHCI_HOST_QTD_STATUS_ACTIVE_MASK)); } - dataAddress = (uint32_t)transfer->transferBuffer; + dataAddress = (uint32_t)transfer->transferBuffer; qtdPointer->transferResults[1] = dataAddress; /* current offset is set too */ /* set buffer pointer no matter data length */ - for (index = 0; index < 4U; ++index) + for (index = 0; index < 4; ++index) { - qtdPointer->bufferPointers[index] = ((dataAddress + ((uint32_t)index + 1U) * 4U * 1024U) & 0xFFFFF000U); + qtdPointer->bufferPointers[index] = ((dataAddress + (index + 1) * 4 * 1024) & 0xFFFFF000U); } } /* status transaction qtd */ - qtdPointer = (usb_host_ehci_qtd_t *)(qtdPointer->nextQtdPointer); + qtdPointer = (usb_host_ehci_qtd_t *)(qtdPointer->nextQtdPointer); qtdPointer->alternateNextQtdPointer = EHCI_HOST_T_INVALID_VALUE; /* dt: dont care; ioc: 1; C_Page: 0; PID Code: IN/OUT; Status: Active */ - qtdPointer->transferResults[1] = 0; - if ((dataLength == 0U) || (transfer->direction == USB_OUT)) + qtdPointer->transferResults[0] = qtdPointer->transferResults[1] = 0; + if ((dataLength == 0) || (transfer->direction == USB_OUT)) { qtdPointer->transferResults[0] = - ((0x00000001UL << EHCI_HOST_QTD_DT_SHIFT) | (EHCI_HOST_PID_IN << EHCI_HOST_QTD_PID_CODE_SHIFT) | + ((0x00000001U << EHCI_HOST_QTD_DT_SHIFT) | (EHCI_HOST_PID_IN << EHCI_HOST_QTD_PID_CODE_SHIFT) | (EHCI_HOST_QTD_IOC_MASK) | (EHCI_HOST_QTD_STATUS_ACTIVE_MASK)); } else @@ -2008,11 +2037,12 @@ static usb_status_t USB_HostEhciQhQtdListInit(usb_host_ehci_instance_t *ehciInst } else { + dataLength = transfer->transferLength; dataAddress = (uint32_t)transfer->transferBuffer; - qtdPointer = BaseQtdPointer; - while (1U == 1U) + qtdPointer = BaseQtdPointer; + while (1) { - endAddress = dataAddress + (16U * 1024U); + endAddress = dataAddress + (16 * 1024); if (endAddress > (uint32_t)(transfer->transferBuffer + transfer->transferLength)) { endAddress = (uint32_t)(transfer->transferBuffer + transfer->transferLength); @@ -2020,7 +2050,7 @@ static usb_status_t USB_HostEhciQhQtdListInit(usb_host_ehci_instance_t *ehciInst qtdPointer->alternateNextQtdPointer = EHCI_HOST_T_INVALID_VALUE; /* dt: set; ioc: 0; C_Page: 0; PID Code: IN/OUT; Status: Active */ - qtdPointer->transferResults[1] = 0U; + qtdPointer->transferResults[0] = qtdPointer->transferResults[1] = 0; if (transfer->direction == USB_OUT) { qtdPointer->transferResults[0] = @@ -2039,13 +2069,13 @@ static usb_status_t USB_HostEhciQhQtdListInit(usb_host_ehci_instance_t *ehciInst } qtdPointer->transferResults[1] = dataAddress; /* current offset is set too */ /* set buffer pointer no matter data length */ - for (index = 0; index < 4U; ++index) + for (index = 0; index < 4; ++index) { - qtdPointer->bufferPointers[index] = ((dataAddress + ((uint32_t)index + 1U) * 4U * 1024U) & 0xFFFFF000U); + qtdPointer->bufferPointers[index] = ((dataAddress + (index + 1) * 4 * 1024) & 0xFFFFF000U); } dataAddress = endAddress; /* for next qtd */ - if (qtdPointer->nextQtdPointer == 0U) + if (qtdPointer->nextQtdPointer == 0) { break; } @@ -2063,25 +2093,24 @@ static usb_status_t USB_HostEhciQhQtdListInit(usb_host_ehci_instance_t *ehciInst transfer->next = NULL; if (vltQhPointer->ehciTransferHead == NULL) { - transfer->next = NULL; - vltQhPointer->ehciTransferTail = transfer; - vltQhPointer->ehciTransferHead = transfer; + transfer->next = NULL; + vltQhPointer->ehciTransferHead = vltQhPointer->ehciTransferTail = transfer; } else { - transfer->next = NULL; + transfer->next = NULL; vltQhPointer->ehciTransferTail->next = transfer; - vltQhPointer->ehciTransferTail = transfer; + vltQhPointer->ehciTransferTail = transfer; } USB_HostEhciLock(); /* link qtd to qh (link to end) */ entryPointer = &(vltQhPointer->nextQtdPointer); - dataAddress = *entryPointer; /* dataAddress variable means entry value here */ - while ((0U != dataAddress) && (0U == (dataAddress & EHCI_HOST_T_INVALID_VALUE))) + dataAddress = *entryPointer; /* dataAddress variable means entry value here */ + while ((dataAddress) && (!(dataAddress & EHCI_HOST_T_INVALID_VALUE))) { entryPointer = (volatile uint32_t *)dataAddress; - dataAddress = *entryPointer; + dataAddress = *entryPointer; } *entryPointer = (uint32_t)BaseQtdPointer; USB_HostEhciUnlock(); @@ -2097,7 +2126,7 @@ static uint32_t USB_HostEhciQtdListRelease(usb_host_ehci_instance_t *ehciInstanc uint32_t length = 0; usb_host_ehci_qtd_t *qtdPointer; - ehciQtdEnd->nextQtdPointer = 0U; + ehciQtdEnd->nextQtdPointer = 0; /* compute remaining length */ qtdPointer = ehciQtdStart; @@ -2112,7 +2141,7 @@ static uint32_t USB_HostEhciQtdListRelease(usb_host_ehci_instance_t *ehciInstanc /* put releasing qtd to idle qtd list */ USB_HostEhciLock(); - if (ehciInstance->ehciQtdNumber == 0U) + if (ehciInstance->ehciQtdNumber == 0) { ehciInstance->ehciQtdHead = ehciQtdStart; ehciInstance->ehciQtdTail = ehciQtdEnd; @@ -2120,7 +2149,7 @@ static uint32_t USB_HostEhciQtdListRelease(usb_host_ehci_instance_t *ehciInstanc else { ehciInstance->ehciQtdTail->nextQtdPointer = (uint32_t)ehciQtdStart; - ehciInstance->ehciQtdTail = ehciQtdEnd; + ehciInstance->ehciQtdTail = ehciQtdEnd; } while (ehciQtdStart != ehciQtdEnd) @@ -2140,41 +2169,37 @@ static usb_status_t USB_HostEhciQhQtdListDeinit(usb_host_ehci_instance_t *ehciIn volatile usb_host_ehci_qh_t *vltQhPointer; usb_host_transfer_t *transfer; usb_host_transfer_t *nextTransfer; - uint32_t currentQtdPointer; - uint8_t needStop = 0U; + uint8_t needStop = 0; vltQhPointer = (volatile usb_host_ehci_qh_t *)ehciPipePointer->ehciQh; USB_HostEhciLock(); /* this API is called from APP, the host task may occupy to access the same resource */ /* remove qtd from qh */ - /*for misra 13.5*/ - currentQtdPointer = vltQhPointer->currentQtdPointer; - if ((0U == ((uint32_t)vltQhPointer->nextQtdPointer & EHCI_HOST_T_INVALID_VALUE)) || - (0U == ((uint32_t)currentQtdPointer & EHCI_HOST_T_INVALID_VALUE))) + if ((!((uint32_t)vltQhPointer->nextQtdPointer & EHCI_HOST_T_INVALID_VALUE)) || + (!((uint32_t)vltQhPointer->currentQtdPointer & EHCI_HOST_T_INVALID_VALUE))) { /* need stop async schedule */ - if ((0U == (vltQhPointer->horizontalLinkPointer & EHCI_HOST_T_INVALID_VALUE)) && + if ((!(vltQhPointer->horizontalLinkPointer & EHCI_HOST_T_INVALID_VALUE)) && (ehciPipePointer->pipeCommon.pipeType != USB_ENDPOINT_INTERRUPT)) { - needStop = 1U; + needStop = 1; } - if (0U != needStop) + if (needStop) { USB_HostEhciStopAsync(ehciInstance); } vltQhPointer->currentQtdPointer = EHCI_HOST_T_INVALID_VALUE; /* invalid current qtd */ - vltQhPointer->nextQtdPointer = EHCI_HOST_T_INVALID_VALUE; /* invalid next qtd */ + vltQhPointer->nextQtdPointer = EHCI_HOST_T_INVALID_VALUE; /* invalid next qtd */ vltQhPointer->transferOverlayResults[0] &= (~EHCI_HOST_QTD_STATUS_MASK); /* clear error status */ - if (0U != needStop) + if (needStop) { USB_HostEhciStartAsync(ehciInstance); } } /* remove transfer from the QH transfer list */ - transfer = vltQhPointer->ehciTransferHead; - vltQhPointer->ehciTransferTail = NULL; - vltQhPointer->ehciTransferHead = NULL; + transfer = vltQhPointer->ehciTransferHead; + vltQhPointer->ehciTransferHead = vltQhPointer->ehciTransferTail = NULL; USB_HostEhciUnlock(); /* release qtd and transfer callback*/ @@ -2185,9 +2210,8 @@ static usb_status_t USB_HostEhciQhQtdListDeinit(usb_host_ehci_instance_t *ehciIn USB_HostEhciQtdListRelease(ehciInstance, (usb_host_ehci_qtd_t *)(transfer->union1.unitHead), (usb_host_ehci_qtd_t *)(transfer->union2.unitTail)); transfer->transferSofar = (transfer->transferLength < transfer->transferSofar) ? - 0U : + 0 : (transfer->transferLength - transfer->transferSofar); - /* callback function is different from the current condition */ transfer->callbackFn(transfer->callbackParam, transfer, kStatus_USB_TransferCancel); transfer = nextTransfer; } @@ -2209,14 +2233,13 @@ static usb_status_t USB_HostEhciTransferQtdListDeinit(usb_host_ehci_instance_t * USB_HostEhciLock(); /* this API is called from APP, the host task may occupy to access the same resource */ /* remove qtd from qh */ - qhNextQtdValue = (uint32_t)vltQhPointer->currentQtdPointer; + qhNextQtdValue = (uint32_t)vltQhPointer->currentQtdPointer; qtdPointerEntry = *((uint32_t *)qhNextQtdValue + 2); /* note: qtdPointerEntry means qtd status */ - if ((0U != (qhNextQtdValue & EHCI_HOST_T_INVALID_VALUE)) || - (0U == (qtdPointerEntry & EHCI_HOST_QTD_STATUS_ACTIVE_MASK))) + if ((qhNextQtdValue & EHCI_HOST_T_INVALID_VALUE) || (!(qtdPointerEntry & EHCI_HOST_QTD_STATUS_ACTIVE_MASK))) { qhNextQtdValue = (uint32_t)vltQhPointer->nextQtdPointer; } - if (0U == (qhNextQtdValue & EHCI_HOST_T_INVALID_VALUE)) /* there is pending qtd in the qh */ + if (!(qhNextQtdValue & EHCI_HOST_T_INVALID_VALUE)) /* there is pending qtd in the qh */ { /* this qh don't schedule temporarily */ if (ehciPipePointer->pipeCommon.pipeType != USB_ENDPOINT_INTERRUPT) @@ -2232,11 +2255,11 @@ static usb_status_t USB_HostEhciTransferQtdListDeinit(usb_host_ehci_instance_t * /* remove qtd from qh one by one */ qtdPointerEntry = transfer->union1.unitHead; - while (1U == 1U) + while (1) { /* search qh's qtd list for qtdPointerEntry */ searchQtdEntryPointer = &qhNextQtdValue; - while (0U == ((*searchQtdEntryPointer) & EHCI_HOST_T_INVALID_VALUE)) + while (!((*searchQtdEntryPointer) & EHCI_HOST_T_INVALID_VALUE)) { if ((*searchQtdEntryPointer) == qtdPointerEntry) { @@ -2283,15 +2306,13 @@ static usb_status_t USB_HostEhciTransferQtdListDeinit(usb_host_ehci_instance_t * transfer->transferSofar = USB_HostEhciQtdListRelease(ehciInstance, (usb_host_ehci_qtd_t *)(transfer->union1.unitHead), (usb_host_ehci_qtd_t *)(transfer->union2.unitTail)); - transfer->transferSofar = (transfer->transferLength < transfer->transferSofar) ? - 0U : - (transfer->transferLength - transfer->transferSofar); - /* callback function is different from the current condition */ + transfer->transferSofar = + (transfer->transferLength < transfer->transferSofar) ? 0 : (transfer->transferLength - transfer->transferSofar); transfer->callbackFn(transfer->callbackParam, transfer, kStatus_USB_TransferCancel); /* start this qh schedule */ vltQhPointer->transferOverlayResults[0] &= (~EHCI_HOST_QTD_STATUS_MASK); /* clear error status */ - if ((qhNextQtdValue != 0U) && (0U == (qhNextQtdValue & EHCI_HOST_T_INVALID_VALUE))) + if ((qhNextQtdValue != 0) && (!(qhNextQtdValue & EHCI_HOST_T_INVALID_VALUE))) { vltQhPointer->nextQtdPointer = qhNextQtdValue; } @@ -2302,14 +2323,9 @@ static usb_status_t USB_HostEhciTransferQtdListDeinit(usb_host_ehci_instance_t * static usb_status_t USB_HostEhciQhInit(usb_host_ehci_instance_t *ehciInstance, usb_host_ehci_pipe_t *ehciPipePointer) { usb_host_ehci_qh_t *qhPointer = NULL; - uint32_t address = 0; - uint32_t speed = 0; - uint32_t portNumber = 0; - uint32_t hubNumber = 0; - ; - uint32_t controlBits1 = 0U; - uint32_t controlBits2 = 0U; - + uint32_t address, speed, portNumber, hubNumber; + uint32_t controlBits1 = 0; + uint32_t controlBits2 = 0; /* get qh */ USB_HostEhciLock(); if (ehciInstance->ehciQhList != NULL) @@ -2329,27 +2345,26 @@ static usb_status_t USB_HostEhciQhInit(usb_host_ehci_instance_t *ehciInstance, u ehciPipePointer->ehciQh = (void *)qhPointer; /* initialize qh */ - USB_HostEhciZeroMem((void *)qhPointer, sizeof(usb_host_ehci_qh_t) / 4U); - qhPointer->horizontalLinkPointer = EHCI_HOST_T_INVALID_VALUE; - qhPointer->currentQtdPointer = EHCI_HOST_T_INVALID_VALUE; - qhPointer->nextQtdPointer = EHCI_HOST_T_INVALID_VALUE; + USB_HostEhciZeroMem((uint32_t *)qhPointer, sizeof(usb_host_ehci_qh_t) / 4); + qhPointer->horizontalLinkPointer = EHCI_HOST_T_INVALID_VALUE; + qhPointer->currentQtdPointer = EHCI_HOST_T_INVALID_VALUE; + qhPointer->nextQtdPointer = EHCI_HOST_T_INVALID_VALUE; qhPointer->alternateNextQtdPointer = EHCI_HOST_T_INVALID_VALUE; - qhPointer->ehciPipePointer = ehciPipePointer; - qhPointer->timeOutLabel = 0; - qhPointer->timeOutValue = USB_HOST_EHCI_CONTROL_BULK_TIME_OUT_VALUE; - (void)USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, - (uint32_t)kUSB_HostGetDeviceSpeed, &speed); + qhPointer->ehciPipePointer = ehciPipePointer; + qhPointer->timeOutLabel = 0; + qhPointer->timeOutValue = USB_HOST_EHCI_CONTROL_BULK_TIME_OUT_VALUE; + USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, kUSB_HostGetDeviceSpeed, &speed); /* initialize staticEndpointStates[0] */ if (ehciPipePointer->pipeCommon.pipeType == USB_ENDPOINT_INTERRUPT) { /* Software should set the RL field to zero if the queue head is an interrupt endpoint. */ - controlBits1 |= ((0UL << EHCI_HOST_QH_RL_SHIFT) & EHCI_HOST_QH_RL_MASK); + controlBits1 |= ((0U << EHCI_HOST_QH_RL_SHIFT) & EHCI_HOST_QH_RL_MASK); } else { - if (ehciPipePointer->pipeCommon.nakCount >= 16U) + if (ehciPipePointer->pipeCommon.nakCount >= 16) { - controlBits1 |= ((15UL << EHCI_HOST_QH_RL_SHIFT) & EHCI_HOST_QH_RL_MASK); + controlBits1 |= ((15U << EHCI_HOST_QH_RL_SHIFT) & EHCI_HOST_QH_RL_MASK); } else { @@ -2361,15 +2376,15 @@ static usb_status_t USB_HostEhciQhInit(usb_host_ehci_instance_t *ehciInstance, u { if (speed != USB_SPEED_HIGH) { - controlBits1 |= (1UL << EHCI_HOST_QH_C_SHIFT); + controlBits1 |= (1 << EHCI_HOST_QH_C_SHIFT); } - controlBits1 |= (1UL << EHCI_HOST_QH_DTC_SHIFT); + controlBits1 |= (1 << EHCI_HOST_QH_DTC_SHIFT); } controlBits1 |= ((uint32_t)ehciPipePointer->pipeCommon.maxPacketSize << EHCI_HOST_QH_MAX_PACKET_LENGTH_SHIFT); controlBits1 |= (speed << EHCI_HOST_QH_EPS_SHIFT); controlBits1 |= ((uint32_t)ehciPipePointer->pipeCommon.endpointAddress << EHCI_HOST_QH_ENDPT_SHIFT); - (void)USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, - (uint32_t)kUSB_HostGetDeviceAddress, &address); + USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, kUSB_HostGetDeviceAddress, + &address); controlBits1 |= (address << EHCI_HOST_QH_DEVICE_ADDRESS_SHIFT); qhPointer->staticEndpointStates[0] = controlBits1; if (speed == USB_SPEED_HIGH) @@ -2378,22 +2393,22 @@ static usb_status_t USB_HostEhciQhInit(usb_host_ehci_instance_t *ehciInstance, u } else { - controlBits2 |= (0x00000001UL << EHCI_HOST_QH_MULT_SHIFT); + controlBits2 |= (0x00000001U << EHCI_HOST_QH_MULT_SHIFT); } /*initialize staticEndpointStates[1] */ if (speed != USB_SPEED_HIGH) { - (void)USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, - (uint32_t)kUSB_HostGetDeviceHSHubNumber, &hubNumber); - (void)USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, - (uint32_t)kUSB_HostGetDeviceHSHubPort, &portNumber); + USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, kUSB_HostGetDeviceHSHubNumber, + &hubNumber); + USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, kUSB_HostGetDeviceHSHubPort, + &portNumber); } else { - (void)USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, - (uint32_t)kUSB_HostGetDeviceHubNumber, &hubNumber); - (void)USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, - (uint32_t)kUSB_HostGetDevicePortNumber, &portNumber); + USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, kUSB_HostGetDeviceHubNumber, + &hubNumber); + USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, kUSB_HostGetDevicePortNumber, + &portNumber); } controlBits2 |= (portNumber << EHCI_HOST_QH_PORT_NUMBER_SHIFT); controlBits2 |= (hubNumber << EHCI_HOST_QH_HUB_ADDR_SHIFT); @@ -2410,12 +2425,12 @@ static usb_status_t USB_HostEhciQhDeinit(usb_host_ehci_instance_t *ehciInstance, qhPointer = (usb_host_ehci_qh_t *)ehciPipePointer->ehciQh; /* de-initialize qtd from qh */ - (void)USB_HostEhciQhQtdListDeinit(ehciInstance, ehciPipePointer); + USB_HostEhciQhQtdListDeinit(ehciInstance, ehciPipePointer); /* release QH */ USB_HostEhciLock(); qhPointer->horizontalLinkPointer = (uint32_t)ehciInstance->ehciQhList; - ehciInstance->ehciQhList = qhPointer; + ehciInstance->ehciQhList = qhPointer; USB_HostEhciUnlock(); return kStatus_USB_Success; @@ -2428,19 +2443,17 @@ static void USB_HostEhciAddQhToFrame(usb_host_ehci_instance_t *ehciInstance, { volatile uint32_t *frameEntryPointer; uint32_t frameEntryValue; - void *temp; /* search for the inserting point by interval */ - temp = (void *)ehciInstance->ehciFrameList; - frameEntryPointer = (volatile uint32_t *)(&((uint32_t *)temp)[framePos]); - while (NULL != frameEntryPointer) + frameEntryPointer = (volatile uint32_t *)(&((uint32_t *)ehciInstance->ehciFrameList)[framePos]); + while (frameEntryPointer) { frameEntryValue = *frameEntryPointer; - if (0U != (frameEntryValue & EHCI_HOST_T_INVALID_VALUE)) + if (frameEntryValue & EHCI_HOST_T_INVALID_VALUE) { /* insert into the end */ *((uint32_t *)entryPointerValue) = EHCI_HOST_T_INVALID_VALUE; - *frameEntryPointer = (entryPointerValue | EHCI_HOST_POINTER_TYPE_QH); + *frameEntryPointer = (entryPointerValue | EHCI_HOST_POINTER_TYPE_QH); break; } @@ -2454,7 +2467,7 @@ static void USB_HostEhciAddQhToFrame(usb_host_ehci_instance_t *ehciInstance, { /* insert into this point */ *((uint32_t *)entryPointerValue) = frameEntryValue; - *frameEntryPointer = (entryPointerValue | EHCI_HOST_POINTER_TYPE_QH); + *frameEntryPointer = (entryPointerValue | EHCI_HOST_POINTER_TYPE_QH); return; } else @@ -2470,15 +2483,14 @@ static void USB_HostEhciRemoveFromFrame(usb_host_ehci_instance_t *ehciInstance, { volatile uint32_t *frameEntryPointer; uint32_t frameEntryValue; - void *temp; - /* search for the qh/itd/sitd entry */ - temp = (void *)ehciInstance->ehciFrameList; - frameEntryPointer = (volatile uint32_t *)(&((uint32_t *)temp)[framePos]); - while (NULL != frameEntryPointer) + /* search for the qh/itd/sitd entry */ + frameEntryPointer = (volatile uint32_t *)(&((uint32_t *)ehciInstance->ehciFrameList)[framePos]); + + while (frameEntryPointer) { frameEntryValue = *frameEntryPointer; - if (0U != (frameEntryValue & EHCI_HOST_T_INVALID_VALUE)) + if (frameEntryValue & EHCI_HOST_T_INVALID_VALUE) { return; } @@ -2505,71 +2517,53 @@ static void USB_HostEhciLinkSitd(usb_host_ehci_instance_t *ehciInstance, usb_host_ehci_sitd_t *sitdPointer; uint32_t distance; uint32_t frameInterval; - uint32_t shouldLinkFrame; - uint32_t currentFrame; - void *temp; + int32_t shouldLinkFrame; + int32_t currentFrame; - frameInterval = ((uint32_t)ehciPipePointer->uframeInterval >> 3U); + frameInterval = (ehciPipePointer->uframeInterval >> 3); - if (isoPointer->lastLinkFrame == 0xFFFFU) /* first link */ + if (isoPointer->lastLinkFrame == 0xFFFF) /* first link */ { - currentFrame = ((ehciInstance->ehciIpBase->FRINDEX & USB_HOST_EHCI_MAX_MICRFRAME_VALUE) >> 3U); + currentFrame = ((ehciInstance->ehciIpBase->FRINDEX & EHCI_MAX_UFRAME_VALUE) >> 3); currentFrame = ((uint32_t)(currentFrame + USB_HOST_EHCI_ISO_BOUNCE_FRAME_NUMBER) & - (USB_HOST_EHCI_MAX_MICRFRAME_VALUE >> 3U)); /* add USB_HOST_EHCI_ISO_BOUNCE_FRAME_NUMBER */ + (EHCI_MAX_UFRAME_VALUE >> 3)); /* add USB_HOST_EHCI_ISO_BOUNCE_FRAME_NUMBER */ /* frame should align with interval */ - if (currentFrame <= ehciPipePointer->startFrame) - { - currentFrame = ehciPipePointer->startFrame; - } - else - { - currentFrame -= ehciPipePointer->startFrame; - currentFrame = ((currentFrame + frameInterval - 1U) & (~(frameInterval - 1U))); - currentFrame += ehciPipePointer->startFrame; - } + currentFrame -= ehciPipePointer->startFrame; + currentFrame = + ((uint32_t)(currentFrame + frameInterval - 1) & (~(frameInterval - 1))); /* frameInterval is power of 2 */ + currentFrame += ehciPipePointer->startFrame; } else { shouldLinkFrame = isoPointer->lastLinkFrame + frameInterval; /* continuous next should link frame */ - if (shouldLinkFrame > USB_HOST_EHCI_MAX_MICRFRAME_VALUE >> 3U) + if (shouldLinkFrame > (int32_t)(EHCI_MAX_UFRAME_VALUE >> 3)) { - shouldLinkFrame = shouldLinkFrame - ((USB_HOST_EHCI_MAX_MICRFRAME_VALUE >> 3U) + 1U); + shouldLinkFrame = shouldLinkFrame - ((EHCI_MAX_UFRAME_VALUE >> 3) + 1); } - currentFrame = ((ehciInstance->ehciIpBase->FRINDEX & USB_HOST_EHCI_MAX_MICRFRAME_VALUE) >> 3U); - distance = - ((shouldLinkFrame + (USB_HOST_EHCI_MAX_MICRFRAME_VALUE >> 3U) + 1U - currentFrame) & - (USB_HOST_EHCI_MAX_MICRFRAME_VALUE >> 3)); /* get the distance from shouldLinkFrame to currentFrame */ + currentFrame = ((ehciInstance->ehciIpBase->FRINDEX & EHCI_MAX_UFRAME_VALUE) >> 3); + distance = ((shouldLinkFrame - currentFrame + (EHCI_MAX_UFRAME_VALUE >> 3) + 1) & + (EHCI_MAX_UFRAME_VALUE >> 3)); /* get the distance from shouldLinkFrame to currentFrame */ /* shouldLinkFrame has add frameInterval, think about the align with interval, so here add (frameInterval * * 2) */ - if ((distance <= - (USB_HOST_EHCI_ISO_BOUNCE_FRAME_NUMBER + frameInterval * USB_HOST_EHCI_ISO_MAX_CONTINUOUS_TRANSFER)) && - (distance > 0U)) + if ((distance <= (USB_HOST_EHCI_ISO_BOUNCE_FRAME_NUMBER + frameInterval * 2)) && (distance > 0)) { currentFrame = shouldLinkFrame; } else /* re-link */ { currentFrame = - ((currentFrame + USB_HOST_EHCI_ISO_BOUNCE_FRAME_NUMBER) & (USB_HOST_EHCI_MAX_MICRFRAME_VALUE >> 3)); - - /*if (currentFrame > (USB_HOST_EHCI_MAX_MICRFRAME_VALUE >> 3)) + ((uint32_t)(currentFrame + USB_HOST_EHCI_ISO_BOUNCE_FRAME_NUMBER) & (EHCI_MAX_UFRAME_VALUE >> 3)); + if (currentFrame > (int32_t)(EHCI_MAX_UFRAME_VALUE >> 3)) { - currentFrame = currentFrame - ((USB_HOST_EHCI_MAX_MICRFRAME_VALUE >> 3) + 1U); - }*/ + currentFrame = currentFrame - ((EHCI_MAX_UFRAME_VALUE >> 3) + 1); + } /* frame should align with interval */ - if (currentFrame <= ehciPipePointer->startFrame) - { - currentFrame = ehciPipePointer->startFrame; - } - else - { - currentFrame -= ehciPipePointer->startFrame; - currentFrame = ((currentFrame + frameInterval - 1U) & (~(frameInterval - 1U))); - currentFrame += ehciPipePointer->startFrame; - } + currentFrame -= ehciPipePointer->startFrame; + currentFrame = ((uint32_t)(currentFrame + frameInterval - 1) & (~(frameInterval - 1))); + currentFrame += ehciPipePointer->startFrame; } } - if (currentFrame >= USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE) /* frame turn around */ + if (currentFrame >= (int32_t)USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE) /* frame turn around */ { shouldLinkFrame = (currentFrame - USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE); /* shouldLinkFrame means inserted frame position */ @@ -2580,14 +2574,14 @@ static void USB_HostEhciLinkSitd(usb_host_ehci_instance_t *ehciInstance, } sitdPointer = (usb_host_ehci_sitd_t *)startEntryPointer; - while (NULL != sitdPointer) + while (sitdPointer) { - sitdPointer->frameEntryIndex = (uint16_t)shouldLinkFrame; + sitdPointer->frameEntryIndex = shouldLinkFrame; /* add to frame list head */ - temp = (void *)ehciInstance->ehciFrameList; - sitdPointer->nextLinkPointer = ((uint32_t *)temp)[shouldLinkFrame]; - ((uint32_t *)temp)[shouldLinkFrame] = ((uint32_t)sitdPointer | EHCI_HOST_POINTER_TYPE_SITD); - if (sitdPointer->nextSitdIndex == 0xFFU) /* 0xFF is invalid value */ + sitdPointer->nextLinkPointer = ((uint32_t *)ehciInstance->ehciFrameList)[shouldLinkFrame]; + ((uint32_t *)ehciInstance->ehciFrameList)[shouldLinkFrame] = + ((uint32_t)sitdPointer | EHCI_HOST_POINTER_TYPE_SITD); + if (sitdPointer->nextSitdIndex == 0xFF) /* 0xFF is invalid value */ { break; } @@ -2595,17 +2589,17 @@ static void USB_HostEhciLinkSitd(usb_host_ehci_instance_t *ehciInstance, shouldLinkFrame += frameInterval; currentFrame += frameInterval; - if (shouldLinkFrame >= USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE) + if (shouldLinkFrame >= (int32_t)USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE) { shouldLinkFrame = (shouldLinkFrame - USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE); } } - if (currentFrame > (USB_HOST_EHCI_MAX_MICRFRAME_VALUE >> 3)) + if (currentFrame > (int32_t)(EHCI_MAX_UFRAME_VALUE >> 3)) { - currentFrame = currentFrame - ((USB_HOST_EHCI_MAX_MICRFRAME_VALUE >> 3) + 1U); + currentFrame = currentFrame - ((EHCI_MAX_UFRAME_VALUE >> 3) + 1); } - isoPointer->lastLinkFrame = (uint16_t)currentFrame; /* save the last link frame value */ + isoPointer->lastLinkFrame = currentFrame; /* save the last link frame value */ } static usb_status_t USB_HostEhciSitdArrayInit(usb_host_ehci_instance_t *ehciInstance, @@ -2618,35 +2612,33 @@ static usb_status_t USB_HostEhciSitdArrayInit(usb_host_ehci_instance_t *ehciInst uint32_t dataLength = 0; uint32_t sitdLength = 0; uint32_t dataBufferValue; - uint32_t hubNumber = 0U; - uint32_t portNumber = 0U; - uint32_t address = 0U; + uint32_t hubNumber; + uint32_t portNumber; + uint32_t address; uint32_t tmp; - uint32_t *temp; - uint32_t index; - int32_t tempIndex; - (void)USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, - (uint32_t)kUSB_HostGetDeviceAddress, &address); + uint8_t index; - sitdNumber = ((transfer->transferLength - 1U + (ehciPipePointer->pipeCommon.maxPacketSize)) / + USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, kUSB_HostGetDeviceAddress, + &address); + + sitdNumber = ((transfer->transferLength - 1 + (ehciPipePointer->pipeCommon.maxPacketSize)) / (ehciPipePointer->pipeCommon.maxPacketSize)); /* get sitd array */ + tmp = ehciPipePointer - ehciInstance->ehciPipeIndexBase; /* pipe index */ /* USB_HostEhciLock(); */ if (ehciInstance->ehciSitdNumber >= sitdNumber) { - sitdPointer = ehciInstance->ehciSitdList; + sitdPointer = ehciInstance->ehciSitdList; transfer->union1.unitHead = (uint32_t)sitdPointer; - for (index = 1U; index < sitdNumber; ++index) + for (index = 1; index < sitdNumber; ++index) { - /*misra 10.8*/ - tempIndex = (((usb_host_ehci_sitd_t *)(sitdPointer->nextLinkPointer & 0xFFFFFFFEU)) - - ehciInstance->ehciSitdIndexBase); - sitdPointer->nextSitdIndex = (uint8_t)tempIndex; - sitdPointer = (usb_host_ehci_sitd_t *)(sitdPointer->nextLinkPointer & 0xFFFFFFFEU); + sitdPointer->nextSitdIndex = + (((usb_host_ehci_sitd_t *)sitdPointer->nextLinkPointer) - ehciInstance->ehciSitdIndexBase); + sitdPointer = (usb_host_ehci_sitd_t *)sitdPointer->nextLinkPointer; } sitdPointer->nextSitdIndex = 0xFF; - ehciInstance->ehciSitdList = (usb_host_ehci_sitd_t *)(sitdPointer->nextLinkPointer & 0xFFFFFFFEU); - ehciInstance->ehciSitdNumber -= (uint8_t)sitdNumber; + ehciInstance->ehciSitdList = (usb_host_ehci_sitd_t *)sitdPointer->nextLinkPointer; + ehciInstance->ehciSitdNumber -= sitdNumber; } else { @@ -2656,16 +2648,15 @@ static usb_status_t USB_HostEhciSitdArrayInit(usb_host_ehci_instance_t *ehciInst /* USB_HostEhciUnlock(); */ transfer->union2.unitTail = (uint32_t)sitdPointer; /* initialize sitd array */ - (void)USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, - (uint32_t)kUSB_HostGetDeviceHubNumber, &hubNumber); - (void)USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, - (uint32_t)kUSB_HostGetDevicePortNumber, &portNumber); + USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, kUSB_HostGetDeviceHubNumber, + &hubNumber); + USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, kUSB_HostGetDevicePortNumber, + &portNumber); sitdPointer = (usb_host_ehci_sitd_t *)transfer->union1.unitHead; - dataLength = transfer->transferLength; - while (0U != sitdNumber) + dataLength = transfer->transferLength; + while (sitdNumber--) { - sitdNumber--; - USB_HostEhciZeroMem((void *)sitdPointer, 7); + USB_HostEhciZeroMem((uint32_t *)sitdPointer, 7); sitdLength = dataLength; if (sitdLength > ehciPipePointer->pipeCommon.maxPacketSize) { @@ -2674,7 +2665,7 @@ static usb_status_t USB_HostEhciSitdArrayInit(usb_host_ehci_instance_t *ehciInst dataBufferValue = (uint32_t)(transfer->transferBuffer + (transfer->transferLength - dataLength)); dataLength -= sitdLength; /* update left data length */ sitdPointer->transferResults[1] = dataBufferValue; - sitdPointer->transferResults[2] = ((dataBufferValue + 4U * 1024U) & 0xFFFFF000U); + sitdPointer->transferResults[2] = ((dataBufferValue + 4 * 1024) & 0xFFFFF000U); sitdPointer->endpointStates[0] = (((uint32_t)ehciPipePointer->pipeCommon.direction << EHCI_HOST_SITD_DIRECTION_SHIFT) | (portNumber << EHCI_HOST_SITD_PORT_NUMBER_SHIFT) | (hubNumber << EHCI_HOST_SITD_HUB_ADDR_SHIFT) | @@ -2688,14 +2679,14 @@ static usb_status_t USB_HostEhciSitdArrayInit(usb_host_ehci_instance_t *ehciInst sitdPointer->endpointStates[1] = (((uint32_t)ehciPipePointer->uframeCmask << EHCI_HOST_SITD_CMASK_SHIFT) | ((uint32_t)ehciPipePointer->uframeSmask << EHCI_HOST_SITD_SMASK_SHIFT)); - tmp = (sitdLength + 187U) / 188U; - if (tmp > 1U) + tmp = (sitdLength + 187) / 188; + if (tmp > 1) { - sitdPointer->transferResults[2] |= (0x01U << EHCI_HOST_SITD_TP_SHIFT); /* for iso split */ + sitdPointer->transferResults[2] |= (0x01 << EHCI_HOST_SITD_TP_SHIFT); /* for iso split */ } else { - sitdPointer->transferResults[2] |= (0x00U << EHCI_HOST_SITD_TP_SHIFT); /* for iso split */ + sitdPointer->transferResults[2] |= (0x00 << EHCI_HOST_SITD_TP_SHIFT); /* for iso split */ } sitdPointer->transferResults[2] |= (tmp << EHCI_HOST_SITD_TCOUNT_SHIFT); /* for iso split */ } @@ -2705,29 +2696,26 @@ static usb_status_t USB_HostEhciSitdArrayInit(usb_host_ehci_instance_t *ehciInst sitdPointer = (ehciInstance->ehciSitdIndexBase + sitdPointer->nextSitdIndex); } sitdPointer = (usb_host_ehci_sitd_t *)transfer->union2.unitTail; - sitdPointer->transferResults[0] |= (1UL << EHCI_HOST_SITD_IOC_SHIFT); /* last set IOC */ + sitdPointer->transferResults[0] |= (1U << EHCI_HOST_SITD_IOC_SHIFT); /* last set IOC */ /* link transfer to usb_host_ehci_iso_t transfer list */ isoPointer = (usb_host_ehci_iso_t *)ehciPipePointer->ehciQh; USB_HostEhciLock(); if (isoPointer->ehciTransferHead == NULL) { - transfer->next = NULL; - isoPointer->ehciTransferTail = transfer; - isoPointer->ehciTransferHead = transfer; + transfer->next = NULL; + isoPointer->ehciTransferHead = isoPointer->ehciTransferTail = transfer; } else { - transfer->next = NULL; + transfer->next = NULL; isoPointer->ehciTransferTail->next = transfer; - isoPointer->ehciTransferTail = transfer; + isoPointer->ehciTransferTail = transfer; } USB_HostEhciUnlock(); /* link itd to frame list (note: initialize frameEntryIndex)*/ - /*misra 11.6*/ - temp = (uint32_t *)(transfer->union1.unitHead); - USB_HostEhciLinkSitd(ehciInstance, ehciPipePointer, (void *)temp); + USB_HostEhciLinkSitd(ehciInstance, ehciPipePointer, (void *)transfer->union1.unitHead); return kStatus_USB_Success; } @@ -2737,9 +2725,9 @@ static uint32_t USB_HostEhciSitdArrayRelease(usb_host_ehci_instance_t *ehciInsta usb_host_ehci_sitd_t *endSitdPointer) { usb_host_ehci_sitd_t *sitdPointer = startSitdPointer; - uint32_t leftLength = 0; + uint32_t leftLength = 0; /* remove itd from frame list */ - while (1U == 1U) + while (1) { /* record the transfer's result length */ leftLength += @@ -2749,9 +2737,8 @@ static uint32_t USB_HostEhciSitdArrayRelease(usb_host_ehci_instance_t *ehciInsta /* release itd */ /* USB_HostEhciLock(); */ - /*set next link pointer to invalid in case hardware access invalid sitd structure in special case*/ - sitdPointer->nextLinkPointer = (((uint32_t)ehciInstance->ehciSitdList) | EHCI_HOST_T_INVALID_VALUE); - ehciInstance->ehciSitdList = sitdPointer; + sitdPointer->nextLinkPointer = (uint32_t)ehciInstance->ehciSitdList; + ehciInstance->ehciSitdList = sitdPointer; ehciInstance->ehciSitdNumber++; /* USB_HostEhciUnlock(); */ @@ -2775,9 +2762,8 @@ static usb_status_t USB_HostEhciSitdArrayDeinit(usb_host_ehci_instance_t *ehciIn /* firstly remove the transfer (because host task may occupy to access the resource) */ USB_HostEhciLock(); - transfer = isoPointer->ehciTransferHead; - isoPointer->ehciTransferTail = NULL; - isoPointer->ehciTransferHead = NULL; + transfer = isoPointer->ehciTransferHead; + isoPointer->ehciTransferHead = isoPointer->ehciTransferTail = NULL; USB_HostEhciUnlock(); while (transfer != NULL) @@ -2788,7 +2774,7 @@ static usb_status_t USB_HostEhciSitdArrayDeinit(usb_host_ehci_instance_t *ehciIn transfer->transferLength - USB_HostEhciSitdArrayRelease(ehciInstance, (usb_host_ehci_sitd_t *)transfer->union1.unitHead, (usb_host_ehci_sitd_t *)transfer->union2.unitTail); - /* callback function is different from the current condition */ + /* transfer callback */ transfer->callbackFn(transfer->callbackParam, transfer, kStatus_USB_TransferCancel); /* next transfer */ transfer = nextTransfer; @@ -2804,66 +2790,50 @@ static uint32_t USB_HostEhciGetItdLinkFrame(usb_host_ehci_instance_t *ehciInstan uint16_t startUframe, uint16_t uframeInterval) { - uint32_t shouldLinkUframe; - uint32_t currentUframe; - uint32_t distance; + int32_t shouldLinkUframe; + int32_t currentUframe; + int32_t distance; - if (lastLinkUframe != 0xFFFFU) + if (lastLinkUframe != 0xFFFF) { shouldLinkUframe = lastLinkUframe + uframeInterval; - if (shouldLinkUframe > USB_HOST_EHCI_MAX_MICRFRAME_VALUE) + if (shouldLinkUframe > (int32_t)EHCI_MAX_UFRAME_VALUE) { - shouldLinkUframe = shouldLinkUframe - (USB_HOST_EHCI_MAX_MICRFRAME_VALUE + 1U); + shouldLinkUframe = shouldLinkUframe - (EHCI_MAX_UFRAME_VALUE + 1); } - currentUframe = (ehciInstance->ehciIpBase->FRINDEX & USB_HOST_EHCI_MAX_MICRFRAME_VALUE); - distance = ((shouldLinkUframe + USB_HOST_EHCI_MAX_MICRFRAME_VALUE + 1U - currentUframe) & - USB_HOST_EHCI_MAX_MICRFRAME_VALUE); /* get the distance */ + currentUframe = (ehciInstance->ehciIpBase->FRINDEX & EHCI_MAX_UFRAME_VALUE); + distance = ((shouldLinkUframe - currentUframe + EHCI_MAX_UFRAME_VALUE + 1) & + EHCI_MAX_UFRAME_VALUE); /* get the distance */ /* shouldLinkUframe has add uframeInterval, think about the align with interval, so here add (uframeInterval * * 2) */ - if ((distance <= ((uint32_t)USB_HOST_EHCI_ISO_BOUNCE_UFRAME_NUMBER + - ((uint32_t)uframeInterval * USB_HOST_EHCI_ISO_MAX_CONTINUOUS_TRANSFER))) && - (distance > 2U)) + if ((distance <= (int32_t)(USB_HOST_EHCI_ISO_BOUNCE_UFRAME_NUMBER + (uframeInterval * 2))) && (distance > 2)) { currentUframe = shouldLinkUframe; } else /* re-link */ { currentUframe = - ((currentUframe + USB_HOST_EHCI_ISO_BOUNCE_UFRAME_NUMBER) & USB_HOST_EHCI_MAX_MICRFRAME_VALUE); - /*if (currentUframe > USB_HOST_EHCI_MAX_MICRFRAME_VALUE) + ((uint32_t)(currentUframe + USB_HOST_EHCI_ISO_BOUNCE_UFRAME_NUMBER) & EHCI_MAX_UFRAME_VALUE); + if (currentUframe > (int32_t)EHCI_MAX_UFRAME_VALUE) { - currentUframe = currentUframe - (USB_HOST_EHCI_MAX_MICRFRAME_VALUE + 1U); - }*/ + currentUframe = currentUframe - (EHCI_MAX_UFRAME_VALUE + 1); + } /* uframe should align with interval */ - if (currentUframe <= startUframe) - { - currentUframe = startUframe; - } - else - { - currentUframe -= startUframe; - currentUframe = ((uint32_t)(currentUframe + uframeInterval) & - (~((uint32_t)uframeInterval - 1U))); /* uframeInterval is power of 2 */ - currentUframe += startUframe; - } + currentUframe -= startUframe; + currentUframe = ((uint32_t)(currentUframe + uframeInterval - 1) & + (~((uint32_t)uframeInterval - 1))); /* uframeInterval is power of 2 */ + currentUframe += startUframe; } } else { - currentUframe = (ehciInstance->ehciIpBase->FRINDEX & USB_HOST_EHCI_MAX_MICRFRAME_VALUE); - currentUframe = ((currentUframe + USB_HOST_EHCI_ISO_BOUNCE_UFRAME_NUMBER) & USB_HOST_EHCI_MAX_MICRFRAME_VALUE); + currentUframe = (ehciInstance->ehciIpBase->FRINDEX & EHCI_MAX_UFRAME_VALUE); + currentUframe = ((uint32_t)(currentUframe + USB_HOST_EHCI_ISO_BOUNCE_UFRAME_NUMBER) & EHCI_MAX_UFRAME_VALUE); /* uframe should align with interval */ - if (currentUframe <= startUframe) - { - currentUframe = startUframe; - } - else - { - currentUframe -= startUframe; - currentUframe = - ((currentUframe + uframeInterval) & (~(uframeInterval - 1U))); /* uframeInterval is power of 2 */ - currentUframe += startUframe; - } + currentUframe -= startUframe; + currentUframe = ((uint32_t)(currentUframe + uframeInterval - 1) & + (~((uint32_t)uframeInterval - 1))); /* uframeInterval is power of 2 */ + currentUframe += startUframe; } return currentUframe; @@ -2875,29 +2845,27 @@ static usb_status_t USB_HostEhciItdArrayInit(usb_host_ehci_instance_t *ehciInsta { usb_host_ehci_iso_t *isoPointer; usb_host_ehci_itd_t *itdPointer = NULL; - usb_host_ehci_itd_t *itdHead = NULL; usb_host_ehci_itd_t *tmpItdPointer; uint32_t dataLength; /* the remaining data for sending */ uint32_t transactionLength; /* the initializing transaction descriptor data length */ uint32_t itdBufferValue; uint32_t itdBufferBaseValue; /* for calculating PG value */ - uint32_t address = 0U; + uint32_t address; uint32_t lastShouldLinkUframe; uint32_t linkUframe; - uint32_t minDataPerItd = - (uint32_t)ehciPipePointer->pipeCommon.numberPerUframe * ehciPipePointer->pipeCommon.maxPacketSize; + uint32_t minDataPerItd = ehciPipePointer->pipeCommon.numberPerUframe * ehciPipePointer->pipeCommon.maxPacketSize; uint8_t maxItdNumber; - uint16_t index = 0; + uint8_t index = 0; isoPointer = (usb_host_ehci_iso_t *)ehciPipePointer->ehciQh; - (void)USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, - (uint32_t)kUSB_HostGetDeviceAddress, &address); + USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, kUSB_HostGetDeviceAddress, + &address); /* max needed itd number, the actual needed number may be less because micro-frame interval may be less than 8 */ - maxItdNumber = (uint8_t)((transfer->transferLength - 1U + minDataPerItd) / minDataPerItd); - if (ehciPipePointer->uframeInterval < 8U) + maxItdNumber = ((transfer->transferLength - 1 + minDataPerItd) / minDataPerItd); + if (ehciPipePointer->uframeInterval < 8) { - maxItdNumber = (uint8_t)((maxItdNumber * ehciPipePointer->uframeInterval + 7U) / 8U) + 1U; + maxItdNumber = ((maxItdNumber * ehciPipePointer->uframeInterval + 7) / 8) + 1; } if (maxItdNumber > ehciInstance->ehciItdNumber) { @@ -2909,46 +2877,43 @@ static usb_status_t USB_HostEhciItdArrayInit(usb_host_ehci_instance_t *ehciInsta /* USB_HostEhciLock(); */ if (isoPointer->ehciTransferHead == NULL) { - isoPointer->ehciTransferTail = transfer; - isoPointer->ehciTransferHead = transfer; + isoPointer->ehciTransferHead = isoPointer->ehciTransferTail = transfer; } else { isoPointer->ehciTransferTail->next = transfer; - isoPointer->ehciTransferTail = transfer; + isoPointer->ehciTransferTail = transfer; } /* USB_HostEhciUnlock(); */ - dataLength = transfer->transferLength; - transfer->union1.unitHead = 0U; + dataLength = transfer->transferLength; + transfer->union1.unitHead = (uint32_t)NULL; /* get the link micro-frame */ lastShouldLinkUframe = USB_HostEhciGetItdLinkFrame( ehciInstance, isoPointer->lastLinkFrame, (uint16_t)((ehciPipePointer->startFrame << 3) + ehciPipePointer->startUframe), ehciPipePointer->uframeInterval); - if (lastShouldLinkUframe > USB_HOST_EHCI_MAX_MICRFRAME_VALUE) + if (lastShouldLinkUframe > EHCI_MAX_UFRAME_VALUE) { - linkUframe = lastShouldLinkUframe - (USB_HOST_EHCI_MAX_MICRFRAME_VALUE + 1U); + linkUframe = lastShouldLinkUframe - (EHCI_MAX_UFRAME_VALUE + 1); } else { linkUframe = lastShouldLinkUframe; } - itdHead = ehciInstance->ehciItdList; - while (0U != dataLength) + while (dataLength) { /* get one idle itd */ tmpItdPointer = ehciInstance->ehciItdList; + ehciInstance->ehciItdList = (usb_host_ehci_itd_t *)tmpItdPointer->nextLinkPointer; + ehciInstance->ehciItdNumber -= 1; if (tmpItdPointer == NULL) { return kStatus_USB_Error; /* this should not reach */ } - ehciInstance->ehciItdList = (usb_host_ehci_itd_t *)tmpItdPointer->nextItdPointer; - ehciInstance->ehciItdNumber -= 1U; - tmpItdPointer->nextItdPointer = NULL; /* use the itd */ - if (transfer->union1.unitHead == 0U) /* first itd */ + if (transfer->union1.unitHead == (uint32_t)NULL) /* first itd */ { transfer->union1.unitHead = (uint32_t)tmpItdPointer; } @@ -2959,11 +2924,11 @@ static usb_status_t USB_HostEhciItdArrayInit(usb_host_ehci_instance_t *ehciInsta itdPointer = tmpItdPointer; /* itd has been set to all zero when releasing */ - itdBufferValue = (uint32_t)(transfer->transferBuffer + (transfer->transferLength - dataLength)); - itdBufferBaseValue = itdBufferValue; - for (index = 0; index < 7U; ++index) + itdBufferBaseValue = itdBufferValue = + (uint32_t)(transfer->transferBuffer + (transfer->transferLength - dataLength)); + for (index = 0; index < 7; ++index) { - itdPointer->bufferPointers[index] = ((itdBufferBaseValue + ((uint32_t)index * 4U * 1024U)) & 0xFFFFF000U); + itdPointer->bufferPointers[index] = ((itdBufferBaseValue + (index * 4 * 1024)) & 0xFFFFF000U); } /* initialize iTD common fields */ itdPointer->bufferPointers[0] |= @@ -2974,7 +2939,7 @@ static usb_status_t USB_HostEhciItdArrayInit(usb_host_ehci_instance_t *ehciInsta ((uint32_t)ehciPipePointer->pipeCommon.maxPacketSize << EHCI_HOST_ITD_MAX_PACKET_SIZE_SHIFT)); itdPointer->bufferPointers[2] |= (ehciPipePointer->pipeCommon.numberPerUframe); /* initialize transaction descriptors */ - for (index = (uint8_t)(linkUframe & 0x0007U); index < 8U; index += ehciPipePointer->uframeInterval) + for (index = (linkUframe & 0x0007); index < 8; index += ehciPipePointer->uframeInterval) { transactionLength = ((dataLength > minDataPerItd) ? minDataPerItd : dataLength); /* initialize the uframeIndex's transaction descriptor in itd */ @@ -2986,7 +2951,7 @@ static usb_status_t USB_HostEhciItdArrayInit(usb_host_ehci_instance_t *ehciInsta (itdBufferValue & EHCI_HOST_ITD_TRANSACTION_OFFSET_MASK)); dataLength -= transactionLength; itdBufferValue += transactionLength; - if (dataLength <= 0U) + if (dataLength <= 0) { break; } @@ -2994,25 +2959,17 @@ static usb_status_t USB_HostEhciItdArrayInit(usb_host_ehci_instance_t *ehciInsta } transfer->union2.unitTail = (uint32_t)itdPointer; - itdPointer->transactions[index] |= (1UL << EHCI_HOST_ITD_IOC_SHIFT); /* last set IOC */ + itdPointer->transactions[index] |= (1 << EHCI_HOST_ITD_IOC_SHIFT); /* last set IOC */ - itdPointer = itdHead; /* link itd to frame list (note: initialize frameEntryIndex)*/ - while (NULL != itdPointer) + while (itdPointer) { - void *temp = (void *)ehciInstance->ehciFrameList; - uint32_t *linkPointer = &((uint32_t *)temp)[linkUframe >> 3]; - uint32_t linkValue = *linkPointer; - itdPointer->frameEntryIndex = linkUframe >> 3; - while ((0U == (linkValue & EHCI_HOST_T_INVALID_VALUE)) && - ((linkValue & EHCI_HOST_POINTER_TYPE_MASK) == EHCI_HOST_POINTER_TYPE_ITD)) - { - linkPointer = (uint32_t *)(linkValue & EHCI_HOST_POINTER_ADDRESS_MASK); - linkValue = *linkPointer; - } - itdPointer->nextLinkPointer = *linkPointer; - *linkPointer = ((uint32_t)itdPointer | EHCI_HOST_POINTER_TYPE_ITD); - itdPointer = itdPointer->nextItdPointer; + itdPointer->frameEntryIndex = linkUframe; + /* add to frame head */ + itdPointer->nextLinkPointer = ((uint32_t *)ehciInstance->ehciFrameList)[linkUframe >> 3]; + *(uint32_t *)((uint32_t *)ehciInstance->ehciFrameList)[linkUframe >> 3] = + ((uint32_t)itdPointer | EHCI_HOST_POINTER_TYPE_ITD); + itdPointer = itdPointer->nextItdPointer; if (itdPointer == NULL) { break; @@ -3026,11 +2983,11 @@ static usb_status_t USB_HostEhciItdArrayInit(usb_host_ehci_instance_t *ehciInsta } } - if (lastShouldLinkUframe > USB_HOST_EHCI_MAX_MICRFRAME_VALUE) + if (lastShouldLinkUframe > EHCI_MAX_UFRAME_VALUE) { - lastShouldLinkUframe = lastShouldLinkUframe - (USB_HOST_EHCI_MAX_MICRFRAME_VALUE + 1U); + lastShouldLinkUframe = lastShouldLinkUframe - (EHCI_MAX_UFRAME_VALUE + 1); } - isoPointer->lastLinkFrame = (uint16_t)lastShouldLinkUframe; + isoPointer->lastLinkFrame = lastShouldLinkUframe; return kStatus_USB_Success; } @@ -3044,24 +3001,23 @@ static uint32_t USB_HostEhciItdArrayRelease(usb_host_ehci_instance_t *ehciInstan uint32_t doneLength = 0; /* remove itd from frame list */ - while (1U == 1U) + while (1) { /* record the transfer's result length */ - for (index = 0U; index < 8U; ++index) + for (index = 0; index < 8; ++index) { doneLength += ((itdPointer->transactions[index] & EHCI_HOST_ITD_TRANSACTION_LEN_MASK) >> EHCI_HOST_ITD_TRANSACTION_LEN_SHIFT); } USB_HostEhciRemoveFromFrame(ehciInstance, (uint32_t)itdPointer, - (uint16_t)itdPointer->frameEntryIndex); /* remove from the inserted frame list */ + itdPointer->frameEntryIndex); /* remove from the inserted frame list */ /* release itd */ /* USB_HostEhciLock(); */ - /*set next link pointer to invalid in case hardware access invalid itd structure in special case*/ - itdPointer->nextLinkPointer = EHCI_HOST_T_INVALID_VALUE; - itdPointer->nextItdPointer = (usb_host_ehci_itd_t *)ehciInstance->ehciItdList; - ehciInstance->ehciItdList = itdPointer; + USB_HostEhciZeroMem((uint32_t *)itdPointer, sizeof(usb_host_ehci_itd_t) >> 2); + itdPointer->nextLinkPointer = (uint32_t)ehciInstance->ehciItdList; + ehciInstance->ehciItdList = itdPointer; ehciInstance->ehciItdNumber++; /* USB_HostEhciUnlock(); */ @@ -3085,15 +3041,14 @@ static usb_status_t USB_HostEhciItdArrayDeinit(usb_host_ehci_instance_t *ehciIns /* firstly remove the transfer (because host task may occupy to access the resource) */ USB_HostEhciLock(); - transfer = isoPointer->ehciTransferHead; - isoPointer->ehciTransferTail = NULL; - isoPointer->ehciTransferHead = NULL; + transfer = isoPointer->ehciTransferHead; + isoPointer->ehciTransferHead = isoPointer->ehciTransferTail = NULL; USB_HostEhciUnlock(); while (transfer != NULL) { nextTransfer = transfer->next; - doneLength = 0; + doneLength = 0; /* remove itd from frame list and release itd */ doneLength = USB_HostEhciItdArrayRelease(ehciInstance, (usb_host_ehci_itd_t *)transfer->union1.unitHead, (usb_host_ehci_itd_t *)transfer->union2.unitTail); @@ -3104,7 +3059,6 @@ static usb_status_t USB_HostEhciItdArrayDeinit(usb_host_ehci_instance_t *ehciIns doneLength = transfer->transferLength; } transfer->transferSofar = doneLength; - /* callback function is different from the current condition */ transfer->callbackFn(transfer->callbackParam, transfer, kStatus_USB_TransferCancel); /* next transfer */ @@ -3128,7 +3082,7 @@ static usb_status_t USB_HostEhciOpenControlBulk(usb_host_ehci_instance_t *ehciIn qhPointer = (usb_host_ehci_qh_t *)ehciPipePointer->ehciQh; /* add qh to async */ - qhPointer->horizontalLinkPointer = ehciInstance->shedFirstQh->horizontalLinkPointer; + qhPointer->horizontalLinkPointer = ehciInstance->shedFirstQh->horizontalLinkPointer; ehciInstance->shedFirstQh->horizontalLinkPointer = ((uint32_t)qhPointer | EHCI_HOST_POINTER_TYPE_QH); return kStatus_USB_Success; @@ -3139,11 +3093,10 @@ static usb_status_t USB_HostEhciCloseControlBulk(usb_host_ehci_instance_t *ehciI { volatile usb_host_ehci_qh_t *vltPrevQhPointer; uint32_t horizontalLinkValue; - uint32_t *temp; + /* remove qh from async schedule */ - temp = (uint32_t *)ehciPipePointer->ehciQh; if ((ehciInstance->shedFirstQh->horizontalLinkPointer & EHCI_HOST_POINTER_ADDRESS_MASK) == - (uint32_t)temp) /* the removing qh is the first qh in the async list */ + (uint32_t)ehciPipePointer->ehciQh) /* the removing qh is the first qh in the async list */ { USB_HostEhciStopAsync(ehciInstance); ehciInstance->shedFirstQh->horizontalLinkPointer = @@ -3157,8 +3110,8 @@ static usb_status_t USB_HostEhciCloseControlBulk(usb_host_ehci_instance_t *ehciI while (vltPrevQhPointer != NULL) { horizontalLinkValue = vltPrevQhPointer->horizontalLinkPointer; - if ((0U != (horizontalLinkValue & EHCI_HOST_T_INVALID_VALUE)) || - ((horizontalLinkValue & EHCI_HOST_POINTER_ADDRESS_MASK) == (uint32_t)temp) || + if ((horizontalLinkValue & EHCI_HOST_T_INVALID_VALUE) || + ((horizontalLinkValue & EHCI_HOST_POINTER_ADDRESS_MASK) == (uint32_t)ehciPipePointer->ehciQh) || ((horizontalLinkValue & EHCI_HOST_POINTER_ADDRESS_MASK) == (uint32_t)ehciInstance->shedFirstQh)) { break; @@ -3168,10 +3121,8 @@ static usb_status_t USB_HostEhciCloseControlBulk(usb_host_ehci_instance_t *ehciI } /* remove the qh from async list */ - /*for misra 11.6*/ - temp = (uint32_t *)ehciPipePointer->ehciQh; - if ((vltPrevQhPointer != NULL) && (0U == (horizontalLinkValue & EHCI_HOST_T_INVALID_VALUE)) && - ((horizontalLinkValue & EHCI_HOST_POINTER_ADDRESS_MASK) == (uint32_t)temp)) + if ((vltPrevQhPointer != NULL) && (!(horizontalLinkValue & EHCI_HOST_T_INVALID_VALUE)) && + ((horizontalLinkValue & EHCI_HOST_POINTER_ADDRESS_MASK) == (uint32_t)ehciPipePointer->ehciQh)) { USB_HostEhciStopAsync(ehciInstance); vltPrevQhPointer->horizontalLinkPointer = @@ -3189,7 +3140,6 @@ static usb_status_t USB_HostEhciOpenInterrupt(usb_host_ehci_instance_t *ehciInst { usb_status_t status = kStatus_USB_Success; uint32_t frameIndex; - uint32_t *temp; /* allocate bandwidth */ if (ehciInstance->firstDeviceSpeed == USB_SPEED_HIGH) @@ -3213,10 +3163,10 @@ static usb_status_t USB_HostEhciOpenInterrupt(usb_host_ehci_instance_t *ehciInst /* insert QH to frame list */ for (frameIndex = ehciPipePointer->startFrame; frameIndex < USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE; - frameIndex += (((uint32_t)ehciPipePointer->uframeInterval + 7U) / 8U)) + frameIndex += (ehciPipePointer->uframeInterval / 8)) { - temp = (uint32_t *)ehciPipePointer->ehciQh; - USB_HostEhciAddQhToFrame(ehciInstance, (uint32_t)temp, (uint16_t)frameIndex, ehciPipePointer->uframeInterval); + USB_HostEhciAddQhToFrame(ehciInstance, (uint32_t)ehciPipePointer->ehciQh, frameIndex, + ehciPipePointer->uframeInterval); } return kStatus_USB_Success; @@ -3226,13 +3176,12 @@ static usb_status_t USB_HostEhciCloseInterrupt(usb_host_ehci_instance_t *ehciIns usb_host_ehci_pipe_t *ehciPipePointer) { uint32_t frameIndex; - uint32_t *temp; + /* remove from frame list */ for (frameIndex = ehciPipePointer->startFrame; frameIndex < USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE; - frameIndex += (((uint32_t)ehciPipePointer->uframeInterval + 7U) / 8U)) + frameIndex += (ehciPipePointer->uframeInterval / 8)) { - temp = (uint32_t *)ehciPipePointer->ehciQh; - USB_HostEhciRemoveFromFrame(ehciInstance, (uint32_t)temp, (uint16_t)frameIndex); + USB_HostEhciRemoveFromFrame(ehciInstance, (uint32_t)ehciPipePointer->ehciQh, frameIndex); } ((usb_host_ehci_qh_t *)ehciPipePointer->ehciQh)->horizontalLinkPointer |= EHCI_HOST_T_INVALID_VALUE; /* invalid next qh link */ @@ -3270,11 +3219,11 @@ static usb_status_t USB_HostEhciOpenIso(usb_host_ehci_instance_t *ehciInstance, return kStatus_USB_Error; } USB_HostEhciLock(); - isoPointer = ehciInstance->ehciIsoList; + isoPointer = ehciInstance->ehciIsoList; ehciInstance->ehciIsoList = ehciInstance->ehciIsoList->next; USB_HostEhciUnlock(); isoPointer->lastLinkFrame = 0xFFFF; - ehciPipePointer->ehciQh = isoPointer; + ehciPipePointer->ehciQh = isoPointer; return status; } @@ -3282,32 +3231,31 @@ static usb_status_t USB_HostEhciOpenIso(usb_host_ehci_instance_t *ehciInstance, static usb_status_t USB_HostEhciCloseIso(usb_host_ehci_instance_t *ehciInstance, usb_host_ehci_pipe_t *ehciPipePointer) { usb_host_ehci_iso_t *isoPointer; - uint32_t speed = 0U; + uint32_t speed; isoPointer = (usb_host_ehci_iso_t *)ehciPipePointer->ehciQh; if (isoPointer->ehciTransferHead != NULL) { - (void)USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, - (uint32_t)kUSB_HostGetDeviceSpeed, &speed); + USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, kUSB_HostGetDeviceSpeed, + &speed); if (speed == USB_SPEED_HIGH) { #if ((defined USB_HOST_CONFIG_EHCI_MAX_ITD) && (USB_HOST_CONFIG_EHCI_MAX_ITD)) - (void)USB_HostEhciItdArrayDeinit(ehciInstance, ehciPipePointer); /* de-initialize itd list and free them */ + USB_HostEhciItdArrayDeinit(ehciInstance, ehciPipePointer); /* de-initialize itd list and free them */ #endif } else { #if ((defined USB_HOST_CONFIG_EHCI_MAX_SITD) && (USB_HOST_CONFIG_EHCI_MAX_SITD)) - (void)USB_HostEhciSitdArrayDeinit(ehciInstance, - ehciPipePointer); /* de-initialize sitd list and free them */ + USB_HostEhciSitdArrayDeinit(ehciInstance, ehciPipePointer); /* de-initialize sitd list and free them */ #endif } } /* release usb_host_ehci_iso_t */ USB_HostEhciLock(); - isoPointer->next = ehciInstance->ehciIsoList; + isoPointer->next = ehciInstance->ehciIsoList; ehciInstance->ehciIsoList = isoPointer; USB_HostEhciUnlock(); return kStatus_USB_Success; @@ -3319,17 +3267,17 @@ static usb_status_t USB_HostEhciResetIP(usb_host_ehci_instance_t *ehciInstance) { /* reset controller */ ehciInstance->ehciIpBase->USBCMD = USBHS_USBCMD_RST_MASK; - while (0U != (ehciInstance->ehciIpBase->USBCMD & USBHS_USBCMD_RST_MASK)) + while (ehciInstance->ehciIpBase->USBCMD & USBHS_USBCMD_RST_MASK) { } /* set host mode */ #if (ENDIANNESS == USB_LITTLE_ENDIAN) - ehciInstance->ehciIpBase->USBMODE |= 0x03U; + ehciInstance->ehciIpBase->USBMODE |= 0x03; #else - ehciInstance->ehciIpBase->USBMODE |= (0x03U | (0x01U << USBHS_USBMODE_ES_SHIFT)); + ehciInstance->ehciIpBase->USBMODE |= (0x03 | (0x01 << USBHS_USBMODE_ES_SHIFT)); #endif /* check frame list size */ - if (0U == (ehciInstance->ehciIpBase->HCCPARAMS & USBHS_HCCPARAMS_PFL_MASK)) + if (!(ehciInstance->ehciIpBase->HCCPARAMS & USBHS_HCCPARAMS_PFL_MASK)) { #if ((USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE < 8) || (USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE > 1024)) return kStatus_USB_Error; @@ -3345,7 +3293,7 @@ static usb_status_t USB_HostEhciStartIP(usb_host_ehci_instance_t *ehciInstance) { uint32_t tmp = 0; - if (0U != (ehciInstance->ehciIpBase->HCSPARAMS & USBHS_HCSPARAMS_PPC_MASK)) /* Ports have power port switches */ + if (ehciInstance->ehciIpBase->HCSPARAMS & USBHS_HCSPARAMS_PPC_MASK) /* Ports have power port switches */ { /* only has one port */ tmp = ehciInstance->ehciIpBase->PORTSC1; @@ -3354,41 +3302,41 @@ static usb_status_t USB_HostEhciStartIP(usb_host_ehci_instance_t *ehciInstance) } /* set frame list size */ - if (0U != (ehciInstance->ehciIpBase->HCCPARAMS & USBHS_HCCPARAMS_PFL_MASK)) + if (ehciInstance->ehciIpBase->HCCPARAMS & USBHS_HCCPARAMS_PFL_MASK) { #if (USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE <= 64) ehciInstance->ehciIpBase->USBCMD |= (USBHS_USBCMD_FS2_MASK); #if (USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE == 64) - ehciInstance->ehciIpBase->USBCMD |= (0x00U << USBHS_USBCMD_FS_SHIFT); -#elif (USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE == 32) - ehciInstance->ehciIpBase->USBCMD |= (0x01U << USBHS_USBCMD_FS_SHIFT); -#elif (USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE == 16) - ehciInstance->ehciIpBase->USBCMD |= (0x02U << USBHS_USBCMD_FS_SHIFT); -#elif (USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE == 8) - ehciInstance->ehciIpBase->USBCMD |= (0x03U << USBHS_USBCMD_FS_SHIFT); + ehciInstance->ehciIpBase->USBCMD |= (0x00 << USBHS_USBCMD_FS_SHIFT); +#elif(USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE == 32) + ehciInstance->ehciIpBase->USBCMD |= (0x01 << USBHS_USBCMD_FS_SHIFT); +#elif(USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE == 16) + ehciInstance->ehciIpBase->USBCMD |= (0x02 << USBHS_USBCMD_FS_SHIFT); +#elif(USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE == 8) + ehciInstance->ehciIpBase->USBCMD |= (0x03 << USBHS_USBCMD_FS_SHIFT); #endif #else #if (USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE == 1024) - ehciInstance->ehciIpBase->USBCMD |= (0x00U << USBHS_USBCMD_FS_SHIFT); -#elif (USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE == 512) - ehciInstance->ehciIpBase->USBCMD |= (0x01U << USBHS_USBCMD_FS_SHIFT); -#elif (USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE == 256) - ehciInstance->ehciIpBase->USBCMD |= (0x02U << USBHS_USBCMD_FS_SHIFT); -#elif (USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE == 128) - ehciInstance->ehciIpBase->USBCMD |= (0x03U << USBHS_USBCMD_FS_SHIFT); + ehciInstance->ehciIpBase->USBCMD |= (0x00 << USBHS_USBCMD_FS_SHIFT); +#elif(USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE == 512) + ehciInstance->ehciIpBase->USBCMD |= (0x01 << USBHS_USBCMD_FS_SHIFT); +#elif(USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE == 256) + ehciInstance->ehciIpBase->USBCMD |= (0x02 << USBHS_USBCMD_FS_SHIFT); +#elif(USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE == 128) + ehciInstance->ehciIpBase->USBCMD |= (0x03 << USBHS_USBCMD_FS_SHIFT); #endif #endif } /* start the controller */ - ehciInstance->ehciIpBase->USBCMD |= USBHS_USBCMD_RS_MASK; + ehciInstance->ehciIpBase->USBCMD = USBHS_USBCMD_RS_MASK; /* set timer0 */ - ehciInstance->ehciIpBase->GPTIMER0LD = (100U * 1000U - 1U); /* 100ms */ + ehciInstance->ehciIpBase->GPTIMER0LD = (300 * 1000 - 1); /* 100ms */ /* enable interrupt (USB interrupt enable + USB error interrupt enable + port change detect enable + system error * enable + interrupt on async advance enable) + general purpos Timer 0 Interrupt enable */ - ehciInstance->ehciIpBase->USBINTR |= (0x1000037U); + ehciInstance->ehciIpBase->USBINTR |= (0x1000037); return kStatus_USB_Success; } @@ -3401,7 +3349,7 @@ static usb_status_t USB_HostEhciCancelPipe(usb_host_ehci_instance_t *ehciInstanc #if (((defined USB_HOST_CONFIG_EHCI_MAX_ITD) && (USB_HOST_CONFIG_EHCI_MAX_ITD)) || \ ((defined USB_HOST_CONFIG_EHCI_MAX_SITD) && (USB_HOST_CONFIG_EHCI_MAX_SITD))) usb_host_ehci_iso_t *isoPointer; - uint32_t speed = 0U; + uint32_t speed; #endif uint8_t cancelPipe = 0; @@ -3420,24 +3368,24 @@ static usb_status_t USB_HostEhciCancelPipe(usb_host_ehci_instance_t *ehciInstanc if ((qhPointer->ehciTransferHead == transfer) && (qhPointer->ehciTransferHead == qhPointer->ehciTransferTail)) /* only has this one transfer */ { - cancelPipe = 1U; + cancelPipe = 1; } else { - cancelPipe = 0U; + cancelPipe = 0; } } else { - cancelPipe = 1U; + cancelPipe = 1; } - if (cancelPipe == 1U) /* cancel all pipe */ + if (cancelPipe == 1) /* cancel all pipe */ { - (void)USB_HostEhciQhQtdListDeinit(ehciInstance, ehciPipePointer); /* release all the qtd */ + USB_HostEhciQhQtdListDeinit(ehciInstance, ehciPipePointer); /* release all the qtd */ } else /* cancel one transfer */ { - (void)USB_HostEhciTransferQtdListDeinit(ehciInstance, ehciPipePointer, transfer); + USB_HostEhciTransferQtdListDeinit(ehciInstance, ehciPipePointer, transfer); } break; @@ -3450,55 +3398,54 @@ static usb_status_t USB_HostEhciCancelPipe(usb_host_ehci_instance_t *ehciInstanc return kStatus_USB_Success; } /* cancel all pipe, don't implement canceling transfer for iso */ - (void)USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, - (uint32_t)kUSB_HostGetDeviceSpeed, &speed); + USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, kUSB_HostGetDeviceSpeed, + &speed); if (speed == USB_SPEED_HIGH) { #if ((defined USB_HOST_CONFIG_EHCI_MAX_ITD) && (USB_HOST_CONFIG_EHCI_MAX_ITD)) - (void)USB_HostEhciItdArrayDeinit(ehciInstance, ehciPipePointer); /* de-initialize itd */ + USB_HostEhciItdArrayDeinit(ehciInstance, ehciPipePointer); /* de-initialize itd */ #endif } else { #if ((defined USB_HOST_CONFIG_EHCI_MAX_SITD) && (USB_HOST_CONFIG_EHCI_MAX_SITD)) - (void)USB_HostEhciSitdArrayDeinit(ehciInstance, ehciPipePointer); /* de-initialize sitd */ + USB_HostEhciSitdArrayDeinit(ehciInstance, ehciPipePointer); /* de-initialize sitd */ #endif } break; #endif default: - /*no action*/ break; } return kStatus_USB_Success; } -usb_status_t USB_HostEhciControlBus(usb_host_ehci_instance_t *ehciInstance, uint8_t busControl) +static usb_status_t USB_HostEhciControlBus(usb_host_ehci_instance_t *ehciInstance, uint8_t busControl) { usb_status_t status = kStatus_USB_Success; uint32_t portScRegister; - usb_host_bus_control_t controlCode = (usb_host_bus_control_t)busControl; - switch (controlCode) + + switch (busControl) { case kUSB_HostBusReset: /* reset port */ portScRegister = ehciInstance->ehciIpBase->PORTSC1; portScRegister &= (~EHCI_PORTSC1_W1_BITS); ehciInstance->ehciIpBase->PORTSC1 = (portScRegister | USBHS_PORTSC1_PR_MASK); - while (0U != (ehciInstance->ehciIpBase->PORTSC1 & USBHS_PORTSC1_PR_MASK)) + while (ehciInstance->ehciIpBase->PORTSC1 & USBHS_PORTSC1_PR_MASK) { } break; case kUSB_HostBusRestart: - ehciInstance->deviceAttached = (uint8_t)kEHCIDeviceDetached; + ehciInstance->deviceAttached = kEHCIDeviceDetached; ehciInstance->ehciIpBase->USBINTR |= (USBHS_USBINTR_PCE_MASK); /* enable ehci port change interrupt */ break; case kUSB_HostBusEnableAttach: /* enable device attach */ - if (ehciInstance->deviceAttached == (uint8_t)kEHCIDeviceDetached) + if (ehciInstance->deviceAttached == kEHCIDeviceDetached) { ehciInstance->ehciIpBase->USBINTR |= (USBHS_USBINTR_PCE_MASK); /* enable ehci port change interrupt */ } @@ -3509,7 +3456,7 @@ usb_status_t USB_HostEhciControlBus(usb_host_ehci_instance_t *ehciInstance, uint break; #if ((defined(USB_HOST_CONFIG_LOW_POWER_MODE)) && (USB_HOST_CONFIG_LOW_POWER_MODE > 0U)) case kUSB_HostBusSuspend: - if (0U != (ehciInstance->ehciIpBase->PORTSC1 & USBHS_PORTSC1_CCS_MASK)) + if (ehciInstance->ehciIpBase->PORTSC1 && USBHS_PORTSC1_CCS_MASK) { /* set timer1 */ ehciInstance->ehciIpBase->GPTIMER1LD = (1 * 1000); /* 1ms */ @@ -3518,9 +3465,9 @@ usb_status_t USB_HostEhciControlBus(usb_host_ehci_instance_t *ehciInstance, uint USB_HostEhciStopAsync(ehciInstance); USB_HostEhciStopPeriodic(ehciInstance); - while (0U != (ehciInstance->ehciIpBase->USBSTS & (USBHS_USBSTS_PS_MASK | USBHS_USBSTS_AS_MASK))) + while (ehciInstance->ehciIpBase->USBSTS & (USBHS_USBSTS_PS_MASK | USBHS_USBSTS_AS_MASK)) { - __NOP(); + __ASM("nop"); } ehciInstance->ehciIpBase->PORTSC1 &= ~USBHS_PORTSC1_WKCN_MASK; ehciInstance->ehciIpBase->PORTSC1 |= USBHS_PORTSC1_WKDS_MASK; @@ -3538,7 +3485,7 @@ usb_status_t USB_HostEhciControlBus(usb_host_ehci_instance_t *ehciInstance, uint case kUSB_HostBusResume: ehciInstance->ehciIpBase->PORTSC1 &= ~(USBHS_PORTSC1_SUSP_MASK); /* Clear Suspend bit */ ehciInstance->ehciIpBase->PORTSC1 &= ~USBHS_PORTSC1_PHCD_MASK; - if (ehciInstance->deviceAttached != (uint8_t)kEHCIDeviceDetached) + if (ehciInstance->deviceAttached != kEHCIDeviceDetached) { ehciInstance->busSuspendStatus = kBus_EhciStartResume; #if (defined(FSL_FEATURE_SOC_USBNC_COUNT) && (FSL_FEATURE_SOC_USBNC_COUNT > 0U)) @@ -3585,9 +3532,6 @@ void USB_HostEhciTransactionDone(usb_host_ehci_instance_t *ehciInstance) uint32_t dataLength; uint32_t speed; #endif - void *temp; - uint32_t transferResults; - uint32_t transferOverlayResults; ehciPipePointer = ehciInstance->ehciRunningPipeList; /* check all the running pipes */ while (ehciPipePointer != NULL) @@ -3598,45 +3542,43 @@ void USB_HostEhciTransactionDone(usb_host_ehci_instance_t *ehciInstance) case USB_ENDPOINT_INTERRUPT: case USB_ENDPOINT_CONTROL: vltQhPointer = (volatile usb_host_ehci_qh_t *)ehciPipePointer->ehciQh; /* pipe's qh */ - transfer = vltQhPointer->ehciTransferHead; /* qh's transfer */ + transfer = vltQhPointer->ehciTransferHead; /* qh's transfer */ while (transfer != NULL) { nextTransfer = transfer->next; /* normal case */ - vltQtdPointer = (volatile usb_host_ehci_qtd_t *)transfer->union2.unitTail; - transferResults = vltQtdPointer->transferResults[0]; - transferOverlayResults = vltQhPointer->transferOverlayResults[0]; - if ((0U != (transferResults & (EHCI_HOST_QTD_IOC_MASK))) && - (0U == (transferResults & EHCI_HOST_QTD_STATUS_ACTIVE_MASK))) /* transfer is done */ + vltQtdPointer = (volatile usb_host_ehci_qtd_t *)transfer->union2.unitTail; + if ((vltQtdPointer->transferResults[0] & (EHCI_HOST_QTD_IOC_MASK)) && + (!(vltQtdPointer->transferResults[0] & + EHCI_HOST_QTD_STATUS_ACTIVE_MASK))) /* transfer is done */ { - qtdStatus = (transferResults & EHCI_HOST_QTD_STATUS_ERROR_MASK); + qtdStatus = (vltQtdPointer->transferResults[0] & EHCI_HOST_QTD_STATUS_ERROR_MASK); transfer->transferSofar = USB_HostEhciQtdListRelease(ehciInstance, (usb_host_ehci_qtd_t *)(transfer->union1.unitHead), (usb_host_ehci_qtd_t *)(transfer->union2.unitTail)); transfer->transferSofar = (transfer->transferLength < transfer->transferSofar) ? - 0U : + 0 : (transfer->transferLength - transfer->transferSofar); vltQhPointer->ehciTransferHead = transfer->next; - vltQhPointer->timeOutLabel = 0U; - vltQhPointer->timeOutValue = USB_HOST_EHCI_CONTROL_BULK_TIME_OUT_VALUE; - if (0U != qtdStatus) /* has errors */ + vltQhPointer->timeOutLabel = 0; + vltQhPointer->timeOutValue = USB_HOST_EHCI_CONTROL_BULK_TIME_OUT_VALUE; + if (qtdStatus) /* has errors */ { - if (0U == (transferOverlayResults & EHCI_HOST_QTD_STATUS_ACTIVE_MASK)) + if (!(vltQhPointer->transferOverlayResults[0] & EHCI_HOST_QTD_STATUS_ACTIVE_MASK)) { vltQhPointer->transferOverlayResults[0] &= (~EHCI_HOST_QTD_STATUS_MASK); /* clear error status */ } - if (0U != (qtdStatus & EHCI_HOST_QH_STATUS_NOSTALL_ERROR_MASK)) + if (qtdStatus & EHCI_HOST_QH_STATUS_NOSTALL_ERROR_MASK) { - /* callback function is different from the current condition */ transfer->callbackFn(transfer->callbackParam, transfer, kStatus_USB_TransferFailed); /* transfer fail */ } else { - /* callback function is different from the current condition */ - transfer->callbackFn(transfer->callbackParam, transfer, kStatus_USB_TransferStall); + transfer->callbackFn(transfer->callbackParam, transfer, + kStatus_USB_TransferStall); /* transfer stall */ } } else @@ -3660,8 +3602,8 @@ void USB_HostEhciTransactionDone(usb_host_ehci_instance_t *ehciInstance) { break; } - temp = (void *)ehciClearPipePointer->pipeCommon.next; - ehciClearPipePointer = (usb_host_ehci_pipe_t *)temp; + ehciClearPipePointer = + (usb_host_ehci_pipe_t *)ehciClearPipePointer->pipeCommon.next; } if ((ehciClearPipePointer != NULL) && @@ -3672,19 +3614,18 @@ void USB_HostEhciTransactionDone(usb_host_ehci_instance_t *ehciInstance) ->transferOverlayResults[0] &= (~EHCI_HOST_QTD_DT_MASK); } } - /* callback function is different from the current condition */ transfer->callbackFn(transfer->callbackParam, transfer, kStatus_USB_Success); /* transfer success */ } } - else if ((0U == (transferOverlayResults & EHCI_HOST_QTD_STATUS_ACTIVE_MASK)) && - (0U != (transferOverlayResults & - EHCI_HOST_QH_STATUS_ERROR_MASK))) /* there is error and transfer is done */ + else if ((!(vltQhPointer->transferOverlayResults[0] & EHCI_HOST_QTD_STATUS_ACTIVE_MASK)) && + (vltQhPointer->transferOverlayResults[0] & + EHCI_HOST_QH_STATUS_ERROR_MASK)) /* there is error and transfer is done */ { - qtdStatus = (vltQhPointer->transferOverlayResults[0] & EHCI_HOST_QH_STATUS_ERROR_MASK); + qtdStatus = (vltQhPointer->transferOverlayResults[0] & EHCI_HOST_QH_STATUS_ERROR_MASK); vltQtdPointer = (volatile usb_host_ehci_qtd_t *)(vltQhPointer->currentQtdPointer); - if ((0U != ((uint32_t)vltQtdPointer & EHCI_HOST_T_INVALID_VALUE)) || + if (((uint32_t)vltQtdPointer & EHCI_HOST_T_INVALID_VALUE) || (vltQtdPointer == NULL)) /* the error status is unreasonable */ { vltQhPointer->transferOverlayResults[0] &= @@ -3693,13 +3634,13 @@ void USB_HostEhciTransactionDone(usb_host_ehci_instance_t *ehciInstance) else { /* remove qtd from qh */ - while ((vltQtdPointer != NULL) && - (0U == (transferResults & EHCI_HOST_QTD_IOC_MASK))) /* find the IOC qtd */ + while ((vltQtdPointer != NULL) && (!(vltQtdPointer->transferResults[0] & + EHCI_HOST_QTD_IOC_MASK))) /* find the IOC qtd */ { vltQtdPointer = (volatile usb_host_ehci_qtd_t *)vltQtdPointer->nextQtdPointer; } - vltQhPointer->nextQtdPointer = EHCI_HOST_T_INVALID_VALUE; + vltQhPointer->nextQtdPointer = EHCI_HOST_T_INVALID_VALUE; vltQhPointer->currentQtdPointer = EHCI_HOST_T_INVALID_VALUE; vltQhPointer->transferOverlayResults[0] &= (~EHCI_HOST_QTD_STATUS_MASK); /* clear error status */ @@ -3712,20 +3653,18 @@ void USB_HostEhciTransactionDone(usb_host_ehci_instance_t *ehciInstance) ehciInstance, (usb_host_ehci_qtd_t *)(transfer->union1.unitHead), (usb_host_ehci_qtd_t *)(transfer->union2.unitTail)); transfer->transferSofar = (transfer->transferLength < transfer->transferSofar) ? - 0U : + 0 : (transfer->transferLength - transfer->transferSofar); vltQhPointer->ehciTransferHead = transfer->next; - vltQhPointer->timeOutLabel = 0U; - vltQhPointer->timeOutValue = USB_HOST_EHCI_CONTROL_BULK_TIME_OUT_VALUE; - if (0U != (qtdStatus & EHCI_HOST_QH_STATUS_NOSTALL_ERROR_MASK)) + vltQhPointer->timeOutLabel = 0; + vltQhPointer->timeOutValue = USB_HOST_EHCI_CONTROL_BULK_TIME_OUT_VALUE; + if (qtdStatus & EHCI_HOST_QH_STATUS_NOSTALL_ERROR_MASK) { - /* callback function is different from the current condition */ transfer->callbackFn(transfer->callbackParam, transfer, kStatus_USB_TransferFailed); /* transfer fail */ } else { - /* callback function is different from the current condition */ transfer->callbackFn(transfer->callbackParam, transfer, kStatus_USB_TransferStall); /* transfer stall */ } @@ -3741,42 +3680,41 @@ void USB_HostEhciTransactionDone(usb_host_ehci_instance_t *ehciInstance) #if (((defined USB_HOST_CONFIG_EHCI_MAX_ITD) && (USB_HOST_CONFIG_EHCI_MAX_ITD)) || \ ((defined USB_HOST_CONFIG_EHCI_MAX_SITD) && (USB_HOST_CONFIG_EHCI_MAX_SITD))) case USB_ENDPOINT_ISOCHRONOUS: - qtdStatus = 0; /* qtdStatus means break here, because there is only one break in while for misra */ + qtdStatus = 0; /* qtdStatus means break here, because there is only one break in while for misra */ isoPointer = (usb_host_ehci_iso_t *)ehciPipePointer->ehciQh; /* pipe's usb_host_ehci_iso_t */ - transfer = isoPointer->ehciTransferHead; /* usb_host_ehci_iso_t's transfer */ + transfer = isoPointer->ehciTransferHead; /* usb_host_ehci_iso_t's transfer */ while (transfer != NULL) { nextTransfer = transfer->next; - (void)USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, - (uint32_t)kUSB_HostGetDeviceSpeed, &speed); + USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, + kUSB_HostGetDeviceSpeed, &speed); if (speed == USB_SPEED_HIGH) { #if ((defined USB_HOST_CONFIG_EHCI_MAX_ITD) && (USB_HOST_CONFIG_EHCI_MAX_ITD)) vltItdPointer = (volatile usb_host_ehci_itd_t *)(transfer->union2.unitTail); /* transfer's last itd */ - for (index = 0; index < 8U; ++index) + for (index = 0; index < 8; ++index) { - if (0U != (vltItdPointer->transactions[index] & EHCI_HOST_ITD_STATUS_ACTIVE_MASK)) + if (vltItdPointer->transactions[index] & EHCI_HOST_ITD_STATUS_ACTIVE_MASK) { break; } } - if (index == 8U) /* transfer is done */ + if (index == 8) /* transfer is done */ { /* remove itd from frame list and release itd */ - dataLength = USB_HostEhciItdArrayRelease(ehciInstance, + dataLength = USB_HostEhciItdArrayRelease(ehciInstance, (usb_host_ehci_itd_t *)transfer->union1.unitHead, (usb_host_ehci_itd_t *)transfer->union2.unitTail); - transfer->transferSofar = dataLength; + transfer->transferSofar = dataLength; isoPointer->ehciTransferHead = transfer->next; - /* callback function is different from the current condition */ transfer->callbackFn(transfer->callbackParam, transfer, kStatus_USB_Success); /* transfer callback success */ /* TODO: iso callback error */ } else { - qtdStatus = 1U; /* break */ + qtdStatus = 1; /* break */ } #endif } @@ -3785,27 +3723,26 @@ void USB_HostEhciTransactionDone(usb_host_ehci_instance_t *ehciInstance) #if ((defined USB_HOST_CONFIG_EHCI_MAX_SITD) && (USB_HOST_CONFIG_EHCI_MAX_SITD)) vltSitdPointer = (volatile usb_host_ehci_sitd_t *)(transfer->union2.unitTail); /* transfer's last sitd */ - if (0U == (vltSitdPointer->transferResults[0] & - EHCI_HOST_SITD_STATUS_ACTIVE_MASK)) /* transfer is done */ + if (!(vltSitdPointer->transferResults[0] & + EHCI_HOST_SITD_STATUS_ACTIVE_MASK)) /* transfer is done */ { /* remove sitd from frame list and release itd */ dataLength = USB_HostEhciSitdArrayRelease( ehciInstance, (usb_host_ehci_sitd_t *)transfer->union1.unitHead, (usb_host_ehci_sitd_t *)transfer->union2.unitTail); - transfer->transferSofar = transfer->transferLength - dataLength; + transfer->transferSofar = dataLength; isoPointer->ehciTransferHead = transfer->next; - /* callback function is different from the current condition */ transfer->callbackFn(transfer->callbackParam, transfer, kStatus_USB_Success); /* transfer callback success */ /* TODO: iso callback error */ } else { - qtdStatus = 1U; /* break */ + qtdStatus = 1; /* break */ } #endif } - if (qtdStatus == 1U) + if (qtdStatus == 1) { break; } @@ -3815,40 +3752,38 @@ void USB_HostEhciTransactionDone(usb_host_ehci_instance_t *ehciInstance) #endif default: - /*no action*/ break; } - temp = (void *)ehciPipePointer->pipeCommon.next; - ehciPipePointer = (usb_host_ehci_pipe_t *)temp; + ehciPipePointer = (usb_host_ehci_pipe_t *)ehciPipePointer->pipeCommon.next; } } -void USB_HostEhciPortChange(usb_host_ehci_instance_t *ehciInstance) +static void USB_HostEhciPortChange(usb_host_ehci_instance_t *ehciInstance) { /* note: only has one port */ uint32_t portScRegister = ehciInstance->ehciIpBase->PORTSC1; - uint32_t sofStart = 0; - uint32_t sofCount = 0; + int32_t sofStart = 0; + int32_t sofCount = 0; uint32_t index; - if (0U != (portScRegister & USBHS_PORTSC1_CSC_MASK)) /* connection status change */ + if (portScRegister & USBHS_PORTSC1_CSC_MASK) /* connection status change */ { - sofStart = (ehciInstance->ehciIpBase->FRINDEX & EHCI_MAX_UFRAME_VALUE); + sofStart = (int32_t)(ehciInstance->ehciIpBase->FRINDEX & EHCI_MAX_UFRAME_VALUE); /* process CSC bit */ - while (1U == 1U) + while (1) { portScRegister = ehciInstance->ehciIpBase->PORTSC1; - if (0U != (portScRegister & USBHS_PORTSC1_CSC_MASK)) + if (portScRegister & USBHS_PORTSC1_CSC_MASK) { /* clear csc bit */ portScRegister = ehciInstance->ehciIpBase->PORTSC1; portScRegister &= (~EHCI_PORTSC1_W1_BITS); ehciInstance->ehciIpBase->PORTSC1 = (portScRegister | USBHS_PORTSC1_CSC_MASK); } - sofCount = (ehciInstance->ehciIpBase->FRINDEX & EHCI_MAX_UFRAME_VALUE); - if (((sofCount + EHCI_MAX_UFRAME_VALUE + 1U - sofStart) & EHCI_MAX_UFRAME_VALUE) > - (1U * 8U)) /* delay 1ms to clear CSC */ + sofCount = (int32_t)(ehciInstance->ehciIpBase->FRINDEX & EHCI_MAX_UFRAME_VALUE); + if (((sofCount - sofStart + EHCI_MAX_UFRAME_VALUE + 1) & EHCI_MAX_UFRAME_VALUE) > + (1 * 8)) /* delay 1ms to clear CSC */ { break; } @@ -3857,10 +3792,10 @@ void USB_HostEhciPortChange(usb_host_ehci_instance_t *ehciInstance) /* process CCS bit */ portScRegister = ehciInstance->ehciIpBase->PORTSC1; - if (0U != (portScRegister & USBHS_PORTSC1_CCS_MASK)) /* process attach */ + if (portScRegister & USBHS_PORTSC1_CCS_MASK) /* process attach */ { - if ((ehciInstance->deviceAttached == (uint8_t)kEHCIDevicePhyAttached) || - (ehciInstance->deviceAttached == (uint8_t)kEHCIDeviceAttached)) + if ((ehciInstance->deviceAttached == kEHCIDevicePhyAttached) || + (ehciInstance->deviceAttached == kEHCIDeviceAttached)) { return; } @@ -3871,25 +3806,25 @@ void USB_HostEhciPortChange(usb_host_ehci_instance_t *ehciInstance) for (index = 0; index < USB_HOST_EHCI_PORT_CONNECT_DEBOUNCE_DELAY; ++index) { USB_HostEhciDelay(ehciInstance->ehciIpBase, 1); - if (0U == (ehciInstance->ehciIpBase->PORTSC1 & USBHS_PORTSC1_CCS_MASK)) + if (!(ehciInstance->ehciIpBase->PORTSC1 & USBHS_PORTSC1_CCS_MASK)) { break; } } if (index < USB_HOST_EHCI_PORT_CONNECT_DEBOUNCE_DELAY) /* CCS is cleared */ { - ehciInstance->deviceAttached = (uint8_t)kEHCIDeviceDetached; + ehciInstance->deviceAttached = kEHCIDeviceDetached; return; } /* reset port */ portScRegister = ehciInstance->ehciIpBase->PORTSC1; portScRegister &= (~EHCI_PORTSC1_W1_BITS); ehciInstance->ehciIpBase->PORTSC1 = (portScRegister | USBHS_PORTSC1_PR_MASK); - while (0U != (ehciInstance->ehciIpBase->PORTSC1 & USBHS_PORTSC1_PR_MASK)) + while (ehciInstance->ehciIpBase->PORTSC1 & USBHS_PORTSC1_PR_MASK) { } ehciInstance->firstDeviceSpeed = - (uint8_t)((ehciInstance->ehciIpBase->PORTSC1 & USBHS_PORTSC1_PSPD_MASK) >> USBHS_PORTSC1_PSPD_SHIFT); + ((ehciInstance->ehciIpBase->PORTSC1 & USBHS_PORTSC1_PSPD_MASK) >> USBHS_PORTSC1_PSPD_SHIFT); /* enable ehci phy disconnection */ if (ehciInstance->firstDeviceSpeed == USB_SPEED_HIGH) { @@ -3899,16 +3834,16 @@ void USB_HostEhciPortChange(usb_host_ehci_instance_t *ehciInstance) /* wait for reset */ USB_HostEhciDelay(ehciInstance->ehciIpBase, USB_HOST_EHCI_PORT_RESET_DELAY); /* process attach */ - (void)OSA_EventSet(ehciInstance->taskEventHandle, EHCI_TASK_EVENT_DEVICE_ATTACH); + USB_OsaEventSet(ehciInstance->taskEventHandle, EHCI_TASK_EVENT_DEVICE_ATTACH); /* gpt timer start */ ehciInstance->ehciIpBase->GPTIMER0CTL |= (USBHS_GPTIMER0CTL_RUN_MASK | USBHS_GPTIMER0CTL_MODE_MASK | USBHS_GPTIMER0CTL_RST_MASK); - ehciInstance->deviceAttached = (uint8_t)kEHCIDevicePhyAttached; + ehciInstance->deviceAttached = kEHCIDevicePhyAttached; } else { - if ((ehciInstance->deviceAttached == (uint8_t)kEHCIDevicePhyAttached) || - (ehciInstance->deviceAttached == (uint8_t)kEHCIDeviceAttached)) + if ((ehciInstance->deviceAttached == kEHCIDevicePhyAttached) || + (ehciInstance->deviceAttached == kEHCIDeviceAttached)) { #if ((defined(USB_HOST_CONFIG_LOW_POWER_MODE)) && (USB_HOST_CONFIG_LOW_POWER_MODE > 0U)) ehciInstance->busSuspendStatus = kBus_EhciIdle; @@ -3919,20 +3854,19 @@ void USB_HostEhciPortChange(usb_host_ehci_instance_t *ehciInstance) /* disable async and periodic */ USB_HostEhciStopAsync(ehciInstance); USB_HostEhciStopPeriodic(ehciInstance); - (void)OSA_EventSet(ehciInstance->taskEventHandle, EHCI_TASK_EVENT_DEVICE_DETACH); + USB_OsaEventSet(ehciInstance->taskEventHandle, EHCI_TASK_EVENT_DEVICE_DETACH); } } } -void USB_HostEhciTimer0(usb_host_ehci_instance_t *ehciInstance) +static void USB_HostEhciTimer0(usb_host_ehci_instance_t *ehciInstance) { volatile usb_host_ehci_qh_t *vltQhPointer; - usb_host_ehci_qtd_t *vltQtdPointer; + volatile usb_host_ehci_qtd_t *vltQtdPointer; usb_host_transfer_t *transfer; uint32_t backValue; - volatile uint32_t *totalBytesAddress = NULL; + volatile uint32_t *totalBytesAddress = NULL; usb_host_ehci_pipe_t *ehciPipePointer = ehciInstance->ehciRunningPipeList; - void *temp; uint8_t timeoutLabel; while (ehciPipePointer != NULL) @@ -3942,13 +3876,13 @@ void USB_HostEhciTimer0(usb_host_ehci_instance_t *ehciInstance) case USB_ENDPOINT_BULK: case USB_ENDPOINT_CONTROL: vltQhPointer = (volatile usb_host_ehci_qh_t *)ehciPipePointer->ehciQh; /* pipe's qh */ - transfer = vltQhPointer->ehciTransferHead; /* qh's transfer */ + transfer = vltQhPointer->ehciTransferHead; /* qh's transfer */ if ((transfer != NULL)) /* there is transfering data */ { - timeoutLabel = 0U; - if (ehciInstance->deviceAttached != (uint8_t)kEHCIDeviceAttached) + timeoutLabel = 0; + if (ehciInstance->deviceAttached != kEHCIDeviceAttached) { - vltQtdPointer = (usb_host_ehci_qtd_t *)transfer->union2.unitTail; + vltQtdPointer = (volatile usb_host_ehci_qtd_t *)transfer->union2.unitTail; vltQhPointer->nextQtdPointer = EHCI_HOST_T_INVALID_VALUE; /* invalid next qtd */ vltQhPointer->transferOverlayResults[0] &= @@ -3957,15 +3891,15 @@ void USB_HostEhciTimer0(usb_host_ehci_instance_t *ehciInstance) } else { - if (0U != (vltQhPointer->transferOverlayResults[0] & EHCI_HOST_QTD_STATUS_ACTIVE_MASK)) + if (vltQhPointer->transferOverlayResults[0] & EHCI_HOST_QTD_STATUS_ACTIVE_MASK) { - vltQtdPointer = (usb_host_ehci_qtd_t *)vltQhPointer->currentQtdPointer; + vltQtdPointer = (volatile usb_host_ehci_qtd_t *)vltQhPointer->currentQtdPointer; totalBytesAddress = &(vltQhPointer->transferOverlayResults[0]); } else { - vltQtdPointer = (usb_host_ehci_qtd_t *)transfer->union2.unitTail; - totalBytesAddress = &(vltQtdPointer->transferResults[0]); + vltQtdPointer = (volatile usb_host_ehci_qtd_t *)transfer->union2.unitTail; + totalBytesAddress = ((uint32_t *)vltQtdPointer + 2); } backValue = @@ -3974,7 +3908,7 @@ void USB_HostEhciTimer0(usb_host_ehci_instance_t *ehciInstance) if (vltQhPointer->timeOutLabel != backValue) /* use total bytes to reflect the time out */ { vltQhPointer->timeOutValue = USB_HOST_EHCI_CONTROL_BULK_TIME_OUT_VALUE; - vltQhPointer->timeOutLabel = (uint16_t)backValue; + vltQhPointer->timeOutLabel = backValue; } else { @@ -3982,7 +3916,7 @@ void USB_HostEhciTimer0(usb_host_ehci_instance_t *ehciInstance) * USB_HOST_EHCI_CONTROL_BULK_TIME_OUT_VALUE */ (vltQhPointer->timeOutValue)--; - if (vltQhPointer->timeOutValue == 0U) + if (vltQhPointer->timeOutValue == 0) { /* stop the qh schedule */ USB_HostEhciStopAsync(ehciInstance); @@ -3997,24 +3931,22 @@ void USB_HostEhciTimer0(usb_host_ehci_instance_t *ehciInstance) vltQhPointer->transferOverlayResults[0] &= (~EHCI_HOST_QTD_STATUS_MASK); /* clear error status */ USB_HostEhciStartAsync(ehciInstance); - timeoutLabel = 1U; + timeoutLabel = 1; } } } } - if (timeoutLabel == 1U) + if (timeoutLabel == 1) { /* remove qtd from qh */ - temp = (void *)vltQhPointer->ehciTransferTail; while ((vltQtdPointer != NULL) && - (0U == (vltQtdPointer->transferResults[0] & EHCI_HOST_QTD_IOC_MASK)) && - (vltQtdPointer != (usb_host_ehci_qtd_t *)temp)) + (!(vltQtdPointer->transferResults[0] & EHCI_HOST_QTD_IOC_MASK)) && + (vltQtdPointer != (usb_host_ehci_qtd_t *)vltQhPointer->ehciTransferTail)) { - vltQtdPointer = (usb_host_ehci_qtd_t *)vltQtdPointer->nextQtdPointer; + vltQtdPointer = (volatile usb_host_ehci_qtd_t *)vltQtdPointer->nextQtdPointer; } - if ((vltQtdPointer != NULL) && - (0U == (vltQtdPointer->nextQtdPointer & EHCI_HOST_T_INVALID_VALUE))) + if ((vltQtdPointer != NULL) && (!(vltQtdPointer->nextQtdPointer & EHCI_HOST_T_INVALID_VALUE))) { vltQhPointer->nextQtdPointer = vltQtdPointer->nextQtdPointer; /* start qh if there are other qtd that don't belong to @@ -4024,41 +3956,38 @@ void USB_HostEhciTimer0(usb_host_ehci_instance_t *ehciInstance) USB_HostEhciQtdListRelease(ehciInstance, (usb_host_ehci_qtd_t *)(transfer->union1.unitHead), (usb_host_ehci_qtd_t *)(transfer->union2.unitTail)); transfer->transferSofar = (transfer->transferLength < transfer->transferSofar) ? - 0U : + 0 : (transfer->transferLength - transfer->transferSofar); vltQhPointer->ehciTransferHead = transfer->next; - vltQhPointer->timeOutValue = USB_HOST_EHCI_CONTROL_BULK_TIME_OUT_VALUE; - /* callback function is different from the current condition */ + vltQhPointer->timeOutValue = USB_HOST_EHCI_CONTROL_BULK_TIME_OUT_VALUE; transfer->callbackFn(transfer->callbackParam, transfer, kStatus_USB_TransferFailed); } } break; default: - /*no action*/ break; } - temp = (void *)ehciPipePointer->pipeCommon.next; - ehciPipePointer = (usb_host_ehci_pipe_t *)temp; + ehciPipePointer = (usb_host_ehci_pipe_t *)ehciPipePointer->pipeCommon.next; } } #if ((defined(USB_HOST_CONFIG_LOW_POWER_MODE)) && (USB_HOST_CONFIG_LOW_POWER_MODE > 0U)) static void USB_HostEhciTimer1(usb_host_ehci_instance_t *ehciInstance) { - if (ehciInstance->deviceAttached != (uint8_t)kEHCIDeviceDetached) + if (ehciInstance->deviceAttached != kEHCIDeviceDetached) { if (kBus_EhciStartSuspend == ehciInstance->busSuspendStatus) { usb_host_instance_t *hostPointer = (usb_host_instance_t *)ehciInstance->hostHandle; - if (0U == ehciInstance->matchTick) + if (0 == ehciInstance->matchTick) { ehciInstance->matchTick = hostPointer->hwTick; } else { - if ((hostPointer->hwTick - ehciInstance->matchTick) >= 5U) + if ((hostPointer->hwTick - ehciInstance->matchTick) >= 5) { ehciInstance->ehciIpBase->USBCMD &= ~USBHS_USBCMD_RS_MASK; ehciInstance->ehciIpBase->USBSTS |= USBHS_USBSTS_SRI_MASK; @@ -4075,9 +4004,9 @@ static void USB_HostEhciTimer1(usb_host_ehci_instance_t *ehciInstance) ehciInstance->registerPhyBase->PWD = 0xFFFFFFFFU; - while (0U != (ehciInstance->registerPhyBase->CTRL & (USBPHY_CTRL_UTMI_SUSPENDM_MASK))) + while (ehciInstance->registerPhyBase->CTRL & (USBPHY_CTRL_UTMI_SUSPENDM_MASK)) { - __NOP(); + __ASM("nop"); } #if (defined(FSL_FEATURE_SOC_USBNC_COUNT) && (FSL_FEATURE_SOC_USBNC_COUNT > 0U)) @@ -4089,8 +4018,8 @@ static void USB_HostEhciTimer1(usb_host_ehci_instance_t *ehciInstance) ehciInstance->ehciIpBase->USBGENCTRL = USBHS_USBGENCTRL_WU_IE_MASK; #endif ehciInstance->registerPhyBase->CTRL |= USBPHY_CTRL_CLKGATE_MASK; - (void)hostPointer->deviceCallback(hostPointer->suspendedDevice, NULL, - kUSB_HostEventSuspended); /* call host callback function */ + hostPointer->deviceCallback(hostPointer->suspendedDevice, NULL, + kUSB_HostEventSuspended); /* call host callback function */ ehciInstance->busSuspendStatus = kBus_EhciSuspended; } } @@ -4098,17 +4027,17 @@ static void USB_HostEhciTimer1(usb_host_ehci_instance_t *ehciInstance) else if (kBus_EhciStartResume == ehciInstance->busSuspendStatus) { usb_host_instance_t *hostPointer = (usb_host_instance_t *)ehciInstance->hostHandle; - if (0U == (ehciInstance->ehciIpBase->PORTSC1 & USBHS_PORTSC1_FPR_MASK)) + if (!(ehciInstance->ehciIpBase->PORTSC1 & USBHS_PORTSC1_FPR_MASK)) { ehciInstance->ehciIpBase->PORTSC1 &= ~USBHS_PORTSC1_WKDS_MASK; - if (0U != (ehciInstance->ehciIpBase->PORTSC1 & USBHS_PORTSC1_CCS_MASK)) + if (ehciInstance->ehciIpBase->PORTSC1 & USBHS_PORTSC1_CCS_MASK) { USB_HostEhciStartAsync(ehciInstance); USB_HostEhciStartPeriodic(ehciInstance); } - (void)hostPointer->deviceCallback(hostPointer->suspendedDevice, NULL, - kUSB_HostEventResumed); /* call host callback function */ - hostPointer->suspendedDevice = NULL; + hostPointer->deviceCallback(hostPointer->suspendedDevice, NULL, + kUSB_HostEventResumed); /* call host callback function */ + hostPointer->suspendedDevice = NULL; ehciInstance->busSuspendStatus = kBus_EhciIdle; ehciInstance->ehciIpBase->USBINTR &= ~(USBHS_USBINTR_TIE1_MASK); } @@ -4130,31 +4059,30 @@ usb_status_t USB_HostEhciCreate(uint8_t controllerId, usb_host_controller_handle *controllerHandle) { uint32_t index = 0; - osa_status_t osaStatus; + usb_osa_status_t osaStatus; usb_host_ehci_instance_t *ehciInstance; uint32_t usbhsBaseAddrs[] = USBHS_BASE_ADDRS; - usb_host_ehci_data_t *usbHostEhciData[USB_HOST_CONFIG_EHCI]; + usb_host_ehci_data_t *usbHostEhciData[] = USB_HOST_EHCI_DATA_ARRAY; + uint8_t *usbHostEhciFrameList[] = USB_HOST_EHCI_FRAME_LIST_ARRAY; uint32_t *framePointer; - void *temp; - uint8_t instanceIndex = 0U; - if ((controllerId - (uint8_t)kUSB_ControllerEhci0) >= (sizeof(usbhsBaseAddrs) / sizeof(usbhsBaseAddrs[0]))) + if ((uint32_t)(controllerId - kUSB_ControllerEhci0) >= (sizeof(usbhsBaseAddrs) / sizeof(usbhsBaseAddrs[0]))) { return kStatus_USB_ControllerNotFound; } *controllerHandle = NULL; - ehciInstance = (usb_host_ehci_instance_t *)OSA_MemoryAllocate( + ehciInstance = (usb_host_ehci_instance_t *)USB_OsaMemoryAllocate( sizeof(usb_host_ehci_instance_t)); /* malloc host ehci instance */ if (ehciInstance == NULL) { return kStatus_USB_AllocFail; } - ehciInstance->controllerId = controllerId; - ehciInstance->hostHandle = upperLayerHandle; - ehciInstance->deviceAttached = (uint8_t)kEHCIDeviceDetached; - ehciInstance->ehciIpBase = (USBHS_Type *) - usbhsBaseAddrs[controllerId - (uint8_t)kUSB_ControllerEhci0]; /* operate ehci ip through the base address */ + ehciInstance->controllerId = controllerId; + ehciInstance->hostHandle = upperLayerHandle; + ehciInstance->deviceAttached = kEHCIDeviceDetached; + ehciInstance->ehciIpBase = (USBHS_Type *) + usbhsBaseAddrs[controllerId - kUSB_ControllerEhci0]; /* operate ehci ip through the base address */ #if ((defined(USB_HOST_CONFIG_LOW_POWER_MODE)) && (USB_HOST_CONFIG_LOW_POWER_MODE > 0U)) ehciInstance->busSuspendStatus = kBus_EhciIdle; @@ -4169,150 +4097,95 @@ usb_status_t USB_HostEhciCreate(uint8_t controllerId, #endif - if ((USB_HostEhciResetIP(ehciInstance) != kStatus_USB_Success) || - ((ehciInstance->controllerId < (uint8_t)kUSB_ControllerEhci0))) /* reset ehci ip */ + if (USB_HostEhciResetIP(ehciInstance) != kStatus_USB_Success) /* reset ehci ip */ { - OSA_MemoryFree(ehciInstance); + USB_OsaMemoryFree(ehciInstance); return kStatus_USB_Error; } -#if (USB_HOST_CONFIG_EHCI == 1U) - if (0U == usbHostEhciFramListStatus[0]) - { - usbHostEhciFramListStatus[0] = 1U; - instanceIndex = 0U; - ehciInstance->ehciFrameList = &s_UsbHostEhciFrameList1[0]; - } -#elif (USB_HOST_CONFIG_EHCI == 2U) - if (0U == usbHostEhciFramListStatus[0]) - { - usbHostEhciFramListStatus[0] = 1U; - instanceIndex = 0U; - ehciInstance->ehciFrameList = &s_UsbHostEhciFrameList1[0]; - } - else if (0U == usbHostEhciFramListStatus[1]) - { - usbHostEhciFramListStatus[1] = 1U; - instanceIndex = 1U; - ehciInstance->ehciFrameList = &s_UsbHostEhciFrameList2[0]; - } - else - { - /*no action*/ - } -#endif - if (ehciInstance->ehciFrameList == NULL) - { - OSA_MemoryFree(ehciInstance); - return kStatus_USB_Error; - } + /* initialize ehci frame list */ + ehciInstance->ehciFrameList = usbHostEhciFrameList[ehciInstance->controllerId - kUSB_ControllerEhci0]; -#if (USB_HOST_CONFIG_EHCI == 1U) - usbHostEhciData[0] = &s_UsbHostEhciData1; -#elif (USB_HOST_CONFIG_EHCI == 2U) - usbHostEhciData[0] = &s_UsbHostEhciData1; - usbHostEhciData[1] = &s_UsbHostEhciData2; -#else -#error "Please increase the instance count." -#endif - - temp = (void *)usbHostEhciData[instanceIndex]; - ehciInstance->ehciUnitBase = (uint32_t *)(temp); + /* initialize ehci units */ + ehciInstance->ehciUnitBase = (uint32_t *)(usbHostEhciData[ehciInstance->controllerId - kUSB_ControllerEhci0]); /* initialize qh/qtd/itd/sitd/iso list */ - ehciInstance->ehciQhList = (usb_host_ehci_qh_t *)((uint32_t)(ehciInstance->ehciUnitBase)); + ehciInstance->ehciQhList = (usb_host_ehci_qh_t *)((uint32_t)(ehciInstance->ehciUnitBase)); ehciInstance->ehciQtdHead = (usb_host_ehci_qtd_t *)((uint32_t)ehciInstance->ehciQhList + (sizeof(usb_host_ehci_qh_t) * USB_HOST_CONFIG_EHCI_MAX_QH)); ehciInstance->ehciItdList = (usb_host_ehci_itd_t *)((uint32_t)ehciInstance->ehciQtdHead + (sizeof(usb_host_ehci_qtd_t) * USB_HOST_CONFIG_EHCI_MAX_QTD)); -#if ((defined(USB_HOST_CONFIG_EHCI_MAX_ITD)) && (USB_HOST_CONFIG_EHCI_MAX_ITD > 0U)) - /* If one ITD's first 32 bytes and next 32 bytes are in different 4K region, - * the ITD need move 32 bytes because the ITD cannot cross over 4K boundary. - */ - index = ((((((uint32_t)(ehciInstance->ehciItdList)) + 4095U) & 0xFFFFF000U) - - ((uint32_t)(ehciInstance->ehciItdList))) >> - 5U); - if (((index / 3U) < USB_HOST_CONFIG_EHCI_MAX_ITD) && ((index % 3U) == 1U)) - { - ehciInstance->ehciItdList = (usb_host_ehci_itd_t *)(((uint32_t)(ehciInstance->ehciItdList)) + 32U); - } -#endif - ehciInstance->ehciSitdIndexBase = + ehciInstance->ehciSitdList = ehciInstance->ehciSitdIndexBase = (usb_host_ehci_sitd_t *)((uint32_t)ehciInstance->ehciItdList + (sizeof(usb_host_ehci_itd_t) * USB_HOST_CONFIG_EHCI_MAX_ITD)); - ehciInstance->ehciSitdList = ehciInstance->ehciSitdIndexBase; - ehciInstance->ehciIsoList = (usb_host_ehci_iso_t *)((uint32_t)ehciInstance->ehciSitdList + + ehciInstance->ehciIsoList = (usb_host_ehci_iso_t *)((uint32_t)ehciInstance->ehciSitdList + (sizeof(usb_host_ehci_sitd_t) * USB_HOST_CONFIG_EHCI_MAX_SITD)); ehciInstance->ehciPipeIndexBase = (usb_host_ehci_pipe_t *)((uint32_t)ehciInstance->ehciIsoList + (sizeof(usb_host_ehci_iso_t) * USB_HOST_EHCI_ISO_NUMBER)); - for (index = 1U; index < USB_HOST_CONFIG_EHCI_MAX_QH; ++index) + for (index = 1; index < USB_HOST_CONFIG_EHCI_MAX_QH; ++index) { - ehciInstance->ehciQhList[index - 1U].horizontalLinkPointer = (uint32_t)(&ehciInstance->ehciQhList[index]); + ehciInstance->ehciQhList[index - 1].horizontalLinkPointer = (uint32_t)(&ehciInstance->ehciQhList[index]); } - ehciInstance->ehciQhList[USB_HOST_CONFIG_EHCI_MAX_QH - 1U].horizontalLinkPointer = 0U; + ehciInstance->ehciQhList[USB_HOST_CONFIG_EHCI_MAX_QH - 1].horizontalLinkPointer = (uint32_t)NULL; for (index = 1; index < USB_HOST_CONFIG_EHCI_MAX_QTD; ++index) { - ehciInstance->ehciQtdHead[index - 1U].nextQtdPointer = (uint32_t)(&ehciInstance->ehciQtdHead[index]); + ehciInstance->ehciQtdHead[index - 1].nextQtdPointer = (uint32_t)(&ehciInstance->ehciQtdHead[index]); } - ehciInstance->ehciQtdNumber = USB_HOST_CONFIG_EHCI_MAX_QTD; - ehciInstance->ehciQtdHead[USB_HOST_CONFIG_EHCI_MAX_QTD - 1U].nextQtdPointer = 0U; - ehciInstance->ehciQtdTail = &ehciInstance->ehciQtdHead[USB_HOST_CONFIG_EHCI_MAX_QTD - 1U]; + ehciInstance->ehciQtdNumber = USB_HOST_CONFIG_EHCI_MAX_QTD; + ehciInstance->ehciQtdHead[USB_HOST_CONFIG_EHCI_MAX_QTD - 1].nextQtdPointer = (uint32_t)NULL; + ehciInstance->ehciQtdTail = &ehciInstance->ehciQtdHead[USB_HOST_CONFIG_EHCI_MAX_QTD - 1]; #if ((defined USB_HOST_CONFIG_EHCI_MAX_ITD) && (USB_HOST_CONFIG_EHCI_MAX_ITD)) for (index = 1; index < USB_HOST_CONFIG_EHCI_MAX_ITD; ++index) { - ehciInstance->ehciItdList[index - 1U].nextItdPointer = - (usb_host_ehci_itd_t *)(&ehciInstance->ehciItdList[index]); + ehciInstance->ehciItdList[index - 1].nextLinkPointer = (uint32_t)(&ehciInstance->ehciItdList[index]); } - ehciInstance->ehciItdNumber = USB_HOST_CONFIG_EHCI_MAX_ITD; - ehciInstance->ehciItdList[USB_HOST_CONFIG_EHCI_MAX_ITD - 1U].nextItdPointer = NULL; + ehciInstance->ehciItdNumber = USB_HOST_CONFIG_EHCI_MAX_ITD; + ehciInstance->ehciItdList[USB_HOST_CONFIG_EHCI_MAX_ITD - 1].nextLinkPointer = (uint32_t)NULL; #endif /* USB_HOST_CONFIG_EHCI_MAX_ITD */ #if ((defined USB_HOST_CONFIG_EHCI_MAX_SITD) && (USB_HOST_CONFIG_EHCI_MAX_SITD)) for (index = 1; index < USB_HOST_CONFIG_EHCI_MAX_SITD; ++index) { - ehciInstance->ehciSitdList[index - 1U].nextLinkPointer = (uint32_t)(&ehciInstance->ehciSitdList[index]); + ehciInstance->ehciSitdList[index - 1].nextLinkPointer = (uint32_t)(&ehciInstance->ehciSitdList[index]); } - ehciInstance->ehciSitdNumber = USB_HOST_CONFIG_EHCI_MAX_SITD; - ehciInstance->ehciSitdList[USB_HOST_CONFIG_EHCI_MAX_SITD - 1U].nextLinkPointer = 0U; + ehciInstance->ehciSitdNumber = USB_HOST_CONFIG_EHCI_MAX_SITD; + ehciInstance->ehciSitdList[USB_HOST_CONFIG_EHCI_MAX_SITD - 1].nextLinkPointer = (uint32_t)NULL; #endif /* USB_HOST_CONFIG_EHCI_MAX_SITD */ #if ((defined USB_HOST_CONFIG_EHCI_MAX_ITD) && (USB_HOST_CONFIG_EHCI_MAX_ITD)) for (index = 1; index < USB_HOST_EHCI_ISO_NUMBER; ++index) { - ehciInstance->ehciIsoList[index - 1U].next = &ehciInstance->ehciIsoList[index]; + ehciInstance->ehciIsoList[index - 1].next = &ehciInstance->ehciIsoList[index]; } - ehciInstance->ehciIsoList[USB_HOST_EHCI_ISO_NUMBER - 1U].next = NULL; + ehciInstance->ehciIsoList[USB_HOST_EHCI_ISO_NUMBER - 1].next = NULL; #endif /* initialize pipes */ ehciInstance->ehciPipeList = ehciInstance->ehciPipeIndexBase; for (index = 1; index < USB_HOST_CONFIG_MAX_PIPES; ++index) { - temp = (void *)&ehciInstance->ehciPipeList[index]; - ehciInstance->ehciPipeList[index - 1U].pipeCommon.next = (usb_host_pipe_t *)temp; + ehciInstance->ehciPipeList[index - 1].pipeCommon.next = (usb_host_pipe_t *)&ehciInstance->ehciPipeList[index]; } /* initialize mutext */ - ehciInstance->ehciMutex = (osa_mutex_handle_t)(&ehciInstance->mutexBuffer[0]); - osaStatus = OSA_MutexCreate(ehciInstance->ehciMutex); - if (osaStatus != KOSA_StatusSuccess) + osaStatus = USB_OsaMutexCreate(&ehciInstance->ehciMutex); + if (osaStatus != kStatus_USB_OSA_Success) { #ifdef HOST_ECHO usb_echo("ehci mutex init fail\r\n"); #endif - OSA_MemoryFree(ehciInstance); + USB_OsaMemoryFree(ehciInstance); return kStatus_USB_Error; } /* initialize task event */ - ehciInstance->taskEventHandle = (osa_event_handle_t)&ehciInstance->taskEventHandleBuffer[0]; - osaStatus = OSA_EventCreate(ehciInstance->taskEventHandle, 1); - if (osaStatus != KOSA_StatusSuccess) + osaStatus = USB_OsaEventCreate(&ehciInstance->taskEventHandle, 1); + if (osaStatus != kStatus_USB_OSA_Success) { #ifdef HOST_ECHO usb_echo("ehci event init fail\r\n"); #endif - (void)OSA_MutexDestroy(ehciInstance->ehciMutex); - OSA_MemoryFree(ehciInstance); + USB_OsaMutexDestroy(ehciInstance->ehciMutex); + USB_OsaMemoryFree(ehciInstance); return kStatus_USB_Error; } @@ -4320,23 +4193,22 @@ usb_status_t USB_HostEhciCreate(uint8_t controllerId, ehciInstance->shedFirstQh = ehciInstance->ehciQhList; ehciInstance->ehciQhList = (usb_host_ehci_qh_t *)(ehciInstance->ehciQhList->horizontalLinkPointer & EHCI_HOST_POINTER_ADDRESS_MASK); - ehciInstance->shedFirstQh->staticEndpointStates[0] |= (1UL << EHCI_HOST_QH_H_SHIFT); /* first qh */ - ehciInstance->shedFirstQh->horizontalLinkPointer = EHCI_HOST_T_INVALID_VALUE; - ehciInstance->shedFirstQh->currentQtdPointer = EHCI_HOST_T_INVALID_VALUE; - ehciInstance->shedFirstQh->nextQtdPointer = EHCI_HOST_T_INVALID_VALUE; + ehciInstance->shedFirstQh->staticEndpointStates[0] |= (1 << EHCI_HOST_QH_H_SHIFT); /* first qh */ + ehciInstance->shedFirstQh->horizontalLinkPointer = EHCI_HOST_T_INVALID_VALUE; + ehciInstance->shedFirstQh->currentQtdPointer = EHCI_HOST_T_INVALID_VALUE; + ehciInstance->shedFirstQh->nextQtdPointer = EHCI_HOST_T_INVALID_VALUE; ehciInstance->shedFirstQh->alternateNextQtdPointer = EHCI_HOST_T_INVALID_VALUE; ehciInstance->shedFirstQh->horizontalLinkPointer = (uint32_t)((uint32_t)(ehciInstance->shedFirstQh) | EHCI_HOST_POINTER_TYPE_QH); /* initialize periodic list */ - temp = (void *)ehciInstance->ehciFrameList; - framePointer = (uint32_t *)temp; + framePointer = (uint32_t *)ehciInstance->ehciFrameList; for (index = 0; index < USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE; ++index) { framePointer[index] = EHCI_HOST_T_INVALID_VALUE; } - (void)USB_HostEhciStartIP(ehciInstance); /* start ehci ip */ + USB_HostEhciStartIP(ehciInstance); /* start ehci ip */ *controllerHandle = ehciInstance; @@ -4351,29 +4223,10 @@ usb_status_t USB_HostEhciDestory(usb_host_controller_handle controllerHandle) ehciInstance->ehciIpBase->USBINTR = 0; /* stop the controller */ ehciInstance->ehciIpBase->USBCMD = 0; -/* free memory */ -#if (USB_HOST_CONFIG_EHCI == 1U) - if (ehciInstance->ehciFrameList == &s_UsbHostEhciFrameList1[0]) - { - usbHostEhciFramListStatus[0] = 0; - } -#elif (USB_HOST_CONFIG_EHCI == 2U) - if (ehciInstance->ehciFrameList == &s_UsbHostEhciFrameList1[0]) - { - usbHostEhciFramListStatus[0] = 0; - } - else if (ehciInstance->ehciFrameList == &s_UsbHostEhciFrameList2[0]) - { - usbHostEhciFramListStatus[1] = 0; - } - else - { - /*no action*/ - } -#endif - (void)OSA_MutexDestroy(ehciInstance->ehciMutex); - (void)OSA_EventDestroy(ehciInstance->taskEventHandle); - OSA_MemoryFree(ehciInstance); + /* free memory */ + USB_OsaMutexDestroy(ehciInstance->ehciMutex); + USB_OsaEventDestroy(ehciInstance->taskEventHandle); + USB_OsaMemoryFree(ehciInstance); return kStatus_USB_Success; } @@ -4384,17 +4237,15 @@ usb_status_t USB_HostEhciOpenPipe(usb_host_controller_handle controllerHandle, { usb_host_ehci_pipe_t *ehciPipePointer = NULL; usb_status_t status; - uint32_t speed = 0; + uint32_t speed; usb_host_ehci_instance_t *ehciInstance = (usb_host_ehci_instance_t *)controllerHandle; - uint32_t val32; - void *temp; + /* get one pipe */ USB_HostEhciLock(); if (ehciInstance->ehciPipeList != NULL) { - ehciPipePointer = ehciInstance->ehciPipeList; - temp = (void *)ehciPipePointer->pipeCommon.next; - ehciInstance->ehciPipeList = (usb_host_ehci_pipe_t *)temp; + ehciPipePointer = ehciInstance->ehciPipeList; + ehciInstance->ehciPipeList = (usb_host_ehci_pipe_t *)ehciPipePointer->pipeCommon.next; } USB_HostEhciUnlock(); if (ehciPipePointer == NULL) @@ -4406,54 +4257,44 @@ usb_status_t USB_HostEhciOpenPipe(usb_host_controller_handle controllerHandle, } /* initialize pipe informations */ - USB_HostEhciZeroMem((void *)ehciPipePointer, sizeof(usb_host_ehci_pipe_t) / 4U); - ehciPipePointer->pipeCommon.deviceHandle = pipeInit->devInstance; + USB_HostEhciZeroMem((uint32_t *)ehciPipePointer, sizeof(usb_host_ehci_pipe_t) / 4); + ehciPipePointer->pipeCommon.deviceHandle = pipeInit->devInstance; ehciPipePointer->pipeCommon.endpointAddress = pipeInit->endpointAddress; - ehciPipePointer->pipeCommon.direction = pipeInit->direction; - ehciPipePointer->pipeCommon.interval = pipeInit->interval; - ehciPipePointer->pipeCommon.maxPacketSize = pipeInit->maxPacketSize; - ehciPipePointer->pipeCommon.pipeType = pipeInit->pipeType; - ehciPipePointer->pipeCommon.numberPerUframe = pipeInit->numberPerUframe + 1U; - if (ehciPipePointer->pipeCommon.numberPerUframe > 3U) + ehciPipePointer->pipeCommon.direction = pipeInit->direction; + ehciPipePointer->pipeCommon.interval = pipeInit->interval; + ehciPipePointer->pipeCommon.maxPacketSize = pipeInit->maxPacketSize; + ehciPipePointer->pipeCommon.pipeType = pipeInit->pipeType; + ehciPipePointer->pipeCommon.numberPerUframe = pipeInit->numberPerUframe; + if (ehciPipePointer->pipeCommon.numberPerUframe == 0) { - ehciPipePointer->pipeCommon.numberPerUframe = 3U; + ehciPipePointer->pipeCommon.numberPerUframe = 1; } - ehciPipePointer->pipeCommon.nakCount = pipeInit->nakCount; - ehciPipePointer->pipeCommon.nextdata01 = 0U; - ehciPipePointer->ehciQh = NULL; - (void)USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, - (uint32_t)kUSB_HostGetDeviceSpeed, &speed); - if ((ehciPipePointer->pipeCommon.pipeType == USB_ENDPOINT_ISOCHRONOUS) || - (ehciPipePointer->pipeCommon.pipeType == USB_ENDPOINT_INTERRUPT)) + ehciPipePointer->pipeCommon.nakCount = pipeInit->nakCount; + ehciPipePointer->pipeCommon.nextdata01 = 0; + ehciPipePointer->ehciQh = NULL; + USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, kUSB_HostGetDeviceSpeed, &speed); + if (ehciPipePointer->pipeCommon.pipeType == USB_ENDPOINT_ISOCHRONOUS) { - if (ehciPipePointer->pipeCommon.pipeType == USB_ENDPOINT_ISOCHRONOUS) + ehciPipePointer->pipeCommon.interval = + (1 << (ehciPipePointer->pipeCommon.interval - 1)); /* iso interval is the power of 2 */ + } + else if (ehciPipePointer->pipeCommon.pipeType == USB_ENDPOINT_INTERRUPT) + { + if (speed == USB_SPEED_HIGH) { ehciPipePointer->pipeCommon.interval = - (uint16_t)(1UL << (ehciPipePointer->pipeCommon.interval - 1U)); /* iso interval is the power of 2 */ + (1 << (ehciPipePointer->pipeCommon.interval - 1)); /* HS interrupt interval is the power of 2 */ } else { - if (speed == USB_SPEED_HIGH) - { - ehciPipePointer->pipeCommon.interval = (uint16_t)( - 1UL << (ehciPipePointer->pipeCommon.interval - 1U)); /* HS interrupt interval is the power of 2 */ - } - else - { - ehciPipePointer->pipeCommon.interval = USB_HostEhciGet2PowerValue( - (uint8_t)ehciPipePointer->pipeCommon.interval); /* FS/LS interrupt interval should be the power of - 2, it is used for ehci bandwidth */ - } - } - - if ((speed == USB_SPEED_HIGH) && (ehciPipePointer->pipeCommon.interval < 8U)) - { - val32 = ehciInstance->ehciIpBase->USBCMD; - val32 &= (~USBHS_USBCMD_ITC_MASK); - val32 |= USBHS_USBCMD_ITC((ehciPipePointer->pipeCommon.interval)); - ehciInstance->ehciIpBase->USBCMD = val32; + ehciPipePointer->pipeCommon.interval = USB_HostEhciGet2PowerValue( + ehciPipePointer->pipeCommon + .interval); /* FS/LS interrupt interval should be the power of 2, it is used for ehci bandwidth */ } } + else + { + } /* save the micro-frame interval, it is convenient for the interval process */ if (speed == USB_SPEED_HIGH) @@ -4462,7 +4303,7 @@ usb_status_t USB_HostEhciOpenPipe(usb_host_controller_handle controllerHandle, } else { - ehciPipePointer->uframeInterval = 8U * ehciPipePointer->pipeCommon.interval; + ehciPipePointer->uframeInterval = 8 * ehciPipePointer->pipeCommon.interval; } /* open pipe */ @@ -4493,17 +4334,15 @@ usb_status_t USB_HostEhciOpenPipe(usb_host_controller_handle controllerHandle, { /* release pipe */ USB_HostEhciLock(); - temp = (void *)ehciInstance->ehciPipeList; - ehciPipePointer->pipeCommon.next = (usb_host_pipe_t *)temp; - ehciInstance->ehciPipeList = ehciPipePointer; + ehciPipePointer->pipeCommon.next = (usb_host_pipe_t *)ehciInstance->ehciPipeList; + ehciInstance->ehciPipeList = ehciPipePointer; USB_HostEhciUnlock(); return status; } /* add pipe to run pipe list */ USB_HostEhciLock(); - temp = (void *)ehciInstance->ehciRunningPipeList; - ehciPipePointer->pipeCommon.next = (usb_host_pipe_t *)temp; + ehciPipePointer->pipeCommon.next = (usb_host_pipe_t *)ehciInstance->ehciRunningPipeList; ehciInstance->ehciRunningPipeList = ehciPipePointer; USB_HostEhciUnlock(); @@ -4514,50 +4353,43 @@ usb_status_t USB_HostEhciOpenPipe(usb_host_controller_handle controllerHandle, usb_status_t USB_HostEhciClosePipe(usb_host_controller_handle controllerHandle, usb_host_pipe_handle pipeHandle) { usb_host_ehci_instance_t *ehciInstance = (usb_host_ehci_instance_t *)controllerHandle; - usb_host_ehci_pipe_t *ehciPipePointer = (usb_host_ehci_pipe_t *)pipeHandle; - usb_host_pipe_t *prevPointer = NULL; - void *temp; - void *tempCurrent; + usb_host_ehci_pipe_t *ehciPipePointer = (usb_host_ehci_pipe_t *)pipeHandle; + usb_host_pipe_t *prevPointer = NULL; switch (ehciPipePointer->pipeCommon.pipeType) { case USB_ENDPOINT_BULK: case USB_ENDPOINT_CONTROL: - (void)USB_HostEhciCloseControlBulk(ehciInstance, ehciPipePointer); + USB_HostEhciCloseControlBulk(ehciInstance, ehciPipePointer); break; case USB_ENDPOINT_INTERRUPT: - (void)USB_HostEhciCloseInterrupt(ehciInstance, ehciPipePointer); + USB_HostEhciCloseInterrupt(ehciInstance, ehciPipePointer); break; #if (((defined USB_HOST_CONFIG_EHCI_MAX_ITD) && (USB_HOST_CONFIG_EHCI_MAX_ITD)) || \ ((defined USB_HOST_CONFIG_EHCI_MAX_SITD) && (USB_HOST_CONFIG_EHCI_MAX_SITD))) case USB_ENDPOINT_ISOCHRONOUS: - (void)USB_HostEhciCloseIso(ehciInstance, ehciPipePointer); + USB_HostEhciCloseIso(ehciInstance, ehciPipePointer); break; #endif default: - /*no action*/ break; } /* delete pipe from run pipe list */ USB_HostEhciLock(); - temp = (void *)ehciInstance->ehciRunningPipeList; - prevPointer = (usb_host_pipe_t *)temp; - tempCurrent = (void *)ehciPipePointer; - if (prevPointer == (usb_host_pipe_t *)tempCurrent) + prevPointer = (usb_host_pipe_t *)ehciInstance->ehciRunningPipeList; + if (prevPointer == (usb_host_pipe_t *)ehciPipePointer) { - temp = (void *)prevPointer->next; - ehciInstance->ehciRunningPipeList = (usb_host_ehci_pipe_t *)(temp); + ehciInstance->ehciRunningPipeList = (usb_host_ehci_pipe_t *)(prevPointer->next); } else { while (prevPointer != NULL) { - temp = (void *)ehciPipePointer; - if (prevPointer->next == (usb_host_pipe_t *)temp) + if (prevPointer->next == (usb_host_pipe_t *)ehciPipePointer) { prevPointer->next = ehciPipePointer->pipeCommon.next; break; @@ -4572,9 +4404,8 @@ usb_status_t USB_HostEhciClosePipe(usb_host_controller_handle controllerHandle, /* release pipe */ USB_HostEhciLock(); - temp = (void *)ehciInstance->ehciPipeList; - ehciPipePointer->pipeCommon.next = (usb_host_pipe_t *)temp; - ehciInstance->ehciPipeList = ehciPipePointer; + ehciPipePointer->pipeCommon.next = (usb_host_pipe_t *)ehciInstance->ehciPipeList; + ehciInstance->ehciPipeList = ehciPipePointer; USB_HostEhciUnlock(); return kStatus_USB_Success; @@ -4585,11 +4416,11 @@ usb_status_t USB_HostEhciWritePipe(usb_host_controller_handle controllerHandle, usb_host_transfer_t *transfer) { usb_host_ehci_instance_t *ehciInstance = (usb_host_ehci_instance_t *)controllerHandle; - usb_host_ehci_pipe_t *ehciPipePointer = (usb_host_ehci_pipe_t *)pipeHandle; - usb_status_t status = kStatus_USB_Success; + usb_host_ehci_pipe_t *ehciPipePointer = (usb_host_ehci_pipe_t *)pipeHandle; + usb_status_t status = kStatus_USB_Success; #if (((defined USB_HOST_CONFIG_EHCI_MAX_ITD) && (USB_HOST_CONFIG_EHCI_MAX_ITD)) || \ ((defined USB_HOST_CONFIG_EHCI_MAX_SITD) && (USB_HOST_CONFIG_EHCI_MAX_SITD))) - uint32_t speed = 0U; + uint32_t speed; #endif switch (ehciPipePointer->pipeCommon.pipeType) @@ -4604,8 +4435,8 @@ usb_status_t USB_HostEhciWritePipe(usb_host_controller_handle controllerHandle, #if (((defined USB_HOST_CONFIG_EHCI_MAX_ITD) && (USB_HOST_CONFIG_EHCI_MAX_ITD)) || \ ((defined USB_HOST_CONFIG_EHCI_MAX_SITD) && (USB_HOST_CONFIG_EHCI_MAX_SITD))) case USB_ENDPOINT_ISOCHRONOUS: - (void)USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, - (uint32_t)kUSB_HostGetDeviceSpeed, &speed); + USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, kUSB_HostGetDeviceSpeed, + &speed); if (speed == USB_SPEED_HIGH) { #if ((defined USB_HOST_CONFIG_EHCI_MAX_ITD) && (USB_HOST_CONFIG_EHCI_MAX_ITD)) @@ -4624,7 +4455,6 @@ usb_status_t USB_HostEhciWritePipe(usb_host_controller_handle controllerHandle, #endif default: - /*no action*/ break; } return status; @@ -4639,22 +4469,22 @@ usb_status_t USB_HostEhciReadpipe(usb_host_controller_handle controllerHandle, usb_status_t USB_HostEhciIoctl(usb_host_controller_handle controllerHandle, uint32_t ioctlEvent, void *ioctlParam) { - usb_status_t status = kStatus_USB_Success; + usb_status_t status = kStatus_USB_Success; usb_host_ehci_instance_t *ehciInstance = (usb_host_ehci_instance_t *)controllerHandle; usb_host_cancel_param_t *param; usb_host_ehci_pipe_t *ehciPipePointer; volatile usb_host_ehci_qh_t *vltQhPointer; - uint32_t deviceAddress = 0; - usb_host_controller_control_t controlCode = (usb_host_controller_control_t)ioctlEvent; + uint32_t deviceAddress; + if (controllerHandle == NULL) { return kStatus_USB_InvalidHandle; } - switch (controlCode) + switch (ioctlEvent) { case kUSB_HostCancelTransfer: /* cancel pipe or one transfer */ - param = (usb_host_cancel_param_t *)ioctlParam; + param = (usb_host_cancel_param_t *)ioctlParam; status = USB_HostEhciCancelPipe(ehciInstance, (usb_host_ehci_pipe_t *)param->pipeHandle, param->transfer); break; @@ -4668,19 +4498,18 @@ usb_status_t USB_HostEhciIoctl(usb_host_controller_handle controllerHandle, uint case kUSB_HostUpdateControlEndpointAddress: ehciPipePointer = (usb_host_ehci_pipe_t *)ioctlParam; - vltQhPointer = (volatile usb_host_ehci_qh_t *)ehciPipePointer->ehciQh; + vltQhPointer = (volatile usb_host_ehci_qh_t *)ehciPipePointer->ehciQh; /* update address */ - (void)USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, - (uint32_t)kUSB_HostGetDeviceAddress, &deviceAddress); + USB_HostHelperGetPeripheralInformation(ehciPipePointer->pipeCommon.deviceHandle, kUSB_HostGetDeviceAddress, + &deviceAddress); vltQhPointer->staticEndpointStates[0] |= deviceAddress; - USB_HostEhciDelay(ehciInstance->ehciIpBase, 2U); break; case kUSB_HostUpdateControlPacketSize: ehciPipePointer = (usb_host_ehci_pipe_t *)ioctlParam; - vltQhPointer = (volatile usb_host_ehci_qh_t *)ehciPipePointer->ehciQh; + vltQhPointer = (volatile usb_host_ehci_qh_t *)ehciPipePointer->ehciQh; USB_HostEhciLock(); - if (0U != (ehciInstance->ehciIpBase->USBSTS & USBHS_USBSTS_AS_MASK)) + if (ehciInstance->ehciIpBase->USBSTS & USBHS_USBSTS_AS_MASK) { USB_HostEhciStopAsync(ehciInstance); /* update max packet size */ @@ -4698,13 +4527,8 @@ usb_status_t USB_HostEhciIoctl(usb_host_controller_handle controllerHandle, uint } USB_HostEhciUnlock(); break; -#if ((defined USB_HOST_CONFIG_COMPLIANCE_TEST) && (USB_HOST_CONFIG_COMPLIANCE_TEST)) - case kUSB_HostTestModeInit: /* test mode control */ - USB_HostEhciTestModeInit((usb_host_device_instance_t *)ioctlParam); - break; -#endif + default: - status = kStatus_USB_NotSupported; break; } return status; @@ -4722,44 +4546,44 @@ void USB_HostEhciTaskFunction(void *hostHandle) } ehciInstance = (usb_host_ehci_instance_t *)((usb_host_instance_t *)hostHandle)->controllerHandle; - if (OSA_EventWait(ehciInstance->taskEventHandle, 0xFF, 0, USB_OSA_WAIT_TIMEOUT, &bitSet) == - KOSA_StatusSuccess) /* wait all event */ + if (USB_OsaEventWait(ehciInstance->taskEventHandle, 0xFF, 0, 0, &bitSet) == + kStatus_USB_OSA_Success) /* wait all event */ { - if (0U != (bitSet & EHCI_TASK_EVENT_PORT_CHANGE)) /* port change */ + if (bitSet & EHCI_TASK_EVENT_PORT_CHANGE) /* port change */ { USB_HostEhciPortChange(ehciInstance); } - if (0U != (bitSet & EHCI_TASK_EVENT_TIMER0)) /* timer0 */ + if (bitSet & EHCI_TASK_EVENT_TIMER0) /* timer0 */ { USB_HostEhciTimer0(ehciInstance); } #if ((defined(USB_HOST_CONFIG_LOW_POWER_MODE)) && (USB_HOST_CONFIG_LOW_POWER_MODE > 0U)) - if (0U != (bitSet & EHCI_TASK_EVENT_TIMER1)) /* timer1 */ + if (bitSet & EHCI_TASK_EVENT_TIMER1) /* timer1 */ { USB_HostEhciTimer1(ehciInstance); } #endif - if ((ehciInstance->deviceAttached == (uint8_t)kEHCIDeviceAttached)) + if (ehciInstance->deviceAttached == kEHCIDeviceAttached) { - if (0U != (bitSet & EHCI_TASK_EVENT_TRANSACTION_DONE)) /* transaction done */ + if (bitSet & EHCI_TASK_EVENT_TRANSACTION_DONE) /* transaction done */ { USB_HostEhciTransactionDone(ehciInstance); } - if (0U != (bitSet & EHCI_TASK_EVENT_DEVICE_DETACH)) /* device detach */ + if (bitSet & EHCI_TASK_EVENT_DEVICE_DETACH) /* device detach */ { ehciInstance->ehciIpBase->USBINTR &= (~USBHS_USBINTR_PCE_MASK); /* disable attach, enable when the detach process is done */ - ehciInstance->deviceAttached = (uint8_t)kEHCIDeviceDetached; - (void)USB_HostDetachDevice(ehciInstance->hostHandle, 0, 0); + ehciInstance->deviceAttached = kEHCIDeviceDetached; + USB_HostDetachDevice(ehciInstance->hostHandle, 0, 0); } } - else if (ehciInstance->deviceAttached != (uint8_t)kEHCIDeviceAttached) + else if (ehciInstance->deviceAttached != kEHCIDeviceAttached) { - if (0U != (bitSet & EHCI_TASK_EVENT_DEVICE_ATTACH)) /* device is attached */ + if (bitSet & EHCI_TASK_EVENT_DEVICE_ATTACH) /* device is attached */ { USB_HostEhciStartAsync(ehciInstance); USB_HostEhciStartPeriodic(ehciInstance); @@ -4767,13 +4591,12 @@ void USB_HostEhciTaskFunction(void *hostHandle) if (USB_HostAttachDevice(ehciInstance->hostHandle, ehciInstance->firstDeviceSpeed, 0, 0, 1, &deviceHandle) == kStatus_USB_Success) { - ehciInstance->deviceAttached = (uint8_t)kEHCIDeviceAttached; + ehciInstance->deviceAttached = kEHCIDeviceAttached; } } } else { - /*no action*/ } } } @@ -4793,18 +4616,18 @@ void USB_HostEhciIsrFunction(void *hostHandle) #if ((defined(USB_HOST_CONFIG_LOW_POWER_MODE)) && (USB_HOST_CONFIG_LOW_POWER_MODE > 0U)) #if (defined(FSL_FEATURE_SOC_USBNC_COUNT) && (FSL_FEATURE_SOC_USBNC_COUNT > 0U)) - if (0U != (ehciInstance->registerNcBase->USB_OTGn_CTRL & USBNC_USB_OTGn_CTRL_WIE_MASK)) + if (ehciInstance->registerNcBase->USB_OTGn_CTRL & USBNC_USB_OTGn_CTRL_WIE_MASK) { usb_host_instance_t *hostPointer = (usb_host_instance_t *)ehciInstance->hostHandle; ehciInstance->registerNcBase->USB_OTGn_CTRL &= ~USBNC_USB_OTGn_CTRL_WIE_MASK; - (void)hostPointer->deviceCallback(hostPointer->suspendedDevice, NULL, - kUSB_HostEventDetectResume); /* call host callback function */ -#if (defined(USBNC_USB_OTGn_PHY_CTRL_0_UTMI_CLK_VLD_MASK)) - while (0U == (ehciInstance->registerNcBase->USB_OTGn_PHY_CTRL_0 & USBNC_USB_OTGn_PHY_CTRL_0_UTMI_CLK_VLD_MASK)) + hostPointer->deviceCallback(hostPointer->suspendedDevice, NULL, + kUSB_HostEventDetectResume); /* call host callback function */ + + while (!(ehciInstance->registerNcBase->USB_OTGn_PHY_CTRL_0 & USBNC_USB_OTGn_PHY_CTRL_0_UTMI_CLK_VLD_MASK)) { } -#endif - if (0U != (ehciInstance->ehciIpBase->PORTSC1 & USBHS_PORTSC1_CCS_MASK)) + + if (ehciInstance->ehciIpBase->PORTSC1 & USBHS_PORTSC1_CCS_MASK) { USB_HostEhciStartAsync(ehciInstance); USB_HostEhciStartPeriodic(ehciInstance); @@ -4817,27 +4640,25 @@ void USB_HostEhciIsrFunction(void *hostHandle) } else { - /*no action*/ } } else { - /*no action*/ } #else - if (0U != (ehciInstance->ehciIpBase->USBGENCTRL & USBHS_USBGENCTRL_WU_IE_MASK)) + if (ehciInstance->ehciIpBase->USBGENCTRL & USBHS_USBGENCTRL_WU_IE_MASK) { usb_host_instance_t *hostPointer = (usb_host_instance_t *)ehciInstance->hostHandle; - (void)hostPointer->deviceCallback(hostPointer->suspendedDevice, NULL, - kUSB_HostEventDetectResume); /* call host callback function */ + hostPointer->deviceCallback(hostPointer->suspendedDevice, NULL, + kUSB_HostEventDetectResume); /* call host callback function */ - while (0U == (USBPHY->PLL_SIC & USBPHY_PLL_SIC_PLL_LOCK_MASK)) + while (!(USBPHY->PLL_SIC & USBPHY_PLL_SIC_PLL_LOCK_MASK)) { } ehciInstance->ehciIpBase->USBGENCTRL |= USBHS_USBGENCTRL_WU_INT_CLR_MASK; ehciInstance->ehciIpBase->USBGENCTRL &= ~USBHS_USBGENCTRL_WU_IE_MASK; - if (0U != (ehciInstance->ehciIpBase->PORTSC1 & USBHS_PORTSC1_CCS_MASK)) + if (ehciInstance->ehciIpBase->PORTSC1 & USBHS_PORTSC1_CCS_MASK) { USB_HostEhciStartAsync(ehciInstance); USB_HostEhciStartPeriodic(ehciInstance); @@ -4850,12 +4671,10 @@ void USB_HostEhciIsrFunction(void *hostHandle) } else { - /*no action*/ } } else { - /*no action*/ } #endif /* FSL_FEATURE_SOC_USBNC_COUNT */ @@ -4863,61 +4682,60 @@ void USB_HostEhciIsrFunction(void *hostHandle) interruptStatus = ehciInstance->ehciIpBase->USBSTS; interruptStatus &= ehciInstance->ehciIpBase->USBINTR; - while (0U != interruptStatus) /* there are usb interrupts */ + while (interruptStatus) /* there are usb interrupts */ { ehciInstance->ehciIpBase->USBSTS = interruptStatus; /* clear interrupt */ - if (0U != (interruptStatus & USBHS_USBSTS_SRI_MASK)) /* SOF interrupt */ + if (interruptStatus & USBHS_USBSTS_SRI_MASK) /* SOF interrupt */ { } - if (0U != (interruptStatus & USBHS_USBSTS_SEI_MASK)) /* system error interrupt */ + if (interruptStatus & USBHS_USBSTS_SEI_MASK) /* system error interrupt */ { } - if ((0U != (interruptStatus & USBHS_USBSTS_UI_MASK)) || - (0U != (interruptStatus & USBHS_USBSTS_UEI_MASK))) /* USB interrupt or USB error interrupt */ + if ((interruptStatus & USBHS_USBSTS_UI_MASK) || + (interruptStatus & USBHS_USBSTS_UEI_MASK)) /* USB interrupt or USB error interrupt */ { - (void)OSA_EventSet(ehciInstance->taskEventHandle, EHCI_TASK_EVENT_TRANSACTION_DONE); + USB_OsaEventSet(ehciInstance->taskEventHandle, EHCI_TASK_EVENT_TRANSACTION_DONE); } - if (0U != (interruptStatus & USBHS_USBSTS_PCI_MASK)) /* port change detect interrupt */ + if (interruptStatus & USBHS_USBSTS_PCI_MASK) /* port change detect interrupt */ { #if ((defined(USB_HOST_CONFIG_LOW_POWER_MODE)) && (USB_HOST_CONFIG_LOW_POWER_MODE > 0U)) usb_host_instance_t *hostPointer = (usb_host_instance_t *)ehciInstance->hostHandle; - if (0U != (ehciInstance->ehciIpBase->PORTSC1 & USBHS_PORTSC1_FPR_MASK)) + if (ehciInstance->ehciIpBase->PORTSC1 & USBHS_PORTSC1_FPR_MASK) { if (kBus_EhciStartSuspend == ehciInstance->busSuspendStatus) { - if (0U != (ehciInstance->ehciIpBase->PORTSC1 & USBHS_PORTSC1_CCS_MASK)) + if (ehciInstance->ehciIpBase->PORTSC1 & USBHS_PORTSC1_CCS_MASK) { USB_HostEhciStartAsync(ehciInstance); USB_HostEhciStartPeriodic(ehciInstance); } - (void)hostPointer->deviceCallback(hostPointer->suspendedDevice, NULL, - kUSB_HostEventNotSuspended); /* call host callback function */ - hostPointer->suspendedDevice = NULL; + hostPointer->deviceCallback(hostPointer->suspendedDevice, NULL, + kUSB_HostEventNotSuspended); /* call host callback function */ + hostPointer->suspendedDevice = NULL; ehciInstance->busSuspendStatus = kBus_EhciIdle; ehciInstance->ehciIpBase->USBINTR &= ~(USBHS_USBINTR_TIE1_MASK); } else { - /*no action */ } } #endif - (void)OSA_EventSet(ehciInstance->taskEventHandle, EHCI_TASK_EVENT_PORT_CHANGE); + USB_OsaEventSet(ehciInstance->taskEventHandle, EHCI_TASK_EVENT_PORT_CHANGE); } - if (0U != (interruptStatus & USBHS_USBSTS_TI0_MASK)) /* timer 0 interrupt */ + if (interruptStatus & USBHS_USBSTS_TI0_MASK) /* timer 0 interrupt */ { - (void)OSA_EventSet(ehciInstance->taskEventHandle, EHCI_TASK_EVENT_TIMER0); + USB_OsaEventSet(ehciInstance->taskEventHandle, EHCI_TASK_EVENT_TIMER0); } #if ((defined(USB_HOST_CONFIG_LOW_POWER_MODE)) && (USB_HOST_CONFIG_LOW_POWER_MODE > 0U)) - if (0U != (interruptStatus & USBHS_USBSTS_TI1_MASK)) /* timer 1 interrupt */ + if (interruptStatus & USBHS_USBSTS_TI1_MASK) /* timer 1 interrupt */ { - (void)OSA_EventSet(ehciInstance->taskEventHandle, EHCI_TASK_EVENT_TIMER1); + USB_OsaEventSet(ehciInstance->taskEventHandle, EHCI_TASK_EVENT_TIMER1); } #endif diff --git a/bsp/imxrt/libraries/drivers/usb/host/usb_host_ehci.h b/bsp/imxrt/libraries/drivers/usb/host/usb_host_ehci.h index 5aea41c147..162d6576cd 100644 --- a/bsp/imxrt/libraries/drivers/usb/host/usb_host_ehci.h +++ b/bsp/imxrt/libraries/drivers/usb/host/usb_host_ehci.h @@ -1,9 +1,31 @@ /* * Copyright (c) 2015, Freescale Semiconductor, Inc. - * Copyright 2016,2019 NXP - * All rights reserved. + * Copyright 2016 NXP * - * SPDX-License-Identifier: BSD-3-Clause + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * o Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * o Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * o Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef _USB_HOST_CONTROLLER_EHCI_H_ @@ -17,95 +39,95 @@ * Definitions ******************************************************************************/ /* EHCI host macros */ -#define EHCI_HOST_T_INVALID_VALUE (1U) -#define EHCI_HOST_POINTER_TYPE_ITD (0x00U) -#define EHCI_HOST_POINTER_TYPE_QH (0x00000002U) -#define EHCI_HOST_POINTER_TYPE_SITD (0x00000004U) -#define EHCI_HOST_POINTER_TYPE_FSTN (0x00000006U) -#define EHCI_HOST_POINTER_TYPE_MASK (0x00000006U) +#define EHCI_HOST_T_INVALID_VALUE (1U) +#define EHCI_HOST_POINTER_TYPE_ITD (0x00U) +#define EHCI_HOST_POINTER_TYPE_QH (0x00000002U) +#define EHCI_HOST_POINTER_TYPE_SITD (0x00000004U) +#define EHCI_HOST_POINTER_TYPE_FSTN (0x00000006U) +#define EHCI_HOST_POINTER_TYPE_MASK (0x00000006U) #define EHCI_HOST_POINTER_ADDRESS_MASK (0xFFFFFFE0U) -#define EHCI_HOST_PID_OUT (0UL) -#define EHCI_HOST_PID_IN (1UL) -#define EHCI_HOST_PID_SETUP (2UL) +#define EHCI_HOST_PID_OUT (0U) +#define EHCI_HOST_PID_IN (1U) +#define EHCI_HOST_PID_SETUP (2U) -#define EHCI_HOST_QH_RL_SHIFT (28U) -#define EHCI_HOST_QH_RL_MASK (0xF0000000U) -#define EHCI_HOST_QH_C_SHIFT (27U) -#define EHCI_HOST_QH_MAX_PACKET_LENGTH_SHIFT (16U) -#define EHCI_HOST_QH_MAX_PACKET_LENGTH_MASK (0x07FF0000U) -#define EHCI_HOST_QH_H_SHIFT (15U) -#define EHCI_HOST_QH_DTC_SHIFT (14U) -#define EHCI_HOST_QH_EPS_SHIFT (12U) -#define EHCI_HOST_QH_ENDPT_SHIFT (8U) -#define EHCI_HOST_QH_I_SHIFT (7U) -#define EHCI_HOST_QH_DEVICE_ADDRESS_SHIFT (0U) -#define EHCI_HOST_QH_MULT_SHIFT (30U) -#define EHCI_HOST_QH_PORT_NUMBER_SHIFT (23U) -#define EHCI_HOST_QH_HUB_ADDR_SHIFT (16U) -#define EHCI_HOST_QH_UFRAME_CMASK_SHIFT (8U) -#define EHCI_HOST_QH_UFRAME_SMASK_SHIFT (0U) -#define EHCI_HOST_QH_STATUS_ERROR_MASK (0x0000007EU) +#define EHCI_HOST_QH_RL_SHIFT (28U) +#define EHCI_HOST_QH_RL_MASK (0xF0000000U) +#define EHCI_HOST_QH_C_SHIFT (27U) +#define EHCI_HOST_QH_MAX_PACKET_LENGTH_SHIFT (16U) +#define EHCI_HOST_QH_MAX_PACKET_LENGTH_MASK (0x07FF0000U) +#define EHCI_HOST_QH_H_SHIFT (15U) +#define EHCI_HOST_QH_DTC_SHIFT (14U) +#define EHCI_HOST_QH_EPS_SHIFT (12U) +#define EHCI_HOST_QH_ENDPT_SHIFT (8U) +#define EHCI_HOST_QH_I_SHIFT (7U) +#define EHCI_HOST_QH_DEVICE_ADDRESS_SHIFT (0U) +#define EHCI_HOST_QH_MULT_SHIFT (30U) +#define EHCI_HOST_QH_PORT_NUMBER_SHIFT (23U) +#define EHCI_HOST_QH_HUB_ADDR_SHIFT (16U) +#define EHCI_HOST_QH_UFRAME_CMASK_SHIFT (8U) +#define EHCI_HOST_QH_UFRAME_SMASK_SHIFT (0U) +#define EHCI_HOST_QH_STATUS_ERROR_MASK (0x0000007EU) #define EHCI_HOST_QH_STATUS_NOSTALL_ERROR_MASK (0x0000003EU) -#define EHCI_HOST_QTD_DT_SHIFT (31U) -#define EHCI_HOST_QTD_DT_MASK (0x80000000U) -#define EHCI_HOST_QTD_TOTAL_BYTES_SHIFT (16U) -#define EHCI_HOST_QTD_TOTAL_BYTES_MASK (0x7FFF0000U) -#define EHCI_HOST_QTD_IOC_MASK (0x00008000U) -#define EHCI_HOST_QTD_C_PAGE_SHIFT (12U) -#define EHCI_HOST_QTD_CERR_SHIFT (10U) -#define EHCI_HOST_QTD_CERR_MAX_VALUE (0x00000003UL) -#define EHCI_HOST_QTD_PID_CODE_SHIFT (8U) -#define EHCI_HOST_QTD_STATUS_SHIFT (0U) -#define EHCI_HOST_QTD_CURRENT_OFFSET_MASK (0x00000FFFU) -#define EHCI_HOST_QTD_BUFFER_POINTER_SHIFT (12U) -#define EHCI_HOST_QTD_STATUS_ACTIVE_MASK (0x00000080U) -#define EHCI_HOST_QTD_STATUS_MASK (0x000000ffU) -#define EHCI_HOST_QTD_STATUS_ERROR_MASK (0x0000007EU) +#define EHCI_HOST_QTD_DT_SHIFT (31U) +#define EHCI_HOST_QTD_DT_MASK (0x80000000U) +#define EHCI_HOST_QTD_TOTAL_BYTES_SHIFT (16U) +#define EHCI_HOST_QTD_TOTAL_BYTES_MASK (0x7FFF0000U) +#define EHCI_HOST_QTD_IOC_MASK (0x00008000U) +#define EHCI_HOST_QTD_C_PAGE_SHIFT (12U) +#define EHCI_HOST_QTD_CERR_SHIFT (10U) +#define EHCI_HOST_QTD_CERR_MAX_VALUE (0x00000003U) +#define EHCI_HOST_QTD_PID_CODE_SHIFT (8U) +#define EHCI_HOST_QTD_STATUS_SHIFT (0U) +#define EHCI_HOST_QTD_CURRENT_OFFSET_MASK (0x00000FFFU) +#define EHCI_HOST_QTD_BUFFER_POINTER_SHIFT (12U) +#define EHCI_HOST_QTD_STATUS_ACTIVE_MASK (0x00000080U) +#define EHCI_HOST_QTD_STATUS_MASK (0x000000ffU) +#define EHCI_HOST_QTD_STATUS_ERROR_MASK (0x0000007EU) #define EHCI_HOST_QTD_STATUS_STALL_ERROR_MASK (0x00000040U) -#define EHCI_HOST_ITD_STATUS_ACTIVE_MASK (0x80000000U) -#define EHCI_HOST_ITD_TRANSACTION_LEN_SHIFT (16U) -#define EHCI_HOST_ITD_TRANSACTION_LEN_MASK (0x0FFF0000U) -#define EHCI_HOST_ITD_IOC_SHIFT (15U) -#define EHCI_HOST_ITD_PG_SHIFT (12U) +#define EHCI_HOST_ITD_STATUS_ACTIVE_MASK (0x80000000U) +#define EHCI_HOST_ITD_TRANSACTION_LEN_SHIFT (16U) +#define EHCI_HOST_ITD_TRANSACTION_LEN_MASK (0x0FFF0000U) +#define EHCI_HOST_ITD_IOC_SHIFT (15U) +#define EHCI_HOST_ITD_PG_SHIFT (12U) #define EHCI_HOST_ITD_TRANSACTION_OFFSET_SHIFT (0U) -#define EHCI_HOST_ITD_TRANSACTION_OFFSET_MASK (0x00000FFFU) -#define EHCI_HOST_ITD_BUFFER_POINTER_SHIFT (12U) -#define EHCI_HOST_ITD_ENDPT_SHIFT (8U) -#define EHCI_HOST_ITD_DEVICE_ADDRESS_SHIFT (0U) -#define EHCI_HOST_ITD_MAX_PACKET_SIZE_SHIFT (0U) -#define EHCI_HOST_ITD_MULT_SHIFT (0U) -#define EHCI_HOST_ITD_DIRECTION_SHIFT (11U) +#define EHCI_HOST_ITD_TRANSACTION_OFFSET_MASK (0x00000FFFU) +#define EHCI_HOST_ITD_BUFFER_POINTER_SHIFT (12U) +#define EHCI_HOST_ITD_ENDPT_SHIFT (8U) +#define EHCI_HOST_ITD_DEVICE_ADDRESS_SHIFT (0U) +#define EHCI_HOST_ITD_MAX_PACKET_SIZE_SHIFT (0U) +#define EHCI_HOST_ITD_MULT_SHIFT (0U) +#define EHCI_HOST_ITD_DIRECTION_SHIFT (11U) -#define EHCI_HOST_SITD_STATUS_ACTIVE_MASK (0x00000080U) -#define EHCI_HOST_SITD_DIRECTION_SHIFT (31U) -#define EHCI_HOST_SITD_PORT_NUMBER_SHIFT (24U) -#define EHCI_HOST_SITD_HUB_ADDR_SHIFT (16U) -#define EHCI_HOST_SITD_ENDPT_SHIFT (8U) +#define EHCI_HOST_SITD_STATUS_ACTIVE_MASK (0x00000080U) +#define EHCI_HOST_SITD_DIRECTION_SHIFT (31U) +#define EHCI_HOST_SITD_PORT_NUMBER_SHIFT (24U) +#define EHCI_HOST_SITD_HUB_ADDR_SHIFT (16U) +#define EHCI_HOST_SITD_ENDPT_SHIFT (8U) #define EHCI_HOST_SITD_DEVICE_ADDRESS_SHIFT (0U) -#define EHCI_HOST_SITD_CMASK_SHIFT (8U) -#define EHCI_HOST_SITD_SMASK_SHIFT (0U) -#define EHCI_HOST_SITD_TOTAL_BYTES_SHIFT (16U) -#define EHCI_HOST_SITD_TOTAL_BYTES_MASK (0x03FF0000U) -#define EHCI_HOST_SITD_TP_SHIFT (3U) -#define EHCI_HOST_SITD_TCOUNT_SHIFT (0U) -#define EHCI_HOST_SITD_IOC_SHIFT (31U) +#define EHCI_HOST_SITD_CMASK_SHIFT (8U) +#define EHCI_HOST_SITD_SMASK_SHIFT (0U) +#define EHCI_HOST_SITD_TOTAL_BYTES_SHIFT (16U) +#define EHCI_HOST_SITD_TOTAL_BYTES_MASK (0x03FF0000U) +#define EHCI_HOST_SITD_TP_SHIFT (3U) +#define EHCI_HOST_SITD_TCOUNT_SHIFT (0U) +#define EHCI_HOST_SITD_IOC_SHIFT (31U) /* register related MACROs */ -#define EHCI_PORTSC1_W1_BITS (0x0000002AU) +#define EHCI_PORTSC1_W1_BITS (0x0000002AU) #define EHCI_MAX_UFRAME_VALUE (0x00003FFFU) /* task event */ -#define EHCI_TASK_EVENT_DEVICE_ATTACH (0x01U) +#define EHCI_TASK_EVENT_DEVICE_ATTACH (0x01U) #define EHCI_TASK_EVENT_TRANSACTION_DONE (0x02U) -#define EHCI_TASK_EVENT_DEVICE_DETACH (0x04U) -#define EHCI_TASK_EVENT_PORT_CHANGE (0x08U) -#define EHCI_TASK_EVENT_TIMER0 (0x10U) -#define EHCI_TASK_EVENT_TIMER1 (0x20U) +#define EHCI_TASK_EVENT_DEVICE_DETACH (0x04U) +#define EHCI_TASK_EVENT_PORT_CHANGE (0x08U) +#define EHCI_TASK_EVENT_TIMER0 (0x10U) +#define EHCI_TASK_EVENT_TIMER1 (0x20U) -#define USB_HostEhciLock() (void)OSA_MutexLock(ehciInstance->ehciMutex, USB_OSA_WAIT_TIMEOUT) -#define USB_HostEhciUnlock() (void)OSA_MutexUnlock(ehciInstance->ehciMutex) +#define USB_HostEhciLock() USB_OsaMutexLock(ehciInstance->ehciMutex) +#define USB_HostEhciUnlock() USB_OsaMutexUnlock(ehciInstance->ehciMutex) /******************************************************************************* * KHCI driver public structures, enumerations, macros, functions @@ -122,8 +144,6 @@ #define USB_HOST_EHCI_PORT_CONNECT_DEBOUNCE_DELAY (101U) /*! @brief Delay for port reset */ #define USB_HOST_EHCI_PORT_RESET_DELAY (11U) -/*! @brief The MAX continuous transfers that application can send. */ -#define USB_HOST_EHCI_ISO_MAX_CONTINUOUS_TRANSFER (8U) /*! @brief The SITD inserts a frame interval for putting more SITD continuously. * There is an interval when an application sends two FS/LS ISO transfers. * When the interval is less than the macro, the two transfers are continuous in the frame list. Otherwise, the two @@ -151,7 +171,7 @@ */ #define USB_HOST_EHCI_ISO_BOUNCE_UFRAME_NUMBER (16U) /*! @brief Control or bulk transaction timeout value (unit: 100 ms) */ -#define USB_HOST_EHCI_CONTROL_BULK_TIME_OUT_VALUE (50U) +#define USB_HOST_EHCI_CONTROL_BULK_TIME_OUT_VALUE (20U) #if ((defined(USB_HOST_CONFIG_LOW_POWER_MODE)) && (USB_HOST_CONFIG_LOW_POWER_MODE > 0U)) typedef enum _bus_ehci_suspend_request_state @@ -303,10 +323,8 @@ typedef struct _usb_host_ehci_instance usb_host_ehci_pipe_t *ehciPipeIndexBase; /*!< Pipe buffer's start pointer*/ usb_host_ehci_pipe_t *ehciPipeList; /*!< Idle pipe list pointer*/ usb_host_ehci_pipe_t *ehciRunningPipeList; /*!< Running pipe list pointer*/ - osa_mutex_handle_t ehciMutex; /*!< EHCI mutex*/ - uint32_t mutexBuffer[(OSA_MUTEX_HANDLE_SIZE + 3) / 4]; /*!< The mutex buffer. */ - osa_event_handle_t taskEventHandle; /*!< EHCI task event*/ - uint32_t taskEventHandleBuffer[(OSA_EVENT_HANDLE_SIZE + 3) / 4]; /*!< EHCI task event handle buffer*/ + usb_osa_mutex_handle ehciMutex; /*!< EHCI mutex*/ + usb_osa_event_handle taskEventHandle; /*!< EHCI task event*/ #if ((defined(USB_HOST_CONFIG_LOW_POWER_MODE)) && (USB_HOST_CONFIG_LOW_POWER_MODE > 0U)) uint64_t matchTick; USBPHY_Type *registerPhyBase; /*!< The base address of the PHY register */ @@ -337,10 +355,6 @@ typedef struct _usb_host_ehci_data #endif #if ((defined(USB_HOST_CONFIG_EHCI_MAX_ITD)) && (USB_HOST_CONFIG_EHCI_MAX_ITD > 0U)) usb_host_ehci_itd_t ehciItd[USB_HOST_CONFIG_EHCI_MAX_ITD]; /*!< Idle ITD list array*/ - /* add additional 32bytes because the itd cannot cross over 4K boundary, - * If one ITD cross over 4K boundary, the code will move 32 bytes for ITD. - */ - uint32_t reserved[8]; #endif #if ((defined(USB_HOST_CONFIG_EHCI_MAX_SITD)) && (USB_HOST_CONFIG_EHCI_MAX_SITD > 0U)) usb_host_ehci_sitd_t ehciSitd[USB_HOST_CONFIG_EHCI_MAX_SITD]; /*!< Idle SITD list array*/ @@ -474,45 +488,6 @@ extern usb_status_t USB_HostEhciIoctl(usb_host_controller_handle controllerHandl uint32_t ioctlEvent, void *ioctlParam); -/*! - * @brief control ehci bus. - * - * @param ehciInstance ehci instance pointer. - * @param bus_control control code. - * - * @return kStatus_USB_Success or error codes. - */ -extern usb_status_t USB_HostEhciControlBus(usb_host_ehci_instance_t *ehciInstance, uint8_t busControl); - -/*! - * @brief ehci port change interrupt process function. - * - * @param ehciInstance ehci instance pointer. - */ -extern void USB_HostEhciPortChange(usb_host_ehci_instance_t *ehciInstance); - -/*! - * @brief ehci timer0 interrupt process function. - * cancel control/bulk transfer that time out. - * - * @param ehciInstance ehci instance pointer. - */ -extern void USB_HostEhciTimer0(usb_host_ehci_instance_t *ehciInstance); - -/*! - * @brief host ehci start async schedule. - * - * @param ehciInstance ehci instance pointer. - */ -extern void USB_HostEhciStartAsync(usb_host_ehci_instance_t *ehciInstance); - -/*! - * @brief host ehci start periodic schedule. - * - * @param ehciInstance ehci instance pointer. - */ -extern void USB_HostEhciStartPeriodic(usb_host_ehci_instance_t *ehciInstance); - /*! @}*/ #ifdef __cplusplus diff --git a/bsp/imxrt/libraries/drivers/usb/host/usb_host_framework.c b/bsp/imxrt/libraries/drivers/usb/host/usb_host_framework.c deleted file mode 100644 index b45612289d..0000000000 --- a/bsp/imxrt/libraries/drivers/usb/host/usb_host_framework.c +++ /dev/null @@ -1,261 +0,0 @@ -/* - * Copyright (c) 2015 - 2016, Freescale Semiconductor, Inc. - * Copyright 2016 NXP - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#include -#include "usb_host.h" -#include "usb_host_hci.h" -#include "usb_host_devices.h" -#include "usb_host_framework.h" -/******************************************************************************* - * Definitions - ******************************************************************************/ - -/* Component ID definition, used by tools. */ -#ifndef FSL_COMPONENT_ID -#define FSL_COMPONENT_ID "middleware.usb.host.fatfs_usb_stack" -#endif - -/******************************************************************************* - * Prototypes - ******************************************************************************/ - -/******************************************************************************* - * Variables - ******************************************************************************/ - -/******************************************************************************* - * Code - ******************************************************************************/ - -usb_status_t USB_HostCh9RequestCommon(usb_host_device_instance_t *deviceInstance, - usb_host_transfer_t *transfer, - uint8_t *buffer, - uint32_t bufferLen) -{ - /* initialize transfer */ - transfer->setupPacket->wLength = USB_SHORT_TO_LITTLE_ENDIAN((uint16_t)bufferLen); - transfer->transferBuffer = buffer; - transfer->transferLength = bufferLen; - - if (USB_HostSendSetup(deviceInstance->hostHandle, deviceInstance->controlPipe, transfer) != - kStatus_USB_Success) /* send setup transfer */ - { -#ifdef HOST_ECHO - usb_echo("failed for USB_HostSendSetup\r\n"); -#endif - (void)USB_HostFreeTransfer(deviceInstance->hostHandle, transfer); - return kStatus_USB_Error; - } - return kStatus_USB_Success; -} - -usb_status_t USB_HostStandardGetStatus(usb_host_device_instance_t *deviceInstance, - usb_host_transfer_t *transfer, - void *param) -{ - usb_host_get_status_param_t *statusParam; - uint8_t length; - - /* initialize transfer */ - statusParam = (usb_host_get_status_param_t *)param; - transfer->setupPacket->bmRequestType = USB_REQUEST_TYPE_DIR_IN | USB_REQUEST_TYPE_TYPE_STANDARD; - if (statusParam->requestType == (uint8_t)kRequestDevice) - { - transfer->setupPacket->bmRequestType |= USB_REQUEST_TYPE_RECIPIENT_DEVICE; - } - else if (statusParam->requestType == (uint8_t)kRequestInterface) - { - transfer->setupPacket->bmRequestType |= USB_REQUEST_TYPE_RECIPIENT_INTERFACE; - } - else - { - transfer->setupPacket->bmRequestType |= USB_REQUEST_TYPE_RECIPIENT_ENDPOINT; - } - transfer->setupPacket->wIndex = USB_SHORT_TO_LITTLE_ENDIAN(statusParam->statusSelector); - - length = 2; - if (statusParam->statusSelector == USB_REQUEST_STANDARD_GET_STATUS_OTG_STATUS_SELECTOR) - { - length = 1; - } - return USB_HostCh9RequestCommon(deviceInstance, transfer, statusParam->statusBuffer, length); -} - -usb_status_t USB_HostStandardSetClearFeature(usb_host_device_instance_t *deviceInstance, - usb_host_transfer_t *transfer, - void *param) -{ - usb_host_process_feature_param_t *featureParam; - - /* initialize transfer */ - featureParam = (usb_host_process_feature_param_t *)param; - if (featureParam->requestType == (uint8_t)kRequestDevice) - { - transfer->setupPacket->bmRequestType |= USB_REQUEST_TYPE_RECIPIENT_DEVICE; - } - else if (featureParam->requestType == (uint8_t)kRequestInterface) - { - transfer->setupPacket->bmRequestType |= USB_REQUEST_TYPE_RECIPIENT_INTERFACE; - } - else - { - transfer->setupPacket->bmRequestType |= USB_REQUEST_TYPE_RECIPIENT_ENDPOINT; - } - transfer->setupPacket->wValue = USB_SHORT_TO_LITTLE_ENDIAN(featureParam->featureSelector); - transfer->setupPacket->wIndex = USB_SHORT_TO_LITTLE_ENDIAN(featureParam->interfaceOrEndpoint); - - return USB_HostCh9RequestCommon(deviceInstance, transfer, NULL, 0); -} - -usb_status_t USB_HostStandardSetAddress(usb_host_device_instance_t *deviceInstance, - usb_host_transfer_t *transfer, - void *param) -{ - uint8_t address; - - /* initialize transfer */ - address = *(uint8_t *)param; - transfer->setupPacket->wValue = USB_SHORT_TO_LITTLE_ENDIAN(address); - - return USB_HostCh9RequestCommon(deviceInstance, transfer, NULL, 0); -} - -usb_status_t USB_HostStandardSetGetDescriptor(usb_host_device_instance_t *deviceInstance, - usb_host_transfer_t *transfer, - void *param) -{ - usb_host_process_descriptor_param_t *descriptorParam; - - /* initialize transfer */ - descriptorParam = (usb_host_process_descriptor_param_t *)param; - transfer->setupPacket->wValue = USB_SHORT_TO_LITTLE_ENDIAN( - (uint16_t)((uint16_t)descriptorParam->descriptorType << 8) | descriptorParam->descriptorIndex); - transfer->setupPacket->wIndex = USB_SHORT_TO_LITTLE_ENDIAN(descriptorParam->languageId); - return USB_HostCh9RequestCommon(deviceInstance, transfer, descriptorParam->descriptorBuffer, - descriptorParam->descriptorLength); -} - -usb_status_t USB_HostStandardGetInterface(usb_host_device_instance_t *deviceInstance, - usb_host_transfer_t *transfer, - void *param) -{ - usb_host_get_interface_param_t *interfaceParam; - - /* initialize transfer */ - interfaceParam = (usb_host_get_interface_param_t *)param; - transfer->setupPacket->bmRequestType |= USB_REQUEST_TYPE_DIR_IN; - transfer->setupPacket->bmRequestType |= USB_REQUEST_TYPE_RECIPIENT_INTERFACE; - transfer->setupPacket->wIndex = USB_SHORT_TO_LITTLE_ENDIAN(interfaceParam->interface); - - return USB_HostCh9RequestCommon(deviceInstance, transfer, interfaceParam->alternateInterfaceBuffer, 1); -} - -usb_status_t USB_HostStandardSetInterface(usb_host_device_instance_t *deviceInstance, - usb_host_transfer_t *transfer, - void *param) -{ - usb_host_set_interface_param_t *setParam; - - /* initialize transfer */ - setParam = (usb_host_set_interface_param_t *)param; - transfer->setupPacket->bmRequestType |= USB_REQUEST_TYPE_RECIPIENT_INTERFACE; - transfer->setupPacket->wIndex = USB_SHORT_TO_LITTLE_ENDIAN(setParam->interface); - transfer->setupPacket->wValue = USB_SHORT_TO_LITTLE_ENDIAN(setParam->alternateSetting); - - return USB_HostCh9RequestCommon(deviceInstance, transfer, NULL, 0); -} - -usb_status_t USB_HostStandardSyncFrame(usb_host_device_instance_t *deviceInstance, - usb_host_transfer_t *transfer, - void *param) -{ - usb_host_synch_frame_param_t *frameParam; - - /* initialize transfer */ - frameParam = (usb_host_synch_frame_param_t *)param; - transfer->setupPacket->bmRequestType |= USB_REQUEST_TYPE_DIR_IN; - transfer->setupPacket->bmRequestType |= USB_REQUEST_TYPE_RECIPIENT_ENDPOINT; - transfer->setupPacket->wIndex = USB_SHORT_TO_LITTLE_ENDIAN(frameParam->endpoint); - - return USB_HostCh9RequestCommon(deviceInstance, transfer, frameParam->frameNumberBuffer, 2); -} - -usb_status_t USB_HostRequestControl(usb_device_handle deviceHandle, - uint8_t usbRequest, - usb_host_transfer_t *transfer, - void *param) -{ - usb_host_device_instance_t *deviceInstance = (usb_host_device_instance_t *)deviceHandle; - usb_status_t status = kStatus_USB_Error; - - if (deviceHandle == NULL) - { - return kStatus_USB_InvalidHandle; - } - - /* reset transfer fields */ - transfer->setupPacket->bmRequestType = 0x00; - transfer->setupPacket->bRequest = usbRequest; - transfer->setupPacket->wIndex = 0; - transfer->setupPacket->wLength = 0; - transfer->setupPacket->wValue = 0; - - switch (usbRequest) - { - case USB_REQUEST_STANDARD_GET_STATUS: /* standard get status request */ - status = USB_HostStandardGetStatus(deviceInstance, transfer, param); - break; - - case USB_REQUEST_STANDARD_CLEAR_FEATURE: /* standard clear status request */ - case USB_REQUEST_STANDARD_SET_FEATURE: /* standard set feature request */ - status = USB_HostStandardSetClearFeature(deviceInstance, transfer, param); - break; - - case USB_REQUEST_STANDARD_SET_ADDRESS: /* standard set address request */ - status = USB_HostStandardSetAddress(deviceInstance, transfer, param); - break; - - case USB_REQUEST_STANDARD_GET_DESCRIPTOR: /* standard get descriptor request */ - case USB_REQUEST_STANDARD_SET_DESCRIPTOR: /* standard set descriptor request */ - if (usbRequest == USB_REQUEST_STANDARD_GET_DESCRIPTOR) - { - transfer->setupPacket->bmRequestType |= USB_REQUEST_TYPE_DIR_IN; - } - status = USB_HostStandardSetGetDescriptor(deviceInstance, transfer, param); - break; - - case USB_REQUEST_STANDARD_GET_CONFIGURATION: /* standard get configuration descriptor request */ - transfer->setupPacket->bmRequestType |= USB_REQUEST_TYPE_DIR_IN; - status = - USB_HostCh9RequestCommon((usb_host_device_instance_t *)deviceHandle, transfer, (uint8_t *)param, 1); - break; - - case USB_REQUEST_STANDARD_SET_CONFIGURATION: /* standard set configuration request */ - transfer->setupPacket->wValue = USB_SHORT_TO_LITTLE_ENDIAN(*((uint8_t *)param)); - status = USB_HostCh9RequestCommon((usb_host_device_instance_t *)deviceHandle, transfer, NULL, 0); - break; - - case USB_REQUEST_STANDARD_GET_INTERFACE: /* standard get interface request */ - status = USB_HostStandardGetInterface(deviceInstance, transfer, param); - break; - - case USB_REQUEST_STANDARD_SET_INTERFACE: /* standard set interface request */ - status = USB_HostStandardSetInterface(deviceInstance, transfer, param); - break; - - case USB_REQUEST_STANDARD_SYNCH_FRAME: /* standard synch frame request */ - status = USB_HostStandardSyncFrame(deviceInstance, transfer, param); - break; - - default: - /*no action*/ - break; - } - - return status; -} diff --git a/bsp/imxrt/libraries/drivers/usb/host/usb_host_framework.h b/bsp/imxrt/libraries/drivers/usb/host/usb_host_framework.h deleted file mode 100644 index 53f618fdc3..0000000000 --- a/bsp/imxrt/libraries/drivers/usb/host/usb_host_framework.h +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright (c) 2015 - 2016, Freescale Semiconductor, Inc. - * Copyright 2016 NXP - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#ifndef _USB_HOST_CH9_H_ -#define _USB_HOST_CH9_H_ - -/******************************************************************************* - * Definitions - ******************************************************************************/ - -/*! - * @addtogroup usb_host_drv - * @{ - */ - -/*! @}*/ - -/******************************************************************************* - * API - ******************************************************************************/ -/*! - * @brief standard control transfer common code. - * - * @param deviceInstance device instance handle. - * @param transfer transfer. - * @param buffer data buffer pointer. - * @param bufferLen data length. - * - * @return kStatus_USB_Success or error codes. - */ -usb_status_t USB_HostCh9RequestCommon(usb_host_device_instance_t *deviceInstance, - usb_host_transfer_t *transfer, - uint8_t *buffer, - uint32_t bufferLen); - -/*! - * @brief standard get status implementation. - * - * @param deviceInstance device instance handle. - * @param transfer transfer. - * @param param parameter. - * - * @return kStatus_USB_Success or error codes. - */ -usb_status_t USB_HostStandardGetStatus(usb_host_device_instance_t *deviceInstance, - usb_host_transfer_t *transfer, - void *param); - -/*! - * @brief standard set/clear feature implementation. - * - * @param deviceInstance device instance handle. - * @param transfer transfer. - * @param param parameter. - * - * @return kStatus_USB_Success or error codes. - */ -usb_status_t USB_HostStandardSetClearFeature(usb_host_device_instance_t *deviceInstance, - usb_host_transfer_t *transfer, - void *param); - -/*! - * @brief standard set address implementation. - * - * @param deviceInstance device instance handle. - * @param transfer transfer. - * @param param parameter. - * - * @return kStatus_USB_Success or error codes. - */ -usb_status_t USB_HostStandardSetAddress(usb_host_device_instance_t *deviceInstance, - usb_host_transfer_t *transfer, - void *param); - -/*! - * @brief standard set/get descriptor implementation. - * - * @param deviceInstance device instance handle. - * @param transfer transfer. - * @param param parameter. - * - * @return kStatus_USB_Success or error codes. - */ -usb_status_t USB_HostStandardSetGetDescriptor(usb_host_device_instance_t *deviceInstance, - usb_host_transfer_t *transfer, - void *param); - -/*! - * @brief standard get interface implementation. - * - * @param deviceInstance device instance handle. - * @param transfer transfer. - * @param param parameter. - * - * @return kStatus_USB_Success or error codes. - */ -usb_status_t USB_HostStandardGetInterface(usb_host_device_instance_t *deviceInstance, - usb_host_transfer_t *transfer, - void *param); - -/*! - * @brief standard set interface implementation. - * - * @param deviceInstance device instance handle. - * @param transfer transfer. - * @param param parameter. - * - * @return kStatus_USB_Success or error codes. - */ -usb_status_t USB_HostStandardSetInterface(usb_host_device_instance_t *deviceInstance, - usb_host_transfer_t *transfer, - void *param); - -/*! - * @brief standard sync frame implementation. - * - * @param deviceInstance device instance handle. - * @param transfer transfer. - * @param param parameter. - * - * @return kStatus_USB_Success or error codes. - */ -usb_status_t USB_HostStandardSyncFrame(usb_host_device_instance_t *deviceInstance, - usb_host_transfer_t *transfer, - void *param); -#endif /* _USB_HOST_CH9_H_ */ diff --git a/bsp/imxrt/libraries/drivers/usb/host/usb_host_hci.c b/bsp/imxrt/libraries/drivers/usb/host/usb_host_hci.c index 1409868b7b..927bf8bd9c 100644 --- a/bsp/imxrt/libraries/drivers/usb/host/usb_host_hci.c +++ b/bsp/imxrt/libraries/drivers/usb/host/usb_host_hci.c @@ -1,12 +1,34 @@ /* * Copyright (c) 2015 - 2016, Freescale Semiconductor, Inc. - * Copyright 2016 - 2019 NXP - * All rights reserved. + * Copyright 2016 NXP * - * SPDX-License-Identifier: BSD-3-Clause + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * o Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * o Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * o Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include +#include #include "fsl_common.h" #include "usb_host.h" #include "usb_host_hci.h" @@ -20,24 +42,16 @@ * Definitions ******************************************************************************/ -/* Component ID definition, used by tools. */ -#ifndef FSL_COMPONENT_ID -#define FSL_COMPONENT_ID "middleware.usb.host_stack" -#endif - -#if defined __CORTEX_M && (__CORTEX_M == 7U) -#if (defined(USB_HOST_CONFIG_BUFFER_PROPERTY_CACHEABLE) && (USB_HOST_CONFIG_BUFFER_PROPERTY_CACHEABLE > 0U)) -#warning USB_HOST_CONFIG_BUFFER_PROPERTY_CACHEABLE is not supported. -#endif -#endif - /******************************************************************************* * Prototypes ******************************************************************************/ #if ((defined USB_HOST_CONFIG_HUB) && (USB_HOST_CONFIG_HUB)) -#include "usb_host_hub.h" -#include "usb_host_hub_app.h" +extern uint32_t USB_HostHubGetTotalThinkTime(usb_host_handle hostHandle, uint8_t parentHubNo); + +extern usb_status_t USB_HostHubSuspendDevice(usb_host_handle hostHandle); + +extern usb_status_t USB_HostHubResumeDevice(usb_host_handle hostHandle); #endif /*! @@ -63,6 +77,15 @@ static void USB_HostReleaseInstance(usb_host_instance_t *hostInstance); static void USB_HostGetControllerInterface(uint8_t controllerId, const usb_host_controller_interface_t **controllerTable); +#if ((defined USB_HOST_CONFIG_COMPLIANCE_TEST) && (USB_HOST_CONFIG_COMPLIANCE_TEST)) +#if ((defined USB_HOST_CONFIG_EHCI) && (USB_HOST_CONFIG_EHCI)) +extern void USB_HostEhciTestModeInit(usb_device_handle devHandle); +#endif /* USB_HOST_CONFIG_COMPLIANCE_TEST */ +#if ((defined USB_HOST_CONFIG_IP3516HS) && (USB_HOST_CONFIG_IP3516HS)) +extern void USB_HostIp3516HsTestModeInit(usb_device_handle devHandle); +#endif /* USB_HOST_CONFIG_COMPLIANCE_TEST */ +#endif /* USB_HOST_CONFIG_EHCI */ + /******************************************************************************* * Variables ******************************************************************************/ @@ -71,7 +94,8 @@ usb_host_instance_t g_UsbHostInstance[USB_HOST_CONFIG_MAX_HOST]; #if ((defined USB_HOST_CONFIG_EHCI) && (USB_HOST_CONFIG_EHCI)) #include "usb_host_ehci.h" -static const usb_host_controller_interface_t s_EhciInterface = { +static const usb_host_controller_interface_t s_EhciInterface = \ +{ USB_HostEhciCreate, USB_HostEhciDestory, USB_HostEhciOpenPipe, USB_HostEhciClosePipe, USB_HostEhciWritePipe, USB_HostEhciReadpipe, USB_HostEhciIoctl, }; @@ -79,7 +103,8 @@ static const usb_host_controller_interface_t s_EhciInterface = { #if ((defined USB_HOST_CONFIG_KHCI) && (USB_HOST_CONFIG_KHCI)) #include "usb_host_khci.h" -static const usb_host_controller_interface_t s_KhciInterface = { +static const usb_host_controller_interface_t s_KhciInterface = \ +{ USB_HostKhciCreate, USB_HostKhciDestory, USB_HostKhciOpenPipe, USB_HostKhciClosePipe, USB_HostKhciWritePipe, USB_HostKhciReadpipe, USB_HostKciIoctl, }; @@ -87,7 +112,8 @@ static const usb_host_controller_interface_t s_KhciInterface = { #if ((defined USB_HOST_CONFIG_OHCI) && (USB_HOST_CONFIG_OHCI > 0U)) #include "usb_host_ohci.h" -static const usb_host_controller_interface_t s_OhciInterface = { +static const usb_host_controller_interface_t s_OhciInterface = \ +{ USB_HostOhciCreate, USB_HostOhciDestory, USB_HostOhciOpenPipe, USB_HostOhciClosePipe, USB_HostOhciWritePipe, USB_HostOhciReadPipe, USB_HostOhciIoctl, }; @@ -95,67 +121,65 @@ static const usb_host_controller_interface_t s_OhciInterface = { #if ((defined USB_HOST_CONFIG_IP3516HS) && (USB_HOST_CONFIG_IP3516HS > 0U)) #include "usb_host_ip3516hs.h" -static const usb_host_controller_interface_t s_Ip3516HsInterface = { +static const usb_host_controller_interface_t s_Ip3516HsInterface = \ +{ USB_HostIp3516HsCreate, USB_HostIp3516HsDestory, USB_HostIp3516HsOpenPipe, USB_HostIp3516HsClosePipe, USB_HostIp3516HsWritePipe, USB_HostIp3516HsReadPipe, USB_HostIp3516HsIoctl, }; #endif /* USB_HOST_CONFIG_IP3516HS */ -USB_DMA_NONINIT_DATA_ALIGN(USB_DATA_ALIGN_SIZE) -static uint8_t s_Setupbuffer[USB_HOST_CONFIG_MAX_HOST][USB_HOST_CONFIG_MAX_TRANSFERS][USB_DATA_ALIGN_SIZE_MULTIPLE(8)]; +USB_DMA_NONINIT_DATA_ALIGN(USB_DATA_ALIGN_SIZE) static uint8_t s_Setupbuffer[USB_HOST_CONFIG_MAX_HOST][USB_HOST_CONFIG_MAX_TRANSFERS][USB_DATA_ALIGN_SIZE_MULTIPLE(8)]; /******************************************************************************* - * Code - ******************************************************************************/ +* Code +******************************************************************************/ #if ((defined USB_HOST_CONFIG_COMPLIANCE_TEST) && (USB_HOST_CONFIG_COMPLIANCE_TEST)) /*FUNCTION*---------------------------------------------------------------- - * - * Function Name : usb_test_mode_init - * Returned Value : None - * Comments : - * This function is called by common class to initialize the class driver. It - * is called in response to a select interface call by application - * - *END*--------------------------------------------------------------------*/ +* +* Function Name : usb_test_mode_init +* Returned Value : None +* Comments : +* This function is called by common class to initialize the class driver. It +* is called in response to a select interface call by application +* +*END*--------------------------------------------------------------------*/ usb_status_t USB_HostTestModeInit(usb_device_handle deviceHandle) { #if (((defined USB_HOST_CONFIG_EHCI) && (USB_HOST_CONFIG_EHCI)) || \ ((defined USB_HOST_CONFIG_IP3516HS) && (USB_HOST_CONFIG_IP3516HS))) usb_host_device_instance_t *deviceInstance = (usb_host_device_instance_t *)deviceHandle; - usb_host_instance_t *hostInstance = (usb_host_instance_t *)deviceInstance->hostHandle; + usb_host_instance_t *hostInstance = (usb_host_instance_t *)deviceInstance->hostHandle; #endif uint32_t productId; uint32_t vendorId; - (void)usb_echo("usb host test init\r\n"); - (void)USB_HostHelperGetPeripheralInformation(deviceHandle, (uint32_t)kUSB_HostGetDevicePID, &productId); - (void)USB_HostHelperGetPeripheralInformation(deviceHandle, (uint32_t)kUSB_HostGetDeviceVID, &vendorId); - (void)usb_echo(" vendor id :0x%x product id:0x%x \r\n", vendorId, productId); + usb_echo("usb host test init\r\n"); + USB_HostHelperGetPeripheralInformation(deviceHandle, kUSB_HostGetDevicePID, &productId); + USB_HostHelperGetPeripheralInformation(deviceHandle, kUSB_HostGetDeviceVID, &vendorId); + usb_echo(" vendor id :0x%x product id:0x%x \r\n", vendorId, productId); - if ((productId != 0x0200U) && (productId != 0x0101U) && (productId != 0x0102U) && (productId != 0x0103U) && - (productId != 0x0104U) && (productId != 0x0105U) && (productId != 0x0106U) && (productId != 0x0107U) && - (productId != 0x0108U)) + if ((productId != 0x0200U) && (productId != 0x0101) && (productId != 0x0102) && (productId != 0x0103) && + (productId != 0x0104) && (productId != 0x0105) && (productId != 0x0106) && (productId != 0x0107) && + (productId != 0x0108)) { - (void)usb_echo("Unsupported Device\r\n"); + usb_echo("Unsupported Device\r\n"); } if (productId == 0x0200U) { - (void)usb_echo("PET test device attached\r\n"); + usb_echo("PET test device attached\r\n"); } else { #if ((defined USB_HOST_CONFIG_EHCI) && (USB_HOST_CONFIG_EHCI)) if (hostInstance->controllerTable == &s_EhciInterface) { - (void)hostInstance->controllerTable->controllerIoctl(hostInstance->controllerHandle, kUSB_HostTestModeInit, - (void *)deviceHandle); + USB_HostEhciTestModeInit(deviceHandle); } -#elif ((defined USB_HOST_CONFIG_IP3516HS) && (USB_HOST_CONFIG_IP3516HS)) +#elif((defined USB_HOST_CONFIG_IP3516HS) && (USB_HOST_CONFIG_IP3516HS)) if (hostInstance->controllerTable == &s_Ip3516HsInterface) { - (void)hostInstance->controllerTable->controllerIoctl(hostInstance->controllerHandle, kUSB_HostTestModeInit, - (void *)deviceHandle); + USB_HostIp3516HsTestModeInit(deviceHandle); } #endif } @@ -166,14 +190,13 @@ usb_status_t USB_HostTestModeInit(usb_device_handle deviceHandle) static usb_host_instance_t *USB_HostGetInstance(void) { - uint8_t i = 0; + uint8_t i = 0; uint32_t index = 0; - void *temp; - OSA_SR_ALLOC(); - OSA_ENTER_CRITICAL(); + USB_OSA_SR_ALLOC(); + USB_OSA_ENTER_CRITICAL(); for (; i < USB_HOST_CONFIG_MAX_HOST; i++) { - if (g_UsbHostInstance[i].occupied != 1U) + if (g_UsbHostInstance[i].occupied != 1) { uint8_t *buffer = (uint8_t *)&g_UsbHostInstance[i]; for (uint32_t j = 0U; j < sizeof(usb_host_instance_t); j++) @@ -181,53 +204,53 @@ static usb_host_instance_t *USB_HostGetInstance(void) buffer[j] = 0x00U; } g_UsbHostInstance[i].occupied = 1; - OSA_EXIT_CRITICAL(); + USB_OSA_EXIT_CRITICAL(); for (index = 0; index < USB_HOST_CONFIG_MAX_TRANSFERS; ++index) { - temp = (void *)&(s_Setupbuffer[i][index][0]); - g_UsbHostInstance[i].transferList[index].setupPacket = (usb_setup_struct_t *)temp; + g_UsbHostInstance[i].transferList[index].setupPacket = + (usb_setup_struct_t *)&(s_Setupbuffer[i][index][0]); } return &g_UsbHostInstance[i]; } } - OSA_EXIT_CRITICAL(); + USB_OSA_EXIT_CRITICAL(); return NULL; } static void USB_HostReleaseInstance(usb_host_instance_t *hostInstance) { - OSA_SR_ALLOC(); - OSA_ENTER_CRITICAL(); + USB_OSA_SR_ALLOC(); + USB_OSA_ENTER_CRITICAL(); hostInstance->occupied = 0; - OSA_EXIT_CRITICAL(); + USB_OSA_EXIT_CRITICAL(); } static void USB_HostGetControllerInterface(uint8_t controllerId, const usb_host_controller_interface_t **controllerTable) { #if ((defined USB_HOST_CONFIG_KHCI) && (USB_HOST_CONFIG_KHCI)) - if (controllerId == (uint8_t)kUSB_ControllerKhci0) + if (controllerId == kUSB_ControllerKhci0) { *controllerTable = &s_KhciInterface; } #endif /* USB_HOST_CONFIG_KHCI */ #if ((defined USB_HOST_CONFIG_EHCI) && (USB_HOST_CONFIG_EHCI)) - if ((controllerId == (uint8_t)kUSB_ControllerEhci0) || (controllerId == (uint8_t)kUSB_ControllerEhci1)) + if ((controllerId == kUSB_ControllerEhci0) || (controllerId == kUSB_ControllerEhci1)) { *controllerTable = &s_EhciInterface; } #endif /* USB_HOST_CONFIG_EHCI */ #if ((defined USB_HOST_CONFIG_OHCI) && (USB_HOST_CONFIG_OHCI > 0U)) - if (controllerId == (uint8_t)kUSB_ControllerOhci0) + if (controllerId == kUSB_ControllerOhci0) { *controllerTable = &s_OhciInterface; } #endif /* USB_HOST_CONFIG_OHCI */ #if ((defined USB_HOST_CONFIG_IP3516HS) && (USB_HOST_CONFIG_IP3516HS > 0U)) - if (controllerId == (uint8_t)kUSB_ControllerIp3516Hs0) + if (controllerId == kUSB_ControllerIp3516Hs0) { *controllerTable = &s_Ip3516HsInterface; } @@ -236,10 +259,10 @@ static void USB_HostGetControllerInterface(uint8_t controllerId, usb_status_t USB_HostInit(uint8_t controllerId, usb_host_handle *hostHandle, host_callback_t callbackFn) { - usb_status_t status = kStatus_USB_Success; + usb_status_t status = kStatus_USB_Success; usb_host_instance_t *hostInstance = NULL; usb_host_transfer_t *transferPrev = NULL; - uint8_t i = 0; + uint8_t i = 0; hostInstance = USB_HostGetInstance(); /* get one host instance */ if (hostInstance == NULL) @@ -268,11 +291,10 @@ usb_status_t USB_HostInit(uint8_t controllerId, usb_host_handle *hostHandle, hos } /* HOST instance init*/ - hostInstance->controllerId = controllerId; + hostInstance->controllerId = controllerId; hostInstance->deviceCallback = callbackFn; - hostInstance->deviceList = NULL; - hostInstance->hostMutex = (osa_mutex_handle_t)(&hostInstance->mutexBuffer[0]); - if (KOSA_StatusSuccess != OSA_MutexCreate(hostInstance->hostMutex)) + hostInstance->deviceList = NULL; + if (kStatus_USB_OSA_Success != USB_OsaMutexCreate(&hostInstance->hostMutex)) { USB_HostReleaseInstance(hostInstance); #ifdef HOST_ECHO @@ -284,19 +306,19 @@ usb_status_t USB_HostInit(uint8_t controllerId, usb_host_handle *hostHandle, hos /* initialize transfer list */ hostInstance->transferHead = &hostInstance->transferList[0]; - transferPrev = hostInstance->transferHead; + transferPrev = hostInstance->transferHead; for (i = 1; i < USB_HOST_CONFIG_MAX_TRANSFERS; ++i) { transferPrev->next = &hostInstance->transferList[i]; - transferPrev = transferPrev->next; + transferPrev = transferPrev->next; } - /* controller create, the callbackFn is initialized in USB_HostGetControllerInterface */ + /* controller create */ status = hostInstance->controllerTable->controllerCreate(controllerId, hostInstance, &(hostInstance->controllerHandle)); if ((status != kStatus_USB_Success) || (hostInstance->controllerHandle == NULL)) { - (void)OSA_MutexDestroy(hostInstance->hostMutex); + USB_OsaMutexDestroy(hostInstance->hostMutex); USB_HostReleaseInstance(hostInstance); #ifdef HOST_ECHO usb_echo("host init: controller init fail\r\n"); @@ -310,8 +332,8 @@ usb_status_t USB_HostInit(uint8_t controllerId, usb_host_handle *hostHandle, hos usb_status_t USB_HostDeinit(usb_host_handle hostHandle) { - usb_status_t status = kStatus_USB_Success; - usb_host_instance_t *hostInstance = (usb_host_instance_t *)hostHandle; + usb_status_t status = kStatus_USB_Success; + usb_host_instance_t *hostInstance = (usb_host_instance_t *)hostHandle; usb_host_device_instance_t *deviceInstance = NULL; if (hostHandle == NULL) @@ -324,23 +346,23 @@ usb_status_t USB_HostDeinit(usb_host_handle hostHandle) while (deviceInstance != NULL) { deviceInstance = (usb_host_device_instance_t *)hostInstance->deviceList; - (void)USB_HostDetachDeviceInternal(hostHandle, deviceInstance); + USB_HostDetachDeviceInternal(hostHandle, deviceInstance); } - /* controller instance destroy, the callbackFn is initialized in USB_HostGetControllerInterface */ - status = hostInstance->controllerTable->controllerDestory(hostInstance->controllerHandle); + /* controller instance destory */ + status = hostInstance->controllerTable->controllerDestory(hostInstance->controllerHandle); hostInstance->controllerHandle = NULL; if (status != kStatus_USB_Success) { #ifdef HOST_ECHO - usb_echo("host controller destroy fail\r\n"); + usb_echo("host controller destory fail\r\n"); #endif } /* resource release */ - if (NULL != hostInstance->hostMutex) + if (hostInstance->hostMutex) { - (void)OSA_MutexDestroy(hostInstance->hostMutex); + USB_OsaMutexDestroy(hostInstance->hostMutex); hostInstance->hostMutex = NULL; } USB_HostReleaseInstance(hostInstance); @@ -352,7 +374,7 @@ usb_status_t USB_HostOpenPipe(usb_host_handle hostHandle, usb_host_pipe_handle *pipeHandle, usb_host_pipe_init_t *pipeInit) { - usb_status_t status = kStatus_USB_Success; + usb_status_t status = kStatus_USB_Success; usb_host_instance_t *hostInstance = (usb_host_instance_t *)hostHandle; if ((hostHandle == NULL) || (pipeInit == NULL)) @@ -360,7 +382,7 @@ usb_status_t USB_HostOpenPipe(usb_host_handle hostHandle, return kStatus_USB_InvalidHandle; } - /* call controller open pipe interface, the callbackFn is initialized in USB_HostGetControllerInterface */ + /* call controller open pipe interface */ status = hostInstance->controllerTable->controllerOpenPipe(hostInstance->controllerHandle, pipeHandle, pipeInit); return status; @@ -368,7 +390,7 @@ usb_status_t USB_HostOpenPipe(usb_host_handle hostHandle, usb_status_t USB_HostClosePipe(usb_host_handle hostHandle, usb_host_pipe_handle pipeHandle) { - usb_status_t status = kStatus_USB_Success; + usb_status_t status = kStatus_USB_Success; usb_host_instance_t *hostInstance = (usb_host_instance_t *)hostHandle; if ((hostHandle == NULL) || (pipeHandle == NULL)) @@ -376,7 +398,7 @@ usb_status_t USB_HostClosePipe(usb_host_handle hostHandle, usb_host_pipe_handle return kStatus_USB_InvalidHandle; } - /* call controller close pipe interface, the callbackFn is initialized in USB_HostGetControllerInterface */ + /* call controller close pipe interface */ status = hostInstance->controllerTable->controllerClosePipe(hostInstance->controllerHandle, pipeHandle); return status; @@ -384,7 +406,7 @@ usb_status_t USB_HostClosePipe(usb_host_handle hostHandle, usb_host_pipe_handle usb_status_t USB_HostSend(usb_host_handle hostHandle, usb_host_pipe_handle pipeHandle, usb_host_transfer_t *transfer) { - usb_status_t status = kStatus_USB_Success; + usb_status_t status = kStatus_USB_Success; usb_host_instance_t *hostInstance = (usb_host_instance_t *)hostHandle; if ((hostHandle == NULL) || (pipeHandle == NULL) || (transfer == NULL)) @@ -394,9 +416,9 @@ usb_status_t USB_HostSend(usb_host_handle hostHandle, usb_host_pipe_handle pipeH /* initialize transfer */ transfer->transferSofar = 0; - transfer->direction = USB_OUT; + transfer->direction = USB_OUT; - (void)USB_HostLock(); /* This api can be called by host task and app task */ + USB_HostLock(); /* This api can be called by host task and app task */ /* keep this code: in normal situation application will guarantee the device is attached when call send/receive function */ #if 0 @@ -413,10 +435,9 @@ usb_status_t USB_HostSend(usb_host_handle hostHandle, usb_host_pipe_handle pipeH DCACHE_CleanByRange((uint32_t)transfer->transferBuffer, transfer->transferLength); } #endif - /* the callbackFn is initialized in USB_HostGetControllerInterface */ status = hostInstance->controllerTable->controllerWritePipe(hostInstance->controllerHandle, pipeHandle, transfer); - (void)USB_HostUnlock(); + USB_HostUnlock(); return status; } @@ -424,7 +445,7 @@ usb_status_t USB_HostSendSetup(usb_host_handle hostHandle, usb_host_pipe_handle pipeHandle, usb_host_transfer_t *transfer) { - usb_status_t status = kStatus_USB_Success; + usb_status_t status = kStatus_USB_Success; usb_host_instance_t *hostInstance = (usb_host_instance_t *)hostHandle; if ((hostHandle == NULL) || (pipeHandle == NULL) || (transfer == NULL)) @@ -434,8 +455,8 @@ usb_status_t USB_HostSendSetup(usb_host_handle hostHandle, /* initialize transfer */ transfer->transferSofar = 0; - transfer->next = NULL; - transfer->setupStatus = 0; + transfer->next = NULL; + transfer->setupStatus = 0; if ((transfer->setupPacket->bmRequestType & USB_REQUEST_TYPE_DIR_MASK) == USB_REQUEST_TYPE_DIR_IN) { transfer->direction = USB_IN; @@ -445,7 +466,7 @@ usb_status_t USB_HostSendSetup(usb_host_handle hostHandle, transfer->direction = USB_OUT; } - (void)USB_HostLock(); /* This API can be called by host task and application task */ + USB_HostLock(); /* This API can be called by host task and application task */ /* keep this code: in normal situation application will guarantee the device is attached when call send/receive function */ #if 0 @@ -463,16 +484,15 @@ usb_status_t USB_HostSendSetup(usb_host_handle hostHandle, DCACHE_CleanInvalidateByRange((uint32_t)transfer->transferBuffer, transfer->transferLength); } #endif - /* the callbackFn is initialized in USB_HostGetControllerInterface */ status = hostInstance->controllerTable->controllerWritePipe(hostInstance->controllerHandle, pipeHandle, transfer); - (void)USB_HostUnlock(); + USB_HostUnlock(); return status; } usb_status_t USB_HostRecv(usb_host_handle hostHandle, usb_host_pipe_handle pipeHandle, usb_host_transfer_t *transfer) { - usb_status_t status = kStatus_USB_Success; + usb_status_t status = kStatus_USB_Success; usb_host_instance_t *hostInstance = (usb_host_instance_t *)hostHandle; if ((hostHandle == NULL) || (pipeHandle == NULL) || (transfer == NULL)) @@ -482,9 +502,9 @@ usb_status_t USB_HostRecv(usb_host_handle hostHandle, usb_host_pipe_handle pipeH /* initialize transfer */ transfer->transferSofar = 0; - transfer->direction = USB_IN; + transfer->direction = USB_IN; - (void)USB_HostLock(); /* This API can be called by host task and application task */ + USB_HostLock(); /* This API can be called by host task and application task */ /* keep this code: in normal situation application will guarantee the device is attached when call send/receive function */ #if 0 @@ -501,10 +521,9 @@ usb_status_t USB_HostRecv(usb_host_handle hostHandle, usb_host_pipe_handle pipeH DCACHE_CleanInvalidateByRange((uint32_t)transfer->transferBuffer, transfer->transferLength); } #endif - /* the callbackFn is initialized in USB_HostGetControllerInterface */ status = hostInstance->controllerTable->controllerReadPipe(hostInstance->controllerHandle, pipeHandle, transfer); - (void)USB_HostUnlock(); + USB_HostUnlock(); return status; } @@ -512,7 +531,7 @@ usb_status_t USB_HostCancelTransfer(usb_host_handle hostHandle, usb_host_pipe_handle pipeHandle, usb_host_transfer_t *transfer) { - usb_status_t status = kStatus_USB_Success; + usb_status_t status = kStatus_USB_Success; usb_host_instance_t *hostInstance = (usb_host_instance_t *)hostHandle; usb_host_cancel_param_t cancelParam; @@ -523,10 +542,9 @@ usb_status_t USB_HostCancelTransfer(usb_host_handle hostHandle, /* initialize cancel parameter */ cancelParam.pipeHandle = pipeHandle; - cancelParam.transfer = transfer; + cancelParam.transfer = transfer; /* USB_HostLock(); This api can be called by host task and app task */ - /* the callbackFn is initialized in USB_HostGetControllerInterface */ status = hostInstance->controllerTable->controllerIoctl(hostInstance->controllerHandle, kUSB_HostCancelTransfer, &cancelParam); /* USB_HostUnlock(); */ @@ -544,18 +562,18 @@ usb_status_t USB_HostMallocTransfer(usb_host_handle hostHandle, usb_host_transfe } /* get one from the transfer_head */ - (void)USB_HostLock(); + USB_HostLock(); if (hostInstance->transferHead != NULL) { - *transfer = hostInstance->transferHead; + *transfer = hostInstance->transferHead; hostInstance->transferHead = hostInstance->transferHead->next; - (void)USB_HostUnlock(); + USB_HostUnlock(); return kStatus_USB_Success; } else { *transfer = NULL; - (void)USB_HostUnlock(); + USB_HostUnlock(); return kStatus_USB_Error; } } @@ -574,10 +592,10 @@ usb_status_t USB_HostFreeTransfer(usb_host_handle hostHandle, usb_host_transfer_ } /* release one to the transfer_head */ - (void)USB_HostLock(); - transfer->next = hostInstance->transferHead; + USB_HostLock(); + transfer->next = hostInstance->transferHead; hostInstance->transferHead = transfer; - (void)USB_HostUnlock(); + USB_HostUnlock(); return kStatus_USB_Success; } @@ -586,28 +604,23 @@ usb_status_t USB_HostHelperGetPeripheralInformation(usb_device_handle deviceHand uint32_t *infoValue) { usb_host_device_instance_t *deviceInstance = (usb_host_device_instance_t *)deviceHandle; - uint32_t *temp; - usb_host_dev_info_t devInfo; if ((deviceHandle == NULL) || (infoValue == NULL)) { return kStatus_USB_InvalidParameter; } - devInfo = (usb_host_dev_info_t)infoCode; - switch (devInfo) + + switch (infoCode) { case kUSB_HostGetDeviceAddress: /* device address */ - *infoValue = (uint32_t)deviceInstance->setAddress; break; case kUSB_HostGetDeviceControlPipe: /* device control pipe */ - temp = (uint32_t *)deviceInstance->controlPipe; - *infoValue = (uint32_t)temp; + *infoValue = (uint32_t)deviceInstance->controlPipe; break; case kUSB_HostGetHostHandle: /* device host handle */ - temp = (uint32_t *)deviceInstance->hostHandle; - *infoValue = (uint32_t)temp; + *infoValue = (uint32_t)deviceInstance->hostHandle; break; #if ((defined USB_HOST_CONFIG_HUB) && (USB_HOST_CONFIG_HUB)) @@ -672,8 +685,7 @@ usb_status_t USB_HostHelperGetPeripheralInformation(usb_device_handle deviceHand break; default: - /*no action*/ - break; + return kStatus_USB_Error; } return kStatus_USB_Success; @@ -686,27 +698,26 @@ usb_status_t USB_HostHelperParseAlternateSetting(usb_host_interface_handle inter uint32_t endPosition; usb_descriptor_union_t *unionDes; usb_host_ep_t *epParse; - void *temp; + if (interfaceHandle == NULL) { return kStatus_USB_InvalidHandle; } - if (alternateSetting == 0U) + if (alternateSetting == 0) { return kStatus_USB_InvalidParameter; } /* parse configuration descriptor */ - temp = (void *)((usb_host_interface_t *)interfaceHandle)->interfaceDesc; - ; - unionDes = (usb_descriptor_union_t *)temp; /* interface extend descriptor start */ + unionDes = (usb_descriptor_union_t *)((usb_host_interface_t *)interfaceHandle) + ->interfaceDesc; /* interface extend descriptor start */ endPosition = (uint32_t)unionDes + ((usb_host_interface_t *)interfaceHandle)->interfaceExtensionLength; /* interface extend descriptor end */ unionDes = (usb_descriptor_union_t *)((uint32_t)unionDes + unionDes->common.bLength); - /* search for the alternate setting interface descriptor */ + /* search for the alternate setting interface descritpor */ while ((uint32_t)unionDes < endPosition) { if (unionDes->interface.bDescriptorType == USB_DESCRIPTOR_TYPE_INTERFACE) @@ -731,12 +742,12 @@ usb_status_t USB_HostHelperParseAlternateSetting(usb_host_interface_handle inter } /* initialize interface handle structure instance */ - interface->interfaceDesc = &unionDes->interface; - interface->alternateSettingNumber = 0U; - interface->epCount = 0U; - interface->interfaceExtension = NULL; - interface->interfaceExtensionLength = 0U; - interface->interfaceIndex = unionDes->interface.bInterfaceNumber; + interface->interfaceDesc = &unionDes->interface; + interface->alternateSettingNumber = 0; + interface->epCount = 0; + interface->interfaceExtension = NULL; + interface->interfaceExtensionLength = 0; + interface->interfaceIndex = unionDes->interface.bInterfaceNumber; /* search for endpoint descriptor start position */ unionDes = (usb_descriptor_union_t *)((uint32_t)unionDes + unionDes->common.bLength); @@ -759,7 +770,7 @@ usb_status_t USB_HostHelperParseAlternateSetting(usb_host_interface_handle inter } /* parse endpoint descriptor */ - if (interface->interfaceDesc->bNumEndpoints != 0U) + if (interface->interfaceDesc->bNumEndpoints != 0) { if ((unionDes->common.bDescriptorType != USB_DESCRIPTOR_TYPE_ENDPOINT) || (interface->interfaceDesc->bNumEndpoints > USB_HOST_CONFIG_INTERFACE_MAX_EP)) @@ -779,12 +790,11 @@ usb_status_t USB_HostHelperParseAlternateSetting(usb_host_interface_handle inter #endif return kStatus_USB_Error; } - epParse = (usb_host_ep_t *)&interface->epList[interface->epCount]; - temp = (void *)unionDes; - epParse->epDesc = (usb_descriptor_endpoint_t *)temp; + epParse = (usb_host_ep_t *)&interface->epList[interface->epCount]; + epParse->epDesc = (usb_descriptor_endpoint_t *)unionDes; epParse->epExtensionLength = 0; - epParse->epExtension = NULL; - unionDes = (usb_descriptor_union_t *)((uint32_t)unionDes + unionDes->common.bLength); + epParse->epExtension = NULL; + unionDes = (usb_descriptor_union_t *)((uint32_t)unionDes + unionDes->common.bLength); while ((uint32_t)unionDes < endPosition) { if ((unionDes->common.bDescriptorType != USB_DESCRIPTOR_TYPE_ENDPOINT) && @@ -810,7 +820,7 @@ usb_status_t USB_HostHelperParseAlternateSetting(usb_host_interface_handle inter void USB_HostGetVersion(uint32_t *version) { - if (NULL != version) + if (version) { *version = (uint32_t)USB_MAKE_VERSION(USB_STACK_VERSION_MAJOR, USB_STACK_VERSION_MINOR, USB_STACK_VERSION_BUGFIX); @@ -818,12 +828,12 @@ void USB_HostGetVersion(uint32_t *version) } #if ((defined(USB_HOST_CONFIG_LOW_POWER_MODE)) && (USB_HOST_CONFIG_LOW_POWER_MODE > 0U)) -/* Send BUS or specific device suspend request */ +/* Send BUS or specific device suepend request */ usb_status_t USB_HostSuspendDeviceResquest(usb_host_handle hostHandle, usb_device_handle deviceHandle) { usb_host_instance_t *hostInstance; usb_host_device_instance_t *deviceInstance; - usb_status_t status = kStatus_USB_Error; + usb_status_t status = kStatus_USB_Error; usb_host_bus_control_t type = kUSB_HostBusSuspend; if (hostHandle == NULL) @@ -839,7 +849,6 @@ usb_status_t USB_HostSuspendDeviceResquest(usb_host_handle hostHandle, usb_devic #if ((defined USB_HOST_CONFIG_HUB) && (USB_HOST_CONFIG_HUB)) status = USB_HostHubSuspendDevice(hostInstance); #else - /* the callbackFn is initialized in USB_HostGetControllerInterface */ status = hostInstance->controllerTable->controllerIoctl(hostInstance->controllerHandle, kUSB_HostBusControl, &type); #endif @@ -848,12 +857,11 @@ usb_status_t USB_HostSuspendDeviceResquest(usb_host_handle hostHandle, usb_devic { #if ((defined USB_HOST_CONFIG_HUB) && (USB_HOST_CONFIG_HUB)) deviceInstance = (usb_host_device_instance_t *)deviceHandle; - if (0U == deviceInstance->hubNumber) + if (0 == deviceInstance->hubNumber) { #endif if (hostInstance->deviceList == deviceHandle) { - /* the callbackFn is initialized in USB_HostGetControllerInterface */ status = hostInstance->controllerTable->controllerIoctl(hostInstance->controllerHandle, kUSB_HostBusControl, &type); } @@ -880,7 +888,7 @@ usb_status_t USB_HostResumeDeviceResquest(usb_host_handle hostHandle, usb_device { usb_host_instance_t *hostInstance; usb_host_device_instance_t *deviceInstance; - usb_status_t status = kStatus_USB_Error; + usb_status_t status = kStatus_USB_Error; usb_host_bus_control_t type = kUSB_HostBusResume; if (hostHandle == NULL) @@ -897,7 +905,6 @@ usb_status_t USB_HostResumeDeviceResquest(usb_host_handle hostHandle, usb_device if (NULL == deviceHandle) { - /* the callbackFn is initialized in USB_HostGetControllerInterface */ status = hostInstance->controllerTable->controllerIoctl(hostInstance->controllerHandle, kUSB_HostBusControl, &type); } @@ -905,12 +912,11 @@ usb_status_t USB_HostResumeDeviceResquest(usb_host_handle hostHandle, usb_device { #if ((defined USB_HOST_CONFIG_HUB) && (USB_HOST_CONFIG_HUB)) deviceInstance = (usb_host_device_instance_t *)deviceHandle; - if (0U == deviceInstance->hubNumber) + if (0 == deviceInstance->hubNumber) { #endif if (hostInstance->deviceList == deviceHandle) { - /* the callbackFn is initialized in USB_HostGetControllerInterface */ status = hostInstance->controllerTable->controllerIoctl(hostInstance->controllerHandle, kUSB_HostBusControl, &type); } @@ -929,13 +935,13 @@ usb_status_t USB_HostResumeDeviceResquest(usb_host_handle hostHandle, usb_device return status; } #if ((defined(USB_HOST_CONFIG_LPM_L1)) && (USB_HOST_CONFIG_LPM_L1 > 0U)) -/* Send BUS or specific device suspend request */ +/* Send BUS or specific device suepend request */ usb_status_t USB_HostL1SleepDeviceResquest(usb_host_handle hostHandle, usb_device_handle deviceHandle, uint8_t sleepType) { usb_host_instance_t *hostInstance; - usb_status_t status = kStatus_USB_Error; + usb_status_t status = kStatus_USB_Error; usb_host_bus_control_t type = kUSB_HostBusL1Sleep; if (hostHandle == NULL) @@ -949,9 +955,8 @@ usb_status_t USB_HostL1SleepDeviceResquest(usb_host_handle hostHandle, if (1U == sleepType) { /*#if ((defined USB_HOST_CONFIG_HUB) && (USB_HOST_CONFIG_HUB))*/ - /*To do, incomplete hub L1 suspend device*/ + /*To do, implete hub L1 suspend device*/ /*#else*/ - /* the callbackFn is initialized in USB_HostGetControllerInterface */ status = hostInstance->controllerTable->controllerIoctl(hostInstance->controllerHandle, kUSB_HostBusControl, &type); /*#endif*/ @@ -963,7 +968,6 @@ usb_status_t USB_HostL1SleepDeviceResquest(usb_host_handle hostHandle, #endif if (hostInstance->deviceList == deviceHandle) { - /* the callbackFn is initialized in USB_HostGetControllerInterface */ status = hostInstance->controllerTable->controllerIoctl(hostInstance->controllerHandle, kUSB_HostBusControl, &type); } @@ -974,7 +978,7 @@ usb_status_t USB_HostL1SleepDeviceResquest(usb_host_handle hostHandle, } return status; } -/* Send BUS or specific device suspend request */ +/* Send BUS or specific device suepend request */ usb_status_t USB_HostL1SleepDeviceResquestConfig(usb_host_handle hostHandle, uint8_t *lpmParam) { usb_host_instance_t *hostInstance; @@ -985,7 +989,7 @@ usb_status_t USB_HostL1SleepDeviceResquestConfig(usb_host_handle hostHandle, uin return kStatus_USB_InvalidHandle; } hostInstance = (usb_host_instance_t *)hostHandle; - /* the callbackFn is initialized in USB_HostGetControllerInterface */ + status = hostInstance->controllerTable->controllerIoctl(hostInstance->controllerHandle, kUSB_HostL1Config, lpmParam); @@ -999,7 +1003,7 @@ usb_status_t USB_HostL1ResumeDeviceResquest(usb_host_handle hostHandle, { usb_host_instance_t *hostInstance; - usb_status_t status = kStatus_USB_Error; + usb_status_t status = kStatus_USB_Error; usb_host_bus_control_t type = kUSB_HostBusL1Resume; if (hostHandle == NULL) @@ -1010,19 +1014,17 @@ usb_status_t USB_HostL1ResumeDeviceResquest(usb_host_handle hostHandle, if (1U == sleepType) { - /* the callbackFn is initialized in USB_HostGetControllerInterface */ status = hostInstance->controllerTable->controllerIoctl(hostInstance->controllerHandle, kUSB_HostBusControl, &type); } else { #if ((defined USB_HOST_CONFIG_HUB) && (USB_HOST_CONFIG_HUB)) - /*To do, if device hub number is 0, need suspend the bus ,else suspend the corresponding device*/ +/*To do, if device hub number is 0, need suspend the bus ,else suspend the corresponding device*/ #endif if (hostInstance->deviceList == deviceHandle) { - /* the callbackFn is initialized in USB_HostGetControllerInterface */ status = hostInstance->controllerTable->controllerIoctl(hostInstance->controllerHandle, kUSB_HostBusControl, &type); } @@ -1048,18 +1050,3 @@ usb_status_t USB_HostUpdateHwTick(usb_host_handle hostHandle, uint64_t tick) return status; } #endif - -#if ((defined(USB_HOST_CONFIG_BATTERY_CHARGER)) && (USB_HOST_CONFIG_BATTERY_CHARGER > 0U)) -usb_status_t USB_HostSetChargerType(usb_host_handle hostHandle, uint8_t type) -{ - usb_host_instance_t *hostInstance; - - if (hostHandle == NULL) - { - return kStatus_USB_InvalidHandle; - } - hostInstance = (usb_host_instance_t *)hostHandle; - return hostInstance->controllerTable->controllerIoctl(hostInstance->controllerHandle, kUSB_HostSetChargerType, - &type); -} -#endif diff --git a/bsp/imxrt/libraries/drivers/usb/host/usb_host_hci.h b/bsp/imxrt/libraries/drivers/usb/host/usb_host_hci.h index c1450dde38..26b6d4a9c5 100644 --- a/bsp/imxrt/libraries/drivers/usb/host/usb_host_hci.h +++ b/bsp/imxrt/libraries/drivers/usb/host/usb_host_hci.h @@ -1,9 +1,31 @@ /* * Copyright (c) 2015, Freescale Semiconductor, Inc. - * Copyright 2016 - 2019 NXP - * All rights reserved. + * Copyright 2016 NXP * - * SPDX-License-Identifier: BSD-3-Clause + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * o Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * o Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * o Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef _USB_HOST_HCI_H_ @@ -14,9 +36,9 @@ ******************************************************************************/ /*! @brief USB host lock */ -#define USB_HostLock() OSA_MutexLock(hostInstance->hostMutex, USB_OSA_WAIT_TIMEOUT) +#define USB_HostLock() USB_OsaMutexLock(hostInstance->hostMutex) /*! @brief USB host unlock */ -#define USB_HostUnlock() OSA_MutexUnlock(hostInstance->hostMutex) +#define USB_HostUnlock() USB_OsaMutexUnlock(hostInstance->hostMutex) /*! * @addtogroup usb_host_controller_driver @@ -34,10 +56,6 @@ typedef enum _usb_host_controller_control kUSB_HostPortAttachDisable, /*!< Disable the port attach event */ kUSB_HostPortAttachEnable, /*!< Enable the port attach event */ kUSB_HostL1Config, /*!< L1 suspend Bus control code */ - kUSB_HostSetChargerType, /*!< set charger type */ -#if ((defined USB_HOST_CONFIG_COMPLIANCE_TEST) && (USB_HOST_CONFIG_COMPLIANCE_TEST)) - kUSB_HostTestModeInit, /*!< intialize charger type */ -#endif } usb_host_controller_control_t; /*! @brief USB host controller bus control code */ @@ -79,9 +97,7 @@ typedef struct _usb_host_controller_interface uint32_t ioctlEvent, void *ioctlParam); /*!< Control a controller function prototype*/ } usb_host_controller_interface_t; -#if ((defined USB_HOST_CONFIG_COMPLIANCE_TEST) && (USB_HOST_CONFIG_COMPLIANCE_TEST)) -usb_status_t USB_HostTestModeInit(usb_device_handle deviceHandle); -#endif + /*! @}*/ /*! @@ -94,8 +110,7 @@ typedef struct _usb_host_instance { void *controllerHandle; /*!< The low level controller handle*/ host_callback_t deviceCallback; /*!< Device attach/detach callback*/ - osa_mutex_handle_t hostMutex; /*!< Host layer mutex*/ - uint32_t mutexBuffer[(OSA_MUTEX_HANDLE_SIZE + 3) / 4]; /*!< Host layer mutex*/ + usb_osa_mutex_handle hostMutex; /*!< Host layer mutex*/ usb_host_transfer_t transferList[USB_HOST_CONFIG_MAX_TRANSFERS]; /*!< Transfer resource*/ usb_host_transfer_t *transferHead; /*!< Idle transfer head*/ const usb_host_controller_interface_t *controllerTable; /*!< KHCI/EHCI interface*/ @@ -111,7 +126,6 @@ typedef struct _usb_host_instance uint8_t controllerId; /*!< The controller ID*/ } usb_host_instance_t; -extern usb_host_instance_t g_UsbHostInstance[USB_HOST_CONFIG_MAX_HOST]; /*! @}*/ #endif /* _USB_HOST_HCI_H_ */ diff --git a/bsp/imxrt/libraries/drivers/usb/include/usb.h b/bsp/imxrt/libraries/drivers/usb/include/usb.h index a219f10cec..256896b472 100644 --- a/bsp/imxrt/libraries/drivers/usb/include/usb.h +++ b/bsp/imxrt/libraries/drivers/usb/include/usb.h @@ -34,7 +34,6 @@ #include #include #include -#include #include "usb_misc.h" #include "usb_spec.h" diff --git a/bsp/imxrt/libraries/drivers/usb/include/usb_host_config.h b/bsp/imxrt/libraries/drivers/usb/include/usb_host_config.h deleted file mode 100644 index 8990136352..0000000000 --- a/bsp/imxrt/libraries/drivers/usb/include/usb_host_config.h +++ /dev/null @@ -1,247 +0,0 @@ -/* - * Copyright (c) 2015 - 2016, Freescale Semiconductor, Inc. - * Copyright 2016 - 2019 NXP - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#ifndef _USB_HOST_CONFIG_H_ -#define _USB_HOST_CONFIG_H_ - -/* Host Controller Enable */ -/*! - * @brief host khci instance count, meantime it indicates khci enable or disable. - * - if 0, host khci driver is disable. - * - if greater than 0, host khci driver is enable. - */ -#define USB_HOST_CONFIG_KHCI (0U) - -/*! - * @brief host ehci instance count, meantime it indicates ehci enable or disable. - * - if 0, host ehci driver is disable. - * - if greater than 0, host ehci driver is enable. - */ -#define USB_HOST_CONFIG_EHCI (2U) - -/*! - * @brief host ohci instance count, meantime it indicates ohci enable or disable. - * - if 0, host ohci driver is disable. - * - if greater than 0, host ohci driver is enable. - */ -#define USB_HOST_CONFIG_OHCI (0U) - -/*! - * @brief host ip3516hs instance count, meantime it indicates ohci enable or disable. - * - if 0, host ip3516hs driver is disable. - * - if greater than 0, host ip3516hs driver is enable. - */ -#define USB_HOST_CONFIG_IP3516HS (0U) - -/* Common configuration macros for all controllers */ - -/*! - * @brief host driver instance max count. - * for example: 2 - one for khci, one for ehci. - */ -#define USB_HOST_CONFIG_MAX_HOST \ - (USB_HOST_CONFIG_KHCI + USB_HOST_CONFIG_EHCI + USB_HOST_CONFIG_OHCI + USB_HOST_CONFIG_IP3516HS) - -/*! - * @brief host pipe max count. - * pipe is the host driver resource for device endpoint, one endpoint need one pipe. - */ -#define USB_HOST_CONFIG_MAX_PIPES (16U) - -/*! - * @brief host transfer max count. - * transfer is the host driver resource for data transmission mission, one transmission mission need one transfer. - */ -#define USB_HOST_CONFIG_MAX_TRANSFERS (16U) - -/*! - * @brief the max endpoint for one interface. - * the max endpoint descriptor number that one interface descriptor contain. - */ -#define USB_HOST_CONFIG_INTERFACE_MAX_EP (4U) - -/*! - * @brief the max interface for one configuration. - * the max interface descriptor number that one configuration descriptor can contain. - */ -#define USB_HOST_CONFIG_CONFIGURATION_MAX_INTERFACE (5U) - -/*! - * @brief the max power for one device. - * the max power the host can provide for one device. - */ -#define USB_HOST_CONFIG_MAX_POWER (250U) - -/*! - * @brief the max retries for enumeration. - * retry time when enumeration fail. - */ -#define USB_HOST_CONFIG_ENUMERATION_MAX_RETRIES (3U) - -/*! - * @brief the max retries for enumeration setup stall. - * the max times for one transfer can stall. - */ -#define USB_HOST_CONFIG_ENUMERATION_MAX_STALL_RETRIES (1U) - -/*! - * @brief the max NAK count for one transaction. - * when nak count reach to the value, the transaction fail. - */ -#define USB_HOST_CONFIG_MAX_NAK (3000U) - -/*! @brief Whether the transfer buffer is cache-enabled or not. */ -#ifndef USB_HOST_CONFIG_BUFFER_PROPERTY_CACHEABLE -#define USB_HOST_CONFIG_BUFFER_PROPERTY_CACHEABLE (0U) -#endif -/*! @brief if 1, enable usb compliance test codes; if 0, disable usb compliance test codes. */ -#define USB_HOST_CONFIG_COMPLIANCE_TEST (0U) - -/*! @brief if 1, class driver clear stall automatically; if 0, class driver don't clear stall. */ -#define USB_HOST_CONFIG_CLASS_AUTO_CLEAR_STALL (0U) - -/* KHCI configuration */ -#if ((defined USB_HOST_CONFIG_KHCI) && (USB_HOST_CONFIG_KHCI)) - -/*! - * @brief khci dma align fix buffer size. - */ -#define USB_HOST_CONFIG_KHCI_DMA_ALIGN_BUFFER (64U) - -#endif - -/* EHCI configuration */ -#if ((defined USB_HOST_CONFIG_EHCI) && (USB_HOST_CONFIG_EHCI)) - -/*! - * @brief ehci periodic frame list size. - * the value can be 1024, 512, 256, 128, 64, 32, 16 or 8. - */ -#define USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE (1024U) - -/*! - * @brief ehci QH max count. - */ -#define USB_HOST_CONFIG_EHCI_MAX_QH (8U) - -/*! - * @brief ehci QTD max count. - */ -#define USB_HOST_CONFIG_EHCI_MAX_QTD (8U) - -/*! - * @brief ehci ITD max count. - */ -#define USB_HOST_CONFIG_EHCI_MAX_ITD (0U) - -/*! - * @brief ehci SITD max count. - */ -#define USB_HOST_CONFIG_EHCI_MAX_SITD (0U) - -#endif - -/* OHCI configuration */ -#if ((defined USB_HOST_CONFIG_OHCI) && (USB_HOST_CONFIG_OHCI)) - -/*! - * @brief ohci ED max count. - */ -#define USB_HOST_CONFIG_OHCI_MAX_ED (8U) - -/*! - * @brief ohci GTD max count. - */ -#define USB_HOST_CONFIG_OHCI_MAX_GTD (8U) - -/*! - * @brief ohci ITD max count. - */ -#define USB_HOST_CONFIG_OHCI_MAX_ITD (8U) - -#endif - -/* OHCI configuration */ -#if ((defined USB_HOST_CONFIG_IP3516HS) && (USB_HOST_CONFIG_IP3516HS)) - -#define USB_HOST_CONFIG_IP3516HS_MAX_PIPE (32U) - -/*! - * @brief ohci ED max count. - */ -#define USB_HOST_CONFIG_IP3516HS_MAX_ATL (32U) - -/*! - * @brief ohci GTD max count. - */ -#define USB_HOST_CONFIG_IP3516HS_MAX_INT (32U) - -/*! - * @brief ohci ITD max count. - */ -#define USB_HOST_CONFIG_IP3516HS_MAX_ISO (0U) - -#endif - -/*! - * @brief host HUB class instance count, meantime it indicates HUB class enable or disable. - * - if 0, host HUB class driver is disable. - * - if greater than 0, host HUB class driver is enable. - */ -#define USB_HOST_CONFIG_HUB (0U) - -/*! - * @brief host HID class instance count, meantime it indicates HID class enable or disable. - * - if 0, host HID class driver is disable. - * - if greater than 0, host HID class driver is enable. - */ -#define USB_HOST_CONFIG_HID (0U) - -/*! - * @brief host MSD class instance count, meantime it indicates MSD class enable or disable. - * - if 0, host MSD class driver is disable. - * - if greater than 0, host MSD class driver is enable. - */ -#define USB_HOST_CONFIG_MSD (0U) - -/*! - * @brief host CDC class instance count, meantime it indicates CDC class enable or disable. - * - if 0, host CDC class driver is disable. - * - if greater than 0, host CDC class driver is enable. - */ -#define USB_HOST_CONFIG_CDC (0U) - -/*! - * @brief host AUDIO class instance count, meantime it indicates AUDIO class enable or disable. - * - if 0, host AUDIO class driver is disable. - * - if greater than 0, host AUDIO class driver is enable. - */ -#define USB_HOST_CONFIG_AUDIO (0U) - -/*! - * @brief host PHDC class instance count, meantime it indicates PHDC class enable or disable. - * - if 0, host PHDC class driver is disable. - * - if greater than 0, host PHDC class driver is enable. - */ -#define USB_HOST_CONFIG_PHDC (0U) - -/*! - * @brief host printer class instance count, meantime it indicates printer class enable or disable. - * - if 0, host printer class driver is disable. - * - if greater than 0, host printer class driver is enable. - */ -#define USB_HOST_CONFIG_PRINTER (0U) - -/*! - * @brief host charger detect enable or disable. It is only supported on RT600 currently. - * - if 0, host charger detect is disable. - * - if greater than 0, host charger detect is enable. - */ -#define USB_HOST_CONFIG_BATTERY_CHARGER (0U) - -#endif /* _USB_HOST_CONFIG_H_ */ diff --git a/bsp/imxrt/libraries/drivers/usb/include/usb_misc.h b/bsp/imxrt/libraries/drivers/usb/include/usb_misc.h index df12d6cd1d..4e65cfa94b 100644 --- a/bsp/imxrt/libraries/drivers/usb/include/usb_misc.h +++ b/bsp/imxrt/libraries/drivers/usb/include/usb_misc.h @@ -1,34 +1,46 @@ /* * Copyright (c) 2015 - 2016, Freescale Semiconductor, Inc. - * Copyright 2016, 2019 NXP - * All rights reserved. + * Copyright 2016 NXP * - * SPDX-License-Identifier: BSD-3-Clause + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * o Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * o Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * o Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef __USB_MISC_H__ #define __USB_MISC_H__ +#ifndef ENDIANNESS + +#error ENDIANNESS should be defined, and then rebulid the project. + +#endif + /******************************************************************************* * Definitions ******************************************************************************/ -/*! @brief Define big endian */ -#define USB_BIG_ENDIAN (0U) -/*! @brief Define little endian */ -#define USB_LITTLE_ENDIAN (1U) - -/*! @brief Define current endian */ -#ifndef ENDIANNESS -#define ENDIANNESS USB_LITTLE_ENDIAN -#endif -/*! @brief Define default timeout value */ -#if (defined(USE_RTOS) && (USE_RTOS > 0)) -#define USB_OSA_WAIT_TIMEOUT (osaWaitForever_c) -#else -#define USB_OSA_WAIT_TIMEOUT (0U) -#endif /* (defined(USE_RTOS) && (USE_RTOS > 0)) */ - /*! @brief Define USB printf */ #if defined(__cplusplus) extern "C" { @@ -40,14 +52,10 @@ extern int DbgConsole_Printf(const char *fmt_s, ...); } #endif /* __cplusplus */ -#ifndef __DSC__ #if defined(SDK_DEBUGCONSOLE) && (SDK_DEBUGCONSOLE < 1) #define usb_echo printf #else -#define usb_echo rt_kprintf -#endif -#else -#define usb_echo +#define usb_echo DbgConsole_Printf #endif #if defined(__ICCARM__) @@ -70,7 +78,7 @@ extern int DbgConsole_Printf(const char *fmt_s, ...); #define STRUCT_UNPACKED __attribute__((__packed__)) #endif -#elif defined(__CC_ARM) || (defined(__ARMCC_VERSION)) +#elif defined(__CC_ARM) #ifndef STRUCT_PACKED #define STRUCT_PACKED _Pragma("pack(1U)") @@ -104,7 +112,7 @@ extern int DbgConsole_Printf(const char *fmt_s, ...); #define USB_ASSIGN_VALUE_ADDRESS_LONG_BY_BYTE(n, m) \ { \ - *((uint8_t *)&(n)) = *((uint8_t *)&(m)); \ + *((uint8_t *)&(n)) = *((uint8_t *)&(m)); \ *((uint8_t *)&(n) + 1) = *((uint8_t *)&(m) + 1); \ *((uint8_t *)&(n) + 2) = *((uint8_t *)&(m) + 2); \ *((uint8_t *)&(n) + 3) = *((uint8_t *)&(m) + 3); \ @@ -112,13 +120,13 @@ extern int DbgConsole_Printf(const char *fmt_s, ...); #define USB_ASSIGN_VALUE_ADDRESS_SHORT_BY_BYTE(n, m) \ { \ - *((uint8_t *)&(n)) = *((uint8_t *)&(m)); \ + *((uint8_t *)&(n)) = *((uint8_t *)&(m)); \ *((uint8_t *)&(n) + 1) = *((uint8_t *)&(m) + 1); \ } #define USB_ASSIGN_MACRO_VALUE_ADDRESS_LONG_BY_BYTE(n, m) \ { \ - *((uint8_t *)&(n)) = (uint8_t)m; \ + *((uint8_t *)&(n)) = (uint8_t)m; \ *((uint8_t *)&(n) + 1) = (uint8_t)(m >> 8); \ *((uint8_t *)&(n) + 2) = (uint8_t)(m >> 16); \ *((uint8_t *)&(n) + 3) = (uint8_t)(m >> 24); \ @@ -126,7 +134,7 @@ extern int DbgConsole_Printf(const char *fmt_s, ...); #define USB_ASSIGN_MACRO_VALUE_ADDRESS_SHORT_BY_BYTE(n, m) \ { \ - *((uint8_t *)&(n)) = (uint8_t)m; \ + *((uint8_t *)&(n)) = (uint8_t)m; \ *((uint8_t *)&(n) + 1) = (uint8_t)(m >> 8); \ } @@ -142,66 +150,65 @@ extern int DbgConsole_Printf(const char *fmt_s, ...); #define USB_SHORT_FROM_BIG_ENDIAN(n) (n) #define USB_LONG_FROM_BIG_ENDIAN(n) (n) -#define USB_LONG_TO_LITTLE_ENDIAN_ADDRESS(n, m) \ - { \ - m[3] = (uint8_t)((((uint32_t)(n)) >> 24U) & 0xFFU); \ - m[2] = (uint8_t)((((uint32_t)(n)) >> 16U) & 0xFFU); \ - m[1] = (uint8_t)((((uint32_t)(n)) >> 8U) & 0xFFU); \ - m[0] = (uint8_t)(((uint32_t)(n)) & 0xFFU); \ +#define USB_LONG_TO_LITTLE_ENDIAN_ADDRESS(n, m) \ + { \ + m[3] = ((n >> 24U) & 0xFFU); \ + m[2] = ((n >> 16U) & 0xFFU); \ + m[1] = ((n >> 8U) & 0xFFU); \ + m[0] = (n & 0xFFU); \ } -#define USB_LONG_FROM_LITTLE_ENDIAN_ADDRESS(n) \ - ((uint32_t)((((uint32_t)n[3]) << 24U) | (((uint32_t)n[2]) << 16U) | (((uint32_t)n[1]) << 8U) | \ - (((uint32_t)n[0]) << 0U))) +#define USB_LONG_FROM_LITTLE_ENDIAN_ADDRESS(n) \ + ((uint32_t)((((uint8_t)n[3]) << 24U) | (((uint8_t)n[2]) << 16U) | (((uint8_t)n[1]) << 8U) | \ + (((uint8_t)n[0]) << 0U))) -#define USB_LONG_TO_BIG_ENDIAN_ADDRESS(n, m) \ - { \ - m[0] = ((((uint32_t)(n)) >> 24U) & 0xFFU); \ - m[1] = ((((uint32_t)(n)) >> 16U) & 0xFFU); \ - m[2] = ((((uint32_t)(n)) >> 8U) & 0xFFU); \ - m[3] = (((uint32_t)(n)) & 0xFFU); \ +#define USB_LONG_TO_BIG_ENDIAN_ADDRESS(n, m) \ + { \ + m[0] = ((n >> 24U) & 0xFFU); \ + m[1] = ((n >> 16U) & 0xFFU); \ + m[2] = ((n >> 8U) & 0xFFU); \ + m[3] = (n & 0xFFU); \ } -#define USB_LONG_FROM_BIG_ENDIAN_ADDRESS(n) \ - ((uint32_t)((((uint32_t)n[0]) << 24U) | (((uint32_t)n[1]) << 16U) | (((uint32_t)n[2]) << 8U) | \ - (((uint32_t)n[3]) << 0U))) +#define USB_LONG_FROM_BIG_ENDIAN_ADDRESS(n) \ + ((uint32_t)((((uint8_t)n[0]) << 24U) | (((uint8_t)n[1]) << 16U) | (((uint8_t)n[2]) << 8U) | \ + (((uint8_t)n[3]) << 0U))) -#define USB_SHORT_TO_LITTLE_ENDIAN_ADDRESS(n, m) \ - { \ - m[1] = ((((uint16_t)(n)) >> 8U) & 0xFFU); \ - m[0] = (((uint16_t)(n)) & 0xFFU); \ +#define USB_SHORT_TO_LITTLE_ENDIAN_ADDRESS(n, m) \ + { \ + m[1] = ((n >> 8U) & 0xFFU); \ + m[0] = (n & 0xFFU); \ } -#define USB_SHORT_FROM_LITTLE_ENDIAN_ADDRESS(n) ((uint16_t)((((uint16_t)n[1]) << 8U) | (((uint16_t)n[0]) << 0U))) +#define USB_SHORT_FROM_LITTLE_ENDIAN_ADDRESS(n) ((uint32_t)((((uint8_t)n[1]) << 8U) | (((uint8_t)n[0]) << 0U))) -#define USB_SHORT_TO_BIG_ENDIAN_ADDRESS(n, m) \ - { \ - m[0] = ((((uint16_t)(n)) >> 8U) & 0xFFU); \ - m[1] = (((uint16_t)(n)) & 0xFFU); \ +#define USB_SHORT_TO_BIG_ENDIAN_ADDRESS(n, m) \ + { \ + m[0] = ((n >> 8U) & 0xFFU); \ + m[1] = (n & 0xFFU); \ } -#define USB_SHORT_FROM_BIG_ENDIAN_ADDRESS(n) ((uint16_t)((((uint16_t)n[0]) << 8U) | (((uint16_t)n[1]) << 0U))) +#define USB_SHORT_FROM_BIG_ENDIAN_ADDRESS(n) ((uint32_t)((((uint8_t)n[0]) << 8U) | (((uint8_t)n[1]) << 0U))) -#define USB_LONG_TO_LITTLE_ENDIAN_DATA(n, m) \ - { \ - *((uint8_t *)&(m) + 3) = ((((uint32_t)(n)) >> 24U) & 0xFFU); \ - *((uint8_t *)&(m) + 2) = ((((uint32_t)(n)) >> 16U) & 0xFFU); \ - *((uint8_t *)&(m) + 1) = ((((uint32_t)(n)) >> 8U) & 0xFFU); \ - *((uint8_t *)&(m) + 0) = (((uint32_t)(n)) & 0xFFU); \ +#define USB_LONG_TO_LITTLE_ENDIAN_DATA(n, m) \ + { \ + *((uint8_t *)&(m) + 3) = ((n >> 24U) & 0xFFU); \ + *((uint8_t *)&(m) + 2) = ((n >> 16U) & 0xFFU); \ + *((uint8_t *)&(m) + 1) = ((n >> 8U) & 0xFFU); \ + *((uint8_t *)&(m) + 0) = (n & 0xFFU); \ } -#define USB_LONG_FROM_LITTLE_ENDIAN_DATA(n) \ - ((uint32_t)(((uint32_t)(*((uint8_t *)&(n) + 3)) << 24U) | ((uint32_t)(*((uint8_t *)&(n) + 2)) << 16U) | \ - ((uint32_t)(*((uint8_t *)&(n) + 1)) << 8U) | ((uint32_t)(*((uint8_t *)&(n))) << 0U))) +#define USB_LONG_FROM_LITTLE_ENDIAN_DATA(n) \ + ((uint32_t)(((*((uint8_t *)&(n) + 3)) << 24U) | ((*((uint8_t *)&(n) + 2)) << 16U) | \ + ((*((uint8_t *)&(n) + 1)) << 8U) | ((*((uint8_t *)&(n))) << 0U))) -#define USB_SHORT_TO_LITTLE_ENDIAN_DATA(n, m) \ - { \ - *((uint8_t *)&(m) + 1) = ((((uint16_t)(n)) >> 8U) & 0xFFU); \ - *((uint8_t *)&(m)) = ((((uint16_t)(n))) & 0xFFU); \ +#define USB_SHORT_TO_LITTLE_ENDIAN_DATA(n, m) \ + { \ + *((uint8_t *)&(m) + 1) = ((n >> 8U) & 0xFFU); \ + *((uint8_t *)&(m)) = ((n)&0xFFU); \ } -#define USB_SHORT_FROM_LITTLE_ENDIAN_DATA(n) \ - ((uint16_t)((uint16_t)(*((uint8_t *)&(n) + 1)) << 8U) | ((uint16_t)(*((uint8_t *)&(n))))) +#define USB_SHORT_FROM_LITTLE_ENDIAN_DATA(n) ((uint32_t)(((*((uint8_t *)&(n) + 1)) << 8U) | ((*((uint8_t *)&(n)))))) #else @@ -215,76 +222,75 @@ extern int DbgConsole_Printf(const char *fmt_s, ...); #define USB_SHORT_FROM_BIG_ENDIAN(n) SWAP2BYTE_CONST(n) #define USB_LONG_FROM_BIG_ENDIAN(n) SWAP4BYTE_CONST(n) -#define USB_LONG_TO_LITTLE_ENDIAN_ADDRESS(n, m) \ - { \ - m[3] = (uint8_t)((((uint32_t)(n)) >> 24U) & 0xFFU); \ - m[2] = (uint8_t)((((uint32_t)(n)) >> 16U) & 0xFFU); \ - m[1] = (uint8_t)((((uint32_t)(n)) >> 8U) & 0xFFU); \ - m[0] = (uint8_t)(((uint32_t)(n)) & 0xFFU); \ +#define USB_LONG_TO_LITTLE_ENDIAN_ADDRESS(n, m) \ + { \ + m[3] = ((n >> 24U) & 0xFFU); \ + m[2] = ((n >> 16U) & 0xFFU); \ + m[1] = ((n >> 8U) & 0xFFU); \ + m[0] = (n & 0xFFU); \ } -#define USB_LONG_FROM_LITTLE_ENDIAN_ADDRESS(n) \ - ((uint32_t)((((uint32_t)n[3]) << 24U) | (((uint32_t)n[2]) << 16U) | (((uint32_t)n[1]) << 8U) | \ - (((uint32_t)n[0]) << 0U))) +#define USB_LONG_FROM_LITTLE_ENDIAN_ADDRESS(n) \ + ((uint32_t)((((uint8_t)n[3]) << 24U) | (((uint8_t)n[2]) << 16U) | (((uint8_t)n[1]) << 8U) | \ + (((uint8_t)n[0]) << 0U))) -#define USB_LONG_TO_BIG_ENDIAN_ADDRESS(n, m) \ - { \ - m[0] = ((((uint32_t)(n)) >> 24U) & 0xFFU); \ - m[1] = ((((uint32_t)(n)) >> 16U) & 0xFFU); \ - m[2] = ((((uint32_t)(n)) >> 8U) & 0xFFU); \ - m[3] = (((uint32_t)(n)) & 0xFFU); \ +#define USB_LONG_TO_BIG_ENDIAN_ADDRESS(n, m) \ + { \ + m[0] = ((n >> 24U) & 0xFFU); \ + m[1] = ((n >> 16U) & 0xFFU); \ + m[2] = ((n >> 8U) & 0xFFU); \ + m[3] = (n & 0xFFU); \ } -#define USB_LONG_FROM_BIG_ENDIAN_ADDRESS(n) \ - ((uint32_t)((((uint32_t)n[0]) << 24U) | (((uint32_t)n[1]) << 16U) | (((uint32_t)n[2]) << 8U) | \ - (((uint32_t)n[3]) << 0U))) +#define USB_LONG_FROM_BIG_ENDIAN_ADDRESS(n) \ + ((uint32_t)((((uint8_t)n[0]) << 24U) | (((uint8_t)n[1]) << 16U) | (((uint8_t)n[2]) << 8U) | \ + (((uint8_t)n[3]) << 0U))) -#define USB_SHORT_TO_LITTLE_ENDIAN_ADDRESS(n, m) \ - { \ - m[1] = ((((uint16_t)(n)) >> 8U) & 0xFFU); \ - m[0] = (((uint16_t)(n)) & 0xFFU); \ +#define USB_SHORT_TO_LITTLE_ENDIAN_ADDRESS(n, m) \ + { \ + m[1] = ((n >> 8U) & 0xFFU); \ + m[0] = (n & 0xFFU); \ } -#define USB_SHORT_FROM_LITTLE_ENDIAN_ADDRESS(n) ((uint16_t)((((uint16_t)n[1]) << 8U) | (((uint16_t)n[0]) << 0U))) +#define USB_SHORT_FROM_LITTLE_ENDIAN_ADDRESS(n) ((uint32_t)((((uint8_t)n[1]) << 8U) | (((uint8_t)n[0]) << 0U))) -#define USB_SHORT_TO_BIG_ENDIAN_ADDRESS(n, m) \ - { \ - m[0] = ((((uint16_t)(n)) >> 8U) & 0xFFU); \ - m[1] = (((uint16_t)(n)) & 0xFFU); \ +#define USB_SHORT_TO_BIG_ENDIAN_ADDRESS(n, m) \ + { \ + m[0] = ((n >> 8U) & 0xFFU); \ + m[1] = (n & 0xFFU); \ } -#define USB_SHORT_FROM_BIG_ENDIAN_ADDRESS(n) ((uint16_t)((((uint16_t)n[0]) << 8U) | (((uint16_t)n[1]) << 0U))) +#define USB_SHORT_FROM_BIG_ENDIAN_ADDRESS(n) ((uint32_t)((((uint8_t)n[0]) << 8U) | (((uint8_t)n[1]) << 0U))) -#define USB_LONG_TO_LITTLE_ENDIAN_DATA(n, m) \ - { \ - *((uint8_t *)&(m) + 3) = ((((uint32_t)(n)) >> 24U) & 0xFFU); \ - *((uint8_t *)&(m) + 2) = ((((uint32_t)(n)) >> 16U) & 0xFFU); \ - *((uint8_t *)&(m) + 1) = ((((uint32_t)(n)) >> 8U) & 0xFFU); \ - *((uint8_t *)&(m) + 0) = (((uint32_t)(n)) & 0xFFU); \ +#define USB_LONG_TO_LITTLE_ENDIAN_DATA(n, m) \ + { \ + *((uint8_t *)&(m) + 3) = ((n >> 24U) & 0xFFU); \ + *((uint8_t *)&(m) + 2) = ((n >> 16U) & 0xFFU); \ + *((uint8_t *)&(m) + 1) = ((n >> 8U) & 0xFFU); \ + *((uint8_t *)&(m) + 0) = (n & 0xFFU); \ } -#define USB_LONG_FROM_LITTLE_ENDIAN_DATA(n) \ - ((uint32_t)(((uint32_t)(*((uint8_t *)&(n) + 3)) << 24U) | ((uint32_t)(*((uint8_t *)&(n) + 2)) << 16U) | \ - ((uint32_t)(*((uint8_t *)&(n) + 1)) << 8U) | ((uint32_t)(*((uint8_t *)&(n))) << 0U))) +#define USB_LONG_FROM_LITTLE_ENDIAN_DATA(n) \ + ((uint32_t)(((*((uint8_t *)&(n) + 3)) << 24U) | ((*((uint8_t *)&(n) + 2)) << 16U) | \ + ((*((uint8_t *)&(n) + 1)) << 8U) | ((*((uint8_t *)&(n))) << 0U))) -#define USB_SHORT_TO_LITTLE_ENDIAN_DATA(n, m) \ - { \ - *((uint8_t *)&(m) + 1) = ((((uint16_t)(n)) >> 8U) & 0xFFU); \ - *((uint8_t *)&(m)) = ((((uint16_t)(n))) & 0xFFU); \ +#define USB_SHORT_TO_LITTLE_ENDIAN_DATA(n, m) \ + { \ + *((uint8_t *)&(m) + 1) = ((n >> 8U) & 0xFFU); \ + *((uint8_t *)&(m)) = ((n)&0xFFU); \ } -#define USB_SHORT_FROM_LITTLE_ENDIAN_DATA(n) \ - ((uint16_t)(((uint16_t)(*(((uint8_t *)&(n)) + 1)) << 8U) | ((uint16_t)(*((uint8_t *)&(n)))))) +#define USB_SHORT_FROM_LITTLE_ENDIAN_DATA(n) ((uint32_t)(((*((uint8_t *)&(n) + 1)) << 8U) | ((*((uint8_t *)&(n)))))) #endif /* * The following MACROs (USB_GLOBAL, USB_BDT, USB_RAM_ADDRESS_ALIGNMENT, etc) are only used for USB device stack. - * The USB device global variables are put into the section m_usb_global and m_usb_bdt - * by using the MACRO USB_GLOBAL and USB_BDT. In this way, the USB device + * The USB device global variables are put into the section m_usb_global and m_usb_bdt or the section + * .bss.m_usb_global and .bss.m_usb_bdt by using the MACRO USB_GLOBAL and USB_BDT. In this way, the USB device * global variables can be linked into USB dedicated RAM by USB_STACK_USE_DEDICATED_RAM. * The MACRO USB_STACK_USE_DEDICATED_RAM is used to decide the USB stack uses dedicated RAM or not. The value of - * the macro can be set as 0, USB_STACK_DEDICATED_RAM_TYPE_BDT_GLOBAL, or USB_STACK_DEDICATED_RAM_TYPE_BDT. + * the marco can be set as 0, USB_STACK_DEDICATED_RAM_TYPE_BDT_GLOBAL, or USB_STACK_DEDICATED_RAM_TYPE_BDT. * The MACRO USB_STACK_DEDICATED_RAM_TYPE_BDT_GLOBAL means USB device global variables, including USB_BDT and * USB_GLOBAL, are put into the USB dedicated RAM. This feature can only be enabled when the USB dedicated RAM * is not less than 2K Bytes. @@ -307,63 +313,40 @@ _Pragma("diag_suppress=Pm120") #define USB_RAM_ADDRESS_ALIGNMENT(n) USB_ALIGN_PRAGMA(data_alignment = n) _Pragma("diag_suppress=Pm120") #define USB_LINK_SECTION_PART(str) _Pragma(#str) -#define USB_LINK_DMA_INIT_DATA(sec) USB_LINK_SECTION_PART(location = #sec) +#define USB_LINK_SECTION_SUB(sec) USB_LINK_SECTION_PART(location = #sec) #define USB_LINK_USB_GLOBAL _Pragma("location = \"m_usb_global\"") #define USB_LINK_USB_BDT _Pragma("location = \"m_usb_bdt\"") -#define USB_LINK_USB_GLOBAL_BSS -#define USB_LINK_USB_BDT_BSS +#define USB_LINK_USB_GLOBAL_BSS _Pragma("location = \".bss.m_usb_global\"") +#define USB_LINK_USB_BDT_BSS _Pragma("location = \".bss.m_usb_bdt\"") _Pragma("diag_default=Pm120") #define USB_LINK_DMA_NONINIT_DATA _Pragma("location = \"m_usb_dma_noninit_data\"") #define USB_LINK_NONCACHE_NONINIT_DATA _Pragma("location = \"NonCacheable\"") -#elif defined(__CC_ARM) || (defined(__ARMCC_VERSION)) +#elif defined(__CC_ARM) #define USB_WEAK_VAR __attribute__((weak)) -#define USB_WEAK_FUN __attribute__((weak)) +#define USB_WEAK_FUN __weak #define USB_RAM_ADDRESS_ALIGNMENT(n) __attribute__((aligned(n))) -#define USB_LINK_DMA_INIT_DATA(sec) __attribute__((section(#sec))) -#if defined(__CC_ARM) +#define USB_LINK_SECTION_SUB(sec) __attribute__((section(#sec))) #define USB_LINK_USB_GLOBAL __attribute__((section("m_usb_global"))) __attribute__((zero_init)) -#else -#define USB_LINK_USB_GLOBAL __attribute__((section(".bss.m_usb_global"))) -#endif -#if defined(__CC_ARM) #define USB_LINK_USB_BDT __attribute__((section("m_usb_bdt"))) __attribute__((zero_init)) -#else -#define USB_LINK_USB_BDT __attribute__((section(".bss.m_usb_bdt"))) -#endif -#define USB_LINK_USB_GLOBAL_BSS -#define USB_LINK_USB_BDT_BSS -#if defined(__CC_ARM) +#define USB_LINK_USB_GLOBAL_BSS __attribute__((section(".bss.m_usb_global"))) __attribute__((zero_init)) +#define USB_LINK_USB_BDT_BSS __attribute__((section(".bss.m_usb_bdt"))) __attribute__((zero_init)) #define USB_LINK_DMA_NONINIT_DATA __attribute__((section("m_usb_dma_noninit_data"))) __attribute__((zero_init)) -#else -#define USB_LINK_DMA_NONINIT_DATA __attribute__((section(".bss.m_usb_dma_noninit_data"))) -#endif -#if defined(__CC_ARM) #define USB_LINK_NONCACHE_NONINIT_DATA __attribute__((section("NonCacheable"))) __attribute__((zero_init)) -#else -#define USB_LINK_NONCACHE_NONINIT_DATA __attribute__((section(".bss.NonCacheable"))) -#endif #elif defined(__GNUC__) #define USB_WEAK_VAR __attribute__((weak)) #define USB_WEAK_FUN __attribute__((weak)) #define USB_RAM_ADDRESS_ALIGNMENT(n) __attribute__((aligned(n))) -#define USB_LINK_DMA_INIT_DATA(sec) __attribute__((section(#sec))) +#define USB_LINK_SECTION_SUB(sec) __attribute__((section(#sec))) #define USB_LINK_USB_GLOBAL __attribute__((section("m_usb_global, \"aw\", %nobits @"))) #define USB_LINK_USB_BDT __attribute__((section("m_usb_bdt, \"aw\", %nobits @"))) -#define USB_LINK_USB_GLOBAL_BSS -#define USB_LINK_USB_BDT_BSS +#define USB_LINK_USB_GLOBAL_BSS __attribute__((section(".bss.m_usb_global, \"aw\", %nobits @"))) +#define USB_LINK_USB_BDT_BSS __attribute__((section(".bss.m_usb_bdt, \"aw\", %nobits @"))) #define USB_LINK_DMA_NONINIT_DATA __attribute__((section("m_usb_dma_noninit_data, \"aw\", %nobits @"))) #define USB_LINK_NONCACHE_NONINIT_DATA __attribute__((section("NonCacheable, \"aw\", %nobits @"))) -#elif (defined(__DSC__) && defined(__CW__)) -#define MAX(a, b) (((a) > (b)) ? (a) : (b)) -#define USB_WEAK_VAR __attribute__((weak)) -#define USB_WEAK_FUN __attribute__((weak)) -#define USB_RAM_ADDRESS_ALIGNMENT(n) __attribute__((aligned(n))) -#define USB_LINK_USB_BDT_BSS -#define USB_LINK_USB_GLOBAL_BSS #else #error The tool-chain is not supported. #endif @@ -373,32 +356,28 @@ _Pragma("diag_suppress=Pm120") #if ((defined(FSL_FEATURE_L2CACHE_LINESIZE_BYTE)) && (defined(FSL_FEATURE_L1DCACHE_LINESIZE_BYTE))) #define USB_CACHE_LINESIZE MAX(FSL_FEATURE_L2CACHE_LINESIZE_BYTE, FSL_FEATURE_L1DCACHE_LINESIZE_BYTE) -#elif (defined(FSL_FEATURE_L2CACHE_LINESIZE_BYTE)) +#elif(defined(FSL_FEATURE_L2CACHE_LINESIZE_BYTE)) #define USB_CACHE_LINESIZE MAX(FSL_FEATURE_L2CACHE_LINESIZE_BYTE, 0) -#elif (defined(FSL_FEATURE_L1DCACHE_LINESIZE_BYTE)) +#elif(defined(FSL_FEATURE_L1DCACHE_LINESIZE_BYTE)) #define USB_CACHE_LINESIZE MAX(0, FSL_FEATURE_L1DCACHE_LINESIZE_BYTE) #else -#define USB_CACHE_LINESIZE 4U +#define USB_CACHE_LINESIZE 4 #endif #else -#define USB_CACHE_LINESIZE 4U +#define USB_CACHE_LINESIZE 4 #endif #if (((defined(USB_DEVICE_CONFIG_LPCIP3511FS)) && (USB_DEVICE_CONFIG_LPCIP3511FS > 0U)) || \ ((defined(USB_DEVICE_CONFIG_LPCIP3511HS)) && (USB_DEVICE_CONFIG_LPCIP3511HS > 0U))) -#define USB_DATA_ALIGN 64U +#define USB_DATA_ALIGN 64 #else -#define USB_DATA_ALIGN 4U +#define USB_DATA_ALIGN 4 #endif -#if (USB_CACHE_LINESIZE > USB_DATA_ALIGN) -#define USB_DATA_ALIGN_SIZE USB_CACHE_LINESIZE -#else -#define USB_DATA_ALIGN_SIZE USB_DATA_ALIGN -#endif +#define USB_DATA_ALIGN_SIZE MAX(USB_CACHE_LINESIZE, USB_DATA_ALIGN) -#define USB_DATA_ALIGN_SIZE_MULTIPLE(n) (((n) + USB_DATA_ALIGN_SIZE - 1U) & (~(USB_DATA_ALIGN_SIZE - 1U))) +#define USB_DATA_ALIGN_SIZE_MULTIPLE(n) ((n + USB_DATA_ALIGN_SIZE - 1) & (~(USB_DATA_ALIGN_SIZE - 1))) #if defined(USB_STACK_USE_DEDICATED_RAM) && (USB_STACK_USE_DEDICATED_RAM == USB_STACK_DEDICATED_RAM_TYPE_BDT_GLOBAL) @@ -408,19 +387,13 @@ _Pragma("diag_suppress=Pm120") #if (defined(USB_DEVICE_CONFIG_BUFFER_PROPERTY_CACHEABLE) && (USB_DEVICE_CONFIG_BUFFER_PROPERTY_CACHEABLE)) || \ (defined(USB_HOST_CONFIG_BUFFER_PROPERTY_CACHEABLE) && (USB_HOST_CONFIG_BUFFER_PROPERTY_CACHEABLE)) #define USB_DMA_DATA_NONINIT_SUB USB_LINK_DMA_NONINIT_DATA -#define USB_DMA_DATA_INIT_SUB USB_LINK_DMA_INIT_DATA(m_usb_dma_init_data) -#define USB_CONTROLLER_DATA USB_LINK_NONCACHE_NONINIT_DATA -#else -#if (defined(DATA_SECTION_IS_CACHEABLE) && (DATA_SECTION_IS_CACHEABLE)) -#define USB_DMA_DATA_NONINIT_SUB USB_LINK_NONCACHE_NONINIT_DATA -#define USB_DMA_DATA_INIT_SUB USB_LINK_DMA_INIT_DATA(NonCacheable.init) +#define USB_DMA_DATA_INIT_SUB USB_LINK_SECTION_SUB(m_usb_dma_init_data) #define USB_CONTROLLER_DATA USB_LINK_NONCACHE_NONINIT_DATA #else #define USB_DMA_DATA_NONINIT_SUB #define USB_DMA_DATA_INIT_SUB #define USB_CONTROLLER_DATA USB_LINK_USB_GLOBAL #endif -#endif #elif defined(USB_STACK_USE_DEDICATED_RAM) && (USB_STACK_USE_DEDICATED_RAM == USB_STACK_DEDICATED_RAM_TYPE_BDT) @@ -430,13 +403,7 @@ _Pragma("diag_suppress=Pm120") (defined(USB_HOST_CONFIG_BUFFER_PROPERTY_CACHEABLE) && (USB_HOST_CONFIG_BUFFER_PROPERTY_CACHEABLE)) #define USB_GLOBAL USB_LINK_DMA_NONINIT_DATA #define USB_DMA_DATA_NONINIT_SUB USB_LINK_DMA_NONINIT_DATA -#define USB_DMA_DATA_INIT_SUB USB_LINK_DMA_INIT_DATA(m_usb_dma_init_data) -#define USB_CONTROLLER_DATA USB_LINK_NONCACHE_NONINIT_DATA -#else -#if (defined(DATA_SECTION_IS_CACHEABLE) && (DATA_SECTION_IS_CACHEABLE)) -#define USB_GLOBAL USB_LINK_NONCACHE_NONINIT_DATA -#define USB_DMA_DATA_NONINIT_SUB USB_LINK_NONCACHE_NONINIT_DATA -#define USB_DMA_DATA_INIT_SUB USB_LINK_DMA_INIT_DATA(NonCacheable.init) +#define USB_DMA_DATA_INIT_SUB USB_LINK_SECTION_SUB(m_usb_dma_init_data) #define USB_CONTROLLER_DATA USB_LINK_NONCACHE_NONINIT_DATA #else #define USB_GLOBAL USB_LINK_USB_GLOBAL_BSS @@ -444,7 +411,6 @@ _Pragma("diag_suppress=Pm120") #define USB_DMA_DATA_INIT_SUB #define USB_CONTROLLER_DATA #endif -#endif #else @@ -454,17 +420,9 @@ _Pragma("diag_suppress=Pm120") #define USB_GLOBAL USB_LINK_DMA_NONINIT_DATA #define USB_BDT USB_LINK_NONCACHE_NONINIT_DATA #define USB_DMA_DATA_NONINIT_SUB USB_LINK_DMA_NONINIT_DATA -#define USB_DMA_DATA_INIT_SUB USB_LINK_DMA_INIT_DATA(m_usb_dma_init_data) +#define USB_DMA_DATA_INIT_SUB USB_LINK_SECTION_SUB(m_usb_dma_init_data) #define USB_CONTROLLER_DATA USB_LINK_NONCACHE_NONINIT_DATA -#else - -#if (defined(DATA_SECTION_IS_CACHEABLE) && (DATA_SECTION_IS_CACHEABLE)) -#define USB_GLOBAL USB_LINK_NONCACHE_NONINIT_DATA -#define USB_BDT USB_LINK_NONCACHE_NONINIT_DATA -#define USB_DMA_DATA_NONINIT_SUB USB_LINK_NONCACHE_NONINIT_DATA -#define USB_DMA_DATA_INIT_SUB USB_LINK_DMA_INIT_DATA(NonCacheable.init) -#define USB_CONTROLLER_DATA USB_LINK_NONCACHE_NONINIT_DATA #else #define USB_GLOBAL USB_LINK_USB_GLOBAL_BSS #define USB_BDT USB_LINK_USB_BDT_BSS @@ -475,8 +433,6 @@ _Pragma("diag_suppress=Pm120") #endif -#endif - #define USB_DMA_NONINIT_DATA_ALIGN(n) USB_RAM_ADDRESS_ALIGNMENT(n) USB_DMA_DATA_NONINIT_SUB #define USB_DMA_INIT_DATA_ALIGN(n) USB_RAM_ADDRESS_ALIGNMENT(n) USB_DMA_DATA_INIT_SUB diff --git a/bsp/nuvoton/libraries/m480/rtt_port/drv_usbhost.c b/bsp/nuvoton/libraries/m480/rtt_port/drv_usbhost.c index 92375cda19..be19dac9e5 100644 --- a/bsp/nuvoton/libraries/m480/rtt_port/drv_usbhost.c +++ b/bsp/nuvoton/libraries/m480/rtt_port/drv_usbhost.c @@ -844,7 +844,7 @@ int nu_usbh_register(void) RT_ASSERT(res == RT_EOK); /*initialize the usb host function */ - res = rt_usb_host_init("usbh"); + res = rt_usb_host_init(); RT_ASSERT(res == RT_EOK); #if defined(RT_USING_PM) diff --git a/bsp/rx/applications/application.c b/bsp/rx/applications/application.c index 9ea0023015..4a6e250429 100644 --- a/bsp/rx/applications/application.c +++ b/bsp/rx/applications/application.c @@ -130,7 +130,7 @@ void rt_init_thread_entry(void* parameter) #endif #ifdef RT_USING_USB_HOST - rt_usb_host_init("usbh"); + rt_usb_host_init(); #endif #ifdef RT_USING_FINSH diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_usbh.c b/bsp/stm32/libraries/HAL_Drivers/drv_usbh.c index 47b24fb950..680a93e722 100644 --- a/bsp/stm32/libraries/HAL_Drivers/drv_usbh.c +++ b/bsp/stm32/libraries/HAL_Drivers/drv_usbh.c @@ -241,7 +241,7 @@ int stm_usbh_register(void) return -RT_ERROR; } - rt_usb_host_init("usbh"); + rt_usb_host_init(); return RT_EOK; } diff --git a/components/drivers/Kconfig b/components/drivers/Kconfig index b0caabc73c..006497519f 100755 --- a/components/drivers/Kconfig +++ b/components/drivers/Kconfig @@ -642,14 +642,6 @@ menu "Using USB" string "Udisk mount dir" default "/" endif - config RT_USBH_HID - bool "Enable HID Drivers" - default n - if RT_USBH_HID - config RT_USBH_HID_MOUSE - bool "Enable HID mouse protocol" - default n - endif endif config RT_USING_USB_DEVICE bool "Using USB device" diff --git a/components/drivers/include/drivers/usb_host.h b/components/drivers/include/drivers/usb_host.h index bd73c7d1d7..2a68f4edb5 100644 --- a/components/drivers/include/drivers/usb_host.h +++ b/components/drivers/include/drivers/usb_host.h @@ -136,8 +136,7 @@ struct uhcd struct rt_device parent; uhcd_ops_t ops; rt_uint8_t num_ports; - uhub_t roothub; - struct rt_messagequeue *usb_mq; + uhub_t roothub; }; typedef struct uhcd* uhcd_t; @@ -164,7 +163,7 @@ struct uhost_msg typedef struct uhost_msg* uhost_msg_t; /* usb host system interface */ -rt_err_t rt_usb_host_init(const char *name); +rt_err_t rt_usb_host_init(void); void rt_usbh_hub_init(struct uhcd *hcd); /* usb host core interface */ @@ -204,7 +203,7 @@ rt_err_t rt_usbh_hub_clear_port_feature(uhub_t uhub, rt_uint16_t port, rt_err_t rt_usbh_hub_set_port_feature(uhub_t uhub, rt_uint16_t port, rt_uint16_t feature); rt_err_t rt_usbh_hub_reset_port(uhub_t uhub, rt_uint16_t port); -rt_err_t rt_usbh_event_signal(uhcd_t uhcd, struct uhost_msg* msg); +rt_err_t rt_usbh_event_signal(struct uhost_msg* msg); void rt_usbh_root_hub_connect_handler(struct uhcd *hcd, rt_uint8_t port, rt_bool_t isHS); diff --git a/components/drivers/pm/debug.log b/components/drivers/pm/debug.log deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/components/drivers/usb/usbhost/class/hid.c b/components/drivers/usb/usbhost/class/hid.c index 1abc82184f..e16096877f 100644 --- a/components/drivers/usb/usbhost/class/hid.c +++ b/components/drivers/usb/usbhost/class/hid.c @@ -26,7 +26,7 @@ static rt_list_t _protocal_list; * * @return the error code, RT_EOK on successfully. */ -rt_err_t rt_usbh_hid_set_idle(struct uhintf* intf, int duration, int report_id) +rt_err_t rt_usbh_hid_set_idle(struct uintf* intf, int duration, int report_id) { struct urequest setup; struct uinstance* device; @@ -40,15 +40,14 @@ rt_err_t rt_usbh_hid_set_idle(struct uhintf* intf, int duration, int report_id) setup.request_type = USB_REQ_TYPE_DIR_OUT | USB_REQ_TYPE_CLASS | USB_REQ_TYPE_INTERFACE; - setup.bRequest = USB_REQ_SET_IDLE; - setup.wIndex = 0; - setup.wLength = 0; - setup.wValue = (duration << 8 )| report_id; + setup.request = USB_REQ_SET_IDLE; + setup.index = 0; + setup.length = 0; + setup.value = (duration << 8 )| report_id; - if (rt_usb_hcd_setup_xfer(device->hcd, device->pipe_ep0_out, &setup, timeout) == 8) - return RT_EOK; - else - return -RT_FALSE; + if(rt_usb_hcd_control_xfer(device->hcd, device, &setup, RT_NULL, 0, + timeout) == 0) return RT_EOK; + else return -RT_FALSE; } /** @@ -60,7 +59,7 @@ rt_err_t rt_usbh_hid_set_idle(struct uhintf* intf, int duration, int report_id) * * @return the error code, RT_EOK on successfully. */ -rt_err_t rt_usbh_hid_get_report(struct uhintf* intf, rt_uint8_t type, +rt_err_t rt_usbh_hid_get_report(struct uintf* intf, rt_uint8_t type, rt_uint8_t id, rt_uint8_t *buffer, rt_size_t size) { struct urequest setup; @@ -75,24 +74,14 @@ rt_err_t rt_usbh_hid_get_report(struct uhintf* intf, rt_uint8_t type, setup.request_type = USB_REQ_TYPE_DIR_IN | USB_REQ_TYPE_CLASS | USB_REQ_TYPE_INTERFACE; - setup.bRequest = USB_REQ_GET_REPORT; - setup.wIndex = intf->intf_desc->bInterfaceNumber; - setup.wLength = size; - setup.wValue = (type << 8 ) + id; + setup.request = USB_REQ_GET_REPORT; + setup.index = intf->intf_desc->bInterfaceNumber; + setup.length = size; + setup.value = (type << 8 ) + id; - if (rt_usb_hcd_setup_xfer(device->hcd, device->pipe_ep0_out, &setup, timeout) == 8) - { - if (rt_usb_hcd_pipe_xfer(device->hcd, device->pipe_ep0_in, buffer, size, timeout) == size) - { - if (rt_usb_hcd_pipe_xfer(device->hcd, device->pipe_ep0_out, RT_NULL, 0, timeout) == 0) - { - return RT_EOK; - } - } - } - else - return -RT_FALSE; - return -RT_FALSE; + if(rt_usb_hcd_control_xfer(device->hcd, device, &setup, buffer, size, + timeout) == size) return RT_EOK; + else return -RT_FALSE; } /** @@ -104,7 +93,7 @@ rt_err_t rt_usbh_hid_get_report(struct uhintf* intf, rt_uint8_t type, * * @return the error code, RT_EOK on successfully. */ -rt_err_t rt_usbh_hid_set_report(struct uhintf* intf, rt_uint8_t *buffer, rt_size_t size) +rt_err_t rt_usbh_hid_set_report(struct uintf* intf, rt_uint8_t *buffer, rt_size_t size) { struct urequest setup; struct uinstance* device; @@ -118,15 +107,14 @@ rt_err_t rt_usbh_hid_set_report(struct uhintf* intf, rt_uint8_t *buffer, rt_size setup.request_type = USB_REQ_TYPE_DIR_OUT | USB_REQ_TYPE_CLASS | USB_REQ_TYPE_INTERFACE; - setup.bRequest = USB_REQ_SET_REPORT; - setup.wIndex = intf->intf_desc->bInterfaceNumber; - setup.wLength = size; - setup.wValue = 0x02 << 8; + setup.request = USB_REQ_SET_REPORT; + setup.index = intf->intf_desc->bInterfaceNumber; + setup.length = size; + setup.value = 0x02 << 8; - if (rt_usb_hcd_setup_xfer(device->hcd, device->pipe_ep0_out, &setup, timeout) == 8) - return RT_EOK; - else - return -RT_FALSE; + if(rt_usb_hcd_control_xfer(device->hcd, device, &setup, buffer, size, + timeout) == size) return RT_EOK; + else return -RT_FALSE; } /** @@ -137,7 +125,7 @@ rt_err_t rt_usbh_hid_set_report(struct uhintf* intf, rt_uint8_t *buffer, rt_size * * @return the error code, RT_EOK on successfully. */ -rt_err_t rt_usbh_hid_set_protocal(struct uhintf* intf, int protocol) +rt_err_t rt_usbh_hid_set_protocal(struct uintf* intf, int protocol) { struct urequest setup; struct uinstance* device; @@ -151,15 +139,14 @@ rt_err_t rt_usbh_hid_set_protocal(struct uhintf* intf, int protocol) setup.request_type = USB_REQ_TYPE_DIR_OUT | USB_REQ_TYPE_CLASS | USB_REQ_TYPE_INTERFACE; - setup.bRequest = USB_REQ_SET_PROTOCOL; - setup.wIndex = 0; - setup.wLength = 0; - setup.wValue = protocol; + setup.request = USB_REQ_SET_PROTOCOL; + setup.index = 0; + setup.length = 0; + setup.value = protocol; - if (rt_usb_hcd_setup_xfer(device->hcd, device->pipe_ep0_out, &setup, timeout) == 8) - return RT_EOK; - else - return -RT_FALSE; + if(rt_usb_hcd_control_xfer(device->hcd, device, &setup, RT_NULL, 0, + timeout) == 0) return RT_EOK; + else return -RT_FALSE; } /** @@ -172,7 +159,7 @@ rt_err_t rt_usbh_hid_set_protocal(struct uhintf* intf, int protocol) * * @return the error code, RT_EOK on successfully. */ -rt_err_t rt_usbh_hid_get_report_descriptor(struct uhintf* intf, +rt_err_t rt_usbh_hid_get_report_descriptor(struct uintf* intf, rt_uint8_t *buffer, rt_size_t size) { struct urequest setup; @@ -187,24 +174,14 @@ rt_err_t rt_usbh_hid_get_report_descriptor(struct uhintf* intf, setup.request_type = USB_REQ_TYPE_DIR_IN | USB_REQ_TYPE_STANDARD| USB_REQ_TYPE_INTERFACE; - setup.bRequest = USB_REQ_GET_DESCRIPTOR; - setup.wIndex = 0; - setup.wLength = size; - setup.wValue = USB_DESC_TYPE_REPORT << 8; + setup.request = USB_REQ_GET_DESCRIPTOR; + setup.index = 0; + setup.length = size; + setup.value = USB_DESC_TYPE_REPORT << 8; - if (rt_usb_hcd_setup_xfer(device->hcd, device->pipe_ep0_out, &setup, timeout) == 8) - { - if (rt_usb_hcd_pipe_xfer(device->hcd, device->pipe_ep0_in, buffer, size, timeout) == size) - { - if (rt_usb_hcd_pipe_xfer(device->hcd, device->pipe_ep0_out, RT_NULL, 0, timeout) == 0) - { - return RT_EOK; - } - } - } - else - return -RT_FALSE; - return -RT_FALSE; + if(rt_usb_hcd_control_xfer(device->hcd, device, &setup, buffer, size, + timeout) == size) return RT_EOK; + else return -RT_FALSE; } /** @@ -243,16 +220,16 @@ static void rt_usbh_hid_callback(void* context) RT_ASSERT(context != RT_NULL); pipe = (upipe_t)context; - hid = (struct uhid*)((struct uhintf*)pipe->inst)->user_data; + hid = (struct uhid*)pipe->intf->user_data; /* invoke protocal callback function */ hid->protocal->callback((void*)hid); /* parameter check */ - RT_ASSERT(((struct uhintf*)pipe->inst)->device->hcd != RT_NULL); + RT_ASSERT(pipe->intf->device->hcd != RT_NULL); - rt_usb_hcd_pipe_xfer(((struct uhintf*)pipe->inst)->device->hcd, pipe, - hid->buffer, pipe->ep.wMaxPacketSize, timeout); + rt_usb_hcd_int_xfer(pipe->intf->device->hcd, pipe, hid->buffer, + pipe->ep.wMaxPacketSize, timeout); } /** @@ -291,7 +268,9 @@ static rt_err_t rt_usbh_hid_enable(void* arg) int i = 0, pro_id; uprotocal_t protocal; struct uhid* hid; - struct uhintf* intf = (struct uhintf*)arg; + struct uintf* intf = (struct uintf*)arg; + int timeout = USB_TIMEOUT_BASIC; + upipe_t pipe; /* parameter check */ if(intf == RT_NULL) @@ -340,13 +319,19 @@ static rt_err_t rt_usbh_hid_enable(void* arg) if(!(ep_desc->bEndpointAddress & USB_DIR_IN)) continue; ret = rt_usb_hcd_alloc_pipe(intf->device->hcd, &hid->pipe_in, - intf, ep_desc); + intf, ep_desc, rt_usbh_hid_callback); if(ret != RT_EOK) return ret; } /* initialize hid protocal */ - hid->protocal->init((void*)intf); + hid->protocal->init((void*)intf); + pipe = hid->pipe_in; + /* parameter check */ + RT_ASSERT(pipe->intf->device->hcd != RT_NULL); + + rt_usb_hcd_int_xfer(pipe->intf->device->hcd, hid->pipe_in, + hid->buffer, hid->pipe_in->ep.wMaxPacketSize, timeout); return RT_EOK; } @@ -361,7 +346,7 @@ static rt_err_t rt_usbh_hid_enable(void* arg) static rt_err_t rt_usbh_hid_disable(void* arg) { struct uhid* hid; - struct uhintf* intf = (struct uhintf*)arg; + struct uintf* intf = (struct uintf*)arg; RT_ASSERT(intf != RT_NULL); @@ -379,6 +364,9 @@ static rt_err_t rt_usbh_hid_disable(void* arg) /* free the hid instance */ rt_free(hid); } + + /* free the instance */ + rt_free(intf); return RT_EOK; } diff --git a/components/drivers/usb/usbhost/class/hid.h b/components/drivers/usb/usbhost/class/hid.h index 04c67aa42b..8e446c8cea 100644 --- a/components/drivers/usb/usbhost/class/hid.h +++ b/components/drivers/usb/usbhost/class/hid.h @@ -31,11 +31,11 @@ typedef struct uhid uhid_t; #define USB_HID_KEYBOARD 1 #define USB_HID_MOUSE 2 -rt_err_t rt_usbh_hid_set_idle(struct uhintf* intf, int duration, int report_id); -rt_err_t rt_usbh_hid_get_report(struct uhintf* intf, rt_uint8_t type, rt_uint8_t id, rt_uint8_t *buffer, rt_size_t size); -rt_err_t rt_usbh_hid_set_report(struct uhintf* intf, rt_uint8_t *buffer, rt_size_t size); -rt_err_t rt_usbh_hid_set_protocal(struct uhintf* intf, int protocol); -rt_err_t rt_usbh_hid_get_report_descriptor(struct uhintf* intf, rt_uint8_t *buffer, rt_size_t size); +rt_err_t rt_usbh_hid_set_idle(struct uintf* intf, int duration, int report_id); +rt_err_t rt_usbh_hid_get_report(struct uintf* intf, rt_uint8_t type, rt_uint8_t id, rt_uint8_t *buffer, rt_size_t size); +rt_err_t rt_usbh_hid_set_report(struct uintf* intf, rt_uint8_t *buffer, rt_size_t size); +rt_err_t rt_usbh_hid_set_protocal(struct uintf* intf, int protocol); +rt_err_t rt_usbh_hid_get_report_descriptor(struct uintf* intf, rt_uint8_t *buffer, rt_size_t size); rt_err_t rt_usbh_hid_protocal_register(uprotocal_t protocal); #endif diff --git a/components/drivers/usb/usbhost/class/umouse.c b/components/drivers/usb/usbhost/class/umouse.c index 7f50c0451f..e769475a98 100644 --- a/components/drivers/usb/usbhost/class/umouse.c +++ b/components/drivers/usb/usbhost/class/umouse.c @@ -126,36 +126,15 @@ static rt_err_t rt_usbh_hid_mouse_callback(void* arg) return RT_EOK; } -rt_thread_t mouse_thread; -void mouse_task(void* param) -{ - struct uhintf* intf = (struct uhintf*)param; - while (1) - { - if (rt_usb_hcd_pipe_xfer(intf->device->hcd, ((struct uhid*)intf->user_data)->pipe_in, - ((struct uhid*)intf->user_data)->buffer, ((struct uhid*)intf->user_data)->pipe_in->ep.wMaxPacketSize, - USB_TIMEOUT_BASIC) == 0) - { - break; - } - - rt_usbh_hid_mouse_callback(intf->user_data); - } -} - - static rt_err_t rt_usbh_hid_mouse_init(void* arg) { - struct uhintf* intf = (struct uhintf*)arg; + struct uintf* intf = (struct uintf*)arg; RT_ASSERT(intf != RT_NULL); rt_usbh_hid_set_protocal(intf, 0); - rt_usbh_hid_set_idle(intf, 0, 0); - - mouse_thread = rt_thread_create("mouse0", mouse_task, intf, 500, 8, 100); - rt_thread_startup(mouse_thread); + rt_usbh_hid_set_idle(intf, 10, 0); RT_DEBUG_LOG(RT_DEBUG_USB, ("start usb mouse\n")); #ifdef RT_USING_RTGUI diff --git a/components/drivers/usb/usbhost/core/driver.c b/components/drivers/usb/usbhost/core/driver.c index 871a7b578a..37327108c1 100644 --- a/components/drivers/usb/usbhost/core/driver.c +++ b/components/drivers/usb/usbhost/core/driver.c @@ -13,7 +13,6 @@ #include static rt_list_t _driver_list; -static rt_bool_t _driver_list_created = RT_FALSE; /** * This function will initilize the usb class driver related data structure, @@ -23,11 +22,8 @@ static rt_bool_t _driver_list_created = RT_FALSE; */ rt_err_t rt_usbh_class_driver_init(void) { - if (_driver_list_created == RT_FALSE) - { - rt_list_init(&_driver_list); - _driver_list_created = RT_TRUE; - } + rt_list_init(&_driver_list); + return RT_EOK; } @@ -43,11 +39,8 @@ rt_err_t rt_usbh_class_driver_register(ucd_t drv) { if (drv == RT_NULL) return -RT_ERROR; - if (rt_usbh_class_driver_find(drv->class_code, drv->subclass_code) == RT_NULL) - { - /* insert class driver into driver list */ - rt_list_insert_after(&_driver_list, &(drv->list)); - } + /* insert class driver into driver list */ + rt_list_insert_after(&_driver_list, &(drv->list)); return RT_EOK; } diff --git a/components/drivers/usb/usbhost/core/hub.c b/components/drivers/usb/usbhost/core/hub.c index c0e025ba7e..eefa571472 100644 --- a/components/drivers/usb/usbhost/core/hub.c +++ b/components/drivers/usb/usbhost/core/hub.c @@ -13,9 +13,9 @@ #define USB_THREAD_STACK_SIZE 4096 -// static struct rt_messagequeue *usb_mq; +static struct rt_messagequeue *usb_mq; static struct uclass_driver hub_driver; -// static struct uhub root_hub; +static struct uhub root_hub; static rt_err_t root_hub_ctrl(struct uhcd *hcd, rt_uint16_t port, rt_uint8_t cmd, void *args) { @@ -92,7 +92,7 @@ void rt_usbh_root_hub_connect_handler(struct uhcd *hcd, rt_uint8_t port, rt_bool { hcd->roothub->port_status[port - 1] |= PORT_LSDA; } - rt_usbh_event_signal(hcd, &msg); + rt_usbh_event_signal(&msg); } void rt_usbh_root_hub_disconnect_handler(struct uhcd *hcd, rt_uint8_t port) @@ -102,7 +102,7 @@ void rt_usbh_root_hub_disconnect_handler(struct uhcd *hcd, rt_uint8_t port) msg.content.hub = hcd->roothub; hcd->roothub->port_status[port - 1] |= PORT_CCSC; hcd->roothub->port_status[port - 1] &= ~PORT_CCS; - rt_usbh_event_signal(hcd, &msg); + rt_usbh_event_signal(&msg); } /** @@ -647,13 +647,12 @@ ucd_t rt_usbh_class_driver_hub(void) */ static void rt_usbh_hub_thread_entry(void* parameter) { - uhcd_t hcd = (uhcd_t)parameter; while(1) { struct uhost_msg msg; /* receive message */ - if(rt_mq_recv(hcd->usb_mq, &msg, sizeof(struct uhost_msg), RT_WAITING_FOREVER) + if(rt_mq_recv(usb_mq, &msg, sizeof(struct uhost_msg), RT_WAITING_FOREVER) != RT_EOK ) continue; //RT_DEBUG_LOG(RT_DEBUG_USB, ("msg type %d\n", msg.type)); @@ -680,12 +679,12 @@ static void rt_usbh_hub_thread_entry(void* parameter) * * @return the error code, RT_EOK on successfully. */ -rt_err_t rt_usbh_event_signal(uhcd_t hcd, struct uhost_msg* msg) +rt_err_t rt_usbh_event_signal(struct uhost_msg* msg) { RT_ASSERT(msg != RT_NULL); /* send message to usb message queue */ - rt_mq_send(hcd->usb_mq, (void*)msg, sizeof(struct uhost_msg)); + rt_mq_send(usb_mq, (void*)msg, sizeof(struct uhost_msg)); return RT_EOK; } @@ -699,17 +698,16 @@ rt_err_t rt_usbh_event_signal(uhcd_t hcd, struct uhost_msg* msg) void rt_usbh_hub_init(uhcd_t hcd) { rt_thread_t thread; - /* create root hub for hcd */ - hcd->roothub = rt_malloc(sizeof(struct uhub)); - rt_memset(hcd->roothub, 0, sizeof(struct uhub)); - hcd->roothub->is_roothub = RT_TRUE; - hcd->roothub->hcd = hcd; - hcd->roothub->num_ports = hcd->num_ports; + /* link root hub to hcd */ + root_hub.is_roothub = RT_TRUE; + hcd->roothub = &root_hub; + root_hub.hcd = hcd; + root_hub.num_ports = hcd->num_ports; /* create usb message queue */ - hcd->usb_mq = rt_mq_create(hcd->parent.parent.name, 32, 16, RT_IPC_FLAG_FIFO); + usb_mq = rt_mq_create("usbh", 32, 16, RT_IPC_FLAG_FIFO); /* create usb hub thread */ - thread = rt_thread_create(hcd->parent.parent.name, rt_usbh_hub_thread_entry, hcd, + thread = rt_thread_create("usbh", rt_usbh_hub_thread_entry, RT_NULL, USB_THREAD_STACK_SIZE, 8, 20); if(thread != RT_NULL) { diff --git a/components/drivers/usb/usbhost/core/usbhost.c b/components/drivers/usb/usbhost/core/usbhost.c index b9e6a7a4b1..f0294238c4 100644 --- a/components/drivers/usb/usbhost/core/usbhost.c +++ b/components/drivers/usb/usbhost/core/usbhost.c @@ -22,15 +22,15 @@ * * @return none. */ -rt_err_t rt_usb_host_init(const char *name) +rt_err_t rt_usb_host_init(void) { ucd_t drv; rt_device_t uhc; - uhc = rt_device_find(name); + uhc = rt_device_find(USB_HOST_CONTROLLER_NAME); if(uhc == RT_NULL) { - rt_kprintf("can't find usb host controller %s\n", name); + rt_kprintf("can't find usb host controller %s\n", USB_HOST_CONTROLLER_NAME); return -RT_ERROR; } @@ -44,16 +44,6 @@ rt_err_t rt_usb_host_init(const char *name) /* register mass storage class driver */ drv = rt_usbh_class_driver_storage(); rt_usbh_class_driver_register(drv); -#endif -#ifdef RT_USBH_HID - /* register mass storage class driver */ - drv = rt_usbh_class_driver_hid(); - rt_usbh_class_driver_register(drv); -#ifdef RT_USBH_HID_MOUSE - uprotocal_t protocal; - protocal = rt_usbh_hid_protocal_mouse(); - rt_usbh_hid_protocal_register(protocal); -#endif #endif /* register hub class driver */ From 8f7bbfa01147f9e0e98445da5cb958cede791a36 Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Tue, 23 Feb 2021 11:27:12 +0800 Subject: [PATCH 20/26] remove RT_USING_NOLIBC --- bsp/efm32/rtconfig.h | 1 - bsp/simulator/rtconfig_project.h | 3 --- bsp/taihu/rtconfig.h | 1 - tools/building.py | 3 --- 4 files changed, 8 deletions(-) diff --git a/bsp/efm32/rtconfig.h b/bsp/efm32/rtconfig.h index 040f07fa02..58159f90b3 100644 --- a/bsp/efm32/rtconfig.h +++ b/bsp/efm32/rtconfig.h @@ -211,7 +211,6 @@ #endif /* SECTION: Runtime library */ -// #define RT_USING_NOLIBC // #define RT_USING_NEWLIB #define RT_LIBC_USING_TIME diff --git a/bsp/simulator/rtconfig_project.h b/bsp/simulator/rtconfig_project.h index 02e29c1a65..2ff5c8d3a4 100644 --- a/bsp/simulator/rtconfig_project.h +++ b/bsp/simulator/rtconfig_project.h @@ -17,9 +17,6 @@ #pragma warning(disable:4267) /* to ignore: warning C4267: conversion from 'size_t' to 'rt_size_t', possible loss of data */ #pragma warning(disable:4244) /* to ignore: warning C4244: '=' : conversion from '__w64 int' to 'rt_size_t', possible loss of data */ -#elif defined(__GNUC__) -#define RT_USING_NOLIBC - #endif /* end of _MSC_VER */ #endif diff --git a/bsp/taihu/rtconfig.h b/bsp/taihu/rtconfig.h index 2437f6b2a3..0ca8b43a19 100644 --- a/bsp/taihu/rtconfig.h +++ b/bsp/taihu/rtconfig.h @@ -53,7 +53,6 @@ /* Using Small MM*/ #define RT_USING_SMALL_MEM -// #define RT_USING_NOLIBC #define RT_TINY_SIZE /* SECTION: Device System */ diff --git a/tools/building.py b/tools/building.py index 3cea6fc692..ba995af278 100644 --- a/tools/building.py +++ b/tools/building.py @@ -276,9 +276,6 @@ def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [ except KeyError: print ('Unknow target: '+ tgt_name+'. Avaible targets: ' +', '.join(tgt_dict.keys())) sys.exit(1) - elif (GetDepend('RT_USING_NEWLIB') == False and GetDepend('RT_USING_NOLIBC') == False) \ - and rtconfig.PLATFORM == 'gcc': - AddDepend('RT_USING_MINILIBC') # auto change the 'RTT_EXEC_PATH' when 'rtconfig.EXEC_PATH' get failed if not os.path.exists(rtconfig.EXEC_PATH): From bf7a3af6fd8e1012cc0e07ecfde059956c2f75c9 Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Tue, 23 Feb 2021 11:28:25 +0800 Subject: [PATCH 21/26] update readme --- components/libc/compilers/common/readme.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/libc/compilers/common/readme.md b/components/libc/compilers/common/readme.md index 99797d933c..81bb005d0a 100644 --- a/components/libc/compilers/common/readme.md +++ b/components/libc/compilers/common/readme.md @@ -1,8 +1,8 @@ ## Attentions -1. This folder is "common" for armlibc newlibc and dlib. It's not "common" for minilibc. +1. This folder is "common" for armlibc newlibc and dlib. -2. If you want to add new .c files, please do not forget to fix SConscript file too. eg: +2. If you want to add new `.c` files, please do not forget to fix SConscript file too. eg: ```python if GetDepend('RT_USING_POSIX') == False: From 8ef1fa192a9fd95da8b4533dc39b8e0fcc73a9a9 Mon Sep 17 00:00:00 2001 From: LeeChunHei Date: Tue, 23 Feb 2021 11:45:27 +0800 Subject: [PATCH 22/26] fix no clear bss with gcc and the wrong logic in SConscript --- .../libraries/MIMXRT1050/MIMXRT1052/gcc/startup_MIMXRT1052.S | 2 -- bsp/imxrt/libraries/MIMXRT1050/SConscript | 3 --- .../libraries/MIMXRT1064/MIMXRT1064/gcc/startup_MIMXRT1064.S | 2 -- bsp/imxrt/libraries/MIMXRT1064/SConscript | 3 --- 4 files changed, 10 deletions(-) diff --git a/bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/gcc/startup_MIMXRT1052.S b/bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/gcc/startup_MIMXRT1052.S index 73003ff20c..ae0f797605 100644 --- a/bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/gcc/startup_MIMXRT1052.S +++ b/bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/gcc/startup_MIMXRT1052.S @@ -367,7 +367,6 @@ Reset_Handler: blt .LC4 #endif /* __STARTUP_INITIALIZE_NONCACHEDATA */ -#ifdef __STARTUP_CLEAR_BSS /* This part of work usually is done in C library startup code. Otherwise, * define this macro to enable it in this startup. * @@ -385,7 +384,6 @@ Reset_Handler: itt lt strlt r0, [r1], #4 blt .LC5 -#endif /* __STARTUP_CLEAR_BSS */ cpsie i /* Unmask interrupts */ #ifndef __START diff --git a/bsp/imxrt/libraries/MIMXRT1050/SConscript b/bsp/imxrt/libraries/MIMXRT1050/SConscript index 58d5ccef78..4b652628f4 100644 --- a/bsp/imxrt/libraries/MIMXRT1050/SConscript +++ b/bsp/imxrt/libraries/MIMXRT1050/SConscript @@ -53,9 +53,6 @@ if GetDepend(['BSP_USING_SDRAM']): if GetDepend(['BSP_USING_LCD']): src += ['MIMXRT1052/drivers/fsl_elcdif.c'] -if GetDepend(['RT_USING_USB_HOST']) or GetDepend(['RT_USING_USB_DEVICE']): - src += ['MIMXRT1052/drivers/fsl_usdhc.c'] - if GetDepend(['BSP_USING_CAN']): src += ['MIMXRT1052/drivers/fsl_flexcan.c'] diff --git a/bsp/imxrt/libraries/MIMXRT1064/MIMXRT1064/gcc/startup_MIMXRT1064.S b/bsp/imxrt/libraries/MIMXRT1064/MIMXRT1064/gcc/startup_MIMXRT1064.S index db5711e040..ade70ab34e 100644 --- a/bsp/imxrt/libraries/MIMXRT1064/MIMXRT1064/gcc/startup_MIMXRT1064.S +++ b/bsp/imxrt/libraries/MIMXRT1064/MIMXRT1064/gcc/startup_MIMXRT1064.S @@ -366,7 +366,6 @@ Reset_Handler: blt .LC4 #endif /* __STARTUP_INITIALIZE_NONCACHEDATA */ -#ifdef __STARTUP_CLEAR_BSS /* This part of work usually is done in C library startup code. Otherwise, * define this macro to enable it in this startup. * @@ -384,7 +383,6 @@ Reset_Handler: itt lt strlt r0, [r1], #4 blt .LC5 -#endif /* __STARTUP_CLEAR_BSS */ cpsie i /* Unmask interrupts */ #ifndef __START diff --git a/bsp/imxrt/libraries/MIMXRT1064/SConscript b/bsp/imxrt/libraries/MIMXRT1064/SConscript index 2035ca530f..00361da038 100644 --- a/bsp/imxrt/libraries/MIMXRT1064/SConscript +++ b/bsp/imxrt/libraries/MIMXRT1064/SConscript @@ -49,9 +49,6 @@ if GetDepend(['BSP_USING_ADC']): if GetDepend(['BSP_USING_SDRAM']): src += ['MIMXRT1064/drivers/fsl_semc.c'] -if GetDepend(['RT_USING_USB_HOST']) or GetDepend(['RT_USING_USB_DEVICE']): - src += ['MIMXRT1064/drivers/fsl_usdhc.c'] - if GetDepend(['RT_USING_CAN']): src += ['MIMXRT1064/drivers/fsl_flexcan.c'] From 361f8385670f5d011c30bdf7319c57ed54a5d6fe Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Tue, 23 Feb 2021 12:50:41 +0800 Subject: [PATCH 23/26] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=8B=BC=E5=86=99?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bsp/stm32/libraries/HAL_Drivers/drv_qspi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_qspi.c b/bsp/stm32/libraries/HAL_Drivers/drv_qspi.c index b3090ec6a1..fe24651dd3 100644 --- a/bsp/stm32/libraries/HAL_Drivers/drv_qspi.c +++ b/bsp/stm32/libraries/HAL_Drivers/drv_qspi.c @@ -341,7 +341,7 @@ rt_err_t stm32_qspi_bus_attach_device(const char *bus_name, const char *device_n qspi_device->exit_qspi_mode = exit_qspi_mode; qspi_device->config.qspi_dl_width = data_line_width; - cs_pin->Pin = pin; + cs_pin->pin = pin; #ifdef BSP_QSPI_USING_SOFTCS rt_pin_mode(pin, PIN_MODE_OUTPUT); rt_pin_write(pin, 1); From 05ce4e67c32e0685e72864aa0c1b9a6e89172509 Mon Sep 17 00:00:00 2001 From: guozhanxin Date: Wed, 24 Feb 2021 11:00:51 +0800 Subject: [PATCH 24/26] [bsp][raspberry-pico] Fixed failure to start without connecting to UART --- bsp/raspberry-pico/drivers/drv_uart.c | 29 ++++++++++++++++----------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/bsp/raspberry-pico/drivers/drv_uart.c b/bsp/raspberry-pico/drivers/drv_uart.c index 48599e01f8..925968f6d7 100644 --- a/bsp/raspberry-pico/drivers/drv_uart.c +++ b/bsp/raspberry-pico/drivers/drv_uart.c @@ -60,6 +60,23 @@ static rt_err_t pico_uart_configure(struct rt_serial_device *serial, struct seri static rt_err_t pico_uart_control(struct rt_serial_device *serial, int cmd, void *arg) { + // Select correct interrupt for the UART we are using + int UART_IRQ = UART_ID == uart0 ? UART0_IRQ : UART1_IRQ; + + switch (cmd) + { + /* enable interrupt */ + case RT_DEVICE_CTRL_SET_INT: + // Set up a RX interrupt + // We need to set up the handler first + // And set up and enable the interrupt handlers + irq_set_exclusive_handler(UART_IRQ, pico_uart_isr); + irq_set_enabled(UART_IRQ, true); + + // Now enable the UART to send interrupts - RX only + uart_set_irq_enables(UART_ID, true, false); + break; + } return RT_EOK; } @@ -125,18 +142,6 @@ int rt_hw_uart_init(void) // Turn off FIFO's - we want to do this character by character uart_set_fifo_enabled(UART_ID, false); - // Set up a RX interrupt - // We need to set up the handler first - // Select correct interrupt for the UART we are using - int UART_IRQ = UART_ID == uart0 ? UART0_IRQ : UART1_IRQ; - - // And set up and enable the interrupt handlers - irq_set_exclusive_handler(UART_IRQ, pico_uart_isr); - irq_set_enabled(UART_IRQ, true); - - // Now enable the UART to send interrupts - RX only - uart_set_irq_enables(UART_ID, true, false); - uart0_dev.parent.ops = &_uart_ops; uart0_dev.parent.config = config; From b4cbfca550d0ed7107c3ad53e8519e53cc6b5f0c Mon Sep 17 00:00:00 2001 From: LeeChunHei Date: Wed, 24 Feb 2021 12:04:08 +0800 Subject: [PATCH 25/26] change to use SConscript to enable clear bss in startup.s --- .../libraries/MIMXRT1050/MIMXRT1052/gcc/startup_MIMXRT1052.S | 2 ++ bsp/imxrt/libraries/MIMXRT1050/SConscript | 5 ++++- .../libraries/MIMXRT1064/MIMXRT1064/gcc/startup_MIMXRT1064.S | 2 ++ bsp/imxrt/libraries/MIMXRT1064/SConscript | 5 ++++- 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/gcc/startup_MIMXRT1052.S b/bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/gcc/startup_MIMXRT1052.S index ae0f797605..73003ff20c 100644 --- a/bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/gcc/startup_MIMXRT1052.S +++ b/bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/gcc/startup_MIMXRT1052.S @@ -367,6 +367,7 @@ Reset_Handler: blt .LC4 #endif /* __STARTUP_INITIALIZE_NONCACHEDATA */ +#ifdef __STARTUP_CLEAR_BSS /* This part of work usually is done in C library startup code. Otherwise, * define this macro to enable it in this startup. * @@ -384,6 +385,7 @@ Reset_Handler: itt lt strlt r0, [r1], #4 blt .LC5 +#endif /* __STARTUP_CLEAR_BSS */ cpsie i /* Unmask interrupts */ #ifndef __START diff --git a/bsp/imxrt/libraries/MIMXRT1050/SConscript b/bsp/imxrt/libraries/MIMXRT1050/SConscript index 4b652628f4..7f8f971b82 100644 --- a/bsp/imxrt/libraries/MIMXRT1050/SConscript +++ b/bsp/imxrt/libraries/MIMXRT1050/SConscript @@ -76,6 +76,9 @@ if GetDepend(['BSP_USING_DMA']): src += ['MIMXRT1052/drivers/fsl_lpspi_edma.c'] -group = DefineGroup('Libraries', src, depend = [''], CPPPATH = path) +if rtconfig.CROSS_TOOL == 'gcc': + group = DefineGroup('Libraries', src, depend = [''], CPPPATH = path, ASFLAGS = '$ASFLAGS -D __STARTUP_CLEAR_BSS') +else: + group = DefineGroup('Libraries', src, depend = [''], CPPPATH = path) Return('group') diff --git a/bsp/imxrt/libraries/MIMXRT1064/MIMXRT1064/gcc/startup_MIMXRT1064.S b/bsp/imxrt/libraries/MIMXRT1064/MIMXRT1064/gcc/startup_MIMXRT1064.S index ade70ab34e..db5711e040 100644 --- a/bsp/imxrt/libraries/MIMXRT1064/MIMXRT1064/gcc/startup_MIMXRT1064.S +++ b/bsp/imxrt/libraries/MIMXRT1064/MIMXRT1064/gcc/startup_MIMXRT1064.S @@ -366,6 +366,7 @@ Reset_Handler: blt .LC4 #endif /* __STARTUP_INITIALIZE_NONCACHEDATA */ +#ifdef __STARTUP_CLEAR_BSS /* This part of work usually is done in C library startup code. Otherwise, * define this macro to enable it in this startup. * @@ -383,6 +384,7 @@ Reset_Handler: itt lt strlt r0, [r1], #4 blt .LC5 +#endif /* __STARTUP_CLEAR_BSS */ cpsie i /* Unmask interrupts */ #ifndef __START diff --git a/bsp/imxrt/libraries/MIMXRT1064/SConscript b/bsp/imxrt/libraries/MIMXRT1064/SConscript index 00361da038..c83546f0eb 100644 --- a/bsp/imxrt/libraries/MIMXRT1064/SConscript +++ b/bsp/imxrt/libraries/MIMXRT1064/SConscript @@ -74,6 +74,9 @@ if GetDepend(['RT_SERIAL_USING_DMA']): src += ['MIMXRT1064/drivers/fsl_lpuart_edma.c'] src += ['MIMXRT1064/drivers/fsl_lpspi_edma.c'] -group = DefineGroup('Libraries', src, depend = [''], CPPPATH = path) +if rtconfig.CROSS_TOOL == 'gcc': + group = DefineGroup('Libraries', src, depend = [''], CPPPATH = path, ASFLAGS = '$ASFLAGS -D __STARTUP_CLEAR_BSS') +else: + group = DefineGroup('Libraries', src, depend = [''], CPPPATH = path) Return('group') From 2b98ac215a4e07401464bfcd6ad00957ff03bd72 Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Wed, 24 Feb 2021 16:29:43 +0800 Subject: [PATCH 26/26] [kernel] rearrange rt_thread_control() - schedule the thread when close it --- components/libc/compilers/common/stdlib.c | 10 +- src/thread.c | 145 ++++++++++++---------- 2 files changed, 79 insertions(+), 76 deletions(-) diff --git a/components/libc/compilers/common/stdlib.c b/components/libc/compilers/common/stdlib.c index 9f801ab966..48a86098cd 100644 --- a/components/libc/compilers/common/stdlib.c +++ b/components/libc/compilers/common/stdlib.c @@ -14,18 +14,10 @@ void __rt_libc_exit(int status) { rt_thread_t self = rt_thread_self(); -#ifdef RT_USING_MODULE - if (dlmodule_self()) - { - dlmodule_exit(status); - } -#endif - if (self != RT_NULL) { rt_kprintf("thread:%s exit:%d!\n", self->name, status); - rt_thread_suspend(self); - rt_schedule(); + rt_thread_control(self, RT_THREAD_CTRL_CLOSE, RT_NULL); } } diff --git a/src/thread.c b/src/thread.c index 0db9dd8e4d..2681eca59f 100644 --- a/src/thread.c +++ b/src/thread.c @@ -26,6 +26,7 @@ * bug when thread has not startup. * 2018-11-22 Jesven yield is same to rt_schedule * add support for tasks bound to cpu + * 2021-02-24 Meco Man rearrange rt_thread_control() - schedule the thread when close it */ #include @@ -670,83 +671,93 @@ rt_err_t rt_thread_control(rt_thread_t thread, int cmd, void *arg) switch (cmd) { - case RT_THREAD_CTRL_CHANGE_PRIORITY: - /* disable interrupt */ - temp = rt_hw_interrupt_disable(); - - /* for ready thread, change queue */ - if ((thread->stat & RT_THREAD_STAT_MASK) == RT_THREAD_READY) + case RT_THREAD_CTRL_CHANGE_PRIORITY: { - /* remove thread from schedule queue first */ - rt_schedule_remove_thread(thread); + /* disable interrupt */ + temp = rt_hw_interrupt_disable(); - /* change thread priority */ - thread->current_priority = *(rt_uint8_t *)arg; + /* for ready thread, change queue */ + if ((thread->stat & RT_THREAD_STAT_MASK) == RT_THREAD_READY) + { + /* remove thread from schedule queue first */ + rt_schedule_remove_thread(thread); - /* recalculate priority attribute */ -#if RT_THREAD_PRIORITY_MAX > 32 - thread->number = thread->current_priority >> 3; /* 5bit */ - thread->number_mask = 1 << thread->number; - thread->high_mask = 1 << (thread->current_priority & 0x07); /* 3bit */ -#else - thread->number_mask = 1 << thread->current_priority; -#endif + /* change thread priority */ + thread->current_priority = *(rt_uint8_t *)arg; - /* insert thread to schedule queue again */ - rt_schedule_insert_thread(thread); - } - else - { - thread->current_priority = *(rt_uint8_t *)arg; + /* recalculate priority attribute */ + #if RT_THREAD_PRIORITY_MAX > 32 + thread->number = thread->current_priority >> 3; /* 5bit */ + thread->number_mask = 1 << thread->number; + thread->high_mask = 1 << (thread->current_priority & 0x07); /* 3bit */ + #else + thread->number_mask = 1 << thread->current_priority; + #endif - /* recalculate priority attribute */ -#if RT_THREAD_PRIORITY_MAX > 32 - thread->number = thread->current_priority >> 3; /* 5bit */ - thread->number_mask = 1 << thread->number; - thread->high_mask = 1 << (thread->current_priority & 0x07); /* 3bit */ -#else - thread->number_mask = 1 << thread->current_priority; -#endif + /* insert thread to schedule queue again */ + rt_schedule_insert_thread(thread); + } + else + { + thread->current_priority = *(rt_uint8_t *)arg; + + /* recalculate priority attribute */ + #if RT_THREAD_PRIORITY_MAX > 32 + thread->number = thread->current_priority >> 3; /* 5bit */ + thread->number_mask = 1 << thread->number; + thread->high_mask = 1 << (thread->current_priority & 0x07); /* 3bit */ + #else + thread->number_mask = 1 << thread->current_priority; + #endif + } + + /* enable interrupt */ + rt_hw_interrupt_enable(temp); + break; } - /* enable interrupt */ - rt_hw_interrupt_enable(temp); - break; - - case RT_THREAD_CTRL_STARTUP: - return rt_thread_startup(thread); - - case RT_THREAD_CTRL_CLOSE: - - if (rt_object_is_systemobject((rt_object_t)thread) == RT_TRUE) + case RT_THREAD_CTRL_STARTUP: { - return rt_thread_detach(thread); - } -#ifdef RT_USING_HEAP - else - { - return rt_thread_delete(thread); - } -#endif - -#ifdef RT_USING_SMP - case RT_THREAD_CTRL_BIND_CPU: - { - rt_uint8_t cpu; - - if ((thread->stat & RT_THREAD_STAT_MASK) != RT_THREAD_INIT) - { - /* we only support bind cpu before started phase. */ - return RT_ERROR; + return rt_thread_startup(thread); } - cpu = (rt_uint8_t)(size_t)arg; - thread->bind_cpu = cpu > RT_CPUS_NR? RT_CPUS_NR : cpu; - break; - } -#endif /*RT_USING_SMP*/ - default: - break; + case RT_THREAD_CTRL_CLOSE: + { + rt_err_t rt_err; + + if (rt_object_is_systemobject((rt_object_t)thread) == RT_TRUE) + { + rt_err = rt_thread_detach(thread); + } + #ifdef RT_USING_HEAP + else + { + rt_err = rt_thread_delete(thread); + } + #endif + rt_schedule(); + return rt_err; + } + + #ifdef RT_USING_SMP + case RT_THREAD_CTRL_BIND_CPU: + { + rt_uint8_t cpu; + + if ((thread->stat & RT_THREAD_STAT_MASK) != RT_THREAD_INIT) + { + /* we only support bind cpu before started phase. */ + return RT_ERROR; + } + + cpu = (rt_uint8_t)(size_t)arg; + thread->bind_cpu = cpu > RT_CPUS_NR? RT_CPUS_NR : cpu; + break; + } + #endif /*RT_USING_SMP*/ + + default: + break; } return RT_EOK;