/* * FUNCTION * Alter_init * * DESCRIPTION * This function is to intial the Alter module. * * CALLS * * PARAMETERS * outtype : pwm, pdm * * RETURNS * None * * GLOBALS AFFECTED * external_global */ void Alter_init(void) { #if !defined(DRV_ALERTER_NOT_EXIST) GPTI_GetHandle(&ALterNote.handle); ALERTER_Config(m3,c13_1MHZ); ALERTER_Output(pwm); #endif /*!defined(DRV_ALERTER_NOT_EXIST)*/ }
/***************************************************************************** * FUNCTION * gmiInit * DESCRIPTION * This function is used to initialize GMI Driver *****************************************************************************/ void gmiInit( uint16 aud_id ) { gmi.aud_id = aud_id; L1Audio_SetEventHandler( gmi.aud_id, gmiHandler ); GPTI_GetHandle( &gmi.gpt ); gmi.state = GMI_STATE_IDLE; }
void pmic6326_ccci_ut_main(void) { GPTI_GetHandle(&pmic6236_ccci_ut_gpt_handle); GPTI_StartItem(pmic6236_ccci_ut_gpt_handle, 1000, pmic6326_ccci_ut_timer_cb, NULL); }
/************************************************************************* * FUNCTION * EINT_SW_Debounce_Init * * DESCRIPTION * Initialize debounce time * * CALLS * * PARAMETERS * * RETURNS * No return * * GLOBALS AFFECTE * *************************************************************************/ void EINT_SW_Debounce_Init(void) { kal_uint8 index; for (index = 0; index < EINT_MAX_CHANNEL; index++) { GPTI_GetHandle(&eint_sw_debounce[index].eint_sw_debounce_handle); eint_sw_debounce[index].eint_intr_allow = KAL_FALSE; eint_sw_debounce[index].eint_no = index; } eint_sw_debounce_time_delay = custom_config_eint_sw_debounce_time_delay(); }
/* * FUNCTION * e_compass_sensor_init * * DESCRIPTION * This function is to initialize e_compass sensor driver * * CALLS * * PARAMETERS * None * * RETURNS * None */ void e_compass_init(void) { /*get customization functin data and function pointr*/ e_compass_sensor_custom_fp = ec_GetFunc(); e_compass_sensor_custom_fp->ec_custom_init(); e_compass_sensor_custom_dp=e_compass_sensor_custom_fp->ec_get_data(); /* init calibration state and GPT handle for sample and calibration */ e_compass_sensor_data.cali_state = E_COMPASS_SENSOR_CALI_NONE; GPTI_GetHandle(&(e_compass_sensor_data.sample_handle)); e_compass_flush_data_buffer(); e_compass_power_on_timer_id = kal_create_timer("E_Compass_Power_On_Timer"); }
void pw_charger_usb_det_eint_ADC(void) { USB_Phy_Enable(USB_PHY_OWNER_BMT);//USB_PowerControl(KAL_TRUE); if (bmt_event_sche_active == 1){ if (usb_charger_eint_reg_handle == 0xFF){ GPTI_GetHandle(&usb_charger_eint_reg_handle); } GPTI_StartItem(usb_charger_eint_reg_handle, 1, usb_charger_eint_reg_adc_measurement_cb, NULL); }else{ // bmt task is NOT setting event scheduler, we can set directly //adc_sche_set_timer_page_align(KAL_FALSE); adc_sche_add_item(chr_usb_detect.chr_usb_adc_logical_id,check_charger_or_usb,adc_sche_measure); } }
/************************************************************************* * FUNCTION * usbvideo_camera_init * * DESCRIPTION * This function init web camera module status. * * PARAMETERS * * RETURNS * None * * GLOBALS AFFECTED * *************************************************************************/ void usbvideo_camera_init(void) { #if 0//JiaShuo Delete for webcam usbvideo_cam_operation_state=USBVIDEO_CAM_OFF_STATE; usbvideo_camera_init_attr(); /* device function mapping */ usbvideo_camera_func_config(); usbvideo_image_sensor_func->usbvideo_cmd_mapping(); #if (defined(YUV_SENSOR_SUPPORT)) image_sensor_func_config(); #endif #if (!defined(DRV_ISP_6225_SERIES)) GPTI_GetHandle(&usbvideo_camera_jpeg_timer_handle); #endif #endif } /* usbvideo_camera_init() */
/************************************************************************* * FUNCTION * GIF_Reset * * DESCRIPTION * reset the gif decoder and control block * * PARAMETERS * * RETURNS * * GLOBALS AFFECTED * gif_dcb *************************************************************************/ void GIF_Reset(void) { DRVPDN_Disable(DRVPDN_CON3,DRVPDN_CON3_GIF,PDN_GIF); GIF_RESET(); DRV_WriteReg32(GIF_STACK_BASE_ADDR, gif_resource.stack); DRV_WriteReg32(GIF_TREE_BASE_ADDR, gif_resource.tree); DRV_WriteReg32(GIF_GCT_BASE_ADDR, gif_resource.GCT); DRV_WriteReg32(GIF_LCT_BASE_ADDR, gif_resource.LCT); DRVPDN_Enable(DRVPDN_CON3,DRVPDN_CON3_GIF,PDN_GIF); gif_dcb.out_location = GIF_MEMORY; //gif_dcb.timeout_period = GIF_TIMEOUT_PERIOD; gif_dcb.is_timeout = KAL_FALSE; gif_dcb.frame_counter = 0; gif_dcb.trailer = KAL_FALSE; if(gif_dcb.gpt_handle == 0) GPTI_GetHandle(&gif_dcb.gpt_handle); kal_mem_set(&gif_dcb.gif_info,0,sizeof(gif_info_struct)); }
/* * FUNCTION * Alter_init * * DESCRIPTION * This function is to intial the Alter module. * * CALLS * * PARAMETERS * outtype : pwm, pdm * * RETURNS * None * * GLOBALS AFFECTED * external_global */ void Alter_init(void) { GPTI_GetHandle(&ALterNote.handle); ALERTER_Config(m3,c13_1MHZ); ALERTER_Output(pwm); }
/* initialize USB2UART setting, called when driver initialize, no matter user select as UART or not */ void USB2UART_init(void) { #ifndef __USB_ENABLE__ ASSERT(0); #endif /* Setup N81,(UART_WLS_8 | UART_NONE_PARITY | UART_1_STOP) = 0x03 */ /* BaudRate and autoflowcontrol */ UARTDCBStruct UART_DefaultConfig = { UART_BAUD_115200, /* baud; */ len_8, /* dataBits; */ sb_1, /*stopBits; */ pa_none, /* parity; */ fc_none, /*no flow control*/ 0x11, /* xonChar; */ 0x13, /* xoffChar; */ KAL_FALSE }; g_UsbACM.acm_param = USB_GetCustomFunc()->get_acm_param_func(); /* get memory for ring buffer and initialize it */ if (USB2UARTPort.RingBuffers.rx_buffer == NULL) USB2UARTPort.RingBuffers.rx_buffer = (kal_uint8 *)g_UsbACM.acm_param->rx_ringbuff; if (USB2UARTPort.RingBuffers.tx_buffer == NULL) USB2UARTPort.RingBuffers.tx_buffer = (kal_uint8 *)g_UsbACM.acm_param->tx_ringbuff; if (USB2UARTPort.RingBuffers.txISR_buffer == NULL) USB2UARTPort.RingBuffers.txISR_buffer = (kal_uint8 *)g_UsbACM.acm_param->txisr_ringbuff; Buf_init(&(USB2UARTPort.Rx_Buffer),(kal_uint8 *)(USB2UARTPort.RingBuffers.rx_buffer), g_UsbACM.acm_param->rx_ringbuff_size); Buf_init(&(USB2UARTPort.Tx_Buffer),(kal_uint8 *)(USB2UARTPort.RingBuffers.tx_buffer), g_UsbACM.acm_param->tx_ringbuff_size); Buf_init(&(USB2UARTPort.Tx_Buffer_ISR),(kal_uint8 *)(USB2UARTPort.RingBuffers.txISR_buffer), g_UsbACM.acm_param->txisr_ringbuff_size); /* set UART setting to USB2UARTPort.DCB and g_UsbACM.line_coding */ USB2UARTPort.UART_id = MOD_DRV_HISR; kal_mem_cpy(&USB2UARTPort.DCB, &UART_DefaultConfig, sizeof(UARTDCBStruct)); if (USB2UARTPort.ownerid == 0) { USB2UARTPort.ownerid = MOD_DRV_HISR; UART2USB_DCB2LineCoding(&USB2UARTPort.DCB, &g_UsbACM.line_coding); } /* register UART and get GPT handler */ if (USB2UARTPort.handle == 0) GPTI_GetHandle(&USB2UARTPort.handle); UART_Register(uart_port_usb, USB_TYPE, (UartDriver_strcut*)&USB2UartDriver); g_UsbACM.send_Txilm = KAL_FALSE; g_UsbACM.send_Rxilm = KAL_TRUE; drv_trace0(TRACE_FUNC, USBACM_INIT_READY_TO_READ_FLAG); // kal_prompt_trace(MOD_USB, "init RDY R"); g_UsbACM.config_send_Txilm = KAL_FALSE; USB2UARTPort.tx_cb = USB2UART_Dafault_Tx_Callback; USB2UARTPort.rx_cb = USB2UART_Dafault_Rx_Callback; USB2UARTPort.port_no = uart_port_usb; }
/* communication interface create function, prepare descriptor */ void USB_Acm_CommIf_Create(void *ifname) { kal_uint8 ep_id; kal_uint8 if_id; /* get resource number and register to gUsbDevice */ g_UsbACM.comm_if_info = USB_Get_Interface_Number(&if_id); g_UsbACM.comm_ep_intr_info = USB_Get_Intr_Ep(&ep_id); /* number is 3 */ /* record interface name and interface descriptor length */ g_UsbACM.comm_if_info->interface_name_ptr = (kal_char *)ifname; g_UsbACM.comm_if_info->ifdscr_size = USB_CDC_IF_LENGTH; g_UsbACM.comm_ep_intr_info->epdscr_size = USB_EPDSC_LENGTH; /* related endpoint info and class specific command handler*/ g_UsbACM.comm_if_info->ep_info[0] = (Usb_Ep_Info*)g_UsbACM.comm_ep_intr_info; g_UsbACM.comm_if_info->if_class_specific_hdlr = USB_Acm_Ep0_Command; /* standard interface descriptor */ // ((Usb_Cdc_If_Dscr*)&g_UsbACM.comm_if_info->ifdscr.classif)->bLength = USB_CDC_IF_LENGTH; ((Usb_Cdc_If_Dscr*)&g_UsbACM.comm_if_info->ifdscr.classif)->bLength = USB_IFDSC_LENGTH; ((Usb_Cdc_If_Dscr*)&g_UsbACM.comm_if_info->ifdscr.classif)->bDescriptorType = USB_INTERFACE; ((Usb_Cdc_If_Dscr*)&g_UsbACM.comm_if_info->ifdscr.classif)->bInterfaceNumber = if_id; ((Usb_Cdc_If_Dscr*)&g_UsbACM.comm_if_info->ifdscr.classif)->bAlternateSetting = 0; ((Usb_Cdc_If_Dscr*)&g_UsbACM.comm_if_info->ifdscr.classif)->bNumEndpoints = USB_CDC_ACM_COMM_EP_NUMBER; ((Usb_Cdc_If_Dscr*)&g_UsbACM.comm_if_info->ifdscr.classif)->bInterfaceClass = USB_ACM_COMM_INTERFACE_CLASS_CODE; ((Usb_Cdc_If_Dscr*)&g_UsbACM.comm_if_info->ifdscr.classif)->bInterfaceSubClass = USB_ACM_COMM_INTERFACE_SUBCLASS_CODE; ((Usb_Cdc_If_Dscr*)&g_UsbACM.comm_if_info->ifdscr.classif)->bInterfaceProtocol = USB_ACM_COMM_INTERFACE_PROTOCOL_CODE; ((Usb_Cdc_If_Dscr*)&g_UsbACM.comm_if_info->ifdscr.classif)->iInterface = USB_Get_String_Number((void *)g_UsbACM.acm_param->comm_interface_string); /*Header Functional Descriptor*/ ((Usb_Cdc_If_Dscr*)&g_UsbACM.comm_if_info->ifdscr.classif)->HFbFunctionLength = 0x05; ((Usb_Cdc_If_Dscr*)&g_UsbACM.comm_if_info->ifdscr.classif)->HFbDescriptorType = 0x24; ((Usb_Cdc_If_Dscr*)&g_UsbACM.comm_if_info->ifdscr.classif)->HFbDescriptorSubtype = 0x00; ((Usb_Cdc_If_Dscr*)&g_UsbACM.comm_if_info->ifdscr.classif)->bcdCDC = 0x0110; /*Abstract Control Management Functional Descriptor*/ ((Usb_Cdc_If_Dscr*)&g_UsbACM.comm_if_info->ifdscr.classif)->ACMFbFunctionLength = 0x04; ((Usb_Cdc_If_Dscr*)&g_UsbACM.comm_if_info->ifdscr.classif)->ACMFbDescriptorType = 0x24; ((Usb_Cdc_If_Dscr*)&g_UsbACM.comm_if_info->ifdscr.classif)->ACMFbDescriptorSubtype = 0x02; ((Usb_Cdc_If_Dscr*)&g_UsbACM.comm_if_info->ifdscr.classif)->ACMFbmCapabilities = 0x0f; /*Union Functional Descriptor*/ ((Usb_Cdc_If_Dscr*)&g_UsbACM.comm_if_info->ifdscr.classif)->UFbFunctionLength = 0x05; ((Usb_Cdc_If_Dscr*)&g_UsbACM.comm_if_info->ifdscr.classif)->UFbDescriptorType = 0x24; ((Usb_Cdc_If_Dscr*)&g_UsbACM.comm_if_info->ifdscr.classif)->UFbDescriptorSubtype = 0x06; ((Usb_Cdc_If_Dscr*)&g_UsbACM.comm_if_info->ifdscr.classif)->bMasterInterface = if_id; ((Usb_Cdc_If_Dscr*)&g_UsbACM.comm_if_info->ifdscr.classif)->bSlaveInterface0 = g_UsbACM.data_interface_id; /*Call Management Descriptor*/ ((Usb_Cdc_If_Dscr*)&g_UsbACM.comm_if_info->ifdscr.classif)->CMFbFunctionLength = 0x05; ((Usb_Cdc_If_Dscr*)&g_UsbACM.comm_if_info->ifdscr.classif)->CMFbDescriptorType = 0x24; ((Usb_Cdc_If_Dscr*)&g_UsbACM.comm_if_info->ifdscr.classif)->CMFbDescriptorSubtype = 0x01; ((Usb_Cdc_If_Dscr*)&g_UsbACM.comm_if_info->ifdscr.classif)->CMFbmCapabilities = 0x03; ((Usb_Cdc_If_Dscr*)&g_UsbACM.comm_if_info->ifdscr.classif)->bDataInterface = g_UsbACM.data_interface_id; /* endpoint handler*/ USB_Register_Drv_Info(USB_DRV_HDLR_EP_TX, ep_id, USB_Acm_IntrIn_Hdlr); g_UsbACM.comm_ep_intr_info->ep_reset = USB_Acm_IntrIn_Reset; // USB_Register_Drv_Info(USB_DRV_HDLR_EP_TX, ep_id, NULL); // g_UsbACM.comm_ep_intr_info->ep_reset = NULL; /* endpoint descriptor */ g_UsbACM.comm_ep_intr_info->epdesc.stdep.bLength = USB_EPDSC_LENGTH; g_UsbACM.comm_ep_intr_info->epdesc.stdep.bDescriptorType = USB_ENDPOINT; g_UsbACM.comm_ep_intr_info->epdesc.stdep.bEndpointAddress = (USB_EP_DIR_IN | ep_id); /*InPipe*/ g_UsbACM.comm_ep_intr_info->epdesc.stdep.bmAttributes = USB_EP_INTR; #ifndef USB_20_ENABLE g_UsbACM.comm_ep_intr_info->epdesc.stdep.wMaxPacketSize[0] = USB_EP_INTR_MAXP&0xff; /*HW-dependent*/ g_UsbACM.comm_ep_intr_info->epdesc.stdep.wMaxPacketSize[1] = (USB_EP_INTR_MAXP>>8)&0xff; #endif g_UsbACM.comm_ep_intr_info->epdesc.stdep.bInterval = 3; g_UsbACM.comm_ep_intr_info->ep_status.epin_status.byEP = ep_id; g_UsbACM.comm_ep_intr_info->ep_status.epin_status.nBytesLeft = USB_EP_NODATA; g_UsbACM.intr_pkt.bmRequestType = USB_CMD_CLASSIFIN; g_UsbACM.intr_pkt.bRequest = USB_ACM_NOTIF_SERIAL_STATE; g_UsbACM.intr_pkt.wValue = 0; g_UsbACM.intr_pkt.wIndex = if_id; g_UsbACM.intr_pkt.wLength = 2; if (g_UsbACM.handle == 0) GPTI_GetHandle(&g_UsbACM.handle); /*for break use!!*/ if (g_UsbACM.ring_buffer_handle == 0) GPTI_GetHandle(&g_UsbACM.ring_buffer_handle); /* for ring buffer time out use!!*/ }