Skip to content

Commit

Permalink
WIP: enumerates, but cannot prime RX on endpoint 1 yet
Browse files Browse the repository at this point in the history
  • Loading branch information
stapelberg committed Sep 19, 2020
1 parent 6801759 commit c6d4537
Show file tree
Hide file tree
Showing 5 changed files with 432 additions and 142 deletions.
2 changes: 2 additions & 0 deletions demos/MIMXRT1062/RT-TEENSY4_1/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ include $(CHIBIOS)/test/rt/rt_test.mk
include $(CHIBIOS)/test/oslib/oslib_test.mk
# for printf
include $(CHIBIOS)/os/hal/lib/streams/streams.mk
include $(CHIBIOS)/os/various/shell/shell.mk


# Define linker script file here
LDSCRIPT= $(STARTUPLD_CONTRIB)/MIMXRT1062.ld
Expand Down
20 changes: 20 additions & 0 deletions demos/MIMXRT1062/RT-TEENSY4_1/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "rt_test_root.h"
#include "oslib_test_root.h"
#include "chprintf.h"
#include "shell.h"
#include <string.h>

#include "usbcfg.h"
Expand All @@ -41,6 +42,19 @@ static THD_FUNCTION(Thread1, arg) {
extern void printf_debug(const char *format, ...);


#define SHELL_WA_SIZE THD_WORKING_AREA_SIZE(2048)

static const ShellCommand commands[] = {
{NULL, NULL}
};

static const ShellConfig shell_cfg1 = {
(BaseSequentialStream *)&SDU1,
commands
};



/*
* Application entry point.
*/
Expand Down Expand Up @@ -99,6 +113,12 @@ int main(void) {
//test_execute((BaseSequentialStream *)MYSERIAL, &rt_test_suite);
//test_execute((BaseSequentialStream *)MYSERIAL, &oslib_test_suite);
while (true) {
if (SDU1.config->usbp->state == USB_ACTIVE) {
thread_t *shelltp = chThdCreateFromHeap(NULL, SHELL_WA_SIZE,
"shell", NORMALPRIO + 1,
shellThread, (void *)&shell_cfg1);
chThdWait(shelltp); /* Waiting termination. */
}
chThdSleepSeconds(1);
}

Expand Down
21 changes: 11 additions & 10 deletions demos/MIMXRT1062/RT-TEENSY4_1/usbcfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,16 +248,16 @@ static USBInEndpointState ep2instate;
* @brief EP2 initialization structure (IN only).
*/
static const USBEndpointConfig ep2config = {
USB_EP_MODE_TYPE_INTR,
NULL,
sduInterruptTransmitted,
NULL,
0x0010,
0x0000,
&ep2instate,
NULL,
1,
NULL
.ep_mode = USB_EP_MODE_TYPE_INTR,
.setup_cb = NULL,
.in_cb = sduInterruptTransmitted,
.out_cb = NULL,
.in_maxsize = 0x0010,
.out_maxsize = 0x0000,
.in_state = &ep2instate,
.out_state = NULL,
.ep_buffers = 1,
.setup_buf = NULL
};

/*
Expand All @@ -266,6 +266,7 @@ static const USBEndpointConfig ep2config = {
static void usb_event(USBDriver *usbp, usbevent_t event) {
extern SerialUSBDriver SDU1;

printf_debug("usbcfg.c:usb_event(event=%d)\n", event);
switch (event) {
case USB_EVENT_ADDRESS:
return;
Expand Down
Loading

0 comments on commit c6d4537

Please sign in to comment.