Fix packet size calculation in CDC/ACM and PL2303 USB serial drivers
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4771 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
b0c14402cf
commit
60a69157d1
@ -167,7 +167,7 @@ extern const uint16_t g_commonconfig[NCOMMON_CONFIG];
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
extern void weak_function stm32_spiinitialize(void);
|
||||
void weak_function stm32_spiinitialize(void);
|
||||
|
||||
/************************************************************************************
|
||||
* Name: stm32_usbinitialize
|
||||
@ -177,7 +177,7 @@ extern void weak_function stm32_spiinitialize(void);
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
extern void weak_function stm32_usbinitialize(void);
|
||||
void weak_function stm32_usbinitialize(void);
|
||||
|
||||
/************************************************************************************
|
||||
* Name: stm32_extcontextsave
|
||||
@ -188,7 +188,7 @@ extern void weak_function stm32_usbinitialize(void);
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_STM32_FSMC
|
||||
extern void stm32_extcontextsave(struct extmem_save_s *save);
|
||||
void stm32_extcontextsave(struct extmem_save_s *save);
|
||||
|
||||
/************************************************************************************
|
||||
* Name: stm32_extcontextrestore
|
||||
@ -198,7 +198,7 @@ extern void stm32_extcontextsave(struct extmem_save_s *save);
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
extern void stm32_extcontextrestore(struct extmem_save_s *restore);
|
||||
void stm32_extcontextrestore(struct extmem_save_s *restore);
|
||||
|
||||
/************************************************************************************
|
||||
* Name: stm32_extmemgpios
|
||||
@ -208,7 +208,7 @@ extern void stm32_extcontextrestore(struct extmem_save_s *restore);
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
extern void stm32_extmemgpios(const uint16_t *gpios, int ngpios);
|
||||
void stm32_extmemgpios(const uint16_t *gpios, int ngpios);
|
||||
|
||||
/************************************************************************************
|
||||
* Name: stm32_enablefsmc
|
||||
@ -218,7 +218,7 @@ extern void stm32_extmemgpios(const uint16_t *gpios, int ngpios);
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
extern void stm32_enablefsmc(void);
|
||||
void stm32_enablefsmc(void);
|
||||
|
||||
/************************************************************************************
|
||||
* Name: stm32_disablefsmc
|
||||
@ -228,7 +228,7 @@ extern void stm32_enablefsmc(void);
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
extern void stm32_disablefsmc(void);
|
||||
void stm32_disablefsmc(void);
|
||||
|
||||
/************************************************************************************
|
||||
* Name: stm32_selectnor
|
||||
@ -238,7 +238,7 @@ extern void stm32_disablefsmc(void);
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
extern void stm32_selectnor(void);
|
||||
void stm32_selectnor(void);
|
||||
|
||||
/************************************************************************************
|
||||
* Name: stm32_deselectnor
|
||||
@ -248,7 +248,7 @@ extern void stm32_selectnor(void);
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
extern void stm32_deselectnor(void);
|
||||
void stm32_deselectnor(void);
|
||||
|
||||
/************************************************************************************
|
||||
* Name: stm32_selectsram
|
||||
@ -258,7 +258,7 @@ extern void stm32_deselectnor(void);
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
extern void stm32_selectsram(void);
|
||||
void stm32_selectsram(void);
|
||||
|
||||
/************************************************************************************
|
||||
* Name: stm32_deselectsram
|
||||
@ -268,7 +268,7 @@ extern void stm32_selectsram(void);
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
extern void stm32_deselectsram(void);
|
||||
void stm32_deselectsram(void);
|
||||
|
||||
/************************************************************************************
|
||||
* Name: stm32_selectlcd
|
||||
@ -278,7 +278,7 @@ extern void stm32_deselectsram(void);
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
extern void stm32_selectlcd(void);
|
||||
void stm32_selectlcd(void);
|
||||
|
||||
/************************************************************************************
|
||||
* Name: stm32_deselectlcd
|
||||
@ -288,7 +288,7 @@ extern void stm32_selectlcd(void);
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
extern void stm32_deselectlcd(void);
|
||||
void stm32_deselectlcd(void);
|
||||
|
||||
#endif /* CONFIG_STM32_FSMC */
|
||||
|
||||
|
@ -164,7 +164,17 @@
|
||||
*
|
||||
****************************************************************************************************/
|
||||
|
||||
extern void weak_function stm32_spiinitialize(void);
|
||||
void weak_function stm32_spiinitialize(void);
|
||||
|
||||
/************************************************************************************
|
||||
* Name: stm32_usbinitialize
|
||||
*
|
||||
* Description:
|
||||
* Called to setup USB-related GPIO pins for the STM3210E-EVAL board.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
void weak_function stm32_usbinitialize(void);
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __CONFIGS_STM3220G_EVAL_SRC_STM3220G_INTERNAL_H */
|
||||
|
@ -88,6 +88,18 @@ void stm32_boardinitialize(void)
|
||||
stm32_selectsram();
|
||||
#endif
|
||||
|
||||
/* Initialize USB is 1) USBDEV is selected, 2) the OTG FS controller is not
|
||||
* disabled, and 3) the weak function stm32_usbinitialize() has been brought
|
||||
* into the build.
|
||||
*/
|
||||
|
||||
#if defined(CONFIG_USBDEV) && defined(CONFIG_STM32_OTGFS)
|
||||
if (stm32_usbinitialize)
|
||||
{
|
||||
stm32_usbinitialize();
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Configure on-board LEDs if LED support has been selected. */
|
||||
|
||||
#ifdef CONFIG_ARCH_LEDS
|
||||
|
@ -212,6 +212,16 @@
|
||||
|
||||
void weak_function stm32_spiinitialize(void);
|
||||
|
||||
/************************************************************************************
|
||||
* Name: stm32_usbinitialize
|
||||
*
|
||||
* Description:
|
||||
* Called to setup USB-related GPIO pins for the STM3210E-EVAL board.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
void weak_function stm32_usbinitialize(void);
|
||||
|
||||
/************************************************************************************
|
||||
* Name: stm32_extmemgpios
|
||||
*
|
||||
@ -323,7 +333,7 @@ void stm32_deselectsram(void);
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_STM32_FSMC
|
||||
extern void stm32_selectlcd(void);
|
||||
void stm32_selectlcd(void);
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
@ -335,7 +345,7 @@ extern void stm32_selectlcd(void);
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_STM32_FSMC
|
||||
extern void stm32_deselectlcd(void);
|
||||
void stm32_deselectlcd(void);
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
|
@ -88,6 +88,18 @@ void stm32_boardinitialize(void)
|
||||
stm32_selectsram();
|
||||
#endif
|
||||
|
||||
/* Initialize USB is 1) USBDEV is selected, 2) the OTG FS controller is not
|
||||
* disabled, and 3) the weak function stm32_usbinitialize() has been brought
|
||||
* into the build.
|
||||
*/
|
||||
|
||||
#if defined(CONFIG_USBDEV) && defined(CONFIG_STM32_OTGFS)
|
||||
if (stm32_usbinitialize)
|
||||
{
|
||||
stm32_usbinitialize();
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Configure on-board LEDs if LED support has been selected. */
|
||||
|
||||
#ifdef CONFIG_ARCH_LEDS
|
||||
|
@ -579,7 +579,12 @@ MAPPING TO STM32 F4:
|
||||
the STMPS2141STR IC power switch that drives the OTG FS host VBUS.
|
||||
4 Also the reset pin for the CS43L22 audio Codec.
|
||||
|
||||
MAPPING of similar LCD in Arduino (write-only):
|
||||
NOTE: The configuration to test this LCD configuration is available at
|
||||
configs/stm32f4discover/nxlines. As of this writing, I have not seen the
|
||||
LCD working so I probaby have some things wrong.
|
||||
|
||||
I might need to use a bit-baning interface. Below is the pin configurationf
|
||||
of a similar LCD to support a (write-only), bit banging interface:
|
||||
|
||||
LCD PIN BOARD CONNECTION
|
||||
LEDA 5V
|
||||
@ -593,8 +598,9 @@ MAPPING of similar LCD in Arduino (write-only):
|
||||
CS Pin configured as output
|
||||
RSET Pin configured as output
|
||||
|
||||
Arduino bit banging interface:
|
||||
The following summarize the bit banging oprations:
|
||||
|
||||
/* Rese the LCD */
|
||||
void Reset(void)
|
||||
{
|
||||
Set RSET output
|
||||
@ -604,6 +610,7 @@ Arduino bit banging interface:
|
||||
Set RSET output
|
||||
}
|
||||
|
||||
/* Write 16-bits of whatever */
|
||||
void Write16(uint8_t ms, uint8_t ls)
|
||||
{
|
||||
Set port A to ms
|
||||
@ -613,19 +620,22 @@ Arduino bit banging interface:
|
||||
Set WR pin
|
||||
}
|
||||
|
||||
/* Set the index register to an LCD register address */
|
||||
void Index(uint8_t address)
|
||||
{
|
||||
Clear RS
|
||||
Write16(0, address);
|
||||
}
|
||||
|
||||
/* Write data to the LCD register or GRAM memory */
|
||||
void WriteData(uin16_t data)
|
||||
{
|
||||
Set RS
|
||||
Write16(data >> 8, data & 0xff);
|
||||
}
|
||||
|
||||
void WriteRegiser(uint8_t address, uint16_t data)
|
||||
/* Write to a register */
|
||||
void WriteRegister(uint8_t address, uint16_t data)
|
||||
{
|
||||
Index(address);
|
||||
WriteData(data);
|
||||
@ -901,8 +911,9 @@ Where <subdir> is one of the following:
|
||||
examples/ostest. By default, this project assumes that you are
|
||||
using the DFU bootloader.
|
||||
|
||||
CONFIG_STM32_CODESOURCERYW=y : CodeSourcery under Windows
|
||||
Default toolchain:
|
||||
|
||||
CONFIG_STM32_CODESOURCERYL=y : CodeSourcery under Linux / Mac OS X
|
||||
|
||||
If you use the Atollic toolchain, then the FPU test can be enabled in the
|
||||
examples/ostest by adding the following your NuttX configuration file:
|
||||
@ -937,6 +948,8 @@ Where <subdir> is one of the following:
|
||||
Configures the NuttShell (nsh) located at apps/examples/nsh. The
|
||||
Configuration enables both the serial and telnet NSH interfaces.
|
||||
|
||||
Default toolchain:
|
||||
|
||||
CONFIG_STM32_CODESOURCERYL=y : CodeSourcery under Linux / Mac OS X
|
||||
|
||||
NOTES:
|
||||
@ -984,6 +997,13 @@ Where <subdir> is one of the following:
|
||||
|
||||
The IWDG timer has a range of about 35 seconds and should not be an issue.
|
||||
|
||||
4. USB Support (CDC/ACM device)
|
||||
|
||||
CONFIG_STM32_OTGFS=y : STM32 OTG FS support
|
||||
CONFIG_USBDEV=y : USB device support must be enabled
|
||||
CONFIG_CDCACM=y : The CDC/ACM driver must be built
|
||||
CONFIG_NSH_BUILTIN_APPS : NSH built-in application support must be enabled
|
||||
|
||||
nxlines:
|
||||
------
|
||||
An example using the NuttX graphics system (NX). This example focuses on
|
||||
@ -999,3 +1019,9 @@ Where <subdir> is one of the following:
|
||||
some issues with how some of the dedicated FSMC pins are used on the
|
||||
boards. This configuration may not be useful and may only serve as
|
||||
an illustration of how to build for th SSD1289 LCD.
|
||||
|
||||
Default toolchain:
|
||||
|
||||
CONFIG_STM32_CODESOURCERYW=y : CodeSourcery under Windows
|
||||
|
||||
NOTE: As of this writing, I have not seen the LCD work!
|
||||
|
@ -1213,6 +1213,24 @@ CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
|
||||
# CONFIG_NSH_ROMFSETC - Use startup script in /etc
|
||||
# CONFIG_NSH_CONSOLE - Use serial console front end
|
||||
# CONFIG_NSH_TELNET - Use telnetd console front end
|
||||
# CONFIG_NSH_USBCONSOLE - If defined, then the an arbitrary USB device may be
|
||||
# used to as the NSH console. In this case, CONFIG_NSH_CONDEV must be
|
||||
# defined to indicate which USB device to use as the console.
|
||||
# CONFIG_NSH_USBCONDEV - If CONFIG_NSH_USBCONSOLE is set to 'y', then
|
||||
# CONFIG_NSH_USBCONDEV must also be set to select the USB device used to
|
||||
# support the NSH console. This should be set to the quoted name of a
|
||||
# readable/write-able USB driver such as: CONFIG_NSH_USBCONDEV="/dev/ttyACM0".
|
||||
# CONFIG_NSH_UBSDEV_MINOR - The minor device number of the USB device.
|
||||
# Default: 0
|
||||
# CONFIG_NSH_UBSDEV_TRACEINIT - Bit set with each bit enabling a trace option
|
||||
# (see include/nuttx/usb/usbdev_trace.h). Default: Only USB errors are traced.
|
||||
# CONFIG_NSH_CONDEV - If CONFIG_NSH_CONSOLE is set to 'y', then CONFIG_NSH_CONDEV
|
||||
# may also be set to select the serial device used to support the NSH console.
|
||||
# This should be set to the quoted name of a readable/write-able character
|
||||
# driver such as: CONFIG_NSH_CONDEV="/dev/ttyS1". This is useful, for example,
|
||||
# to separate the NSH command line from the system console when the system
|
||||
# console is used to provide debug output. Default: stdin and stdout (probably
|
||||
# "/dev/console")
|
||||
# CONFIG_NSH_ARCHINIT - Platform provides architecture
|
||||
# specific initialization (nsh_archinitialize()).
|
||||
#
|
||||
@ -1244,6 +1262,11 @@ CONFIG_NSH_DISABLEBG=n
|
||||
CONFIG_NSH_ROMFSETC=n
|
||||
CONFIG_NSH_CONSOLE=y
|
||||
CONFIG_NSH_TELNET=n
|
||||
CONFIG_NSH_USBCONSOLE=n
|
||||
CONFIG_NSH_USBCONDEV="/dev/ttyACM0"
|
||||
CONFIG_NSH_UBSDEV_MINOR=0
|
||||
#CONFIG_NSH_UBSDEV_TRACEINIT
|
||||
#CONFIG_NSH_CONDEV
|
||||
CONFIG_NSH_ARCHINIT=n
|
||||
CONFIG_NSH_IOBUFFER_SIZE=512
|
||||
CONFIG_NSH_DHCPC=n
|
||||
|
@ -131,6 +131,16 @@
|
||||
|
||||
void weak_function stm32_spiinitialize(void);
|
||||
|
||||
/************************************************************************************
|
||||
* Name: stm32_usbinitialize
|
||||
*
|
||||
* Description:
|
||||
* Called to setup USB-related GPIO pins for the STM3210E-EVAL board.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
void weak_function stm32_usbinitialize(void);
|
||||
|
||||
/************************************************************************************
|
||||
* Name: stm32_extmemgpios
|
||||
*
|
||||
|
@ -82,6 +82,18 @@ void stm32_boardinitialize(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Initialize USB is 1) USBDEV is selected, 2) the OTG FS controller is not
|
||||
* disabled, and 3) the weak function stm32_usbinitialize() has been brought
|
||||
* into the build.
|
||||
*/
|
||||
|
||||
#if defined(CONFIG_USBDEV) && defined(CONFIG_STM32_OTGFS)
|
||||
if (stm32_usbinitialize)
|
||||
{
|
||||
stm32_usbinitialize();
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Configure on-board LEDs if LED support has been selected. */
|
||||
|
||||
#ifdef CONFIG_ARCH_LEDS
|
||||
|
Loading…
Reference in New Issue
Block a user