This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

understanding app_sched_queue_space_get()

I'm trying to understand the function app_sched_queue_space_get()

There is a description on the following page:
https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.sdk5.v16.0.0%2Fgroup__app__scheduler.html

uint16_t app_sched_queue_space_get ( void  )

Function for getting the current amount of free space in the queue.

The real amount of free space may be less if entries are being added from an interrupt. To get the sxact value, this function should be called from the critical section.

Returns
Amount of free space in the queue.

I'm not sure what sxact means? It could be a typo, but I found it on all SDK versions.

The documentation doesn't tell what unit this function returns? Is it available bytes or slots?

When I run my program, this function usually returns 31. I thought that if I increase SCHED_QUEUE_SIZE, the value would increase as well?
I tried SCHED_QUEUE_SIZE 192 and 1024, but the return value remains around 31.
I do see a decrease in RAM in the memory usage (view - memory usage) when I increase the queue size.

I'm using s140_nrf52_7.0.1_softdevice

Parents
  • Hi Philip

    I'm not sure what sxact means? It could be a typo, but I found it on all SDK versions.

    It is a typo. needs to be fixed. 

     

    The documentation doesn't tell what unit this function returns? Is it available bytes or slots?

    The unit is same as the unit of queue_size in app_sched_init. So it is the number of free slots/entries available.

     

    When I run my program, this function usually returns 31. I thought that if I increase SCHED_QUEUE_SIZE, the value would increase as well?
    I tried SCHED_QUEUE_SIZE 192 and 1024, but the return value remains around 31.
    I do see a decrease in RAM in the memory usage (view - memory usage) when I increase the queue size.

     seems like the compiler is optimizing something away from you get the space. try making the return value type for app_sched_queue_space_get as volatile. Also check the value of m_queue_start_index and m_queue_end_index inside the app_scheduler.c to see if their difference matches your result.

Reply
  • Hi Philip

    I'm not sure what sxact means? It could be a typo, but I found it on all SDK versions.

    It is a typo. needs to be fixed. 

     

    The documentation doesn't tell what unit this function returns? Is it available bytes or slots?

    The unit is same as the unit of queue_size in app_sched_init. So it is the number of free slots/entries available.

     

    When I run my program, this function usually returns 31. I thought that if I increase SCHED_QUEUE_SIZE, the value would increase as well?
    I tried SCHED_QUEUE_SIZE 192 and 1024, but the return value remains around 31.
    I do see a decrease in RAM in the memory usage (view - memory usage) when I increase the queue size.

     seems like the compiler is optimizing something away from you get the space. try making the return value type for app_sched_queue_space_get as volatile. Also check the value of m_queue_start_index and m_queue_end_index inside the app_scheduler.c to see if their difference matches your result.

Children
No Data
Related