Skip to content

Commit

Permalink
Add CDC break support (untested)
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-dewar committed Nov 7, 2023
1 parent 677ab91 commit 8ec81db
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 1 deletion.
5 changes: 5 additions & 0 deletions microfw/CW310/src/config/conf_usb.h
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,11 @@ bool main_setup_in_received(void);
#define UDI_VENDOR_SETUP_OUT_RECEIVED() main_setup_out_received()
#define UDI_VENDOR_SETUP_IN_RECEIVED() main_setup_in_received()

bool naeusb_cdc_handle_send_break(uint8_t port, uint16_t wValue);

#define UDI_CDC_HANDLE_SEND_BREAK(port, wValue) naeusb_cdc_handle_send_break(port, wValue)


//! endpoints size for full speed
//! Note: Disable the endpoints of a type, if size equal 0
#define UDI_VENDOR_EPS_SIZE_INT_FS 0 /*64*/
Expand Down
4 changes: 4 additions & 0 deletions microfw/CW310/src/main_cw310.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ int usb_pd_soft_reset(void);
void usb_pwr_setup(void);
void check_power_state(void);

uint8_t FPGA_PINS_ON = 0;

void fpga_pins(bool enabled)
{
gpio_configure_pin(PIN_FPGA_DONE_GPIO, PIN_FPGA_DONE_FLAGS);
Expand All @@ -54,6 +56,7 @@ void fpga_pins(bool enabled)
//gpio_configure_pin(PIO_PB18_IDX, PIO_OUTPUT_0);

if (enabled){
FPGA_PINS_ON = 1;
#ifdef CONF_BOARD_PCK0
gpio_configure_pin(PIN_PCK0, PIN_PCK0_FLAGS);
#endif
Expand Down Expand Up @@ -118,6 +121,7 @@ void fpga_pins(bool enabled)
//gpio_configure_pin(SPI_SPCK_GPIO, SPI_SPCK_FLAGS); /* TODO: Add back */

} else {
FPGA_PINS_ON = 0;
#ifdef CONF_BOARD_PCK0
gpio_configure_pin(PIN_PCK0, PIO_INPUT);
#endif
Expand Down
3 changes: 3 additions & 0 deletions microfw/CW310/src/main_cw340.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ void fpga_pins(bool enabled);
void usb_pwr_setup(void);
void check_power_state(void);

uint8_t FPGA_PINS_ON = 0;
/*
If enabled, configure FPGA pins as their default
Expand All @@ -62,6 +63,7 @@ void fpga_pins(bool enabled)
//gpio_configure_pin(PIO_PB18_IDX, PIO_OUTPUT_0);

if (enabled){
FPGA_PINS_ON = 1;
#ifdef CONF_BOARD_PCK0
gpio_configure_pin(PIN_PCK0, PIN_PCK0_FLAGS);
#endif
Expand Down Expand Up @@ -112,6 +114,7 @@ void fpga_pins(bool enabled)
//gpio_configure_pin(SPI_SPCK_GPIO, SPI_SPCK_FLAGS); /* TODO: Add back */

} else {
FPGA_PINS_ON = 0;
// high-z FPGA pins to avoid powering the FPGA thru these pins
#ifdef CONF_BOARD_PCK0
gpio_configure_pin(PIN_PCK0, PIO_INPUT);
Expand Down
2 changes: 1 addition & 1 deletion microfw/CW310/src/naeusb
1 change: 1 addition & 0 deletions microfw/CW310/src/naeusb_board_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -502,4 +502,5 @@ void kill_fpga_power(void);

#endif /* CW305_PLUS_PINS_H_ */

extern uint8_t FPGA_PINS_ON;
#endif

0 comments on commit 8ec81db

Please sign in to comment.