diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json deleted file mode 100644 index ca43874..0000000 --- a/.vscode/c_cpp_properties.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "configurations": [ - { - "name": "Star6E", - "includePath": [ - "${workspaceFolder}/**" - ], - "defines": [ - "__SIGMASTAR__", - "__INFINITY6__" - ], - "compilerPath": "/usr/bin/gcc", - "cStandard": "c11", - "cppStandard": "c++17", - "intelliSenseMode": "gcc-x64" - }, - { - "name": "Star6C", - "includePath": [ - "${workspaceFolder}/**" - ], - "defines": [ - "__SIGMASTAR__", - "__INFINITY6__", - "__INFINITY6C__" - ], - "compilerPath": "/usr/bin/gcc", - "cStandard": "c11", - "cppStandard": "c++17", - "intelliSenseMode": "gcc-x64" - }, - { - "name": "native(x86)", - "includePath": [ - "${workspaceFolder}/**" - ], - "defines": [ - "_x86" - ], - "compilerPath": "/usr/bin/gcc", - "cStandard": "c11", - "cppStandard": "c++17", - "intelliSenseMode": "gcc-x64" - }, - { - "name": "sigmastar-infinity6c", - "compilerPath": "/home/home/src/msposd/toolchain/sigmastar-infinity6c/bin/arm-linux-gcc", - "intelliSenseMode": "linux-gcc-arm", - "cStandard": "c11", - "includePath": [ - "/home/home/src/msposd", - "/home/home/src/msposd/sdk/infinity6/include", - "/home/home/src/msposd/toolchain/sigmastar-infinity6c/usr/include" - ], - "defines": [ - "__SIGMASTAR__", - "__INFINITY6__", - "__INFINITY6C__" - ], - "compilerArgs": [ - "-Wno-address-of-packed-member" - ] - } - ], - "version": 4 -} \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json index 6f3ed7d..8cdaed7 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -6,7 +6,7 @@ "name": "UDP_OSD", "type": "cppdbg", "request": "launch", - "program": "${workspaceFolder}/msposd", + "program": "${workspaceFolder}/msposd", "args": [ "--master", "127.0.0.1:14550", diff --git a/.vscode/settings.json b/.vscode/settings.json index 9965cf7..97fb600 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,86 +1,72 @@ { - "workbench.colorTheme": "Visual Studio Dark - C++", - + "workbench.colorTheme": "Default High Contrast", "editor.formatOnSave": false, "editor.formatOnType": false, "editor.formatOnPaste": false, - - "C_Cpp.clang_format_path": "/usr/bin/clang-format", - "C_Cpp.clang_format_style": "file", - - "C_Cpp.intelliSenseEngine": "Default", - "C_Cpp.enhancedColorization": "Enabled", - "C_Cpp.dimInactiveRegions": true, - "C_Cpp.inactiveRegionOpacity": 0.5, - - "[c]": { "editor.semanticHighlighting.enabled": true }, - "[cpp]":{ "editor.semanticHighlighting.enabled": true }, - "files.associations": { - "mavlink.h": "c", - "system_error": "c", - "chrono": "c", - "common.h": "c", - "array": "c", - "string": "c", - "string_view": "c", - "msp_displayport.h": "c", - "msp.h": "c", - "graphics.h": "c", - "thread": "c", - "mi_rgn.h": "c", - "mi_common.h": "c", - "bitmap.h": "c", - "random": "c", - "format": "c", - "compare": "c", - "cstdint": "c", - "functional": "c", - "rope": "c", - "ranges": "c", - "variant": "c", - "lodepng.h": "c", - "any": "c", - "expected": "c", - "fstream": "c", - "future": "c", - "optional": "c", - "shared_mutex": "c", - "spanstream": "c", - "stacktrace": "c", - "stop_token": "c", - "syncstream": "c", - "tuple": "c", - "string.h": "c", - "mi_vpe.h": "c", - "bitset": "c", - "slist": "c", - "initializer_list": "c", - "span": "c", - "regex": "c", - "utility": "c", - "*.tcc": "c", - "iomanip": "c", - "istream": "c", - "streambuf": "c", - "*.def": "c", - "iterator": "c", - "charconv": "c", - "ratio": "c", - "type_traits": "c", - "hi_math.h": "c", - "cstdlib": "c", - "xlib.h": "c", - "stdbool.h": "c", - "xutil.h": "c", - "xatom.h": "c", - "region.h": "c", - "cairo-xlib.h": "c", - "stdint-uintn.h": "c", - "interface.h": "c", - "valarray": "c", - "complex": "c", - "source_location": "c" + "mavlink.h": "c", + "system_error": "c", + "chrono": "c", + "common.h": "c", + "array": "c", + "string": "c", + "string_view": "c", + "msp_displayport.h": "c", + "msp.h": "c", + "graphics.h": "c", + "thread": "c", + "mi_rgn.h": "c", + "mi_common.h": "c", + "bitmap.h": "c", + "random": "c", + "format": "c", + "compare": "c", + "cstdint": "c", + "functional": "c", + "rope": "c", + "ranges": "c", + "variant": "c", + "lodepng.h": "c", + "any": "c", + "expected": "c", + "fstream": "c", + "future": "c", + "optional": "c", + "shared_mutex": "c", + "spanstream": "c", + "stacktrace": "c", + "stop_token": "c", + "syncstream": "c", + "tuple": "c", + "string.h": "c", + "mi_vpe.h": "c", + "bitset": "c", + "slist": "c", + "initializer_list": "c", + "span": "c", + "regex": "c", + "utility": "c", + "*.tcc": "c", + "iomanip": "c", + "istream": "c", + "streambuf": "c", + "*.def": "c", + "iterator": "c", + "charconv": "c", + "ratio": "c", + "type_traits": "c", + "hi_math.h": "c", + "cstdlib": "c", + "xlib.h": "c", + "stdbool.h": "c", + "xutil.h": "c", + "xatom.h": "c", + "region.h": "c", + "cairo-xlib.h": "c", + "stdint-uintn.h": "c", + "interface.h": "c", + "valarray": "c", + "complex": "c", + "source_location": "c" } - } - \ No newline at end of file +} \ No newline at end of file diff --git a/bmp/macros.h b/bmp/macros.h deleted file mode 100644 index c1521f1..0000000 --- a/bmp/macros.h +++ /dev/null @@ -1,45 +0,0 @@ -#pragma once - -#include -#include - -#define HAL_DANGER(mod, x, ...) \ - do { \ - fprintf(stderr, "[%s] \033[31m", (mod)); \ - fprintf(stderr, (x), ##__VA_ARGS__); \ - fprintf(stderr, "\033[0m"); \ - } while (0) - -#define HAL_ERROR(mod, x, ...) \ - do { \ - fprintf(stderr, "[%s] \033[31m", (mod)); \ - fprintf(stderr, (x), ##__VA_ARGS__); \ - fprintf(stderr, "\033[0m"); \ - return EXIT_FAILURE; \ - } while (0) - -#define HAL_INFO(mod, x, ...) \ - do { \ - fprintf(stderr, "[%s] ", (mod)); \ - fprintf(stderr, (x), ##__VA_ARGS__); \ - } while (0) - -#define HAL_WARNING(mod, x, ...) \ - do { \ - fprintf(stderr, "[%s] \033[33m", (mod)); \ - fprintf(stderr, (x), ##__VA_ARGS__); \ - fprintf(stderr, "\033[0m"); \ - } while (0) - -#ifndef CEILING -#define CEILING_POS(X) ((X-(int)(X)) > 0 ? (int)(X+1) : (int)(X)) -#define CEILING_NEG(X) (int)(X) -#define CEILING(X) ( ((X) > 0) ? CEILING_POS(X) : CEILING_NEG(X) ) -#endif - -#define EMPTY(x) (x[0] == '\0') -#define ENDS_WITH(a, b) \ - ((strlen(a) > strlen(b)) && !strcmp(a + strlen(a) - strlen(b), b)) -#define EQUALS(a, b) !strcmp(a, b) -#define EQUALS_CASE(a, b) !strcasecmp(a, b) -#define STARTS_WITH(a, b) !strncmp(a, b, strlen(b)) \ No newline at end of file diff --git a/bmp/region.c b/bmp/region.c index d0b67f7..0531d9c 100644 --- a/bmp/region.c +++ b/bmp/region.c @@ -1,9 +1,5 @@ #include "region.h" -#if defined(__INFINITY6C__) -#include "bmp/star/i6c_hal.c" -#endif - // https://wx.comake.online/doc/ds82ff82j7jsd9-SSD220/customer/development/mi/en/exclude/mi_rgn.html #ifdef __SIGMASTAR__ @@ -29,9 +25,7 @@ int create_region(int *handle, int x, int y, int width, int height) { MI_RGN_ChnPortParam_t stChnAttrCurrent; #if __INFINITY6C__ - hal_rect rect = { .height = height, .width = width, - .x = x, .y = y }; - return i6c_region_create(0,rect,255); + stChn.eModId = E_MI_MODULE_ID_VENC; #else stChn.eModId = E_MI_RGN_MODID_VPE; #endif @@ -352,9 +346,9 @@ void *get_directBMP(int handle) { int s32Ret = GetCanvas(handle, &stCanvasInfo); if (s32Ret) - printf("GetCanvas Res: %X OSD Handle:%d CanvasStride: %d , Canvas size : %d:%d\r\n", - s32Ret, handle, stCanvasInfo.u32Stride, stCanvasInfo.stSize.u32Width, - stCanvasInfo.stSize.u32Height); + printf("GetCanvas Res: 0x%X, OSD Handle: %d CanvasStride: %d, Canvas size: %d:%d\r\n", + s32Ret, handle, stCanvasInfo.u32Stride, + stCanvasInfo.stSize.u32Width, stCanvasInfo.stSize.u32Height); return (void *)(stCanvasInfo.virtAddr); #endif return NULL; @@ -430,8 +424,8 @@ int unload_region(int *handle) { } #ifdef __SIGMASTAR__ -int GetCanvas(int handle, MI_RGN_CanvasInfo_t *stCanvasInfo) { - int s32Result = MI_RGN_GetCanvasInfo(DEV handle, stCanvasInfo); +int GetCanvas(int handle, MI_RGN_CanvasInfo_t *stCanvasInfo) { + int s32Result = MI_RGN_GetCanvasInfo(DEV handle, stCanvasInfo); if (s32Result != MI_RGN_OK) return s32Result; diff --git a/bmp/star/i6c_common copy.h b/bmp/star/i6c_common copy.h deleted file mode 100644 index f0fff04..0000000 --- a/bmp/star/i6c_common copy.h +++ /dev/null @@ -1,119 +0,0 @@ -#pragma once - -#include -#include -#include - -#include "../symbols.h" -#include "../types.h" - -#define I6C_VENC_CHN_NUM 12 - -typedef enum { - I6C_BAYER_RG, - I6C_BAYER_GR, - I6C_BAYER_BG, - I6C_BAYER_GB, - I6C_BAYER_R0, - I6C_BAYER_G0, - I6C_BAYER_B0, - I6C_BAYER_G1, - I6C_BAYER_G2, - I6C_BAYER_I0, - I6C_BAYER_G3, - I6C_BAYER_I1, - I6C_BAYER_END -} i6c_common_bayer; - -typedef enum { - I6C_COMPR_NONE, - I6C_COMPR_SEG, - I6C_COMPR_LINE, - I6C_COMPR_FRAME, - I6C_COMPR_8BIT, - I6C_COMPR_6BIT, - I6C_COMPR_IFC, - I6C_COMPR_SFBC0, - I6C_COMPR_SFBC1, - I6C_COMPR_SFBC2, - I6C_COMPR_END -} i6c_common_compr; - -typedef enum { - I6C_EDGE_SINGLE_UP, - I6C_EDGE_SINGLE_DOWN, - I6C_EDGE_DOUBLE, - I6C_EDGE_END -} i6c_common_edge; - -typedef enum { - I6C_HDR_OFF, - I6C_HDR_VC, - I6C_HDR_DOL, - I6C_HDR_EMBED, - I6C_HDR_LI, - I6C_HDR_END -} i6c_common_hdr; - -typedef enum { - I6C_INTF_BT656, - I6C_INTF_DIGITAL_CAMERA, - I6C_INTF_BT1120_STANDARD, - I6C_INTF_BT1120_INTERLEAVED, - I6C_INTF_MIPI, - I6C_INTF_LVDS, - I6C_INTF_END -} i6c_common_intf; - -typedef enum { - I6C_PREC_8BPP, - I6C_PREC_10BPP, - I6C_PREC_12BPP, - I6C_PREC_14BPP, - I6C_PREC_16BPP, - I6C_PREC_END -} i6c_common_prec; - -typedef enum { - I6C_PIXFMT_YUV422_YUYV, - I6C_PIXFMT_ARGB8888, - I6C_PIXFMT_ABGR8888, - I6C_PIXFMT_BGRA8888, - I6C_PIXFMT_RGB565, - I6C_PIXFMT_ARGB1555, - I6C_PIXFMT_ARGB4444, - I6C_PIXFMT_I2, - I6C_PIXFMT_I4, - I6C_PIXFMT_I8, - I6C_PIXFMT_YUV422SP, - I6C_PIXFMT_YUV420SP, - I6C_PIXFMT_YUV420SP_NV21, - I6C_PIXFMT_YUV420_TILE, - I6C_PIXFMT_YUV422_UYVY, - I6C_PIXFMT_YUV422_YVYU, - I6C_PIXFMT_YUV422_VYUY, - I6C_PIXFMT_YUV422P, - I6C_PIXFMT_YUV420P, - I6C_PIXFMT_YUV420_FBC, - I6C_PIXFMT_RGB_BAYER, - I6C_PIXFMT_RGB_BAYER_END = - I6C_PIXFMT_RGB_BAYER + I6C_PREC_END * I6C_BAYER_END - 1, - I6C_PIXFMT_RGB888, - I6C_PIXFMT_BGR888, - I6C_PIXFMT_GRAY8, - I6C_PIXFMT_RGB101010, - I6C_PIXFMT_RGB888P, - I6C_PIXFMT_END -} i6c_common_pixfmt; - -typedef struct { - unsigned short width; - unsigned short height; -} i6c_common_dim; - -typedef struct { - unsigned short x; - unsigned short y; - unsigned short width; - unsigned short height; -} i6c_common_rect; \ No newline at end of file diff --git a/bmp/star/i6c_common.h b/bmp/star/i6c_common.h deleted file mode 100644 index f0fff04..0000000 --- a/bmp/star/i6c_common.h +++ /dev/null @@ -1,119 +0,0 @@ -#pragma once - -#include -#include -#include - -#include "../symbols.h" -#include "../types.h" - -#define I6C_VENC_CHN_NUM 12 - -typedef enum { - I6C_BAYER_RG, - I6C_BAYER_GR, - I6C_BAYER_BG, - I6C_BAYER_GB, - I6C_BAYER_R0, - I6C_BAYER_G0, - I6C_BAYER_B0, - I6C_BAYER_G1, - I6C_BAYER_G2, - I6C_BAYER_I0, - I6C_BAYER_G3, - I6C_BAYER_I1, - I6C_BAYER_END -} i6c_common_bayer; - -typedef enum { - I6C_COMPR_NONE, - I6C_COMPR_SEG, - I6C_COMPR_LINE, - I6C_COMPR_FRAME, - I6C_COMPR_8BIT, - I6C_COMPR_6BIT, - I6C_COMPR_IFC, - I6C_COMPR_SFBC0, - I6C_COMPR_SFBC1, - I6C_COMPR_SFBC2, - I6C_COMPR_END -} i6c_common_compr; - -typedef enum { - I6C_EDGE_SINGLE_UP, - I6C_EDGE_SINGLE_DOWN, - I6C_EDGE_DOUBLE, - I6C_EDGE_END -} i6c_common_edge; - -typedef enum { - I6C_HDR_OFF, - I6C_HDR_VC, - I6C_HDR_DOL, - I6C_HDR_EMBED, - I6C_HDR_LI, - I6C_HDR_END -} i6c_common_hdr; - -typedef enum { - I6C_INTF_BT656, - I6C_INTF_DIGITAL_CAMERA, - I6C_INTF_BT1120_STANDARD, - I6C_INTF_BT1120_INTERLEAVED, - I6C_INTF_MIPI, - I6C_INTF_LVDS, - I6C_INTF_END -} i6c_common_intf; - -typedef enum { - I6C_PREC_8BPP, - I6C_PREC_10BPP, - I6C_PREC_12BPP, - I6C_PREC_14BPP, - I6C_PREC_16BPP, - I6C_PREC_END -} i6c_common_prec; - -typedef enum { - I6C_PIXFMT_YUV422_YUYV, - I6C_PIXFMT_ARGB8888, - I6C_PIXFMT_ABGR8888, - I6C_PIXFMT_BGRA8888, - I6C_PIXFMT_RGB565, - I6C_PIXFMT_ARGB1555, - I6C_PIXFMT_ARGB4444, - I6C_PIXFMT_I2, - I6C_PIXFMT_I4, - I6C_PIXFMT_I8, - I6C_PIXFMT_YUV422SP, - I6C_PIXFMT_YUV420SP, - I6C_PIXFMT_YUV420SP_NV21, - I6C_PIXFMT_YUV420_TILE, - I6C_PIXFMT_YUV422_UYVY, - I6C_PIXFMT_YUV422_YVYU, - I6C_PIXFMT_YUV422_VYUY, - I6C_PIXFMT_YUV422P, - I6C_PIXFMT_YUV420P, - I6C_PIXFMT_YUV420_FBC, - I6C_PIXFMT_RGB_BAYER, - I6C_PIXFMT_RGB_BAYER_END = - I6C_PIXFMT_RGB_BAYER + I6C_PREC_END * I6C_BAYER_END - 1, - I6C_PIXFMT_RGB888, - I6C_PIXFMT_BGR888, - I6C_PIXFMT_GRAY8, - I6C_PIXFMT_RGB101010, - I6C_PIXFMT_RGB888P, - I6C_PIXFMT_END -} i6c_common_pixfmt; - -typedef struct { - unsigned short width; - unsigned short height; -} i6c_common_dim; - -typedef struct { - unsigned short x; - unsigned short y; - unsigned short width; - unsigned short height; -} i6c_common_rect; \ No newline at end of file diff --git a/bmp/star/i6c_hal.c b/bmp/star/i6c_hal.c deleted file mode 100644 index 1ca9cde..0000000 --- a/bmp/star/i6c_hal.c +++ /dev/null @@ -1,158 +0,0 @@ -#if defined(__INFINITY6C__) - -#include "i6c_hal.h" - -i6c_rgn_impl i6c_rgn; -i6c_sys_impl i6c_sys; - -char _i6c_venc_dev[2] = { 0, 8 }; -char _i6c_venc_port = 0; - -void i6c_hal_deinit(void) -{ - i6c_system_deinit(); - - i6c_rgn_unload(&i6c_rgn); - i6c_sys_unload(&i6c_sys); -} - -int i6c_hal_init(void) -{ - int ret; - - if (ret = i6c_sys_load(&i6c_sys)) - return ret; - if (ret = i6c_rgn_load(&i6c_rgn)) - return ret; - - if (ret = i6c_system_init()) - return ret; - - return EXIT_SUCCESS; -} - -int i6c_region_create(char handle, hal_rect rect, short opacity) -{ - int ret = EXIT_SUCCESS; - - i6c_sys_bind dest = { .module = I6C_SYS_MOD_VENC, .port =_i6c_venc_port }; - //i6c_sys_bind dest = { .module = I6C_SYS_MOD_VPE, .port =_i6c_venc_port }; - - i6c_rgn_cnf region, regionCurr; - i6c_rgn_chn attrib, attribCurr; - - region.type = I6C_RGN_TYPE_OSD; - region.pixFmt = PIXEL_FORMAT_DEFAULT;//I6C_RGN_PIXFMT_ARGB1555; - region.size.width = rect.width; - region.size.height = rect.height; - - if (i6c_rgn.fnGetRegionConfig(0, handle, ®ionCurr)) { - HAL_INFO("i6c_rgn", "Creating region %d...\n", handle); - if (ret = i6c_rgn.fnCreateRegion(0, handle, ®ion)) - return ret; - } else if (regionCurr.type != region.type || - regionCurr.size.height != region.size.height || - regionCurr.size.width != region.size.width) { - HAL_INFO("i6c_rgn", "Parameters are different, recreating " - "region %d...\n", handle); - for (dest.channel = 0; dest.channel < 2; dest.channel++) { - dest.device = _i6c_venc_dev[0]; - i6c_rgn.fnDetachChannel(0, handle, &dest); - dest.device = _i6c_venc_dev[1]; - i6c_rgn.fnDetachChannel(0, handle, &dest); - } - i6c_rgn.fnDestroyRegion(0, handle); - if (ret = i6c_rgn.fnCreateRegion(0, handle, ®ion)) - return ret; - } - - if (i6c_rgn.fnGetChannelConfig(0, handle, &dest, &attribCurr)) - HAL_INFO("i6c_rgn", "Attaching region %d...\n", handle); - else if (attribCurr.point.x != rect.x || attribCurr.point.x != rect.y || - attribCurr.osd.bgFgAlpha[1] != opacity) { - HAL_INFO("i6c_rgn", "Parameters are different, reattaching " - "region %d...\n", handle); - for (dest.channel = 0; dest.channel < 2; dest.channel++) { - dest.device = _i6c_venc_dev[0]; - i6c_rgn.fnDetachChannel(0, handle, &dest); - dest.device = _i6c_venc_dev[1]; - i6c_rgn.fnDetachChannel(0, handle, &dest); - } - } - - memset(&attrib, 0, sizeof(attrib)); - attrib.show = 1; - attrib.point.x = rect.x; - attrib.point.y = rect.y; - attrib.osd.layer = 0; - attrib.osd.constAlphaOn = 0; - attrib.osd.bgFgAlpha[0] = 0; - attrib.osd.bgFgAlpha[1] = opacity; - - for (dest.channel = 0; dest.channel < 2; dest.channel++) { - dest.device = _i6c_venc_dev[0]; - i6c_rgn.fnAttachChannel(0, handle, &dest, &attrib); - dest.device = _i6c_venc_dev[1]; - i6c_rgn.fnAttachChannel(0, handle, &dest, &attrib); - } - - return EXIT_SUCCESS; -} - -void i6c_region_deinit(void) -{ - i6c_rgn.fnDeinit(0); -} - -void i6c_region_destroy(char handle) -{ - i6c_sys_bind dest = { .module = I6C_SYS_MOD_VENC, .port =_i6c_venc_port }; - - for (dest.channel = 0; dest.channel < 2; dest.channel++) { - dest.device = _i6c_venc_dev[0]; - i6c_rgn.fnDetachChannel(0, handle, &dest); - dest.device = _i6c_venc_dev[1]; - i6c_rgn.fnDetachChannel(0, handle, &dest); - } - i6c_rgn.fnDestroyRegion(0, handle); -} - -void i6c_region_init(i6c_rgn_pal *palette) -{ - //i6c_rgn_pal palette = {{{0, 0, 0, 0}}}; - i6c_rgn.fnInit(0, palette); -} - -int i6c_region_setbitmap(int handle, hal_bitmap *bitmap) -{ - i6c_rgn_bmp nativeBmp = { .data = bitmap->data, .pixFmt = I6C_RGN_PIXFMT_ARGB1555, - .size.height = bitmap->dim.height, .size.width = bitmap->dim.width }; - - return i6c_rgn.fnSetBitmap(0, handle, &nativeBmp); -} - -void i6c_system_deinit(void) -{ - i6c_sys.fnExit(0); -} - -int i6c_system_init(void) -{ - int ret; - - if (ret = i6c_sys.fnInit(0)) - return ret; - - printf("App built with headers v%s\n", I6C_SYS_API); - - { - i6c_sys_ver version; - if (ret = i6c_sys.fnGetVersion(0, &version)) - return ret; - puts(version.version); - } - - return EXIT_SUCCESS; -} - -#endif \ No newline at end of file diff --git a/bmp/star/i6c_hal.h b/bmp/star/i6c_hal.h deleted file mode 100644 index e54e6d7..0000000 --- a/bmp/star/i6c_hal.h +++ /dev/null @@ -1,22 +0,0 @@ -#pragma once - -#include "i6c_common.h" -#include "i6c_rgn.h" -#include "i6c_sys.h" - -#include -#include - -extern char keepRunning; - -void i6c_hal_deinit(void); -int i6c_hal_init(void); - -int i6c_region_create(char handle, hal_rect rect, short opacity); -void i6c_region_deinit(void); -void i6c_region_destroy(char handle); -void i6c_region_init(i6c_rgn_pal *palette); -int i6c_region_setbitmap(int handle, hal_bitmap *bitmap); - -void i6c_system_deinit(void); -int i6c_system_init(void); \ No newline at end of file diff --git a/bmp/star/i6c_rgn.h b/bmp/star/i6c_rgn.h deleted file mode 100644 index c384ebc..0000000 --- a/bmp/star/i6c_rgn.h +++ /dev/null @@ -1,158 +0,0 @@ -#pragma once - -#include "i6c_common.h" -#include "i6c_sys.h" - -typedef enum { - I6C_RGN_PIXFMT_ARGB1555, - I6C_RGN_PIXFMT_ARGB4444, - I6C_RGN_PIXFMT_I2, - I6C_RGN_PIXFMT_I4, - I6C_RGN_PIXFMT_I8, - I6C_RGN_PIXFMT_RGB565, - I6C_RGN_PIXFMT_ARGB888, - I6C_RGN_PIXFMT_END -} i6c_rgn_pixfmt; - -typedef enum { - I6C_RGN_TYPE_OSD, - I6C_RGN_TYPE_COVER, - I6C_RGN_TYPE_END -} i6c_rgn_type; - -typedef struct { - unsigned int width; - unsigned int height; -} i6c_rgn_size; - -typedef struct { - i6c_rgn_pixfmt pixFmt; - i6c_rgn_size size; - void *data; -} i6c_rgn_bmp; - -typedef struct { - i6c_rgn_type type; - i6c_rgn_pixfmt pixFmt; - i6c_rgn_size size; -} i6c_rgn_cnf; - -typedef struct { - unsigned int layer; - i6c_rgn_size size; - unsigned int color; -} i6c_rgn_cov; - -typedef struct { - int invColOn; - int lowThanThresh; - unsigned int lumThresh; - unsigned short divWidth; - unsigned short divHeight; -} i6c_rgn_inv; - -typedef struct { - unsigned int layer; - int constAlphaOn; - union { - unsigned char bgFgAlpha[2]; - unsigned char constAlpha[2]; - }; - i6c_rgn_inv invert; -} i6c_rgn_osd; - -typedef struct { - unsigned int x; - unsigned int y; -} i6c_rgn_pnt; - -typedef struct { - int show; - i6c_rgn_pnt point; - union { - i6c_rgn_cov cover; - i6c_rgn_osd osd; - }; -} i6c_rgn_chn; - -typedef struct { - unsigned char alpha; - unsigned char red; - unsigned char green; - unsigned char blue; -} i6c_rgn_pale; - -typedef struct { - i6c_rgn_pale element[256]; -} i6c_rgn_pal; - -typedef struct { - void *handle; - - int (*fnDeinit)(unsigned short chip); - int (*fnInit)(unsigned short chip, i6c_rgn_pal *palette); - - int (*fnCreateRegion)(unsigned short chip, unsigned int handle, i6c_rgn_cnf *config); - int (*fnDestroyRegion)(unsigned short chip, unsigned int handle); - int (*fnGetRegionConfig)(unsigned short chip, unsigned int handle, i6c_rgn_cnf *config); - - int (*fnAttachChannel)(unsigned short chip, unsigned int handle, i6c_sys_bind *dest, i6c_rgn_chn *config); - int (*fnDetachChannel)(unsigned short chip, unsigned int handle, i6c_sys_bind *dest); - int (*fnGetChannelConfig)(unsigned short chip, unsigned int handle, i6c_sys_bind *dest, i6c_rgn_chn *config); - int (*fnSetChannelConfig)(unsigned short chip, unsigned int handle, i6c_sys_bind *dest, i6c_rgn_chn *config); - - int (*fnSetBitmap)(unsigned short chip, unsigned int handle, i6c_rgn_bmp *bitmap); -} i6c_rgn_impl; - -static int i6c_rgn_load(i6c_rgn_impl *rgn_lib) { - if (!(rgn_lib->handle = dlopen("libmi_rgn.so", RTLD_LAZY | RTLD_GLOBAL))) - HAL_ERROR("i6c_rgn", "Failed to load library!\nError: %s\n", dlerror()); - - if (!(rgn_lib->fnDeinit = (int(*)(unsigned short chip)) - hal_symbol_load("i6c_rgn", rgn_lib->handle, "MI_RGN_DeInit"))) - return EXIT_FAILURE; - - if (!(rgn_lib->fnInit = (int(*)(unsigned short chip, i6c_rgn_pal *palette)) - hal_symbol_load("i6c_rgn", rgn_lib->handle, "MI_RGN_Init"))) - return EXIT_FAILURE; - - if (!(rgn_lib->fnCreateRegion = (int(*)(unsigned short chip, unsigned int handle, i6c_rgn_cnf *config)) - hal_symbol_load("i6c_rgn", rgn_lib->handle, "MI_RGN_Create"))) - return EXIT_FAILURE; - - if (!(rgn_lib->fnDestroyRegion = (int(*)(unsigned short chip, unsigned int handle)) - hal_symbol_load("i6c_rgn", rgn_lib->handle, "MI_RGN_Destroy"))) - return EXIT_FAILURE; - - if (!(rgn_lib->fnGetRegionConfig = (int(*)(unsigned short chip, unsigned int handle, i6c_rgn_cnf *config)) - hal_symbol_load("i6c_rgn", rgn_lib->handle, "MI_RGN_GetAttr"))) - return EXIT_FAILURE; - - if (!(rgn_lib->fnAttachChannel = (int(*)(unsigned short chip, unsigned int handle, i6c_sys_bind *dest, i6c_rgn_chn *config)) - hal_symbol_load("i6c_rgn", rgn_lib->handle, "MI_RGN_AttachToChn"))) - return EXIT_FAILURE; - - if (!(rgn_lib->fnDetachChannel = (int(*)(unsigned short chip, unsigned int handle, i6c_sys_bind *dest)) - hal_symbol_load("i6c_rgn", rgn_lib->handle, "MI_RGN_DetachFromChn"))) - return EXIT_FAILURE; - - if (!(rgn_lib->fnGetChannelConfig = (int(*)(unsigned short chip, unsigned int handle, i6c_sys_bind *dest, i6c_rgn_chn *config)) - hal_symbol_load("i6c_rgn", rgn_lib->handle, "MI_RGN_GetDisplayAttr"))) - return EXIT_FAILURE; - - if (!(rgn_lib->fnSetChannelConfig = (int(*)(unsigned short chip, unsigned int handle, i6c_sys_bind *dest, i6c_rgn_chn *config)) - hal_symbol_load("i6c_rgn", rgn_lib->handle, "MI_RGN_SetDisplayAttr"))) - return EXIT_FAILURE; - - if (!(rgn_lib->fnSetBitmap = (int(*)(unsigned short chip, unsigned int handle, i6c_rgn_bmp *bitmap)) - hal_symbol_load("i6c_rgn", rgn_lib->handle, "MI_RGN_SetBitMap"))) - return EXIT_FAILURE; - - return EXIT_SUCCESS; -} - -static void i6c_rgn_unload(i6c_rgn_impl *rgn_lib) { - if (rgn_lib->handle) dlclose(rgn_lib->handle); - rgn_lib->handle = NULL; - memset(rgn_lib, 0, sizeof(*rgn_lib)); -} \ No newline at end of file diff --git a/bmp/star/i6c_sys.h b/bmp/star/i6c_sys.h deleted file mode 100644 index 5ee7add..0000000 --- a/bmp/star/i6c_sys.h +++ /dev/null @@ -1,197 +0,0 @@ -#pragma once - -#include "i6c_common.h" - -#define I6C_SYS_API "1.0" - -typedef enum { - I6C_SYS_LINK_FRAMEBASE = 0x1, - I6C_SYS_LINK_LOWLATENCY = 0x2, - I6C_SYS_LINK_REALTIME = 0x4, - I6C_SYS_LINK_AUTOSYNC = 0x8, - I6C_SYS_LINK_RING = 0x10 -} i6c_sys_link; - -typedef enum { - I6C_SYS_MOD_IVE, - I6C_SYS_MOD_VDF, - I6C_SYS_MOD_VENC, - I6C_SYS_MOD_RGN, - I6C_SYS_MOD_AI, - I6C_SYS_MOD_AO, - I6C_SYS_MOD_VIF, - I6C_SYS_MOD_VPE, - I6C_SYS_MOD_VDEC, - I6C_SYS_MOD_SYS, - I6C_SYS_MOD_FB, - I6C_SYS_MOD_HDMI, - I6C_SYS_MOD_DIVP, - I6C_SYS_MOD_GFX, - I6C_SYS_MOD_VDISP, - I6C_SYS_MOD_DISP, - I6C_SYS_MOD_OS, - I6C_SYS_MOD_IAE, - I6C_SYS_MOD_MD, - I6C_SYS_MOD_OD, - I6C_SYS_MOD_SHADOW, - I6C_SYS_MOD_WARP, - I6C_SYS_MOD_UAC, - I6C_SYS_MOD_LDC, - I6C_SYS_MOD_SD, - I6C_SYS_MOD_PANEL, - I6C_SYS_MOD_CIPHER, - I6C_SYS_MOD_SNR, - I6C_SYS_MOD_WLAN, - I6C_SYS_MOD_IPU, - I6C_SYS_MOD_MIPITX, - I6C_SYS_MOD_GYRO, - I6C_SYS_MOD_JPD, - I6C_SYS_MOD_ISP, - I6C_SYS_MOD_SCL, - I6C_SYS_MOD_WBC, - I6C_SYS_MOD_DSP, - I6C_SYS_MOD_PCIE, - I6C_SYS_MOD_DUMMY, - I6C_SYS_MOD_NIR, - I6C_SYS_MOD_DPU, - I6C_SYS_MOD_END, -} i6c_sys_mod; - -typedef enum { - I6C_SYS_POOL_ENCODER_RING, - I6C_SYS_POOL_CHANNEL, - I6C_SYS_POOL_DEVICE, - I6C_SYS_POOL_OUTPUT, - I6C_SYS_POOL_DEVICE_RING -} i6c_sys_pooltype; - -typedef struct { - i6c_sys_mod module; - unsigned int device; - unsigned int channel; - unsigned int port; -} i6c_sys_bind; - -typedef struct { - i6c_sys_mod module; - unsigned int device; - unsigned int channel; - unsigned char heapName[32]; - unsigned int heapSize; -} i6c_sys_poolchn; - -typedef struct { - i6c_sys_mod module; - unsigned int device; - unsigned int reserved; - unsigned char heapName[32]; - unsigned int heapSize; -} i6c_sys_pooldev; - -typedef struct { - unsigned int ringSize; - unsigned char heapName[32]; -} i6c_sys_poolenc; - -typedef struct { - i6c_sys_mod module; - unsigned int device; - unsigned int channel; - unsigned int port; - unsigned char heapName[32]; - unsigned int heapSize; -} i6c_sys_poolout; - -typedef struct { - i6c_sys_mod module; - unsigned int device; - unsigned short maxWidth; - unsigned short maxHeight; - unsigned short ringLine; - unsigned char heapName[32]; -} i6c_sys_poolring; - -typedef struct { - i6c_sys_pooltype type; - char create; - union { - i6c_sys_poolchn channel; - i6c_sys_pooldev device; - i6c_sys_poolenc encode; - i6c_sys_poolout output; - i6c_sys_poolring ring; - } config; -} i6c_sys_pool; - -typedef struct { - unsigned char version[128]; -} i6c_sys_ver; - -typedef struct { - void *handle, *handleCamOsWrapper; - - int (*fnExit)(unsigned short chip); - int (*fnGetVersion)(unsigned short chip, i6c_sys_ver *version); - int (*fnInit)(unsigned short chip); - - int (*fnBind)(unsigned short chip, i6c_sys_bind *source, i6c_sys_bind *dest, i6c_sys_link *link); - int (*fnBindExt)(unsigned short chip, i6c_sys_bind *source, i6c_sys_bind *dest, - unsigned int srcFps, unsigned int dstFps, i6c_sys_link link, unsigned int linkParam); - int (*fnSetOutputDepth)(unsigned short chip, i6c_sys_bind *bind, unsigned int usrDepth, - unsigned int bufDepth); - int (*fnUnbind)(unsigned short chip, i6c_sys_bind *source, i6c_sys_bind *dest); - - int (*fnConfigPool)(unsigned short chip, i6c_sys_pool *config); -} i6c_sys_impl; - -static int i6c_sys_load(i6c_sys_impl *sys_lib) { - if (!(sys_lib->handleCamOsWrapper = dlopen("libcam_os_wrapper.so", RTLD_LAZY | RTLD_GLOBAL))) - HAL_ERROR("i6c_sys", "Failed to load dependency library!\nError: %s\n", dlerror()); - - if (!(sys_lib->handle = dlopen("libmi_sys.so", RTLD_LAZY | RTLD_GLOBAL))) - HAL_ERROR("i6c_sys", "Failed to load library!\nError: %s\n", dlerror()); - - if (!(sys_lib->fnExit = (int(*)(unsigned short chip)) - hal_symbol_load("i6c_sys", sys_lib->handle, "MI_SYS_Exit"))) - return EXIT_FAILURE; - - if (!(sys_lib->fnGetVersion = (int(*)(unsigned short chip, i6c_sys_ver *version)) - hal_symbol_load("i6c_sys", sys_lib->handle, "MI_SYS_GetVersion"))) - return EXIT_FAILURE; - - if (!(sys_lib->fnInit = (int(*)(unsigned short chip)) - hal_symbol_load("i6c_sys", sys_lib->handle, "MI_SYS_Init"))) - return EXIT_FAILURE; - - if (!(sys_lib->fnBind = (int(*)(unsigned short chip, i6c_sys_bind *source, i6c_sys_bind *dest, i6c_sys_link *link)) - hal_symbol_load("i6c_sys", sys_lib->handle, "MI_SYS_BindChnPort"))) - return EXIT_FAILURE; - - if (!(sys_lib->fnBindExt = (int(*)(unsigned short chip, i6c_sys_bind *source, i6c_sys_bind *dest, - unsigned int srcFps, unsigned int dstFps, i6c_sys_link link, unsigned int linkParam)) - hal_symbol_load("i6c_sys", sys_lib->handle, "MI_SYS_BindChnPort2"))) - return EXIT_FAILURE; - - if (!(sys_lib->fnSetOutputDepth = (int(*)(unsigned short chip, i6c_sys_bind *bind, - unsigned int usrDepth, unsigned int bufDepth)) - hal_symbol_load("i6c_sys", sys_lib->handle, "MI_SYS_SetChnOutputPortDepth"))) - return EXIT_FAILURE; - - if (!(sys_lib->fnUnbind = (int(*)(unsigned short chip, i6c_sys_bind *source, i6c_sys_bind *dest)) - hal_symbol_load("i6c_sys", sys_lib->handle, "MI_SYS_UnBindChnPort"))) - return EXIT_FAILURE; - - if (!(sys_lib->fnConfigPool = (int(*)(unsigned short chip, i6c_sys_pool *config)) - hal_symbol_load("i6c_sys", sys_lib->handle, "MI_SYS_ConfigPrivateMMAPool"))) - return EXIT_FAILURE; - - return EXIT_SUCCESS; -} - -static void i6c_sys_unload(i6c_sys_impl *sys_lib) { - if (sys_lib->handle) dlclose(sys_lib->handle); - sys_lib->handle = NULL; - if (sys_lib->handleCamOsWrapper) dlclose(sys_lib->handleCamOsWrapper); - sys_lib->handleCamOsWrapper = NULL; - memset(sys_lib, 0, sizeof(*sys_lib)); -} \ No newline at end of file diff --git a/bmp/symbols.h b/bmp/symbols.h deleted file mode 100644 index adfd19a..0000000 --- a/bmp/symbols.h +++ /dev/null @@ -1,15 +0,0 @@ -#pragma once - -#include -#include - -#include "macros.h" - -static void inline *hal_symbol_load(const char *module, void *handle, const char *symbol) { - void *function = dlsym(handle, symbol); - if (!function) { - HAL_DANGER(module, "Failed to acquire symbol %s!\n", symbol); - return (void*)0; - } - return function; -} \ No newline at end of file diff --git a/bmp/types.h b/bmp/types.h deleted file mode 100644 index b2ec9b0..0000000 --- a/bmp/types.h +++ /dev/null @@ -1,49 +0,0 @@ -#pragma once - -#include "macros.h" - -#ifndef ALIGN_BACK -#define ALIGN_BACK(x, a) (((x) / (a)) * (a)) -#endif -#ifndef ALIGN_UP -#define ALIGN_UP(x, a) ((((x) + ((a)-1)) / a) * a) -#endif -#ifndef CEILING_2_POWER -#define CEILING_2_POWER(x, a) (((x) + ((a)-1)) & (~((a) - 1))) -#endif -#ifndef MIN -#define MIN(a, b) (((a) < (b)) ? (a) : (b)) -#endif -#ifndef MAX -#define MAX(a, b) (((a) > (b)) ? (a) : (b)) -#endif - -typedef enum { - HAL_PLATFORM_UNK, - HAL_PLATFORM_I6, - HAL_PLATFORM_I6C, - HAL_PLATFORM_M6, - HAL_PLATFORM_V1, - HAL_PLATFORM_V2, - HAL_PLATFORM_V3, - HAL_PLATFORM_V4 -} hal_platform; - -typedef enum { - OP_READ = 0b1, - OP_WRITE = 0b10, - OP_MODIFY = 0b11 -} hal_register_op; - -typedef struct { - unsigned short width, height; -} hal_dim; - -typedef struct { - hal_dim dim; - void *data; -} hal_bitmap; - -typedef struct { - unsigned short x, y, width, height; -} hal_rect; \ No newline at end of file diff --git a/msposd_x b/msposd_x deleted file mode 100755 index f15bd74..0000000 Binary files a/msposd_x and /dev/null differ diff --git a/osd.c b/osd.c index 3747162..968552b 100644 --- a/osd.c +++ b/osd.c @@ -2459,22 +2459,16 @@ static void InitMSPHook() { } #ifdef __SIGMASTAR__ -#if __INFINITY6C__ - if (i6c_hal_init()) +#if __INFINITY6C__ + if (MI_SYS_Init(0)) fprintf(stderr, "[%s:%d]MI_SYS_Init failed with!\n", __func__, __LINE__); - int s32Ret = i6c_region_init(&g_stPaletteTable); - if (verbose) - printf("MI_RGN_Init_6c results: %d \n", s32Ret); - if (s32Ret) - fprintf(stderr, "[%s:%d]RGN_Init_6c failed with %#x!\n", __func__, __LINE__, s32Ret); - -#else - int s32Ret = MI_RGN_Init(DEV &g_stPaletteTable); +#endif + + int s32Ret = MI_RGN_Init(DEV &g_stPaletteTable); if (verbose) printf("MI_RGN_Init results: %d\n", s32Ret); if (s32Ret) fprintf(stderr, "[%s:%d]RGN_Init failed with %#x!\n", __func__, __LINE__, s32Ret); -#endif #endif int XOffs = (majestic_width - OVERLAY_WIDTH) / 2; @@ -2489,7 +2483,7 @@ static void InitMSPHook() { if (matrix_size == 9) YOffs = (majestic_height - OVERLAY_HEIGHT); // vertical bottom - // THIS IS NEEDED, the main region to draw inside + // THIS IS NEEDED, the main region to draw inside if (DrawOSD) rgn = create_region(&osds[FULL_OVERLAY_ID].hand, XOffs, YOffs, OVERLAY_WIDTH, OVERLAY_HEIGHT); @@ -2507,12 +2501,12 @@ static void InitMSPHook() { #endif BITMAP bitmap; int prepared = 0; - + // LOAD PNG TEST, if there is font file loaded, preview it if (/*true*/ bitmapFnt.pData != NULL) { // Split and show a review of the - // selected font for several seconds + // selected font for several seconds prepared = 1; - + bitmap.enPixelFormat = PIXEL_FORMAT_DEFAULT; int preview_height = current_display_info.font_height * current_display_info.char_height; @@ -2522,7 +2516,7 @@ static void InitMSPHook() { int fontPageHeight = rows * current_display_info.font_height; // OVERLAY_HEIGHT;; bitmap.u32Height = OVERLAY_HEIGHT; // preview_height;//rows * // current_display_info.font_height;//OVERLAY_HEIGHT; - bitmap.u32Width = OVERLAY_WIDTH; // bitmapFnt.u32Width * cols; + bitmap.u32Width = OVERLAY_WIDTH; // bitmapFnt.u32Width * cols; bitmap.pData = (unsigned char *)malloc( bitmap.u32Height * getRowStride(bitmap.u32Width, PIXEL_FORMAT_BitsPerPixel)); memset(bitmap.pData, 0, @@ -2553,7 +2547,7 @@ static void InitMSPHook() { bitmap.enPixelFormat-PIXEL_FORMAT_DEFAULT; */ -#ifdef __SIGMASTAR__ +#ifdef __SIGMASTAR__ if (verbose) printf("Set SS Font Review %d:%d\n", bitmap.u32Width, bitmap.u32Height); // For some reason this fails...?! @@ -2567,7 +2561,7 @@ static void InitMSPHook() { // This is how direct image memory works in sigmastar void *bmp = get_directBMP(osds[FULL_OVERLAY_ID].hand); memcpy(bmp, bitmap.pData, - bitmap.u32Height * getRowStride(bitmap.u32Width, PIXEL_FORMAT_BitsPerPixel)); + bitmap.u32Height * getRowStride(bitmap.u32Width, PIXEL_FORMAT_BitsPerPixel)); MI_RGN_UpdateCanvas(DEV osds[FULL_OVERLAY_ID].hand); if (true) { @@ -2605,14 +2599,14 @@ static void InitMSPHook() { #endif // free(bitmap.pData); - } else { // no font file still, show message on screen + } else { // no font file still, show message on screen cntr = 0; char msgbuff[120]; sprintf(msgbuff, "&F48 &L23 Waiting for data on %s ...", _port_name); SetOSDMsg(msgbuff); draw_screenBMP(); } - + if (prepared) { if (verbose) printf("set_LOGO with u32Height:%d enPixelFormat %d\n", bitmap.u32Height,