dma2d
概述
DMA2D模块提供统一的DMA2D接口
参考工程:
有关dma2d的详细信息,请参阅:
有关dma2d的示例工程,请参阅:
DMA2D API Reference
Header File
Functions
-
avdk_err_t bk_dma2d_open(bk_dma2d_ctlr_handle_t handle)
Open a DMA2D controller handle.
- 参数
handle – Handle to open
- 返回
AVDK_ERR_OK if successful, otherwise error code
-
avdk_err_t bk_dma2d_close(bk_dma2d_ctlr_handle_t handle)
Close a DMA2D controller handle.
- 参数
handle – Handle to close
- 返回
AVDK_ERR_OK if successful, otherwise error code
-
avdk_err_t bk_dma2d_delete(bk_dma2d_ctlr_handle_t handle)
Delete a DMA2D controller handle.
- 参数
handle – Handle to delete
- 返回
AVDK_ERR_OK if successful, otherwise error code
-
avdk_err_t bk_dma2d_fill(bk_dma2d_ctlr_handle_t handle, dma2d_fill_config_t *config)
Perform fill operation using DMA2D.
- 参数
handle – DMA2D controller handle
config – Fill configuration
- 返回
AVDK_ERR_OK if successful, otherwise error code
-
avdk_err_t bk_dma2d_memcpy(bk_dma2d_ctlr_handle_t handle, dma2d_memcpy_config_t *config)
Perform memory copy operation using DMA2D.
- 参数
handle – DMA2D controller handle
config – Memory copy configuration
- 返回
AVDK_ERR_OK if successful, otherwise error code
-
avdk_err_t bk_dma2d_pixel_conversion(bk_dma2d_ctlr_handle_t handle, dma2d_pfc_memcpy_config_t *config)
Perform pixel format conversion operation using DMA2D.
- 参数
handle – DMA2D controller handle
config – Pixel conversion configuration
- 返回
AVDK_ERR_OK if successful, otherwise error code
-
avdk_err_t bk_dma2d_blend(bk_dma2d_ctlr_handle_t handle, dma2d_blend_config_t *config)
Perform blend operation using DMA2D.
- 参数
handle – DMA2D controller handle
config – Blend configuration
- 返回
AVDK_ERR_OK if successful, otherwise error code
-
avdk_err_t bk_dma2d_ioctl(bk_dma2d_ctlr_handle_t handle, uint32_t ioctl_cmd, uint32_t param1, uint32_t param2, uint32_t param3)
Control IO operations of DMA2D controller.
- 参数
handle – DMA2D controller handle
ioctl_cmd – IO control command
param1 – Command parameter 1
param2 – Command parameter 2
param3 – Command parameter 3
- 返回
AVDK_ERR_OK if successful, otherwise error code
-
avdk_err_t bk_dma2d_new(bk_dma2d_ctlr_handle_t *handle)
Create a DMA2D controller handle.
- 参数
handle – Handle to create
- 返回
AVDK_ERR_OK if successful, otherwise error code
-
bk_dma2d_ctlr_handle_t bk_dma2d_handle_get(void)
get dma2d handle
- 返回
bk_dma2d_ctlr_handle_t handle
DMA2D API Typedefs
Header File
Structures
-
struct dma2d_fill_config_t
Public Members
-
dma2d_fill_t fill
dma2d fill config
-
void (*transfer_complete_cb)(dma2d_trans_status_t status, void *user_data)
dma2d transfer complete callback
-
bool is_sync
true: dma2d config valid immediately or wait for dma2d execute finish if current in use, false: dma2d config valid after dma2d execute finish if dma2d current is in use
-
dma2d_fill_t fill
-
struct dma2d_memcpy_config_t
Public Members
-
dma2d_memcpy_pfc_t memcpy
dma2d memcpy config
-
void (*transfer_complete_cb)(dma2d_trans_status_t status, void *user_data)
dma2d transfer complete callback
-
bool is_sync
true: dma2d config valid immediately or wait for dma2d execute finish if current in use, false: dma2d config valid after dma2d execute finish if dma2d current is in use
-
dma2d_memcpy_pfc_t memcpy
-
struct dma2d_pfc_memcpy_config_t
Public Members
-
dma2d_memcpy_pfc_t pfc
dma2d pfc memcpy config
-
void (*transfer_complete_cb)(dma2d_trans_status_t status, void *user_data)
dma2d transfer complete callback
-
bool is_sync
true: dma2d config valid immediately or wait for dma2d execute finish if current in use, false: dma2d config valid after dma2d execute finish if dma2d current is in use
-
dma2d_memcpy_pfc_t pfc
-
struct dma2d_blend_config_t
Public Members
-
dma2d_offset_blend_t blend
dma2d blend config
-
void (*transfer_complete_cb)(dma2d_trans_status_t status, void *user_data)
dma2d transfer complete callback
-
bool is_sync
true: dma2d config valid immediately or wait for dma2d execute finish if current in use, false: dma2d config valid after dma2d execute finish if dma2d current is in use
-
dma2d_offset_blend_t blend
-
struct bk_dma2d_ctlr
Type Definitions
-
typedef struct bk_dma2d_ctlr *bk_dma2d_ctlr_handle_t
-
typedef struct bk_dma2d_ctlr bk_dma2d_ctlr_t
Enumerations
Header File
Structures
-
struct dma2d_init_t
DMA2D Init structure definition.
Public Members
-
dma2d_mode_t mode
Configures the DMA2D transfer mode.his parameter can be one value of DMA2D_Mode.
-
uint32_t color_mode
Configures the color format of the output image. This parameter can be one value of DMA2D_Output_Color_Mode.
-
uint32_t output_offset
Specifies the Offset value. This parameter must be a number between Min_Data = 0x0000 and Max_Data = 0x3FFF.
-
uint32_t alpha_inverted
Select regular or inverted alpha value for the output pixel format converter. This parameter can be one value of DMA2D_Alpha_Inverted.
-
uint32_t line_offset_mode
Configures how is expressed the line offset for the foreground, background and output. This parameter can be one value of DMA2D_Line_Offset_Mode.
-
uint8_t red_blue_swap
Select regular mode (RGB or ARGB) or swap mode (BGR or ABGR) for the output pixel format converter. This parameter can be one value of DMA2D_RB_Swap.
-
uint8_t out_byte_by_byte_reverse
DMA2D_BYTE_REVERSE or DMA2D_NO_REVERSE , normally for 32bit color of yuv format
-
dma2d_trans_ability_t trans_ability
set defult MAX_TRANS_256BYTES
-
dma2d_mode_t mode
-
struct dma2d_layer_cfg_t
DMA2D Layer structure definition
Public Members
-
uint32_t input_offset
Configures the DMA2D foreground or background offset. This parameter must be a number between Min_Data = 0x0000 and Max_Data = 0x3FFF.
-
uint32_t input_color_mode
Configures the DMA2D foreground or background color mode. This parameter can be one value of DMA2D_Input_Color_Mode.
-
uint32_t alpha_mode
Configures the DMA2D foreground or background alpha mode.This parameter can be one value of DMA2D_Alpha_Mode.
-
uint32_t input_color
Specifies color value in case of A8 or A4 color mode.
备注
In case of A8 or A4 color mode (ARGB), this parameter must be a number between Min_Data = 0x00000000 and Max_Data = 0xFFFFFF where
Inputcolor[16:23] is the red value RED[0:7]
Inputcolor[8:15] is the green value GREEN[0:7]
Inputcolor[0:7] is the blue value BLUE[0:7].
-
uint32_t alpha_inverted
Select regular or inverted alpha value.This parameter can be one value of DMA2D_Alpha_Inverted.
-
uint32_t red_blue_swap
Select regular mode (RGB or ARGB) or swap mode (BGR or ABGR). This parameter can be one value of DMA2D_RB_Swap.
-
data_reverse_t input_data_reverse
input formart for yuv format, reverse data byte by byte or halfword by halfword.
-
uint32_t input_offset
-
struct dma2d_config_t
Public Members
-
dma2d_init_t init
dma2d init config, is the value of struct dma2d_init_t
-
dma2d_layer_cfg_t layer_cfg[MAX_DMA2D_LAYER]
dma2d layer config, is the value of struct dma2d_layer_cfg_t the param MAX_DMA2D_LAYER is select from DMA2D_BACKGROUND_LAYER and DMA2D_FOREGROUND_LAYER
-
dma2d_init_t init
-
struct 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_t fg_color_mode
fg color mode..
-
input_color_mode_t bg_color_mode
bg color mode..
-
out_color_mode_t 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_t red_bule_swap
DMA2D_RB_SWAP or DMA2D_RB_REGULAR
-
void *pfg_addr
-
struct dma2d_offset_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_t fg_color_mode
fg color mode..
-
input_color_mode_t bg_color_mode
bg color mode..
-
out_color_mode_t dst_color_mode
out color mode..
-
uint16_t fg_frame_xpos
src img start copy/pfc x pos
-
uint16_t fg_frame_ypos
src img start copy/pfc y pos
-
uint16_t bg_frame_xpos
dma2d fill x pos based on frame_xsize
-
uint16_t bg_frame_ypos
dma2d fill y pos based on frame_ysize
-
uint16_t dst_frame_xpos
dma2d fill x pos based on frame_xsize
-
uint16_t dst_frame_ypos
dma2d fill y pos based on frame_ysize
-
uint16_t fg_frame_width
src image width
-
uint16_t fg_frame_height
src image height
-
uint16_t bg_frame_width
src image width
-
uint16_t bg_frame_height
src image height
-
uint16_t dst_frame_width
src image width
-
uint16_t dst_frame_height
src image height
-
uint32_t dma2d_width
dma2d blend x size..
-
uint32_t dma2d_height
dma2d blend y size..
-
uint8_t fg_alpha_value
config fg alpha..
-
uint8_t bg_alpha_value
config bg alpha.
-
red_blue_swap_t fg_red_blue_swap
fg img red blue swap, select DMA2D_RB_SWAP or DMA2D_RB_REGULAR
-
red_blue_swap_t bg_red_blue_swap
bg img red blue swap, select DMA2D_RB_SWAP or DMA2D_RB_REGULAR
-
red_blue_swap_t dst_red_blue_swap
dst img red blue swap, select DMA2D_RB_SWAP or DMA2D_RB_REGULAR
-
data_reverse_t input_data_reverse
NO_REVERSE, BYTE_BY_BYTE_REVERSE or HFWORD_BY_HFWORD_REVERSE
-
data_reverse_t out_byte_by_byte_reverse
NO_REVERSE, BYTE_BY_BYTE_REVERSE or HFWORD_BY_HFWORD_REVERSE
-
void *pfg_addr
-
struct dma2d_memcpy_pfc_t
Public Members
-
void *input_addr
The image memcpy or pixel convert src addr
-
uint16_t src_frame_width
memcpy or pfc src image width
-
uint16_t src_frame_height
imemcpy or pfc src image height
-
uint16_t src_frame_xpos
src img start copy/pfc x pos
-
uint16_t src_frame_ypos
src img start copy/pfc y pos
-
input_color_mode_t input_color_mode
The pixel convert src color mode
-
data_reverse_t input_data_reverse
NO_REVERSE, BYTE_BY_BYTE_REVERSE or HFWORD_BY_HFWORD_REVERSE
-
red_blue_swap_t input_red_blue_swap
src img red blue swap, select DMA2D_RB_SWAP or DMA2D_RB_REGULAR
-
void *output_addr
The mage memcpy or pixel convert dst addr
-
uint16_t dst_frame_width
memcpy to dst image, the dst image width
-
uint16_t dst_frame_height
memcpy to dst image, the dst image height
-
uint16_t dst_frame_xpos
dma2d fill x pos based on frame_xsize
-
uint16_t dst_frame_ypos
dma2d fill y pos based on frame_ysize
-
out_color_mode_t output_color_mode
The pixel convert dst color mode
-
red_blue_swap_t output_red_blue_swap
src img red blue swap, select DMA2D_RB_SWAP or DMA2D_RB_REGULAR
-
uint16_t dma2d_width
dma2d memcpy or pfc width
-
uint16_t dma2d_height
dma2d memcpy or pfc height
-
uint8_t input_alpha
src data alpha, depend on alpha_mode , only used in pfc
-
uint8_t output_alpha
dst data alpha,depend on alpha_mode , only used in pfc
-
void *input_addr
-
struct 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 height
dma2d fill height
-
uint32_t color
dma2d fill color , if YUV datat fill , should fill RGB888 color data
-
void *frameaddr
Macros
-
BK_ERR_DMA2D_NOT_INIT
dma2d macos define
LCD driver not init
-
USE_HAL_DMA2D_REGISTER_CALLBACKS
if use int type isr register, set this value 1. always use with API @refs bk_dma2d_register_int_callback_isr
-
COLOR_BLACK
-
COLOR_NAVY
-
COLOR_DARKGREEN
-
COLOR_DARKCYAN
-
COLOR_MAROON
-
COLOR_PURPLE
-
COLOR_OLIVE
-
COLOR_LIGHTGREY
-
COLOR_DARKGREY
-
COLOR_BLUE
-
COLOR_GREEN
-
COLOR_CYAN
-
COLOR_RED
-
COLOR_MAGENTA
-
COLOR_YELLOW
-
COLOR_WHITE
-
COLOR_ORANGE
-
COLOR_GREENYELLOW
-
COLOR_PINK
-
COLOR_SILVER
-
COLOR_GRAY
-
COLOR_LIME
-
COLOR_TEAL
-
COLOR_FUCHSIA
-
COLOR_ESP_BKGD
-
DMA2D_OCOLR_BLUE_1
define Mode_ARGB8888/RGB888 Blue Value
-
DMA2D_OCOLR_GREEN_1
define Mode_ARGB8888/RGB888 Green Value
-
DMA2D_OCOLR_RED_1
define Mode_ARGB8888/RGB888 Red Value
-
DMA2D_OCOLR_YELLOW_1
define Mode_ARGB8888/RGB888 yellow Value
-
DMA2D_OCOLR_ALPHA_1
define Mode_ARGB8888/RGB888Alpha Channel Value
-
DMA2D_OCOLR_BLUE_3
define Mode_ARGB1555 Blue Value
-
DMA2D_OCOLR_GREEN_3
define Mode_ARGB1555Green Value
-
DMA2D_OCOLR_RED_3
define Mode_ARGB1555 Red Value
-
DMA2D_OCOLR_ALPHA_3
define Mode_ARGB1555 Alpha Channel Value
-
DMA2D_OCOLR_BLUE_4
define Mode_ARGB4444 Blue Value
-
DMA2D_OCOLR_GREEN_4
define Mode_ARGB4444 Green Value
-
DMA2D_OCOLR_RED_4
define Mode_ARGB4444 Red Value
-
DMA2D_OCOLR_ALPHA_4
define Mode_ARGB4444 Alpha Channel Value
-
DMA2D_BACKGROUND_LAYER
DMA2D Background Layer (layer 0)
-
DMA2D_FOREGROUND_LAYER
DMA2D Foreground Layer (layer 1)
-
MAX_DMA2D_LAYER
DMA2D maximum number of layers
-
DMA2D_REGULAR_ALPHA
No modification of the alpha channel value
-
DMA2D_INVERTED_ALPHA
Invert the alpha channel value
-
DMA2D_NO_REVERSE
dma2d in/out put data in order not flip
-
DMA2D_BYTE_REVERSE
input/output data reerse byte by byte for 32 bits color of YUV
-
DMA2D_HFWORD_REVERSE
input/output data reerse half-word by half-word for 32 bits color of YUV
Type Definitions
-
typedef void (*dma2d_isr_t)(void *args)
Enumerations
-
enum dm2d_isr_id_t
if USE_HAL_DMA2D_REGISTER_CALLBACKS = 1, define int isr register id
Values:
-
enumerator DMA2D_CFG_ERROR_ISR
-
enumerator DMA2D_CLUT_TRANS_COMPLETE_ISR
-
enumerator DMA2D_CLUT_TRANS_ERROR_ISR
-
enumerator DMA2D_WARTERMARK_INT_ISR
-
enumerator DMA2D_TRANS_COMPLETE_ISR
-
enumerator DMA2D_TRANS_ERROR_ISR
-
enumerator DMA2D_ISR_NUM
-
enumerator DMA2D_CFG_ERROR_ISR
-
enum dma2d_mode_t
DMA2D enum defines.
DMA2D_Mode
Values:
-
enumerator DMA2D_M2M
DMA2D memory to memory transfer mode
-
enumerator DMA2D_M2M_PFC
DMA2D memory to memory with pixel format conversion transfer mode
-
enumerator DMA2D_M2M_BLEND
DMA2D memory to memory with blending transfer mode
-
enumerator DMA2D_R2M
DMA2D register to memory transfer mode
-
enumerator DMA2D_M2M_BLEND_FG
DMA2D memory to memory with blending transfer mode and fixed color FG
-
enumerator DMA2D_M2M_BLEND_BG
DMA2D memory to memory with blending transfer mode and fixed color BG
-
enumerator DMA2D_M2M
-
enum data_reverse_t
Values:
-
enumerator NO_REVERSE
in output 32bit color(yuv) formart, not reverse data byte by byte
-
enumerator BYTE_BY_BYTE_REVERSE
in output 32bit color(yuv) formart, reverse data byte by byte
-
enumerator HFWORD_BY_HFWORD_REVERSE
in output 32bit color(yuv) formart, reverse data byte by byte
-
enumerator NO_REVERSE
-
enum out_color_mode_t
DMA2D_Output_Color_Mode , used for fillfmt / memcpy dst fmt/ blend output fmt
Values:
-
enumerator DMA2D_OUTPUT_ARGB8888
ARGB8888 DMA2D color mode
-
enumerator DMA2D_OUTPUT_RGB888
RGB888 DMA2D color mode
-
enumerator DMA2D_OUTPUT_RGB565
RGB565 DMA2D color mode
-
enumerator DMA2D_OUTPUT_ARGB1555
ARGB1555 DMA2D color mode
-
enumerator DMA2D_OUTPUT_ARGB4444
ARGB4444 DMA2D color mode
-
enumerator DMA2D_OUTPUT_YUYV
-
enumerator DMA2D_OUTPUT_UYVY
-
enumerator DMA2D_OUTPUT_YYUV
-
enumerator DMA2D_OUTPUT_UVYY
-
enumerator DMA2D_OUTPUT_VUYY
-
enumerator DMA2D_OUTPUT_ARGB8888
-
enum input_color_mode_t
DMA2D_Input_Color_Mode, the members in order
Values:
-
enumerator DMA2D_INPUT_ARGB8888
ARGB8888 DMA2D color mode
-
enumerator DMA2D_INPUT_RGB888
RGB888 DMA2D color mode
-
enumerator DMA2D_INPUT_RGB565
RGB565 DMA2D color mode
-
enumerator DMA2D_INPUT_ARGB1555
ARGB1555 DMA2D color mode
-
enumerator DMA2D_INPUT_ARGB4444
ARGB4444 DMA2D color mode
-
enumerator DMA2D_INPUT_L8
-
enumerator DMA2D_INPUT_AL44
-
enumerator DMA2D_INPUT_AL88
-
enumerator DMA2D_INPUT_L4
-
enumerator DMA2D_INPUT_A8
-
enumerator DMA2D_INPUT_A4
-
enumerator DMA2D_INPUT_YUYV
-
enumerator DMA2D_INPUT_UYVY
-
enumerator DMA2D_INPUT_YYUV
-
enumerator DMA2D_INPUT_UVYY
-
enumerator DMA2D_INPUT_VUYY
-
enumerator DMA2D_INPUT_ARGB8888
-
enum dma2d_int_type_t
dma2d int type
Values:
-
enumerator DMA2D_CFG_ERROR
-
enumerator DMA2D_CLUT_TRANS_COMPLETE
-
enumerator DMA2D_CLUT_TRANS_ERROR
-
enumerator DMA2D_WARTERMARK_INT
-
enumerator DMA2D_TRANS_COMPLETE
-
enumerator DMA2D_TRANS_ERROR
-
enumerator DMA2D_ALL_INI
-
enumerator DMA2D_CFG_ERROR
-
enum dma2d_int_status_t
dma2d int status
Values:
-
enumerator DMA2D_TRANS_ERROR_STATUS
-
enumerator DMA2D_TRANS_COMPLETE_STATUS
-
enumerator DMA2D_WARTERMARK_INT_STATUS
-
enumerator DMA2D_CLUT_TRANS_ERROR_STATUS
-
enumerator DMA2D_CLUT_TRANS_COMPLETE_STATU
-
enumerator DMA2D_CFG_ERROR_STATUS
-
enumerator DMA2D_TRANS_ERROR_STATUS
-
enum dma2d_trans_ability_t
Values:
-
enumerator MAX_TRANS_256BYTES
-
enumerator TRANS_128BYTES
-
enumerator TRANS_64BYTES
-
enumerator TRANS_32BYTES
-
enumerator TRANS_16BYTES
-
enumerator MAX_TRANS_256BYTES
-
enum blend_alpha_mode_t
Values:
-
enumerator DMA2D_NO_MODIF_ALPHA
-
enumerator DMA2D_REPLACE_ALPHA
-
enumerator DMA2D_COMBINE_ALPHA
-
enumerator DMA2D_NO_MODIF_ALPHA