PX4 Firmware
PX4 Autopilot Software http://px4.io
cdev_platform.cpp File Reference
#include "cdev_platform.hpp"
#include <string>
#include <map>
#include "vfile.h"
#include "../CDev.hpp"
#include <px4_platform_common/log.h>
#include <px4_platform_common/posix.h>
#include <px4_platform_common/time.h>
#include "DevMgr.hpp"
Include dependency graph for cdev_platform.cpp:

Go to the source code of this file.

Macros

#define PX4_MAX_FD   350
 

Functions

static cdev::CDevgetDev (const char *path)
 
static cdev::CDevget_vdev (int fd)
 
int register_driver (const char *name, const cdev::px4_file_operations_t *fops, cdev::mode_t mode, void *data)
 
int unregister_driver (const char *name)
 
int px4_open (const char *path, int flags,...)
 
int px4_close (int fd)
 
ssize_t px4_read (int fd, void *buffer, size_t buflen)
 
ssize_t px4_write (int fd, const void *buffer, size_t buflen)
 
int px4_ioctl (int fd, int cmd, unsigned long arg)
 
int px4_poll (px4_pollfd_struct_t *fds, nfds_t nfds, int timeout)
 
int px4_fsync (int fd)
 
int px4_access (const char *pathname, int mode)
 
void px4_show_devices ()
 
void px4_show_topics ()
 
void px4_show_files ()
 

Variables

pthread_mutex_t devmutex = PTHREAD_MUTEX_INITIALIZER
 
pthread_mutex_t filemutex = PTHREAD_MUTEX_INITIALIZER
 
static map< string, void * > devmap
 
static cdev::file_t filemap [PX4_MAX_FD] = {}
 
int px4_errno
 

Macro Definition Documentation

◆ PX4_MAX_FD

#define PX4_MAX_FD   350

Definition at line 57 of file cdev_platform.cpp.

Referenced by px4_open().

Function Documentation

◆ get_vdev()

static cdev::CDev* get_vdev ( int  fd)
static

Definition at line 83 of file cdev_platform.cpp.

References fd, filemutex, and cdev::file_t::vdev.

Referenced by px4_close(), px4_ioctl(), px4_poll(), px4_read(), and px4_write().

Here is the caller graph for this function:

◆ getDev()

static cdev::CDev* getDev ( const char *  path)
static

Definition at line 65 of file cdev_platform.cpp.

References devmutex.

Referenced by px4_access(), and px4_open().

Here is the caller graph for this function:

◆ px4_access()

int px4_access ( const char *  pathname,
int  mode 
)

Definition at line 429 of file cdev_platform.cpp.

References getDev().

Referenced by uORB::Manager::orb_exists().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ px4_close()

◆ px4_fsync()

int px4_fsync ( int  fd)

Definition at line 424 of file cdev_platform.cpp.

◆ px4_ioctl()

◆ px4_open()

◆ px4_poll()

◆ px4_read()

ssize_t px4_read ( int  fd,
void *  buffer,
size_t  buflen 
)

Definition at line 243 of file cdev_platform.cpp.

References get_vdev(), and cdev::CDev::read().

Referenced by HMC5883::calibrate(), CDevExample::do_poll(), uORB::Manager::orb_copy(), and test_adc().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ px4_show_devices()

void px4_show_devices ( )

Definition at line 440 of file cdev_platform.cpp.

References devmutex.

◆ px4_show_files()

void px4_show_files ( )

Definition at line 485 of file cdev_platform.cpp.

References devmutex.

◆ px4_show_topics()

void px4_show_topics ( )

Definition at line 470 of file cdev_platform.cpp.

References devmutex.

◆ px4_write()

ssize_t px4_write ( int  fd,
const void *  buffer,
size_t  buflen 
)

Definition at line 265 of file cdev_platform.cpp.

References get_vdev(), and cdev::CDev::write().

Referenced by MavlinkReceiver::handle_message_play_tune(), and writer_main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ register_driver()

int register_driver ( const char *  name,
const cdev::px4_file_operations_t fops,
cdev::mode_t  mode,
void *  data 
)

Definition at line 100 of file cdev_platform.cpp.

References devmutex, and name.

Referenced by cdev::VFile::createFile(), cdev::file_t::file_t(), cdev::CDev::init(), MK::init(), PX4IO::init(), and cdev::CDev::register_class_devname().

Here is the caller graph for this function:

◆ unregister_driver()

int unregister_driver ( const char *  name)

Definition at line 127 of file cdev_platform.cpp.

References devmutex.

Referenced by cdev::file_t::file_t(), PX4IO::task_main(), cdev::CDev::unregister_class_devname(), cdev::CDev::unregister_driver_and_memory(), cdev::CDev::~CDev(), and MK::~MK().

Here is the caller graph for this function:

Variable Documentation

◆ devmap

map<string, void *> devmap
static

Definition at line 58 of file cdev_platform.cpp.

◆ devmutex

pthread_mutex_t devmutex = PTHREAD_MUTEX_INITIALIZER

◆ filemap

cdev::file_t filemap[PX4_MAX_FD] = {}
static

Definition at line 59 of file cdev_platform.cpp.

◆ filemutex

pthread_mutex_t filemutex = PTHREAD_MUTEX_INITIALIZER

Definition at line 55 of file cdev_platform.cpp.

Referenced by get_vdev(), px4_close(), and px4_open().

◆ px4_errno

int px4_errno

Definition at line 63 of file cdev_platform.cpp.