修复:热重启时保持射频时钟
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
### Auther : F
|
### Auther : F
|
||||||
### Date : 2021-12-7
|
### Date : 2021-12-7
|
||||||
### Function: Start anywave work
|
### Function: Start anywave work
|
||||||
echo " "
|
echo " "
|
||||||
echo " "
|
echo " "
|
||||||
echo "--------------------------------"
|
echo "--------------------------------"
|
||||||
@@ -20,8 +20,13 @@ echo "clk prepare..."
|
|||||||
sleep 5
|
sleep 5
|
||||||
echo "clk rdy"
|
echo "clk rdy"
|
||||||
|
|
||||||
init_ad9528_reset_gpio.sh
|
if imx_cfgad9528 --check-ready; then
|
||||||
imx_cfgad9528
|
echo "AD9528 already configured and locked; preserve live RF clocks"
|
||||||
|
else
|
||||||
|
echo "AD9528 not ready; run cold-start reset and configuration"
|
||||||
|
init_ad9528_reset_gpio.sh
|
||||||
|
imx_cfgad9528
|
||||||
|
fi
|
||||||
|
|
||||||
mkdir -p /aw/anywave/dpd_log
|
mkdir -p /aw/anywave/dpd_log
|
||||||
|
|
||||||
@@ -38,7 +43,7 @@ echo "== web start =="
|
|||||||
cd /aw/anywave/web/sh && ./start_web.sh
|
cd /aw/anywave/web/sh && ./start_web.sh
|
||||||
|
|
||||||
MODULE_LOG_PATH=/var/module_log/
|
MODULE_LOG_PATH=/var/module_log/
|
||||||
mkdir -p $MODULE_LOG_PATH
|
mkdir -p $MODULE_LOG_PATH
|
||||||
|
|
||||||
echo 10 > /sys/class/gpio/export
|
echo 10 > /sys/class/gpio/export
|
||||||
echo 11 > /sys/class/gpio/export
|
echo 11 > /sys/class/gpio/export
|
||||||
@@ -148,15 +153,3 @@ echo " "
|
|||||||
|
|
||||||
|
|
||||||
start_and_longlog /usr/sbin logrotateStart $MODULE_LOG_PATH logrotateStart.log 0 &
|
start_and_longlog /usr/sbin logrotateStart $MODULE_LOG_PATH logrotateStart.log 0 &
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,155 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
### Auther : F
|
||||||
|
### Date : 2021-12-7
|
||||||
|
### Function: Start anywave work
|
||||||
|
echo " "
|
||||||
|
echo " "
|
||||||
|
echo "--------------------------------"
|
||||||
|
echo " ... HELLO , ANYWAVE ... "
|
||||||
|
echo "--------------------------------"
|
||||||
|
echo " "
|
||||||
|
echo " "
|
||||||
|
|
||||||
|
setnetmac.sh
|
||||||
|
|
||||||
|
ifconfig eth0 192.168.1.143
|
||||||
|
ifconfig eth1 192.168.2.143
|
||||||
|
route add default gw 192.168.1.1
|
||||||
|
|
||||||
|
echo "clk prepare..."
|
||||||
|
sleep 5
|
||||||
|
echo "clk rdy"
|
||||||
|
|
||||||
|
if imx_cfgad9528 --check-ready; then
|
||||||
|
echo "AD9528 already configured and locked; preserve live RF clocks"
|
||||||
|
else
|
||||||
|
echo "AD9528 not ready; run cold-start reset and configuration"
|
||||||
|
init_ad9528_reset_gpio.sh
|
||||||
|
imx_cfgad9528
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir -p /aw/anywave/dpd_log
|
||||||
|
|
||||||
|
### Path for web upgrade
|
||||||
|
mkdir -p /aw/upgrade
|
||||||
|
mkdir -p /aw/tmp
|
||||||
|
mkdir -p /aw/anywave/cfg
|
||||||
|
mkdir -p /aw/anywave/cfg/bkp
|
||||||
|
mkdir -p /aw/anywave/dpd_curve
|
||||||
|
mkdir -p /aw/anywave/lib
|
||||||
|
mkdir -p /aw/log
|
||||||
|
mkdir -p /etc/logrotate.d/
|
||||||
|
echo "== web start =="
|
||||||
|
cd /aw/anywave/web/sh && ./start_web.sh
|
||||||
|
|
||||||
|
MODULE_LOG_PATH=/var/module_log/
|
||||||
|
mkdir -p $MODULE_LOG_PATH
|
||||||
|
|
||||||
|
echo 10 > /sys/class/gpio/export
|
||||||
|
echo 11 > /sys/class/gpio/export
|
||||||
|
echo 12 > /sys/class/gpio/export
|
||||||
|
echo 13 > /sys/class/gpio/export
|
||||||
|
echo 14 > /sys/class/gpio/export
|
||||||
|
echo 15 > /sys/class/gpio/export
|
||||||
|
insmod /aw/anywave/lib/key-bsp.ko
|
||||||
|
|
||||||
|
#logconf
|
||||||
|
LOG_CONF_FILE=/etc/logrotate.d/log.conf
|
||||||
|
rm -f $LOG_CONF_FILE
|
||||||
|
set_log_conf()
|
||||||
|
{
|
||||||
|
echo "$1$2{
|
||||||
|
$3
|
||||||
|
daily
|
||||||
|
rotate 3
|
||||||
|
size 1K
|
||||||
|
dateext
|
||||||
|
extension .log
|
||||||
|
compress
|
||||||
|
notifempty
|
||||||
|
sharedscripts
|
||||||
|
create 644 root root
|
||||||
|
sharedscripts
|
||||||
|
postrotate
|
||||||
|
$4
|
||||||
|
endscript
|
||||||
|
}
|
||||||
|
" >> $LOG_CONF_FILE
|
||||||
|
}
|
||||||
|
|
||||||
|
start_and_log()
|
||||||
|
{
|
||||||
|
if [ $# -lt 4 ];then
|
||||||
|
echo 'Usage:start_and_log command_path command_with_param log_path log_name enable_output &'
|
||||||
|
echo "For example:"
|
||||||
|
echo "start_and_log /app ./app /var/module_log/ app.log 0 &"
|
||||||
|
echo "or start_and_log /app ./app /var/module_log/ app.log 1 &"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
set_log_conf $3 $4
|
||||||
|
cd $1 && $2 2>&1 | loglog $3 $4 $5 $6
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
set_longlog_conf()
|
||||||
|
{
|
||||||
|
echo "$1$2{
|
||||||
|
$3
|
||||||
|
daily
|
||||||
|
rotate 3
|
||||||
|
size 500K
|
||||||
|
dateext
|
||||||
|
extension .log
|
||||||
|
compress
|
||||||
|
notifempty
|
||||||
|
create 644 root root
|
||||||
|
sharedscripts
|
||||||
|
postrotate
|
||||||
|
$4
|
||||||
|
endscript
|
||||||
|
}
|
||||||
|
" >> $LOG_CONF_FILE
|
||||||
|
}
|
||||||
|
start_and_longlog()
|
||||||
|
{
|
||||||
|
if [ $# -lt 4 ];then
|
||||||
|
echo 'Usage:start_and_longlog command_path command_with_param log_path log_name enable_output &'
|
||||||
|
echo "For example:"
|
||||||
|
echo "start_and_longlog /app ./app /var/module_log/ app.log 0 &"
|
||||||
|
echo "or start_and_longlog /app ./app /var/module_log/ app.log 1 &"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
set_longlog_conf $3 $4
|
||||||
|
cd $1 && $2 2>&1 | loglog $3 $4 $5 $6
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
echo "== app start =="
|
||||||
|
#cd /aw/anywave/app/ && ./imx_atsc_app&
|
||||||
|
start_and_log /aw/anywave/app ./imx_atsc_app $MODULE_LOG_PATH imx_atsc_app.log 1 &
|
||||||
|
|
||||||
|
echo "== daemon_system start =="
|
||||||
|
#daemon_system
|
||||||
|
start_and_longlog /usr/sbin daemon_system $MODULE_LOG_PATH daemon_system.log 1 &
|
||||||
|
|
||||||
|
echo " "
|
||||||
|
echo "== start finished =="
|
||||||
|
echo " "
|
||||||
|
|
||||||
|
|
||||||
|
#----------daemon_app-------------
|
||||||
|
#ProcNumber=`ps -ef |grep -w daemon_app|grep -v grep|wc -l`
|
||||||
|
#if [ $ProcNumber -le 0 ];then
|
||||||
|
#/usr/sbin/daemon_app &
|
||||||
|
#echo "daemon_app first run"
|
||||||
|
#else
|
||||||
|
#echo "daemon_app have been run"
|
||||||
|
#fi
|
||||||
|
|
||||||
|
|
||||||
|
start_and_longlog /usr/sbin logrotateStart $MODULE_LOG_PATH logrotateStart.log 0 &
|
||||||
+8
-3
@@ -755,13 +755,18 @@ int main(int argc, char *argv[])
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 1: // restart
|
case 1: // restart
|
||||||
log_printf(LOG_DEBUG,I_NOUSED,"\n\nrestart by daemon.\n");
|
/* Keep argument 1 compatible with the deployed daemon, but use the same
|
||||||
g_restart_app_flg = 1;
|
* no-power-off RF recovery path as a normal application start. A fresh
|
||||||
|
* process must rebuild the TALISE handle and the FPGA-side JESD link;
|
||||||
|
* g_restart_app_flg=1 skips adrv9009_init() and can leave TX unavailable. */
|
||||||
|
log_printf(LOG_DEBUG,I_NOUSED,
|
||||||
|
"\n\nrestart by daemon, use normal RF recovery path.\n");
|
||||||
|
g_restart_app_flg = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
log_printf(LOG_INFO, I_SYS_STATUS, "====System start===k=%d= 260428\n", USE_KOREA_VERSION);
|
log_printf(LOG_INFO, I_SYS_STATUS, "====System start===k=%d= 2607281650\n", USE_KOREA_VERSION);
|
||||||
|
|
||||||
pr_soft_start_ver();
|
pr_soft_start_ver();
|
||||||
|
|
||||||
|
|||||||
@@ -266,7 +266,7 @@ s8 ad9528_reg_read(u16 addr, u32 *data, u8 width)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
s8 ad9528_reg_write(u16 addr, u32 data, u8 width)
|
s8 ad9528_reg_write(u16 addr, u32 data, u8 width)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@@ -291,10 +291,40 @@ s8 ad9528_reg_write(u16 addr, u32 data, u8 width)
|
|||||||
{
|
{
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ad9528_is_ready(void)
|
||||||
s8 ad9528_config(void)
|
{
|
||||||
|
u32 chip_type = 0;
|
||||||
|
u32 part_version = 0;
|
||||||
|
u32 pll_cfg = 0;
|
||||||
|
u32 sysref_ctrl = 0;
|
||||||
|
u32 pll_status = 0;
|
||||||
|
|
||||||
|
/* Read-only probe used during Linux boot. Do not issue IO_UPDATE, reset the
|
||||||
|
* device, or touch SYSREF: a warm reboot must preserve the live RF clocks. */
|
||||||
|
if (ad9528_reg_read(0x0003, &chip_type, 1) != RET_SUCC ||
|
||||||
|
ad9528_reg_read(0x0006, &part_version, 1) != RET_SUCC ||
|
||||||
|
ad9528_reg_read(0x0200, &pll_cfg, 1) != RET_SUCC ||
|
||||||
|
ad9528_reg_read(0x0403, &sysref_ctrl, 1) != RET_SUCC ||
|
||||||
|
ad9528_reg_read(0x0508, &pll_status, 1) != RET_SUCC) {
|
||||||
|
PRINTF_ERROR("AD9528 ready check: SPI read failed\r\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
PRINTF_INFO("AD9528 ready check: type=0x%02x version=0x%02x "
|
||||||
|
"pll_cfg=0x%02x sysref=0x%02x status=0x%02x\r\n",
|
||||||
|
chip_type, part_version, pll_cfg, sysref_ctrl, pll_status);
|
||||||
|
|
||||||
|
return chip_type == 0x05 &&
|
||||||
|
part_version == 0x03 &&
|
||||||
|
pll_cfg == 0xE6 &&
|
||||||
|
sysref_ctrl == 0x91 &&
|
||||||
|
(pll_status & 0x02) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
s8 ad9528_config(void)
|
||||||
{
|
{
|
||||||
//u8 typeflag;
|
//u8 typeflag;
|
||||||
//u32 ad9528_data = 0x0;
|
//u32 ad9528_data = 0x0;
|
||||||
|
|||||||
@@ -15,8 +15,9 @@ typedef struct {
|
|||||||
}AD9528_REG_STR;
|
}AD9528_REG_STR;
|
||||||
|
|
||||||
|
|
||||||
s8 ad9528_config(void);
|
s8 ad9528_config(void);
|
||||||
|
int ad9528_is_ready(void);
|
||||||
|
|
||||||
#endif
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|||||||
+18
-14
@@ -21,29 +21,33 @@
|
|||||||
#include "ad9528_config.h"
|
#include "ad9528_config.h"
|
||||||
|
|
||||||
|
|
||||||
int main(void)
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
|
||||||
openSpiDev(SPIDEV_AD9528_NODE_NAME);
|
ret = openSpiDev(SPIDEV_AD9528_NODE_NAME);
|
||||||
if(ret < 0 ) {
|
if(ret < 0 ) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = initSpiDev();
|
ret = initSpiDev();
|
||||||
if(ret < 0 ) {
|
if(ret < 0 ) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = ad9528_config();
|
if(argc == 2 && strcmp(argv[1], "--check-ready") == 0) {
|
||||||
|
return ad9528_is_ready() ? 0 : 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = ad9528_config();
|
||||||
if(ret == 0) {
|
if(ret == 0) {
|
||||||
PRINTF_INFO("ad9528 cfg ok.\r\n");
|
PRINTF_INFO("ad9528 cfg ok.\r\n");
|
||||||
} else {
|
} else {
|
||||||
PRINTF_INFO("ERROR:ad9528 cfg fail.\r\n");
|
PRINTF_INFO("ERROR:ad9528 cfg fail.\r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return ret == 0 ? 0 : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user