This commit is contained in:
Anton D. Kachalov
2015-08-10 18:16:09 +03:00
29 changed files with 2527 additions and 147 deletions
+2 -2
View File
@@ -379,11 +379,11 @@
#define ECANCELED_STR "Operation cancelled"
/************************************************************************
* Type Declarations
* Public Type Definitions
************************************************************************/
/************************************************************************
* Global Function Prototypes
* Public Function Prototypes
************************************************************************/
#undef EXTERN
+1 -1
View File
@@ -51,7 +51,7 @@
#define MQ_NONBLOCK O_NONBLOCK
/********************************************************************************
* Global Type Declarations
* Public Type Declarations
********************************************************************************/
/* Message queue attributes */
+108 -20
View File
@@ -1,7 +1,7 @@
/************************************************************************************
* include/nuttx/can.h
*
* Copyright (C) 2008, 2009, 2011-2012 Gregory Nutt. All rights reserved.
* Copyright (C) 2008, 2009, 2011-2012, 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -49,6 +49,7 @@
#include <semaphore.h>
#include <nuttx/fs/fs.h>
#include <nuttx/fs/ioctl.h>
#ifdef CONFIG_CAN
@@ -60,6 +61,8 @@
* CONFIG_STM32_CAN2 must also be defined)
* CONFIG_CAN_EXTID - Enables support for the 29-bit extended ID. Default
* Standard 11-bit IDs.
* CONFIG_CAN_FD - Enable support for CAN FD mode. For the upper half driver, this
* just means handling encoded DLC values (for values of DLC > 9).
* CONFIG_CAN_FIFOSIZE - The size of the circular buffer of CAN messages.
* Default: 8
* CONFIG_CAN_NPENDINGRTR - The size of the list of pending RTR requests.
@@ -88,7 +91,63 @@
# define CONFIG_CAN_NPENDINGRTR 255
#endif
/* Convenience macros */
/* Ioctl Commands *******************************************************************/
/* Ioctl commands supported by the upper half CAN driver.
*
* CANIOC_RTR:
* Description: Send the remote transmission request and wait for the response.
* Argument: A reference to struct canioc_rtr_s
*
* Ioctl commands that may or may not be supported by the lower half CAN driver.
*
* CANIOC_ADD_STDFILTER:
* Description: Add an address filter for a standard 11 bit address.
* Argument: A reference to struct canioc_stdfilter_s
* Returned Value: A non-negative filter ID is returned on success.
* Otherwise -1 (ERROR) is returned with the errno
* variable set to indicate the nature of the error.
* Dependencies: Requires CONFIG_CAN_EXID *not* defined
*
* CANIOC_ADD_EXTFILTER:
* Description: Add an address filter for a extended 29 bit address.
* Argument: A reference to struct canioc_extfilter_s
* Returned Value: A non-negative filter ID is returned on success.
* Otherwise -1 (ERROR) is returned with the errno
* variable set to indicate the nature of the error.
* Dependencies: Requires CONFIG_CAN_EXID=y
*
* CANIOC_DEL_STDFILTER:
* Description: Remove an address filter for a standard 11 bit address.
* Argument: The filter index previously returned by the
* CANIOC_ADD_STDFILTER command
* Returned Value: Zero (OK) is returned on success. Otherwise -1 (ERROR)
* is returned with the errno variable set to indicate the
* nature of the error.
* Dependencies: Requires CONFIG_CAN_EXID *not* defined
*
* CANIOC_DEL_EXTFILTER:
* Description: Remove an address filter for a standard 29 bit address.
* Argument: The filter index previously returned by the
* CANIOC_ADD_EXTFILTER command
* Returned Value: Zero (OK) is returned on success. Otherwise -1 (ERROR)
* is returned with the errno variable set to indicate the
* nature of the error.
* Dependencies: Requires CONFIG_CAN_EXID=y
*/
#define CANIOC_RTR _CANIOC(1)
#define CANIOC_ADD_STDFILTER _CANIOC(2)
#define CANIOC_ADD_EXTFILTER _CANIOC(3)
#define CANIOC_DEL_STDFILTER _CANIOC(4)
#define CANIOC_DEL_EXTFILTER _CANIOC(5)
/* CANIOC_USER: Device specific ioctl calls can be supported with cmds greater
* than this value
*/
#define CANIOC_USER _CANIOC(6)
/* Convenience macros ***************************************************************/
#define dev_reset(dev) dev->cd_ops->co_reset(dev)
#define dev_setup(dev) dev->cd_ops->co_setup(dev)
@@ -101,50 +160,57 @@
#define dev_txready(dev) dev->cd_ops->co_txready(dev)
#define dev_txempty(dev) dev->cd_ops->co_txempty(dev)
/* CAN message support */
/* CAN message support **************************************************************/
#define CAN_MAXDATALEN 8
#define CAN_MAX_MSGID 0x07ff
#ifdef CONFIG_CAN_FD
# define CAN_MAXDATALEN 64
#else
# define CAN_MAXDATALEN 8
#endif
#define CAN_MAX_STDMSGID 0x07ff
#define CAN_MAX_EXTMSGID 0x1fffffff
#define CAN_MSGLEN(nbytes) (sizeof(struct can_msg_s) - CAN_MAXDATALEN + (nbytes))
/* Built-in ioctl commands
*
* CANIOCTL_RTR: Send the remote transmission request and wait for the response.
/* CAN filter support ***************************************************************/
/* Some CAN hardware supports a notion of prioritizing messages that match filters.
* Only two priority levels are currently supported and are encoded as defined
* below:
*/
#define CANIOCTL_RTR 1 /* Argument is a reference to struct canioctl_rtr_s */
#define CAN_MSGPRIO_LOW 0
#define CAN_MSGPRIO_HIGH 1
/* CANIOCTL_USER: Device specific ioctl calls can be supported with cmds greater
* than this value
*/
/* Filter type. Not all CAN hardware will support all filter types. */
#define CANIOCTL_USER 2
#define CAN_FILTER_MASK 0 /* Address match under a mask */
#define CAN_FILTER_DUAL 1 /* Dual address match */
#define CAN_FILTER_RANGE 2 /* Match a range of addresses */
/************************************************************************************
* Public Types
************************************************************************************/
/* CAN-message Format (without Extended ID suppport)
/* CAN-message Format (without Extended ID support)
*
* One based CAN-message is represented with a maximum of 10 bytes. A message is
* composed of at least the first 2 bytes (when there are no data bytes present).
*
* Bytes 0-1: Hold a 16-bit value in host byte order
* Bits 0-3: Data Length Code (DLC)
* Bit 4: Remote Tranmission Request (RTR)
* Bit 4: Remote Transmission Request (RTR)
* Bits 5-15: The 11-bit CAN identifier
*
* Bytes 2-9: CAN data
*
* CAN-message Format (with Extended ID suppport)
* CAN-message Format (with Extended ID support)
*
* One CAN-message consists of a maximum of 13 bytes. A message is composed of at
* least the first 5 bytes (when there are no data bytes).
*
* Bytes 0-3: Hold 11- or 29-bit CAN ID in host byte order
* Byte 4: Bits 0-3: Data Length Code (DLC)
* Bit 4: Remote Tranmission Request (RTR)
* Bit 4: Remote Transmission Request (RTR)
* Bit 5: Extended ID indication
* Bits 6-7: Unused
* Bytes 5-12: CAN data
@@ -158,7 +224,7 @@
#ifdef CONFIG_CAN_EXTID
struct can_hdr_s
{
uint32_t ch_id; /* 11- or 29-bit ID (3-bits unsed) */
uint32_t ch_id; /* 11- or 29-bit ID (3-bits unused) */
uint8_t ch_dlc : 4; /* 4-bit DLC */
uint8_t ch_rtr : 1; /* RTR indication */
uint8_t ch_extid : 1; /* Extended ID indication */
@@ -167,7 +233,7 @@ struct can_hdr_s
#else
struct can_hdr_s
{
uint16_t ch_dlc : 4; /* 4-bit DLC */
uint16_t ch_dlc : 4; /* 4-bit DLC. May be encoded in CAN_FD mode. */
uint16_t ch_rtr : 1; /* RTR indication */
uint16_t ch_id : 11; /* 11-bit standard ID */
} packed_struct;
@@ -296,12 +362,34 @@ struct can_dev_s
/* Structures used with ioctl calls */
struct canioctl_rtr_s
struct canioc_rtr_s
{
uint16_t ci_id; /* The 11-bit ID to use in the RTR message */
FAR struct can_msg_s *ci_msg; /* The location to return the RTR response */
};
#ifdef CONFIG_CAN_EXTID
struct canioc_extfilter_s
{
uint32_t xf_id1; /* 29-bit ID. For dual match or for the
* lower address in a range of addresses */
uint32_t xf_id2; /* 29-bit ID. For dual match, address mask
* or for upper address in address range */
uint8_t xf_type; /* See CAN_FILTER_* definitions */
uint8_t xf_prio; /* See CAN_MSGPRIO_* definitions */
};
#else
struct canioc_stdfilter_s
{
uint16_t sf_id1; /* 11-bit ID. For dual match or for the
* lower address in a range of addresses */
uint16_t sf_id2; /* 11-bit ID. For dual match, address mask
* or for upper address in address range */
uint8_t sf_type; /* See CAN_FILTER_* definitions */
uint8_t sf_prio; /* See CAN_MSGPRIO_* definitions */
};
#endif
/************************************************************************************
* Public Data
************************************************************************************/
+8 -1
View File
@@ -76,7 +76,8 @@
#define _PIPEBASE (0x1700) /* FIFO/pipe ioctl commands */
#define _RTCBASE (0x1800) /* RTC ioctl commands */
#define _RELAYBASE (0x1900) /* Relay devices ioctl commands */
#define _BOARDBASE (0x1a00) /* boardctl commands */
#define _CANBASE (0x1a00) /* CAN ioctl commands */
#define _BOARDBASE (0x1b00) /* boardctl ioctl commands */
/* Macros used to manage ioctl commands */
@@ -348,6 +349,12 @@
#define _RELAYIOCVALID(c) (_IOC_TYPE(c)==_RELAYBASE)
#define _RELAYIOC(nr) _IOC(_RELAYBASE,nr)
/* CAN driver ioctl definitions *********************************************/
/* (see nuttx/can.h */
#define _CANIOCVALID(c) (_IOC_TYPE(c)==_CANBASE)
#define _CANIOC(nr) _IOC(_CANBASE,nr)
/* boardctl() command definitions *******************************************/
#define _BOARDIOCVALID(c) (_IOC_TYPE(c)==_BOARDBASE)
+37 -5
View File
@@ -48,8 +48,38 @@
#ifdef CONFIG_NET_SLIP
/****************************************************************************
* Public Type Definitions
* Pre-processor Definitions
****************************************************************************/
/* Configuration ***********************************************************/
/* Dependencies:
*
* CONFIG_NET_NOINTS - Required.
* CONFIG_NET_MULTIBUFFER - Required.
*
* SLIP Configuration:
*
* CONFIG_NET_SLIP - Enables building of the SLIP driver
* CONFIG_NET_SLIP_STACKSIZE - Provides the stack size for SLIP RX and TX
* threads. Default: 2048
* CONFIG_NET_SLIP_DEFPRIO - Provides the priority for SLIP RX and TX
* threads. Default 128.
* CONFIG_NET_NET_SLIP_MTU - Provides the size of the SLIP packet buffers.
* Default 296
*
* The Linux slip module hard-codes its MTU size to 296 (40 bytes for the
* IP+TPC headers plus 256 bytes of data). So you might as well set
* CONFIG_NET_SLIP_MTU to 296 as well.
*
* There may be an issue with this setting, however. I see that Linux
* uses a MTU of 296 and window of 256, but actually only sends 168 bytes
* of data: 40 + 128. I believe that is to allow for the 2x worst cast
* packet expansion. Ideally we would like to advertise the 256 MSS,
* but restrict transfers to 128 bytes (possibly by modifying the
* tcp_mss() macro).
*
* CONFIG_NET_SLIP_NINTERFACES determines the number of physical interfaces
* that will be supported.
*/
/****************************************************************************
* Public Data
@@ -73,10 +103,12 @@ extern "C"
* Description:
* Instantiate a SLIP network interface.
*
* Parameters:
* intf - In the case where there are multiple SLIP interfaces, this value
* identifies which is to be initialized. The network name will be,
* for example, "/dev/slip5" for intf == 5
* Input Parameters:
* intf - In the case where there are multiple SLIP interfaces, this
* value identifies which is to be initialized. The number of
* possible SLIP interfaces is determined by
* devname - This is the path to the serial device that will support SLIP.
* For example, this might be "/dev/ttyS1"
*
* Returned Value:
* OK on success; Negated errno on failure.
+136
View File
@@ -0,0 +1,136 @@
/****************************************************************************
* include/nuttx/sensors/as5048b.h
*
* Copyright (C) 2015 Alexandru Duru. All rights reserved.
* Author: Alexandru Duru <alexandruduru@gmail.com>
*
* 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.
*
****************************************************************************/
#ifndef __INCLUDE_NUTTX_SENSORS_AS5048B
#define __INCLUDE_NUTTX_SENSORS_AS5048B
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/i2c.h>
#include <nuttx/fs/ioctl.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Configuration ************************************************************
* Prerequisites:
*
* CONFIG_I2C
* Enables support for I2C drivers
* CONFIG_AS5048B
* Enables support for the AS5048B driver
*/
/* IOCTL Commands ***********************************************************/
#define SNIOC_READZERO _SNIOC(0x0001) /* Arg: uint16_t* pointer */
#define SNIOC_WRITEZERO _SNIOC(0x0002) /* Arg: uint16_t value */
#define SNIOC_READAGC _SNIOC(0x0004) /* Arg: uint8_t* pointer */
#define SNIOC_READDIAG _SNIOC(0x0005) /* Arg: uint8_t* pointer */
#define SNIOC_READMAG _SNIOC(0x0006) /* Arg: uint16_t* pointer */
/* Resolution ***************************************************************/
#define AS5048B_MAX 0x3fff /* Maximum value (14 bits) */
/* Register Definitions *****************************************************/
/* Register Addresses */
#define AS5048B_PROG_REG 0x03 /* Programming Control Register */
#define AS5048B_ADDR_REG 0x15 /* I2C Slave Address Register */
#define AS5048B_ZEROLO_REG 0x16 /* Zero Position Register Bits 0 to 5 */
#define AS5048B_ZEROHI_REG 0x17 /* Zero Position Register Bits 6 to 13 */
#define AS5048B_AGC_REG 0xfa /* Automatic Gain Control Register */
#define AS5048B_DIAG_REG 0xfb /* Diagnostics Register */
#define AS5048B_MAGLO_REG 0xfc /* Magnitude Register Bits 0 to 5 */
#define AS5048B_MAGHI_REG 0xfd /* Magnitude Register Bits 6 to 13 */
#define AS5048B_ANGLO_REG 0xfe /* Angle Register Bits 0 to 5 */
#define AS5048B_ANGHI_REG 0xff /* Angle Register Bits 6 to 13 */
/* Programming Control Register Bit Definitions */
#define AS5048B_PROG_ENABLE (1 << 0)
#define AS5048B_PROG_BURN (1 << 3)
#define AS5048B_PROG_VERIFY (1 << 6)
/* Diagnostics Register Bit Definitions */
#define AS5048B_DIAG_OCF (1 << 0) /* Offset Compensation Finished */
#define AS5048B_DIAG_COF (1 << 1) /* Cordic Overflow */
#define AS5048B_DIAG_COMPLOW (1 << 2) /* High Magnetic Field */
#define AS5048B_DIAG_COMPHIGH (1 << 3) /* Low Magnetic Field */
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
#ifdef __cplusplus
#define EXTERN extern "C"
extern "C"
{
#else
#define EXTERN extern
#endif
/****************************************************************************
* Name: as5048b_register
*
* Description:
* Register the AS5048B character device as 'devpath'.
*
* Input Parameters:
* devpath - The full path to the driver to register,
* for example "/dev/angle0".
* i2c - An instance of the I2C interface to use to communicate
* with the AS5048B.
* addr - The I2C address of the AS5048B.
*
* Returned Value:
* Zero (OK) on success; a negated errno value on failure.
*
****************************************************************************/
int as5048b_register(FAR const char *devpath, FAR struct i2c_dev_s *i2c,
uint8_t addr);
#undef EXTERN
#ifdef __cplusplus
}
#endif
#endif /* __INCLUDE_NUTTX_SENSORS_AS5048B */
+150
View File
@@ -0,0 +1,150 @@
/****************************************************************************
* include/nuttx/sensors/lm92.h
*
* Copyright (C) 2011-2012, 2015 Gregory Nutt. All rights reserved.
* Copyright (C) 2015 Alexandru Duru. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
* Alexandru Duru <alexandruduru@gmail.com>
*
* 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.
*
****************************************************************************/
#ifndef __INCLUDE_NUTTX_SENSORS_LM92_H
#define __INCLUDE_NUTTX_SENSORS_LM92_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/fs/ioctl.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Configuration ************************************************************
* CONFIG_I2C - Enables support for I2C drivers
* CONFIG_LM92 - Enables support for the LM92 driver
*/
#define CONFIG_LM92_BASEADDR 0x48
#define CONFIG_LM92_ADDR0 (CONFIG_LM92_BASEADDR + 0)
#define CONFIG_LM92_ADDR1 (CONFIG_LM92_BASEADDR + 1)
#define CONFIG_LM92_ADDR2 (CONFIG_LM92_BASEADDR + 2)
#define CONFIG_LM92_ADDR3 (CONFIG_LM92_BASEADDR + 3)
/* IOCTL Commands ***********************************************************/
#define SNIOC_READCONF _SNIOC(0x0001) /* Arg: uint8_t* pointer */
#define SNIOC_WRITECONF _SNIOC(0x0002) /* Arg: uint8_t value */
#define SNIOC_SHUTDOWN _SNIOC(0x0003) /* Arg: None */
#define SNIOC_POWERUP _SNIOC(0x0004) /* Arg: None */
#define SNIOC_FAHRENHEIT _SNIOC(0x0005) /* Arg: None */
#define SNIOC_CENTIGRADE _SNIOC(0x0006) /* Arg: None */
#define SNIOC_READTHYS _SNIOC(0x0007) /* Arg: b16_t* pointer */
#define SNIOC_WRITETHYS _SNIOC(0x0008) /* Arg: b16_t value */
#define SNIOC_READTCRIT _SNIOC(0x0009) /* Arg: b16_t* pointer */
#define SNIOC_WRITETCRIT _SNIOC(0x000a) /* Arg: b16_t value */
#define SNIOC_READTLOW _SNIOC(0x000b) /* Arg: b16_t* pointer */
#define SNIOC_WRITETLOW _SNIOC(0x000c) /* Arg: b16_t value */
#define SNIOC_READTHIGH _SNIOC(0x000d) /* Arg: b16_t* pointer */
#define SNIOC_WRITETHIGH _SNIOC(0x000e) /* Arg: b16_t value */
#define SNIOC_READID _SNIOC(0x000f) /* Arg: uint16_t* pointer */
/* LM92 Register Definitions ***********************************************/
/* LM92 Register Addresses */
#define LM92_TEMP_REG 0x00 /* Temperature Register */
#define LM92_CONF_REG 0x01 /* Configuration Register */
#define LM92_THYS_REG 0x02 /* Temperature Register */
#define LM92_TCRIT_REG 0x03 /* Critical Temperature Register */
#define LM92_TLOW_REG 0x04 /* Low Temperature Register */
#define LM92_THIGH_REG 0x05 /* High Temperature Register */
#define LM92_ID_REG 0x07 /* Manufacturer's Identification Register */
/* Configuration Register Bit Definitions */
#define LM92_CONF_SHUTDOWN (1 << 0) /* Bit 0: Put LM92 goes in low power shutdown mode */
#define LM92_CONF_INTMODE (1 << 1) /* Bit 1: 0=Comparator 1=Interrupt mode */
#define LM92_CONF_TCRITPOLARITY (1 << 2) /* Bit 2: 0=Active low 1=Active high */
#define LM92_CONF_INTPOLARITY (1 << 3) /* Bit 3: 0=Active low 1=Active high */
#define LM92_CONF_FAULTQ (1 << 4) /* Bit 4: 0=Disabled 1=Enabled */
/* NOTE: When temperature values are read, they are returned as b16_t, fixed
* precision integer values (see include/fixedmath.h).
*/
/****************************************************************************
* Public Data
****************************************************************************/
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
#ifdef __cplusplus
#define EXTERN extern "C"
extern "C"
{
#else
#define EXTERN extern
#endif
/****************************************************************************
* Name: lm92_register
*
* Description:
* Register the LM92 character device as 'devpath'
*
* Input Parameters:
* devpath - The full path to the driver to register. E.g., "/dev/temp0".
* i2c - An instance of the I2C interface to use to communicate
* with the LM92.
* addr - The I2C address of the LM92. The base I2C address of the LM92
* is 0x48. Bits 0-2 can be controlled to get 4 unique addresses
* from 0x48 through 0x4b.
*
* Returned Value:
* Zero (OK) on success; a negated errno value on failure.
*
****************************************************************************/
int lm92_register(FAR const char *devpath, FAR struct i2c_dev_s *i2c,
uint8_t addr);
#undef EXTERN
#ifdef __cplusplus
}
#endif
#endif /* __INCLUDE_NUTTX_SENSORS_LM92_H */
+474
View File
@@ -0,0 +1,474 @@
/****************************************************************************
* include/nuttx/spi/slave.h
*
* Copyright(C) 2015 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.
*
****************************************************************************/
#ifndef __INCLUDE_NUTTX_SPI_SLAVE_H
#define __INCLUDE_NUTTX_SPI_SLAVE_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
#include <stdbool.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Configuration ************************************************************/
/* CONFIG_SPI_SLAVE - Enable support for SPI slave features
* CONFIG_SPI_SLAVE_DMA - Enable support for DMA data transfers (not
* implemented in initial version).
*/
/* Access macros ************************************************************/
/****************************************************************************
* Name: SPI_SCTRLR_BIND
*
* Description:
* Bind the SPI slave device interface to the SPI slave controller
* interface and configure the SPI interface. Upon return, the SPI
* slave controller driver is fully operational and ready to perform
* transfers.
*
* Input Parameters:
* sctrlr - SPI slave controller interface instance
* sdev - SPI slave device interface instance
* mode - The SPI mode requested
* nbits - The number of bits requests.
* If value is greater > 0 then it implies MSB first
* If value is below < 0, then it implies LSB first with -nbits
*
* Returned Value:
* none
*
****************************************************************************/
#define SPI_SCTRLR_BIND(c,d,m,n) ((c)->ops->bind(c,d,m,n))
/****************************************************************************
* Name: SPI_SCTRLR_UNBIND
*
* Description:
* Un-bind the SPI slave device interface from the SPI slave controller
* interface. Reset the SPI interface and restore the SPI slave
* controller driver to its initial state,
*
* Input Parameters:
* sctrlr - SPI slave controller interface instance
*
* Returned Value:
* none
*
****************************************************************************/
#define SPI_SCTRLR_UNBIND(c) ((c)->ops->unbind(c))
/****************************************************************************
* Name: SPI_SCTRLR_ENQUEUE
*
* Description:
* Enqueue the next value to be shifted out from the interface. This adds
* the word the controller driver for a subsequent transfer but has no
* effect on any in-process or currently "committed" transfers
*
* Input Parameters:
* sctrlr - SPI slave controller interface instance
* data - Command/data mode data value to be shifted out. The width of
* the data must be the same as the nbits parameter previously
* provided to the bind() methods.
*
* Returned Value:
* Zero if the word was successfully queue; A negated errno valid is
* returned on any failure to enqueue the word (such as if the queue is
* full).
*
****************************************************************************/
#define SPI_SCTRLR_ENQUEUE(c,v) ((c)->ops->enqueue(c,v))
/****************************************************************************
* Name: SPI_SCTRLR_QFULL
*
* Description:
* Return true if the queue is full or false if there is space to add an
* additional word to the queue.
*
* Input Parameters:
* sctrlr - SPI slave controller interface instance
*
* Returned Value:
* true if the output wueue is full
*
****************************************************************************/
#define SPI_SCTRLR_QFULL(c) ((c)->ops->qfull(c))
/****************************************************************************
* Name: SPI_SCTRLR_QFLUSH
*
* Description:
* Discard all saved values in the output queue. On return from this
* function the output queue will be empty. Any in-progress or otherwise
* "committed" output values may not be flushed.
*
* Input Parameters:
* sctrlr - SPI slave controller interface instance
*
* Returned Value:
* None
*
****************************************************************************/
#define SPI_SCTRLR_QFLUSH(c) ((c)->ops->qflush(c))
/****************************************************************************
* Name: SPI_SDEV_SELECT
*
* Description:
* This is a SPI device callback that used when the SPI device controller
* driver detects any change in the chip select pin.
*
* Input Parameters:
* sdev - SPI device interface instance
* selected - True: chip select is low (selected);
*
* Returned Value:
* none
*
* Assumptions:
* May be called from an interrupt handler.
*
****************************************************************************/
#define SPI_SDEV_SELECT(d,s) ((c)->ops->select(d,s))
/****************************************************************************
* Name: SPI_SDEV_CMDDATA
*
* Description:
* This is a SPI device callback that used when the SPI device controller
* driver detects any change command/data condition.
*
* Normally only LCD devices distinguish command and data. For devices
* that do not distinguish between command and data, this method may be
* a stub.; For devices that do make that distinction, they should treat
* all subsequent calls to enqueue() or rece() appropriately for the
* current command/data selection.
*
* Input Parameters:
* sdev - SPI device interface instance
* data - True: Data is selected
*
* Returned Value:
* none
*
* Assumptions:
* May be called from an interrupt handler.
*
****************************************************************************/
#define SPI_SDEV_CMDDATA(d,i) ((d)->ops->cmddata(d,i))
/****************************************************************************
* Name: SPI_SDEV_GETDATA
*
* Description:
* This is a SPI device callback that used when the SPI device controller
* requires data be shifted out at the next leading clock edge. This
* is necessary to "prime the pump" so that the SPI controller driver
* can keep pace with the shifted-in data.
*
* The SPI controller driver will prime for both command and data
* transfers as determined by a preceding call to the device cmddata()
* method. Normally only LCD devices distinguish command and data.
*
* Input Parameters:
* sdev - SPI device interface instance
*
* Returned Value:
* The next data value to be shifted out
*
* Assumptions:
* May be called from an interrupt handler.
*
****************************************************************************/
#define SPI_SDEV_GETDATA(d) ((d)->ops->getdata(d))
/****************************************************************************
* Name: SPI_SDEV_RECEIVE
*
* Description:
* This is a SPI device callback that used when the SPI device controller
* receives a new value shifted in and requires the next value to be
* shifted out. Notice that these values my be out of synchronization by
* several words.
*
* Input Parameters:
* sdev - SPI device interface instance
* data - The last command/data value that was shifted in
*
* Returned Value:
* None
*
* Assumptions:
* May be called from an interrupt handler.
*
****************************************************************************/
#define SPI_SDEV_RECEIVE(d,v) ((d)->ops->receive(d,v))
/****************************************************************************
* Public Types
****************************************************************************/
/* There are two interfaces defined for the implementation of SPI slave:
*
* 1) struct spi_sctrlr_s: Defines one interface between the SPI
* slave device and the SPI slave controller hardware. This interface
* is implemented by the SPI slave device controller lower-half driver
* and is provided to the the SPI slave device driver when that driver
* is initialized. That SPI slave device initialization function has
* the prototype:
*
* FAR struct spi_sctrlr_s *up_spi_slave_initialize(int port);
*
* Given an SPI port number, this function returns an instance of the
* SPI slave controller interface.
*
* 2) struct spi_sdev_s: Defines the second interface between the SPI
* slave device and the SPI slave controller hardware. This interface
* is implemented by the SPI slave device. The slave device passes this
* interface to the struct spi_sctrlr_s during initialization
* be calling the bind() method of the struct spi_sctrlr_s
* interface.
*
* The basic initialization steps are:
*
* 1) Board-specific logic calls board- or chip-specific logic to create an
* instance of the SPI slave controller interface, struct spi_sctrlr_s.
*
* 2) Board-specific logic then calls up_dev_initialize() to initialize
* the SPI slave device. The board-specific logic passes the instance
* of struct spi_sctrlr_s to support the initialization.
*
* 3) The SPI slave device driver creates and initializes an instance of
* struct spi_sdev_s; it passes this instance to the bind() method of
* of the SPI slave controller interface.
*
* 4) The SPI slave controller will (1) call the slaved device's select()
* and cmddata() methods to indicate the initial state of the chip select
* and any command/data selection, then (2) call the slave device's
* getdata() method to get the value that will be shifted out the SPI
* clock is detected. The kind of data returned the getdata() method
* may be contingent on the current command/data setting reported the
* device cmddata() method. The driver may enqueue additional words
* to be shifted out at any time by The calling the SPI slave
* controller's enqueue() method.
*
* 5) Upon return from the bind method, the SPI slave controller will be
* fully "armed" and ready to begin normal SPI data transfers.
*
* A typical (non-DMA) data transfer proceeds as follows:
*
* 1) Internally, the SPI slave driver detects that the SPI chip select
* has gone low, selecting this device for data transfer. The SPI
* slave controller will notify the slave device by called its
* select() method.
*
* 2) If a change in the command/data state changes any time before,
* during, or after the chip is selected, that new command/data state
* will reported to the device driver via the cmddata() method.
*
* 3) As the first word is shifted in, the command or data word obtained
* by the initial call to getdata() will be shifted out. As soon as
* the clock is detected, the SPI controller driver will call the
* getdata() method again to get a default second word to be shifted
* out. NOTES: (1) the SPI slave device has only one word in bit
* times to provide this value! (2) The SPI device probably cannot
* really output anything meaning until it receives a decodes the
* first word received from the master.
*
* 4) When the first word from the master is shifted in, the SPI
* controller driver will call the device's receive() method to
* provide the master with the command word that was just shifted
* in.
*
* For the case of bi-directional data transfer or of a transfer of
* data from the SPI device to the master, the SPI device driver
* should call the controller's enqueue() method to provide the next
* value(s) to be shifted out. If the SPI device responds with this
* value before clocking begins for the next word, that that value
* will be used. Otherwise, the value obtained from getdata() in
* step 3 will be shifted out.
*
* 5) The SPI device's receive() method will be called in a similar
* way after each subsequent word is clocked in.
*
* For the case of bi-directional data transfer or of a uni-directional
* transfer of data from the SPI device to the master, the SPI device
* driver can call the enqueue() methods as it has new data to be shifted
* out. The goal of the SPI device driver for this kind of transfer is
* to supply valid output data at such a rate that data underruns do not
* occur. In the event of a data underrun, the SPI slave controller
* driver will fallback to the default output value obtained from the
* last getdata() call.
*
* The SPI device driver can detect if there is space to enqueue
* additional data by calling the qfull() method.
*
* For the case of uni-directional transfer of data from the master to
* the SPI device, there is no need to call the enqueue() method at all;
* the value that is shifted out is not important that fallback behavior
* is suficient.
*
* 6) The activity of 5) will continue until the master raises the chip
* select signal. In that case, the SPI slave controller driver will
* again call the SPI device's select() method. At this point, the SPI
* controller driver may have several words enqueued. It will not
* discard these unless the SPI device driver calls the qflush()
* method.
*
* Some master side implementations may simply tie the chip select signal
* to ground if there are no other devices on the SPI bus. In that case,
* the initial indication of chip selected will be the only call to the
* select() method that is made.
*
* A typical DMA data transfer processes as follows:
* To be provided
*/
enum spi_smode_e
{
SPISLAVE_MODE0 = 0, /* CPOL=0 CHPHA=0 */
SPISLAVE_MODE1, /* CPOL=0 CHPHA=1 */
SPISLAVE_MODE2, /* CPOL=1 CHPHA=0 */
SPISLAVE_MODE3 /* CPOL=1 CHPHA=1 */
};
/* The SPI slave controller driver vtable */
struct spi_sctrlr_s; /* Forward reference */
struct spi_sdev_s; /* Forward reference */
struct spi_sctrlrops_s
{
CODE void (*bind)(FAR struct spi_sctrlr_s *sctrlr,
FAR struct spi_sdev_s *sdev, enum spi_smode_e mode,
int nbits);
CODE void (*unbind)(FAR struct spi_sctrlr_s *sctrlr);
CODE int (*enqueue)(FAR struct spi_sctrlr_s *sctrlr, uint16_t data);
CODE bool (*qfull)(FAR struct spi_sctrlr_s *sctrlr);
CODE void (*qflush)(FAR struct spi_sctrlr_s *sctrlr);
};
/* SPI slave controller private data. This structure only defines the
* initial fields of the structure visible to the SPI device driver. The
* specific implementation may add additional, device specific fields after
* the vtable structure pointer.
*/
struct spi_sctrlr_s
{
FAR const struct spi_sctrlrops_s *ops;
/* Private SPI slave controller driver data may follow */
};
/* The SPI slave device driver vtable */
struct spi_sdevops_s
{
CODE void (*select)(FAR struct spi_sdev_s *sdev, bool selected);
CODE void (*cmddata)(FAR struct spi_sdev_s *sdev, bool data);
CODE uint16_t (*getdata)(FAR struct spi_sdev_s *sdev);
CODE void (*receive)(FAR struct spi_sdev_s *sdev, uint16_t cmd);
};
/* SPI slave device private data. This structure only defines the initial
* fields of the structure visible to the SPI slave controller driver. The
* specific implementation may add additional, device specific fields after
* the vtable structure pointer.
*/
struct spi_sdev_s
{
FAR const struct spi_sdevops_s *ops;
/* Private SPI slave device driver data may follow */
};
/****************************************************************************
* Public Data
****************************************************************************/
#undef EXTERN
#if defined(__cplusplus)
#define EXTERN extern "C"
extern "C"
{
#else
#define EXTERN extern
#endif
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_spi_slave_initialize
*
* Description:
* Initialize the selected SPI port in slave mode.
*
* Input Parameter:
* port - Chip select number identifying the "logical" SPI port. Includes
* encoded port and chip select information.
*
* Returned Value:
* Valid SPI device structure reference on success; a NULL on failure
*
****************************************************************************/
FAR struct spi_sctrlr_s *up_spi_slave_initialize(int port);
#undef EXTERN
#if defined(__cplusplus)
}
#endif
#endif /* __INCLUDE_NUTTX_SPI_SLAVE_H */
+28 -26
View File
@@ -1,7 +1,7 @@
/****************************************************************************
* include/nuttx/spi/spi.h
*
* Copyright(C) 2008-2013 Gregory Nutt. All rights reserved.
* Copyright(C) 2008-2013, 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -271,7 +271,7 @@
*
* Input Parameters:
* dev - Device-specific state data
* buffer - A pointer to the buffer in which to recieve data
* buffer - A pointer to the buffer in which to receive data
* nwords - the length of data that can be received in the buffer in number
* of words. The wordsize is determined by the number of bits-
* per-word selected for the SPI interface. If nbits <= 8, the
@@ -298,7 +298,7 @@
* Input Parameters:
* dev - Device-specific state data
* txbuffer - A pointer to the buffer of data to be sent
* rxbuffer - A pointer to the buffer in which to recieve data
* rxbuffer - A pointer to the buffer in which to receive data
* nwords - the length of data that to be exchanged in units of words.
* The wordsize is determined by the number of bits-per-word
* selected for the SPI interface. If nbits <= 8, the data is
@@ -324,7 +324,7 @@
*
* Input Parameters:
* dev - Device-specific state data
* callback - The funtion to call on the media change
* callback - The function to call on the media change
* arg - A caller provided value to return with the callback
*
* Returned Value:
@@ -367,7 +367,7 @@ enum spi_dev_e
SPIDEV_USER /* Board-specific values start here */
};
/* Certain SPI devices may required differnt clocking modes */
/* Certain SPI devices may required different clocking modes */
enum spi_mode_e
{
@@ -383,29 +383,31 @@ struct spi_dev_s;
struct spi_ops_s
{
#ifndef CONFIG_SPI_OWNBUS
int (*lock)(FAR struct spi_dev_s *dev, bool lock);
CODE int (*lock)(FAR struct spi_dev_s *dev, bool lock);
#endif
void (*select)(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
bool selected);
uint32_t (*setfrequency)(FAR struct spi_dev_s *dev, uint32_t frequency);
void (*setmode)(FAR struct spi_dev_s *dev, enum spi_mode_e mode);
void (*setbits)(FAR struct spi_dev_s *dev, int nbits);
uint8_t (*status)(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
CODE void (*select)(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
bool selected);
CODE uint32_t (*setfrequency)(FAR struct spi_dev_s *dev, uint32_t frequency);
CODE void (*setmode)(FAR struct spi_dev_s *dev, enum spi_mode_e mode);
CODE void (*setbits)(FAR struct spi_dev_s *dev, int nbits);
CODE uint8_t (*status)(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
#ifdef CONFIG_SPI_CMDDATA
int (*cmddata)(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
CODE int (*cmddata)(FAR struct spi_dev_s *dev, enum spi_dev_e devid
bool cmd);
#endif
uint16_t (*send)(FAR struct spi_dev_s *dev, uint16_t wd);
CODE uint16_t (*send)(FAR struct spi_dev_s *dev, uint16_t wd);
#ifdef CONFIG_SPI_EXCHANGE
void (*exchange)(FAR struct spi_dev_s *dev, FAR const void *txbuffer,
FAR void *rxbuffer, size_t nwords);
CODE void (*exchange)(FAR struct spi_dev_s *dev,
FAR const void *txbuffer, FAR void *rxbuffer,
size_t nwords);
#else
void (*sndblock)(FAR struct spi_dev_s *dev, FAR const void *buffer,
size_t nwords);
void (*recvblock)(FAR struct spi_dev_s *dev, FAR void *buffer,
size_t nwords);
CODE void (*sndblock)(FAR struct spi_dev_s *dev,
FAR const void *buffer, size_t nwords);
CODE void (*recvblock)(FAR struct spi_dev_s *dev, FAR void *buffer,
size_t nwords);
#endif
int (*registercallback)(FAR struct spi_dev_s *dev, spi_mediachange_t callback,
void *arg);
CODE int (*registercallback)(FAR struct spi_dev_s *dev,
spi_mediachange_t callback, void *arg);
};
/* SPI private data. This structure only defines the initial fields of the
@@ -435,7 +437,7 @@ extern "C"
* Name: up_spiinitialize
*
* Description:
* Initialize the selected SPI port.
* Initialize the selected SPI port in master mode.
*
* This is a generic prototype for the SPI initialize logic. Specific
* architectures may support different SPI initialization functions if,
@@ -454,14 +456,14 @@ extern "C"
*
* Another example would be the STM32 families that support both SPI
* blocks as well as USARTs that can be configured to perform the SPI
* function as well (the STM32 USARTs do not suppor SPI as of this
* function as well (the STM32 USARTs do not support SPI as of this
* writing).
*
* Input Parameter:
* Port number (for hardware that has mutiple SPI interfaces)
* Port number (for hardware that has multiple SPI interfaces)
*
* Returned Value:
* Valid SPI device structure reference on succcess; a NULL on failure
* Valid SPI device structure reference on success; a NULL on failure
*
****************************************************************************/
+3 -4
View File
@@ -148,7 +148,7 @@
prctl((int)PR_GET_NAME, (char*)name, (int)thread)
/********************************************************************************
* Global Type Declarations
* Public Type Definitions
********************************************************************************/
#ifdef __cplusplus
@@ -241,11 +241,11 @@ typedef bool pthread_once_t;
struct sched_param; /* Defined in sched.h */
/********************************************************************************
* Global Variables
* Public Data
********************************************************************************/
/********************************************************************************
* Global Function Prototypes
* Public Function Prototypes
********************************************************************************/
/* Initializes a thread attributes object (attr) with default values for all of
@@ -414,4 +414,3 @@ int pthread_sigmask(int how, FAR const sigset_t *set, FAR sigset_t *oset);
#endif
#endif /* __INCLUDE_PTHREAD_H */
+2 -2
View File
@@ -60,7 +60,7 @@
#define dq_peek(q) ((q)->head)
/****************************************************************************
* Global Type Declarations
* Public Type Definitions
****************************************************************************/
struct sq_entry_s
@@ -91,7 +91,7 @@ struct dq_queue_s
typedef struct dq_queue_s dq_queue_t;
/****************************************************************************
* Global Function Prototypes
* Public Function Prototypes
****************************************************************************/
#ifdef __cplusplus
+8 -4
View File
@@ -53,10 +53,14 @@
/* POSIX-like scheduling policies */
#define SCHED_FIFO 1 /* FIFO per priority scheduling policy */
#define SCHED_RR 2 /* Round robin scheduling policy */
#define SCHED_SPORADIC 3 /* Sporadic scheduling policy */
#define SCHED_OTHER 4 /* Not supported */
#define SCHED_FIFO 1 /* FIFO priority scheduling policy */
#define SCHED_RR 2 /* Round robin scheduling policy */
#define SCHED_SPORADIC 3 /* Sporadic scheduling policy */
#define SCHED_OTHER 4 /* Not supported */
/* Maximum number of SCHED_SPORADIC replenishments */
#define SS_REPL_MAX CONFIG_SCHED_SPORADIC_MAXREPL
/* Pthread definitions **********************************************************/
+3 -4
View File
@@ -183,7 +183,7 @@
#endif
/********************************************************************************
* Global Type Declarations
* Public Type Definitions
********************************************************************************/
/* This defines a set of 32 signals (numbered 0 through 31). */
@@ -251,11 +251,11 @@ struct sigaction
#define sa_sigaction sa_u._sa_sigaction
/********************************************************************************
* Global Variables
* Public Data
********************************************************************************/
/********************************************************************************
* Global Function Prototypes
* Public Function Prototypes
********************************************************************************/
#ifdef __cplusplus
@@ -297,4 +297,3 @@ int sigqueue(int pid, int signo, FAR void *sival_ptr);
#endif
#endif /* __INCLUDE_SIGNAL_H */
+7 -12
View File
@@ -49,9 +49,9 @@
* Pre-processor Definitions
****************************************************************************/
/* The C standard specifies two constants, EXIT_SUCCESS and
* EXIT_FAILURE, that may be passed to exit() to indicate
* successful or unsucessful termination, respectively.
/* The C standard specifies two constants, EXIT_SUCCESS and EXIT_FAILURE,
* that may be passed to exit() to indicate successful or unsuccessful
* termination, respectively.
*/
#define EXIT_SUCCESS 0
@@ -71,9 +71,8 @@
#define MB_CUR_MAX 1
/* The environ variable, normally 'extern char **environ;' is
* not implemented as a function call. However, get_environ_ptr()
* can be used in its place.
/* The environ variable, normally 'char **environ;' is not implemented as a
* function call. However, get_environ_ptr() can be used in its place.
*/
#ifndef CONFIG_DISABLE_ENVIRON
@@ -81,7 +80,7 @@
#endif
/****************************************************************************
* Global Type Definitions
* Public Type Definitions
****************************************************************************/
struct mallinfo
@@ -97,11 +96,7 @@ struct mallinfo
};
/****************************************************************************
* Global Function Prototypes
****************************************************************************/
/****************************************************************************
* Global Function Prototypes
* Public Function Prototypes
****************************************************************************/
#undef EXTERN
+1 -1
View File
@@ -56,7 +56,7 @@
#define bcopy(b1,b2,len) (void)memmove(b2,b1,len)
/****************************************************************************
* Global Function Prototypes
* Public Function Prototypes
****************************************************************************/
#undef EXTERN
+4 -4
View File
@@ -113,7 +113,7 @@
#define HOST_NAME_MAX 32
/****************************************************************************
* Global Variables
* Public Data
****************************************************************************/
#undef EXTERN
@@ -133,7 +133,7 @@ extern "C"
#ifndef __NXFLAT__
EXTERN FAR char *optarg; /* Optional argument following option */
EXTERN int optind; /* Index into argv */
EXTERN int optopt; /* unrecognized option character */
EXTERN int optopt; /* Unrecognized option character */
#else
# define optarg (*(getoptargp()))
# define optind (*(getoptindp()))
@@ -141,7 +141,7 @@ EXTERN int optopt; /* unrecognized option character */
#endif
/****************************************************************************
* Global Function Prototypes
* Public Function Prototypes
****************************************************************************/
/* Task Control Interfaces */
@@ -205,7 +205,7 @@ int getopt(int argc, FAR char *const argv[], FAR const char *optstring);
FAR char **getoptargp(void); /* Optional argument following option */
int *getoptindp(void); /* Index into argv */
int *getoptoptp(void); /* unrecognized option character */
int *getoptoptp(void); /* Unrecognized option character */
#ifdef CONFIG_NET
int gethostname(FAR char *name, size_t size);