Fifo

This module provides a uni-directional fifo queue for sending data pointers between threads. A typical example (no error checking):. More...

Data Structures

struct  Fifo_Attrs
 Attributes used to create a Fifo. More...

Typedefs

typedef struct Fifo_Object * Fifo_Handle
 Handle through which to reference a Fifo.

Functions

Fifo_Handle Fifo_create (Fifo_Attrs *attrs)
 Creates a fifo.
Int Fifo_get (Fifo_Handle hFifo, Ptr ptrPtr)
 Blocking call to receive a buffer pointer from a fifo.
Int Fifo_flush (Fifo_Handle hFifo)
 Flushes a fifo. The other end will unblock and return the (non-negative) Dmai_EFLUSH error code.
Int Fifo_put (Fifo_Handle hFifo, Ptr ptr)
 Put a buffer pointer on the fifo.
Int Fifo_getNumEntries (Fifo_Handle hFifo)
 Determine number of entries (pointers) currently in fifo.
Int Fifo_delete (Fifo_Handle hFifo)
 Deletes a previously created fifo.

Variables

const Fifo_Attrs Fifo_Attrs_DEFAULT
 Default attributes for a Fifo.

Detailed Description

This module provides a uni-directional fifo queue for sending data pointers between threads. A typical example (no error checking):.

   #include <xdc/std.h>
   #include <ti/sdo/dmai/Fifo.h>
   Fifo_Attrs fAttrs = Fifo_Attrs_DEFAULT;
   Fifo_Handle hFifo;

   Dmai_init();
   hFifo = Fifo_create(&fAttrs);
 thread1:
   extern Fifo_Handle hFifo;
   Int message[] = { 1, 2, 3 };
   Fifo_put(hFifo, message);
 thread2:
   extern Fifo_Handle hFifo;
   Int *msgPtr;
   Fifo_get(hFifo, &msgPtr);
   // msgPtr now points to the message[] array from main.

Typedef Documentation

typedef struct Fifo_Object* Fifo_Handle

Handle through which to reference a Fifo.


Function Documentation

Fifo_Handle Fifo_create ( Fifo_Attrs attrs  ) 

Creates a fifo.

Parameters:
[in] attrs Fifo_Attrs to use for creating the Fifo.
Return values:
Handle for use in subsequent operations (see Fifo_Handle).
NULL for failure.

Int Fifo_get ( Fifo_Handle  hFifo,
Ptr  ptrPtr 
)

Blocking call to receive a buffer pointer from a fifo.

Parameters:
[in] hFifo Fifo_Handle from which to receive a buffer.
[out] ptrPtr A pointer to the pointer to be set.
Return values:
Dmai_EOK if a buffer was successfully received.
Dmai_EFLUSH if the fifo was flushed.
Negative value for failure, see Dmai.h.
Remarks:
Fifo_create must be called before this function.

Int Fifo_flush ( Fifo_Handle  hFifo  ) 

Flushes a fifo. The other end will unblock and return the (non-negative) Dmai_EFLUSH error code.

Parameters:
[in] hFifo Fifo_Handle which to flush.
Return values:
Dmai_EOK for success.
Negative value for failure, see Dmai.h.
Remarks:
Fifo_create must be called before this function.

Int Fifo_put ( Fifo_Handle  hFifo,
Ptr  ptr 
)

Put a buffer pointer on the fifo.

Parameters:
[in] hFifo Fifo_Handle to which to send a buffer.
[in] ptr The pointer to put to the fifo.
Return values:
Dmai_EOK for success.
Negative value for failure, see Dmai.h.
Remarks:
Fifo_create must be called before this function.

Int Fifo_getNumEntries ( Fifo_Handle  hFifo  ) 

Determine number of entries (pointers) currently in fifo.

Parameters:
[in] hFifo Fifo_Handle which to investigate.
Return values:
Number of entries in the fifo on success.
Negative value for failure, see Dmai.h.
Remarks:
Fifo_create must be called before this function.

Int Fifo_delete ( Fifo_Handle  hFifo  ) 

Deletes a previously created fifo.

Parameters:
[in] hFifo Fifo_Handle for the fifo to delete.
Return values:
Dmai_EOK for success.
Negative value for failure, see Dmai.h.
Remarks:
Fifo_create must be called before this function.


Variable Documentation

Default attributes for a Fifo.

 numElems     = 20


Copyright 2011, Texas Instruments Incorporated