示例#1
0
static long gpsctl_ioctl(struct file *file,unsigned int cmd, unsigned long arg)
{
	void __user *pa = (void __user *)arg;
	short is_poweron;
	short is_clkon;
	short is_reset;
	short is_on;
	switch (cmd) {
		case GPSCTL_IOC_SET_POWER:
			if (copy_from_user(&is_poweron, pa, sizeof(is_poweron)))
				return -EFAULT;
			gps_power_ctl(is_poweron);
			break;

		case GPSCTL_IOC_SET_CLK:
			if (copy_from_user(&is_clkon, pa, sizeof(is_clkon)))
				return -EFAULT;
			clk_32k_config(is_clkon);
			break;

		case GPSCTL_IOC_RESET:
			 if (copy_from_user(&is_reset, pa, sizeof(is_reset)))
				return -EFAULT;
			 gps_reset(is_reset);
			break;
		case GPSCTL_IOC_ONOFF:
			if (copy_from_user(&is_on, pa, sizeof(is_on)))
				return -EFAULT;
			gps_onoff(is_on);
			break;
		default:
			break;
	}
	return 0;
}
示例#2
0
void  GPS_Abnormal_process(void)
{
    		  //----------GPS 异常情况处理-----------------------
		   Gps_Exception.no_updateTimer++;
		  if( Gps_Exception.no_updateTimer>=100) 
			{
			   Gps_Exception.no_updateTimer=0;
			  if(Gps_Exception.Reset_gps==1)
				{
				  Gps_Exception.Reset_gps=0;
				  gps_onoff(1); // GPS power on
				  // rt_kprintf("\r\n	gps power on");   
				   Gps_Exception.GPS_Rst_counter++;
				   if(Gps_Exception.GPS_Rst_counter>5)
				   	{
                                        Gps_Exception.GPS_Rst_counter=0; 
				   	}
				} 
				else
				{
					if(Gps_Exception.current_datacou-Gps_Exception.last_datacou<100) 
						{
						        gps_onoff(0); //GPS  power off
							  Gps_Exception.Reset_gps=1;						  
							  //---------断电就置为不定位 -----------------						  
							  UDP_dataPacket_flag=0X03;
							  Car_Status[3]&=~0x02;   //Bit(1)
	                                            ModuleStatus &= ~Status_GPS;
							  GPS_getfirst=0;
						  //-------------------------------------------
						}
					else
						{ 
						   Gps_Exception.last_datacou=0;
						   Gps_Exception.current_datacou=0;          
						}
				}
	    }




}
示例#3
0
//    GPS  长期保持 V  处理
void  GPS_Keep_V_timer(void)
{
    if(((Warn_Status[3] & 0x60) == 0x00) && (UDP_dataPacket_flag == 0x03) ) // 在天线状态正常情况下 判断V
    {
        Gps_Exception.GPS_V_counter++;
        if(Gps_Exception.GPS_V_counter == GPS_V_LIMIT)
        {
            gps_onoff(0);
            StatusReg_GPS_V();
            // rt_kprintf("\r\n gps long v  cut power\r\n");
        }
        if(Gps_Exception.GPS_V_counter >= (GPS_V_LIMIT + 3))
        {
            gps_onoff(1);  // Gps module Power on	GPS 模块开电
            Gps_Exception.GPS_V_counter = 0;
            //  rt_kprintf("\r\n gps long v  recover power\r\n");
        }
    }
    else if(UDP_dataPacket_flag == 0x02)
    {
        Gps_Exception.GPS_V_counter = 0;
    }

}
示例#4
0
void  GPS_short_judge_timer(void)
{
       if(Gps_Exception.GPS_short_checkFlag==1)
       {
              Gps_Exception.GPS_short_timer++; 
		if(Gps_Exception.GPS_short_timer>10)
		{   //   关电 后开启
		     Gps_Exception.GPS_short_timer=0; 
		     gps_onoff(1);
		     rt_kprintf("\r\n	 再次开启GPS模块\r\n");   
		}	 
 
       }



}
示例#5
0
void  GPS_short_judge_timer(void)
{
       if(Gps_Exception.GPS_short_checkFlag==1)
       {
        Gps_Exception.GPS_short_timer++; 
		if(Gps_Exception.GPS_short_timer>100)
		{   //   关电 后开启
		     Gps_Exception.GPS_short_timer=0;  
		     gps_onoff(1);
		     rt_kprintf("\r\n	 再次开启GPS模块\r\n"); 
			 //---------------期待模块正常-----------
               Warn_Status[3]&=~0x20;
			   Warn_Status[3]&=~0x40; 
			 //----------------
			 Gps_Exception.GPS_short_checkFlag=0; 
		}	 
 
       }



}
示例#6
0
void Dayin_Fun(u8 dayin_par)
{
if(dayin_par==1)
	{
	memcpy(dayin_chepaihaoma+11,Vechicle_Info.Vech_Num,8);    //  2
	memcpy(dayin_chepaifenlei+11,Vechicle_Info.Vech_Type,6);  //  3
	memcpy(dayin_cheliangVIN+10,Vechicle_Info.Vech_VIN,17);   //  4
	memcpy(dayin_driver_NUM+13,JT808Conf_struct.Driver_Info.DriveName,21);    //5
	memcpy(dayin_driver_card+13,JT808Conf_struct.Driver_Info.DriverCard_ID,18);//6
	memcpy((char *)dayin_data_time+11,(char *)Dis_date,20);  //7
	switch(DaYin)
		{
		case 1:
			DaYin++;
			break;
		case 2://车牌号码 9
		    if(License_Not_SetEnable==1)
				printer("\r\n车牌号码:无牌照");
			else
			printer((const char *)dayin_chepaihaoma);
			DaYin++;
			break;
		case 3://车牌分类
			printer((const char *)dayin_chepaifenlei);
			DaYin++;
			break;
		case 4://车辆VIN号码 8
			printer((const char *)dayin_cheliangVIN);
			DaYin++;
			break;
		case 5://驾驶员代码 11   驾驶员姓名
			printer((const char *)dayin_driver_NUM);
			DaYin++;
			break;
		case 6://驾驶证代码
			printer((const char *)dayin_driver_card);
			DaYin++;
			break;
		case 7:
			if(ModuleStatus&Status_GPS)
				{
				printer((const char *)dayin_data_time);//00/00/00 00:00:00
				DaYin++;
				}
			else
				{
				printer("\r\n当前不定位,暂不打印停车前速度\r\n");
				DaYin=24;
				}
			break;
		case 8:
			printer("停车前15分钟车速:\r\n"); 
			DaYin++;
			break;
		case 9:
			Dayin_15MinSpeedFun(0);
			DaYin++;
			break;
		case 10:
			Dayin_15MinSpeedFun(1);
			DaYin++;
			break;
		case 11:
			Dayin_15MinSpeedFun(2);
			DaYin++;
			break;
		case 12:
			Dayin_15MinSpeedFun(3);
			DaYin++;
			break;
		case 13:
			Dayin_15MinSpeedFun(4);
			DaYin++;
			break;
		case 14:
			Dayin_15MinSpeedFun(5);
			DaYin++;
			break;
		case 15:
			Dayin_15MinSpeedFun(6);
			DaYin++;
			break;
		case 16:
			Dayin_15MinSpeedFun(7);
			DaYin++;
			break;
		case 17:
			Dayin_15MinSpeedFun(8);
			DaYin++;
			break;
		case 18:
			Dayin_15MinSpeedFun(9);
			DaYin++;
			break;
		case 19:
		    Dayin_15MinSpeedFun(10);
			DaYin++;
			break;
		case 20:
			Dayin_15MinSpeedFun(11);
			DaYin++;
			break;
		case 21:
			Dayin_15MinSpeedFun(12);
			DaYin++;
			break;
		case 22:
			Dayin_15MinSpeedFun(13);
			DaYin++;
			break;
		case 23:
			Dayin_15MinSpeedFun(14);
			DaYin++;
			break;
		case 24:
			printer("最后一次疲劳驾驶记录:\r\n");
			DaYin++;
			break;
		case 25:
			if(TiredDrv_write>0)
				{
				Dayin_TireExpsFun(1,1);
				DaYin++;
				}
			else
				{
				printer("无疲劳驾驶记录\r\n");
				DaYin=28;
				}
			break;
		case 26:
			Dayin_TireExpsFun(1,2);
			DaYin++;
			break;
		case 27:
			Dayin_TireExpsFun(1,3);
			DaYin++;
			break;
		case 28:
			printer("最后一次超速驾驶记录:\r\n");
			DaYin++;
			break;
		case 29:
			if(ExpSpdRec_write>0)
				{
				Dayin_TireExpsFun(2,1);
				DaYin++;
				}
			else
				{
				printer("无超速驾驶记录\r\n");
				DaYin=33;
				}
			break;
		case 30:
			Dayin_TireExpsFun(2,2);
			DaYin++;
			break;
		case 31:
			Dayin_TireExpsFun(2,3);
			DaYin++;
			break;
		case 32:
			Dayin_TireExpsFun(2,4);
			DaYin++;
			break;	
	    case 33:
			step(50,1000);
			DaYin++;
			break;
	   case 34:
			step(50,1000);
			DaYin++;
			break;
	    case 35:
			DaYin=0;
			print_rec_flag=0;
			GPIO_ResetBits(GPIOB,GPIO_Pin_7);//打印关电

			//----------------------------------------------------- 
			gps_onoff(1);  //开启GPS 模块的点
			print_workingFlag=0;  // 打印状态进行中
			Power_485CH1_ON;     // 开启485
			//Speak_ON;      //  开启音频功放     
			//-----------------------------------------------------
			
			rt_kprintf("\r\n----------打印完毕");
			break;
		}
	
	}
}