]> jspc29.x-matter.uni-frankfurt.de Git - trb3.git/commitdiff
nxyter: new i2c handler working
authorLudwig Maier <lmaier@crius.e12.ph.tum.de>
Tue, 12 Nov 2013 00:20:48 +0000 (01:20 +0100)
committerLudwig Maier <lmaier@crius.e12.ph.tum.de>
Wed, 20 Nov 2013 20:43:14 +0000 (21:43 +0100)
nxyter/source/nx_setup.vhd
nxyter/source/registers.txt

index 6fbf70db546b964e50c4254568463fa7b0ebe873..598de8216e249206b9fc1920c4ca9bc1c987291e 100644 (file)
@@ -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,
index bbab26907960b6ab6e4c1a63e0e9a99db27b58da..683d1d6f08898d3d93ce79d53011192ff1022f72 100644 (file)
@@ -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)