refactor nrf5x mcu macro

This commit is contained in:
hathach
2018-04-12 13:14:59 +07:00
parent e1272159d8
commit 08a24ee224
7 changed files with 11 additions and 7 deletions

View File

@@ -48,6 +48,7 @@
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
//#define CFG_TUSB_MCU will be passed from IDE/command line for easy board/mcu switching //#define CFG_TUSB_MCU will be passed from IDE/command line for easy board/mcu switching
#define CFG_TUSB_MCU OPT_MCU_NRF5X
#define CFG_TUSB_CONTROLLER_0_MODE (TUSB_MODE_DEVICE) #define CFG_TUSB_CONTROLLER_0_MODE (TUSB_MODE_DEVICE)
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
@@ -78,7 +79,7 @@
// LPC11uxx and LPC13uxx requires each buffer has to be 64-byte alignment // LPC11uxx and LPC13uxx requires each buffer has to be 64-byte alignment
#if CFG_TUSB_MCU == OPT_MCU_LPC11UXX || CFG_TUSB_MCU == OPT_MCU_LPC13UXX #if CFG_TUSB_MCU == OPT_MCU_LPC11UXX || CFG_TUSB_MCU == OPT_MCU_LPC13UXX
#define CFG_TUSB_MEM_ALIGN ATTR_ALIGNED(64) #define CFG_TUSB_MEM_ALIGN ATTR_ALIGNED(64)
#elif defined NRF52840_XXAA #elif CFG_TUSB_MCU == OPT_MCU_NRF5X
#define CFG_TUSB_MEM_ALIGN ATTR_ALIGNED(4) #define CFG_TUSB_MEM_ALIGN ATTR_ALIGNED(4)
#else #else
#define CFG_TUSB_MEM_ALIGN #define CFG_TUSB_MEM_ALIGN

View File

@@ -113,7 +113,7 @@
// LPC11uxx and LPC13uxx requires each buffer has to be 64-byte alignment // LPC11uxx and LPC13uxx requires each buffer has to be 64-byte alignment
#if CFG_TUSB_MCU == OPT_MCU_LPC11UXX || CFG_TUSB_MCU == OPT_MCU_LPC13UXX #if CFG_TUSB_MCU == OPT_MCU_LPC11UXX || CFG_TUSB_MCU == OPT_MCU_LPC13UXX
#define CFG_TUSB_MEM_ALIGN ATTR_ALIGNED(64) #define CFG_TUSB_MEM_ALIGN ATTR_ALIGNED(64)
#elif defined NRF52840_XXAA #elif CFG_TUSB_MCU == OPT_MCU_NRF5X
#define CFG_TUSB_MEM_ALIGN ATTR_ALIGNED(4) #define CFG_TUSB_MEM_ALIGN ATTR_ALIGNED(4)
#else #else
#define CFG_TUSB_MEM_ALIGN #define CFG_TUSB_MEM_ALIGN

View File

@@ -66,7 +66,7 @@ typedef struct {
}cdcd_data_t; }cdcd_data_t;
// TODO multiple rhport // TODO multiple rhport
#ifdef NRF52840_XXAA #if CFG_TUSB_MCU == OPT_MCU_NRF5X
// FIXME nrf52 OUT bug ( Controller ACK data even we didn't prepare transfer ) // FIXME nrf52 OUT bug ( Controller ACK data even we didn't prepare transfer )
CFG_TUSB_ATTR_USBRAM CFG_TUSB_MEM_ALIGN uint8_t _tmp_rx_buf[1024]; CFG_TUSB_ATTR_USBRAM CFG_TUSB_MEM_ALIGN uint8_t _tmp_rx_buf[1024];
#else #else

View File

@@ -344,7 +344,7 @@ static tusb_error_t proc_control_request_st(uint8_t rhport, tusb_control_request
dcd_set_address(rhport, (uint8_t) p_request->wValue); dcd_set_address(rhport, (uint8_t) p_request->wValue);
usbd_devices[rhport].state = TUSB_DEVICE_STATE_ADDRESSED; usbd_devices[rhport].state = TUSB_DEVICE_STATE_ADDRESSED;
#ifndef NRF52840_XXAA // nrf52 auto handle set address, we must not return status #if CFG_TUSB_MCU != OPT_MCU_NRF5X // nrf5x auto handle set address, we must not return status
dcd_control_status(rhport, p_request->bmRequestType_bit.direction); dcd_control_status(rhport, p_request->bmRequestType_bit.direction);
#endif #endif
} }

View File

@@ -34,7 +34,9 @@
*/ */
/**************************************************************************/ /**************************************************************************/
#ifdef NRF52840_XXAA #include "tusb_option.h"
#if MODE_DEVICE_SUPPORTED && CFG_TUSB_MCU == OPT_MCU_NRF5X
// TODO remove // TODO remove
#include "nrf.h" #include "nrf.h"

View File

@@ -34,7 +34,9 @@
*/ */
/**************************************************************************/ /**************************************************************************/
#ifdef NRF52840_XXAA #include "tusb_option.h"
#if MODE_DEVICE_SUPPORTED && CFG_TUSB_MCU == OPT_MCU_NRF5X
#include <stdbool.h> #include <stdbool.h>
#include "nrf.h" #include "nrf.h"

View File

@@ -45,7 +45,6 @@
#define TUSB_VERSION_NAME "alpha" #define TUSB_VERSION_NAME "alpha"
#define TUSB_VERSION XSTRING_(TUSB_VERSION_YEAR) "." XSTRING_(TUSB_VERSION_MONTH) #define TUSB_VERSION XSTRING_(TUSB_VERSION_YEAR) "." XSTRING_(TUSB_VERSION_MONTH)
// TODO remove, use vendor specific flag
/** \defgroup group_mcu Supported MCU /** \defgroup group_mcu Supported MCU
* \ref CFG_TUSB_MCU must be defined to one of these * \ref CFG_TUSB_MCU must be defined to one of these
* @{ */ * @{ */