mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-16 09:43:35 +08:00
DriverFramework purge
The bulk of this change was tightly coupled and needed to be deleted in one pass. Some of the smaller changes were things that broke as a result of the initial purge and subsequently fixed by further eradicating unnecessary platform differences. Finally, I deleted any dead code I came across in the related files I touched while going through everything.
- DriverFramework (src/lib/DriverFramework submodule) completely removed
- added dspal submodule in qurt platform (was brought in via DriverFramework)
- all df wrapper drivers removed
- all boards using df wrapper drivers updated to use in tree equivalents
- unused empty arch/board.h on posix and qurt removed
- unused IOCTLs removed (pub block, priv, etc)
- Integrator delete methods only used from df wrapper drivers
- commander: sensor calibration use "NuttX version" everywhere for now
- sensors: update to px4_{open, read, close} instead of DevMgr wrapper (adc open for analog differential pressure)
- battery_status: update to px4_{open, read, close} instead of DevMgr wrapper (adc open for analog differential pressure)
- cdev cleanup conflicting typedefs and names with actual OS (pollevent_t, etc)
- load_mon and top remove from linux boards (unused)
- delete unused PX4_MAIN_FUNCTION
- delete unused getreg32 macro
- delete unused SIOCDEVPRIVATE define
- named each platform tasks consistently
- posix list_devices and list_topics removed (list_files now shows all virtual files)
This commit is contained in:
+2
-23
@@ -188,27 +188,6 @@ CDev::close(file_t *filep)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
CDev::ioctl(file_t *filep, int cmd, unsigned long arg)
|
||||
{
|
||||
PX4_DEBUG("CDev::ioctl");
|
||||
int ret = -ENOTTY;
|
||||
|
||||
switch (cmd) {
|
||||
|
||||
/* fetch a pointer to the driver's private data */
|
||||
case DIOC_GETPRIV:
|
||||
*(void **)(uintptr_t)arg = (void *)this;
|
||||
ret = PX4_OK;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
CDev::poll(file_t *filep, px4_pollfd_struct_t *fds, bool setup)
|
||||
{
|
||||
@@ -327,7 +306,7 @@ CDev::poll(file_t *filep, px4_pollfd_struct_t *fds, bool setup)
|
||||
}
|
||||
|
||||
void
|
||||
CDev::poll_notify(pollevent_t events)
|
||||
CDev::poll_notify(px4_pollevent_t events)
|
||||
{
|
||||
PX4_DEBUG("CDev::poll_notify events = %0x", events);
|
||||
|
||||
@@ -344,7 +323,7 @@ CDev::poll_notify(pollevent_t events)
|
||||
}
|
||||
|
||||
void
|
||||
CDev::poll_notify_one(px4_pollfd_struct_t *fds, pollevent_t events)
|
||||
CDev::poll_notify_one(px4_pollfd_struct_t *fds, px4_pollevent_t events)
|
||||
{
|
||||
PX4_DEBUG("CDev::poll_notify_one");
|
||||
|
||||
|
||||
@@ -137,8 +137,8 @@ public:
|
||||
/**
|
||||
* Perform an ioctl operation on the device.
|
||||
*
|
||||
* The default implementation handles DIOC_GETPRIV, and otherwise
|
||||
* returns -ENOTTY. Subclasses should call the default implementation
|
||||
* The default implementation returns -ENOTTY.
|
||||
* Subclasses should call the default implementation
|
||||
* for any command they do not handle themselves.
|
||||
*
|
||||
* @param filep Pointer to the NuttX file structure.
|
||||
@@ -146,7 +146,7 @@ public:
|
||||
* @param arg The ioctl argument value.
|
||||
* @return OK on success, or -errno otherwise.
|
||||
*/
|
||||
virtual int ioctl(file_t *filep, int cmd, unsigned long arg);
|
||||
virtual int ioctl(file_t *filep, int cmd, unsigned long arg) { return -ENOTTY; };
|
||||
|
||||
/**
|
||||
* Perform a poll setup/teardown operation.
|
||||
@@ -187,7 +187,7 @@ protected:
|
||||
* @param filep The file that's interested.
|
||||
* @return The current set of poll events.
|
||||
*/
|
||||
virtual pollevent_t poll_state(file_t *filep) { return 0; }
|
||||
virtual px4_pollevent_t poll_state(file_t *filep) { return 0; }
|
||||
|
||||
/**
|
||||
* Report new poll events.
|
||||
@@ -197,7 +197,7 @@ protected:
|
||||
*
|
||||
* @param events The new event(s) being announced.
|
||||
*/
|
||||
virtual void poll_notify(pollevent_t events);
|
||||
virtual void poll_notify(px4_pollevent_t events);
|
||||
|
||||
/**
|
||||
* Internal implementation of poll_notify.
|
||||
@@ -205,7 +205,7 @@ protected:
|
||||
* @param fds A poll waiter to notify.
|
||||
* @param events The event(s) to send to the waiter.
|
||||
*/
|
||||
virtual void poll_notify_one(px4_pollfd_struct_t *fds, pollevent_t events);
|
||||
virtual void poll_notify_one(px4_pollfd_struct_t *fds, px4_pollevent_t events);
|
||||
|
||||
/**
|
||||
* Notification of the first open.
|
||||
|
||||
@@ -44,10 +44,7 @@
|
||||
#include <px4_platform_common/posix.h>
|
||||
#include <px4_platform_common/time.h>
|
||||
|
||||
#include "DevMgr.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace DriverFramework;
|
||||
|
||||
const cdev::px4_file_operations_t cdev::CDev::fops = {};
|
||||
|
||||
@@ -60,8 +57,6 @@ static cdev::file_t filemap[PX4_MAX_FD] = {};
|
||||
|
||||
extern "C" {
|
||||
|
||||
int px4_errno;
|
||||
|
||||
static cdev::CDev *getDev(const char *path)
|
||||
{
|
||||
PX4_DEBUG("CDev::getDev");
|
||||
@@ -233,7 +228,6 @@ extern "C" {
|
||||
}
|
||||
|
||||
if (ret < 0) {
|
||||
px4_errno = -ret;
|
||||
ret = PX4_ERROR;
|
||||
}
|
||||
|
||||
@@ -255,7 +249,6 @@ extern "C" {
|
||||
}
|
||||
|
||||
if (ret < 0) {
|
||||
px4_errno = -ret;
|
||||
ret = PX4_ERROR;
|
||||
}
|
||||
|
||||
@@ -277,7 +270,6 @@ extern "C" {
|
||||
}
|
||||
|
||||
if (ret < 0) {
|
||||
px4_errno = -ret;
|
||||
ret = PX4_ERROR;
|
||||
}
|
||||
|
||||
@@ -298,14 +290,10 @@ extern "C" {
|
||||
ret = -EINVAL;
|
||||
}
|
||||
|
||||
if (ret < 0) {
|
||||
px4_errno = -ret;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int px4_poll(px4_pollfd_struct_t *fds, nfds_t nfds, int timeout)
|
||||
int px4_poll(px4_pollfd_struct_t *fds, unsigned int nfds, int timeout)
|
||||
{
|
||||
if (nfds == 0) {
|
||||
PX4_WARN("px4_poll with no fds");
|
||||
@@ -315,7 +303,6 @@ extern "C" {
|
||||
px4_sem_t sem;
|
||||
int count = 0;
|
||||
int ret = -1;
|
||||
unsigned int i;
|
||||
|
||||
const unsigned NAMELEN = 32;
|
||||
char thread_name[NAMELEN] = {};
|
||||
@@ -339,7 +326,7 @@ extern "C" {
|
||||
// Go through all fds and check them for a pollable state
|
||||
bool fd_pollable = false;
|
||||
|
||||
for (i = 0; i < nfds; ++i) {
|
||||
for (unsigned int i = 0; i < nfds; ++i) {
|
||||
fds[i].sem = &sem;
|
||||
fds[i].revents = 0;
|
||||
fds[i].priv = nullptr;
|
||||
@@ -393,7 +380,7 @@ extern "C" {
|
||||
|
||||
// We have waited now (or not, depending on timeout),
|
||||
// go through all fds and count how many have data
|
||||
for (i = 0; i < nfds; ++i) {
|
||||
for (unsigned int i = 0; i < nfds; ++i) {
|
||||
|
||||
cdev::CDev *dev = get_vdev(fds[i].fd);
|
||||
|
||||
@@ -421,11 +408,6 @@ extern "C" {
|
||||
return (count) ? count : ret;
|
||||
}
|
||||
|
||||
int px4_fsync(int fd)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int px4_access(const char *pathname, int mode)
|
||||
{
|
||||
if (mode != F_OK) {
|
||||
@@ -437,51 +419,6 @@ extern "C" {
|
||||
return (dev != nullptr) ? 0 : -1;
|
||||
}
|
||||
|
||||
void px4_show_devices()
|
||||
{
|
||||
int i = 0;
|
||||
PX4_INFO("PX4 Devices:");
|
||||
|
||||
pthread_mutex_lock(&devmutex);
|
||||
|
||||
for (const auto &dev : devmap) {
|
||||
if (strncmp(dev.first.c_str(), "/dev/", 5) == 0) {
|
||||
PX4_INFO(" %s", dev.first.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
pthread_mutex_unlock(&devmutex);
|
||||
|
||||
PX4_INFO("DF Devices:");
|
||||
const char *dev_path;
|
||||
unsigned int index = 0;
|
||||
i = 0;
|
||||
|
||||
do {
|
||||
// Each look increments index and returns -1 if end reached
|
||||
i = DevMgr::getNextDeviceName(index, &dev_path);
|
||||
|
||||
if (i == 0) {
|
||||
PX4_INFO(" %s", dev_path);
|
||||
}
|
||||
} while (i == 0);
|
||||
}
|
||||
|
||||
void px4_show_topics()
|
||||
{
|
||||
PX4_INFO("Devices:");
|
||||
|
||||
pthread_mutex_lock(&devmutex);
|
||||
|
||||
for (const auto &dev : devmap) {
|
||||
if (strncmp(dev.first.c_str(), "/obj/", 5) == 0) {
|
||||
PX4_INFO(" %s", dev.first.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
pthread_mutex_unlock(&devmutex);
|
||||
}
|
||||
|
||||
void px4_show_files()
|
||||
{
|
||||
PX4_INFO("Files:");
|
||||
@@ -489,10 +426,7 @@ extern "C" {
|
||||
pthread_mutex_lock(&devmutex);
|
||||
|
||||
for (const auto &dev : devmap) {
|
||||
if (strncmp(dev.first.c_str(), "/obj/", 5) != 0 &&
|
||||
strncmp(dev.first.c_str(), "/dev/", 5) != 0) {
|
||||
PX4_INFO(" %s", dev.first.c_str());
|
||||
}
|
||||
PX4_INFO_RAW(" %s\n", dev.first.c_str());
|
||||
}
|
||||
|
||||
pthread_mutex_unlock(&devmutex);
|
||||
|
||||
Reference in New Issue
Block a user