mirror of
https://github.com/hathach/tinyusb.git
synced 2025-01-31 05:52:55 +08:00
frdm k64f usb work well, add kinetis_k to ci cmake
This commit is contained in:
parent
a1bfde83fb
commit
3d3bf45102
2
.github/workflows/cmake_arm.yml
vendored
2
.github/workflows/cmake_arm.yml
vendored
@ -38,7 +38,7 @@ jobs:
|
|||||||
family:
|
family:
|
||||||
# Alphabetical order
|
# Alphabetical order
|
||||||
- 'imxrt'
|
- 'imxrt'
|
||||||
- 'kinetis_kl'
|
- 'kinetis_k kinetis_kl'
|
||||||
- 'lpc17 lpc18 lpc40 lpc43'
|
- 'lpc17 lpc18 lpc40 lpc43'
|
||||||
- 'lpc54 lpc55'
|
- 'lpc54 lpc55'
|
||||||
- 'mcx'
|
- 'mcx'
|
||||||
|
@ -732,15 +732,27 @@
|
|||||||
</dcdx>
|
</dcdx>
|
||||||
<periphs name="Peripherals" version="13.0" enabled="true" update_project_code="true">
|
<periphs name="Peripherals" version="13.0" enabled="true" update_project_code="true">
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency resourceType="Tool" resourceId="Clocks" description="The Clocks tool is required by the Peripherals tool, but it is disabled." problem_level="2" source="Peripherals">
|
<dependency resourceType="SWComponent" resourceId="middleware.usb.common_header" description="USB Common Header is not found in the toolchain/IDE project. The project will not compile!" problem_level="2" source="Peripherals">
|
||||||
<feature name="enabled" evaluation="equal">
|
<feature name="enabled" evaluation="equal">
|
||||||
<data>true</data>
|
<data type="Boolean">true</data>
|
||||||
|
</feature>
|
||||||
|
</dependency>
|
||||||
|
<dependency resourceType="SWComponent" resourceId="middleware.usb.common_header" description="An unsupported version of the USB Common Header in the toolchain/IDE project. Required: ${required_value}, actual: ${actual_value}. The project might not compile correctly." problem_level="1" source="Peripherals">
|
||||||
|
<feature name="version" evaluation="compatible">
|
||||||
|
<data type="Version">2.8.0</data>
|
||||||
</feature>
|
</feature>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<generated_project_files>
|
<generated_project_files>
|
||||||
<file path="board/peripherals.c" update_enabled="true"/>
|
<file path="board/peripherals.c" update_enabled="true"/>
|
||||||
<file path="board/peripherals.h" update_enabled="true"/>
|
<file path="board/peripherals.h" update_enabled="true"/>
|
||||||
|
<file path="source/generated/usb_device_composite.c" update_enabled="true"/>
|
||||||
|
<file path="source/generated/usb_device_composite.h" update_enabled="true"/>
|
||||||
|
<file path="source/generated/usb_device_config.h" update_enabled="true"/>
|
||||||
|
<file path="source/generated/usb_device_descriptor.c" update_enabled="true"/>
|
||||||
|
<file path="source/generated/usb_device_descriptor.h" update_enabled="true"/>
|
||||||
|
<file path="source/usb_device_interface_0_cic_vcom.c" update_enabled="true"/>
|
||||||
|
<file path="source/usb_device_interface_0_cic_vcom.h" update_enabled="true"/>
|
||||||
</generated_project_files>
|
</generated_project_files>
|
||||||
<peripherals_profile>
|
<peripherals_profile>
|
||||||
<processor_version>14.0.0</processor_version>
|
<processor_version>14.0.0</processor_version>
|
||||||
@ -755,6 +767,31 @@
|
|||||||
<data type="Boolean">true</data>
|
<data type="Boolean">true</data>
|
||||||
</feature>
|
</feature>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency resourceType="SWComponent" resourceId="middleware.usb.device_controller_khci" description=""USB Device KHCI Controller Driver(FS)" component is missing in the project." problem_level="2" source="Peripherals:BOARD_InitPeripherals">
|
||||||
|
<feature name="enabled" evaluation="equal">
|
||||||
|
<data type="Boolean">true</data>
|
||||||
|
</feature>
|
||||||
|
</dependency>
|
||||||
|
<dependency resourceType="SWComponent" resourceId="platform.drivers.common" description=""Common" driver is missing in the project." problem_level="2" source="Peripherals:BOARD_InitPeripherals">
|
||||||
|
<feature name="enabled" evaluation="equal">
|
||||||
|
<data type="Boolean">true</data>
|
||||||
|
</feature>
|
||||||
|
</dependency>
|
||||||
|
<dependency resourceType="ClockOutput" resourceId="USB48MCLK" description="USB Function Clock (USB48MCLK) is inactive and USB module will not work." problem_level="2" source="Peripherals:BOARD_InitPeripherals">
|
||||||
|
<feature name="frequency" evaluation="greaterThan">
|
||||||
|
<data type="Frequency" unit="Hz">0</data>
|
||||||
|
</feature>
|
||||||
|
</dependency>
|
||||||
|
<dependency resourceType="SWComponent" resourceId="middleware.usb.device.cdc.external" description=""USB device CDC" driver is missing in the project." problem_level="2" source="Peripherals:BOARD_InitPeripherals">
|
||||||
|
<feature name="enabled" evaluation="equal">
|
||||||
|
<data type="Boolean">true</data>
|
||||||
|
</feature>
|
||||||
|
</dependency>
|
||||||
|
<dependency resourceType="SWComponent" resourceId="middleware.usb.device.cdc.external" description=""USB device CDC" driver is missing in the project." problem_level="2" source="Peripherals:BOARD_InitPeripherals">
|
||||||
|
<feature name="enabled" evaluation="equal">
|
||||||
|
<data type="Boolean">true</data>
|
||||||
|
</feature>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<instances>
|
<instances>
|
||||||
<instance name="NVIC" uuid="e1a88231-4d9e-46a3-b134-d2c743110640" type="nvic" type_id="nvic_57b5eef3774cc60acaede6f5b8bddc67" mode="general" peripheral="NVIC" enabled="true" comment="" custom_name_enabled="false" editing_lock="false">
|
<instance name="NVIC" uuid="e1a88231-4d9e-46a3-b134-d2c743110640" type="nvic" type_id="nvic_57b5eef3774cc60acaede6f5b8bddc67" mode="general" peripheral="NVIC" enabled="true" comment="" custom_name_enabled="false" editing_lock="false">
|
||||||
@ -789,7 +826,7 @@
|
|||||||
<setting name="mpuInit" value="disabled"/>
|
<setting name="mpuInit" value="disabled"/>
|
||||||
</config_set>
|
</config_set>
|
||||||
</instance>
|
</instance>
|
||||||
<instance name="USB0" uuid="cc0eb411-8fed-4548-b79c-9a8340cc02fd" type="usb" type_id="usb_cbf31fb9a3cef21890d93e737c3d2690" mode="device" peripheral="USB0" enabled="false" comment="" custom_name_enabled="false" editing_lock="false">
|
<instance name="USB0" uuid="cc0eb411-8fed-4548-b79c-9a8340cc02fd" type="usb" type_id="usb_cbf31fb9a3cef21890d93e737c3d2690" mode="device" peripheral="USB0" enabled="true" comment="" custom_name_enabled="false" editing_lock="false">
|
||||||
<config_set name="deviceSetting" quick_selection="QS_DEVICE_CDC_VCOM">
|
<config_set name="deviceSetting" quick_selection="QS_DEVICE_CDC_VCOM">
|
||||||
<setting name="vendor_id" value="0x1FC9"/>
|
<setting name="vendor_id" value="0x1FC9"/>
|
||||||
<setting name="product_id" value="0x0094"/>
|
<setting name="product_id" value="0x0094"/>
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#include "fsl_port.h"
|
#include "fsl_port.h"
|
||||||
#include "fsl_clock.h"
|
#include "fsl_clock.h"
|
||||||
#include "fsl_uart.h"
|
#include "fsl_uart.h"
|
||||||
|
#include "fsl_sysmpu.h"
|
||||||
|
|
||||||
#include "board/clock_config.h"
|
#include "board/clock_config.h"
|
||||||
#include "board/pin_mux.h"
|
#include "board/pin_mux.h"
|
||||||
@ -50,6 +51,7 @@ void board_init(void) {
|
|||||||
BOARD_InitBootPins();
|
BOARD_InitBootPins();
|
||||||
BOARD_BootClockRUN();
|
BOARD_BootClockRUN();
|
||||||
SystemCoreClockUpdate();
|
SystemCoreClockUpdate();
|
||||||
|
SYSMPU_Enable(SYSMPU, 0);
|
||||||
|
|
||||||
#if CFG_TUSB_OS == OPT_OS_NONE
|
#if CFG_TUSB_OS == OPT_OS_NONE
|
||||||
// 1ms tick timer
|
// 1ms tick timer
|
||||||
@ -84,7 +86,7 @@ void board_init(void) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// USB
|
// USB
|
||||||
CLOCK_EnableUsbfs0Clock(kCLOCK_UsbSrcPll0, CLOCK_GetFreq(kCLOCK_PllFllSelClk));
|
// USB clock is configured in BOARD_BootClockRUN()
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
|
@ -40,6 +40,7 @@ function(add_board_target BOARD_TARGET)
|
|||||||
${SDK_DIR}/drivers/gpio
|
${SDK_DIR}/drivers/gpio
|
||||||
${SDK_DIR}/drivers/port
|
${SDK_DIR}/drivers/port
|
||||||
${SDK_DIR}/drivers/smc
|
${SDK_DIR}/drivers/smc
|
||||||
|
${SDK_DIR}/drivers/sysmpu
|
||||||
${SDK_DIR}/drivers/uart
|
${SDK_DIR}/drivers/uart
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -29,6 +29,7 @@ INC += \
|
|||||||
$(TOP)/$(SDK_DIR)/drivers/gpio \
|
$(TOP)/$(SDK_DIR)/drivers/gpio \
|
||||||
$(TOP)/$(SDK_DIR)/drivers/port \
|
$(TOP)/$(SDK_DIR)/drivers/port \
|
||||||
$(TOP)/$(SDK_DIR)/drivers/smc \
|
$(TOP)/$(SDK_DIR)/drivers/smc \
|
||||||
|
$(TOP)/$(SDK_DIR)/drivers/sysmpu \
|
||||||
$(TOP)/$(SDK_DIR)/drivers/uart \
|
$(TOP)/$(SDK_DIR)/drivers/uart \
|
||||||
|
|
||||||
SRC_S += ${SDK_DIR}/devices/${MCU_VARIANT}/gcc/startup_${MCU_VARIANT}.S
|
SRC_S += ${SDK_DIR}/devices/${MCU_VARIANT}/gcc/startup_${MCU_VARIANT}.S
|
||||||
|
@ -36,14 +36,12 @@
|
|||||||
#define CI_FS_REG(_port) ((ci_fs_regs_t*) USB0_BASE)
|
#define CI_FS_REG(_port) ((ci_fs_regs_t*) USB0_BASE)
|
||||||
#define CI_REG CI_FS_REG(0)
|
#define CI_REG CI_FS_REG(0)
|
||||||
|
|
||||||
void dcd_int_enable(uint8_t rhport)
|
void dcd_int_enable(uint8_t rhport) {
|
||||||
{
|
|
||||||
(void) rhport;
|
(void) rhport;
|
||||||
NVIC_EnableIRQ(USB0_IRQn);
|
NVIC_EnableIRQ(USB0_IRQn);
|
||||||
}
|
}
|
||||||
|
|
||||||
void dcd_int_disable(uint8_t rhport)
|
void dcd_int_disable(uint8_t rhport) {
|
||||||
{
|
|
||||||
(void) rhport;
|
(void) rhport;
|
||||||
NVIC_DisableIRQ(USB0_IRQn);
|
NVIC_DisableIRQ(USB0_IRQn);
|
||||||
}
|
}
|
||||||
|
@ -271,9 +271,17 @@ void dcd_init(uint8_t rhport)
|
|||||||
{
|
{
|
||||||
(void) rhport;
|
(void) rhport;
|
||||||
|
|
||||||
|
// save crystal-less setting (recovery clock)
|
||||||
|
uint32_t clk_recover_irc_en = CI_REG->CLK_RECOVER_IRC_EN;
|
||||||
|
uint32_t clk_recover_ctrl = CI_REG->CLK_RECOVER_CTRL;;
|
||||||
|
|
||||||
CI_REG->USBTRC0 |= USB_USBTRC0_USBRESET_MASK;
|
CI_REG->USBTRC0 |= USB_USBTRC0_USBRESET_MASK;
|
||||||
while (CI_REG->USBTRC0 & USB_USBTRC0_USBRESET_MASK);
|
while (CI_REG->USBTRC0 & USB_USBTRC0_USBRESET_MASK);
|
||||||
|
|
||||||
|
// restore crystal-less setting
|
||||||
|
CI_REG->CLK_RECOVER_IRC_EN = clk_recover_irc_en;
|
||||||
|
CI_REG->CLK_RECOVER_CTRL |= clk_recover_ctrl;
|
||||||
|
|
||||||
tu_memclr(&_dcd, sizeof(_dcd));
|
tu_memclr(&_dcd, sizeof(_dcd));
|
||||||
CI_REG->USBTRC0 |= TU_BIT(6); /* software must set this bit to 1 */
|
CI_REG->USBTRC0 |= TU_BIT(6); /* software must set this bit to 1 */
|
||||||
CI_REG->BDT_PAGE1 = (uint8_t)((uintptr_t)_dcd.bdt >> 8);
|
CI_REG->BDT_PAGE1 = (uint8_t)((uintptr_t)_dcd.bdt >> 8);
|
||||||
|
@ -269,22 +269,16 @@ void dcd_init(uint8_t rhport)
|
|||||||
{
|
{
|
||||||
(void) rhport;
|
(void) rhport;
|
||||||
|
|
||||||
#if (CFG_TUSB_MCU == OPT_MCU_KINETIS_K)
|
// save crystal-less setting (recovery clock)
|
||||||
uint32_t clk_recover_irc_en;
|
uint32_t clk_recover_irc_en = KHCI->CLK_RECOVER_IRC_EN;
|
||||||
uint32_t clk_recover_ctrl;
|
uint32_t clk_recover_ctrl = KHCI->CLK_RECOVER_CTRL;
|
||||||
|
|
||||||
clk_recover_irc_en = KHCI->CLK_RECOVER_IRC_EN;
|
|
||||||
clk_recover_ctrl = KHCI->CLK_RECOVER_CTRL;
|
|
||||||
|
|
||||||
KHCI->USBTRC0 |= USB_USBTRC0_USBRESET_MASK;
|
KHCI->USBTRC0 |= USB_USBTRC0_USBRESET_MASK;
|
||||||
while (KHCI->USBTRC0 & USB_USBTRC0_USBRESET_MASK);
|
while (KHCI->USBTRC0 & USB_USBTRC0_USBRESET_MASK);
|
||||||
|
|
||||||
|
// restore crystal-less setting
|
||||||
KHCI->CLK_RECOVER_IRC_EN = clk_recover_irc_en;
|
KHCI->CLK_RECOVER_IRC_EN = clk_recover_irc_en;
|
||||||
KHCI->CLK_RECOVER_CTRL |= clk_recover_ctrl;
|
KHCI->CLK_RECOVER_CTRL |= clk_recover_ctrl;
|
||||||
#else
|
|
||||||
KHCI->USBTRC0 |= USB_USBTRC0_USBRESET_MASK;
|
|
||||||
while (KHCI->USBTRC0 & USB_USBTRC0_USBRESET_MASK);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
tu_memclr(&_dcd, sizeof(_dcd));
|
tu_memclr(&_dcd, sizeof(_dcd));
|
||||||
KHCI->USBTRC0 |= TU_BIT(6); /* software must set this bit to 1 */
|
KHCI->USBTRC0 |= TU_BIT(6); /* software must set this bit to 1 */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user