Esempio n. 1
0
static void __init mioa701_machine_init(void)
{
	PSLR  = 0xff100000; /* SYSDEL=125ms, PWRDEL=125ms, PSLR_SL_ROD=1 */
	PCFR = PCFR_DC_EN | PCFR_GPR_EN | PCFR_OPDE;
	RTTR = 32768 - 1; /* Reset crazy WinCE value */
	UP2OCR = UP2OCR_HXOE;

	pxa2xx_mfp_config(ARRAY_AND_SIZE(mioa701_pin_config));
	pxa_set_ffuart_info(NULL);
	pxa_set_btuart_info(NULL);
	pxa_set_stuart_info(NULL);
	mio_gpio_request(ARRAY_AND_SIZE(global_gpios));
	bootstrap_init();
	pxa_set_fb_info(NULL, &mioa701_pxafb_info);
	pxa_set_mci_info(&mioa701_mci_info);
	pxa_set_keypad_info(&mioa701_keypad_info);
	pxa_set_udc_info(&mioa701_udc_info);
	pxa_set_ac97_info(&mioa701_ac97_info);
	pm_power_off = mioa701_poweroff;
	arm_pm_restart = mioa701_restart;
	platform_add_devices(devices, ARRAY_SIZE(devices));
	gsm_init();

	i2c_register_board_info(1, ARRAY_AND_SIZE(mioa701_pi2c_devices));
	pxa_set_i2c_info(&i2c_pdata);
	pxa27x_set_i2c_power_info(NULL);
	pxa_set_camera_info(&mioa701_pxacamera_platform_data);
}
Esempio n. 2
0
void gsmInit(Serial *port) {
	// Saving UART port device
	ASSERT(port);
	gsm = port;
	LOG_INFO("GSM: Init\n");
	gsm_init();
}
Esempio n. 3
0
File: mioa701.c Progetto: E-LLP/n900
static void __init mioa701_machine_init(void)
{
	PSLR  = 0xff100000; /* SYSDEL=125ms, PWRDEL=125ms, PSLR_SL_ROD=1 */
	PCFR = PCFR_DC_EN | PCFR_GPR_EN | PCFR_OPDE;
	RTTR = 32768 - 1; /* Reset crazy WinCE value */
	UP2OCR = UP2OCR_HXOE;

	pxa2xx_mfp_config(ARRAY_AND_SIZE(mioa701_pin_config));
	mio_gpio_request(ARRAY_AND_SIZE(global_gpios));
	bootstrap_init();
	set_pxa_fb_info(&mioa701_pxafb_info);
	pxa_set_mci_info(&mioa701_mci_info);
	pxa_set_keypad_info(&mioa701_keypad_info);
	udc_init();
	pm_power_off = mioa701_poweroff;
	arm_pm_restart = mioa701_restart;
	platform_add_devices(devices, ARRAY_SIZE(devices));
	gsm_init();
	mioa701_battery_init();
}
Esempio n. 4
0
static void __init mioa701_machine_init(void)
{
	int rc;

	PSLR  = 0xff100000; /* SYSDEL=125ms, PWRDEL=125ms, PSLR_SL_ROD=1 */
	PCFR = PCFR_DC_EN | PCFR_GPR_EN | PCFR_OPDE;
	RTTR = 32768 - 1; /* Reset crazy WinCE value */
	UP2OCR = UP2OCR_HXOE;

	/*
	 * Set up the flash memory : DiskOnChip G3 on first static memory bank
	 */
	__raw_writel(0x7ff02dd8, MSC0);
	__raw_writel(0x0001c391, MCMEM0);
	__raw_writel(0x0001c391, MCATT0);
	__raw_writel(0x0001c391, MCIO0);


	pxa2xx_mfp_config(ARRAY_AND_SIZE(mioa701_pin_config));
	pxa_set_ffuart_info(NULL);
	pxa_set_btuart_info(NULL);
	pxa_set_stuart_info(NULL);
	rc = gpio_request_array(ARRAY_AND_SIZE(global_gpios));
	if (rc)
		pr_err("MioA701: Failed to request GPIOs: %d", rc);
	bootstrap_init();
	pxa_set_fb_info(NULL, &mioa701_pxafb_info);
	pxa_set_mci_info(&mioa701_mci_info);
	pxa_set_keypad_info(&mioa701_keypad_info);
	pxa_set_udc_info(&mioa701_udc_info);
	pxa_set_ac97_info(&mioa701_ac97_info);
	pm_power_off = mioa701_poweroff;
	platform_add_devices(devices, ARRAY_SIZE(devices));
	gsm_init();

	i2c_register_board_info(1, ARRAY_AND_SIZE(mioa701_pi2c_devices));
	pxa_set_i2c_info(&i2c_pdata);
	pxa27x_set_i2c_power_info(NULL);
	pxa_set_camera_info(&mioa701_pxacamera_platform_data);
}
Esempio n. 5
0
File: main.c Progetto: dpmjoshi/ARM7
void main(void)
{
 IO0DIR |= 0x00000020;     // GSM init LED Indication 
 IO1DIR  |= 0X0FFF0000;	 //pins 1.16 to 1.23 output pins
 IO0DIR  |= 0X003E0C88;	 //port 0 rs and en as output
 IO0CLR   = 0X00FF0000;

 IO0SET   = 0X0FF00400;
 lcd_init();
 lcd_line2_disp("SIM900 testing",3);
 uart_init_interrupt();
// VICIntEnClr |= (1 << UART1_CHANNEL_NO);
 gsm_init();
 rtc_init();
 timer1_init_interrupt();
 GSM_APP_diallist_init(10);
 ms_delay(10000);
 //VICIntEnable |= (1 << UART1_CHANNEL_NO);
 uart0_tx_string("\n\rGSM Init Complete...");
 if(Uc_stat_code_gsm != 0)
 {
	Uc_stat_code_gsm = 0;
	uart0_tx_string("\n\n\rBigg Big reason to Worry...!!!!");
 }


 
 while(1)
 {
  //gsm_check_status();	

	rtc_get_time(time);
	lcd_line_disp(time,12,1);

   temp_key = get_key(0);

   	if(temp_key == '1')
	{
		GSM_APP_call(phone_no);		
	}
   	else if(temp_key == '2')
	{
		ms_delay(1000);
		GSM_APP_diallist_show();	             
	}
   	else if(temp_key == 'D')
   	{
		gsm_end_voice_call();
		ms_delay(2000);
		APP_default_page();
	}
	else if(temp_key == 'E')
   	{
		GSM_APP_options(main_opt, 3);
		ms_delay(2000);
		APP_default_page();
	}
	else if(temp_key == '0')
	{
		GSM_APP_write(msg);
	}
  /*
  if(Uc_stat_code_gsm == 11)
  {
	if(strgcmp(&Uc_uart1_str_gsm[0],"\r\n+CMTI:"))
	{
		Uc_stat_code_gsm = 20;
		Uc_gsm_sms_read[8] = Uc_uart1_str_gsm[14];
		uart0_tx_string(Uc_uart1_str_gsm);
		uart0_tx_string("\n\n\rCompared");
		uart1_tx_string(Uc_gsm_sms_read);
	}
	else
	{
		Uc_stat_code_gsm = 0;	// Comparision fails which shows that unwanted event ocurred. Thus making status code 0 &
							   // byte_cnt = 0. So that hence forth we do not miss any notifications.
		uart0_tx_string("\n\n\rCompare fails:");
 	}	
  }
  else if(Uc_stat_code_gsm == 20)
  {
  	 //uart0_tx_string("\n\rcase 20:");
  }
  else if(Uc_stat_code_gsm == 23)
  {
	str_copy(&SMS_cur.detail[33], SMS_cur.ph_no, 13);
	uart0_tx_string("\n\rMSG Details. : ");
	uart0_tx_string(&SMS_cur.detail[10]);

	uart0_tx_string("\n\rPhone No. : ");
	uart0_tx_string(SMS_cur.ph_no);

  }
  else if(Uc_stat_code_gsm == 24)
  {
 	Uc_stat_code_gsm = 0;
	uart0_tx_string("\n\rMessage : ");
	uart0_tx_string(SMS_cur.data);
  }	
  
  */   
 }	
}
Esempio n. 6
0
void
GSMTask (void *arg)
{
    static const char fname[] = "GSMTask";
    void           *msg;
    phn_syshdr_t   *syshdr;
    boolean        release_msg = TRUE;

    /*
     * Get the GSM message queue handle
     * A hack until the tasks in irx are
     * CPRized.
     */
    gsm_msg_queue = (cprMsgQueue_t) arg;
    if (!gsm_msg_queue) {
        GSM_ERR_MSG(GSM_F_PREFIX"invalid input, exiting\n", fname);
        return;
    }

    if (platThreadInit("GSMTask") != 0) {
        return;
    }

    /*
     * Adjust relative priority of GSM thread.
     */
    (void) cprAdjustRelativeThreadPriority(GSM_THREAD_RELATIVE_PRIORITY);

    /*
     * Initialize all the GSM modules
     */
    lsm_init();
    fsm_init();
    fim_init();
    gsm_init();
    dcsm_init();

    cc_init();

    fsmutil_init_shown_calls_ci_map();
    /*
     * On Win32 platform, the random seed is stored per thread; therefore,
     * each thread needs to seed the random number.  It is recommended by
     * MS to do the following to ensure randomness across application
     * restarts.
     */
    cpr_srand((unsigned int)time(NULL));

    /*
     * Cache random numbers for SRTP keys
     */
    gsmsdp_cache_crypto_keys();

    while (1) {

        release_msg = TRUE;

        msg = cprGetMessage(gsm_msg_queue, TRUE, (void **) &syshdr);
        if (msg) {
            switch (syshdr->Cmd) {
            case TIMER_EXPIRATION:
                gsm_process_timer_expiration(msg);
                break;

            case GSM_SIP:
            case GSM_GSM:
                release_msg = gsm_process_msg(syshdr->Cmd, msg);
                break;

            case DP_MSG_INIT_DIALING:
            case DP_MSG_DIGIT_STR:
            case DP_MSG_STORE_DIGIT:
            case DP_MSG_DIGIT:
            case DP_MSG_DIAL_IMMEDIATE:
            case DP_MSG_REDIAL:
            case DP_MSG_ONHOOK:
            case DP_MSG_OFFHOOK:
            case DP_MSG_UPDATE:
            case DP_MSG_DIGIT_TIMER:
            case DP_MSG_CANCEL_OFFHOOK_TIMER:
                dp_process_msg(syshdr->Cmd, msg);
                break;

            case SUB_MSG_B2BCNF_SUBSCRIBE_RESP:
            case SUB_MSG_B2BCNF_NOTIFY:
            case SUB_MSG_B2BCNF_TERMINATE:
                sub_process_b2bcnf_msg(syshdr->Cmd, msg);
                break;

            case SUB_MSG_FEATURE_SUBSCRIBE_RESP:
            case SUB_MSG_FEATURE_NOTIFY:
            case SUB_MSG_FEATURE_TERMINATE:
                sub_process_feature_msg(syshdr->Cmd, msg);
                break;

            case SUB_MSG_KPML_SUBSCRIBE:
            case SUB_MSG_KPML_TERMINATE:
            case SUB_MSG_KPML_NOTIFY_ACK:
            case SUB_MSG_KPML_SUBSCRIBE_TIMER:
            case SUB_MSG_KPML_DIGIT_TIMER:
                kpml_process_msg(syshdr->Cmd, msg);
                break;

            case REG_MGR_STATE_CHANGE:
                gsm_reset();
                break;
            case THREAD_UNLOAD:
                destroy_gsm_thread();
                break;

            default:
                GSM_ERR_MSG(GSM_F_PREFIX"Unknown message\n", fname);
                break;
            }

            cprReleaseSysHeader(syshdr);
            if (release_msg == TRUE) {
                cprReleaseBuffer(msg);
            }
            
            /* Check if there are pending messages for dcsm 
             * if it in the right state perform its operation 
             */
            dcsm_process_jobs();
        }
    }
}
int main(int argc,char **argv)
{	
	uart_config();
	gsm_init();
	sendMessage("18664307310", "4E2D");
	global.isReceivedMsg = false;
	pthread_mutex_init(&global.db, NULL);
	if((global.shmid=shmget(IPC_PRIVATE,MAX_BUFFER_SIZE,0666))<0)
	{
		perror("create share-memory");
		exit(1);
	}
	//create receive message Thread
	pthread_t listenClientThreadID;
	//pthread_create(&listenClientThreadID,NULL,listen_client_connect_thread_func,NULL);
	//pthread_detach(listenClientThreadID);

	int read_length = 0;
	char buffer[MAX_BUFFER_SIZE]={0};
	char command[MAX_BUFFER_SIZE] ={0};
	char *share_msg_info_addr;
	
	if((share_msg_info_addr = shmat(global.shmid,0,0))==(void *)-1)
	{
		perror("Parent: shmat:");
		exit(1);
	}
	
	while(true)
	{			
		if(global.isReceivedMsg)
		{
			sendMessage("18664307310", "4E2D");
			global.isReceivedMsg = false;
		}
		if((read_length=read(global.fd,buffer,sizeof(buffer)))>0)
		{
			if(strstr(buffer,"0891"))
			{
				// 1. get the messgae info
				message_info_t rcv_info = handler_receive_msg(strstr(buffer,"0891"));
				// 2.share memory
				memset(buffer,0,sizeof(buffer));
				sprintf(buffer,"%s,%s,%s\0",rcv_info.send_number,rcv_info.send_time,rcv_info.send_content);
				memset(share_msg_info_addr,0,sizeof(share_msg_info_addr));
				memcpy(share_msg_info_addr,buffer,strlen(buffer));
				// 3.save log
				save_gsm_log(rcv_info);
				// 4.delete it from SIM
				memset(buffer,0,sizeof(buffer));
				sprintf(buffer,"AT+CMGD=%s\r\0",rcv_msg_sim_index);
				write(global.fd,buffer,strlen(buffer));
				global.isReceivedMsg = true;
			}
			else if(strstr(buffer,"CMTI:"))//new message is coming
			{
				memset(command,0,sizeof(command));
				strcpy(command,buffer);
				printf("new message : %s\n",buffer);
				memset(buffer,0,sizeof(buffer));
				strtok(command,",");
				strcpy(rcv_msg_sim_index,strtok(NULL,","));
				sprintf(buffer,"AT+CMGR=%s\r\0",rcv_msg_sim_index);
				write(global.fd,buffer,strlen(buffer));  //read new message command
			}
			else
			{
				printf("buffer is: %s\n",buffer);
			}
			memset(buffer,0,sizeof(buffer));
		}
	}
	return 0;
}
Esempio n. 8
0
/**
 * This function will startup RT-Thread RTOS.
 */
void rtthread_startup(void)
{
	char buf[128];
	char *psrc;
	char *pdst=RT_NULL;
	int i,linkno,infolen;


	/* init board */
	rt_hw_board_init();

	/* show version */
	rt_show_version();

	/* init tick */
	rt_system_tick_init();

	/* init kernel object */
	rt_system_object_init();

	/* init timer system */
	rt_system_timer_init();

    rt_system_heap_init((void*)STM32_SRAM_BEGIN, (void*)STM32_SRAM_END);

	/* init scheduler system */
	rt_system_scheduler_init();

	/* init all device */
	rt_device_init_all();


	rt_kprintf("\r\nrcc.csr=%08x",RCC->CSR);

/*
	sprintf(buf,"%s","%IPDATA:1,3,\"123\"");

	psrc=buf;
	pdst=buf;
	rt_kprintf("buf=%s\r\n",psrc);
	i = sscanf( psrc, "%%IPDATA:%d,%d,%s", &linkno, &infolen, pdst );
	rt_kprintf("\r\ni=%d,linkno=%d,infolen=%d,pdst=%s\r\n",i,linkno,infolen,pdst);
*/	
	/* init application */
	sst25_init(); /*在此初始化,gsm才能读取参数,放在app_thread中不会先执行*/
	rt_application_init();
	RS485_init();
	gps_init();
	gsm_init();
	hmi_init();
	jt808_init();
 	

#ifdef RT_USING_FINSH
	/* init finsh */
	finsh_system_init();
	finsh_set_device( FINSH_DEVICE_NAME );
#endif

    /* init timer thread */
    rt_system_timer_thread_init();

	/* init idle thread */
	rt_thread_idle_init();

	/* start scheduler */
	rt_system_scheduler_start();

	/* never reach here */
	return ;
}