Skip to content
Snippets Groups Projects
Commit b7227f00 authored by Gregory Nutt's avatar Gregory Nutt
Browse files

Cosmetic changes, mostly to comments

parent 551b106e
No related branches found
No related tags found
No related merge requests found
......@@ -284,12 +284,12 @@ void inode_semgive(void)
*
****************************************************************************/
FAR struct inode *inode_search(const char **path,
FAR struct inode *inode_search(FAR const char **path,
FAR struct inode **peer,
FAR struct inode **parent,
const char **relpath)
FAR const char **relpath)
{
const char *name = *path + 1; /* Skip over leading '/' */
FAR const char *name = *path + 1; /* Skip over leading '/' */
FAR struct inode *node = root_inode;
FAR struct inode *left = NULL;
FAR struct inode *above = NULL;
......
......@@ -56,7 +56,7 @@
****************************************************************************/
/* Configuration ************************************************************
*
* CONFIG_AUDIO_WM8904 - Enabled WM8904 support
* CONFIG_AUDIO_WM8904 - Enables WM8904 support
* CONFIG_WM8904_INITVOLUME - The initial volume level in the range {0..1000}
* CONFIG_WM8904_INFLIGHT - Maximum number of buffers that the WM8904 driver
* will send to the I2S driver before any have completed.
......@@ -161,14 +161,14 @@ struct wm8904_lower_s
* interrupts should be configured on both rising and falling edges
* so that contact and loss-of-contact events can be detected.
*
* attach - Attach or detacth the WM8904 interrupt handler to the GPIO
* attach - Attach or detach the WM8904 interrupt handler to the GPIO
* interrupt
* enable - Enable or disable the GPIO interrupt
*/
int (*attach)(FAR const struct wm8904_lower_s *lower, wm8904_handler_t isr,
FAR void *arg);
void (*enable)(FAR const struct wm8904_lower_s *lower, bool enable);
CODE int (*attach)(FAR const struct wm8904_lower_s *lower,
wm8904_handler_t isr, FAR void *arg);
CODE void (*enable)(FAR const struct wm8904_lower_s *lower, bool enable);
};
/****************************************************************************
......
......@@ -251,9 +251,10 @@
#undef EXTERN
#if defined(__cplusplus)
#define EXTERN extern "C"
extern "C" {
extern "C"
{
#else
#define EXTERN extern
# define EXTERN extern
#endif
struct cc1101_dev_s;
......@@ -318,7 +319,7 @@ struct c1101_rfsettings_s
* RF Configuration Database
****************************************************************************/
// \todo Recalculate ERP in maximum power level
/* TODO Recalculate ERP in maximum power level */
/* 868 MHz, GFSK, 100 kbps, ISM Region 1 (Europe only)
*
......@@ -371,90 +372,124 @@ EXTERN const struct c1101_rfsettings_s cc1101_rfsettings_ISM2_905MHzGFSK250kbps;
* Public Function Prototypes
****************************************************************************/
/** Initialize Chipcon CC1101 Chip.
/****************************************************************************
* Initialize Chipcon CC1101 Chip.
* After initialization CC1101 is ready to listen, receive and transmit
* messages on the default channel 0 at given RF configuration.
*
* \param spi SPI Device Structure
* \param isrpin Select the CC1101_PIN_GDOx used to signal interrupts
* \param rfsettings Pointer to default RF Settings loaded at boot time.
* \return Pointer to newly allocated CC1101 structure or NULL on error with errno set.
* Input Parameters:
* spi SPI Device Structure
* isrpin Select the CC1101_PIN_GDOx used to signal interrupts
* rfsettings Pointer to default RF Settings loaded at boot time.
*
* Returned Value:
* Pointer to newly allocated CC1101 structure or NULL on error with errno
* set.
*
* Possible errno as set by this function on error:
* - ENODEV: When device addressed is not compatible or it is not a CC1101
* - EFAULT: When there is no device
* - ENOMEM: Out of kernel memory to allocate the device
* - EBUSY: When device is already addressed by other device driver (not yet supported by low-level driver)
**/
* - EBUSY: When device is already addressed by other device driver (not yet
* supported by low-level driver)
*
****************************************************************************/
struct cc1101_dev_s * cc1101_init(struct spi_dev_s * spi, uint8_t isrpin,
uint32_t pinset, const struct c1101_rfsettings_s * rfsettings);
/** Deinitialize Chipcon CC1101 Chip
/****************************************************************************
** Deinitialize Chipcon CC1101 Chip
*
* \param dev Device to CC1101 device structure, as returned by the cc1101_init()
* \return OK On success
* Input Parameters:
* dev Device to CC1101 device structure, as returned by the cc1101_init()
*
**/
* Returned Value:
* OK On success
*
****************************************************************************/
int cc1101_deinit(struct cc1101_dev_s * dev);
/** Power up device, start conversion. \return Zero on success. */
/****************************************************************************
* Power up device, start conversion. Returns zero on success.
****************************************************************************/
int cc1101_powerup(struct cc1101_dev_s * dev);
/** Power down device, stop conversion. \return Zero on success. */
/****************************************************************************
* Power down device, stop conversion. Returns zero on success.
****************************************************************************/
int cc1101_powerdown(struct cc1101_dev_s * dev);
/** Set Multi Purpose Output Function. \return Zero on success. */
/****************************************************************************
* Set Multi Purpose Output Function. Returns zero on success.
****************************************************************************/
int cc1101_setgdo(struct cc1101_dev_s * dev, uint8_t pin, uint8_t function);
/** Set RF settings. Use one from the database above. */
/****************************************************************************
* Set RF settings. Use one from the database above.
****************************************************************************/
int cc1101_setrf(struct cc1101_dev_s * dev, const struct c1101_rfsettings_s *settings);
int cc1101_setrf(struct cc1101_dev_s * dev,
const struct c1101_rfsettings_s *settings);
/** Set Channel.
/****************************************************************************
* Set Channel.
* Note that regulatory check is made and sending may be prohibited.
*
* \retval 0 On success, sending and receiving is allowed.
* \retval 1 Only receive mode is allowed.
* \retval <0 On error.
*/
* Returned Value:
* 0 On success, sending and receiving is allowed.
* 1 Only receive mode is allowed.
* <0 On error.
*
****************************************************************************/
int cc1101_setchannel(struct cc1101_dev_s * dev, uint8_t channel);
/** Set Output Power
/****************************************************************************
* Set Output Power
*
* \param power Value from 0 - 8, where 0 means power off, and values
* Input Parameters:
* power Value from 0 - 8, where 0 means power off, and values
* from 1 .. 8 denote the following output power in dBm:
* {-30, -20, -15, -10, -5, 0, 5, 10} [dBm]
*
* If power is above the regulatory limit (defined by the RF settings)
* it is limited.
*
* \return Actual output power in range from 0..8.
*/
* Returned Value:
* Actual output power in range from 0..8.
*
****************************************************************************/
uint8_t cc1101_setpower(struct cc1101_dev_s * dev, uint8_t power);
/** Convert RSSI as obtained from CC1101 to [dBm] */
/****************************************************************************
* Convert RSSI as obtained from CC1101 to [dBm] */
int cc1101_calcRSSIdBm(int rssi);
/** Enter receive mode and wait for a packet.
/****************************************************************************
* Enter receive mode and wait for a packet.
* If transmission is in progress, receive mode is entered upon its
* completion. As long cc1101_idle() is not called, each transmission
* returns to receive mode.
*
* \param dev Device to CC1101 structure
* \return Zero on success.
*/
* Input Parameters:
* dev Device to CC1101 structure
*
* Returned Value:
* Zero on success.
*
****************************************************************************/
int cc1101_receive(struct cc1101_dev_s * dev);
/** Read received packet
/****************************************************************************
* Read received packet
*
* If size of buffer is too small then the remaining part of data can
* be discarded by the driver.
......@@ -470,33 +505,45 @@ int cc1101_receive(struct cc1101_dev_s * dev);
*
* NOTE: messages length are typically defined by the MAC, transmit/
* receive windows at some rate.
*/
*
****************************************************************************/
int cc1101_read(struct cc1101_dev_s * dev, uint8_t * buf, size_t size);
/** Write data to be send, using the cc1101_send()
/****************************************************************************
* Write data to be send, using the cc1101_send()
*
* \param dev Device to CC1101 structure
* \param buf Pointer to data.
* \param size Size must be within limits, otherwise data is truncated.
* Present driver limitation supports a single cc1101_write()
* prioer cc1101_send() is called.
*/
* Input Parameters:
* dev Device to CC1101 structure
* buf Pointer to data.
* size Size must be within limits, otherwise data is truncated.
* Present driver limitation supports a single cc1101_write()
* prioer cc1101_send() is called.
*
****************************************************************************/
int cc1101_write(struct cc1101_dev_s * dev, const uint8_t * buf, size_t size);
/** Send data previously writtenusing cc1101_write()
/****************************************************************************
* Send data previously written using cc1101_write()
*
* \param dev Device to CC1101 structure
* \return Zero on success.
*/
* Input Parameters:
* dev Device to CC1101 structure
*
* Returned Value:
* Zero on success.
*
****************************************************************************/
int cc1101_send(struct cc1101_dev_s * dev);
/** Enter idle state (after reception and transmission completes).
/****************************************************************************
* Enter idle state (after reception and transmission completes).
*
* \return Zero on success.
*/
* Returned Value:
* Zero on success.
*
****************************************************************************/
int cc1101_idle(struct cc1101_dev_s * dev);
......
......@@ -209,219 +209,306 @@ struct nrf24l01_config_s
* Public Functions
************************************************************************************/
/** Register the nRF24L01+ device.
/************************************************************************************
* Register the nRF24L01+ device.
*
* Input Parmeters:
* spi - SPI Device structure
* cfg Board specific configuration info
*
* \param spi SPI Device structure
* \param cfg Board specific configuration info
* \return Pointer to newly allocated nrf24l01 device structure or NULL on error (errno is set accordingly in this case).
* Returned Value:
* Pointer to newly allocated nrf24l01 device structure or NULL on error
* (errno is set accordingly in this case).
*
* Possible errors:
* - ENOMEM: Out of kernel memory to allocate the device
**/
*
************************************************************************************/
int nrf24l01_register(FAR struct spi_dev_s *spi, FAR struct nrf24l01_config_s *cfg);
/** Initialize the nRF24L01+ chip to a default initial state.
/************************************************************************************
* Initialize the nRF24L01+ chip to a default initial state.
*
* \param dev Pointer to a registered nRF24L01 device structure
**/
* Input Parmeters:
* dev Pointer to a registered nRF24L01 device structure
*
************************************************************************************/
int nrf24l01_init(FAR struct nrf24l01_dev_s *dev);
/** Get a pointer to the registered device
*/
/************************************************************************************
* Get a pointer to the registered device
************************************************************************************/
FAR struct nrf24l01_dev_s * nrf24l01_getinstance(void);
/** Set the default TX address.
/************************************************************************************
* Set the default TX address.
*
* Input Parmeters:
* dev Pointer to an nRF24L01 device structure
* addr TX address (LSByte first)
*
* \param dev Pointer to an nRF24L01 device structure
* \param addr TX address (LSByte first)
* Returned Value:
* 0
*
* \return 0
**/
************************************************************************************/
int nrf24l01_settxaddr(FAR struct nrf24l01_dev_s *dev, FAR const uint8_t *addr);
/** Get the default TX address.
/************************************************************************************
* Get the default TX address.
*
* Input Parmeters:
* dev Pointer to an nRF24L01 device structure
* addr TX address (LSByte first)
*
* \param dev Pointer to an nRF24L01 device structure
* \param addr TX address (LSByte first)
* Returned Value:
* 0
*
* \return 0
**/
************************************************************************************/
int nrf24l01_gettxaddr(FAR struct nrf24l01_dev_s *dev, FAR uint8_t *addr);
/** Configure auto-retransmit
/************************************************************************************
* Configure auto-retransmit
*
* Input Parmeters:
* dev Pointer to an nRF24L01 device structure
* retrdelay Auto-retransmit delay
* retrcount Auto-retransmit count (0 - 15)
*
* Returned Value:
* 0
*
* \param dev Pointer to an nRF24L01 device structure
* \param retrdelay Auto-retransmit delay
* \param retrcount Auto-retransmit count (0 - 15)
* \return 0
**/
************************************************************************************/
int nrf24l01_setretransmit(FAR struct nrf24l01_dev_s *dev, nrf24l01_retransmit_delay_t retrdelay, uint8_t retrcount);
int nrf24l01_setretransmit(FAR struct nrf24l01_dev_s *dev,
nrf24l01_retransmit_delay_t retrdelay, uint8_t retrcount);
/** Configure a RX pipe.
/************************************************************************************
* Configure a RX pipe.
*
* Input Parmeters:
* dev Pointer to an nRF24L01 device structure
* pipeno Pipe number to configure
* pipecfg Pointer to configuration data
*
* \param dev Pointer to an nRF24L01 device structure
* \param pipeno Pipe number to configure
* \param pipecfg Pointer to configuration data
* Returned Value:
* 0
*
* \return 0
**/
************************************************************************************/
int nrf24l01_setpipeconfig(FAR struct nrf24l01_dev_s *dev, unsigned int pipeno,
FAR const nrf24l01_pipecfg_t *pipecfg);
/** Get pipe configuration.
/************************************************************************************
* Get pipe configuration.
*
* \param dev Pointer to an nRF24L01 device structure
* \param pipeno Pipe number to configure
* \param pipecfg Pointer to configuration data used to store the config
* Input Parmeters:
* dev Pointer to an nRF24L01 device structure
* pipeno Pipe number to configure
* pipecfg Pointer to configuration data used to store the config
*
* \return 0
**/
* Returned Value:
* 0
*
************************************************************************************/
int nrf24l01_getpipeconfig(FAR struct nrf24l01_dev_s *dev, unsigned int pipeno,
FAR nrf24l01_pipecfg_t *pipecfg);
/** Enable a RX pipe.
/************************************************************************************
* Enable a RX pipe.
*
* Input Parmeters:
* dev Pointer to an nRF24L01 device structure
* pipeno Pipe number
* enable true to enable the pipe, false to disable it
*
* \param dev Pointer to an nRF24L01 device structure
* \param pipeno Pipe number
* \param enable true to enable the pipe, false to disable it
* Returned Value:
* 0
*
* \return 0
**/
************************************************************************************/
int nrf24l01_enablepipe(FAR struct nrf24l01_dev_s *dev, unsigned int pipeno, bool enable);
int nrf24l01_enablepipe(FAR struct nrf24l01_dev_s *dev, unsigned int pipeno,
bool enable);
/** Configure RF.
/************************************************************************************
* Configure RF.
*
* Input Parmeters:
* dev Pointer to an nRF24L01 device structure
* datarate Datarate
* outpower Output power
*
* \param dev Pointer to an nRF24L01 device structure
* \param datarate Datarate
* \param outpower Output power
* Returned Value:
* 0
*
* \return 0
**/
************************************************************************************/
int nrf24l01_setuprf(FAR struct nrf24l01_dev_s *dev, nrf24l01_datarate_t datarate,
int outpower);
/** Configure the TX output power.
/************************************************************************************
* Configure the TX output power.
*
* Note that hardware supports only -18, -12, -6 and 0 dBm values.
*
* \param dev Pointer to an nRF24L01 device structure
* \param outpower Output power (in dBm).
* Input Parmeters:
* dev Pointer to an nRF24L01 device structure
* outpower Output power (in dBm).
*
* \return 0
**/
* Returned Value:
* 0
*
************************************************************************************/
int nrf24l01_settxpower(FAR struct nrf24l01_dev_s *dev, int outpower);
/** Get the current TX output power.
/************************************************************************************
* Get the current TX output power.
*
* Note that hardware supports only -18, -12, -6 and 0 dBm values.
*
* \param dev Pointer to an nRF24L01 device structure
* \return outpower Output power (in dBm)
**/
* Input Parmeters:
* dev Pointer to an nRF24L01 device structure
*
* Returned Value:
* outpower Output power (in dBm)
*
************************************************************************************/
int nrf24l01_gettxpower(FAR struct nrf24l01_dev_s *dev);
/** Set transmission data rate
* \param dev Pointer to an nRF24L01 device structure
* \return datarate Data rate
**/
/************************************************************************************
* Set transmission data rate
*
* Input Parmeters:
* dev Pointer to an nRF24L01 device structure
*
* Returned Value:
* datarate Data rate
*
************************************************************************************/
int nrf24l01_setdatarate(FAR struct nrf24l01_dev_s *dev, nrf24l01_datarate_t datarate);
int nrf24l01_setdatarate(FAR struct nrf24l01_dev_s *dev,
nrf24l01_datarate_t datarate);
/** Set radio frequency.
/************************************************************************************
* Set radio frequency.
*
* \param dev Pointer to an nRF24L01 device structure
* \param freq New frequency value (in Mhz: 2400 to 2525)
* Input Parmeters:
* dev Pointer to an nRF24L01 device structure
* freq New frequency value (in Mhz: 2400 to 2525)
*
* \return OK
**/
* Returned Value:
* OK
*
************************************************************************************/
int nrf24l01_setradiofreq(FAR struct nrf24l01_dev_s *dev, uint32_t freq);
/** Get current radio frequency.
/************************************************************************************
* Get current radio frequency.
*
* \param dev Pointer to an nRF24L01 device structure
* Input Parmeters:
* dev Pointer to an nRF24L01 device structure
*
* \return Radio frequency (in Mhz)
**/
* Returned Value:
* Radio frequency (in Mhz)
*
************************************************************************************/
uint32_t nrf24l01_getradiofreq(FAR struct nrf24l01_dev_s *dev);
/** Configure address length.
/************************************************************************************
* Configure address length.
*
* Input Parmeters:
* dev Pointer to an nRF24L01 device structure
* width Address width to use (3-5)
*
* \param dev Pointer to an nRF24L01 device structure
* \param width Address width to use (3-5)
* \return 0
**/
* Returned Value:
* 0
*
************************************************************************************/
int nrf24l01_setaddrwidth(FAR struct nrf24l01_dev_s *dev, uint32_t width);
/** Change the current lifecycle state of the nRF24L01+ chip.
/************************************************************************************
* Change the current lifecycle state of the nRF24L01+ chip.
*
* Input Parmeters:
* dev Pointer to an nRF24L01 device structure
* state New state to put the nRF24L01 module into
*
* \param dev Pointer to an nRF24L01 device structure
* \param state New state to put the nRF24L01 module into
**/
************************************************************************************/
int nrf24l01_changestate(FAR struct nrf24l01_dev_s *dev, nrf24l01_state_t state);
/** Send data to the default address.
/************************************************************************************
* Send data to the default address.
*
* Input Parmeters:
* dev Pointer to an nRF24L01 device structure
* data Pointer on the data buffer
* datalen Length of the buffer (in bytes)
*
* \param dev Pointer to an nRF24L01 device structure
* \param data Pointer on the data buffer
* \param datalen Length of the buffer (in bytes)
* Returned Value:
*
* \return
**/
************************************************************************************/
int nrf24l01_send(FAR struct nrf24l01_dev_s *dev, FAR const uint8_t *data, size_t datalen);
int nrf24l01_send(FAR struct nrf24l01_dev_s *dev, FAR const uint8_t *data,
size_t datalen);
/** Send data to the specified address.
/************************************************************************************
* Send data to the specified address.
*
* \param dev Pointer to an nRF24L01 device structure
* \param data Pointer on the data buffer
* \param datalen Length of the buffer (in bytes)
* \param destaddr Destination address
* Input Parmeters:
* dev Pointer to an nRF24L01 device structure
* data Pointer on the data buffer
* datalen Length of the buffer (in bytes)
* destaddr Destination address
*
* \return
**/
* Returned Value:
*
************************************************************************************/
int nrf24l01_sendto(FAR struct nrf24l01_dev_s *dev, FAR const uint8_t *data,
size_t datalen, FAR const uint8_t *destaddr);
/** Get the retransmits count of the last transmission.
/************************************************************************************
* Get the retransmits count of the last transmission.
* This value is meaningful only if auto-acknowledge is enabled.
*
* \param dev Pointer to an nRF24L01 device structure
* \return Retransmit count, or NRF24L01_XMIT_MAXRT if no ACK received (transmission failure)
*/
* Input Parmeters:
* dev Pointer to an nRF24L01 device structure
*
* Returned Value:
* Retransmit count, or NRF24L01_XMIT_MAXRT if no ACK received (transmission
* failure)
*
************************************************************************************/
int nrf24l01_xmitcount(FAR struct nrf24l01_dev_s *dev);
#ifdef CONFIG_WL_NRF24L01_RXSUPPORT
/** Read the next received frame.
/************************************************************************************
* Read the next received frame.
*
* \param dev Pointer to an nRF24L01 device structure
* \param buffer Pointer on buffer used to store the received frame bytes
* \param buflen Length of the buffer (in bytes)
* \param recvpipe Pointer to a byte value used to store the pipe number of the frame
* dev Pointer to an nRF24L01 device structure
* buffer Pointer on buffer used to store the received frame bytes
* buflen Length of the buffer (in bytes)
* recvpipe Pointer to a byte value used to store the pipe number of the frame
* (use NULL if the pipe number info is not required)
*
* \return Length of the actual data
**/
* Returned Value:
* Length of the actual data
*
************************************************************************************/
ssize_t nrf24l01_recv(struct nrf24l01_dev_s *dev, uint8_t *buffer,
size_t buflen, uint8_t *recvpipe);
......
......@@ -107,8 +107,8 @@ int work_cancel(int qid, FAR struct work_s *work)
{
/* A little test of the integrity of the work queue */
DEBUGASSERT(work->dq.flink ||(FAR dq_entry_t *)work == wqueue->q.tail);
DEBUGASSERT(work->dq.blink ||(FAR dq_entry_t *)work == wqueue->q.head);
DEBUGASSERT(work->dq.flink || (FAR dq_entry_t *)work == wqueue->q.tail);
DEBUGASSERT(work->dq.blink || (FAR dq_entry_t *)work == wqueue->q.head);
/* Remove the entry from the work queue and make sure that it is
* mark as availalbe (i.e., the worker field is nullified).
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment