Commit a821207d authored by Andrey Filippov's avatar Andrey Filippov
Browse files

Fixed GCC reported errors, added includes

parent 8c3c3a8a
Loading
Loading
Loading
Loading
+290 −286

File changed.

Preview size limit exceeded, changes collapsed.

+6 −2
Original line number Diff line number Diff line
@@ -5,6 +5,10 @@
 * Description: Constants definitions and functions declarations to access x393 hardware registers
 *******************************************************************************/

#include "elphel/types.h"
//#include "elphel/x393_defs.h // alternative variant"


// R/W addresses to set up memory arbiter priorities. For sensors  (chn = 8..11), for compressors - 12..15

void                         set_x393_mcntrl_arbiter_priority    (x393_arbite_pri_t d, int chn);                  // Set memory arbiter priority (currently r/w, may become just wo)
@@ -158,8 +162,8 @@ x393_status_membridge_t x393_membridge_status (void);

void                         x393_sens_mode                      (x393_sens_mode_t d, int sens_num);              // Write sensor channel mode
void                         x393_sensi2c_ctrl                   (x393_i2c_ctltbl_t d, int sens_num);             // Control sensor i2c, write i2c LUT
void                         set_x393_sensi2c_status             (x393_status_ctrl_t d, int sens_num);            // Setup sensor i2c status report mode
x393_status_ctrl_t           get_x393_sensi2c_status             (int sens_num);
void                         set_x393_sensi2c_status_ctrl        (x393_status_ctrl_t d, int sens_num);            // Setup sensor i2c status report mode
x393_status_ctrl_t           get_x393_sensi2c_status_ctrl        (int sens_num);
void                         x393_sens_sync_mult                 (x393_sens_sync_mult_t d, int sens_num);         // Configure frames combining
void                         x393_sens_sync_late                 (x393_sens_sync_late_t d, int sens_num);         // Configure frame sync delay
void                         x393_sensio_ctrl                    (x393_sensio_ctl_t d, int sens_num);             // Configure sensor I/O port
+5 −5
Original line number Diff line number Diff line
@@ -131,7 +131,7 @@

#define X393_SENS_MODE(sens_num)                         (0x40001000 + 0x100 * (sens_num)) // Write sensor channel mode, sens_num = 0..3, data type: x393_sens_mode_t (wo)
#define X393_SENSI2C_CTRL(sens_num)                      (0x40001008 + 0x100 * (sens_num)) // Control sensor i2c, write i2c LUT, sens_num = 0..3, data type: x393_i2c_ctltbl_t (wo)
#define X393_SENSI2C_STATUS(sens_num)                    (0x4000100c + 0x100 * (sens_num)) // Setup sensor i2c status report mode, sens_num = 0..3, data type: x393_status_ctrl_t (rw)
#define X393_SENSI2C_STATUS_CTRL(sens_num)               (0x4000100c + 0x100 * (sens_num)) // Setup sensor i2c status report mode, sens_num = 0..3, data type: x393_status_ctrl_t (rw)
#define X393_SENS_SYNC_MULT(sens_num)                    (0x40001018 + 0x100 * (sens_num)) // Configure frames combining, sens_num = 0..3, data type: x393_sens_sync_mult_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)
@@ -158,8 +158,8 @@
//     in the table. Slave address is always in byte 2 (bits 23:16), byte1 (high register address) is skipped if
//     read address in the table is programmed to be a single-byte one

#define X393_SENSI2C_ABS((sens_num),(offset))            (0x40001040)+ 0x40 * (sens_num)+ 0x1 * (offset)) // Write sensor i2c sequencer, sens_num = 0..3, offset = 0..15, data type: u32 (wo)
#define X393_SENSI2C_REL((sens_num),(offset))            (0x40001080)+ 0x40 * (sens_num)+ 0x1 * (offset)) // Write sensor i2c sequencer, sens_num = 0..3, offset = 0..15, data type: u32 (wo)
#define X393_SENSI2C_ABS(sens_num,offset)                (0x40001040)+ 0x40 * (sens_num)+ 0x1 * (offset)) // Write sensor i2c sequencer, sens_num = 0..3, offset = 0..15, data type: u32 (wo)
#define X393_SENSI2C_REL(sens_num,offset)                (0x40001080)+ 0x40 * (sens_num)+ 0x1 * (offset)) // Write sensor i2c sequencer, sens_num = 0..3, offset = 0..15, data type: u32 (wo)

// Lens vignetting correction (for each sub-frame separately)

@@ -357,8 +357,8 @@
//      [13:12] - 3 - run seq, 2 - stop seq , 1,0 - no change to run state
//        [1:0] - 0: NOP, 1: clear IRQ, 2 - Clear IE, 3: set IE
#define X393_CMDFRAMESEQ_CTRL(sens_chn)                  (0x40001e7c + 0x80 * (sens_chn)) // CMDFRAMESEQ control register, sens_chn = 0..3, data type: x393_cmdframeseq_mode_t (wo)
#define X393_CMDFRAMESEQ_ABS((sens_chn),(offset))        (0x40001e00)+ 0x20 * (sens_chn)+ 0x1 * (offset)) // CMDFRAMESEQ absolute frame address/command, sens_chn = 0..3, offset = 0..15, data type: u32 (wo)
#define X393_CMDFRAMESEQ_REL((sens_chn),(offset))        (0x40001e40)+ 0x20 * (sens_chn)+ 0x1 * (offset)) // CMDFRAMESEQ relative frame address/command, sens_chn = 0..3, offset = 0..14, data type: u32 (wo)
#define X393_CMDFRAMESEQ_ABS(sens_chn,offset)            (0x40001e00)+ 0x20 * (sens_chn)+ 0x1 * (offset)) // CMDFRAMESEQ absolute frame address/command, sens_chn = 0..3, offset = 0..15, data type: u32 (wo)
#define X393_CMDFRAMESEQ_REL(sens_chn,offset)            (0x40001e40)+ 0x20 * (sens_chn)+ 0x1 * (offset)) // CMDFRAMESEQ relative frame address/command, sens_chn = 0..3, offset = 0..14, data type: u32 (wo)
// Command sequencer multiplexer, provides current frame number for each sesnor 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)
+4 −4
Original line number Diff line number Diff line
@@ -183,7 +183,7 @@
#define X393_SENS_MODE__0                                0x40001000 // Write sensor channel mode, data type: x393_sens_mode_t (wo)
// RESERVED: 0x1 DWORD
#define X393_SENSI2C_CTRL__0                             0x40001008 // Control sensor i2c, write i2c LUT, data type: x393_i2c_ctltbl_t (wo)
#define X393_SENSI2C_STATUS__0                           0x4000100c // Setup sensor i2c status report mode, data type: x393_status_ctrl_t (rw)
#define X393_SENSI2C_STATUS_CTRL__0                      0x4000100c // Setup sensor i2c status report mode, data type: x393_status_ctrl_t (rw)
// RESERVED: 0x2 DWORDs
#define X393_SENS_SYNC_MULT__0                           0x40001018 // Configure frames combining, data type: x393_sens_sync_mult_t (wo)
#define X393_SENS_SYNC_LATE__0                           0x4000101c // Configure frame sync delay, data type: x393_sens_sync_late_t (wo)
@@ -246,7 +246,7 @@
#define X393_SENS_MODE__1                                0x40001100 // Write sensor channel mode, data type: x393_sens_mode_t (wo)
// RESERVED: 0x1 DWORD
#define X393_SENSI2C_CTRL__1                             0x40001108 // Control sensor i2c, write i2c LUT, data type: x393_i2c_ctltbl_t (wo)
#define X393_SENSI2C_STATUS__1                           0x4000110c // Setup sensor i2c status report mode, data type: x393_status_ctrl_t (rw)
#define X393_SENSI2C_STATUS_CTRL__1                      0x4000110c // Setup sensor i2c status report mode, data type: x393_status_ctrl_t (rw)
// RESERVED: 0x2 DWORDs
#define X393_SENS_SYNC_MULT__1                           0x40001118 // Configure frames combining, data type: x393_sens_sync_mult_t (wo)
#define X393_SENS_SYNC_LATE__1                           0x4000111c // Configure frame sync delay, data type: x393_sens_sync_late_t (wo)
@@ -309,7 +309,7 @@
#define X393_SENS_MODE__2                                0x40001200 // Write sensor channel mode, data type: x393_sens_mode_t (wo)
// RESERVED: 0x1 DWORD
#define X393_SENSI2C_CTRL__2                             0x40001208 // Control sensor i2c, write i2c LUT, data type: x393_i2c_ctltbl_t (wo)
#define X393_SENSI2C_STATUS__2                           0x4000120c // Setup sensor i2c status report mode, data type: x393_status_ctrl_t (rw)
#define X393_SENSI2C_STATUS_CTRL__2                      0x4000120c // Setup sensor i2c status report mode, data type: x393_status_ctrl_t (rw)
// RESERVED: 0x2 DWORDs
#define X393_SENS_SYNC_MULT__2                           0x40001218 // Configure frames combining, data type: x393_sens_sync_mult_t (wo)
#define X393_SENS_SYNC_LATE__2                           0x4000121c // Configure frame sync delay, data type: x393_sens_sync_late_t (wo)
@@ -372,7 +372,7 @@
#define X393_SENS_MODE__3                                0x40001300 // Write sensor channel mode, data type: x393_sens_mode_t (wo)
// RESERVED: 0x1 DWORD
#define X393_SENSI2C_CTRL__3                             0x40001308 // Control sensor i2c, write i2c LUT, data type: x393_i2c_ctltbl_t (wo)
#define X393_SENSI2C_STATUS__3                           0x4000130c // Setup sensor i2c status report mode, data type: x393_status_ctrl_t (rw)
#define X393_SENSI2C_STATUS_CTRL__3                      0x4000130c // Setup sensor i2c status report mode, data type: x393_status_ctrl_t (rw)
// RESERVED: 0x2 DWORDs
#define X393_SENS_SYNC_MULT__3                           0x40001318 // Configure frames combining, data type: x393_sens_sync_mult_t (wo)
#define X393_SENS_SYNC_LATE__3                           0x4000131c // Configure frame sync delay, data type: x393_sens_sync_late_t (wo)
+15 −10
Original line number Diff line number Diff line
@@ -145,7 +145,9 @@ class X393ExportC(object):
        header = self.generated_fileHeader(filename,description)
        ld= self.define_macros()
        ld+=self.define_other_macros()
        txt = ""
        # Includes section
        txt = '\n#include "elphel/types.h"\n'
        txt +='//#include "elphel/x393_defs.h // alternative variant"\n\n'
        for d in ld:
            fd=self.expand_define_maxi0(d, mode = "func_decl",frmt_spcs = None)
            if fd:
@@ -161,7 +163,10 @@ class X393ExportC(object):
        header = self.generated_fileHeader(filename,description)
        ld= self.define_macros()
        ld+=self.define_other_macros()
        txt = ""
        # Includes section
        txt = '\n#include <linux/io.h>\n'
        txt +=  '#include "x393.h"\n\n'

        for d in ld:
            fd=self.expand_define_maxi0(d, mode = "func_def",frmt_spcs = None)
            if fd:
@@ -754,7 +759,7 @@ class X393ExportC(object):
            (('Write-only control of the sensor channels',)),
            (("X393_SENS_MODE",                         c, vrlg.SENSOR_CTRL_RADDR +                        ba, ia, z3, "x393_sens_mode", "wo",               "Write sensor channel mode")),
            (("X393_SENSI2C_CTRL",                      c, vrlg.SENSI2C_CTRL_RADDR + vrlg.SENSI2C_CTRL +   ba, ia, z3, "x393_i2c_ctltbl", "wo",              "Control sensor i2c, write i2c LUT")),
            (("X393_SENSI2C_STATUS",                    c, vrlg.SENSI2C_CTRL_RADDR + vrlg.SENSI2C_STATUS + ba, ia, z3, "x393_status_ctrl", "rw",             "Setup sensor i2c status report mode")),
            (("X393_SENSI2C_STATUS_CTRL",               c, vrlg.SENSI2C_CTRL_RADDR + vrlg.SENSI2C_STATUS + ba, ia, z3, "x393_status_ctrl", "rw",             "Setup sensor i2c status report mode")),
            (("X393_SENS_SYNC_MULT",                    c, vrlg.SENS_SYNC_RADDR + vrlg.SENS_SYNC_MULT +    ba, ia, z3, "x393_sens_sync_mult", "wo",          "Configure frames combining")),
            (("X393_SENS_SYNC_LATE",                    c, vrlg.SENS_SYNC_RADDR + vrlg.SENS_SYNC_LATE +    ba, ia, z3, "x393_sens_sync_late", "wo",          "Configure frame sync delay")),
            (("X393_SENSIO_CTRL",                       c, vrlg.SENSIO_RADDR + vrlg.SENSIO_CTRL +          ba, ia, z3, "x393_sensio_ctl", "wo",              "Configure sensor I/O port")),
@@ -1289,7 +1294,7 @@ class X393ExportC(object):
                    s+='return (%s) readl(0x%08x + 0x%x * %s)'%(data_type, address, address_inc, arg)
            else:
                s+='return (%s) readl(0x%08x)'%(data_type, address)
            s+='};'
            s+=';}'
        else:
            s += ';'
        if comment:
@@ -1339,7 +1344,7 @@ class X393ExportC(object):
                    s+='writel(0x%08x + 0x%x * %s, (u32) d)'%(address, address_inc, arg)
            else:
                s+='writel(0x%08x, (u32) d)'%(address)
            s+='};'
            s+=';}'
        else:
            s += ';'
        if comment:
@@ -1384,7 +1389,7 @@ class X393ExportC(object):
                    s+='writel(0x%08x + 0x%x * %s, 0)'%(address, address_inc, arg)
            else:
                s+='writel(0x%08x, 0)'%(address)
            s+='};'
            s+=';}'
        else:
            s += ';'
        if comment:
@@ -1435,17 +1440,17 @@ class X393ExportC(object):
            name_len = len(name)
            if address_inc:
                if multivar:
                    name_len += 4 + len(var_name[0])
                    name_len += 2 + len(var_name[0])
                    for vn in var_name[1:]:
                        name_len += 3 + len(vn)
                        name_len += 1 + len(vn)
                else:        
                    name_len += 2 + len(var_name)
            ins_spaces = max(0,frmt_spcs['macroNameLen'] - name_len)
            if address_inc:
                if multivar:
                    vname = "(%s)"%(var_name[0])
                    vname = "%s"%(var_name[0])
                    for vn in var_name[1:]:
                        vname +=",(%s)"%(vn)
                        vname +=",%s"%(vn)
                    s = "#define %s(%s) %s(0x%08x)"%(name, vname, ' ' * ins_spaces, address)
                    for vn, vi in zip(var_name, address_inc):
                        s += "+ 0x%x * (%s)"%(vi,vn)