wireless/ieee802154: Adds IOCTL definitions for accessing PHY layer
This commit is contained in:
parent
7a95cc62b4
commit
10d7baca10
@ -2,7 +2,9 @@
|
||||
* include/nuttx/wireless/ieee802154/ieee802154_radio.h
|
||||
*
|
||||
* Copyright (C) 2014-2016 Sebastien Lorquet. All rights reserved.
|
||||
* Copyright (C) 2017 Verge Inc. All rights reserved.
|
||||
* Author: Sebastien Lorquet <sebastien@lorquet.fr>
|
||||
* Author: Anthony Merlino <anthony@vergeaero.com>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@ -44,6 +46,8 @@
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <semaphore.h>
|
||||
#include <nuttx/fs/ioctl.h>
|
||||
#include <nuttx/wireless/ieee802154/ieee802154.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-Processor Definitions
|
||||
@ -62,18 +66,38 @@
|
||||
#define IEEE802154_MODE_COORD 0x01 /* avail in mrf24j40, but why? */
|
||||
#define IEEE802154_MODE_PANCOORD 0x02
|
||||
|
||||
/* IEEE 802.15.4 Radio Character Driver IOCTL ********************************/
|
||||
|
||||
#define PHY802154IOC_SET_CHAN _PHY802154IOC(0x0001)
|
||||
#define PHY802154IOC_GET_CHAN _PHY802154IOC(0x0002)
|
||||
|
||||
#define PHY802154IOC_SET_PANID _PHY802154IOC(0x0003)
|
||||
#define PHY802154IOC_GET_PANID _PHY802154IOC(0x0004)
|
||||
|
||||
#define PHY802154IOC_SET_SADDR _PHY802154IOC(0x0005)
|
||||
#define PHY802154IOC_GET_SADDR _PHY802154IOC(0x0006)
|
||||
|
||||
#define PHY802154IOC_SET_EADDR _PHY802154IOC(0x0007)
|
||||
#define PHY802154IOC_GET_EADDR _PHY802154IOC(0x0008)
|
||||
|
||||
#define PHY802154IOC_SET_PROMISC _PHY802154IOC(0x0009)
|
||||
#define PHY802154IOC_GET_PROMISC _PHY802154IOC(0x000A)
|
||||
|
||||
#define PHY802154IOC_SET_DEVMODE _PHY802154IOC(0x000B)
|
||||
#define PHY802154IOC_GET_DEVMODE _PHY802154IOC(0x000C)
|
||||
|
||||
#define PHY802154IOC_SET_TXPWR _PHY802154IOC(0x000D)
|
||||
#define PHY802154IOC_GET_TXPWR _PHY802154IOC(0x000E)
|
||||
|
||||
#define PHY802154IOC_SET_CCA _PHY802154IOC(0x000F)
|
||||
#define PHY802154IOC_GET_CCA _PHY802154IOC(0x0010)
|
||||
|
||||
#define PHY802154IOC_ENERGYDETECT _PHY802154IOC(0x0011)
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
struct ieee802154_packet_s
|
||||
{
|
||||
uint8_t len;
|
||||
uint8_t data[127];
|
||||
uint8_t lqi;
|
||||
uint8_t rssi;
|
||||
};
|
||||
|
||||
struct ieee802154_cca_s
|
||||
{
|
||||
uint8_t use_ed : 1; /* CCA using ED */
|
||||
|
@ -51,7 +51,6 @@
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/kmalloc.h>
|
||||
#include <nuttx/wireless/ieee802154/ieee802154_radio.h>
|
||||
#include <nuttx/ieee802154/ieee802154_dev.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
@ -383,78 +382,78 @@ static int radio802154dev_ioctl(FAR struct file *filep, int cmd,
|
||||
DEBUGASSERT(filep != NULL && filep->f_inode != NULL);
|
||||
inode = filep->f_inode;
|
||||
dev = inode->i_private;
|
||||
DEBUGASSERT(dev != NULL && dev->child != NULL;
|
||||
DEBUGASSERT(dev != NULL && dev->child != NULL);
|
||||
child = dev->child;
|
||||
|
||||
/* Get exclusive access to the driver data structures */
|
||||
|
||||
switch (cmd)
|
||||
{
|
||||
case MAC854IOCSCHAN:
|
||||
case PHY802154IOC_SET_CHAN:
|
||||
ret = child->ops->setchannel(child, (uint8_t)arg);
|
||||
break;
|
||||
|
||||
case MAC854IOCGCHAN:
|
||||
case PHY802154IOC_GET_CHAN:
|
||||
ret = child->ops->getchannel(child, (FAR uint8_t*)arg);
|
||||
break;
|
||||
|
||||
case MAC854IOCSPANID:
|
||||
case PHY802154IOC_SET_PANID:
|
||||
ret = child->ops->setpanid(child, (uint16_t)arg);
|
||||
break;
|
||||
|
||||
case MAC854IOCGPANID:
|
||||
case PHY802154IOC_GET_PANID:
|
||||
ret = child->ops->getpanid(child, (FAR uint16_t*)arg);
|
||||
break;
|
||||
|
||||
case MAC854IOCSSADDR:
|
||||
case PHY802154IOC_SET_SADDR:
|
||||
ret = child->ops->setsaddr(child, (uint16_t)arg);
|
||||
break;
|
||||
|
||||
case MAC854IOCGSADDR:
|
||||
case PHY802154IOC_GET_SADDR:
|
||||
ret = child->ops->getsaddr(child, (FAR uint16_t*)arg);
|
||||
break;
|
||||
|
||||
case MAC854IOCSEADDR:
|
||||
case PHY802154IOC_SET_EADDR:
|
||||
ret = child->ops->seteaddr(child, (FAR uint8_t*)arg);
|
||||
break;
|
||||
|
||||
case MAC854IOCGEADDR:
|
||||
case PHY802154IOC_GET_EADDR:
|
||||
ret = child->ops->geteaddr(child, (FAR uint8_t*)arg);
|
||||
break;
|
||||
|
||||
case MAC854IOCSPROMISC:
|
||||
case PHY802154IOC_SET_PROMISC:
|
||||
ret = child->ops->setpromisc(child, (bool)arg);
|
||||
break;
|
||||
|
||||
case MAC854IOCGPROMISC:
|
||||
case PHY802154IOC_GET_PROMISC:
|
||||
ret = child->ops->getpromisc(child, (FAR bool*)arg);
|
||||
break;
|
||||
|
||||
case MAC854IOCSDEVMODE:
|
||||
case PHY802154IOC_SET_DEVMODE:
|
||||
ret = child->ops->setdevmode(child, (uint8_t)arg);
|
||||
break;
|
||||
|
||||
case MAC854IOCGDEVMODE:
|
||||
case PHY802154IOC_GET_DEVMODE:
|
||||
ret = child->ops->getdevmode(child, (FAR uint8_t*)arg);
|
||||
break;
|
||||
|
||||
case MAC854IOCSTXP:
|
||||
case PHY802154IOC_SET_TXPWR:
|
||||
ret = child->ops->settxpower(child, (int32_t)arg);
|
||||
break;
|
||||
|
||||
case MAC854IOCGTXP:
|
||||
case PHY802154IOC_GET_TXPWR:
|
||||
ret = child->ops->gettxpower(child, (FAR int32_t*)arg);
|
||||
break;
|
||||
|
||||
case MAC854IOCSCCA:
|
||||
case PHY802154IOC_SET_CCA:
|
||||
ret = child->ops->setcca(child, (FAR struct ieee802154_cca_s*)arg);
|
||||
break;
|
||||
|
||||
case MAC854IOCGCCA:
|
||||
case PHY802154IOC_GET_CCA:
|
||||
ret = child->ops->getcca(child, (FAR struct ieee802154_cca_s*)arg);
|
||||
break;
|
||||
|
||||
case MAC854IOCGED:
|
||||
case PHY802154IOC_ENERGYDETECT:
|
||||
ret = child->ops->energydetect(child, (FAR uint8_t*)arg);
|
||||
break;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user