NetBurner 3.5.6
PDF Version

Typedefs

typedef void(* SAI_BufferDoneFn_t) (void *buffer, int doneInvalid)
 Callback function type for buffer completion notifications.
 

Detailed Description

Typedef Documentation

◆ SAI_BufferDoneFn_t

typedef void(* SAI_BufferDoneFn_t) (void *buffer, int doneInvalid)

#include <sai.h>

Callback function type for buffer completion notifications.

This callback is invoked from interrupt context when a buffer transfer completes or encounters an error. The callback should return quickly and defer any lengthy processing to a task context.

Parameters
bufferPointer to the buffer that completed (same pointer passed to TransmitBuffer or ReadyReceiveBuffer)
doneInvalidStatus indicator for the buffer completion:
  • **< -1**: Channel error, buffer state unchanged (may be retried)
  • -1: Transfer error, buffer retired (do not reuse immediately)
  • 0: Half transfer complete (if half-notify enabled), second half still in progress
  • **> 0**: Buffer completely transferred successfully
Note
This callback executes in interrupt context. Keep processing minimal:
  • Do NOT call blocking functions
  • Do NOT perform long computations
  • Use RTOS signaling (semaphores, flags) to defer work to tasks
  • Avoid excessive printing
Warning
The buffer pointer is only valid if the completion status is non-negative. For error conditions (< 0), the buffer may be in an indeterminate state.
void myBufferCallback(void *buffer, int doneInvalid) {
if (doneInvalid > 0) {
// Success - buffer fully transferred
OSSemPost(&bufferDoneSemaphore);
} else if (doneInvalid == 0) {
// Half complete - can start processing first half
ProcessFirstHalf(buffer);
} else {
// Error condition
iprintf("Buffer error: %d\n", doneInvalid);
}
}