Files
E3_boot/middleware/sdrvres/sdrv_res.h
2025-11-07 10:05:24 +08:00

77 lines
1.9 KiB
C

/**
* @file sdrv_res.h
*
* Copyright (c) 2020 Semidrive Semiconductor.
* All rights reserved.
*
* Description: sdrv res header.
*
* Revision History:
* -----------------
*/
#ifndef SDRV_RES_H
#define SDRV_RES_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include <stdio.h>
#include <stdbool.h>
#include <stdint.h>
/*********************
* DEFINES
*********************/
/*Use this macro to declare an res in a c file*/
#define SDRV_RES_DECLARE(var_name) extern const sdrv_res_dsc_t var_name;
/**********************
* TYPEDEFS
**********************/
/*sdrv res format*/
#define SDRV_RES_FORMAT_UNKNOWN 0
#define SDRV_RES_FORMAT_BIN_RAW 1 /**< Contains the file as it is. Needs custom decoder function */
#define SDRV_RES_FORMAT_DATA_RAW 2 /**< Contains the data as it is. NO Needs custom decoder function */
typedef uint8_t sdrv_res_format_t;
/**
* sdrv res header
*/
/* The first 8 bit is very important to distinguish the different source types.
* For more info see `lv_img_get_src_type()` in lv_img.c
* On big endian systems the order is reversed so cf and always_zero must be at
* the end of the struct.
* */
typedef struct {
uint32_t rf : 5; /* res format: See `sdrv_res_format_t`*/
uint32_t always_zero : 3; /*It the upper bits of the first byte. Always zero to look like a
non-printable character*/
uint32_t reserved : 24; /*Reserved to be used later*/
} sdrv_res_header_t;
/** sdrv res header it is compatible with
* the result from sdrv res converter utility*/
typedef struct {
sdrv_res_header_t header;
uint32_t data_size;
const uint8_t * data;
} sdrv_res_dsc_t;
/**********************
* MACROS
**********************/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /*SDRV_RES_H*/