You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
213 lines
6.8 KiB
213 lines
6.8 KiB
/******************************************************************************* |
|
* lib_smartfb.h |
|
* |
|
* History: |
|
* 2017/07/25 - [Hao Qian] created file |
|
* |
|
* Copyright (c) 2017 Ambarella, Inc. |
|
* |
|
* This file and its contents ( "Software" ) are protected by intellectual |
|
* property rights including, without limitation, U.S. and/or foreign |
|
* copyrights. This Software is also the confidential and proprietary |
|
* information of Ambarella, Inc. and its licensors. You may not use, reproduce, |
|
* disclose, distribute, modify, or otherwise prepare derivative works of this |
|
* Software or any portion thereof except pursuant to a signed license agreement |
|
* or nondisclosure agreement with Ambarella, Inc. or its authorized affiliates. |
|
* In the absence of such an agreement, you agree to promptly notify and return |
|
* this Software to Ambarella, Inc. |
|
* |
|
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, |
|
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, |
|
* MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
|
* IN NO EVENT SHALL AMBARELLA, INC. OR ITS AFFILIATES BE LIABLE FOR ANY DIRECT, |
|
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
|
* LOSS OF USE, DATA, OR PROFITS; COMPUTER FAILURE OR MALFUNCTION; OR BUSINESS |
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
* POSSIBILITY OF SUCH DAMAGE. |
|
* |
|
******************************************************************************/ |
|
|
|
#ifndef _SMARTFB_LIB_H |
|
#define _SMARTFB_LIB_H |
|
|
|
#ifdef __cplusplus |
|
extern "C" { |
|
#endif |
|
|
|
#define MAX_TEXT_SIZE (200) |
|
#define MAX_LINE_THICKNESS (10) |
|
#define MAX_CAP_AREA_NUM (10) |
|
#define MAX_NAME_SIZE (32) |
|
|
|
#include "basetypes.h" |
|
|
|
enum smartfb_vout_id { |
|
SMARTFB_DIGITAL_VOUT = 0, |
|
SMARTFB_ANALOG_VOUT = 1, |
|
SMARTFB_VOUT_NUM, |
|
}; |
|
|
|
enum smartfb_mode_name { |
|
SMARTFB_MODE_CLUT8BPP = 0, |
|
SMARTFB_MODE_ARGB8888 = 1, |
|
SMARTFB_MODE_NUM, |
|
SMARTFB_MODE_INVALID = 0xFF, |
|
}; |
|
|
|
enum smartfb_color { |
|
SMARTFB_COLOR_RED = 0, |
|
SMARTFB_COLOR_LIME = 1, |
|
SMARTFB_COLOR_BLUE = 2, |
|
SMARTFB_COLOR_MAGENTA = 3, |
|
SMARTFB_COLOR_SPRING_GREEN = 4, |
|
SMARTFB_COLOR_MEDIUM_SLATE_BLUE = 5, |
|
SMARTFB_COLOR_YELLOW = 6, |
|
SMARTFB_COLOR_DARK_ORANGE = 7, |
|
SMARTFB_COLOR_CYAN = 8, |
|
SMARTFB_COLOR_GREEN = 9, |
|
SMARTFB_COLOR_BLUE_VIOLET = 10, |
|
SMARTFB_COLOR_VIOLET = 11, |
|
SMARTFB_COLOR_DEEP_PINK = 12, |
|
SMARTFB_COLOR_NAVY = 13, |
|
SMARTFB_COLOR_MAROON = 14, |
|
SMARTFB_COLOR_PURPLE = 15, |
|
SMARTFB_COLOR_SALMON = 16, |
|
SMARTFB_COLOR_OLIVE = 17, |
|
SMARTFB_COLOR_MOCCASIN = 18, |
|
SMARTFB_COLOR_TEAL = 19, |
|
SMARTFB_COLOR_GRAY = 20, |
|
SMARTFB_COLOR_WHITE = 21, |
|
SMARTFB_COLOR_BLACK = 22, |
|
SMARTFB_COLOR_NUM, |
|
}; |
|
|
|
enum smartfb_alpha { |
|
SMARTFB_ALPHA_LEVEL0 = 0, // alpha = 0 |
|
SMARTFB_ALPHA_LEVEL1 = 1, // alpha = 32 |
|
SMARTFB_ALPHA_LEVEL2 = 2, // alpha = 64 |
|
SMARTFB_ALPHA_LEVEL3 = 3, // alpha = 96 |
|
SMARTFB_ALPHA_LEVEL4 = 4, // alpha = 128 |
|
SMARTFB_ALPHA_LEVEL5 = 5, // alpha = 160 |
|
SMARTFB_ALPHA_LEVEL6 = 6, // alpha = 192 |
|
SMARTFB_ALPHA_LEVEL7 = 7, // alpha = 255 |
|
SMARTFB_ALPHA_NUM, |
|
}; |
|
|
|
typedef struct smartfb_init_s { |
|
enum smartfb_vout_id vout; |
|
} smartfb_init_t; |
|
|
|
typedef struct smartfb_obj_s { |
|
u16 offset_x; |
|
u16 offset_y; |
|
u8 color; |
|
u8 bg_color; |
|
u8 bg_alpha; |
|
u8 reserved; |
|
} smartfb_obj_t; |
|
|
|
typedef struct smartfb_box_s { |
|
smartfb_obj_t obj; |
|
u16 width; |
|
u16 height; |
|
u8 line_thickness; |
|
u8 reserved[3]; |
|
} smartfb_box_t; |
|
|
|
typedef struct smartfb_cap_area_s { |
|
char name[MAX_NAME_SIZE]; |
|
u16 offset_x; |
|
u16 offset_y; |
|
u16 width; |
|
u16 height; |
|
} smartfb_cap_area_t; |
|
|
|
typedef struct smartfb_textbox_s { |
|
smartfb_box_t box; |
|
u8 font_size; |
|
u8 outline; // to do |
|
u8 bold; |
|
u8 italic; |
|
u32 wrap_line : 1; |
|
u32 reserved : 31; |
|
char text[MAX_TEXT_SIZE]; |
|
} smartfb_textbox_t; |
|
|
|
typedef struct smartfb_line_s { |
|
u32 start_x; |
|
u32 start_y; |
|
u32 end_x; |
|
u32 end_y; |
|
u8 line_thickness; |
|
u8 color; |
|
u8 reserved[2]; |
|
} smartfb_line_t; |
|
|
|
typedef struct smartfb_circle_s { |
|
u16 center_x; |
|
u16 center_y; |
|
u16 radius; |
|
u8 color; |
|
u8 alpha; |
|
} smartfb_circle_t; |
|
|
|
typedef struct smartfb_iav_yuv_cap_params_s { |
|
u8 *y_vir_base_addr; /*!< y_virtual_base_address is based on YUV data resolution */ |
|
u8 *uv_vir_base_addr; /*!< uv_virtual_base_address is based on YUV data resolution */ |
|
u32 pitch; /*!< pitch size is based on YUV data resolution */ |
|
u32 width; /*!< Width is based on YUV data resolution */ |
|
u32 height; /*!< Height is based on YUV data resolution */ |
|
} smartfb_iav_yuv_cap_params_t; |
|
|
|
typedef struct smartfb_mosaic_s { |
|
smartfb_iav_yuv_cap_params_t yuv_params; |
|
u32 offset_x; /*!< mosaic_offset_x is based on frame buffer resolution */ |
|
u32 offset_y; /*!< mosaic_offset_y is based on frame buffer resolution */ |
|
u32 width; /*!< mosaic_width is based on frame buffer resolution */ |
|
u32 height; /*!< mosaic_height is based on frame buffer resolution */ |
|
u32 grid_width; /*!< mosaic_grid_width is based on frame buffer resolution */ |
|
u32 grid_height; /*!< mosaic_grid_height is based on frame buffer resolution */ |
|
} smartfb_mosaic_t; |
|
|
|
/* Basix API */ |
|
AMBA_API int smartfb_init(smartfb_init_t *fb_init); |
|
AMBA_API int smartfb_deinit(void); |
|
AMBA_API int smartfb_clear(void); //Blank VOUT and Clear fmem |
|
AMBA_API int smartfb_display(void); // Display fmem in VOUT |
|
|
|
/* Draw differe obj to fmem */ |
|
AMBA_API int smartfb_draw_box(smartfb_box_t *fb_box); |
|
AMBA_API int smartfb_draw_textbox(smartfb_textbox_t *fb_textbox); |
|
|
|
AMBA_API int smartfb_draw_line(smartfb_line_t *fb_line); |
|
AMBA_API int smartfb_draw_circle(smartfb_circle_t *fb_circle); |
|
AMBA_API int smartfb_draw_mosaic(smartfb_mosaic_t *fb_mosaic); |
|
/* All interfaces use clut8bpp by default, except for some interfaces with "argb8888" suffix like this. */ |
|
AMBA_API int smartfb_draw_mosaic_with_argb8888(smartfb_mosaic_t *fb_mosaic); |
|
|
|
AMBA_API int smartfb_set_clut(u16 *r_table, u16 *g_table, u16 *b_table, u16 *trans_table); |
|
AMBA_API u8 *smartfb_get_fb_mem(void); |
|
AMBA_API int smartfb_get_var(struct fb_var_screeninfo *fb_var); |
|
AMBA_API int smartfb_get_fix(struct fb_fix_screeninfo *fb_fix); |
|
AMBA_API u32 smartfb_get_fb_bpp(void); |
|
AMBA_API enum smartfb_mode_name smartfb_get_fb_mode_name(void); |
|
AMBA_API int smartfb_get_specific_text(smartfb_textbox_t *fb_textbox, |
|
wchar_t *pattern_addr, u8 *mem, int convert_num); |
|
AMBA_API u32 smartfb_get_fb_yoffset(void); |
|
AMBA_API int smartfb_clear_buffer(void); |
|
AMBA_API int smartfb_save_capture_area_buffer(smartfb_cap_area_t *fb_cap_area); |
|
AMBA_API int smartfb_modify_capture_area_buffer(smartfb_cap_area_t *fb_cap_area, char *area_name); |
|
AMBA_API int smartfb_delete_capture_area_buffer(char *area_name); |
|
AMBA_API int smartfb_delete_all_capture_area_buffer(void); |
|
AMBA_API int smartfb_restore_capture_area_buffer(char *area_name); |
|
AMBA_API int smartfb_restore_all_capture_area_buffer(void); |
|
|
|
#ifdef __cplusplus |
|
} |
|
#endif |
|
|
|
#endif //_SMARTFB_LIB_H |
|
|
|
|