コード例 #1
0
kal_bool usbc_cosim_core_task_init(void)
{
    usbc_core_t* pUsbCore;
    kal_char usbc_class_mutex_name[50];

#ifdef IPCORE_NOT_PRESENT
    hmu_boot_init();
#endif

    usbc_set_op_mode(USBC_OP_MODE_NORMAL);
    kal_mem_set(usbc_core_get_instance(), 0, sizeof(usbc_core_t));

    usbc_core_clear_register();
    usbc_core_clear_status();

    pUsbCore = usbc_core_get_instance();
    // create enhance mutex
    sprintf(usbc_class_mutex_name, "USBC_CLASS_REMOTE_WK_MUTEX");
    pUsbCore->usbc_class_remote_wk_mutex = kal_create_enh_mutex(usbc_class_mutex_name);
    sprintf(usbc_class_mutex_name, "USBC_CLASS_RENOTIFY_MUTEX");
    pUsbCore->usbc_class_renotify_mutex = kal_create_enh_mutex(usbc_class_mutex_name);
    sprintf(usbc_class_mutex_name, "USBC_CLASS_FUNC_ACCESS_MUTEX");
    pUsbCore->usbc_class_func_access_mutex = kal_create_enh_mutex(usbc_class_mutex_name);
    if ( NULL == pUsbCore->usbc_class_remote_wk_mutex ||
         NULL == pUsbCore->usbc_class_renotify_mutex ||
         NULL == pUsbCore->usbc_class_func_access_mutex )
    {
        ASSERT(0);
    }

    // initial an evnet scheduler
    pUsbCore->usbc_es_wk_notify_g = evshed_create(
                        "USBC_WK_NOTIFY", /* timer_name: event scheduler name */
                        MOD_USBCORE, /* dest_mod_id: system sends timeout message to this module when event scheduler timeout happens */
                        0, /* fuzz */
                        255); /* max_delay_ticks */
    if (pUsbCore->usbc_es_wk_notify_g) {
        evshed_set_index(pUsbCore->usbc_es_wk_notify_g, USBC_WK_NOTIFY_INDEX);
    } else {
        ASSERT(0);
    }

    usbc_normal_hif_factory();
    usbc_cosim_hif_factory();

    usbc_stack_checkin(USB_CLASS_NUM, NULL);
    return KAL_TRUE;
}
コード例 #2
0
void SP_Strm_Enable( ilm_struct *ilm_ptr )
{
   UART_CTRL_OPEN_T data;
   DCL_STATUS status;
   cmux_dlc_connect_ind_struct *local_para;
   
   if (intSStrmControl != NULL )
      return;
   local_para = (cmux_dlc_connect_ind_struct *)ilm_ptr->local_para_ptr;
   
   if( ss_enh_mutex == NULL) // no delete mutex
      ss_enh_mutex = kal_create_enh_mutex( "SP_STRM_ENH_MUTEX" );
   intSStrmControl = (SpStrmControl *)get_ctrl_buffer(sizeof(SpStrmControl));
   intSStrmControl->ul_ready = KAL_FALSE;
   intSStrmControl->ul_sample_count = 0;
   intSStrmControl->port = local_para->port;
   kal_prompt_trace(MOD_L1SP, "SS port %d", intSStrmControl->port);
#if !defined(SS_UNIT_TEST)   
   data.u4OwenrId = MOD_MED;
   intSStrmControl->cmux_handle = DclSerialPort_Open(intSStrmControl->port, 0);
   status = DclSerialPort_Control(intSStrmControl->cmux_handle, SIO_CMD_OPEN, (DCL_CTRL_DATA_T*)&data);
   ASSERT(STATUS_OK == status);
#endif
   L1SP_Register_Strm_Handler( spStrmOnHandler, spStrmOffHandler, spStrmCallback );
}