mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-10-07 00:59:00 +08:00
爲imxrt系列添加usb host驅動 (#4377)
* adding fsl_os_abstraction porting * port usbh to imxrt Co-authored-by: guo <guozhanxin@rt-thread.com>
This commit is contained in:
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__
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -83,6 +83,10 @@ if GetDepend(['BSP_USING_PULSE_ENCODER']):
|
||||
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']
|
||||
|
||||
if rtconfig.CROSS_TOOL == 'gcc':
|
||||
group = DefineGroup('Libraries', src, depend = [''], CPPPATH = path, ASFLAGS = '$ASFLAGS -D __STARTUP_CLEAR_BSS')
|
||||
else:
|
||||
|
||||
@@ -59,10 +59,14 @@ if GetDepend('BSP_USING_USB_DEVICE'):
|
||||
src += ['drv_usbd.c']
|
||||
src += Glob('usb/device/*.c')
|
||||
|
||||
if GetDepend('BSP_USING_USB_DEVICE'):
|
||||
if GetDepend('BSP_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']
|
||||
src += Glob('usb/host/*.c')
|
||||
|
||||
if GetDepend('BSP_USING_PULSE_ENCODER'):
|
||||
src += ['drv_pulse_encoder.c']
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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 <rtthread.h>
|
||||
|
||||
#define OTG_PORT 1
|
||||
|
||||
int imxrt_usbh_register(void);
|
||||
|
||||
#endif
|
||||
|
||||
/************* end of file ************/
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -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;
|
||||
|
||||
/*******************************************************************************
|
||||
@@ -175,4 +152,4 @@ extern uint8_t USB_HostGetDeviceAttachState(usb_device_handle deviceHandle);
|
||||
extern usb_status_t USB_HostValidateDevice(usb_host_handle hostHandle, usb_device_handle deviceHandle);
|
||||
|
||||
/*! @}*/
|
||||
#endif /* _USB_HOST_DEV_MNG_H_ */
|
||||
#endif /* _USB_HOST_DEV_MNG_H_ */
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -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_ */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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, USB_OSA_WAIT_TIMEOUT)
|
||||
/*! @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_ */
|
||||
#endif /* _USB_HOST_HCI_H_ */
|
||||
@@ -34,6 +34,7 @@
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <fsl_common.h>
|
||||
#include <fsl_os_abstraction.h>
|
||||
#include "usb_misc.h"
|
||||
#include "usb_spec.h"
|
||||
|
||||
@@ -137,4 +138,4 @@ typedef struct _usb_version
|
||||
|
||||
/*! @} */
|
||||
|
||||
#endif /* __USB_H__ */
|
||||
#endif /* __USB_H__ */
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user