DRS4 Forum
  DRS4 Discussion Forum  Not logged in ELOG logo
Entry  Wed Mar 14 09:13:39 2018, chen wenjun, confusion about the description in drs.cpp 20180314161201.jpg
    Reply  Fri Mar 16 14:00:06 2018, Stefan Ritt, confusion about the description in drs.cpp 
       Reply  Sun May 6 08:13:37 2018, chen wenjun, confusion about the description in drs.cpp 
          Reply  Sun May 6 11:45:09 2018, Stefan Ritt, confusion about the description in drs.cpp 
Message ID: 673     Entry time: Fri Mar 16 14:00:06 2018     In reply to: 671     Reply to this: 689
Author: Stefan Ritt 
Subject: confusion about the description in drs.cpp 

The FPGA is very small, so it only has an address space of 256 bytes. Look at the definition in DRS.cpp

#define USB_CTRL_OFFSET                 0x00    /* all registers 32 bit */
#define USB_STATUS_OFFSET               0x40
#define USB_RAM_OFFSET                  0x80

The registers are 32 bits wide, but the addresses only run from 0 to 255, and thus a single byte is enough for addressing them.

chen wenjun wrote:

Hi,Stefan:

  recently,whtn I study the drs.cpp code ,I found that  the buffer[1] is char but the addr and the base_addr are all unsigned int,isn't there any problem that the addr may be cut off to 8 bits? Also ,I found that the data fpga recieved from the usb is 16 bits,so how can fpga get the true 32bits address from the PC.

 

ELOG V3.1.5-3fb85fa6