diff options
author | Suren A. Chilingaryan <csa@dside.dyndns.org> | 2012-07-24 15:47:34 +0200 |
---|---|---|
committer | Suren A. Chilingaryan <csa@dside.dyndns.org> | 2012-07-24 15:47:34 +0200 |
commit | 8643089a3d39b49115c547c3b9c27c0086754ec5 (patch) | |
tree | d08adf18760325c40cfab8134a8e3b8e9518fbc2 | |
parent | f836cce5a89e5757111c6962bd8fa308d0685959 (diff) | |
download | pcitool-8643089a3d39b49115c547c3b9c27c0086754ec5.tar.gz pcitool-8643089a3d39b49115c547c3b9c27c0086754ec5.tar.bz2 pcitool-8643089a3d39b49115c547c3b9c27c0086754ec5.tar.xz pcitool-8643089a3d39b49115c547c3b9c27c0086754ec5.zip |
Support for new ufodecode and updated register model in ipecamera
-rw-r--r-- | ipecamera/data.c | 4 | ||||
-rw-r--r-- | ipecamera/model.h | 47 | ||||
-rw-r--r-- | ipecamera/private.h | 2 | ||||
-rwxr-xr-x | tests/Reset_Init_all_reg_10bit.sh | 314 | ||||
-rwxr-xr-x | tests/Reset_Init_all_reg_11bit.sh | 309 | ||||
-rwxr-xr-x | tests/Reset_Init_all_reg_12bit.sh | 309 |
6 files changed, 973 insertions, 12 deletions
diff --git a/ipecamera/data.c b/ipecamera/data.c index ff0813c..d753d43 100644 --- a/ipecamera/data.c +++ b/ipecamera/data.c @@ -37,8 +37,8 @@ static int ipecamera_resolve_event_id(ipecamera_t *ctx, pcilib_event_id_t evid) inline static int ipecamera_decode_frame(ipecamera_t *ctx, pcilib_event_id_t event_id) { int err = 0; size_t res; - uint32_t tmp; uint16_t *pixels; + UfoDecoderMeta meta; int buf_ptr = ipecamera_resolve_event_id(ctx, event_id); if (buf_ptr < 0) return PCILIB_ERROR_TIMEOUT; @@ -54,7 +54,7 @@ inline static int ipecamera_decode_frame(ipecamera_t *ctx, pcilib_event_id_t eve pixels = ctx->image + buf_ptr * ctx->image_size; memset(ctx->cmask + ctx->buffer_pos * ctx->dim.height, 0, ctx->dim.height * sizeof(ipecamera_change_mask_t)); - res = ufo_decoder_decode_frame(ctx->ipedec, ctx->buffer + buf_ptr * ctx->padded_size, ctx->raw_size, pixels, &tmp, &tmp, &tmp, ctx->cmask + ctx->buffer_pos * ctx->dim.height); + res = ufo_decoder_decode_frame(ctx->ipedec, ctx->buffer + buf_ptr * ctx->padded_size, ctx->raw_size, pixels, &meta); if (!res) { ctx->frame[buf_ptr].event.image_broken = 1; err = PCILIB_ERROR_FAILED; diff --git a/ipecamera/model.h b/ipecamera/model.h index 31aa01c..3899acc 100644 --- a/ipecamera/model.h +++ b/ipecamera/model.h @@ -75,17 +75,46 @@ pcilib_register_description_t ipecamera_registers[] = { {0x00, 0, 32, 0, 0, PCILIB_REGISTER_RW, PCILIB_REGISTER_STANDARD, PCILIB_REGISTER_BANK1, "spi_conf_input", ""}, {0x10, 0, 32, 0, 0, PCILIB_REGISTER_R, PCILIB_REGISTER_STANDARD, PCILIB_REGISTER_BANK1, "spi_conf_output", ""}, {0x20, 0, 32, 0, 0, PCILIB_REGISTER_RW, PCILIB_REGISTER_STANDARD, PCILIB_REGISTER_BANK1, "spi_clk_speed", ""}, -{0x30, 0, 32, 0, 0, PCILIB_REGISTER_R, PCILIB_REGISTER_STANDARD, PCILIB_REGISTER_BANK1, "firmware_version", ""}, +{0x30, 0, 32, 0, 0, PCILIB_REGISTER_R, PCILIB_REGISTER_STANDARD, PCILIB_REGISTER_BANK1, "firmware_info", ""}, +{0x30, 0, 8, 0, 0, PCILIB_REGISTER_R, PCILIB_REGISTER_BITS, PCILIB_REGISTER_BANK1, "firmware_version", ""}, +{0x30, 8, 1, 0, 0, PCILIB_REGISTER_R, PCILIB_REGISTER_BITS, PCILIB_REGISTER_BANK1, "firmware_bitmode", ""}, +{0x30, 12, 2, 0, 0, PCILIB_REGISTER_R, PCILIB_REGISTER_BITS, PCILIB_REGISTER_BANK1, "adc_resolution", ""}, +{0x30, 16, 2, 0, 0, PCILIB_REGISTER_R, PCILIB_REGISTER_BITS, PCILIB_REGISTER_BANK1, "output_mode", ""}, {0x40, 0, 32, 0, 0, PCILIB_REGISTER_RW, PCILIB_REGISTER_STANDARD, PCILIB_REGISTER_BANK1, "control", ""}, {0x50, 0, 32, 0, 0, PCILIB_REGISTER_R, PCILIB_REGISTER_STANDARD, PCILIB_REGISTER_BANK1, "status", ""}, -{0x60, 0, 16, 0, 0, PCILIB_REGISTER_R, PCILIB_REGISTER_STANDARD, PCILIB_REGISTER_BANK1, "cmosis_temperature", ""}, -{0x70, 0, 32, 0, 0, PCILIB_REGISTER_RW, PCILIB_REGISTER_STANDARD, PCILIB_REGISTER_BANK1, "temperature_sample_timing", ""}, -{0x80, 0, 32, 0, 0, PCILIB_REGISTER_R, PCILIB_REGISTER_STANDARD, PCILIB_REGISTER_BANK1, "start_address", ""}, -{0x90, 0, 32, 0, 0, PCILIB_REGISTER_R, PCILIB_REGISTER_STANDARD, PCILIB_REGISTER_BANK1, "end_address", ""}, -{0x100, 0, 32, 0, 0, PCILIB_REGISTER_R, PCILIB_REGISTER_STANDARD, PCILIB_REGISTER_BANK1, "last_write_address", ""}, -{0x110, 0, 32, 0, 0, PCILIB_REGISTER_R, PCILIB_REGISTER_STANDARD, PCILIB_REGISTER_BANK1, "status3", ""}, -{0x160, 0, 32, 0, 0, PCILIB_REGISTER_R , PCILIB_REGISTER_STANDARD, PCILIB_REGISTER_BANK1, "reg9160", ""}, -{0x170, 0, 32, 0, 0, PCILIB_REGISTER_R , PCILIB_REGISTER_STANDARD, PCILIB_REGISTER_BANK1, "reg9170", ""}, +{0x54, 0, 32, 0, 0, PCILIB_REGISTER_R, PCILIB_REGISTER_STANDARD, PCILIB_REGISTER_BANK1, "status2", ""}, +{0x58, 0, 32, 0, 0, PCILIB_REGISTER_R, PCILIB_REGISTER_STANDARD, PCILIB_REGISTER_BANK1, "status3", ""}, +{0x5c, 0, 32, 0, 0, PCILIB_REGISTER_R, PCILIB_REGISTER_STANDARD, PCILIB_REGISTER_BANK1, "fr_status", ""}, +{0x70, 0, 32, 0, 0, PCILIB_REGISTER_R, PCILIB_REGISTER_STANDARD, PCILIB_REGISTER_BANK1, "start_address", ""}, +{0x74, 0, 32, 0, 0, PCILIB_REGISTER_R, PCILIB_REGISTER_STANDARD, PCILIB_REGISTER_BANK1, "end_address", ""}, +{0x78, 0, 32, 0, 0, PCILIB_REGISTER_R, PCILIB_REGISTER_STANDARD, PCILIB_REGISTER_BANK1, "rd_address", ""}, +{0xa0, 0, 32, 0, 0, PCILIB_REGISTER_R, PCILIB_REGISTER_STANDARD, PCILIB_REGISTER_BANK1, "fr_param1", ""}, +{0xa0, 0, 11, 0, 0, PCILIB_REGISTER_R, PCILIB_REGISTER_BITS, PCILIB_REGISTER_BANK1, "fr_skip_lines", ""}, +{0xa0, 11, 11, 0, 0, PCILIB_REGISTER_R, PCILIB_REGISTER_BITS, PCILIB_REGISTER_BANK1, "fr_num_lines", ""}, +{0xa0, 22, 10, 0, 0, PCILIB_REGISTER_R, PCILIB_REGISTER_BITS, PCILIB_REGISTER_BANK1, "fr_start_address", ""}, +{0xb0, 0, 32, 0, 0, PCILIB_REGISTER_RW, PCILIB_REGISTER_STANDARD, PCILIB_REGISTER_BANK1, "fr_param2", ""}, +{0xa0, 0, 11, 0, 0, PCILIB_REGISTER_RW, PCILIB_REGISTER_BITS, PCILIB_REGISTER_BANK1, "fr_threshold_lines", ""}, +{0xc0, 0, 32, 0, 0, PCILIB_REGISTER_R, PCILIB_REGISTER_STANDARD, PCILIB_REGISTER_BANK1, "skiped_lines", ""}, +{0x100, 0, 32, 0, 0, PCILIB_REGISTER_RW, PCILIB_REGISTER_STANDARD, PCILIB_REGISTER_BANK1, "rawdata_pkt_addr", ""}, +{0x110, 0, 32, 0, 0, PCILIB_REGISTER_R, PCILIB_REGISTER_STANDARD, PCILIB_REGISTER_BANK1, "temperature_info", ""}, +{0x110, 0, 19, 0, 0, PCILIB_REGISTER_R, PCILIB_REGISTER_BITS, PCILIB_REGISTER_BANK1, "sensor_temperature", ""}, +{0x110, 19, 10, 0, 0, PCILIB_REGISTER_R, PCILIB_REGISTER_BITS, PCILIB_REGISTER_BANK1, "fpga_temperature", ""}, +{0x110, 29, 3, 0, 0, PCILIB_REGISTER_R, PCILIB_REGISTER_BITS, PCILIB_REGISTER_BANK1, "temperature_alarms", ""}, +{0x120, 0, 32, 0, 0, PCILIB_REGISTER_R, PCILIB_REGISTER_STANDARD, PCILIB_REGISTER_BANK1, "copy_num_lines", ""}, +{0x130, 0, 32, 0, 0, PCILIB_REGISTER_R, PCILIB_REGISTER_STANDARD, PCILIB_REGISTER_BANK1, "copy_start_line", ""}, +{0x140, 0, 32, 0, 0, PCILIB_REGISTER_R, PCILIB_REGISTER_STANDARD, PCILIB_REGISTER_BANK1, "copy_exp_time", ""}, +{0x150, 0, 32, 0, 0, PCILIB_REGISTER_RW, PCILIB_REGISTER_STANDARD, PCILIB_REGISTER_BANK1, "motor", ""}, +{0x150, 0, 5, 0, 0, PCILIB_REGISTER_RW, PCILIB_REGISTER_BITS, PCILIB_REGISTER_BANK1, "motor_phi", ""}, +{0x150, 5, 5, 0, 0, PCILIB_REGISTER_RW, PCILIB_REGISTER_BITS, PCILIB_REGISTER_BANK1, "motor_z", ""}, +{0x150, 10, 5, 0, 0, PCILIB_REGISTER_RW, PCILIB_REGISTER_BITS, PCILIB_REGISTER_BANK1, "motor_y", ""}, +{0x150, 15, 5, 0, 0, PCILIB_REGISTER_RW, PCILIB_REGISTER_BITS, PCILIB_REGISTER_BANK1, "motor_x", ""}, +{0x150, 20, 8, 0, 0, PCILIB_REGISTER_R, PCILIB_REGISTER_BITS, PCILIB_REGISTER_BANK1, "copy_adc_gain", ""}, +{0x160, 0, 32, 0, 0, PCILIB_REGISTER_R, PCILIB_REGISTER_STANDARD, PCILIB_REGISTER_BANK1, "write_status", ""}, +{0x170, 0, 32, 0, 0, PCILIB_REGISTER_RW, PCILIB_REGISTER_STANDARD, PCILIB_REGISTER_BANK1, "num_triggers", ""}, +{0x180, 0, 32, 0x280, 0, PCILIB_REGISTER_RW, PCILIB_REGISTER_STANDARD, PCILIB_REGISTER_BANK1, "trigger_period", ""}, +{0x190, 0, 32, 0, 0, PCILIB_REGISTER_R, PCILIB_REGISTER_STANDARD, PCILIB_REGISTER_BANK1, "temperature_sample_period", ""}, +{0x1a0, 0, 32, 0x64, 0, PCILIB_REGISTER_RW, PCILIB_REGISTER_STANDARD, PCILIB_REGISTER_BANK1, "max_frames", ""}, +{0x1b0, 0, 32, 0, 0, PCILIB_REGISTER_R, PCILIB_REGISTER_STANDARD, PCILIB_REGISTER_BANK1, "num_frames", ""}, {0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL} }; diff --git a/ipecamera/private.h b/ipecamera/private.h index 34eb99a..a0fb4e4 100644 --- a/ipecamera/private.h +++ b/ipecamera/private.h @@ -55,7 +55,7 @@ typedef struct { struct ipecamera_s { pcilib_context_t event; - ufo_decoder ipedec; + UfoDecoder *ipedec; char *data; ipecamera_pixel_t *image; diff --git a/tests/Reset_Init_all_reg_10bit.sh b/tests/Reset_Init_all_reg_10bit.sh new file mode 100755 index 0000000..9c7e6b8 --- /dev/null +++ b/tests/Reset_Init_all_reg_10bit.sh @@ -0,0 +1,314 @@ +#!/bin/bash + +###################### by Michele Caselle and Uros Stafanovic ################################################## +############ Resent procedure and camera initialization for 10 -bit mode ###################################### + +error=0 +echo " Reset Readout and CMOSIS " +pci -w 0x9040 204 +sleep .1 +#echo " Release Reset for Readout" +#pci -w 0x9040 1e0 +sleep .1 +##################### PLL SET ##################################### +val=f501 +pci -w 0x9000 $val +sleep 0.01 +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "b$val" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val" + error=1 + # exit +fi +sleep 0.01 +echo " Start CMOSIS Configuration .." +pci -w 0x9000 f301 +sleep 0.01 +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "bf301" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val" + error=1 + # exit +fi +sleep 0.01 +val=d207 +pci -w 0x9000 $val +sleep 0.01 +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "b$val" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val" + error=1 + # exit +fi +sleep 0.01 + +# Michele 10 - 12 bit mode # +# ################################################################################################### +echo " 10 - bit mode, set Bit_mode " +val=ef00 ###################################################### +pci -w 0x9000 $val +sleep 0.01 +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "b$val" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val" + error=1 + # exit +fi +sleep 0.01 +# Michele set ADC_resolution @ 12 bits +echo " 10 bit mode, set ADC resolution 10 bits " +val=f000 # qui for 10 - 11 - 12 bits ######################################################## +pci -w 0x9000 $val +sleep 0.01 +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "b$val" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val" + error=1 + # exit +fi +sleep 0.01 + +# adc recommended 28=44 +val=e72c +pci -w 0x9000 $val +sleep 0.01 +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "b$val" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val " + error=1 + # exit +fi +sleep 0.01 +# #################################################################################################### + +################# CAMERA CONFIGURATION ############################################ +val=e603 +pci -w 0x9000 $val +sleep 0.01 +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "b$val" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val" + error=1 + # exit +fi +sleep 0.01 + +val=d404 +pci -w 0x9000 $val +sleep 0.01 +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "b$val" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val" + error=1 + # exit +fi +sleep 0.01 +val=d501 +pci -w 0x9000 $val +sleep 0.01 +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "b$val" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val" + error=1 + # exit +fi +sleep 0.01 +# recommended is d840 +val=d840 +pci -w 0x9000 $val +sleep 0.01 +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "b$val" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val" + error=1 + # exit +fi +# sleep 0.01 +# recommended is db40 +val=db40 +pci -w 0x9000 $val +sleep 0.01 +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "b$val" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val" + error=1 + # exit +fi +sleep 0.01 +val=de65 +# val=de0 +pci -w 0x9000 $val +sleep 0.01 +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "b$val" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val" + error=1 + # exit +fi +sleep 0.01 +sleep 0.01 +val=df6a +pci -w 0x9000 $val +sleep 0.01 +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "b$val" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val" + error=1 + # exit +fi +sleep 0.01 +echo " End CMOSIS Configuration .." +######################################################################################################## +echo " Write exp time......" + +######################################### EXP TIME ####################################################### +val=aa25 +pci -w 0x9000 $val +sleep 0.01 +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "b$val" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val" + error=1 + # exit +fi +sleep 0.01 +# val=ab2c +val=ab00 +pci -w 0x9000 $val +sleep 0.01 +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "b$val" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val" + error=1 + # exit +fi +sleep 0.01 +# val=acaa +val=ac00 +pci -w 0x9000 $val +sleep 0.01 +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "b$val" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val" + error=1 + # exit +fi +#################################################################################################################### + +sleep 0.01 +#pci -w 0x9040 201 +sleep 0.01 +########################## WRITE THE READOUT NUMBER OF LINE ####################################################### +pci -w number_lines 1088 +#pci -w number_lines 8 +sleep 0.01 +################################################################################################################# +pci --start-dma dma1 +sleep 0.01 +#VRAMP 6c is 108 +val=e26c +pci -w 0x9000 $val +sleep 0.01 +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "b$val" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val" + error=1 + # exit +fi +sleep 0.01 +#VRAMP 6c is 108 +val=e36c +pci -w 0x9000 $val +sleep 0.01 +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "b$val" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val" + error=1 + # exit +fi +sleep 0.01 +###################################### NUMBER OF OUTPUT ############################################################ +##pci -w 0x9000 0xc803 +sleep 0.01 +val=c800 +pci -w 0x9000 $val +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "b$val" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val" + error=1 + # exit +fi +#pci -r 0x9000 -s 10 + +sleep 0.01 +#pci -w 0x9000 0xd011 +sleep 0.01 +#pci -r 0x9000 -s 10 + +sleep 0.01 +#pci -w 0x9000 0xd111 +######################################################################################################### +sleep 0.01 + +#echo " Reset Readout and CMOSIS " +pci -w 0x9040 0x204 +sleep .1 +echo " Release Reset for Readout" +pci -w 0x9040 0x201 +sleep .1 + +status=`pci -r 0x9050 -s 4 | awk '{print $2$3$4}'` +if [ "$status" != "8449ffff0f0010013ffff111" ]; then + echo "--------------------------------->>>> ERROR! in the camera status ... " + error=1 + # exit +fi + +#echo "--> $status" + +if [ "$error" = "1" ]; then + echo " Error in the reset and initialization" +else + echo " Camera READY ........................... OK" +fi +echo + + diff --git a/tests/Reset_Init_all_reg_11bit.sh b/tests/Reset_Init_all_reg_11bit.sh new file mode 100755 index 0000000..5d78f24 --- /dev/null +++ b/tests/Reset_Init_all_reg_11bit.sh @@ -0,0 +1,309 @@ +#!/bin/bash + +###################### by Michele Caselle and Uros Stafanovic ################################################## +############ Resent procedure and camera initialization for 12 -bit mode ###################################### + +error=0 +echo " Reset Readout and CMOSIS " +pci -w 0x9040 1e4 +sleep .1 +echo " Release Reset for Readout" +pci -w 0x9040 1e0 +sleep .1 +##################### PLL SET ##################################### +val=f501 +pci -w 0x9000 $val +sleep 0.01 +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "b$val" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val" + error =1 + # exit +fi +sleep 0.01 +echo " Start CMOSIS Configuration .." +pci -w 0x9000 f301 +sleep 0.01 +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "bf301" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val" + error =1 + # exit +fi +sleep 0.01 +val=d207 +pci -w 0x9000 $val +sleep 0.01 +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "b$val" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val" + error =1 + # exit +fi +sleep 0.01 + +# Michele 10 - 12 bit mode # +# ################################################################################################### +echo " 11 - bit mode, set Bit_mode " +val=ef00 ###################################################### +pci -w 0x9000 $val +sleep 0.01 +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "b$val" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val" + error =1 + # exit +fi +sleep 0.01 +# Michele set ADC_resolution @ 12 bits +echo " 11 bit mode, set ADC resolution 11 bits " +val=f001 # qui for 10 - 11 - 12 bits ######################################################## +pci -w 0x9000 $val +sleep 0.01 +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "b$val" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val" + error =1 + # exit +fi +sleep 0.01 + +# adc recommended 28=44 +val=e72c +pci -w 0x9000 $val +sleep 0.01 +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "b$val" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val " + error =1 + # exit +fi +sleep 0.01 +# #################################################################################################### + +################# CAMERA CONFIGURATION ############################################ +val=e603 +pci -w 0x9000 $val +sleep 0.01 +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "b$val" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val" + error =1 + # exit +fi +sleep 0.01 + +val=d404 +pci -w 0x9000 $val +sleep 0.01 +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "b$val" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val" + error =1 + # exit +fi +sleep 0.01 +val=d501 +pci -w 0x9000 $val +sleep 0.01 +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "b$val" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val" + error =1 + # exit +fi +sleep 0.01 +# recommended is d840 +val=d840 +pci -w 0x9000 $val +sleep 0.01 +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "b$val" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val" + error =1 + # exit +fi +# sleep 0.01 +# recommended is db40 +val=db40 +pci -w 0x9000 $val +sleep 0.01 +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "b$val" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val" + error =1 + # exit +fi +sleep 0.01 +val=de65 +# val=de0 +pci -w 0x9000 $val +sleep 0.01 +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "b$val" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val" + error =1 + # exit +fi +sleep 0.01 +sleep 0.01 +val=df6a +pci -w 0x9000 $val +sleep 0.01 +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "b$val" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val" + error =1 + # exit +fi +sleep 0.01 +echo " End CMOSIS Configuration .." +######################################################################################################## +echo " Write exp time......" + +######################################### EXP TIME ####################################################### +val=aa25 +pci -w 0x9000 $val +sleep 0.01 +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "b$val" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val" + error =1 + # exit +fi +sleep 0.01 +# val=ab2c +val=ab02 +pci -w 0x9000 $val +sleep 0.01 +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "b$val" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val" + error =1 + # exit +fi +sleep 0.01 +# val=acaa +val=ac00 +pci -w 0x9000 $val +sleep 0.01 +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "b$val" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val" + error =1 + # exit +fi +#################################################################################################################### + +sleep 0.01 +pci -w 0x9040 201 +sleep 0.01 +########################## WRITE THE READOUT NUMBER OF LINE ####################################################### +pci -w number_lines 1088 +#pci -w number_lines 8 +sleep 0.01 +################################################################################################################# +pci --start-dma dma1 +sleep 0.01 +#VRAMP 6c is 108 +val=e26c +pci -w 0x9000 $val +sleep 0.01 +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "b$val" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val" + error =1 + # exit +fi +sleep 0.01 +#VRAMP 6c is 108 +val=e36c +pci -w 0x9000 $val +sleep 0.01 +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "b$val" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val" + error =1 + # exit +fi +sleep 0.01 +######################################################################################################## +#pci -w 0x9000 0xc802 +##pci -w 0x9000 0xc803 +sleep 0.01 +val=c802 +pci -w 0x9000 $val +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "b$val" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val" + error =1 + # exit +fi +#pci -r 0x9000 -s 10 + +sleep 0.01 +#pci -w 0x9000 0xd011 +sleep 0.01 +#pci -r 0x9000 -s 10 + +sleep 0.01 +#pci -w 0x9000 0xd111 +#pci -r 0x9000 -s 10 +######################################################################################################### +sleep 0.01 + +status=`pci -r 0x9050 -s 4 | awk '{print $2$3$4}'` +if [ "$status" != "8449ffff0f0010013ffff111" ]; then + echo "--------------------------------->>>> ERROR! in the camera status ... " + error =1 + # exit +fi + +#echo "--> $status" + +if [ "$error" = "1" ]; then + echo " Error in the resetand initialization" +else + echo " Camera READY ........ OK" +fi +echo + + diff --git a/tests/Reset_Init_all_reg_12bit.sh b/tests/Reset_Init_all_reg_12bit.sh new file mode 100755 index 0000000..b14e5c9 --- /dev/null +++ b/tests/Reset_Init_all_reg_12bit.sh @@ -0,0 +1,309 @@ +#!/bin/bash + +###################### by Michele Caselle and Uros Stafanovic ################################################## +############ Resent procedure and camera initialization for 12 -bit mode ###################################### + +error=0 +echo " Reset Readout and CMOSIS " +pci -w 0x9040 1e4 +sleep .1 +echo " Release Reset for Readout" +pci -w 0x9040 1e0 +sleep .1 +##################### PLL SET ##################################### +val=f501 +pci -w 0x9000 $val +sleep 0.01 +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "b$val" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val" + error =1 + # exit +fi +sleep 0.01 +echo " Start CMOSIS Configuration .." +pci -w 0x9000 f301 +sleep 0.01 +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "bf301" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val" + error =1 + # exit +fi +sleep 0.01 +val=d207 +pci -w 0x9000 $val +sleep 0.01 +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "b$val" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val" + error =1 + # exit +fi +sleep 0.01 + +# Michele 10 - 12 bit mode # +# ################################################################################################### +echo " 12 - bit mode, set Bit_mode " +val=ef00 ###################################################### +pci -w 0x9000 $val +sleep 0.01 +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "b$val" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val" + error =1 + # exit +fi +sleep 0.01 +# Michele set ADC_resolution @ 12 bits +echo " 12 bit mode, set ADC resolution 12 bits " +val=f002 # qui for 10 - 11 - 12 bits ######################################################## +pci -w 0x9000 $val +sleep 0.01 +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "b$val" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val" + error =1 + # exit +fi +sleep 0.01 + +# adc recommended 28=44 +val=e72c +pci -w 0x9000 $val +sleep 0.01 +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "b$val" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val " + error =1 + # exit +fi +sleep 0.01 +# #################################################################################################### + +################# CAMERA CONFIGURATION ############################################ +val=e603 +pci -w 0x9000 $val +sleep 0.01 +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "b$val" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val" + error =1 + # exit +fi +sleep 0.01 + +val=d404 +pci -w 0x9000 $val +sleep 0.01 +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "b$val" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val" + error =1 + # exit +fi +sleep 0.01 +val=d501 +pci -w 0x9000 $val +sleep 0.01 +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "b$val" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val" + error =1 + # exit +fi +sleep 0.01 +# recommended is d840 +val=d840 +pci -w 0x9000 $val +sleep 0.01 +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "b$val" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val" + error =1 + # exit +fi +# sleep 0.01 +# recommended is db40 +val=db40 +pci -w 0x9000 $val +sleep 0.01 +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "b$val" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val" + error =1 + # exit +fi +sleep 0.01 +val=de65 +# val=de0 +pci -w 0x9000 $val +sleep 0.01 +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "b$val" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val" + error =1 + # exit +fi +sleep 0.01 +sleep 0.01 +val=df6a +pci -w 0x9000 $val +sleep 0.01 +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "b$val" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val" + error =1 + # exit +fi +sleep 0.01 +echo " End CMOSIS Configuration .." +######################################################################################################## +echo " Write exp time......" + +######################################### EXP TIME ####################################################### +val=aa01 +pci -w 0x9000 $val +sleep 0.01 +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "b$val" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val" + error =1 + # exit +fi +sleep 0.01 +# val=ab2c +val=ab00 +pci -w 0x9000 $val +sleep 0.01 +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "b$val" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val" + error =1 + # exit +fi +sleep 0.01 +# val=acaa +val=ac00 +pci -w 0x9000 $val +sleep 0.01 +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "b$val" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val" + error =1 + # exit +fi +#################################################################################################################### + +sleep 0.01 +pci -w 0x9040 201 +sleep 0.01 +########################## WRITE THE READOUT NUMBER OF LINE ####################################################### +pci -w number_lines 1088 +#pci -w number_lines 8 +sleep 0.01 +################################################################################################################# +pci --start-dma dma1 +sleep 0.01 +#VRAMP 6c is 108 +val=e26c +pci -w 0x9000 $val +sleep 0.01 +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "b$val" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val" + error =1 + # exit +fi +sleep 0.01 +#VRAMP 6c is 108 +val=e36c +pci -w 0x9000 $val +sleep 0.01 +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "b$val" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val" + error =1 + # exit +fi +sleep 0.01 +######################################################################################################## +#pci -w 0x9000 0xc802 +##pci -w 0x9000 0xc803 +sleep 0.01 +val=c802 +pci -w 0x9000 $val +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "b$val" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val" + error =1 + # exit +fi +#pci -r 0x9000 -s 10 + +sleep 0.01 +#pci -w 0x9000 0xd011 +sleep 0.01 +#pci -r 0x9000 -s 10 + +sleep 0.01 +#pci -w 0x9000 0xd111 +#pci -r 0x9000 -s 10 +######################################################################################################### +sleep 0.01 + +status=`pci -r 0x9050 -s 4 | awk '{print $2$3$4}'` +if [ "$status" != "8449ffff0f0010013ffff111" ]; then + echo "--------------------------------->>>> ERROR! in the camera status ... " + error =1 + # exit +fi + +#echo "--> $status" + +if [ "$error" = "1" ]; then + echo " Error in the resetand initialization" +else + echo " Camera READY ........ OK" +fi +echo + + |