/***************************************************************************** * PROT_digital_v30_Core1.c *****************************************************************************/ #include #include #include #include #include "adi_initialize.h" #include "PROT_digital_v30_Core1.h" #include "sys/drivers.h" //#include "cgu.h" #include "rtdb.h" #include "digit_protect\inc\digit_commonapi.h" #include "adi_osal.h" /** * Place program arguments in the following string. */ extern void timer_interrupt(void); extern void pulseAjustClock(); //秒脉冲中断处理函数 extern int progStart(int ErrCode); extern void KaiChuChannelReset(); //开出通道复位 extern void maintask(void); extern int spi_flash_init(void); extern void gse_handle( void ); extern int goosesmv_init( void ); //int inf_shm_printf_write( const char *forms, ... ); extern void adi_gpio_init(); double sGetMsTime ( void ); extern void adi_qpio_wd_set(); extern void adi_qpio_wd_clear(); extern int driver_can_adi_open_can0( int baudRate ); extern int driver_can_adi_handle( void ); static double restartTime=0; /* 设定过多少毫秒后,重启系统(停止喂狗) **/ int set_boottime( int millSecs ) { restartTime = sGetMsTime() + millSecs + 10.0; return 0; } static int feed_watch_dog( void ) { if( restartTime < 10 || sGetMsTime() 0 ) { int gsv_clnp_recv_submit_buffer( int eth_index ); subNum = gsv_clnp_recv_submit_buffer( 2 ); if( 0 != subNum ) { inf_shm_printf_write("gsv_clnp_recv_submit_buffer failed.\n"); } subNum = 0; } #endif #if 0 int gsv_clnp_send( int eth_index, unsigned char *msg, int msg_len ); unsigned char buff[128]={00,00,00,00,00,00,11,22,33,44,55,66,0x81,00,00,00, 0x88,0xb8,0x30,0x08,0x00,0x37,0x00,0x00,0x00,0x00,0x61,0x2d,0x80,0x01,0x62,0x81, }; static unsigned char dd=0,iLoop; for( iLoop=48; iLoop<49; iLoop++ ) buff[iLoop]=(unsigned char)(iLoop+dd); dd++; gsv_clnp_send(3, buff, sizeof(buff) ); buff[iLoop]=(unsigned char)(iLoop+dd); gsv_clnp_send(3, buff, sizeof(buff) ); //gsv_clnp_send(3, buff, sizeof(buff) ); #endif #if 0 static unsigned char status=0; status = !status; gw61850gse_data_value_change(1,NULL,2041, (void *)&status); gw61850gse_data_value_change(1,NULL,2054, (void *)&status); gw61850gse_check_and_send(); #endif #if 0 int addr; unsigned char buf[1024]={0x55}; addr = 64*1024 * (3 + 2); //在spi_flash_write中已经将该快擦除 memset(buf, 0x55, 1024 ); spi_flash_write(addr, buf, 1024 ); #endif #if 0 static int tmp=0; tmp++; if( tmp > 4 ) { tmp = 0; gsv_clnp_linkport_reable_rx(2); SYS_TRACE("\n \t>>Now reset LinkPort.\n" ); } #endif //SYS_TRACE(">>Now protect circle is %d, time is %0.3f.\n", // *ptr/1000, sGetMsTime()/1000 ); } //kk2 = sGetMsTime(); /* if((kk3 = kk2 - kk1)>= 8) { SYS_TRACE("the circle %d time is longer than 8ms and the circle time is %f\n",*ptr,kk3); } */ #endif } /* Begin adding your custom code here */ }