mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-09-21 18:57:16 +08:00
@@ -27,7 +27,22 @@ menu "On-chip Peripheral Drivers"
|
||||
bool "Enable RTC"
|
||||
select RT_USING_RTC
|
||||
default n
|
||||
|
||||
config BSP_USING_USB
|
||||
bool "Enable USB"
|
||||
select RT_USING_USB_HOST
|
||||
default n
|
||||
|
||||
if BSP_USING_USB
|
||||
config BSP_USB0_HOST
|
||||
bool "Enable USB0"
|
||||
default n
|
||||
|
||||
config BSP_USB1_HOST
|
||||
bool "Enable USB1"
|
||||
default n
|
||||
endif
|
||||
|
||||
config BSP_USING_SDIO
|
||||
bool "Enable SDIO"
|
||||
select RT_USING_SDIO
|
||||
@@ -52,17 +67,17 @@ menu "On-chip Peripheral Drivers"
|
||||
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_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_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"
|
||||
|
||||
@@ -126,7 +126,7 @@ static void BOARD_ConfigMPU(void)
|
||||
|
||||
/* Region 0 setting: Instruction access disabled, No data access permission. */
|
||||
MPU->RBAR = ARM_MPU_RBAR(0, 0x00000000U);
|
||||
MPU->RASR = ARM_MPU_RASR(1, ARM_MPU_AP_NONE, 2, 0, 0, 0, 0, ARM_MPU_REGION_SIZE_4GB);
|
||||
MPU->RASR = ARM_MPU_RASR(1, ARM_MPU_AP_NONE, 0, 0, 0, 0, 0, ARM_MPU_REGION_SIZE_4GB);
|
||||
|
||||
/* Region 1 setting: Memory with Device type, not shareable, non-cacheable. */
|
||||
MPU->RBAR = ARM_MPU_RBAR(1, 0x80000000U);
|
||||
@@ -148,6 +148,15 @@ static void BOARD_ConfigMPU(void)
|
||||
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_256KB);
|
||||
|
||||
#if defined(CACHE_MODE_WRITE_THROUGH) && CACHE_MODE_WRITE_THROUGH
|
||||
/* Region 6 setting: Memory with Normal type, not shareable, write through */
|
||||
MPU->RBAR = ARM_MPU_RBAR(6, 0x20200000U);
|
||||
MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 0, 0, 1, 0, 0, ARM_MPU_REGION_SIZE_1MB);
|
||||
|
||||
/* Region 7 setting: Memory with Normal type, not shareable, write trough */
|
||||
MPU->RBAR = ARM_MPU_RBAR(7, 0x20300000U);
|
||||
MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 0, 0, 1, 0, 0, ARM_MPU_REGION_SIZE_512KB);
|
||||
#else
|
||||
/* Region 6 setting: Memory with Normal type, not shareable, outer/inner write back */
|
||||
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_1MB);
|
||||
@@ -155,6 +164,7 @@ static void BOARD_ConfigMPU(void)
|
||||
/* Region 7 setting: Memory with Normal type, not shareable, outer/inner write back */
|
||||
MPU->RBAR = ARM_MPU_RBAR(7, 0x20300000U);
|
||||
MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 0, 0, 1, 1, 0, ARM_MPU_REGION_SIZE_512KB);
|
||||
#endif
|
||||
|
||||
#if defined(XIP_EXTERNAL_FLASH) && (XIP_EXTERNAL_FLASH == 1)
|
||||
/* Region 8 setting: Memory with Normal type, not shareable, outer/inner write back. */
|
||||
@@ -163,9 +173,15 @@ static void BOARD_ConfigMPU(void)
|
||||
#endif
|
||||
|
||||
#ifdef USE_SDRAM
|
||||
#if defined(CACHE_MODE_WRITE_THROUGH) && CACHE_MODE_WRITE_THROUGH
|
||||
/* Region 9 setting: Memory with Normal type, not shareable, write trough */
|
||||
MPU->RBAR = ARM_MPU_RBAR(9, 0x80000000U);
|
||||
MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 0, 0, 1, 0, 0, ARM_MPU_REGION_SIZE_64MB);
|
||||
#else
|
||||
/* Region 9 setting: Memory with Normal type, not shareable, outer/inner write back */
|
||||
MPU->RBAR = ARM_MPU_RBAR(9, 0x80000000U);
|
||||
MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 0, 0, 1, 1, 0, ARM_MPU_REGION_SIZE_64MB);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
while ((size >> i) > 0x1U)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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_ */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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 <rtthread.h>
|
||||
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__
|
||||
@@ -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*/
|
||||
}
|
||||
@@ -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_*/
|
||||
@@ -51,6 +51,10 @@ if GetDepend(['RT_USING_CAN']):
|
||||
|
||||
if GetDepend(['BSP_USING_FLEXSPI']):
|
||||
src += ['MIMXRT1176/drivers/fsl_flexspi.c']
|
||||
|
||||
#fsl os abstract files
|
||||
src += ['MIMXRT1176/drivers/fsl_os_abstraction_rtthread.c']
|
||||
src += ['MIMXRT1176/drivers/generic_list.c']
|
||||
|
||||
if rtconfig.PLATFORM in ['gcc']:
|
||||
group = DefineGroup('Libraries', src, depend = [''], CPPPATH = path, ASFLAGS = '$ASFLAGS -D __STARTUP_CLEAR_BSS')
|
||||
|
||||
@@ -24,8 +24,12 @@
|
||||
|
||||
/* USB PHY configuration */
|
||||
#ifndef BOARD_USB_PHY_D_CAL
|
||||
#ifdef SOC_IMXRT1170_SERIES
|
||||
#define BOARD_USB_PHY_D_CAL (0x07U)
|
||||
#else
|
||||
#define BOARD_USB_PHY_D_CAL (0x0CU)
|
||||
#endif
|
||||
#endif
|
||||
#ifndef BOARD_USB_PHY_TXCAL45DP
|
||||
#define BOARD_USB_PHY_TXCAL45DP (0x06U)
|
||||
#endif
|
||||
@@ -33,7 +37,12 @@
|
||||
#define BOARD_USB_PHY_TXCAL45DM (0x06U)
|
||||
#endif
|
||||
|
||||
#define USB_HOST_INTERRUPT_PRIORITY 3
|
||||
#define USB_HOST_INTERRUPT_PRIORITY 6
|
||||
|
||||
/* Allocate the memory for the heap. */
|
||||
#if defined(configAPPLICATION_ALLOCATED_HEAP) && (configAPPLICATION_ALLOCATED_HEAP)
|
||||
USB_DMA_NONINIT_DATA_ALIGN(USB_DATA_ALIGN_SIZE) uint8_t ucHeap[configTOTAL_HEAP_SIZE];
|
||||
#endif
|
||||
|
||||
enum
|
||||
{
|
||||
@@ -91,20 +100,22 @@ static void _imxrt_usb_host_send_callback(void *param, usb_host_transfer_t *tran
|
||||
*/
|
||||
static void USB_HostClockInit(usb_controller_index_t controller_id)
|
||||
{
|
||||
uint32_t usbClockFreq;
|
||||
usb_phy_config_struct_t phyConfig = {
|
||||
BOARD_USB_PHY_D_CAL, BOARD_USB_PHY_TXCAL45DP, BOARD_USB_PHY_TXCAL45DM,
|
||||
};
|
||||
uint32_t notUsed = 0;
|
||||
|
||||
usbClockFreq = 24000000;
|
||||
|
||||
if (controller_id == kUSB_ControllerEhci0)
|
||||
{
|
||||
CLOCK_EnableUsbhs0PhyPllClock(kCLOCK_Usbphy480M, 480000000U);
|
||||
CLOCK_EnableUsbhs0Clock(kCLOCK_Usb480M, 480000000U);
|
||||
CLOCK_EnableUsbhs0PhyPllClock(kCLOCK_Usbphy480M, usbClockFreq);
|
||||
CLOCK_EnableUsbhs0Clock(kCLOCK_Usb480M, usbClockFreq);
|
||||
}
|
||||
else
|
||||
{
|
||||
CLOCK_EnableUsbhs1PhyPllClock(kCLOCK_Usbphy480M, 480000000U);
|
||||
CLOCK_EnableUsbhs1Clock(kCLOCK_Usb480M, 480000000U);
|
||||
CLOCK_EnableUsbhs1PhyPllClock(kCLOCK_Usbphy480M, usbClockFreq);
|
||||
CLOCK_EnableUsbhs1Clock(kCLOCK_Usb480M, usbClockFreq);
|
||||
}
|
||||
|
||||
USB_EhciPhyInit(controller_id, 24000000U, &phyConfig);
|
||||
@@ -151,7 +162,7 @@ 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;
|
||||
// int timeout = timeouts;
|
||||
|
||||
if (!imxrt_usb_host_obj[USBH0_INDEX].connect_status)
|
||||
{
|
||||
|
||||
@@ -105,8 +105,13 @@ typedef struct _usb_host_process_descriptor_param
|
||||
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 */
|
||||
#ifdef SOC_IMXRT1170_SERIES
|
||||
uint16_t languageId; /*!< It specifies the language ID for string descriptors or is reset to zero for other
|
||||
descriptors */
|
||||
#else
|
||||
uint8_t languageId; /*!< It specifies the language ID for string descriptors or is reset to zero for other
|
||||
descriptors */
|
||||
#endif
|
||||
uint8_t *descriptorBuffer; /*!< Buffer pointer */
|
||||
uint16_t descriptorLength; /*!< Buffer data length */
|
||||
} usb_host_process_descriptor_param_t;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -21,6 +21,11 @@
|
||||
#include "usb_host.h"
|
||||
#endif
|
||||
|
||||
//#define USB_GINSTANCE_SIZE (sizeof(usb_host_ehci_instance_t))
|
||||
//#if defined(__ICCARM__) /* IAR Workbench */
|
||||
//#pragma location = "usb_heap_section"
|
||||
//static char ginstance_base[USB_GINSTANCE_SIZE];
|
||||
//#endif
|
||||
/*******************************************************************************
|
||||
* Definitions
|
||||
******************************************************************************/
|
||||
@@ -156,6 +161,15 @@ static void USB_HostEhciZeroMem(uint32_t *buffer, uint32_t length);
|
||||
*/
|
||||
static void USB_HostEhciDelay(USBHS_Type *ehciIpBase, uint32_t ms);
|
||||
|
||||
#ifdef SOC_IMXRT1170_SERIES
|
||||
/*!
|
||||
* @brief host ehci start async schedule.
|
||||
*
|
||||
* @param ehciInstance ehci instance pointer.
|
||||
*/
|
||||
static void USB_HostEhciStartAsync(usb_host_ehci_instance_t *ehciInstance);
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* @brief host ehci stop async schedule.
|
||||
*
|
||||
@@ -163,6 +177,15 @@ static void USB_HostEhciDelay(USBHS_Type *ehciIpBase, uint32_t ms);
|
||||
*/
|
||||
static void USB_HostEhciStopAsync(usb_host_ehci_instance_t *ehciInstance);
|
||||
|
||||
#ifdef SOC_IMXRT1170_SERIES
|
||||
/*!
|
||||
* @brief host ehci start periodic schedule.
|
||||
*
|
||||
* @param ehciInstance ehci instance pointer.
|
||||
*/
|
||||
static void USB_HostEhciStartPeriodic(usb_host_ehci_instance_t *ehciInstance);
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* @brief host ehci stop periodic schedule.
|
||||
*
|
||||
@@ -482,6 +505,19 @@ static usb_status_t USB_HostEhciCancelPipe(usb_host_ehci_instance_t *ehciInstanc
|
||||
usb_host_ehci_pipe_t *ehciPipePointer,
|
||||
usb_host_transfer_t *transfer);
|
||||
|
||||
|
||||
#ifdef SOC_IMXRT1170_SERIES
|
||||
/*!
|
||||
* @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);
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* @brief ehci transaction done process function.
|
||||
*
|
||||
@@ -489,7 +525,22 @@ static usb_status_t USB_HostEhciCancelPipe(usb_host_ehci_instance_t *ehciInstanc
|
||||
*/
|
||||
void USB_HostEhciTransactionDone(usb_host_ehci_instance_t *ehciInstance);
|
||||
|
||||
#ifdef SOC_IMXRT1170_SERIES
|
||||
/*!
|
||||
* @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);
|
||||
#endif
|
||||
|
||||
#if ((defined(USB_HOST_CONFIG_LOW_POWER_MODE)) && (USB_HOST_CONFIG_LOW_POWER_MODE > 0U))
|
||||
/*!
|
||||
@@ -1045,7 +1096,11 @@ static void USB_HostBandwidthHsHostComputeCurrentFsls(usb_host_ehci_instance_t *
|
||||
{
|
||||
usb_host_ehci_pipe_t *ehciPipePointer;
|
||||
uint8_t index;
|
||||
#ifdef SOC_IMXRT1170_SERIES
|
||||
uint32_t deviceInfo = 0;
|
||||
#else
|
||||
uint32_t deviceInfo;
|
||||
#endif
|
||||
void *temp;
|
||||
|
||||
for (index = 0; index < 8U; ++index)
|
||||
@@ -1117,7 +1172,11 @@ static void USB_HostBandwidthHsHostComputeCurrentHsAll(usb_host_ehci_instance_t
|
||||
{
|
||||
usb_host_ehci_pipe_t *ehciPipePointer;
|
||||
uint16_t index;
|
||||
#ifdef SOC_IMXRT1170_SERIES
|
||||
uint32_t deviceInfo = 0U;
|
||||
#else
|
||||
uint32_t deviceInfo;
|
||||
#endif
|
||||
uint16_t frameInterval;
|
||||
void *temp;
|
||||
for (index = 0; index < 8U; ++index)
|
||||
@@ -1790,7 +1849,11 @@ 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 */
|
||||
}
|
||||
|
||||
#ifdef SOC_IMXRT1170_SERIES
|
||||
static void USB_HostEhciStartAsync(usb_host_ehci_instance_t *ehciInstance)
|
||||
#else
|
||||
void USB_HostEhciStartAsync(usb_host_ehci_instance_t *ehciInstance)
|
||||
#endif
|
||||
{
|
||||
uint32_t stateSync;
|
||||
|
||||
@@ -1828,7 +1891,11 @@ static void USB_HostEhciStopAsync(usb_host_ehci_instance_t *ehciInstance)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef SOC_IMXRT1170_SERIES
|
||||
static void USB_HostEhciStartPeriodic(usb_host_ehci_instance_t *ehciInstance)
|
||||
#else
|
||||
void USB_HostEhciStartPeriodic(usb_host_ehci_instance_t *ehciInstance)
|
||||
#endif
|
||||
{
|
||||
uint32_t stateSync;
|
||||
|
||||
@@ -3060,6 +3127,9 @@ static uint32_t USB_HostEhciItdArrayRelease(usb_host_ehci_instance_t *ehciInstan
|
||||
/* 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;
|
||||
#ifdef SOC_IMXRT1170_SERIES
|
||||
USB_HostEhciZeroMem((uint32_t *)(void *)itdPointer + 1, ((sizeof(usb_host_ehci_itd_t) >> 2) - 4U));
|
||||
#endif
|
||||
itdPointer->nextItdPointer = (usb_host_ehci_itd_t *)ehciInstance->ehciItdList;
|
||||
ehciInstance->ehciItdList = itdPointer;
|
||||
ehciInstance->ehciItdNumber++;
|
||||
@@ -3379,7 +3449,10 @@ static usb_status_t USB_HostEhciStartIP(usb_host_ehci_instance_t *ehciInstance)
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef SOC_IMXRT1170_SERIES
|
||||
/* no interrupt threshold */
|
||||
ehciInstance->ehciIpBase->USBCMD &= ~USBHS_USBCMD_ITC_MASK;
|
||||
#endif
|
||||
/* start the controller */
|
||||
ehciInstance->ehciIpBase->USBCMD |= USBHS_USBCMD_RS_MASK;
|
||||
|
||||
@@ -3474,8 +3547,11 @@ static usb_status_t USB_HostEhciCancelPipe(usb_host_ehci_instance_t *ehciInstanc
|
||||
|
||||
return kStatus_USB_Success;
|
||||
}
|
||||
|
||||
#ifdef SOC_IMXRT1170_SERIES
|
||||
static usb_status_t USB_HostEhciControlBus(usb_host_ehci_instance_t *ehciInstance, uint8_t busControl)
|
||||
#else
|
||||
usb_status_t USB_HostEhciControlBus(usb_host_ehci_instance_t *ehciInstance, uint8_t busControl)
|
||||
#endif
|
||||
{
|
||||
usb_status_t status = kStatus_USB_Success;
|
||||
uint32_t portScRegister;
|
||||
@@ -3525,7 +3601,9 @@ usb_status_t USB_HostEhciControlBus(usb_host_ehci_instance_t *ehciInstance, uint
|
||||
ehciInstance->ehciIpBase->PORTSC1 &= ~USBHS_PORTSC1_WKCN_MASK;
|
||||
ehciInstance->ehciIpBase->PORTSC1 |= USBHS_PORTSC1_WKDS_MASK;
|
||||
ehciInstance->ehciIpBase->PORTSC1 |= (USBHS_PORTSC1_SUSP_MASK); /* Suspend the device */
|
||||
|
||||
#if (defined(FSL_FEATURE_USB_ATLANTIC_EHCI_SUPPORT) && (FSL_FEATURE_USB_ATLANTIC_EHCI_SUPPORT > 0U))
|
||||
PMU->WAKEUP_PM2_MASK1 |= PMU_WAKEUP_PM2_MASK1_USB(1);
|
||||
#endif
|
||||
ehciInstance->matchTick = 0U;
|
||||
ehciInstance->ehciIpBase->USBINTR |= (USBHS_USBINTR_TIE1_MASK);
|
||||
ehciInstance->busSuspendStatus = kBus_EhciStartSuspend;
|
||||
@@ -3543,8 +3621,11 @@ usb_status_t USB_HostEhciControlBus(usb_host_ehci_instance_t *ehciInstance, uint
|
||||
ehciInstance->busSuspendStatus = kBus_EhciStartResume;
|
||||
#if (defined(FSL_FEATURE_SOC_USBNC_COUNT) && (FSL_FEATURE_SOC_USBNC_COUNT > 0U))
|
||||
ehciInstance->registerNcBase->USB_OTGn_CTRL &= ~USBNC_USB_OTGn_CTRL_WIE_MASK;
|
||||
#else
|
||||
#if (defined(FSL_FEATURE_USB_ATLANTIC_EHCI_SUPPORT) && (FSL_FEATURE_USB_ATLANTIC_EHCI_SUPPORT > 0U))
|
||||
#else
|
||||
ehciInstance->ehciIpBase->USBGENCTRL &= ~USBHS_USBGENCTRL_WU_IE_MASK;
|
||||
#endif
|
||||
#endif
|
||||
ehciInstance->ehciIpBase->USBCMD |= (USBHS_USBCMD_RS_MASK);
|
||||
ehciInstance->ehciIpBase->PORTSC1 |= (USBHS_PORTSC1_FPR_MASK); /* Resume the device */
|
||||
@@ -3583,7 +3664,11 @@ void USB_HostEhciTransactionDone(usb_host_ehci_instance_t *ehciInstance)
|
||||
((defined USB_HOST_CONFIG_EHCI_MAX_SITD) && (USB_HOST_CONFIG_EHCI_MAX_SITD)))
|
||||
usb_host_ehci_iso_t *isoPointer;
|
||||
uint32_t dataLength;
|
||||
#ifdef SOC_IMXRT1170_SERIES
|
||||
uint32_t speed = 0U;
|
||||
#else
|
||||
uint32_t speed;
|
||||
#endif
|
||||
#endif
|
||||
void *temp;
|
||||
uint32_t transferResults;
|
||||
@@ -3693,12 +3778,30 @@ void USB_HostEhciTransactionDone(usb_host_ehci_instance_t *ehciInstance)
|
||||
else
|
||||
{
|
||||
/* remove qtd from qh */
|
||||
#ifdef SOC_IMXRT1170_SERIES
|
||||
do
|
||||
{
|
||||
if (vltQtdPointer == NULL)
|
||||
{
|
||||
break;
|
||||
}
|
||||
else if (0U != (vltQtdPointer->transferResults[0] & EHCI_HOST_QTD_IOC_MASK))
|
||||
{
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* no action */
|
||||
}
|
||||
vltQtdPointer = (volatile usb_host_ehci_qtd_t *)vltQtdPointer->nextQtdPointer;
|
||||
} while (true);
|
||||
#else
|
||||
while ((vltQtdPointer != NULL) &&
|
||||
(0U == (transferResults & EHCI_HOST_QTD_IOC_MASK))) /* find the IOC qtd */
|
||||
{
|
||||
vltQtdPointer = (volatile usb_host_ehci_qtd_t *)vltQtdPointer->nextQtdPointer;
|
||||
}
|
||||
|
||||
#endif
|
||||
vltQhPointer->nextQtdPointer = EHCI_HOST_T_INVALID_VALUE;
|
||||
vltQhPointer->currentQtdPointer = EHCI_HOST_T_INVALID_VALUE;
|
||||
vltQhPointer->transferOverlayResults[0] &=
|
||||
@@ -3823,7 +3926,11 @@ void USB_HostEhciTransactionDone(usb_host_ehci_instance_t *ehciInstance)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef SOC_IMXRT1170_SERIES
|
||||
static void USB_HostEhciPortChange(usb_host_ehci_instance_t *ehciInstance)
|
||||
#else
|
||||
void USB_HostEhciPortChange(usb_host_ehci_instance_t *ehciInstance)
|
||||
#endif
|
||||
{
|
||||
/* note: only has one port */
|
||||
uint32_t portScRegister = ehciInstance->ehciIpBase->PORTSC1;
|
||||
@@ -3915,7 +4022,13 @@ void USB_HostEhciPortChange(usb_host_ehci_instance_t *ehciInstance)
|
||||
ehciInstance->ehciIpBase->USBINTR &= ~(USBHS_USBINTR_TIE1_MASK);
|
||||
#endif
|
||||
/* disable ehci phy disconnection */
|
||||
#ifdef SOC_IMXRT1170_SERIES
|
||||
#if ((defined FSL_FEATURE_SOC_USBPHY_COUNT) && (FSL_FEATURE_SOC_USBPHY_COUNT > 0U))
|
||||
USB_EhcihostPhyDisconnectDetectCmd(ehciInstance->controllerId, 0);
|
||||
#endif
|
||||
#else
|
||||
USB_EhcihostPhyDisconnectDetectCmd(ehciInstance->controllerId, 0);
|
||||
#endif
|
||||
/* disable async and periodic */
|
||||
USB_HostEhciStopAsync(ehciInstance);
|
||||
USB_HostEhciStopPeriodic(ehciInstance);
|
||||
@@ -3924,7 +4037,11 @@ void USB_HostEhciPortChange(usb_host_ehci_instance_t *ehciInstance)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef SOC_IMXRT1170_SERIES
|
||||
static void USB_HostEhciTimer0(usb_host_ehci_instance_t *ehciInstance)
|
||||
#else
|
||||
void USB_HostEhciTimer0(usb_host_ehci_instance_t *ehciInstance)
|
||||
#endif
|
||||
{
|
||||
volatile usb_host_ehci_qh_t *vltQhPointer;
|
||||
usb_host_ehci_qtd_t *vltQtdPointer;
|
||||
@@ -4070,25 +4187,55 @@ static void USB_HostEhciTimer1(usb_host_ehci_instance_t *ehciInstance)
|
||||
| USBPHY_CTRL_ENIRQRESUMEDETECT_MASK
|
||||
;
|
||||
#endif
|
||||
#endif
|
||||
#ifdef SOC_IMXRT1170_SERIES
|
||||
#if (defined(FSL_FEATURE_USBPHY_28FDSOI) && (FSL_FEATURE_USBPHY_28FDSOI > 0U))
|
||||
ehciInstance->registerPhyBase->USB1_VBUS_DETECT_SET |=
|
||||
USBPHY_USB1_VBUS_DETECT_VBUSVALID_TO_SESSVALID_MASK;
|
||||
#endif
|
||||
#endif
|
||||
ehciInstance->ehciIpBase->PORTSC1 |= USBHS_PORTSC1_PHCD_MASK;
|
||||
|
||||
#ifdef SOC_IMXRT1170_SERIES
|
||||
#if ((defined FSL_FEATURE_SOC_USBPHY_COUNT) && (FSL_FEATURE_SOC_USBPHY_COUNT > 0U))
|
||||
ehciInstance->registerPhyBase->PWD = 0xFFFFFFFFU;
|
||||
|
||||
while (0U != (ehciInstance->registerPhyBase->CTRL & (USBPHY_CTRL_UTMI_SUSPENDM_MASK)))
|
||||
{
|
||||
__NOP();
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
ehciInstance->registerPhyBase->PWD = 0xFFFFFFFFU;
|
||||
|
||||
while (0U != (ehciInstance->registerPhyBase->CTRL & (USBPHY_CTRL_UTMI_SUSPENDM_MASK)))
|
||||
{
|
||||
__NOP();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (defined(FSL_FEATURE_SOC_USBNC_COUNT) && (FSL_FEATURE_SOC_USBNC_COUNT > 0U))
|
||||
ehciInstance->registerNcBase->USB_OTGn_CTRL |= USBNC_USB_OTGn_CTRL_WKUP_ID_EN_MASK |
|
||||
USBNC_USB_OTGn_CTRL_WKUP_VBUS_EN_MASK |
|
||||
USBNC_USB_OTGn_CTRL_WKUP_DPDM_EN_MASK;
|
||||
ehciInstance->registerNcBase->USB_OTGn_CTRL |= USBNC_USB_OTGn_CTRL_WIE_MASK;
|
||||
#else
|
||||
#ifdef SOC_IMXRT1170_SERIES
|
||||
#if (defined(FSL_FEATURE_USB_ATLANTIC_EHCI_SUPPORT) && (FSL_FEATURE_USB_ATLANTIC_EHCI_SUPPORT > 0U))
|
||||
#else
|
||||
ehciInstance->ehciIpBase->USBGENCTRL = USBHS_USBGENCTRL_WU_IE_MASK;
|
||||
#endif
|
||||
#else
|
||||
ehciInstance->ehciIpBase->USBGENCTRL = USBHS_USBGENCTRL_WU_IE_MASK;
|
||||
#endif
|
||||
#endif
|
||||
#ifdef
|
||||
#if ((defined FSL_FEATURE_SOC_USBPHY_COUNT) && (FSL_FEATURE_SOC_USBPHY_COUNT > 0U))
|
||||
ehciInstance->registerPhyBase->CTRL |= USBPHY_CTRL_CLKGATE_MASK;
|
||||
#endif
|
||||
#else
|
||||
ehciInstance->registerPhyBase->CTRL |= USBPHY_CTRL_CLKGATE_MASK;
|
||||
#endif
|
||||
(void)hostPointer->deviceCallback(hostPointer->suspendedDevice, NULL,
|
||||
kUSB_HostEventSuspended); /* call host callback function */
|
||||
ehciInstance->busSuspendStatus = kBus_EhciSuspended;
|
||||
@@ -4159,8 +4306,14 @@ usb_status_t USB_HostEhciCreate(uint8_t controllerId,
|
||||
ehciInstance->busSuspendStatus = kBus_EhciIdle;
|
||||
|
||||
#if (defined(USB_HOST_CONFIG_LOW_POWER_MODE) && (USB_HOST_CONFIG_LOW_POWER_MODE > 0U))
|
||||
#ifdef SOC_IMXRT1170_SERIES
|
||||
#if ((defined FSL_FEATURE_SOC_USBPHY_COUNT) && (FSL_FEATURE_SOC_USBPHY_COUNT > 0U))
|
||||
ehciInstance->registerPhyBase = (USBPHY_Type *)USB_EhciPhyGetBase(controllerId);
|
||||
|
||||
#endif
|
||||
#else
|
||||
ehciInstance->registerPhyBase = (USBPHY_Type *)USB_EhciPhyGetBase(controllerId);
|
||||
#endif
|
||||
|
||||
#if (defined(FSL_FEATURE_SOC_USBNC_COUNT) && (FSL_FEATURE_SOC_USBNC_COUNT > 0U))
|
||||
ehciInstance->registerNcBase = (USBNC_Type *)USB_EhciNCGetBase(controllerId);
|
||||
#endif
|
||||
@@ -4386,7 +4539,9 @@ usb_status_t USB_HostEhciOpenPipe(usb_host_controller_handle controllerHandle,
|
||||
usb_status_t status;
|
||||
uint32_t speed = 0;
|
||||
usb_host_ehci_instance_t *ehciInstance = (usb_host_ehci_instance_t *)controllerHandle;
|
||||
#if !defined(SOC_IMXRT1170_SERIES)
|
||||
uint32_t val32;
|
||||
#endif
|
||||
void *temp;
|
||||
/* get one pipe */
|
||||
USB_HostEhciLock();
|
||||
@@ -4444,6 +4599,7 @@ usb_status_t USB_HostEhciOpenPipe(usb_host_controller_handle controllerHandle,
|
||||
(uint8_t)ehciPipePointer->pipeCommon.interval); /* FS/LS interrupt interval should be the power of
|
||||
2, it is used for ehci bandwidth */
|
||||
}
|
||||
#if !defined(SOC_IMXRT1170_SERIES)
|
||||
}
|
||||
|
||||
if ((speed == USB_SPEED_HIGH) && (ehciPipePointer->pipeCommon.interval < 8U))
|
||||
@@ -4452,6 +4608,7 @@ usb_status_t USB_HostEhciOpenPipe(usb_host_controller_handle controllerHandle,
|
||||
val32 &= (~USBHS_USBCMD_ITC_MASK);
|
||||
val32 |= USBHS_USBCMD_ITC((ehciPipePointer->pipeCommon.interval));
|
||||
ehciInstance->ehciIpBase->USBCMD = val32;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4824,6 +4981,8 @@ void USB_HostEhciIsrFunction(void *hostHandle)
|
||||
{
|
||||
/*no action*/
|
||||
}
|
||||
#else
|
||||
#if (defined(FSL_FEATURE_USB_ATLANTIC_EHCI_SUPPORT) && (FSL_FEATURE_USB_ATLANTIC_EHCI_SUPPORT > 0U))
|
||||
#else
|
||||
if (0U != (ehciInstance->ehciIpBase->USBGENCTRL & USBHS_USBGENCTRL_WU_IE_MASK))
|
||||
{
|
||||
@@ -4857,8 +5016,8 @@ void USB_HostEhciIsrFunction(void *hostHandle)
|
||||
{
|
||||
/*no action*/
|
||||
}
|
||||
#endif /* FSL_FEATURE_USB_ATLANTIC_EHCI_SUPPORT */
|
||||
#endif /* FSL_FEATURE_SOC_USBNC_COUNT */
|
||||
|
||||
#endif /* USB_HOST_CONFIG_LOW_POWER_MODE */
|
||||
|
||||
interruptStatus = ehciInstance->ehciIpBase->USBSTS;
|
||||
@@ -4905,6 +5064,27 @@ void USB_HostEhciIsrFunction(void *hostHandle)
|
||||
/*no action */
|
||||
}
|
||||
}
|
||||
#if (defined(FSL_FEATURE_USB_ATLANTIC_EHCI_SUPPORT) && (FSL_FEATURE_USB_ATLANTIC_EHCI_SUPPORT > 0U))
|
||||
if ((kBus_EhciSuspended == ehciInstance->busSuspendStatus))
|
||||
{
|
||||
usb_host_instance_t *hostPointer = (usb_host_instance_t *)ehciInstance->hostHandle;
|
||||
|
||||
(void)hostPointer->deviceCallback(hostPointer->suspendedDevice, NULL,
|
||||
kUSB_HostEventDetectResume); /* call host callback function */
|
||||
|
||||
uint32_t delay = 100000;
|
||||
while (delay-- && !(USBOTG->PLL_CONTROL_0 & USBC_PLL_CONTROL_0_PLL_READY_MASK))
|
||||
{
|
||||
}
|
||||
if (0U != (ehciInstance->ehciIpBase->PORTSC1 & USBHS_PORTSC1_CCS_MASK))
|
||||
{
|
||||
USB_HostEhciStartAsync(ehciInstance);
|
||||
USB_HostEhciStartPeriodic(ehciInstance);
|
||||
}
|
||||
ehciInstance->ehciIpBase->USBCMD |= (USBHS_USBCMD_RS_MASK);
|
||||
ehciInstance->busSuspendStatus = kBus_EhciStartResume;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
(void)OSA_EventSet(ehciInstance->taskEventHandle, EHCI_TASK_EVENT_PORT_CHANGE);
|
||||
}
|
||||
|
||||
@@ -309,7 +309,13 @@ typedef struct _usb_host_ehci_instance
|
||||
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;
|
||||
#ifdef SOC_IMXRT1170_SERIES
|
||||
#if ((defined FSL_FEATURE_SOC_USBPHY_COUNT) && (FSL_FEATURE_SOC_USBPHY_COUNT > 0U))
|
||||
USBPHY_Type *registerPhyBase; /*!< The base address of the PHY register */
|
||||
#endif
|
||||
#else
|
||||
USBPHY_Type *registerPhyBase; /*!< The base address of the PHY register */
|
||||
#endif
|
||||
#if (defined(FSL_FEATURE_SOC_USBNC_COUNT) && (FSL_FEATURE_SOC_USBNC_COUNT > 0U))
|
||||
USBNC_Type *registerNcBase; /*!< The base address of the USBNC register */
|
||||
#endif
|
||||
@@ -473,6 +479,7 @@ extern usb_status_t USB_HostEhciIoctl(usb_host_controller_handle controllerHandl
|
||||
uint32_t ioctlEvent,
|
||||
void *ioctlParam);
|
||||
|
||||
#if !defined(SOC_IMXRT1170_SERIES)
|
||||
/*!
|
||||
* @brief control ehci bus.
|
||||
*
|
||||
@@ -511,7 +518,7 @@ extern void USB_HostEhciStartAsync(usb_host_ehci_instance_t *ehciInstance);
|
||||
* @param ehciInstance ehci instance pointer.
|
||||
*/
|
||||
extern void USB_HostEhciStartPeriodic(usb_host_ehci_instance_t *ehciInstance);
|
||||
|
||||
#endif
|
||||
/*! @}*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -171,7 +171,7 @@ static usb_host_instance_t *USB_HostGetInstance(void)
|
||||
void *temp;
|
||||
OSA_SR_ALLOC();
|
||||
OSA_ENTER_CRITICAL();
|
||||
for (; i < USB_HOST_CONFIG_MAX_HOST; i++)
|
||||
for (; i < (uint8_t)USB_HOST_CONFIG_MAX_HOST; i++)
|
||||
{
|
||||
if (g_UsbHostInstance[i].occupied != 1U)
|
||||
{
|
||||
@@ -182,7 +182,7 @@ static usb_host_instance_t *USB_HostGetInstance(void)
|
||||
}
|
||||
g_UsbHostInstance[i].occupied = 1;
|
||||
OSA_EXIT_CRITICAL();
|
||||
for (index = 0; index < USB_HOST_CONFIG_MAX_TRANSFERS; ++index)
|
||||
for (index = 0; index < (uint32_t)USB_HOST_CONFIG_MAX_TRANSFERS; ++index)
|
||||
{
|
||||
temp = (void *)&(s_Setupbuffer[i][index][0]);
|
||||
g_UsbHostInstance[i].transferList[index].setupPacket = (usb_setup_struct_t *)temp;
|
||||
@@ -266,6 +266,7 @@ usb_status_t USB_HostInit(uint8_t controllerId, usb_host_handle *hostHandle, hos
|
||||
{
|
||||
return kStatus_USB_Error;
|
||||
}
|
||||
|
||||
|
||||
/* HOST instance init*/
|
||||
hostInstance->controllerId = controllerId;
|
||||
@@ -290,7 +291,7 @@ usb_status_t USB_HostInit(uint8_t controllerId, usb_host_handle *hostHandle, hos
|
||||
transferPrev->next = &hostInstance->transferList[i];
|
||||
transferPrev = transferPrev->next;
|
||||
}
|
||||
|
||||
|
||||
/* controller create, the callbackFn is initialized in USB_HostGetControllerInterface */
|
||||
status =
|
||||
hostInstance->controllerTable->controllerCreate(controllerId, hostInstance, &(hostInstance->controllerHandle));
|
||||
@@ -698,14 +699,19 @@ usb_status_t USB_HostHelperParseAlternateSetting(usb_host_interface_handle inter
|
||||
}
|
||||
|
||||
/* parse configuration descriptor */
|
||||
#ifdef SOC_IMXRT1170_SERIES
|
||||
temp = (void *)((usb_host_interface_t *)interfaceHandle)->interfaceExtension;
|
||||
#else
|
||||
temp = (void *)((usb_host_interface_t *)interfaceHandle)->interfaceDesc;
|
||||
;
|
||||
#endif
|
||||
unionDes = (usb_descriptor_union_t *)temp; /* interface extend descriptor start */
|
||||
endPosition =
|
||||
(uint32_t)unionDes +
|
||||
((usb_host_interface_t *)interfaceHandle)->interfaceExtensionLength; /* interface extend descriptor end */
|
||||
#if !defined(SOC_IMXRT1170_SERIES)
|
||||
unionDes = (usb_descriptor_union_t *)((uint32_t)unionDes + unionDes->common.bLength);
|
||||
|
||||
#endif
|
||||
|
||||
/* search for the alternate setting interface descriptor */
|
||||
while ((uint32_t)unionDes < endPosition)
|
||||
{
|
||||
|
||||
@@ -56,6 +56,12 @@
|
||||
/*! @brief USB stack version definition */
|
||||
#define USB_MAKE_VERSION(major, minor, bugfix) (((major) << 16) | ((minor) << 8) | (bugfix))
|
||||
|
||||
#ifdef SOC_IMXRT1170_SERIES
|
||||
/*! @brief USB stack component version definition, changed with component in yaml together */
|
||||
#define USB_STACK_COMPONENT_VERSION \
|
||||
MAKE_VERSION(USB_STACK_VERSION_MAJOR, USB_STACK_VERSION_MINOR, USB_STACK_VERSION_BUGFIX)
|
||||
#endif
|
||||
|
||||
/*! @brief USB error code */
|
||||
typedef enum _usb_status
|
||||
{
|
||||
@@ -80,6 +86,11 @@ typedef enum _usb_status
|
||||
kStatus_USB_MSDStatusFail, /*!< For MSD, the CSW status means fail */
|
||||
kStatus_USB_EHCIAttached,
|
||||
kStatus_USB_EHCIDetached,
|
||||
#ifdef SOC_IMXRT1170_SERIES
|
||||
kStatus_USB_DataOverRun, /*!< The amount of data returned by the endpoint exceeded
|
||||
either the size of the maximum data packet allowed
|
||||
from the endpoint or the remaining buffer size. */
|
||||
#endif
|
||||
} usb_status_t;
|
||||
|
||||
/*! @brief USB host handle type define */
|
||||
@@ -120,6 +131,11 @@ typedef enum _usb_controller_index
|
||||
kUSB_ControllerIp3516Hs1 =
|
||||
11U, /*!< IP3516HS 1U, Currently, there are no platforms which have two IP3516HS IPs, this is reserved
|
||||
to be used in the future. */
|
||||
#ifdef SOC_IMXRT1170_SERIES
|
||||
kUSB_ControllerDwc30 = 12U, /*!< DWC3 0U */
|
||||
kUSB_ControllerDwc31 = 13U, /*!< DWC3 1U Currently, there are no platforms which have two Dwc IPs, this is reserved
|
||||
to be used in the future.*/
|
||||
#endif
|
||||
} usb_controller_index_t;
|
||||
|
||||
/**
|
||||
|
||||
@@ -22,8 +22,11 @@
|
||||
* - if 0, host ehci driver is disable.
|
||||
* - if greater than 0, host ehci driver is enable.
|
||||
*/
|
||||
#ifdef SOC_IMXRT1170_SERIES
|
||||
#define USB_HOST_CONFIG_EHCI (1U)
|
||||
#else
|
||||
#define USB_HOST_CONFIG_EHCI (2U)
|
||||
|
||||
#endif
|
||||
/*!
|
||||
* @brief host ohci instance count, meantime it indicates ohci enable or disable.
|
||||
* - if 0, host ohci driver is disable.
|
||||
@@ -100,8 +103,13 @@
|
||||
#define USB_HOST_CONFIG_BUFFER_PROPERTY_CACHEABLE (0U)
|
||||
#endif
|
||||
/*! @brief if 1, enable usb compliance test codes; if 0, disable usb compliance test codes. */
|
||||
#ifdef SOC_IMXRT1170_SERIES
|
||||
#ifndef USB_HOST_CONFIG_COMPLIANCE_TEST
|
||||
#define USB_HOST_CONFIG_COMPLIANCE_TEST (0U)
|
||||
|
||||
#endif
|
||||
#else
|
||||
#define USB_HOST_CONFIG_COMPLIANCE_TEST (0U)
|
||||
#endif
|
||||
/*! @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)
|
||||
|
||||
@@ -148,7 +156,17 @@
|
||||
|
||||
/* OHCI configuration */
|
||||
#if ((defined USB_HOST_CONFIG_OHCI) && (USB_HOST_CONFIG_OHCI))
|
||||
#ifdef SOC_IMXRT1170_SERIES
|
||||
/*!
|
||||
* @brief ohci ED max count.
|
||||
*/
|
||||
#define USB_HOST_CONFIG_OHCI_MAX_ED (16U)
|
||||
|
||||
/*!
|
||||
* @brief ohci GTD max count.
|
||||
*/
|
||||
#define USB_HOST_CONFIG_OHCI_MAX_GTD (16U)
|
||||
#else
|
||||
/*!
|
||||
* @brief ohci ED max count.
|
||||
*/
|
||||
@@ -158,7 +176,8 @@
|
||||
* @brief ohci GTD max count.
|
||||
*/
|
||||
#define USB_HOST_CONFIG_OHCI_MAX_GTD (8U)
|
||||
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* @brief ohci ITD max count.
|
||||
*/
|
||||
@@ -243,5 +262,4 @@
|
||||
* - if greater than 0, host charger detect is enable.
|
||||
*/
|
||||
#define USB_HOST_CONFIG_BATTERY_CHARGER (0U)
|
||||
|
||||
#endif /* _USB_HOST_CONFIG_H_ */
|
||||
|
||||
@@ -33,6 +33,273 @@
|
||||
|
||||
#include <usb/phy/usb_phy.h>
|
||||
|
||||
#ifdef SOC_IMXRT1170_SERIES
|
||||
void *USB_EhciPhyGetBase(uint8_t controllerId)
|
||||
{
|
||||
void *usbPhyBase = NULL;
|
||||
#if ((defined FSL_FEATURE_SOC_USBPHY_COUNT) && (FSL_FEATURE_SOC_USBPHY_COUNT > 0U))
|
||||
uint32_t instance;
|
||||
uint32_t newinstance = 0;
|
||||
uint32_t usbphy_base_temp[] = USBPHY_BASE_ADDRS;
|
||||
uint32_t usbphy_base[] = USBPHY_BASE_ADDRS;
|
||||
uint32_t *temp;
|
||||
if (controllerId < (uint8_t)kUSB_ControllerEhci0)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((controllerId == (uint8_t)kUSB_ControllerEhci0) || (controllerId == (uint8_t)kUSB_ControllerEhci1))
|
||||
{
|
||||
controllerId = controllerId - (uint8_t)kUSB_ControllerEhci0;
|
||||
}
|
||||
else if ((controllerId == (uint8_t)kUSB_ControllerLpcIp3511Hs0) ||
|
||||
(controllerId == (uint8_t)kUSB_ControllerLpcIp3511Hs1))
|
||||
{
|
||||
controllerId = controllerId - (uint8_t)kUSB_ControllerLpcIp3511Hs0;
|
||||
}
|
||||
else if ((controllerId == (uint8_t)kUSB_ControllerIp3516Hs0) || (controllerId == (uint8_t)kUSB_ControllerIp3516Hs1))
|
||||
{
|
||||
controllerId = controllerId - (uint8_t)kUSB_ControllerIp3516Hs0;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*no action*/
|
||||
}
|
||||
|
||||
for (instance = 0; instance < (sizeof(usbphy_base_temp) / sizeof(usbphy_base_temp[0])); instance++)
|
||||
{
|
||||
if (0U != usbphy_base_temp[instance])
|
||||
{
|
||||
usbphy_base[newinstance++] = usbphy_base_temp[instance];
|
||||
}
|
||||
}
|
||||
if (controllerId > newinstance)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
temp = (uint32_t *)usbphy_base[controllerId];
|
||||
usbPhyBase = (void *)temp;
|
||||
#endif
|
||||
return usbPhyBase;
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief ehci phy initialization.
|
||||
*
|
||||
* This function initialize ehci phy IP.
|
||||
*
|
||||
* @param[in] controllerId ehci controller id, please reference to #usb_controller_index_t.
|
||||
* @param[in] freq the external input clock.
|
||||
* for example: if the external input clock is 16M, the parameter freq should be 16000000.
|
||||
*
|
||||
* @retval kStatus_USB_Success cancel successfully.
|
||||
* @retval kStatus_USB_Error the freq value is incorrect.
|
||||
*/
|
||||
uint32_t USB_EhciPhyInit(uint8_t controllerId, uint32_t freq, usb_phy_config_struct_t *phyConfig)
|
||||
{
|
||||
#if ((defined FSL_FEATURE_SOC_USBPHY_COUNT) && (FSL_FEATURE_SOC_USBPHY_COUNT > 0U))
|
||||
USBPHY_Type *usbPhyBase;
|
||||
|
||||
usbPhyBase = (USBPHY_Type *)USB_EhciPhyGetBase(controllerId);
|
||||
if (NULL == usbPhyBase)
|
||||
{
|
||||
return (uint8_t)kStatus_USB_Error;
|
||||
}
|
||||
|
||||
#if ((defined FSL_FEATURE_SOC_ANATOP_COUNT) && (FSL_FEATURE_SOC_ANATOP_COUNT > 0U))
|
||||
ANATOP->HW_ANADIG_REG_3P0.RW =
|
||||
(ANATOP->HW_ANADIG_REG_3P0.RW &
|
||||
(~(ANATOP_HW_ANADIG_REG_3P0_OUTPUT_TRG(0x1F) | ANATOP_HW_ANADIG_REG_3P0_ENABLE_ILIMIT_MASK))) |
|
||||
ANATOP_HW_ANADIG_REG_3P0_OUTPUT_TRG(0x17) | ANATOP_HW_ANADIG_REG_3P0_ENABLE_LINREG_MASK;
|
||||
ANATOP->HW_ANADIG_USB2_CHRG_DETECT.SET =
|
||||
ANATOP_HW_ANADIG_USB2_CHRG_DETECT_CHK_CHRG_B_MASK | ANATOP_HW_ANADIG_USB2_CHRG_DETECT_EN_B_MASK;
|
||||
#endif
|
||||
|
||||
#if (defined USB_ANALOG)
|
||||
USB_ANALOG->INSTANCE[controllerId - (uint8_t)kUSB_ControllerEhci0].CHRG_DETECT_SET =
|
||||
USB_ANALOG_CHRG_DETECT_CHK_CHRG_B(1) | USB_ANALOG_CHRG_DETECT_EN_B(1);
|
||||
#endif
|
||||
|
||||
#if ((!(defined FSL_FEATURE_SOC_CCM_ANALOG_COUNT)) && (!(defined FSL_FEATURE_SOC_ANATOP_COUNT)))
|
||||
|
||||
usbPhyBase->TRIM_OVERRIDE_EN = 0x001fU; /* override IFR value */
|
||||
#endif
|
||||
usbPhyBase->CTRL |= USBPHY_CTRL_SET_ENUTMILEVEL2_MASK; /* support LS device. */
|
||||
usbPhyBase->CTRL |= USBPHY_CTRL_SET_ENUTMILEVEL3_MASK; /* support external FS Hub with LS device connected. */
|
||||
/* PWD register provides overall control of the PHY power state */
|
||||
usbPhyBase->PWD = 0U;
|
||||
if (((uint8_t)kUSB_ControllerIp3516Hs0 == controllerId) || ((uint8_t)kUSB_ControllerIp3516Hs1 == controllerId) ||
|
||||
((uint8_t)kUSB_ControllerLpcIp3511Hs0 == controllerId) ||
|
||||
((uint8_t)kUSB_ControllerLpcIp3511Hs1 == controllerId))
|
||||
{
|
||||
usbPhyBase->CTRL_SET = USBPHY_CTRL_SET_ENAUTOCLR_CLKGATE_MASK;
|
||||
usbPhyBase->CTRL_SET = USBPHY_CTRL_SET_ENAUTOCLR_PHY_PWD_MASK;
|
||||
}
|
||||
if (NULL != phyConfig)
|
||||
{
|
||||
/* Decode to trim the nominal 17.78mA current source for the High Speed TX drivers on USB_DP and USB_DM. */
|
||||
usbPhyBase->TX =
|
||||
((usbPhyBase->TX & (~(USBPHY_TX_D_CAL_MASK | USBPHY_TX_TXCAL45DM_MASK | USBPHY_TX_TXCAL45DP_MASK))) |
|
||||
(USBPHY_TX_D_CAL(phyConfig->D_CAL) | USBPHY_TX_TXCAL45DP(phyConfig->TXCAL45DP) |
|
||||
USBPHY_TX_TXCAL45DM(phyConfig->TXCAL45DM)));
|
||||
}
|
||||
#endif
|
||||
|
||||
return (uint8_t)kStatus_USB_Success;
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief ehci phy initialization for suspend and resume.
|
||||
*
|
||||
* This function initialize ehci phy IP for suspend and resume.
|
||||
*
|
||||
* @param[in] controllerId ehci controller id, please reference to #usb_controller_index_t.
|
||||
* @param[in] freq the external input clock.
|
||||
* for example: if the external input clock is 16M, the parameter freq should be 16000000.
|
||||
*
|
||||
* @retval kStatus_USB_Success cancel successfully.
|
||||
* @retval kStatus_USB_Error the freq value is incorrect.
|
||||
*/
|
||||
uint32_t USB_EhciLowPowerPhyInit(uint8_t controllerId, uint32_t freq, usb_phy_config_struct_t *phyConfig)
|
||||
{
|
||||
#if ((defined FSL_FEATURE_SOC_USBPHY_COUNT) && (FSL_FEATURE_SOC_USBPHY_COUNT > 0U))
|
||||
USBPHY_Type *usbPhyBase;
|
||||
|
||||
usbPhyBase = (USBPHY_Type *)USB_EhciPhyGetBase(controllerId);
|
||||
if (NULL == usbPhyBase)
|
||||
{
|
||||
return (uint8_t)kStatus_USB_Error;
|
||||
}
|
||||
|
||||
#if ((!(defined FSL_FEATURE_SOC_CCM_ANALOG_COUNT)) && (!(defined FSL_FEATURE_SOC_ANATOP_COUNT)))
|
||||
usbPhyBase->TRIM_OVERRIDE_EN = 0x001fU; /* override IFR value */
|
||||
#endif
|
||||
|
||||
#if ((defined USBPHY_CTRL_AUTORESUME_EN_MASK) && (USBPHY_CTRL_AUTORESUME_EN_MASK > 0U))
|
||||
usbPhyBase->CTRL_CLR |= USBPHY_CTRL_AUTORESUME_EN_MASK;
|
||||
#else
|
||||
usbPhyBase->CTRL |= USBPHY_CTRL_ENAUTO_PWRON_PLL_MASK;
|
||||
#endif
|
||||
usbPhyBase->CTRL |= USBPHY_CTRL_ENAUTOCLR_CLKGATE_MASK | USBPHY_CTRL_ENAUTOCLR_PHY_PWD_MASK;
|
||||
usbPhyBase->CTRL |= USBPHY_CTRL_SET_ENUTMILEVEL2_MASK; /* support LS device. */
|
||||
usbPhyBase->CTRL |= USBPHY_CTRL_SET_ENUTMILEVEL3_MASK; /* support external FS Hub with LS device connected. */
|
||||
/* PWD register provides overall control of the PHY power state */
|
||||
usbPhyBase->PWD = 0U;
|
||||
#if (defined USBPHY_ANACTRL_PFD_CLKGATE_MASK)
|
||||
/* now the 480MHz USB clock is up, then configure fractional divider after PLL with PFD
|
||||
* pfd clock = 480MHz*18/N, where N=18~35
|
||||
* Please note that USB1PFDCLK has to be less than 180MHz for RUN or HSRUN mode
|
||||
*/
|
||||
usbPhyBase->ANACTRL |= USBPHY_ANACTRL_PFD_FRAC(24); /* N=24 */
|
||||
usbPhyBase->ANACTRL |= USBPHY_ANACTRL_PFD_CLK_SEL(1); /* div by 4 */
|
||||
|
||||
usbPhyBase->ANACTRL &= ~USBPHY_ANACTRL_DEV_PULLDOWN_MASK;
|
||||
usbPhyBase->ANACTRL &= ~USBPHY_ANACTRL_PFD_CLKGATE_MASK;
|
||||
while (0U == (usbPhyBase->ANACTRL & USBPHY_ANACTRL_PFD_STABLE_MASK))
|
||||
{
|
||||
}
|
||||
#endif
|
||||
if (NULL != phyConfig)
|
||||
{
|
||||
/* Decode to trim the nominal 17.78mA current source for the High Speed TX drivers on USB_DP and USB_DM. */
|
||||
usbPhyBase->TX =
|
||||
((usbPhyBase->TX & (~(USBPHY_TX_D_CAL_MASK | USBPHY_TX_TXCAL45DM_MASK | USBPHY_TX_TXCAL45DP_MASK))) |
|
||||
(USBPHY_TX_D_CAL(phyConfig->D_CAL) | USBPHY_TX_TXCAL45DP(phyConfig->TXCAL45DP) |
|
||||
USBPHY_TX_TXCAL45DM(phyConfig->TXCAL45DM)));
|
||||
}
|
||||
#endif
|
||||
|
||||
return (uint8_t)kStatus_USB_Success;
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief ehci phy de-initialization.
|
||||
*
|
||||
* This function de-initialize ehci phy IP.
|
||||
*
|
||||
* @param[in] controllerId ehci controller id, please reference to #usb_controller_index_t.
|
||||
*/
|
||||
void USB_EhciPhyDeinit(uint8_t controllerId)
|
||||
{
|
||||
#if ((defined FSL_FEATURE_SOC_USBPHY_COUNT) && (FSL_FEATURE_SOC_USBPHY_COUNT > 0U))
|
||||
USBPHY_Type *usbPhyBase;
|
||||
|
||||
usbPhyBase = (USBPHY_Type *)USB_EhciPhyGetBase(controllerId);
|
||||
if (NULL == usbPhyBase)
|
||||
{
|
||||
return;
|
||||
}
|
||||
#if ((!(defined FSL_FEATURE_SOC_CCM_ANALOG_COUNT)) && (!(defined FSL_FEATURE_SOC_ANATOP_COUNT)))
|
||||
usbPhyBase->PLL_SIC &= ~USBPHY_PLL_SIC_PLL_POWER_MASK; /* power down PLL */
|
||||
usbPhyBase->PLL_SIC &= ~USBPHY_PLL_SIC_PLL_EN_USB_CLKS_MASK; /* disable USB clock output from USB PHY PLL */
|
||||
#endif
|
||||
usbPhyBase->CTRL |= USBPHY_CTRL_CLKGATE_MASK; /* set to 1U to gate clocks */
|
||||
#endif
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief ehci phy disconnect detection enable or disable.
|
||||
*
|
||||
* This function enable/disable host ehci disconnect detection.
|
||||
*
|
||||
* @param[in] controllerId ehci controller id, please reference to #usb_controller_index_t.
|
||||
* @param[in] enable
|
||||
* 1U - enable;
|
||||
* 0U - disable;
|
||||
*/
|
||||
void USB_EhcihostPhyDisconnectDetectCmd(uint8_t controllerId, uint8_t enable)
|
||||
{
|
||||
#if ((defined FSL_FEATURE_SOC_USBPHY_COUNT) && (FSL_FEATURE_SOC_USBPHY_COUNT > 0U))
|
||||
USBPHY_Type *usbPhyBase;
|
||||
|
||||
usbPhyBase = (USBPHY_Type *)USB_EhciPhyGetBase(controllerId);
|
||||
if (NULL == usbPhyBase)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (0U != enable)
|
||||
{
|
||||
usbPhyBase->CTRL |= USBPHY_CTRL_ENHOSTDISCONDETECT_MASK;
|
||||
}
|
||||
else
|
||||
{
|
||||
usbPhyBase->CTRL &= (~USBPHY_CTRL_ENHOSTDISCONDETECT_MASK);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if ((defined FSL_FEATURE_SOC_USBPHY_COUNT) && (FSL_FEATURE_SOC_USBPHY_COUNT > 0U))
|
||||
#if ((defined FSL_FEATURE_USBHSD_HAS_EXIT_HS_ISSUE) && (FSL_FEATURE_USBHSD_HAS_EXIT_HS_ISSUE > 0U))
|
||||
void USB_PhyDeviceForceEnterFSMode(uint8_t controllerId, uint8_t enable)
|
||||
{
|
||||
USBPHY_Type *usbPhyBase;
|
||||
|
||||
usbPhyBase = (USBPHY_Type *)USB_EhciPhyGetBase(controllerId);
|
||||
if (NULL == usbPhyBase)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (0U != enable)
|
||||
{
|
||||
uint32_t delay = 1000000;
|
||||
usbPhyBase->DEBUG0_CLR = USBPHY_DEBUG0_CLKGATE_MASK;
|
||||
while ((0U != (usbPhyBase->USB1_VBUS_DET_STAT & USBPHY_USB1_VBUS_DET_STAT_VBUS_VALID_3V_MASK)) && (0U != delay))
|
||||
{
|
||||
delay--;
|
||||
}
|
||||
usbPhyBase->USB1_LOOPBACK_SET = USBPHY_USB1_LOOPBACK_UTMI_TESTSTART_MASK;
|
||||
}
|
||||
else
|
||||
{
|
||||
usbPhyBase->DEBUG0_CLR = USBPHY_DEBUG0_CLKGATE_MASK;
|
||||
usbPhyBase->USB1_LOOPBACK_CLR = USBPHY_USB1_LOOPBACK_UTMI_TESTSTART_MASK;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#else
|
||||
void *USB_EhciPhyGetBase(uint8_t controllerId)
|
||||
{
|
||||
void *usbPhyBase = NULL;
|
||||
@@ -238,3 +505,4 @@ void USB_EhcihostPhyDisconnectDetectCmd(uint8_t controllerId, uint8_t enable)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
@@ -105,7 +105,23 @@ extern void USB_EhciPhyDeinit(uint8_t controllerId);
|
||||
* 0U - disable;
|
||||
*/
|
||||
extern void USB_EhcihostPhyDisconnectDetectCmd(uint8_t controllerId, uint8_t enable);
|
||||
|
||||
#ifdef SOC_IMXRT1170_SERIES
|
||||
#if ((defined FSL_FEATURE_SOC_USBPHY_COUNT) && (FSL_FEATURE_SOC_USBPHY_COUNT > 0U))
|
||||
#if ((defined FSL_FEATURE_USBHSD_HAS_EXIT_HS_ISSUE) && (FSL_FEATURE_USBHSD_HAS_EXIT_HS_ISSUE > 0U))
|
||||
/*!
|
||||
* @brief Force the PHY enter FS Mode
|
||||
*
|
||||
* on RT500 and RT600, the device doesn't enter FS Mode after vbus is invalide and the controller works as HS.
|
||||
*
|
||||
* @param[in] controllerId EHCI controller ID; See #usb_controller_index_t.
|
||||
* @param[in] enable
|
||||
* 1U - enable;
|
||||
* 0U - disable;
|
||||
*/
|
||||
extern void USB_PhyDeviceForceEnterFSMode(uint8_t controllerId, uint8_t enable);
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user