diff --git a/README.md b/README.md index 40c8d7f..b6bc752 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ _* At the moment, only text, 24-bit and 32-bit RGB overlays are handled, matrici [^9]: GK7202V300, GK7205V200/300 and GK7605V100 [^10]: Hi3516AV200 and Hi3519V101 [^11]: RV110\[3/7/8/9\] and RV1106\(G2/G3\) -[^12]: MSC313E, MSC316\[DC/Q\] and MSC318 +[^12]: MSC313E, MSC316\[DC/DE/QE\] and MSC318 [^13]: SSC323, SSC325\(D/DE\) and SSC327\(D/DE/Q\) [^14]: SSC33\[3/5/7\]\(DE\) [^15]: SSC30K\[D/Q\], SSC336\[D/Q\], SSC338\[D/G/Q\] and SSC339G diff --git a/src/hal/star/i3_isp.h b/src/hal/star/i3_isp.h new file mode 100644 index 0000000..b7edf2d --- /dev/null +++ b/src/hal/star/i3_isp.h @@ -0,0 +1,31 @@ +#pragma once + +#include "i3_common.h" + +typedef struct { + void *handle; + + int (*fnLoadChannelConfig)(int channel, char *path, unsigned int key); + int (*fnSetColorToGray)(int channel, char *enable); +} i3_isp_impl; + +static int i3_isp_load(i3_isp_impl *isp_lib) { + if (!(isp_lib->handle = dlopen("libmi_isp.so", RTLD_LAZY | RTLD_GLOBAL))) + HAL_ERROR("i3_isp", "Failed to load library!\nError: %s\n", dlerror()); + + if (!(isp_lib->fnLoadChannelConfig = (int(*)(int channel, char *path, unsigned int key)) + hal_symbol_load("i3_isp", isp_lib->handle, "MI_ISP_Load_ISPCmdBinFile"))) + return EXIT_FAILURE; + + if (!(isp_lib->fnSetColorToGray = (int(*)(int channel, char *enable)) + hal_symbol_load("i3_isp", isp_lib->handle, "MI_ISP_SetColorToGray"))) + return EXIT_FAILURE; + + return EXIT_SUCCESS; +} + +static void i3_isp_unload(i3_isp_impl *isp_lib) { + if (isp_lib->handle) dlclose(isp_lib->handle); + isp_lib->handle = NULL; + memset(isp_lib, 0, sizeof(*isp_lib)); +} \ No newline at end of file