mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-09-28 01:18:55 +08:00
Fix packet size calculation in CDC/ACM and PL2303 USB serial drivers
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4771 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
@@ -230,3 +230,7 @@
|
|||||||
initialization interfaces.
|
initialization interfaces.
|
||||||
|
|
||||||
6.19 2012-xx-xx Gregory Nutt <gnutt@nuttx.org>
|
6.19 2012-xx-xx Gregory Nutt <gnutt@nuttx.org>
|
||||||
|
|
||||||
|
* apps/nshlib/nsh_usbdev.c: Add the capability to use an arbitrary USB
|
||||||
|
device as the console (not necessarily /dev/console). This is a useful
|
||||||
|
option because then you can still use the serial console to debug with.
|
||||||
|
|||||||
@@ -916,6 +916,33 @@ NSH-Specific Configuration Settings
|
|||||||
CDC/ACM serial device as a console device at
|
CDC/ACM serial device as a console device at
|
||||||
dev/console.
|
dev/console.
|
||||||
|
|
||||||
|
CONFIG_NSH_USBCONSOLE
|
||||||
|
If defined, then the an arbitrary USB device may be used
|
||||||
|
to as the NSH console. In this case, CONFIG_NSH_USBCONDEV
|
||||||
|
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".
|
||||||
|
|
||||||
|
If there are more than one USB devices, then a USB device
|
||||||
|
minor number may also need to be provided:
|
||||||
|
|
||||||
|
CONFIG_NSH_UBSDEV_MINOR
|
||||||
|
The minor device number of the USB device. Default: 0
|
||||||
|
|
||||||
|
If USB tracing is enabled, then NSH will initialize USB
|
||||||
|
tracing as requested by the following:
|
||||||
|
|
||||||
|
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
|
* CONFIG_NSH_CONDEV
|
||||||
If CONFIG_NSH_CONSOLE is set to 'y', then 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
|
may also be set to select the serial device used to support
|
||||||
|
|||||||
@@ -49,6 +49,8 @@
|
|||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
#include <nuttx/usb/usbdev_trace.h>
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Definitions
|
* Definitions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -79,10 +81,44 @@
|
|||||||
|
|
||||||
#undef HAVE_USB_CONSOLE
|
#undef HAVE_USB_CONSOLE
|
||||||
#if defined(CONFIG_USBDEV)
|
#if defined(CONFIG_USBDEV)
|
||||||
|
|
||||||
|
/* Check for a PL2303 serial console. Use console device "/dev/console". */
|
||||||
|
|
||||||
# if defined(CONFIG_PL2303) && defined(CONFIG_PL2303_CONSOLE)
|
# if defined(CONFIG_PL2303) && defined(CONFIG_PL2303_CONSOLE)
|
||||||
# define HAVE_USB_CONSOLE 1
|
# define HAVE_USB_CONSOLE 1
|
||||||
|
|
||||||
|
/* Check for a CDC/ACM serial console. Use console device "/dev/console". */
|
||||||
|
|
||||||
# elif defined(CONFIG_CDCACM) && defined(CONFIG_CDCACM_CONSOLE)
|
# elif defined(CONFIG_CDCACM) && defined(CONFIG_CDCACM_CONSOLE)
|
||||||
# define HAVE_USB_CONSOLE 1
|
# define HAVE_USB_CONSOLE 1
|
||||||
|
|
||||||
|
/* Check for other USB console. USB console device must be provided in CONFIG_NSH_CONDEV */
|
||||||
|
|
||||||
|
# elif defined(CONFIG_NSH_USBCONSOLE)
|
||||||
|
# define HAVE_USB_CONSOLE 1
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Defaults for the USB console */
|
||||||
|
|
||||||
|
#ifdef HAVE_USB_CONSOLE
|
||||||
|
|
||||||
|
/* The default USB console device minor number is 0*/
|
||||||
|
|
||||||
|
# ifndef CONFIG_NSH_UBSDEV_MINOR
|
||||||
|
# define CONFIG_NSH_UBSDEV_MINOR 0
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/* USB trace settings */
|
||||||
|
|
||||||
|
# ifndef CONFIG_NSH_UBSDEV_TRACEINIT
|
||||||
|
# define CONFIG_NSH_UBSDEV_TRACEINIT (TRACE_DEVERROR_BIT|TRACE_CLSERROR_BIT)
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/* The default console device is always /dev/console */
|
||||||
|
|
||||||
|
# ifndef CONFIG_NSH_USBCONDEV
|
||||||
|
# define CONFIG_NSH_USBCONDEV "/dev/console"
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -95,6 +95,10 @@ int nsh_usbconsole(void)
|
|||||||
int fd;
|
int fd;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
/* Initialize any USB tracing options that were requested */
|
||||||
|
|
||||||
|
usbtrace_enable(CONFIG_NSH_UBSDEV_TRACEINIT);
|
||||||
|
|
||||||
/* Don't start the NSH console until the console device is ready. Chances
|
/* Don't start the NSH console until the console device is ready. Chances
|
||||||
* are, we get here with no functional console. The USB console will not
|
* are, we get here with no functional console. The USB console will not
|
||||||
* be available until the device is connected to the host and until the
|
* be available until the device is connected to the host and until the
|
||||||
@@ -103,12 +107,14 @@ int nsh_usbconsole(void)
|
|||||||
|
|
||||||
/* Initialize the USB serial driver */
|
/* Initialize the USB serial driver */
|
||||||
|
|
||||||
|
#if defined(CONFIG_PL2303) || defined(CONFIG_CDCACM)
|
||||||
#ifdef CONFIG_CDCACM
|
#ifdef CONFIG_CDCACM
|
||||||
ret = cdcacm_initialize(0, NULL);
|
ret = cdcacm_initialize(CONFIG_NSH_UBSDEV_MINOR, NULL);
|
||||||
#else
|
#else
|
||||||
ret = usbdev_serialinitialize(0);
|
ret = usbdev_serialinitialize(CONFIG_NSH_UBSDEV_MINOR);
|
||||||
#endif
|
#endif
|
||||||
DEBUGASSERT(ret == OK);
|
DEBUGASSERT(ret == OK);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Make sure the stdin, stdout, and stderr are closed */
|
/* Make sure the stdin, stdout, and stderr are closed */
|
||||||
|
|
||||||
@@ -122,14 +128,16 @@ int nsh_usbconsole(void)
|
|||||||
{
|
{
|
||||||
/* Try to open the console */
|
/* Try to open the console */
|
||||||
|
|
||||||
fd = open("/dev/console", O_RDWR);
|
fd = open(CONFIG_NSH_USBCONDEV, O_RDWR);
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
{
|
{
|
||||||
|
int errval = errno;
|
||||||
|
|
||||||
/* ENOTCONN means that the USB device is not yet connected. Anything
|
/* ENOTCONN means that the USB device is not yet connected. Anything
|
||||||
* else is bad.
|
* else is bad.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
DEBUGASSERT(errno == ENOTCONN);
|
DEBUGASSERT(errval == ENOTCONN);
|
||||||
|
|
||||||
/* Sleep a bit and try again */
|
/* Sleep a bit and try again */
|
||||||
|
|
||||||
|
|||||||
+8
-2
@@ -2809,5 +2809,11 @@
|
|||||||
STM32F4Discovery for than an external, SSD1289-based LCD.
|
STM32F4Discovery for than an external, SSD1289-based LCD.
|
||||||
* configs/stm32f4discovery/nxlines: Add an STM32F4Discovery configuration
|
* configs/stm32f4discovery/nxlines: Add an STM32F4Discovery configuration
|
||||||
to thest the SSD1289-based LCD.
|
to thest the SSD1289-based LCD.
|
||||||
|
* configs/stm3240g-eval/src: Add USB GPIO initialization logic needed
|
||||||
|
in board-specific boot logic.
|
||||||
|
* configs/stm32f4discovery/src: Add USB GPIO initialization logic needed
|
||||||
|
in board-specific boot logic.
|
||||||
|
* drivers/usbdev/pl2303.c and cdcacm.c: Fix the request size used for sending
|
||||||
|
packets. It was not using the maximum request size, but instead the previous
|
||||||
|
request size. As a result, packets get smaller, and smaller, and ... This
|
||||||
|
is an important USB serial fix.
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
<tr align="center" bgcolor="#e4e4e4">
|
<tr align="center" bgcolor="#e4e4e4">
|
||||||
<td>
|
<td>
|
||||||
<h1><big><font color="#3c34ec"><i>NuttShell (NSH)</i></font></big></h1>
|
<h1><big><font color="#3c34ec"><i>NuttShell (NSH)</i></font></big></h1>
|
||||||
<p>Last Updated: March 6, 2012</p>
|
<p>Last Updated: May 25, 2012</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
@@ -2196,6 +2196,36 @@ nsh>
|
|||||||
<code>CONFIG_CDCACM</code> and <code>CONFIG_CDCACM_CONSOLE</code>.
|
<code>CONFIG_CDCACM</code> and <code>CONFIG_CDCACM_CONSOLE</code>.
|
||||||
Sets up the CDC/ACM serial device as a console device at <code>/dev/console</code>.
|
Sets up the CDC/ACM serial device as a console device at <code>/dev/console</code>.
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<code>CONFIG_NSH_USBCONSOLE</code>.
|
||||||
|
If defined, then the an arbitrary USB device may be used to as the NSH console.
|
||||||
|
In this case, <code>CONFIG_NSH_CONDEV</code> must be defined to indicate which USB device to use as the console.
|
||||||
|
The advantage of using a device other that /dev/console is that normal debug output can not use /dev/console while NSH uses <code>CONFIG_NSH_USBCONDEV</code>.
|
||||||
|
<p>
|
||||||
|
<code>CONFIG_NSH_USBCONDEV</code>.
|
||||||
|
If <code>CONFIG_NSH_USBCONSOLE</code> is set to 'y', then <code>CONFIG_NSH_USBCONDEV</code> 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: <code>CONFIG_NSH_USBCONDEV="/dev/ttyACM0"</code>.
|
||||||
|
</p>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<p>
|
||||||
|
If there are more than one USB slots, then a USB device minor number may also need to be provided:
|
||||||
|
</p>
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<code>CONFIG_NSH_UBSDEV_MINOR</code>.
|
||||||
|
The minor device number of the USB device. Default: 0
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<p>
|
||||||
|
If USB tracing is enabled, then NSH will initialize USB tracing as requested by the following:
|
||||||
|
</p>
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<code>CONFIG_NSH_UBSDEV_TRACEINIT</code>.
|
||||||
|
Bit set with each bit enabling a trace option (see <code>include/nuttx/usb/usbdev_trace.h</code>).
|
||||||
|
Default: Only USB errors are traced.
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -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
|
* 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
|
* Name: stm32_extcontextsave
|
||||||
@@ -188,7 +188,7 @@ extern void weak_function stm32_usbinitialize(void);
|
|||||||
************************************************************************************/
|
************************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_STM32_FSMC
|
#ifdef CONFIG_STM32_FSMC
|
||||||
extern void stm32_extcontextsave(struct extmem_save_s *save);
|
void stm32_extcontextsave(struct extmem_save_s *save);
|
||||||
|
|
||||||
/************************************************************************************
|
/************************************************************************************
|
||||||
* Name: stm32_extcontextrestore
|
* 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
|
* 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
|
* 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
|
* Name: stm32_disablefsmc
|
||||||
@@ -228,7 +228,7 @@ extern void stm32_enablefsmc(void);
|
|||||||
*
|
*
|
||||||
************************************************************************************/
|
************************************************************************************/
|
||||||
|
|
||||||
extern void stm32_disablefsmc(void);
|
void stm32_disablefsmc(void);
|
||||||
|
|
||||||
/************************************************************************************
|
/************************************************************************************
|
||||||
* Name: stm32_selectnor
|
* Name: stm32_selectnor
|
||||||
@@ -238,7 +238,7 @@ extern void stm32_disablefsmc(void);
|
|||||||
*
|
*
|
||||||
************************************************************************************/
|
************************************************************************************/
|
||||||
|
|
||||||
extern void stm32_selectnor(void);
|
void stm32_selectnor(void);
|
||||||
|
|
||||||
/************************************************************************************
|
/************************************************************************************
|
||||||
* Name: stm32_deselectnor
|
* Name: stm32_deselectnor
|
||||||
@@ -248,7 +248,7 @@ extern void stm32_selectnor(void);
|
|||||||
*
|
*
|
||||||
************************************************************************************/
|
************************************************************************************/
|
||||||
|
|
||||||
extern void stm32_deselectnor(void);
|
void stm32_deselectnor(void);
|
||||||
|
|
||||||
/************************************************************************************
|
/************************************************************************************
|
||||||
* Name: stm32_selectsram
|
* Name: stm32_selectsram
|
||||||
@@ -258,7 +258,7 @@ extern void stm32_deselectnor(void);
|
|||||||
*
|
*
|
||||||
************************************************************************************/
|
************************************************************************************/
|
||||||
|
|
||||||
extern void stm32_selectsram(void);
|
void stm32_selectsram(void);
|
||||||
|
|
||||||
/************************************************************************************
|
/************************************************************************************
|
||||||
* Name: stm32_deselectsram
|
* Name: stm32_deselectsram
|
||||||
@@ -268,7 +268,7 @@ extern void stm32_selectsram(void);
|
|||||||
*
|
*
|
||||||
************************************************************************************/
|
************************************************************************************/
|
||||||
|
|
||||||
extern void stm32_deselectsram(void);
|
void stm32_deselectsram(void);
|
||||||
|
|
||||||
/************************************************************************************
|
/************************************************************************************
|
||||||
* Name: stm32_selectlcd
|
* Name: stm32_selectlcd
|
||||||
@@ -278,7 +278,7 @@ extern void stm32_deselectsram(void);
|
|||||||
*
|
*
|
||||||
************************************************************************************/
|
************************************************************************************/
|
||||||
|
|
||||||
extern void stm32_selectlcd(void);
|
void stm32_selectlcd(void);
|
||||||
|
|
||||||
/************************************************************************************
|
/************************************************************************************
|
||||||
* Name: stm32_deselectlcd
|
* 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 */
|
#endif /* CONFIG_STM32_FSMC */
|
||||||
|
|
||||||
|
|||||||
@@ -88,10 +88,10 @@ void stm32_boardinitialize(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Initialize USB is 1) USBDEV is selected, 2) the USB controller is not
|
/* Initialize USB is 1) USBDEV is selected, 2) the USB controller is not
|
||||||
* disabled, and 3) the weak function stm32_usbinitialize() has been brought
|
* disabled, and 3) the weak function stm32_usbinitialize() has been brought
|
||||||
* into the build.
|
* into the build.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(CONFIG_USBDEV) && defined(CONFIG_STM32_USB)
|
#if defined(CONFIG_USBDEV) && defined(CONFIG_STM32_USB)
|
||||||
if (stm32_usbinitialize)
|
if (stm32_usbinitialize)
|
||||||
|
|||||||
@@ -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 /* __ASSEMBLY__ */
|
||||||
#endif /* __CONFIGS_STM3220G_EVAL_SRC_STM3220G_INTERNAL_H */
|
#endif /* __CONFIGS_STM3220G_EVAL_SRC_STM3220G_INTERNAL_H */
|
||||||
|
|||||||
@@ -88,6 +88,18 @@ void stm32_boardinitialize(void)
|
|||||||
stm32_selectsram();
|
stm32_selectsram();
|
||||||
#endif
|
#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. */
|
/* Configure on-board LEDs if LED support has been selected. */
|
||||||
|
|
||||||
#ifdef CONFIG_ARCH_LEDS
|
#ifdef CONFIG_ARCH_LEDS
|
||||||
|
|||||||
@@ -212,6 +212,16 @@
|
|||||||
|
|
||||||
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);
|
||||||
|
|
||||||
/************************************************************************************
|
/************************************************************************************
|
||||||
* Name: stm32_extmemgpios
|
* Name: stm32_extmemgpios
|
||||||
*
|
*
|
||||||
@@ -323,7 +333,7 @@ void stm32_deselectsram(void);
|
|||||||
************************************************************************************/
|
************************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_STM32_FSMC
|
#ifdef CONFIG_STM32_FSMC
|
||||||
extern void stm32_selectlcd(void);
|
void stm32_selectlcd(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/************************************************************************************
|
/************************************************************************************
|
||||||
@@ -335,7 +345,7 @@ extern void stm32_selectlcd(void);
|
|||||||
************************************************************************************/
|
************************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_STM32_FSMC
|
#ifdef CONFIG_STM32_FSMC
|
||||||
extern void stm32_deselectlcd(void);
|
void stm32_deselectlcd(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* __ASSEMBLY__ */
|
#endif /* __ASSEMBLY__ */
|
||||||
|
|||||||
@@ -88,6 +88,18 @@ void stm32_boardinitialize(void)
|
|||||||
stm32_selectsram();
|
stm32_selectsram();
|
||||||
#endif
|
#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. */
|
/* Configure on-board LEDs if LED support has been selected. */
|
||||||
|
|
||||||
#ifdef CONFIG_ARCH_LEDS
|
#ifdef CONFIG_ARCH_LEDS
|
||||||
|
|||||||
@@ -578,8 +578,13 @@ MAPPING TO STM32 F4:
|
|||||||
for the parallel interface if PC0 is held high (or floating). PC0 enables
|
for the parallel interface if PC0 is held high (or floating). PC0 enables
|
||||||
the STMPS2141STR IC power switch that drives the OTG FS host VBUS.
|
the STMPS2141STR IC power switch that drives the OTG FS host VBUS.
|
||||||
4 Also the reset pin for the CS43L22 audio Codec.
|
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
|
LCD PIN BOARD CONNECTION
|
||||||
LEDA 5V
|
LEDA 5V
|
||||||
@@ -593,8 +598,9 @@ MAPPING of similar LCD in Arduino (write-only):
|
|||||||
CS Pin configured as output
|
CS Pin configured as output
|
||||||
RSET 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)
|
void Reset(void)
|
||||||
{
|
{
|
||||||
Set RSET output
|
Set RSET output
|
||||||
@@ -604,6 +610,7 @@ Arduino bit banging interface:
|
|||||||
Set RSET output
|
Set RSET output
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Write 16-bits of whatever */
|
||||||
void Write16(uint8_t ms, uint8_t ls)
|
void Write16(uint8_t ms, uint8_t ls)
|
||||||
{
|
{
|
||||||
Set port A to ms
|
Set port A to ms
|
||||||
@@ -613,19 +620,22 @@ Arduino bit banging interface:
|
|||||||
Set WR pin
|
Set WR pin
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Set the index register to an LCD register address */
|
||||||
void Index(uint8_t address)
|
void Index(uint8_t address)
|
||||||
{
|
{
|
||||||
Clear RS
|
Clear RS
|
||||||
Write16(0, address);
|
Write16(0, address);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Write data to the LCD register or GRAM memory */
|
||||||
void WriteData(uin16_t data)
|
void WriteData(uin16_t data)
|
||||||
{
|
{
|
||||||
Set RS
|
Set RS
|
||||||
Write16(data >> 8, data & 0xff);
|
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);
|
Index(address);
|
||||||
WriteData(data);
|
WriteData(data);
|
||||||
@@ -901,8 +911,9 @@ Where <subdir> is one of the following:
|
|||||||
examples/ostest. By default, this project assumes that you are
|
examples/ostest. By default, this project assumes that you are
|
||||||
using the DFU bootloader.
|
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
|
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:
|
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
|
Configures the NuttShell (nsh) located at apps/examples/nsh. The
|
||||||
Configuration enables both the serial and telnet NSH interfaces.
|
Configuration enables both the serial and telnet NSH interfaces.
|
||||||
|
|
||||||
|
Default toolchain:
|
||||||
|
|
||||||
CONFIG_STM32_CODESOURCERYL=y : CodeSourcery under Linux / Mac OS X
|
CONFIG_STM32_CODESOURCERYL=y : CodeSourcery under Linux / Mac OS X
|
||||||
|
|
||||||
NOTES:
|
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.
|
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:
|
nxlines:
|
||||||
------
|
------
|
||||||
An example using the NuttX graphics system (NX). This example focuses on
|
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
|
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
|
boards. This configuration may not be useful and may only serve as
|
||||||
an illustration of how to build for th SSD1289 LCD.
|
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_ROMFSETC - Use startup script in /etc
|
||||||
# CONFIG_NSH_CONSOLE - Use serial console front end
|
# CONFIG_NSH_CONSOLE - Use serial console front end
|
||||||
# CONFIG_NSH_TELNET - Use telnetd 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
|
# CONFIG_NSH_ARCHINIT - Platform provides architecture
|
||||||
# specific initialization (nsh_archinitialize()).
|
# specific initialization (nsh_archinitialize()).
|
||||||
#
|
#
|
||||||
@@ -1244,6 +1262,11 @@ CONFIG_NSH_DISABLEBG=n
|
|||||||
CONFIG_NSH_ROMFSETC=n
|
CONFIG_NSH_ROMFSETC=n
|
||||||
CONFIG_NSH_CONSOLE=y
|
CONFIG_NSH_CONSOLE=y
|
||||||
CONFIG_NSH_TELNET=n
|
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_ARCHINIT=n
|
||||||
CONFIG_NSH_IOBUFFER_SIZE=512
|
CONFIG_NSH_IOBUFFER_SIZE=512
|
||||||
CONFIG_NSH_DHCPC=n
|
CONFIG_NSH_DHCPC=n
|
||||||
|
|||||||
@@ -131,6 +131,16 @@
|
|||||||
|
|
||||||
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);
|
||||||
|
|
||||||
/************************************************************************************
|
/************************************************************************************
|
||||||
* Name: stm32_extmemgpios
|
* Name: stm32_extmemgpios
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,90 +1,102 @@
|
|||||||
/************************************************************************************
|
/************************************************************************************
|
||||||
* configs/stm32f4discovery/src/up_boot.c
|
* configs/stm32f4discovery/src/up_boot.c
|
||||||
* arch/arm/src/board/up_boot.c
|
* arch/arm/src/board/up_boot.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
* are met:
|
* are met:
|
||||||
*
|
*
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in
|
* notice, this list of conditions and the following disclaimer in
|
||||||
* the documentation and/or other materials provided with the
|
* the documentation and/or other materials provided with the
|
||||||
* distribution.
|
* distribution.
|
||||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||||
* used to endorse or promote products derived from this software
|
* used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
************************************************************************************/
|
************************************************************************************/
|
||||||
|
|
||||||
/************************************************************************************
|
/************************************************************************************
|
||||||
* Included Files
|
* Included Files
|
||||||
************************************************************************************/
|
************************************************************************************/
|
||||||
|
|
||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
#include <arch/board/board.h>
|
#include <arch/board/board.h>
|
||||||
|
|
||||||
#include "up_arch.h"
|
#include "up_arch.h"
|
||||||
#include "stm32f4discovery-internal.h"
|
#include "stm32f4discovery-internal.h"
|
||||||
|
|
||||||
/************************************************************************************
|
/************************************************************************************
|
||||||
* Definitions
|
* Definitions
|
||||||
************************************************************************************/
|
************************************************************************************/
|
||||||
|
|
||||||
/************************************************************************************
|
/************************************************************************************
|
||||||
* Private Functions
|
* Private Functions
|
||||||
************************************************************************************/
|
************************************************************************************/
|
||||||
|
|
||||||
/************************************************************************************
|
/************************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
************************************************************************************/
|
************************************************************************************/
|
||||||
|
|
||||||
/************************************************************************************
|
/************************************************************************************
|
||||||
* Name: stm32_boardinitialize
|
* Name: stm32_boardinitialize
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* All STM32 architectures must provide the following entry point. This entry point
|
* All STM32 architectures must provide the following entry point. This entry point
|
||||||
* is called early in the intitialization -- after all memory has been configured
|
* is called early in the intitialization -- after all memory has been configured
|
||||||
* and mapped but before any devices have been initialized.
|
* and mapped but before any devices have been initialized.
|
||||||
*
|
*
|
||||||
************************************************************************************/
|
************************************************************************************/
|
||||||
|
|
||||||
void stm32_boardinitialize(void)
|
void stm32_boardinitialize(void)
|
||||||
{
|
{
|
||||||
/* Configure SPI chip selects if 1) SPI is not disabled, and 2) the weak function
|
/* Configure SPI chip selects if 1) SPI is not disabled, and 2) the weak function
|
||||||
* stm32_spiinitialize() has been brought into the link.
|
* stm32_spiinitialize() has been brought into the link.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(CONFIG_STM32_SPI1) || defined(CONFIG_STM32_SPI2) || defined(CONFIG_STM32_SPI3)
|
#if defined(CONFIG_STM32_SPI1) || defined(CONFIG_STM32_SPI2) || defined(CONFIG_STM32_SPI3)
|
||||||
if (stm32_spiinitialize)
|
if (stm32_spiinitialize)
|
||||||
{
|
{
|
||||||
stm32_spiinitialize();
|
stm32_spiinitialize();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Configure on-board LEDs if LED support has been selected. */
|
/* 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
|
||||||
#ifdef CONFIG_ARCH_LEDS
|
* into the build.
|
||||||
up_ledinit();
|
*/
|
||||||
#endif
|
|
||||||
}
|
#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
|
||||||
|
up_ledinit();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|||||||
@@ -318,6 +318,7 @@ static int cdcacm_sndpacket(FAR struct cdcacm_dev_s *priv)
|
|||||||
FAR struct usbdev_ep_s *ep;
|
FAR struct usbdev_ep_s *ep;
|
||||||
FAR struct usbdev_req_s *req;
|
FAR struct usbdev_req_s *req;
|
||||||
FAR struct cdcacm_req_s *reqcontainer;
|
FAR struct cdcacm_req_s *reqcontainer;
|
||||||
|
uint16_t reqlen;
|
||||||
irqstate_t flags;
|
irqstate_t flags;
|
||||||
int len;
|
int len;
|
||||||
int ret = OK;
|
int ret = OK;
|
||||||
@@ -337,7 +338,7 @@ static int cdcacm_sndpacket(FAR struct cdcacm_dev_s *priv)
|
|||||||
ep = priv->epbulkin;
|
ep = priv->epbulkin;
|
||||||
|
|
||||||
/* Loop until either (1) we run out or write requests, or (2) cdcacm_fillrequest()
|
/* Loop until either (1) we run out or write requests, or (2) cdcacm_fillrequest()
|
||||||
* is unable to fill the request with data (i.e., untilthere is no more data
|
* is unable to fill the request with data (i.e., until there is no more data
|
||||||
* to be sent).
|
* to be sent).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -345,6 +346,14 @@ static int cdcacm_sndpacket(FAR struct cdcacm_dev_s *priv)
|
|||||||
priv->serdev.xmit.head, priv->serdev.xmit.tail,
|
priv->serdev.xmit.head, priv->serdev.xmit.tail,
|
||||||
priv->nwrq, sq_empty(&priv->reqlist));
|
priv->nwrq, sq_empty(&priv->reqlist));
|
||||||
|
|
||||||
|
/* Get the maximum number of bytes that will fit into one bulk IN request */
|
||||||
|
|
||||||
|
#ifdef CONFIG_CDCACM_BULKREQLEN
|
||||||
|
reqlen = MAX(CONFIG_CDCACM_BULKREQLEN, ep->maxpacket);
|
||||||
|
#else
|
||||||
|
reqlen = ep->maxpacket;
|
||||||
|
#endif
|
||||||
|
|
||||||
while (!sq_empty(&priv->reqlist))
|
while (!sq_empty(&priv->reqlist))
|
||||||
{
|
{
|
||||||
/* Peek at the request in the container at the head of the list */
|
/* Peek at the request in the container at the head of the list */
|
||||||
@@ -354,7 +363,7 @@ static int cdcacm_sndpacket(FAR struct cdcacm_dev_s *priv)
|
|||||||
|
|
||||||
/* Fill the request with serial TX data */
|
/* Fill the request with serial TX data */
|
||||||
|
|
||||||
len = cdcacm_fillrequest(priv, req->buf, req->len);
|
len = cdcacm_fillrequest(priv, req->buf, reqlen);
|
||||||
if (len > 0)
|
if (len > 0)
|
||||||
{
|
{
|
||||||
/* Remove the empty container from the request list */
|
/* Remove the empty container from the request list */
|
||||||
|
|||||||
@@ -567,6 +567,7 @@ static int usbclass_sndpacket(FAR struct pl2303_dev_s *priv)
|
|||||||
FAR struct usbdev_ep_s *ep;
|
FAR struct usbdev_ep_s *ep;
|
||||||
FAR struct usbdev_req_s *req;
|
FAR struct usbdev_req_s *req;
|
||||||
FAR struct pl2303_req_s *reqcontainer;
|
FAR struct pl2303_req_s *reqcontainer;
|
||||||
|
uint16_t reqlen;
|
||||||
irqstate_t flags;
|
irqstate_t flags;
|
||||||
int len;
|
int len;
|
||||||
int ret = OK;
|
int ret = OK;
|
||||||
@@ -586,7 +587,7 @@ static int usbclass_sndpacket(FAR struct pl2303_dev_s *priv)
|
|||||||
ep = priv->epbulkin;
|
ep = priv->epbulkin;
|
||||||
|
|
||||||
/* Loop until either (1) we run out or write requests, or (2) usbclass_fillrequest()
|
/* Loop until either (1) we run out or write requests, or (2) usbclass_fillrequest()
|
||||||
* is unable to fill the request with data (i.e., untilthere is no more data
|
* is unable to fill the request with data (i.e., until there is no more data
|
||||||
* to be sent).
|
* to be sent).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -594,6 +595,14 @@ static int usbclass_sndpacket(FAR struct pl2303_dev_s *priv)
|
|||||||
priv->serdev.xmit.head, priv->serdev.xmit.tail,
|
priv->serdev.xmit.head, priv->serdev.xmit.tail,
|
||||||
priv->nwrq, sq_empty(&priv->reqlist));
|
priv->nwrq, sq_empty(&priv->reqlist));
|
||||||
|
|
||||||
|
/* Get the maximum number of bytes that will fit into one bulk IN request */
|
||||||
|
|
||||||
|
#ifdef CONFIG_PL2303_BULKREQLEN
|
||||||
|
reqlen = MAX(CONFIG_CDCACM_BULKREQLEN, ep->maxpacket);
|
||||||
|
#else
|
||||||
|
reqlen = ep->maxpacket;
|
||||||
|
#endif
|
||||||
|
|
||||||
while (!sq_empty(&priv->reqlist))
|
while (!sq_empty(&priv->reqlist))
|
||||||
{
|
{
|
||||||
/* Peek at the request in the container at the head of the list */
|
/* Peek at the request in the container at the head of the list */
|
||||||
@@ -603,7 +612,7 @@ static int usbclass_sndpacket(FAR struct pl2303_dev_s *priv)
|
|||||||
|
|
||||||
/* Fill the request with serial TX data */
|
/* Fill the request with serial TX data */
|
||||||
|
|
||||||
len = usbclass_fillrequest(priv, req->buf, req->len);
|
len = usbclass_fillrequest(priv, req->buf, reqlen);
|
||||||
if (len > 0)
|
if (len > 0)
|
||||||
{
|
{
|
||||||
/* Remove the empty container from the request list */
|
/* Remove the empty container from the request list */
|
||||||
|
|||||||
Reference in New Issue
Block a user