Skip to content

Commit 9f0849d

Browse files
Merge remote-tracking branch 'upstream/master'
2 parents 1243bb3 + 1da17bd commit 9f0849d

File tree

680 files changed

+252217
-13390
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

680 files changed

+252217
-13390
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ NXP:
4242
* [DipCortex-M0](https://mbed.org/platforms/DipCortex-M0/) (Cortex-M0)
4343
* [DipCortex-M3](https://mbed.org/platforms/DipCortex-M3/) (Cortex-M3)
4444
* [BlueBoard-LPC11U24](https://mbed.org/platforms/BlueBoard-LPC11U24/) (Cortex-M0)
45+
* LPCCAPPUCCINO (Cortex-M0)
4546

4647
Freescale:
4748
* FRDM-K20D50M (Cortex-M4)

libraries/USBDevice/USBDevice/USBEndpoints.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ typedef enum {
3939
/* Include configuration for specific target */
4040
#if defined(TARGET_LPC1768) || defined(TARGET_LPC2368) || defined(TARGET_LPC4088)
4141
#include "USBEndpoints_LPC17_LPC23.h"
42-
#elif defined(TARGET_LPC11UXX) || defined(TARGET_LPC1347) || defined (TARGET_LPC11U6X)
42+
#elif defined(TARGET_LPC11UXX) || defined(TARGET_LPC1347) || defined (TARGET_LPC11U6X) || defined (TARGET_LPC1549)
4343
#include "USBEndpoints_LPC11U.h"
4444
#elif defined(TARGET_KL25Z) | defined(TARGET_KL46Z) | defined(TARGET_K20D5M) | defined(TARGET_K64F)
4545
#include "USBEndpoints_KL25Z.h"

libraries/USBDevice/USBDevice/USBHAL_LPC11U.cpp

Lines changed: 46 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1717
*/
1818

19-
#if defined(TARGET_LPC11U24) || defined(TARGET_LPC11U35_401) || defined(TARGET_LPC1347) || defined(TARGET_LPC11U35_501) || defined(TARGET_LPC11U68)
19+
#if defined(TARGET_LPC11U24) || defined(TARGET_LPC11U35_401) || defined(TARGET_LPC1347) || defined(TARGET_LPC11U35_501) || defined(TARGET_LPC11U68) || defined(TARGET_LPC1549)
2020

21-
#if defined(TARGET_LPC1347)
21+
#if defined(TARGET_LPC1347) || defined(TARGET_LPC1549)
2222
#define USB_IRQ USB_IRQ_IRQn
2323
#elif defined(TARGET_LPC11U24) || defined(TARGET_LPC11U35_401) || defined(TARGET_LPC11U35_501) || defined(TARGET_LPC11U68)
2424
#define USB_IRQ USB_IRQn
@@ -27,6 +27,9 @@
2727
#include "USBHAL.h"
2828

2929
USBHAL * USBHAL::instance;
30+
#if defined(TARGET_LPC1549)
31+
static uint8_t usbmem[2048] __attribute__((aligned(2048)));
32+
#endif
3033

3134
// Valid physical endpoint numbers are 0 to (NUMBER_OF_PHYSICAL_ENDPOINTS-1)
3235
#define LAST_PHYSICAL_ENDPOINT (NUMBER_OF_PHYSICAL_ENDPOINTS-1)
@@ -42,12 +45,21 @@ USBHAL * USBHAL::instance;
4245
#define OUT_EP(endpoint) ((endpoint) & 1U ? false : true)
4346

4447
// USB RAM
48+
#if defined(TARGET_LPC1549)
49+
#define USB_RAM_START ((uint32_t)usbmem)
50+
#define USB_RAM_SIZE sizeof(usbmem)
51+
#else
4552
#define USB_RAM_START (0x20004000)
4653
#define USB_RAM_SIZE (0x00000800)
54+
#endif
4755

4856
// SYSAHBCLKCTRL
57+
#if defined(TARGET_LPC1549)
58+
#define CLK_USB (1UL<<23)
59+
#else
4960
#define CLK_USB (1UL<<14)
5061
#define CLK_USBRAM (1UL<<27)
62+
#endif
5163

5264
// USB Information register
5365
#define FRAME_NR(a) ((a) & 0x7ff) // Frame number
@@ -145,6 +157,37 @@ USBHAL::USBHAL(void) {
145157
epCallback[6] = &USBHAL::EP4_OUT_callback;
146158
epCallback[7] = &USBHAL::EP4_IN_callback;
147159

160+
#if defined(TARGET_LPC1549)
161+
/* Set USB PLL input to system oscillator */
162+
LPC_SYSCON->USBPLLCLKSEL = 0x01;
163+
164+
/* Setup USB PLL (FCLKIN = 12MHz) * 4 = 48MHz
165+
MSEL = 3 (this is pre-decremented), PSEL = 1 (for P = 2)
166+
FCLKOUT = FCLKIN * (MSEL + 1) = 12MHz * 4 = 48MHz
167+
FCCO = FCLKOUT * 2 * P = 48MHz * 2 * 2 = 192MHz (within FCCO range) */
168+
LPC_SYSCON->USBPLLCTRL = (0x3 | (1UL << 6));
169+
170+
/* Powerup USB PLL */
171+
LPC_SYSCON->PDRUNCFG &= ~(CLK_USB);
172+
173+
/* Wait for PLL to lock */
174+
while(!(LPC_SYSCON->USBPLLSTAT & 0x01));
175+
176+
/* enable USB main clock */
177+
LPC_SYSCON->USBCLKSEL = 0x02;
178+
LPC_SYSCON->USBCLKDIV = 1;
179+
180+
/* Enable AHB clock to the USB block. */
181+
LPC_SYSCON->SYSAHBCLKCTRL1 |= CLK_USB;
182+
183+
/* power UP USB Phy */
184+
LPC_SYSCON->PDRUNCFG &= ~(1UL << 9);
185+
186+
/* Reset USB block */
187+
LPC_SYSCON->PRESETCTRL1 |= (CLK_USB);
188+
LPC_SYSCON->PRESETCTRL1 &= ~(CLK_USB);
189+
190+
#else
148191
#if defined(TARGET_LPC11U35_401) || defined(TARGET_LPC11U35_501)
149192
// USB_VBUS input with pull-down
150193
LPC_IOCON->PIO0_3 = 0x00000009;
@@ -158,7 +201,7 @@ USBHAL::USBHAL(void) {
158201

159202
// Ensure device disconnected (DCON not set)
160203
LPC_USB->DEVCMDSTAT = 0;
161-
204+
#endif
162205
// to ensure that the USB host sees the device as
163206
// disconnected if the target CPU is reset.
164207
wait(0.3);

libraries/USBHost/USBHost/USBHostConf.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@
5858
*/
5959
#define USBHOST_3GMODULE 1
6060

61+
/*
62+
* Enable USB MIDI
63+
*/
64+
#define USBHOST_MIDI 1
65+
6166
/*
6267
* Maximum number of interfaces of a usb device
6368
*/

0 commit comments

Comments
 (0)