From b44f31c453257d93a3e94625cdf719f5fed5a34b Mon Sep 17 00:00:00 2001 From: saehim Date: Thu, 15 Apr 2021 17:07:47 +0900 Subject: [PATCH] =?UTF-8?q?buildroot:=20jig=20=EB=B3=80=EA=B2=BD=20?= =?UTF-8?q?=EB=B0=8F=20=ED=93=A8=EC=A7=95=EC=8A=A4=ED=81=AC=EB=A6=BD?= =?UTF-8?q?=ED=8A=B8=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../rootfs_overlay/root/.falinux/mk-emmc-fusing.sh | 2 + .../root/.falinux/prime_jig/prime_jig.sh | 285 ++++++++++++++------- 2 files changed, 189 insertions(+), 98 deletions(-) diff --git a/buildroot/buildroot-2016.08.1/board/falinux/prime_oven/rootfs_overlay/root/.falinux/mk-emmc-fusing.sh b/buildroot/buildroot-2016.08.1/board/falinux/prime_oven/rootfs_overlay/root/.falinux/mk-emmc-fusing.sh index 85fad98..a99373d 100755 --- a/buildroot/buildroot-2016.08.1/board/falinux/prime_oven/rootfs_overlay/root/.falinux/mk-emmc-fusing.sh +++ b/buildroot/buildroot-2016.08.1/board/falinux/prime_oven/rootfs_overlay/root/.falinux/mk-emmc-fusing.sh @@ -14,6 +14,7 @@ PART4=p4 FNAME_UBOOT="u-boot.imx" FNAME_LOGO="init.bmp" FNAME_DTB="imx6s-prime-oven.dtb" +FNAME_JIG="imx6s-prime-oven_jig.dtb" FNAME_KERNEL="uImage" FNAME_FSCPIO="ramdisk-prime_oven.uboot" FNAME_RFS="rootfs.tar" @@ -126,6 +127,7 @@ function run_copy_image() cp -v ${SD_MOUNT_PATH_P1}/boot/${FNAME_UBOOT} ${EMMC_MOUNT_PATH_P1}/boot/ cp -v ${SD_MOUNT_PATH_P1}/boot/${FNAME_LOGO} ${EMMC_MOUNT_PATH_P1}/boot/ cp -v ${SD_MOUNT_PATH_P1}/boot/${FNAME_DTB} ${EMMC_MOUNT_PATH_P1}/boot/ + cp -v ${SD_MOUNT_PATH_P1}/boot/${FNAME_JIG} ${EMMC_MOUNT_PATH_P1}/boot/ cp -v ${SD_MOUNT_PATH_P1}/boot/${FNAME_KERNEL} ${EMMC_MOUNT_PATH_P1}/boot/ cp -v ${SD_MOUNT_PATH_P1}/boot/${FNAME_FSCPIO} ${EMMC_MOUNT_PATH_P1}/boot/ run_copy_rootfs diff --git a/buildroot/buildroot-2016.08.1/board/falinux/prime_oven/rootfs_overlay/root/.falinux/prime_jig/prime_jig.sh b/buildroot/buildroot-2016.08.1/board/falinux/prime_oven/rootfs_overlay/root/.falinux/prime_jig/prime_jig.sh index b1c1d4a..b365f9d 100755 --- a/buildroot/buildroot-2016.08.1/board/falinux/prime_oven/rootfs_overlay/root/.falinux/prime_jig/prime_jig.sh +++ b/buildroot/buildroot-2016.08.1/board/falinux/prime_oven/rootfs_overlay/root/.falinux/prime_jig/prime_jig.sh @@ -9,14 +9,30 @@ C_BOLD='\033[1m' PING_ADDR="192.168.10.1" -MAC_ADDR="" -ETH_NAME="eth0" SUMMARY_PATH="/tmp/list" -JIG_PATH="/root/.falinux/prime_jig/" -RESULT_LOG="${JIG_PATH}result_log" -THREAD_FUNC_SCRIPT="${JIG_PATH}thread_func.sh" -FRAM_TEST_APP="${JIG_PATH}fram_test" +JIG_PATH="/root/.falinux/prime_jig" +RESULT_LOG="${JIG_PATH}/result_log" +THREAD_FUNC_SCRIPT="${JIG_PATH}/thread_func.sh" +FRAM_TEST_APP="${JIG_PATH}/fram_test" + COMPLETE_TEST_NAME="" +RUN_PROC=0 + +###### PRIME OVEN ###### + +IFACE_ETH0="eth0" +ETH0_I2CCH="2" +MAC_ADDR="" + +USB_SDA="/dev/sda" + +USB_RS485="/dev/ttyUSB0" +SERIAL_RS485="/dev/ttymxc2" + +RTC_DEV="/dev/rtc0" + +MANUAL_TEST_LIST=() +FIRST_MENU+=("JIG MANUAL") function Init() { @@ -72,21 +88,31 @@ function test_mac() echo -e "${C_LCYAN}### [${FUNCNAME}] ###${C_NC}" echo "" - COMPLETE_TEST_NAME=${FUNCNAME} + COMPLETE_TEST_NAME="${FUNCNAME}-${1}" + IFACE="$1" + I2C_CH="$2" for i in 0xfa 0xfb 0xfc 0xfd 0xfe 0xff do if [ "$i" == "0xfa" ]; then - EEPROM_MAC=$(i2cget -f -y 1 0x50 $i b | sed 's/0x//') + i2cget -f -y ${I2C_CH} 0x50 $i b + if [ "$?" != 0 ]; then + return -1 + fi + EEPROM_MAC=$(i2cget -f -y ${I2C_CH} 0x50 $i b | sed 's/0x//') else - EEPROM_MAC+=$(i2cget -f -y 1 0x50 $i b | sed 's/0x/:/') + i2cget -f -y ${I2C_CH} 0x50 $i b + if [ "$?" != 0 ]; then + return -1 + fi + EEPROM_MAC+=$(i2cget -f -y ${I2C_CH} 0x50 $i b | sed 's/0x/:/') fi done MAC_ADDR="${EEPROM_MAC^^}" - ETH_MAC=$(ifconfig | grep eth0 | awk {'print $5'}) + ETH_MAC=$(ifconfig ${IFACE} | grep ${IFACE} | awk {'print $5'}) if [ "${EEPROM_MAC^^}" = "${ETH_MAC^^}" ]; then return $? @@ -143,7 +169,7 @@ function test_ethernet() sleep 1 done - udhcpc -i eth0 -n -q + udhcpc -i ${IFACE} -n -q if [ "$?" != 0 ]; then return -1 fi @@ -205,7 +231,7 @@ function test_touch() return 0 } -BACK_LIGHT="/sys/class/backlight/backlight_lvds.19/brightness" +BACK_LIGHT="/sys/class/backlight/backlight_lvds.21/brightness" function test_lcd() { echo "" @@ -215,8 +241,9 @@ function test_lcd() COMPLETE_TEST_NAME=${FUNCNAME} # TODO Test - - fb-test + + fb-test + fb-test -f 2 if [ "$?" != 0 ]; then return -1 fi @@ -267,7 +294,7 @@ function test_encoder() return $? } -WAV_FILE="${JIG_PATH}opening.wav" +WAV_FILE="${JIG_PATH}/opening.wav" function test_audio() { echo "" @@ -286,22 +313,32 @@ function test_audio() return $? } -function test_usb_storage() +function test_storage() { echo "" echo -e "${C_LCYAN}### [${FUNCNAME}] ###${C_NC}" echo "" - COMPLETE_TEST_NAME=${FUNCNAME} + COMPLETE_TEST_NAME="${FUNCNAME}-${1}" # TODO Test - ls /dev/sda + ls $1 if [ "$?" != "0" ]; then return -1 fi - ls /dev/sdb + DEVICE_TYPE=$(readlink /sys/class/block/$(echo ${1} | cut -d'/' -f 3)) + echo ${DEVICE_TYPE} | grep usb + if [ "$?" == "0" ]; then + COMPLETE_TEST_NAME="test_usb_host-${1}" + fi + + echo ${DEVICE_TYPE} | grep sata + if [ "$?" == "0" ]; then + COMPLETE_TEST_NAME="test_ssd-${1}" + fi + return $? } @@ -323,69 +360,45 @@ function test_fram() return $? } -function test_tty() -{ +function write_uart() { + while [ 1 ] + do + echo "${2}" > ${1} + sleep 0.1 + done +} + +function test_rs232_pair() { echo "" echo -e "${C_LCYAN}### [${FUNCNAME}] ###${C_NC}" echo "" - COMPLETE_TEST_NAME=${FUNCNAME} + COMPLETE_TEST_NAME="${FUNCNAME}-${1}-${2}" WRITE_MSG="FALINUX_TTY" # TODO Test - DEV_TTY_PATH="/dev/ttymxc1" + DEV_RS232_WRITE_PATH="$1" + DEV_RS232_READ_PATH="$2" - ${THREAD_FUNC_SCRIPT} tty ${DEV_TTY_PATH} ${WRITE_MSG} & - read -s -t 5 READ_MSG < ${DEV_TTY_PATH} - if [ "$?" != 0 ]; then - return -1 - fi - echo "Read: [${READ_MSG}]" - - if [ "${WRITE_MSG}" != "${READ_MSG}" ]; then - return -1 - fi - - return $? -} - -function test_rs485() -{ - echo "" - echo -e "${C_LCYAN}### [${FUNCNAME}] ###${C_NC}" - echo "" - - COMPLETE_TEST_NAME=${FUNCNAME} + stty -F ${DEV_RS232_WRITE_PATH} speed 115200 cs8 + stty -F ${DEV_RS232_READ_PATH} speed 115200 cs8 - # TODO Test + write_uart ${DEV_RS232_WRITE_PATH} ${WRITE_MSG} & - DEV_RS485_PATH1="/dev/ttymxc2" - DEV_RS485_PATH2="/dev/ttymxc3" + WRITE_THREAD_PID=$! - # Read : RS485_1, Write : RS485_2 - RS485_WRITE_MSG="FALINUX_TEST:"${DEV_RS485_PATH2} - ${THREAD_FUNC_SCRIPT} rs485 ${DEV_RS485_PATH2} ${RS485_WRITE_MSG} & - read -s -t 5 RS485_READ_MSG < ${DEV_RS485_PATH1} + read -s -t 5 READ_MSG < ${DEV_RS232_READ_PATH} if [ "$?" != 0 ]; then + kill ${WRITE_THREAD_PID} > /dev/null 2>&1 return -1 fi - echo "Read: [${RS485_READ_MSG}]" - - if [ "${RS485_WRITE_MSG}" != "${RS485_READ_MSG}" ]; then - return -1 - fi + echo "Read: [${READ_MSG}]" - # Read : RS485_2, Write : RS485_1 - RS485_WRITE_MSG="FALINUX_TEST:"${DEV_RS485_PATH1} - ${THREAD_FUNC_SCRIPT} rs485 ${DEV_RS485_PATH1} ${RS485_WRITE_MSG} & - read -s -t 5 RS485_READ_MSG < ${DEV_RS485_PATH2} - if [ "$?" != 0 ]; then - return -1 - fi - echo "Read: [${RS485_READ_MSG}]" + + kill ${WRITE_THREAD_PID} > /dev/null 2>&1 - if [ "${RS485_WRITE_MSG}" != "${RS485_READ_MSG}" ]; then + if [ "${WRITE_MSG}" != "${READ_MSG}" ]; then return -1 fi @@ -407,60 +420,136 @@ function test_default() return $? } -function main() -{ +function jig_main() { echo "" echo -e " ### Start DEV Test - [${FUNCNAME}] ###" echo "" Init - test_mac - error_check $? ${COMPLETE_TEST_NAME} + for test_name in "${MANUAL_TEST_LIST[@]}"; do + ${test_name} + error_check $? ${COMPLETE_TEST_NAME} + done + + summary + save_result +} - test_ethernet ${ETH_NAME} - error_check $? ${COMPLETE_TEST_NAME} +function init_manual() { + rm -f ${RESULT_LOG} + clear + MANUAL_TEST_LIST+=("test_mac ${IFACE_ETH0} ${ETH0_I2CCH}") + MANUAL_TEST_LIST+=("test_ethernet ${IFACE_ETH0}") + MANUAL_TEST_LIST+=("test_rtc ${RTC_DEV}") + MANUAL_TEST_LIST+=("test_rs232_pair ${SERIAL_RS485} ${USB_RS485}") + MANUAL_TEST_LIST+=("test_rs232_pair ${USB_RS485} ${SERIAL_RS485}") + + MANUAL_TEST_LIST+=("test_touch") + MANUAL_TEST_LIST+=("test_lcd") + MANUAL_TEST_LIST+=("test_encoder") + MANUAL_TEST_LIST+=("test_audio") + MANUAL_TEST_LIST+=("test_storage ${USB_SDA}") + MANUAL_TEST_LIST+=("test_fram") +} - test_rtc - error_check $? ${COMPLETE_TEST_NAME} +function print_first_menu() { + TEST_NUM=1 + for tests in "${FIRST_MENU[@]}"; do + echo -e "${C_LGREEN}${TEST_NUM}. ${tests}${C_NC}" + TEST_NUM=$(( ${TEST_NUM} + 1 )) + done - test_touch - error_check $? ${COMPLETE_TEST_NAME} + echo -e "${C_LRED}${TEST_NUM}. EXIT${C_NC}" - test_lcd - error_check $? ${COMPLETE_TEST_NAME} + read -p "Select Test : " -e TEST_NUMBER - test_encoder - error_check $? ${COMPLETE_TEST_NAME} + return ${TEST_NUMBER} +} - test_audio - error_check $? ${COMPLETE_TEST_NAME} +function print_manual() { + TEST_NUM=1 + for names in "${MANUAL_TEST_LIST[@]}"; do + echo -e "${C_LGREEN}${TEST_NUM}. ${names}${C_NC}" + TEST_NUM=$(( ${TEST_NUM} + 1)) + done - test_usb_storage - error_check $? ${COMPLETE_TEST_NAME} + echo -e "${C_LRED}${TEST_NUM}. BACK${C_NC}" + TEST_NUM=$(( ${TEST_NUM} + 1)) + echo -e "${C_LRED}${TEST_NUM}. EXIT${C_NC}" - test_fram - error_check $? ${COMPLETE_TEST_NAME} + read -p "Select Test : " -e OUTPUT_NUM - test_tty - error_check $? ${COMPLETE_TEST_NAME} - test_rs485 - error_check $? ${COMPLETE_TEST_NAME} + manual_test_proc ${OUTPUT_NUM} + + return 0 +} +function manual_test_proc() { + if [ "${1}" == "" ]; then + echo -e "${C_LRED} Select Correct Number ${C_NC}" + return + fi + ARRAY_NUM=$(( ${1} - 1 )) + if [ ${ARRAY_NUM} -eq ${#MANUAL_TEST_LIST[@]} ]; then + MANUAL_JIG=0 + fi + if [ ${ARRAY_NUM} -eq $(( ${#MANUAL_TEST_LIST[@]} + 1)) ]; then + exit + fi + Init + ${MANUAL_TEST_LIST[${ARRAY_NUM}]} + error_check $? ${COMPLETE_TEST_NAME} summary save_result } -function test_func() -{ - echo "" - echo -e " ### TEST Func - [${FUNCNAME}] ###" - echo "" - - test_encoder - error_check $? ${COMPLETE_TEST_NAME} + +function read_key_event() { + for time in $(seq 3 -1 1); do + clear + read -p "Press Any Key : ${time}" -t 1 -n 1 KEYDATA + if [ "${KEYDATA}" != "" ]; then + RUN_PROC=1 + break + fi + done +} + +function proc_main() { + if [ ${RUN_PROC} -eq 0 ]; then + clear + jig_main + else + while [ true ]; do + echo -e "" + echo -e "${C_BOLD}${C_LCYAN} MANAUL TEST ${C_NC}" + print_first_menu + case "$?" in + 1) + echo -e "${C_BOLD}${C_LCYAN} MANAUL TEST ${C_NC}" + MANUAL_JIG=1 + while [ true ]; do + print_manual + if [ "${MANUAL_JIG}" == "0" ]; then + break + fi + done + ;; + 2) + exit + ;; + *) + echo -e "${C_LRED} Select Correct Number ${C_NC}" + ;; + + esac + done + fi } -main +init_manual +read_key_event +proc_main -- 2.1.4