BK_DLP
BK_DLP API Status
API |
|---|
BK_DLP API Reference
Header File
Functions
-
uint32_t bk_dlp_open(uint32_t dev_index)
beken dlp open interface.
提供dlp open的接口,使用之前需要先open,参数是设备index,从0开始
- 参数:
dev_index – [in] device index, always equal 0
- 返回值:
0 – fail
other – success
- 返回:
handle
-
int32_t bk_dlp_close(uint32_t handle)
beken dlp close.
使用DLP结束后需要close,调用前需要先 bk_dlp_stop()
- 参数:
handle – [in] return value of bk_dlp_open()
- 返回值:
0 – success [BK_RET_OK]
other – fail
- 返回:
result
-
int32_t bk_dlp_config(uint32_t handle, bk_dlp_cfg_t *pt_cfg)
dlp config interface.
在 bk_dlp_start() 之前需要先进行相关参数的配置
- 参数:
handle – [in] return value of bk_dlp_open()
pt_cfg – [in] pointer to the config struct
- 返回值:
0 – success [BK_RET_OK]
other – fail
- 返回:
result
-
int32_t bk_dlp_start(uint32_t handle, bool master_tx_first)
beken dlp start.
start DLP function after config dlp parameter
- 参数:
handle – [in] return value of bk_dlp_open()
master_tx_first – [in] true: tx first for master false: rx first for slave
- 返回值:
0 – success [BK_RET_OK]
other – fail
- 返回:
result
-
int32_t bk_dlp_stop(uint32_t handle)
beken dlp stop.
stop dlp function, 和 bk_dlp_start() 的动作相反
- 参数:
handle – [in] return value of bk_dlp_open()
- 返回值:
0 – success [BK_RET_OK]
other – fail
- 返回:
result
-
int32_t bk_dlp_write(uint32_t handle, uint8_t *pu1_buf, uint16_t buf_len)
beken dlp write interface.
使用DLP来发送一些数据出去,该函数是一个同步发送函数,在送走数据后才会返回
- 参数:
handle – [in] return value of bk_dlp_open()
pu1_buf – [in] pointer to the send buffer
buf_len – [in] send buffer length in bytes
- 返回值:
0 – success [BK_RET_OK]
other – fail
- 返回:
result
-
int32_t bk_dlp_write_keep_active(uint32_t handle, uint8_t *pu1_buf, uint16_t buf_len, uint32_t active_timeout_ms)
beken dlp write interface.
使用DLP来发送一些数据出去,该函数是一个同步发送函数,在送走数据后才会返回 和bk_dlp_write()不同的是该函数会自动让DLP保持active而不发生reset
- 参数:
handle – [in] return value of bk_dlp_open()
pu1_buf – [in] pointer to the send buffer
buf_len – [in] send buffer length in bytes
active_timeout_ms – [in] active DLP after this time
- 返回值:
0 – success [BK_RET_OK]
other – fail
- 返回:
result
-
int32_t bk_dlp_read(uint32_t handle, uint8_t *pu1_buf, uint16_t buf_len, pfunc_bk_dlp_cb_t pfn_cb)
beken dlp read interface.
使用DLP收一些数据回来,如果pfn_cb==NULL,则该函数从dlp收完数据后才会返回 如果pfn_cb!=NULL,该函数会立即返回,等后面数据收完后通过 pfn_cb进行通知
- 参数:
handle – [in] return value of bk_dlp_open()
pu1_buf – [in] pointer to the receive buffer
buf_len – [in] receive buffer length in bytes
pfn_cb – [in] callback function for async recevie. it can be NULL if you do not want async recevie
- 返回值:
0 – success [BK_RET_OK]
other – fail
- 返回:
result
-
int32_t bk_dlp_reg_notify_callback(uint32_t handle, pfunc_bk_dlp_notify_t pfn_notify)
register notify callback for DLP.
- 参数:
handle – [in] return value of bk_dlp_open()
pfn_notify – [in] 回调函数
- 返回值:
0 – success [BK_RET_OK]
other – fail
- 返回:
result
-
uint32_t bk_dlp_get_remain_bytes(uint32_t handle)
get current rx remain bytes which is not read for user.
- 参数:
handle – [in] return value of bk_dlp_open()
- 返回:
remain bytes
-
int32_t bk_dlp_rx_enable(uint32_t handle, bool enable)
enable or disable DLP rx.
- 参数:
handle – [in] return value of bk_dlp_open()
enable – [in] true: enable rx false: disable rx
- 返回值:
0 – success [BK_RET_OK]
other – fail
- 返回:
result
-
bool bk_dlp_is_dlp_active(void)
check DLP is active or not.
- 返回:
DLP active state
-
void bk_dlp_ana_enable(bool enable)
enable/disable DLP analog switch.
- 参数:
enable – [in] true: 打开模拟开关 false: 关闭模拟开关
- 返回:
N/A
Structures
-
struct _bk_dlp_cfg_t
Macros
-
DLP_ACTIVE_PERIOD_MS
Type Definitions
-
typedef void (*pfunc_bk_dlp_cb_t)(uint32_t handle, uint8_t *pu1_buf, uint16_t buf_len, bool attach)
-
typedef void (*pfunc_bk_dlp_notify_t)(bool attach, uint16_t remain_bytes)
-
typedef struct _bk_dlp_cfg_t bk_dlp_cfg_t