/* ------------------------------------------------------------------------------ */
void AUDL_Task(task_entry_struct * task_entry_ptr)
{
   /*----------------------------------------------------------------*/
   /* Local Variables                                                */
   /*----------------------------------------------------------------*/
   ilm_struct current_ilm;

   /*----------------------------------------------------------------*/
   /* Initialization                                                 */
   /*----------------------------------------------------------------*/
   
   
   /*----------------------------------------------------------------*/
   /* Code Body (Wait Message)                                       */
   /*----------------------------------------------------------------*/

   while (1)
   {
#if VERIFY_DATA_TO_DSP
      VERIFY_DATA_TO_DSP_SAVE_DATA();
#endif

      msg_receive_extq(&current_ilm);
      kal_set_active_module_id(MOD_AUDL);

      AUDL_Msg_Handler((void*)&current_ilm);

      destroy_ilm(&current_ilm);
   }
}
示例#2
0
/*****************************************************************************
 * FUNCTION
 *  med_task_main
 * DESCRIPTION
 *  This function is main function of media task.
 * PARAMETERS
 *  task_entry_ptr      [?]     
 * RETURNS
 *  void
 *****************************************************************************/
void med_task_main(task_entry_struct *task_entry_ptr)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    ilm_struct current_ilm;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/

#if !defined(L1_NOT_PRESENT) && !defined(__UE_SIMULATOR__)
    SP_Drv_Init_Task();
#endif

    while (1)
    {
        msg_receive_extq(&current_ilm);
        
        kal_set_active_module_id(current_ilm.dest_mod_id);

        med_main((void*)&current_ilm);

        destroy_ilm(&current_ilm);
    }

}
示例#3
0
static void uart_core_task_main(task_entry_struct* task_entry_ptr)
{
	ilm_struct current_ilm;
	kal_uint32 rt_event, uart_event=0;
	kal_uint32 count = 0;

	kal_set_active_module_id(MOD_UARTCORE);
	kal_mem_set(&current_ilm, 0, sizeof(ilm_struct));

	while(1)
	{
		//dbg_print("=========>uartcore_task_main\r\n");

		// msg_receive_extq will block, therefore we poll if any message exist first
		while(msg_get_extq_messages() > 0)
		{
			if(msg_receive_extq(&current_ilm) != KAL_TRUE)
			{
				break;
			}

			switch (current_ilm.msg_id)
			{
				default:
					break;
			}

			destroy_ilm(&current_ilm);
		}
			// wait some open uart port first time;
		if(uart_open_event <= 0){
			uart_event = hmu_hifeg_wait(HIF_DRV_EG_UART_IND_EVENT);
		}
		if((HIF_DRV_EG_UART_IND_EVENT & uart_event) || uart_open_event>0){
		// Wait someone notify HMU to wake up HIF.
		rt_event = hmu_hifeg_wait(HIF_DRV_EG_HIF_TICK_EVENT_UART);
		if((HIF_DRV_EG_HIF_TICK_EVENT_UART & rt_event))
		{
			count++;
			if(0 == (count % 1) )
			{
				if(uart_tgpd_head[uart_port1] != uart_tgpd_tail[uart_port1])
					uart_en_q_de_q_with_mutex(uart_port1, UART_TX, UART_DE_Q, NULL, NULL);
			
				if(uart_rgpd_head[uart_port1] != uart_rgpd_tail[uart_port1])
					uart_en_q_de_q_with_mutex(uart_port1, UART_RX, UART_DE_Q, NULL, NULL);
#if defined(__FLAVOR_MULTI_MODE_ROUTER__) || defined(__FLAVOR_SINGLE_MODE_ROUTER__)
	//in Router product. SUART0 is AP  own, so it should not be init here.
#else
				if(uart_tgpd_head[uart_port2] != uart_tgpd_tail[uart_port2])
					uart_en_q_de_q_with_mutex(uart_port2, UART_TX, UART_DE_Q, NULL, NULL);
			
				if(uart_rgpd_head[uart_port2] != uart_rgpd_tail[uart_port2])
					uart_en_q_de_q_with_mutex(uart_port2, UART_RX, UART_DE_Q, NULL, NULL);
#endif
			}
		}
	}
}
}
/*******************************************************************************
* FUNCTION
*   FT_Task
*
* DESCRIPTION
*   Entry point for the factory testing task. The function performs initialisation,
*   then sits in an infinite loop reading messages or reports and dispatching
*   them.
*
* CALLS
*
* PARAMETERS
*   None
*
* RETURNS
*   None
*
* GLOBALS AFFECTED
*   None
*******************************************************************************/
void FTC_Task(task_entry_struct * task_entry_ptr)
{
    ilm_struct current_ilm;
    while ( 1 )
    {
        msg_receive_extq(&current_ilm);
        FTC_DispatchMessage(&current_ilm);
        destroy_ilm(&current_ilm);
    }
}
void FT_Task(task_entry_struct * task_entry_ptr)
{
    ilm_struct current_ilm;
    FT_Initialization(task_entry_ptr);
    while ( 1 )
    {
        msg_receive_extq(&current_ilm );
        FT_DispatchMessage(&current_ilm );
        destroy_ilm(&current_ilm);
    }
}
void l1audio_sph_srv_task_main(task_entry_struct *task_entry_ptr)
{
   ilm_struct current_ilm;

   while(1)
   {
      msg_receive_extq(&current_ilm);
      kal_set_active_module_id(current_ilm.dest_mod_id);

      l1audio_sph_srv_main((void *)&current_ilm);

      destroy_ilm(&current_ilm);
   }
}
void cccisrv_task_main(task_entry_struct *task_entry_ptr)
{
    ilm_struct  current_ilm;
    ccci_rpc_task_main_init();
    ccci_ipc_task_main_init();
#if defined(__CCCIFS_SUPPORT__)    
    ccci_fs_task_main_init();
#endif
    kal_set_active_module_id(MOD_CCCISRV);
    while (1) {
        /*Receive message from ext queue, this may suspend.*/
        if (KAL_TRUE == msg_receive_extq(&current_ilm)) {
            cccisrv_task_on_ilm(&current_ilm);
        }
    }
}
示例#8
0
/*******************************************************************************
* FUNCTION
*  cmux_task_main
* DESCRIPTION
*   dispatch primitives to modules
*
* PARAMETERS
*   IN          *task_entry_ptr
* RETURNS
*   void
* GLOBALS AFFECTED
*   None
*******************************************************************************/
static void cmux_task_main(task_entry_struct *task_entry_ptr)
{
    ilm_struct current_ilm;

    while (1)
    {
        // External Queue
        msg_receive_extq(&current_ilm);
        kal_set_active_module_id(current_ilm.dest_mod_id); 

        do {
#ifdef __MBIM_SUPPORT__
            if (mbim_ctrl_dispatchMsg(&current_ilm)) break;
#endif

#ifdef __USB_TETHERING__
            if (rndis_ctrl_dispatchMsg(&current_ilm)) break;
#endif

#ifdef __CMUX_SUPPORT__
            if (cmux_dispatchMsg(&current_ilm)) break;
#endif

            break;
        }while(1);
        
        destroy_ilm(&current_ilm);

        // Internal Queue
#ifdef __CMUX_SUPPORT__
        while (msg_receive_intq(&current_ilm))
        {
            kal_set_active_module_id(current_ilm.dest_mod_id);
            
            cmux_dispatchMsg(&current_ilm);
            
            destroy_ilm(&current_ilm);
        }
#endif
    }
} /* end of cmux_task_main() */
示例#9
0
void usbc_cosim_core_task_main(task_entry_struct* task_entry_ptr)
{
    kal_uint8 wait_count = 0;
    ilm_struct current_ilm;
    kal_uint32 rt_event;
    kal_uint16 timer_index;
    module_type dest_mod;
    msg_type msg_id;
    usbc_class_device_esl_connect_parm  *rsp_msg_p;
    usbc_core_t* pUsbCore = usbc_core_get_instance();

    kal_set_active_module_id(MOD_USBCORE);
    kal_mem_set(&current_ilm, 0, sizeof(ilm_struct));

    usbc_esl_printf("Start USBCORE task loop...\n");
    while(1)
    {
        while ( msg_get_extq_messages() > 0 )
        {
            if ( msg_receive_extq(&current_ilm) != KAL_TRUE )
            {
                break;
            }

            switch (current_ilm.msg_id)
            {
                case MSG_ID_TIMER_EXPIRY:
                    timer_index = evshed_get_index(&current_ilm);
                    switch (timer_index)
                    {
                        case USBC_WK_NOTIFY_INDEX:
                            ASSERT(0);
                            evshed_timer_handler(pUsbCore->usbc_es_wk_notify_g);
                            break;

                        default:
                            break;
                    }
                    break;

                default:
                    break;
            }

            destroy_ilm(&current_ilm);
        }

        /* Wait someone notify HMU to wake up HIF. */
        rt_event = hmu_hifeg_wait(HIF_DRV_EG_HIF_TICK_EVENT | HIF_DRV_EG_USBC_IND_EVENT);
        if ((HIF_DRV_EG_HIF_TICK_EVENT & rt_event) &&
            (pUsbCore->state != USBC_USB_STATE_SUSPENDED))
        {
            /* poll HIF queue data */
            usbc_esl_printf("Start HIF USB poll queue...\n");
            usbc_normal_hif_poll_queue();
            usbc_esl_printf("End HIF USB poll queue...\n");
        }
        if ((HIF_DRV_EG_USBC_IND_EVENT & rt_event))
        {
            /* Handle indications */
            usbc_normal_hif_process_indications();
        }

        // wait for IPCORE finishing handling ILMs in ipc_init
        if (wait_count < 1)
        {
            wait_count++;

            if(wait_count == 1)
            {
                usbc_esl_printf("Emulare USB enumeration...\n");
                // Emulate USB plug-in for ESL COSIM
                usbc_cosim_hif_attach();

                usbc_esl_printf("Set USB class to connected state...\n");
                // change USB classes state to transfer data
                rsp_msg_p = (usbc_class_device_esl_connect_parm*)construct_local_para(sizeof(usbc_class_device_esl_connect_parm), TD_RESET);
                ASSERT(rsp_msg_p);
                rsp_msg_p->class_device_id = 0;
                msg_id = MSG_ID_USBCLASS_USBCORE_ESL_ENTER_CONNECTED_STATE_REQ;

                switch ((pUsbCore->class_device[0]).class_type)
                {
#ifdef __USB_MBIM_SUPPORT__
                    case USB_CLASS_MBIM:
                        dest_mod = MOD_MBIM;
                        break;
#endif
#ifdef __USB_ECM_SUPPORT__
                    case USB_CLASS_ECM:
                        dest_mod = MOD_ECM;
                        break;
#endif
#ifdef __USB_RNDIS_SUPPORT__			
                    case USB_CLASS_RNDIS:
                        dest_mod = MOD_RNDIS;
                        break;
#endif			
                    default:
                        // We assume the first class device must be a NIC for ESL CO-SIM
                        ASSERT(0);
                        return;
                        break;
                }

                msg_send6(MOD_USBCORE,  // src module
                          dest_mod,  // dst module
                          0,       // sap id
                          msg_id,
                          (local_para_struct*)rsp_msg_p,
                          0); //msg id
            }
        }
    }
}