Commit a40eed25 authored by Andrey Filippov's avatar Andrey Filippov

more porting pgm_functions and related files

parent 7a3e1480
......@@ -117,6 +117,7 @@
#include <elphel/exifa.h>
//#include "fpgactrl.h" // defines port_csp0_addr, port_csp4_addr
#include "framepars.h" // for debug mask
#include "sensor_common.h" // for FPGA_TABLE_CHUNK - or move it?
//#include "fpga_io.h"//fpga_table_write_nice
......@@ -126,6 +127,7 @@
//#include "framepars.h"
//#include "quantization_tables.h"
#include "gamma_tables.h"
#include "x393.h"
/**
* @brief optional debug output
*/
......@@ -666,6 +668,35 @@ int set_gamma_table (unsigned short hash16, ///< 16-bit unique (non-scale
return tmp_p1;
}
/** Writing gamma table to FPGA (1 color, 1 sub-channel) enabling IRQ after transferring each FPGA_TABLE_CHUNK DWORDs */
void fpga_gamma_write_nice(int color, ///< Color (0..3)
int sensor_port, ///< sensor port (0..3)
int sensor_subchn, ///< sensor sub-channel (when several are connected through a multiplexer)
u32 * gamma) ///< Gamma table (256 DWORDs) in encoded FPGA format
{
x393_gamma_tbl_t gamma_tbl_a = {.d32=0};
x393_gamma_tbl_t gamma_tbl_d = {.d32=0};
const int gamma_size=256; // 18-bit entries
unsigned long flags;
int addr32, len32, i;
gamma_tbl_a.a_n_d = 1;
gamma_tbl_a.color = color;
gamma_tbl_a.sub_chn = sensor_subchn;
for (addr32 = 0; addr32 < gamma_size; addr32 += FPGA_TABLE_CHUNK){
len32 = FPGA_TABLE_CHUNK;
if (unlikely(addr32 + len32 > gamma_size))
len32 = gamma_size - addr32;
gamma_tbl_a.addr= addr32;
local_irq_save(flags);
x393_sens_gamma_tbl(gamma_tbl_a, sensor_port);
for (i = addr32; i < addr32 + len32; i++){
gamma_tbl_d.d32 = gamma[i];
x393_sens_gamma_tbl(gamma_tbl_d, sensor_port);
}
local_irq_restore(flags);
}
}
///======================================
// File operations:
......
......@@ -12,6 +12,8 @@ int unlock_gamma_node (int color, int sensor_port, int sensor_subchn); /// NOTE:
/// return a pointer to the gamma table (single color) encoded in FPGA format (NULL if there is to table ready)
///
unsigned long * get_gamma_fpga(int color, int sensor_port, int sensor_subchn);
void fpga_gamma_write_nice (int color, int sensor_port, int sensor_subchn, u32 * gamma);
int gamma_new_node(void);
void gamma_encode_fpga(unsigned short * gamma_in, unsigned long * gamma_out);///Hardware-dependent encoding of the FPGA "gamma" table. Converts unsigned short array of 257 16-bit values (only 10 msb-s are used) to 256 unsigned long words to be written to FPGA
......
This diff is collapsed.
......@@ -993,14 +993,13 @@ static unsigned long coring_tables[] = {
/**
* @brief Directly set one of the coring LUTs (currently 100: 0.0 to 9.9 with 0.1 step)
* to one of 16 FPGA tables (even - for Y, odd - for C)
* @param[in] coring_number 0..99 - function number
* @param[in] fpga_tbl_num 0..15 - FPGA table number
* @param[in] chn compressor channel number
* @return None
*/
void set_coring_fpga(unsigned int coring_number, int fpga_tbl_num, unsigned int chn)
* Table is rather small, so turn off IRQ for the whole duration */
void set_coring_fpga(unsigned int coring_number, ///< [in] 0..99 - function number
int fpga_tbl_num, ///< [in] 0..15 - FPGA table number
unsigned int chn) ///< [in] compressor channel number
{
int i;
unsigned long flags;
x393_cmprs_table_addr_t table_addr;
if (coring_number >= sizeof(coring_tables) / (4 * CORING_SIZE))
......@@ -1010,11 +1009,12 @@ void set_coring_fpga(unsigned int coring_number, int fpga_tbl_num, unsigned int
table_addr.type = TABLE_TYPE_CORING;
table_addr.addr32 = fpga_tbl_num * CORING_SIZE;
local_irq_save(flags);
x393_cmprs_tables_address(table_addr, chn);
for (i = 0; i < CORING_SIZE; i++) {
x393_cmprs_tables_data(coring_tables[coring_number * CORING_SIZE], chn);
x393_cmprs_tables_data(coring_tables[coring_number * CORING_SIZE + i], chn);
}
local_irq_restore(flags);
print_hex_dump_bytes("", DUMP_PREFIX_NONE, &coring_tables[coring_number * CORING_SIZE], CORING_SIZE * 4);
}
......
......@@ -17,7 +17,4 @@
#include "x393.h"
#include "x393_fpga_functions.h"
/*
*/
......@@ -16,3 +16,4 @@
*******************************************************************************/
//typedef enum {DIRECT,ABSOLUTE,RELATIVE} x393cmd_t;
#include "x393.h"
void fpga_table_write_nice (int addr, int len, unsigned long * data);
This diff is collapsed.
......@@ -25,7 +25,11 @@ struct elphel_video_buf_t
};
int setup_sensor_memory (int num_sensor, int window_width, int window_height, int window_left,
int window_top, x393cmd_t x393cmd, int frame16);
int control_sensor_memory (int num_sensor, int cmd, x393cmd_t x393cmd, int frame16);
int setup_compressor_memory (int num_sensor, int window_width, int window_height, int window_left,
int window_top, int tile_width, int tile_height, int tile_vstep,
int extra_pages, int disable_need, x393cmd_t x393cmd, int frame16);
x393cmd_t x393cmd, int frame16);
int control_compressor_memory (int num_sensor, int cmd, int extra_pages, int disable_need, x393cmd_t x393cmd, int frame16);
int frames_in_buffer_minus_one(int num_sensor);
......@@ -269,12 +269,14 @@
#define P_SENSOR_RUN 4 ///< Sensor acquisition mode 0 - stop, 1 - single, 2 - run
#define SENSOR_RUN_STOP 0 ///< Sensor acquisition mode: STOP
#define SENSOR_RUN_SINGLE 1 ///< Sensor acquisition mode: SINGLE FRAME
#define SENSOR_RUN_CONT 2 ///< Sensor acquisition mode: RUN continjuously
#define SENSOR_RUN_CONT 2 ///< Sensor acquisition mode: RUN continuously
#define SENSOR_RUN_RESET 3 ///< Sensor acquisition mode: RESET
#define P_COMPRESSOR_RUN 5 ///< Compressor mode 0 - stop, 1 - single, 2 - run
#define COMPRESSOR_RUN_STOP 0 ///< Compressor mode: STOP
#define COMPRESSOR_RUN_SINGLE 1 ///< Compressor mode: SINGLE
#define COMPRESSOR_RUN_CONT 2 ///< Compressor mode: RUN
#define COMPRESSOR_RUN_RESET 2 ///< Compressor mode: RESET
#define P_BAYER 6 ///< filter number at (0,0) 0-R, 1-G(R), 2-G(B), 3 - B. Write enabled at first, move to WindowSize later
#define P_TRIGGERED 7 ///< when trigger occured - 4 LSBs - pixel in DMA word, higher bits - number of DMA word OBSOLETE
......@@ -343,6 +345,8 @@
#define P_COLOR_SATURATION_RED 55 ///< 100*realtive saturation red
/// Vignetting control, AX*X^2+BX*X+AY*Y^2+BY*Y+C *** 393: These will need to be split for each subchannel
#define VIGNET_SUBCHN_OFFSET 0 ///< for individual per-subchannel vignetting parameters (add num_sub_chn * VIGNET_SUBCHN_OFFSET)
///< set for NC393 when define, meanwhile will use the same for all sub-channels
#define P_VIGNET_AX 56 ///< AX in Vignetting control, AX*X^2+BX*X+AY*Y^2+BY*Y+C. 393: These will need to be split for each subchannel
#define P_VIGNET_AY 57 ///< AY in Vignetting control, AX*X^2+BX*X+AY*Y^2+BY*Y+C. 393: These will need to be split for each subchannel
#define P_VIGNET_BX 58 ///< BX in Vignetting control, AX*X^2+BX*X+AY*Y^2+BY*Y+C. 393: These will need to be split for each subchannel
......
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