123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158 |
- /* Copyright (C) 2018 RDA Technologies Limited and/or its affiliates("RDA").
- * All rights reserved.
- *
- * This software is supplied "AS IS" without any warranties.
- * RDA assumes no responsibility or liability for the use of the software,
- * conveys no license or title under any patent, copyright, or mask work
- * right to the product. RDA reserves the right to make changes in the
- * software without notification. RDA also make no representation or
- * warranty that such application will be suitable for the specified use
- * without further testing or modification.
- */
- #ifndef _DRV_WCN_IPC_H_
- #define _DRV_WCN_IPC_H_
- #include "osi_compiler.h"
- #include "drv_uart.h"
- OSI_EXTERN_C_BEGIN
- /**
- * \brief opaque data struct of wcn ipc uart
- */
- typedef struct drvWcnIpcUart drvWcnIpcUart_t;
- /**
- *\brief set bt power rollback
- *
- *This function is used to reduce the power of bt by 1db
- *
- *\param if_power_rollback reduce when 1,and not when 0.
- */
- void drvWcnSetBtPowerRollback(uint32_t if_power_rollback);
- /**
- * \brief initialize btfw start psram
- *
- * The main purpose of the func is for dynamic config btfw runing addr and space size
- * \param btfw_base ,psram addr load btfw
- * \param btfw_ramsize ,psram size used in btfw
- */
- void drvWcnSetBtfwStartParam(uint32_t btfw_base, uint32_t btfw_ramsize);
- /**
- * \brief set max adv num
- *
- * The main purpose of the func is set the max adv num for scan filter,
- * \param max_adv_num ,set the max adv num for scan filter,value 0~60,0 is disable
- */
- void drvWcnSetBtMaxAdvNum(uint32_t max_adv_num);
- /**
- * \brief initialize wcn ipc
- *
- * The main purpose of wcn ipc is to provide one instance of
- * \p drvWcnIpcUart_t.
- */
- void drvWcnIpcInit(void);
- /**
- * \brief reset wcn ipc
- *
- * This should be called at reload wcn firmware and reset wcn.
- */
- void drvWcnIpcReset(void);
- /**
- * \brief open wcn ipc uart
- *
- * There is buffer for rx (from wcn to ap). It can reduce the latency to
- * fetch rx data from shared memory.
- *
- * At open, the rx data in shared memory will be kept.
- *
- * \param cb event callback
- * \param rx_size rx fifo size
- * \param cb_ctx event callback context
- * \param event_mask event mask
- * \return
- * - wcn ipc uart instance
- * - NULL on error, out of memory
- */
- drvWcnIpcUart_t *drvWcnIpcUartOpen(unsigned rx_size, drvUartEventCB_t cb,
- void *cb_ctx, unsigned event_mask);
- /**
- * \brief close wcn ipc usrt
- *
- * After close, the instance will be freed. So, don't access the instance
- * after close.
- *
- * \param uart wcn ipc uart instance
- */
- void drvWcnIpcUartClose(drvWcnIpcUart_t *uart);
- /**
- * \brief read data from uart channel
- *
- * When the read size may be less than \p size.
- *
- * \param uart wcn ipc uart instance
- * \param data memory for read data
- * \param size memory size
- * \return
- * - real read size
- * = -1 on error
- */
- int drvWcnIpcUartRead(drvWcnIpcUart_t *uart, void *data, unsigned size);
- /**
- * \brief write data to uart channel
- *
- * The the written size may be less than \p size.
- *
- * \param uart wcn ipc uart instance
- * \param data data to be written
- * \param size data size to be written
- * \return
- * - real written size
- * - -1 on error
- */
- int drvWcnIpcUartWrite(drvWcnIpcUart_t *uart, const void *data, unsigned size);
- /**
- * \brief write data to uart channel with waiting
- *
- * \param uart wcn ipc uart instance
- * \param data data to be written
- * \param size data size to be written
- * \param timeout timeout in milliseconds
- * \return
- * - real written size
- * - -1 on error
- */
- int drvWcnIpcUartWriteAll(drvWcnIpcUart_t *uart, const void *data, unsigned size, unsigned timeout);
- /**
- * \brief uart channel read available byte count
- *
- * \param uart wcn ipc uart instance
- * \return
- * - read available byte count
- * - -1 on error
- */
- int drvWcnIpcUartReadAvail(drvWcnIpcUart_t *uart);
- /**
- * \brief uart channel write space byte count
- *
- * \param uart wcn ipc uart instance
- * \return
- * - write space byte count
- * - -1 on error
- */
- int drvWcnIpcUartWriteAvail(drvWcnIpcUart_t *uart);
- OSI_EXTERN_C_END
- #endif
|