diff --git a/src/hal/inge/tx_hal.c b/src/hal/inge/tx_hal.c index 206ebd0..74ee56d 100644 --- a/src/hal/inge/tx_hal.c +++ b/src/hal/inge/tx_hal.c @@ -10,6 +10,8 @@ tx_venc_impl tx_venc; hal_chnstate tx_state[TX_VENC_CHN_NUM] = {0}; int (*tx_venc_cb)(char, hal_vidstream*); +tx_isp_snr _tx_isp_snr; + void tx_hal_deinit(void) { tx_venc_unload(&tx_venc); @@ -37,5 +39,58 @@ int tx_hal_init(void) if (ret = tx_venc_load(&tx_venc)) return ret; + return EXIT_SUCCESS; +} + +int tx_pipeline_create(short width, short height, char framerate) +{ + +} + +void tx_pipeline_destroy() +{ + +} + +void tx_system_deinit(void) +{ + tx_sys.fnExit(); + + tx_isp.fnDisableSensor(); + tx_isp.fnDeleteSensor(&_tx_isp_snr); + tx_isp.fnExit(); +} + +int tx_system_init(char *sensor) +{ + int ret; + + { + tx_sys_ver version; + if (ret = tx_sys.fnGetVersion(&version)) + return ret; + printf("App built with headers v%s\n", TX_SYS_API); + puts(version.version); + } + + for (char i = 0; i < sizeof(tx_sensors) / sizeof(*tx_sensors); i++) { + if (strcmp(sensor, tx_sensors[i].name)) continue; + _tx_isp_snr = tx_sensors[i]; + ret = 0; + break; + } + if (ret) + return EXIT_FAILURE; + + if (ret = tx_isp.fnInit()) + return ret; + if (ret = tx_isp.fnAddSensor(&_tx_isp_snr)) + return ret; + if (ret = tx_isp.fnEnableSensor()) + return ret; + + if (ret = tx_sys.fnInit()) + return ret; + return EXIT_SUCCESS; } \ No newline at end of file diff --git a/src/hal/inge/tx_hal.h b/src/hal/inge/tx_hal.h index 217f3b0..a2bb969 100644 --- a/src/hal/inge/tx_hal.h +++ b/src/hal/inge/tx_hal.h @@ -8,4 +8,15 @@ #include "tx_sys.h" #include "tx_venc.h" -extern char keepRunning; \ No newline at end of file +extern char keepRunning; + +extern int (*tx_venc_cb)(char, hal_vidstream*); + +void tx_hal_deinit(void); +int tx_hal_init(void); + +int tx_pipeline_create(short width, short height, char framerate); +void tx_pipeline_destroy(void); + +void tx_system_deinit(void); +int tx_system_init(char *sensor); \ No newline at end of file diff --git a/src/hal/inge/tx_isp.h b/src/hal/inge/tx_isp.h index e4568e4..8475edb 100644 --- a/src/hal/inge/tx_isp.h +++ b/src/hal/inge/tx_isp.h @@ -25,6 +25,10 @@ typedef struct { unsigned short powUpPin; } tx_isp_snr; +static tx_isp_snr tx_sensors[] = { + { .name = "sc2335", .spiMode = 0, .i2c.type = "sc2335", .i2c.addr = 0x30, + .rstPin = 18, .powDownPin = -1, .powUpPin = -1 } +}; typedef struct { void *handle; diff --git a/src/hal/support.c b/src/hal/support.c index c50a2df..390b1c7 100644 --- a/src/hal/support.c +++ b/src/hal/support.c @@ -86,6 +86,9 @@ void hal_identify(void) { venc_thread = i6f_video_thread; return; } + else if (!access("/proc/jz", 0)) { + plat = HAL_PLATFORM_TX; + } if (file = fopen("/proc/iomem", "r")) while (fgets(line, 200, file))