Skip to content

Commit 6893535

Browse files
authored
Merge pull request #3169 from bridadan/USB_Updates
[Update of #3014] Usb updates
2 parents c32b2cf + edd6cac commit 6893535

File tree

7 files changed

+45
-29
lines changed

7 files changed

+45
-29
lines changed

features/unsupported/USBDevice/USBDevice/USBHAL_KL25Z.cpp

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818

1919
#if defined(TARGET_KL25Z) | defined(TARGET_KL43Z) | defined(TARGET_KL46Z) | defined(TARGET_K20D50M) | defined(TARGET_K64F) | defined(TARGET_K22F) | defined(TARGET_TEENSY3_1)
2020

21+
#if defined(TARGET_KSDK2_MCUS)
22+
#include "fsl_common.h"
23+
#endif
2124
#include "USBHAL.h"
2225

2326
USBHAL * USBHAL::instance;
@@ -65,7 +68,8 @@ typedef struct BDT {
6568
// there are:
6669
// * 16 bidirectionnal endpt -> 32 physical endpt
6770
// * as there are ODD and EVEN buffer -> 32*2 bdt
68-
__attribute__((__aligned__(512))) BDT bdt[NUMBER_OF_PHYSICAL_ENDPOINTS * 2];
71+
MBED_ALIGN(512) BDT bdt[NUMBER_OF_PHYSICAL_ENDPOINTS * 2]; // 512 bytes aligned!
72+
6973
uint8_t * endpoint_buffer[(NUMBER_OF_PHYSICAL_ENDPOINTS - 2) * 2];
7074
uint8_t * endpoint_buffer_iso[2*2];
7175

@@ -86,7 +90,7 @@ USBHAL::USBHAL(void) {
8690
// Disable IRQ
8791
NVIC_DisableIRQ(USB0_IRQn);
8892

89-
#if defined(TARGET_K64F)
93+
#if (defined(FSL_FEATURE_SOC_MPU_COUNT) && (FSL_FEATURE_SOC_MPU_COUNT > 0U))
9094
MPU->CESR=0;
9195
#endif
9296
// fill in callback array
@@ -121,18 +125,9 @@ USBHAL::USBHAL(void) {
121125
epCallback[28] = &USBHAL::EP15_OUT_callback;
122126
epCallback[29] = &USBHAL::EP15_IN_callback;
123127

124-
#if defined(TARGET_KL43Z)
128+
#if defined(TARGET_KL43Z) || defined(TARGET_K22F) || defined(TARGET_K64F)
125129
// enable USBFS clock
126-
SIM->SCGC4 |= SIM_SCGC4_USBFS_MASK;
127-
128-
// enable the IRC48M clock
129-
USB0->CLK_RECOVER_IRC_EN |= USB_CLK_RECOVER_IRC_EN_IRC_EN_MASK;
130-
131-
// enable the USB clock recovery tuning
132-
USB0->CLK_RECOVER_CTRL |= USB_CLK_RECOVER_CTRL_CLOCK_RECOVER_EN_MASK;
133-
134-
// choose usb src clock
135-
SIM->SOPT2 |= SIM_SOPT2_USBSRC_MASK;
130+
CLOCK_EnableUsbfs0Clock(kCLOCK_UsbSrcIrc48M, 48000000U);
136131
#else
137132
// choose usb src as PLL
138133
SIM->SOPT2 &= ~SIM_SOPT2_PLLFLLSEL_MASK;
@@ -148,10 +143,6 @@ USBHAL::USBHAL(void) {
148143
NVIC_EnableIRQ(USB0_IRQn);
149144

150145
// USB Module Configuration
151-
// Reset USB Module
152-
USB0->USBTRC0 |= USB_USBTRC0_USBRESET_MASK;
153-
while(USB0->USBTRC0 & USB_USBTRC0_USBRESET_MASK);
154-
155146
// Set BDT Base Register
156147
USB0->BDTPAGE1 = (uint8_t)((uint32_t)bdt>>8);
157148
USB0->BDTPAGE2 = (uint8_t)((uint32_t)bdt>>16);

features/unsupported/tests/mbed/sd/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#if defined(TARGET_KL25Z)
66
SDFileSystem sd(PTD2, PTD3, PTD1, PTD0, "sd");
77

8-
#elif defined(TARGET_KL46Z)
8+
#elif defined(TARGET_KL46Z) || defined(TARGET_KL43Z)
99
SDFileSystem sd(PTD6, PTD7, PTD5, PTD4, "sd");
1010

1111
#elif defined(TARGET_K64F) || defined(TARGET_K66F)

features/unsupported/tests/mbed/sd_perf_fatfs/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#if defined(TARGET_KL25Z)
88
SDFileSystem sd(PTD2, PTD3, PTD1, PTD0, "sd");
99

10-
#elif defined(TARGET_KL46Z)
10+
#elif defined(TARGET_KL46Z) || defined(TARGET_KL43Z)
1111
SDFileSystem sd(PTD6, PTD7, PTD5, PTD4, "sd");
1212

1313
#elif defined(TARGET_K64F) || defined(TARGET_K66F)

features/unsupported/tests/mbed/sd_perf_fhandle/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#if defined(TARGET_KL25Z)
88
SDFileSystem sd(PTD2, PTD3, PTD1, PTD0, "sd");
99

10-
#elif defined(TARGET_KL46Z)
10+
#elif defined(TARGET_KL46Z) || defined(TARGET_KL43Z)
1111
SDFileSystem sd(PTD6, PTD7, PTD5, PTD4, "sd");
1212

1313
#elif defined(TARGET_K64F) || defined(TARGET_K66F)

features/unsupported/tests/mbed/sd_perf_stdio/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#if defined(TARGET_KL25Z)
88
SDFileSystem sd(PTD2, PTD3, PTD1, PTD0, "sd");
99

10-
#elif defined(TARGET_KL46Z)
10+
#elif defined(TARGET_KL46Z) || defined(TARGET_KL43Z)
1111
SDFileSystem sd(PTD6, PTD7, PTD5, PTD4, "sd");
1212

1313
#elif defined(TARGET_K64F) || defined(TARGET_K66F)

tools/build_travis.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@
9898
{ "target": "K20D50M", "toolchains": "GCC_ARM", "libs": ["dsp", "fat"] },
9999
{ "target": "TEENSY3_1", "toolchains": "GCC_ARM", "libs": ["dsp", "fat"] },
100100
{ "target": "K64F", "toolchains": "GCC_ARM", "libs": ["dsp", "rtos", "usb", "fat"] },
101+
{ "target": "K22F", "toolchains": "GCC_ARM", "libs": ["dsp", "rtos", "usb", "fat"] },
101102
{ "target": "LPC4088", "toolchains": "GCC_ARM", "libs": ["dsp", "rtos", "usb", "fat"] },
102103
{ "target": "ARCH_PRO", "toolchains": "GCC_ARM", "libs": ["dsp", "rtos", "fat"] },
103104
{ "target": "LPC1549", "toolchains": "GCC_ARM", "libs": ["dsp", "rtos", "fat"] },
@@ -137,6 +138,30 @@
137138
"rtos" : ["RTOS_1", "RTOS_2", "RTOS_3"],
138139
"usb" : ["USB_1", "USB_2" ,"USB_3"],
139140
}
141+
},
142+
{"target": "K64F",
143+
"toolchains": "GCC_ARM",
144+
"tests": {"" : ["MBED_2", "MBED_10", "MBED_11", "MBED_16"],
145+
"fat" : ["MBED_A12", "PERF_1", "PERF_2", "PERF_3"],
146+
"rtos" : ["RTOS_1", "RTOS_2", "RTOS_3"],
147+
"usb" : ["USB_1", "USB_2" ,"USB_3"],
148+
}
149+
},
150+
{"target": "K22F",
151+
"toolchains": "GCC_ARM",
152+
"tests": {"" : ["MBED_2", "MBED_10", "MBED_11", "MBED_16"],
153+
"fat" : ["MBED_A12", "PERF_1", "PERF_2", "PERF_3"],
154+
"rtos" : ["RTOS_1", "RTOS_2", "RTOS_3"],
155+
"usb" : ["USB_1", "USB_2" ,"USB_3"],
156+
}
157+
},
158+
{"target": "KL43Z",
159+
"toolchains": "GCC_ARM",
160+
"tests": {"" : ["MBED_2", "MBED_10", "MBED_11", "MBED_16"],
161+
"fat" : ["MBED_A12", "PERF_1", "PERF_2", "PERF_3"],
162+
"rtos" : ["RTOS_1", "RTOS_2", "RTOS_3"],
163+
"usb" : ["USB_1", "USB_2" ,"USB_3"],
164+
}
140165
}
141166
]
142167

tools/tests.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,7 @@
730730
"automated": True,
731731
#"host_test": "wait_us_auto",
732732
"mcu": ["LPC1768", "LPC1549", "LPC11U24", "LPC812", "LPC2460", "LPC824", "SSCI824",
733-
"KL25Z", "KL05Z", "K64F", "K66F", "KL46Z", "HEXIWEAR",
733+
"KL25Z", "KL05Z", "K22F", "K64F", "K66F", "KL43Z", "KL46Z", "HEXIWEAR",
734734
"RZ_A1H", "VK_RZ_A1H", "DISCO_F407VG", "DISCO_F429ZI", "NUCLEO_F411RE", "DISCO_F469NI", "NUCLEO_F410RB", "NUCLEO_F429ZI",
735735
"NUCLEO_F401RE", "NUCLEO_F334R8", "DISCO_F334C8", "NUCLEO_F302R8", "NUCLEO_F070RB", "NUCLEO_F207ZG",
736736
"NUCLEO_L073RZ", "NUCLEO_F072RB", "NUCLEO_F091RC", "NUCLEO_L432KC", "DISCO_L476VG", "NUCLEO_L476RG",
@@ -744,7 +744,7 @@
744744
"dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, TEST_MBED_LIB],
745745
"automated": True,
746746
"mcu": ["LPC1768", "LPC1549", "LPC11U24", "LPC812", "LPC2460", "LPC824", "SSCI824",
747-
"KL25Z", "KL05Z", "K64F", "K66F", "KL46Z", "HEXIWEAR",
747+
"KL25Z", "KL05Z", "K22F", "K64F", "K66F", "KL43Z", "KL46Z", "HEXIWEAR",
748748
"RZ_A1H", "VK_RZ_A1H", "DISCO_F407VG", "DISCO_F429ZI", "NUCLEO_F411RE", "DISCO_F469NI", "NUCLEO_F410RB", "NUCLEO_F429ZI",
749749
"NUCLEO_F401RE", "NUCLEO_F334R8", "DISCO_F334C8", "NUCLEO_F302R8", "NUCLEO_F303ZE", "NUCLEO_F070RB", "NUCLEO_F207ZG",
750750
"NUCLEO_L073RZ", "NUCLEO_F072RB", "NUCLEO_F091RC", "NUCLEO_L432KC", "DISCO_L476VG", "NUCLEO_L476RG",
@@ -759,7 +759,7 @@
759759
"dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, TEST_MBED_LIB],
760760
"automated": True,
761761
"mcu": ["LPC1768", "LPC1549", "LPC11U24", "LPC812", "LPC2460", "LPC824", "SSCI824",
762-
"KL25Z", "KL05Z", "K64F", "K66F", "KL46Z", "HEXIWEAR",
762+
"KL25Z", "KL05Z", "K22F", "K64F", "K66F", "KL43Z", "KL46Z", "HEXIWEAR",
763763
"RZ_A1H", "VK_RZ_A1H", "DISCO_F407VG", "DISCO_F429ZI", "NUCLEO_F411RE", "DISCO_F469NI", "NUCLEO_F410RB", "NUCLEO_F429ZI",
764764
"NUCLEO_F401RE", "NUCLEO_F334R8", "DISCO_F334C8", "NUCLEO_F302R8", "NUCLEO_F303ZE", "NUCLEO_F070RB", "NUCLEO_F207ZG",
765765
"NUCLEO_L073RZ", "NUCLEO_F072RB", "NUCLEO_F091RC", "NUCLEO_L432KC", "DISCO_L476VG", "NUCLEO_L476RG",
@@ -775,7 +775,7 @@
775775
"dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, TEST_MBED_LIB],
776776
"automated": True,
777777
"mcu": ["LPC1768", "LPC1549", "LPC11U24", "LPC812", "LPC2460", "LPC824", "SSCI824",
778-
"KL25Z", "KL05Z", "K64F", "K66F", "KL46Z", "HEXIWEAR",
778+
"KL25Z", "KL05Z", "K22F", "K64F", "K66F", "KL43Z", "KL46Z", "HEXIWEAR",
779779
"RZ_A1H", "VK_RZ_A1H", "DISCO_F407VG", "DISCO_F429ZI", "NUCLEO_F411RE", "DISCO_F469NI", "NUCLEO_F410RB", "NUCLEO_F429ZI",
780780
"NUCLEO_F401RE", "NUCLEO_F334R8", "DISCO_F334C8", "NUCLEO_F302R8", "NUCLEO_F303ZE", "NUCLEO_F070RB", "NUCLEO_F207ZG",
781781
"NUCLEO_L073RZ", "NUCLEO_F072RB", "NUCLEO_F091RC", "NUCLEO_L432KC", "DISCO_L476VG", "NUCLEO_L476RG",
@@ -791,7 +791,7 @@
791791
"dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, TEST_MBED_LIB],
792792
"automated": True,
793793
"mcu": ["LPC1768", "LPC1549", "LPC11U24", "LPC812", "LPC2460", "LPC824", "SSCI824",
794-
"KL25Z", "KL05Z", "K64F", "K66F", "KL46Z", "HEXIWEAR",
794+
"KL25Z", "KL05Z", "K22F", "K64F", "K66F", "KL43Z", "KL46Z", "HEXIWEAR",
795795
"RZ_A1H", "VK_RZ_A1H", "DISCO_F407VG", "DISCO_F429ZI", "NUCLEO_F411RE", "DISCO_F469NI", "NUCLEO_F410RB", "NUCLEO_F429ZI",
796796
"NUCLEO_F401RE", "NUCLEO_F334R8", "DISCO_F334C8", "NUCLEO_F302R8", "NUCLEO_F303ZE", "NUCLEO_F070RB", "NUCLEO_F207ZG",
797797
"NUCLEO_L073RZ", "NUCLEO_F072RB", "NUCLEO_F091RC", "NUCLEO_L432KC", "DISCO_L476VG", "NUCLEO_L476RG",
@@ -806,7 +806,7 @@
806806
"dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, TEST_MBED_LIB],
807807
"automated": True,
808808
"mcu": ["LPC1768", "LPC1549", "LPC11U24", "LPC812", "LPC2460", "LPC824", "SSCI824",
809-
"KL25Z", "KL05Z", "K64F", "K66F", "KL46Z", "HEXIWEAR",
809+
"KL25Z", "KL05Z", "K22F", "K64F", "K66F", "KL43Z", "KL46Z", "HEXIWEAR",
810810
"RZ_A1H", "VK_RZ_A1H", "DISCO_F407VG", "DISCO_F429ZI", "NUCLEO_F411RE", "DISCO_F469NI", "NUCLEO_F410RB", "NUCLEO_F429ZI",
811811
"NUCLEO_F401RE", "NUCLEO_F334R8", "DISCO_F334C8", "NUCLEO_F302R8", "NUCLEO_F303ZE", "NUCLEO_F070RB", "NUCLEO_F207ZG",
812812
"NUCLEO_L073RZ", "NUCLEO_F072RB", "NUCLEO_F091RC", "NUCLEO_L432KC", "DISCO_L476VG", "NUCLEO_L476RG",
@@ -822,7 +822,7 @@
822822
"automated": True,
823823
#"host_test": "wait_us_auto",
824824
"mcu": ["LPC1768", "LPC1549", "LPC11U24", "LPC812", "LPC2460", "LPC824", "SSCI824",
825-
"KL25Z", "KL05Z", "K64F", "K66F", "KL46Z", "HEXIWEAR",
825+
"KL25Z", "KL05Z", "K22F", "K64F", "K66F", "KL43Z", "KL46Z", "HEXIWEAR",
826826
"RZ_A1H", "VK_RZ_A1H", "DISCO_F407VG", "DISCO_F429ZI", "NUCLEO_F411RE", "DISCO_F469NI", "NUCLEO_F410RB", "NUCLEO_F429ZI",
827827
"NUCLEO_F401RE", "NUCLEO_F334R8", "DISCO_F334C8", "NUCLEO_F302R8", "NUCLEO_F303ZE", "NUCLEO_F070RB", "NUCLEO_F207ZG",
828828
"NUCLEO_L073RZ", "NUCLEO_F072RB", "NUCLEO_F091RC", "NUCLEO_L432KC", "DISCO_L476VG", "NUCLEO_L476RG",
@@ -837,7 +837,7 @@
837837
"dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, TEST_MBED_LIB],
838838
"automated": True,
839839
"mcu": ["LPC1768", "LPC1549", "LPC11U24", "LPC812", "LPC2460", "LPC824", "SSCI824",
840-
"KL25Z", "KL05Z", "K64F", "K66F", "KL46Z", "HEXIWEAR",
840+
"KL25Z", "KL05Z", "K22F", "K64F", "K66F", "KL43Z", "KL46Z", "HEXIWEAR",
841841
"RZ_A1H", "VK_RZ_A1H", "DISCO_F407VG", "DISCO_F429ZI", "NUCLEO_F411RE", "DISCO_F469NI", "NUCLEO_F410RB", "NUCLEO_F429ZI",
842842
"NUCLEO_F401RE", "NUCLEO_F334R8", "DISCO_F334C8", "NUCLEO_F302R8", "NUCLEO_F303ZE", "NUCLEO_F070RB", "NUCLEO_F207ZG",
843843
"NUCLEO_L073RZ", "NUCLEO_F072RB", "NUCLEO_F091RC", "NUCLEO_L432KC", "DISCO_L476VG", "NUCLEO_L476RG",

0 commit comments

Comments
 (0)