nuttx: Add missing FAR and CODE

Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
This commit is contained in:
Petro Karashchenko 2023-01-27 00:51:53 +02:00 committed by Xiang Xiao
parent e0cb643545
commit 8e72b07a62
5 changed files with 121 additions and 98 deletions

View file

@ -186,7 +186,8 @@ static int axp202_putreg8(FAR struct axp202_dev_s *priv, uint8_t regaddr,
return OK;
}
static int axp202_state(struct battery_charger_dev_s *dev, int *status)
static int axp202_state(FAR struct battery_charger_dev_s *dev,
FAR int *status)
{
FAR struct axp202_dev_s *priv = (FAR struct axp202_dev_s *)dev;
uint8_t val = 0;
@ -284,7 +285,8 @@ static int axp202_health(FAR struct battery_charger_dev_s *dev,
*
****************************************************************************/
static int axp202_online(struct battery_charger_dev_s *dev, bool *status)
static int axp202_online(FAR struct battery_charger_dev_s *dev,
FAR bool *status)
{
FAR struct axp202_dev_s *priv = (FAR struct axp202_dev_s *)dev;
uint8_t val = 0;

View file

@ -464,7 +464,7 @@ static ssize_t bat_charger_poll(FAR struct file *filep,
****************************************************************************/
int battery_charger_changed(FAR struct battery_charger_dev_s *dev,
uint32_t mask)
uint32_t mask)
{
FAR struct battery_charger_priv_s *priv;
int ret;

View file

@ -200,27 +200,30 @@ struct file_operations
{
/* The device driver open method differs from the mountpoint open method */
int (*open)(FAR struct file *filep);
CODE int (*open)(FAR struct file *filep);
/* The following methods must be identical in signature and position
* because the struct file_operations and struct mountpt_operations are
* treated like unions.
*/
int (*close)(FAR struct file *filep);
ssize_t (*read)(FAR struct file *filep, FAR char *buffer, size_t buflen);
ssize_t (*write)(FAR struct file *filep, FAR const char *buffer,
size_t buflen);
off_t (*seek)(FAR struct file *filep, off_t offset, int whence);
int (*ioctl)(FAR struct file *filep, int cmd, unsigned long arg);
int (*mmap)(FAR struct file *filep, FAR struct mm_map_entry_s *map);
CODE int (*close)(FAR struct file *filep);
CODE ssize_t (*read)(FAR struct file *filep, FAR char *buffer,
size_t buflen);
CODE ssize_t (*write)(FAR struct file *filep, FAR const char *buffer,
size_t buflen);
CODE off_t (*seek)(FAR struct file *filep, off_t offset, int whence);
CODE int (*ioctl)(FAR struct file *filep, int cmd, unsigned long arg);
CODE int (*mmap)(FAR struct file *filep,
FAR struct mm_map_entry_s *map);
int (*truncate)(FAR struct file *filep, off_t length);
/* The two structures need not be common after this point */
int (*poll)(FAR struct file *filep, struct pollfd *fds, bool setup);
CODE int (*poll)(FAR struct file *filep, FAR struct pollfd *fds,
bool setup);
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
int (*unlink)(FAR struct inode *inode);
CODE int (*unlink)(FAR struct inode *inode);
#endif
};
@ -259,17 +262,18 @@ struct partition_info_s
struct inode;
struct block_operations
{
int (*open)(FAR struct inode *inode);
int (*close)(FAR struct inode *inode);
ssize_t (*read)(FAR struct inode *inode, FAR unsigned char *buffer,
blkcnt_t start_sector, unsigned int nsectors);
ssize_t (*write)(FAR struct inode *inode, FAR const unsigned char *buffer,
blkcnt_t start_sector, unsigned int nsectors);
int (*geometry)(FAR struct inode *inode, FAR struct geometry
*geometry);
int (*ioctl)(FAR struct inode *inode, int cmd, unsigned long arg);
CODE int (*open)(FAR struct inode *inode);
CODE int (*close)(FAR struct inode *inode);
CODE ssize_t (*read)(FAR struct inode *inode, FAR unsigned char *buffer,
blkcnt_t start_sector, unsigned int nsectors);
CODE ssize_t (*write)(FAR struct inode *inode,
FAR const unsigned char *buffer,
blkcnt_t start_sector, unsigned int nsectors);
CODE int (*geometry)(FAR struct inode *inode,
FAR struct geometry *geometry);
CODE int (*ioctl)(FAR struct inode *inode, int cmd, unsigned long arg);
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
int (*unlink)(FAR struct inode *inode);
CODE int (*unlink)(FAR struct inode *inode);
#endif
};
@ -287,7 +291,7 @@ struct mountpt_operations
* information to manage privileges.
*/
int (*open)(FAR struct file *filep, FAR const char *relpath,
CODE int (*open)(FAR struct file *filep, FAR const char *relpath,
int oflags, mode_t mode);
/* The following methods must be identical in signature and position
@ -295,14 +299,16 @@ struct mountpt_operations
* treated like unions.
*/
int (*close)(FAR struct file *filep);
ssize_t (*read)(FAR struct file *filep, FAR char *buffer, size_t buflen);
ssize_t (*write)(FAR struct file *filep, FAR const char *buffer,
size_t buflen);
off_t (*seek)(FAR struct file *filep, off_t offset, int whence);
int (*ioctl)(FAR struct file *filep, int cmd, unsigned long arg);
int (*mmap)(FAR struct file *filep, FAR struct mm_map_entry_s *map);
int (*truncate)(FAR struct file *filep, off_t length);
CODE int (*close)(FAR struct file *filep);
CODE ssize_t (*read)(FAR struct file *filep, FAR char *buffer,
size_t buflen);
CODE ssize_t (*write)(FAR struct file *filep, FAR const char *buffer,
size_t buflen);
CODE off_t (*seek)(FAR struct file *filep, off_t offset, int whence);
CODE int (*ioctl)(FAR struct file *filep, int cmd, unsigned long arg);
CODE int (*mmap)(FAR struct file *filep,
FAR struct mm_map_entry_s *map);
CODE int (*truncate)(FAR struct file *filep, off_t length);
/* The two structures need not be common after this point. The following
* are extended methods needed to deal with the unique needs of mounted
@ -311,43 +317,45 @@ struct mountpt_operations
* Additional open-file-specific mountpoint operations:
*/
int (*sync)(FAR struct file *filep);
int (*dup)(FAR const struct file *oldp, FAR struct file *newp);
int (*fstat)(FAR const struct file *filep, FAR struct stat *buf);
int (*fchstat)(FAR const struct file *filep,
FAR const struct stat *buf, int flags);
CODE int (*sync)(FAR struct file *filep);
CODE int (*dup)(FAR const struct file *oldp, FAR struct file *newp);
CODE int (*fstat)(FAR const struct file *filep, FAR struct stat *buf);
CODE int (*fchstat)(FAR const struct file *filep,
FAR const struct stat *buf, int flags);
/* Directory operations */
int (*opendir)(FAR struct inode *mountpt, FAR const char *relpath,
FAR struct fs_dirent_s **dir);
int (*closedir)(FAR struct inode *mountpt,
FAR struct fs_dirent_s *dir);
int (*readdir)(FAR struct inode *mountpt,
FAR struct fs_dirent_s *dir, FAR struct dirent *entry);
int (*rewinddir)(FAR struct inode *mountpt,
FAR struct fs_dirent_s *dir);
CODE int (*opendir)(FAR struct inode *mountpt, FAR const char *relpath,
FAR struct fs_dirent_s **dir);
CODE int (*closedir)(FAR struct inode *mountpt,
FAR struct fs_dirent_s *dir);
CODE int (*readdir)(FAR struct inode *mountpt,
FAR struct fs_dirent_s *dir,
FAR struct dirent *entry);
CODE int (*rewinddir)(FAR struct inode *mountpt,
FAR struct fs_dirent_s *dir);
/* General volume-related mountpoint operations: */
int (*bind)(FAR struct inode *blkdriver, FAR const void *data,
FAR void **handle);
int (*unbind)(FAR void *handle, FAR struct inode **blkdriver,
unsigned int flags);
int (*statfs)(FAR struct inode *mountpt, FAR struct statfs *buf);
CODE int (*bind)(FAR struct inode *blkdriver, FAR const void *data,
FAR void **handle);
CODE int (*unbind)(FAR void *handle, FAR struct inode **blkdriver,
unsigned int flags);
CODE int (*statfs)(FAR struct inode *mountpt, FAR struct statfs *buf);
/* Operations on paths */
int (*unlink)(FAR struct inode *mountpt, FAR const char *relpath);
int (*mkdir)(FAR struct inode *mountpt, FAR const char *relpath,
mode_t mode);
int (*rmdir)(FAR struct inode *mountpt, FAR const char *relpath);
int (*rename)(FAR struct inode *mountpt, FAR const char *oldrelpath,
FAR const char *newrelpath);
int (*stat)(FAR struct inode *mountpt, FAR const char *relpath,
FAR struct stat *buf);
int (*chstat)(FAR struct inode *mountpt, FAR const char *relpath,
FAR const struct stat *buf, int flags);
CODE int (*unlink)(FAR struct inode *mountpt, FAR const char *relpath);
CODE int (*mkdir)(FAR struct inode *mountpt, FAR const char *relpath,
mode_t mode);
CODE int (*rmdir)(FAR struct inode *mountpt, FAR const char *relpath);
CODE int (*rename)(FAR struct inode *mountpt,
FAR const char *oldrelpath,
FAR const char *newrelpath);
CODE int (*stat)(FAR struct inode *mountpt, FAR const char *relpath,
FAR struct stat *buf);
CODE int (*chstat)(FAR struct inode *mountpt, FAR const char *relpath,
FAR const struct stat *buf, int flags);
};
#endif /* CONFIG_DISABLE_MOUNTPOINT */
@ -1189,7 +1197,7 @@ ssize_t file_pwrite(FAR struct file *filep, FAR const void *buf,
****************************************************************************/
ssize_t file_sendfile(FAR struct file *outfile, FAR struct file *infile,
off_t *offset, size_t count);
FAR off_t *offset, size_t count);
/****************************************************************************
* Name: file_seek

View file

@ -93,47 +93,54 @@ struct battery_charger_operations_s
{
/* Return the current battery state (see enum battery_status_e) */
int (*state)(struct battery_charger_dev_s *dev, int *status);
CODE int (*state)(FAR struct battery_charger_dev_s *dev, FAR int *status);
/* Return the current battery health (see enum battery_health_e) */
int (*health)(struct battery_charger_dev_s *dev, int *health);
CODE int (*health)(FAR struct battery_charger_dev_s *dev, FAR int *health);
/* Return true if the battery is online */
int (*online)(struct battery_charger_dev_s *dev, bool *status);
CODE int (*online)(FAR struct battery_charger_dev_s *dev,
FAR bool *status);
/* Set the wished battery voltage for charging */
int (*voltage)(struct battery_charger_dev_s *dev, int value);
CODE int (*voltage)(FAR struct battery_charger_dev_s *dev, int value);
/* Set the wished current rate used for charging */
int (*current)(struct battery_charger_dev_s *dev, int value);
CODE int (*current)(FAR struct battery_charger_dev_s *dev, int value);
/* Set the input current limit of power supply */
int (*input_current)(struct battery_charger_dev_s *dev, int value);
CODE int (*input_current)(FAR struct battery_charger_dev_s *dev,
int value);
/* Do device specific operation */
int (*operate)(struct battery_charger_dev_s *dev, uintptr_t param);
CODE int (*operate)(FAR struct battery_charger_dev_s *dev,
uintptr_t param);
/* Get chip id */
int (*chipid)(struct battery_charger_dev_s *dev, unsigned int *value);
CODE int (*chipid)(FAR struct battery_charger_dev_s *dev,
FAR unsigned int *value);
/* Get the actual output voltage for charging */
int (*get_voltage)(struct battery_charger_dev_s *dev, FAR int *value);
CODE int (*get_voltage)(FAR struct battery_charger_dev_s *dev,
FAR int *value);
/* the voltage infomation for charging */
/* the voltage information for charging */
int (*voltage_info)(struct battery_charger_dev_s *dev, FAR int *value);
CODE int (*voltage_info)(FAR struct battery_charger_dev_s *dev,
FAR int *value);
/* Get charge protocol */
int (*get_protocol)(struct battery_charger_dev_s *dev, FAR int *value);
CODE int (*get_protocol)(FAR struct battery_charger_dev_s *dev,
FAR int *value);
};
/* This structure defines the battery driver state structure */

View file

@ -125,7 +125,7 @@ struct battery_monitor_voltage_s
* list of cell voltages in the expected order.
*/
uint32_t *cell_voltages;
FAR uint32_t *cell_voltages;
};
struct battery_monitor_temperature_s
@ -146,7 +146,7 @@ struct battery_monitor_temperature_s
* and current.
*/
uint32_t *temperatures;
FAR uint32_t *temperatures;
};
struct battery_monitor_balance_s
@ -161,7 +161,7 @@ struct battery_monitor_balance_s
* necessary to make this happen.
*/
bool *balance;
FAR bool *balance;
};
struct battery_monitor_limits_s
@ -223,75 +223,81 @@ struct battery_monitor_operations_s
{
/* Return the current battery state (see enum battery_status_e) */
int (*state)(struct battery_monitor_dev_s *dev, int *status);
CODE int (*state)(FAR struct battery_monitor_dev_s *dev, FAR int *status);
/* Return the current battery health (see enum battery_health_e) */
int (*health)(struct battery_monitor_dev_s *dev, int *health);
CODE int (*health)(FAR struct battery_monitor_dev_s *dev, FAR int *health);
/* Return true if the battery is online */
int (*online)(struct battery_monitor_dev_s *dev, bool *status);
CODE int (*online)(FAR struct battery_monitor_dev_s *dev,
FAR bool *status);
/* Get the battery pack voltage */
int (*voltage)(struct battery_monitor_dev_s *dev, int *value);
CODE int (*voltage)(FAR struct battery_monitor_dev_s *dev, FAR int *value);
/* Get the battery cell voltages */
int (*cell_voltage)(struct battery_monitor_dev_s *dev,
struct battery_monitor_voltage_s *cellv);
CODE int (*cell_voltage)(FAR struct battery_monitor_dev_s *dev,
FAR struct battery_monitor_voltage_s *cellv);
/* Get the battery pack current */
int (*current)(struct battery_monitor_dev_s *dev,
struct battery_monitor_current_s *current);
CODE int (*current)(FAR struct battery_monitor_dev_s *dev,
FAR struct battery_monitor_current_s *current);
/* Get the battery pack state of charge */
int (*soc)(struct battery_monitor_dev_s *dev, b16_t *value);
CODE int (*soc)(FAR struct battery_monitor_dev_s *dev, FAR b16_t *value);
/* Get the battery pack Coulomb count value */
int (*coulombs)(struct battery_monitor_dev_s *dev, int *value);
CODE int (*coulombs)(FAR struct battery_monitor_dev_s *dev,
FAR int *value);
/* Read battery pack temperature sensor(s) */
int (*temperature)(struct battery_monitor_dev_s *dev,
struct battery_monitor_temperature_s *temps);
CODE int (*temperature)(FAR struct battery_monitor_dev_s *dev,
FAR struct battery_monitor_temperature_s *temps);
/* Set balance switches on battery cells */
int (*balance)(struct battery_monitor_dev_s *dev,
struct battery_monitor_balance_s *bal);
CODE int (*balance)(FAR struct battery_monitor_dev_s *dev,
FAR struct battery_monitor_balance_s *bal);
/* Put monitor device into low-power shutdown mode */
int (*shutdown)(struct battery_monitor_dev_s *dev, uintptr_t param);
CODE int (*shutdown)(FAR struct battery_monitor_dev_s *dev,
uintptr_t param);
/* Configure safety limits for the device */
int (*setlimits)(struct battery_monitor_dev_s *dev,
struct battery_monitor_limits_s *limits);
CODE int (*setlimits)(FAR struct battery_monitor_dev_s *dev,
FAR struct battery_monitor_limits_s *limits);
/* Set the state of charge/discharge switches to allow battery to
* source/sink power
*/
int (*chgdsg)(struct battery_monitor_dev_s *dev,
struct battery_monitor_switches_s *sw);
CODE int (*chgdsg)(FAR struct battery_monitor_dev_s *dev,
FAR struct battery_monitor_switches_s *sw);
/* Clear battery monitor faults */
int (*clearfaults)(struct battery_monitor_dev_s *dev, uintptr_t param);
CODE int (*clearfaults)(FAR struct battery_monitor_dev_s *dev,
uintptr_t param);
/* Do device specific operation */
int (*operate)(struct battery_monitor_dev_s *dev, uintptr_t param);
CODE int (*operate)(FAR struct battery_monitor_dev_s *dev,
uintptr_t param);
/* Get chip id */
int (*chipid)(struct battery_charger_dev_s *dev, unsigned int *value);
CODE int (*chipid)(FAR struct battery_charger_dev_s *dev,
FAR unsigned int *value);
};
/* This structure defines the battery driver state structure */