1#!/bin/bash 2 3# shellcheck source=/dev/null 4source /usr/sbin/gpio-defs.sh 5source /usr/sbin/gpio-lib.sh 6 7function usage() { 8 echo "usage: ampere_gpio_utils.sh [power] [on|off]"; 9} 10 11set_gpio_power_off() { 12 echo "Setting GPIO before Power off" 13} 14 15set_gpio_power_on() { 16 echo "Setting GPIO before Power on" 17 val=$(gpio_get_val "$S0_CPU_FW_BOOT_OK") 18 if [ "$val" == 1 ]; then 19 exit 20 fi 21 gpio_configure_output "$SPI0_PROGRAM_SEL" 1 22 gpio_configure_output "$SPI0_BACKUP_SEL" 0 23} 24 25if [ $# -lt 2 ]; then 26 echo "Total number of parameter=$#" 27 echo "Insufficient parameter" 28 usage; 29 exit 0; 30fi 31 32if [ "$1" == "power" ]; then 33 if [ "$2" == "on" ]; then 34 set_gpio_power_on 35 elif [ "$2" == "off" ]; then 36 set_gpio_power_off 37 fi 38 exit 0; 39else 40 echo "Invalid parameter1=$1" 41 usage; 42 exit 0; 43fi 44exit 0; 45