quasar_fifo.h

This module provides the functions to used the FIFO buffers for UART and I2C transmission and reception.

Copyright

Copyright (C) 2026 SPARK Microsystems International Inc. All rights reserved.

License

This source code is proprietary and subject to the SPARK Microsystems Software EULA found in this package in file EULA.txt.

Author

SPARK FW Team.

Defines

QUASAR_FIFO_BUFFER_SIZE 4096

Size of the data array used in each FIFO instance, AKA the FIFO buffer capacity.

Typedefs

typedef struct quasar_fifo quasar_fifo_t

Structure representing a First-In-First-Out buffer for the Quasar.

Functions

void quasar_fifo_init(quasar_fifo_t *fifo_to_init)

Initialize the Quasar FIFO buffer.

Parameters:

fifo_to_init[in] Quasar FIFO buffer to be initialized.

uint8_t quasar_fifo_push(quasar_fifo_t *fifo, uint8_t new_data)

Pushes a byte into the Quasar FIFO buffer.

Parameters:
  • fifo[in] Quasar FIFO buffer to push data into.

  • new_data[in] New byte to be added to the FIFO buffer.

Returns:

Return 0 if the push was successful or non-zero value if the buffer is full.

uint8_t quasar_fifo_push_bytes(quasar_fifo_t *fifo, uint8_t *new_data_array, uint16_t size_array)

Pushes multiple bytes into the Quasar FIFO buffer.

Parameters:
  • fifo[in] Quasar FIFO buffer to push data into.

  • new_data_array[in] Array of new bytes to be added to the FIFO buffer.

  • size_array[in] Size of the array which is also the number of bytes to be added to the FIFO buffer.

Returns:

Return 0 if the push was successful or non-zero value if the buffer is full.

uint8_t quasar_fifo_pull(quasar_fifo_t *fifo, uint8_t *pulled_data)

Pull a byte from a Quasar FIFO buffer.

Parameters:
  • fifo[inout] Quasar FIFO buffer from which data will be pulled.

  • pulled_data[out] Pointer to store the pulled data element.

Returns:

Returns 0 if the pull was successful or non-zero value if the buffer is empty.

uint64_t quasar_fifo_pull_bytes(quasar_fifo_t *fifo, uint16_t number_of_bytes, quasar_bsp_status_t *err)

Pull multiple bytes from a Quasar FIFO buffer.

Parameters:
  • fifo[out] Quasar FIFO buffer from which data will be pulled.

  • number_of_bytes[in] Number of bytes to be pulled from the FIFO buffer.

  • err[out] Pointer to store the error status.

Returns:

Return the pulled bytes from the FIFO.

uint32_t quasar_fifo_get_count(quasar_fifo_t *fifo)

Get the current count of the elements in a Quasar FIFO buffer.

Parameters:

fifo[inout] Quasar FIFO buffer to query.

Returns:

The count of the elements in the FIFO buffer.

struct quasar_fifo
#include <quasar_fifo.h>

Structure representing a First-In-First-Out buffer for the Quasar.

Public Members

uint8_t data[QUASAR_FIFO_BUFFER_SIZE]

The FIFO Buffer.

uint16_t count

Number of elements currently in the FIFO buffer.

uint16_t index_in

Index for inserting new elements into the FIFO buffer.

uint16_t index_out

Index for extracting elements from the FIFO buffer.