Skip to content

Commit

Permalink
Merge pull request #1139 from hathach/release-0.12.0
Browse files Browse the repository at this point in the history
update changelog and increase version for 0.12.0
  • Loading branch information
hathach committed Oct 19, 2021
2 parents e927359 + 3485c82 commit 4bfab30
Show file tree
Hide file tree
Showing 9 changed files with 89 additions and 22 deletions.
3 changes: 1 addition & 2 deletions CONTRIBUTORS.rst
Expand Up @@ -177,8 +177,7 @@ Notable contributors
- Add new DCD port for Synopsys DesignWare for STM32 L4, F2, F4,
F7, H7 etc ...
- Add new DCD port for TI MSP430
- Board support for STM32F407 Discovery, STM32H743 Nucleo, pyboard
v1.1, msp\_exp430f5529lp etc ...
- Board support for STM32F407 Discovery, STM32H743 Nucleo, pyboard v1.1, msp\_exp430f5529lp etc ...


`Zixun Li <https://github.com/HiFiPhile>`__
Expand Down
33 changes: 32 additions & 1 deletion docs/info/changelog.rst
Expand Up @@ -2,6 +2,37 @@
Changelog
*********

0.12.0
======

- add CFG_TUSB_OS_INC_PATH for os include path

Device Controller Driver (DCD)
------------------------------

- Getting device stack to pass USB Compliance Verification test (chapter9, HID, MSC). Ports are tested:
nRF, SAMD 21/51, rp2040, stm32f4, Renesas RX, iMXRT, ESP32-S2/3, Kinetic KL25/32, DA146xx
- Added dcd_edpt_close_all() for switching configuration
- [Transdimension] Support dcd_edpt_xfer_fifo() with auto wrap over if fifo buffer is 4K aligned and size is multiple of 4K.
- [DA146xx] Improve vbus, reset, suspend, resume detection, and remote wakeup.

Device Stack
------------

- Add new network driver Network Control Model (CDC-NCM), update net_lwip_webserver to work with NCM (need re-configure example)
- Add new USB Video Class UVC 1.5 driver and video_capture example ((work in progress)
- Fix potential buffer overflow for HID, bluetooth drivers

Host Controller Driver (HCD)
----------------------------

No notable changes

Host Stack
----------

No notable changes

0.11.0 (2021-08-29)
===================

Expand All @@ -26,7 +57,7 @@ Synopsys
^^^^^^^^

- Fix Synopsys set address bug which could cause re-enumeration failed
- Fix for dcd_synopsys driver integer overflow in HS mode (issue #968)
- Fix dcd_synopsys driver integer overflow in HS mode (issue #968)

nRF5x
^^^^^
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/getting_started.rst
Expand Up @@ -122,7 +122,7 @@ Logger
By default log message is printed via on-board UART which is slow and take lots of CPU time comparing to USB speed. If your board support on-board/external debugger, it would be more efficient to use it for logging. There are 2 protocols:


* `LOGGER=rtt`: use [Segger RTT protocol](https://www.segger.com/products/debug-probes/j-link/technology/about-real-time-transfer/)
* `LOGGER=rtt`: use `Segger RTT protocol <https://www.segger.com/products/debug-probes/j-link/technology/about-real-time-transfer/>`_

* Cons: requires jlink as the debugger.
* Pros: work with most if not all MCUs
Expand Down
25 changes: 24 additions & 1 deletion hw/bsp/rp2040/family.cmake
Expand Up @@ -77,7 +77,6 @@ if (NOT TARGET _rp2040_family_inclusion_marker)
${TOP}/src/class/video/video_device.c
)


# Base config for host mode; wrapped by SDK's tinyusb_host
add_library(tinyusb_host_base INTERFACE)
target_sources(tinyusb_host_base INTERFACE
Expand Down Expand Up @@ -153,4 +152,28 @@ if (NOT TARGET _rp2040_family_inclusion_marker)
enable_language(C CXX ASM)
pico_sdk_init()
endfunction()

# This method must be called from the project scope to suppress known warnings in TinyUSB source files
function(suppress_tinyusb_warnings)
set_source_files_properties(
${PICO_TINYUSB_PATH}/src/tusb.c
PROPERTIES
COMPILE_FLAGS "-Wno-conversion")
set_source_files_properties(
${PICO_TINYUSB_PATH}/src/common/tusb_fifo.c
PROPERTIES
COMPILE_FLAGS "-Wno-conversion -Wno-cast-qual")
set_source_files_properties(
${PICO_TINYUSB_PATH}/src/device/usbd.c
PROPERTIES
COMPILE_FLAGS "-Wno-conversion -Wno-cast-qual -Wno-null-dereference")
set_source_files_properties(
${PICO_TINYUSB_PATH}/src/device/usbd_control.c
PROPERTIES
COMPILE_FLAGS "-Wno-conversion")
set_source_files_properties(
${PICO_TINYUSB_PATH}/src/class/cdc/cdc_device.c
PROPERTIES
COMPILE_FLAGS "-Wno-conversion")
endfunction()
endif()
7 changes: 7 additions & 0 deletions src/device/dcd.h
Expand Up @@ -106,7 +106,14 @@ typedef struct TU_ATTR_ALIGNED(4)
void dcd_init (uint8_t rhport);

// Interrupt Handler
#if __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wredundant-decls"
#endif
void dcd_int_handler(uint8_t rhport);
#if __GNUC__
#pragma GCC diagnostic pop
#endif

// Enable device interrupt
void dcd_int_enable (uint8_t rhport);
Expand Down
7 changes: 7 additions & 0 deletions src/osal/osal.h
Expand Up @@ -67,6 +67,10 @@ typedef void (*osal_task_func_t)( void * );
// OSAL Porting API
//--------------------------------------------------------------------+

#if __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wredundant-decls"
#endif
//------------- Semaphore -------------//
static inline osal_semaphore_t osal_semaphore_create(osal_semaphore_def_t* semdef);
static inline bool osal_semaphore_post(osal_semaphore_t sem_hdl, bool in_isr);
Expand All @@ -84,6 +88,9 @@ static inline osal_queue_t osal_queue_create(osal_queue_def_t* qdef);
static inline bool osal_queue_receive(osal_queue_t qhdl, void* data);
static inline bool osal_queue_send(osal_queue_t qhdl, void const * data, bool in_isr);
static inline bool osal_queue_empty(osal_queue_t qhdl);
#if __GNUC__
#pragma GCC diagnostic pop
#endif

#if 0 // TODO remove subtask related macros later
// Sub Task
Expand Down
22 changes: 11 additions & 11 deletions src/portable/raspberrypi/rp2040/dcd_rp2040.c
Expand Up @@ -70,7 +70,7 @@ static struct hw_endpoint *hw_endpoint_get_by_addr(uint8_t ep_addr)
static void _hw_endpoint_alloc(struct hw_endpoint *ep, uint8_t transfer_type)
{
// size must be multiple of 64
uint16_t size = tu_div_ceil(ep->wMaxPacketSize, 64) * 64u;
uint size = tu_div_ceil(ep->wMaxPacketSize, 64) * 64u;

// double buffered Bulk endpoint
if ( transfer_type == TUSB_XFER_BULK )
Expand All @@ -88,7 +88,7 @@ static void _hw_endpoint_alloc(struct hw_endpoint *ep, uint8_t transfer_type)
pico_info(" Alloced %d bytes at offset 0x%x (0x%p)\r\n", size, dpram_offset, ep->hw_data_buf);

// Fill in endpoint control register with buffer offset
uint32_t const reg = EP_CTRL_ENABLE_BITS | (transfer_type << EP_CTRL_BUFFER_TYPE_LSB) | dpram_offset;
uint32_t const reg = EP_CTRL_ENABLE_BITS | ((uint)transfer_type << EP_CTRL_BUFFER_TYPE_LSB) | dpram_offset;

*ep->endpoint_control = reg;
}
Expand Down Expand Up @@ -177,7 +177,7 @@ static void hw_handle_buff_status(void)
uint32_t remaining_buffers = usb_hw->buf_status;
pico_trace("buf_status = 0x%08x\n", remaining_buffers);
uint bit = 1u;
for (uint i = 0; remaining_buffers && i < USB_MAX_ENDPOINTS * 2; i++)
for (uint8_t i = 0; remaining_buffers && i < USB_MAX_ENDPOINTS * 2; i++)
{
if (remaining_buffers & bit)
{
Expand Down Expand Up @@ -365,19 +365,19 @@ void dcd_init (uint8_t rhport)
dcd_connect(rhport);
}

void dcd_int_enable(uint8_t rhport)
void dcd_int_enable(__unused uint8_t rhport)
{
assert(rhport == 0);
irq_set_enabled(USBCTRL_IRQ, true);
}

void dcd_int_disable(uint8_t rhport)
void dcd_int_disable(__unused uint8_t rhport)
{
assert(rhport == 0);
irq_set_enabled(USBCTRL_IRQ, false);
}

void dcd_set_address (uint8_t rhport, uint8_t dev_addr)
void dcd_set_address (__unused uint8_t rhport, __unused uint8_t dev_addr)
{
assert(rhport == 0);

Expand All @@ -386,22 +386,22 @@ void dcd_set_address (uint8_t rhport, uint8_t dev_addr)
hw_endpoint_xfer(0x80, NULL, 0);
}

void dcd_remote_wakeup(uint8_t rhport)
void dcd_remote_wakeup(__unused uint8_t rhport)
{
pico_info("dcd_remote_wakeup %d\n", rhport);
assert(rhport == 0);
usb_hw_set->sie_ctrl = USB_SIE_CTRL_RESUME_BITS;
}

// disconnect by disabling internal pull-up resistor on D+/D-
void dcd_disconnect(uint8_t rhport)
void dcd_disconnect(__unused uint8_t rhport)
{
(void) rhport;
usb_hw_clear->sie_ctrl = USB_SIE_CTRL_PULLUP_EN_BITS;
}

// connect by enabling internal pull-up resistor on D+/D-
void dcd_connect(uint8_t rhport)
void dcd_connect(__unused uint8_t rhport)
{
(void) rhport;
usb_hw_set->sie_ctrl = USB_SIE_CTRL_PULLUP_EN_BITS;
Expand All @@ -423,7 +423,7 @@ void dcd_edpt0_status_complete(uint8_t rhport, tusb_control_request_t const * re
}
}

bool dcd_edpt_open (uint8_t rhport, tusb_desc_endpoint_t const * desc_edpt)
bool dcd_edpt_open (__unused uint8_t rhport, tusb_desc_endpoint_t const * desc_edpt)
{
assert(rhport == 0);
hw_endpoint_init(desc_edpt->bEndpointAddress, desc_edpt->wMaxPacketSize.size, desc_edpt->bmAttributes.xfer);
Expand All @@ -438,7 +438,7 @@ void dcd_edpt_close_all (uint8_t rhport)
reset_non_control_endpoints();
}

bool dcd_edpt_xfer(uint8_t rhport, uint8_t ep_addr, uint8_t * buffer, uint16_t total_bytes)
bool dcd_edpt_xfer(__unused uint8_t rhport, uint8_t ep_addr, uint8_t * buffer, uint16_t total_bytes)
{
assert(rhport == 0);
hw_endpoint_xfer(ep_addr, buffer, total_bytes);
Expand Down
10 changes: 5 additions & 5 deletions src/portable/raspberrypi/rp2040/rp2040_usb.c
Expand Up @@ -38,7 +38,7 @@ const char *ep_dir_string[] = {
"in",
};

static inline void _hw_endpoint_lock_update(struct hw_endpoint *ep, int delta) {
static inline void _hw_endpoint_lock_update(__unused struct hw_endpoint * ep, __unused int delta) {
// todo add critsec as necessary to prevent issues between worker and IRQ...
// note that this is perhaps as simple as disabling IRQs because it would make
// sense to have worker and IRQ on same core, however I think using critsec is about equivalent.
Expand Down Expand Up @@ -107,7 +107,7 @@ void _hw_endpoint_buffer_control_update32(struct hw_endpoint *ep, uint32_t and_m
static uint32_t prepare_ep_buffer(struct hw_endpoint *ep, uint8_t buf_id)
{
uint16_t const buflen = tu_min16(ep->remaining_len, ep->wMaxPacketSize);
ep->remaining_len -= buflen;
ep->remaining_len = (uint16_t)(ep->remaining_len - buflen);

uint32_t buf_ctrl = buflen | USB_BUF_CTRL_AVAIL;

Expand Down Expand Up @@ -214,15 +214,15 @@ static uint16_t sync_ep_buffer(struct hw_endpoint *ep, uint8_t buf_id)
// sent some data can increase the length we have sent
assert(!(buf_ctrl & USB_BUF_CTRL_FULL));

ep->xferred_len += xferred_bytes;
ep->xferred_len = (uint16_t)(ep->xferred_len + xferred_bytes);
}else
{
// If we have received some data, so can increase the length
// we have received AFTER we have copied it to the user buffer at the appropriate offset
assert(buf_ctrl & USB_BUF_CTRL_FULL);

memcpy(ep->user_buf, ep->hw_data_buf + buf_id*64, xferred_bytes);
ep->xferred_len += xferred_bytes;
ep->xferred_len = (uint16_t)(ep->xferred_len + xferred_bytes);
ep->user_buf += xferred_bytes;
}

Expand All @@ -242,7 +242,7 @@ static void _hw_endpoint_xfer_sync (struct hw_endpoint *ep)
// Update hw endpoint struct with info from hardware
// after a buff status interrupt

uint32_t buf_ctrl = _hw_endpoint_buffer_control_get_value32(ep);
uint32_t __unused buf_ctrl = _hw_endpoint_buffer_control_get_value32(ep);
TU_LOG(3, " Sync BufCtrl: [0] = 0x%04u [1] = 0x%04x\r\n", tu_u32_low16(buf_ctrl), tu_u32_high16(buf_ctrl));

// always sync buffer 0
Expand Down
2 changes: 1 addition & 1 deletion src/tusb_option.h
Expand Up @@ -28,7 +28,7 @@
#define _TUSB_OPTION_H_

#define TUSB_VERSION_MAJOR 0
#define TUSB_VERSION_MINOR 11
#define TUSB_VERSION_MINOR 12
#define TUSB_VERSION_REVISION 0
#define TUSB_VERSION_STRING TU_STRING(TUSB_VERSION_MAJOR) "." TU_STRING(TUSB_VERSION_MINOR) "." TU_STRING(TUSB_VERSION_REVISION)

Expand Down

0 comments on commit 4bfab30

Please sign in to comment.