/* Copyright (c), 2001-2022, Shenshu Tech. Co., Ltd. */ #ifndef OT_COMMON_TDE_H #define OT_COMMON_TDE_H #include "ot_type.h" #ifdef __cplusplus #if __cplusplus extern "C" { #endif /* __cplusplus */ #endif /* __cplusplus */ /* tde start err no. */ #define OT_ERR_TDE_BASE ((td_s32)(((0x80UL + 0x20UL) << 24) | (100 << 16) | (4 << 13) | 1)) typedef enum { OT_ERR_TDE_DEV_NOT_OPEN = OT_ERR_TDE_BASE, /* tde device not open yet */ OT_ERR_TDE_DEV_OPEN_FAILED, /* open tde device failed */ OT_ERR_TDE_NULL_PTR, /* input parameters contain null ptr */ OT_ERR_TDE_NO_MEM, /* malloc failed */ OT_ERR_TDE_INVALID_HANDLE, /* invalid job handle */ OT_ERR_TDE_INVALID_PARAM, /* invalid parameter */ OT_ERR_TDE_NOT_ALIGNED, /* aligned error for position, stride, width */ OT_ERR_TDE_MINIFICATION, /* invalid minification */ OT_ERR_TDE_CLIP_AREA, /* clip area and operation area have no intersection */ OT_ERR_TDE_JOB_TIMEOUT, /* blocked job wait timeout */ OT_ERR_TDE_UNSUPPORTED_OPERATION, /* unsupported operation */ OT_ERR_TDE_QUERY_TIMEOUT, /* query time out */ OT_ERR_TDE_INTERRUPT, /* blocked job was interrupted */ OT_ERR_TDE_BUTT, }ot_tde_err_code; /* RGB and packet YUV formats and semi-planar YUV format */ typedef enum { OT_TDE_COLOR_FORMAT_RGB444 = 0, /* RGB444 format */ OT_TDE_COLOR_FORMAT_BGR444, /* BGR444 format */ OT_TDE_COLOR_FORMAT_RGB555, /* RGB555 format */ OT_TDE_COLOR_FORMAT_BGR555, /* BGR555 format */ OT_TDE_COLOR_FORMAT_RGB565, /* RGB565 format */ OT_TDE_COLOR_FORMAT_BGR565, /* BGR565 format */ OT_TDE_COLOR_FORMAT_RGB888, /* RGB888 format */ OT_TDE_COLOR_FORMAT_BGR888, /* BGR888 format */ OT_TDE_COLOR_FORMAT_ARGB4444, /* ARGB4444 format */ OT_TDE_COLOR_FORMAT_ABGR4444, /* ABGR4444 format */ OT_TDE_COLOR_FORMAT_RGBA4444, /* RGBA4444 format */ OT_TDE_COLOR_FORMAT_BGRA4444, /* BGRA4444 format */ OT_TDE_COLOR_FORMAT_ARGB1555, /* ARGB1555 format */ OT_TDE_COLOR_FORMAT_ABGR1555, /* ABGR1555 format */ OT_TDE_COLOR_FORMAT_RGBA1555, /* RGBA1555 format */ OT_TDE_COLOR_FORMAT_BGRA1555, /* BGRA1555 format */ OT_TDE_COLOR_FORMAT_ARGB8565, /* ARGB8565 format */ OT_TDE_COLOR_FORMAT_ABGR8565, /* ABGR8565 format */ OT_TDE_COLOR_FORMAT_RGBA8565, /* RGBA8565 format */ OT_TDE_COLOR_FORMAT_BGRA8565, /* BGRA8565 format */ OT_TDE_COLOR_FORMAT_ARGB8888, /* ARGB8888 format */ OT_TDE_COLOR_FORMAT_ABGR8888, /* ABGR8888 format */ OT_TDE_COLOR_FORMAT_RGBA8888, /* RGBA8888 format */ OT_TDE_COLOR_FORMAT_BGRA8888, /* BGRA8888 format */ OT_TDE_COLOR_FORMAT_RABG8888, /* RABG8888 format */ /* 1-bit palette format without alpha component. Each pixel occupies one bit. */ OT_TDE_COLOR_FORMAT_CLUT1, /* 2-bit palette format without alpha component. Each pixel occupies two bits. */ OT_TDE_COLOR_FORMAT_CLUT2, /* 4-bit palette format without alpha component. Each pixel occupies four bits. */ OT_TDE_COLOR_FORMAT_CLUT4, /* 8-bit palette format without alpha component. Each pixel occupies eight bits. */ OT_TDE_COLOR_FORMAT_CLUT8, /* 4-bit palette format with alpha component. Each pixel occupies 8 bit. */ OT_TDE_COLOR_FORMAT_ACLUT44, /* 8-bit palette format with alpha component. Each pixel occupies 16 bit. */ OT_TDE_COLOR_FORMAT_ACLUT88, OT_TDE_COLOR_FORMAT_A1, /* Alpha format. Each pixel occupies one bit. */ OT_TDE_COLOR_FORMAT_A8, /* Alpha format. Each pixel occupies eight bits. */ OT_TDE_COLOR_FORMAT_YCbCr888, /* YUV packet format without alpha component */ OT_TDE_COLOR_FORMAT_AYCbCr8888, /* YUV packet format with alpha component */ OT_TDE_COLOR_FORMAT_YCbCr422, /* YUV packet422 format */ OT_TDE_COLOR_FORMAT_PKGVYUY, /* YUV packet422 format, VYUY format */ OT_TDE_COLOR_FORMAT_BYTE, /* Only for fast copy */ OT_TDE_COLOR_FORMAT_HALFWORD, /* Only for fast copy */ OT_TDE_COLOR_FORMAT_JPG_YCbCr400MBP, /* Semi-planar YUV400 format, for JPG decoding */ OT_TDE_COLOR_FORMAT_JPG_YCbCr422MBHP, /* Semi-planar YUV422 format, horizontal sampling, for JPG decoding */ OT_TDE_COLOR_FORMAT_JPG_YCbCr422MBVP, /* Semi-planar YUV422 format, vertical sampling, for JPG decoding */ OT_TDE_COLOR_FORMAT_MP1_YCbCr420MBP, /* Semi-planar YUV420 format */ OT_TDE_COLOR_FORMAT_MP2_YCbCr420MBP, /* Semi-planar YUV420 format */ OT_TDE_COLOR_FORMAT_MP2_YCbCr420MBI, /* Semi-planar YUV420 format */ OT_TDE_COLOR_FORMAT_JPG_YCbCr420MBP, /* Semi-planar YUV420 format, for JPG decoding */ OT_TDE_COLOR_FORMAT_JPG_YCbCr444MBP, /* Semi-planar YUV444 format */ OT_TDE_COLOR_FORMAT_MAX /* End of enumeration */ } ot_tde_color_format; /* Definition of the semi-planar YUV format */ typedef enum { OT_TDE_MB_COLOR_FORMAT_JPG_YCbCr400MBP = 0, /* Semi-planar YUV400 format, for JPG decoding */ /* Semi-planar YUV422 format, horizontal sampling, for JPG decoding */ OT_TDE_MB_COLOR_FORMAT_JPG_YCbCr422MBHP, OT_TDE_MB_COLOR_FORMAT_JPG_YCbCr422MBVP, /* Semi-planar YUV422 format, vertical sampling, for JPG decoding */ OT_TDE_MB_COLOR_FORMAT_MP1_YCbCr420MBP, /* Semi-planar YUV420 format */ OT_TDE_MB_COLOR_FORMAT_MP2_YCbCr420MBP, /* Semi-planar YUV420 format */ OT_TDE_MB_COLOR_FORMAT_MP2_YCbCr420MBI, /* Semi-planar YUV420 format */ OT_TDE_MB_COLOR_FORMAT_JPG_YCbCr420MBP, /* Semi-planar YUV420 format, for JPG pictures */ OT_TDE_MB_COLOR_FORMAT_JPG_YCbCr444MBP, /* Semi-planar YUV444 format, for JPG pictures */ OT_TDE_MB_COLOR_FORMAT_MAX } ot_tde_mb_color_format; /* Structure of the bitmap information set by customers */ typedef struct { td_phys_addr_t phys_addr; /* Header address of a bitmap or the Y component */ td_u32 phys_len; ot_tde_color_format color_format; /* Color format */ td_u32 height; /* Bitmap height */ td_u32 width; /* Bitmap width */ td_u32 stride; /* Stride of a bitmap or the Y component */ td_bool is_ycbcr_clut; /* Whether the CLUT is in the YCbCr space. */ td_bool alpha_max_is_255; /* The maximum alpha value of a bitmap is 255 or 128. */ td_bool support_alpha_ex_1555; /* Whether to enable the alpha extension of an ARGB1555 bitmap. */ td_u8 alpha0; /* Values of alpha0 and alpha1, used as the ARGB1555 format */ td_u8 alpha1; /* Values of alpha0 and alpha1, used as the ARGB1555 format */ td_phys_addr_t cbcr_phys_addr; /* Address of the CbCr component, pilot */ td_u32 cbcr_phys_len; td_u32 cbcr_stride; /* Stride of the CbCr component, pilot */ /*