mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-05 14:17:20 +08:00
Merge branch 'master' of github.com:PX4/Firmware into px4io-adc-integration-battery-msg
This commit is contained in:
@@ -500,7 +500,7 @@ PX4FMU::pwm_ioctl(file *filp, int cmd, unsigned long arg)
|
|||||||
/* FALLTHROUGH */
|
/* FALLTHROUGH */
|
||||||
case PWM_SERVO_GET(0):
|
case PWM_SERVO_GET(0):
|
||||||
case PWM_SERVO_GET(1): {
|
case PWM_SERVO_GET(1): {
|
||||||
channel = cmd - PWM_SERVO_SET(0);
|
channel = cmd - PWM_SERVO_GET(0);
|
||||||
*(servo_position_t *)arg = up_pwm_servo_get(channel);
|
*(servo_position_t *)arg = up_pwm_servo_get(channel);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -660,9 +660,9 @@ static int uart_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
|||||||
|
|
||||||
int ret = dev->ops->ioctl(filep, cmd, arg);
|
int ret = dev->ops->ioctl(filep, cmd, arg);
|
||||||
|
|
||||||
/* Append any higher level TTY flags */
|
/* If the low-level handler didn't handle the call, see if we can handle it here */
|
||||||
|
|
||||||
if (ret == OK)
|
if (ret == -ENOTTY)
|
||||||
{
|
{
|
||||||
switch (cmd)
|
switch (cmd)
|
||||||
{
|
{
|
||||||
@@ -686,8 +686,43 @@ static int uart_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
|||||||
irqrestore(state);
|
irqrestore(state);
|
||||||
|
|
||||||
*(int *)arg = count;
|
*(int *)arg = count;
|
||||||
|
ret = 0;
|
||||||
|
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case FIONWRITE:
|
||||||
|
{
|
||||||
|
int count;
|
||||||
|
irqstate_t state = irqsave();
|
||||||
|
|
||||||
|
/* determine the number of bytes free in the buffer */
|
||||||
|
|
||||||
|
if (dev->xmit.head < dev->xmit.tail)
|
||||||
|
{
|
||||||
|
count = dev->xmit.tail - dev->xmit.head - 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
count = dev->xmit.size - (dev->xmit.head - dev->xmit.tail) - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
irqrestore(state);
|
||||||
|
|
||||||
|
*(int *)arg = count;
|
||||||
|
ret = 0;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Append any higher level TTY flags */
|
||||||
|
|
||||||
|
else if (ret == OK)
|
||||||
|
{
|
||||||
|
switch (cmd)
|
||||||
|
{
|
||||||
#ifdef CONFIG_SERIAL_TERMIOS
|
#ifdef CONFIG_SERIAL_TERMIOS
|
||||||
case TCGETS:
|
case TCGETS:
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -110,6 +110,10 @@
|
|||||||
* OUT: Bytes readable from this fd
|
* OUT: Bytes readable from this fd
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define FIONWRITE _FIOC(0x0005) /* IN: Location to return value (int *)
|
||||||
|
* OUT: Bytes writable to this fd
|
||||||
|
*/
|
||||||
|
|
||||||
/* NuttX file system ioctl definitions **************************************/
|
/* NuttX file system ioctl definitions **************************************/
|
||||||
|
|
||||||
#define _DIOCVALID(c) (_IOC_TYPE(c)==_DIOCBASE)
|
#define _DIOCVALID(c) (_IOC_TYPE(c)==_DIOCBASE)
|
||||||
|
|||||||
Reference in New Issue
Block a user