HAL EZIP 模塊提供抽象的軟件接口操作硬件EZIP模塊,EZIP模塊支持對(duì)ezip格式的數(shù)據(jù)進(jìn)行解壓縮。 支持的特性有:
- AHB和EPIC輸出模式,AHB模式指解壓后的數(shù)據(jù)保存到指定memory地址,EPIC模式指解壓后的數(shù)據(jù)送入EPIC模塊, 使得EPIC可讀取ezip格式圖像數(shù)據(jù)實(shí)現(xiàn)混疊和縮放操作(不支持ezip格式數(shù)據(jù)的旋轉(zhuǎn)), 對(duì)于EPIC輸出模式,用戶可使用HAL EPIC接口配置EPIC讀取ezip格式數(shù)據(jù),HAL EPIC會(huì)配置EZIP進(jìn)入EPIC輸出模式,用戶不必調(diào)用HAL EZIP接口
- 可指定圖形的部分區(qū)域解壓輸出
- 支持中斷和輪詢模式
- AHB模式下支持LZ4和GZIP4的解壓
- 除了SF32LB55X,其他芯片系列支持EZIPA動(dòng)畫數(shù)據(jù)的解壓縮,中間件的ezipa_dec模塊基于EPIC和EZIP驅(qū)動(dòng)提供了更上層的軟件支持,使用方法參考ezipa_dec模塊的頭文件
詳細(xì)的API說明參考 EZIP .
使用HAL EZIP
首先調(diào)用 HAL_EZIP_Init 初始化HAL_EZIP, 需要在 EZIP_HandleTypeDef 中指定使用的EZIP硬件模塊(即EZIP實(shí)例),芯片只有一個(gè)EZIP實(shí)例,由 hwp_ezip 表示。 初始化只需做一次,之后就可以調(diào)用 HAL_EZIP_Decode 和 HAL_EZIP_Decode_IT 解壓數(shù)據(jù)。
- Note
- 源和目的地址需要保證4字節(jié)對(duì)齊
例如,
AHB output (polling mode)
void example_ahb(void)
{
uint16_t width = 68;
uint16_t height = 37;
config.
input = (uint8_t *)img;
config.
output = malloc(width * height * 3);
memset(config.
output, 0, width * height * 3);
config.
input = (uint8_t *)img;
config.
output = malloc(width * height * 3);
memset(config.
output, 0, width * height * 3);
}
AHB output (interrupt mode)
void EZIP_IRQHandler(void)
{
}
static uint8_t ezip_done_flag;
{
ezip_done_flag = 1;
}
void example_ahb_it(void)
{
ZIP_DecodeConfigTypeDef config;
uint16_t width = 68;
uint16_t height = 37;
config.input = (uint8_t *)img;
config.output = malloc(width * height * 3);
memset(config.output, 0, width * height * 3);
config.start_x = 0;
config.start_y = 0;
config.width = 68;
config.height = 37;
ezip_done_flag = 0;
ezip->CpltCallback = ezip_done;
while (0 == ezip_done_flag)
{
}
}