diff options
| -rw-r--r-- | fpga/ebaz4205/linux-6.16.4-pq/master/jmm-fb | 415 | ||||
| -rw-r--r-- | fpga/ebaz4205/src/uEnv.txt | 3 | ||||
| -rw-r--r-- | fpga/hp_lcd_driver/Makefile | 2 | ||||
| -rw-r--r-- | fpga/hp_lcd_driver/common.vhdl | 20 | ||||
| -rw-r--r-- | fpga/hp_lcd_driver/hp_lcd_driver.vhdl | 5 | ||||
| -rw-r--r-- | fpga/hp_lcd_driver/output_stage.vhdl | 2 | ||||
| -rw-r--r-- | fpga/hp_lcd_driver/zynq7.mk | 1 | ||||
| -rw-r--r-- | fpga/hp_lcd_driver/zynq7_ip/blk_mem_gen_1.tcl | 2 | ||||
| -rw-r--r-- | fpga/hp_lcd_driver/zynq7_wrapper.vhdl | 50 |
9 files changed, 295 insertions, 205 deletions
diff --git a/fpga/ebaz4205/linux-6.16.4-pq/master/jmm-fb b/fpga/ebaz4205/linux-6.16.4-pq/master/jmm-fb index 1b98045..c892fad 100644 --- a/fpga/ebaz4205/linux-6.16.4-pq/master/jmm-fb +++ b/fpga/ebaz4205/linux-6.16.4-pq/master/jmm-fb @@ -38,10 +38,10 @@ index cef74a483..7f3eadf0e 100644 obj-$(CONFIG_NSM) += nsm.o diff --git a/drivers/misc/jmm_fb.c b/drivers/misc/jmm_fb.c new file mode 100644 -index 000000000..db164d714 +index 000000000..ed9dab898 --- /dev/null +++ b/drivers/misc/jmm_fb.c -@@ -0,0 +1,305 @@ +@@ -0,0 +1,356 @@ +#include <linux/miscdevice.h> +#include <linux/fs.h> +#include <linux/kernel.h> @@ -59,48 +59,51 @@ index 000000000..db164d714 + + +static struct jmm_fb { -+ struct fb_info *info; -+ uint8_t *fb_base; -+ size_t fb_len; ++ struct fb_info *info; ++ uint8_t *fb_base; ++ size_t fb_len; +} jmm_fb; + +struct jmm_fb_par { -+ int dummy; ++ int dummy; +}; + ++ +static const struct fb_var_screeninfo jmm_fb_var = { -+ .xres = 384, -+ .yres = 600, -+ .xres_virtual = 384, -+ .yres_virtual = 600, -+ .bits_per_pixel = 2, -+ .red = {0, 1, 0}, -+ .green = {0, 1, 0}, -+ .blue = {0, 1, 0}, -+ .transp = {1, 1, 0}, -+ .height = -1, -+ .width = -1, ++ .xres = 384, ++ .yres = 600, ++ .xres_virtual = 384, ++ .yres_virtual = 600, ++ .bits_per_pixel = 4, ++ .red = {0, 4, 0}, ++ .green = {0, 4, 0}, ++ .blue = {0, 4, 0}, ++ .transp = {0, 4, 0}, ++ .grayscale = 1, ++ .rotate = FB_ROTATE_CW, ++ .height = -1, ++ .width = -1, +}; + +static struct fb_fix_screeninfo jmm_fb_fix = { -+ .id = "jmm_fb", -+ .type = FB_TYPE_PACKED_PIXELS, /* (not sure) */ -+ .visual = FB_VISUAL_MONO10, -+ .xpanstep = 0, -+ .ypanstep = 0, -+ .line_length = 96, -+ .accel = FB_ACCEL_NONE ++ .id = "jmm_fb", ++ .type = FB_TYPE_PACKED_PIXELS, /* (not sure) */ ++ .visual = FB_VISUAL_STATIC_PSEUDOCOLOR, ++ .xpanstep = 0, ++ .ypanstep = 0, ++ .line_length = 96, ++ .accel = FB_ACCEL_NONE +}; + + + +static struct fb_ops jmm_fb_ops = { -+.owner = THIS_MODULE, -+ __FB_DEFAULT_IOMEM_OPS_RDWR, -+.fb_fillrect = cfb_fillrect, -+.fb_imageblit = cfb_imageblit, -+.fb_copyarea = cfb_copyarea, -+ __FB_DEFAULT_IOMEM_OPS_MMAP, ++ .owner = THIS_MODULE, ++ __FB_DEFAULT_IOMEM_OPS_RDWR, ++ .fb_fillrect = cfb_fillrect, ++ .fb_imageblit = cfb_imageblit, ++ .fb_copyarea = cfb_copyarea, ++ __FB_DEFAULT_IOMEM_OPS_MMAP, + +}; + @@ -108,242 +111,290 @@ index 000000000..db164d714 +/* +** This function will be called when we open the Misc device file +*/ -+static int jmm_fb_open(struct inode *inode, struct file *file) ++static int jmm_fb_open (struct inode *inode, struct file *file) +{ -+ pr_info("jmm_fb device open\n"); -+ return 0; ++ pr_info ("jmm_fb device open\n"); ++ return 0; +} + +/* +** This function will be called when we close the Misc Device file +*/ -+static int jmm_fb_close(struct inode *inodep, struct file *filp) ++static int jmm_fb_close (struct inode *inodep, struct file *filp) +{ -+ pr_info("jmm_fb device close\n"); -+ return 0; ++ pr_info ("jmm_fb device close\n"); ++ return 0; +} + +/* +** This function will be called when we write the Misc Device file +*/ -+static ssize_t jmm_fb_write(struct file *file, const char __user *buf, -+ size_t count, loff_t *f_pos) ++static ssize_t jmm_fb_write (struct file *file, const char __user *buf, ++ size_t count, loff_t *f_pos) +{ -+ if (*f_pos>=jmm_fb.fb_len) return 0; ++ if (*f_pos >= jmm_fb.fb_len) return 0; + -+ if ((*f_pos+count)>jmm_fb.fb_len) { -+ count=jmm_fb.fb_len-*f_pos; -+ } ++ if ((*f_pos + count) > jmm_fb.fb_len) ++ count = jmm_fb.fb_len - *f_pos; + -+ if (copy_from_user(jmm_fb.fb_base+(*f_pos), buf, count)) -+ return -EFAULT; ++ if (copy_from_user (jmm_fb.fb_base + (*f_pos), buf, count)) ++ return -EFAULT; + -+ (*f_pos) += count; ++ (*f_pos) += count; + -+ return count; ++ return count; +} -+ ++ +/* +** This function will be called when we read the Misc Device file +*/ -+static ssize_t jmm_fb_read(struct file *filp, char __user *buf, -+ size_t count, loff_t *f_pos) ++static ssize_t jmm_fb_read (struct file *filp, char __user *buf, ++ size_t count, loff_t *f_pos) +{ -+ if (*f_pos>=jmm_fb.fb_len) return 0; ++ if (*f_pos >= jmm_fb.fb_len) return 0; + -+ if ((*f_pos+count)>jmm_fb.fb_len) { -+ count=jmm_fb.fb_len-*f_pos; -+ } ++ if ((*f_pos + count) > jmm_fb.fb_len) ++ count = jmm_fb.fb_len - *f_pos; + -+ if (copy_to_user(buf, jmm_fb.fb_base+(*f_pos), count)) -+ return -EFAULT; ++ if (copy_to_user (buf, jmm_fb.fb_base + (*f_pos), count)) ++ return -EFAULT; + -+ (*f_pos) += count; ++ (*f_pos) += count; + -+ return count; ++ return count; +} + -+static loff_t jmm_fb_llseek(struct file *filp, loff_t offset, int whence) ++static loff_t jmm_fb_llseek (struct file *filp, loff_t offset, int whence) +{ -+loff_t new_offset; -+ -+ -+switch(whence) { -+case SEEK_SET: -+ new_offset=offset; -+ break; -+case SEEK_CUR: -+ new_offset=filp->f_pos + offset; -+ break; -+case SEEK_END: -+ new_offset=jmm_fb.fb_len + offset; -+ break; -+default: -+ return -EINVAL; -+} ++ loff_t new_offset; ++ ++ ++ switch (whence) { ++ case SEEK_SET: ++ new_offset = offset; ++ break; ++ ++ case SEEK_CUR: ++ new_offset = filp->f_pos + offset; ++ break; ++ ++ case SEEK_END: ++ new_offset = jmm_fb.fb_len + offset; ++ break; ++ ++ default: ++ return -EINVAL; ++ } + + -+if (new_offset<0) -+ return -EINVAL; -+if (new_offset>jmm_fb.fb_len) -+ return -EINVAL; ++ if (new_offset < 0) ++ return -EINVAL; + -+filp->f_pos=new_offset; ++ if (new_offset > jmm_fb.fb_len) ++ return -EINVAL; + -+return new_offset; ++ filp->f_pos = new_offset; ++ ++ return new_offset; +} + + + + -+//File operation structure ++//File operation structure +static const struct file_operations fops = { -+ .owner = THIS_MODULE, -+ .write = jmm_fb_write, -+ .read = jmm_fb_read, -+ .open = jmm_fb_open, -+ .release = jmm_fb_close, -+ .llseek = jmm_fb_llseek, ++ .owner = THIS_MODULE, ++ .write = jmm_fb_write, ++ .read = jmm_fb_read, ++ .open = jmm_fb_open, ++ .release = jmm_fb_close, ++ .llseek = jmm_fb_llseek, +}; + +//Misc device structure +struct miscdevice jmm_fb_device = { -+ .minor = MISC_DYNAMIC_MINOR, -+ .name = "jmm_fb", -+ .fops = &fops, ++ .minor = MISC_DYNAMIC_MINOR, ++ .name = "jmm_fb", ++ .fops = &fops, +}; + + +static const struct of_device_id jmm_fb_of_match[] = { -+ { .compatible = "jmm,frame-buffer-device" }, -+ { /* end of table */ } ++ { .compatible = "jmm,frame-buffer-device" }, ++ { /* end of table */ } +}; -+MODULE_DEVICE_TABLE(of, jmm_fb_of_match); ++MODULE_DEVICE_TABLE (of, jmm_fb_of_match); + + -+static int jmm_fb_probe(struct platform_device *pdev) ++static int jmm_fb_probe (struct platform_device *pdev) +{ -+ struct resource *res; -+ const struct of_device_id *match; -+ uint8_t *ptr; ++ struct resource *res; ++ const struct of_device_id *match; ++ uint8_t *ptr; ++ unsigned i; ++ ++ ++ match = of_match_node (jmm_fb_of_match, pdev->dev.of_node); ++ pr_info ("jmm_fb match %px\n", match); ++ printk (KERN_ERR "jmm_fb" "jmm_fb match %px\n", match); ++ ++ if (!match) { ++ dev_err (&pdev->dev, "of_match_node() failed\n"); ++ printk (KERN_ERR "jmm_fb" "of_match_node() failed\n"); ++ return -EINVAL; ++ } ++ ++ res = platform_get_resource (pdev, IORESOURCE_MEM, 0); ++ ++ if (!res) { ++ dev_err (&pdev->dev, "can't get parent mmio range\n"); ++ printk (KERN_ERR "jmm_fb" "can't get parent mmio range\n"); ++ return -EINVAL; ++ } ++ ++ jmm_fb.fb_len = res->end - res->start; ++ jmm_fb.fb_len++; ++ pr_info ("jmm_fb resource indicates length of 0x%x\n", jmm_fb.fb_len); ++ printk (KERN_ERR "jmm_fb resource indicates length of 0x%x\n", jmm_fb.fb_len); + ++ pr_info ("jmm_fb start %08x end %08x\n", (unsigned) res->start, (unsigned) res->end); ++ printk (KERN_ERR "jmm_fb start %08x end %08x\n", (unsigned) res->start, (unsigned) res->end); + -+ match = of_match_node(jmm_fb_of_match, pdev->dev.of_node); -+ pr_info("jmm_fb match %px\n",match); -+ printk(KERN_ERR "jmm_fb" "jmm_fb match %px\n",match); -+ if (!match) { -+ dev_err(&pdev->dev, "of_match_node() failed\n"); -+ printk(KERN_ERR "jmm_fb" "of_match_node() failed\n"); -+ return -EINVAL; -+ } ++ ptr = devm_ioremap_resource (&pdev->dev, res); ++ pr_info ("jmm_fb devm_ioremap_resource() gives %px\n", ptr); ++ printk (KERN_ERR "jmm_fb devm_ioremap_resource() gives %px\n", ptr); + -+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); -+ if (!res) { -+ dev_err(&pdev->dev, "can't get parent mmio range\n"); -+ printk(KERN_ERR "jmm_fb" "can't get parent mmio range\n"); -+ return -EINVAL; -+ } ++ if (IS_ERR (ptr)) ++ return PTR_ERR (ptr); + -+ jmm_fb.fb_len=res->end - res->start; -+ jmm_fb.fb_len++; -+ pr_info("jmm_fb resource indicates length of 0x%x\n",jmm_fb.fb_len); -+ printk(KERN_ERR "jmm_fb" "jmm_fb resource indicates length of 0x%x\n",jmm_fb.fb_len); ++ jmm_fb.fb_base = ptr; + -+ pr_info("jmm_fb start %08x end %08x\n",(unsigned) res->start, (unsigned) res->end ); -+ printk(KERN_ERR "jmm_fb start %08x end %08x\n",(unsigned) res->start, (unsigned) res->end ); ++ jmm_fb.info = framebuffer_alloc (sizeof (struct jmm_fb_par), &pdev->dev); ++ jmm_fb.info->screen_base = ptr; ++ jmm_fb.info->fbops = &jmm_fb_ops; ++ jmm_fb.info->fix = jmm_fb_fix; ++ jmm_fb.info->fix.smem_start = res->start; ++ jmm_fb.info->fix.smem_len = jmm_fb.fb_len; ++ jmm_fb.info->fix.type = FB_TYPE_PACKED_PIXELS; + -+ ptr = devm_ioremap_resource(&pdev->dev, res); -+ pr_info("jmm_fb devm_ioremap_resource() gives %px\n",ptr); -+ printk(KERN_ERR "jmm_fb" "jmm_fb devm_ioremap_resource() gives %px\n",ptr); ++ jmm_fb.info->flags = 0; + -+ if (IS_ERR(ptr)) -+ return PTR_ERR(ptr); ++ jmm_fb.info->var = jmm_fb_var; + -+ jmm_fb.fb_base=ptr; + -+ jmm_fb.info = framebuffer_alloc(sizeof(struct jmm_fb_par), &pdev->dev); -+ jmm_fb.info->screen_base = ptr; -+ jmm_fb.info->fbops=&jmm_fb_ops; -+ jmm_fb.info->fix=jmm_fb_fix; -+ jmm_fb.info->fix.smem_start = res->start; -+ jmm_fb.info->fix.smem_len = jmm_fb.fb_len; -+ jmm_fb.info->fix.type=FB_TYPE_PACKED_PIXELS; ++ if (fb_alloc_cmap (&jmm_fb.info->cmap, 0x10, 1)) { ++ framebuffer_release (jmm_fb.info); ++ jmm_fb.info = NULL; ++ } + -+ jmm_fb.info->flags=0; ++ jmm_fb.info->cmap.start = 0; ++ jmm_fb.info->cmap.len = 4; + -+ jmm_fb.info->var=jmm_fb_var; ++ for (i=0;i<0x8;++i) { ++ jmm_fb.info->cmap.red[i] = (i &4) ? 0xaaaa:0x0; ++ jmm_fb.info->cmap.green[i] = (i &2) ? 0xaaaa:0x0; ++ jmm_fb.info->cmap.blue[i] = (i &1) ? 0xaaaa:0x0; ++ jmm_fb.info->cmap.transp[i] = 0; ++ } + -+ return 0; ++ for (;i<0x10;++i) { ++ jmm_fb.info->cmap.red[i] = (i &4) ? 0xffff:0x5555; ++ jmm_fb.info->cmap.green[i] = (i &2) ? 0xffff:0x5555; ++ jmm_fb.info->cmap.blue[i] = (i &1) ? 0xffff:0x5555; ++ jmm_fb.info->cmap.transp[i] = 0; ++ } ++ ++ ++ jmm_fb.info->cmap.green[6] = 0x5555; // Brown ++ jmm_fb.info->cmap.transp[i] = 0xffff; ++ ++ if (register_framebuffer (jmm_fb.info) < 0) { ++ printk (KERN_ERR "jmm_fb register framebuffer didn't\n"); ++ fb_dealloc_cmap (&jmm_fb.info->cmap); ++ framebuffer_release (jmm_fb.info); ++ jmm_fb.info = NULL; ++ } else ++ printk (KERN_ERR "jmm_fb registered framebuffer\n"); ++ ++ ++ return 0; +} + +/** + * zynq_gpio_remove - Driver removal function -+ * @pdev: platform device instance ++ * @pdev: platform device instance + * + * Return: 0 always + */ -+static void jmm_fb_remove(struct platform_device *pdev) ++static void jmm_fb_remove (struct platform_device *pdev) +{ -+ //struct zynq_gpio *gpio = platform_get_drvdata(pdev); ++ //struct zynq_gpio *gpio = platform_get_drvdata(pdev); ++ ++ if (jmm_fb.info) { ++ unregister_framebuffer (jmm_fb.info); ++ fb_dealloc_cmap (&jmm_fb.info->cmap); + -+ unregister_framebuffer(jmm_fb.info); -+ framebuffer_release(jmm_fb.info); ++ framebuffer_release (jmm_fb.info); ++ jmm_fb.info = NULL; ++ } + -+ jmm_fb.fb_base=NULL; ++ jmm_fb.fb_base = NULL; +} + +static struct platform_driver jmm_fb_driver = { -+ .driver = { -+ .name = "jmm-fb", -+ .of_match_table = jmm_fb_of_match, -+ }, -+ .probe = jmm_fb_probe, -+ .remove = jmm_fb_remove, ++ .driver = { ++ .name = "jmm-fb", ++ .of_match_table = jmm_fb_of_match, ++ }, ++ .probe = jmm_fb_probe, ++ .remove = jmm_fb_remove, +}; + + -+static int __init jmm_fb_init(void) ++static int __init jmm_fb_init (void) +{ -+ int error; -+ -+ //jmm_fb_driver->driver.owner = THIS_MODULE; -+ //jmm_fb_driver->driver.bus=&platform_bus_type; -+ -+ error=platform_driver_register(&jmm_fb_driver); -+ if (error) { -+ pr_err("platform_driver_register failed!!!\n"); -+ printk(KERN_ERR "jmm_fb" "platform_driver_register failed!!!\n"); -+ return error; -+ } -+ -+ error = misc_register(&jmm_fb_device); -+ if (error) { -+ platform_driver_unregister(&jmm_fb_driver); -+ pr_err("misc_register failed!!!\n"); -+ printk(KERN_ERR "jmm_fb" "misc_register failed!!!\n"); -+ return error; -+ } -+ -+ pr_info("misc_register init done!!!\n"); -+ printk(KERN_ERR "jmm_fb" "misc_register init done!!!\n"); -+ -+ return 0; ++ int error; ++ ++ //jmm_fb_driver->driver.owner = THIS_MODULE; ++ //jmm_fb_driver->driver.bus=&platform_bus_type; ++ ++ error = platform_driver_register (&jmm_fb_driver); ++ ++ if (error) { ++ pr_err ("platform_driver_register failed!!!\n"); ++ printk (KERN_ERR "jmm_fb" "platform_driver_register failed!!!\n"); ++ return error; ++ } ++ ++ error = misc_register (&jmm_fb_device); ++ ++ if (error) { ++ platform_driver_unregister (&jmm_fb_driver); ++ pr_err ("misc_register failed!!!\n"); ++ printk (KERN_ERR "jmm_fb" "misc_register failed!!!\n"); ++ return error; ++ } ++ ++ pr_info ("misc_register init done!!!\n"); ++ printk (KERN_ERR "jmm_fb" "misc_register init done!!!\n"); ++ ++ return 0; +} + -+static void __exit jmm_fb_exit(void) ++static void __exit jmm_fb_exit (void) +{ -+ misc_deregister(&jmm_fb_device); -+ platform_driver_unregister(&jmm_fb_driver); ++ misc_deregister (&jmm_fb_device); ++ platform_driver_unregister (&jmm_fb_driver); + -+ pr_info("misc_register exit done!!!\n"); ++ pr_info ("misc_register exit done!!!\n"); + +} -+ -+module_init(jmm_fb_init) -+module_exit(jmm_fb_exit) -+ -+MODULE_LICENSE("GPL"); -+MODULE_AUTHOR("meh"); -+MODULE_DESCRIPTION("jmm_fb driver"); -+MODULE_VERSION("1.00"); ++ ++module_init (jmm_fb_init) ++module_exit (jmm_fb_exit) ++ ++MODULE_LICENSE ("GPL"); ++MODULE_AUTHOR ("meh"); ++MODULE_DESCRIPTION ("jmm_fb driver"); ++MODULE_VERSION ("1.00"); + diff --git a/fpga/ebaz4205/src/uEnv.txt b/fpga/ebaz4205/src/uEnv.txt index 45f0791..0bd8ee6 100644 --- a/fpga/ebaz4205/src/uEnv.txt +++ b/fpga/ebaz4205/src/uEnv.txt @@ -5,7 +5,8 @@ devicetree_image=ebaz4205-zynq7.dtb loaddtb=load mmc 0 ${devicetree_load_address} ${devicetree_image} ramdisk_image=nowt.cpio.uboot loadramdisk=load mmc 0 ${ramdisk_load_address} ${ramdisk_image} -bootargs=earlyprintk console=ttyPS0,115200 root=/dev/mmcblk0p3 ro rootwait +#bootargs=earlyprintk console=ttyPS0,115200 root=/dev/mmcblk0p3 ro rootwait +bootargs=fbcon=rotate:1 root=/dev/mmcblk0p3 ro rootwait bitstream_image=hp_lcd_driver.bin bitstream_type=load fpga_config=fpga ${bitstream_type} 0 ${bitstream_load_address} ${filesize} diff --git a/fpga/hp_lcd_driver/Makefile b/fpga/hp_lcd_driver/Makefile index 0558bdd..6e21f21 100644 --- a/fpga/hp_lcd_driver/Makefile +++ b/fpga/hp_lcd_driver/Makefile @@ -7,7 +7,7 @@ TARGETS=ebaz4205 better_default: ${TARGETS:%=build_%/hp_lcd_driver.svf} scp build_ebaz4205/out/hp_lcd_driver.bin ${DIP}:/boot/uboot/hp_lcd_driver.bin - ssh -n ${DIP} reboot < /dev/null & + #ssh -n ${DIP} reboot < /dev/null & qbetter_default: build_rando_a7/hp_lcd_driver.svf ./prog_a7 diff --git a/fpga/hp_lcd_driver/common.vhdl b/fpga/hp_lcd_driver/common.vhdl index 39d1f28..a3e41d4 100644 --- a/fpga/hp_lcd_driver/common.vhdl +++ b/fpga/hp_lcd_driver/common.vhdl @@ -46,7 +46,10 @@ entity common is video_out_index : out std_logic; video_in_addr : out std_logic_vector(addr_width-1 downto 0); video_in_clk : out std_logic; - video_in_data : in std_logic_vector(1 downto 0) + video_in_gate : in std_logic; + video_in_r : in std_logic_vector(7 downto 0); + video_in_g : in std_logic_vector(7 downto 0); + video_in_b : in std_logic_vector(7 downto 0) ); end common; @@ -264,15 +267,12 @@ begin - r <= r_s when video_in_data(1) = '0' else - x"00" when video_in_data(0)='0' else - x"ff"; - g <= g_s when video_in_data(1) = '0' else - x"00" when video_in_data(0)='0' else - x"ff"; - b <= b_s when video_in_data(1) = '0' else - x"00" when video_in_data(0)='0' else - x"ff"; + r <= r_s when video_in_gate = '0' else + video_in_r; + g <= g_s when video_in_gate = '0' else + video_in_g; + b <= b_s when video_in_gate = '0' else + video_in_b; output0 : entity work.output_stage diff --git a/fpga/hp_lcd_driver/hp_lcd_driver.vhdl b/fpga/hp_lcd_driver/hp_lcd_driver.vhdl index d68afa5..5c29ff6 100644 --- a/fpga/hp_lcd_driver/hp_lcd_driver.vhdl +++ b/fpga/hp_lcd_driver/hp_lcd_driver.vhdl @@ -77,7 +77,10 @@ begin video_out_valid => open, video_in_clk => open, video_in_addr => open, - video_in_data => x"00" + video_in_gate => '0', + video_in_r => open, + video_in_g => open, + video_in_b => open ); end Behavioral; diff --git a/fpga/hp_lcd_driver/output_stage.vhdl b/fpga/hp_lcd_driver/output_stage.vhdl index 234d16d..4787dc6 100644 --- a/fpga/hp_lcd_driver/output_stage.vhdl +++ b/fpga/hp_lcd_driver/output_stage.vhdl @@ -137,7 +137,7 @@ begin o => grid_d ); - r <= r_in when grid_d='0' else x"ff"; + r <= r_in; -- when grid_d='0' else x"ff"; g <= g_in; b <= b_in; diff --git a/fpga/hp_lcd_driver/zynq7.mk b/fpga/hp_lcd_driver/zynq7.mk index 1426f38..05f5727 100644 --- a/fpga/hp_lcd_driver/zynq7.mk +++ b/fpga/hp_lcd_driver/zynq7.mk @@ -35,7 +35,6 @@ SRCS= ${IP} \ tmds_output_artix7.vhdl \ tmds_phy_artix7.vhdl \ vram_artix7.vhdl \ - overlay_vram_artix7.vhdl \ zynq7_wrapper.vhdl \ fifo_to_axi.vhdl \ vnc_serializer.vhdl diff --git a/fpga/hp_lcd_driver/zynq7_ip/blk_mem_gen_1.tcl b/fpga/hp_lcd_driver/zynq7_ip/blk_mem_gen_1.tcl index e178395..588d624 100644 --- a/fpga/hp_lcd_driver/zynq7_ip/blk_mem_gen_1.tcl +++ b/fpga/hp_lcd_driver/zynq7_ip/blk_mem_gen_1.tcl @@ -13,7 +13,7 @@ set_property -dict [list \ CONFIG.Use_Byte_Write_Enable {true} \ CONFIG.Byte_Size {8} \ CONFIG.Write_Width_A {32} \ - CONFIG.Write_Depth_A {16384} \ + CONFIG.Write_Depth_A {28800} \ CONFIG.Read_Width_A {32} \ CONFIG.Operating_Mode_A {WRITE_FIRST} \ CONFIG.Write_Width_B {32} \ diff --git a/fpga/hp_lcd_driver/zynq7_wrapper.vhdl b/fpga/hp_lcd_driver/zynq7_wrapper.vhdl index ca90bea..0e7367e 100644 --- a/fpga/hp_lcd_driver/zynq7_wrapper.vhdl +++ b/fpga/hp_lcd_driver/zynq7_wrapper.vhdl @@ -100,6 +100,21 @@ end entity zynq7_wrapper; architecture arch of zynq7_wrapper is + type t_palette is array (0 to 15) of std_logic_vector(7 downto 0); + constant r_lut : t_palette := ( + x"00", x"00", x"00", x"00", x"AA", x"AA", x"AA", x"AA", + x"55", x"55", x"55", x"55", x"FF", x"FF", x"FF", x"FF" + ); + constant g_lut : t_palette := ( + x"00", x"00", x"AA", x"AA", x"00", x"00", x"55", x"AA", + x"55", x"55", x"FF", x"FF", x"55", x"55", x"FF", x"FF" + ); + constant b_lut : t_palette := ( + x"00", x"AA", x"00", x"AA", x"00", x"AA", x"00", x"AA", + x"55", x"FF", x"55", x"FF", x"55", x"FF", x"55", x"FF" + ); + + signal eth0_gmii_txd : std_logic_vector(7 downto 0); signal eth0_gmii_rxd : std_logic_vector(7 downto 0); @@ -193,8 +208,13 @@ architecture arch of zynq7_wrapper is signal overlay_addr : std_logic_vector(addr_width-1 downto 0); signal overlay_clk : std_logic; - signal overlay_data : std_logic_vector(1 downto 0); + signal overlay_demux_p :integer; signal overlay_demux :integer; + signal overlay_data : integer; + signal overlay_gate : std_logic; + signal overlay_r : std_logic_vector(7 downto 0); + signal overlay_g : std_logic_vector(7 downto 0); + signal overlay_b : std_logic_vector(7 downto 0); signal fb_ps_clk : STD_LOGIC; @@ -204,9 +224,11 @@ architecture arch of zynq7_wrapper is signal fb_ps_wrdata : STD_LOGIC_VECTOR ( 31 downto 0 ); signal fb_ps_rddata : STD_LOGIC_VECTOR ( 31 downto 0 ); - signal fb_pl_addr : STD_LOGIC_VECTOR ( 13 downto 0 ); + signal fb_pl_addr : STD_LOGIC_VECTOR ( 14 downto 0 ); signal fb_pl_rddata : STD_LOGIC_VECTOR ( 31 downto 0 ); + + begin scope_ch1 <= gp0_awvalid; --clk_50m_ps; @@ -250,7 +272,10 @@ begin video_out_index => vnc_index, video_in_clk => overlay_clk, video_in_addr => overlay_addr, - video_in_data => overlay_data + video_in_gate => overlay_gate, + video_in_r => overlay_r, + video_in_g => overlay_g, + video_in_b => overlay_b ); processing_system7_0_i : entity work.processing_system7_0 @@ -475,11 +500,22 @@ begin - fb_pl_addr <= overlay_addr(17 downto 4); + fb_pl_addr <= overlay_addr(17 downto 3); - overlay_demux <= to_integer(unsigned(overlay_addr(3 downto 0)))*2; - overlay_data(0) <= fb_pl_rddata(overlay_demux); - overlay_data(1) <= fb_pl_rddata(overlay_demux +1); + process (overlay_clk) begin + if rising_edge(overlay_clk) then + overlay_demux_p <= to_integer(unsigned(overlay_addr(2 downto 0)))*4; + overlay_demux <=overlay_demux_p; + end if; + end process; + + overlay_data <= to_integer(unsigned(fb_pl_rddata(overlay_demux+3 downto overlay_demux))); + + overlay_gate <= '0' when overlay_data = 0 else '1'; + overlay_r <= r_lut(overlay_data); + overlay_g <= g_lut(overlay_data); + overlay_b <= b_lut(overlay_data); + -- fb_ps_rddata <=x"9abcdef0"; |
