aura  0.1
 All Data Structures Functions Variables Modules Pages
aura_transport Struct Reference

#include <aura.h>

Data Fields

const char * name
 Required. More...
 
uint32_t flags
 Optional. More...
 
int buffer_overhead
 Optional. More...
 
int buffer_offset
 Optional. More...
 
int(* open )(struct aura_node *node, const char *opts)
 Required. More...
 
void(* close )(struct aura_node *node)
 Required. More...
 
void(* loop )(struct aura_node *node, const struct aura_pollfds *fd)
 Required. More...
 
void(* buffer_put )(struct aura_buffer *dst, struct aura_buffer *buf)
 Optional. More...
 
struct aura_buffer *(* buffer_get )(struct aura_buffer *buf)
 Optional. More...
 
struct aura_buffer *(* buffer_request )(struct aura_node *node, int size)
 Optional. More...
 
void(* buffer_release )(struct aura_buffer *buf)
 Optional. More...
 
int usage
 Private. More...
 
struct list_head registry
 Private. More...
 

Detailed Description

Represents an aura transport module

Definition at line 162 of file aura.h.

Field Documentation

struct aura_buffer*(* aura_transport::buffer_get)(struct aura_buffer *buf)

Optional.

Your transport may implement passing aura_buffers as arguments. This may be extremely useful for DSP applications, where you also implement your own buffer_request and buffer_release to take care of allocating memory on the DSP side. This function should deserialize and return aura_buffer from buffer buf

Parameters
buf
ptr

Definition at line 265 of file aura.h.

int aura_transport::buffer_offset

Optional.

Offset in the buffer at which core puts serialized data.

NOTE: Your buffer_overhead should more or equal buffer_offset bytes. Otherwise core will complain and refuse to register your transport.

Definition at line 195 of file aura.h.

int aura_transport::buffer_overhead

Optional.

Additional bytes to allocate for each buffer.

If your transport layer requires any additional bytes to encapsulate the actual serialized message - just specify how many. This is node to avoid unneeded copying while formatting the message for transmission in the transport layer.

Definition at line 185 of file aura.h.

void(* aura_transport::buffer_put)(struct aura_buffer *dst, struct aura_buffer *buf)

Optional.

Your transport may implement passing aura_buffers as arguments. This may be extremely useful for DSP applications, where you also implement your own buffer_request and buffer_release to take care of allocating memory on the DSP side. This function should serialize buffer buf into buffer dst. Buffer pointer/handle must be cast to uint64_t.

Parameters
buf

Definition at line 253 of file aura.h.

void(* aura_transport::buffer_release)(struct aura_buffer *buf)

Optional.

Override Buffer deallocation. This may be called if you need any special consideration when allocating and deallocating buffers (e.g. ION)

Parameters
node
size
Returns

Definition at line 303 of file aura.h.

struct aura_buffer*(* aura_transport::buffer_request)(struct aura_node *node, int size)

Optional.

Override Buffer allocation. This may be called if you need any special consideration when allocating buffers (e.g. ION). The size includes any transport-required overhead, but doesn't include the actual struct aura_buffer or any of your own data. Your code should set (struct aura_buffer *)->data field to point to the actual data

The simplest implementation would be:

struct aura_buffer *aura_buffer_internal_request(struct aura_node *node, int size) {
int act_size = sizeof(struct aura_buffer) + size;
struct aura_buffer *ret = malloc(act_size);
ret->size = size;
ret->pos = 0;
return ret;
}
Parameters
nodecurrent node
sizerequested buffer size (NOT including struct aura_buffer)
Returns

Definition at line 291 of file aura.h.

void(* aura_transport::close)(struct aura_node *node)

Required.

Close function.

The reverse of open. Free any allocated memory, etc. This function may block if required. But avoid it if you can.

Parameters
nodecurrent node

Definition at line 221 of file aura.h.

uint32_t aura_transport::flags

Optional.

Flags. TODO: Is it still needed?

Definition at line 173 of file aura.h.

void(* aura_transport::loop)(struct aura_node *node, const struct aura_pollfds *fd)

Required.

The workhorse of your transport plugin.

This function should check the node->outbound_buffers queue for any new messages to deliver and place any incoming messages into node->inbound_buffers queue.

This function is called by the core when:

  • Descriptors associated with this node report being ready for I/O (fd will be set to the descriptor that reports being ready for I/O)
  • Node's periodic timeout expires (fd will be NULL)
  • A new message has been put into outbound queue that has previously been empty (e.g. Wake up! We've got work to do) (fd will NULL)
Parameters
nodecurrent node
fdpointer to struct aura_pollfds that generated an event.

Definition at line 240 of file aura.h.

const char* aura_transport::name

Required.

String name identifying the transport e.g. "usb"

Definition at line 168 of file aura.h.

int(* aura_transport::open)(struct aura_node *node, const char *opts)

Required.

Open function.

Open function should perform sanity checking on supplied (in ap) arguments and allocate internal data structures and set required periodic timeout in the respective node. See transport-dummy.c for a boilerplate.

Avoid doing any blocking stuff in open(), do in in loop instead in non-blocking fashion.

Parameters
nodecurrent node
optsstring containing transport-specific options
Returns
0 if everything went fine, anything other will be considered an error.

Definition at line 210 of file aura.h.

struct list_head aura_transport::registry

Private.

List entry for global transport list

Definition at line 313 of file aura.h.

int aura_transport::usage

Private.

Transport usage count

Definition at line 308 of file aura.h.


The documentation for this struct was generated from the following file: