diff options
| -rw-r--r-- | fpga/ebaz4205/linux-6.16.4-pq/master/serial-test | 287 | ||||
| -rw-r--r-- | fpga/hp_lcd_driver/Makefile | 2 | ||||
| -rw-r--r-- | fpga/hp_lcd_driver/ebaz4205.xdc | 12 | ||||
| -rw-r--r-- | fpga/hp_lcd_driver/fb_ram.vhdl | 81 | ||||
| -rw-r--r-- | fpga/hp_lcd_driver/zynq7_ip/axi_uart16550_0.tcl | 12 | ||||
| -rw-r--r-- | fpga/hp_lcd_driver/zynq7_wrapper.vhdl | 13 |
6 files changed, 400 insertions, 7 deletions
diff --git a/fpga/ebaz4205/linux-6.16.4-pq/master/serial-test b/fpga/ebaz4205/linux-6.16.4-pq/master/serial-test new file mode 100644 index 0000000..ff0ea66 --- /dev/null +++ b/fpga/ebaz4205/linux-6.16.4-pq/master/serial-test @@ -0,0 +1,287 @@ +diff --git a/.config b/.config +index e06bfbd12..baad3e250 100644 +--- a/.config ++++ b/.config +@@ -1794,6 +1794,7 @@ CONFIG_PCI_ENDPOINT_TEST=m + # CONFIG_MCHP_LAN966X_PCI is not set + CONFIG_MISC_JMM_VCAP=y + CONFIG_MISC_JMM_FB=y ++CONFIG_MISC_SERIAL_TEST=y + # CONFIG_C2PORT is not set + + # +diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig +index b56499f42..35ac2299a 100644 +--- a/drivers/misc/Kconfig ++++ b/drivers/misc/Kconfig +@@ -650,6 +650,9 @@ config MISC_JMM_VCAP + config MISC_JMM_FB + tristate "JMM_FB Driver" + ++config MISC_SERIAL_TEST ++ tristate "serial test driver" ++ + source "drivers/misc/c2port/Kconfig" + source "drivers/misc/eeprom/Kconfig" + source "drivers/misc/cb710/Kconfig" +diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile +index 7f3eadf0e..9aff2404c 100644 +--- a/drivers/misc/Makefile ++++ b/drivers/misc/Makefile +@@ -68,6 +68,7 @@ obj-$(CONFIG_TMR_MANAGER) += xilinx_tmr_manager.o + obj-$(CONFIG_TMR_INJECT) += xilinx_tmr_inject.o + obj-$(CONFIG_MISC_JMM_VCAP) += jmm_vcap.o + obj-$(CONFIG_MISC_JMM_FB) += jmm_fb.o ++obj-$(CONFIG_MISC_SERIAL_TEST) += serial_test.o + obj-$(CONFIG_TPS6594_ESM) += tps6594-esm.o + obj-$(CONFIG_TPS6594_PFSM) += tps6594-pfsm.o + obj-$(CONFIG_NSM) += nsm.o +diff --git a/drivers/misc/serial_test.c b/drivers/misc/serial_test.c +new file mode 100644 +index 000000000..1dbb9fc37 +--- /dev/null ++++ b/drivers/misc/serial_test.c +@@ -0,0 +1,243 @@ ++#include <linux/miscdevice.h> ++#include <linux/fs.h> ++#include <linux/kernel.h> ++#include <linux/module.h> ++#include <linux/init.h> ++#include <linux/uaccess.h> ++#include <linux/io.h> ++#include <linux/platform_device.h> ++#include <linux/pm_runtime.h> ++#include <linux/of.h> ++ ++ ++ ++static struct serial_test { ++ uint8_t *reg_base; ++ size_t reg_len; ++} serial_test; ++ ++ ++/* ++** This function will be called when we open the Misc device file ++*/ ++static int serial_test_open(struct inode *inode, struct file *file) ++{ ++ pr_info("serial_test device open\n"); ++ return 0; ++} ++ ++/* ++** This function will be called when we close the Misc Device file ++*/ ++static int serial_test_close(struct inode *inodep, struct file *filp) ++{ ++ pr_info("serial_test device close\n"); ++ return 0; ++} ++ ++/* ++** This function will be called when we write the Misc Device file ++*/ ++static ssize_t serial_test_write(struct file *file, const char __user *buf, ++ size_t len, loff_t *ppos) ++{ ++ pr_info("serial_test device write\n"); ++ ++ /* We are not doing anything with this data now */ ++ ++ return -ENODEV; ++} ++ ++/* ++** This function will be called when we read the Misc Device file ++*/ ++static ssize_t serial_test_read(struct file *filp, char __user *buf, ++ size_t count, loff_t *f_pos) ++{ ++ ++ if (*f_pos>=serial_test.reg_len) return 0; ++ ++ if ((*f_pos+count)>serial_test.reg_len) { ++ count=serial_test.reg_len-*f_pos; ++ } ++ ++ if (copy_to_user(buf, serial_test.reg_base+(*f_pos), count)) ++ return -EFAULT; ++ ++ (*f_pos) += count; ++ ++ return count; ++} ++ ++static loff_t serial_test_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=serial_test.reg_len + offset; ++ break; ++default: ++ return -EINVAL; ++} ++ ++ ++if (new_offset<0) ++ return -EINVAL; ++if (new_offset>serial_test.reg_len) ++ return -EINVAL; ++ ++filp->f_pos=new_offset; ++ ++return new_offset; ++} ++ ++ ++//File operation structure ++static const struct file_operations fops = { ++ .owner = THIS_MODULE, ++ .write = serial_test_write, ++ .read = serial_test_read, ++ .open = serial_test_open, ++ .release = serial_test_close, ++ .llseek = serial_test_llseek, ++}; ++ ++//Misc device structure ++struct miscdevice serial_test_device = { ++ .minor = MISC_DYNAMIC_MINOR, ++ .name = "serial_test", ++ .fops = &fops, ++}; ++ ++ ++static const struct of_device_id serial_test_of_match[] = { ++ { .compatible = "jmm,serial-test" }, ++ { /* end of table */ } ++}; ++MODULE_DEVICE_TABLE(of, serial_test_of_match); ++ ++ ++static int serial_test_probe(struct platform_device *pdev) ++{ ++ struct resource *res; ++ const struct of_device_id *match; ++ uint8_t *ptr; ++ ++ ++ match = of_match_node(serial_test_of_match, pdev->dev.of_node); ++ pr_info("serial_test match %px\n",match); ++ printk(KERN_ERR "serial_test" "serial_test match %px\n",match); ++ if (!match) { ++ dev_err(&pdev->dev, "of_match_node() failed\n"); ++ printk(KERN_ERR "serial_test" "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 "serial_test" "can't get parent mmio range\n"); ++ return -EINVAL; ++ } ++ ++ serial_test.reg_len=res->end - res->start; ++ serial_test.reg_len++; ++ pr_info("serial_test resource indicates length of 0x%x\n",serial_test.reg_len); ++ printk(KERN_ERR "serial_test" "serial_test resource indicates length of 0x%x\n",serial_test.reg_len); ++ ++ ptr = devm_ioremap_resource(&pdev->dev, res); ++ pr_info("serial_test devm_ioremap_resource() gives %px\n",ptr); ++ printk(KERN_ERR "serial_test" "serial_test devm_ioremap_resource() gives %px\n",ptr); ++ ++ if (IS_ERR(ptr)) ++ return PTR_ERR(ptr); ++ ++ serial_test.reg_base=ptr; ++ ++ return 0; ++} ++ ++/** ++ * zynq_gpio_remove - Driver removal function ++ * @pdev: platform device instance ++ * ++ * Return: 0 always ++ */ ++static void serial_test_remove(struct platform_device *pdev) ++{ ++ serial_test.reg_base=NULL; ++} ++ ++static struct platform_driver serial_test_driver = { ++ .driver = { ++ .name = "jmm-serial-test", ++ .of_match_table = serial_test_of_match, ++ }, ++ .probe = serial_test_probe, ++ .remove = serial_test_remove, ++}; ++ ++ ++static int __init serial_test_init(void) ++{ ++ int error; ++ ++ //serial_test_driver->driver.owner = THIS_MODULE; ++ //serial_test_driver->driver.bus=&platform_bus_type; ++ ++ error=platform_driver_register(&serial_test_driver); ++ if (error) { ++ pr_err("platform_driver_register failed!!!\n"); ++ printk(KERN_ERR "serial_test" "platform_driver_register failed!!!\n"); ++ return error; ++ } ++ ++ error = misc_register(&serial_test_device); ++ if (error) { ++ platform_driver_unregister(&serial_test_driver); ++ pr_err("misc_register failed!!!\n"); ++ printk(KERN_ERR "serial_test" "misc_register failed!!!\n"); ++ return error; ++ } ++ ++ pr_info("misc_register init done!!!\n"); ++ printk(KERN_ERR "serial_test" "misc_register init done!!!\n"); ++ ++#if 0 ++ serial_test = ioremap(0xfffc0000,0x40000); ++ pr_info("serial_test mapped at %px\n",serial_test); ++#endif ++ ++ return 0; ++} ++ ++static void __exit serial_test_exit(void) ++{ ++ misc_deregister(&serial_test_device); ++ platform_driver_unregister(&serial_test_driver); ++ ++ pr_info("misc_register exit done!!!\n"); ++ ++#if 0 ++ if (serial_test.reg_base) iounmap(serial_test.reg_base); ++#endif ++} ++ ++module_init(serial_test_init) ++module_exit(serial_test_exit) ++ ++MODULE_LICENSE("GPL"); ++MODULE_AUTHOR("meh"); ++MODULE_DESCRIPTION("serial_test driver"); ++MODULE_VERSION("1.00"); ++ ++ ++ diff --git a/fpga/hp_lcd_driver/Makefile b/fpga/hp_lcd_driver/Makefile index 0558bdd..9b9fe65 100644 --- a/fpga/hp_lcd_driver/Makefile +++ b/fpga/hp_lcd_driver/Makefile @@ -1,4 +1,4 @@ -DIP=10.16.66.234 +DIP=10.16.66.224 #TARGETS=rando_a7 TARGETS=ebaz4205 #TARGETS= ebaz4205 #rando_a7 #smh-ac415b #spartan6 #ep4ce6 smh-ac415 diff --git a/fpga/hp_lcd_driver/ebaz4205.xdc b/fpga/hp_lcd_driver/ebaz4205.xdc index c2ee09d..9d345be 100644 --- a/fpga/hp_lcd_driver/ebaz4205.xdc +++ b/fpga/hp_lcd_driver/ebaz4205.xdc @@ -117,14 +117,14 @@ set_property IOSTANDARD LVCMOS33 [get_ports {hsync_in}] #set_property PULLTYPE PULLUP [get_ports {sys_rst_n}] # -set_property PACKAGE_PIN M19 [get_ports {u0_tx}]; #data3-5 -set_property IOSTANDARD LVCMOS33 [get_ports {u0_tx}] -set_property PACKAGE_PIN P18 [get_ports {u0_rx}]; #data3-7 -set_property IOSTANDARD LVCMOS33 [get_ports {u0_rx}] -set_property PACKAGE_PIN N17 [get_ports {u1_tx}]; #data3-9 +set_property PACKAGE_PIN M19 [get_ports {u1_tx}]; #data3-5 set_property IOSTANDARD LVCMOS33 [get_ports {u1_tx}] -set_property PACKAGE_PIN P20 [get_ports {u1_rx}]; #data3-11 +set_property PACKAGE_PIN N20 [get_ports {u0_tx}]; #data3-6 +set_property IOSTANDARD LVCMOS33 [get_ports {u0_tx}] +set_property PACKAGE_PIN P18 [get_ports {u1_rx}]; #data3-7 set_property IOSTANDARD LVCMOS33 [get_ports {u1_rx}] +set_property PACKAGE_PIN M17 [get_ports {u0_rx}]; #data3-8 +set_property IOSTANDARD LVCMOS33 [get_ports {u0_rx}] set_property PACKAGE_PIN M20 [get_ports {scope_ch1}]; #data2-19 set_property IOSTANDARD LVCMOS33 [get_ports {scope_ch1}] diff --git a/fpga/hp_lcd_driver/fb_ram.vhdl b/fpga/hp_lcd_driver/fb_ram.vhdl new file mode 100644 index 0000000..89c1a1a --- /dev/null +++ b/fpga/hp_lcd_driver/fb_ram.vhdl @@ -0,0 +1,81 @@ +library IEEE; +use IEEE.STD_LOGIC_1164.all; +use IEEE.NUMERIC_STD.all; +use work.all; + +entity fb_ram is + Port ( + clka : in STD_LOGIC; + ena : in STD_LOGIC; + wea : in STD_LOGIC_VECTOR ( 3 downto 0 ); + addra : in STD_LOGIC_VECTOR ( 15 downto 0 ); + dina : in STD_LOGIC_VECTOR ( 31 downto 0 ); + douta : out STD_LOGIC_VECTOR ( 31 downto 0 ); + clkb : in STD_LOGIC; + web : in STD_LOGIC_VECTOR ( 3 downto 0 ); + addrb : in STD_LOGIC_VECTOR ( 15 downto 0 ); + dinb : in STD_LOGIC_VECTOR ( 31 downto 0 ); + doutb : out STD_LOGIC_VECTOR ( 31 downto 0 ) + ); +end fb_ram; + +architecture Behavioural of fb_ram is +type t_d is array (0 to 3) of std_logic_vector(2 downto 0); + +signal s_dina:t_d; +signal s_dinb:t_d; +signal s_douta:t_d; +signal s_doutb:t_d; + +begin + + + g_fbram: for i in 0 to 3 generate + + s_dina(i)(2) <= dina((8*i)+7); + s_dina(i)(1) <= dina((8*i)+4); + s_dina(i)(0) <= dina((8*i)+1); + + douta((8*i)+7) <= s_douta(i)(2); + douta((8*i)+6) <= s_douta(i)(2); + douta((8*i)+5) <= s_douta(i)(2); + douta((8*i)+4) <= s_douta(i)(1); + douta((8*i)+3) <= s_douta(i)(1); + douta((8*i)+2) <= s_douta(i)(1); + douta((8*i)+1) <= s_douta(i)(0); + douta((8*i)+0) <= s_douta(i)(0); + + s_dinb(i)(2) <= dinb((8*i)+7); + s_dinb(i)(1) <= dinb((8*i)+4); + s_dinb(i)(0) <= dinb((8*i)+1); + + doutb((8*i)+7) <= s_doutb(i)(2); + doutb((8*i)+6) <= s_doutb(i)(2); + doutb((8*i)+5) <= s_doutb(i)(2); + doutb((8*i)+4) <= s_doutb(i)(1); + doutb((8*i)+3) <= s_doutb(i)(1); + doutb((8*i)+2) <= s_doutb(i)(1); + doutb((8*i)+1) <= s_doutb(i)(0); + doutb((8*i)+0) <= s_doutb(i)(0); + + + + fb_ram_i : entity work.blk_mem_gen_1 + port map ( + clka => clka, + ena => ena, + wea => wea(i), + addra => addra, + dina => s_dina(i), + douta => s_douta(i), + clkb => clkb, + web => web(0), + addrb => addrb, + dinb => s_dinb(i), + doutb => s_doutb(i) + ); + + end generate; + + +end Behavioural; diff --git a/fpga/hp_lcd_driver/zynq7_ip/axi_uart16550_0.tcl b/fpga/hp_lcd_driver/zynq7_ip/axi_uart16550_0.tcl index 7005584..13d4573 100644 --- a/fpga/hp_lcd_driver/zynq7_ip/axi_uart16550_0.tcl +++ b/fpga/hp_lcd_driver/zynq7_ip/axi_uart16550_0.tcl @@ -5,6 +5,18 @@ source $source_dir/zynq7_config.tcl create_ip -name axi_uart16550 -vendor xilinx.com -library ip -version 2.0 -module_name axi_uart16550_0 -dir $ip_dir +set_property -dict [ list \ + CONFIG.C_EXTERNAL_XIN_CLK_HZ {25000000} \ + CONFIG.C_HAS_EXTERNAL_RCLK {0} \ + CONFIG.C_HAS_EXTERNAL_XIN {0} \ + CONFIG.C_IS_A_16550 {16550} \ + CONFIG.C_S_AXI_ACLK_FREQ_HZ {50000000} \ + CONFIG.C_USE_MODEM_PORTS {1} \ + CONFIG.C_USE_USER_PORTS {1} \ + CONFIG.UART_BOARD_INTERFACE {Custom} \ + ] [get_ips axi_uart16550_0] + + generate_target all [get_ips] synth_ip [get_ips] diff --git a/fpga/hp_lcd_driver/zynq7_wrapper.vhdl b/fpga/hp_lcd_driver/zynq7_wrapper.vhdl index 0107700..8efbbb5 100644 --- a/fpga/hp_lcd_driver/zynq7_wrapper.vhdl +++ b/fpga/hp_lcd_driver/zynq7_wrapper.vhdl @@ -241,6 +241,12 @@ architecture arch of zynq7_wrapper is signal overlay_b : std_logic_vector(7 downto 0); +-- signal u0_t0 : std_logic; +-- signal u0_t1 : std_logic; +-- signal u1_t0 : std_logic; +-- signal u1_t1 : std_logic; + + begin @@ -617,6 +623,13 @@ begin ); +-- u0_t1 <= u0_rx and u0_t0; +-- u1_t1 <= u1_rx and u1_t0; + +-- u1_tx <= u0_rx; +-- u0_tx <= u1_rx; + + |
