drivers/timers/oneshot.c: Support signal notification through SIGEV_THREAD
drivers/timers/rtc.c: Support signal notification through SIGEV_THREAD drivers/input/ajoystick.c: Support signal notification through SIGEV_THREAD drivers/input/djoystick.c: Support signal notification through SIGEV_THREAD drivers/input/button_upper.c: Support signal notification through SIGEV_THREAD drivers/sensors/zerocross.c: Support signal notification through SIGEV_THREAD drivers/wireless/ieee802154: Support signal notification through SIGEV_THREAD drivers/lcd/ft80x.c: Support signal notification through SIGEV_THREAD
This commit is contained in:
parent
7dd81cc5c2
commit
5e8ae23edc
@ -374,16 +374,9 @@ static void ajoy_sample(FAR struct ajoy_upperhalf_s *priv)
|
|||||||
{
|
{
|
||||||
/* Yes.. Signal the waiter */
|
/* Yes.. Signal the waiter */
|
||||||
|
|
||||||
#ifdef CONFIG_CAN_PASS_STRUCTS
|
opriv->ao_notify.an_event.sigev_value.sival_int = sample;
|
||||||
union sigval value;
|
nxsig_notification(opriv->ao_pid, &opriv->ao_notify.an_event,
|
||||||
value.sival_int = (int)sample;
|
SI_QUEUE);
|
||||||
|
|
||||||
(void)nxsig_queue(opriv->ao_pid, opriv->ao_notify.an_signo,
|
|
||||||
value);
|
|
||||||
#else
|
|
||||||
(void)nxsig_queue(opriv->ao_pid, opriv->ao_notify.dn.signo,
|
|
||||||
(FAR void *)sample);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -639,10 +632,10 @@ static int ajoy_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
|||||||
{
|
{
|
||||||
/* Command: AJOYIOC_SUPPORTED
|
/* Command: AJOYIOC_SUPPORTED
|
||||||
* Description: Report the set of button events supported by the hardware;
|
* Description: Report the set of button events supported by the hardware;
|
||||||
* Argument: A pointer to writeable integer value in which to return the
|
* Argument: A pointer to writeable integer value in which to return
|
||||||
* set of supported buttons.
|
* the set of supported buttons.
|
||||||
* Return: Zero (OK) on success. Minus one will be returned on failure
|
* Return: Zero (OK) on success. Minus one will be returned on
|
||||||
* with the errno value set appropriately.
|
* failure with the errno value set appropriately.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
case AJOYIOC_SUPPORTED:
|
case AJOYIOC_SUPPORTED:
|
||||||
@ -715,7 +708,7 @@ static int ajoy_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
|||||||
|
|
||||||
opriv->ao_notify.an_press = notify->an_press;
|
opriv->ao_notify.an_press = notify->an_press;
|
||||||
opriv->ao_notify.an_release = notify->an_release;
|
opriv->ao_notify.an_release = notify->an_release;
|
||||||
opriv->ao_notify.an_signo = notify->an_signo;
|
opriv->ao_notify.an_event = notify->an_event;
|
||||||
opriv->ao_pid = getpid();
|
opriv->ao_pid = getpid();
|
||||||
|
|
||||||
/* Enable/disable interrupt handling */
|
/* Enable/disable interrupt handling */
|
||||||
|
@ -356,16 +356,10 @@ static void btn_sample(FAR struct btn_upperhalf_s *priv)
|
|||||||
{
|
{
|
||||||
/* Yes.. Signal the waiter */
|
/* Yes.. Signal the waiter */
|
||||||
|
|
||||||
#ifdef CONFIG_CAN_PASS_STRUCTS
|
opriv->bo_notify.bn_event.sigev_value.sival_int = sample;
|
||||||
union sigval value;
|
nxsig_notification(opriv->bo_pid, &opriv->bo_notify.bn_event,
|
||||||
value.sival_int = (int)sample;
|
SI_QUEUE);
|
||||||
(void)nxsig_queue(opriv->bo_pid, opriv->bo_notify.bn_signo,
|
}
|
||||||
value);
|
|
||||||
#else
|
|
||||||
(void)nxsig_queue(opriv->bo_pid, opriv->bo_notify.dn.signo,
|
|
||||||
(FAR void *)sample);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -620,15 +614,16 @@ static int btn_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
|||||||
{
|
{
|
||||||
/* Command: BTNIOC_SUPPORTED
|
/* Command: BTNIOC_SUPPORTED
|
||||||
* Description: Report the set of button events supported by the hardware;
|
* Description: Report the set of button events supported by the hardware;
|
||||||
* Argument: A pointer to writeable integer value in which to return the
|
* Argument: A pointer to writeable integer value in which to return
|
||||||
* set of supported buttons.
|
* the set of supported buttons.
|
||||||
* Return: Zero (OK) on success. Minus one will be returned on failure
|
* Return: Zero (OK) on success. Minus one will be returned on
|
||||||
* with the errno value set appropriately.
|
* failure with the errno value set appropriately.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
case BTNIOC_SUPPORTED:
|
case BTNIOC_SUPPORTED:
|
||||||
{
|
{
|
||||||
FAR btn_buttonset_t *supported = (FAR btn_buttonset_t *)((uintptr_t)arg);
|
FAR btn_buttonset_t *supported =
|
||||||
|
(FAR btn_buttonset_t *)((uintptr_t)arg);
|
||||||
|
|
||||||
if (supported)
|
if (supported)
|
||||||
{
|
{
|
||||||
@ -696,7 +691,7 @@ static int btn_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
|||||||
|
|
||||||
opriv->bo_notify.bn_press = notify->bn_press;
|
opriv->bo_notify.bn_press = notify->bn_press;
|
||||||
opriv->bo_notify.bn_release = notify->bn_release;
|
opriv->bo_notify.bn_release = notify->bn_release;
|
||||||
opriv->bo_notify.bn_signo = notify->bn_signo;
|
opriv->bo_notify.bn_event = notify->bn_event;
|
||||||
opriv->bo_pid = getpid();
|
opriv->bo_pid = getpid();
|
||||||
|
|
||||||
/* Enable/disable interrupt handling */
|
/* Enable/disable interrupt handling */
|
||||||
|
@ -374,15 +374,9 @@ static void djoy_sample(FAR struct djoy_upperhalf_s *priv)
|
|||||||
{
|
{
|
||||||
/* Yes.. Signal the waiter */
|
/* Yes.. Signal the waiter */
|
||||||
|
|
||||||
#ifdef CONFIG_CAN_PASS_STRUCTS
|
opriv->do_notify.dn_event.sigev_value.sival_int = sample;
|
||||||
union sigval value;
|
nxsig_notification(opriv->do_pid, &opriv->do_notify.dn_event,
|
||||||
value.sival_int = (int)sample;
|
SI_QUEUE);
|
||||||
(void)nxsig_queue(opriv->do_pid, opriv->do_notify.dn_signo,
|
|
||||||
value);
|
|
||||||
#else
|
|
||||||
(void)nxsig_queue(opriv->do_pid, opriv->do_notify.dn.signo,
|
|
||||||
(FAR void *)sample);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -634,10 +628,10 @@ static int djoy_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
|||||||
{
|
{
|
||||||
/* Command: DJOYIOC_SUPPORTED
|
/* Command: DJOYIOC_SUPPORTED
|
||||||
* Description: Report the set of button events supported by the hardware;
|
* Description: Report the set of button events supported by the hardware;
|
||||||
* Argument: A pointer to writeable integer value in which to return the
|
* Argument: A pointer to writeable integer value in which to return
|
||||||
* set of supported buttons.
|
* the set of supported buttons.
|
||||||
* Return: Zero (OK) on success. Minus one will be returned on failure
|
* Return: Zero (OK) on success. Minus one will be returned on
|
||||||
* with the errno value set appropriately.
|
* failure with the errno value set appropriately.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
case DJOYIOC_SUPPORTED:
|
case DJOYIOC_SUPPORTED:
|
||||||
@ -710,7 +704,7 @@ static int djoy_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
|||||||
|
|
||||||
opriv->do_notify.dn_press = notify->dn_press;
|
opriv->do_notify.dn_press = notify->dn_press;
|
||||||
opriv->do_notify.dn_release = notify->dn_release;
|
opriv->do_notify.dn_release = notify->dn_release;
|
||||||
opriv->do_notify.dn_signo = notify->dn_signo;
|
opriv->do_notify.dn_event = notify->dn_event;
|
||||||
opriv->do_pid = getpid();
|
opriv->do_pid = getpid();
|
||||||
|
|
||||||
/* Enable/disable interrupt handling */
|
/* Enable/disable interrupt handling */
|
||||||
|
@ -53,7 +53,6 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <signal.h>
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
@ -109,7 +108,7 @@ static int ft80x_fade(FAR struct ft80x_dev_s *priv,
|
|||||||
FAR const struct ft80x_fade_s *fade);
|
FAR const struct ft80x_fade_s *fade);
|
||||||
|
|
||||||
static void ft80x_notify(FAR struct ft80x_dev_s *priv,
|
static void ft80x_notify(FAR struct ft80x_dev_s *priv,
|
||||||
enum ft80x_notify_e event, int value);
|
enum ft80x_notify_e id, int value);
|
||||||
static void ft80x_interrupt_work(FAR void *arg);
|
static void ft80x_interrupt_work(FAR void *arg);
|
||||||
static int ft80x_interrupt(int irq, FAR void *context, FAR void *arg);
|
static int ft80x_interrupt(int irq, FAR void *context, FAR void *arg);
|
||||||
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
|
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
|
||||||
@ -264,27 +263,20 @@ static int ft80x_fade(FAR struct ft80x_dev_s *priv,
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static void ft80x_notify(FAR struct ft80x_dev_s *priv,
|
static void ft80x_notify(FAR struct ft80x_dev_s *priv,
|
||||||
enum ft80x_notify_e event, int arg)
|
enum ft80x_notify_e id, int value)
|
||||||
{
|
{
|
||||||
FAR struct ft80x_eventinfo_s *info = &priv->notify[event];
|
FAR struct ft80x_eventinfo_s *info = &priv->notify[id];
|
||||||
#ifdef CONFIG_CAN_PASS_STRUCTS
|
|
||||||
union sigval value;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Are notifications enabled for this event? */
|
/* Are notifications enabled for this event? */
|
||||||
|
|
||||||
if (info->enable)
|
if (info->enable)
|
||||||
{
|
{
|
||||||
DEBUGASSERT(info->signo > 0 && GOOD_SIGNO(info->signo) && info->pid > 0);
|
DEBUGASSERT(info->pid > 0);
|
||||||
|
|
||||||
/* Yes.. Signal the client */
|
/* Yes.. Signal the client */
|
||||||
|
|
||||||
#ifdef CONFIG_CAN_PASS_STRUCTS
|
info->event.sigev_value.sival_int = value;
|
||||||
value.sival_int = arg;
|
nxsig_notification(info->pid, &info->event, SI_QUEUE);
|
||||||
(void)nxsig_queue(info->pid, info->signo, value);
|
|
||||||
#else
|
|
||||||
(void)nxsig_queue(info->pid, info->signo, (FAR void *)arg);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1015,14 +1007,14 @@ static int ft80x_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
|||||||
FAR struct ft80x_notify_s *notify =
|
FAR struct ft80x_notify_s *notify =
|
||||||
(FAR struct ft80x_notify_s *)((uintptr_t)arg);
|
(FAR struct ft80x_notify_s *)((uintptr_t)arg);
|
||||||
|
|
||||||
if (notify == NULL || !GOOD_SIGNO(notify->signo) || notify->pid < 0 ||
|
if (notify == NULL || notify->pid < 0 ||
|
||||||
(unsigned int)notify->event >= FT80X_INT_NEVENTS)
|
(unsigned int)notify->id >= FT80X_INT_NEVENTS)
|
||||||
{
|
{
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FAR struct ft80x_eventinfo_s *info = &priv->notify[notify->event];
|
FAR struct ft80x_eventinfo_s *info = &priv->notify[notify->id];
|
||||||
uint32_t regval;
|
uint32_t regval;
|
||||||
|
|
||||||
/* Are we enabling or disabling */
|
/* Are we enabling or disabling */
|
||||||
@ -1031,7 +1023,7 @@ static int ft80x_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
|||||||
{
|
{
|
||||||
/* Make sure that arguments are valid for the enable */
|
/* Make sure that arguments are valid for the enable */
|
||||||
|
|
||||||
if (notify->signo == 0 || notify->pid == 0)
|
if (notify->pid == 0)
|
||||||
{
|
{
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
}
|
}
|
||||||
@ -1039,14 +1031,14 @@ static int ft80x_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
|||||||
{
|
{
|
||||||
/* Setup the new notification information */
|
/* Setup the new notification information */
|
||||||
|
|
||||||
info->signo = notify->signo;
|
info->event = notify->event;
|
||||||
info->pid = notify->pid;
|
info->pid = notify->pid;
|
||||||
info->enable = true;
|
info->enable = true;
|
||||||
|
|
||||||
/* Enable interrupts associated with the event */
|
/* Enable interrupts associated with the event */
|
||||||
|
|
||||||
regval = ft80x_read_word(priv, FT80X_REG_INT_MASK);
|
regval = ft80x_read_word(priv, FT80X_REG_INT_MASK);
|
||||||
regval |= (1 << notify->event);
|
regval |= (1 << notify->id);
|
||||||
ft80x_write_word(priv, FT80X_REG_INT_MASK, regval);
|
ft80x_write_word(priv, FT80X_REG_INT_MASK, regval);
|
||||||
ret = OK;
|
ret = OK;
|
||||||
}
|
}
|
||||||
@ -1055,14 +1047,13 @@ static int ft80x_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
|||||||
{
|
{
|
||||||
/* Disable the notification */
|
/* Disable the notification */
|
||||||
|
|
||||||
info->signo = 0;
|
|
||||||
info->pid = 0;
|
info->pid = 0;
|
||||||
info->enable = false;
|
info->enable = false;
|
||||||
|
|
||||||
/* Disable interrupts associated with the event */
|
/* Disable interrupts associated with the event */
|
||||||
|
|
||||||
regval = ft80x_read_word(priv, FT80X_REG_INT_MASK);
|
regval = ft80x_read_word(priv, FT80X_REG_INT_MASK);
|
||||||
regval &= ~(1 << notify->event);
|
regval &= ~(1 << notify->id);
|
||||||
ft80x_write_word(priv, FT80X_REG_INT_MASK, regval);
|
ft80x_write_word(priv, FT80X_REG_INT_MASK, regval);
|
||||||
ret = OK;
|
ret = OK;
|
||||||
}
|
}
|
||||||
|
@ -51,6 +51,8 @@
|
|||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
#include <nuttx/wqueue.h>
|
#include <nuttx/wqueue.h>
|
||||||
|
|
||||||
|
#include <signal.h>
|
||||||
|
|
||||||
/*******************************************************************************************
|
/*******************************************************************************************
|
||||||
* Public Types
|
* Public Types
|
||||||
*******************************************************************************************/
|
*******************************************************************************************/
|
||||||
@ -157,7 +159,7 @@ struct ft80x_i2cwrite_s
|
|||||||
|
|
||||||
struct ft80x_eventinfo_s
|
struct ft80x_eventinfo_s
|
||||||
{
|
{
|
||||||
uint8_t signo; /* Notify using this signal number */
|
struct sigevent event; /* Describe the way a task is to be notified */
|
||||||
bool enable; /* True: enable notification; false: disable */
|
bool enable; /* True: enable notification; false: disable */
|
||||||
int16_t pid; /* Send the notification to this task */
|
int16_t pid; /* Send the notification to this task */
|
||||||
};
|
};
|
||||||
|
@ -103,7 +103,7 @@ struct zc_open_s
|
|||||||
/* Zero cross event notification information */
|
/* Zero cross event notification information */
|
||||||
|
|
||||||
pid_t do_pid;
|
pid_t do_pid;
|
||||||
struct zc_notify_s do_notify;
|
struct sigevent do_event;
|
||||||
};
|
};
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -204,14 +204,8 @@ static void zerocross_interrupt(FAR const struct zc_lowerhalf_s *lower,
|
|||||||
{
|
{
|
||||||
/* Signal the waiter */
|
/* Signal the waiter */
|
||||||
|
|
||||||
#ifdef CONFIG_CAN_PASS_STRUCTS
|
opriv->do_event.sigev_value.sival_int = sample;
|
||||||
union sigval value;
|
nxsig_notification(opriv->do_pid, &opriv->do_event, SI_QUEUE);
|
||||||
value.sival_int = (int)sample;
|
|
||||||
(void)nxsig_queue(opriv->do_pid, opriv->do_notify.zc_signo, value);
|
|
||||||
#else
|
|
||||||
(void)nxsig_queue(opriv->do_pid, opriv->do_notify.zc_signo,
|
|
||||||
(FAR void *)sample);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
leave_critical_section(flags);
|
leave_critical_section(flags);
|
||||||
@ -229,7 +223,6 @@ static int zc_open(FAR struct file *filep)
|
|||||||
{
|
{
|
||||||
FAR struct inode *inode;
|
FAR struct inode *inode;
|
||||||
FAR struct zc_upperhalf_s *priv;
|
FAR struct zc_upperhalf_s *priv;
|
||||||
FAR const struct zc_lowerhalf_s *lower;
|
|
||||||
FAR struct zc_open_s *opriv;
|
FAR struct zc_open_s *opriv;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@ -412,7 +405,6 @@ static int zc_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
|||||||
FAR struct inode *inode;
|
FAR struct inode *inode;
|
||||||
FAR struct zc_upperhalf_s *priv;
|
FAR struct zc_upperhalf_s *priv;
|
||||||
FAR struct zc_open_s *opriv;
|
FAR struct zc_open_s *opriv;
|
||||||
FAR struct zc_lowerhalf_s *lower;
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
sninfo("cmd: %d arg: %ld\n", cmd, arg);
|
sninfo("cmd: %d arg: %ld\n", cmd, arg);
|
||||||
@ -447,15 +439,15 @@ static int zc_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
|||||||
|
|
||||||
case ZCIOC_REGISTER:
|
case ZCIOC_REGISTER:
|
||||||
{
|
{
|
||||||
FAR struct zc_notify_s *notify =
|
FAR struct sigevent *event =
|
||||||
(FAR struct zc_notify_s *)((uintptr_t)arg);
|
(FAR struct sigevent *)((uintptr_t)arg);
|
||||||
|
|
||||||
if (notify)
|
if (event)
|
||||||
{
|
{
|
||||||
/* Save the notification events */
|
/* Save the notification events */
|
||||||
|
|
||||||
opriv->do_notify.zc_signo = notify->zc_signo;
|
opriv->do_event = *event;
|
||||||
opriv->do_pid = getpid();
|
opriv->do_pid = getpid();
|
||||||
|
|
||||||
/* Enable/disable interrupt handling */
|
/* Enable/disable interrupt handling */
|
||||||
|
|
||||||
|
@ -44,7 +44,6 @@
|
|||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <semaphore.h>
|
#include <semaphore.h>
|
||||||
#include <signal.h>
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
@ -76,9 +75,8 @@ struct oneshot_dev_s
|
|||||||
|
|
||||||
/* Oneshot timer expiration notification information */
|
/* Oneshot timer expiration notification information */
|
||||||
|
|
||||||
uint8_t od_signo; /* Signal number for notification */
|
struct sigevent od_event; /* Signal info */
|
||||||
pid_t od_pid; /* PID to be notified */
|
pid_t od_pid; /* PID to be notified */
|
||||||
FAR void *od_arg; /* Signal value argument */
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -129,29 +127,21 @@ static void oneshot_callback(FAR struct oneshot_lowerhalf_s *lower,
|
|||||||
FAR void *arg)
|
FAR void *arg)
|
||||||
{
|
{
|
||||||
FAR struct oneshot_dev_s *priv = (FAR struct oneshot_dev_s *)arg;
|
FAR struct oneshot_dev_s *priv = (FAR struct oneshot_dev_s *)arg;
|
||||||
#ifdef CONFIG_CAN_PASS_STRUCTS
|
|
||||||
union sigval value;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
DEBUGASSERT(priv != NULL);
|
DEBUGASSERT(priv != NULL);
|
||||||
|
|
||||||
/* Signal the waiter.. if there is one */
|
/* Signal the waiter.. if there is one */
|
||||||
|
|
||||||
#ifdef CONFIG_CAN_PASS_STRUCTS
|
nxsig_notification(priv->od_pid, &priv->od_event, SI_QUEUE);
|
||||||
value.sival_ptr = priv->od_arg;
|
|
||||||
(void)nxsig_queue(priv->od_pid, priv->od_signo, value);
|
|
||||||
#else
|
|
||||||
(void)nxsig_queue(priv->od_pid, priv->od_signo, priv->od_arg);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************************
|
/****************************************************************************
|
||||||
* Name: oneshot_open
|
* Name: oneshot_open
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This function is called whenever the PWM device is opened.
|
* This function is called whenever the PWM device is opened.
|
||||||
*
|
*
|
||||||
************************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static int oneshot_open(FAR struct file *filep)
|
static int oneshot_open(FAR struct file *filep)
|
||||||
{
|
{
|
||||||
@ -160,13 +150,13 @@ static int oneshot_open(FAR struct file *filep)
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************************
|
/****************************************************************************
|
||||||
* Name: oneshot_close
|
* Name: oneshot_close
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This function is called when the PWM device is closed.
|
* This function is called when the PWM device is closed.
|
||||||
*
|
*
|
||||||
************************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static int oneshot_close(FAR struct file *filep)
|
static int oneshot_close(FAR struct file *filep)
|
||||||
{
|
{
|
||||||
@ -175,15 +165,16 @@ static int oneshot_close(FAR struct file *filep)
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************************
|
/****************************************************************************
|
||||||
* Name: oneshot_read
|
* Name: oneshot_read
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* A dummy read method. This is provided only to satsify the VFS layer.
|
* A dummy read method. This is provided only to satsify the VFS layer.
|
||||||
*
|
*
|
||||||
************************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static ssize_t oneshot_read(FAR struct file *filep, FAR char *buffer, size_t buflen)
|
static ssize_t oneshot_read(FAR struct file *filep, FAR char *buffer,
|
||||||
|
size_t buflen)
|
||||||
{
|
{
|
||||||
/* Return zero -- usually meaning end-of-file */
|
/* Return zero -- usually meaning end-of-file */
|
||||||
|
|
||||||
@ -192,13 +183,13 @@ static ssize_t oneshot_read(FAR struct file *filep, FAR char *buffer, size_t buf
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************************
|
/****************************************************************************
|
||||||
* Name: oneshot_write
|
* Name: oneshot_write
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* A dummy write method. This is provided only to satsify the VFS layer.
|
* A dummy write method. This is provided only to satsify the VFS layer.
|
||||||
*
|
*
|
||||||
************************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static ssize_t oneshot_write(FAR struct file *filep, FAR const char *buffer,
|
static ssize_t oneshot_write(FAR struct file *filep, FAR const char *buffer,
|
||||||
size_t buflen)
|
size_t buflen)
|
||||||
@ -210,13 +201,13 @@ static ssize_t oneshot_write(FAR struct file *filep, FAR const char *buffer,
|
|||||||
return -EPERM;
|
return -EPERM;
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************************
|
/****************************************************************************
|
||||||
* Name: oneshot_ioctl
|
* Name: oneshot_ioctl
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* The standard ioctl method. This is where ALL of the PWM work is done.
|
* The standard ioctl method. This is where ALL of the PWM work is done.
|
||||||
*
|
*
|
||||||
************************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static int oneshot_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
static int oneshot_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||||
{
|
{
|
||||||
@ -270,10 +261,9 @@ static int oneshot_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
|||||||
start = (FAR struct oneshot_start_s *)((uintptr_t)arg);
|
start = (FAR struct oneshot_start_s *)((uintptr_t)arg);
|
||||||
DEBUGASSERT(start != NULL);
|
DEBUGASSERT(start != NULL);
|
||||||
|
|
||||||
/* Save signalling information */
|
/* Save signaling information */
|
||||||
|
|
||||||
priv->od_signo = start->signo;
|
priv->od_event = start->event;
|
||||||
priv->od_arg = start->arg;
|
|
||||||
|
|
||||||
pid = start->pid;
|
pid = start->pid;
|
||||||
if (pid == 0)
|
if (pid == 0)
|
||||||
|
@ -58,9 +58,8 @@
|
|||||||
struct rtc_alarminfo_s
|
struct rtc_alarminfo_s
|
||||||
{
|
{
|
||||||
bool active; /* True: alarm is active */
|
bool active; /* True: alarm is active */
|
||||||
uint8_t signo; /* Signal number for alarm notification */
|
|
||||||
pid_t pid; /* Identifies task to be notified */
|
pid_t pid; /* Identifies task to be notified */
|
||||||
union sigval sigvalue; /* Data passed with notification */
|
struct sigevent event; /* Describe the way a task is to be notified */
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -197,13 +196,7 @@ static void rtc_alarm_callback(FAR void *priv, int alarmid)
|
|||||||
{
|
{
|
||||||
/* Yes.. signal the alarm expiration */
|
/* Yes.. signal the alarm expiration */
|
||||||
|
|
||||||
#ifdef CONFIG_CAN_PASS_STRUCTS
|
nxsig_notification(alarminfo->pid, &alarminfo->event, SI_QUEUE);
|
||||||
(void)nxsig_queue(alarminfo->pid, alarminfo->signo,
|
|
||||||
alarminfo->sigvalue);
|
|
||||||
#else
|
|
||||||
(void)nxsig_queue(alarminfo->pid, alarminfo->signo,
|
|
||||||
alarminfo->sigvalue->sival_ptr);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The alarm is no longer active */
|
/* The alarm is no longer active */
|
||||||
@ -234,13 +227,7 @@ static void rtc_periodic_callback(FAR void *priv, int alarmid)
|
|||||||
{
|
{
|
||||||
/* Yes.. signal the alarm expiration */
|
/* Yes.. signal the alarm expiration */
|
||||||
|
|
||||||
#ifdef CONFIG_CAN_PASS_STRUCTS
|
nxsig_notification(alarminfo->pid, &alarminfo->event, SI_QUEUE);
|
||||||
(void)nxsig_queue(alarminfo->pid, alarminfo->signo,
|
|
||||||
alarminfo->sigvalue);
|
|
||||||
#else
|
|
||||||
(void)nxsig_queue(alarminfo->pid, alarminfo->signo,
|
|
||||||
alarminfo->sigvalue->sival_ptr);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The alarm is no longer active */
|
/* The alarm is no longer active */
|
||||||
@ -326,7 +313,8 @@ static ssize_t rtc_read(FAR struct file *filep, FAR char *buffer, size_t len)
|
|||||||
* Name: rtc_write
|
* Name: rtc_write
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static ssize_t rtc_write(FAR struct file *filep, FAR const char *buffer, size_t len)
|
static ssize_t rtc_write(FAR struct file *filep, FAR const char *buffer,
|
||||||
|
size_t len)
|
||||||
{
|
{
|
||||||
return len; /* Say that everything was written */
|
return len; /* Say that everything was written */
|
||||||
}
|
}
|
||||||
@ -368,7 +356,8 @@ static int rtc_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
|||||||
|
|
||||||
case RTC_RD_TIME:
|
case RTC_RD_TIME:
|
||||||
{
|
{
|
||||||
FAR struct rtc_time *rtctime = (FAR struct rtc_time *)((uintptr_t)arg);
|
FAR struct rtc_time *rtctime =
|
||||||
|
(FAR struct rtc_time *)((uintptr_t)arg);
|
||||||
|
|
||||||
if (ops->rdtime)
|
if (ops->rdtime)
|
||||||
{
|
{
|
||||||
@ -464,9 +453,8 @@ static int rtc_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
upperinfo->active = true;
|
upperinfo->active = true;
|
||||||
upperinfo->signo = alarminfo->signo;
|
|
||||||
upperinfo->pid = pid;
|
upperinfo->pid = pid;
|
||||||
upperinfo->sigvalue = alarminfo->sigvalue;
|
upperinfo->event = alarminfo->event;
|
||||||
|
|
||||||
/* Format the alarm info needed by the lower half driver */
|
/* Format the alarm info needed by the lower half driver */
|
||||||
|
|
||||||
@ -488,8 +476,8 @@ static int rtc_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
|||||||
|
|
||||||
/* RTC_SET_RELATIVE sets the alarm time relative to the current time.
|
/* RTC_SET_RELATIVE sets the alarm time relative to the current time.
|
||||||
*
|
*
|
||||||
* Argument: A read-only reference to a struct rtc_setrelative_s containing the
|
* Argument: A read-only reference to a struct rtc_setrelative_s
|
||||||
* new relative alarm time to be set.
|
* containing the new relative alarm time to be set.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
case RTC_SET_RELATIVE:
|
case RTC_SET_RELATIVE:
|
||||||
@ -536,9 +524,8 @@ static int rtc_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
upperinfo->active = true;
|
upperinfo->active = true;
|
||||||
upperinfo->signo = alarminfo->signo;
|
|
||||||
upperinfo->pid = pid;
|
upperinfo->pid = pid;
|
||||||
upperinfo->sigvalue = alarminfo->sigvalue;
|
upperinfo->event = alarminfo->event;
|
||||||
|
|
||||||
/* Format the alarm info needed by the lower half driver */
|
/* Format the alarm info needed by the lower half driver */
|
||||||
|
|
||||||
@ -622,8 +609,8 @@ static int rtc_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
|||||||
#ifdef CONFIG_RTC_PERIODIC
|
#ifdef CONFIG_RTC_PERIODIC
|
||||||
/* RTC_SET_PERIODIC set a periodic wakeup.
|
/* RTC_SET_PERIODIC set a periodic wakeup.
|
||||||
*
|
*
|
||||||
* Argument: A read-only reference to a struct rtc_setperiodic_s containing the
|
* Argument: A read-only reference to a struct rtc_setperiodic_s
|
||||||
* new wakeup period to be set.
|
* containing the new wakeup period to be set.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
case RTC_SET_PERIODIC:
|
case RTC_SET_PERIODIC:
|
||||||
@ -670,9 +657,8 @@ static int rtc_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
upperinfo->active = true;
|
upperinfo->active = true;
|
||||||
upperinfo->signo = alarminfo->signo;
|
|
||||||
upperinfo->pid = pid;
|
upperinfo->pid = pid;
|
||||||
upperinfo->sigvalue = alarminfo->sigvalue;
|
upperinfo->event = alarminfo->event;
|
||||||
|
|
||||||
/* Format the alarm info needed by the lower half driver. */
|
/* Format the alarm info needed by the lower half driver. */
|
||||||
|
|
||||||
@ -802,7 +788,9 @@ int rtc_initialize(int minor, FAR struct rtc_lowerhalf_s *lower)
|
|||||||
|
|
||||||
/* Allocate an upper half container structure */
|
/* Allocate an upper half container structure */
|
||||||
|
|
||||||
upper = (FAR struct rtc_upperhalf_s *)kmm_zalloc(sizeof(struct rtc_upperhalf_s));
|
upper = (FAR struct rtc_upperhalf_s *)
|
||||||
|
kmm_zalloc(sizeof(struct rtc_upperhalf_s));
|
||||||
|
|
||||||
if (!upper)
|
if (!upper)
|
||||||
{
|
{
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
@ -163,8 +163,8 @@ struct xbeenet_driver_s
|
|||||||
/* MAC Service notification information */
|
/* MAC Service notification information */
|
||||||
|
|
||||||
bool xd_notify_registered;
|
bool xd_notify_registered;
|
||||||
uint8_t xd_notify_signo;
|
|
||||||
pid_t xd_notify_pid;
|
pid_t xd_notify_pid;
|
||||||
|
struct sigevent xd_notify_event;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -444,15 +444,9 @@ static int xbeenet_notify(FAR struct xbee_maccb_s *maccb,
|
|||||||
#ifndef CONFIG_DISABLE_SIGNALS
|
#ifndef CONFIG_DISABLE_SIGNALS
|
||||||
if (priv->xd_notify_registered)
|
if (priv->xd_notify_registered)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_CAN_PASS_STRUCTS
|
priv->xd_notify_event.sigev_value.sival_int = primitive->type;
|
||||||
union sigval value;
|
nxsig_notification(priv->xd_notify_pid, &priv->xd_notify_event,
|
||||||
value.sival_int = (int)primitive->type;
|
SI_QUEUE);
|
||||||
(void)nxsig_queue(priv->xd_notify_pid, priv->xd_notify_signo,
|
|
||||||
value);
|
|
||||||
#else
|
|
||||||
(void)nxsig_queue(priv->xd_notify_pid, priv->xd_notify_signo,
|
|
||||||
(FAR void *)primitive->type);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1053,7 +1047,7 @@ static int xbeenet_ioctl(FAR struct net_driver_s *dev, int cmd,
|
|||||||
{
|
{
|
||||||
/* Save the notification events */
|
/* Save the notification events */
|
||||||
|
|
||||||
priv->xd_notify_signo = netmac->u.signo;
|
priv->xd_notify_event = netmac->u.event;
|
||||||
priv->xd_notify_pid = getpid();
|
priv->xd_notify_pid = getpid();
|
||||||
priv->xd_notify_registered = true;
|
priv->xd_notify_registered = true;
|
||||||
ret = OK;
|
ret = OK;
|
||||||
|
@ -58,6 +58,8 @@
|
|||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
#include <nuttx/input/ioctl.h>
|
#include <nuttx/input/ioctl.h>
|
||||||
|
|
||||||
|
#include <signal.h>
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -187,7 +189,7 @@ struct ajoy_notify_s
|
|||||||
{
|
{
|
||||||
ajoy_buttonset_t an_press; /* Set of button depressions to be notified */
|
ajoy_buttonset_t an_press; /* Set of button depressions to be notified */
|
||||||
ajoy_buttonset_t an_release; /* Set of button releases to be notified */
|
ajoy_buttonset_t an_release; /* Set of button releases to be notified */
|
||||||
uint8_t an_signo; /* Signal number to use in the notification */
|
struct sigevent an_event; /* Describe the way a task is to be notified */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* This structure is returned by read() and provides the sample state of the
|
/* This structure is returned by read() and provides the sample state of the
|
||||||
|
@ -43,6 +43,8 @@
|
|||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
#include <nuttx/fs/ioctl.h>
|
#include <nuttx/fs/ioctl.h>
|
||||||
|
|
||||||
|
#include <signal.h>
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -118,7 +120,7 @@ struct btn_notify_s
|
|||||||
{
|
{
|
||||||
btn_buttonset_t bn_press; /* Set of button depressions to be notified */
|
btn_buttonset_t bn_press; /* Set of button depressions to be notified */
|
||||||
btn_buttonset_t bn_release; /* Set of button releases to be notified */
|
btn_buttonset_t bn_release; /* Set of button releases to be notified */
|
||||||
uint8_t bn_signo; /* Signal number to use in the notification */
|
struct sigevent bn_event; /* Describe the way a task is to be notified */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* This is the type of the button interrupt handler used with the struct
|
/* This is the type of the button interrupt handler used with the struct
|
||||||
|
@ -58,6 +58,8 @@
|
|||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
#include <nuttx/input/ioctl.h>
|
#include <nuttx/input/ioctl.h>
|
||||||
|
|
||||||
|
#include <signal.h>
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -186,7 +188,7 @@ struct djoy_notify_s
|
|||||||
{
|
{
|
||||||
djoy_buttonset_t dn_press; /* Set of button depressions to be notified */
|
djoy_buttonset_t dn_press; /* Set of button depressions to be notified */
|
||||||
djoy_buttonset_t dn_release; /* Set of button releases to be notified */
|
djoy_buttonset_t dn_release; /* Set of button releases to be notified */
|
||||||
uint8_t dn_signo; /* Signal number to use in the notification */
|
struct sigevent dn_event; /* Describe the way a task is to be notified */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* This is the type of the discrete joystick interrupt handler used with
|
/* This is the type of the discrete joystick interrupt handler used with
|
||||||
|
@ -58,6 +58,8 @@
|
|||||||
#include <nuttx/i2c/i2c_master.h>
|
#include <nuttx/i2c/i2c_master.h>
|
||||||
#include <nuttx/lcd/lcd_ioctl.h>
|
#include <nuttx/lcd/lcd_ioctl.h>
|
||||||
|
|
||||||
|
#include <signal.h>
|
||||||
|
|
||||||
#ifdef CONFIG_LCD_FT80X
|
#ifdef CONFIG_LCD_FT80X
|
||||||
|
|
||||||
/********************************************************************************************
|
/********************************************************************************************
|
||||||
@ -1636,9 +1638,9 @@ enum ft80x_notify_e
|
|||||||
|
|
||||||
struct ft80x_notify_s
|
struct ft80x_notify_s
|
||||||
{
|
{
|
||||||
int signo; /* Notify using this signal number */
|
|
||||||
pid_t pid; /* Send the notification to this task */
|
pid_t pid; /* Send the notification to this task */
|
||||||
enum ft80x_notify_e event; /* Notify on this event */
|
enum ft80x_notify_e id; /* Notify on this event */
|
||||||
|
struct sigevent event; /* Describe the way a task is to be notified */
|
||||||
bool enable; /* True: enable notification; false: disable */
|
bool enable; /* True: enable notification; false: disable */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -43,6 +43,8 @@
|
|||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
#include <nuttx/fs/ioctl.h>
|
#include <nuttx/fs/ioctl.h>
|
||||||
|
|
||||||
|
#include <signal.h>
|
||||||
|
|
||||||
#ifdef CONFIG_SENSORS_ZEROCROSS
|
#ifdef CONFIG_SENSORS_ZEROCROSS
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -56,7 +58,7 @@
|
|||||||
/* Command: ZCIOC_REGISTER
|
/* Command: ZCIOC_REGISTER
|
||||||
* Description: Register to receive a signal whenever there is zero cross
|
* Description: Register to receive a signal whenever there is zero cross
|
||||||
* interrupt event.
|
* interrupt event.
|
||||||
* Argument: A read-only pointer to an instance of struct zc_notify_s
|
* Argument: A read-only pointer to an instance of struct sigevent
|
||||||
* Return: Zero (OK) on success. Minus one will be returned on failure
|
* Return: Zero (OK) on success. Minus one will be returned on failure
|
||||||
* with the errno value set appropriately.
|
* with the errno value set appropriately.
|
||||||
*/
|
*/
|
||||||
@ -91,16 +93,6 @@ typedef CODE void (*zc_interrupt_t)
|
|||||||
* fields of the following generic lower half state structure.
|
* fields of the following generic lower half state structure.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* A reference to this structure is provided with the ZCIOC_REGISTER IOCTL
|
|
||||||
* command and describes the conditions under which the client would like
|
|
||||||
* to receive notification.
|
|
||||||
*/
|
|
||||||
|
|
||||||
struct zc_notify_s
|
|
||||||
{
|
|
||||||
uint8_t zc_signo; /* Signal number to use in the notification */
|
|
||||||
};
|
|
||||||
|
|
||||||
struct zc_lowerhalf_s
|
struct zc_lowerhalf_s
|
||||||
{
|
{
|
||||||
/* Enable interrupt on the defined pin used to zero cross detection */
|
/* Enable interrupt on the defined pin used to zero cross detection */
|
||||||
|
@ -43,6 +43,7 @@
|
|||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <signal.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
@ -223,10 +224,9 @@ struct oneshot_lowerhalf_s
|
|||||||
|
|
||||||
struct oneshot_start_s
|
struct oneshot_start_s
|
||||||
{
|
{
|
||||||
pid_t pid; /* PID of task to be signalled (0 means calling task) */
|
pid_t pid; /* PID of task to be signalled (0 means calling task) */
|
||||||
int signo; /* Signal number to use */
|
struct sigevent event; /* Describe the way a task is to be notified */
|
||||||
FAR void *arg; /* Signal value argument */
|
struct timespec ts; /* Delay until time expiration */
|
||||||
struct timespec ts; /* Delay until time expiration */
|
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -262,9 +262,8 @@ struct rtc_rdalarm_s
|
|||||||
struct rtc_setalarm_s
|
struct rtc_setalarm_s
|
||||||
{
|
{
|
||||||
uint8_t id; /* Indicates the alarm to be set */
|
uint8_t id; /* Indicates the alarm to be set */
|
||||||
uint8_t signo; /* Signal number for alarm notification */
|
|
||||||
pid_t pid; /* Identifies task to be notified (0=caller) */
|
pid_t pid; /* Identifies task to be notified (0=caller) */
|
||||||
union sigval sigvalue; /* Data passed with notification */
|
struct sigevent event; /* Describe the way a task is to be notified */
|
||||||
struct rtc_time time; /* Alarm time */
|
struct rtc_time time; /* Alarm time */
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -273,9 +272,8 @@ struct rtc_setalarm_s
|
|||||||
struct rtc_setrelative_s
|
struct rtc_setrelative_s
|
||||||
{
|
{
|
||||||
uint8_t id; /* Indicates the alarm to be set */
|
uint8_t id; /* Indicates the alarm to be set */
|
||||||
uint8_t signo; /* Signal number for alarm notification */
|
|
||||||
pid_t pid; /* Identifies task to be notified (0=caller) */
|
pid_t pid; /* Identifies task to be notified (0=caller) */
|
||||||
union sigval sigvalue; /* Data passed with notification */
|
struct sigevent event; /* Describe the way a task is to be notified */
|
||||||
time_t reltime; /* Relative time in seconds */
|
time_t reltime; /* Relative time in seconds */
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -322,9 +320,8 @@ struct lower_rdalarm_s
|
|||||||
struct rtc_setperiodic_s
|
struct rtc_setperiodic_s
|
||||||
{
|
{
|
||||||
uint8_t id; /* Indicates the alarm to be set */
|
uint8_t id; /* Indicates the alarm to be set */
|
||||||
uint8_t signo; /* Signal number for alarm notification */
|
|
||||||
pid_t pid; /* Identifies task to be notified (0=caller) */
|
pid_t pid; /* Identifies task to be notified (0=caller) */
|
||||||
union sigval sigvalue; /* Data passed with notification */
|
struct sigevent event; /* Describe the way a task is to be notified */
|
||||||
struct timespec period; /* Period between wakeups */
|
struct timespec period; /* Period between wakeups */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -48,6 +48,7 @@
|
|||||||
|
|
||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#include <signal.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
@ -1706,7 +1707,7 @@ union ieee802154_macarg_u
|
|||||||
/* To be determined */ /* MAC802154IOC_MLME_SOUNDING_REQUEST */
|
/* To be determined */ /* MAC802154IOC_MLME_SOUNDING_REQUEST */
|
||||||
/* To be determined */ /* MAC802154IOC_MLME_CALIBRATE_REQUEST */
|
/* To be determined */ /* MAC802154IOC_MLME_CALIBRATE_REQUEST */
|
||||||
|
|
||||||
uint8_t signo; /* MAC802154IOC_NOTIFY_REGISTER */
|
struct sigevent event; /* MAC802154IOC_NOTIFY_REGISTER */
|
||||||
struct ieee802154_primitive_s primitive; /* MAC802154IOC_GET_EVENT */
|
struct ieee802154_primitive_s primitive; /* MAC802154IOC_GET_EVENT */
|
||||||
bool enable; /* MAC802154IOC_ENABLE_EVENTS */
|
bool enable; /* MAC802154IOC_ENABLE_EVENTS */
|
||||||
};
|
};
|
||||||
|
@ -120,8 +120,8 @@ struct mac802154_chardevice_s
|
|||||||
/* MAC Service notification information */
|
/* MAC Service notification information */
|
||||||
|
|
||||||
bool md_notify_registered;
|
bool md_notify_registered;
|
||||||
uint8_t md_notify_signo;
|
|
||||||
pid_t md_notify_pid;
|
pid_t md_notify_pid;
|
||||||
|
struct sigevent md_notify_event;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
@ -624,7 +624,7 @@ static int mac802154dev_ioctl(FAR struct file *filep, int cmd,
|
|||||||
{
|
{
|
||||||
/* Save the notification events */
|
/* Save the notification events */
|
||||||
|
|
||||||
dev->md_notify_signo = macarg->signo;
|
dev->md_notify_event = macarg->event;
|
||||||
dev->md_notify_pid = getpid();
|
dev->md_notify_pid = getpid();
|
||||||
dev->md_notify_registered = true;
|
dev->md_notify_registered = true;
|
||||||
|
|
||||||
@ -766,16 +766,9 @@ static int mac802154dev_notify(FAR struct mac802154_maccb_s *maccb,
|
|||||||
#ifndef CONFIG_DISABLE_SIGNALS
|
#ifndef CONFIG_DISABLE_SIGNALS
|
||||||
if (dev->md_notify_registered)
|
if (dev->md_notify_registered)
|
||||||
{
|
{
|
||||||
|
dev->md_notify_event.sigev_value.sival_int = primitive->type;
|
||||||
#ifdef CONFIG_CAN_PASS_STRUCTS
|
nxsig_notification(dev->md_notify_pid, &dev->md_notify_event,
|
||||||
union sigval value;
|
SI_QUEUE);
|
||||||
value.sival_int = (int)primitive->type;
|
|
||||||
(void)nxsig_queue(dev->md_notify_pid, dev->md_notify_signo,
|
|
||||||
value);
|
|
||||||
#else
|
|
||||||
(void)nxsig_queue(dev->md_notify_pid, dev->md_notify_signo,
|
|
||||||
(FAR void *)primitive->type);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -163,8 +163,8 @@ struct macnet_driver_s
|
|||||||
/* MAC Service notification information */
|
/* MAC Service notification information */
|
||||||
|
|
||||||
bool md_notify_registered;
|
bool md_notify_registered;
|
||||||
uint8_t md_notify_signo;
|
|
||||||
pid_t md_notify_pid;
|
pid_t md_notify_pid;
|
||||||
|
struct sigevent md_notify_event;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -444,15 +444,9 @@ static int macnet_notify(FAR struct mac802154_maccb_s *maccb,
|
|||||||
#ifndef CONFIG_DISABLE_SIGNALS
|
#ifndef CONFIG_DISABLE_SIGNALS
|
||||||
if (priv->md_notify_registered)
|
if (priv->md_notify_registered)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_CAN_PASS_STRUCTS
|
priv->md_notify_event.sigev_value.sival_int = primitive->type;
|
||||||
union sigval value;
|
nxsig_notification(priv->md_notify_pid, &priv->md_notify_event,
|
||||||
value.sival_int = (int)primitive->type;
|
SI_QUEUE);
|
||||||
(void)nxsig_queue(priv->md_notify_pid, priv->md_notify_signo,
|
|
||||||
value);
|
|
||||||
#else
|
|
||||||
(void)nxsig_queue(priv->md_notify_pid, priv->md_notify_signo,
|
|
||||||
(FAR void *)primitive->type);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1053,7 +1047,7 @@ static int macnet_ioctl(FAR struct net_driver_s *dev, int cmd,
|
|||||||
{
|
{
|
||||||
/* Save the notification events */
|
/* Save the notification events */
|
||||||
|
|
||||||
priv->md_notify_signo = netmac->u.signo;
|
priv->md_notify_event = netmac->u.event;
|
||||||
priv->md_notify_pid = getpid();
|
priv->md_notify_pid = getpid();
|
||||||
priv->md_notify_registered = true;
|
priv->md_notify_registered = true;
|
||||||
ret = OK;
|
ret = OK;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user