no-OS
All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
oa_tc6.c File Reference
#include <errno.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <string.h>
#include "no_os_alloc.h"
#include "oa_tc6.h"
Include dependency graph for oa_tc6.c:

Functions

int oa_rx_chunk_to_frame (struct oa_tc6_desc *desc, uint8_t *chunks, uint32_t len)
 
int oa_tc6_reg_read (struct oa_tc6_desc *desc, uint32_t addr, uint32_t *val)
 Read a register value.
 
int oa_tc6_reg_write (struct oa_tc6_desc *desc, uint32_t addr, uint32_t val)
 Write a register value.
 
int oa_tc6_reg_update (struct oa_tc6_desc *desc, uint32_t addr, uint32_t val, uint32_t mask)
 Update a field inside a register.
 
int oa_tc6_get_tx_frame (struct oa_tc6_desc *desc, struct oa_tc6_frame_buffer **buffer)
 Get a frame buffer that can be filled by user.
 
int oa_tc6_put_tx_frame (struct oa_tc6_desc *desc, struct oa_tc6_frame_buffer *buffer)
 Mark a frame buffer as ready to be transmitted.
 
int oa_tc6_get_rx_frame_match_vs (struct oa_tc6_desc *desc, struct oa_tc6_frame_buffer **buffer, uint8_t vs, uint8_t mask)
 Get a frame buffer that is ready to be read by the user. The VS field in the chunk footer fields should match what is provided.
 
int oa_tc6_get_rx_frame (struct oa_tc6_desc *desc, struct oa_tc6_frame_buffer **buffer)
 Get a frame buffer that is ready to be read by the user.
 
int oa_tc6_put_rx_frame (struct oa_tc6_desc *desc, struct oa_tc6_frame_buffer *buffer)
 Mark a frame buffer as used and ready to be rewritten.
 
int oa_tc6_thread (struct oa_tc6_desc *desc)
 Transmit all the frames in the OA_BUFF_TX_READY state and receive the frames in the OA_BUFF_RX_COMPLETE state.
 
int oa_tc6_init (struct oa_tc6_desc **desc, struct oa_tc6_init_param *param)
 Allocate resources for the OA TC6 driver.
 
int oa_tc6_remove (struct oa_tc6_desc *desc)
 Free a device descriptor.
 

Function Documentation

◆ oa_rx_chunk_to_frame()

int oa_rx_chunk_to_frame ( struct oa_tc6_desc * desc,
uint8_t * chunks,
uint32_t len )

◆ oa_tc6_get_rx_frame()

int oa_tc6_get_rx_frame ( struct oa_tc6_desc * desc,
struct oa_tc6_frame_buffer ** buffer )

Get a frame buffer that is ready to be read by the user.

Parameters
desc- the OA TC6 descriptor.
buffer- buffer containing the frame received.
Returns
0 in case of success, negative error code otherwise

◆ oa_tc6_get_rx_frame_match_vs()

int oa_tc6_get_rx_frame_match_vs ( struct oa_tc6_desc * desc,
struct oa_tc6_frame_buffer ** buffer,
uint8_t vs,
uint8_t mask )

Get a frame buffer that is ready to be read by the user. The VS field in the chunk footer fields should match what is provided.

Parameters
desc- the OA TC6 descriptor.
buffer- buffer containing the frame received.
vs- the value of the VS field to match.
mask- the mask to apply to the VS field.
Returns
0 in case of success, negative error code otherwise
Here is the caller graph for this function:

◆ oa_tc6_get_tx_frame()

int oa_tc6_get_tx_frame ( struct oa_tc6_desc * desc,
struct oa_tc6_frame_buffer ** buffer )

Get a frame buffer that can be filled by user.

Parameters
desc- the OA TC6 descriptor.
buffer- buffer containing the frame to be transmitted.
Returns
0 in case of success, negative error code otherwise
Here is the caller graph for this function:

◆ oa_tc6_init()

int oa_tc6_init ( struct oa_tc6_desc ** desc,
struct oa_tc6_init_param * param )

Allocate resources for the OA TC6 driver.

Parameters
desc- the device descriptor to be initialized
param- the device's parameter
Returns
0 in case of success, negative error code otherwise
Here is the caller graph for this function:

◆ oa_tc6_put_rx_frame()

int oa_tc6_put_rx_frame ( struct oa_tc6_desc * desc,
struct oa_tc6_frame_buffer * buffer )

Mark a frame buffer as used and ready to be rewritten.

Parameters
desc- the OA TC6 descriptor.
buffer- buffer containing the frame read by the user.
Returns
0 in case of success, negative error code otherwise
Here is the caller graph for this function:

◆ oa_tc6_put_tx_frame()

int oa_tc6_put_tx_frame ( struct oa_tc6_desc * desc,
struct oa_tc6_frame_buffer * buffer )

Mark a frame buffer as ready to be transmitted.

Parameters
desc- the OA TC6 descriptor.
buffer- buffer containing the frame to be transmitted.
Returns
0 in case of success, negative error code otherwise
Here is the caller graph for this function:

◆ oa_tc6_reg_read()

int oa_tc6_reg_read ( struct oa_tc6_desc * desc,
uint32_t addr,
uint32_t * val )

Read a register value.

Parameters
desc- the OA TC6 descriptor.
addr- Register address.
val- Register value.
Returns
0 in case of success, negative error code otherwise
Here is the caller graph for this function:

◆ oa_tc6_reg_update()

int oa_tc6_reg_update ( struct oa_tc6_desc * desc,
uint32_t addr,
uint32_t val,
uint32_t mask )

Update a field inside a register.

Parameters
desc- the OA TC6 descriptor.
addr- Register address.
val- Field value.
mask- Bit mask corresponding to the register field.
Returns
0 in case of success, negative error code otherwise
Here is the caller graph for this function:

◆ oa_tc6_reg_write()

int oa_tc6_reg_write ( struct oa_tc6_desc * desc,
uint32_t addr,
uint32_t val )

Write a register value.

Parameters
desc- the OA TC6 descriptor.
addr- Register address.
val- Register value.
Returns
0 in case of success, negative error code otherwise
Here is the caller graph for this function:

◆ oa_tc6_remove()

int oa_tc6_remove ( struct oa_tc6_desc * desc)

Free a device descriptor.

Parameters
desc- the device descriptor to be removed.
Returns
0
Here is the caller graph for this function:

◆ oa_tc6_thread()

int oa_tc6_thread ( struct oa_tc6_desc * desc)

Transmit all the frames in the OA_BUFF_TX_READY state and receive the frames in the OA_BUFF_RX_COMPLETE state.

Parameters
desc- the OA TC6 descriptor
Returns
0 in case of success, negative error code otherwise
Here is the caller graph for this function: