Skip to content

Commit

Permalink
Finding something cleaner to remove deadcode
Browse files Browse the repository at this point in the history
  • Loading branch information
wberube committed Jun 6, 2024
1 parent 95acf6d commit 49c9206
Show file tree
Hide file tree
Showing 14 changed files with 8 additions and 113 deletions.
2 changes: 0 additions & 2 deletions src/error.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ char *errstr(int error) {
int module = (error >> 16) & 0xFF;

switch (plat) {
#ifdef __arm__
case HAL_PLATFORM_I6:
level = (error >> 12) & 0xF;
error = error & 0xFF000FFF | (level > 0 ? (4 << 13) : 0);
Expand Down Expand Up @@ -98,7 +97,6 @@ char *errstr(int error) {
error |= (module << 16); break;
}
break;
#endif
}

switch (error) {
Expand Down
4 changes: 1 addition & 3 deletions src/hal/hisi/v3_hal.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#ifdef __arm__
#include "v3_hal.h"

v3_isp_alg v3_ae_lib = { .id = 0, .libName = "ae_lib" };
Expand Down Expand Up @@ -840,5 +839,4 @@ int v3_system_init(char *snrConfig)
return ret;

return EXIT_SUCCESS;
}
#endif
}
4 changes: 1 addition & 3 deletions src/hal/hisi/v4_hal.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#ifdef __arm__
#include "v4_hal.h"

v4_isp_alg v4_ae_lib = { .id = 0, .libName = "ae_lib" };
Expand Down Expand Up @@ -895,5 +894,4 @@ int v4_system_init(char *snrConfig)
return ret;

return EXIT_SUCCESS;
}
#endif
}
6 changes: 1 addition & 5 deletions src/hal/hisi/v4_quirks.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#ifdef __arm__

int (*fnISP_AlgRegisterDehaze)(int);
int (*fnISP_AlgRegisterDrc)(int);
int (*fnISP_AlgRegisterLdci)(int);
Expand All @@ -16,6 +14,4 @@ int ISP_AlgRegisterLdci(int pipeId) {
}
int MPI_ISP_IrAutoRunOnce(int pipeId, void *irAttr) {
return fnMPI_ISP_IrAutoRunOnce(pipeId, irAttr);
}

#endif
}
4 changes: 1 addition & 3 deletions src/hal/inge/t31_hal.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#ifdef __mips__
#include "t31_hal.h"

t31_aud_impl t31_aud;
Expand Down Expand Up @@ -638,5 +637,4 @@ int t31_system_init(void)
return ret;

return EXIT_SUCCESS;
}
#endif
}
4 changes: 1 addition & 3 deletions src/hal/sstar/i6_hal.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#ifdef __arm__
#include "i6_hal.h"

i6_aud_impl i6_aud;
Expand Down Expand Up @@ -828,5 +827,4 @@ int i6_system_init(void)
return ret;

return EXIT_SUCCESS;
}
#endif
}
4 changes: 1 addition & 3 deletions src/hal/sstar/i6c_hal.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#ifdef __arm__
#include "i6c_hal.h"

i6c_aud_impl i6c_aud;
Expand Down Expand Up @@ -946,5 +945,4 @@ int i6c_system_init(void)
return ret;

return EXIT_SUCCESS;
}
#endif
}
4 changes: 1 addition & 3 deletions src/hal/sstar/i6f_hal.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#ifdef __arm__
#include "i6f_hal.h"

i6f_aud_impl i6f_aud;
Expand Down Expand Up @@ -905,5 +904,4 @@ int i6f_system_init(void)
return ret;

return EXIT_SUCCESS;
}
#endif
}
8 changes: 0 additions & 8 deletions src/hal/support.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ void hal_identify(void) {
char *endMark;
char line[200] = {0};

#ifdef __arm__
if (!access("/proc/mi_modules", 0) &&
hal_registry(0x1F003C00, &val, OP_READ))
switch (val) {
Expand Down Expand Up @@ -89,9 +88,7 @@ void hal_identify(void) {
venc_thread = i6f_video_thread;
return;
}
#endif

#ifdef __mips__
if (!access("/proc/jz", 0) &&
hal_registry(0x1300002C, &val, OP_READ)) {
unsigned int type;
Expand All @@ -118,10 +115,6 @@ void hal_identify(void) {
}
}

return;
#endif

#ifdef __arm__
if (file = fopen("/proc/iomem", "r"))
while (fgets(line, 200, file))
if (strstr(line, "uart")) {
Expand Down Expand Up @@ -177,5 +170,4 @@ void hal_identify(void) {
chnState = (hal_chnstate*)v4_state;
isp_thread = v4_image_thread;
venc_thread = v4_video_thread;
#endif
}
7 changes: 1 addition & 6 deletions src/hal/support.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
#include "types.h"
#if defined(__arm__)
#include "hisi/v3_hal.h"
#include "hisi/v4_hal.h"
#include "sstar/i6_hal.h"
#include "sstar/i6c_hal.h"
#include "sstar/i6f_hal.h"
#elif defined(__mips__)
#include "inge/t31_hal.h"
#endif

#include <errno.h>
#include <fcntl.h>
Expand All @@ -22,7 +19,6 @@ extern hal_chnstate *chnState;
extern hal_platform plat;
extern char series[16];

#if defined(__arm__)
extern void *v3_video_thread(void);
extern hal_chnstate v3_state[V4_VENC_CHN_NUM];

Expand All @@ -37,10 +33,9 @@ extern hal_chnstate i6c_state[I6C_VENC_CHN_NUM];

extern void *i6f_video_thread(void);
extern hal_chnstate i6f_state[I6F_VENC_CHN_NUM];
#elif defined(__mips__)

extern void *t31_video_thread(void);
extern hal_chnstate t31_state[T31_VENC_CHN_NUM];
#endif

bool hal_registry(unsigned int addr, unsigned int *data, hal_register_op op);
void hal_identify(void);
Expand Down
11 changes: 0 additions & 11 deletions src/jpeg.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,9 @@ int jpeg_init() {
pthread_mutex_lock(&jpeg_mutex);

switch (plat) {
#ifdef __mips__
case HAL_PLATFORM_T31:
if (app_config.mjpeg_enable) goto mjpeg_active;
break;
#endif
}

jpeg_index = take_next_free_channel(false);
Expand All @@ -53,15 +51,12 @@ int jpeg_init() {
config.minQual = config.maxQual = app_config.jpeg_qfactor;

switch (plat) {
#if defined(__arm__)
case HAL_PLATFORM_I6: ret = i6_video_create(jpeg_index, &config); break;
case HAL_PLATFORM_I6C: ret = i6c_video_create(jpeg_index, &config); break;
case HAL_PLATFORM_I6F: ret = i6f_video_create(jpeg_index, &config); break;
case HAL_PLATFORM_V3: ret = v3_video_create(jpeg_index, &config); break;
case HAL_PLATFORM_V4: ret = v4_video_create(jpeg_index, &config); break;
#elif defined(__mips__)
case HAL_PLATFORM_T31: ret = t31_video_create(jpeg_index, &config); break;
#endif
default:
pthread_mutex_unlock(&jpeg_mutex);
return EXIT_FAILURE;
Expand All @@ -88,18 +83,15 @@ void jpeg_deinit() {
pthread_mutex_lock(&jpeg_mutex);

switch (plat) {
#if defined(__arm__)
case HAL_PLATFORM_I6: i6_video_destroy(jpeg_index); break;
case HAL_PLATFORM_I6C: i6c_video_destroy(jpeg_index, 1); break;
case HAL_PLATFORM_I6F: i6f_video_destroy(jpeg_index, 1); break;
case HAL_PLATFORM_V3: v3_video_destroy(jpeg_index); break;
case HAL_PLATFORM_V4: v4_video_destroy(jpeg_index); break;
#elif defined(__mips__)
case HAL_PLATFORM_T31:
if (app_config.mjpeg_enable) goto mjpeg_active;
t31_video_destroy(jpeg_index);
break;
#endif
default:
pthread_mutex_unlock(&jpeg_mutex);
return;
Expand All @@ -122,7 +114,6 @@ int jpeg_get(short width, short height, char quality, char grayscale,
int ret;

switch (plat) {
#if defined(__arm__)
case HAL_PLATFORM_I6: ret = i6_video_snapshot_grab(jpeg_index, quality,
grayscale, jpeg); break;
case HAL_PLATFORM_I6C: ret = i6c_video_snapshot_grab(jpeg_index, quality,
Expand All @@ -131,10 +122,8 @@ int jpeg_get(short width, short height, char quality, char grayscale,
grayscale, jpeg); break;
case HAL_PLATFORM_V3: ret = v3_video_snapshot_grab(jpeg_index, jpeg); break;
case HAL_PLATFORM_V4: ret = v4_video_snapshot_grab(jpeg_index, jpeg); break;
#elif defined(__mips__)
case HAL_PLATFORM_T31: ret = t31_video_snapshot_grab(app_config.mjpeg_enable ?
-1 : jpeg_index, jpeg); break;
#endif
}
if (ret) {
if (jpeg->data)
Expand Down
3 changes: 0 additions & 3 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ rtsp_handle rtspHandle;
int main(int argc, char *argv[]) {
hal_identify();
switch (plat) {
#if defined(__arm__)
case HAL_PLATFORM_I6:
fprintf(stderr, "Divinus for infinity6(b0/e)\n"); break;
case HAL_PLATFORM_I6C:
Expand All @@ -30,10 +29,8 @@ int main(int argc, char *argv[]) {
fprintf(stderr, "Divinus for hisi-gen3\n"); break;
case HAL_PLATFORM_V4:
fprintf(stderr, "Divinus for hisi-gen4\n"); break;
#elif defined(__mips__)
case HAL_PLATFORM_T31:
fprintf(stderr, "Divinus for ingenic t31\n"); break;
#endif
default:
fprintf(stderr, "Unsupported chip family! Quitting...\n");
return EXIT_FAILURE;
Expand Down
10 changes: 0 additions & 10 deletions src/region.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,11 @@ void region_fill_formatted(char* str)

void *region_thread(void)
{
#ifdef __arm__
switch (plat) {
case HAL_PLATFORM_I6: i6_region_init(); break;
case HAL_PLATFORM_I6C: i6c_region_init(); break;
case HAL_PLATFORM_I6F: i6f_region_init(); break;
}
#endif

for (char id = 0; id < MAX_OSD; id++)
{
Expand Down Expand Up @@ -140,7 +138,6 @@ void *region_thread(void)
hal_rect rect = { .height = bitmap.dim.height, .width = bitmap.dim.width,
.x = osds[id].posx, .y = osds[id].posy };
switch (plat) {
#if defined(__arm__)
case HAL_PLATFORM_I6:
i6_region_create(id, rect, osds[id].opal);
i6_region_setbitmap(id, &bitmap);
Expand All @@ -161,12 +158,10 @@ void *region_thread(void)
v4_region_create(id, rect, osds[id].opal);
v4_region_setbitmap(id, &bitmap);
break;
#elif defined(__mips__)
case HAL_PLATFORM_T31:
t31_region_create(&osds[id].hand, rect, osds[id].opal);
t31_region_setbitmap(&osds[id].hand, &bitmap);
break;
#endif
}
free(bitmap.data);
}
Expand All @@ -175,15 +170,12 @@ void *region_thread(void)
else if (empty(osds[id].text) && osds[id].updt)
{
switch (plat) {
#if defined(__arm__)
case HAL_PLATFORM_I6: i6_region_destroy(id); break;
case HAL_PLATFORM_I6C: i6c_region_destroy(id); break;
case HAL_PLATFORM_I6F: i6f_region_destroy(id); break;
case HAL_PLATFORM_V3: v3_region_destroy(id); break;
case HAL_PLATFORM_V4: v4_region_destroy(id); break;
#elif defined(__mips__)
case HAL_PLATFORM_T31: t31_region_destroy(&osds[id].hand); break;
#endif
}
}
osds[id].updt = 0;
Expand All @@ -192,11 +184,9 @@ void *region_thread(void)
}

switch (plat) {
#ifdef __arm__
case HAL_PLATFORM_I6: i6_region_deinit(); break;
case HAL_PLATFORM_I6C: i6c_region_deinit(); break;
case HAL_PLATFORM_I6F: i6f_region_deinit(); break;
#endif
}
}

Expand Down
Loading

0 comments on commit 49c9206

Please sign in to comment.