mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-26 14:33: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:
@@ -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