Skip to content

Commit

Permalink
Preparing for Ingenic support
Browse files Browse the repository at this point in the history
  • Loading branch information
wberube committed May 26, 2024
1 parent 04a765f commit ae5f53c
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 1 deletion.
55 changes: 55 additions & 0 deletions src/hal/inge/tx_hal.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}
13 changes: 12 additions & 1 deletion src/hal/inge/tx_hal.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,15 @@
#include "tx_sys.h"
#include "tx_venc.h"

extern char keepRunning;
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);
4 changes: 4 additions & 0 deletions src/hal/inge/tx_isp.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions src/hal/support.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit ae5f53c

Please sign in to comment.