-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rewrite of NCM device driver #2227
Merged
Merged
Changes from 19 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
fca08c9
files taken from yapicoprobe
rgrr d5da303
moved some declarations
rgrr e4c18c1
Copyright
rgrr 2810732
bug fix recv/xmit_get_next_ready_ntb()
rgrr 2c1addf
defined(ECLIPSE_GUI)
rgrr 1dd9fa3
code review: changed to TinyUSB log system
rgrr 92025b0
code review: add NCM options in example config
rgrr 51ea467
removed debug comment
rgrr 745c154
ECM/RNDIS again selected for webserver example
rgrr f1d3663
minor changes to comments and debug output
rgrr a298523
Merge remote-tracking branch 'upstream/master' into pr/2227
HiFiPhile 327e3ec
Stall unsupported class request.
HiFiPhile ea55537
minor changes due to CR with HiFiPhile
rgrr cc70958
mostly comments
rgrr 45d450d
Merge remote-tracking branch 'remotes/tinyusb/master' into pr/2227
HiFiPhile 91d69fa
Reformat NCM class.
HiFiPhile d25ee82
Reformat net_lwip_webserver example.
HiFiPhile 63d5103
Increase TCP_WND for better performance.
HiFiPhile 0f4ea8e
Enable NCM + iperf for MCU with bigger RAM.
HiFiPhile e5d92c4
Fix CI.
HiFiPhile File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,21 +27,23 @@ | |
#define _TUSB_CONFIG_H_ | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
extern "C" { | ||
#endif | ||
|
||
#include "lwipopts.h" | ||
|
||
//--------------------------------------------------------------------+ | ||
// Board Specific Configuration | ||
//--------------------------------------------------------------------+ | ||
|
||
// RHPort number used for device can be defined by board.mk, default to port 0 | ||
#ifndef BOARD_TUD_RHPORT | ||
#define BOARD_TUD_RHPORT 0 | ||
#define BOARD_TUD_RHPORT 0 | ||
#endif | ||
|
||
// RHPort max operational speed can defined by board.mk | ||
#ifndef BOARD_TUD_MAX_SPEED | ||
#define BOARD_TUD_MAX_SPEED OPT_MODE_DEFAULT_SPEED | ||
#define BOARD_TUD_MAX_SPEED OPT_MODE_DEFAULT_SPEED | ||
#endif | ||
|
||
//-------------------------------------------------------------------- | ||
|
@@ -50,22 +52,22 @@ | |
|
||
// defined by compiler flags for flexibility | ||
#ifndef CFG_TUSB_MCU | ||
#error CFG_TUSB_MCU must be defined | ||
#error CFG_TUSB_MCU must be defined | ||
#endif | ||
|
||
#ifndef CFG_TUSB_OS | ||
#define CFG_TUSB_OS OPT_OS_NONE | ||
#define CFG_TUSB_OS OPT_OS_NONE | ||
#endif | ||
|
||
#ifndef CFG_TUSB_DEBUG | ||
#define CFG_TUSB_DEBUG 0 | ||
#define CFG_TUSB_DEBUG 0 | ||
#endif | ||
|
||
// Enable Device stack | ||
#define CFG_TUD_ENABLED 1 | ||
#define CFG_TUD_ENABLED 1 | ||
|
||
// Default is max speed that hardware controller could support with on-chip PHY | ||
#define CFG_TUD_MAX_SPEED BOARD_TUD_MAX_SPEED | ||
#define CFG_TUD_MAX_SPEED BOARD_TUD_MAX_SPEED | ||
|
||
/* USB DMA on some MCUs can only access a specific SRAM region with restriction on alignment. | ||
* Tinyusb use follows macros to declare transferring memory so that they can be put | ||
|
@@ -75,30 +77,64 @@ | |
* - CFG_TUSB_MEM_ALIGN : __attribute__ ((aligned(4))) | ||
*/ | ||
#ifndef CFG_TUSB_MEM_SECTION | ||
#define CFG_TUSB_MEM_SECTION | ||
#define CFG_TUSB_MEM_SECTION | ||
#endif | ||
|
||
#ifndef CFG_TUSB_MEM_ALIGN | ||
#define CFG_TUSB_MEM_ALIGN __attribute__ ((aligned(4))) | ||
#define CFG_TUSB_MEM_ALIGN __attribute__((aligned(4))) | ||
#endif | ||
|
||
// Use different configurations to test all net devices (also due to resource limitations) | ||
#if TU_CHECK_MCU(OPT_MCU_LPC15XX, OPT_MCU_LPC40XX, OPT_MCU_LPC51UXX, OPT_MCU_LPC54) | ||
#define USE_ECM 1 | ||
#elif TU_CHECK_MCU(OPT_MCU_SAMD21, OPT_MCU_SAML21, OPT_MCU_SAML22) | ||
#define USE_ECM 1 | ||
#elif TU_CHECK_MCU(OPT_MCU_STM32F0, OPT_MCU_STM32F1) | ||
#define USE_ECM 1 | ||
#else | ||
#define USE_ECM 0 | ||
#define INCLUDE_IPERF | ||
#endif | ||
|
||
//-------------------------------------------------------------------- | ||
// NCM CLASS CONFIGURATION, SEE "ncm.h" FOR PERFORMANCE TUNNING | ||
//-------------------------------------------------------------------- | ||
|
||
// Must be >> MTU | ||
// Can be set to 2048 without impact | ||
#define CFG_TUD_NCM_IN_NTB_MAX_SIZE (2 * TCP_MSS + 100) | ||
|
||
// Must be >> MTU | ||
// Can be set to smaller values if wNtbOutMaxDatagrams==1 | ||
#define CFG_TUD_NCM_OUT_NTB_MAX_SIZE (2 * TCP_MSS + 100) | ||
|
||
// Number of NCM transfer blocks for reception side | ||
#ifndef CFG_TUD_NCM_OUT_NTB_N | ||
#define CFG_TUD_NCM_OUT_NTB_N 1 | ||
#endif | ||
|
||
// Number of NCM transfer blocks for transmission side | ||
#ifndef CFG_TUD_NCM_IN_NTB_N | ||
#define CFG_TUD_NCM_IN_NTB_N 1 | ||
#endif | ||
|
||
//-------------------------------------------------------------------- | ||
// DEVICE CONFIGURATION | ||
//-------------------------------------------------------------------- | ||
|
||
#ifndef CFG_TUD_ENDPOINT0_SIZE | ||
#define CFG_TUD_ENDPOINT0_SIZE 64 | ||
#define CFG_TUD_ENDPOINT0_SIZE 64 | ||
#endif | ||
|
||
//------------- CLASS -------------// | ||
|
||
// Network class has 2 drivers: ECM/RNDIS and NCM. | ||
// Only one of the drivers can be enabled | ||
#define CFG_TUD_ECM_RNDIS 1 | ||
#define CFG_TUD_NCM (1-CFG_TUD_ECM_RNDIS) | ||
#define CFG_TUD_ECM_RNDIS USE_ECM | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. #2242 is included |
||
#define CFG_TUD_NCM (1 - CFG_TUD_ECM_RNDIS) | ||
|
||
#ifdef __cplusplus | ||
} | ||
} | ||
#endif | ||
|
||
#endif /* _TUSB_CONFIG_H_ */ |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For example build I reduced both NTBs to 1 for less RAM usage, users can read ncm.h for tuning details.