mirror of
https://github.com/apache/nuttx.git
synced 2026-06-02 09:38:37 +08:00
Run nxstyle all .c and .h files modified by PR.
This commit is contained in:
committed by
Alan Carvalho de Assis
parent
a569006fd8
commit
57bc329aac
@@ -201,7 +201,9 @@ static int onewire_pm_prepare(FAR struct pm_callback_s *cb, int domain,
|
|||||||
|
|
||||||
if (sval <= 0)
|
if (sval <= 0)
|
||||||
{
|
{
|
||||||
/* Exclusive lock is held, do not allow entry to deeper PM states. */
|
/* Exclusive lock is held, do not allow entry to deeper PM
|
||||||
|
* states.
|
||||||
|
*/
|
||||||
|
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -138,7 +138,9 @@ static int adc_open(FAR struct file *filep)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Check if this is the first time that the driver has been opened. */
|
/* Check if this is the first time that the driver has been
|
||||||
|
* opened.
|
||||||
|
*/
|
||||||
|
|
||||||
if (tmp == 1)
|
if (tmp == 1)
|
||||||
{
|
{
|
||||||
@@ -323,7 +325,7 @@ static ssize_t adc_read(FAR struct file *filep, FAR char *buffer,
|
|||||||
|
|
||||||
if (msglen == 1)
|
if (msglen == 1)
|
||||||
{
|
{
|
||||||
/* Only one channel, return MS 8-bits of the sample*/
|
/* Only one channel, return MS 8-bits of the sample. */
|
||||||
|
|
||||||
buffer[nread] = msg->am_data >> 24;
|
buffer[nread] = msg->am_data >> 24;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -274,7 +274,9 @@ static int comp_open(FAR struct file *filep)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Check if this is the first time that the driver has been opened. */
|
/* Check if this is the first time that the driver has been
|
||||||
|
* opened.
|
||||||
|
*/
|
||||||
|
|
||||||
if (tmp == 1)
|
if (tmp == 1)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -133,7 +133,9 @@ static int dac_open(FAR struct file *filep)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Check if this is the first time that the driver has been opened. */
|
/* Check if this is the first time that the driver has been
|
||||||
|
* opened.
|
||||||
|
*/
|
||||||
|
|
||||||
if (tmp == 1)
|
if (tmp == 1)
|
||||||
{
|
{
|
||||||
@@ -330,7 +332,9 @@ static ssize_t dac_write(FAR struct file *filep, FAR const char *buffer,
|
|||||||
nexttail = 0;
|
nexttail = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If the XMIT fifo becomes full, then wait for space to become available */
|
/* If the XMIT fifo becomes full, then wait for space to become
|
||||||
|
* available.
|
||||||
|
*/
|
||||||
|
|
||||||
while (nexttail == fifo->af_head)
|
while (nexttail == fifo->af_head)
|
||||||
{
|
{
|
||||||
|
|||||||
+3
-1
@@ -834,7 +834,9 @@ static ssize_t can_write(FAR struct file *filep, FAR const char *buffer,
|
|||||||
nexttail = 0;
|
nexttail = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If the XMIT FIFO becomes full, then wait for space to become available */
|
/* If the XMIT FIFO becomes full, then wait for space to become
|
||||||
|
* available.
|
||||||
|
*/
|
||||||
|
|
||||||
while (nexttail == fifo->tx_head)
|
while (nexttail == fifo->tx_head)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -644,7 +644,9 @@ static void ads7843e_worker(FAR void *arg)
|
|||||||
|
|
||||||
if (xdiff < CONFIG_ADS7843E_THRESHX && ydiff < CONFIG_ADS7843E_THRESHY)
|
if (xdiff < CONFIG_ADS7843E_THRESHX && ydiff < CONFIG_ADS7843E_THRESHY)
|
||||||
{
|
{
|
||||||
/* Little or no change in either direction ... don't report anything. */
|
/* Little or no change in either direction ... don't report
|
||||||
|
* anything.
|
||||||
|
*/
|
||||||
|
|
||||||
goto ignored;
|
goto ignored;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -641,11 +641,15 @@ static void max11802_worker(FAR void *arg)
|
|||||||
xdiff = x > priv->threshx ? (x - priv->threshx) : (priv->threshx - x);
|
xdiff = x > priv->threshx ? (x - priv->threshx) : (priv->threshx - x);
|
||||||
ydiff = y > priv->threshy ? (y - priv->threshy) : (priv->threshy - y);
|
ydiff = y > priv->threshy ? (y - priv->threshy) : (priv->threshy - y);
|
||||||
|
|
||||||
/* Check the thresholds. Bail if there is no significant difference */
|
/* Check the thresholds. Bail if there is no significant
|
||||||
|
* difference.
|
||||||
|
*/
|
||||||
|
|
||||||
if (xdiff < CONFIG_MAX11802_THRESHX && ydiff < CONFIG_MAX11802_THRESHY)
|
if (xdiff < CONFIG_MAX11802_THRESHX && ydiff < CONFIG_MAX11802_THRESHY)
|
||||||
{
|
{
|
||||||
/* Little or no change in either direction ... don't report anything. */
|
/* Little or no change in either direction ... don't report
|
||||||
|
* anything.
|
||||||
|
*/
|
||||||
|
|
||||||
goto ignored;
|
goto ignored;
|
||||||
}
|
}
|
||||||
|
|||||||
+136
-135
@@ -1,46 +1,31 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* drivers/input/tsc2007.c
|
* drivers/input/tsc2007.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2011-2012, 2016-2017 Gregory Nutt. All rights reserved.
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* References:
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* "1.2V to 3.6V, 12-Bit, Nanopower, 4-Wire Micro TOUCH SCREEN CONTROLLER
|
|
||||||
* with I2C Interface," SBAS405A March 2007, Revised, March 2009, Texas
|
|
||||||
* Instruments Incorporated
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* modification, are permitted provided that the following conditions
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
* are met:
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
*
|
* License for the specific language governing permissions and limitations
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
* under the License.
|
||||||
* 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.
|
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/* The TSC2007 is an analog interface circuit for a human interface touch
|
/* The TSC2007 is an analog interface circuit for a human interface touch
|
||||||
* screen device. All peripheral functions are controlled through the command
|
* screen device. All peripheral functions are controlled through the command
|
||||||
* byte and onboard state machines.
|
* byte and onboard state machines.
|
||||||
|
*
|
||||||
|
* References:
|
||||||
|
* "1.2V to 3.6V, 12-Bit, Nanopower, 4-Wire Micro TOUCH SCREEN CONTROLLER
|
||||||
|
* with I2C Interface," SBAS405A March 2007, Revised, March 2009, Texas
|
||||||
|
* Instruments Incorporated
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -79,7 +64,9 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/* Configuration ************************************************************/
|
/* Configuration ************************************************************/
|
||||||
|
|
||||||
/* Reference counting is partially implemented, but not needed in the
|
/* Reference counting is partially implemented, but not needed in the
|
||||||
* current design.
|
* current design.
|
||||||
*/
|
*/
|
||||||
@@ -95,6 +82,7 @@
|
|||||||
#define CONFIG_TSC2007_ACTIVATE 1
|
#define CONFIG_TSC2007_ACTIVATE 1
|
||||||
|
|
||||||
/* Driver support ***********************************************************/
|
/* Driver support ***********************************************************/
|
||||||
|
|
||||||
/* This format is used to construct the /dev/input[n] device driver path. It
|
/* This format is used to construct the /dev/input[n] device driver path. It
|
||||||
* defined here so that it will be used consistently in all places.
|
* defined here so that it will be used consistently in all places.
|
||||||
*/
|
*/
|
||||||
@@ -200,9 +188,11 @@ static int tsc2007_interrupt(int irq, FAR void *context);
|
|||||||
|
|
||||||
static int tsc2007_open(FAR struct file *filep);
|
static int tsc2007_open(FAR struct file *filep);
|
||||||
static int tsc2007_close(FAR struct file *filep);
|
static int tsc2007_close(FAR struct file *filep);
|
||||||
static ssize_t tsc2007_read(FAR struct file *filep, FAR char *buffer, size_t len);
|
static ssize_t tsc2007_read(FAR struct file *filep, FAR char *buffer,
|
||||||
|
size_t len);
|
||||||
static int tsc2007_ioctl(FAR struct file *filep, int cmd, unsigned long arg);
|
static int tsc2007_ioctl(FAR struct file *filep, int cmd, unsigned long arg);
|
||||||
static int tsc2007_poll(FAR struct file *filep, struct pollfd *fds, bool setup);
|
static int tsc2007_poll(FAR struct file *filep, struct pollfd *fds,
|
||||||
|
bool setup);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Data
|
* Private Data
|
||||||
@@ -259,10 +249,10 @@ static void tsc2007_notify(FAR struct tsc2007_dev_s *priv)
|
|||||||
nxsem_post(&priv->waitsem);
|
nxsem_post(&priv->waitsem);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If there are threads waiting on poll() for TSC2007 data to become available,
|
/* If there are threads waiting on poll() for TSC2007 data to become
|
||||||
* then wake them up now. NOTE: we wake up all waiting threads because we
|
* available, then wake them up now. NOTE: we wake up all waiting
|
||||||
* do not know that they are going to do. If they all try to read the data,
|
* threads because we do not know that they are going to do. If they
|
||||||
* then some make end up blocking after all.
|
* all try to read the data, then some make end up blocking after all.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
for (i = 0; i < CONFIG_TSC2007_NPOLLWAITERS; i++)
|
for (i = 0; i < CONFIG_TSC2007_NPOLLWAITERS; i++)
|
||||||
@@ -317,11 +307,11 @@ static int tsc2007_sample(FAR struct tsc2007_dev_s *priv,
|
|||||||
priv->id++;
|
priv->id++;
|
||||||
}
|
}
|
||||||
else if (sample->contact == CONTACT_DOWN)
|
else if (sample->contact == CONTACT_DOWN)
|
||||||
{
|
{
|
||||||
/* First report -- next report will be a movement */
|
/* First report -- next report will be a movement */
|
||||||
|
|
||||||
priv->sample.contact = CONTACT_MOVE;
|
priv->sample.contact = CONTACT_MOVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
priv->penchange = false;
|
priv->penchange = false;
|
||||||
ret = OK;
|
ret = OK;
|
||||||
@@ -379,8 +369,8 @@ static int tsc2007_waitsample(FAR struct tsc2007_dev_s *priv,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Re-acquire the semaphore that manages mutually exclusive access to
|
/* Re-acquire the semaphore that manages mutually exclusive access to
|
||||||
* the device structure. We may have to wait here. But we have our sample.
|
* the device structure. We may have to wait here. But we have our
|
||||||
* Interrupts and pre-emption will be re-enabled while we wait.
|
* sample. Interrupts and pre-emption will be re-enabled while we wait.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ret = nxsem_wait(&priv->devsem);
|
ret = nxsem_wait(&priv->devsem);
|
||||||
@@ -410,42 +400,43 @@ errout:
|
|||||||
#ifdef CONFIG_TSC2007_ACTIVATE
|
#ifdef CONFIG_TSC2007_ACTIVATE
|
||||||
static int tsc2007_activate(FAR struct tsc2007_dev_s *priv, uint8_t cmd)
|
static int tsc2007_activate(FAR struct tsc2007_dev_s *priv, uint8_t cmd)
|
||||||
{
|
{
|
||||||
struct i2c_msg_s msg;
|
struct i2c_msg_s msg;
|
||||||
uint8_t data;
|
uint8_t data;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* Send the setup command (with no ACK) followed by the A/D converter
|
/* Send the setup command (with no ACK) followed by the A/D converter
|
||||||
* activation command (ACKed).
|
* activation command (ACKed).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
data = TSC2007_SETUP;
|
data = TSC2007_SETUP;
|
||||||
|
|
||||||
msg.frequency = priv->config->frequency; /* I2C frequency */
|
msg.frequency = priv->config->frequency; /* I2C frequency */
|
||||||
msg.addr = priv->config->address; /* 7-bit address */
|
msg.addr = priv->config->address; /* 7-bit address */
|
||||||
msg.flags = 0; /* Write transaction, beginning with START */
|
msg.flags = 0; /* Write transaction, beginning with START */
|
||||||
msg.buffer = &data; /* Transfer from this address */
|
msg.buffer = &data; /* Transfer from this address */
|
||||||
msg.length = 1; /* Send one byte following the address */
|
msg.length = 1; /* Send one byte following the address */
|
||||||
|
|
||||||
/* Ignore errors from the setup command (because it is not ACKed) */
|
/* Ignore errors from the setup command (because it is not ACKed) */
|
||||||
|
|
||||||
I2C_TRANSFER(priv->i2c, &msg, 1);
|
I2C_TRANSFER(priv->i2c, &msg, 1);
|
||||||
|
|
||||||
/* Now activate the A/D converter */
|
/* Now activate the A/D converter */
|
||||||
|
|
||||||
data = cmd;
|
data = cmd;
|
||||||
|
|
||||||
msg.frequency = priv->config->frequency; /* I2C frequency */
|
msg.frequency = priv->config->frequency; /* I2C frequency */
|
||||||
msg.addr = priv->config->address; /* 7-bit address */
|
msg.addr = priv->config->address; /* 7-bit address */
|
||||||
msg.flags = 0; /* Write transaction, beginning with START */
|
msg.flags = 0; /* Write transaction, beginning with START */
|
||||||
msg.buffer = &data; /* Transfer from this address */
|
msg.buffer = &data; /* Transfer from this address */
|
||||||
msg.length = 1; /* Send one byte following the address */
|
msg.length = 1; /* Send one byte following the address */
|
||||||
|
|
||||||
ret = I2C_TRANSFER(priv->i2c, &msg, 1);
|
ret = I2C_TRANSFER(priv->i2c, &msg, 1);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
ierr("ERROR: I2C_TRANSFER failed: %d\n", ret);
|
ierr("ERROR: I2C_TRANSFER failed: %d\n", ret);
|
||||||
}
|
}
|
||||||
return ret;
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
# define tsc2007_activate(p,c)
|
# define tsc2007_activate(p,c)
|
||||||
@@ -457,9 +448,9 @@ static int tsc2007_activate(FAR struct tsc2007_dev_s *priv, uint8_t cmd)
|
|||||||
|
|
||||||
static int tsc2007_transfer(FAR struct tsc2007_dev_s *priv, uint8_t cmd)
|
static int tsc2007_transfer(FAR struct tsc2007_dev_s *priv, uint8_t cmd)
|
||||||
{
|
{
|
||||||
struct i2c_msg_s msg;
|
struct i2c_msg_s msg;
|
||||||
uint8_t data12[2];
|
uint8_t data12[2];
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* "A conversion/write cycle begins when the master issues the address
|
/* "A conversion/write cycle begins when the master issues the address
|
||||||
* byte containing the slave address of the TSC2007, with the eighth bit
|
* byte containing the slave address of the TSC2007, with the eighth bit
|
||||||
@@ -473,18 +464,18 @@ static int tsc2007_transfer(FAR struct tsc2007_dev_s *priv, uint8_t cmd)
|
|||||||
* STOP condition...
|
* STOP condition...
|
||||||
*/
|
*/
|
||||||
|
|
||||||
msg.frequency = priv->config->frequency; /* I2C frequency */
|
msg.frequency = priv->config->frequency; /* I2C frequency */
|
||||||
msg.addr = priv->config->address; /* 7-bit address */
|
msg.addr = priv->config->address; /* 7-bit address */
|
||||||
msg.flags = 0; /* Write transaction, beginning with START */
|
msg.flags = 0; /* Write transaction, beginning with START */
|
||||||
msg.buffer = &cmd; /* Transfer from this address */
|
msg.buffer = &cmd; /* Transfer from this address */
|
||||||
msg.length = 1; /* Send one byte following the address */
|
msg.length = 1; /* Send one byte following the address */
|
||||||
|
|
||||||
ret = I2C_TRANSFER(priv->i2c, &msg, 1);
|
ret = I2C_TRANSFER(priv->i2c, &msg, 1);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
ierr("ERROR: I2C_TRANSFER failed: %d\n", ret);
|
ierr("ERROR: I2C_TRANSFER failed: %d\n", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* "The input multiplexer channel for the A/D converter is selected when
|
/* "The input multiplexer channel for the A/D converter is selected when
|
||||||
* bits C3 through C0 are clocked in. If the selected channel is an X-,Y-,
|
* bits C3 through C0 are clocked in. If the selected channel is an X-,Y-,
|
||||||
@@ -501,7 +492,7 @@ static int tsc2007_transfer(FAR struct tsc2007_dev_s *priv, uint8_t cmd)
|
|||||||
* least 10ms before attempting to read data from the TSC2007...
|
* least 10ms before attempting to read data from the TSC2007...
|
||||||
*/
|
*/
|
||||||
|
|
||||||
nxsig_usleep(10*1000);
|
nxsig_usleep(10 * 1000);
|
||||||
|
|
||||||
/* "Data access begins with the master issuing a START condition followed
|
/* "Data access begins with the master issuing a START condition followed
|
||||||
* by the address byte ... with R/W = 1.
|
* by the address byte ... with R/W = 1.
|
||||||
@@ -510,35 +501,35 @@ static int tsc2007_transfer(FAR struct tsc2007_dev_s *priv, uint8_t cmd)
|
|||||||
* slave issues an acknowledge. The first byte of serial data then follows
|
* slave issues an acknowledge. The first byte of serial data then follows
|
||||||
* (D11-D4, MSB first).
|
* (D11-D4, MSB first).
|
||||||
*
|
*
|
||||||
* "After the first byte has been sent by the slave, it releases the SDA line
|
* "After the first byte has been sent by the slave, it releases the SDA
|
||||||
* for the master to issue an acknowledge. The slave responds with the
|
* line for the master to issue an acknowledge. The slave responds with
|
||||||
* second byte of serial data upon receiving the acknowledge from the master
|
* the second byte of serial data upon receiving the acknowledge from the
|
||||||
* (D3-D0, followed by four 0 bits). The second byte is followed by a NOT
|
* master (D3-D0, followed by four 0 bits). The second byte is followed by
|
||||||
* acknowledge bit (ACK = 1) from the master to indicate that the last
|
* a NOT acknowledge bit (ACK = 1) from the master to indicate that the
|
||||||
* data byte has been received...
|
* last data byte has been received...
|
||||||
*/
|
*/
|
||||||
|
|
||||||
msg.frequency = priv->config->frequency; /* I2C frequency */
|
msg.frequency = priv->config->frequency; /* I2C frequency */
|
||||||
msg.addr = priv->config->address; /* 7-bit address */
|
msg.addr = priv->config->address; /* 7-bit address */
|
||||||
msg.flags = I2C_M_READ; /* Read transaction, beginning with START */
|
msg.flags = I2C_M_READ; /* Read transaction, beginning with START */
|
||||||
msg.buffer = data12; /* Transfer to this address */
|
msg.buffer = data12; /* Transfer to this address */
|
||||||
msg.length = 2; /* Read two bytes following the address */
|
msg.length = 2; /* Read two bytes following the address */
|
||||||
|
|
||||||
ret = I2C_TRANSFER(priv->i2c, &msg, 1);
|
ret = I2C_TRANSFER(priv->i2c, &msg, 1);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
ierr("ERROR: I2C_TRANSFER failed: %d\n", ret);
|
ierr("ERROR: I2C_TRANSFER failed: %d\n", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the MS 8 bits from the first byte and the remaining LS 4 bits from
|
/* Get the MS 8 bits from the first byte and the remaining LS 4 bits from
|
||||||
* the second byte. The valid range of data is then from 0 to 4095 with
|
* the second byte. The valid range of data is then from 0 to 4095 with
|
||||||
* the LSB unit corresponding to Vref/4096.
|
* the LSB unit corresponding to Vref/4096.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ret = (unsigned int)data12[0] << 4 | (unsigned int)data12[1] >> 4;
|
ret = (unsigned int)data12[0] << 4 | (unsigned int)data12[1] >> 4;
|
||||||
iinfo("data: 0x%04x\n", ret);
|
iinfo("data: 0x%04x\n", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -573,8 +564,9 @@ static void tsc2007_worker(FAR void *arg)
|
|||||||
|
|
||||||
if (!pendown)
|
if (!pendown)
|
||||||
{
|
{
|
||||||
/* Ignore the interrupt if the pen was already down (CONTACT_NONE == pen up and
|
/* Ignore the interrupt if the pen was already down (CONTACT_NONE ==
|
||||||
* already reported. CONTACT_UP == pen up, but not reported)
|
* pen up and already reported. CONTACT_UP == pen up, but not
|
||||||
|
* reported)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (priv->sample.contact == CONTACT_NONE)
|
if (priv->sample.contact == CONTACT_NONE)
|
||||||
@@ -584,13 +576,13 @@ static void tsc2007_worker(FAR void *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* It is a pen down event. If the last loss-of-contact event has not been
|
/* It is a pen down event. If the last loss-of-contact event has not been
|
||||||
* processed yet, then we have to ignore the pen down event (or else it will
|
* processed yet, then we have to ignore the pen down event (or else it
|
||||||
* look like a drag event)
|
* will look like a drag event)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
else if (priv->sample.contact == CONTACT_UP)
|
else if (priv->sample.contact == CONTACT_UP)
|
||||||
{
|
{
|
||||||
goto errout;
|
goto errout;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -598,47 +590,50 @@ static void tsc2007_worker(FAR void *arg)
|
|||||||
*
|
*
|
||||||
* "A resistive touch screen operates by applying a voltage across a
|
* "A resistive touch screen operates by applying a voltage across a
|
||||||
* resistor network and measuring the change in resistance at a given
|
* resistor network and measuring the change in resistance at a given
|
||||||
* point on the matrix where the screen is touched by an input (stylus,
|
* point on the matrix where the screen is touched by an input
|
||||||
* pen, or finger). The change in the resistance ratio marks the location
|
* (stylus, pen, or finger). The change in the resistance ratio marks
|
||||||
* on the touch screen.
|
* the location on the touch screen.
|
||||||
*
|
*
|
||||||
* "The 4-wire touch screen panel works by applying a voltage across the
|
* "The 4-wire touch screen panel works by applying a voltage across
|
||||||
* vertical or horizontal resistive network. The A/D converter converts
|
* the vertical or horizontal resistive network. The A/D converter
|
||||||
* the voltage measured at the point where the panel is touched. A measurement
|
* converts the voltage measured at the point where the panel is
|
||||||
* of the Y position of the pointing device is made by connecting the X+
|
* touched. A measurement of the Y position of the pointing device is
|
||||||
* input to a data converter chip, turning on the Y+ and Y- drivers, and
|
* made by connecting the X+ input to a data converter chip, turning
|
||||||
* digitizing the voltage seen at the X+ input ..."
|
* on the Y+ and Y- drivers, and digitizing the voltage seen at the
|
||||||
|
* X+ input ..."
|
||||||
*
|
*
|
||||||
* "... it is recommended that whenever the host writes to the TSC2007, the
|
* "... it is recommended that whenever the host writes to the TSC2007,
|
||||||
* master processor masks the interrupt associated to PENIRQ. This masking
|
* the master processor masks the interrupt associated to PENIRQ.
|
||||||
* prevents false triggering of interrupts when the PENIRQ line is disabled
|
* This masking prevents false triggering of interrupts when the
|
||||||
* in the cases previously listed."
|
* PENIRQ line is disabled in the cases previously listed."
|
||||||
*/
|
*/
|
||||||
|
|
||||||
tsc2007_activate(priv, TSC2007_ACTIVATE_X);
|
tsc2007_activate(priv, TSC2007_ACTIVATE_X);
|
||||||
y = tsc2007_transfer(priv, TSC2007_MEASURE_Y);
|
y = tsc2007_transfer(priv, TSC2007_MEASURE_Y);
|
||||||
|
|
||||||
|
|
||||||
/* "Voltage is then applied to the other axis, and the A/D converter
|
/* "Voltage is then applied to the other axis, and the A/D converter
|
||||||
* converts the voltage representing the X position on the screen. This
|
* converts the voltage representing the X position on the screen.
|
||||||
* process provides the X and Y coordinates to the associated processor."
|
* This process provides the X and Y coordinates to the associated
|
||||||
|
* processor."
|
||||||
*/
|
*/
|
||||||
|
|
||||||
tsc2007_activate(priv, TSC2007_ACTIVATE_Y);
|
tsc2007_activate(priv, TSC2007_ACTIVATE_Y);
|
||||||
x = tsc2007_transfer(priv, TSC2007_MEASURE_X);
|
x = tsc2007_transfer(priv, TSC2007_MEASURE_X);
|
||||||
|
|
||||||
/* "... To determine pen or finger touch, the pressure of the touch must be
|
/* "... To determine pen or finger touch, the pressure of the touch
|
||||||
* determined. ... There are several different ways of performing this
|
* must be determined. ... There are several different ways of
|
||||||
* measurement. The TSC2007 supports two methods. The first method requires
|
* performing this measurement. The TSC2007 supports two methods. The
|
||||||
* knowing the X-plate resistance, the measurement of the X-position, and two
|
* first method requires knowing the X-plate resistance, the
|
||||||
* additional cross panel measurements (Z2 and Z1) of the touch screen."
|
* measurement of the X-position, and two additional cross panel
|
||||||
|
* measurements (Z2 and Z1) of the touch screen."
|
||||||
*
|
*
|
||||||
* Rtouch = Rxplate * (X / 4096)* (Z2/Z1 - 1)
|
* Rtouch = Rxplate * (X / 4096)* (Z2/Z1 - 1)
|
||||||
*
|
*
|
||||||
* "The second method requires knowing both the X-plate and Y-plate
|
* "The second method requires knowing both the X-plate and Y-plate
|
||||||
* resistance, measurement of X-position and Y-position, and Z1 ..."
|
* resistance, measurement of X-position and Y-position, and Z1 ..."
|
||||||
*
|
*
|
||||||
* Rtouch = Rxplate * (X / 4096) * (4096/Z1 - 1) - Ryplate * (1 - Y/4096)
|
* Rtouch = Rxplate * (X / 4096) * (4096/Z1 - 1) -
|
||||||
|
* Ryplate * (1 - Y/4096)
|
||||||
*
|
*
|
||||||
* Read Z1 and Z2 values.
|
* Read Z1 and Z2 values.
|
||||||
*/
|
*/
|
||||||
@@ -880,7 +875,8 @@ static int tsc2007_close(FAR struct file *filep)
|
|||||||
* Name: tsc2007_read
|
* Name: tsc2007_read
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static ssize_t tsc2007_read(FAR struct file *filep, FAR char *buffer, size_t len)
|
static ssize_t tsc2007_read(FAR struct file *filep, FAR char *buffer,
|
||||||
|
size_t len)
|
||||||
{
|
{
|
||||||
FAR struct inode *inode;
|
FAR struct inode *inode;
|
||||||
FAR struct tsc2007_dev_s *priv;
|
FAR struct tsc2007_dev_s *priv;
|
||||||
@@ -930,7 +926,7 @@ static ssize_t tsc2007_read(FAR struct file *filep, FAR char *buffer, size_t len
|
|||||||
{
|
{
|
||||||
ret = -EAGAIN;
|
ret = -EAGAIN;
|
||||||
goto errout;
|
goto errout;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Wait for sample data */
|
/* Wait for sample data */
|
||||||
|
|
||||||
@@ -980,16 +976,20 @@ static ssize_t tsc2007_read(FAR struct file *filep, FAR char *buffer, size_t len
|
|||||||
{
|
{
|
||||||
/* Loss of contact */
|
/* Loss of contact */
|
||||||
|
|
||||||
report->point[0].flags = TOUCH_DOWN | TOUCH_ID_VALID | TOUCH_POS_VALID;
|
report->point[0].flags = TOUCH_DOWN | TOUCH_ID_VALID |
|
||||||
|
TOUCH_POS_VALID;
|
||||||
}
|
}
|
||||||
else /* if (sample->contact == CONTACT_MOVE) */
|
else /* if (sample->contact == CONTACT_MOVE) */
|
||||||
{
|
{
|
||||||
/* Movement of the same contact */
|
/* Movement of the same contact */
|
||||||
|
|
||||||
report->point[0].flags = TOUCH_MOVE | TOUCH_ID_VALID | TOUCH_POS_VALID;
|
report->point[0].flags = TOUCH_MOVE | TOUCH_ID_VALID |
|
||||||
|
TOUCH_POS_VALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* A pressure measurement of zero means that pressure is not available */
|
/* A pressure measurement of zero means that pressure is not
|
||||||
|
* available.
|
||||||
|
*/
|
||||||
|
|
||||||
if (report->point[0].pressure != 0)
|
if (report->point[0].pressure != 0)
|
||||||
{
|
{
|
||||||
@@ -1212,7 +1212,8 @@ int tsc2007_register(FAR struct i2c_master_s *dev,
|
|||||||
#ifndef CONFIG_TSC2007_MULTIPLE
|
#ifndef CONFIG_TSC2007_MULTIPLE
|
||||||
priv = &g_tsc2007;
|
priv = &g_tsc2007;
|
||||||
#else
|
#else
|
||||||
priv = (FAR struct tsc2007_dev_s *)kmm_malloc(sizeof(struct tsc2007_dev_s));
|
priv = (FAR struct tsc2007_dev_s *)
|
||||||
|
kmm_malloc(sizeof(struct tsc2007_dev_s));
|
||||||
if (!priv)
|
if (!priv)
|
||||||
{
|
{
|
||||||
ierr("ERROR: kmm_malloc(%d) failed\n", sizeof(struct tsc2007_dev_s));
|
ierr("ERROR: kmm_malloc(%d) failed\n", sizeof(struct tsc2007_dev_s));
|
||||||
|
|||||||
+31
-20
@@ -141,7 +141,9 @@
|
|||||||
# define net_rpmsg_drv_dumppacket(m, b, l)
|
# define net_rpmsg_drv_dumppacket(m, b, l)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* TX poll delay = 1 seconds. CLK_TCK is the number of clock ticks per second */
|
/* TX poll delay = 1 seconds. CLK_TCK is the number of clock ticks per
|
||||||
|
* second.
|
||||||
|
*/
|
||||||
|
|
||||||
#define NET_RPMSG_DRV_WDDELAY (1*CLK_TCK)
|
#define NET_RPMSG_DRV_WDDELAY (1*CLK_TCK)
|
||||||
|
|
||||||
@@ -379,8 +381,8 @@ static int net_rpmsg_drv_txpoll(FAR struct net_driver_s *dev)
|
|||||||
|
|
||||||
net_rpmsg_drv_transmit(dev, true);
|
net_rpmsg_drv_transmit(dev, true);
|
||||||
|
|
||||||
/* Check if there is room in the device to hold another packet. If not,
|
/* Check if there is room in the device to hold another packet. If
|
||||||
* return a non-zero value to terminate the poll.
|
* not, return a non-zero value to terminate the poll.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
dev->d_buf = rpmsg_get_tx_payload_buffer(&priv->ept, &size, false);
|
dev->d_buf = rpmsg_get_tx_payload_buffer(&priv->ept, &size, false);
|
||||||
@@ -394,8 +396,8 @@ static int net_rpmsg_drv_txpoll(FAR struct net_driver_s *dev)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If zero is returned, the polling will continue until all connections have
|
/* If zero is returned, the polling will continue until all connections
|
||||||
* been examined.
|
* have been examined.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -492,7 +494,8 @@ static int net_rpmsg_drv_sockioctl_task(int argc, FAR char *argv[])
|
|||||||
msg->header.result = psock_socket(domain, type, protocol, &sock);
|
msg->header.result = psock_socket(domain, type, protocol, &sock);
|
||||||
if (msg->header.result >= 0)
|
if (msg->header.result >= 0)
|
||||||
{
|
{
|
||||||
msg->header.result = psock_ioctl(&sock, msg->code, (unsigned long)msg->arg);
|
msg->header.result = psock_ioctl(&sock, msg->code,
|
||||||
|
(unsigned long)msg->arg);
|
||||||
psock_close(&sock); /* Close the temporary sock */
|
psock_close(&sock); /* Close the temporary sock */
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -536,7 +539,8 @@ static int net_rpmsg_drv_sockioctl_handler(FAR struct rpmsg_endpoint *ept,
|
|||||||
#ifdef CONFIG_NET_IPv4
|
#ifdef CONFIG_NET_IPv4
|
||||||
static bool net_rpmsg_drv_is_ipv4(FAR struct net_driver_s *dev)
|
static bool net_rpmsg_drv_is_ipv4(FAR struct net_driver_s *dev)
|
||||||
{
|
{
|
||||||
FAR struct ipv4_hdr_s *ip = (struct ipv4_hdr_s *)(dev->d_buf + dev->d_llhdrlen);
|
FAR struct ipv4_hdr_s *ip =
|
||||||
|
(struct ipv4_hdr_s *)(dev->d_buf + dev->d_llhdrlen);
|
||||||
FAR struct eth_hdr_s *eth = (struct eth_hdr_s *)dev->d_buf;
|
FAR struct eth_hdr_s *eth = (struct eth_hdr_s *)dev->d_buf;
|
||||||
|
|
||||||
if (dev->d_lltype == NET_LL_ETHERNET || dev->d_lltype == NET_LL_IEEE80211)
|
if (dev->d_lltype == NET_LL_ETHERNET || dev->d_lltype == NET_LL_IEEE80211)
|
||||||
@@ -553,7 +557,8 @@ static bool net_rpmsg_drv_is_ipv4(FAR struct net_driver_s *dev)
|
|||||||
#ifdef CONFIG_NET_IPv6
|
#ifdef CONFIG_NET_IPv6
|
||||||
static bool net_rpmsg_drv_is_ipv6(FAR struct net_driver_s *dev)
|
static bool net_rpmsg_drv_is_ipv6(FAR struct net_driver_s *dev)
|
||||||
{
|
{
|
||||||
FAR struct ipv6_hdr_s *ip = (struct ipv6_hdr_s *)(dev->d_buf + dev->d_llhdrlen);
|
FAR struct ipv6_hdr_s *ip =
|
||||||
|
(struct ipv6_hdr_s *)(dev->d_buf + dev->d_llhdrlen);
|
||||||
FAR struct eth_hdr_s *eth = (struct eth_hdr_s *)dev->d_buf;
|
FAR struct eth_hdr_s *eth = (struct eth_hdr_s *)dev->d_buf;
|
||||||
|
|
||||||
if (dev->d_lltype == NET_LL_ETHERNET || dev->d_lltype == NET_LL_IEEE80211)
|
if (dev->d_lltype == NET_LL_ETHERNET || dev->d_lltype == NET_LL_IEEE80211)
|
||||||
@@ -737,7 +742,8 @@ static int net_rpmsg_drv_ept_cb(FAR struct rpmsg_endpoint *ept, void *data,
|
|||||||
FAR struct net_rpmsg_header_s *header = data;
|
FAR struct net_rpmsg_header_s *header = data;
|
||||||
uint32_t command = header->command;
|
uint32_t command = header->command;
|
||||||
|
|
||||||
if (command < sizeof(g_net_rpmsg_drv_handler) / sizeof(g_net_rpmsg_drv_handler[0]))
|
if (command < sizeof(g_net_rpmsg_drv_handler) /
|
||||||
|
sizeof(g_net_rpmsg_drv_handler[0]))
|
||||||
{
|
{
|
||||||
return g_net_rpmsg_drv_handler[command](ept, data, len, src, priv);
|
return g_net_rpmsg_drv_handler[command](ept, data, len, src, priv);
|
||||||
}
|
}
|
||||||
@@ -827,9 +833,9 @@ static void net_rpmsg_drv_poll_work(FAR void *arg)
|
|||||||
|
|
||||||
if (dev->d_buf)
|
if (dev->d_buf)
|
||||||
{
|
{
|
||||||
/* If so, update TCP timing states and poll the network for new XMIT data.
|
/* If so, update TCP timing states and poll the network for new XMIT
|
||||||
* Hmmm.. might be bug here. Does this mean if there is a transmit in
|
* data. Hmmm.. might be bug here. Does this mean if there is a
|
||||||
* progress, we will missing TCP time state updates?
|
* transmit in progress, we will missing TCP time state updates?
|
||||||
*/
|
*/
|
||||||
|
|
||||||
devif_timer(dev, NET_RPMSG_DRV_WDDELAY, net_rpmsg_drv_txpoll);
|
devif_timer(dev, NET_RPMSG_DRV_WDDELAY, net_rpmsg_drv_txpoll);
|
||||||
@@ -979,7 +985,8 @@ static int net_rpmsg_drv_ifup(FAR struct net_driver_s *dev)
|
|||||||
dnsaddr.sin_port = htons(DNS_DEFAULT_PORT);
|
dnsaddr.sin_port = htons(DNS_DEFAULT_PORT);
|
||||||
memcpy(&dnsaddr.sin_addr, &msg.dnsaddr, sizeof(msg.dnsaddr));
|
memcpy(&dnsaddr.sin_addr, &msg.dnsaddr, sizeof(msg.dnsaddr));
|
||||||
|
|
||||||
dns_add_nameserver((FAR const struct sockaddr *)&dnsaddr, sizeof(dnsaddr));
|
dns_add_nameserver((FAR const struct sockaddr *)&dnsaddr,
|
||||||
|
sizeof(dnsaddr));
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
@@ -994,7 +1001,8 @@ static int net_rpmsg_drv_ifup(FAR struct net_driver_s *dev)
|
|||||||
dnsaddr.sin6_port = htons(DNS_DEFAULT_PORT);
|
dnsaddr.sin6_port = htons(DNS_DEFAULT_PORT);
|
||||||
memcpy(&dnsaddr.sin6_addr, msg.ipv6dnsaddr, sizeof(msg.ipv6dnsaddr));
|
memcpy(&dnsaddr.sin6_addr, msg.ipv6dnsaddr, sizeof(msg.ipv6dnsaddr));
|
||||||
|
|
||||||
dns_add_nameserver((FAR const struct sockaddr *)&dnsaddr, sizeof(dnsaddr));
|
dns_add_nameserver((FAR const struct sockaddr *)&dnsaddr,
|
||||||
|
sizeof(dnsaddr));
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
@@ -1037,8 +1045,8 @@ static int net_rpmsg_drv_ifdown(FAR struct net_driver_s *dev)
|
|||||||
leave_critical_section(flags);
|
leave_critical_section(flags);
|
||||||
|
|
||||||
/* Put the EMAC in its reset, non-operational state. This should be
|
/* Put the EMAC in its reset, non-operational state. This should be
|
||||||
* a known configuration that will guarantee the net_rpmsg_drv_ifup() always
|
* a known configuration that will guarantee the net_rpmsg_drv_ifup()
|
||||||
* successfully brings the interface back up.
|
* always successfully brings the interface back up.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
return net_rpmsg_drv_send_recv(dev, &msg, NET_RPMSG_IFDOWN, sizeof(msg));
|
return net_rpmsg_drv_send_recv(dev, &msg, NET_RPMSG_IFDOWN, sizeof(msg));
|
||||||
@@ -1091,7 +1099,9 @@ static void net_rpmsg_drv_txavail_work(FAR void *arg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if there is room in the hardware to hold another outgoing packet. */
|
/* Check if there is room in the hardware to hold another outgoing
|
||||||
|
* packet.
|
||||||
|
*/
|
||||||
|
|
||||||
if (dev->d_buf)
|
if (dev->d_buf)
|
||||||
{
|
{
|
||||||
@@ -1136,7 +1146,8 @@ static int net_rpmsg_drv_txavail(FAR struct net_driver_s *dev)
|
|||||||
{
|
{
|
||||||
/* Schedule to serialize the poll on the worker thread. */
|
/* Schedule to serialize the poll on the worker thread. */
|
||||||
|
|
||||||
work_queue(LPWORK, &priv->pollwork, net_rpmsg_drv_txavail_work, dev, 0);
|
work_queue(LPWORK, &priv->pollwork, net_rpmsg_drv_txavail_work,
|
||||||
|
dev, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
@@ -1176,8 +1187,8 @@ static int net_rpmsg_drv_addmac(FAR struct net_driver_s *dev,
|
|||||||
* Name: net_rpmsg_drv_rmmac
|
* Name: net_rpmsg_drv_rmmac
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* NuttX Callback: Remove the specified MAC address from the hardware multicast
|
* NuttX Callback: Remove the specified MAC address from the hardware
|
||||||
* address filtering
|
* multicast address filtering
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* dev - Reference to the NuttX driver state structure
|
* dev - Reference to the NuttX driver state structure
|
||||||
|
|||||||
+3
-1
@@ -111,7 +111,9 @@
|
|||||||
|
|
||||||
#define TUN_WDDELAY (1 * CLK_TCK)
|
#define TUN_WDDELAY (1 * CLK_TCK)
|
||||||
|
|
||||||
/* This is a helper pointer for accessing the contents of the Ethernet header */
|
/* This is a helper pointer for accessing the contents of the Ethernet
|
||||||
|
* header.
|
||||||
|
*/
|
||||||
|
|
||||||
#ifdef CONFIG_NET_ETHERNET
|
#ifdef CONFIG_NET_ETHERNET
|
||||||
# define BUF ((FAR struct eth_hdr_s *)priv->dev.d_buf)
|
# define BUF ((FAR struct eth_hdr_s *)priv->dev.d_buf)
|
||||||
|
|||||||
+30
-10
@@ -205,7 +205,9 @@ int pipecommon_open(FAR struct file *filep)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If opened for writing, increment the count of writers on the pipe instance */
|
/* If opened for writing, increment the count of writers on the pipe
|
||||||
|
* instance.
|
||||||
|
*/
|
||||||
|
|
||||||
if ((filep->f_oflags & O_WROK) != 0)
|
if ((filep->f_oflags & O_WROK) != 0)
|
||||||
{
|
{
|
||||||
@@ -225,7 +227,9 @@ int pipecommon_open(FAR struct file *filep)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If opened for reading, increment the count of reader on on the pipe instance */
|
/* If opened for reading, increment the count of reader on on the pipe
|
||||||
|
* instance.
|
||||||
|
*/
|
||||||
|
|
||||||
if ((filep->f_oflags & O_RDOK) != 0)
|
if ((filep->f_oflags & O_RDOK) != 0)
|
||||||
{
|
{
|
||||||
@@ -455,7 +459,9 @@ ssize_t pipecommon_read(FAR struct file *filep, FAR char *buffer, size_t len)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Then return whatever is available in the pipe (which is at least one byte) */
|
/* Then return whatever is available in the pipe (which is at least one
|
||||||
|
* byte).
|
||||||
|
*/
|
||||||
|
|
||||||
nread = 0;
|
nread = 0;
|
||||||
while ((size_t)nread < len && dev->d_wrndx != dev->d_rdndx)
|
while ((size_t)nread < len && dev->d_wrndx != dev->d_rdndx)
|
||||||
@@ -469,7 +475,9 @@ ssize_t pipecommon_read(FAR struct file *filep, FAR char *buffer, size_t len)
|
|||||||
nread++;
|
nread++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Notify all waiting writers that bytes have been removed from the buffer */
|
/* Notify all waiting writers that bytes have been removed from the
|
||||||
|
* buffer.
|
||||||
|
*/
|
||||||
|
|
||||||
while (nxsem_get_value(&dev->d_wrsem, &sval) == 0 && sval < 0)
|
while (nxsem_get_value(&dev->d_wrsem, &sval) == 0 && sval < 0)
|
||||||
{
|
{
|
||||||
@@ -575,14 +583,18 @@ ssize_t pipecommon_write(FAR struct file *filep, FAR const char *buffer,
|
|||||||
nwritten++;
|
nwritten++;
|
||||||
if ((size_t)nwritten >= len)
|
if ((size_t)nwritten >= len)
|
||||||
{
|
{
|
||||||
/* Yes.. Notify all of the waiting readers that more data is available */
|
/* Yes.. Notify all of the waiting readers that more data is
|
||||||
|
* available.
|
||||||
|
*/
|
||||||
|
|
||||||
while (nxsem_get_value(&dev->d_rdsem, &sval) == 0 && sval < 0)
|
while (nxsem_get_value(&dev->d_rdsem, &sval) == 0 && sval < 0)
|
||||||
{
|
{
|
||||||
nxsem_post(&dev->d_rdsem);
|
nxsem_post(&dev->d_rdsem);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Notify all poll/select waiters that they can read from the FIFO */
|
/* Notify all poll/select waiters that they can read from the
|
||||||
|
* FIFO.
|
||||||
|
*/
|
||||||
|
|
||||||
pipecommon_pollnotify(dev, POLLIN);
|
pipecommon_pollnotify(dev, POLLIN);
|
||||||
|
|
||||||
@@ -594,25 +606,33 @@ ssize_t pipecommon_write(FAR struct file *filep, FAR const char *buffer,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* There is not enough room for the next byte. Was anything written in this pass? */
|
/* There is not enough room for the next byte. Was anything
|
||||||
|
* written in this pass?
|
||||||
|
*/
|
||||||
|
|
||||||
if (last < nwritten)
|
if (last < nwritten)
|
||||||
{
|
{
|
||||||
/* Yes.. Notify all of the waiting readers that more data is available */
|
/* Yes.. Notify all of the waiting readers that more data is
|
||||||
|
* available.
|
||||||
|
*/
|
||||||
|
|
||||||
while (nxsem_get_value(&dev->d_rdsem, &sval) == 0 && sval < 0)
|
while (nxsem_get_value(&dev->d_rdsem, &sval) == 0 && sval < 0)
|
||||||
{
|
{
|
||||||
nxsem_post(&dev->d_rdsem);
|
nxsem_post(&dev->d_rdsem);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Notify all poll/select waiters that they can read from the FIFO */
|
/* Notify all poll/select waiters that they can read from the
|
||||||
|
* FIFO.
|
||||||
|
*/
|
||||||
|
|
||||||
pipecommon_pollnotify(dev, POLLIN);
|
pipecommon_pollnotify(dev, POLLIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
last = nwritten;
|
last = nwritten;
|
||||||
|
|
||||||
/* If O_NONBLOCK was set, then return partial bytes written or EGAIN */
|
/* If O_NONBLOCK was set, then return partial bytes written or
|
||||||
|
* EGAIN.
|
||||||
|
*/
|
||||||
|
|
||||||
if (filep->f_oflags & O_NONBLOCK)
|
if (filep->f_oflags & O_NONBLOCK)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -99,7 +99,8 @@ static void lis3dh_write_register(FAR struct lis3dh_dev_s *dev,
|
|||||||
static void lis3dh_reset(FAR struct lis3dh_dev_s *dev);
|
static void lis3dh_reset(FAR struct lis3dh_dev_s *dev);
|
||||||
static int lis3dh_ident(FAR struct lis3dh_dev_s *dev);
|
static int lis3dh_ident(FAR struct lis3dh_dev_s *dev);
|
||||||
static int lis3dh_read_fifo(FAR struct lis3dh_dev_s *dev);
|
static int lis3dh_read_fifo(FAR struct lis3dh_dev_s *dev);
|
||||||
static int lis3dh_interrupt_handler(int irq, FAR void *context, FAR void *arg);
|
static int lis3dh_interrupt_handler(int irq, FAR void *context,
|
||||||
|
FAR void *arg);
|
||||||
static void lis3dh_worker(FAR void *arg);
|
static void lis3dh_worker(FAR void *arg);
|
||||||
static int lis3dh_irq_enable(FAR struct lis3dh_dev_s *dev, bool enable);
|
static int lis3dh_irq_enable(FAR struct lis3dh_dev_s *dev, bool enable);
|
||||||
static int lis3dh_fifo_enable(FAR struct lis3dh_dev_s *dev);
|
static int lis3dh_fifo_enable(FAR struct lis3dh_dev_s *dev);
|
||||||
@@ -152,7 +153,9 @@ static void lis3dh_read_register(FAR struct lis3dh_dev_s *dev,
|
|||||||
{
|
{
|
||||||
uint8_t buffer[2];
|
uint8_t buffer[2];
|
||||||
|
|
||||||
/* Lock the SPI bus so that only one device can access it at the same time */
|
/* Lock the SPI bus so that only one device can access it at the same
|
||||||
|
* time.
|
||||||
|
*/
|
||||||
|
|
||||||
SPI_LOCK(dev->spi, true);
|
SPI_LOCK(dev->spi, true);
|
||||||
|
|
||||||
@@ -193,7 +196,9 @@ static void lis3dh_write_register(FAR struct lis3dh_dev_s *dev,
|
|||||||
{
|
{
|
||||||
uint8_t buffer[2];
|
uint8_t buffer[2];
|
||||||
|
|
||||||
/* Lock the SPI bus so that only one device can access it at the same time */
|
/* Lock the SPI bus so that only one device can access it at the same
|
||||||
|
* time.
|
||||||
|
*/
|
||||||
|
|
||||||
SPI_LOCK(dev->spi, true);
|
SPI_LOCK(dev->spi, true);
|
||||||
|
|
||||||
@@ -501,7 +506,8 @@ static int lis3dh_read_fifo(FAR struct lis3dh_dev_s *dev)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static int lis3dh_interrupt_handler(int irq, FAR void *context, FAR void *arg)
|
static int lis3dh_interrupt_handler(int irq, FAR void *context,
|
||||||
|
FAR void *arg)
|
||||||
{
|
{
|
||||||
/* The interrupt handler is called when the FIFO watermark is reached */
|
/* The interrupt handler is called when the FIFO watermark is reached */
|
||||||
|
|
||||||
|
|||||||
@@ -795,7 +795,8 @@ static int pty_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
|||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
DEBUGVERIFY(nxsem_get_value(&devpair->pp_slavesem, &sval));
|
DEBUGVERIFY(nxsem_get_value(&devpair->pp_slavesem,
|
||||||
|
&sval));
|
||||||
if (sval < 0)
|
if (sval < 0)
|
||||||
{
|
{
|
||||||
nxsem_post(&devpair->pp_slavesem);
|
nxsem_post(&devpair->pp_slavesem);
|
||||||
|
|||||||
+33
-40
@@ -1,35 +1,20 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* drivers/syslog/ramlog.c
|
* drivers/syslog/ramlog.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2012, 2016-2017 Gregory Nutt. All rights reserved.
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
*
|
*
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
* notice, this list of conditions and the following disclaimer in
|
* License for the specific language governing permissions and limitations
|
||||||
* the documentation and/or other materials provided with the
|
* under the License.
|
||||||
* 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.
|
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
@@ -212,6 +197,7 @@ static void ramlog_pollnotify(FAR struct ramlog_dev_s *priv,
|
|||||||
nxsem_post(fds->sem);
|
nxsem_post(fds->sem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
leave_critical_section(flags);
|
leave_critical_section(flags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -259,7 +245,8 @@ static ssize_t ramlog_addchar(FAR struct ramlog_dev_s *priv, char ch)
|
|||||||
* Name: ramlog_read
|
* Name: ramlog_read
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static ssize_t ramlog_read(FAR struct file *filep, FAR char *buffer, size_t len)
|
static ssize_t ramlog_read(FAR struct file *filep, FAR char *buffer,
|
||||||
|
size_t len)
|
||||||
{
|
{
|
||||||
FAR struct inode *inode = filep->f_inode;
|
FAR struct inode *inode = filep->f_inode;
|
||||||
FAR struct ramlog_dev_s *priv;
|
FAR struct ramlog_dev_s *priv;
|
||||||
@@ -310,7 +297,9 @@ static ssize_t ramlog_read(FAR struct file *filep, FAR char *buffer, size_t len)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If the driver was opened with O_NONBLOCK option, then don't wait. */
|
/* If the driver was opened with O_NONBLOCK option, then don't
|
||||||
|
* wait.
|
||||||
|
*/
|
||||||
|
|
||||||
if (filep->f_oflags & O_NONBLOCK)
|
if (filep->f_oflags & O_NONBLOCK)
|
||||||
{
|
{
|
||||||
@@ -319,8 +308,9 @@ static ssize_t ramlog_read(FAR struct file *filep, FAR char *buffer, size_t len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Otherwise, wait for something to be written to the circular
|
/* Otherwise, wait for something to be written to the circular
|
||||||
* buffer. Increment the number of waiters so that the ramlog_write()
|
* buffer. Increment the number of waiters so that the
|
||||||
* will note that it needs to post the semaphore to wake us up.
|
* ramlog_write() will note that it needs to post the semaphore
|
||||||
|
* to wake us up.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
sched_lock();
|
sched_lock();
|
||||||
@@ -419,7 +409,8 @@ errout_without_sem:
|
|||||||
* Name: ramlog_write
|
* Name: ramlog_write
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static ssize_t ramlog_write(FAR struct file *filep, FAR const char *buffer, size_t len)
|
static ssize_t ramlog_write(FAR struct file *filep, FAR const char *buffer,
|
||||||
|
size_t len)
|
||||||
{
|
{
|
||||||
FAR struct inode *inode = filep->f_inode;
|
FAR struct inode *inode = filep->f_inode;
|
||||||
FAR struct ramlog_dev_s *priv;
|
FAR struct ramlog_dev_s *priv;
|
||||||
@@ -508,7 +499,9 @@ static ssize_t ramlog_write(FAR struct file *filep, FAR const char *buffer, size
|
|||||||
|
|
||||||
if (readers_waken == 0)
|
if (readers_waken == 0)
|
||||||
{
|
{
|
||||||
/* Notify all poll/select waiters that they can read from the FIFO */
|
/* Notify all poll/select waiters that they can read from the
|
||||||
|
* FIFO.
|
||||||
|
*/
|
||||||
|
|
||||||
ramlog_pollnotify(priv, POLLIN);
|
ramlog_pollnotify(priv, POLLIN);
|
||||||
}
|
}
|
||||||
@@ -592,23 +585,23 @@ int ramlog_poll(FAR struct file *filep, FAR struct pollfd *fds, bool setup)
|
|||||||
/* First, check if the receive buffer is not full. */
|
/* First, check if the receive buffer is not full. */
|
||||||
|
|
||||||
if (next_head != priv->rl_tail)
|
if (next_head != priv->rl_tail)
|
||||||
{
|
{
|
||||||
eventset |= POLLOUT;
|
eventset |= POLLOUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if the receive buffer is not empty. */
|
/* Check if the receive buffer is not empty. */
|
||||||
|
|
||||||
if (priv->rl_head != priv->rl_tail)
|
if (priv->rl_head != priv->rl_tail)
|
||||||
{
|
{
|
||||||
eventset |= POLLIN;
|
eventset |= POLLIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
leave_critical_section(flags);
|
leave_critical_section(flags);
|
||||||
|
|
||||||
if (eventset)
|
if (eventset)
|
||||||
{
|
{
|
||||||
ramlog_pollnotify(priv, eventset);
|
ramlog_pollnotify(priv, eventset);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (fds->priv)
|
else if (fds->priv)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -458,7 +458,9 @@ static int pwm_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
|||||||
|
|
||||||
memcpy(&upper->info, info, sizeof(struct pwm_info_s));
|
memcpy(&upper->info, info, sizeof(struct pwm_info_s));
|
||||||
|
|
||||||
/* If PWM is already running, then re-start it with the new characteristics */
|
/* If PWM is already running, then re-start it with the new
|
||||||
|
* characteristics.
|
||||||
|
*/
|
||||||
|
|
||||||
if (upper->started)
|
if (upper->started)
|
||||||
{
|
{
|
||||||
@@ -532,7 +534,9 @@ static int pwm_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Any unrecognized IOCTL commands might be platform-specific ioctl commands */
|
/* Any unrecognized IOCTL commands might be platform-specific ioctl
|
||||||
|
* commands.
|
||||||
|
*/
|
||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
@@ -590,7 +594,9 @@ int pwm_register(FAR const char *path, FAR struct pwm_lowerhalf_s *dev)
|
|||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize the PWM device structure (it was already zeroed by kmm_zalloc()) */
|
/* Initialize the PWM device structure (it was already zeroed by
|
||||||
|
* kmm_zalloc()).
|
||||||
|
*/
|
||||||
|
|
||||||
nxsem_init(&upper->exclsem, 0, 1);
|
nxsem_init(&upper->exclsem, 0, 1);
|
||||||
#ifdef CONFIG_PWM_PULSECOUNT
|
#ifdef CONFIG_PWM_PULSECOUNT
|
||||||
|
|||||||
+14
-15
@@ -131,32 +131,30 @@ struct rpmsg_rtc_lowerhalf_s
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static void rpmsg_rtc_device_created(FAR struct rpmsg_device *rdev,
|
static void rpmsg_rtc_device_created(FAR struct rpmsg_device *rdev,
|
||||||
FAR void *priv);
|
FAR void *priv);
|
||||||
static void rpmsg_rtc_device_destroy(FAR struct rpmsg_device *rdev,
|
static void rpmsg_rtc_device_destroy(FAR struct rpmsg_device *rdev,
|
||||||
FAR void *priv);
|
FAR void *priv);
|
||||||
static void rpmsg_rtc_alarm_fire_handler(FAR struct rpmsg_endpoint *ept,
|
static void rpmsg_rtc_alarm_fire_handler(FAR struct rpmsg_endpoint *ept,
|
||||||
FAR void *data, size_t len,
|
FAR void *data, size_t len, uint32_t src, FAR void *priv);
|
||||||
uint32_t src, FAR void *priv);
|
|
||||||
static int rpmsg_rtc_ept_cb(FAR struct rpmsg_endpoint *ept, FAR void *data,
|
static int rpmsg_rtc_ept_cb(FAR struct rpmsg_endpoint *ept, FAR void *data,
|
||||||
size_t len, uint32_t src, FAR void *priv);
|
size_t len, uint32_t src, FAR void *priv);
|
||||||
|
|
||||||
static int rpmsg_rtc_send_recv(FAR struct rpmsg_rtc_lowerhalf_s *lower,
|
static int rpmsg_rtc_send_recv(FAR struct rpmsg_rtc_lowerhalf_s *lower,
|
||||||
uint32_t command,
|
uint32_t command, FAR struct rpmsg_rtc_header_s *msg, int len);
|
||||||
FAR struct rpmsg_rtc_header_s *msg, int len);
|
|
||||||
static int rpmsg_rtc_rdtime(FAR struct rtc_lowerhalf_s *lower,
|
static int rpmsg_rtc_rdtime(FAR struct rtc_lowerhalf_s *lower,
|
||||||
FAR struct rtc_time *rtctime);
|
FAR struct rtc_time *rtctime);
|
||||||
static int rpmsg_rtc_settime(FAR struct rtc_lowerhalf_s *lower,
|
static int rpmsg_rtc_settime(FAR struct rtc_lowerhalf_s *lower,
|
||||||
FAR const struct rtc_time *rtctime);
|
FAR const struct rtc_time *rtctime);
|
||||||
static bool rpmsg_rtc_havesettime(FAR struct rtc_lowerhalf_s *lower);
|
static bool rpmsg_rtc_havesettime(FAR struct rtc_lowerhalf_s *lower);
|
||||||
#ifdef CONFIG_RTC_ALARM
|
#ifdef CONFIG_RTC_ALARM
|
||||||
static int rpmsg_rtc_setalarm(FAR struct rtc_lowerhalf_s *lower_,
|
static int rpmsg_rtc_setalarm(FAR struct rtc_lowerhalf_s *lower_,
|
||||||
FAR const struct lower_setalarm_s *alarminfo);
|
FAR const struct lower_setalarm_s *alarminfo);
|
||||||
static int rpmsg_rtc_setrelative(FAR struct rtc_lowerhalf_s *lower,
|
static int rpmsg_rtc_setrelative(FAR struct rtc_lowerhalf_s *lower,
|
||||||
FAR const struct lower_setrelative_s *relinfo);
|
FAR const struct lower_setrelative_s *relinfo);
|
||||||
static int rpmsg_rtc_cancelalarm(FAR struct rtc_lowerhalf_s *lower,
|
static int rpmsg_rtc_cancelalarm(FAR struct rtc_lowerhalf_s *lower,
|
||||||
int alarmid);
|
int alarmid);
|
||||||
static int rpmsg_rtc_rdalarm(FAR struct rtc_lowerhalf_s *lower_,
|
static int rpmsg_rtc_rdalarm(FAR struct rtc_lowerhalf_s *lower_,
|
||||||
FAR struct lower_rdalarm_s *alarminfo);
|
FAR struct lower_rdalarm_s *alarminfo);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -337,8 +335,9 @@ static int rpmsg_rtc_setalarm(FAR struct rtc_lowerhalf_s *lower_,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rpmsg_rtc_setrelative(FAR struct rtc_lowerhalf_s *lower,
|
static int
|
||||||
FAR const struct lower_setrelative_s *relinfo)
|
rpmsg_rtc_setrelative(FAR struct rtc_lowerhalf_s *lower,
|
||||||
|
FAR const struct lower_setrelative_s *relinfo)
|
||||||
{
|
{
|
||||||
struct lower_setalarm_s alarminfo =
|
struct lower_setalarm_s alarminfo =
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -766,7 +766,9 @@ static int usbhost_xboxcontroller_poll(int argc, char *argv[])
|
|||||||
memcpy(priv->tbuffer, guide_button_report_ack,
|
memcpy(priv->tbuffer, guide_button_report_ack,
|
||||||
sizeof(guide_button_report_ack));
|
sizeof(guide_button_report_ack));
|
||||||
|
|
||||||
/* Ensure the sequence number is the same as the input packet. */
|
/* Ensure the sequence number is the same as the input
|
||||||
|
* packet.
|
||||||
|
*/
|
||||||
|
|
||||||
priv->tbuffer[2] = seq_num;
|
priv->tbuffer[2] = seq_num;
|
||||||
|
|
||||||
@@ -789,7 +791,9 @@ static int usbhost_xboxcontroller_poll(int argc, char *argv[])
|
|||||||
|
|
||||||
case USBHOST_BUTTON_DATA:
|
case USBHOST_BUTTON_DATA:
|
||||||
|
|
||||||
/* Ignore the controller data if no task has opened the driver. */
|
/* Ignore the controller data if no task has opened the
|
||||||
|
* driver.
|
||||||
|
*/
|
||||||
|
|
||||||
if (priv->open)
|
if (priv->open)
|
||||||
{
|
{
|
||||||
@@ -879,7 +883,9 @@ static int usbhost_xboxcontroller_poll(int argc, char *argv[])
|
|||||||
|
|
||||||
priv->valid = true;
|
priv->valid = true;
|
||||||
|
|
||||||
/* Notify any waiters that new controller data is available */
|
/* Notify any waiters that new controller data is
|
||||||
|
* available.
|
||||||
|
*/
|
||||||
|
|
||||||
usbhost_pollnotify(priv);
|
usbhost_pollnotify(priv);
|
||||||
|
|
||||||
@@ -1185,7 +1191,9 @@ static inline int usbhost_cfgdesc(FAR struct usbhost_state_s *priv,
|
|||||||
uinfo("Interface descriptor\n");
|
uinfo("Interface descriptor\n");
|
||||||
DEBUGASSERT(remaining >= USB_SIZEOF_IFDESC);
|
DEBUGASSERT(remaining >= USB_SIZEOF_IFDESC);
|
||||||
|
|
||||||
/* Did we already find what we needed from a preceding interface? */
|
/* Did we already find what we needed from a preceding
|
||||||
|
* interface?
|
||||||
|
*/
|
||||||
|
|
||||||
if ((found & USBHOST_ALLFOUND) == USBHOST_ALLFOUND)
|
if ((found & USBHOST_ALLFOUND) == USBHOST_ALLFOUND)
|
||||||
{
|
{
|
||||||
@@ -1415,7 +1423,9 @@ static inline int usbhost_devinit(FAR struct usbhost_state_s *priv)
|
|||||||
(FAR char * const *)NULL);
|
(FAR char * const *)NULL);
|
||||||
if (priv->pollpid < 0)
|
if (priv->pollpid < 0)
|
||||||
{
|
{
|
||||||
/* Failed to started the poll thread... probably due to memory resources */
|
/* Failed to started the poll thread... probably due to memory
|
||||||
|
* resources.
|
||||||
|
*/
|
||||||
|
|
||||||
usbhost_givesem(&g_exclsem);
|
usbhost_givesem(&g_exclsem);
|
||||||
ret = priv->pollpid;
|
ret = priv->pollpid;
|
||||||
@@ -1649,11 +1659,15 @@ static FAR struct usbhost_class_s *
|
|||||||
priv->usbclass.connect = usbhost_connect;
|
priv->usbclass.connect = usbhost_connect;
|
||||||
priv->usbclass.disconnected = usbhost_disconnected;
|
priv->usbclass.disconnected = usbhost_disconnected;
|
||||||
|
|
||||||
/* The initial reference count is 1... One reference is held by the driver */
|
/* The initial reference count is 1... One reference is held by the
|
||||||
|
* driver.
|
||||||
|
*/
|
||||||
|
|
||||||
priv->crefs = 1;
|
priv->crefs = 1;
|
||||||
|
|
||||||
/* Initialize semaphores (this works okay in the interrupt context) */
|
/* Initialize semaphores (this works okay in the interrupt
|
||||||
|
* context).
|
||||||
|
*/
|
||||||
|
|
||||||
nxsem_init(&priv->exclsem, 0, 1);
|
nxsem_init(&priv->exclsem, 0, 1);
|
||||||
nxsem_init(&priv->waitsem, 0, 0);
|
nxsem_init(&priv->waitsem, 0, 0);
|
||||||
@@ -1782,7 +1796,9 @@ static int usbhost_disconnected(struct usbhost_class_s *usbclass)
|
|||||||
priv->disconnected = true;
|
priv->disconnected = true;
|
||||||
uinfo("Disconnected\n");
|
uinfo("Disconnected\n");
|
||||||
|
|
||||||
/* Are there a thread(s) waiting for controller data that will never come? */
|
/* Are there a thread(s) waiting for controller data that will never
|
||||||
|
* come?
|
||||||
|
*/
|
||||||
|
|
||||||
for (i = 0; i < priv->nwaiters; i++)
|
for (i = 0; i < priv->nwaiters; i++)
|
||||||
{
|
{
|
||||||
|
|||||||
+25
-19
@@ -237,6 +237,7 @@ static const struct file_operations g_video_fops =
|
|||||||
};
|
};
|
||||||
|
|
||||||
static bool is_initialized = false;
|
static bool is_initialized = false;
|
||||||
|
static FAR void *video_handler;
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Data
|
* Public Data
|
||||||
@@ -245,6 +246,7 @@ static bool is_initialized = false;
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Functions
|
* Private Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static int video_lock(FAR sem_t *sem)
|
static int video_lock(FAR sem_t *sem)
|
||||||
{
|
{
|
||||||
if (sem == NULL)
|
if (sem == NULL)
|
||||||
@@ -483,6 +485,7 @@ static int video_open(FAR struct file *filep)
|
|||||||
{
|
{
|
||||||
priv->open_num++;
|
priv->open_num++;
|
||||||
}
|
}
|
||||||
|
|
||||||
video_unlock(&priv->lock_open_num);
|
video_unlock(&priv->lock_open_num);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
@@ -507,6 +510,7 @@ static int video_close(FAR struct file *filep)
|
|||||||
cleanup_resources(priv);
|
cleanup_resources(priv);
|
||||||
g_video_devops->close();
|
g_video_devops->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
video_unlock(&priv->lock_open_num);
|
video_unlock(&priv->lock_open_num);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
@@ -927,39 +931,39 @@ static int video_takepict_start(FAR struct video_mng_s *vmng,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (capture_num > 0)
|
if (capture_num > 0)
|
||||||
{
|
{
|
||||||
vmng->still_inf.remaining_capnum = capture_num;
|
vmng->still_inf.remaining_capnum = capture_num;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
vmng->still_inf.remaining_capnum = VIDEO_REMAINING_CAPNUM_INFINITY;
|
vmng->still_inf.remaining_capnum = VIDEO_REMAINING_CAPNUM_INFINITY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Control video stream prior to still stream */
|
/* Control video stream prior to still stream */
|
||||||
|
|
||||||
flags = enter_critical_section();
|
flags = enter_critical_section();
|
||||||
|
|
||||||
next_video_state = estimate_next_video_state(vmng,
|
next_video_state = estimate_next_video_state(vmng,
|
||||||
CAUSE_STILL_START);
|
CAUSE_STILL_START);
|
||||||
change_video_state(vmng, next_video_state);
|
change_video_state(vmng, next_video_state);
|
||||||
|
|
||||||
leave_critical_section(flags);
|
leave_critical_section(flags);
|
||||||
|
|
||||||
dma_container = video_framebuff_get_dma_container
|
dma_container = video_framebuff_get_dma_container
|
||||||
(&vmng->still_inf.bufinf);
|
(&vmng->still_inf.bufinf);
|
||||||
if (dma_container)
|
if (dma_container)
|
||||||
{
|
{
|
||||||
/* Start video stream DMA */
|
/* Start video stream DMA */
|
||||||
|
|
||||||
g_video_devops->set_buftype(V4L2_BUF_TYPE_STILL_CAPTURE);
|
g_video_devops->set_buftype(V4L2_BUF_TYPE_STILL_CAPTURE);
|
||||||
g_video_devops->set_buf(dma_container->buf.m.userptr,
|
g_video_devops->set_buf(dma_container->buf.m.userptr,
|
||||||
dma_container->buf.length);
|
dma_container->buf.length);
|
||||||
vmng->still_inf.state = VIDEO_STATE_DMA;
|
vmng->still_inf.state = VIDEO_STATE_DMA;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
vmng->still_inf.state = VIDEO_STATE_STREAMON;
|
vmng->still_inf.state = VIDEO_STATE_STREAMON;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -993,6 +997,7 @@ static int video_takepict_stop(FAR struct video_mng_s *vmng, bool halfpush)
|
|||||||
{
|
{
|
||||||
g_video_devops->cancel_dma();
|
g_video_devops->cancel_dma();
|
||||||
}
|
}
|
||||||
|
|
||||||
leave_critical_section(flags);
|
leave_critical_section(flags);
|
||||||
|
|
||||||
vmng->still_inf.state = VIDEO_STATE_STREAMOFF;
|
vmng->still_inf.state = VIDEO_STATE_STREAMOFF;
|
||||||
@@ -1431,6 +1436,7 @@ static FAR void *video_register(FAR const char *devpath)
|
|||||||
kmm_free(priv);
|
kmm_free(priv);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(priv->devpath, devpath, allocsize);
|
memcpy(priv->devpath, devpath, allocsize);
|
||||||
priv->devpath[allocsize] = '\0';
|
priv->devpath[allocsize] = '\0';
|
||||||
|
|
||||||
@@ -1476,7 +1482,6 @@ static int video_unregister(FAR video_mng_t *v_mgr)
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
static FAR void *video_handler;
|
|
||||||
|
|
||||||
int video_initialize(FAR const char *devpath)
|
int video_initialize(FAR const char *devpath)
|
||||||
{
|
{
|
||||||
@@ -1498,6 +1503,7 @@ int video_uninitialize(void)
|
|||||||
{
|
{
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
video_unregister(video_handler);
|
video_unregister(video_handler);
|
||||||
|
|
||||||
is_initialized = false;
|
is_initialized = false;
|
||||||
|
|||||||
@@ -302,7 +302,9 @@ static int load_bcm4343x_firmware(FAR const struct btuart_lowerhalf_s *lower)
|
|||||||
0x00
|
0x00
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Let's temporarily connect to the hci uart rx callback so we can get data */
|
/* Let's temporarily connect to the hci uart rx callback so we can get
|
||||||
|
* data.
|
||||||
|
*/
|
||||||
|
|
||||||
lower->rxattach(lower, hciuart_cb, &rxsem);
|
lower->rxattach(lower, hciuart_cb, &rxsem);
|
||||||
lower->rxenable(lower, true);
|
lower->rxenable(lower, true);
|
||||||
|
|||||||
@@ -242,7 +242,7 @@ hciuart_setbaud(FAR const struct btuart_lowerhalf_s *lower, uint32_t baud)
|
|||||||
ret = file_ioctl(&state->f, TCGETS, (long unsigned int)&tio);
|
ret = file_ioctl(&state->f, TCGETS, (long unsigned int)&tio);
|
||||||
if (ret)
|
if (ret)
|
||||||
{
|
{
|
||||||
wlerr("hciuart_setbaud: ERROR during TCGETS\n");
|
wlerr("ERROR during TCGETS\n");
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -259,7 +259,7 @@ hciuart_setbaud(FAR const struct btuart_lowerhalf_s *lower, uint32_t baud)
|
|||||||
|
|
||||||
if (ret)
|
if (ret)
|
||||||
{
|
{
|
||||||
wlerr("hciuart_setbaud: ERROR during TCSETS, does UART support CTS/RTS?\n");
|
wlerr("ERROR during TCSETS, does UART support CTS/RTS?\n");
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -286,10 +286,11 @@ hciuart_read(FAR const struct btuart_lowerhalf_s *lower,
|
|||||||
FAR struct hciuart_state_s *state = &config->state;
|
FAR struct hciuart_state_s *state = &config->state;
|
||||||
size_t ntotal;
|
size_t ntotal;
|
||||||
|
|
||||||
wlinfo("config %p buffer %p buflen %lu\n", config, buffer, (size_t) buflen);
|
wlinfo("config %p buffer %p buflen %lu\n",
|
||||||
|
config, buffer, (size_t) buflen);
|
||||||
|
|
||||||
/* NOTE: This assumes that the caller has exclusive access to the Rx buffer,
|
/* NOTE: This assumes that the caller has exclusive access to the Rx
|
||||||
* i.e., one lower half instance can server only one upper half!
|
* buffer, i.e., one lower half instance can server only one upper half!
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ntotal = file_read(&state->f, buffer, buflen);
|
ntotal = file_read(&state->f, buffer, buflen);
|
||||||
@@ -318,7 +319,8 @@ hciuart_write(FAR const struct btuart_lowerhalf_s *lower,
|
|||||||
= (FAR const struct hciuart_config_s *)lower;
|
= (FAR const struct hciuart_config_s *)lower;
|
||||||
FAR const struct hciuart_state_s *state = &config->state;
|
FAR const struct hciuart_state_s *state = &config->state;
|
||||||
|
|
||||||
wlinfo("config %p buffer %p buflen %lu\n", config, buffer, (size_t) buflen);
|
wlinfo("config %p buffer %p buflen %lu\n",
|
||||||
|
config, buffer, (size_t) buflen);
|
||||||
|
|
||||||
buflen = file_write((struct file *)&state->f, buffer, buflen);
|
buflen = file_write((struct file *)&state->f, buffer, buflen);
|
||||||
|
|
||||||
@@ -367,7 +369,9 @@ static int hcicollecttask(int argc, FAR char **argv)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* These flags can change dynamically as new events occur, so snapshot */
|
/* These flags can change dynamically as new events occur, so
|
||||||
|
* snapshot.
|
||||||
|
*/
|
||||||
|
|
||||||
irqstate_t flags = enter_critical_section();
|
irqstate_t flags = enter_critical_section();
|
||||||
uint32_t tevents = s->p.revents;
|
uint32_t tevents = s->p.revents;
|
||||||
@@ -434,7 +438,8 @@ FAR void *bt_uart_shim_getdevice(FAR char *path)
|
|||||||
|
|
||||||
/* Get the memory for this shim instance */
|
/* Get the memory for this shim instance */
|
||||||
|
|
||||||
g_n = (struct hciuart_config_s *)kmm_zalloc(sizeof(struct hciuart_config_s));
|
g_n = (FAR struct hciuart_config_s *)
|
||||||
|
kmm_zalloc(sizeof(struct hciuart_config_s));
|
||||||
|
|
||||||
if (!g_n)
|
if (!g_n)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -73,9 +73,9 @@
|
|||||||
#define BCMF_SCAN_RESULT_SIZE 1024
|
#define BCMF_SCAN_RESULT_SIZE 1024
|
||||||
|
|
||||||
/* CLM file is cut into pieces of MAX_CHUNK_LEN.
|
/* CLM file is cut into pieces of MAX_CHUNK_LEN.
|
||||||
* It is relatively small because dongles (FW) have a small maximum size input
|
* It is relatively small because dongles (FW) have a small maximum size
|
||||||
* payload restriction for ioctl's ... something like 1900'ish bytes. So chunk
|
* input payload restriction for ioctl's ... something like 1900'ish bytes.
|
||||||
* len should not exceed 1400 bytes
|
* So chunk len should not exceed 1400 bytes
|
||||||
*
|
*
|
||||||
* NOTE: CONFIG_NET_ETH_PKTSIZE is the MTU plus the size of the Ethernet
|
* NOTE: CONFIG_NET_ETH_PKTSIZE is the MTU plus the size of the Ethernet
|
||||||
* header (14 bytes).
|
* header (14 bytes).
|
||||||
@@ -198,7 +198,8 @@ FAR struct bcmf_dev_s *bcmf_allocate_device(void)
|
|||||||
goto exit_free_priv;
|
goto exit_free_priv;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((ret = nxsem_set_protocol(&priv->control_timeout, SEM_PRIO_NONE)) != OK)
|
if ((ret = nxsem_set_protocol(&priv->control_timeout, SEM_PRIO_NONE)) !=
|
||||||
|
OK)
|
||||||
{
|
{
|
||||||
goto exit_free_priv;
|
goto exit_free_priv;
|
||||||
}
|
}
|
||||||
@@ -324,7 +325,8 @@ int bcmf_driver_download_clm(FAR struct bcmf_dev_s *priv)
|
|||||||
/* CLM header */
|
/* CLM header */
|
||||||
|
|
||||||
dlhead = (struct wl_dload_data *)downloadbuff;
|
dlhead = (struct wl_dload_data *)downloadbuff;
|
||||||
dlhead->flag = (DLOAD_HANDLER_VER << DLOAD_FLAG_VER_SHIFT) | dl_flag;
|
dlhead->flag = (DLOAD_HANDLER_VER << DLOAD_FLAG_VER_SHIFT) |
|
||||||
|
dl_flag;
|
||||||
dlhead->dload_type = DL_TYPE_CLM;
|
dlhead->dload_type = DL_TYPE_CLM;
|
||||||
dlhead->len = chunk_len;
|
dlhead->len = chunk_len;
|
||||||
dlhead->crc = 0;
|
dlhead->crc = 0;
|
||||||
@@ -389,7 +391,8 @@ int bcmf_driver_download_clm(FAR struct bcmf_dev_s *priv)
|
|||||||
uint32_t out_len;
|
uint32_t out_len;
|
||||||
|
|
||||||
chunk_len = datalen >= MAX_CHUNK_LEN ? MAX_CHUNK_LEN : datalen;
|
chunk_len = datalen >= MAX_CHUNK_LEN ? MAX_CHUNK_LEN : datalen;
|
||||||
memcpy(downloadbuff + sizeof(struct wl_dload_data), srcbuff, chunk_len);
|
memcpy(downloadbuff + sizeof(struct wl_dload_data), srcbuff,
|
||||||
|
chunk_len);
|
||||||
datalen -= chunk_len;
|
datalen -= chunk_len;
|
||||||
srcbuff += chunk_len;
|
srcbuff += chunk_len;
|
||||||
|
|
||||||
@@ -401,7 +404,8 @@ int bcmf_driver_download_clm(FAR struct bcmf_dev_s *priv)
|
|||||||
/* CLM header */
|
/* CLM header */
|
||||||
|
|
||||||
dlhead = (struct wl_dload_data *)downloadbuff;
|
dlhead = (struct wl_dload_data *)downloadbuff;
|
||||||
dlhead->flag = (DLOAD_HANDLER_VER << DLOAD_FLAG_VER_SHIFT) | dl_flag;
|
dlhead->flag = (DLOAD_HANDLER_VER << DLOAD_FLAG_VER_SHIFT) |
|
||||||
|
dl_flag;
|
||||||
dlhead->dload_type = DL_TYPE_CLM;
|
dlhead->dload_type = DL_TYPE_CLM;
|
||||||
dlhead->len = chunk_len;
|
dlhead->len = chunk_len;
|
||||||
dlhead->crc = 0;
|
dlhead->crc = 0;
|
||||||
@@ -537,16 +541,26 @@ int bcmf_driver_initialize(FAR struct bcmf_dev_s *priv)
|
|||||||
|
|
||||||
/* Register authentication related events */
|
/* Register authentication related events */
|
||||||
|
|
||||||
bcmf_event_register(priv, bcmf_wl_auth_event_handler, WLC_E_ASSOC_IND_NDIS);
|
bcmf_event_register(priv, bcmf_wl_auth_event_handler,
|
||||||
bcmf_event_register(priv, bcmf_wl_auth_event_handler, WLC_E_AUTH);
|
WLC_E_ASSOC_IND_NDIS);
|
||||||
bcmf_event_register(priv, bcmf_wl_auth_event_handler, WLC_E_ASSOC);
|
bcmf_event_register(priv, bcmf_wl_auth_event_handler,
|
||||||
bcmf_event_register(priv, bcmf_wl_auth_event_handler, WLC_E_LINK);
|
WLC_E_AUTH);
|
||||||
bcmf_event_register(priv, bcmf_wl_auth_event_handler, WLC_E_PSK_SUP);
|
bcmf_event_register(priv, bcmf_wl_auth_event_handler,
|
||||||
bcmf_event_register(priv, bcmf_wl_auth_event_handler, WLC_E_JOIN);
|
WLC_E_ASSOC);
|
||||||
bcmf_event_register(priv, bcmf_wl_auth_event_handler, WLC_E_SET_SSID);
|
bcmf_event_register(priv, bcmf_wl_auth_event_handler,
|
||||||
bcmf_event_register(priv, bcmf_wl_auth_event_handler, WLC_E_DEAUTH_IND);
|
WLC_E_LINK);
|
||||||
bcmf_event_register(priv, bcmf_wl_auth_event_handler, WLC_E_DISASSOC);
|
bcmf_event_register(priv, bcmf_wl_auth_event_handler,
|
||||||
bcmf_event_register(priv, bcmf_wl_auth_event_handler, WLC_E_DISASSOC_IND);
|
WLC_E_PSK_SUP);
|
||||||
|
bcmf_event_register(priv, bcmf_wl_auth_event_handler,
|
||||||
|
WLC_E_JOIN);
|
||||||
|
bcmf_event_register(priv, bcmf_wl_auth_event_handler,
|
||||||
|
WLC_E_SET_SSID);
|
||||||
|
bcmf_event_register(priv, bcmf_wl_auth_event_handler,
|
||||||
|
WLC_E_DEAUTH_IND);
|
||||||
|
bcmf_event_register(priv, bcmf_wl_auth_event_handler,
|
||||||
|
WLC_E_DISASSOC);
|
||||||
|
bcmf_event_register(priv, bcmf_wl_auth_event_handler,
|
||||||
|
WLC_E_DISASSOC_IND);
|
||||||
|
|
||||||
if (bcmf_event_push_config(priv))
|
if (bcmf_event_push_config(priv))
|
||||||
{
|
{
|
||||||
@@ -559,19 +573,22 @@ int bcmf_driver_initialize(FAR struct bcmf_dev_s *priv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void bcmf_wl_default_event_handler(FAR struct bcmf_dev_s *priv,
|
void bcmf_wl_default_event_handler(FAR struct bcmf_dev_s *priv,
|
||||||
struct bcmf_event_s *event, unsigned int len)
|
struct bcmf_event_s *event,
|
||||||
|
unsigned int len)
|
||||||
{
|
{
|
||||||
wlinfo("Got event %d from <%s>\n", bcmf_getle32(&event->type),
|
wlinfo("Got event %d from <%s>\n", bcmf_getle32(&event->type),
|
||||||
event->src_name);
|
event->src_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void bcmf_wl_radio_event_handler(FAR struct bcmf_dev_s *priv,
|
void bcmf_wl_radio_event_handler(FAR struct bcmf_dev_s *priv,
|
||||||
struct bcmf_event_s *event, unsigned int len)
|
struct bcmf_event_s *event,
|
||||||
|
unsigned int len)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void bcmf_wl_auth_event_handler(FAR struct bcmf_dev_s *priv,
|
void bcmf_wl_auth_event_handler(FAR struct bcmf_dev_s *priv,
|
||||||
struct bcmf_event_s *event, unsigned int len)
|
struct bcmf_event_s *event,
|
||||||
|
unsigned int len)
|
||||||
{
|
{
|
||||||
uint32_t type;
|
uint32_t type;
|
||||||
uint32_t status;
|
uint32_t status;
|
||||||
@@ -598,7 +615,8 @@ void bcmf_wl_auth_event_handler(FAR struct bcmf_dev_s *priv,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
void bcmf_wl_scan_event_handler(FAR struct bcmf_dev_s *priv,
|
void bcmf_wl_scan_event_handler(FAR struct bcmf_dev_s *priv,
|
||||||
struct bcmf_event_s *event, unsigned int len)
|
struct bcmf_event_s *event,
|
||||||
|
unsigned int len)
|
||||||
{
|
{
|
||||||
uint32_t status;
|
uint32_t status;
|
||||||
uint32_t event_len;
|
uint32_t event_len;
|
||||||
@@ -642,7 +660,8 @@ void bcmf_wl_scan_event_handler(FAR struct bcmf_dev_s *priv,
|
|||||||
|
|
||||||
result = (struct wl_escan_result *)&event[1];
|
result = (struct wl_escan_result *)&event[1];
|
||||||
|
|
||||||
if (len < result->buflen || result->buflen < sizeof(struct wl_escan_result))
|
if (len < result->buflen ||
|
||||||
|
result->buflen < sizeof(struct wl_escan_result))
|
||||||
{
|
{
|
||||||
goto exit_invalid_frame;
|
goto exit_invalid_frame;
|
||||||
}
|
}
|
||||||
@@ -690,7 +709,8 @@ void bcmf_wl_scan_event_handler(FAR struct bcmf_dev_s *priv,
|
|||||||
|
|
||||||
if (iwe->cmd == SIOCGIWAP)
|
if (iwe->cmd == SIOCGIWAP)
|
||||||
{
|
{
|
||||||
if (memcmp(&iwe->u.ap_addr.sa_data, bss->BSSID.ether_addr_octet,
|
if (memcmp(&iwe->u.ap_addr.sa_data,
|
||||||
|
bss->BSSID.ether_addr_octet,
|
||||||
sizeof(bss->BSSID.ether_addr_octet)) == 0)
|
sizeof(bss->BSSID.ether_addr_octet)) == 0)
|
||||||
{
|
{
|
||||||
goto process_next_bss;
|
goto process_next_bss;
|
||||||
@@ -700,10 +720,14 @@ void bcmf_wl_scan_event_handler(FAR struct bcmf_dev_s *priv,
|
|||||||
check_offset += iwe->len;
|
check_offset += iwe->len;
|
||||||
}
|
}
|
||||||
|
|
||||||
wlinfo("Scan result: <%.32s> %02x:%02x:%02x:%02x:%02x:%02x\n", bss->SSID,
|
wlinfo("Scan result: <%.32s> %02x:%02x:%02x:%02x:%02x:%02x\n",
|
||||||
bss->BSSID.ether_addr_octet[0], bss->BSSID.ether_addr_octet[1],
|
bss->SSID,
|
||||||
bss->BSSID.ether_addr_octet[2], bss->BSSID.ether_addr_octet[3],
|
bss->BSSID.ether_addr_octet[0],
|
||||||
bss->BSSID.ether_addr_octet[4], bss->BSSID.ether_addr_octet[5]);
|
bss->BSSID.ether_addr_octet[1],
|
||||||
|
bss->BSSID.ether_addr_octet[2],
|
||||||
|
bss->BSSID.ether_addr_octet[3],
|
||||||
|
bss->BSSID.ether_addr_octet[4],
|
||||||
|
bss->BSSID.ether_addr_octet[5]);
|
||||||
|
|
||||||
/* Copy BSSID */
|
/* Copy BSSID */
|
||||||
|
|
||||||
@@ -849,22 +873,28 @@ void bcmf_wl_scan_event_handler(FAR struct bcmf_dev_s *priv,
|
|||||||
ie_frame_size_aligned = (ie_frame_size + 3) & -4;
|
ie_frame_size_aligned = (ie_frame_size + 3) & -4;
|
||||||
|
|
||||||
wlinfo("found RSN\n");
|
wlinfo("found RSN\n");
|
||||||
if (result_size < BCMF_IW_EVENT_SIZE(data) + ie_frame_size_aligned)
|
|
||||||
|
if (result_size < BCMF_IW_EVENT_SIZE(data) +
|
||||||
|
ie_frame_size_aligned)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
iwe = (struct iw_event *)&priv->scan_result[priv->scan_result_size];
|
iwe = (struct iw_event *)
|
||||||
|
&priv->scan_result[priv->scan_result_size];
|
||||||
|
|
||||||
iwe->len = BCMF_IW_EVENT_SIZE(data)+ie_frame_size_aligned;
|
iwe->len = BCMF_IW_EVENT_SIZE(data)+ie_frame_size_aligned;
|
||||||
iwe->cmd = IWEVGENIE;
|
iwe->cmd = IWEVGENIE;
|
||||||
iwe->u.data.flags = 0;
|
iwe->u.data.flags = 0;
|
||||||
iwe->u.data.length = ie_frame_size;
|
iwe->u.data.length = ie_frame_size;
|
||||||
iwe->u.data.pointer = (FAR void *)sizeof(iwe->u.data);
|
iwe->u.data.pointer = (FAR void *)sizeof(iwe->u.data);
|
||||||
memcpy(&iwe->u.data + 1, &ie_buffer[ie_offset], ie_frame_size);
|
memcpy(&iwe->u.data + 1, &ie_buffer[ie_offset],
|
||||||
|
ie_frame_size);
|
||||||
|
|
||||||
priv->scan_result_size += BCMF_IW_EVENT_SIZE(essid) +
|
priv->scan_result_size += BCMF_IW_EVENT_SIZE(essid) +
|
||||||
ie_frame_size_aligned;
|
ie_frame_size_aligned;
|
||||||
result_size -= BCMF_IW_EVENT_SIZE(essid) + ie_frame_size_aligned;
|
result_size -= BCMF_IW_EVENT_SIZE(essid) +
|
||||||
|
ie_frame_size_aligned;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1302,7 +1332,8 @@ int bcmf_wl_set_auth_param(FAR struct bcmf_dev_s *priv, struct iwreq *iwr)
|
|||||||
|
|
||||||
out_len = 4;
|
out_len = 4;
|
||||||
if (bcmf_cdc_ioctl(priv, interface, true,
|
if (bcmf_cdc_ioctl(priv, interface, true,
|
||||||
WLC_SET_WSEC, (uint8_t *)&cipher_mode, &out_len))
|
WLC_SET_WSEC, (uint8_t *)&cipher_mode,
|
||||||
|
&out_len))
|
||||||
{
|
{
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
@@ -1311,7 +1342,8 @@ int bcmf_wl_set_auth_param(FAR struct bcmf_dev_s *priv, struct iwreq *iwr)
|
|||||||
|
|
||||||
out_len = 4;
|
out_len = 4;
|
||||||
if (bcmf_cdc_ioctl(priv, interface, true,
|
if (bcmf_cdc_ioctl(priv, interface, true,
|
||||||
WLC_SET_AUTH, (uint8_t *)&wep_auth, &out_len))
|
WLC_SET_AUTH, (uint8_t *)&wep_auth,
|
||||||
|
&out_len))
|
||||||
{
|
{
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -108,7 +108,8 @@ static int bcmf_chipinitialize(FAR struct bcmf_sdio_dev_s *sbus);
|
|||||||
|
|
||||||
static int bcmf_oob_irq(FAR void *arg);
|
static int bcmf_oob_irq(FAR void *arg);
|
||||||
|
|
||||||
static int bcmf_sdio_bus_sleep(FAR struct bcmf_sdio_dev_s *sbus, bool sleep);
|
static int bcmf_sdio_bus_sleep(FAR struct bcmf_sdio_dev_s *sbus,
|
||||||
|
bool sleep);
|
||||||
|
|
||||||
static void bcmf_sdio_waitdog_timeout(int argc, wdparm_t arg1, ...);
|
static void bcmf_sdio_waitdog_timeout(int argc, wdparm_t arg1, ...);
|
||||||
static int bcmf_sdio_thread(int argc, char **argv);
|
static int bcmf_sdio_thread(int argc, char **argv);
|
||||||
@@ -605,8 +606,8 @@ int bcmf_transfer_bytes(FAR struct bcmf_sdio_dev_s *sbus, bool write,
|
|||||||
nblocks = 0;
|
nblocks = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return sdio_io_rw_extended(sbus->sdio_dev, write,
|
return sdio_io_rw_extended(sbus->sdio_dev, write, function, address, true,
|
||||||
function, address, true, buf, blocklen, nblocks);
|
buf, blocklen, nblocks);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -876,15 +877,17 @@ int bcmf_sdio_thread(int argc, char **argv)
|
|||||||
|
|
||||||
sbus->irq_pending = false;
|
sbus->irq_pending = false;
|
||||||
|
|
||||||
bcmf_read_sbregw(sbus,
|
bcmf_read_sbregw(
|
||||||
CORE_BUS_REG(sbus->chip->core_base[SDIOD_CORE_ID],
|
sbus,
|
||||||
intstatus), &sbus->intstatus);
|
CORE_BUS_REG(sbus->chip->core_base[SDIOD_CORE_ID], intstatus),
|
||||||
|
&sbus->intstatus);
|
||||||
|
|
||||||
/* Clear interrupts */
|
/* Clear interrupts */
|
||||||
|
|
||||||
bcmf_write_sbregw(sbus,
|
bcmf_write_sbregw(
|
||||||
CORE_BUS_REG(sbus->chip->core_base[SDIOD_CORE_ID],
|
sbus,
|
||||||
intstatus), sbus->intstatus);
|
CORE_BUS_REG(sbus->chip->core_base[SDIOD_CORE_ID], intstatus),
|
||||||
|
sbus->intstatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* On frame indication, read available frames */
|
/* On frame indication, read available frames */
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -114,7 +114,9 @@
|
|||||||
# define XBEENET_FRAMELEN IEEE802154_MAX_PHY_PACKET_SIZE
|
# define XBEENET_FRAMELEN IEEE802154_MAX_PHY_PACKET_SIZE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* TX poll delay = 1 seconds. CLK_TCK is the number of clock ticks per second */
|
/* TX poll delay = 1 seconds. CLK_TCK is the number of clock ticks per
|
||||||
|
* second.
|
||||||
|
*/
|
||||||
|
|
||||||
#define TXPOLL_WDDELAY (1*CLK_TCK)
|
#define TXPOLL_WDDELAY (1*CLK_TCK)
|
||||||
|
|
||||||
@@ -128,7 +130,8 @@ struct xbeenet_callback_s
|
|||||||
{
|
{
|
||||||
/* This holds the information visible to the MAC layer */
|
/* This holds the information visible to the MAC layer */
|
||||||
|
|
||||||
struct xbee_maccb_s mc_cb; /* Interface understood by the MAC layer */
|
struct xbee_maccb_s mc_cb; /* Interface understood by the MAC
|
||||||
|
* layer */
|
||||||
FAR struct xbeenet_driver_s *mc_priv; /* Our priv data */
|
FAR struct xbeenet_driver_s *mc_priv; /* Our priv data */
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -251,8 +254,10 @@ static struct sixlowpan_reassbuf_s g_iobuffer;
|
|||||||
*
|
*
|
||||||
* 128 112 96 80 64 48 32 16
|
* 128 112 96 80 64 48 32 16
|
||||||
* ---- ---- ---- ---- ---- ---- ---- ----
|
* ---- ---- ---- ---- ---- ---- ---- ----
|
||||||
* fe80 0000 0000 0000 0000 00ff fe00 xxxx 2-byte short address IEEE 48-bit MAC
|
* fe80 0000 0000 0000 0000 00ff fe00 xxxx 2-byte short address IEEE
|
||||||
* fe80 0000 0000 0000 xxxx xxxx xxxx xxxx 8-byte extended address IEEE EUI-64
|
* 48-bit MAC
|
||||||
|
* fe80 0000 0000 0000 xxxx xxxx xxxx xxxx 8-byte extended address IEEE
|
||||||
|
* EUI-64
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
@@ -285,15 +290,20 @@ static int xbeenet_set_ipaddress(FAR struct net_driver_s *dev)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
IEEE802154_EADDRCOPY(dev->d_mac.radio.nv_addr, arg.getreq.attrval.mac.eaddr);
|
IEEE802154_EADDRCOPY(dev->d_mac.radio.nv_addr,
|
||||||
|
arg.getreq.attrval.mac.eaddr);
|
||||||
dev->d_mac.radio.nv_addrlen = IEEE802154_EADDRSIZE;
|
dev->d_mac.radio.nv_addrlen = IEEE802154_EADDRSIZE;
|
||||||
|
|
||||||
/* Set the IP address based on the eaddr */
|
/* Set the IP address based on the eaddr */
|
||||||
|
|
||||||
dev->d_ipv6addr[4] = HTONS((uint16_t)eaddr[0] << 8 | (uint16_t)eaddr[1]);
|
dev->d_ipv6addr[4] = HTONS((uint16_t)eaddr[0] << 8 |
|
||||||
dev->d_ipv6addr[5] = HTONS((uint16_t)eaddr[2] << 8 | (uint16_t)eaddr[3]);
|
(uint16_t)eaddr[1]);
|
||||||
dev->d_ipv6addr[6] = HTONS((uint16_t)eaddr[4] << 8 | (uint16_t)eaddr[5]);
|
dev->d_ipv6addr[5] = HTONS((uint16_t)eaddr[2] << 8 |
|
||||||
dev->d_ipv6addr[7] = HTONS((uint16_t)eaddr[6] << 8 | (uint16_t)eaddr[7]);
|
(uint16_t)eaddr[3]);
|
||||||
|
dev->d_ipv6addr[6] = HTONS((uint16_t)eaddr[4] << 8 |
|
||||||
|
(uint16_t)eaddr[5]);
|
||||||
|
dev->d_ipv6addr[7] = HTONS((uint16_t)eaddr[6] << 8 |
|
||||||
|
(uint16_t)eaddr[7]);
|
||||||
|
|
||||||
/* Invert the U/L bit */
|
/* Invert the U/L bit */
|
||||||
|
|
||||||
@@ -337,7 +347,8 @@ static int xbeenet_set_ipaddress(FAR struct net_driver_s *dev)
|
|||||||
dev->d_ipv6addr[4] = 0;
|
dev->d_ipv6addr[4] = 0;
|
||||||
dev->d_ipv6addr[5] = HTONS(0x00ff);
|
dev->d_ipv6addr[5] = HTONS(0x00ff);
|
||||||
dev->d_ipv6addr[6] = HTONS(0xfe00);
|
dev->d_ipv6addr[6] = HTONS(0xfe00);
|
||||||
dev->d_ipv6addr[7] = HTONS((uint16_t)saddr[0] << 8 | (uint16_t)saddr[1]);
|
dev->d_ipv6addr[7] = HTONS((uint16_t)saddr[0] << 8 |
|
||||||
|
(uint16_t)saddr[1]);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -352,8 +363,10 @@ static int xbeenet_set_ipaddress(FAR struct net_driver_s *dev)
|
|||||||
*
|
*
|
||||||
* 128 112 96 80 64 48 32 16
|
* 128 112 96 80 64 48 32 16
|
||||||
* ---- ---- ---- ---- ---- ---- ---- ----
|
* ---- ---- ---- ---- ---- ---- ---- ----
|
||||||
* fe80 0000 0000 0000 0000 00ff fe00 xxxx 2-byte short address IEEE 48-bit MAC
|
* fe80 0000 0000 0000 0000 00ff fe00 xxxx 2-byte short address IEEE
|
||||||
* fe80 0000 0000 0000 xxxx xxxx xxxx xxxx 8-byte extended address IEEE EUI-64
|
* 48-bit MAC
|
||||||
|
* fe80 0000 0000 0000 xxxx xxxx xxxx xxxx 8-byte extended address IEEE
|
||||||
|
* EUI-64
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
@@ -401,15 +414,16 @@ static int xbeenet_notify(FAR struct xbee_maccb_s *maccb,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* If there is a registered primitive receiver, queue the event and signal
|
/* If there is a registered primitive receiver, queue the event and signal
|
||||||
* the receiver. Events should be popped from the queue from the application
|
* the receiver. Events should be popped from the queue from the
|
||||||
* at a reasonable rate in order for the MAC layer to be able to allocate new
|
* application at a reasonable rate in order for the MAC layer to be able
|
||||||
* primitives.
|
* to allocate new primitives.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (priv->xd_enableevents)
|
if (priv->xd_enableevents)
|
||||||
{
|
{
|
||||||
/* Get exclusive access to the driver structure. We don't care about any
|
/* Get exclusive access to the driver structure. We don't care about
|
||||||
* signals so if we see one, just go back to trying to get access again
|
* any signals so if we see one, just go back to trying to get access
|
||||||
|
* again.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
while (nxsem_wait(&priv->xd_exclsem) < 0);
|
while (nxsem_wait(&priv->xd_exclsem) < 0);
|
||||||
@@ -437,8 +451,8 @@ static int xbeenet_notify(FAR struct xbee_maccb_s *maccb,
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* By returning a negative value, we let the MAC know that we don't want the
|
/* By returning a negative value, we let the MAC know that we don't want
|
||||||
* primitive and it will free it for us
|
* the primitive and it will free it for us
|
||||||
*/
|
*/
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
@@ -567,8 +581,8 @@ static int xbeenet_rxframe(FAR struct xbeenet_driver_s *priv,
|
|||||||
|
|
||||||
static int xbeenet_txpoll_callback(FAR struct net_driver_s *dev)
|
static int xbeenet_txpoll_callback(FAR struct net_driver_s *dev)
|
||||||
{
|
{
|
||||||
/* If zero is returned, the polling will continue until all connections have
|
/* If zero is returned, the polling will continue until all connections
|
||||||
* been examined.
|
* have been examined.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -796,7 +810,8 @@ static int xbeenet_ifup(FAR struct net_driver_s *dev)
|
|||||||
|
|
||||||
static int xbeenet_ifdown(FAR struct net_driver_s *dev)
|
static int xbeenet_ifdown(FAR struct net_driver_s *dev)
|
||||||
{
|
{
|
||||||
FAR struct xbeenet_driver_s *priv = (FAR struct xbeenet_driver_s *)dev->d_private;
|
FAR struct xbeenet_driver_s *priv =
|
||||||
|
(FAR struct xbeenet_driver_s *)dev->d_private;
|
||||||
irqstate_t flags;
|
irqstate_t flags;
|
||||||
|
|
||||||
/* Disable interruption */
|
/* Disable interruption */
|
||||||
@@ -807,9 +822,9 @@ static int xbeenet_ifdown(FAR struct net_driver_s *dev)
|
|||||||
|
|
||||||
wd_cancel(priv->xd_txpoll);
|
wd_cancel(priv->xd_txpoll);
|
||||||
|
|
||||||
/* TODO: Put the xbee driver in its reset, non-operational state. This should be
|
/* TODO: Put the xbee driver in its reset, non-operational state. This
|
||||||
* a known configuration that will guarantee the xbeenet_ifup() always
|
* should be a known configuration that will guarantee the xbeenet_ifup()
|
||||||
* successfully brings the interface back up.
|
* always successfully brings the interface back up.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Mark the device "down" */
|
/* Mark the device "down" */
|
||||||
@@ -889,7 +904,8 @@ static void xbeenet_txavail_work(FAR void *arg)
|
|||||||
|
|
||||||
static int xbeenet_txavail(FAR struct net_driver_s *dev)
|
static int xbeenet_txavail(FAR struct net_driver_s *dev)
|
||||||
{
|
{
|
||||||
FAR struct xbeenet_driver_s *priv = (FAR struct xbeenet_driver_s *)dev->d_private;
|
FAR struct xbeenet_driver_s *priv =
|
||||||
|
(FAR struct xbeenet_driver_s *)dev->d_private;
|
||||||
|
|
||||||
wlinfo("Available=%u\n", work_available(&priv->xd_pollwork));
|
wlinfo("Available=%u\n", work_available(&priv->xd_pollwork));
|
||||||
|
|
||||||
@@ -902,7 +918,8 @@ static int xbeenet_txavail(FAR struct net_driver_s *dev)
|
|||||||
{
|
{
|
||||||
/* Schedule to serialize the poll on the worker thread. */
|
/* Schedule to serialize the poll on the worker thread. */
|
||||||
|
|
||||||
work_queue(XBEENET_WORK, &priv->xd_pollwork, xbeenet_txavail_work, priv, 0);
|
work_queue(XBEENET_WORK, &priv->xd_pollwork, xbeenet_txavail_work,
|
||||||
|
priv, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
@@ -927,9 +944,11 @@ static int xbeenet_txavail(FAR struct net_driver_s *dev)
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_NET_MCASTGROUP
|
#ifdef CONFIG_NET_MCASTGROUP
|
||||||
static int xbeenet_addmac(FAR struct net_driver_s *dev, FAR const uint8_t *mac)
|
static int xbeenet_addmac(FAR struct net_driver_s *dev,
|
||||||
|
FAR const uint8_t *mac)
|
||||||
{
|
{
|
||||||
FAR struct xbeenet_driver_s *priv = (FAR struct xbeenet_driver_s *)dev->d_private;
|
FAR struct xbeenet_driver_s *priv =
|
||||||
|
(FAR struct xbeenet_driver_s *)dev->d_private;
|
||||||
|
|
||||||
/* Add the MAC address to the hardware multicast routing table. Not used
|
/* Add the MAC address to the hardware multicast routing table. Not used
|
||||||
* with IEEE 802.15.4 radios.
|
* with IEEE 802.15.4 radios.
|
||||||
@@ -943,8 +962,8 @@ static int xbeenet_addmac(FAR struct net_driver_s *dev, FAR const uint8_t *mac)
|
|||||||
* Name: xbeenet_rmmac
|
* Name: xbeenet_rmmac
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* NuttX Callback: Remove the specified MAC address from the hardware multicast
|
* NuttX Callback: Remove the specified MAC address from the hardware
|
||||||
* address filtering
|
* multicast address filtering
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* dev - Reference to the NuttX driver state structure
|
* dev - Reference to the NuttX driver state structure
|
||||||
@@ -958,12 +977,14 @@ static int xbeenet_addmac(FAR struct net_driver_s *dev, FAR const uint8_t *mac)
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_NET_MCASTGROUP
|
#ifdef CONFIG_NET_MCASTGROUP
|
||||||
static int xbeenet_rmmac(FAR struct net_driver_s *dev, FAR const uint8_t *mac)
|
static int xbeenet_rmmac(FAR struct net_driver_s *dev,
|
||||||
|
FAR const uint8_t *mac)
|
||||||
{
|
{
|
||||||
FAR struct xbeenet_driver_s *priv = (FAR struct xbeenet_driver_s *)dev->d_private;
|
FAR struct xbeenet_driver_s *priv =
|
||||||
|
(FAR struct xbeenet_driver_s *)dev->d_private;
|
||||||
|
|
||||||
/* Remove the MAC address from the hardware multicast routing table Not used
|
/* Remove the MAC address from the hardware multicast routing table. Not
|
||||||
* with IEEE 802.15.4 radios.
|
* used with IEEE 802.15.4 radios.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
return -ENOSYS;
|
return -ENOSYS;
|
||||||
@@ -992,7 +1013,8 @@ static int xbeenet_rmmac(FAR struct net_driver_s *dev, FAR const uint8_t *mac)
|
|||||||
static int xbeenet_ioctl(FAR struct net_driver_s *dev, int cmd,
|
static int xbeenet_ioctl(FAR struct net_driver_s *dev, int cmd,
|
||||||
unsigned long arg)
|
unsigned long arg)
|
||||||
{
|
{
|
||||||
FAR struct xbeenet_driver_s *priv = (FAR struct xbeenet_driver_s *)dev->d_private;
|
FAR struct xbeenet_driver_s *priv =
|
||||||
|
(FAR struct xbeenet_driver_s *)dev->d_private;
|
||||||
int ret = -EINVAL;
|
int ret = -EINVAL;
|
||||||
|
|
||||||
ret = nxsem_wait(&priv->xd_exclsem);
|
ret = nxsem_wait(&priv->xd_exclsem);
|
||||||
@@ -1016,12 +1038,13 @@ static int xbeenet_ioctl(FAR struct net_driver_s *dev, int cmd,
|
|||||||
switch (cmd)
|
switch (cmd)
|
||||||
{
|
{
|
||||||
/* Command: MAC802154IOC_NOTIFY_REGISTER
|
/* Command: MAC802154IOC_NOTIFY_REGISTER
|
||||||
* Description: Register to receive a signal whenever there is a
|
* Description: Register to receive a signal whenever there is
|
||||||
* event primitive sent from the MAC layer.
|
* an event primitive sent from the MAC layer.
|
||||||
* Argument: A read-only pointer to an instance of struct
|
* Argument: A read-only pointer to an instance of struct
|
||||||
* xbeenet_notify_s
|
* xbeenet_notify_s
|
||||||
* Return: Zero (OK) on success. Minus one will be returned on
|
* Return: Zero (OK) on success. Minus one will be
|
||||||
* failure with the errno value set appropriately.
|
* returned on failure with the errno value set
|
||||||
|
* appropriately.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
case MAC802154IOC_NOTIFY_REGISTER:
|
case MAC802154IOC_NOTIFY_REGISTER:
|
||||||
@@ -1046,8 +1069,8 @@ static int xbeenet_ioctl(FAR struct net_driver_s *dev, int cmd,
|
|||||||
primitive = (FAR struct ieee802154_primitive_s *)
|
primitive = (FAR struct ieee802154_primitive_s *)
|
||||||
sq_remfirst(&priv->primitive_queue);
|
sq_remfirst(&priv->primitive_queue);
|
||||||
|
|
||||||
/* If there was an event to pop off, copy it into the user
|
/* If there was an event to pop off, copy it into the
|
||||||
* data and free it from the MAC layer's memory.
|
* user data and free it from the MAC layer's memory.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (primitive != NULL)
|
if (primitive != NULL)
|
||||||
@@ -1082,8 +1105,8 @@ static int xbeenet_ioctl(FAR struct net_driver_s *dev, int cmd,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get exclusive access again, then loop back around and try and
|
/* Get exclusive access again, then loop back around
|
||||||
* pop an event off the queue
|
* and try and pop an event off the queue
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ret = nxsem_wait(&priv->xd_exclsem);
|
ret = nxsem_wait(&priv->xd_exclsem);
|
||||||
@@ -1352,12 +1375,12 @@ int xbee_netdev_register(XBEEHANDLE xbee)
|
|||||||
#ifdef CONFIG_NETDEV_IOCTL
|
#ifdef CONFIG_NETDEV_IOCTL
|
||||||
dev->d_ioctl = xbeenet_ioctl; /* Handle network IOCTL commands */
|
dev->d_ioctl = xbeenet_ioctl; /* Handle network IOCTL commands */
|
||||||
#endif
|
#endif
|
||||||
dev->d_private = (FAR void *)priv; /* Used to recover private state from dev */
|
dev->d_private = (FAR void *)priv; /* Used to recover private state from dev */
|
||||||
|
|
||||||
/* Create a watchdog for timing polling for and timing of transmissions */
|
/* Create a watchdog for timing polling for and timing of transmissions */
|
||||||
|
|
||||||
priv->xd_mac = xbee; /* Save the MAC interface instance */
|
priv->xd_mac = xbee; /* Save the MAC interface instance */
|
||||||
priv->xd_txpoll = wd_create(); /* Create periodic poll timer */
|
priv->xd_txpoll = wd_create(); /* Create periodic poll timer */
|
||||||
|
|
||||||
/* Setup a locking semaphore for exclusive device driver access */
|
/* Setup a locking semaphore for exclusive device driver access */
|
||||||
|
|
||||||
@@ -1417,9 +1440,9 @@ int xbee_netdev_register(XBEEHANDLE xbee)
|
|||||||
xbeenet_ifdown(dev);
|
xbeenet_ifdown(dev);
|
||||||
|
|
||||||
#ifdef CONFIG_NET_6LOWPAN
|
#ifdef CONFIG_NET_6LOWPAN
|
||||||
/* Make sure the our single packet buffer is attached. We must do this before
|
/* Make sure the our single packet buffer is attached. We must do this
|
||||||
* registering the device since, once the device is registered, a packet may
|
* before registering the device since, once the device is registered, a
|
||||||
* be attempted to be forwarded and require the buffer.
|
* packet may be attempted to be forwarded and require the buffer.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
priv->xd_dev.r_dev.d_buf = g_iobuffer.rb_buf;
|
priv->xd_dev.r_dev.d_buf = g_iobuffer.rb_buf;
|
||||||
|
|||||||
@@ -280,8 +280,9 @@ static void hostfs_rpmsg_device_destroy(FAR struct rpmsg_device *rdev,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int hostfs_rpmsg_ept_cb(FAR struct rpmsg_endpoint *ept, FAR void *data,
|
static int hostfs_rpmsg_ept_cb(FAR struct rpmsg_endpoint *ept,
|
||||||
size_t len, uint32_t src, FAR void *priv)
|
FAR void *data, size_t len, uint32_t src,
|
||||||
|
FAR void *priv)
|
||||||
{
|
{
|
||||||
FAR struct hostfs_rpmsg_header_s *header = data;
|
FAR struct hostfs_rpmsg_header_s *header = data;
|
||||||
uint32_t command = header->command;
|
uint32_t command = header->command;
|
||||||
@@ -441,7 +442,8 @@ ssize_t host_write(int fd, FAR const void *buf, size_t count)
|
|||||||
memcpy(msg->buf, buf + written, space);
|
memcpy(msg->buf, buf + written, space);
|
||||||
|
|
||||||
ret = hostfs_rpmsg_send_recv(HOSTFS_RPMSG_WRITE, false,
|
ret = hostfs_rpmsg_send_recv(HOSTFS_RPMSG_WRITE, false,
|
||||||
(struct hostfs_rpmsg_header_s *)msg, sizeof(*msg) + space, NULL);
|
(FAR struct hostfs_rpmsg_header_s *)msg,
|
||||||
|
sizeof(*msg) + space, NULL);
|
||||||
if (ret <= 0)
|
if (ret <= 0)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -1,35 +1,20 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* nuttx/graphics/nxterm/nxterm_register.c
|
* nuttx/graphics/nxterm/nxterm_register.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2012, 2016-2017 Gregory Nutt. All rights reserved.
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
*
|
*
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
* notice, this list of conditions and the following disclaimer in
|
* License for the specific language governing permissions and limitations
|
||||||
* the documentation and/or other materials provided with the
|
* under the License.
|
||||||
* 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.
|
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
@@ -74,7 +59,8 @@ FAR struct nxterm_state_s *
|
|||||||
|
|
||||||
/* Allocate the driver structure */
|
/* Allocate the driver structure */
|
||||||
|
|
||||||
priv = (FAR struct nxterm_state_s *)kmm_zalloc(sizeof(struct nxterm_state_s));
|
priv = (FAR struct nxterm_state_s *)
|
||||||
|
kmm_zalloc(sizeof(struct nxterm_state_s));
|
||||||
if (!priv)
|
if (!priv)
|
||||||
{
|
{
|
||||||
gerr("ERROR: Failed to allocate the NX driver structure\n");
|
gerr("ERROR: Failed to allocate the NX driver structure\n");
|
||||||
|
|||||||
@@ -123,9 +123,10 @@ static inline int nxmutex_destroy(FAR mutex_t *mutex)
|
|||||||
* Name: nxmutex_lock
|
* Name: nxmutex_lock
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This function attempts to lock the mutex referenced by 'mutex'. The mutex
|
* This function attempts to lock the mutex referenced by 'mutex'. The
|
||||||
* is implemented with a semaphore, so if the semaphore value is (<=) zero,
|
* mutex is implemented with a semaphore, so if the semaphore value is
|
||||||
* then the calling task will not return until it successfully acquires the lock.
|
* (<=) zero, then the calling task will not return until it successfully
|
||||||
|
* acquires the lock.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* mutex - mutex descriptor.
|
* mutex - mutex descriptor.
|
||||||
|
|||||||
+14
-29
@@ -1,35 +1,20 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* net/arp/arp_send.c
|
* net/arp/arp_send.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2014-2016 Gregory Nutt. All rights reserved.
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
*
|
*
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
* notice, this list of conditions and the following disclaimer in
|
* License for the specific language governing permissions and limitations
|
||||||
* the documentation and/or other materials provided with the
|
* under the License.
|
||||||
* 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.
|
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
@@ -205,8 +190,8 @@ int arp_send(in_addr_t ipaddr)
|
|||||||
#ifdef CONFIG_NET_IGMP
|
#ifdef CONFIG_NET_IGMP
|
||||||
/* Check if the destination address is a multicast address
|
/* Check if the destination address is a multicast address
|
||||||
*
|
*
|
||||||
* - IPv4: multicast addresses lie in the class D group -- The address range
|
* - IPv4: multicast addresses lie in the class D group -- The address
|
||||||
* 224.0.0.0 to 239.255.255.255 (224.0.0.0/4)
|
* range 224.0.0.0 to 239.255.255.255 (224.0.0.0/4)
|
||||||
*
|
*
|
||||||
* - IPv6 multicast addresses are have the high-order octet of the
|
* - IPv6 multicast addresses are have the high-order octet of the
|
||||||
* addresses=0xff (ff00::/8.)
|
* addresses=0xff (ff00::/8.)
|
||||||
|
|||||||
@@ -1,35 +1,20 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* net/socket/bluetooth_recvfrom.c
|
* net/socket/bluetooth_recvfrom.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2018 Gregory Nutt. All rights reserved.
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
*
|
*
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
* notice, this list of conditions and the following disclaimer in
|
* License for the specific language governing permissions and limitations
|
||||||
* the documentation and/or other materials provided with the
|
* under the License.
|
||||||
* 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.
|
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
@@ -129,8 +114,9 @@ static int bluetooth_count_frames(FAR struct bluetooth_conn_s *conn)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static ssize_t bluetooth_recvfrom_rxqueue(FAR struct radio_driver_s *radio,
|
static ssize_t
|
||||||
FAR struct bluetooth_recvfrom_s *pstate)
|
bluetooth_recvfrom_rxqueue(FAR struct radio_driver_s *radio,
|
||||||
|
FAR struct bluetooth_recvfrom_s *pstate)
|
||||||
{
|
{
|
||||||
FAR struct bluetooth_container_s *container;
|
FAR struct bluetooth_container_s *container;
|
||||||
FAR struct sockaddr_bt_s *iaddr;
|
FAR struct sockaddr_bt_s *iaddr;
|
||||||
@@ -290,9 +276,9 @@ static uint16_t bluetooth_recvfrom_eventhandler(FAR struct net_driver_s *dev,
|
|||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Implements the socket recvfrom interface for the case of the AF_INET
|
* Implements the socket recvfrom interface for the case of the AF_INET
|
||||||
* and AF_INET6 address families. bluetooth_recvfrom() receives messages from
|
* and AF_INET6 address families. bluetooth_recvfrom() receives messages
|
||||||
* a socket, and may be used to receive data on a socket whether or not it
|
* from a socket, and may be used to receive data on a socket whether or
|
||||||
* is connection-oriented.
|
* not it is connection-oriented.
|
||||||
*
|
*
|
||||||
* If 'from' is not NULL, and the underlying protocol provides the source
|
* If 'from' is not NULL, and the underlying protocol provides the source
|
||||||
* address, this source address is filled in. The argument 'fromlen' is
|
* address, this source address is filled in. The argument 'fromlen' is
|
||||||
@@ -323,7 +309,8 @@ ssize_t bluetooth_recvfrom(FAR struct socket *psock, FAR void *buf,
|
|||||||
size_t len, int flags, FAR struct sockaddr *from,
|
size_t len, int flags, FAR struct sockaddr *from,
|
||||||
FAR socklen_t *fromlen)
|
FAR socklen_t *fromlen)
|
||||||
{
|
{
|
||||||
FAR struct bluetooth_conn_s *conn = (FAR struct bluetooth_conn_s *)psock->s_conn;
|
FAR struct bluetooth_conn_s *conn =
|
||||||
|
(FAR struct bluetooth_conn_s *)psock->s_conn;
|
||||||
FAR struct radio_driver_s *radio;
|
FAR struct radio_driver_s *radio;
|
||||||
struct bluetooth_recvfrom_s state;
|
struct bluetooth_recvfrom_s state;
|
||||||
ssize_t ret;
|
ssize_t ret;
|
||||||
|
|||||||
@@ -1,35 +1,20 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* net/bluetooth/bluetooth_sendto.c
|
* net/bluetooth/bluetooth_sendto.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2018 Gregory Nutt. All rights reserved.
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
*
|
*
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
* notice, this list of conditions and the following disclaimer in
|
* License for the specific language governing permissions and limitations
|
||||||
* the documentation and/or other materials provided with the
|
* under the License.
|
||||||
* 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.
|
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
@@ -246,8 +231,9 @@ errout:
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
ssize_t psock_bluetooth_sendto(FAR struct socket *psock, FAR const void *buf,
|
ssize_t psock_bluetooth_sendto(FAR struct socket *psock, FAR const void *buf,
|
||||||
size_t len, int flags,
|
size_t len, int flags,
|
||||||
FAR const struct sockaddr *to, socklen_t tolen)
|
FAR const struct sockaddr *to,
|
||||||
|
socklen_t tolen)
|
||||||
{
|
{
|
||||||
FAR struct sockaddr_bt_s *destaddr;
|
FAR struct sockaddr_bt_s *destaddr;
|
||||||
FAR struct radio_driver_s *radio;
|
FAR struct radio_driver_s *radio;
|
||||||
@@ -349,8 +335,9 @@ ssize_t psock_bluetooth_sendto(FAR struct socket *psock, FAR const void *buf,
|
|||||||
return state.is_sent;
|
return state.is_sent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If net_lockedwait failed, then we were probably reawakened by a signal. In
|
/* If net_lockedwait failed, then we were probably reawakened by a signal.
|
||||||
* this case, net_lockedwait will have returned negated errno appropriately.
|
* In this case, net_lockedwait will have returned negated errno
|
||||||
|
* appropriately.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
|
|||||||
+24
-35
@@ -1,35 +1,20 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* net/icmp/icmp_recvfrom.c
|
* net/icmp/icmp_recvfrom.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2017, 2019 Gregory Nutt. All rights reserved.
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
*
|
*
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
* notice, this list of conditions and the following disclaimer in
|
* License for the specific language governing permissions and limitations
|
||||||
* the documentation and/or other materials provided with the
|
* under the License.
|
||||||
* 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.
|
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
@@ -69,13 +54,15 @@
|
|||||||
struct icmp_recvfrom_s
|
struct icmp_recvfrom_s
|
||||||
{
|
{
|
||||||
FAR struct devif_callback_s *recv_cb; /* Reference to callback instance */
|
FAR struct devif_callback_s *recv_cb; /* Reference to callback instance */
|
||||||
FAR struct socket *recv_sock; /* IPPROTO_ICMP socket structure */
|
FAR struct socket *recv_sock; /* IPPROTO_ICMP socket structure */
|
||||||
sem_t recv_sem; /* Use to manage the wait for the response */
|
sem_t recv_sem; /* Use to manage the wait for the
|
||||||
in_addr_t recv_from; /* The peer we received the request from */
|
* response */
|
||||||
FAR uint8_t *recv_buf; /* Location to return the response */
|
in_addr_t recv_from; /* The peer we received the request
|
||||||
uint16_t recv_buflen; /* Size of the response */
|
* from */
|
||||||
int16_t recv_result; /* >=0: receive size on success;
|
FAR uint8_t *recv_buf; /* Location to return the response */
|
||||||
* <0: negated errno on fail */
|
uint16_t recv_buflen; /* Size of the response */
|
||||||
|
int16_t recv_result; /* >=0: receive size on success;
|
||||||
|
* <0: negated errno on fail */
|
||||||
};
|
};
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -248,7 +235,9 @@ static inline ssize_t icmp_readahead(FAR struct icmp_conn_s *conn,
|
|||||||
ssize_t ret = -ENODATA;
|
ssize_t ret = -ENODATA;
|
||||||
int recvlen;
|
int recvlen;
|
||||||
|
|
||||||
/* Check there is any ICMP replies already buffered in a read-ahead buffer. */
|
/* Check there is any ICMP replies already buffered in a read-ahead
|
||||||
|
* buffer.
|
||||||
|
*/
|
||||||
|
|
||||||
if ((iob = iob_peek_queue(&conn->readahead)) != NULL)
|
if ((iob = iob_peek_queue(&conn->readahead)) != NULL)
|
||||||
{
|
{
|
||||||
|
|||||||
+35
-43
@@ -1,35 +1,20 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* net/icmp/icmp_sendto.c
|
* net/icmp/icmp_sendto.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2017, 2019-2020 Gregory Nutt. All rights reserved.
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
*
|
*
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
* notice, this list of conditions and the following disclaimer in
|
* License for the specific language governing permissions and limitations
|
||||||
* the documentation and/or other materials provided with the
|
* under the License.
|
||||||
* 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.
|
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
@@ -86,11 +71,14 @@
|
|||||||
struct icmp_sendto_s
|
struct icmp_sendto_s
|
||||||
{
|
{
|
||||||
FAR struct devif_callback_s *snd_cb; /* Reference to callback instance */
|
FAR struct devif_callback_s *snd_cb; /* Reference to callback instance */
|
||||||
sem_t snd_sem; /* Use to manage the wait for send complete */
|
sem_t snd_sem; /* Use to manage the wait for send
|
||||||
in_addr_t snd_toaddr; /* The peer to send the request to */
|
* complete */
|
||||||
FAR const uint8_t *snd_buf; /* ICMP header + data payload */
|
in_addr_t snd_toaddr; /* The peer to send the request to */
|
||||||
uint16_t snd_buflen; /* Size of the ICMP header + data payload */
|
FAR const uint8_t *snd_buf; /* ICMP header + data payload */
|
||||||
int16_t snd_result; /* 0: success; <0:negated errno on fail */
|
uint16_t snd_buflen; /* Size of the ICMP header + data
|
||||||
|
* payload */
|
||||||
|
int16_t snd_result; /* 0: success; <0:negated errno on
|
||||||
|
* fail */
|
||||||
};
|
};
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -295,8 +283,9 @@ end_wait:
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
ssize_t icmp_sendto(FAR struct socket *psock, FAR const void *buf, size_t len,
|
ssize_t icmp_sendto(FAR struct socket *psock, FAR const void *buf,
|
||||||
int flags, FAR const struct sockaddr *to, socklen_t tolen)
|
size_t len, int flags, FAR const struct sockaddr *to,
|
||||||
|
socklen_t tolen)
|
||||||
{
|
{
|
||||||
FAR const struct sockaddr_in *inaddr;
|
FAR const struct sockaddr_in *inaddr;
|
||||||
FAR struct net_driver_s *dev;
|
FAR struct net_driver_s *dev;
|
||||||
@@ -367,10 +356,12 @@ ssize_t icmp_sendto(FAR struct socket *psock, FAR const void *buf, size_t len,
|
|||||||
nxsem_init(&state.snd_sem, 0, 0);
|
nxsem_init(&state.snd_sem, 0, 0);
|
||||||
nxsem_set_protocol(&state.snd_sem, SEM_PRIO_NONE);
|
nxsem_set_protocol(&state.snd_sem, SEM_PRIO_NONE);
|
||||||
|
|
||||||
state.snd_result = -ENOMEM; /* Assume allocation failure */
|
state.snd_result = -ENOMEM; /* Assume allocation failure */
|
||||||
state.snd_toaddr = inaddr->sin_addr.s_addr; /* Address of the peer to send the request */
|
state.snd_toaddr = inaddr->sin_addr.s_addr; /* Address of the peer to send
|
||||||
state.snd_buf = buf; /* ICMP header + data payload */
|
* the request */
|
||||||
state.snd_buflen = len; /* Size of the ICMP header + data payload */
|
state.snd_buf = buf; /* ICMP header + data payload */
|
||||||
|
state.snd_buflen = len; /* Size of the ICMP header +
|
||||||
|
* data payload */
|
||||||
|
|
||||||
net_lock();
|
net_lock();
|
||||||
|
|
||||||
@@ -406,16 +397,17 @@ ssize_t icmp_sendto(FAR struct socket *psock, FAR const void *buf, size_t len,
|
|||||||
{
|
{
|
||||||
if (ret == -ETIMEDOUT)
|
if (ret == -ETIMEDOUT)
|
||||||
{
|
{
|
||||||
/* Check if this device is on the same network as the destination
|
/* Check if this device is on the same network as the
|
||||||
* device.
|
* destination device.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!net_ipv4addr_maskcmp(state.snd_toaddr, dev->d_ipaddr,
|
if (!net_ipv4addr_maskcmp(state.snd_toaddr, dev->d_ipaddr,
|
||||||
dev->d_netmask))
|
dev->d_netmask))
|
||||||
{
|
{
|
||||||
/* Destination address was not on the local network served by
|
/* Destination address was not on the local network served
|
||||||
* this device. If a timeout occurs, then the most likely
|
* by this device. If a timeout occurs, then the most
|
||||||
* reason is that the destination address is not reachable.
|
* likely reason is that the destination address is not
|
||||||
|
* reachable.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ret = -ENETUNREACH;
|
ret = -ENETUNREACH;
|
||||||
|
|||||||
@@ -1,35 +1,20 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* net/icmpv6/icmpv6_autoconfig.c
|
* net/icmpv6/icmpv6_autoconfig.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015-2016, 2018-2020 Gregory Nutt. All rights reserved.
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
*
|
*
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
* notice, this list of conditions and the following disclaimer in
|
* License for the specific language governing permissions and limitations
|
||||||
* the documentation and/or other materials provided with the
|
* under the License.
|
||||||
* 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.
|
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
@@ -123,9 +108,9 @@ static uint16_t icmpv6_router_eventhandler(FAR struct net_driver_s *dev,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Check if the outgoing packet is available. It may have been claimed
|
/* Check if the outgoing packet is available. It may have been claimed
|
||||||
* by a send event handler serving a different thread -OR- if the output
|
* by a send event handler serving a different thread -OR- if the
|
||||||
* buffer currently contains unprocessed incoming data. In these cases
|
* output buffer currently contains unprocessed incoming data. In
|
||||||
* we will just have to wait for the next polling cycle.
|
* these cases we will just have to wait for the next polling cycle.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
else if (dev->d_sndlen > 0 || (flags & ICMPv6_NEWDATA) != 0)
|
else if (dev->d_sndlen > 0 || (flags & ICMPv6_NEWDATA) != 0)
|
||||||
@@ -326,20 +311,22 @@ int icmpv6_autoconfig(FAR struct net_driver_s *dev)
|
|||||||
icmpv6_linkipaddr(dev, lladdr);
|
icmpv6_linkipaddr(dev, lladdr);
|
||||||
|
|
||||||
ninfo("lladdr=%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n",
|
ninfo("lladdr=%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n",
|
||||||
ntohs(lladdr[0]), ntohs(lladdr[1]), ntohs(lladdr[2]), ntohs(lladdr[3]),
|
ntohs(lladdr[0]), ntohs(lladdr[1]),
|
||||||
ntohs(lladdr[4]), ntohs(lladdr[5]), ntohs(lladdr[6]), ntohs(lladdr[7]));
|
ntohs(lladdr[2]), ntohs(lladdr[3]),
|
||||||
|
ntohs(lladdr[4]), ntohs(lladdr[5]),
|
||||||
|
ntohs(lladdr[6]), ntohs(lladdr[7]));
|
||||||
|
|
||||||
#ifdef CONFIG_NET_ICMPv6_NEIGHBOR
|
#ifdef CONFIG_NET_ICMPv6_NEIGHBOR
|
||||||
/* 2. Link-Local Address Uniqueness Test: The node tests to ensure that
|
/* 2. Link-Local Address Uniqueness Test: The node tests to ensure that
|
||||||
* the address it generated isn't for some reason already in use on the
|
* the address it generated isn't for some reason already in use on the
|
||||||
* local network. (This is very unlikely to be an issue if the link-local
|
* local network. (This is very unlikely to be an issue if the link-
|
||||||
* address came from a MAC address but more likely if it was based on a
|
* local address came from a MAC address but more likely if it was
|
||||||
* generated token.) It sends a Neighbor Solicitation message using the
|
* based on a generated token.) It sends a Neighbor Solicitation
|
||||||
* Neighbor Discovery (ND) protocol. It then listens for a Neighbor
|
* message using the Neighbor Discovery (ND) protocol. It then listens
|
||||||
* Advertisement in response that indicates that another device is
|
* for a Neighbor Advertisement in response that indicates that another
|
||||||
* already using its link-local address; if so, either a new address
|
* device is already using its link-local address; if so, either a new
|
||||||
* must be generated, or auto-configuration fails and another method
|
* address must be generated, or auto-configuration fails and another
|
||||||
* must be employed.
|
* method must be employed.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ret = icmpv6_neighbor(lladdr);
|
ret = icmpv6_neighbor(lladdr);
|
||||||
@@ -409,7 +396,8 @@ int icmpv6_autoconfig(FAR struct net_driver_s *dev)
|
|||||||
{
|
{
|
||||||
int senderr;
|
int senderr;
|
||||||
|
|
||||||
nerr("ERROR: Failed to get the router advertisement: %d (retries=%d)\n",
|
nerr("ERROR: Failed to get the router advertisement: "
|
||||||
|
"%d (retries=%d)\n",
|
||||||
ret, retries);
|
ret, retries);
|
||||||
|
|
||||||
/* Claim the link local address as ours by sending the ICMPv6 Neighbor
|
/* Claim the link local address as ours by sending the ICMPv6 Neighbor
|
||||||
@@ -431,11 +419,11 @@ int icmpv6_autoconfig(FAR struct net_driver_s *dev)
|
|||||||
net_ipv6addr_copy(dev->d_ipv6netmask, g_ipv6_llnetmask);
|
net_ipv6addr_copy(dev->d_ipv6netmask, g_ipv6_llnetmask);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 5. Router Direction: The router provides direction to the node on how to
|
/* 5. Router Direction: The router provides direction to the node on how
|
||||||
* proceed with the auto-configuration. It may tell the node that on this
|
* to proceed with the auto-configuration. It may tell the node that on
|
||||||
* network "stateful" auto-configuration is in use, and tell it the
|
* this network "stateful" auto-configuration is in use, and tell it
|
||||||
* address of a DHCP server to use. Alternately, it will tell the host
|
* the address of a DHCP server to use. Alternately, it will tell the
|
||||||
* how to determine its global Internet address.
|
* host how to determine its global Internet address.
|
||||||
*
|
*
|
||||||
* 6. Global Address Configuration: Assuming that stateless auto-
|
* 6. Global Address Configuration: Assuming that stateless auto-
|
||||||
* configuration is in use on the network, the host will configure
|
* configuration is in use on the network, the host will configure
|
||||||
|
|||||||
@@ -1,35 +1,20 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* net/icmpv6/icmpv6_neighbor.c
|
* net/icmpv6/icmpv6_neighbor.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015-2016, 2019 Gregory Nutt. All rights reserved.
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
*
|
*
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
* notice, this list of conditions and the following disclaimer in
|
* License for the specific language governing permissions and limitations
|
||||||
* the documentation and/or other materials provided with the
|
* under the License.
|
||||||
* 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.
|
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
@@ -108,9 +93,9 @@ static uint16_t icmpv6_neighbor_eventhandler(FAR struct net_driver_s *dev,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Check if the outgoing packet is available. It may have been claimed
|
/* Check if the outgoing packet is available. It may have been claimed
|
||||||
* by a send event handler serving a different thread -OR- if the output
|
* by a send event handler serving a different thread -OR- if the
|
||||||
* buffer currently contains unprocessed incoming data. In these cases
|
* output buffer currently contains unprocessed incoming data. In
|
||||||
* we will just have to wait for the next polling cycle.
|
* these cases we will just have to wait for the next polling cycle.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (dev->d_sndlen > 0 || (flags & ICMPv6_NEWDATA) != 0)
|
if (dev->d_sndlen > 0 || (flags & ICMPv6_NEWDATA) != 0)
|
||||||
@@ -174,7 +159,8 @@ static uint16_t icmpv6_neighbor_eventhandler(FAR struct net_driver_s *dev,
|
|||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* Zero (OK) is returned on success and the IP address mapping can now be
|
* Zero (OK) is returned on success and the IP address mapping can now be
|
||||||
* found in the Neighbor Table. On error a negated errno value is returned:
|
* found in the Neighbor Table. On error a negated errno value is
|
||||||
|
* returned:
|
||||||
*
|
*
|
||||||
* -ETIMEDOUT: The number or retry counts has been exceed.
|
* -ETIMEDOUT: The number or retry counts has been exceed.
|
||||||
* -EHOSTUNREACH: Could not find a route to the host
|
* -EHOSTUNREACH: Could not find a route to the host
|
||||||
@@ -290,8 +276,8 @@ int icmpv6_neighbor(const net_ipv6addr_t ipaddr)
|
|||||||
/* Check if the address mapping is present in the Neighbor Table. This
|
/* Check if the address mapping is present in the Neighbor Table. This
|
||||||
* is only really meaningful on the first time through the loop.
|
* is only really meaningful on the first time through the loop.
|
||||||
*
|
*
|
||||||
* NOTE: If the Neighbor Table is large than this could be a performance
|
* NOTE: If the Neighbor Table is large than this could be a
|
||||||
* issue.
|
* performance issue.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (neighbor_lookup(lookup, NULL) >= 0)
|
if (neighbor_lookup(lookup, NULL) >= 0)
|
||||||
@@ -329,7 +315,9 @@ int icmpv6_neighbor(const net_ipv6addr_t ipaddr)
|
|||||||
}
|
}
|
||||||
while (!state.snd_sent);
|
while (!state.snd_sent);
|
||||||
|
|
||||||
/* Now wait for response to the Neighbor Advertisement to be received. */
|
/* Now wait for response to the Neighbor Advertisement to be
|
||||||
|
* received.
|
||||||
|
*/
|
||||||
|
|
||||||
ret = icmpv6_wait(¬ify, CONFIG_ICMPv6_NEIGHBOR_DELAYMSEC);
|
ret = icmpv6_wait(¬ify, CONFIG_ICMPv6_NEIGHBOR_DELAYMSEC);
|
||||||
|
|
||||||
|
|||||||
@@ -1,35 +1,20 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* net/icmpv6/icmpv6_recvfrom.c
|
* net/icmpv6/icmpv6_recvfrom.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2017, 2019 Gregory Nutt. All rights reserved.
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
*
|
*
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
* notice, this list of conditions and the following disclaimer in
|
* License for the specific language governing permissions and limitations
|
||||||
* the documentation and/or other materials provided with the
|
* under the License.
|
||||||
* 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.
|
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
@@ -72,13 +57,15 @@
|
|||||||
struct icmpv6_recvfrom_s
|
struct icmpv6_recvfrom_s
|
||||||
{
|
{
|
||||||
FAR struct devif_callback_s *recv_cb; /* Reference to callback instance */
|
FAR struct devif_callback_s *recv_cb; /* Reference to callback instance */
|
||||||
FAR struct socket *recv_sock; /* IPPROTO_ICMP6 socket structure */
|
FAR struct socket *recv_sock; /* IPPROTO_ICMP6 socket structure */
|
||||||
sem_t recv_sem; /* Use to manage the wait for the response */
|
sem_t recv_sem; /* Use to manage the wait for the
|
||||||
struct in6_addr recv_from; /* The peer we received the request from */
|
* response */
|
||||||
FAR uint8_t *recv_buf; /* Location to return the response */
|
struct in6_addr recv_from; /* The peer we received the request
|
||||||
uint16_t recv_buflen; /* Size of the response */
|
* from */
|
||||||
int16_t recv_result; /* >=0: receive size on success;
|
FAR uint8_t *recv_buf; /* Location to return the response */
|
||||||
* <0: negated errno on fail */
|
uint16_t recv_buflen; /* Size of the response */
|
||||||
|
int16_t recv_result; /* >=0: receive size on success;
|
||||||
|
* <0: negated errno on fail */
|
||||||
};
|
};
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -255,7 +242,9 @@ static inline ssize_t icmpv6_readahead(FAR struct icmpv6_conn_s *conn,
|
|||||||
ssize_t ret = -ENODATA;
|
ssize_t ret = -ENODATA;
|
||||||
int recvlen;
|
int recvlen;
|
||||||
|
|
||||||
/* Check there is any ICMPv6 replies already buffered in a read-ahead buffer. */
|
/* Check there is any ICMPv6 replies already buffered in a read-ahead
|
||||||
|
* buffer.
|
||||||
|
*/
|
||||||
|
|
||||||
if ((iob = iob_peek_queue(&conn->readahead)) != NULL)
|
if ((iob = iob_peek_queue(&conn->readahead)) != NULL)
|
||||||
{
|
{
|
||||||
|
|||||||
+31
-41
@@ -1,35 +1,20 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* net/icmpv6/icmpv6_sendto.c
|
* net/icmpv6/icmpv6_sendto.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2017, 2019-2020 Gregory Nutt. All rights reserved.
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
*
|
*
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
* notice, this list of conditions and the following disclaimer in
|
* License for the specific language governing permissions and limitations
|
||||||
* the documentation and/or other materials provided with the
|
* under the License.
|
||||||
* 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.
|
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
@@ -85,11 +70,14 @@
|
|||||||
struct icmpv6_sendto_s
|
struct icmpv6_sendto_s
|
||||||
{
|
{
|
||||||
FAR struct devif_callback_s *snd_cb; /* Reference to callback instance */
|
FAR struct devif_callback_s *snd_cb; /* Reference to callback instance */
|
||||||
sem_t snd_sem; /* Use to manage the wait for send complete */
|
sem_t snd_sem; /* Use to manage the wait for send
|
||||||
struct in6_addr snd_toaddr; /* The peer to send the request to */
|
* complete */
|
||||||
FAR const uint8_t *snd_buf; /* ICMPv6 header + data payload */
|
struct in6_addr snd_toaddr; /* The peer to send the request to */
|
||||||
uint16_t snd_buflen; /* Size of the ICMPv6 header + data payload */
|
FAR const uint8_t *snd_buf; /* ICMPv6 header + data payload */
|
||||||
int16_t snd_result; /* 0: success; <0:negated errno on fail */
|
uint16_t snd_buflen; /* Size of the ICMPv6 header + data
|
||||||
|
* payload */
|
||||||
|
int16_t snd_result; /* 0: success; <0:negated errno on
|
||||||
|
* fail */
|
||||||
};
|
};
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -267,8 +255,8 @@ end_wait:
|
|||||||
* Implements the sendto() operation for the case of the IPPROTO_ICMP6
|
* Implements the sendto() operation for the case of the IPPROTO_ICMP6
|
||||||
* socket. The 'buf' parameter points to a block of memory that includes
|
* socket. The 'buf' parameter points to a block of memory that includes
|
||||||
* an ICMPv6 request header, followed by any payload that accompanies the
|
* an ICMPv6 request header, followed by any payload that accompanies the
|
||||||
* request. The 'len' parameter includes both the size of the ICMPv6 header
|
* request. The 'len' parameter includes both the size of the ICMPv6
|
||||||
* and the following payload.
|
* header and the following payload.
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* psock A pointer to a NuttX-specific, internal socket structure
|
* psock A pointer to a NuttX-specific, internal socket structure
|
||||||
@@ -285,8 +273,9 @@ end_wait:
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
ssize_t icmpv6_sendto(FAR struct socket *psock, FAR const void *buf, size_t len,
|
ssize_t icmpv6_sendto(FAR struct socket *psock, FAR const void *buf,
|
||||||
int flags, FAR const struct sockaddr *to, socklen_t tolen)
|
size_t len, int flags, FAR const struct sockaddr *to,
|
||||||
|
socklen_t tolen)
|
||||||
{
|
{
|
||||||
FAR const struct sockaddr_in6 *inaddr;
|
FAR const struct sockaddr_in6 *inaddr;
|
||||||
FAR struct net_driver_s *dev;
|
FAR struct net_driver_s *dev;
|
||||||
@@ -399,16 +388,17 @@ ssize_t icmpv6_sendto(FAR struct socket *psock, FAR const void *buf, size_t len,
|
|||||||
{
|
{
|
||||||
if (ret == -ETIMEDOUT)
|
if (ret == -ETIMEDOUT)
|
||||||
{
|
{
|
||||||
/* Check if this device is on the same network as the destination
|
/* Check if this device is on the same network as the
|
||||||
* device.
|
* destination device.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!net_ipv6addr_maskcmp(state.snd_toaddr.s6_addr16,
|
if (!net_ipv6addr_maskcmp(state.snd_toaddr.s6_addr16,
|
||||||
dev->d_ipv6addr, dev->d_ipv6netmask))
|
dev->d_ipv6addr, dev->d_ipv6netmask))
|
||||||
{
|
{
|
||||||
/* Destination address was not on the local network served by
|
/* Destination address was not on the local network served
|
||||||
* this device. If a timeout occurs, then the most likely
|
* by this device. If a timeout occurs, then the most
|
||||||
* reason is that the destination address is not reachable.
|
* likely reason is that the destination address is not
|
||||||
|
* reachable.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ret = -ENETUNREACH;
|
ret = -ENETUNREACH;
|
||||||
|
|||||||
@@ -1,35 +1,20 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* net/socket/ieee802154_recvfrom.c
|
* net/socket/ieee802154_recvfrom.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2017 Gregory Nutt. All rights reserved.
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
*
|
*
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
* notice, this list of conditions and the following disclaimer in
|
* License for the specific language governing permissions and limitations
|
||||||
* the documentation and/or other materials provided with the
|
* under the License.
|
||||||
* 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.
|
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
@@ -127,8 +112,9 @@ static int ieee802154_count_frames(FAR struct ieee802154_conn_s *conn)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static ssize_t ieee802154_recvfrom_rxqueue(FAR struct radio_driver_s *radio,
|
static ssize_t
|
||||||
FAR struct ieee802154_recvfrom_s *pstate)
|
ieee802154_recvfrom_rxqueue(FAR struct radio_driver_s *radio,
|
||||||
|
FAR struct ieee802154_recvfrom_s *pstate)
|
||||||
{
|
{
|
||||||
FAR struct ieee802154_container_s *container;
|
FAR struct ieee802154_container_s *container;
|
||||||
FAR struct sockaddr_ieee802154_s *iaddr;
|
FAR struct sockaddr_ieee802154_s *iaddr;
|
||||||
@@ -187,8 +173,10 @@ static ssize_t ieee802154_recvfrom_rxqueue(FAR struct radio_driver_s *radio,
|
|||||||
|
|
||||||
if (pstate->ir_from != NULL)
|
if (pstate->ir_from != NULL)
|
||||||
{
|
{
|
||||||
iaddr = (FAR struct sockaddr_ieee802154_s *)pstate->ir_from;
|
iaddr = (FAR struct sockaddr_ieee802154_s *)
|
||||||
|
pstate->ir_from;
|
||||||
iaddr->sa_family = AF_IEEE802154;
|
iaddr->sa_family = AF_IEEE802154;
|
||||||
|
|
||||||
memcpy(&iaddr->sa_addr, &container->ic_src,
|
memcpy(&iaddr->sa_addr, &container->ic_src,
|
||||||
sizeof(struct ieee802154_saddr_s));
|
sizeof(struct ieee802154_saddr_s));
|
||||||
}
|
}
|
||||||
@@ -216,10 +204,10 @@ static ssize_t ieee802154_recvfrom_rxqueue(FAR struct radio_driver_s *radio,
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static uint16_t ieee802154_recvfrom_eventhandler(FAR struct net_driver_s *dev,
|
static uint16_t
|
||||||
FAR void *pvconn,
|
ieee802154_recvfrom_eventhandler(FAR struct net_driver_s *dev,
|
||||||
FAR void *pvpriv,
|
FAR void *pvconn, FAR void *pvpriv,
|
||||||
uint16_t flags)
|
uint16_t flags)
|
||||||
{
|
{
|
||||||
FAR struct ieee802154_recvfrom_s *pstate;
|
FAR struct ieee802154_recvfrom_s *pstate;
|
||||||
FAR struct radio_driver_s *radio;
|
FAR struct radio_driver_s *radio;
|
||||||
@@ -288,9 +276,9 @@ static uint16_t ieee802154_recvfrom_eventhandler(FAR struct net_driver_s *dev,
|
|||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Implements the socket recvfrom interface for the case of the AF_INET
|
* Implements the socket recvfrom interface for the case of the AF_INET
|
||||||
* and AF_INET6 address families. ieee802154_recvfrom() receives messages from
|
* and AF_INET6 address families. ieee802154_recvfrom() receives messages
|
||||||
* a socket, and may be used to receive data on a socket whether or not it
|
* from a socket, and may be used to receive data on a socket whether or
|
||||||
* is connection-oriented.
|
* not it is connection-oriented.
|
||||||
*
|
*
|
||||||
* If 'from' is not NULL, and the underlying protocol provides the source
|
* If 'from' is not NULL, and the underlying protocol provides the source
|
||||||
* address, this source address is filled in. The argument 'fromlen' is
|
* address, this source address is filled in. The argument 'fromlen' is
|
||||||
@@ -321,7 +309,8 @@ ssize_t ieee802154_recvfrom(FAR struct socket *psock, FAR void *buf,
|
|||||||
size_t len, int flags, FAR struct sockaddr *from,
|
size_t len, int flags, FAR struct sockaddr *from,
|
||||||
FAR socklen_t *fromlen)
|
FAR socklen_t *fromlen)
|
||||||
{
|
{
|
||||||
FAR struct ieee802154_conn_s *conn = (FAR struct ieee802154_conn_s *)psock->s_conn;
|
FAR struct ieee802154_conn_s *conn =
|
||||||
|
(FAR struct ieee802154_conn_s *)psock->s_conn;
|
||||||
FAR struct radio_driver_s *radio;
|
FAR struct radio_driver_s *radio;
|
||||||
struct ieee802154_recvfrom_s state;
|
struct ieee802154_recvfrom_s state;
|
||||||
ssize_t ret;
|
ssize_t ret;
|
||||||
|
|||||||
@@ -1,35 +1,20 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* net/ieee802154/ieee802154_sendto.c
|
* net/ieee802154/ieee802154_sendto.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2017-2018 Gregory Nutt. All rights reserved.
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
*
|
*
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
* notice, this list of conditions and the following disclaimer in
|
* License for the specific language governing permissions and limitations
|
||||||
* the documentation and/or other materials provided with the
|
* under the License.
|
||||||
* 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.
|
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
@@ -433,9 +418,10 @@ errout:
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
ssize_t psock_ieee802154_sendto(FAR struct socket *psock, FAR const void *buf,
|
ssize_t psock_ieee802154_sendto(FAR struct socket *psock,
|
||||||
size_t len, int flags,
|
FAR const void *buf, size_t len, int flags,
|
||||||
FAR const struct sockaddr *to, socklen_t tolen)
|
FAR const struct sockaddr *to,
|
||||||
|
socklen_t tolen)
|
||||||
{
|
{
|
||||||
FAR struct sockaddr_ieee802154_s *destaddr;
|
FAR struct sockaddr_ieee802154_s *destaddr;
|
||||||
FAR struct radio_driver_s *radio;
|
FAR struct radio_driver_s *radio;
|
||||||
@@ -538,8 +524,9 @@ ssize_t psock_ieee802154_sendto(FAR struct socket *psock, FAR const void *buf,
|
|||||||
return state.is_sent;
|
return state.is_sent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If net_lockedwait failed, then we were probably reawakened by a signal. In
|
/* If net_lockedwait failed, then we were probably reawakened by a signal.
|
||||||
* this case, net_lockedwait will have returned negated errno appropriately.
|
* In this case, net_lockedwait will have returned negated errno
|
||||||
|
* appropriately.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
|
|||||||
+17
-30
@@ -1,35 +1,20 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* net/local/local_connect.c
|
* net/local/local_connect.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015-2017 Gregory Nutt. All rights reserved.
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
*
|
*
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
* notice, this list of conditions and the following disclaimer in
|
* License for the specific language governing permissions and limitations
|
||||||
* the documentation and/or other materials provided with the
|
* under the License.
|
||||||
* 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.
|
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
@@ -305,7 +290,8 @@ int psock_local_connect(FAR struct socket *psock,
|
|||||||
/* Bind the address and protocol */
|
/* Bind the address and protocol */
|
||||||
|
|
||||||
client->lc_proto = conn->lc_proto;
|
client->lc_proto = conn->lc_proto;
|
||||||
strncpy(client->lc_path, unaddr->sun_path, UNIX_PATH_MAX - 1);
|
strncpy(client->lc_path, unaddr->sun_path,
|
||||||
|
UNIX_PATH_MAX - 1);
|
||||||
client->lc_path[UNIX_PATH_MAX - 1] = '\0';
|
client->lc_path[UNIX_PATH_MAX - 1] = '\0';
|
||||||
client->lc_instance_id = local_generate_instance_id();
|
client->lc_instance_id = local_generate_instance_id();
|
||||||
|
|
||||||
@@ -317,8 +303,9 @@ int psock_local_connect(FAR struct socket *psock,
|
|||||||
|
|
||||||
if (conn->lc_proto == SOCK_STREAM)
|
if (conn->lc_proto == SOCK_STREAM)
|
||||||
{
|
{
|
||||||
ret = local_stream_connect(client, conn,
|
ret =
|
||||||
_SS_ISNONBLOCK(psock->s_flags));
|
local_stream_connect(client, conn,
|
||||||
|
_SS_ISNONBLOCK(psock->s_flags));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
+16
-30
@@ -1,35 +1,20 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* net/tcp/tcp_connect.c
|
* net/tcp/tcp_connect.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2012, 2015-2017 Gregory Nutt. All rights reserved.
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
*
|
*
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
* notice, this list of conditions and the following disclaimer in
|
* License for the specific language governing permissions and limitations
|
||||||
* the documentation and/or other materials provided with the
|
* under the License.
|
||||||
* 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.
|
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
@@ -195,8 +180,8 @@ static uint16_t psock_connect_eventhandler(FAR struct net_driver_s *dev,
|
|||||||
* ENETUNREACH
|
* ENETUNREACH
|
||||||
* Network is unreachable.
|
* Network is unreachable.
|
||||||
* ETIMEDOUT
|
* ETIMEDOUT
|
||||||
* Timeout while attempting connection. The server may be too busy
|
* Timeout while attempting connection. The server may be too
|
||||||
* to accept new connections.
|
* busy to accept new connections.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* TCP_CLOSE: The remote host has closed the connection
|
/* TCP_CLOSE: The remote host has closed the connection
|
||||||
@@ -292,7 +277,8 @@ static uint16_t psock_connect_eventhandler(FAR struct net_driver_s *dev,
|
|||||||
* Perform a TCP connection
|
* Perform a TCP connection
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* psock - A reference to the socket structure of the socket to be connected
|
* psock - A reference to the socket structure of the socket to be
|
||||||
|
* connected
|
||||||
* addr - The address of the remote server to connect to
|
* addr - The address of the remote server to connect to
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
|
|||||||
+30
-43
@@ -1,35 +1,20 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* net/tcp/tcp_recvfrom.c
|
* net/tcp/tcp_recvfrom.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2020 Gregory Nutt. All rights reserved.
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
*
|
*
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
* notice, this list of conditions and the following disclaimer in
|
* License for the specific language governing permissions and limitations
|
||||||
* the documentation and/or other materials provided with the
|
* under the License.
|
||||||
* 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.
|
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
@@ -249,7 +234,8 @@ static inline void tcp_newdata(FAR struct net_driver_s *dev,
|
|||||||
|
|
||||||
static inline void tcp_readahead(struct tcp_recvfrom_s *pstate)
|
static inline void tcp_readahead(struct tcp_recvfrom_s *pstate)
|
||||||
{
|
{
|
||||||
FAR struct tcp_conn_s *conn = (FAR struct tcp_conn_s *)pstate->ir_sock->s_conn;
|
FAR struct tcp_conn_s *conn =
|
||||||
|
(FAR struct tcp_conn_s *)pstate->ir_sock->s_conn;
|
||||||
FAR struct iob_s *iob;
|
FAR struct iob_s *iob;
|
||||||
int recvlen;
|
int recvlen;
|
||||||
|
|
||||||
@@ -607,8 +593,9 @@ static ssize_t tcp_recvfrom_result(int result, struct tcp_recvfrom_s *pstate)
|
|||||||
return pstate->ir_result;
|
return pstate->ir_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If net_timedwait failed, then we were probably reawakened by a signal. In
|
/* If net_timedwait failed, then we were probably reawakened by a signal.
|
||||||
* this case, net_timedwait will have returned negated errno appropriately.
|
* In this case, net_timedwait will have returned negated errno
|
||||||
|
* appropriately.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (result < 0)
|
if (result < 0)
|
||||||
@@ -683,15 +670,15 @@ ssize_t psock_tcp_recvfrom(FAR struct socket *psock, FAR void *buf,
|
|||||||
* will wait to return end disconnection indications the next time that
|
* will wait to return end disconnection indications the next time that
|
||||||
* recvfrom() is called.
|
* recvfrom() is called.
|
||||||
*
|
*
|
||||||
* If no data was received (i.e., ret == 0 -- it will not be negative)
|
* If no data was received (i.e., ret == 0 -- it will not be
|
||||||
* and the connection was gracefully closed by the remote peer, then return
|
* negative) and the connection was gracefully closed by the remote
|
||||||
* success. If ir_recvlen is zero, the caller of recvfrom() will get an
|
* peer, then return success. If ir_recvlen is zero, the caller of
|
||||||
* end-of-file indication.
|
* recvfrom() will get an end-of-file indication.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (ret <= 0 && !_SS_ISCLOSED(psock->s_flags))
|
if (ret <= 0 && !_SS_ISCLOSED(psock->s_flags))
|
||||||
{
|
{
|
||||||
/* Nothing was previously received from the readahead buffers.
|
/* Nothing was previously received from the read-ahead buffers.
|
||||||
* The SOCK_STREAM must be (re-)connected in order to receive any
|
* The SOCK_STREAM must be (re-)connected in order to receive any
|
||||||
* additional data.
|
* additional data.
|
||||||
*/
|
*/
|
||||||
@@ -701,9 +688,9 @@ ssize_t psock_tcp_recvfrom(FAR struct socket *psock, FAR void *buf,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* In general, this implementation will not support non-blocking socket
|
/* In general, this implementation will not support non-blocking socket
|
||||||
* operations... except in a few cases: Here for TCP receive with read-ahead
|
* operations... except in a few cases: Here for TCP receive with read-
|
||||||
* enabled. If this socket is configured as non-blocking then return EAGAIN
|
* ahead enabled. If this socket is configured as non-blocking then
|
||||||
* if no data was obtained from the read-ahead buffers.
|
* return EAGAIN if no data was obtained from the read-ahead buffers.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
else if (_SS_ISNONBLOCK(psock->s_flags) || (flags & MSG_DONTWAIT) != 0)
|
else if (_SS_ISNONBLOCK(psock->s_flags) || (flags & MSG_DONTWAIT) != 0)
|
||||||
@@ -720,15 +707,15 @@ ssize_t psock_tcp_recvfrom(FAR struct socket *psock, FAR void *buf,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* It is okay to block if we need to. If there is space to receive anything
|
/* It is okay to block if we need to. If there is space to receive
|
||||||
* more, then we will wait to receive the data. Otherwise return the number
|
* anything more, then we will wait to receive the data. Otherwise return
|
||||||
* of bytes read from the read-ahead buffer (already in 'ret').
|
* the number of bytes read from the read-ahead buffer (already in 'ret').
|
||||||
*/
|
*/
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
/* We get here when we we decide that we need to setup the wait for incoming
|
/* We get here when we we decide that we need to setup the wait for
|
||||||
* TCP/IP data. Just a few more conditions to check:
|
* incoming TCP/IP data. Just a few more conditions to check:
|
||||||
*
|
*
|
||||||
* 1) Make sure thet there is buffer space to receive additional data
|
* 1) Make sure thet there is buffer space to receive additional data
|
||||||
* (state.ir_buflen > 0). This could be zero, for example, we filled
|
* (state.ir_buflen > 0). This could be zero, for example, we filled
|
||||||
|
|||||||
@@ -94,16 +94,16 @@
|
|||||||
|
|
||||||
struct sendfile_s
|
struct sendfile_s
|
||||||
{
|
{
|
||||||
FAR struct socket *snd_sock; /* Points to the parent socket structure */
|
FAR struct socket *snd_sock; /* Points to the parent socket structure */
|
||||||
FAR struct devif_callback_s *snd_datacb; /* Data callback */
|
FAR struct devif_callback_s *snd_datacb; /* Data callback */
|
||||||
FAR struct devif_callback_s *snd_ackcb; /* ACK callback */
|
FAR struct devif_callback_s *snd_ackcb; /* ACK callback */
|
||||||
FAR struct file *snd_file; /* File structure of the input file */
|
FAR struct file *snd_file; /* File structure of the input file */
|
||||||
sem_t snd_sem; /* Used to wake up the waiting thread */
|
sem_t snd_sem; /* Used to wake up the waiting thread */
|
||||||
off_t snd_foffset; /* Input file offset */
|
off_t snd_foffset; /* Input file offset */
|
||||||
size_t snd_flen; /* File length */
|
size_t snd_flen; /* File length */
|
||||||
ssize_t snd_sent; /* The number of bytes sent */
|
ssize_t snd_sent; /* The number of bytes sent */
|
||||||
uint32_t snd_isn; /* Initial sequence number */
|
uint32_t snd_isn; /* Initial sequence number */
|
||||||
uint32_t snd_acked; /* The number of bytes acked */
|
uint32_t snd_acked; /* The number of bytes acked */
|
||||||
};
|
};
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|||||||
@@ -1,36 +1,20 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* net/udp/udp_sendto_unbuffered.c
|
* net/udp/udp_sendto_unbuffered.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2009, 2011-2016, 2018-2019 Gregory Nutt. All rights
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
* reserved.
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
*
|
*
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
* notice, this list of conditions and the following disclaimer in
|
* License for the specific language governing permissions and limitations
|
||||||
* the documentation and/or other materials provided with the
|
* under the License.
|
||||||
* 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.
|
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
@@ -273,8 +257,8 @@ static uint16_t sendto_eventhandler(FAR struct net_driver_s *dev,
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
ssize_t psock_udp_sendto(FAR struct socket *psock, FAR const void *buf,
|
ssize_t psock_udp_sendto(FAR struct socket *psock, FAR const void *buf,
|
||||||
size_t len, int flags, FAR const struct sockaddr *to,
|
size_t len, int flags,
|
||||||
socklen_t tolen)
|
FAR const struct sockaddr *to, socklen_t tolen)
|
||||||
{
|
{
|
||||||
FAR struct udp_conn_s *conn;
|
FAR struct udp_conn_s *conn;
|
||||||
struct sendto_s state;
|
struct sendto_s state;
|
||||||
@@ -486,7 +470,9 @@ ssize_t psock_udp_sendto(FAR struct socket *psock, FAR const void *buf,
|
|||||||
ret = net_timedwait(&state.st_sem, _SO_TIMEOUT(psock->s_sndtimeo));
|
ret = net_timedwait(&state.st_sem, _SO_TIMEOUT(psock->s_sndtimeo));
|
||||||
if (ret >= 0)
|
if (ret >= 0)
|
||||||
{
|
{
|
||||||
/* The result of the sendto operation is the number of bytes transferred */
|
/* The result of the sendto operation is the number of bytes
|
||||||
|
* transferred.
|
||||||
|
*/
|
||||||
|
|
||||||
ret = state.st_sndlen;
|
ret = state.st_sndlen;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -140,8 +140,8 @@ FAR struct usrsock_conn_s *usrsock_alloc(void)
|
|||||||
* Name: usrsock_free()
|
* Name: usrsock_free()
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Free a usrsock connection structure that is no longer in use. This should
|
* Free a usrsock connection structure that is no longer in use. This
|
||||||
* be done by the implementation of close().
|
* should be done by the implementation of close().
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
@@ -283,10 +283,11 @@ int usrsock_setup_request_callback(FAR struct usrsock_conn_s *conn,
|
|||||||
* Name: usrsock_setup_data_request_callback()
|
* Name: usrsock_setup_data_request_callback()
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int usrsock_setup_data_request_callback(FAR struct usrsock_conn_s *conn,
|
int usrsock_setup_data_request_callback(
|
||||||
FAR struct usrsock_data_reqstate_s *pstate,
|
FAR struct usrsock_conn_s *conn,
|
||||||
FAR devif_callback_event_t event,
|
FAR struct usrsock_data_reqstate_s *pstate,
|
||||||
uint16_t flags)
|
FAR devif_callback_event_t event,
|
||||||
|
uint16_t flags)
|
||||||
{
|
{
|
||||||
pstate->valuelen = 0;
|
pstate->valuelen = 0;
|
||||||
pstate->valuelen_nontrunc = 0;
|
pstate->valuelen_nontrunc = 0;
|
||||||
|
|||||||
@@ -1,35 +1,20 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* sched/pthread/pthread_condsignal.c
|
* sched/pthread/pthread_condsignal.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2009, 2012 Gregory Nutt. All rights reserved.
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
*
|
*
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
* notice, this list of conditions and the following disclaimer in
|
* License for the specific language governing permissions and limitations
|
||||||
* the documentation and/or other materials provided with the
|
* under the License.
|
||||||
* 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.
|
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
@@ -92,13 +77,14 @@ int pthread_cond_signal(FAR pthread_cond_t *cond)
|
|||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* One of my objectives in this design was to make pthread_cond_signal
|
/* One of my objectives in this design was to make
|
||||||
* usable from interrupt handlers. However, from interrupt handlers,
|
* pthread_cond_signal() usable from interrupt handlers. However,
|
||||||
* you cannot take the associated mutex before signaling the condition.
|
* from interrupt handlers, you cannot take the associated mutex
|
||||||
* As a result, I think that there could be a race condition with
|
* before signaling the condition. As a result, I think that
|
||||||
* the following logic which assumes that the if sval < 0 then the
|
* there could be a race condition with the following logic which
|
||||||
* thread is waiting. Without the mutex, there is no atomic, protected
|
* assumes that the if sval < 0 then the thread is waiting.
|
||||||
* operation that will guarantee this to be so.
|
* Without the mutex, there is no atomic, protected operation that
|
||||||
|
* will guarantee this to be so.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
sinfo("sval=%d\n", sval);
|
sinfo("sval=%d\n", sval);
|
||||||
|
|||||||
@@ -1,35 +1,20 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* sched/pthread/pthread_mutexinit.c
|
* sched/pthread/pthread_mutexinit.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2009, 2011, 2016-2017 Gregory Nutt. All rights reserved.
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
*
|
*
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
* notice, this list of conditions and the following disclaimer in
|
* License for the specific language governing permissions and limitations
|
||||||
* the documentation and/or other materials provided with the
|
* under the License.
|
||||||
* 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.
|
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
@@ -138,7 +123,8 @@ int pthread_mutex_init(FAR pthread_mutex_t *mutex,
|
|||||||
/* Initial internal fields of the mutex */
|
/* Initial internal fields of the mutex */
|
||||||
|
|
||||||
mutex->flink = NULL;
|
mutex->flink = NULL;
|
||||||
mutex->flags = (robust == PTHREAD_MUTEX_ROBUST ? _PTHREAD_MFLAGS_ROBUST : 0);
|
mutex->flags = (robust == PTHREAD_MUTEX_ROBUST ?
|
||||||
|
_PTHREAD_MFLAGS_ROBUST : 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_PTHREAD_MUTEX_TYPES
|
#ifdef CONFIG_PTHREAD_MUTEX_TYPES
|
||||||
|
|||||||
Reference in New Issue
Block a user