SPDIO
Ameba SDK » HAL

spdio functions More...

## Data Structures

struct | spdio_buf_t
struct | spdio_t

## Variables

void * | priv
u32 | buf_allocated
u16 | size_allocated
u32 | buf_addr
u16 | buf_size
u8 | type
u8 | reserved
void * | priv
u32 | tx_bd_num
u32 | rx_bd_num
u32 | rx_bd_bufsz
struct spdio_buf_t * | rx_buf
char(* | rx_done_cb )(void *priv, void *pbuf, u8 *pdata, u16 size, u8 type)
| pointer to callback function defined by user, called by spdio when one packet receive done More...
char(* | tx_done_cb )(void *priv, void *pbuf)
| pointer to callback function defined by user, called by spdio when one packet sent done More...

## Ameba Common

enum | spdio_rx_data_t { SPDIO_RX_DATA_NULL = 0x00, SPDIO_RX_DATA_ETH = 0x83, SPDIO_RX_DATA_ATCMD = 0x11, SPDIO_RX_DATA_USER = 0x41 }
enum | spdio_tx_data_t { SPDIO_TX_DATA_NULL = 0x00, SPDIO_TX_DATA_ETH = 0x82, SPDIO_TX_DATA_ATCMDRSP = 0x10, SPDIO_TX_DATA_USER = 0x40 }
struct spdio_t * | g_spdio_priv
| an obj which will be used to initialize sdio interface so it must be initialized before calling HalSdioInit();
void | spdio_structinit (struct spdio_t *obj)
| Gets example setting for spdio obj. More...
void | spdio_init (struct spdio_t *obj)
| Initialize spdio interface. More...
void | spdio_deinit (struct spdio_t *obj)
| Deinitialize spdio interface. More...
s8 | spdio_tx (struct spdio_t *obj, struct spdio_buf_t *pbuf)
| spdio write function. More...
#define | SPDIO_API_DBG
#define | SPDIO_API_PRINTK(fmt, args...) printf(fmt"\r\n",## args)
#define | _SPDIO_API_PRINTK(fmt, args...) printf(fmt,## args)
#define | SPDIO_DMA_ALIGN_4 4
#define | SPDIO_RX_BUFSZ_ALIGN(x) ((((x-1)>>6)+1)<<6)
#define | SPDIO_RXDESC_SZ 24

## Detailed Description

spdio functions

## Function Documentation

void spdio_deinit | ( | struct spdio_t * | obj | ) |

Deinitialize spdio interface.

Parameters

  obj | a pointer to spdio_t structure which is already initialized

Return values

  None |

void spdio_init | ( | struct spdio_t * | obj | ) |

Initialize spdio interface.

Parameters

  obj,a | pointer to a spdio_t structure which should be initialized by user, and which will be used to initialize spdio interface obj->tx_bd_num: spdio write bd number, needs 2 bd for one transaction obj->rx_bd_num: spdio read bd number obj->rx_bd_bufsz: spdio read buffer size obj->rx_buf: spdio read buffer array

Return values

  None |

void spdio_structinit | ( | struct spdio_t * | obj | ) |

Gets example setting for spdio obj.

Parameters

  obj | a pointer to an spdio_t structure which will be initialized with an example settings

Return values

  None |

s8 spdio_tx | ( | struct spdio_t * | obj,
|  | struct spdio_buf_t * | pbuf
| ) |  |

spdio write function.

Parameters

  obj | a pointer to spdio_t structure which is already initialized
  pbuf | a pointer to spdio_buf_t structure which carries the payload

Return values

  SUCCESS | or FAIL

## Variable Documentation

char(* rx_done_cb) (void *priv, void *pbuf, u8 *pdata, u16 size, u8 type)

pointer to callback function defined by user, called by spdio when one packet receive done

Parameters

  priv | a pointer to spdio_t structure which is used to initilize spdio interface
  pbuf | a pointer to spdio_buf_t structure which is spdio receive buffer
  pdata | the actual received packet payload
  size | the actual payload length
  type | the received packet type, spdio_rx_data_t

Return values

  SUCCESS | or FAIL

char(* tx_done_cb) (void *priv, void *pbuf)

pointer to callback function defined by user, called by spdio when one packet sent done

Parameters

  priv | a pointer to spdio_t structure which is used to initilize spdio interface
  pbuf | a pointer to spdio_buf_t structure which carries the transmit packet

Return values

  SUCCESS | or FAIL