// R/W addresses to set up memory arbiter priorities. For sensors (chn = 8..11), for compressors - 12..15
voidset_x393_mcntrl_arbiter_priority(x393_arbite_pri_td,intchn){writel(d.d32,mmio_ptr+(0x0180+0x4*chn));}// Set memory arbiter priority (currently r/w, may become just wo)
// Write-only addresses to program memory channels for sensors (chn = 0..3), memory channels 8..11
voidx393_sens_mcntrl_scanline_mode(x393_mcntrl_mode_scan_td,intchn){writel(d.d32,mmio_ptr+(0x1a00+0x40*chn));}// Set mode register (write last after other channel registers are set)
voidset_x393_sens_mcntrl_scanline_status_cntrl(x393_status_ctrl_td,intchn){writel(d.d32,mmio_ptr+(0x1a04+0x40*chn));}// Set status control register (status update mode)
voidx393_sens_mcntrl_scanline_startaddr(x393_mcntrl_window_frame_sa_td,intchn){writel(d.d32,mmio_ptr+(0x1a08+0x40*chn));}// Set frame start address
voidx393_sens_mcntrl_scanline_frame_size(x393_mcntrl_window_frame_sa_inc_td,intchn){writel(d.d32,mmio_ptr+(0x1a0c+0x40*chn));}// Set frame size (address increment)
voidx393_sens_mcntrl_scanline_frame_last(x393_mcntrl_window_last_frame_num_td,intchn){writel(d.d32,mmio_ptr+(0x1a10+0x40*chn));}// Set last frame number (number of frames in buffer minus 1)
voidx393_sens_mcntrl_scanline_frame_full_width(x393_mcntrl_window_full_width_td,intchn){writel(d.d32,mmio_ptr+(0x1a14+0x40*chn));}// Set frame full(padded) width
voidx393_sens_mcntrl_scanline_window_wh(x393_mcntrl_window_width_height_td,intchn){writel(d.d32,mmio_ptr+(0x1a18+0x40*chn));}// Set frame window size
voidx393_sens_mcntrl_scanline_window_x0y0(x393_mcntrl_window_left_top_td,intchn){writel(d.d32,mmio_ptr+(0x1a1c+0x40*chn));}// Set frame position
voidx393_sens_mcntrl_scanline_startxy(x393_mcntrl_window_startx_starty_td,intchn){writel(d.d32,mmio_ptr+(0x1a20+0x40*chn));}// Set startXY register
// Write-only addresses to program memory channels for compressors (chn = 0..3), memory channels 12..15
voidx393_sens_mcntrl_tiled_mode(x393_mcntrl_mode_scan_td,intchn){writel(d.d32,mmio_ptr+(0x1b00+0x40*chn));}// Set mode register (write last after other channel registers are set)
voidset_x393_sens_mcntrl_tiled_status_cntrl(x393_status_ctrl_td,intchn){writel(d.d32,mmio_ptr+(0x1b04+0x40*chn));}// Set status control register (status update mode)
voidx393_sens_mcntrl_tiled_startaddr(x393_mcntrl_window_frame_sa_td,intchn){writel(d.d32,mmio_ptr+(0x1b08+0x40*chn));}// Set frame start address
voidx393_sens_mcntrl_tiled_frame_size(x393_mcntrl_window_frame_sa_inc_td,intchn){writel(d.d32,mmio_ptr+(0x1b0c+0x40*chn));}// Set frame size (address increment)
voidx393_sens_mcntrl_tiled_frame_last(x393_mcntrl_window_last_frame_num_td,intchn){writel(d.d32,mmio_ptr+(0x1b10+0x40*chn));}// Set last frame number (number of frames in buffer minus 1)
voidx393_sens_mcntrl_tiled_frame_full_width(x393_mcntrl_window_full_width_td,intchn){writel(d.d32,mmio_ptr+(0x1b14+0x40*chn));}// Set frame full(padded) width
voidx393_sens_mcntrl_tiled_window_wh(x393_mcntrl_window_width_height_td,intchn){writel(d.d32,mmio_ptr+(0x1b18+0x40*chn));}// Set frame window size
voidx393_sens_mcntrl_tiled_window_x0y0(x393_mcntrl_window_left_top_td,intchn){writel(d.d32,mmio_ptr+(0x1b1c+0x40*chn));}// Set frame position
voidx393_sens_mcntrl_tiled_startxy(x393_mcntrl_window_startx_starty_td,intchn){writel(d.d32,mmio_ptr+(0x1b20+0x40*chn));}// Set startXY register
voidx393_sens_mcntrl_tiled_tile_whs(x393_mcntrl_window_tile_whs_td,intchn){writel(d.d32,mmio_ptr+(0x1b24+0x40*chn));}// Set tile size/step (tiled mode only)
// Write-only addresses to program memory channel for membridge, memory channel 1
voidx393_membridge_scanline_mode(x393_mcntrl_mode_scan_td){writel(d.d32,mmio_ptr+0x0480);}// Set mode register (write last after other channel registers are set)
voidset_x393_membridge_scanline_status_cntrl(x393_status_ctrl_td){writel(d.d32,mmio_ptr+0x0484);}// Set status control register (status update mode)
voidx393_membridge_scanline_startaddr(x393_mcntrl_window_frame_sa_td){writel(d.d32,mmio_ptr+0x0488);}// Set frame start address
voidx393_membridge_scanline_frame_size(x393_mcntrl_window_frame_sa_inc_td){writel(d.d32,mmio_ptr+0x048c);}// Set frame size (address increment)
voidx393_membridge_scanline_frame_last(x393_mcntrl_window_last_frame_num_td){writel(d.d32,mmio_ptr+0x0490);}// Set last frame number (number of frames in buffer minus 1)
voidx393_membridge_scanline_frame_full_width(x393_mcntrl_window_full_width_td){writel(d.d32,mmio_ptr+0x0494);}// Set frame full(padded) width
voidx393_membridge_scanline_window_wh(x393_mcntrl_window_width_height_td){writel(d.d32,mmio_ptr+0x0498);}// Set frame window size
voidx393_membridge_scanline_window_x0y0(x393_mcntrl_window_left_top_td){writel(d.d32,mmio_ptr+0x049c);}// Set frame position
voidx393_membridge_scanline_startxy(x393_mcntrl_window_startx_starty_td){writel(d.d32,mmio_ptr+0x04a0);}// Set startXY register
// Write-only addresses for test channels commands
voidx393_mcntrl_test01_chn2_mode(x393_test01_mode_td){writel(d.d32,mmio_ptr+0x03d0);}// Set command for test01 channel 2
voidx393_mcntrl_test01_chn3_mode(x393_test01_mode_td){writel(d.d32,mmio_ptr+0x03d8);}// Set command for test01 channel 3
voidx393_mcntrl_test01_chn4_mode(x393_test01_mode_td){writel(d.d32,mmio_ptr+0x03e0);}// Set command for test01 channel 4
// Read-only addresses for status information
x393_status_mcntrl_phy_tx393_mcontr_phy_status(void){x393_status_mcntrl_phy_td;d.d32=readl(mmio_ptr+0x2000);returnd;}// Status register for MCNTRL PHY
x393_status_mcntrl_top_tx393_mcontr_top_status(void){x393_status_mcntrl_top_td;d.d32=readl(mmio_ptr+0x2004);returnd;}// Status register for MCNTRL requests
x393_status_mcntrl_ps_tx393_mcntrl_ps_status(void){x393_status_mcntrl_ps_td;d.d32=readl(mmio_ptr+0x2008);returnd;}// Status register for MCNTRL software R/W
x393_status_mcntrl_lintile_tx393_mcntrl_chn1_status(void){x393_status_mcntrl_lintile_td;d.d32=readl(mmio_ptr+0x2010);returnd;}// Status register for MCNTRL CHN1 (membridge)
x393_status_mcntrl_lintile_tx393_mcntrl_chn3_status(void){x393_status_mcntrl_lintile_td;d.d32=readl(mmio_ptr+0x2018);returnd;}// Status register for MCNTRL CHN3 (scanline)
x393_status_mcntrl_lintile_tx393_mcntrl_chn2_status(void){x393_status_mcntrl_lintile_td;d.d32=readl(mmio_ptr+0x2014);returnd;}// Status register for MCNTRL CHN2 (tiled)
x393_status_mcntrl_lintile_tx393_mcntrl_chn4_status(void){x393_status_mcntrl_lintile_td;d.d32=readl(mmio_ptr+0x201c);returnd;}// Status register for MCNTRL CHN4 (tiled)
x393_status_mcntrl_testchn_tx393_test01_chn2_status(void){x393_status_mcntrl_testchn_td;d.d32=readl(mmio_ptr+0x20f4);returnd;}// Status register for test channel 2
x393_status_mcntrl_testchn_tx393_test01_chn3_status(void){x393_status_mcntrl_testchn_td;d.d32=readl(mmio_ptr+0x20f8);returnd;}// Status register for test channel 3
x393_status_mcntrl_testchn_tx393_test01_chn4_status(void){x393_status_mcntrl_testchn_td;d.d32=readl(mmio_ptr+0x20fc);returnd;}// Status register for test channel 4
x393_status_membridge_tx393_membridge_status(void){x393_status_membridge_td;d.d32=readl(mmio_ptr+0x20ec);returnd;}// Status register for membridge
voidx393_sensio_ctrl(x393_sensio_ctl_td,intsens_num){writel(d.d32,mmio_ptr+(0x1020+0x100*sens_num));}// Configure sensor I/O port
voidset_x393_sensio_status_cntrl(x393_status_ctrl_td,intsens_num){writel(d.d32,mmio_ptr+(0x1024+0x100*sens_num));}// Set status control for SENSIO module
voidx393_sensio_jtag(x393_sensio_jtag_td,intsens_num){writel(d.d32,mmio_ptr+(0x1028+0x100*sens_num));}// Programming interface for multiplexer FPGA (with X393_SENSIO_STATUS)
voidset_x393_sensio_width(x393_sensio_width_td,intsens_num){writel(d.d32,mmio_ptr+(0x102c+0x100*sens_num));}// Set sensor line in pixels (0 - use line sync from the sensor)
// Read-only addresses for sensors status information
x393_status_sens_i2c_tx393_sensi2c_status(intsens_num){x393_status_sens_i2c_td;d.d32=readl(mmio_ptr+(0x2080+0x8*sens_num));returnd;}// Status of the sensors i2c
x393_status_sens_io_tx393_sensio_status(intsens_num){x393_status_sens_io_td;d.d32=readl(mmio_ptr+(0x2084+0x8*sens_num));returnd;}// Status of the sensor ports I/O pins
// Compressor bitfields values
// Compressor control
voidx393_cmprs_control_reg(x393_cmprs_mode_td,intcmprs_chn){writel(d.d32,mmio_ptr+(0x1800+0x40*cmprs_chn));}// Program compressor channel operation mode
voidset_x393_cmprs_status(x393_status_ctrl_td,intcmprs_chn){writel(d.d32,mmio_ptr+(0x1804+0x40*cmprs_chn));}// Setup compressor status report mode
voidset_x393_cmprs_color_saturation(x393_cmprs_colorsat_td,intcmprs_chn){writel(d.d32,mmio_ptr+(0x180c+0x40*cmprs_chn));}// Compressor color saturation
x393_cmprs_status_tx393_cmprs_status(intchn){x393_cmprs_status_td;d.d32=readl(mmio_ptr+(0x2040+0x4*chn));returnd;}// Status of the compressor channel (incl. interrupt
// Read-only sensors status information (pointer offset and last sequence number)
x393_afimux_status_tx393_afimux0_status(intafi_port){x393_afimux_status_td;d.d32=readl(mmio_ptr+(0x2060+0x4*afi_port));returnd;}// Status of the AFI MUX 0 (including image pointer)
x393_afimux_status_tx393_afimux1_status(intafi_port){x393_afimux_status_td;d.d32=readl(mmio_ptr+(0x2070+0x4*afi_port));returnd;}// Status of the AFI MUX 1 (including image pointer)
//
// GPIO contol. Each of the 10 pins can be controlled by the software - individually or simultaneously or from any of the 3 masters (other FPGA modules)
// Currently these modules are;
// A - camsync (intercamera synchronization), uses up to 4 pins
// B - reserved (not yet used) and
// C - logger (IMU, GPS, images), uses 6 pins, including separate i2c available on extension boards
// If several enabled ports try to contol the same bit, highest priority has port C, lowest - software controlled
voidx393_gpio_set_pins(x393_gpio_set_pins_td){writel(d.d32,mmio_ptr+0x1c00);}// State of the GPIO pins and seq. number
voidset_x393_gpio_status_control(x393_status_ctrl_td){writel(d.d32,mmio_ptr+0x1c04);}// GPIO status control mode
// Command sequencer multiplexer, provides current frame number for each sensor channel and interrupt status/interrupt masks for them.
// Interrupts and interrupt masks are controlled through channel CMDFRAMESEQ module
voidset_x393_cmdseqmux_status_ctrl(x393_status_ctrl_td){writel(d.d32,mmio_ptr+0x1c08);}// CMDSEQMUX status control mode (status provides current frame numbers)
x393_cmdseqmux_status_tx393_cmdseqmux_status(void){x393_cmdseqmux_status_td;d.d32=readl(mmio_ptr+0x20e0);returnd;}// CMDSEQMUX status data (frame numbers and interrupts
// Event logger
// Event logger configuration/data is writtent to the module ising two 32-bit register locations : data and address.
// Address consists of 2 parts - 2-bit page (configuration, imu, gps, message) and a 5-bit sub-address autoincremented when writing data.
x393_logger_status_tx393_logger_status(void){x393_logger_status_td;d.d32=readl(mmio_ptr+0x20e4);returnd;}// Logger status data (sequence number)
// MULT SAXI DMA engine control. Of 4 channels only one (number 0) is currently used - for the event logger
voidset_x393_mult_saxi_status_ctrl(x393_status_ctrl_td){writel(d.d32,mmio_ptr+0x1ce0);}// MULT_SAXI status control mode (status provides current DWORD pointer)
voidx393_mult_saxi_buf_address(x393_mult_saxi_al_td,intchn){writel(d.d32,mmio_ptr+(0x1cc0+0x8*chn));}// MULT_SAXI buffer start address in DWORDS
voidx393_mult_saxi_buf_len(x393_mult_saxi_al_td,intchn){writel(d.d32,mmio_ptr+(0x1cc4+0x8*chn));}// MULT_SAXI buffer length in DWORDS
x393_mult_saxi_al_tx393_mult_saxi_status(intchn){x393_mult_saxi_al_td;d.d32=readl(mmio_ptr+(0x20d0+0x4*chn));returnd;}// MULT_SAXI current DWORD pointer
// MULTI_CLK - global clock generation PLLs. Interface provided for debugging, no interaction is needed for normal operation
voidset_x393_multiclk_status_ctrl(x393_status_ctrl_td){writel(d.d32,mmio_ptr+0x1ca4);}// MULTI_CLK status generation (do not use or do not set auto)
voidx393_debug_load(void){writel(0,mmio_ptr+0x1c44);}// Debug ring copy shift register to/from tested modules
voidx393_debug_shift(u32d){writel(d,mmio_ptr+0x1c40);}// Debug ring shift ring by 32 bits
x393_debug_status_tx393_debug_status(void){x393_debug_status_td;d.d32=readl(mmio_ptr+0x23f0);returnd;}// Debug read status (watch sequence number)
u32x393_debug_read(void){u32d;d=readl(mmio_ptr+0x23f4);returnd;}// Debug read DWORD form ring register
// Write-only addresses to program memory channel 3 (test channel)
voidx393_mcntrl_chn3_scanline_mode(x393_mcntrl_mode_scan_td){writel(d.d32,mmio_ptr+0x04c0);}// Set mode register (write last after other channel registers are set)
voidset_x393_mcntrl_chn3_scanline_status_cntrl(x393_status_ctrl_td){writel(d.d32,mmio_ptr+0x04c4);}// Set status control register (status update mode)
voidx393_mcntrl_chn3_scanline_startaddr(x393_mcntrl_window_frame_sa_td){writel(d.d32,mmio_ptr+0x04c8);}// Set frame start address
voidx393_mcntrl_chn3_scanline_frame_size(x393_mcntrl_window_frame_sa_inc_td){writel(d.d32,mmio_ptr+0x04cc);}// Set frame size (address increment)
voidx393_mcntrl_chn3_scanline_frame_last(x393_mcntrl_window_last_frame_num_td){writel(d.d32,mmio_ptr+0x04d0);}// Set last frame number (number of frames in buffer minus 1)
voidx393_mcntrl_chn3_scanline_frame_full_width(x393_mcntrl_window_full_width_td){writel(d.d32,mmio_ptr+0x04d4);}// Set frame full(padded) width
voidx393_mcntrl_chn3_scanline_window_wh(x393_mcntrl_window_width_height_td){writel(d.d32,mmio_ptr+0x04d8);}// Set frame window size
voidx393_mcntrl_chn3_scanline_window_x0y0(x393_mcntrl_window_left_top_td){writel(d.d32,mmio_ptr+0x04dc);}// Set frame position
voidx393_mcntrl_chn3_scanline_startxy(x393_mcntrl_window_startx_starty_td){writel(d.d32,mmio_ptr+0x04e0);}// Set startXY register
// Write-only addresses to program memory channel 2 (test channel)
voidx393_mcntrl_chn2_tiled_mode(x393_mcntrl_mode_scan_td){writel(d.d32,mmio_ptr+0x0500);}// Set mode register (write last after other channel registers are set)
voidset_x393_mcntrl_chn2_tiled_status_cntrl(x393_status_ctrl_td){writel(d.d32,mmio_ptr+0x0504);}// Set status control register (status update mode)
voidx393_mcntrl_chn2_tiled_startaddr(x393_mcntrl_window_frame_sa_td){writel(d.d32,mmio_ptr+0x0508);}// Set frame start address
voidx393_mcntrl_chn2_tiled_frame_size(x393_mcntrl_window_frame_sa_inc_td){writel(d.d32,mmio_ptr+0x050c);}// Set frame size (address increment)
voidx393_mcntrl_chn2_tiled_frame_last(x393_mcntrl_window_last_frame_num_td){writel(d.d32,mmio_ptr+0x0510);}// Set last frame number (number of frames in buffer minus 1)
voidx393_mcntrl_chn2_tiled_frame_full_width(x393_mcntrl_window_full_width_td){writel(d.d32,mmio_ptr+0x0514);}// Set frame full(padded) width
voidx393_mcntrl_chn2_tiled_window_wh(x393_mcntrl_window_width_height_td){writel(d.d32,mmio_ptr+0x0518);}// Set frame window size
voidx393_mcntrl_chn2_tiled_window_x0y0(x393_mcntrl_window_left_top_td){writel(d.d32,mmio_ptr+0x051c);}// Set frame position
voidx393_mcntrl_chn2_tiled_startxy(x393_mcntrl_window_startx_starty_td){writel(d.d32,mmio_ptr+0x0520);}// Set startXY register
voidx393_mcntrl_chn2_tiled_tile_whs(x393_mcntrl_window_tile_whs_td){writel(d.d32,mmio_ptr+0x0524);}// Set tile size/step (tiled mode only)
// Write-only addresses to program memory channel 4 (test channel)
voidx393_mcntrl_chn4_tiled_mode(x393_mcntrl_mode_scan_td){writel(d.d32,mmio_ptr+0x0540);}// Set mode register (write last after other channel registers are set)
voidset_x393_mcntrl_chn4_tiled_status_cntrl(x393_status_ctrl_td){writel(d.d32,mmio_ptr+0x0544);}// Set status control register (status update mode)
voidx393_mcntrl_chn4_tiled_startaddr(x393_mcntrl_window_frame_sa_td){writel(d.d32,mmio_ptr+0x0548);}// Set frame start address
voidx393_mcntrl_chn4_tiled_frame_size(x393_mcntrl_window_frame_sa_inc_td){writel(d.d32,mmio_ptr+0x054c);}// Set frame size (address increment)
voidx393_mcntrl_chn4_tiled_frame_last(x393_mcntrl_window_last_frame_num_td){writel(d.d32,mmio_ptr+0x0550);}// Set last frame number (number of frames in buffer minus 1)
voidx393_mcntrl_chn4_tiled_frame_full_width(x393_mcntrl_window_full_width_td){writel(d.d32,mmio_ptr+0x0554);}// Set frame full(padded) width
voidx393_mcntrl_chn4_tiled_window_wh(x393_mcntrl_window_width_height_td){writel(d.d32,mmio_ptr+0x0558);}// Set frame window size
voidx393_mcntrl_chn4_tiled_window_x0y0(x393_mcntrl_window_left_top_td){writel(d.d32,mmio_ptr+0x055c);}// Set frame position
voidx393_mcntrl_chn4_tiled_startxy(x393_mcntrl_window_startx_starty_td){writel(d.d32,mmio_ptr+0x0560);}// Set startXY register
voidx393_mcntrl_chn4_tiled_tile_whs(x393_mcntrl_window_tile_whs_td){writel(d.d32,mmio_ptr+0x0564);}// Set tile size/step (tiled mode only)
// Read-only sensors status information (pointer offset and last sequence number)
x393_afimux_status_tx393_afimux0_status(intafi_port);// Status of the AFI MUX 0 (including image pointer)
x393_afimux_status_tx393_afimux1_status(intafi_port);// Status of the AFI MUX 1 (including image pointer)
//
// GPIO contol. Each of the 10 pins can be controlled by the software - individually or simultaneously or from any of the 3 masters (other FPGA modules)
// Currently these modules are;
// A - camsync (intercamera synchronization), uses up to 4 pins
// B - reserved (not yet used) and
// C - logger (IMU, GPS, images), uses 6 pins, including separate i2c available on extension boards
// If several enabled ports try to contol the same bit, highest priority has port C, lowest - software controlled
voidx393_gpio_set_pins(x393_gpio_set_pins_td);// State of the GPIO pins and seq. number
voidset_x393_gpio_status_control(x393_status_ctrl_td);// GPIO status control mode
// R/W addresses to set up memory arbiter priorities. For sensors (chn = 8..11), for compressors - 12..15
#define X393_MCNTRL_ARBITER_PRIORITY(chn) (0x40000180 + 0x4 * (chn)) // Set memory arbiter priority (currently r/w, may become just wo), chn = 0..15, data type: x393_arbite_pri_t (rw)
// Enable/disable memory channels (bits in a 16-bit word). For sensors (chn = 8..11), for compressors - 12..15
#define X393_MCNTRL_CHN_EN 0x400001c0 // Enable/disable memory channels (currently r/w, may become just wo), data type: x393_mcntr_chn_en_t (rw)
#define X393_MCNTRL_DQS_DQM_PATT 0x40000140 // Setup DQS and DQM patterns, data type: x393_mcntr_dqs_dqm_patt_t (rw)
#define X393_MCNTRL_DQ_DQS_TRI 0x40000144 // Setup DQS and DQ on/off sequence, data type: x393_mcntr_dqs_dqm_tri_t (rw)
// Following enable/disable addresses can be written with any data, only addresses matter
#define X393_MCNTRL_CMDA_ODLY(chn) (0x40000300 + 0x4 * (chn)) // Address, bank and commands delays, chn = 0..31, data type: x393_dly_t (rw)
#define X393_MCNTRL_PHASE 0x40000380 // Clock phase, data type: x393_dly_t (rw)
#define X393_MCNTRL_DLY_SET 0x40000080 // Set all pre-programmed delays
#define X393_MCNTRL_WBUF_DLY 0x40000148 // Set write buffer delay, data type: x393_wbuf_dly_t (rw)
// Write-only addresses to program memory channels for sensors (chn = 0..3), memory channels 8..11
#define X393_SENS_MCNTRL_SCANLINE_MODE(chn) (0x40001a00 + 0x40 * (chn)) // Set mode register (write last after other channel registers are set), chn = 0..3, data type: x393_mcntrl_mode_scan_t (wo)
#define X393_SENS_MCNTRL_SCANLINE_STATUS_CNTRL(chn) (0x40001a04 + 0x40 * (chn)) // Set status control register (status update mode), chn = 0..3, data type: x393_status_ctrl_t (rw)
#define X393_SENS_MCNTRL_SCANLINE_STARTADDR(chn) (0x40001a08 + 0x40 * (chn)) // Set frame start address, chn = 0..3, data type: x393_mcntrl_window_frame_sa_t (wo)
#define X393_SENS_MCNTRL_SCANLINE_FRAME_SIZE(chn) (0x40001a0c + 0x40 * (chn)) // Set frame size (address increment), chn = 0..3, data type: x393_mcntrl_window_frame_sa_inc_t (wo)
#define X393_SENS_MCNTRL_SCANLINE_FRAME_LAST(chn) (0x40001a10 + 0x40 * (chn)) // Set last frame number (number of frames in buffer minus 1), chn = 0..3, data type: x393_mcntrl_window_last_frame_num_t (wo)
#define X393_SENS_MCNTRL_SCANLINE_FRAME_FULL_WIDTH(chn) (0x40001a14 + 0x40 * (chn)) // Set frame full(padded) width, chn = 0..3, data type: x393_mcntrl_window_full_width_t (wo)
#define X393_SENS_MCNTRL_SCANLINE_WINDOW_WH(chn) (0x40001a18 + 0x40 * (chn)) // Set frame window size, chn = 0..3, data type: x393_mcntrl_window_width_height_t (wo)
#define X393_SENS_MCNTRL_SCANLINE_WINDOW_X0Y0(chn) (0x40001a1c + 0x40 * (chn)) // Set frame position, chn = 0..3, data type: x393_mcntrl_window_left_top_t (wo)
#define X393_SENS_MCNTRL_SCANLINE_STARTXY(chn) (0x40001a20 + 0x40 * (chn)) // Set startXY register, chn = 0..3, data type: x393_mcntrl_window_startx_starty_t (wo)
// Write-only addresses to program memory channels for compressors (chn = 0..3), memory channels 12..15
#define X393_SENS_MCNTRL_TILED_MODE(chn) (0x40001b00 + 0x40 * (chn)) // Set mode register (write last after other channel registers are set), chn = 0..3, data type: x393_mcntrl_mode_scan_t (wo)
#define X393_SENS_MCNTRL_TILED_STATUS_CNTRL(chn) (0x40001b04 + 0x40 * (chn)) // Set status control register (status update mode), chn = 0..3, data type: x393_status_ctrl_t (rw)
#define X393_SENS_MCNTRL_TILED_STARTADDR(chn) (0x40001b08 + 0x40 * (chn)) // Set frame start address, chn = 0..3, data type: x393_mcntrl_window_frame_sa_t (wo)
#define X393_SENS_MCNTRL_TILED_FRAME_SIZE(chn) (0x40001b0c + 0x40 * (chn)) // Set frame size (address increment), chn = 0..3, data type: x393_mcntrl_window_frame_sa_inc_t (wo)
#define X393_SENS_MCNTRL_TILED_FRAME_LAST(chn) (0x40001b10 + 0x40 * (chn)) // Set last frame number (number of frames in buffer minus 1), chn = 0..3, data type: x393_mcntrl_window_last_frame_num_t (wo)
#define X393_SENS_MCNTRL_TILED_FRAME_FULL_WIDTH(chn) (0x40001b14 + 0x40 * (chn)) // Set frame full(padded) width, chn = 0..3, data type: x393_mcntrl_window_full_width_t (wo)
#define X393_SENS_MCNTRL_TILED_WINDOW_WH(chn) (0x40001b18 + 0x40 * (chn)) // Set frame window size, chn = 0..3, data type: x393_mcntrl_window_width_height_t (wo)
#define X393_SENS_MCNTRL_TILED_WINDOW_X0Y0(chn) (0x40001b1c + 0x40 * (chn)) // Set frame position, chn = 0..3, data type: x393_mcntrl_window_left_top_t (wo)
#define X393_SENS_MCNTRL_TILED_STARTXY(chn) (0x40001b20 + 0x40 * (chn)) // Set startXY register, chn = 0..3, data type: x393_mcntrl_window_startx_starty_t (wo)
// Write-only addresses to program memory channel for membridge, memory channel 1
#define X393_MEMBRIDGE_SCANLINE_MODE 0x40000480 // Set mode register (write last after other channel registers are set), data type: x393_mcntrl_mode_scan_t (wo)
#define X393_MEMBRIDGE_SCANLINE_STATUS_CNTRL 0x40000484 // Set status control register (status update mode), data type: x393_status_ctrl_t (rw)
#define X393_MEMBRIDGE_SCANLINE_STARTADDR 0x40000488 // Set frame start address, data type: x393_mcntrl_window_frame_sa_t (wo)
#define X393_MEMBRIDGE_SCANLINE_FRAME_SIZE 0x4000048c // Set frame size (address increment), data type: x393_mcntrl_window_frame_sa_inc_t (wo)
#define X393_MEMBRIDGE_SCANLINE_FRAME_LAST 0x40000490 // Set last frame number (number of frames in buffer minus 1), data type: x393_mcntrl_window_last_frame_num_t (wo)
#define X393_MEMBRIDGE_SCANLINE_FRAME_FULL_WIDTH 0x40000494 // Set frame full(padded) width, data type: x393_mcntrl_window_full_width_t (wo)
#define X393_MEMBRIDGE_SCANLINE_WINDOW_WH 0x40000498 // Set frame window size, data type: x393_mcntrl_window_width_height_t (wo)
#define X393_MEMBRIDGE_SCANLINE_WINDOW_X0Y0 0x4000049c // Set frame position, data type: x393_mcntrl_window_left_top_t (wo)
#define X393_MEMBRIDGE_SCANLINE_STARTXY 0x400004a0 // Set startXY register, data type: x393_mcntrl_window_startx_starty_t (wo)
#define X393_SENSIO_STATUS_CNTRL(sens_num) (0x40001024 + 0x100 * (sens_num)) // Set status control for SENSIO module, sens_num = 0..3, data type: x393_status_ctrl_t (rw)
#define X393_SENSIO_WIDTH(sens_num) (0x4000102c + 0x100 * (sens_num)) // Set sensor line in pixels (0 - use line sync from the sensor), sens_num = 0..3, data type: x393_sensio_width_t (rw)
// Read-only addresses for sensors status information
#define X393_SENSI2C_STATUS(sens_num) (0x40002080 + 0x8 * (sens_num)) // Status of the sensors i2c, sens_num = 0..3, data type: x393_status_sens_i2c_t (ro)
#define X393_SENSIO_STATUS(sens_num) (0x40002084 + 0x8 * (sens_num)) // Status of the sensor ports I/O pins, sens_num = 0..3, data type: x393_status_sens_io_t (ro)
// Read-only sensors status information (pointer offset and last sequence number)
#define X393_AFIMUX0_STATUS(afi_port) (0x40002060 + 0x4 * (afi_port)) // Status of the AFI MUX 0 (including image pointer), afi_port = 0..3, data type: x393_afimux_status_t (ro)
#define X393_AFIMUX1_STATUS(afi_port) (0x40002070 + 0x4 * (afi_port)) // Status of the AFI MUX 1 (including image pointer), afi_port = 0..3, data type: x393_afimux_status_t (ro)
//
// GPIO contol. Each of the 10 pins can be controlled by the software - individually or simultaneously or from any of the 3 masters (other FPGA modules)
// Currently these modules are;
// A - camsync (intercamera synchronization), uses up to 4 pins
// B - reserved (not yet used) and
// C - logger (IMU, GPS, images), uses 6 pins, including separate i2c available on extension boards
// If several enabled ports try to contol the same bit, highest priority has port C, lowest - software controlled
#define X393_GPIO_SET_PINS 0x40001c00 // State of the GPIO pins and seq. number, data type: x393_gpio_set_pins_t (wo)
#define X393_GPIO_STATUS_CONTROL 0x40001c04 // GPIO status control mode, data type: x393_status_ctrl_t (rw)
// Read-only GPIO pins state
#define X393_GPIO_STATUS 0x400020c0 // State of the GPIO pins and seq. number, data type: x393_gpio_status_t (ro)
// RTC control
#define X393_RTC_USEC 0x40001c10 // RTC microseconds, data type: x393_rtc_usec_t (rw)
#define X393_RTC_SEC_SET 0x40001c14 // RTC seconds and set clock, data type: x393_rtc_sec_t (rw)
#define X393_RTC_CORR 0x40001c18 // RTC correction (+/- 1/256 full scale), data type: x393_rtc_corr_t (rw)
#define X393_RTC_SET_STATUS 0x40001c1c // RTC status control mode, write makes a snapshot to be read out, data type: x393_status_ctrl_t (rw)
// Read-only RTC state
#define X393_RTC_STATUS 0x400020c4 // RTC status reg, data type: x393_rtc_status_t (ro)
// Command sequencer multiplexer, provides current frame number for each sensor channel and interrupt status/interrupt masks for them.
// Interrupts and interrupt masks are controlled through channel CMDFRAMESEQ module
#define X393_CMDSEQMUX_STATUS_CTRL 0x40001c08 // CMDSEQMUX status control mode (status provides current frame numbers), data type: x393_status_ctrl_t (rw)
#define X393_CMDSEQMUX_STATUS 0x400020e0 // CMDSEQMUX status data (frame numbers and interrupts, data type: x393_cmdseqmux_status_t (ro)
// Event logger
// Event logger configuration/data is writtent to the module ising two 32-bit register locations : data and address.
// Address consists of 2 parts - 2-bit page (configuration, imu, gps, message) and a 5-bit sub-address autoincremented when writing data.
#define X393_LOGGER_STATUS 0x400020e4 // Logger status data (sequence number), data type: x393_logger_status_t (ro)
// MULT SAXI DMA engine control. Of 4 channels only one (number 0) is currently used - for the event logger
#define X393_MULT_SAXI_STATUS_CTRL 0x40001ce0 // MULT_SAXI status control mode (status provides current DWORD pointer), data type: x393_status_ctrl_t (rw)
#define X393_DEBUG_SHIFT 0x40001c40 // Debug ring shift ring by 32 bits, data type: u32 (wo)
#define X393_DEBUG_STATUS 0x400023f0 // Debug read status (watch sequence number), data type: x393_debug_status_t (ro)
#define X393_DEBUG_READ 0x400023f4 // Debug read DWORD form ring register, data type: u32 (ro)
// Write-only addresses to program memory channel 3 (test channel)
#define X393_MCNTRL_CHN3_SCANLINE_MODE 0x400004c0 // Set mode register (write last after other channel registers are set), data type: x393_mcntrl_mode_scan_t (wo)
#define X393_MCNTRL_CHN3_SCANLINE_STATUS_CNTRL 0x400004c4 // Set status control register (status update mode), data type: x393_status_ctrl_t (rw)
#define X393_MCNTRL_CHN3_SCANLINE_STARTADDR 0x400004c8 // Set frame start address, data type: x393_mcntrl_window_frame_sa_t (wo)
#define X393_MCNTRL_CHN3_SCANLINE_FRAME_SIZE 0x400004cc // Set frame size (address increment), data type: x393_mcntrl_window_frame_sa_inc_t (wo)
#define X393_MCNTRL_CHN3_SCANLINE_FRAME_LAST 0x400004d0 // Set last frame number (number of frames in buffer minus 1), data type: x393_mcntrl_window_last_frame_num_t (wo)
#define X393_MCNTRL_CHN3_SCANLINE_FRAME_FULL_WIDTH 0x400004d4 // Set frame full(padded) width, data type: x393_mcntrl_window_full_width_t (wo)
#define X393_MCNTRL_CHN3_SCANLINE_WINDOW_WH 0x400004d8 // Set frame window size, data type: x393_mcntrl_window_width_height_t (wo)
#define X393_MCNTRL_CHN3_SCANLINE_WINDOW_X0Y0 0x400004dc // Set frame position, data type: x393_mcntrl_window_left_top_t (wo)
#define X393_MCNTRL_CHN3_SCANLINE_STARTXY 0x400004e0 // Set startXY register, data type: x393_mcntrl_window_startx_starty_t (wo)
// Write-only addresses to program memory channel 2 (test channel)
#define X393_MCNTRL_CHN2_TILED_MODE 0x40000500 // Set mode register (write last after other channel registers are set), data type: x393_mcntrl_mode_scan_t (wo)
#define X393_MCNTRL_CHN2_TILED_STATUS_CNTRL 0x40000504 // Set status control register (status update mode), data type: x393_status_ctrl_t (rw)
#define X393_MCNTRL_CHN2_TILED_STARTADDR 0x40000508 // Set frame start address, data type: x393_mcntrl_window_frame_sa_t (wo)
#define X393_MCNTRL_CHN2_TILED_FRAME_SIZE 0x4000050c // Set frame size (address increment), data type: x393_mcntrl_window_frame_sa_inc_t (wo)
#define X393_MCNTRL_CHN2_TILED_FRAME_LAST 0x40000510 // Set last frame number (number of frames in buffer minus 1), data type: x393_mcntrl_window_last_frame_num_t (wo)
#define X393_MCNTRL_CHN2_TILED_FRAME_FULL_WIDTH 0x40000514 // Set frame full(padded) width, data type: x393_mcntrl_window_full_width_t (wo)
#define X393_MCNTRL_CHN2_TILED_WINDOW_WH 0x40000518 // Set frame window size, data type: x393_mcntrl_window_width_height_t (wo)
#define X393_MCNTRL_CHN2_TILED_WINDOW_X0Y0 0x4000051c // Set frame position, data type: x393_mcntrl_window_left_top_t (wo)
#define X393_MCNTRL_CHN2_TILED_STARTXY 0x40000520 // Set startXY register, data type: x393_mcntrl_window_startx_starty_t (wo)
#define X393_MCNTRL_CHN2_TILED_TILE_WHS 0x40000524 // Set tile size/step (tiled mode only), data type: x393_mcntrl_window_tile_whs_t (wo)
// Write-only addresses to program memory channel 4 (test channel)
#define X393_MCNTRL_CHN4_TILED_MODE 0x40000540 // Set mode register (write last after other channel registers are set), data type: x393_mcntrl_mode_scan_t (wo)
#define X393_MCNTRL_CHN4_TILED_STATUS_CNTRL 0x40000544 // Set status control register (status update mode), data type: x393_status_ctrl_t (rw)
#define X393_MCNTRL_CHN4_TILED_STARTADDR 0x40000548 // Set frame start address, data type: x393_mcntrl_window_frame_sa_t (wo)
#define X393_MCNTRL_CHN4_TILED_FRAME_SIZE 0x4000054c // Set frame size (address increment), data type: x393_mcntrl_window_frame_sa_inc_t (wo)
#define X393_MCNTRL_CHN4_TILED_FRAME_LAST 0x40000550 // Set last frame number (number of frames in buffer minus 1), data type: x393_mcntrl_window_last_frame_num_t (wo)
#define X393_MCNTRL_CHN4_TILED_FRAME_FULL_WIDTH 0x40000554 // Set frame full(padded) width, data type: x393_mcntrl_window_full_width_t (wo)
#define X393_MCNTRL_CHN4_TILED_WINDOW_WH 0x40000558 // Set frame window size, data type: x393_mcntrl_window_width_height_t (wo)
#define X393_MCNTRL_CHN4_TILED_WINDOW_X0Y0 0x4000055c // Set frame position, data type: x393_mcntrl_window_left_top_t (wo)
#define X393_MCNTRL_CHN4_TILED_STARTXY 0x40000560 // Set startXY register, data type: x393_mcntrl_window_startx_starty_t (wo)
#define X393_MCNTRL_CHN4_TILED_TILE_WHS 0x40000564 // Set tile size/step (tiled mode only), data type: x393_mcntrl_window_tile_whs_t (wo)