Skip to content

Commit

Permalink
[scripts] remove axiom_ prefix for i2c functions again
Browse files Browse the repository at this point in the history
  • Loading branch information
rroohhh committed Aug 10, 2020
1 parent 490fee7 commit 91cee38
Show file tree
Hide file tree
Showing 16 changed files with 134 additions and 134 deletions.
40 changes: 20 additions & 20 deletions software/scripts/axiom_i2c.func
Original file line number Diff line number Diff line change
@@ -1,63 +1,63 @@
#!/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 ))
printf "0x%02X%02X" $vhb $vlb
# 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
Expand Down
40 changes: 20 additions & 20 deletions software/scripts/axiom_i2c0.func
Original file line number Diff line number Diff line change
@@ -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
Expand Down
40 changes: 20 additions & 20 deletions software/scripts/axiom_i2c1.func
Original file line number Diff line number Diff line change
@@ -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
Expand Down
34 changes: 17 additions & 17 deletions software/scripts/axiom_i2c2.func
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion software/scripts/axiom_mclr_h.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/bin/bash
axiom_i2c_set 0x22 0x14 0x1F
i2c_set 0x22 0x14 0x1F
2 changes: 1 addition & 1 deletion software/scripts/axiom_mclr_l.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/bin/bash
axiom_i2c_set 0x22 0x14 0x0F
i2c_set 0x22 0x14 0x0F
16 changes: 8 additions & 8 deletions software/scripts/axiom_pac1720_info.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
28 changes: 14 additions & 14 deletions software/scripts/axiom_power_init.sh
Original file line number Diff line number Diff line change
@@ -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
6 changes: 3 additions & 3 deletions software/scripts/axiom_power_off.sh
Original file line number Diff line number Diff line change
@@ -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

Loading

0 comments on commit 91cee38

Please sign in to comment.