mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-15 02:40:34 +08:00
Add IOCTL interface to uORBManager for nuttx protected/kernel build split
When building uORB for NuttX flat build, or for some other target, everything works as before. When building uORB for NuttX protected or kernel build, this does the following: - The kernel side uORB library reigsters a boardctl handler for calls from userspace and services the boardctl_ioctls by calling the actual uORB functions - For user mode binaries, the uORBManager acts as a proxy, making boardctl_ioctl calls to the kernel side - The uORBDeviceNodes are always allocated in user heap for protected build, so that they are accessible from both kernel and user side. This is only for optimization, a few functions such as "is_advertised" get really heavy when called frequently via ioctl Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
This commit is contained in:
@@ -49,6 +49,10 @@
|
||||
#include <poll.h>
|
||||
#endif // PX4_QURT
|
||||
|
||||
#if defined(__PX4_NUTTX)
|
||||
#include <nuttx/mm/mm.h>
|
||||
#endif
|
||||
|
||||
uORB::DeviceMaster::DeviceMaster()
|
||||
{
|
||||
px4_sem_init(&_lock, 0, 1);
|
||||
@@ -111,7 +115,11 @@ int uORB::DeviceMaster::advertise(const struct orb_metadata *meta, bool is_adver
|
||||
|
||||
/* if we didn't get a device, that's bad, free the path too */
|
||||
if (node == nullptr) {
|
||||
#if defined(__PX4_NUTTX) && !defined(CONFIG_BUILD_FLAT)
|
||||
kmm_free((void *)devpath);
|
||||
#else
|
||||
free((void *)devpath);
|
||||
#endif
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user