diff --git a/software/scripts/axiom_i2c.func b/software/scripts/axiom_i2c.func index 691f8899..72414bd3 100644 --- a/software/scripts/axiom_i2c.func +++ b/software/scripts/axiom_i2c.func @@ -1,15 +1,15 @@ #!/bin/bash -axiom_i2c_test() { +i2c_test() { i2cget -y 0 $1 >/dev/null 2>&1 } -axiom_i2c_get() { +i2c_get() { i2cget -y 0 $1 $2 # i2cget -y 1 $1 $2 } -axiom_i2c_get_w() { +i2c_get_w() { val=`i2cget -y 0 $1 $2 w` vhb=$(( val & 0xFF )) vlb=$(( val >> 8 )) @@ -17,47 +17,47 @@ axiom_i2c_get_w() { # i2cget -y 1 $1 $2 } -axiom_i2c_set() { +i2c_set() { i2cset -y 0 $1 $2 $3 # i2cset -y 1 $1 $2 $3 } -axiom_i2c_bit_get() { - val=`axiom_i2c_get $1 $2` +i2c_bit_get() { + val=`i2c_get $1 $2` msk=`bit_msk $3` bit=$(( (val & msk) >> $3 )) printf "%d" $bit return $bit } -axiom_i2c_bit_set() { - val=`axiom_i2c_get $1 $2` +i2c_bit_set() { + val=`i2c_get $1 $2` msk=`bit_msk $3` val=$(( val | msk )) - axiom_i2c_set $1 $2 $val + i2c_set $1 $2 $val } -axiom_i2c_bit_clr() { - val=`axiom_i2c_get $1 $2` +i2c_bit_clr() { + val=`i2c_get $1 $2` msk=`bit_msk $3` val=$(( val & ~msk )) - axiom_i2c_set $1 $2 $val + i2c_set $1 $2 $val } -axiom_i2c_map() { - val=`axiom_i2c_get $1 $2` +i2c_map() { + val=`i2c_get $1 $2` val=`bit_map $val $3 $4 $5` - axiom_i2c_set $1 $2 $val + i2c_set $1 $2 $val } -axiom_i2c_bit() { +i2c_bit() { [ -n "$4" ] && \ - axiom_i2c_map $1 $2 $3 $3 $4 || - axiom_i2c_bit_get $1 $2 $3 + i2c_map $1 $2 $3 $3 $4 || + i2c_bit_get $1 $2 $3 } -axiom_i2c_mbv() { - val=`axiom_i2c_get $1 $2` +i2c_mbv() { + val=`i2c_get $1 $2` msk=`bit_msk $3 $4` val=$(( (val & msk) >> $3 )) printf "%d" $val diff --git a/software/scripts/axiom_i2c0.func b/software/scripts/axiom_i2c0.func index b37d072e..2bbc374f 100644 --- a/software/scripts/axiom_i2c0.func +++ b/software/scripts/axiom_i2c0.func @@ -1,58 +1,58 @@ #!/bin/bash -axiom_i2c0_get() { +i2c0_get() { i2cget -y 0 $1 $2 } -axiom_i2c0_set() { +i2c0_set() { i2cset -y 0 $1 $2 $3 } -axiom_i2c0_getw() { +i2c0_getw() { i2cget -y 0 $1 $2 w } -axiom_i2c0_setw() { +i2c0_setw() { i2cset -y 0 $1 $2 $3 w } -axiom_i2c0_bit_get() { - val=`axiom_i2c0_get $1 $2` +i2c0_bit_get() { + val=`i2c0_get $1 $2` msk=`bit_msk $3` bit=$(( (val & msk) >> $3 )) printf "%d" $bit return $bit } -axiom_i2c0_bit_set() { - val=`axiom_i2c0_get $1 $2` +i2c0_bit_set() { + val=`i2c0_get $1 $2` msk=`bit_msk $3` val=$(( val | msk )) - axiom_i2c0_set $1 $2 $val + i2c0_set $1 $2 $val } -axiom_i2c0_bit_clr() { - val=`axiom_i2c0_get $1 $2` +i2c0_bit_clr() { + val=`i2c0_get $1 $2` msk=`bit_msk $3` val=$(( val & ~msk )) - axiom_i2c0_set $1 $2 $val + i2c0_set $1 $2 $val } -axiom_i2c0_map() { - val=`axiom_i2c0_get $1 $2` +i2c0_map() { + val=`i2c0_get $1 $2` val=`bit_map $val $3 $4 $5` - axiom_i2c0_set $1 $2 $val + i2c0_set $1 $2 $val } -axiom_i2c0_bit() { +i2c0_bit() { [ -n "$4" ] && \ - axiom_i2c0_map $1 $2 $3 $3 $4 || - axiom_i2c0_bit_get $1 $2 $3 + i2c0_map $1 $2 $3 $3 $4 || + i2c0_bit_get $1 $2 $3 } -axiom_i2c0_mbv() { - val=`axiom_i2c0_get $1 $2` +i2c0_mbv() { + val=`i2c0_get $1 $2` msk=`bit_msk $3 $4` val=$(( (val & msk) >> $3 )) printf "%d" $val diff --git a/software/scripts/axiom_i2c1.func b/software/scripts/axiom_i2c1.func index df14a51b..a82717a0 100644 --- a/software/scripts/axiom_i2c1.func +++ b/software/scripts/axiom_i2c1.func @@ -1,57 +1,57 @@ #!/bin/bash -axiom_i2c1_get() { +i2c1_get() { i2cget -y 1 $1 $2 } -axiom_i2c1_set() { +i2c1_set() { i2cset -y 1 $1 $2 $3 } -axiom_i2c1_getw() { +i2c1_getw() { i2cget -y 1 $1 $2 w } -axiom_i2c1_setw() { +i2c1_setw() { i2cset -y 1 $1 $2 $3 w } -axiom_i2c1_bit_get() { - val=`axiom_i2c1_get $1 $2` +i2c1_bit_get() { + val=`i2c1_get $1 $2` msk=`bit_msk $3` bit=$(( (val & msk) >> $3 )) printf "%d" $bit return $bit } -axiom_i2c1_bit_set() { - val=`axiom_i2c1_get $1 $2` +i2c1_bit_set() { + val=`i2c1_get $1 $2` msk=`bit_msk $3` val=$(( val | msk )) - axiom_i2c1_set $1 $2 $val + i2c1_set $1 $2 $val } -axiom_i2c1_bit_clr() { - val=`axiom_i2c1_get $1 $2` +i2c1_bit_clr() { + val=`i2c1_get $1 $2` msk=`bit_msk $3` val=$(( val & ~msk )) - axiom_i2c1_set $1 $2 $val + i2c1_set $1 $2 $val } -axiom_i2c1_map() { - val=`axiom_i2c1_get $1 $2` +i2c1_map() { + val=`i2c1_get $1 $2` val=`bit_map $val $3 $4 $5` - axiom_i2c1_set $1 $2 $val + i2c1_set $1 $2 $val } -axiom_i2c1_bit() { +i2c1_bit() { [ -n "$4" ] && \ - axiom_i2c1_map $1 $2 $3 $3 $4 || - axiom_i2c1_bit_get $1 $2 $3 + i2c1_map $1 $2 $3 $3 $4 || + i2c1_bit_get $1 $2 $3 } -axiom_i2c1_mbv() { - val=`axiom_i2c1_get $1 $2` +i2c1_mbv() { + val=`i2c1_get $1 $2` msk=`bit_msk $3 $4` val=$(( (val & msk) >> $3 )) printf "%d" $val diff --git a/software/scripts/axiom_i2c2.func b/software/scripts/axiom_i2c2.func index 3f6ae5e6..bd50b4da 100644 --- a/software/scripts/axiom_i2c2.func +++ b/software/scripts/axiom_i2c2.func @@ -1,49 +1,49 @@ #!/bin/bash -axiom_i2c2_get() { +i2c2_get() { i2cget -y 2 $@ } -axiom_i2c2_set() { +i2c2_set() { i2cset -y 2 $@ } -axiom_i2c2_bit_get() { - local val=`axiom_i2c2_get $1 $2` +i2c2_bit_get() { + local val=`i2c2_get $1 $2` local msk=`bit_msk $3` local bit=$(( (val & msk) >> $3 )) printf "%d" $bit return $bit } -axiom_i2c2_bit_set() { +i2c2_bit_set() { local val=`axiom i2c2_get $1 $2` local msk=`bit_msk $3` val=$(( val | msk )) - axiom_i2c2_set $1 $2 $val + i2c2_set $1 $2 $val } -axiom_i2c2_bit_clr() { - local val=`axiom_i2c2_get $1 $2` +i2c2_bit_clr() { + local val=`i2c2_get $1 $2` local msk=`bit_msk $3` val=$(( val & ~msk )) - axiom_i2c2_set $1 $2 $val + i2c2_set $1 $2 $val } -axiom_i2c2_map() { - local val=`axiom_i2c2_get $1 $2` +i2c2_map() { + local val=`i2c2_get $1 $2` val=`bit_map $val $3 $4 $5` - axiom_i2c2_set $1 $2 $val + i2c2_set $1 $2 $val } -axiom_i2c2_bit() { +i2c2_bit() { [ -n "$4" ] && \ - axiom_i2c2_map $1 $2 $3 $3 $4 || - axiom_i2c2_bit_get $1 $2 $3 + i2c2_map $1 $2 $3 $3 $4 || + i2c2_bit_get $1 $2 $3 } -axiom_i2c2_mbv() { - local val=`axiom_i2c2_get $1 $2` +i2c2_mbv() { + local val=`i2c2_get $1 $2` local msk=`bit_msk $3 $4` val=$(( (val & msk) >> $3 )) printf "%d" $val diff --git a/software/scripts/axiom_mclr_h.sh b/software/scripts/axiom_mclr_h.sh index 5cc6db81..7781aa38 100755 --- a/software/scripts/axiom_mclr_h.sh +++ b/software/scripts/axiom_mclr_h.sh @@ -1,2 +1,2 @@ #!/bin/bash -axiom_i2c_set 0x22 0x14 0x1F +i2c_set 0x22 0x14 0x1F diff --git a/software/scripts/axiom_mclr_l.sh b/software/scripts/axiom_mclr_l.sh index 513bdf0a..babf08e0 100755 --- a/software/scripts/axiom_mclr_l.sh +++ b/software/scripts/axiom_mclr_l.sh @@ -1,2 +1,2 @@ #!/bin/bash -axiom_i2c_set 0x22 0x14 0x0F +i2c_set 0x22 0x14 0x0F diff --git a/software/scripts/axiom_pac1720_info.sh b/software/scripts/axiom_pac1720_info.sh index 51fcbc9b..c9d10d38 100755 --- a/software/scripts/axiom_pac1720_info.sh +++ b/software/scripts/axiom_pac1720_info.sh @@ -10,20 +10,20 @@ VS2l=("BETA_5V" "PCIE_N_V" "PCIE_S_V" "IOW_V" "IOE_V" "VCCO_13" "VCCO_34" "N_VW" for i in `seq 1 ${#PACn[*]}`; do n=$[i-1] ID="${PACn[$n]}" - axiom_i2c_test $ID || continue + i2c_test $ID || continue - axiom_i2c_set $ID 0x0A 0xFF # 20ms sample, average 8 - axiom_i2c_set $ID 0x0B 0xFF # 320ms sample, average 8, 80mV - axiom_i2c_set $ID 0x0C 0xFF # 320ms sample, average 8, 80mV + i2c_set $ID 0x0A 0xFF # 20ms sample, average 8 + i2c_set $ID 0x0B 0xFF # 320ms sample, average 8, 80mV + i2c_set $ID 0x0C 0xFF # 320ms sample, average 8, 80mV - VV1i=$[ (`axiom_i2c_get $ID 0x11` << 8) | `axiom_i2c_get $ID 0x12` ] - VV2i=$[ (`axiom_i2c_get $ID 0x13` << 8) | `axiom_i2c_get $ID 0x14` ] + VV1i=$[ (`i2c_get $ID 0x11` << 8) | `i2c_get $ID 0x12` ] + VV2i=$[ (`i2c_get $ID 0x13` << 8) | `i2c_get $ID 0x14` ] VV1f=`dc -e "5k $VV1i 20 * 32768 / p"` VV2f=`dc -e "5k $VV2i 20 * 32768 / p"` - VS1i=$[ (`axiom_i2c_get $ID 0x0D` << 4) | (`axiom_i2c_get $ID 0x0E` >> 4) ] - VS2i=$[ (`axiom_i2c_get $ID 0x0F` << 4) | (`axiom_i2c_get $ID 0x10` >> 4) ] + VS1i=$[ (`i2c_get $ID 0x0D` << 4) | (`i2c_get $ID 0x0E` >> 4) ] + VS2i=$[ (`i2c_get $ID 0x0F` << 4) | (`i2c_get $ID 0x10` >> 4) ] [ $VS1i -ge 2048 ] && VS1v=$[ $VS1i - 4096 ] || VS1v=$VS1i [ $VS2i -ge 2048 ] && VS2v=$[ $VS2i - 4096 ] || VS2v=$VS2i diff --git a/software/scripts/axiom_power_init.sh b/software/scripts/axiom_power_init.sh index 41aff50c..d76691da 100755 --- a/software/scripts/axiom_power_init.sh +++ b/software/scripts/axiom_power_init.sh @@ -1,26 +1,26 @@ #!/bin/bash for id in 0x20 0x21; do - axiom_i2c_test $id || continue + i2c_test $id || continue - axiom_i2c_set $id 0x00 0x55 - axiom_i2c_set $id 0x01 0x55 + i2c_set $id 0x00 0x55 + i2c_set $id 0x01 0x55 - axiom_i2c_set $id 0x0c 0xAA - axiom_i2c_set $id 0x0d 0xAA + i2c_set $id 0x0c 0xAA + i2c_set $id 0x0d 0xAA - axiom_i2c_set $id 0x14 0x00 - axiom_i2c_set $id 0x15 0x00 + i2c_set $id 0x14 0x00 + i2c_set $id 0x15 0x00 done for id in 0x22 0x23; do - axiom_i2c_test $id || continue + i2c_test $id || continue - axiom_i2c_set $id 0x00 0xA5 - axiom_i2c_set $id 0x01 0xC3 + i2c_set $id 0x00 0xA5 + i2c_set $id 0x01 0xC3 - axiom_i2c_set $id 0x0c 0x5A - axiom_i2c_set $id 0x0d 0x3C + i2c_set $id 0x0c 0x5A + i2c_set $id 0x0d 0x3C - axiom_i2c_set $id 0x14 0x00 - axiom_i2c_set $id 0x15 0x00 + i2c_set $id 0x14 0x00 + i2c_set $id 0x15 0x00 done diff --git a/software/scripts/axiom_power_off.sh b/software/scripts/axiom_power_off.sh index 4acf3130..3ef5ddc5 100755 --- a/software/scripts/axiom_power_off.sh +++ b/software/scripts/axiom_power_off.sh @@ -1,8 +1,8 @@ #!/bin/bash for id in 0x20 0x21 0x22 0x23; do - axiom_i2c_test $id || continue + i2c_test $id || continue - axiom_i2c_set $id 0x14 0x00 - axiom_i2c_set $id 0x15 0x00 + i2c_set $id 0x14 0x00 + i2c_set $id 0x15 0x00 done diff --git a/software/scripts/axiom_power_on.sh b/software/scripts/axiom_power_on.sh index 54e4e060..6ea9d71b 100755 --- a/software/scripts/axiom_power_on.sh +++ b/software/scripts/axiom_power_on.sh @@ -1,15 +1,15 @@ #!/bin/bash for id in 0x20 0x21; do - axiom_i2c_test $id || continue + i2c_test $id || continue - axiom_i2c_set $id 0x14 0xFF - axiom_i2c_set $id 0x15 0xFF + i2c_set $id 0x14 0xFF + i2c_set $id 0x15 0xFF done for id in 0x22 0x23; do - axiom_i2c_test $id || continue + i2c_test $id || continue - axiom_i2c_set $id 0x14 0x4F - axiom_i2c_set $id 0x15 0x3C + i2c_set $id 0x14 0x4F + i2c_set $id 0x15 0x3C done diff --git a/software/scripts/axiom_power_sensor_off.sh b/software/scripts/axiom_power_sensor_off.sh index d7752dcd..31747b43 100755 --- a/software/scripts/axiom_power_sensor_off.sh +++ b/software/scripts/axiom_power_sensor_off.sh @@ -1,8 +1,8 @@ #!/bin/bash for id in 0x21; do - axiom_i2c_test $id || continue + i2c_test $id || continue - axiom_i2c_set $id 0x14 0x00 - axiom_i2c_set $id 0x15 0x00 + i2c_set $id 0x14 0x00 + i2c_set $id 0x15 0x00 done diff --git a/software/scripts/axiom_power_vio.sh b/software/scripts/axiom_power_vio.sh index 3d8a70c3..6c0e7595 100755 --- a/software/scripts/axiom_power_vio.sh +++ b/software/scripts/axiom_power_vio.sh @@ -1,4 +1,4 @@ #!/bin/bash # enable VIO -axiom_i2c0_bit_set 0x20 0x14 5 +i2c0_bit_set 0x20 0x14 5 diff --git a/software/scripts/axiom_prep_icsp.sh b/software/scripts/axiom_prep_icsp.sh index 6a02acf2..9631bfd8 100755 --- a/software/scripts/axiom_prep_icsp.sh +++ b/software/scripts/axiom_prep_icsp.sh @@ -6,9 +6,9 @@ axiom_fclk_init.sh axiom_gpio.py init -axiom_i2c0_bit_clr 0x22 0x15 7 +i2c0_bit_clr 0x22 0x15 7 sleep 0.1 -axiom_i2c0_bit_set 0x22 0x15 7 +i2c0_bit_set 0x22 0x15 7 echo icsp.bin > /sys/class/fpga_manager/fpga0/firmware diff --git a/software/scripts/axiom_rf_disable.sh b/software/scripts/axiom_rf_disable.sh index 100c8d4d..65a36bda 100755 --- a/software/scripts/axiom_rf_disable.sh +++ b/software/scripts/axiom_rf_disable.sh @@ -1,12 +1,12 @@ #!/bin/bash # disable power to RFs -axiom_i2c0_bit_clr 0x22 0x14 1 -axiom_i2c0_bit_clr 0x22 0x14 3 -axiom_i2c0_bit_clr 0x23 0x14 1 -axiom_i2c0_bit_clr 0x23 0x14 3 +i2c0_bit_clr 0x22 0x14 1 +i2c0_bit_clr 0x22 0x14 3 +i2c0_bit_clr 0x23 0x14 1 +i2c0_bit_clr 0x23 0x14 3 # take PICs out of reset -axiom_i2c0_bit_set 0x22 0x14 4 -axiom_i2c0_bit_set 0x23 0x14 4 +i2c0_bit_set 0x22 0x14 4 +i2c0_bit_set 0x23 0x14 4 diff --git a/software/scripts/axiom_rf_enable.sh b/software/scripts/axiom_rf_enable.sh index a9ed6ec0..9e78f5c6 100755 --- a/software/scripts/axiom_rf_enable.sh +++ b/software/scripts/axiom_rf_enable.sh @@ -1,12 +1,12 @@ #!/bin/bash # disable power to RFs -axiom_i2c0_bit_set 0x22 0x14 1 -axiom_i2c0_bit_set 0x22 0x14 3 -axiom_i2c0_bit_set 0x23 0x14 1 -axiom_i2c0_bit_set 0x23 0x14 3 +i2c0_bit_set 0x22 0x14 1 +i2c0_bit_set 0x22 0x14 3 +i2c0_bit_set 0x23 0x14 1 +i2c0_bit_set 0x23 0x14 3 # take PICs out of reset -axiom_i2c0_bit_set 0x22 0x14 4 -axiom_i2c0_bit_set 0x23 0x14 4 +i2c0_bit_set 0x22 0x14 4 +i2c0_bit_set 0x23 0x14 4 diff --git a/software/scripts/axiom_rf_reset.sh b/software/scripts/axiom_rf_reset.sh index ed2097c9..94a6988e 100755 --- a/software/scripts/axiom_rf_reset.sh +++ b/software/scripts/axiom_rf_reset.sh @@ -1,12 +1,12 @@ #!/bin/bash # disable power to RFs -axiom_i2c0_bit_clr 0x22 0x14 1 -axiom_i2c0_bit_clr 0x22 0x14 3 -axiom_i2c0_bit_clr 0x23 0x14 1 -axiom_i2c0_bit_clr 0x23 0x14 3 +i2c0_bit_clr 0x22 0x14 1 +i2c0_bit_clr 0x22 0x14 3 +i2c0_bit_clr 0x23 0x14 1 +i2c0_bit_clr 0x23 0x14 3 # reset PICs -axiom_i2c0_bit_clr 0x22 0x14 4 -axiom_i2c0_bit_clr 0x23 0x14 4 +i2c0_bit_clr 0x22 0x14 4 +i2c0_bit_clr 0x23 0x14 4