Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions system/uorb/test/unit_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,12 +235,6 @@ static int latency_test(bool print)
usleep(1000); /* simulate >800 Hz system operation */
}

if (pubsub_task < 0)
{
test_fail("failed launching task");
goto out;
}

ret = OK;

out:
Expand Down
9 changes: 6 additions & 3 deletions system/uorb/uORB/epoll.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ static int orb_loop_epoll_run(FAR struct orb_loop_s *loop)
uorberr("epoll wait data in error! fd:%d", handle->fd);
}
}
else if (et[i].events & EPOLLOUT)

if (et[i].events & EPOLLOUT)
{
if (handle->dataout_cb != NULL)
{
Expand All @@ -116,7 +117,8 @@ static int orb_loop_epoll_run(FAR struct orb_loop_s *loop)
uorberr("epoll wait data out error! fd:%d", handle->fd);
}
}
else if (et[i].events & EPOLLPRI)

if (et[i].events & EPOLLPRI)
{
if (handle->eventpri_cb != NULL)
{
Expand All @@ -127,7 +129,8 @@ static int orb_loop_epoll_run(FAR struct orb_loop_s *loop)
uorberr("epoll wait events pri error! fd:%d", handle->fd);
}
}
else if (et[i].events & EPOLLERR)

if (et[i].events & EPOLLERR)
{
if (handle->eventerr_cb != NULL)
{
Expand Down
50 changes: 29 additions & 21 deletions system/uorb/uORB/uORB.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
* Name: orb_advsub_open
*
* Description:
* Open device node as advertiser / subscriber, regist node and save meta
* Open device node as advertiser / subscriber, register node and save meta
* in driver for first user, set buffer number for advertisers.
*
* Input Parameters:
Expand All @@ -57,7 +57,8 @@
****************************************************************************/

static int orb_advsub_open(FAR const struct orb_metadata *meta, int flags,
int instance, unsigned int queue_size)
int instance, unsigned int queue_size,
FAR orb_info_t *info)
{
char path[ORB_PATH_MAX];
int fd;
Expand All @@ -67,7 +68,7 @@
snprintf(path, ORB_PATH_MAX, ORB_SENSOR_PATH"%s%d", meta->o_name,
instance);

/* Check existance before open */
/* Check existence before open */

flags |= O_CLOEXEC;
fd = open(path, flags);
Expand All @@ -78,6 +79,14 @@
reginfo.esize = meta->o_size;
reginfo.nbuffer = queue_size;
reginfo.persist = !!(flags & SENSOR_PERSIST);
if (info != NULL)
{
memcpy(&reginfo.devinfo, info, sizeof(*info));

Check failure on line 84 in system/uorb/uORB/uORB.c

View workflow job for this annotation

GitHub Actions / Linux (sim-03)

'struct sensor_reginfo_s' has no member named 'devinfo'

Check failure on line 84 in system/uorb/uORB/uORB.c

View workflow job for this annotation

GitHub Actions / Linux (sim-03)

'struct sensor_reginfo_s' has no member named 'devinfo'
}
else
{
memset(&reginfo.devinfo, 0, sizeof(*info));

Check failure on line 88 in system/uorb/uORB/uORB.c

View workflow job for this annotation

GitHub Actions / Linux (sim-03)

'struct sensor_reginfo_s' has no member named 'devinfo'

Check failure on line 88 in system/uorb/uORB/uORB.c

View workflow job for this annotation

GitHub Actions / Linux (sim-03)

'struct sensor_reginfo_s' has no member named 'devinfo'
}

fd = open(ORB_USENSOR_PATH, O_WRONLY | O_CLOEXEC);
if (fd < 0)
Expand Down Expand Up @@ -120,7 +129,8 @@
static int
orb_advertise_multi_queue_flags(FAR const struct orb_metadata *meta,
FAR const void *data, FAR int *instance,
unsigned int queue_size, int flags)
unsigned int queue_size, int flags,
FAR orb_info_t *info)
{
int inst;
int fd;
Expand All @@ -129,7 +139,7 @@

inst = instance ? *instance : orb_group_count(meta);

fd = orb_advsub_open(meta, flags, inst, queue_size);
fd = orb_advsub_open(meta, flags, inst, queue_size, info);
if (fd < 0)
{
uorberr("%s advertise failed (%i)", meta->o_name, fd);
Expand Down Expand Up @@ -172,32 +182,35 @@
return close(fd);
}

int orb_advertise_multi_queue(FAR const struct orb_metadata *meta,
FAR const void *data, FAR int *instance,
unsigned int queue_size)
int orb_advertise_multi_queue_info(FAR const struct orb_metadata *meta,
FAR const void *data, FAR int *instance,
unsigned int queue_size,
FAR orb_info_t *info)
{
return orb_advertise_multi_queue_flags(meta, data, instance,
queue_size, O_WRONLY);
queue_size, O_WRONLY, info);
}

int orb_advertise_multi_queue_persist(FAR const struct orb_metadata *meta,
FAR const void *data,
FAR int *instance,
unsigned int queue_size)
int
orb_advertise_multi_queue_persist_info(FAR const struct orb_metadata *meta,
FAR const void *data,
FAR int *instance,
unsigned int queue_size,
FAR orb_info_t *info)
{
return orb_advertise_multi_queue_flags(meta, data, instance, queue_size,
O_WRONLY | SENSOR_PERSIST);
O_WRONLY | SENSOR_PERSIST, info);
}

ssize_t orb_publish_multi(int fd, const void *data, size_t len)
ssize_t orb_publish_multi(int fd, FAR const void *data, size_t len)
{
return write(fd, data, len);
}

int orb_subscribe_multi(FAR const struct orb_metadata *meta,
unsigned instance)
{
return orb_advsub_open(meta, O_RDONLY, instance, 0);
return orb_advsub_open(meta, O_RDONLY, instance, 0, NULL);
}

ssize_t orb_copy_multi(int fd, FAR void *buffer, size_t len)
Expand Down Expand Up @@ -276,11 +289,6 @@
return ret;
}

int orb_set_info(int fd, FAR const orb_info_t *info)
{
return ioctl(fd, SNIOC_SET_INFO, (unsigned long)(uintptr_t)info);
}

int orb_get_info(int fd, FAR orb_info_t *info)
{
return ioctl(fd, SNIOC_GET_INFO, (unsigned long)(uintptr_t)info);
Expand Down
56 changes: 32 additions & 24 deletions system/uorb/uORB/uORB.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,10 @@ struct orb_handle_s
int events; /* Events of interest. */
int fd; /* Topic fd. */
FAR void *arg; /* Callback parameter. */
orb_datain_cb_t datain_cb; /* User EPOLLIN callback funtion. */
orb_dataout_cb_t dataout_cb; /* User EPOLLOUT callback funtion. */
orb_eventpri_cb_t eventpri_cb; /* User EPOLLPRI callback funtion. */
orb_eventerr_cb_t eventerr_cb; /* User EPOLLERR callback funtion. */
orb_datain_cb_t datain_cb; /* User EPOLLIN callback function. */
orb_dataout_cb_t dataout_cb; /* User EPOLLOUT callback function. */
orb_eventpri_cb_t eventpri_cb; /* User EPOLLPRI callback function. */
orb_eventerr_cb_t eventerr_cb; /* User EPOLLERR callback function. */
};

struct orb_loop_ops_s;
Expand Down Expand Up @@ -266,7 +266,7 @@ int orb_open(FAR const char *name, int instance, int flags);
int orb_close(int fd);

/****************************************************************************
* Name: orb_advertise_multi_queue
* Name: orb_advertise_multi_queue_info
*
* Description:
* This performs the initial advertisement of a topic; it creates the topic
Expand All @@ -278,6 +278,7 @@ int orb_close(int fd);
* instance Pointer to an integer which yield the instance ID,
* (has default 0 if pointer is NULL).
* queue_size Maximum number of buffered elements.
* info A pointer to the orb_info_t.
*
* Returned Value:
* -1 on error, otherwise returns an file descriptor
Expand All @@ -287,10 +288,21 @@ int orb_close(int fd);
* this function will return -1 and set errno to ENOENT.
****************************************************************************/

int orb_advertise_multi_queue_info(FAR const struct orb_metadata *meta,
FAR const void *data,
FAR int *instance,
unsigned int queue_size,
FAR orb_info_t *info);

static inline
int orb_advertise_multi_queue(FAR const struct orb_metadata *meta,
FAR const void *data,
FAR int *instance,
unsigned int queue_size);
unsigned int queue_size)
{
return orb_advertise_multi_queue_info(meta, data, instance,
queue_size, NULL);
}

static inline int orb_advertise(FAR const struct orb_metadata *meta,
FAR const void *data)
Expand Down Expand Up @@ -338,10 +350,22 @@ static inline int orb_advertise_multi(FAR const struct orb_metadata *meta,
* this function will return -1 and set errno to ENOENT.
****************************************************************************/

int
orb_advertise_multi_queue_persist_info(FAR const struct orb_metadata *meta,
FAR const void *data,
FAR int *instance,
unsigned int queue_size,
FAR orb_info_t *info);

static inline
int orb_advertise_multi_queue_persist(FAR const struct orb_metadata *meta,
FAR const void *data,
FAR int *instance,
unsigned int queue_size);
unsigned int queue_size)
{
return orb_advertise_multi_queue_persist_info(meta, data, instance,
queue_size, NULL);
}

/****************************************************************************
* Name: orb_unadvertise
Expand Down Expand Up @@ -691,22 +715,6 @@ int orb_set_interval(int fd, unsigned interval);

int orb_get_interval(int fd, FAR unsigned *interval);

/****************************************************************************
* Name: orb_set_info
*
* Description:
* Set topic information.
*
* Input Parameters:
* fd A fd returned from orb_subscribe.
* info Data to be transmitted.
*
* Returned Value:
* 0 on success, -1 otherwise with ERRNO set accordingly.
****************************************************************************/

int orb_set_info(int fd, FAR const orb_info_t *info);

/****************************************************************************
* Name: orb_get_info
*
Expand Down Expand Up @@ -798,7 +806,7 @@ orb_abstime orb_absolute_time(void);
* then Past system time.
*
* Returned Value:
* Bewteen time.
* Between time.
****************************************************************************/

static inline orb_abstime orb_elapsed_time(FAR const orb_abstime *then)
Expand Down
Loading