Event Logger APIs

Event Logger

void sys_event_logger_init(struct event_logger *logger, uint32_t *logger_buffer, uint32_t buffer_size)

Initialize the event logger.

This routine initializes the ring buffer.

Return
N/A
Parameters
  • logger: Logger to be initialized.
  • logger_buffer: Pointer to the buffer to be used by the logger.
  • buffer_size: Size of the buffer in 32-bit words.

void sys_event_logger_put(struct event_logger *logger, uint16_t event_id, uint32_t *event_data, uint8_t data_size)

Send an event message to the logger.

This routine adds an event message to the ring buffer and signals the sync semaphore to indicate that event messages are available.

Return
N/A
Parameters
  • logger: Pointer to the event logger used.
  • event_id: The profiler event’s ID.
  • event_data: Pointer to the data of the message.
  • data_size: Size of the buffer in 32-bit words.

int sys_event_logger_get(struct event_logger *logger, uint16_t *event_id, uint8_t *dropped_event_count, uint32_t *buffer, uint8_t *buffer_size)

Retrieve an event message from the logger.

This routine retrieves an event message from the ring buffer and copies it to the provided buffer. If the provided buffer is smaller than the message size the function returns -EMSGSIZE. Otherwise, it returns the number of 32-bit words copied. The function retrieves messages in FIFO order. If there is no message in the buffer the function returns immediately. It can only be called from a fiber.

Parameters
  • logger: Pointer to the event logger used.
  • event_id: Pointer to the id of the fetched event.
  • dropped_event_count: Pointer to the number of events dropped.
  • buffer: Pointer to the buffer for the copied message.
  • buffer_size: Size of the buffer in 32-bit words. Updated with the actual message’s size.
Return Value
  • EMSGSIZE: If the buffer size is smaller than the message size.
  • Number: of 32-bit words copied.
  • 0: If no message was already available.

int sys_event_logger_get_wait(struct event_logger *logger, uint16_t *event_id, uint8_t *dropped_event_count, uint32_t *buffer, uint8_t *buffer_size)

Retrieve an event message from the logger, wait if empty.

This routine retrieves an event message from the ring buffer and copies it to the provided buffer. If the provided buffer is smaller than the message size the function returns -EMSGSIZE. Otherwise, it returns the number of 32-bit words copied.

The function retrieves messages in FIFO order. The caller pends if there is no message available in the buffer. It can only be called from a fiber.

Parameters
  • logger: Pointer to the event logger used.
  • event_id: Pointer to the ID of the fetched event.
  • dropped_event_count: Pointer to the number of dropped events.
  • buffer: Pointer to the buffer for the copied messages.
  • buffer_size: Size of the buffer in 32-bit words. Updated with the actual message’s size.
Return Value
  • EMSGSIZE: If the buffer size is smaller than the message size.
  • Number: of DWORDs copied, otherwise.

int sys_event_logger_get_wait_timeout(struct event_logger *logger, uint16_t *event_id, uint8_t *dropped_event_count, uint32_t *buffer, uint8_t *buffer_size, uint32_t timeout)

Retrieve an event message from the logger, wait with a timeout if empty.

This routine retrieves an event message from the ring buffer and copies it to the provided buffer. If the provided buffer is smaller than the message size the routine returns -EMSGSIZE. Otherwise, it returns the number of dwords copied. The function retrieves messages in FIFO order. If no message is available in the buffer, the caller pends until a new message is added or the timeout expires. This routine can only be called from a fiber.

Parameters
  • logger: Pointer to the event logger used.
  • event_id: Pointer to the ID of the event fetched.
  • dropped_event_count: Pointer to the number of dropped events.
  • buffer: Pointer to the buffer for the copied message.
  • buffer_size: Size of the buffer in 32-bit words. Updated with the actual message size.
  • timeout: Timeout in ticks.
Return Value
  • EMSGSIZE: if the buffer size is smaller than the message size.
  • Number: of 32-bit words copied.
  • 0: If the timeout expired and there was no message already available.