From 862f0a05bdeb84281cde8a26da0a82da62e15253 Mon Sep 17 00:00:00 2001 From: Ludwig Maier Date: Tue, 12 Nov 2013 01:20:48 +0100 Subject: [PATCH] nxyter: new i2c handler working --- nxyter/source/nx_setup.vhd | 15 ++++++++++++--- nxyter/source/registers.txt | 1 + 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/nxyter/source/nx_setup.vhd b/nxyter/source/nx_setup.vhd index 6fbf70d..598de82 100644 --- a/nxyter/source/nx_setup.vhd +++ b/nxyter/source/nx_setup.vhd @@ -406,12 +406,20 @@ begin ----------------------------------------------------------------------------- PROC_I2C_TOKEN_HANDLER: process(CLK_IN) + variable read_token_mask : std_logic_vector(45 downto 0) := (others => '1'); begin if( rising_edge(CLK_IN) ) then if( RESET_IN = '1' ) then i2c_read_token <= (others => '0'); i2c_write_token <= (others => '0'); else + if (i2c_ram(32)(3) = '1') then + read_token_mask(15 downto 0) := (others => '0'); + read_token_mask(45 downto 16) := (others => '1'); + else + read_token_mask := (others => '1'); + end if; + -- Write Token if (unsigned(i2c_write_token_r) /= 0) then i2c_write_token <= i2c_write_token or i2c_write_token_r; @@ -421,9 +429,10 @@ begin -- Read Token if (i2c_update_memory = '1') then - i2c_read_token <= (others => '1'); + i2c_read_token <= read_token_mask; elsif (unsigned(i2c_read_token_r) /= 0) then - i2c_read_token <= i2c_read_token or i2c_read_token_r; + i2c_read_token <= (i2c_read_token or i2c_read_token_r) and + read_token_mask; elsif (unsigned(read_token_clear) /= 0) then i2c_read_token <= i2c_read_token and (not read_token_clear); end if; @@ -835,7 +844,7 @@ begin pulse_delay_1: pulse_delay generic map ( - DELAY => 10000 + DELAY => 1000000 ) port map ( CLK_IN => CLK_IN, diff --git a/nxyter/source/registers.txt b/nxyter/source/registers.txt index bbab269..683d1d6 100644 --- a/nxyter/source/registers.txt +++ b/nxyter/source/registers.txt @@ -22,6 +22,7 @@ 0x8256 : r Nxyter I2C Online 0x8260 : w Read all I2C Registers into Memory 0x8261 : w Read Trim DAC Register(129 deep FIFO) into Memory +0x8262 : w Read ALL: Read Trim DAC Register(129 deep FIFO) into Memory -- Trigger Generator 0x8140 : r/w Length of Trigger TestPulse (12 Bit, in 4ns) -- 2.43.0