Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lfmiao0
rt-thread
提交
183eb0f3
R
rt-thread
项目概览
lfmiao0
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
183eb0f3
编写于
2月 23, 2021
作者:
B
Bernard Xiong
提交者:
GitHub
2月 23, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #4370 from RT-Thread/revert-4295-test_branch
Revert "添加imxrt的pulse encoder和usb host驅動"
上级
d9c3459e
4426af03
变更
36
展开全部
隐藏空白更改
内联
并排
Showing
36 changed file
with
1855 addition
and
6392 deletion
+1855
-6392
bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/drivers/fsl_os_abstraction.h
...raries/MIMXRT1050/MIMXRT1052/drivers/fsl_os_abstraction.h
+0
-813
bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/drivers/fsl_os_abstraction_config.h
...MIMXRT1050/MIMXRT1052/drivers/fsl_os_abstraction_config.h
+0
-36
bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/drivers/fsl_os_abstraction_rtthread.c
...MXRT1050/MIMXRT1052/drivers/fsl_os_abstraction_rtthread.c
+0
-917
bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/drivers/fsl_os_abstraction_rtthread.h
...MXRT1050/MIMXRT1052/drivers/fsl_os_abstraction_rtthread.h
+0
-130
bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/drivers/generic_list.c
...rt/libraries/MIMXRT1050/MIMXRT1052/drivers/generic_list.c
+0
-475
bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/drivers/generic_list.h
...rt/libraries/MIMXRT1050/MIMXRT1052/drivers/generic_list.h
+0
-203
bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/gcc/startup_MIMXRT1052.S
.../libraries/MIMXRT1050/MIMXRT1052/gcc/startup_MIMXRT1052.S
+2
-0
bsp/imxrt/libraries/MIMXRT1050/SConscript
bsp/imxrt/libraries/MIMXRT1050/SConscript
+3
-10
bsp/imxrt/libraries/drivers/SConscript
bsp/imxrt/libraries/drivers/SConscript
+4
-11
bsp/imxrt/libraries/drivers/drv_pulse_encoder.c
bsp/imxrt/libraries/drivers/drv_pulse_encoder.c
+0
-160
bsp/imxrt/libraries/drivers/drv_usbh.c
bsp/imxrt/libraries/drivers/drv_usbh.c
+0
-730
bsp/imxrt/libraries/drivers/drv_usbh.h
bsp/imxrt/libraries/drivers/drv_usbh.h
+0
-22
bsp/imxrt/libraries/drivers/usb/host/usb_host.h
bsp/imxrt/libraries/drivers/usb/host/usb_host.h
+39
-100
bsp/imxrt/libraries/drivers/usb/host/usb_host_devices.c
bsp/imxrt/libraries/drivers/usb/host/usb_host_devices.c
+309
-359
bsp/imxrt/libraries/drivers/usb/host/usb_host_devices.h
bsp/imxrt/libraries/drivers/usb/host/usb_host_devices.h
+31
-8
bsp/imxrt/libraries/drivers/usb/host/usb_host_ehci.c
bsp/imxrt/libraries/drivers/usb/host/usb_host_ehci.c
+927
-1109
bsp/imxrt/libraries/drivers/usb/host/usb_host_ehci.h
bsp/imxrt/libraries/drivers/usb/host/usb_host_ehci.h
+103
-128
bsp/imxrt/libraries/drivers/usb/host/usb_host_framework.c
bsp/imxrt/libraries/drivers/usb/host/usb_host_framework.c
+0
-261
bsp/imxrt/libraries/drivers/usb/host/usb_host_framework.h
bsp/imxrt/libraries/drivers/usb/host/usb_host_framework.h
+0
-131
bsp/imxrt/libraries/drivers/usb/host/usb_host_hci.c
bsp/imxrt/libraries/drivers/usb/host/usb_host_hci.c
+164
-177
bsp/imxrt/libraries/drivers/usb/host/usb_host_hci.h
bsp/imxrt/libraries/drivers/usb/host/usb_host_hci.h
+29
-15
bsp/imxrt/libraries/drivers/usb/include/usb.h
bsp/imxrt/libraries/drivers/usb/include/usb.h
+0
-1
bsp/imxrt/libraries/drivers/usb/include/usb_host_config.h
bsp/imxrt/libraries/drivers/usb/include/usb_host_config.h
+0
-247
bsp/imxrt/libraries/drivers/usb/include/usb_misc.h
bsp/imxrt/libraries/drivers/usb/include/usb_misc.h
+146
-190
bsp/nuvoton/libraries/m480/rtt_port/drv_usbhost.c
bsp/nuvoton/libraries/m480/rtt_port/drv_usbhost.c
+1
-1
bsp/rx/applications/application.c
bsp/rx/applications/application.c
+1
-1
bsp/stm32/libraries/HAL_Drivers/drv_usbh.c
bsp/stm32/libraries/HAL_Drivers/drv_usbh.c
+1
-1
components/drivers/Kconfig
components/drivers/Kconfig
+0
-8
components/drivers/include/drivers/usb_host.h
components/drivers/include/drivers/usb_host.h
+3
-4
components/drivers/pm/debug.log
components/drivers/pm/debug.log
+0
-0
components/drivers/usb/usbhost/class/hid.c
components/drivers/usb/usbhost/class/hid.c
+64
-76
components/drivers/usb/usbhost/class/hid.h
components/drivers/usb/usbhost/class/hid.h
+5
-5
components/drivers/usb/usbhost/class/umouse.c
components/drivers/usb/usbhost/class/umouse.c
+2
-23
components/drivers/usb/usbhost/core/driver.c
components/drivers/usb/usbhost/core/driver.c
+4
-11
components/drivers/usb/usbhost/core/hub.c
components/drivers/usb/usbhost/core/hub.c
+14
-16
components/drivers/usb/usbhost/core/usbhost.c
components/drivers/usb/usbhost/core/usbhost.c
+3
-13
未找到文件。
bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/drivers/fsl_os_abstraction.h
已删除
100644 → 0
浏览文件 @
d9c3459e
此差异已折叠。
点击以展开。
bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/drivers/fsl_os_abstraction_config.h
已删除
100644 → 0
浏览文件 @
d9c3459e
/*!
* 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_ */
bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/drivers/fsl_os_abstraction_rtthread.c
已删除
100644 → 0
浏览文件 @
d9c3459e
此差异已折叠。
点击以展开。
bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/drivers/fsl_os_abstraction_rtthread.h
已删除
100644 → 0
浏览文件 @
d9c3459e
/*! *********************************************************************************
* 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__
bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/drivers/generic_list.c
已删除
100644 → 0
浏览文件 @
d9c3459e
/*
* 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*/
}
bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/drivers/generic_list.h
已删除
100644 → 0
浏览文件 @
d9c3459e
/*
* 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_*/
bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/gcc/startup_MIMXRT1052.S
浏览文件 @
183eb0f3
...
...
@@ -367,6 +367,7 @@ Reset_Handler:
blt
.
LC4
#endif /* __STARTUP_INITIALIZE_NONCACHEDATA */
#ifdef __STARTUP_CLEAR_BSS
/*
This
part
of
work
usually
is
done
in
C
library
startup
code
.
Otherwise
,
*
define
this
macro
to
enable
it
in
this
startup
.
*
...
...
@@ -384,6 +385,7 @@ Reset_Handler:
itt
lt
strlt
r0
,
[
r1
],
#
4
blt
.
LC5
#endif /* __STARTUP_CLEAR_BSS */
cpsie
i
/*
Unmask
interrupts
*/
#ifndef __START
...
...
bsp/imxrt/libraries/MIMXRT1050/SConscript
浏览文件 @
183eb0f3
...
...
@@ -53,6 +53,9 @@ if GetDepend(['BSP_USING_SDRAM']):
if
GetDepend
([
'BSP_USING_LCD'
]):
src
+=
[
'MIMXRT1052/drivers/fsl_elcdif.c'
]
if
GetDepend
([
'RT_USING_USB_HOST'
])
or
GetDepend
([
'RT_USING_USB_DEVICE'
]):
src
+=
[
'MIMXRT1052/drivers/fsl_usdhc.c'
]
if
GetDepend
([
'BSP_USING_CAN'
]):
src
+=
[
'MIMXRT1052/drivers/fsl_flexcan.c'
]
...
...
@@ -74,17 +77,7 @@ if GetDepend(['BSP_USING_DMA']):
src
+=
[
'MIMXRT1052/drivers/fsl_edma.c'
]
src
+=
[
'MIMXRT1052/drivers/fsl_lpuart_edma.c'
]
src
+=
[
'MIMXRT1052/drivers/fsl_lpspi_edma.c'
]
if
GetDepend
([
'BSP_USING_PULSE_ENCODER'
]):
src
+=
[
'MIMXRT1052/drivers/fsl_enc.c'
]
#Adding this as XBAR is used in pin mux
src
+=
[
'MIMXRT1052/drivers/fsl_xbara.c'
]
src
+=
[
'MIMXRT1052/drivers/fsl_xbarb.c'
]
#fsl os abstract files
src
+=
[
'MIMXRT1052/drivers/fsl_os_abstraction_rtthread.c'
]
src
+=
[
'MIMXRT1052/drivers/generic_list.c'
]
group
=
DefineGroup
(
'Libraries'
,
src
,
depend
=
[
''
],
CPPPATH
=
path
)
...
...
bsp/imxrt/libraries/drivers/SConscript
浏览文件 @
183eb0f3
...
...
@@ -54,22 +54,15 @@ if GetDepend('BSP_USING_AUDIO'):
if
GetDepend
(
'BSP_USING_SDIO'
):
src
+=
[
'drv_sdio.c'
]
if
GetDepend
(
'BSP_USING_PULSE_ENCODER'
):
src
+=
[
'drv_pulse_encoder.c'
]
if
GetDepend
(
'RT_USING_USB_DEVICE'
):
if
GetDepend
(
'BSP_USING_USB_DEVICE'
):
src
+=
[
'drv_usbd.c'
]
src
+=
Glob
(
'usb/device/*.c'
)
if
GetDepend
(
'
RT_USING_USB_DEVICE'
)
or
GetDepend
(
'RT_USING_USB_HOST
'
):
if
GetDepend
(
'
BSP_USING_USB_DEVICE
'
):
src
+=
Glob
(
'usb/phy/*.c'
)
CPPDEFINES
+=
[
'ENDIANNESS'
,
'USE_RTOS'
]
CPPDEFINES
+=
[
'ENDIANNESS'
]
if
GetDepend
(
'RT_USING_USB_HOST'
):
src
+=
[
'drv_usbh.c'
]
src
+=
Glob
(
'usb/host/*.c'
)
path
=
[
cwd
,
cwd
+
'/config'
]
group
=
DefineGroup
(
'Drivers'
,
src
,
depend
=
[
''
],
CPPPATH
=
path
,
CPPDEFINES
=
CPPDEFINES
)
...
...
bsp/imxrt/libraries/drivers/drv_pulse_encoder.c
已删除
100644 → 0
浏览文件 @
d9c3459e
/*
* Copyright (c) 2006-2018, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2019-08-23 balanceTWK first version
* 2021-01-19 Leslie Lee port to imxrt series
*/
#include <rtthread.h>
#include <rtdevice.h>
#ifdef BSP_USING_PULSE_ENCODER
#include "fsl_common.h"
#include "fsl_enc.h"
#define LOG_TAG "drv.pulse_encoder"
#include <drv_log.h>
#if !defined(BSP_USING_PULSE_ENCODER1) && !defined(BSP_USING_PULSE_ENCODER2) && !defined(BSP_USING_PULSE_ENCODER3) \
&& !defined(BSP_USING_PULSE_ENCODER4)
#error "Please define at least one BSP_USING_PULSE_ENCODERx"
/* this driver can be disabled at menuconfig → RT-Thread Components → Device Drivers */
#elif (defined(BSP_USING_PULSE_ENCODER2) || defined(BSP_USING_PULSE_ENCODER3) || defined(BSP_USING_PULSE_ENCODER4)) || defined(SOC_IMXRT1015_SERIES)
#error "IMXRT1015 had only one quadrature decoder module"
#elif (defined(BSP_USING_PULSE_ENCODER3) || defined(BSP_USING_PULSE_ENCODER4)) || defined(SOC_IMXRT1020_SERIES)
#error "IMXRT1020 had only two quadrature decoder module"
#endif
enum
{
#ifdef BSP_USING_PULSE_ENCODER1
PULSE_ENCODER1_INDEX
,
#endif
#ifdef BSP_USING_PULSE_ENCODER2
PULSE_ENCODER2_INDEX
,
#endif
#ifdef BSP_USING_PULSE_ENCODER3
PULSE_ENCODER3_INDEX
,
#endif
#ifdef BSP_USING_PULSE_ENCODER4
PULSE_ENCODER4_INDEX
,
#endif
};
struct
imxrt_pulse_encoder_device
{
struct
rt_pulse_encoder_device
pulse_encoder
;
ENC_Type
*
base
;
char
*
name
;
};
typedef
struct
imxrt_pulse_encoder_device
imxrt_pulse_enccoder_device_t
;
static
imxrt_pulse_enccoder_device_t
imxrt_pulse_encoder_obj
[]
=
{
#ifdef BSP_USING_PULSE_ENCODER1
{
.
base
=
ENC1
,
.
name
=
"pulse1"
},
#endif
#ifdef BSP_USING_PULSE_ENCODER2
{
.
base
=
ENC2
,
.
name
=
"pulse2"
},
#endif
#ifdef BSP_USING_PULSE_ENCODER3
{
.
base
=
ENC3
,
.
name
=
"pulse3"
},
#endif
#ifdef BSP_USING_PULSE_ENCODER4
{
.
base
=
ENC4
,
.
name
=
"pulse4"
},
#endif
};
rt_err_t
pulse_encoder_init
(
struct
rt_pulse_encoder_device
*
pulse_encoder
)
{
ENC_Type
*
base
=
((
imxrt_pulse_enccoder_device_t
*
)(
pulse_encoder
->
parent
.
user_data
))
->
base
;
enc_config_t
enc_config
;
ENC_GetDefaultConfig
(
&
enc_config
);
ENC_Init
(
base
,
&
enc_config
);
ENC_DoSoftwareLoadInitialPositionValue
(
base
);
/* Update the position counter with initial value. */
return
RT_EOK
;
}
rt_err_t
pulse_encoder_clear_count
(
struct
rt_pulse_encoder_device
*
pulse_encoder
)
{
ENC_SetInitialPositionValue
(((
imxrt_pulse_enccoder_device_t
*
)(
pulse_encoder
->
parent
.
user_data
))
->
base
,
0
);
return
RT_EOK
;
}
rt_int32_t
pulse_encoder_get_count
(
struct
rt_pulse_encoder_device
*
pulse_encoder
)
{
return
(
rt_int32_t
)
ENC_GetPositionValue
(((
imxrt_pulse_enccoder_device_t
*
)(
pulse_encoder
->
parent
.
user_data
))
->
base
);
}
rt_err_t
pulse_encoder_control
(
struct
rt_pulse_encoder_device
*
pulse_encoder
,
rt_uint32_t
cmd
,
void
*
args
)
{
rt_err_t
result
;
result
=
RT_EOK
;
switch
(
cmd
)
{
case
PULSE_ENCODER_CMD_ENABLE
:
result
=
pulse_encoder
->
ops
->
init
(
pulse_encoder
);
break
;
case
PULSE_ENCODER_CMD_DISABLE
:
ENC_Deinit
(((
imxrt_pulse_enccoder_device_t
*
)(
pulse_encoder
->
parent
.
user_data
))
->
base
);
break
;
default:
result
=
-
RT_ENOSYS
;
break
;
}
return
result
;
}
static
const
struct
rt_pulse_encoder_ops
_ops
=
{
.
init
=
pulse_encoder_init
,
.
get_count
=
pulse_encoder_get_count
,
.
clear_count
=
pulse_encoder_clear_count
,
.
control
=
pulse_encoder_control
,
};
int
rt_hw_pulse_encoder_init
(
void
)
{
int
i
;
int
result
;
result
=
RT_EOK
;
for
(
i
=
0
;
i
<
sizeof
(
imxrt_pulse_encoder_obj
)
/
sizeof
(
imxrt_pulse_encoder_obj
[
0
]);
i
++
)
{
imxrt_pulse_encoder_obj
[
i
].
pulse_encoder
.
type
=
AB_PHASE_PULSE_ENCODER
;
imxrt_pulse_encoder_obj
[
i
].
pulse_encoder
.
ops
=
&
_ops
;
imxrt_pulse_encoder_obj
[
i
].
pulse_encoder
.
parent
.
user_data
=
&
(
imxrt_pulse_encoder_obj
[
i
]);
if
(
rt_device_pulse_encoder_register
(
&
imxrt_pulse_encoder_obj
[
i
].
pulse_encoder
,
imxrt_pulse_encoder_obj
[
i
].
name
,
&
imxrt_pulse_encoder_obj
[
i
])
!=
RT_EOK
)
{
LOG_E
(
"%s register failed"
,
imxrt_pulse_encoder_obj
[
i
].
name
);
result
=
-
RT_ERROR
;
}
}
return
result
;
}
INIT_BOARD_EXPORT
(
rt_hw_pulse_encoder_init
);
#endif
bsp/imxrt/libraries/drivers/drv_usbh.c
已删除
100644 → 0
浏览文件 @
d9c3459e
此差异已折叠。
点击以展开。
bsp/imxrt/libraries/drivers/drv_usbh.h
已删除
100644 → 0
浏览文件 @
d9c3459e
/*
* 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 ************/
bsp/imxrt/libraries/drivers/usb/host/usb_host.h
浏览文件 @
183eb0f3
/*
* Copyright (c) 2015 - 2016, Freescale Semiconductor, Inc.
* Copyright 2016 - 2019 NXP
* All rights reserved.
* Copyright 2016 NXP
*
* SPDX-License-Identifier: BSD-3-Clause
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* o Redistributions of source code must retain the above copyright notice, this list
* of conditions and the following disclaimer.
*
* o Redistributions in binary form must reproduce the above copyright notice, this
* list of conditions and the following disclaimer in the documentation and/or
* other materials provided with the distribution.
*
* o Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _USB_HOST_H_
...
...
@@ -46,16 +68,6 @@ typedef enum _usb_host_event
kUSB_HostEventDetach
,
/*!< Device is detached */
kUSB_HostEventEnumerationDone
,
/*!< Device's enumeration is done and the device is supported */
kUSB_HostEventNotSupported
,
/*!< Device's enumeration is done and the device is not supported */
/*! Device's enumeration failed due to errors
* fail reason is put in the high 2 bytes of callback event code.
* kStatus_USB_TransferFailed - the transfer failed.
* kStatus_USB_TransferCancel - transfer is canceled by application.
* kStatus_USB_Error - parsing descriptor failed, the power cannot satisfy device's requirement,
* device addresss allocation failed, transfer is not enough
* or the transfer API failed.
* kStatus_USB_AllocFail - malloc failed.
*/
kUSB_HostEventEnumerationFail
,
#if ((defined(USB_HOST_CONFIG_LOW_POWER_MODE)) && (USB_HOST_CONFIG_LOW_POWER_MODE > 0U))
kUSB_HostEventNotSuspended
,
/*!< Suspend failed */
kUSB_HostEventSuspended
,
/*!< Suspend successful */
...
...
@@ -91,60 +103,7 @@ typedef enum _usb_host_dev_info
kUSB_HostGetConfigurationDes
,
/*!< Device's configuration descriptor pointer */
kUSB_HostGetConfigurationLength
,
/*!< Device's configuration descriptor pointer */
}
usb_host_dev_info_t
;
/*! @brief Request type */
typedef
enum
_usb_host_request_type
{
kRequestDevice
=
1U
,
/*!< Control request object is device */
kRequestInterface
,
/*!< Control request object is interface */
kRequestEndpoint
,
/*!< Control request object is endpoint */
}
usb_host_request_type_t
;
/*! @brief For USB_REQUEST_STANDARD_GET_DESCRIPTOR and USB_REQUEST_STANDARD_SET_DESCRIPTOR */
typedef
struct
_usb_host_process_descriptor_param
{
uint8_t
descriptorType
;
/*!< See the usb_spec.h, such as the USB_DESCRIPTOR_TYPE_DEVICE */
uint8_t
descriptorIndex
;
/*!< The descriptor index is used to select a specific descriptor (only for configuration
and string descriptors) when several descriptors of the same type are implemented in a
device */
uint8_t
languageId
;
/*!< It specifies the language ID for string descriptors or is reset to zero for other
descriptors */
uint8_t
*
descriptorBuffer
;
/*!< Buffer pointer */
uint16_t
descriptorLength
;
/*!< Buffer data length */
}
usb_host_process_descriptor_param_t
;
/*! @brief For USB_REQUEST_STANDARD_CLEAR_FEATURE and USB_REQUEST_STANDARD_SET_FEATURE */
typedef
struct
_usb_host_process_feature_param
{
uint8_t
requestType
;
/*!< See the #usb_host_request_type_t */
uint8_t
featureSelector
;
/*!< Set/cleared feature */
uint8_t
interfaceOrEndpoint
;
/*!< Interface or end pointer */
}
usb_host_process_feature_param_t
;
/*! @brief For USB_REQUEST_STANDARD_GET_INTERFACE */
typedef
struct
_usb_host_get_interface_param
{
uint8_t
interface
;
/*!< Interface number */
uint8_t
*
alternateInterfaceBuffer
;
/*!< Save the transfer result */
}
usb_host_get_interface_param_t
;
/*! @brief For USB_REQUEST_STANDARD_GET_STATUS */
typedef
struct
_usb_host_get_status_param
{
uint16_t
statusSelector
;
/*!< Interface number, the end pointer number or OTG status selector */
uint8_t
requestType
;
/*!< See the #usb_host_request_type_t */
uint8_t
*
statusBuffer
;
/*!< Save the transfer result */
}
usb_host_get_status_param_t
;
/*! @brief For USB_REQUEST_STANDARD_SET_INTERFACE */
typedef
struct
_usb_host_set_interface_param
{
uint8_t
alternateSetting
;
/*!< Alternate setting value */
uint8_t
interface
;
/*!< Interface number */
}
usb_host_set_interface_param_t
;
/*! @brief For USB_REQUEST_STANDARD_SYNCH_FRAME */
typedef
struct
_usb_host_synch_frame_param
{
uint8_t
endpoint
;
/*!< Endpoint number */
uint8_t
*
frameNumberBuffer
;
/*!< Frame number data buffer */
}
usb_host_synch_frame_param_t
;
/*!
* @brief Host callback function typedef.
*
...
...
@@ -284,8 +243,8 @@ typedef struct _usb_host_pipe_init
/*! @brief Cancel transfer parameter structure */
typedef
struct
_usb_host_cancel_param
{
usb_host_pipe_handle
pipeHandle
;
/*!< Canceling pipe handle*/
usb_host_transfer_t
*
transfer
;
/*!< Canceling transfer*/
usb_host_pipe_handle
pipeHandle
;
/*!< Cancel
l
ing pipe handle*/
usb_host_transfer_t
*
transfer
;
/*!< Cancel
l
ing transfer*/
}
usb_host_cancel_param_t
;
/*******************************************************************************
...
...
@@ -383,7 +342,7 @@ extern usb_status_t USB_HostHelperParseAlternateSetting(usb_host_interface_handl
* @retval kStatus_USB_InvalidParameter The deviceHandle instance don't belong to hostHandle instance.
*/
extern
usb_status_t
USB_HostRemoveDevice
(
usb_host_handle
hostHandle
,
usb_device_handle
deviceHandle
);
#if (defined(USB_HOST_CONFIG_KHCI) && (USB_HOST_CONFIG_KHCI > 0U))
/*!
* @brief KHCI task function.
*
...
...
@@ -394,8 +353,7 @@ extern usb_status_t USB_HostRemoveDevice(usb_host_handle hostHandle, usb_device_
* @param[in] hostHandle The host handle.
*/
extern
void
USB_HostKhciTaskFunction
(
void
*
hostHandle
);
#endif
#if (defined(USB_HOST_CONFIG_EHCI) && (USB_HOST_CONFIG_EHCI > 0U))
/*!
* @brief EHCI task function.
*
...
...
@@ -406,8 +364,7 @@ extern void USB_HostKhciTaskFunction(void *hostHandle);
* @param[in] hostHandle The host handle.
*/
extern
void
USB_HostEhciTaskFunction
(
void
*
hostHandle
);
#endif
#if (defined(USB_HOST_CONFIG_OHCI) && (USB_HOST_CONFIG_OHCI > 0U))
/*!
* @brief OHCI task function.
*
...
...
@@ -418,8 +375,7 @@ extern void USB_HostEhciTaskFunction(void *hostHandle);
* @param[in] hostHandle The host handle.
*/
extern
void
USB_HostOhciTaskFunction
(
void
*
hostHandle
);
#endif
#if (defined(USB_HOST_CONFIG_IP3516HS) && (USB_HOST_CONFIG_IP3516HS > 0U))
/*!
* @brief IP3516HS task function.
*
...
...
@@ -430,8 +386,7 @@ extern void USB_HostOhciTaskFunction(void *hostHandle);
* @param[in] hostHandle The host handle.
*/
extern
void
USB_HostIp3516HsTaskFunction
(
void
*
hostHandle
);
#endif
#if (defined(USB_HOST_CONFIG_KHCI) && (USB_HOST_CONFIG_KHCI > 0U))
/*!
* @brief Device KHCI ISR function.
*
...
...
@@ -440,8 +395,7 @@ extern void USB_HostIp3516HsTaskFunction(void *hostHandle);
* @param[in] hostHandle The host handle.
*/
extern
void
USB_HostKhciIsrFunction
(
void
*
hostHandle
);
#endif
#if (defined(USB_HOST_CONFIG_EHCI) && (USB_HOST_CONFIG_EHCI > 0U))
/*!
* @brief Device EHCI ISR function.
*
...
...
@@ -450,8 +404,7 @@ extern void USB_HostKhciIsrFunction(void *hostHandle);
* @param[in] hostHandle The host handle.
*/
extern
void
USB_HostEhciIsrFunction
(
void
*
hostHandle
);
#endif
#if (defined(USB_HOST_CONFIG_OHCI) && (USB_HOST_CONFIG_OHCI > 0U))
/*!
* @brief Device OHCI ISR function.
*
...
...
@@ -460,8 +413,7 @@ extern void USB_HostEhciIsrFunction(void *hostHandle);
* @param[in] hostHandle The host handle.
*/
extern
void
USB_HostOhciIsrFunction
(
void
*
hostHandle
);
#endif
#if (defined(USB_HOST_CONFIG_IP3516HS) && (USB_HOST_CONFIG_IP3516HS > 0U))
/*!
* @brief Device IP3516HS ISR function.
*
...
...
@@ -470,7 +422,7 @@ extern void USB_HostOhciIsrFunction(void *hostHandle);
* @param[in] hostHandle The host handle.
*/
extern
void
USB_HostIp3516HsIsrFunction
(
void
*
hostHandle
);
#endif
/*! @}*/
/*!
...
...
@@ -614,7 +566,7 @@ extern usb_status_t USB_HostFreeTransfer(usb_host_handle hostHandle, usb_host_tr
* This function sends the USB standard request packet.
*
* @param[in] deviceHandle The device handle for control transfer.
* @param[in] usbRequest A USB standard request code. Se
e
the usb_spec.h.
* @param[in] usbRequest A USB standard request code. Se the usb_spec.h.
* @param[in] transfer The used transfer.
* @param[in] param The parameter structure is different for different request, see
* usb_host_framework.h.
...
...
@@ -742,10 +694,10 @@ extern usb_status_t USB_HostL1ResumeDeviceResquest(usb_host_handle hostHandle,
/*!
* @brief Update the lpm param.
*
* The function is used to configure the lpm token.
* The function is used to configu
u
re the lpm token.
*
* @param[in] hostHandle The host handle.
* @param[in] lpmParam HIRD va
lu
e and whether enable remotewakeup.
* @param[in] lpmParam HIRD va
ul
e and whether enable remotewakeup.
*
*/
extern
usb_status_t
USB_HostL1SleepDeviceResquestConfig
(
usb_host_handle
hostHandle
,
uint8_t
*
lpmParam
);
...
...
@@ -763,19 +715,6 @@ extern usb_status_t USB_HostUpdateHwTick(usb_host_handle hostHandle, uint64_t ti
#endif
#if ((defined(USB_HOST_CONFIG_BATTERY_CHARGER)) && (USB_HOST_CONFIG_BATTERY_CHARGER > 0U))
/*!
* @brief Set the charger type. It is only supported on RT600 currently.
*
* The set charger type becomes valid in next attach.
*
* @param[in] hostHandle The host handle.
* @param[in] type.
*
*/
extern
usb_status_t
USB_HostSetChargerType
(
usb_host_handle
hostHandle
,
uint8_t
type
);
#endif
/*! @}*/
#ifdef __cplusplus
...
...
bsp/imxrt/libraries/drivers/usb/host/usb_host_devices.c
浏览文件 @
183eb0f3
此差异已折叠。
点击以展开。
bsp/imxrt/libraries/drivers/usb/host/usb_host_devices.h
浏览文件 @
183eb0f3
/*
* Copyright (c) 2015, Freescale Semiconductor, Inc.
* Copyright 2016 NXP
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* o Redistributions of source code must retain the above copyright notice, this list
* of conditions and the following disclaimer.
*
* o Redistributions in binary form must reproduce the above copyright notice, this
* list of conditions and the following disclaimer in the documentation and/or
* other materials provided with the distribution.
*
* o Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _USB_HOST_DEV_MNG_H_
...
...
@@ -57,11 +79,11 @@ typedef struct _usb_host_device_instance
usb_descriptor_device_t
*
deviceDescriptor
;
/*!< Standard device descriptor */
usb_host_pipe_handle
controlPipe
;
/*!< Device's control pipe */
uint8_t
*
configurationDesc
;
/*!< Configuration descriptor pointer */
uint8_t
*
enumBuffer
;
/*!< Buffer for enumeration */
uint16_t
configurationLen
;
/*!< Configuration descriptor length */
uint16_t
configurationValue
;
/*!< Configuration index */
uint8_t
interfaceStatus
[
USB_HOST_CONFIG_CONFIGURATION_MAX_INTERFACE
];
/*!< Interfaces' status, please reference to
#usb_host_interface_state_t */
uint8_t
configurationValue
;
/*!< Configuration index
*/
uint8_t
*
enumBuffer
;
/*!< Buffer for enumeration
*/
uint8_t
state
;
/*!< Device state for enumeration */
uint8_t
enumRetries
;
/*!< Re-enumeration when error in control transfer */
uint8_t
stallRetries
;
/*!< Re-transfer when stall */
...
...
@@ -82,10 +104,11 @@ typedef struct _usb_host_device_instance
typedef
struct
_usb_host_enum_process_entry
{
usb_host_device_enumeration_status_t
successState
;
/*!< When the last step is successful, the next state value */
usb_host_device_enumeration_status_t
retryState
;
/*!< When the last step need retry, the next state value */
/*! When the last step transfer is done, the function is used to process the transfer data */
usb_status_t
(
*
process
)(
usb_host_device_instance_t
*
deviceInstance
,
uint32_t
dataLength
);
uint8_t
successState
;
/*!< When the last step is successful, the next state value */
uint8_t
retryState
;
/*!< When the last step need retry, the next state value */
usb_status_t
(
*
process
)(
usb_host_device_instance_t
*
deviceInstance
);
/*!< When the last step transfer is done, the
function is used to process the transfer
data */
}
usb_host_enum_process_entry_t
;
/*******************************************************************************
...
...
bsp/imxrt/libraries/drivers/usb/host/usb_host_ehci.c
浏览文件 @
183eb0f3
此差异已折叠。
点击以展开。
bsp/imxrt/libraries/drivers/usb/host/usb_host_ehci.h
浏览文件 @
183eb0f3
/*
* Copyright (c) 2015, Freescale Semiconductor, Inc.
* Copyright 2016,2019 NXP
* All rights reserved.
* Copyright 2016 NXP
*
* SPDX-License-Identifier: BSD-3-Clause
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* o Redistributions of source code must retain the above copyright notice, this list
* of conditions and the following disclaimer.
*
* o Redistributions in binary form must reproduce the above copyright notice, this
* list of conditions and the following disclaimer in the documentation and/or
* other materials provided with the distribution.
*
* o Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _USB_HOST_CONTROLLER_EHCI_H_
...
...
@@ -17,95 +39,95 @@
* Definitions
******************************************************************************/
/* EHCI host macros */
#define EHCI_HOST_T_INVALID_VALUE
(1U)
#define EHCI_HOST_POINTER_TYPE_ITD
(0x00U)
#define EHCI_HOST_POINTER_TYPE_QH
(0x00000002U)
#define EHCI_HOST_POINTER_TYPE_SITD
(0x00000004U)
#define EHCI_HOST_POINTER_TYPE_FSTN
(0x00000006U)
#define EHCI_HOST_POINTER_TYPE_MASK
(0x00000006U)
#define EHCI_HOST_T_INVALID_VALUE (1U)
#define EHCI_HOST_POINTER_TYPE_ITD (0x00U)
#define EHCI_HOST_POINTER_TYPE_QH (0x00000002U)
#define EHCI_HOST_POINTER_TYPE_SITD (0x00000004U)
#define EHCI_HOST_POINTER_TYPE_FSTN (0x00000006U)
#define EHCI_HOST_POINTER_TYPE_MASK (0x00000006U)
#define EHCI_HOST_POINTER_ADDRESS_MASK (0xFFFFFFE0U)
#define EHCI_HOST_PID_OUT
(0UL
)
#define EHCI_HOST_PID_IN
(1UL
)
#define EHCI_HOST_PID_SETUP
(2UL
)
#define EHCI_HOST_QH_RL_SHIFT
(28U)
#define EHCI_HOST_QH_RL_MASK
(0xF0000000U)
#define EHCI_HOST_QH_C_SHIFT
(27U)
#define EHCI_HOST_QH_MAX_PACKET_LENGTH_SHIFT
(16U)
#define EHCI_HOST_QH_MAX_PACKET_LENGTH_MASK
(0x07FF0000U)
#define EHCI_HOST_QH_H_SHIFT
(15U)
#define EHCI_HOST_QH_DTC_SHIFT
(14U)
#define EHCI_HOST_QH_EPS_SHIFT
(12U)
#define EHCI_HOST_QH_ENDPT_SHIFT
(8U)
#define EHCI_HOST_QH_I_SHIFT
(7U)
#define EHCI_HOST_QH_DEVICE_ADDRESS_SHIFT
(0U)
#define EHCI_HOST_QH_MULT_SHIFT
(30U)
#define EHCI_HOST_QH_PORT_NUMBER_SHIFT
(23U)
#define EHCI_HOST_QH_HUB_ADDR_SHIFT
(16U)
#define EHCI_HOST_QH_UFRAME_CMASK_SHIFT
(8U)
#define EHCI_HOST_QH_UFRAME_SMASK_SHIFT
(0U)
#define EHCI_HOST_QH_STATUS_ERROR_MASK
(0x0000007EU)
#define EHCI_HOST_PID_OUT
(0U
)
#define EHCI_HOST_PID_IN
(1U
)
#define EHCI_HOST_PID_SETUP
(2U
)
#define EHCI_HOST_QH_RL_SHIFT (28U)
#define EHCI_HOST_QH_RL_MASK (0xF0000000U)
#define EHCI_HOST_QH_C_SHIFT (27U)
#define EHCI_HOST_QH_MAX_PACKET_LENGTH_SHIFT (16U)
#define EHCI_HOST_QH_MAX_PACKET_LENGTH_MASK (0x07FF0000U)
#define EHCI_HOST_QH_H_SHIFT (15U)
#define EHCI_HOST_QH_DTC_SHIFT (14U)
#define EHCI_HOST_QH_EPS_SHIFT (12U)
#define EHCI_HOST_QH_ENDPT_SHIFT (8U)
#define EHCI_HOST_QH_I_SHIFT (7U)
#define EHCI_HOST_QH_DEVICE_ADDRESS_SHIFT (0U)
#define EHCI_HOST_QH_MULT_SHIFT (30U)
#define EHCI_HOST_QH_PORT_NUMBER_SHIFT (23U)
#define EHCI_HOST_QH_HUB_ADDR_SHIFT (16U)
#define EHCI_HOST_QH_UFRAME_CMASK_SHIFT (8U)
#define EHCI_HOST_QH_UFRAME_SMASK_SHIFT (0U)
#define EHCI_HOST_QH_STATUS_ERROR_MASK (0x0000007EU)
#define EHCI_HOST_QH_STATUS_NOSTALL_ERROR_MASK (0x0000003EU)
#define EHCI_HOST_QTD_DT_SHIFT
(31U)
#define EHCI_HOST_QTD_DT_MASK
(0x80000000U)
#define EHCI_HOST_QTD_TOTAL_BYTES_SHIFT
(16U)
#define EHCI_HOST_QTD_TOTAL_BYTES_MASK
(0x7FFF0000U)
#define EHCI_HOST_QTD_IOC_MASK
(0x00008000U)
#define EHCI_HOST_QTD_C_PAGE_SHIFT
(12U)
#define EHCI_HOST_QTD_CERR_SHIFT
(10U)
#define EHCI_HOST_QTD_CERR_MAX_VALUE
(0x00000003UL
)
#define EHCI_HOST_QTD_PID_CODE_SHIFT
(8U)
#define EHCI_HOST_QTD_STATUS_SHIFT
(0U)
#define EHCI_HOST_QTD_CURRENT_OFFSET_MASK
(0x00000FFFU)
#define EHCI_HOST_QTD_BUFFER_POINTER_SHIFT
(12U)
#define EHCI_HOST_QTD_STATUS_ACTIVE_MASK
(0x00000080U)
#define EHCI_HOST_QTD_STATUS_MASK
(0x000000ffU)
#define EHCI_HOST_QTD_STATUS_ERROR_MASK
(0x0000007EU)
#define EHCI_HOST_QTD_DT_SHIFT (31U)
#define EHCI_HOST_QTD_DT_MASK (0x80000000U)
#define EHCI_HOST_QTD_TOTAL_BYTES_SHIFT (16U)
#define EHCI_HOST_QTD_TOTAL_BYTES_MASK (0x7FFF0000U)
#define EHCI_HOST_QTD_IOC_MASK (0x00008000U)
#define EHCI_HOST_QTD_C_PAGE_SHIFT (12U)
#define EHCI_HOST_QTD_CERR_SHIFT (10U)
#define EHCI_HOST_QTD_CERR_MAX_VALUE
(0x00000003U
)
#define EHCI_HOST_QTD_PID_CODE_SHIFT (8U)
#define EHCI_HOST_QTD_STATUS_SHIFT (0U)
#define EHCI_HOST_QTD_CURRENT_OFFSET_MASK (0x00000FFFU)
#define EHCI_HOST_QTD_BUFFER_POINTER_SHIFT (12U)
#define EHCI_HOST_QTD_STATUS_ACTIVE_MASK (0x00000080U)
#define EHCI_HOST_QTD_STATUS_MASK (0x000000ffU)
#define EHCI_HOST_QTD_STATUS_ERROR_MASK (0x0000007EU)
#define EHCI_HOST_QTD_STATUS_STALL_ERROR_MASK (0x00000040U)
#define EHCI_HOST_ITD_STATUS_ACTIVE_MASK
(0x80000000U)
#define EHCI_HOST_ITD_TRANSACTION_LEN_SHIFT
(16U)
#define EHCI_HOST_ITD_TRANSACTION_LEN_MASK
(0x0FFF0000U)
#define EHCI_HOST_ITD_IOC_SHIFT
(15U)
#define EHCI_HOST_ITD_PG_SHIFT
(12U)
#define EHCI_HOST_ITD_STATUS_ACTIVE_MASK (0x80000000U)
#define EHCI_HOST_ITD_TRANSACTION_LEN_SHIFT (16U)
#define EHCI_HOST_ITD_TRANSACTION_LEN_MASK (0x0FFF0000U)
#define EHCI_HOST_ITD_IOC_SHIFT (15U)
#define EHCI_HOST_ITD_PG_SHIFT (12U)
#define EHCI_HOST_ITD_TRANSACTION_OFFSET_SHIFT (0U)
#define EHCI_HOST_ITD_TRANSACTION_OFFSET_MASK
(0x00000FFFU)
#define EHCI_HOST_ITD_BUFFER_POINTER_SHIFT
(12U)
#define EHCI_HOST_ITD_ENDPT_SHIFT
(8U)
#define EHCI_HOST_ITD_DEVICE_ADDRESS_SHIFT
(0U)
#define EHCI_HOST_ITD_MAX_PACKET_SIZE_SHIFT
(0U)
#define EHCI_HOST_ITD_MULT_SHIFT
(0U)
#define EHCI_HOST_ITD_DIRECTION_SHIFT
(11U)
#define EHCI_HOST_SITD_STATUS_ACTIVE_MASK
(0x00000080U)
#define EHCI_HOST_SITD_DIRECTION_SHIFT
(31U)
#define EHCI_HOST_SITD_PORT_NUMBER_SHIFT
(24U)
#define EHCI_HOST_SITD_HUB_ADDR_SHIFT
(16U)
#define EHCI_HOST_SITD_ENDPT_SHIFT
(8U)
#define EHCI_HOST_ITD_TRANSACTION_OFFSET_MASK (0x00000FFFU)
#define EHCI_HOST_ITD_BUFFER_POINTER_SHIFT (12U)
#define EHCI_HOST_ITD_ENDPT_SHIFT (8U)
#define EHCI_HOST_ITD_DEVICE_ADDRESS_SHIFT (0U)
#define EHCI_HOST_ITD_MAX_PACKET_SIZE_SHIFT (0U)
#define EHCI_HOST_ITD_MULT_SHIFT (0U)
#define EHCI_HOST_ITD_DIRECTION_SHIFT (11U)
#define EHCI_HOST_SITD_STATUS_ACTIVE_MASK (0x00000080U)
#define EHCI_HOST_SITD_DIRECTION_SHIFT (31U)
#define EHCI_HOST_SITD_PORT_NUMBER_SHIFT (24U)
#define EHCI_HOST_SITD_HUB_ADDR_SHIFT (16U)
#define EHCI_HOST_SITD_ENDPT_SHIFT (8U)
#define EHCI_HOST_SITD_DEVICE_ADDRESS_SHIFT (0U)
#define EHCI_HOST_SITD_CMASK_SHIFT
(8U)
#define EHCI_HOST_SITD_SMASK_SHIFT
(0U)
#define EHCI_HOST_SITD_TOTAL_BYTES_SHIFT
(16U)
#define EHCI_HOST_SITD_TOTAL_BYTES_MASK
(0x03FF0000U)
#define EHCI_HOST_SITD_TP_SHIFT
(3U)
#define EHCI_HOST_SITD_TCOUNT_SHIFT
(0U)
#define EHCI_HOST_SITD_IOC_SHIFT
(31U)
#define EHCI_HOST_SITD_CMASK_SHIFT (8U)
#define EHCI_HOST_SITD_SMASK_SHIFT (0U)
#define EHCI_HOST_SITD_TOTAL_BYTES_SHIFT (16U)
#define EHCI_HOST_SITD_TOTAL_BYTES_MASK (0x03FF0000U)
#define EHCI_HOST_SITD_TP_SHIFT (3U)
#define EHCI_HOST_SITD_TCOUNT_SHIFT (0U)
#define EHCI_HOST_SITD_IOC_SHIFT (31U)
/* register related MACROs */
#define EHCI_PORTSC1_W1_BITS
(0x0000002AU)
#define EHCI_PORTSC1_W1_BITS (0x0000002AU)
#define EHCI_MAX_UFRAME_VALUE (0x00003FFFU)
/* task event */
#define EHCI_TASK_EVENT_DEVICE_ATTACH
(0x01U)
#define EHCI_TASK_EVENT_DEVICE_ATTACH (0x01U)
#define EHCI_TASK_EVENT_TRANSACTION_DONE (0x02U)
#define EHCI_TASK_EVENT_DEVICE_DETACH
(0x04U)
#define EHCI_TASK_EVENT_PORT_CHANGE
(0x08U)
#define EHCI_TASK_EVENT_TIMER0
(0x10U)
#define EHCI_TASK_EVENT_TIMER1
(0x20U)
#define EHCI_TASK_EVENT_DEVICE_DETACH (0x04U)
#define EHCI_TASK_EVENT_PORT_CHANGE (0x08U)
#define EHCI_TASK_EVENT_TIMER0 (0x10U)
#define EHCI_TASK_EVENT_TIMER1 (0x20U)
#define USB_HostEhciLock()
(void)OSA_MutexLock(ehciInstance->ehciMutex, USB_OSA_WAIT_TIMEOUT
)
#define USB_HostEhciUnlock()
(void)OSA_
MutexUnlock(ehciInstance->ehciMutex)
#define USB_HostEhciLock()
USB_OsaMutexLock(ehciInstance->ehciMutex
)
#define USB_HostEhciUnlock()
USB_Osa
MutexUnlock(ehciInstance->ehciMutex)
/*******************************************************************************
* KHCI driver public structures, enumerations, macros, functions
...
...
@@ -122,8 +144,6 @@
#define USB_HOST_EHCI_PORT_CONNECT_DEBOUNCE_DELAY (101U)
/*! @brief Delay for port reset */
#define USB_HOST_EHCI_PORT_RESET_DELAY (11U)
/*! @brief The MAX continuous transfers that application can send. */
#define USB_HOST_EHCI_ISO_MAX_CONTINUOUS_TRANSFER (8U)
/*! @brief The SITD inserts a frame interval for putting more SITD continuously.
* There is an interval when an application sends two FS/LS ISO transfers.
* When the interval is less than the macro, the two transfers are continuous in the frame list. Otherwise, the two
...
...
@@ -151,7 +171,7 @@
*/
#define USB_HOST_EHCI_ISO_BOUNCE_UFRAME_NUMBER (16U)
/*! @brief Control or bulk transaction timeout value (unit: 100 ms) */
#define USB_HOST_EHCI_CONTROL_BULK_TIME_OUT_VALUE (
5
0U)
#define USB_HOST_EHCI_CONTROL_BULK_TIME_OUT_VALUE (
2
0U)
#if ((defined(USB_HOST_CONFIG_LOW_POWER_MODE)) && (USB_HOST_CONFIG_LOW_POWER_MODE > 0U))
typedef
enum
_bus_ehci_suspend_request_state
...
...
@@ -303,10 +323,8 @@ typedef struct _usb_host_ehci_instance
usb_host_ehci_pipe_t
*
ehciPipeIndexBase
;
/*!< Pipe buffer's start pointer*/
usb_host_ehci_pipe_t
*
ehciPipeList
;
/*!< Idle pipe list pointer*/
usb_host_ehci_pipe_t
*
ehciRunningPipeList
;
/*!< Running pipe list pointer*/
osa_mutex_handle_t
ehciMutex
;
/*!< EHCI mutex*/
uint32_t
mutexBuffer
[(
OSA_MUTEX_HANDLE_SIZE
+
3
)
/
4
];
/*!< The mutex buffer. */
osa_event_handle_t
taskEventHandle
;
/*!< EHCI task event*/
uint32_t
taskEventHandleBuffer
[(
OSA_EVENT_HANDLE_SIZE
+
3
)
/
4
];
/*!< EHCI task event handle buffer*/
usb_osa_mutex_handle
ehciMutex
;
/*!< EHCI mutex*/
usb_osa_event_handle
taskEventHandle
;
/*!< EHCI task event*/
#if ((defined(USB_HOST_CONFIG_LOW_POWER_MODE)) && (USB_HOST_CONFIG_LOW_POWER_MODE > 0U))
uint64_t
matchTick
;
USBPHY_Type
*
registerPhyBase
;
/*!< The base address of the PHY register */
...
...
@@ -337,10 +355,6 @@ typedef struct _usb_host_ehci_data
#endif
#if ((defined(USB_HOST_CONFIG_EHCI_MAX_ITD)) && (USB_HOST_CONFIG_EHCI_MAX_ITD > 0U))
usb_host_ehci_itd_t
ehciItd
[
USB_HOST_CONFIG_EHCI_MAX_ITD
];
/*!< Idle ITD list array*/
/* add additional 32bytes because the itd cannot cross over 4K boundary,
* If one ITD cross over 4K boundary, the code will move 32 bytes for ITD.
*/
uint32_t
reserved
[
8
];
#endif
#if ((defined(USB_HOST_CONFIG_EHCI_MAX_SITD)) && (USB_HOST_CONFIG_EHCI_MAX_SITD > 0U))
usb_host_ehci_sitd_t
ehciSitd
[
USB_HOST_CONFIG_EHCI_MAX_SITD
];
/*!< Idle SITD list array*/
...
...
@@ -474,45 +488,6 @@ extern usb_status_t USB_HostEhciIoctl(usb_host_controller_handle controllerHandl
uint32_t
ioctlEvent
,
void
*
ioctlParam
);
/*!
* @brief control ehci bus.
*
* @param ehciInstance ehci instance pointer.
* @param bus_control control code.
*
* @return kStatus_USB_Success or error codes.
*/
extern
usb_status_t
USB_HostEhciControlBus
(
usb_host_ehci_instance_t
*
ehciInstance
,
uint8_t
busControl
);
/*!
* @brief ehci port change interrupt process function.
*
* @param ehciInstance ehci instance pointer.
*/
extern
void
USB_HostEhciPortChange
(
usb_host_ehci_instance_t
*
ehciInstance
);
/*!
* @brief ehci timer0 interrupt process function.
* cancel control/bulk transfer that time out.
*
* @param ehciInstance ehci instance pointer.
*/
extern
void
USB_HostEhciTimer0
(
usb_host_ehci_instance_t
*
ehciInstance
);
/*!
* @brief host ehci start async schedule.
*
* @param ehciInstance ehci instance pointer.
*/
extern
void
USB_HostEhciStartAsync
(
usb_host_ehci_instance_t
*
ehciInstance
);
/*!
* @brief host ehci start periodic schedule.
*
* @param ehciInstance ehci instance pointer.
*/
extern
void
USB_HostEhciStartPeriodic
(
usb_host_ehci_instance_t
*
ehciInstance
);
/*! @}*/
#ifdef __cplusplus
...
...
bsp/imxrt/libraries/drivers/usb/host/usb_host_framework.c
已删除
100644 → 0
浏览文件 @
d9c3459e
/*
* Copyright (c) 2015 - 2016, Freescale Semiconductor, Inc.
* Copyright 2016 NXP
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <usb/include/usb_host_config.h>
#include "usb_host.h"
#include "usb_host_hci.h"
#include "usb_host_devices.h"
#include "usb_host_framework.h"
/*******************************************************************************
* Definitions
******************************************************************************/
/* Component ID definition, used by tools. */
#ifndef FSL_COMPONENT_ID
#define FSL_COMPONENT_ID "middleware.usb.host.fatfs_usb_stack"
#endif
/*******************************************************************************
* Prototypes
******************************************************************************/
/*******************************************************************************
* Variables
******************************************************************************/
/*******************************************************************************
* Code
******************************************************************************/
usb_status_t
USB_HostCh9RequestCommon
(
usb_host_device_instance_t
*
deviceInstance
,
usb_host_transfer_t
*
transfer
,
uint8_t
*
buffer
,
uint32_t
bufferLen
)
{
/* initialize transfer */
transfer
->
setupPacket
->
wLength
=
USB_SHORT_TO_LITTLE_ENDIAN
((
uint16_t
)
bufferLen
);
transfer
->
transferBuffer
=
buffer
;
transfer
->
transferLength
=
bufferLen
;
if
(
USB_HostSendSetup
(
deviceInstance
->
hostHandle
,
deviceInstance
->
controlPipe
,
transfer
)
!=
kStatus_USB_Success
)
/* send setup transfer */
{
#ifdef HOST_ECHO
usb_echo
(
"failed for USB_HostSendSetup
\r\n
"
);
#endif
(
void
)
USB_HostFreeTransfer
(
deviceInstance
->
hostHandle
,
transfer
);
return
kStatus_USB_Error
;
}
return
kStatus_USB_Success
;
}
usb_status_t
USB_HostStandardGetStatus
(
usb_host_device_instance_t
*
deviceInstance
,
usb_host_transfer_t
*
transfer
,
void
*
param
)
{
usb_host_get_status_param_t
*
statusParam
;
uint8_t
length
;
/* initialize transfer */
statusParam
=
(
usb_host_get_status_param_t
*
)
param
;
transfer
->
setupPacket
->
bmRequestType
=
USB_REQUEST_TYPE_DIR_IN
|
USB_REQUEST_TYPE_TYPE_STANDARD
;
if
(
statusParam
->
requestType
==
(
uint8_t
)
kRequestDevice
)
{
transfer
->
setupPacket
->
bmRequestType
|=
USB_REQUEST_TYPE_RECIPIENT_DEVICE
;
}
else
if
(
statusParam
->
requestType
==
(
uint8_t
)
kRequestInterface
)
{
transfer
->
setupPacket
->
bmRequestType
|=
USB_REQUEST_TYPE_RECIPIENT_INTERFACE
;
}
else
{
transfer
->
setupPacket
->
bmRequestType
|=
USB_REQUEST_TYPE_RECIPIENT_ENDPOINT
;
}
transfer
->
setupPacket
->
wIndex
=
USB_SHORT_TO_LITTLE_ENDIAN
(
statusParam
->
statusSelector
);
length
=
2
;
if
(
statusParam
->
statusSelector
==
USB_REQUEST_STANDARD_GET_STATUS_OTG_STATUS_SELECTOR
)
{
length
=
1
;
}
return
USB_HostCh9RequestCommon
(
deviceInstance
,
transfer
,
statusParam
->
statusBuffer
,
length
);
}
usb_status_t
USB_HostStandardSetClearFeature
(
usb_host_device_instance_t
*
deviceInstance
,
usb_host_transfer_t
*
transfer
,
void
*
param
)
{
usb_host_process_feature_param_t
*
featureParam
;
/* initialize transfer */
featureParam
=
(
usb_host_process_feature_param_t
*
)
param
;
if
(
featureParam
->
requestType
==
(
uint8_t
)
kRequestDevice
)
{
transfer
->
setupPacket
->
bmRequestType
|=
USB_REQUEST_TYPE_RECIPIENT_DEVICE
;
}
else
if
(
featureParam
->
requestType
==
(
uint8_t
)
kRequestInterface
)
{
transfer
->
setupPacket
->
bmRequestType
|=
USB_REQUEST_TYPE_RECIPIENT_INTERFACE
;
}
else
{
transfer
->
setupPacket
->
bmRequestType
|=
USB_REQUEST_TYPE_RECIPIENT_ENDPOINT
;
}
transfer
->
setupPacket
->
wValue
=
USB_SHORT_TO_LITTLE_ENDIAN
(
featureParam
->
featureSelector
);
transfer
->
setupPacket
->
wIndex
=
USB_SHORT_TO_LITTLE_ENDIAN
(
featureParam
->
interfaceOrEndpoint
);
return
USB_HostCh9RequestCommon
(
deviceInstance
,
transfer
,
NULL
,
0
);
}
usb_status_t
USB_HostStandardSetAddress
(
usb_host_device_instance_t
*
deviceInstance
,
usb_host_transfer_t
*
transfer
,
void
*
param
)
{
uint8_t
address
;
/* initialize transfer */
address
=
*
(
uint8_t
*
)
param
;
transfer
->
setupPacket
->
wValue
=
USB_SHORT_TO_LITTLE_ENDIAN
(
address
);
return
USB_HostCh9RequestCommon
(
deviceInstance
,
transfer
,
NULL
,
0
);
}
usb_status_t
USB_HostStandardSetGetDescriptor
(
usb_host_device_instance_t
*
deviceInstance
,
usb_host_transfer_t
*
transfer
,
void
*
param
)
{
usb_host_process_descriptor_param_t
*
descriptorParam
;
/* initialize transfer */
descriptorParam
=
(
usb_host_process_descriptor_param_t
*
)
param
;
transfer
->
setupPacket
->
wValue
=
USB_SHORT_TO_LITTLE_ENDIAN
(
(
uint16_t
)((
uint16_t
)
descriptorParam
->
descriptorType
<<
8
)
|
descriptorParam
->
descriptorIndex
);
transfer
->
setupPacket
->
wIndex
=
USB_SHORT_TO_LITTLE_ENDIAN
(
descriptorParam
->
languageId
);
return
USB_HostCh9RequestCommon
(
deviceInstance
,
transfer
,
descriptorParam
->
descriptorBuffer
,
descriptorParam
->
descriptorLength
);
}
usb_status_t
USB_HostStandardGetInterface
(
usb_host_device_instance_t
*
deviceInstance
,
usb_host_transfer_t
*
transfer
,
void
*
param
)
{
usb_host_get_interface_param_t
*
interfaceParam
;
/* initialize transfer */
interfaceParam
=
(
usb_host_get_interface_param_t
*
)
param
;
transfer
->
setupPacket
->
bmRequestType
|=
USB_REQUEST_TYPE_DIR_IN
;
transfer
->
setupPacket
->
bmRequestType
|=
USB_REQUEST_TYPE_RECIPIENT_INTERFACE
;
transfer
->
setupPacket
->
wIndex
=
USB_SHORT_TO_LITTLE_ENDIAN
(
interfaceParam
->
interface
);
return
USB_HostCh9RequestCommon
(
deviceInstance
,
transfer
,
interfaceParam
->
alternateInterfaceBuffer
,
1
);
}
usb_status_t
USB_HostStandardSetInterface
(
usb_host_device_instance_t
*
deviceInstance
,
usb_host_transfer_t
*
transfer
,
void
*
param
)
{
usb_host_set_interface_param_t
*
setParam
;
/* initialize transfer */
setParam
=
(
usb_host_set_interface_param_t
*
)
param
;
transfer
->
setupPacket
->
bmRequestType
|=
USB_REQUEST_TYPE_RECIPIENT_INTERFACE
;
transfer
->
setupPacket
->
wIndex
=
USB_SHORT_TO_LITTLE_ENDIAN
(
setParam
->
interface
);
transfer
->
setupPacket
->
wValue
=
USB_SHORT_TO_LITTLE_ENDIAN
(
setParam
->
alternateSetting
);
return
USB_HostCh9RequestCommon
(
deviceInstance
,
transfer
,
NULL
,
0
);
}
usb_status_t
USB_HostStandardSyncFrame
(
usb_host_device_instance_t
*
deviceInstance
,
usb_host_transfer_t
*
transfer
,
void
*
param
)
{
usb_host_synch_frame_param_t
*
frameParam
;
/* initialize transfer */
frameParam
=
(
usb_host_synch_frame_param_t
*
)
param
;
transfer
->
setupPacket
->
bmRequestType
|=
USB_REQUEST_TYPE_DIR_IN
;
transfer
->
setupPacket
->
bmRequestType
|=
USB_REQUEST_TYPE_RECIPIENT_ENDPOINT
;
transfer
->
setupPacket
->
wIndex
=
USB_SHORT_TO_LITTLE_ENDIAN
(
frameParam
->
endpoint
);
return
USB_HostCh9RequestCommon
(
deviceInstance
,
transfer
,
frameParam
->
frameNumberBuffer
,
2
);
}
usb_status_t
USB_HostRequestControl
(
usb_device_handle
deviceHandle
,
uint8_t
usbRequest
,
usb_host_transfer_t
*
transfer
,
void
*
param
)
{
usb_host_device_instance_t
*
deviceInstance
=
(
usb_host_device_instance_t
*
)
deviceHandle
;
usb_status_t
status
=
kStatus_USB_Error
;
if
(
deviceHandle
==
NULL
)
{
return
kStatus_USB_InvalidHandle
;
}
/* reset transfer fields */
transfer
->
setupPacket
->
bmRequestType
=
0x00
;
transfer
->
setupPacket
->
bRequest
=
usbRequest
;
transfer
->
setupPacket
->
wIndex
=
0
;
transfer
->
setupPacket
->
wLength
=
0
;
transfer
->
setupPacket
->
wValue
=
0
;
switch
(
usbRequest
)
{
case
USB_REQUEST_STANDARD_GET_STATUS
:
/* standard get status request */
status
=
USB_HostStandardGetStatus
(
deviceInstance
,
transfer
,
param
);
break
;
case
USB_REQUEST_STANDARD_CLEAR_FEATURE
:
/* standard clear status request */
case
USB_REQUEST_STANDARD_SET_FEATURE
:
/* standard set feature request */
status
=
USB_HostStandardSetClearFeature
(
deviceInstance
,
transfer
,
param
);
break
;
case
USB_REQUEST_STANDARD_SET_ADDRESS
:
/* standard set address request */
status
=
USB_HostStandardSetAddress
(
deviceInstance
,
transfer
,
param
);
break
;
case
USB_REQUEST_STANDARD_GET_DESCRIPTOR
:
/* standard get descriptor request */
case
USB_REQUEST_STANDARD_SET_DESCRIPTOR
:
/* standard set descriptor request */
if
(
usbRequest
==
USB_REQUEST_STANDARD_GET_DESCRIPTOR
)
{
transfer
->
setupPacket
->
bmRequestType
|=
USB_REQUEST_TYPE_DIR_IN
;
}
status
=
USB_HostStandardSetGetDescriptor
(
deviceInstance
,
transfer
,
param
);
break
;
case
USB_REQUEST_STANDARD_GET_CONFIGURATION
:
/* standard get configuration descriptor request */
transfer
->
setupPacket
->
bmRequestType
|=
USB_REQUEST_TYPE_DIR_IN
;
status
=
USB_HostCh9RequestCommon
((
usb_host_device_instance_t
*
)
deviceHandle
,
transfer
,
(
uint8_t
*
)
param
,
1
);
break
;
case
USB_REQUEST_STANDARD_SET_CONFIGURATION
:
/* standard set configuration request */
transfer
->
setupPacket
->
wValue
=
USB_SHORT_TO_LITTLE_ENDIAN
(
*
((
uint8_t
*
)
param
));
status
=
USB_HostCh9RequestCommon
((
usb_host_device_instance_t
*
)
deviceHandle
,
transfer
,
NULL
,
0
);
break
;
case
USB_REQUEST_STANDARD_GET_INTERFACE
:
/* standard get interface request */
status
=
USB_HostStandardGetInterface
(
deviceInstance
,
transfer
,
param
);
break
;
case
USB_REQUEST_STANDARD_SET_INTERFACE
:
/* standard set interface request */
status
=
USB_HostStandardSetInterface
(
deviceInstance
,
transfer
,
param
);
break
;
case
USB_REQUEST_STANDARD_SYNCH_FRAME
:
/* standard synch frame request */
status
=
USB_HostStandardSyncFrame
(
deviceInstance
,
transfer
,
param
);
break
;
default:
/*no action*/
break
;
}
return
status
;
}
bsp/imxrt/libraries/drivers/usb/host/usb_host_framework.h
已删除
100644 → 0
浏览文件 @
d9c3459e
/*
* 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_ */
bsp/imxrt/libraries/drivers/usb/host/usb_host_hci.c
浏览文件 @
183eb0f3
此差异已折叠。
点击以展开。
bsp/imxrt/libraries/drivers/usb/host/usb_host_hci.h
浏览文件 @
183eb0f3
/*
* Copyright (c) 2015, Freescale Semiconductor, Inc.
* Copyright 2016 - 2019 NXP
* All rights reserved.
* Copyright 2016 NXP
*
* SPDX-License-Identifier: BSD-3-Clause
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* o Redistributions of source code must retain the above copyright notice, this list
* of conditions and the following disclaimer.
*
* o Redistributions in binary form must reproduce the above copyright notice, this
* list of conditions and the following disclaimer in the documentation and/or
* other materials provided with the distribution.
*
* o Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _USB_HOST_HCI_H_
...
...
@@ -14,9 +36,9 @@
******************************************************************************/
/*! @brief USB host lock */
#define USB_HostLock()
OSA_MutexLock(hostInstance->hostMutex, USB_OSA_WAIT_TIMEOUT
)
#define USB_HostLock()
USB_OsaMutexLock(hostInstance->hostMutex
)
/*! @brief USB host unlock */
#define USB_HostUnlock()
OSA_
MutexUnlock(hostInstance->hostMutex)
#define USB_HostUnlock()
USB_Osa
MutexUnlock(hostInstance->hostMutex)
/*!
* @addtogroup usb_host_controller_driver
...
...
@@ -34,10 +56,6 @@ typedef enum _usb_host_controller_control
kUSB_HostPortAttachDisable
,
/*!< Disable the port attach event */
kUSB_HostPortAttachEnable
,
/*!< Enable the port attach event */
kUSB_HostL1Config
,
/*!< L1 suspend Bus control code */
kUSB_HostSetChargerType
,
/*!< set charger type */
#if ((defined USB_HOST_CONFIG_COMPLIANCE_TEST) && (USB_HOST_CONFIG_COMPLIANCE_TEST))
kUSB_HostTestModeInit
,
/*!< intialize charger type */
#endif
}
usb_host_controller_control_t
;
/*! @brief USB host controller bus control code */
...
...
@@ -79,9 +97,7 @@ typedef struct _usb_host_controller_interface
uint32_t
ioctlEvent
,
void
*
ioctlParam
);
/*!< Control a controller function prototype*/
}
usb_host_controller_interface_t
;
#if ((defined USB_HOST_CONFIG_COMPLIANCE_TEST) && (USB_HOST_CONFIG_COMPLIANCE_TEST))
usb_status_t
USB_HostTestModeInit
(
usb_device_handle
deviceHandle
);
#endif
/*! @}*/
/*!
...
...
@@ -94,8 +110,7 @@ typedef struct _usb_host_instance
{
void
*
controllerHandle
;
/*!< The low level controller handle*/
host_callback_t
deviceCallback
;
/*!< Device attach/detach callback*/
osa_mutex_handle_t
hostMutex
;
/*!< Host layer mutex*/
uint32_t
mutexBuffer
[(
OSA_MUTEX_HANDLE_SIZE
+
3
)
/
4
];
/*!< Host layer mutex*/
usb_osa_mutex_handle
hostMutex
;
/*!< Host layer mutex*/
usb_host_transfer_t
transferList
[
USB_HOST_CONFIG_MAX_TRANSFERS
];
/*!< Transfer resource*/
usb_host_transfer_t
*
transferHead
;
/*!< Idle transfer head*/
const
usb_host_controller_interface_t
*
controllerTable
;
/*!< KHCI/EHCI interface*/
...
...
@@ -111,7 +126,6 @@ typedef struct _usb_host_instance
uint8_t
controllerId
;
/*!< The controller ID*/
}
usb_host_instance_t
;
extern
usb_host_instance_t
g_UsbHostInstance
[
USB_HOST_CONFIG_MAX_HOST
];
/*! @}*/
#endif
/* _USB_HOST_HCI_H_ */
bsp/imxrt/libraries/drivers/usb/include/usb.h
浏览文件 @
183eb0f3
...
...
@@ -34,7 +34,6 @@
#include <stdint.h>
#include <stdio.h>
#include <fsl_common.h>
#include <fsl_os_abstraction.h>
#include "usb_misc.h"
#include "usb_spec.h"
...
...
bsp/imxrt/libraries/drivers/usb/include/usb_host_config.h
已删除
100644 → 0
浏览文件 @
d9c3459e
/*
* Copyright (c) 2015 - 2016, Freescale Semiconductor, Inc.
* Copyright 2016 - 2019 NXP
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef _USB_HOST_CONFIG_H_
#define _USB_HOST_CONFIG_H_
/* Host Controller Enable */
/*!
* @brief host khci instance count, meantime it indicates khci enable or disable.
* - if 0, host khci driver is disable.
* - if greater than 0, host khci driver is enable.
*/
#define USB_HOST_CONFIG_KHCI (0U)
/*!
* @brief host ehci instance count, meantime it indicates ehci enable or disable.
* - if 0, host ehci driver is disable.
* - if greater than 0, host ehci driver is enable.
*/
#define USB_HOST_CONFIG_EHCI (2U)
/*!
* @brief host ohci instance count, meantime it indicates ohci enable or disable.
* - if 0, host ohci driver is disable.
* - if greater than 0, host ohci driver is enable.
*/
#define USB_HOST_CONFIG_OHCI (0U)
/*!
* @brief host ip3516hs instance count, meantime it indicates ohci enable or disable.
* - if 0, host ip3516hs driver is disable.
* - if greater than 0, host ip3516hs driver is enable.
*/
#define USB_HOST_CONFIG_IP3516HS (0U)
/* Common configuration macros for all controllers */
/*!
* @brief host driver instance max count.
* for example: 2 - one for khci, one for ehci.
*/
#define USB_HOST_CONFIG_MAX_HOST \
(USB_HOST_CONFIG_KHCI + USB_HOST_CONFIG_EHCI + USB_HOST_CONFIG_OHCI + USB_HOST_CONFIG_IP3516HS)
/*!
* @brief host pipe max count.
* pipe is the host driver resource for device endpoint, one endpoint need one pipe.
*/
#define USB_HOST_CONFIG_MAX_PIPES (16U)
/*!
* @brief host transfer max count.
* transfer is the host driver resource for data transmission mission, one transmission mission need one transfer.
*/
#define USB_HOST_CONFIG_MAX_TRANSFERS (16U)
/*!
* @brief the max endpoint for one interface.
* the max endpoint descriptor number that one interface descriptor contain.
*/
#define USB_HOST_CONFIG_INTERFACE_MAX_EP (4U)
/*!
* @brief the max interface for one configuration.
* the max interface descriptor number that one configuration descriptor can contain.
*/
#define USB_HOST_CONFIG_CONFIGURATION_MAX_INTERFACE (5U)
/*!
* @brief the max power for one device.
* the max power the host can provide for one device.
*/
#define USB_HOST_CONFIG_MAX_POWER (250U)
/*!
* @brief the max retries for enumeration.
* retry time when enumeration fail.
*/
#define USB_HOST_CONFIG_ENUMERATION_MAX_RETRIES (3U)
/*!
* @brief the max retries for enumeration setup stall.
* the max times for one transfer can stall.
*/
#define USB_HOST_CONFIG_ENUMERATION_MAX_STALL_RETRIES (1U)
/*!
* @brief the max NAK count for one transaction.
* when nak count reach to the value, the transaction fail.
*/
#define USB_HOST_CONFIG_MAX_NAK (3000U)
/*! @brief Whether the transfer buffer is cache-enabled or not. */
#ifndef USB_HOST_CONFIG_BUFFER_PROPERTY_CACHEABLE
#define USB_HOST_CONFIG_BUFFER_PROPERTY_CACHEABLE (0U)
#endif
/*! @brief if 1, enable usb compliance test codes; if 0, disable usb compliance test codes. */
#define USB_HOST_CONFIG_COMPLIANCE_TEST (0U)
/*! @brief if 1, class driver clear stall automatically; if 0, class driver don't clear stall. */
#define USB_HOST_CONFIG_CLASS_AUTO_CLEAR_STALL (0U)
/* KHCI configuration */
#if ((defined USB_HOST_CONFIG_KHCI) && (USB_HOST_CONFIG_KHCI))
/*!
* @brief khci dma align fix buffer size.
*/
#define USB_HOST_CONFIG_KHCI_DMA_ALIGN_BUFFER (64U)
#endif
/* EHCI configuration */
#if ((defined USB_HOST_CONFIG_EHCI) && (USB_HOST_CONFIG_EHCI))
/*!
* @brief ehci periodic frame list size.
* the value can be 1024, 512, 256, 128, 64, 32, 16 or 8.
*/
#define USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE (1024U)
/*!
* @brief ehci QH max count.
*/
#define USB_HOST_CONFIG_EHCI_MAX_QH (8U)
/*!
* @brief ehci QTD max count.
*/
#define USB_HOST_CONFIG_EHCI_MAX_QTD (8U)
/*!
* @brief ehci ITD max count.
*/
#define USB_HOST_CONFIG_EHCI_MAX_ITD (0U)
/*!
* @brief ehci SITD max count.
*/
#define USB_HOST_CONFIG_EHCI_MAX_SITD (0U)
#endif
/* OHCI configuration */
#if ((defined USB_HOST_CONFIG_OHCI) && (USB_HOST_CONFIG_OHCI))
/*!
* @brief ohci ED max count.
*/
#define USB_HOST_CONFIG_OHCI_MAX_ED (8U)
/*!
* @brief ohci GTD max count.
*/
#define USB_HOST_CONFIG_OHCI_MAX_GTD (8U)
/*!
* @brief ohci ITD max count.
*/
#define USB_HOST_CONFIG_OHCI_MAX_ITD (8U)
#endif
/* OHCI configuration */
#if ((defined USB_HOST_CONFIG_IP3516HS) && (USB_HOST_CONFIG_IP3516HS))
#define USB_HOST_CONFIG_IP3516HS_MAX_PIPE (32U)
/*!
* @brief ohci ED max count.
*/
#define USB_HOST_CONFIG_IP3516HS_MAX_ATL (32U)
/*!
* @brief ohci GTD max count.
*/
#define USB_HOST_CONFIG_IP3516HS_MAX_INT (32U)
/*!
* @brief ohci ITD max count.
*/
#define USB_HOST_CONFIG_IP3516HS_MAX_ISO (0U)
#endif
/*!
* @brief host HUB class instance count, meantime it indicates HUB class enable or disable.
* - if 0, host HUB class driver is disable.
* - if greater than 0, host HUB class driver is enable.
*/
#define USB_HOST_CONFIG_HUB (0U)
/*!
* @brief host HID class instance count, meantime it indicates HID class enable or disable.
* - if 0, host HID class driver is disable.
* - if greater than 0, host HID class driver is enable.
*/
#define USB_HOST_CONFIG_HID (0U)
/*!
* @brief host MSD class instance count, meantime it indicates MSD class enable or disable.
* - if 0, host MSD class driver is disable.
* - if greater than 0, host MSD class driver is enable.
*/
#define USB_HOST_CONFIG_MSD (0U)
/*!
* @brief host CDC class instance count, meantime it indicates CDC class enable or disable.
* - if 0, host CDC class driver is disable.
* - if greater than 0, host CDC class driver is enable.
*/
#define USB_HOST_CONFIG_CDC (0U)
/*!
* @brief host AUDIO class instance count, meantime it indicates AUDIO class enable or disable.
* - if 0, host AUDIO class driver is disable.
* - if greater than 0, host AUDIO class driver is enable.
*/
#define USB_HOST_CONFIG_AUDIO (0U)
/*!
* @brief host PHDC class instance count, meantime it indicates PHDC class enable or disable.
* - if 0, host PHDC class driver is disable.
* - if greater than 0, host PHDC class driver is enable.
*/
#define USB_HOST_CONFIG_PHDC (0U)
/*!
* @brief host printer class instance count, meantime it indicates printer class enable or disable.
* - if 0, host printer class driver is disable.
* - if greater than 0, host printer class driver is enable.
*/
#define USB_HOST_CONFIG_PRINTER (0U)
/*!
* @brief host charger detect enable or disable. It is only supported on RT600 currently.
* - if 0, host charger detect is disable.
* - if greater than 0, host charger detect is enable.
*/
#define USB_HOST_CONFIG_BATTERY_CHARGER (0U)
#endif
/* _USB_HOST_CONFIG_H_ */
bsp/imxrt/libraries/drivers/usb/include/usb_misc.h
浏览文件 @
183eb0f3
此差异已折叠。
点击以展开。
bsp/nuvoton/libraries/m480/rtt_port/drv_usbhost.c
浏览文件 @
183eb0f3
...
...
@@ -844,7 +844,7 @@ int nu_usbh_register(void)
RT_ASSERT
(
res
==
RT_EOK
);
/*initialize the usb host function */
res
=
rt_usb_host_init
(
"usbh"
);
res
=
rt_usb_host_init
();
RT_ASSERT
(
res
==
RT_EOK
);
#if defined(RT_USING_PM)
...
...
bsp/rx/applications/application.c
浏览文件 @
183eb0f3
...
...
@@ -130,7 +130,7 @@ void rt_init_thread_entry(void* parameter)
#endif
#ifdef RT_USING_USB_HOST
rt_usb_host_init
(
"usbh"
);
rt_usb_host_init
();
#endif
#ifdef RT_USING_FINSH
...
...
bsp/stm32/libraries/HAL_Drivers/drv_usbh.c
浏览文件 @
183eb0f3
...
...
@@ -241,7 +241,7 @@ int stm_usbh_register(void)
return
-
RT_ERROR
;
}
rt_usb_host_init
(
"usbh"
);
rt_usb_host_init
();
return
RT_EOK
;
}
...
...
components/drivers/Kconfig
浏览文件 @
183eb0f3
...
...
@@ -642,14 +642,6 @@ menu "Using USB"
string "Udisk mount dir"
default "/"
endif
config RT_USBH_HID
bool "Enable HID Drivers"
default n
if RT_USBH_HID
config RT_USBH_HID_MOUSE
bool "Enable HID mouse protocol"
default n
endif
endif
config RT_USING_USB_DEVICE
bool "Using USB device"
...
...
components/drivers/include/drivers/usb_host.h
浏览文件 @
183eb0f3
...
...
@@ -136,8 +136,7 @@ struct uhcd
struct
rt_device
parent
;
uhcd_ops_t
ops
;
rt_uint8_t
num_ports
;
uhub_t
roothub
;
struct
rt_messagequeue
*
usb_mq
;
uhub_t
roothub
;
};
typedef
struct
uhcd
*
uhcd_t
;
...
...
@@ -164,7 +163,7 @@ struct uhost_msg
typedef
struct
uhost_msg
*
uhost_msg_t
;
/* usb host system interface */
rt_err_t
rt_usb_host_init
(
const
char
*
name
);
rt_err_t
rt_usb_host_init
(
void
);
void
rt_usbh_hub_init
(
struct
uhcd
*
hcd
);
/* usb host core interface */
...
...
@@ -204,7 +203,7 @@ rt_err_t rt_usbh_hub_clear_port_feature(uhub_t uhub, rt_uint16_t port,
rt_err_t
rt_usbh_hub_set_port_feature
(
uhub_t
uhub
,
rt_uint16_t
port
,
rt_uint16_t
feature
);
rt_err_t
rt_usbh_hub_reset_port
(
uhub_t
uhub
,
rt_uint16_t
port
);
rt_err_t
rt_usbh_event_signal
(
uhcd_t
uhcd
,
struct
uhost_msg
*
msg
);
rt_err_t
rt_usbh_event_signal
(
struct
uhost_msg
*
msg
);
void
rt_usbh_root_hub_connect_handler
(
struct
uhcd
*
hcd
,
rt_uint8_t
port
,
rt_bool_t
isHS
);
...
...
components/drivers/pm/debug.log
已删除
100644 → 0
浏览文件 @
d9c3459e
components/drivers/usb/usbhost/class/hid.c
浏览文件 @
183eb0f3
此差异已折叠。
点击以展开。
components/drivers/usb/usbhost/class/hid.h
浏览文件 @
183eb0f3
...
...
@@ -31,11 +31,11 @@ typedef struct uhid uhid_t;
#define USB_HID_KEYBOARD 1
#define USB_HID_MOUSE 2
rt_err_t
rt_usbh_hid_set_idle
(
struct
u
h
intf
*
intf
,
int
duration
,
int
report_id
);
rt_err_t
rt_usbh_hid_get_report
(
struct
u
h
intf
*
intf
,
rt_uint8_t
type
,
rt_uint8_t
id
,
rt_uint8_t
*
buffer
,
rt_size_t
size
);
rt_err_t
rt_usbh_hid_set_report
(
struct
u
h
intf
*
intf
,
rt_uint8_t
*
buffer
,
rt_size_t
size
);
rt_err_t
rt_usbh_hid_set_protocal
(
struct
u
h
intf
*
intf
,
int
protocol
);
rt_err_t
rt_usbh_hid_get_report_descriptor
(
struct
u
h
intf
*
intf
,
rt_uint8_t
*
buffer
,
rt_size_t
size
);
rt_err_t
rt_usbh_hid_set_idle
(
struct
uintf
*
intf
,
int
duration
,
int
report_id
);
rt_err_t
rt_usbh_hid_get_report
(
struct
uintf
*
intf
,
rt_uint8_t
type
,
rt_uint8_t
id
,
rt_uint8_t
*
buffer
,
rt_size_t
size
);
rt_err_t
rt_usbh_hid_set_report
(
struct
uintf
*
intf
,
rt_uint8_t
*
buffer
,
rt_size_t
size
);
rt_err_t
rt_usbh_hid_set_protocal
(
struct
uintf
*
intf
,
int
protocol
);
rt_err_t
rt_usbh_hid_get_report_descriptor
(
struct
uintf
*
intf
,
rt_uint8_t
*
buffer
,
rt_size_t
size
);
rt_err_t
rt_usbh_hid_protocal_register
(
uprotocal_t
protocal
);
#endif
components/drivers/usb/usbhost/class/umouse.c
浏览文件 @
183eb0f3
...
...
@@ -126,36 +126,15 @@ static rt_err_t rt_usbh_hid_mouse_callback(void* arg)
return
RT_EOK
;
}
rt_thread_t
mouse_thread
;
void
mouse_task
(
void
*
param
)
{
struct
uhintf
*
intf
=
(
struct
uhintf
*
)
param
;
while
(
1
)
{
if
(
rt_usb_hcd_pipe_xfer
(
intf
->
device
->
hcd
,
((
struct
uhid
*
)
intf
->
user_data
)
->
pipe_in
,
((
struct
uhid
*
)
intf
->
user_data
)
->
buffer
,
((
struct
uhid
*
)
intf
->
user_data
)
->
pipe_in
->
ep
.
wMaxPacketSize
,
USB_TIMEOUT_BASIC
)
==
0
)
{
break
;
}
rt_usbh_hid_mouse_callback
(
intf
->
user_data
);
}
}
static
rt_err_t
rt_usbh_hid_mouse_init
(
void
*
arg
)
{
struct
u
hintf
*
intf
=
(
struct
uh
intf
*
)
arg
;
struct
u
intf
*
intf
=
(
struct
u
intf
*
)
arg
;
RT_ASSERT
(
intf
!=
RT_NULL
);
rt_usbh_hid_set_protocal
(
intf
,
0
);
rt_usbh_hid_set_idle
(
intf
,
0
,
0
);
mouse_thread
=
rt_thread_create
(
"mouse0"
,
mouse_task
,
intf
,
500
,
8
,
100
);
rt_thread_startup
(
mouse_thread
);
rt_usbh_hid_set_idle
(
intf
,
10
,
0
);
RT_DEBUG_LOG
(
RT_DEBUG_USB
,
(
"start usb mouse
\n
"
));
#ifdef RT_USING_RTGUI
...
...
components/drivers/usb/usbhost/core/driver.c
浏览文件 @
183eb0f3
此差异已折叠。
点击以展开。
components/drivers/usb/usbhost/core/hub.c
浏览文件 @
183eb0f3
此差异已折叠。
点击以展开。
components/drivers/usb/usbhost/core/usbhost.c
浏览文件 @
183eb0f3
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录