-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
enc_err_counter: Added read and reset script wrappers fpr use without
eb-mon.
- Loading branch information
Showing
2 changed files
with
101 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#!/bin/bash | ||
dev=$1 | ||
interface=$2 | ||
addr="NULL" | ||
vendor_id="0x00000651" | ||
device_id="0x434e5452" | ||
|
||
function get_sensor_address() | ||
{ | ||
# Check address | ||
addr=$(eb-find $dev $vendor_id $device_id) | ||
if [ $? -ne 0 ]; then | ||
echo "Error: Can't find device or module!" | ||
exit 1 | ||
else | ||
echo "Info: Found device at $addr ..." | ||
fi | ||
} | ||
|
||
function read_enc_err_counter() | ||
{ | ||
if [ $interface -eq 1 ] | ||
then | ||
counterAddr=$addr | ||
overflowAddr=$(($addr+4)) | ||
else | ||
counterAddr=$(($addr+8)) | ||
overflowAddr=$(($addr+12)) | ||
fi | ||
counter=$(eb-read $dev $counterAddr/4) | ||
overflowFlag=$(eb-read $dev $overflowAddr/4) | ||
echo "Phy#1 counter: $counter overflow flag: $overflowFlag" | ||
} | ||
|
||
if [ -z "$1" ] | ||
then | ||
echo "expecting non-optional argument: <device>" | ||
exit 1 | ||
fi | ||
|
||
if [ -z "$2" ] | ||
then | ||
interface=1 | ||
fi | ||
|
||
echo $interface | ||
|
||
get_sensor_address | ||
read_enc_err_counter | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#!/bin/bash | ||
dev=$1 | ||
interface=$2 | ||
addr="NULL" | ||
vendor_id="0x00000651" | ||
device_id="0x434e5452" | ||
|
||
function get_sensor_address() | ||
{ | ||
# Check address | ||
addr=$(eb-find $dev $vendor_id $device_id) | ||
if [ $? -ne 0 ]; then | ||
echo "Error: Can't find device or module!" | ||
exit 1 | ||
else | ||
echo "Info: Found device at $addr ..." | ||
fi | ||
} | ||
|
||
function reset_enc_err_counter() | ||
{ | ||
if [ $interface -eq 1 ] | ||
then | ||
counterAddr=$addr | ||
else | ||
counterAddr=$(($addr+8)) | ||
fi | ||
eb-write $dev $counterAddr/4 0x00000001 | ||
sleep 1 | ||
eb-write $dev $counterAddr/4 0x00000000 | ||
echo "Reset carried out. Check counter for confirmation." | ||
} | ||
|
||
if [ -z "$1" ] | ||
then | ||
echo "expecting non-optional argument: <device>" | ||
exit 1 | ||
fi | ||
|
||
if [ -z "$2" ] | ||
then | ||
interface=1 | ||
fi | ||
|
||
echo $interface | ||
|
||
get_sensor_address | ||
reset_enc_err_counter | ||
|
||
exit 0 |