mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-18 23:23:33 +08:00
Merge with trunk NuttX
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@5079 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
+48
-1
@@ -3202,4 +3202,51 @@
|
||||
for control transfers but does not resolve all of the issues.
|
||||
* configs/stm3220g-eval/*/defconfig: Calibrated delay loop. It had
|
||||
never been calibrated was was way off.
|
||||
|
||||
* sched/sem_holder.c: Add logic to handler some priority inheritance
|
||||
cases when sem_post() is called from an interrupt handler. The
|
||||
logic is clearly wrong, but it is not known if this is the
|
||||
cause of any known bugs.
|
||||
* lib/stdio/lib_perror(): Add perror(). Contributed by Kate.
|
||||
* lib/string/lib_strerror(): Add option CONFIG_LIBC_STRERROR that
|
||||
is now required to enabled strerror(). Add an option
|
||||
CONFIG_LIBC_STRERROR_SHORT that can be used to output shortened
|
||||
strings by strerror().
|
||||
* arch/arm/src/stm32/stm32_usbotghost.c: Finally... the USB OTG FS
|
||||
appears to handle NAKing correctly is complete.
|
||||
* configs/stm32f4discovery/*: Added and verifed support for USB OTG FS
|
||||
host on the STM32F4Discovery board.
|
||||
* configs/*/defconfig: Remove configuration documentation from config
|
||||
files. It is redundant, error-prone, and difficult to maintain.
|
||||
Configuration documentation is available in configs/README.txt for
|
||||
common configurations and in configs/*/README.txt for board and MCU_
|
||||
specific configurations.
|
||||
* configs/stm3240g-eval: Add USB host support.
|
||||
* sched/os_bring.c, configs/*/defconfig, tools/mkconfig.c, and others: Added
|
||||
configuration variable CONFIG_USER_ENTRYPOINT that may be used to change
|
||||
the default entry from user_start to some other symbol. Contributed by
|
||||
Kate. NOTE: This change does introduce a minor backward incompatibility.
|
||||
For example, if your application uses NSH as its start-up program, then your
|
||||
code will not fail because it will be unable to find "user_start". The fix
|
||||
for this link failure is to add the following to your configuration file:
|
||||
CONFIG_USER_ENTRYPOINT="nsh_main".
|
||||
* libs/stdio/lib_libfread.c and lib_*flush*.c: Correct a couple of
|
||||
error cases where the lib semaphore was not be released on error
|
||||
exits (thanks Ronen Vainish). Also, improved some error reporting:
|
||||
the generic ERROR was being used instead of the specific errno
|
||||
value; the errno variable was not always set correctly.
|
||||
* tools/mkfsdata.pl: The uIP web server CGI image making perl script was
|
||||
moved from apps/netutils/webserver/makefsdata to nuttx/tools/mkfsdata.pl
|
||||
(Part of a larger change submitted by Max Holtzberg).
|
||||
* configs/stm3240g-eval/script/ld.script: All of the identical ld.script
|
||||
files for the STM3240G-EVAL were replaced by one version in this directory.
|
||||
* configs/stm3240g-eval/webserver: Configuration submitted by Max Holtzberg
|
||||
for testing the changes to the uIP web server (see apps/ChangeLog.txt).
|
||||
* lib/stdio/lib_perror.c: Remove CONFIG_LIBC_PERROR_DEVNAME. What was I
|
||||
thinking? Arbitrary streams cannot be shared by different tasks.
|
||||
* tools/mksyscall.c, csvparser.c, and csvparser.h: Separate CSV parsing
|
||||
logic from mksyscall.c into files where it can be shared.
|
||||
* tools/mksymtab.c: Add a tool that can be used to convert a CSV file
|
||||
into a NuttX-style symbol table.
|
||||
* sched/work_cancel.c: Fix a bad assertion (reported by Mike Smith)
|
||||
* configs/stm3210e-eval/src/up_idle.c: Correct some power management
|
||||
compilation errors (reported by Diego Sanchez).
|
||||
|
||||
@@ -43,15 +43,12 @@
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <semaphore.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
|
||||
#if !defined(CONFIG_DEBUG_VERBOSE) && !defined(CONFIG_DEBUG_USB)
|
||||
# include <debug.h>
|
||||
#endif
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/kmalloc.h>
|
||||
#include <nuttx/usb/usb.h>
|
||||
@@ -315,6 +312,10 @@ static int stm32_ctrl_senddata(FAR struct stm32_usbhost_s *priv,
|
||||
FAR uint8_t *buffer, unsigned int buflen);
|
||||
static int stm32_ctrl_recvdata(FAR struct stm32_usbhost_s *priv,
|
||||
FAR uint8_t *buffer, unsigned int buflen);
|
||||
static int stm32_in_transfer(FAR struct stm32_usbhost_s *priv, int chidx,
|
||||
FAR uint8_t *buffer, size_t buflen);
|
||||
static int stm32_out_transfer(FAR struct stm32_usbhost_s *priv, int chidx,
|
||||
FAR uint8_t *buffer, size_t buflen);
|
||||
|
||||
/* Interrupt handling **********************************************************/
|
||||
/* Lower level interrupt handlers */
|
||||
@@ -751,7 +752,7 @@ static void stm32_chan_configure(FAR struct stm32_usbhost_s *priv, int chidx)
|
||||
stm32_putreg(STM32_OTGFS_HCINTMSK(chidx), regval);
|
||||
|
||||
/* Enable the top level host channel interrupt. */
|
||||
|
||||
|
||||
stm32_modifyreg(STM32_OTGFS_HAINTMSK, 0, OTGFS_HAINT(chidx));
|
||||
|
||||
/* Make sure host channel interrupts are enabled. */
|
||||
@@ -808,7 +809,7 @@ static void stm32_chan_halt(FAR struct stm32_usbhost_s *priv, int chidx,
|
||||
uint32_t eptype;
|
||||
unsigned int avail;
|
||||
|
||||
/* Save the recon for the halt. We need this in the channel halt interrrupt
|
||||
/* Save the reason for the halt. We need this in the channel halt interrrupt
|
||||
* handling logic to know what to do next.
|
||||
*/
|
||||
|
||||
@@ -1157,7 +1158,7 @@ static void stm32_transfer_start(FAR struct stm32_usbhost_s *priv, int chidx)
|
||||
unsigned int wrpackets = avail / chan->maxpacket;
|
||||
wrsize = wrpackets * chan->maxpacket;
|
||||
}
|
||||
|
||||
|
||||
/* Write packet into the Tx FIFO. */
|
||||
|
||||
stm32_gint_wrpacket(priv, chan->buffer, chidx, wrsize);
|
||||
@@ -1354,6 +1355,254 @@ static int stm32_ctrl_recvdata(FAR struct stm32_usbhost_s *priv,
|
||||
return stm32_chan_wait(priv, chan);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Name: stm32_in_transfer
|
||||
*
|
||||
* Description:
|
||||
* Transfer 'buflen' bytes into 'buffer' from an IN channel.
|
||||
*
|
||||
*******************************************************************************/
|
||||
|
||||
static int stm32_in_transfer(FAR struct stm32_usbhost_s *priv, int chidx,
|
||||
FAR uint8_t *buffer, size_t buflen)
|
||||
{
|
||||
FAR struct stm32_chan_s *chan;
|
||||
uint16_t start;
|
||||
uint16_t elapsed;
|
||||
int ret = OK;
|
||||
|
||||
/* Loop until the transfer completes (i.e., buflen is decremented to zero)
|
||||
* or a fatal error occurs (any error other than a simple NAK)
|
||||
*/
|
||||
|
||||
chan = &priv->chan[chidx];
|
||||
chan->buffer = buffer;
|
||||
chan->buflen = buflen;
|
||||
|
||||
start = stm32_getframe();
|
||||
while (chan->buflen > 0)
|
||||
{
|
||||
/* Set up for the wait BEFORE starting the transfer */
|
||||
|
||||
ret = stm32_chan_waitsetup(priv, chan);
|
||||
if (ret != OK)
|
||||
{
|
||||
udbg("ERROR: Device disconnected\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Set up for the transfer based on the direction and the endpoint type */
|
||||
|
||||
switch (chan->eptype)
|
||||
{
|
||||
default:
|
||||
case OTGFS_EPTYPE_CTRL: /* Control */
|
||||
{
|
||||
/* This kind of transfer on control endpoints other than EP0 are not
|
||||
* currently supported
|
||||
*/
|
||||
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
case OTGFS_EPTYPE_ISOC: /* Isochronous */
|
||||
{
|
||||
/* Set up the IN data PID */
|
||||
|
||||
chan->pid = OTGFS_PID_DATA0;
|
||||
}
|
||||
break;
|
||||
|
||||
case OTGFS_EPTYPE_BULK: /* Bulk */
|
||||
case OTGFS_EPTYPE_INTR: /* Interrupt */
|
||||
{
|
||||
/* Setup the IN data PID */
|
||||
|
||||
chan->pid = chan->indata1 ? OTGFS_PID_DATA1 : OTGFS_PID_DATA0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
/* Start the transfer */
|
||||
|
||||
stm32_transfer_start(priv, chidx);
|
||||
|
||||
/* Wait for the transfer to complete and get the result */
|
||||
|
||||
ret = stm32_chan_wait(priv, chan);
|
||||
|
||||
/* EAGAIN indicates that the device NAKed the transfer and we need
|
||||
* do try again. Anything else (success or other errors) will
|
||||
* cause use to return
|
||||
*/
|
||||
|
||||
if (ret != OK)
|
||||
{
|
||||
udbg("Transfer failed: %d\n", ret);
|
||||
|
||||
/* Check for a special case: If (1) the transfer was NAKed and (2)
|
||||
* no Tx FIFO empty or Rx FIFO not-empty event occurred, then we
|
||||
* should be able to just flush the Rx and Tx FIFOs and try again.
|
||||
* We can detect this latter case becasue the then the transfer
|
||||
* buffer pointer and buffer size will be unaltered.
|
||||
*/
|
||||
|
||||
elapsed = stm32_getframe() - start;
|
||||
if (ret != -EAGAIN || /* Not a NAK condition OR */
|
||||
elapsed >= STM32_DATANAK_DELAY || /* Timeout has elapsed OR */
|
||||
chan->buflen != buflen) /* Data has been partially transferred */
|
||||
{
|
||||
/* Break out and return the error */
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Name: stm32_out_transfer
|
||||
*
|
||||
* Description:
|
||||
* Transfer the 'buflen' bytes in 'buffer' through an OUT channel.
|
||||
*
|
||||
*******************************************************************************/
|
||||
|
||||
static int stm32_out_transfer(FAR struct stm32_usbhost_s *priv, int chidx,
|
||||
FAR uint8_t *buffer, size_t buflen)
|
||||
{
|
||||
FAR struct stm32_chan_s *chan;
|
||||
uint16_t start;
|
||||
uint16_t elapsed;
|
||||
size_t xfrlen;
|
||||
int ret = OK;
|
||||
|
||||
/* Loop until the transfer completes (i.e., buflen is decremented to zero)
|
||||
* or a fatal error occurs (any error other than a simple NAK)
|
||||
*/
|
||||
|
||||
chan = &priv->chan[chidx];
|
||||
start = stm32_getframe();
|
||||
|
||||
while (buflen > 0)
|
||||
{
|
||||
/* Transfer one packet at a time. The hardware is capable of queueing
|
||||
* multiple OUT packets, but I just haven't figured out how to handle
|
||||
* the case where a single OUT packet in the group is NAKed.
|
||||
*/
|
||||
|
||||
xfrlen = MIN(chan->maxpacket, buflen);
|
||||
chan->buffer = buffer;
|
||||
chan->buflen = xfrlen;
|
||||
|
||||
/* Set up for the wait BEFORE starting the transfer */
|
||||
|
||||
ret = stm32_chan_waitsetup(priv, chan);
|
||||
if (ret != OK)
|
||||
{
|
||||
udbg("ERROR: Device disconnected\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Set up for the transfer based on the direction and the endpoint type */
|
||||
|
||||
switch (chan->eptype)
|
||||
{
|
||||
default:
|
||||
case OTGFS_EPTYPE_CTRL: /* Control */
|
||||
{
|
||||
/* This kind of transfer on control endpoints other than EP0 are not
|
||||
* currently supported
|
||||
*/
|
||||
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
case OTGFS_EPTYPE_ISOC: /* Isochronous */
|
||||
{
|
||||
/* Set up the OUT data PID */
|
||||
|
||||
chan->pid = OTGFS_PID_DATA0;
|
||||
}
|
||||
break;
|
||||
|
||||
case OTGFS_EPTYPE_BULK: /* Bulk */
|
||||
{
|
||||
/* Setup the OUT data PID */
|
||||
|
||||
chan->pid = chan->outdata1 ? OTGFS_PID_DATA1 : OTGFS_PID_DATA0;
|
||||
}
|
||||
break;
|
||||
|
||||
case OTGFS_EPTYPE_INTR: /* Interrupt */
|
||||
{
|
||||
/* Setup the OUT data PID */
|
||||
|
||||
chan->pid = chan->outdata1 ? OTGFS_PID_DATA1 : OTGFS_PID_DATA0;
|
||||
|
||||
/* Toggle the OUT data PID for the next transfer */
|
||||
|
||||
chan->outdata1 ^= true;
|
||||
}
|
||||
}
|
||||
|
||||
/* Start the transfer */
|
||||
|
||||
stm32_transfer_start(priv, chidx);
|
||||
|
||||
/* Wait for the transfer to complete and get the result */
|
||||
|
||||
ret = stm32_chan_wait(priv, chan);
|
||||
|
||||
/* Handle transfer failures */
|
||||
|
||||
if (ret != OK)
|
||||
{
|
||||
udbg("Transfer failed: %d\n", ret);
|
||||
|
||||
/* Check for a special case: If (1) the transfer was NAKed and (2)
|
||||
* no Tx FIFO empty or Rx FIFO not-empty event occurred, then we
|
||||
* should be able to just flush the Rx and Tx FIFOs and try again.
|
||||
* We can detect this latter case becasue the then the transfer
|
||||
* buffer pointer and buffer size will be unaltered.
|
||||
*/
|
||||
|
||||
elapsed = stm32_getframe() - start;
|
||||
if (ret != -EAGAIN || /* Not a NAK condition OR */
|
||||
elapsed >= STM32_DATANAK_DELAY || /* Timeout has elapsed OR */
|
||||
chan->buflen != xfrlen) /* Data has been partially transferred */
|
||||
{
|
||||
/* Break out and return the error */
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
/* Is this flush really necessary? What does the hardware do with the
|
||||
* data in the FIFO when the NAK occurs? Does it discard it?
|
||||
*/
|
||||
|
||||
stm32_flush_txfifos(OTGFS_GRSTCTL_TXFNUM_HALL);
|
||||
|
||||
/* Get the device a little time to catch up. Then retry the transfer
|
||||
* using the same buffer pointer and length.
|
||||
*/
|
||||
|
||||
usleep(20*1000);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Successfully transferred. Update the buffer pointer and length */
|
||||
|
||||
buffer += xfrlen;
|
||||
buflen -= xfrlen;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Name: stm32_gint_wrpacket
|
||||
*
|
||||
@@ -1923,7 +2172,7 @@ static void stm32_gint_disconnected(FAR struct stm32_usbhost_s *priv)
|
||||
if (!priv->connected)
|
||||
{
|
||||
/* Yes.. then we no longer connected */
|
||||
|
||||
|
||||
ullvdbg("Disconnected\n");
|
||||
|
||||
/* Are we bound to a class driver? */
|
||||
@@ -2148,7 +2397,7 @@ static inline void stm32_gint_nptxfeisr(FAR struct stm32_usbhost_s *priv)
|
||||
unsigned int wrpackets = avail / chan->maxpacket;
|
||||
wrsize = wrpackets * chan->maxpacket;
|
||||
}
|
||||
|
||||
|
||||
/* Otherwise, this will be the last packet to be sent in this transaction.
|
||||
* We now need to disable further NPTXFE interrupts.
|
||||
*/
|
||||
@@ -2238,7 +2487,7 @@ static inline void stm32_gint_ptxfeisr(FAR struct stm32_usbhost_s *priv)
|
||||
unsigned int wrpackets = avail / chan->maxpacket;
|
||||
wrsize = wrpackets * chan->maxpacket;
|
||||
}
|
||||
|
||||
|
||||
/* Otherwise, this will be the last packet to be sent in this transaction.
|
||||
* We now need to disable further PTXFE interrupts.
|
||||
*/
|
||||
@@ -2382,7 +2631,7 @@ static inline void stm32_gint_hprtisr(FAR struct stm32_usbhost_s *priv)
|
||||
/* Set the Host Frame Interval Register for the 6KHz speed */
|
||||
|
||||
stm32_putreg(STM32_OTGFS_HFIR, 6000);
|
||||
|
||||
|
||||
/* Are we switching from FS to LS? */
|
||||
|
||||
if ((hcfg & OTGFS_HCFG_FSLSPCS_MASK) != OTGFS_HCFG_FSLSPCS_LS6MHz)
|
||||
@@ -2459,7 +2708,7 @@ static inline void stm32_gint_iisooxfrisr(FAR struct stm32_usbhost_s *priv)
|
||||
/* CHENA : Set to enable the channel
|
||||
* CHDIS : Set to stop transmitting/receiving data on a channel
|
||||
*/
|
||||
|
||||
|
||||
regval = stm32_getreg(STM32_OTGFS_HCCHAR(0));
|
||||
regval |= (OTGFS_HCCHAR_CHDIS | OTGFS_HCCHAR_CHENA);
|
||||
stm32_putreg(STM32_OTGFS_HCCHAR(0), regval);
|
||||
@@ -2718,7 +2967,7 @@ static void stm32_txfe_enable(FAR struct stm32_usbhost_s *priv, int chidx)
|
||||
/* Disable all interrupts so that we have exclusive access to the GINTMSK
|
||||
* (it would be sufficent just to disable the GINT interrupt).
|
||||
*/
|
||||
|
||||
|
||||
flags = irqsave();
|
||||
|
||||
/* Should we enable the periodic or non-peridic Tx FIFO empty interrupts */
|
||||
@@ -2842,7 +3091,7 @@ static int stm32_enumerate(FAR struct usbhost_driver_s *drvr)
|
||||
}
|
||||
|
||||
DEBUGASSERT(priv->smstate == SMSTATE_ATTACHED);
|
||||
|
||||
|
||||
/* Allocate and initialize the control OUT channel */
|
||||
|
||||
chidx = stm32_chan_alloc(priv);
|
||||
@@ -2869,9 +3118,9 @@ static int stm32_enumerate(FAR struct usbhost_driver_s *drvr)
|
||||
priv->chan[chidx].indata1 = false;
|
||||
priv->chan[chidx].outdata1 = false;
|
||||
|
||||
/* USB 2.0 spec says at least 50ms delay before port reset */
|
||||
/* USB 2.0 spec says at least 50ms delay before port reset. We wait 100ms. */
|
||||
|
||||
up_mdelay(100);
|
||||
usleep(100*1000);
|
||||
|
||||
/* Reset the host port */
|
||||
|
||||
@@ -2956,12 +3205,12 @@ static int stm32_ep0configure(FAR struct usbhost_driver_s *drvr, uint8_t funcadd
|
||||
|
||||
priv->chan[priv->ep0out].maxpacket = maxpacketsize;
|
||||
stm32_chan_configure(priv, priv->ep0out);
|
||||
|
||||
|
||||
/* Configure the EP0 IN channel */
|
||||
|
||||
priv->chan[priv->ep0in].maxpacket = maxpacketsize;
|
||||
stm32_chan_configure(priv, priv->ep0in);
|
||||
|
||||
|
||||
stm32_givesem(&priv->exclsem);
|
||||
return OK;
|
||||
}
|
||||
@@ -3427,7 +3676,7 @@ static int stm32_ctrlout(FAR struct usbhost_driver_s *drvr,
|
||||
}
|
||||
|
||||
/* Handle the status IN phase */
|
||||
|
||||
|
||||
if (ret == OK)
|
||||
{
|
||||
ret = stm32_ctrl_recvdata(priv, NULL, 0);
|
||||
@@ -3492,145 +3741,33 @@ static int stm32_ctrlout(FAR struct usbhost_driver_s *drvr,
|
||||
* - Never called from an interrupt handler.
|
||||
*
|
||||
*******************************************************************************/
|
||||
|
||||
|
||||
static int stm32_transfer(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep,
|
||||
FAR uint8_t *buffer, size_t buflen)
|
||||
{
|
||||
struct stm32_usbhost_s *priv = (struct stm32_usbhost_s *)drvr;
|
||||
FAR struct stm32_chan_s *chan;
|
||||
FAR struct stm32_usbhost_s *priv = (FAR struct stm32_usbhost_s *)drvr;
|
||||
unsigned int chidx = (unsigned int)ep;
|
||||
int ret = OK;
|
||||
int ret;
|
||||
|
||||
uvdbg("chidx: %d buflen: %d\n", (unsigned int)ep, buflen);
|
||||
|
||||
DEBUGASSERT(priv && buffer && chidx < STM32_MAX_TX_FIFOS && buflen > 0);
|
||||
chan = &priv->chan[chidx];
|
||||
|
||||
/* We must have exclusive access to the USB host hardware and state structures */
|
||||
|
||||
stm32_takesem(&priv->exclsem);
|
||||
|
||||
/* Loop until the transfer completes (i.e., buflen is decremented to zero)
|
||||
* or a fatal error occurs (any error other than a simple NAK)
|
||||
*/
|
||||
/* Handle IN and OUT transfer slightly differently */
|
||||
|
||||
chan->buffer = buffer;
|
||||
chan->buflen = buflen;
|
||||
|
||||
while (chan->buflen > 0)
|
||||
if (priv->chan[chidx].in)
|
||||
{
|
||||
/* Set up for the wait BEFORE starting the transfer */
|
||||
|
||||
ret = stm32_chan_waitsetup(priv, chan);
|
||||
if (ret != OK)
|
||||
{
|
||||
udbg("ERROR: Device disconnected\n");
|
||||
goto errout;
|
||||
}
|
||||
|
||||
/* Set up for the transfer based on the direction and the endpoint type */
|
||||
|
||||
switch (chan->eptype)
|
||||
{
|
||||
default:
|
||||
case OTGFS_EPTYPE_CTRL: /* Control */
|
||||
{
|
||||
/* This kind of transfer on control endpoints other than EP0 are not
|
||||
* currently supported
|
||||
*/
|
||||
|
||||
ret = -ENOSYS;
|
||||
goto errout;
|
||||
}
|
||||
|
||||
case OTGFS_EPTYPE_ISOC: /* Isochronous */
|
||||
{
|
||||
/* Set up the IN/OUT data PID */
|
||||
|
||||
chan->pid = OTGFS_PID_DATA0;
|
||||
}
|
||||
break;
|
||||
|
||||
case OTGFS_EPTYPE_BULK: /* Bulk */
|
||||
{
|
||||
/* Handle the bulk transfer based on the direction of the transfer. */
|
||||
|
||||
if (chan->in)
|
||||
{
|
||||
/* Setup the IN data PID */
|
||||
|
||||
chan->pid = chan->indata1 ? OTGFS_PID_DATA1 : OTGFS_PID_DATA0;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Setup the OUT data PID */
|
||||
|
||||
chan->pid = chan->outdata1 ? OTGFS_PID_DATA1 : OTGFS_PID_DATA0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case OTGFS_EPTYPE_INTR: /* Interrupt */
|
||||
{
|
||||
/* Handle the interrupt transfer based on the direction of the
|
||||
* transfer.
|
||||
*/
|
||||
|
||||
if (chan->in)
|
||||
{
|
||||
/* Setup the IN data PID */
|
||||
|
||||
chan->pid = chan->indata1 ? OTGFS_PID_DATA1 : OTGFS_PID_DATA0;
|
||||
|
||||
/* The indata1 data toggle will be updated in the Rx FIFO
|
||||
* interrupt handling logic as each packet is received.
|
||||
*/
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Setup the OUT data PID */
|
||||
|
||||
chan->pid = chan->outdata1 ? OTGFS_PID_DATA1 : OTGFS_PID_DATA0;
|
||||
|
||||
/* Toggle the OUT data PID for the next transfer */
|
||||
|
||||
chan->outdata1 ^= true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* There is a bug in the code at present. With debug OFF, this driver
|
||||
* overruns the typical FLASH device and there are many problems with
|
||||
* NAKS sticking a big delay here allows the driver to work but with
|
||||
* very poor performance when debug is off.
|
||||
*/
|
||||
|
||||
#if !defined(CONFIG_DEBUG_VERBOSE) && !defined(CONFIG_DEBUG_USB)
|
||||
#warning "REVISIT this delay"
|
||||
usleep(100*1000);
|
||||
#endif
|
||||
|
||||
/* Start the transfer */
|
||||
|
||||
stm32_transfer_start(priv, chidx);
|
||||
|
||||
/* Wait for the transfer to complete and get the result */
|
||||
|
||||
ret = stm32_chan_wait(priv, chan);
|
||||
|
||||
/* EAGAIN indicates that the device NAKed the transfer and we need
|
||||
* do try again. Anything else (success or other errors) will
|
||||
* cause use to return
|
||||
*/
|
||||
|
||||
if (ret != OK)
|
||||
{
|
||||
udbg("Transfer failed: %d\n", ret);
|
||||
break;
|
||||
}
|
||||
ret = stm32_in_transfer(priv, chidx, buffer, buflen);
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = stm32_out_transfer(priv, chidx, buffer, buflen);
|
||||
}
|
||||
|
||||
errout:
|
||||
stm32_givesem(&priv->exclsem);
|
||||
return ret;
|
||||
}
|
||||
@@ -3663,7 +3800,7 @@ static void stm32_disconnect(FAR struct usbhost_driver_s *drvr)
|
||||
struct stm32_usbhost_s *priv = (struct stm32_usbhost_s *)drvr;
|
||||
priv->class = NULL;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Initialization
|
||||
*******************************************************************************/
|
||||
@@ -3979,7 +4116,7 @@ static inline int stm32_hw_initialize(FAR struct stm32_usbhost_s *priv)
|
||||
/* Set the PHYSEL bit in the GUSBCFG register to select the OTG FS serial
|
||||
* transceiver: "This bit is always 1 with write-only access"
|
||||
*/
|
||||
|
||||
|
||||
regval = stm32_getreg(STM32_OTGFS_GUSBCFG);;
|
||||
regval |= OTGFS_GUSBCFG_PHYSEL;
|
||||
stm32_putreg(STM32_OTGFS_GUSBCFG, regval);
|
||||
@@ -4128,7 +4265,7 @@ FAR struct usbhost_driver_s *usbhost_initialize(int controller)
|
||||
stm32_configgpio(GPIO_OTGFS_SOF);
|
||||
#endif
|
||||
|
||||
/* Initialize the USB OTG FS core */
|
||||
/* Initialize the USB OTG FS core */
|
||||
|
||||
stm32_hw_initialize(priv);
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ Table of Contents
|
||||
o Summary of Files
|
||||
o Supported Architectures
|
||||
o Configuring NuttX
|
||||
o Building Symbol Tables
|
||||
|
||||
Board-Specific Configurations
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@@ -268,6 +269,7 @@ defconfig -- This is a configuration file similar to the Linux
|
||||
by default)
|
||||
CONFIG_DEBUG_GRAPHICS - enable NX graphics debug output
|
||||
(disabled by default)
|
||||
|
||||
CONFIG_ARCH_LOWPUTC - architecture supports low-level, boot
|
||||
time console output
|
||||
CONFIG_MM_REGIONS - If the architecture includes multiple
|
||||
@@ -331,7 +333,7 @@ defconfig -- This is a configuration file similar to the Linux
|
||||
threads (minus 1) than can be waiting for another thread
|
||||
to release a count on a semaphore. This value may be set
|
||||
to zero if no more than one thread is expected to wait for
|
||||
a semaphore. If defined, then this should be a relatively
|
||||
a semaphore. If defined, then this should be a relatively
|
||||
small number because this the number of maximumum of waiters
|
||||
on one semaphore (like 4 or 8).
|
||||
CONFIG_FDCLONE_DISABLE. Disable cloning of all file descriptors
|
||||
@@ -375,6 +377,10 @@ defconfig -- This is a configuration file similar to the Linux
|
||||
CONFIG_SCHED_ONEXIT_MAX - By default if CONFIG_SCHED_ONEXIT is selected,
|
||||
only a single on_exit() function is supported. That number can be
|
||||
increased by defined this setting to the number that you require.
|
||||
CONFIG_USER_ENTRYPOINT - The name of the entry point for user
|
||||
applications. For the example applications this is of the form 'app_main'
|
||||
where 'app' is the application name. If not defined, CONFIG_USER_ENTRYPOINT
|
||||
defaults to user_start.
|
||||
|
||||
System Logging:
|
||||
CONFIG_SYSLOG enables general system logging support.
|
||||
@@ -546,10 +552,28 @@ defconfig -- This is a configuration file similar to the Linux
|
||||
|
||||
Misc libc settings
|
||||
|
||||
CONFIG_NOPRINTF_FIELDWIDTH - sprintf-related logic is a
|
||||
little smaller if we do not support fieldwidthes
|
||||
CONFIG_LIBC_FLOATINGPOINT - By default, floating point
|
||||
support in printf, sscanf, etc. is disabled.
|
||||
CONFIG_NOPRINTF_FIELDWIDTH - sprintf-related logic is a little smaller
|
||||
if we do not support fieldwidthes
|
||||
CONFIG_LIBC_FLOATINGPOINT - By default, floating point support in printf,
|
||||
sscanf, etc. is disabled.
|
||||
CONFIG_LIBC_STRERROR - strerror() is useful because it decodes 'errno'
|
||||
values into a human readable strings. But it can also require
|
||||
a lot of memory. If this option is selected, strerror() will still
|
||||
exist in the build but it will not decode error values. This option
|
||||
should be used by other logic to decide if it should use strerror() or
|
||||
not. For example, the NSH application will not use strerror() if this
|
||||
option is not selected; perror() will not use strerror() is this option
|
||||
is not selected (see also CONFIG_NSH_STRERROR).
|
||||
CONFIG_LIBC_STRERROR_SHORT - If this option is selected, then strerror()
|
||||
will use a shortened string when it decodes the error. Specifically,
|
||||
strerror() is simply use the string that is the common name for the
|
||||
error. For example, the 'errno' value of 2 will produce the string
|
||||
"No such file or directory" if CONFIG_LIBC_STRERROR_SHORT is not
|
||||
defined but the string "ENOENT" if CONFIG_LIBC_STRERROR_SHORT is
|
||||
defined.
|
||||
CONFIG_LIBC_PERROR_STDOUT - POSIX requires that perror() provide its output
|
||||
on stderr. This option may be defined, however, to provide perror() output
|
||||
that is serialized with other stdout messages.
|
||||
|
||||
Allow for architecture optimized implementations
|
||||
|
||||
@@ -1782,3 +1806,26 @@ command line like:
|
||||
|
||||
cd tools
|
||||
./configure.sh -a <app-dir> <board-name>/<config-dir>
|
||||
|
||||
Building Symbol Tables
|
||||
^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Symbol tables are needed at several of the binfmt interfaces in order to bind
|
||||
a module to the base code. These symbol tables can be tricky to create and
|
||||
will probably have to be tailored for any specific application, balancing
|
||||
the number of symbols and the size of the symbol table against the symbols
|
||||
required by the applications.
|
||||
|
||||
The top-level System.map file is one good source of symbol information
|
||||
(which, or course, was just generated from the top-level nuttx file
|
||||
using the GNU 'nm' tool).
|
||||
|
||||
There are also common-separated value (CSV) values in the source try that
|
||||
provide information about symbols. In particular:
|
||||
|
||||
nuttx/syscall/syscall.csv - Describes the NuttX RTOS interface, and
|
||||
nuttx/lib/lib.csv - Describes the NuttX C library interface.
|
||||
|
||||
There is a tool at nuttx/tools/mksymtab that will use these CSV files as
|
||||
input to generate a generic symbol table. See nuttx/tools/README.txt for
|
||||
more information about using the mksymtab tool.
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
#include <debug.h>
|
||||
@@ -317,7 +318,7 @@ int usbhost_enumerate(FAR struct usbhost_driver_s *drvr, uint8_t funcaddr,
|
||||
|
||||
DEBUGASSERT(drvr && class);
|
||||
|
||||
/* Allocate TD buffers for use in this function. We will need two:
|
||||
/* Allocate descriptor buffers for use in this function. We will need two:
|
||||
* One for the request and one for the data buffer.
|
||||
*/
|
||||
|
||||
@@ -400,7 +401,7 @@ int usbhost_enumerate(FAR struct usbhost_driver_s *drvr, uint8_t funcaddr,
|
||||
udbg("ERROR: SETADDRESS DRVR_CTRLOUT returned %d\n", ret);
|
||||
goto errout;
|
||||
}
|
||||
up_mdelay(2);
|
||||
usleep(2*1000);
|
||||
|
||||
/* Modify control pipe with the provided USB device address */
|
||||
|
||||
@@ -461,9 +462,9 @@ int usbhost_enumerate(FAR struct usbhost_driver_s *drvr, uint8_t funcaddr,
|
||||
goto errout;
|
||||
}
|
||||
|
||||
/* Free the TD that we were using for the request buffer. It is not needed
|
||||
* further here but it may be needed by the class driver during its connection
|
||||
* operations.
|
||||
/* Free the descriptor buffer that we were using for the request buffer.
|
||||
* It is not needed further here but it may be needed by the class driver
|
||||
* during its connection operations.
|
||||
*/
|
||||
|
||||
DRVR_FREE(drvr, (uint8_t*)ctrlreq);
|
||||
@@ -488,9 +489,9 @@ int usbhost_enumerate(FAR struct usbhost_driver_s *drvr, uint8_t funcaddr,
|
||||
}
|
||||
}
|
||||
|
||||
/* Some devices may require this delay before initialization */
|
||||
/* Some devices may require some delay before initialization */
|
||||
|
||||
up_mdelay(100);
|
||||
usleep(100*1000);
|
||||
|
||||
/* Parse the configuration descriptor and bind to the class instance for the
|
||||
* device. This needs to be the last thing done because the class driver
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <semaphore.h>
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
@@ -724,6 +725,7 @@ static inline int usbhost_testunitready(FAR struct usbhost_state_s *priv)
|
||||
usbhost_dumpcsw((FAR struct usbmsc_csw_s *)priv->tbuffer);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1195,13 +1197,15 @@ static inline int usbhost_initvolume(FAR struct usbhost_state_s *priv)
|
||||
uvdbg("Get max LUN\n");
|
||||
ret = usbhost_maxlunreq(priv);
|
||||
|
||||
/* Wait for the unit to be ready */
|
||||
|
||||
for (retries = 0; retries < USBHOST_MAX_RETRIES && ret == OK; retries++)
|
||||
for (retries = 0; retries < USBHOST_MAX_RETRIES /* && ret == OK */; retries++)
|
||||
{
|
||||
uvdbg("Test unit ready, retries=%d\n", retries);
|
||||
|
||||
/* Send TESTUNITREADY to see the unit is ready */
|
||||
/* Wait just a bit */
|
||||
|
||||
usleep(50*1000);
|
||||
|
||||
/* Send TESTUNITREADY to see if the unit is ready */
|
||||
|
||||
ret = usbhost_testunitready(priv);
|
||||
if (ret == OK)
|
||||
|
||||
@@ -91,6 +91,10 @@
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef assert
|
||||
#define assert ASSERT
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
@@ -55,8 +55,8 @@ extern "C" {
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
EXTERN char *basename(char *path);
|
||||
EXTERN char *dirname(char *path);
|
||||
EXTERN FAR char *basename(FAR char *path);
|
||||
EXTERN FAR char *dirname(FAR char *path);
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -63,7 +63,7 @@ extern "C" {
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
EXTERN char *ether_ntoa(const struct ether_addr *addr);
|
||||
EXTERN FAR char *ether_ntoa(FAR const struct ether_addr *addr);
|
||||
EXTERN struct ether_addr *ether_aton(const char *asc);
|
||||
EXTERN int ether_ntohost(char *hostname, const struct ether_addr *addr);
|
||||
EXTERN int ether_hostton(const char *hostname, struct ether_addr *addr);
|
||||
|
||||
@@ -68,7 +68,7 @@ extern "C" {
|
||||
|
||||
/* This entry point must be supplied by the application */
|
||||
|
||||
EXTERN int user_start(int argc, char *argv[]);
|
||||
EXTERN int CONFIG_USER_ENTRYPOINT(int argc, char *argv[]);
|
||||
|
||||
/* Functions contained in os_task.c *****************************************/
|
||||
|
||||
|
||||
@@ -128,6 +128,7 @@ EXTERN int sprintf(FAR char *buf, const char *format, ...);
|
||||
EXTERN int asprintf (FAR char **ptr, const char *fmt, ...);
|
||||
EXTERN int snprintf(FAR char *buf, size_t size, const char *format, ...);
|
||||
EXTERN int sscanf(const char *buf, const char *fmt, ...);
|
||||
EXTERN void perror(FAR const char *s);
|
||||
|
||||
EXTERN int ungetc(int c, FAR FILE *stream);
|
||||
EXTERN int vprintf(FAR const char *format, va_list ap);
|
||||
|
||||
+42
-2
@@ -23,7 +23,7 @@ config NUNGET_CHARS
|
||||
---help---
|
||||
Number of characters that can be buffered by ungetc() (Only if NFILE_STREAMS > 0)
|
||||
|
||||
config CONFIG_LIB_HOMEDIR
|
||||
config LIB_HOMEDIR
|
||||
string "Home directory"
|
||||
default "/"
|
||||
depends on !DISABLE_ENVIRON
|
||||
@@ -51,6 +51,46 @@ config LIBC_FLOATINGPOINT
|
||||
By default, floating point
|
||||
support in printf, sscanf, etc. is disabled.
|
||||
|
||||
config LIBC_STRERROR
|
||||
bool "Enable strerror"
|
||||
default n
|
||||
---help---
|
||||
strerror() is useful because it decodes 'errno' values into a human readable
|
||||
strings. But it can also require a lot of memory. If this option is selected,
|
||||
strerror() will still exist in the build but it will not decode error values.
|
||||
This option should be used by other logic to decide if it should use strerror()
|
||||
or not. For example, the NSH application will not use strerror() if this
|
||||
option is not selected; perror() will not use strerror() is this option is not
|
||||
selected (see also NSH_STRERROR).
|
||||
|
||||
config LIBC_STRERROR_SHORT
|
||||
bool "Use short error descriptions in strerror()"
|
||||
default n
|
||||
depends on LIBC_STRERROR
|
||||
---help---
|
||||
If this option is selected, then strerror() will use a shortened string when
|
||||
it decodes the error. Specifically, strerror() is simply use the string that
|
||||
is the common name for the error. For example, the 'errno' value of 2 will
|
||||
produce the string "No such file or directory" is LIBC_STRERROR_SHORT
|
||||
is not defined but the string "ENOENT" is LIBC_STRERROR_SHORT is defined.
|
||||
|
||||
config LIBC_PERROR_STDOUT
|
||||
bool "perror() to stdout"
|
||||
default n
|
||||
---help---
|
||||
POSIX requires that perror() provide its output on stderr. This option may
|
||||
be defined, however, to provide perror() output that is serialized with
|
||||
other stdout messages.
|
||||
|
||||
config LIBC_PERROR_DEVNAME
|
||||
string "perror() to device"
|
||||
default "/dev/console"
|
||||
depends on !LIBC_PERROR_STDOUT
|
||||
---help---
|
||||
Another non-standard option is to provide perror() output to a logging device
|
||||
or file. LIBC_PERROR_DEVNAME may be defined to be any write-able,
|
||||
character device (or file).
|
||||
|
||||
config ARCH_LOWPUTC
|
||||
bool "Low-level console output"
|
||||
default "y"
|
||||
@@ -68,7 +108,7 @@ config ENABLE_ARCH_OPTIMIZED_FUN
|
||||
|
||||
The architecture may provide custom versions of certain
|
||||
standard header files:
|
||||
config ARCH_MATH_H, CONFIG_ARCH_STDBOOL_H, CONFIG_ARCH_STDINT_H
|
||||
config ARCH_MATH_H, ARCH_STDBOOL_H, ARCH_STDINT_H
|
||||
|
||||
if ENABLE_ARCH_OPTIMIZED_FUN
|
||||
config ARCH_MEMCPY
|
||||
|
||||
@@ -45,3 +45,40 @@ directory:
|
||||
|
||||
misc - Nonstandard "glue" logic, debug.h, crc32.h, dirent.h
|
||||
|
||||
Library Database
|
||||
================
|
||||
|
||||
Information about functions available in the NuttX C library information is
|
||||
maintained in a database. That "database" is implemented as a simple comma-
|
||||
separated-value file, lib.csv. Most spreadsheets programs will accept this
|
||||
format and can be used to maintain the library database.
|
||||
|
||||
This library database will (eventually) be used to generate symbol library
|
||||
symbol table information that can be exported to external applications.
|
||||
|
||||
The format of the CSV file for each line is:
|
||||
|
||||
Field 1: Function name
|
||||
Field 2: The header file that contains the function prototype
|
||||
Field 3: Condition for compilation
|
||||
Field 4: The type of function return value.
|
||||
Field 5 - N+5: The type of each of the N formal parameters of the function
|
||||
|
||||
Each type field has a format as follows:
|
||||
|
||||
type name:
|
||||
For all simpler types
|
||||
formal type | actual type:
|
||||
For array types where the form of the formal (eg. int parm[2])
|
||||
differs from the type of actual passed parameter (eg. int*). This
|
||||
is necessary because you cannot do simple casts to array types.
|
||||
formal type | union member actual type | union member fieldname:
|
||||
A similar situation exists for unions. For example, the formal
|
||||
parameter type union sigval -- You cannot cast a uintptr_t to
|
||||
a union sigval, but you can cast to the type of one of the union
|
||||
member types when passing the actual paramter. Similarly, we
|
||||
cannot cast a union sigval to a uinptr_t either. Rather, we need
|
||||
to cast a specific union member fieldname to uintptr_t.
|
||||
|
||||
NOTE: The tool mksymtab can be used to generate a symbol table from this CSV
|
||||
file. See nuttx/tools/README.txt for further details about the use of mksymtab.
|
||||
|
||||
@@ -0,0 +1,170 @@
|
||||
"_inet_ntoa","arpa/inet.h","!defined(CONFIG_NET_IPv6) && !defined(CONFIG_CAN_PASS_STRUCTS)","FAR char","in_addr_t"
|
||||
"abort","stdlib.h","","void"
|
||||
"abs","stdlib.h","","int","int"
|
||||
"asprintf","stdio.h","","int","FAR char **","const char *","..."
|
||||
"avsprintf","stdio.h","","int","FAR char **","const char *","va_list"
|
||||
"b16atan2","fixedmath.h","","b16_t","b16_t","b16_t"
|
||||
"b16cos","fixedmath.h","","b16_t","b16_t"
|
||||
"b16divb16","fixedmath.h","","b16_t","b16_t","b16_t"
|
||||
"b16mulb16","fixedmath.h","","b16_t","b16_t","b16_t"
|
||||
"b16sin","fixedmath.h","","b16_t","b16_t"
|
||||
"b16sqr","fixedmath.h","","b16_t","b16_t"
|
||||
"basename","libgen.h","","FAR char","FAR char *"
|
||||
"cfgetspeed","termios.h","CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_SERIAL_TERMIOS)","speed_t","FAR const struct termios *"
|
||||
"cfsetspeed","termios.h","CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_SERIAL_TERMIOS)","int","FAR struct termios *","speed_t"
|
||||
"chdir","unistd.h","CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_ENVIRON)","int","FAR const char *"
|
||||
"crc32","crc32.h","","uint32_t","FAR const uint8_t *","size_t"
|
||||
"crc32part","crc32.h","","uint32_t","FAR const uint8_t *","size_t","uint32_t"
|
||||
"dbg","debug.h","!defined(CONFIG_CPP_HAVE_VARARGS) && defined(CONFIG_DEBUG)","int","const char *","..."
|
||||
"dbg_enable","debug.h","defined(CONFIG_DEBUG_ENABLE)","void","bool"
|
||||
"dirname","libgen.h","","FAR char","FAR char *"
|
||||
"dq_addafter","queue.h","","void","FAR dq_entry_t *","FAR dq_entry_t *","FAR dq_queue_t *"
|
||||
"dq_addbefore","queue.h","","void","FAR dq_entry_t *","FAR dq_entry_t *","FAR dq_queue_t *"
|
||||
"dq_addfirst","queue.h","","void","FAR dq_entry_t *","dq_queue_t *"
|
||||
"dq_addlast","queue.h","","void","FAR dq_entry_t *","dq_queue_t *"
|
||||
"dq_rem","queue.h","","void","FAR dq_entry_t *","dq_queue_t *"
|
||||
"dq_remfirst","queue.h","","FAR dq_entry_t","dq_queue_t *"
|
||||
"dq_remlast","queue.h","","FAR dq_entry_t","dq_queue_t *"
|
||||
"ether_ntoa","netinet/ether.h","","FAR char","FAR const struct ether_addr *"
|
||||
"fclose","stdio.h","CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","int","FAR FILE *"
|
||||
"fdopen","stdio.h","CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","FAR FILE","int","FAR const char *"
|
||||
"fflush","stdio.h","CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","int","FAR FILE *"
|
||||
"fgetc","stdio.h","CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","int","FAR FILE *"
|
||||
"fgetpos","stdio.h","CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","int","FAR FILE *","FAR fpos_t *"
|
||||
"fgets","stdio.h","CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","FAR char","FAR char *","int","FAR FILE *"
|
||||
"fileno","stdio.h","","int","FAR FILE *"
|
||||
"fopen","stdio.h","CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","FAR FILE","FAR const char *","FAR const char *"
|
||||
"fprintf","stdio.h","CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","int","FAR FILE *","FAR const char *","..."
|
||||
"fputc","stdio.h","CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","int","int c","FAR FILE *"
|
||||
"fputs","stdio.h","CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","int","FAR const char *","FAR FILE *"
|
||||
"fread","stdio.h","CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","size_t","FAR void *","size_t","size_t","FAR FILE *"
|
||||
"fseek","stdio.h","CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","int","FAR FILE *","long int","int"
|
||||
"fsetpos","stdio.h","CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","int","FAR FILE *","FAR fpos_t *"
|
||||
"ftell","stdio.h","CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","long","FAR FILE *"
|
||||
"fwrite","stdio.h","CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","size_t","FAR const void *","size_t","size_t","FAR FILE *"
|
||||
"getcwd","unistd.h","CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_ENVIRON)","FAR char","FAR char *","size_t"
|
||||
"getopt","unistd.h","","int","int","FAR char *const[]","FAR const char *"
|
||||
"getoptargp","unistd.h","","FAR char *"
|
||||
"getoptindp","unistd.h","","int"
|
||||
"getoptoptp","unistd.h","","int"
|
||||
"gets","stdio.h","CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","FAR char","FAR char *"
|
||||
"gmtime","time.h","","struct tm","const time_t *"
|
||||
"gmtime_r","time.h","","FAR struct tm","FAR const time_t *","FAR struct tm *"
|
||||
"htonl","arpa/inet.h","","uint32_t","uint32_t"
|
||||
"htons","arpa/inet.h","","uint16_t","uint16_t"
|
||||
"imaxabs","stdlib.h","","intmax_t","intmax_t"
|
||||
"inet_addr","arpa/inet.h","","in_addr_t","FAR const char "
|
||||
"inet_ntoa","arpa/inet.h","!defined(CONFIG_NET_IPv6) && defined(CONFIG_CAN_PASS_STRUCTS)","FAR char","struct in_addr"
|
||||
"inet_ntop","arpa/inet.h","","FAR const char","int","FAR const void *","FAR char *","socklen_t"
|
||||
"inet_pton","arpa/inet.h","","int","int","FAR const char *","FAR void *"
|
||||
"labs","stdlib.h","","long int","long int"
|
||||
"lib_dumpbuffer","debug.h","","void","FAR const char *","FAR const uint8_t *","unsigned int"
|
||||
"lib_lowprintf","debug.h","","int","FAR const char *","..."
|
||||
"lib_rawprintf","debug.h","","int","FAR const char *","..."
|
||||
"llabs","stdlib.h","defined(CONFIG_HAVE_LONG_LONG)","long long int","long long int"
|
||||
"lldbg","debug.h","!defined(CONFIG_CPP_HAVE_VARARGS) && defined(CONFIG_DEBUG) && defined(CONFIG_ARCH_LOWPUTC)","int","const char *","..."
|
||||
"llvdbg","debug.h","!defined(CONFIG_CPP_HAVE_VARARGS) && defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_VERBOSE) && defined(CONFIG_ARCH_LOWPUTC)","int","const char *","..."
|
||||
"match","","","int","const char *","const char *"
|
||||
"memccpy","string.h","","FAR void","FAR void *","FAR const void *","int c","size_t"
|
||||
"memchr","string.h","","FAR void","FAR const void *","int c","size_t"
|
||||
"memcmp","string.h","","int","FAR const void *","FAR const void *","size_t"
|
||||
"memcpy","string.h","","FAR void","FAR void *","FAR const void *","size_t"
|
||||
"memmove","string.h","","FAR void","FAR void *","FAR const void *","size_t"
|
||||
"memset","string.h","","FAR void","FAR void *","int c","size_t"
|
||||
"mktime","time.h","","time_t","const struct tm *"
|
||||
"mq_getattr","mqueue.h","!defined(CONFIG_DISABLE_MQUEUE)","int","mqd_t","struct mq_attr *"
|
||||
"mq_setattr","mqueue.h","!defined(CONFIG_DISABLE_MQUEUE)","int","mqd_t","const struct mq_attr *","struct mq_attr *"
|
||||
"ntohl","arpa/inet.h","","uint32_t","uint32_t"
|
||||
"ntohs","arpa/inet.h","","uint16_t","uint16_t"
|
||||
"perror","stdio.h","CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","void","FAR const char *"
|
||||
"printf","stdio.h","","int","const char *","..."
|
||||
"pthread_attr_destroy","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_attr_t *"
|
||||
"pthread_attr_getinheritsched","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR const pthread_attr_t *","FAR int *"
|
||||
"pthread_attr_getschedparam","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_attr_t *","FAR struct sched_param *"
|
||||
"pthread_attr_getschedpolicy","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_attr_t *","int *"
|
||||
"pthread_attr_getstacksize","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_attr_t *","FAR long *"
|
||||
"pthread_attr_init","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_attr_t *"
|
||||
"pthread_attr_setinheritsched","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_attr_t *","int"
|
||||
"pthread_attr_setschedparam","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_attr_t *","FAR const struct sched_param *"
|
||||
"pthread_attr_setschedpolicy","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_attr_t *","int"
|
||||
"pthread_attr_setstacksize","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_attr_t *","long"
|
||||
"pthread_barrierattr_destroy","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_barrierattr_t *"
|
||||
"pthread_barrierattr_getpshared","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR const pthread_barrierattr_t *","FAR int *"
|
||||
"pthread_barrierattr_init","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_barrierattr_t *"
|
||||
"pthread_barrierattr_setpshared","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_barrierattr_t *","int"
|
||||
"pthread_condattr_destroy","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_condattr_t *"
|
||||
"pthread_condattr_init","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_condattr_t *"
|
||||
"pthread_mutexattr_destroy","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_mutexattr_t *"
|
||||
"pthread_mutexattr_getpshared","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_mutexattr_t *","FAR int *"
|
||||
"pthread_mutexattr_gettype","pthread.h","!defined(CONFIG_DISABLE_PTHREAD) && defined(CONFIG_MUTEX_TYPES)","int","const pthread_mutexattr_t *","int *"
|
||||
"pthread_mutexattr_init","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_mutexattr_t *"
|
||||
"pthread_mutexattr_setpshared","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_mutexattr_t *","int "
|
||||
"pthread_mutexattr_settype","pthread.h","!defined(CONFIG_DISABLE_PTHREAD) && defined(CONFIG_MUTEX_TYPES)","int","pthread_mutexattr_t *","int"
|
||||
"puts","stdio.h","CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","int","FAR const char *"
|
||||
"qsort","stdlib.h","","void","void *","size_t","size_t","int(*)(const void *","const void *)"
|
||||
"rand","stdlib.h","","int"
|
||||
"readdir_r","dirent.h","CONFIG_NFILE_DESCRIPTORS > 0","int","FAR DIR *","FAR struct dirent *","FAR struct dirent **"
|
||||
"rint","","","double_t","double_t"
|
||||
"sched_get_priority_max","sched.h","","int","int"
|
||||
"sched_get_priority_min","sched.h","","int","int"
|
||||
"sem_getvalue","semaphore.h","","int","FAR sem_t *","FAR int *"
|
||||
"sem_init","semaphore.h","","int","FAR sem_t *","int","unsigned int"
|
||||
"sigaddset","signal.h","!defined(CONFIG_DISABLE_SIGNALS)","int","FAR sigset_t *","int"
|
||||
"sigdelset","signal.h","!defined(CONFIG_DISABLE_SIGNALS)","int","FAR sigset_t *","int"
|
||||
"sigemptyset","signal.h","!defined(CONFIG_DISABLE_SIGNALS)","int","FAR sigset_t *"
|
||||
"sigfillset","signal.h","!defined(CONFIG_DISABLE_SIGNALS)","int","FAR sigset_t *"
|
||||
"sigismember","signal.h","!defined(CONFIG_DISABLE_SIGNALS)","int","FAR const sigset_t *","int"
|
||||
"snprintf","stdio.h","","int","FAR char *","size_t","const char *","..."
|
||||
"sprintf","stdio.h","","int","FAR char *","const char *","..."
|
||||
"sq_addafter","queue.h","","void","FAR sq_entry_t *","FAR sq_entry_t *","FAR sq_queue_t *"
|
||||
"sq_addfirst","queue.h","","void","FAR sq_entry_t *","sq_queue_t *"
|
||||
"sq_addlast","queue.h","","void","FAR sq_entry_t *","sq_queue_t *"
|
||||
"sq_rem","queue.h","","void","FAR sq_entry_t *","sq_queue_t *"
|
||||
"sq_remafter","queue.h","","FAR sq_entry_t","FAR sq_entry_t *","sq_queue_t *"
|
||||
"sq_remfirst","queue.h","","FAR sq_entry_t","sq_queue_t *"
|
||||
"sq_remlast","queue.h","","FAR sq_entry_t","sq_queue_t *"
|
||||
"srand","stdlib.h","","void","unsigned int"
|
||||
"sscanf","stdio.h","","int","const char *","const char *","..."
|
||||
"strcasecmp","string.h","","int","FAR const char *","FAR const char *"
|
||||
"strcasestr","string.h","","FAR char","FAR const char *","FAR const char *"
|
||||
"strcat","string.h","","FAR char","FAR char *","FAR const char *"
|
||||
"strchr","string.h","","FAR char","FAR const char *","int"
|
||||
"strcmp","string.h","","int","FAR const char *","FAR const char *"
|
||||
"strcpy","string.h","","FAR char","char *","FAR const char *"
|
||||
"strcspn","string.h","","size_t","FAR const char *","FAR const char *"
|
||||
"strdup","string.h","","FAR char","FAR const char *"
|
||||
"strerror","string.h","","FAR const char","int"
|
||||
"strftime","time.h","","size_t","char *","size_t","const char *","const struct tm *"
|
||||
"strlen","string.h","","size_t","FAR const char *"
|
||||
"strncasecmp","string.h","","int","FAR const char *","FAR const char *","size_t"
|
||||
"strncat","string.h","","FAR char","FAR char *","FAR const char *","size_t"
|
||||
"strncmp","string.h","","int","FAR const char *","FAR const char *","size_t"
|
||||
"strncpy","string.h","","FAR char","char *","FAR const char *","size_t"
|
||||
"strndup","string.h","","FAR char","FAR const char *","size_t"
|
||||
"strnlen","string.h","","size_t","FAR const char *","size_t"
|
||||
"strpbrk","string.h","","FAR char","FAR const char *","FAR const char *"
|
||||
"strrchr","string.h","","FAR char","FAR const char *","int"
|
||||
"strspn","string.h","","size_t","FAR const char *","FAR const char *"
|
||||
"strstr","string.h","","FAR char","FAR const char *","FAR const char *"
|
||||
"strtod","stdlib.h","","double_t","const char *str","char **endptr"
|
||||
"strtok","string.h","","FAR char","FAR char *","FAR const char *"
|
||||
"strtok_r","string.h","","FAR char","FAR char *","FAR const char *","FAR char **"
|
||||
"strtol","string.h","","long","const char *","char **","int"
|
||||
"strtoll","stdlib.h","defined(CONFIG_HAVE_LONG_LONG)","long long","const char *nptr","char **endptr","int base"
|
||||
"strtoul","stdlib.h","","unsigned long","const char *","char **","int"
|
||||
"strtoull","stdlib.h","defined(CONFIG_HAVE_LONG_LONG)","unsigned long long","const char *","char **","int"
|
||||
"tcflush","termios.h","CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_SERIAL_TERMIOS)","int","int","int"
|
||||
"tcgetattr","termios.h","CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_SERIAL_TERMIOS)","int","int","FAR struct termios *"
|
||||
"tcsetattr","termios.h","CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_SERIAL_TERMIOS)","int","int","int","FAR const struct termios *"
|
||||
"telldir","dirent.h","CONFIG_NFILE_DESCRIPTORS > 0","off_t","FAR DIR *"
|
||||
"time","time.h","","time_t","time_t *"
|
||||
"ub16divub16","fixedmath.h","","ub16_t","ub16_t","ub16_t"
|
||||
"ub16mulub16","fixedmath.h","","ub16_t","ub16_t","ub16_t"
|
||||
"ub16sqr","fixedmath.h","","ub16_t","ub16_t"
|
||||
"ungetc","stdio.h","CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","int","int","FAR FILE *"
|
||||
"vdbg","debug.h","!defined(CONFIG_CPP_HAVE_VARARGS) && defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_VERBOSE)","int","const char *","..."
|
||||
"vfprintf","stdio.h","CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","int","FAR FILE *","const char *","va_list"
|
||||
"vprintf","stdio.h","CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","int","FAR const char *","va_list"
|
||||
"vsnprintf","stdio.h","","int","FAR char *","size_t","const char *","va_list"
|
||||
"vsprintf","stdio.h","","int","FAR char *","const char *","va_list"
|
||||
"vsscanf","stdio.h","","int","char *","const char *","va_list"
|
||||
|
@@ -1,8 +1,8 @@
|
||||
/****************************************************************************
|
||||
* lib/libgen/lib_basename.c
|
||||
*
|
||||
* Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Copyright (C) 2007, 2009, 2011-2012 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -78,7 +78,7 @@ static char g_retchar[2];
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
char *basename(char *path)
|
||||
FAR char *basename(FAR char *path)
|
||||
{
|
||||
char *p;
|
||||
int len;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/****************************************************************************
|
||||
* lib/libgen/lib_dirname.c
|
||||
*
|
||||
* Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Copyright (C) 2007, 2009, 2011-2012 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -78,7 +78,7 @@ static char g_retchar[2];
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
char *dirname(char *path)
|
||||
FAR char *dirname(FAR char *path)
|
||||
{
|
||||
char *p;
|
||||
int len;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/math/lib_b16atan2.c
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/math/lib_b16cos.c
|
||||
*
|
||||
* Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/math/lib_b16sin.c
|
||||
*
|
||||
* Copyright (C) 2008, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/math/lib_fixedmath.c
|
||||
*
|
||||
* Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -165,7 +165,7 @@ ub16_t ub16mulub16(ub16_t m1, ub16_t m2)
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: b16divb16
|
||||
* Name: b16sqr
|
||||
**************************************************************************/
|
||||
|
||||
b16_t b16sqr(b16_t a)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/math/lib_rint.c
|
||||
*
|
||||
* Copyright (C) 2007, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/net/lib_etherntoa.c
|
||||
*
|
||||
* Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -58,7 +58,7 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
char *ether_ntoa(const struct ether_addr *addr)
|
||||
FAR char *ether_ntoa(FAR const struct ether_addr *addr)
|
||||
{
|
||||
static char buffer[20];
|
||||
sprintf(buffer, "%02x:%02x:%02x:%02x:%02x:%02x",
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/net/lib_ntohl.c
|
||||
*
|
||||
* Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/net/lib_htons.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/pthread/pthread_attrdestroy.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/pthread/pthread_attrgetinheritsched.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/pthread/pthread_attrgetschedparam.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/pthread/pthread_attrgetschedpolicy.c
|
||||
*
|
||||
* Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/pthread/pthread_attrgetstacksize.c
|
||||
*
|
||||
* Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/pthread/pthread_attrinit.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/pthread/pthread_attrsetinheritsched.c
|
||||
*
|
||||
* Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/pthread/pthread_attrsetschedparam.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/pthread/pthread_attrsetschedpolicy.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/pthread/pthread_attrsetstacksize.c
|
||||
*
|
||||
* Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/pthread/pthread_barrierattrdestroy.c
|
||||
*
|
||||
* Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/pthread/pthread_barrierattrgetpshared.c
|
||||
*
|
||||
* Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/pthread/pthread_barrierattrinit.c
|
||||
*
|
||||
* Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/pthread/pthread_barrierattrsetpshared.c
|
||||
*
|
||||
* Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/pthread/pthread_condattrdestroy.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/pthread/pthread_condattrinit.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/pthread/pthread_mutexattrdestroy.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/pthread/pthread_mutexattrgetpshared.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/pthread/pthread_mutexattrgettype.c
|
||||
*
|
||||
* Copyright (C) 2008, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/pthread/pthread_mutexattrinit.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/pthread/pthread_mutexattrsetpshared.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/pthread/pthread_mutexattrsettype.c
|
||||
*
|
||||
* Copyright (C) 2008, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/sched/sched_getprioritymax.c
|
||||
*
|
||||
* Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/sched/sched_getprioritymin.c
|
||||
*
|
||||
* Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/semaphore/sem_getvalue.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/signal/sig_addset.c
|
||||
*
|
||||
* Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/signal/sig_delset.c
|
||||
*
|
||||
* Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/signal/sig_emptyset.c
|
||||
*
|
||||
* Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/signal/sig_fillset.c
|
||||
*
|
||||
* Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/signal/sig_ismember.c
|
||||
*
|
||||
* Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -50,7 +50,8 @@ CSRCS += lib_fopen.c lib_fclose.c lib_fread.c lib_libfread.c lib_fseek.c \
|
||||
lib_gets.c lib_fwrite.c lib_libfwrite.c lib_fflush.c \
|
||||
lib_libflushall.c lib_libfflush.c lib_rdflush.c lib_wrflush.c \
|
||||
lib_fputc.c lib_puts.c lib_fputs.c lib_ungetc.c lib_vprintf.c \
|
||||
lib_fprintf.c lib_vfprintf.c lib_stdinstream.c lib_stdoutstream.c
|
||||
lib_fprintf.c lib_vfprintf.c lib_stdinstream.c lib_stdoutstream.c \
|
||||
lib_perror.c
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/stdio/lib_fflush.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -97,22 +97,36 @@
|
||||
|
||||
int fflush(FAR FILE *stream)
|
||||
{
|
||||
int ret;
|
||||
|
||||
/* Is the stream argument NULL? */
|
||||
|
||||
if (!stream)
|
||||
{
|
||||
/* Yes... then this is a request to flush all streams */
|
||||
|
||||
return lib_flushall(sched_getstreams());
|
||||
ret = lib_flushall(sched_getstreams());
|
||||
}
|
||||
else if (lib_fflush(stream, true) != 0)
|
||||
else
|
||||
{
|
||||
/* An error occurred during the flush AND/OR we were unable to flush all
|
||||
* of the buffered write data. Return EOF on failure.
|
||||
ret = lib_fflush(stream, true);
|
||||
}
|
||||
|
||||
/* Check the return value */
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
/* An error occurred during the flush AND/OR we were unable to flush
|
||||
* all of the buffered write data. Set the errno value.
|
||||
*/
|
||||
|
||||
set_errno(-ret);
|
||||
|
||||
/* And return EOF on failure. */
|
||||
|
||||
return EOF;
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/stdio/lib_fgetc.c
|
||||
*
|
||||
* Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/stdio/lib_fgetpos.c
|
||||
*
|
||||
* Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/stdio/lib_fileno.c
|
||||
*
|
||||
* Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -63,6 +63,7 @@ int fileno(FAR FILE *stream)
|
||||
set_errno(EBADF);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif /* CONFIG_NFILE_STREAMS */
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/stdio/lib_fread.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/stdio/lib_fseek.c
|
||||
*
|
||||
* Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/stdio/lib_fsetpos.c
|
||||
*
|
||||
* Copyright (C) 2008, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/stdio/lib_ftell.c
|
||||
*
|
||||
* Copyright (C) 2008, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/stdio/lib_fwrite.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -98,8 +98,8 @@
|
||||
* bforce - flush must be complete.
|
||||
*
|
||||
* Return:
|
||||
* ERROR on failure, otherwise the number of bytes remaining in the buffer.
|
||||
* If bforce is set, then only the values ERROR and 0 will be returned.
|
||||
* A negated errno value on failure, otherwise the number of bytes remaining
|
||||
* in the buffer.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
@@ -114,8 +114,7 @@ ssize_t lib_fflush(FAR FILE *stream, bool bforce)
|
||||
|
||||
if (stream->fs_filedes < 0 || (stream->fs_oflags & O_WROK) == 0)
|
||||
{
|
||||
set_errno(EBADF);
|
||||
return ERROR;
|
||||
return -EBADF;
|
||||
}
|
||||
|
||||
/* Make sure that we have exclusive access to the stream */
|
||||
@@ -132,8 +131,11 @@ ssize_t lib_fflush(FAR FILE *stream, bool bforce)
|
||||
|
||||
if (stream->fs_bufread != stream->fs_bufstart)
|
||||
{
|
||||
/* The buffer holds read data... just return zero */
|
||||
/* The buffer holds read data... just return zero meaning "no bytes
|
||||
* remaining in the buffer."
|
||||
*/
|
||||
|
||||
lib_give_semaphore(stream);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -151,8 +153,12 @@ ssize_t lib_fflush(FAR FILE *stream, bool bforce)
|
||||
bytes_written = write(stream->fs_filedes, src, nbuffer);
|
||||
if (bytes_written < 0)
|
||||
{
|
||||
/* Write failed. The cause of the failure is in 'errno'.
|
||||
* returned the negated errno value.
|
||||
*/
|
||||
|
||||
lib_give_semaphore(stream);
|
||||
return ERROR;
|
||||
return -get_errno();
|
||||
}
|
||||
|
||||
/* Handle partial writes. fflush() must either return with
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/****************************************************************************
|
||||
* lib/stdio/lib_libflushall.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Copyright (C) 2007-2009, 2011-2012 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -91,7 +91,7 @@
|
||||
int lib_flushall(FAR struct streamlist *list)
|
||||
{
|
||||
int lasterrno = OK;
|
||||
int ret = OK;
|
||||
int ret;
|
||||
|
||||
/* Make sure that there are streams associated with this thread */
|
||||
|
||||
@@ -115,25 +115,23 @@ int lib_flushall(FAR struct streamlist *list)
|
||||
{
|
||||
/* Flush the writable FILE */
|
||||
|
||||
if (lib_fflush(stream, true) != 0)
|
||||
ret = lib_fflush(stream, true);
|
||||
if (ret < 0)
|
||||
{
|
||||
/* An error occurred during the flush AND/OR we were unable
|
||||
* to flush all of the buffered write data. Return EOF on failure.
|
||||
* to flush all of the buffered write data. Remember the
|
||||
* last errcode.
|
||||
*/
|
||||
|
||||
lasterrno = get_errno();
|
||||
ret = ERROR;
|
||||
lasterrno = ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stream_semgive(list);
|
||||
}
|
||||
|
||||
/* If any flush failed, return that last failed flush */
|
||||
/* If any flush failed, return the errorcode of the last failed flush */
|
||||
|
||||
if (ret != OK)
|
||||
{
|
||||
set_errno(lasterrno);
|
||||
}
|
||||
return ret;
|
||||
return lasterrno;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/****************************************************************************
|
||||
* lib/stdio/lib_libfread.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Copyright (C) 2007-2009, 2011-2012 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -88,6 +88,7 @@ ssize_t lib_fread(FAR void *ptr, size_t count, FAR FILE *stream)
|
||||
{
|
||||
unsigned char *dest = (unsigned char*)ptr;
|
||||
ssize_t bytes_read;
|
||||
int ret;
|
||||
|
||||
/* Make sure that reading from this stream is allowed */
|
||||
|
||||
@@ -127,9 +128,11 @@ ssize_t lib_fread(FAR void *ptr, size_t count, FAR FILE *stream)
|
||||
* buffered read/write access.
|
||||
*/
|
||||
|
||||
if (lib_wrflush(stream) != 0)
|
||||
ret = lib_wrflush(stream);
|
||||
if (ret < 0)
|
||||
{
|
||||
return ERROR;
|
||||
lib_give_semaphore(stream);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Now get any other needed chars from the buffer or the file. */
|
||||
@@ -176,15 +179,17 @@ ssize_t lib_fread(FAR void *ptr, size_t count, FAR FILE *stream)
|
||||
bytes_read = read(stream->fs_filedes, dest, count);
|
||||
if (bytes_read < 0)
|
||||
{
|
||||
/* An error occurred on the read */
|
||||
/* An error occurred on the read. The error code is
|
||||
* in the 'errno' variable.
|
||||
*/
|
||||
|
||||
goto err_out;
|
||||
goto errout_with_errno;
|
||||
}
|
||||
else if (bytes_read == 0)
|
||||
{
|
||||
/* We are at the end of the file */
|
||||
|
||||
goto short_read;
|
||||
goto shortread;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -198,7 +203,7 @@ ssize_t lib_fread(FAR void *ptr, size_t count, FAR FILE *stream)
|
||||
{
|
||||
/* No. We must be at the end of file. */
|
||||
|
||||
goto short_read;
|
||||
goto shortread;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -219,15 +224,17 @@ ssize_t lib_fread(FAR void *ptr, size_t count, FAR FILE *stream)
|
||||
bytes_read = read(stream->fs_filedes, stream->fs_bufread, buffer_available);
|
||||
if (bytes_read < 0)
|
||||
{
|
||||
/* An error occurred on the read */
|
||||
/* An error occurred on the read. The error code is
|
||||
* in the 'errno' variable.
|
||||
*/
|
||||
|
||||
goto err_out;
|
||||
goto errout_with_errno;
|
||||
}
|
||||
else if (bytes_read == 0)
|
||||
{
|
||||
/* We are at the end of the file */
|
||||
|
||||
goto short_read;
|
||||
goto shortread;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -246,7 +253,11 @@ ssize_t lib_fread(FAR void *ptr, size_t count, FAR FILE *stream)
|
||||
bytes_read = read(stream->fs_filedes, dest, count);
|
||||
if (bytes_read < 0)
|
||||
{
|
||||
goto err_out;
|
||||
/* An error occurred on the read. The error code is
|
||||
* in the 'errno' variable.
|
||||
*/
|
||||
|
||||
goto errout_with_errno;
|
||||
}
|
||||
else if (bytes_read == 0)
|
||||
{
|
||||
@@ -259,13 +270,21 @@ ssize_t lib_fread(FAR void *ptr, size_t count, FAR FILE *stream)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
/* Here after a successful (but perhaps short) read */
|
||||
|
||||
#if CONFIG_STDIO_BUFFER_SIZE > 0
|
||||
short_read:
|
||||
shortread:
|
||||
#endif
|
||||
bytes_read = dest - (unsigned char*)ptr;
|
||||
err_out:
|
||||
lib_give_semaphore(stream);
|
||||
}
|
||||
return bytes_read;
|
||||
|
||||
lib_give_semaphore(stream);
|
||||
return bytes_read;
|
||||
|
||||
/* Error exits */
|
||||
|
||||
errout_with_errno:
|
||||
lib_give_semaphore(stream);
|
||||
return -get_errno();
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/stdio/lib_libsprintf.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
/****************************************************************************
|
||||
* lib/stdio/lib_perror.c
|
||||
*
|
||||
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* POSIX requires that perror provide its output on stderr. This option may
|
||||
* be defined, however, to provide perror output that is serialized with
|
||||
* other stdout messages.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_LIBC_PERROR_STDOUT
|
||||
# define PERROR_STREAM stdout
|
||||
#else
|
||||
# define PERROR_STREAM stderr
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Type Declarations
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: perror
|
||||
****************************************************************************/
|
||||
|
||||
void perror(FAR const char *s)
|
||||
{
|
||||
|
||||
/* If strerror() is not enabled, then just print the error number */
|
||||
|
||||
#ifdef CONFIG_LIBC_STRERROR
|
||||
(void)fprintf(PERROR_STREAM, "%s: %s\n", s, strerror(errno));
|
||||
#else
|
||||
(void)fprintf(PERROR_STREAM, "%s: Error %d\n", s, errno);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/stdio/lib_rdflush.c
|
||||
*
|
||||
* Copyright (C) 2008, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/stdio/lib_snprintf.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/stdio/lib_sprintf.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/stdio/lib_sscanf.c
|
||||
*
|
||||
* Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/stdio/lib_syslogstream.c
|
||||
*
|
||||
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/stdio/lib_ungetc.c
|
||||
*
|
||||
* Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/stdio/lib_vfprintf.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/stdio/lib_vprintf.c
|
||||
*
|
||||
* Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/stdio/lib_vsnprintf.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/stdio/lib_vsprintf.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/****************************************************************************
|
||||
* lib/stdio/lib_wrflush.c
|
||||
*
|
||||
* Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Copyright (C) 2008-2009, 2011-2012 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -88,29 +88,47 @@
|
||||
|
||||
int lib_wrflush(FAR FILE *stream)
|
||||
{
|
||||
#if CONFIG_STDIO_BUFFER_SIZE > 0
|
||||
/* Verify that we were passed a valid (i.e., non-NULL) stream */
|
||||
|
||||
#if CONFIG_STDIO_BUFFER_SIZE > 0
|
||||
if (stream)
|
||||
#ifdef CONFIG_DEBUG
|
||||
if (!stream)
|
||||
{
|
||||
/* Verify that the stream is opened for writing... lib_fflush will
|
||||
* return an error if it is called for a stream that is not opened for
|
||||
* writing.
|
||||
return -EINVAL;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Verify that the stream is opened for writing... lib_fflush will
|
||||
* return an error if it is called for a stream that is not opened for
|
||||
* writing. Check that first so that this function will not fail in
|
||||
* that case.
|
||||
*/
|
||||
|
||||
if ((stream->fs_oflags & O_WROK) == 0)
|
||||
{
|
||||
/* Report that the success was successful if we attempt to flush a
|
||||
* read-only stream.
|
||||
*/
|
||||
|
||||
if ((stream->fs_oflags & O_WROK) == 0 ||
|
||||
lib_fflush(stream, true) == 0)
|
||||
{
|
||||
/* Return success if there is no buffered write data -- i.e., that
|
||||
* the stream is not opened for writing or, if it is, that all of
|
||||
* the buffered write data was successfully flushed.
|
||||
*/
|
||||
|
||||
return OK;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
return ERROR;
|
||||
|
||||
/* Flush the stream. Return success if there is no buffered write data
|
||||
* -- i.e., that the stream is opened for writing and that all of the
|
||||
* buffered write data was successfully flushed by lib_fflush().
|
||||
*/
|
||||
|
||||
return lib_fflush(stream, true);
|
||||
#else
|
||||
return stream ? OK : ERROR;
|
||||
/* Verify that we were passed a valid (i.e., non-NULL) stream */
|
||||
|
||||
#ifdef CONFIG_DEBUG
|
||||
if (!stream)
|
||||
{
|
||||
return -EINVAL;
|
||||
}
|
||||
#endif
|
||||
|
||||
return OK;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/stdio/lib_zeroinstream.c
|
||||
*
|
||||
* Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/stdlib/lib_abs.c
|
||||
*
|
||||
* Copyright (C) 2010-2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/stdlib//lib_abs.c
|
||||
*
|
||||
* Copyright (C) 2010-2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/stdlib/lib_labs.c
|
||||
*
|
||||
* Copyright (C) 2010-2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/stdlib/lib_llabs.c
|
||||
*
|
||||
* Copyright (C) 2010-2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/stdlib/lib_qsort.c
|
||||
*
|
||||
* Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Leveraged from:
|
||||
*
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/stdlib/lib_rand.c
|
||||
*
|
||||
* Copyright (C) 2007, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/************************************************************************
|
||||
* lib/string/lib_strerror.c
|
||||
*
|
||||
* Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Copyright (C) 2007, 2009, 2011-2012 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -61,6 +61,8 @@ struct errno_strmap_s
|
||||
* Private Data
|
||||
************************************************************************/
|
||||
|
||||
#ifdef CONFIG_LIBC_STRERROR
|
||||
|
||||
/* This table maps all error numbers to descriptive strings.
|
||||
* The only assumption that the code makes with regard to this
|
||||
* this table is that it is ordered by error number.
|
||||
@@ -70,6 +72,8 @@ struct errno_strmap_s
|
||||
* strings.
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_LIBC_STRERROR_SHORT
|
||||
|
||||
static const struct errno_strmap_s g_errnomap[] =
|
||||
{
|
||||
{ EPERM, EPERM_STR },
|
||||
@@ -196,8 +200,140 @@ static const struct errno_strmap_s g_errnomap[] =
|
||||
{ EMEDIUMTYPE, EMEDIUMTYPE_STR }
|
||||
};
|
||||
|
||||
#else /* CONFIG_LIBC_STRERROR_SHORT */
|
||||
|
||||
static const struct errno_strmap_s g_errnomap[] =
|
||||
{
|
||||
{ EPERM, "EPERM" },
|
||||
{ ENOENT, "ENOENT" },
|
||||
{ ESRCH, "ESRCH" },
|
||||
{ EINTR, "EINTR" },
|
||||
{ EIO, "EIO" },
|
||||
{ ENXIO, "ENXIO" },
|
||||
{ E2BIG, "E2BIG" },
|
||||
{ ENOEXEC, "ENOEXEC" },
|
||||
{ EBADF, "EBADF" },
|
||||
{ ECHILD, "ECHILD" },
|
||||
{ EAGAIN, "EAGAIN" },
|
||||
{ ENOMEM, "ENOMEM" },
|
||||
{ EACCES, "EACCES" },
|
||||
{ EFAULT, "EFAULT" },
|
||||
{ ENOTBLK, "ENOTBLK" },
|
||||
{ EBUSY, "EBUSY" },
|
||||
{ EEXIST, "EEXIST" },
|
||||
{ EXDEV, "EXDEV" },
|
||||
{ ENODEV, "ENODEV" },
|
||||
{ ENOTDIR, "ENOTDIR" },
|
||||
{ EISDIR, "EISDIR" },
|
||||
{ EINVAL, "EINVAL" },
|
||||
{ ENFILE, "ENFILE" },
|
||||
{ EMFILE, "EMFILE" },
|
||||
{ ENOTTY, "ENOTTY" },
|
||||
{ ETXTBSY, "ETXTBSY" },
|
||||
{ EFBIG, "EFBIG" },
|
||||
{ ENOSPC, "ENOSPC" },
|
||||
{ ESPIPE, "ESPIPE" },
|
||||
{ EROFS, "EROFS" },
|
||||
{ EMLINK, "EMLINK" },
|
||||
{ EPIPE, "EPIPE" },
|
||||
{ EDOM, "EDOM" },
|
||||
{ ERANGE, "ERANGE" },
|
||||
{ EDEADLK, "EDEADLK" },
|
||||
{ ENAMETOOLONG, "ENAMETOOLONG" },
|
||||
{ ENOLCK, "ENOLCK" },
|
||||
{ ENOSYS, "ENOSYS" },
|
||||
{ ENOTEMPTY, "ENOTEMPTY" },
|
||||
{ ELOOP, "ELOOP" },
|
||||
{ ENOMSG, "ENOMSG" },
|
||||
{ EIDRM, "EIDRM" },
|
||||
{ ECHRNG, "ECHRNG" },
|
||||
{ EL2NSYNC, "EL2NSYNC" },
|
||||
{ EL3HLT, "EL3HLT" },
|
||||
{ EL3RST, "EL3RST" },
|
||||
{ EL3RST, "EL3RST" },
|
||||
{ EUNATCH, "EUNATCH" },
|
||||
{ ENOCSI, "ENOCSI" },
|
||||
{ EL2HLT, "EL2HLT" },
|
||||
{ EBADE, "EBADE" },
|
||||
{ EBADR, "EBADR" },
|
||||
{ EXFULL, "EXFULL" },
|
||||
{ ENOANO, "ENOANO" },
|
||||
{ EBADRQC, "EBADRQC" },
|
||||
{ EBADSLT, "EBADSLT" },
|
||||
{ EBFONT, "EBFONT" },
|
||||
{ ENOSTR, "ENOSTR" },
|
||||
{ ENODATA, "ENODATA" },
|
||||
{ ETIME, "ETIME" },
|
||||
{ ENOSR, "ENOSR" },
|
||||
{ ENONET, "ENONET" },
|
||||
{ ENOPKG, "ENOPKG" },
|
||||
{ EREMOTE, "EREMOTE" },
|
||||
{ ENOLINK, "ENOLINK" },
|
||||
{ EADV, "EADV" },
|
||||
{ ESRMNT, "ESRMNT" },
|
||||
{ ECOMM, "ECOMM" },
|
||||
{ EPROTO, "EPROTO" },
|
||||
{ EMULTIHOP, "EMULTIHOP" },
|
||||
{ EDOTDOT, "EDOTDOT" },
|
||||
{ EBADMSG, "EBADMSG" },
|
||||
{ EOVERFLOW, "EOVERFLOW" },
|
||||
{ ENOTUNIQ, "ENOTUNIQ" },
|
||||
{ EBADFD, "EBADFD" },
|
||||
{ EREMCHG, "EREMCHG" },
|
||||
{ ELIBACC, "ELIBACC" },
|
||||
{ ELIBBAD, "ELIBBAD" },
|
||||
{ ELIBSCN, "ELIBSCN" },
|
||||
{ ELIBMAX, "ELIBMAX" },
|
||||
{ ELIBEXEC, "ELIBEXEC" },
|
||||
{ EILSEQ, "EILSEQ" },
|
||||
{ ERESTART, "ERESTART" },
|
||||
{ ESTRPIPE, "ESTRPIPE" },
|
||||
{ EUSERS, "EUSERS" },
|
||||
{ ENOTSOCK, "ENOTSOCK" },
|
||||
{ EDESTADDRREQ, "EDESTADDRREQ" },
|
||||
{ EMSGSIZE, "EMSGSIZE" },
|
||||
{ EPROTOTYPE, "EPROTOTYPE" },
|
||||
{ ENOPROTOOPT, "ENOPROTOOPT" },
|
||||
{ EPROTONOSUPPORT, "EPROTONOSUPPORT" },
|
||||
{ ESOCKTNOSUPPORT, "ESOCKTNOSUPPORT" },
|
||||
{ EOPNOTSUPP, "EOPNOTSUPP" },
|
||||
{ EPFNOSUPPORT, "EPFNOSUPPORT" },
|
||||
{ EAFNOSUPPORT, "EAFNOSUPPORT" },
|
||||
{ EADDRINUSE, "EADDRINUSE" },
|
||||
{ EADDRNOTAVAIL, "EADDRNOTAVAIL" },
|
||||
{ ENETDOWN, "ENETDOWN" },
|
||||
{ ENETUNREACH, "ENETUNREACH" },
|
||||
{ ENETRESET, "ENETRESET" },
|
||||
{ ECONNABORTED, "ECONNABORTED" },
|
||||
{ ECONNRESET, "ECONNRESET" },
|
||||
{ ENOBUFS, "ENOBUFS" },
|
||||
{ EISCONN, "EISCONN" },
|
||||
{ ENOTCONN, "ENOTCONN" },
|
||||
{ ESHUTDOWN, "ESHUTDOWN" },
|
||||
{ ETOOMANYREFS, "ETOOMANYREFS" },
|
||||
{ ETIMEDOUT, "ETIMEDOUT" },
|
||||
{ ECONNREFUSED, "ECONNREFUSED" },
|
||||
{ EHOSTDOWN, "EHOSTDOWN" },
|
||||
{ EHOSTUNREACH, "EHOSTUNREACH" },
|
||||
{ EALREADY, "EALREADY" },
|
||||
{ EINPROGRESS, "EINPROGRESS" },
|
||||
{ ESTALE, "ESTALE" },
|
||||
{ EUCLEAN, "EUCLEAN" },
|
||||
{ ENOTNAM, "ENOTNAM" },
|
||||
{ ENAVAIL, "ENAVAIL" },
|
||||
{ EISNAM, "EISNAM" },
|
||||
{ EREMOTEIO, "EREMOTEIO" },
|
||||
{ EDQUOT, "EDQUOT" },
|
||||
{ ENOMEDIUM, "ENOMEDIUM" },
|
||||
{ EMEDIUMTYPE, "EMEDIUMTYPE" }
|
||||
};
|
||||
|
||||
#endif /* CONFIG_LIBC_STRERROR_SHORT */
|
||||
|
||||
#define NERRNO_STRS (sizeof(g_errnomap) / sizeof(struct errno_strmap_s))
|
||||
|
||||
#endif /* CONFIG_LIBC_STRERROR */
|
||||
|
||||
/************************************************************************
|
||||
* Private Functions
|
||||
************************************************************************/
|
||||
@@ -210,8 +346,9 @@ static const struct errno_strmap_s g_errnomap[] =
|
||||
* Name: strerror
|
||||
************************************************************************/
|
||||
|
||||
const char *strerror(int errnum)
|
||||
FAR const char *strerror(int errnum)
|
||||
{
|
||||
#ifdef CONFIG_LIBC_STRERROR
|
||||
int ndxlow = 0;
|
||||
int ndxhi = NERRNO_STRS - 1;
|
||||
int ndxmid;
|
||||
@@ -233,5 +370,6 @@ const char *strerror(int errnum)
|
||||
}
|
||||
}
|
||||
while (ndxlow <= ndxhi);
|
||||
#endif
|
||||
return "Unknown error";
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
char *strtok_r(char *str, const char *delim, char **saveptr)
|
||||
FAR char *strtok_r(FAR char *str, FAR const char *delim, FAR char **saveptr)
|
||||
{
|
||||
char *pbegin;
|
||||
char *pend = NULL;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/time/lib_calendar2utc.c
|
||||
*
|
||||
* Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/time/lib_daysbeforemonth.c
|
||||
*
|
||||
* Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/time/lib_gmtime.c
|
||||
*
|
||||
* Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/time/lib_gmtimer.c
|
||||
*
|
||||
* Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/time/lib_isleapyear.c
|
||||
*
|
||||
* Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/time/lib_mktime.c
|
||||
*
|
||||
* Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/time/lib_strftime.c
|
||||
*
|
||||
* Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/time/lib_time.c
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/unistd/lib_chdir.c
|
||||
*
|
||||
* Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/unistd/lib_getcwd.c
|
||||
*
|
||||
* Copyright (C) 2008, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/unistd/lib_getopt.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* lib/unistd/lib_getoptargp.c
|
||||
*
|
||||
* Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user