Commit b1b3e028 authored by Andrey Filippov's avatar Andrey Filippov

working on 10359 control

parent 9a7f17fa
/******************************************************************************* /*******************************************************************************
* File: x393.c * File: x393.c
* Date: 2016-03-29 * Date: 2016-04-04
* Author: auto-generated file, see x393_export_c.py * Author: auto-generated file, see x393_export_c.py
* Description: Functions definitions to access x393 hardware registers * Description: Functions definitions to access x393 hardware registers
*******************************************************************************/ *******************************************************************************/
...@@ -174,7 +174,7 @@ void x393_sens_sync_late (x393_sens_sync ...@@ -174,7 +174,7 @@ void x393_sens_sync_late (x393_sens_sync
void x393_sensio_ctrl (x393_sensio_ctl_t d, int sens_num){writel(d.d32, mmio_ptr + (0x1020 + 0x100 * sens_num));} // Configure sensor I/O port void x393_sensio_ctrl (x393_sensio_ctl_t d, int sens_num){writel(d.d32, mmio_ptr + (0x1020 + 0x100 * sens_num));} // Configure sensor I/O port
void set_x393_sensio_status_cntrl (x393_status_ctrl_t d, int sens_num){writel(d.d32, mmio_ptr + (0x1024 + 0x100 * sens_num));} // Set status control for SENSIO module void set_x393_sensio_status_cntrl (x393_status_ctrl_t d, int sens_num){writel(d.d32, mmio_ptr + (0x1024 + 0x100 * sens_num));} // Set status control for SENSIO module
x393_status_ctrl_t get_x393_sensio_status_cntrl (int sens_num) { x393_status_ctrl_t d; d.d32 = readl(mmio_ptr + (0x1024 + 0x100 * sens_num)); return d; } x393_status_ctrl_t get_x393_sensio_status_cntrl (int sens_num) { x393_status_ctrl_t d; d.d32 = readl(mmio_ptr + (0x1024 + 0x100 * sens_num)); return d; }
void x393_sensio_jtag (x393_sensio_jpag_t d, int sens_num){writel(d.d32, mmio_ptr + (0x1028 + 0x100 * sens_num));} // Programming interface for multiplexer FPGA (with X393_SENSIO_STATUS) void x393_sensio_jtag (x393_sensio_jtag_t d, int sens_num){writel(d.d32, mmio_ptr + (0x1028 + 0x100 * sens_num));} // Programming interface for multiplexer FPGA (with X393_SENSIO_STATUS)
void set_x393_sensio_width (x393_sensio_width_t d, int sens_num){writel(d.d32, mmio_ptr + (0x102c + 0x100 * sens_num));} // Set sensor line in pixels (0 - use line sync from the sensor) void set_x393_sensio_width (x393_sensio_width_t d, int sens_num){writel(d.d32, mmio_ptr + (0x102c + 0x100 * sens_num));} // Set sensor line in pixels (0 - use line sync from the sensor)
x393_sensio_width_t get_x393_sensio_width (int sens_num) { x393_sensio_width_t d; d.d32 = readl(mmio_ptr + (0x102c + 0x100 * sens_num)); return d; } x393_sensio_width_t get_x393_sensio_width (int sens_num) { x393_sensio_width_t d; d.d32 = readl(mmio_ptr + (0x102c + 0x100 * sens_num)); return d; }
void set_x393_sensio_tim0 (x393_sensio_tim0_t d, int sens_num){writel(d.d32, mmio_ptr + (0x1030 + 0x100 * sens_num));} // Sensor port i/o timing configuration, register 0 void set_x393_sensio_tim0 (x393_sensio_tim0_t d, int sens_num){writel(d.d32, mmio_ptr + (0x1030 + 0x100 * sens_num));} // Sensor port i/o timing configuration, register 0
......
/******************************************************************************* /*******************************************************************************
* File: x393.h * File: x393.h
* Date: 2016-03-29 * Date: 2016-04-04
* Author: auto-generated file, see x393_export_c.py * Author: auto-generated file, see x393_export_c.py
* Description: Constants definitions and functions declarations to access x393 hardware registers * Description: Constants definitions and functions declarations to access x393 hardware registers
*******************************************************************************/ *******************************************************************************/
#include "elphel/x393_types.h" #include "x393_types.h"
//#include "elphel/x393_defs.h // alternative variant" //#include "elphel/x393_defs.h // alternative variant"
// See elphel/x393_map.h for the ordered list of all I/O register addresses used // See elphel/x393_map.h for the ordered list of all I/O register addresses used
...@@ -173,7 +173,7 @@ void x393_sens_sync_late (x393_sens_sync ...@@ -173,7 +173,7 @@ void x393_sens_sync_late (x393_sens_sync
void x393_sensio_ctrl (x393_sensio_ctl_t d, int sens_num); // Configure sensor I/O port void x393_sensio_ctrl (x393_sensio_ctl_t d, int sens_num); // Configure sensor I/O port
void set_x393_sensio_status_cntrl (x393_status_ctrl_t d, int sens_num); // Set status control for SENSIO module void set_x393_sensio_status_cntrl (x393_status_ctrl_t d, int sens_num); // Set status control for SENSIO module
x393_status_ctrl_t get_x393_sensio_status_cntrl (int sens_num); x393_status_ctrl_t get_x393_sensio_status_cntrl (int sens_num);
void x393_sensio_jtag (x393_sensio_jpag_t d, int sens_num); // Programming interface for multiplexer FPGA (with X393_SENSIO_STATUS) void x393_sensio_jtag (x393_sensio_jtag_t d, int sens_num); // Programming interface for multiplexer FPGA (with X393_SENSIO_STATUS)
void set_x393_sensio_width (x393_sensio_width_t d, int sens_num); // Set sensor line in pixels (0 - use line sync from the sensor) void set_x393_sensio_width (x393_sensio_width_t d, int sens_num); // Set sensor line in pixels (0 - use line sync from the sensor)
x393_sensio_width_t get_x393_sensio_width (int sens_num); x393_sensio_width_t get_x393_sensio_width (int sens_num);
void set_x393_sensio_tim0 (x393_sensio_tim0_t d, int sens_num); // Sensor port i/o timing configuration, register 0 void set_x393_sensio_tim0 (x393_sensio_tim0_t d, int sens_num); // Sensor port i/o timing configuration, register 0
...@@ -298,7 +298,6 @@ x393_status_sens_io_t x393_sensio_status (int sens_num); ...@@ -298,7 +298,6 @@ x393_status_sens_io_t x393_sensio_status (int sens_num);
#define X393_CMPRS_CBIT_CMODE_MONO1 0x0000000b // Mono JPEG (not yet implemented) #define X393_CMPRS_CBIT_CMODE_MONO1 0x0000000b // Mono JPEG (not yet implemented)
#define X393_CMPRS_CBIT_CMODE_MONO4 0x0000000e // Mono, 4 blocks (2x2 macroblocks) #define X393_CMPRS_CBIT_CMODE_MONO4 0x0000000e // Mono, 4 blocks (2x2 macroblocks)
#define X393_CMPRS_CBIT_CMODE_JPEG18 0x00000000 // Color 4:2:0 #define X393_CMPRS_CBIT_CMODE_JPEG18 0x00000000 // Color 4:2:0
#define X393_CMPRS_CBIT_CMODE_JPEG18 0x00000000 // Color 4:2:0
#define X393_CMPRS_CBIT_FRAMES_SINGLE 0x00000000 // Use single-frame buffer #define X393_CMPRS_CBIT_FRAMES_SINGLE 0x00000000 // Use single-frame buffer
#define X393_CMPRS_CBIT_FRAMES_MULTI 0x00000001 // Use multi-frame buffer #define X393_CMPRS_CBIT_FRAMES_MULTI 0x00000001 // Use multi-frame buffer
......
/******************************************************************************* /*******************************************************************************
* File: x393_defs.h * File: x393_defs.h
* Date: 2016-03-29 * Date: 2016-04-04
* Author: auto-generated file, see x393_export_c.py * Author: auto-generated file, see x393_export_c.py
* Description: Constants and hardware addresses definitions to access x393 hardware registers * Description: Constants and hardware addresses definitions to access x393 hardware registers
*******************************************************************************/ *******************************************************************************/
...@@ -136,7 +136,7 @@ ...@@ -136,7 +136,7 @@
#define X393_SENS_SYNC_LATE(sens_num) (0x4000101c + 0x100 * (sens_num)) // Configure frame sync delay, sens_num = 0..3, data type: x393_sens_sync_late_t (wo) #define X393_SENS_SYNC_LATE(sens_num) (0x4000101c + 0x100 * (sens_num)) // Configure frame sync delay, sens_num = 0..3, data type: x393_sens_sync_late_t (wo)
#define X393_SENSIO_CTRL(sens_num) (0x40001020 + 0x100 * (sens_num)) // Configure sensor I/O port, sens_num = 0..3, data type: x393_sensio_ctl_t (wo) #define X393_SENSIO_CTRL(sens_num) (0x40001020 + 0x100 * (sens_num)) // Configure sensor I/O port, sens_num = 0..3, data type: x393_sensio_ctl_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_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_JTAG(sens_num) (0x40001028 + 0x100 * (sens_num)) // Programming interface for multiplexer FPGA (with X393_SENSIO_STATUS), sens_num = 0..3, data type: x393_sensio_jpag_t (wo) #define X393_SENSIO_JTAG(sens_num) (0x40001028 + 0x100 * (sens_num)) // Programming interface for multiplexer FPGA (with X393_SENSIO_STATUS), sens_num = 0..3, data type: x393_sensio_jtag_t (wo)
#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) #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)
#define X393_SENSIO_TIM0(sens_num) (0x40001030 + 0x100 * (sens_num)) // Sensor port i/o timing configuration, register 0, sens_num = 0..3, data type: x393_sensio_tim0_t (rw) #define X393_SENSIO_TIM0(sens_num) (0x40001030 + 0x100 * (sens_num)) // Sensor port i/o timing configuration, register 0, sens_num = 0..3, data type: x393_sensio_tim0_t (rw)
#define X393_SENSIO_TIM1(sens_num) (0x40001034 + 0x100 * (sens_num)) // Sensor port i/o timing configuration, register 1, sens_num = 0..3, data type: x393_sensio_tim1_t (rw) #define X393_SENSIO_TIM1(sens_num) (0x40001034 + 0x100 * (sens_num)) // Sensor port i/o timing configuration, register 1, sens_num = 0..3, data type: x393_sensio_tim1_t (rw)
...@@ -240,7 +240,6 @@ ...@@ -240,7 +240,6 @@
#define X393_CMPRS_CBIT_CMODE_MONO1 0x0000000b // Mono JPEG (not yet implemented) #define X393_CMPRS_CBIT_CMODE_MONO1 0x0000000b // Mono JPEG (not yet implemented)
#define X393_CMPRS_CBIT_CMODE_MONO4 0x0000000e // Mono, 4 blocks (2x2 macroblocks) #define X393_CMPRS_CBIT_CMODE_MONO4 0x0000000e // Mono, 4 blocks (2x2 macroblocks)
#define X393_CMPRS_CBIT_CMODE_JPEG18 0x00000000 // Color 4:2:0 #define X393_CMPRS_CBIT_CMODE_JPEG18 0x00000000 // Color 4:2:0
#define X393_CMPRS_CBIT_CMODE_JPEG18 0x00000000 // Color 4:2:0
#define X393_CMPRS_CBIT_FRAMES_SINGLE 0x00000000 // Use single-frame buffer #define X393_CMPRS_CBIT_FRAMES_SINGLE 0x00000000 // Use single-frame buffer
#define X393_CMPRS_CBIT_FRAMES_MULTI 0x00000001 // Use multi-frame buffer #define X393_CMPRS_CBIT_FRAMES_MULTI 0x00000001 // Use multi-frame buffer
......
/******************************************************************************* /*******************************************************************************
* File: x393_map.h * File: x393_map.h
* Date: 2016-03-29 * Date: 2016-04-04
* Author: auto-generated file, see x393_export_c.py * Author: auto-generated file, see x393_export_c.py
* Description: Sorted hardware addresses map * Description: Sorted hardware addresses map
*******************************************************************************/ *******************************************************************************/
...@@ -189,7 +189,7 @@ ...@@ -189,7 +189,7 @@
#define X393_SENS_SYNC_LATE__0 0x4000101c // Configure frame sync delay, data type: x393_sens_sync_late_t (wo) #define X393_SENS_SYNC_LATE__0 0x4000101c // Configure frame sync delay, data type: x393_sens_sync_late_t (wo)
#define X393_SENSIO_CTRL__0 0x40001020 // Configure sensor I/O port, data type: x393_sensio_ctl_t (wo) #define X393_SENSIO_CTRL__0 0x40001020 // Configure sensor I/O port, data type: x393_sensio_ctl_t (wo)
#define X393_SENSIO_STATUS_CNTRL__0 0x40001024 // Set status control for SENSIO module, data type: x393_status_ctrl_t (rw) #define X393_SENSIO_STATUS_CNTRL__0 0x40001024 // Set status control for SENSIO module, data type: x393_status_ctrl_t (rw)
#define X393_SENSIO_JTAG__0 0x40001028 // Programming interface for multiplexer FPGA (with X393_SENSIO_STATUS), data type: x393_sensio_jpag_t (wo) #define X393_SENSIO_JTAG__0 0x40001028 // Programming interface for multiplexer FPGA (with X393_SENSIO_STATUS), data type: x393_sensio_jtag_t (wo)
#define X393_SENSIO_WIDTH__0 0x4000102c // Set sensor line in pixels (0 - use line sync from the sensor), data type: x393_sensio_width_t (rw) #define X393_SENSIO_WIDTH__0 0x4000102c // Set sensor line in pixels (0 - use line sync from the sensor), data type: x393_sensio_width_t (rw)
#define X393_SENSIO_TIM0__0 0x40001030 // Sensor port i/o timing configuration, register 0, data type: x393_sensio_tim0_t (rw) #define X393_SENSIO_TIM0__0 0x40001030 // Sensor port i/o timing configuration, register 0, data type: x393_sensio_tim0_t (rw)
#define X393_SENSIO_TIM1__0 0x40001034 // Sensor port i/o timing configuration, register 1, data type: x393_sensio_tim1_t (rw) #define X393_SENSIO_TIM1__0 0x40001034 // Sensor port i/o timing configuration, register 1, data type: x393_sensio_tim1_t (rw)
...@@ -252,7 +252,7 @@ ...@@ -252,7 +252,7 @@
#define X393_SENS_SYNC_LATE__1 0x4000111c // Configure frame sync delay, data type: x393_sens_sync_late_t (wo) #define X393_SENS_SYNC_LATE__1 0x4000111c // Configure frame sync delay, data type: x393_sens_sync_late_t (wo)
#define X393_SENSIO_CTRL__1 0x40001120 // Configure sensor I/O port, data type: x393_sensio_ctl_t (wo) #define X393_SENSIO_CTRL__1 0x40001120 // Configure sensor I/O port, data type: x393_sensio_ctl_t (wo)
#define X393_SENSIO_STATUS_CNTRL__1 0x40001124 // Set status control for SENSIO module, data type: x393_status_ctrl_t (rw) #define X393_SENSIO_STATUS_CNTRL__1 0x40001124 // Set status control for SENSIO module, data type: x393_status_ctrl_t (rw)
#define X393_SENSIO_JTAG__1 0x40001128 // Programming interface for multiplexer FPGA (with X393_SENSIO_STATUS), data type: x393_sensio_jpag_t (wo) #define X393_SENSIO_JTAG__1 0x40001128 // Programming interface for multiplexer FPGA (with X393_SENSIO_STATUS), data type: x393_sensio_jtag_t (wo)
#define X393_SENSIO_WIDTH__1 0x4000112c // Set sensor line in pixels (0 - use line sync from the sensor), data type: x393_sensio_width_t (rw) #define X393_SENSIO_WIDTH__1 0x4000112c // Set sensor line in pixels (0 - use line sync from the sensor), data type: x393_sensio_width_t (rw)
#define X393_SENSIO_TIM0__1 0x40001130 // Sensor port i/o timing configuration, register 0, data type: x393_sensio_tim0_t (rw) #define X393_SENSIO_TIM0__1 0x40001130 // Sensor port i/o timing configuration, register 0, data type: x393_sensio_tim0_t (rw)
#define X393_SENSIO_TIM1__1 0x40001134 // Sensor port i/o timing configuration, register 1, data type: x393_sensio_tim1_t (rw) #define X393_SENSIO_TIM1__1 0x40001134 // Sensor port i/o timing configuration, register 1, data type: x393_sensio_tim1_t (rw)
...@@ -315,7 +315,7 @@ ...@@ -315,7 +315,7 @@
#define X393_SENS_SYNC_LATE__2 0x4000121c // Configure frame sync delay, data type: x393_sens_sync_late_t (wo) #define X393_SENS_SYNC_LATE__2 0x4000121c // Configure frame sync delay, data type: x393_sens_sync_late_t (wo)
#define X393_SENSIO_CTRL__2 0x40001220 // Configure sensor I/O port, data type: x393_sensio_ctl_t (wo) #define X393_SENSIO_CTRL__2 0x40001220 // Configure sensor I/O port, data type: x393_sensio_ctl_t (wo)
#define X393_SENSIO_STATUS_CNTRL__2 0x40001224 // Set status control for SENSIO module, data type: x393_status_ctrl_t (rw) #define X393_SENSIO_STATUS_CNTRL__2 0x40001224 // Set status control for SENSIO module, data type: x393_status_ctrl_t (rw)
#define X393_SENSIO_JTAG__2 0x40001228 // Programming interface for multiplexer FPGA (with X393_SENSIO_STATUS), data type: x393_sensio_jpag_t (wo) #define X393_SENSIO_JTAG__2 0x40001228 // Programming interface for multiplexer FPGA (with X393_SENSIO_STATUS), data type: x393_sensio_jtag_t (wo)
#define X393_SENSIO_WIDTH__2 0x4000122c // Set sensor line in pixels (0 - use line sync from the sensor), data type: x393_sensio_width_t (rw) #define X393_SENSIO_WIDTH__2 0x4000122c // Set sensor line in pixels (0 - use line sync from the sensor), data type: x393_sensio_width_t (rw)
#define X393_SENSIO_TIM0__2 0x40001230 // Sensor port i/o timing configuration, register 0, data type: x393_sensio_tim0_t (rw) #define X393_SENSIO_TIM0__2 0x40001230 // Sensor port i/o timing configuration, register 0, data type: x393_sensio_tim0_t (rw)
#define X393_SENSIO_TIM1__2 0x40001234 // Sensor port i/o timing configuration, register 1, data type: x393_sensio_tim1_t (rw) #define X393_SENSIO_TIM1__2 0x40001234 // Sensor port i/o timing configuration, register 1, data type: x393_sensio_tim1_t (rw)
...@@ -378,7 +378,7 @@ ...@@ -378,7 +378,7 @@
#define X393_SENS_SYNC_LATE__3 0x4000131c // Configure frame sync delay, data type: x393_sens_sync_late_t (wo) #define X393_SENS_SYNC_LATE__3 0x4000131c // Configure frame sync delay, data type: x393_sens_sync_late_t (wo)
#define X393_SENSIO_CTRL__3 0x40001320 // Configure sensor I/O port, data type: x393_sensio_ctl_t (wo) #define X393_SENSIO_CTRL__3 0x40001320 // Configure sensor I/O port, data type: x393_sensio_ctl_t (wo)
#define X393_SENSIO_STATUS_CNTRL__3 0x40001324 // Set status control for SENSIO module, data type: x393_status_ctrl_t (rw) #define X393_SENSIO_STATUS_CNTRL__3 0x40001324 // Set status control for SENSIO module, data type: x393_status_ctrl_t (rw)
#define X393_SENSIO_JTAG__3 0x40001328 // Programming interface for multiplexer FPGA (with X393_SENSIO_STATUS), data type: x393_sensio_jpag_t (wo) #define X393_SENSIO_JTAG__3 0x40001328 // Programming interface for multiplexer FPGA (with X393_SENSIO_STATUS), data type: x393_sensio_jtag_t (wo)
#define X393_SENSIO_WIDTH__3 0x4000132c // Set sensor line in pixels (0 - use line sync from the sensor), data type: x393_sensio_width_t (rw) #define X393_SENSIO_WIDTH__3 0x4000132c // Set sensor line in pixels (0 - use line sync from the sensor), data type: x393_sensio_width_t (rw)
#define X393_SENSIO_TIM0__3 0x40001330 // Sensor port i/o timing configuration, register 0, data type: x393_sensio_tim0_t (rw) #define X393_SENSIO_TIM0__3 0x40001330 // Sensor port i/o timing configuration, register 0, data type: x393_sensio_tim0_t (rw)
#define X393_SENSIO_TIM1__3 0x40001334 // Sensor port i/o timing configuration, register 1, data type: x393_sensio_tim1_t (rw) #define X393_SENSIO_TIM1__3 0x40001334 // Sensor port i/o timing configuration, register 1, data type: x393_sensio_tim1_t (rw)
......
/******************************************************************************* /*******************************************************************************
* File: x393_types.h * File: x393_types.h
* Date: 2016-03-29 * Date: 2016-04-04
* Author: auto-generated file, see x393_export_c.py * Author: auto-generated file, see x393_export_c.py
* Description: typedef definitions for the x393 hardware registers * Description: typedef definitions for the x393 hardware registers
*******************************************************************************/ *******************************************************************************/
...@@ -382,7 +382,7 @@ typedef union { ...@@ -382,7 +382,7 @@ typedef union {
typedef union { typedef union {
struct { struct {
u32 tbl_addr: 8; // [ 7: 0] (0) Address/length in 64-bit words (<<3 to get byte address u32 tbl_addr: 8; // [ 7: 0] (0) Address/length in 64-bit words (<<3 to get byte address)
u32 :20; u32 :20;
u32 tbl_mode: 2; // [29:28] (3) Should be 3 to select table address write mode u32 tbl_mode: 2; // [29:28] (3) Should be 3 to select table address write mode
u32 : 2; u32 : 2;
...@@ -664,7 +664,7 @@ typedef union { ...@@ -664,7 +664,7 @@ typedef union {
struct { struct {
u32 d32:32; // [31: 0] (0) cast to u32 u32 d32:32; // [31: 0] (0) cast to u32
}; };
} x393_sensio_jpag_t; } x393_sensio_jtag_t;
// Sensor i/o timing register 0 (different meanings for different sensor types) // Sensor i/o timing register 0 (different meanings for different sensor types)
......
...@@ -274,7 +274,7 @@ class X393AxiControlStatus(object): ...@@ -274,7 +274,7 @@ class X393AxiControlStatus(object):
0: disable status generation, 0: disable status generation,
1: single status request, 1: single status request,
2: auto status, keep specified seq number, 2: auto status, keep specified seq number,
4: auto, inc sequence number 3: auto, inc sequence number
@param pattern 26-bit pattern to match @param pattern 26-bit pattern to match
@param mask 26-bit mask to enable pattern matching (0-s - ignore) @param mask 26-bit mask to enable pattern matching (0-s - ignore)
@param invert_match invert match (wait until matching condition becomes false) @param invert_match invert match (wait until matching condition becomes false)
...@@ -352,7 +352,7 @@ class X393AxiControlStatus(object): ...@@ -352,7 +352,7 @@ class X393AxiControlStatus(object):
0: disable status generation, 0: disable status generation,
1: single status request, 1: single status request,
2: auto status, keep specified seq number, 2: auto status, keep specified seq number,
4: auto, inc sequence number 3: auto, inc sequence number
<seq_number> - 6-bit sequence number of the status message to be sent <seq_number> - 6-bit sequence number of the status message to be sent
""" """
self.write_control_register(base_addr + reg_addr, ((mode & 3)<< 6) | (seq_number * 0x3f)) self.write_control_register(base_addr + reg_addr, ((mode & 3)<< 6) | (seq_number * 0x3f))
...@@ -367,7 +367,7 @@ class X393AxiControlStatus(object): ...@@ -367,7 +367,7 @@ class X393AxiControlStatus(object):
0: disable status generation, 0: disable status generation,
1: single status request, 1: single status request,
2: auto status, keep specified seq number, 2: auto status, keep specified seq number,
4: auto, inc sequence number 3: auto, inc sequence number
@param seq_number - 6-bit sequence number of the status message to be sent @param seq_number - 6-bit sequence number of the status message to be sent
""" """
......
...@@ -69,7 +69,7 @@ class X393Cmprs(object): ...@@ -69,7 +69,7 @@ class X393Cmprs(object):
0: disable status generation, 0: disable status generation,
1: single status request, 1: single status request,
2: auto status, keep specified seq number, 2: auto status, keep specified seq number,
4: auto, inc sequence number 3: auto, inc sequence number
@param seq_number - 6-bit sequence number of the status message to be sent @param seq_number - 6-bit sequence number of the status message to be sent
""" """
......
...@@ -125,7 +125,7 @@ class X393ExportC(object): ...@@ -125,7 +125,7 @@ class X393ExportC(object):
ld= self.define_macros() ld= self.define_macros()
ld+=self.define_other_macros() ld+=self.define_other_macros()
# Includes section # Includes section
txt = '\n#include "elphel/x393_types.h"\n' txt = '\n#include "x393_types.h"\n'
txt +='//#include "elphel/x393_defs.h // alternative variant"\n\n' txt +='//#include "elphel/x393_defs.h // alternative variant"\n\n'
txt +='// See elphel/x393_map.h for the ordered list of all I/O register addresses used\n' txt +='// See elphel/x393_map.h for the ordered list of all I/O register addresses used\n'
txt += '// init_mmio_ptr() should be called once before using any of the other declared functions\n\n' txt += '// init_mmio_ptr() should be called once before using any of the other declared functions\n\n'
......
...@@ -66,7 +66,7 @@ class X393GPIO(object): ...@@ -66,7 +66,7 @@ class X393GPIO(object):
0: disable status generation, 0: disable status generation,
1: single status request, 1: single status request,
2: auto status, keep specified seq number, 2: auto status, keep specified seq number,
4: auto, inc sequence number 3: auto, inc sequence number
@param seq_number - 6-bit sequence number of the status message to be sent @param seq_number - 6-bit sequence number of the status message to be sent
""" """
......
...@@ -965,6 +965,14 @@ class X393Jpeg(object): ...@@ -965,6 +965,14 @@ class X393Jpeg(object):
ff d9 ff d9
""" """
""" """
################## 10359 ##################
cd /usr/local/verilog/; test_mcntrl.py @hargs
setupSensorsPower "PAR12"
measure_all "*DI"
program_status_sensor_io all 1 0
print_status_sensor_io all
################## Parallel ################## ################## Parallel ##################
cd /usr/local/verilog/; test_mcntrl.py @hargs cd /usr/local/verilog/; test_mcntrl.py @hargs
setupSensorsPower "PAR12" setupSensorsPower "PAR12"
......
...@@ -67,7 +67,7 @@ class X393Rtc(object): ...@@ -67,7 +67,7 @@ class X393Rtc(object):
0: disable status generation, 0: disable status generation,
1: single status request, 1: single status request,
2: auto status, keep specified seq number, 2: auto status, keep specified seq number,
4: auto, inc sequence number 3: auto, inc sequence number
@param seq_number - 6-bit sequence number of the status message to be sent @param seq_number - 6-bit sequence number of the status message to be sent
""" """
......
...@@ -1429,7 +1429,7 @@ class X393SensCmprs(object): ...@@ -1429,7 +1429,7 @@ class X393SensCmprs(object):
0: disable status generation, 0: disable status generation,
1: single status request, 1: single status request,
2: auto status, keep specified seq number, 2: auto status, keep specified seq number,
4: auto, inc sequence number 3: auto, inc sequence number
@param seq_number - 6-bit sequence number of the status message to be sent @param seq_number - 6-bit sequence number of the status message to be sent
""" """
......
...@@ -32,6 +32,8 @@ __email__ = "andrey@elphel.com" ...@@ -32,6 +32,8 @@ __email__ = "andrey@elphel.com"
__status__ = "Development" __status__ = "Development"
#import sys #import sys
#import pickle #import pickle
import struct
from x393_mem import X393Mem from x393_mem import X393Mem
import x393_axi_control_status import x393_axi_control_status
...@@ -81,7 +83,7 @@ class X393Sensor(object): ...@@ -81,7 +83,7 @@ class X393Sensor(object):
0: disable status generation, 0: disable status generation,
1: single status request, 1: single status request,
2: auto status, keep specified seq number, 2: auto status, keep specified seq number,
4: auto, inc sequence number 3: auto, inc sequence number
@param seq_number - 6-bit sequence number of the status message to be sent @param seq_number - 6-bit sequence number of the status message to be sent
""" """
...@@ -101,31 +103,57 @@ class X393Sensor(object): ...@@ -101,31 +103,57 @@ class X393Sensor(object):
0: disable status generation, 0: disable status generation,
1: single status request, 1: single status request,
2: auto status, keep specified seq number, 2: auto status, keep specified seq number,
4: auto, inc sequence number 3: auto, inc sequence number
@param seq_number - 6-bit sequence number of the status message to be sent @param seq_number - 6-bit sequence number of the status message to be sent
""" """
try:
if (num_sensor == all) or (num_sensor[0].upper() == "A"): #all is a built-in function
for num_sensor in range(4):
self.program_status_sensor_io (num_sensor = num_sensor,
mode = mode,
seq_num = seq_num)
return
except:
pass
self.x393_axi_tasks.program_status ( self.x393_axi_tasks.program_status (
vrlg.SENSOR_GROUP_ADDR + num_sensor * vrlg.SENSOR_BASE_INC + vrlg.SENSIO_RADDR, vrlg.SENSOR_GROUP_ADDR + num_sensor * vrlg.SENSOR_BASE_INC + vrlg.SENSIO_RADDR,
vrlg.SENSIO_STATUS, vrlg.SENSIO_STATUS,
mode, mode,
seq_num)# //MCONTR_PHY_STATUS_REG_ADDR= 'h0, seq_num)# //MCONTR_PHY_STATUS_REG_ADDR= 'h0,
def get_status_sensor_io ( self, def get_status_sensor_io ( self,
num_sensor): num_sensor="All"):
""" """
Read sensor_io status word (no sync) Read sensor_io status word (no sync)
@param num_sensor - number of the sensor port (0..3) @param num_sensor - number of the sensor port (0..3)
@return sesnor_io status @return sesnor_io status
""" """
try:
if (num_sensor == all) or (num_sensor[0].upper() == "A"): #all is a built-in function
rslt = []
for num_sensor in range(4):
rslt.append(self.program_status_sensor_io (num_sensor = num_sensor))
return rslt
except:
pass
return self.x393_axi_tasks.read_status( return self.x393_axi_tasks.read_status(
address=(vrlg.SENSI2C_STATUS_REG_BASE + num_sensor * vrlg.SENSI2C_STATUS_REG_INC + vrlg.SENSIO_STATUS_REG_REL)) address=(vrlg.SENSI2C_STATUS_REG_BASE + num_sensor * vrlg.SENSI2C_STATUS_REG_INC + vrlg.SENSIO_STATUS_REG_REL))
def print_status_sensor_io (self, def print_status_sensor_io (self,
num_sensor): num_sensor="All"):
""" """
Print sensor_io status word (no sync) Print sensor_io status word (no sync)
@param num_sensor - number of the sensor port (0..3) @param num_sensor - number of the sensor port (0..3)
""" """
try:
if (num_sensor == all) or (num_sensor[0].upper() == "A"): #all is a built-in function
for num_sensor in range(4):
print ("\n ==== Sensor %d"%(num_sensor))
self.print_status_sensor_io (num_sensor = num_sensor)
return
except:
pass
status= self.get_status_sensor_io(num_sensor) status= self.get_status_sensor_io(num_sensor)
print ("print_status_sensor_io(%d):"%(num_sensor)) print ("print_status_sensor_io(%d):"%(num_sensor))
#last_in_line_1cyc_mclk, dout_valid_1cyc_mclk #last_in_line_1cyc_mclk, dout_valid_1cyc_mclk
...@@ -154,21 +182,37 @@ class X393Sensor(object): ...@@ -154,21 +182,37 @@ class X393Sensor(object):
print (" seq = %d"%((status>>26) & 0x3f)) print (" seq = %d"%((status>>26) & 0x3f))
#vact_alive, hact_ext_alive, hact_alive #vact_alive, hact_ext_alive, hact_alive
def get_status_sensor_i2c ( self, def get_status_sensor_i2c ( self,
num_sensor): num_sensor="All"):
""" """
Read sensor_i2c status word (no sync) Read sensor_i2c status word (no sync)
@param num_sensor - number of the sensor port (0..3) @param num_sensor - number of the sensor port (0..3)
@return sesnor_io status @return sesnor_io status
""" """
try:
if (num_sensor == all) or (num_sensor[0].upper() == "A"): #all is a built-in function
rslt = []
for num_sensor in range(4):
rslt.append(self.get_status_sensor_i2c (num_sensor = num_sensor))
return rslt
except:
pass
return self.x393_axi_tasks.read_status( return self.x393_axi_tasks.read_status(
address=(vrlg.SENSI2C_STATUS_REG_BASE + num_sensor * vrlg.SENSI2C_STATUS_REG_INC + vrlg.SENSI2C_STATUS_REG_REL)) address=(vrlg.SENSI2C_STATUS_REG_BASE + num_sensor * vrlg.SENSI2C_STATUS_REG_INC + vrlg.SENSI2C_STATUS_REG_REL))
def print_status_sensor_i2c (self, def print_status_sensor_i2c (self,
num_sensor): num_sensor="All"):
""" """
Print sensor_i2c status word (no sync) Print sensor_i2c status word (no sync)
@param num_sensor - number of the sensor port (0..3) @param num_sensor - number of the sensor port (0..3)
""" """
try:
if (num_sensor == all) or (num_sensor[0].upper() == "A"): #all is a built-in function
for num_sensor in range(4):
print ("\n ==== Sensor %d"%(num_sensor))
self.print_status_sensor_i2c (num_sensor = num_sensor)
return
except:
pass
status= self.get_status_sensor_i2c(num_sensor) status= self.get_status_sensor_i2c(num_sensor)
print ("print_status_sensor_i2c(%d):"%(num_sensor)) print ("print_status_sensor_i2c(%d):"%(num_sensor))
print (" reset_on = %d"%((status>> 7) & 1)) print (" reset_on = %d"%((status>> 7) & 1))
...@@ -882,6 +926,137 @@ class X393Sensor(object): ...@@ -882,6 +926,137 @@ class X393Sensor(object):
tms = tms, tms = tms,
tdi = tdi) tdi = tdi)
self.x393_axi_tasks.write_control_register(reg_addr, data) self.x393_axi_tasks.write_control_register(reg_addr, data)
# /dev/sfpgabscan0
def readbscan(self, filename):
ffs=struct.pack("B",0xff)*97
with open(filename,'r+') as jtag:
jtag.write(ffs)
jtag.seek (0,0)
boundary= jtag.read(97)
return boundary
"""
import struct
def readbscan(filename):
ffs=struct.pack("B",0xff)*97
with open(filename,'r+') as jtag:
jtag.write(ffs)
jtag.seek (0,0)
boundary= jtag.read(97)
return boundary
b = readbscan('/dev/sfpgabscan0')
$boards=array (
'0' => array ('model' => '10347', 'scl' =>241,'sda' => 199), // E4, C1
'1' => array ('model' => '10359', 'scl' =>280,'sda' => 296) // H6, J5
);
cd /usr/local/verilog/; test_mcntrl.py @hargs
setupSensorsPower "PAR12"
measure_all "*DI"
program_status_sensor_io all 1 0
print_status_sensor_io all
>>> b = readbscan('/dev/sfpgabscan0')
>>> b
b='\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00$\x82\x12I\t\x00\x80\x02\x00@\x00\x04\x00\x00@\x00\x00\x00\x00\x00@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
a='ffffffffff7fffffffffffffffffffffffffffffffffffffbfffffffffffffffffffff7fff7ffffffbffffffffffffffffffffffffffffffffffffffffdffffffffffffffffffffff6dfffffffffffffffedf7fdbfedff7ffff6fffeffffffbff0'
al = []
for i in range(len(a)/2):
al.append(int('0x'+a[2*i:2*i+2],0))
bl = []
for i in b:
bl.append(ord(i))
for i,x in enumerate(zip(al,bl)):
print ("%02x %02x %02x"%(i,x[0],x[1]))
fwrite returned 97<br/>
Boundary:
ffffffffff7fffffffffffffffffffffffffffffffffffffbfffffffffffffffffffffffff7ffffffbffffffffffffffffffffffffffffffffffffffffdffffffffffffffffffffff6dfffffffffffffffedf7fdbfedff7ffff6fffeffffffbff0
fwrite returned 97<br/>
Boundary:
ffffffffff7fffffffffffffffffffffffffffffffffffffbfffffffffffffffffffff7ffffffffffbffffffffffffffffffffffffffffffffffffffffdffffffffffffffffffffff6dfffffffffffffffedf7fdbfedff7ffff6fffeffffffbff0
fwrite returned 97<br/>
Boundary:
ffffffffff7fffffffffffffffffffffffffffffffffffffbffffffffffffffffffffffffffffffffbffffffffffffffffffffffffffffffffffffffffdffffffffffffffffffffff6dfffffffffffffffedf7fdbfedff7ffff6fffeffffffbff0
>>> b1 = readbscan('/dev/sfpgabscan0')
>>> b1
'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xf0'
'\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00$\x82\x12I\t\x00\x80\x02\x00@\x00\x04\x00\x00@\x00\x00\x00\x00\x00@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
root@elphel393:/sys/kernel/debug/dynamic_debug# cat control | grep fpga
drivers/elphel/fpgajtag353.c:655 [fpgajtag]fpga_jtag_lseek =_ "fpga_jtag_lseek, fsize= 0x%x\012"
drivers/elphel/fpgajtag353.c:679 [fpgajtag]fpga_jtag_lseek =_ "fpga_jtag_lseek, file->f_pos= 0x%x\012"
drivers/elphel/fpgajtag353.c:1405 [fpgajtag]fpga_jtag_init =_ "elphel test %s: MAJOR %d"
drivers/elphel/fpgajtag353.c:751 [fpgajtag]wait_sensio_status =_ "seq_num = %d received after %d wait cycles"
drivers/elphel/fpgajtag353.c:764 [fpgajtag]set_pgm_mode =_ "set_pgm_mode (%d,%d)\012"
drivers/elphel/fpgajtag353.c:789 [fpgajtag]set_pgm =_ "set_pgm (%d,%d)\012"
drivers/elphel/fpgajtag353.c:851 [fpgajtag]jtag_send =_ "jtag_send(0x%x, 0x%x, 0x%x, 0x%x)\015\012"
drivers/elphel/fpgajtag353.c:950 [fpgajtag]jtag_write_bits =_ "jtag_write_bits(0x%x, 0x%x, 0x%x, 0x%x, 0x%x)\015\012"
drivers/elphel/fpgajtag353.c:1096 [fpgajtag]JTAG_configure =_ "JTAG_configure: chn=%x, wp=0x%x, rp=0x%x, len=0x%x\015\012"
drivers/elphel/fpgajtag353.c:1211 [fpgajtag]JTAG_openChannel =_ "JTAG_openChannel (%d)\012"
drivers/elphel/fpgajtag353.c:367 [fpgajtag]fpga_jtag_open =_ "fpga_jtag_open: minor=%x, channel=%x, buf=%p\015\012"
drivers/elphel/fpgajtag353.c:440 [fpgajtag]fpga_jtag_open =_ "fpga_jtag_open: chn=%x, JTAG_channels[chn].sizew=%x, JTAG_channels[chn].sizer=%x\015\012"
drivers/elphel/fpgajtag353.c:441 [fpgajtag]fpga_jtag_open =_ "fpga_jtag_open: chn=%x, JTAG_channels[chn].bitsw=%x, JTAG_channels[chn].bitsr=%x\015\012"
drivers/elphel/fpgajtag353.c:446 [fpgajtag]fpga_jtag_open =_ "fpga_jtag_open: inode->i_size=%x, chn=%x\015\012"
drivers/elphel/fpgajtag353.c:1231 [fpgajtag]JTAG_resetChannel =_ "JTAG_resetChannel (%d)\012"
drivers/elphel/fpgajtag353.c:1342 [fpgajtag]JTAG_CAPTURE =_ "\012"
drivers/elphel/fpgajtag353.c:1347 [fpgajtag]JTAG_CAPTURE =_ "\012"
drivers/elphel/fpgajtag353.c:1344 [fpgajtag]JTAG_CAPTURE =_ "%3x "
drivers/elphel/fpgajtag353.c:1345 [fpgajtag]JTAG_CAPTURE =_ "\012"
drivers/elphel/fpgajtag353.c:456 [fpgajtag]fpga_jtag_release =_ "fpga_jtag_release: p=%x,chn=%x, wp=0x%x, rp=0x%x\015\012"
drivers/elphel/fpgajtag353.c:497 [fpgajtag]fpga_jtag_release =_ "fpga_jtag_release: done\015\012"
drivers/elphel/fpgajtag353.c:509 [fpgajtag]fpga_jtag_write =_ "fpga_jtag_write: p=%x,chn=%x, buf address=%lx count=%lx *offs=%lx, wp=%lx,size=0x%x\015\012"
drivers/elphel/fpgajtag353.c:562 [fpgajtag]fpga_jtag_write =_ "fpga_jtag_write end: p=%x,chn=%x, buf address=%lx count=%lx *offs=%lx, wp=%lx,size=0x%x\015\012"
drivers/elphel/fpgajtag353.c:574 [fpgajtag]fpga_jtag_read =_ "fpga_jtag_read: p=%x,chn=%x, buf address=%lx count=%lx *offs=%lx, rp=%lx,size=0x%x\015\012"
drivers/elphel/fpgajtag353.c:601 [fpgajtag]fpga_jtag_read =_ "fpga_jtag_read_01: p=%x,chn=%x, buf address=%lx count=%lx *offs=%lx, rp=%lx,size=0x%x\015\012"
drivers/elphel/fpgajtag353.c:624 [fpgajtag]fpga_jtag_read =_ "fpga_jtag_read_01: p=%x,chn=%x, buf address=%lx count=%lx *offs=%lx, rp=%lx,size=0x%x\015\012"
drivers/elphel/fpgajtag353.c:635 [fpgajtag]fpga_jtag_read =_ "fpga_jtag_read_end: p=%x,chn=%x, buf address=%lx count=%lx *offs=%lx, rp=%lx,size=0x%x, mode=%x\015\012"
drivers/elphel/fpgajtag353.c:1416 [fpgajtag]fpga_jtag_exit =_ "unregistering driver"
root@elphel393:/sys/kernel/debug/dynamic_debug# echo 'file drivers/elphel/fpgajtag353.c +p' > control
afpgaconfjtag jtagraw memory_bandwidth mtd4ro ram2 stderr tty18 tty30 tty43 tty56 ttyS1
block kmem mmcblk0 mtdblock0 ram3 stdin tty19 tty31 tty44 tty57 ttyS2
char kmsg mmcblk0p1 mtdblock1 random stdout tty2 tty32 tty45 tty58 ttyS3
console log mmcblk0p2 mtdblock2 rtc0 tty tty20 tty33 tty46 tty59 ubi_ctrl
cpu_dma_latency loop-control mtab mtdblock3 sfpgabscan0 tty0 tty21 tty34 tty47 tty6 urandom
disk loop0 mtd0 mtdblock4 sfpgabscan1 tty1 tty22 tty35 tty48 tty60 vcs
fd loop1 mtd0ro network_latency sfpgabscan2 tty10 tty23 tty36 tty49 tty61 vcs1
fpgaconfjtag loop2 mtd1 network_throughput sfpgabscan3 tty11 tty24 tty37 tty5 tty62 vcsa
fpgaresetjtag loop3 mtd1ro null sfpgaconfjtag tty12 tty25 tty38 tty50 tty63 vcsa1
full loop4 mtd2 psaux sfpgaconfjtag0 tty13 tty26 tty39 tty51 tty7 watchdog
i2c-0 loop5 mtd2ro ptmx sfpgaconfjtag1 tty14 tty27 tty4 tty52 tty8 watchdog0
iio:device0 loop6 mtd3 pts sfpgaconfjtag2 tty15 tty28 tty40 tty53 tty9 xdevcfg
initctl loop7 mtd3ro ram0 sfpgaconfjtag3 tty16 tty29 tty41 tty54 ttyPS0 zero
input mem mtd4 ram1 shm tty17 tty3 tty42 tty55 ttyS0
fseek ($jtag,0);
$boundary= fread($jtag, 97);
fclose($jtag);
return $boundary;
packedData=struct.pack(self.ENDIAN+"L",data)
d=struct.unpack(self.ENDIAN+"L",packedData)[0]
mm[page_offs:page_offs+4]=packedData
"""
def set_sensor_io_width ( def set_sensor_io_width (
self, self,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment