Commit 976eeadf authored by Dafna Hirschfeld's avatar Dafna Hirschfeld

stream-tests.sh

parent 68a0cdc8
......@@ -48,35 +48,41 @@ function link {
ltype=$7
mkdir -p "/configfs/vimc/$DEV/${ttype}:${to}/sink:${tpad}/${from}-to-${to}"
echo $ltype > "/configfs/vimc/$DEV/${ttype}:${to}/sink:${tpad}/${from}-to-${to}/type"
ln -s "/configfs/vimc/$DEV/${ttype}:${to}/sink:${tpad}/${from}-to-${to}" "/configfs/vimc/$DEV/${ftype}:${from}/source:${fpad}" 2>/dev/null && echo "link ${from}->${to}"
ln -s "/configfs/vimc/$DEV/${ttype}:${to}/sink:${tpad}/${from}-to-${to}" "/configfs/vimc/$DEV/${ftype}:${from}/source:${fpad}" 2>/dev/null
#ls -l "/configfs/vimc/$DEV/${ftype}:${from}/source:${fpad}/${from}-to-${to}"
}
#3 - one script links between entities
function create_links {
#for k in `seq 1 ${BIS}`
while :
do
for k in `seq 1 5`
#for k in `seq 1 10`
do
i=$((RANDOM % 10))
j=$((RANDOM % 10))
l=$((RANDOM % 10))
a=$((RANDOM % 10))
b=$((RANDOM % 10))
c=$((RANDOM % 10))
d=$((RANDOM % 10))
e=$((RANDOM % 10))
link sen$i vimc-sensor 0 deb$j vimc-debayer 0 on
i=$((RANDOM % 10))
j=$((RANDOM % 10))
link sen$i vimc-sensor 0 cap$j vimc-capture 0 on
link deb$l vimc-debayer 1 sca$c vimc-scaler 0 on
link sca$a vimc-scaler 1 cap$b vimc-capture 0 on
link sca$d vimc-scaler 1 sca$e vimc-scaler 0 on
sleep 2
i=$((RANDOM % 10))
j=$((RANDOM % 10))
link deb$i vimc-debayer 1 sca$j vimc-scaler 0 on
i=$((RANDOM % 10))
j=$((RANDOM % 10))
link sca$i vimc-scaler 1 cap$j vimc-capture 0 on
i=$((RANDOM % 10))
j=$((RANDOM % 10))
link sca$i vimc-scaler 1 sca$j vimc-scaler 0 on
#sleep 2
done
for k in `seq 11 50`
do
link sen$k vimc-sensor 0 cap$k vimc-capture 0 on
done
sleep 1
done
}
#one script delet entities
......@@ -84,20 +90,20 @@ function delete_links_and_entities {
while :
# for k in `seq 1 ${BIS}`
do
find /configfs -type l -name "sca*" -delete;
find /configfs -type d -name "vimc-scaler*" -delete
sleep $((RANDOM % 9))
find /configfs -type l -name "sen*" -delete;
find /configfs -type d -name "vimc-sensor*" -delete
find /configfs -type l -name "deb*" -delete;
find /configfs -type d -name "*to-deb*" -delete && echo "OK deb target"
find /configfs -type d -name "vimc-debayer*" -delete
sleep $((RANDOM % 9))
find /configfs -type l -name "sen*" -delete;
find /configfs -type d -name "vimc-sensor*" -delete
sleep $((RANDOM % 9))
find /configfs -type l -name "sca*" -delete;
find /configfs -type d -name "*to-sca*" -delete && echo "OK sca target"
find /configfs -type d -name "vimc-scaler*" -delete
find /configfs -type d -name "*to-cap*" -delete && echo "OK cap target"
find /configfs -type d -name "vimc-capture*" -delete
sleep $((RANDOM % 9))
sleep $((RANDOM % 30))
done
}
function configure_all_formats {
......@@ -123,21 +129,21 @@ function stream {
while :
#for k in `seq 1 10000`
do
for i in `seq 1 ${ENT_NUM}`
for i in `seq 11 ${ENT_NUM}`
do
for j in {0..0}
do
if [ -c "/dev/media0" ]; then
media-ctl -d platform:vimc-00$j -V "\"sen$i\":0[fmt:SBGGR8_1X8/640x480]"
media-ctl -d platform:vimc-00$j -V "\"deb$i\":0[fmt:SBGGR8_1X8/640x480]"
media-ctl -d platform:vimc-00$j -V "\"sca$i\":0[fmt:RGB888_1X24/640x480]"
#if [ -c "/dev/media0" ]; then
#media-ctl -d platform:vimc-00$j -V "\"sen$i\":0[fmt:SBGGR8_1X8/640x480]"
#media-ctl -d platform:vimc-00$j -V "\"deb$i\":0[fmt:SBGGR8_1X8/640x480]"
#media-ctl -d platform:vimc-00$j -V "\"sca$i\":0[fmt:RGB888_1X24/640x480]"
# v4l2-ctl -z platform:vimc-00$j -d "cap$i" -v pixelformat=RGB3
echo "steaming $i"
v4l2-ctl -z platform:vimc-00$j -d "cap$i" -v pixelformat=BA81
#v4l2-ctl -z platform:vimc-00$j -d "cap$i" -v pixelformat=BA81
v4l2-ctl -z platform:vimc-00$j -d "cap$i" --stream-mmap --stream-count=10
else
echo "no media"
fi
#else
# echo "no media"
#fi
done
done
sleep $((RANDOM % 2))
......@@ -197,8 +203,6 @@ echo 1 > /configfs/vimc/$DEV/hotplug
plug_unplug &
create_entities &
create_links &
create_links &
create_links &
delete_links_and_entities &
#delete_links &
#delete_entities &
......
#!/bin/bash
#one script plug and unplug the device
function link {
from=$1
ftype=$2
fpad=$3
to=$4
ttype=$5
tpad=$6
ltype=$7
mkdir -p "/configfs/vimc/$DEV/${ttype}:${to}/sink:${tpad}/${from}-to-${to}"
echo $ltype > "/configfs/vimc/$DEV/${ttype}:${to}/sink:${tpad}/${from}-to-${to}/type"
ln -s "/configfs/vimc/$DEV/${ttype}:${to}/sink:${tpad}/${from}-to-${to}" "/configfs/vimc/$DEV/${ftype}:${from}/source:${fpad}" 2>/dev/null
}
function stream {
while :
do
media-ctl -d platform:vimc-000 -V "\"sen\":0[fmt:SBGGR8_1X8/640x480]"
media-ctl -d platform:vimc-000 -V "\"deb\":0[fmt:SBGGR8_1X8/640x480]"
media-ctl -d platform:vimc-000 -V "\"sca\":0[fmt:RGB888_1X24/640x480]"
v4l2-ctl -z platform:vimc-000 -d "cap" -v pixelformat=RGB3
echo "steaming"
v4l2-ctl -z platform:vimc-000 -d "cap" --stream-mmap
done
}
function rm_entity {
ent=$1
find /configfs -type l -name "*${ent}*" -delete
find /configfs -type d -name "*${ent}*" -delete
echo 0 > /configfs/vimc/$DEV/hotplug
echo 1 > /configfs/vimc/$DEV/hotplug
sleep 1
}
function recreate_sca {
while :
do
rm_entity sca
mkdir -p /configfs/vimc/$DEV/vimc-scaler:sca
link deb vimc-debayer 1 sca vimc-scaler 0 on
link sca vimc-scaler 1 cap vimc-capture 0 on
echo 0 > /configfs/vimc/$DEV/hotplug
echo 1 > /configfs/vimc/$DEV/hotplug
sleep $((RANDOM % 3))
done
}
function recreate_deb {
while :
do
rm_entity deb
mkdir -p /configfs/vimc/$DEV/vimc-debayer:deb
link sen vimc-sensor 0 deb vimc-debayer 0 on
link deb vimc-debayer 1 sca vimc-scaler 0 on
echo 0 > /configfs/vimc/$DEV/hotplug
echo 1 > /configfs/vimc/$DEV/hotplug
sleep $((RANDOM % 3))
done
}
function recreate_sen {
while :
do
rm_entity sen
mkdir -p /configfs/vimc/$DEV/vimc-sensor:sen
link sen vimc-sensor 0 deb vimc-debayer 0 on
echo 0 > /configfs/vimc/$DEV/hotplug
echo 1 > /configfs/vimc/$DEV/hotplug
sleep $((RANDOM % 3))
done
}
function recreate_cap {
while :
do
rm_entity cap
mkdir -p /configfs/vimc/$DEV/vimc-capture:cap
link sca vimc-scaler 1 cap vimc-capture 0 on
echo 0 > /configfs/vimc/$DEV/hotplug
echo 1 > /configfs/vimc/$DEV/hotplug
sleep $((RANDOM % 3))
done
}
function prepare {
DEV=mdev
modprobe -vr vimc
modprobe -v vimc sca_mult=1
mount -t configfs none /configfs
echo 15 > /proc/sys/kernel/printk
mkdir /configfs/vimc/$DEV
mkdir -p /configfs/vimc/$DEV/vimc-sensor:sen
mkdir -p /configfs/vimc/$DEV/vimc-debayer:deb
mkdir -p /configfs/vimc/$DEV/vimc-scaler:sca
mkdir -p /configfs/vimc/$DEV/vimc-capture:cap
link sen vimc-sensor 0 deb vimc-debayer 0 on
link deb vimc-debayer 1 sca vimc-scaler 0 on
link sca vimc-scaler 1 cap vimc-capture 0 on
}
function main2 {
prepare
stream &
while :
do
echo disabled > /configfs/vimc/mdev/vimc-capture:cap/sink:0/sca-to-cap/type
echo 0 > /configfs/vimc/$DEV/hotplug
echo 1 > /configfs/vimc/$DEV/hotplug
sleep 0.5
echo enabled > /configfs/vimc/mdev/vimc-capture:cap/sink:0/sca-to-cap/type
echo 0 > /configfs/vimc/$DEV/hotplug
echo 1 > /configfs/vimc/$DEV/hotplug
sleep 2
echo disabled > /configfs/vimc/mdev/vimc-scaler:sca/sink:0/deb-to-sca/type
echo 0 > /configfs/vimc/$DEV/hotplug
echo 1 > /configfs/vimc/$DEV/hotplug
sleep 0.5
echo enabled > /configfs/vimc/mdev/vimc-scaler:sca/sink:0/deb-to-sca/type
echo 0 > /configfs/vimc/$DEV/hotplug
echo 1 > /configfs/vimc/$DEV/hotplug
sleep 2
echo disabled > /configfs/vimc/mdev/vimc-debayer:deb/sink:0/sen-to-deb/type
echo 0 > /configfs/vimc/$DEV/hotplug
echo 1 > /configfs/vimc/$DEV/hotplug
sleep 0.5
echo enabled > /configfs/vimc/mdev/vimc-debayer:deb/sink:0/sen-to-deb/type
echo 0 > /configfs/vimc/$DEV/hotplug
echo 1 > /configfs/vimc/$DEV/hotplug
sleep 2
done
}
prepare
stream &
recreate_sen &
recreate_deb &
recreate_sca &
recreate_cap &
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