BK_DMA2D

[English]

BK_DMA2D API Status

API

bk_dma2d_init()

bk_dma2d_deinit()

bk_dma2d_int_enable()

bk_dma2d_register_int_callback_isr()

bk_dma2d_memcpy()

bk_dma2d_pixel_convert()

bk_dma2d_blend()

bk_dma2d_fill()

bk_dma2d_is_transfer_busy()

BK_DMA2D API Reference

Header File

Functions

int32_t bk_dma2d_init(void)

Deinitializes the DMA2D peripheral registers to their default reset values.

  • reset the dma2d driver init reg

返回值:
  • 0 – success [BK_RET_OK]

  • other – fail

返回:

result

int32_t bk_dma2d_deinit(void)

Deinitializes the DMA2D peripheral registers to their default reset values.

  • reset the dma2d driver init reg

返回值:
  • 0 – success [BK_RET_OK]

  • other – fail

返回:

result

int32_t bk_dma2d_int_enable(dma2d_int_type_e int_type, bool enable)

dma2d int enable.

Usage example: bk_dma2d_register_int_callback_isr(DMA2D_CFG_ERROR_ISR, function_cbk, pa_arg); bk_dma2d_register_int_callback_isr(DMA2D_TRANS_COMPLETE_ISR, function_cbk1, pa_arg1); bk_dma2d_int_enable(DMA2D_TRANS_ERROR | DMA2D_TRANS_COMPLETE ,1);

参数:
  • int_type[in] select from dma2d_int_type_t, include int type:

    • DMA2D_CFG_ERROR

    • DMA2D_CLUT_TRANS_COMPLETE

    • DMA2D_CLUT_TRANS_ERROR

    • DMA2D_WARTERMARK_INT

    • DMA2D_TRANS_COMPLETE

    • DMA2D_TRANS_ERROR

  • enable[in] 1:enable int, 0 disable int

返回值:
  • 0 – success [BK_RET_OK]

  • other – fail

返回:

result

int32_t bk_dma2d_register_int_callback_isr(dm2d_isr_id_e isr_id, pfunc_bk_dma2d_cb_t cb_isr, void *pv_arg)

register dma2d int type isr open the macro #define USE_HAL_DMA2D_REGISTER_CALLBACKS 1

参数:
  • isr_id[in] based on int type, a int type can register a isr, select from: typedef enum { DMA2D_CFG_ERROR_ISR = 0, DMA2D_CLUT_TRANS_COMPLETE_ISR, DMA2D_CLUT_TRANS_ERROR_ISR, DMA2D_WARTERMARK_INT_ISR, DMA2D_TRANS_COMPLETE_ISR, DMA2D_TRANS_ERROR_ISR, }dm2d_isr_id;

  • cb_isr[in] the user register int callback function

  • pv_arg[in] callback parameter

返回值:
  • 0 – success [BK_RET_OK]

  • other – fail

返回:

result

int32_t bk_dma2d_memcpy(bk_dma2d_memcpy_t *p_memcopy)

config dma2d memcopy

参数:

p_memcopy[in] bk_dma2d_memcpy_t struct to config pixel convert params

返回值:
  • 0 – success [BK_RET_OK]

  • other – fail

返回:

result

int32_t bk_dma2d_pixel_convert(bk_dma2d_pixel_convert_t *pixel_convert)

config dma2d pixel revert

参数:

pixel_convert[in] bk_dma2d_pixel_convert_t struct to config pixel convert params

返回值:
  • 0 – success [BK_RET_OK]

  • other – fail

返回:

result

int32_t bk_dma2d_blend(bk_dma2d_blend_t *dma2d_blebnd)

config dma2d blend

参数:

dma2d_blebnd[in] bk_dma2d_blend_t struct to config blend params

返回值:
  • 0 – success [BK_RET_OK]

  • other – fail

返回:

result

int32_t bk_dma2d_fill(bk_dma2d_fill_t *fill)

config dma2d fill color

参数:

fill[in] bk_dma2d_fill_t struct to config dma2d fill params

返回值:
  • 0 – success [BK_RET_OK]

  • other – fail

返回:

result

bool bk_dma2d_is_transfer_busy(void)

this API is check dma2d is transfer busy or not

返回值:
  • 0 – transfer stop or transfer done;

  • 1 – dma2d is work or transfer not done

返回:

transfer status

Structures

struct bk_dma2d_memcpy_t

Public Members

void *input_addr

memcpy or partical copy start addr, in other word, the lcd frame addr add offset addr is the start copy addr

void *output_addr

memcpy or partical copy dst addr, in other word, the dst frame addr add dst offset addr is the end copy addr

uint32_t xsize

he memcpy or partical copy width

uint32_t ysize

the memcpy or partical copy hight

uint32_t intput_offline

for partical copy this is to calculate start copy addr based frame addr, uint by pixel

uint32_t output_offline

for partical copy this is to calculate copy to dst addr based frame addr, uint by pixel

out_color_mode_e color_mode

The pixel convert src color mode

struct bk_dma2d_pixel_convert_t

Public Members

void *input_addr

The pixel convert src addr

void *output_addr

The pixel convert dst addr

uint32_t xsize

image width

uint32_t ysize

image height

input_color_mode_e input_color_mode

The pixel convert src color mode

out_color_mode_e output_color_mode

The pixel convert dst color mode

uint32_t intput_offline

set src offset addr, mem start addr to pixel convert

uint32_t output_offline

set dst offset addr, write to mem dst addr

red_blue_swap_e intput_red_blue_swap

src img red blue swap, select DMA2D_RB_SWAP or DMA2D_RB_REGULAR

red_blue_swap_e output_red_blue_swap

src img red blue swap, select DMA2D_RB_SWAP or DMA2D_RB_REGULAR

struct bk_dma2d_blend_t

Public Members

void *pfg_addr

The source memory Buffer address for the foreground layer..

void *pbg_addr

he source memory Buffer address for the background layer…

void *pdst_addr

The output memory Buffer address ..

input_color_mode_e fg_color_mode

fg color mode..

input_color_mode_e bg_color_mode

bg color mode..

out_color_mode_e dst_color_mode

out color mode..

uint32_t fg_offline

for partical copy this is to calculate start addr based on fg frame addr, uint by pixel

uint32_t bg_offline

for partical copy this is to calculate start addr based on bg frame addr, uint by pixel

uint32_t dest_offline

for partical copy this is to calculate output addr based on dst frame addr, uint by pixel

uint32_t xsize

dma2d blend x size..

uint32_t ysize

dma2d blend y size..

uint8_t fg_alpha_value

config fg alpha..

uint8_t bg_alpha_value

config bg alpha.

red_blue_swap_e red_bule_swap

DMA2D_RB_SWAP or DMA2D_RB_REGULAR

struct bk_dma2d_fill_t

Public Members

void *frameaddr

dma2d fill frame baseaddr , normally LCD start frame addr

uint16_t frame_xsize

img/lcd x size

uint16_t frame_ysize

img/lcd y size

uint16_t xpos

dma2d fill x pos based on frame_xsize

uint16_t ypos

dma2d fill y pos based on frame_ysize

uint16_t width

dma2d fill width

uint16_t high

dma2d fill height

uint16_t color

dma2d fill color

Type Definitions

typedef void (*pfunc_bk_dma2d_cb_t)(void *pv_arg)