4 #include "migration/vmstate.h"
7 /* All fields are private */
16 * @fifo: struct Fifo8 to initialise with new FIFO
17 * @capacity: capacity of the newly created FIFO
19 * Create a FIFO of the specified size. Clients should call fifo8_destroy()
20 * when finished using the fifo. The FIFO is initially empty.
23 void fifo8_create(Fifo8
*fifo
, uint32_t capacity
);
27 * @fifo: FIFO to cleanup
29 * Cleanup a FIFO created with fifo8_create(). Frees memory created for FIFO
30 *storage. The FIFO is no longer usable after this has been called.
33 void fifo8_destroy(Fifo8
*fifo
);
37 * @fifo: FIFO to push to
38 * @data: data byte to push
40 * Push a data byte to the FIFO. Behaviour is undefined if the FIFO is full.
41 * Clients are responsible for checking for fullness using fifo8_is_full().
44 void fifo8_push(Fifo8
*fifo
, uint8_t data
);
48 * @fifo: fifo to pop from
50 * Pop a data byte from the FIFO. Behaviour is undefined if the FIFO is empty.
51 * Clients are responsible for checking for emptyness using fifo8_is_empty().
53 * Returns: The popped data byte.
56 uint8_t fifo8_pop(Fifo8
*fifo
);
60 * @fifo: FIFO to reset
62 * Reset a FIFO. All data is discarded and the FIFO is emptied.
65 void fifo8_reset(Fifo8
*fifo
);
69 * @fifo: FIFO to check
71 * Check if a FIFO is empty.
73 * Returns: True if the fifo is empty, false otherwise.
76 bool fifo8_is_empty(Fifo8
*fifo
);
80 * @fifo: FIFO to check
82 * Check if a FIFO is full.
84 * Returns: True if the fifo is full, false otherwise.
87 bool fifo8_is_full(Fifo8
*fifo
);
89 extern const VMStateDescription vmstate_fifo8
;
91 #define VMSTATE_FIFO8(_field, _state) { \
92 .name = (stringify(_field)), \
93 .size = sizeof(Fifo8), \
94 .vmsd = &vmstate_fifo8, \
95 .flags = VMS_STRUCT, \
96 .offset = vmstate_offset_value(_state, _field, Fifo8), \