diff --git a/firmware/Makefile b/firmware/Makefile index 1076a6f8..9902e95e 100644 --- a/firmware/Makefile +++ b/firmware/Makefile @@ -45,6 +45,7 @@ OBJECTS=\ tofe_eeprom.o \ uptime.o \ version.o \ + crop.o \ $(FIRMBUILD_DIRECTORY)/version_data.o \ $(FIRMBUILD_DIRECTORY)/hdmi_in1.o \ boot-helper-$(CPU).o diff --git a/firmware/ci.c b/firmware/ci.c index fa6277c2..d3a0ed6d 100644 --- a/firmware/ci.c +++ b/firmware/ci.c @@ -49,7 +49,7 @@ #include "tofe_eeprom.h" #include "uptime.h" #include "version.h" - +#include "crop.h" #include "ci.h" int status_enabled; @@ -97,18 +97,37 @@ static void help_heartbeat(void) wputs(" heartbeat - Turn on/off heartbeat feature"); } +static void help_crop(void) +{ + wputs("change crop status (alias: 'cr')"); + wputs(" crop - Turn on/off crop feature"); +} + static void heartbeat_enable(void) { hb_status(true); wprintf("Heartbeat enabled\n"); } +static void crop_enable(void) +{ + crop_status(true); + wprintf("crop enable\n"); +} + static void heartbeat_disable(void) { hb_status(false); wprintf("Heartbeat disabled\n"); } +static void crop_disable(void) +{ + + crop_status(false); + wprintf("crop disabled\n"); +} + #ifdef CSR_HDMI_OUT0_BASE static void help_output0(void) { @@ -191,6 +210,7 @@ static void ci_help(void) wputs("mdio_status - show mdio status"); #endif wputs("pattern (p) - select next pattern"); + wputs("version - show firmware version"); wputs(""); help_status(); wputs(""); @@ -202,6 +222,9 @@ static void ci_help(void) wputs(""); help_hdp_toggle(); wputs(""); + help_crop(); + wputs(""); + #ifdef CSR_HDMI_OUT0_BASE help_output0(); wputs(""); @@ -1134,6 +1157,15 @@ void ci_service(void) token = get_token(&str); hdp_toggle(atoi(token)); } + else if((strcmp(token, "crop") == 0) || (strcmp(token, "cr") == 0)) { + token = get_token(&str); + if((strcmp(token, "on") == 0) ) + crop_enable(); + else if((strcmp(token, "off") == 0) ) + crop_disable(); + else + help_crop(); + } #ifdef CSR_HDMI_OUT0_BASE else if((strcmp(token, "output0") == 0) || (strcmp(token, "o0") == 0)) { token = get_token(&str); diff --git a/firmware/crop.c b/firmware/crop.c new file mode 100644 index 00000000..2d5f0967 --- /dev/null +++ b/firmware/crop.c @@ -0,0 +1,68 @@ + +#include +#include +#include +#include +#include + +#include "hdmi_in0.h" +#include "hdmi_in1.h" +#include "crop.h" +#include "processor.h" +#include "pattern.h" +#include "stdio_wrap.h" + +static bool crop_stat = false; + +void crop_status(bool val) +{ + crop_stat = val; +} + +void crop_service(fb_ptrdiff_t fb_offset,int top) +{ + static int last_event; + static int counter; + static bool color_v; + + if (crop_stat==1) { + crop_fill(color_v, fb_offset,top); + } +} + +void crop_fill(bool color_v, fb_ptrdiff_t fb_offset,int top) +{ + int addr1,addr2,addr3,addr4, i, j,k; + unsigned int color; + unsigned int *framebuffer = fb_ptrdiff_to_main_ram(fb_offset); + + addr1 = 0 + (processor_h_active/2)*(processor_v_active-top); + addr2 = 0; + addr3 = 0 + (processor_h_active/2)*top + (processor_h_active/2) - top; + addr4 = 0 + (processor_h_active/2)*top; + + for (i=0; i +#include "framebuffer.h" + +void crop_status(bool val); +void crop_service(fb_ptrdiff_t fb_offset,int top) ; +void crop_fill(bool color_v, fb_ptrdiff_t fb_offset,int top); + diff --git a/firmware/processor.c b/firmware/processor.c index 171fbbd7..e8837d25 100644 --- a/firmware/processor.c +++ b/firmware/processor.c @@ -33,7 +33,7 @@ #include "mmcm.h" #include "processor.h" #include "heartbeat.h" - +#include "crop.h" /* ----------------->>> Time ----------->>> @@ -703,11 +703,17 @@ void processor_update(void) /* hdmi_out0 */ #ifdef CSR_HDMI_IN0_BASE if(processor_hdmi_out0_source == VIDEO_IN_HDMI_IN0) + { + crop_service(hdmi_in0_framebuffer_base(hdmi_in0_fb_index),40); hdmi_out0_core_initiator_base_write(hdmi_in0_framebuffer_base(hdmi_in0_fb_index)); + } #endif #ifdef CSR_HDMI_IN1_BASE if(processor_hdmi_out0_source == VIDEO_IN_HDMI_IN1) + { + crop_service(hdmi_in1_framebuffer_base(hdmi_in1_fb_index),40); hdmi_out0_core_initiator_base_write(hdmi_in1_framebuffer_base(hdmi_in1_fb_index)); + } #endif if(processor_hdmi_out0_source == VIDEO_IN_PATTERN) hdmi_out0_core_initiator_base_write(pattern_framebuffer_base()); @@ -744,6 +750,8 @@ void processor_update(void) encoder_reader_base_write(pattern_framebuffer_base()); #endif + crop_service(pattern_framebuffer_base(),40); + #ifdef CSR_HDMI_IN0_BASE hb_service(hdmi_in0_framebuffer_base(hdmi_in0_fb_index)); #endif