static void custom_em_gpo_writeIO(kal_uint8 data,kal_uint8 port) { DCL_HANDLE handle; handle=DclGPIO_Open(DCL_GPO,port); if(0 == data) DclGPIO_Control(handle,GPO_CMD_WRITE_LOW,0); else if(1 == data) DclGPIO_Control(handle,GPO_CMD_WRITE_HIGH,0); DclGPIO_Close(handle); }
void led_Dimming(LED_NUM led_num) { if(led_num == GPIO_LED1) { kal_cancel_timer(led1_timer); DclGPIO_Control(led1_handle,GPIO_CMD_WRITE_LOW,0); } else { kal_cancel_timer(led2_timer); DclGPIO_Control(led2_handle,GPIO_CMD_WRITE_LOW,0); } }
DCL_STATUS gpio_15_segment_display(void) { kal_uint8 j; static kal_uint8 i = 0; i = i%table_count; if(word_to_display[i].Char_A == 1) DclGPIO_Control(debug1_Handle,GPIO_CMD_WRITE_HIGH,0); else DclGPIO_Control(debug1_Handle,GPIO_CMD_WRITE_LOW,0); if(word_to_display[i].Char_B == 1) DclGPIO_Control(debug2_Handle,GPIO_CMD_WRITE_HIGH,0); else DclGPIO_Control(debug2_Handle,GPIO_CMD_WRITE_LOW,0); if(word_to_display[i].Char_C == 1) DclGPIO_Control(debug3_Handle,GPIO_CMD_WRITE_HIGH,0); else DclGPIO_Control(debug3_Handle,GPIO_CMD_WRITE_LOW,0); if(word_to_display[i].Char_D == 1) DclGPIO_Control(debug4_Handle,GPIO_CMD_WRITE_HIGH,0); else DclGPIO_Control(debug4_Handle,GPIO_CMD_WRITE_LOW,0); i++; return STATUS_OK; }
void led2_flicker(void) { if(Is_Led2_On == KAL_FALSE) { DclGPIO_Control(led2_handle,GPIO_CMD_WRITE_HIGH,0); Is_Led2_On = KAL_TRUE; } else { DclGPIO_Control(led2_handle,GPIO_CMD_WRITE_LOW,0); Is_Led2_On = KAL_FALSE; } }
AST_HIF_HW_RESULT ast_hif_hw_init(AST_HIF_HW_CONFIG_T* pConfigParam) { DCL_HANDLE gpio_handle; GPIO_CTRL_SET_CLK_OUT_T gpio_clk_data; ASSERT(pConfigParam != NULL); ast_gpio_wakeup_pin = gpio_ast_wakeup_pin; ast_gpio_rst_pin = gpio_ast_rst_pin; //enable 32k to AST1001 gpio_handle = DclGPIO_Open(DCL_GPIO_CLK, AST_GPIO_CLK32K_MODULE); gpio_clk_data.u2ClkNum=AST_GPIO_CLK32K_MODULE; gpio_clk_data.u2Mode=mode_f32k_ck; DclGPIO_Control(gpio_handle,GPIO_CMD_SET_CLK_OUT,(DCL_CTRL_DATA_T*)&gpio_clk_data); DclGPIO_Close(gpio_handle); ast_hif_port = AST_HIF_PORT; ast_hif_hw_handle = hif_open(AST_HIF_PORT); ASSERT(ast_hif_hw_handle); ast_hif_hw_power_ctrl(KAL_TRUE); ast_hif_hw_config(pConfigParam); { HIF_REALTIME_CALLBACK_T HifRealTimeCB; HifRealTimeCB.realtime_callback_en = KAL_TRUE; hif_ioctl(ast_hif_hw_handle,HIF_IOCTL_REALTIME_CALLBACK,&HifRealTimeCB); } ast_hif_hw_power_ctrl(KAL_FALSE); return AST_HIF_HW_RESULT_OK; }
AST_HIF_HW_RESULT ast_hif_hw_set_gpio(char value, char pin) { DCL_HANDLE handle; handle=DclGPIO_Open(DCL_GPIO, pin); if(0==value) DclGPIO_Control(handle,GPIO_CMD_WRITE_LOW,0); else if(1==value) DclGPIO_Control(handle,GPIO_CMD_WRITE_HIGH,0); else { DclGPIO_Close(handle); ASSERT(0); } DclGPIO_Close(handle); return AST_HIF_HW_RESULT_OK; }
/************************************************************************* * FUNCTION * bmt_check_ac_usb * * DESCRIPTION * This function is to tell USB and AC * * PARAMETERS * measurement voltage * * RETURNS * AC or USB * * GLOBALS AFFECTED * *************************************************************************/ charger_usb_present_enum bmt_check_ac_usb(kal_int32 vol) { #ifdef _GPIO_DETECT_USB_CHARGER_ kal_uint16 gpio_pin; kal_uint8 gpio_state; DCL_HANDLE gpio_handle; GPIO_CTRL_READ_T gpio_data; #endif #ifdef _ADC_DETECT_USB_CHARGER_ // Use ADC to get voltage value (Analog method) /* Use voltage to tell AC/USB */ if(vol<chr_usb_detect_volt) return USB_PRESENT; else return CHARGER_PRESENT; #elif defined(_GPIO_DETECT_USB_CHARGER_) // #ifdef _ADC_DETECT_USB_CHARGER_ /* Kerwin: use GPIO state(high/low) to differentiate voltage value, because for digital(GPIO is digital due to 0/1), GPIO=1, if voltage > V GPIO=0, if voltage < V use V to differentiate USB or CHARGER, the following gpio_pin should be customized according to physical layout */ #ifdef __CUST_NEW__ gpio_handle = DclGPIO_Open(DCL_GPIO, gpio_bmt_check_ac_usb_pin); DclGPIO_Control(gpio_handle, GPIO_CMD_READ, (DCL_CTRL_DATA_T*)&gpio_data); DclGPIO_Close(gpio_handle); gpio_state = gpio_data.u1IOData; #else /* __CUST_NEW__ */ /*use GPIO to tell AC/USB*/ gpio_pin=1;/*GPIO port number*/ gpio_handle = DclGPIO_Open(DCL_GPIO, gpio_pin); DclGPIO_Control(gpio_handle, GPIO_CMD_SET_MODE_0, 0); DclGPIO_Control(gpio_handle, GPIO_CMD_SET_DIR_IN, 0); DclGPIO_Control(gpio_handle, GPIO_CMD_READ, (DCL_CTRL_DATA_T*)&gpio_data); DclGPIO_Close(gpio_handle); gpio_state = gpio_data.u1IOData; #endif /* __CUST_NEW__ */ if(gpio_state) return USB_PRESENT; else return CHARGER_PRESENT; #endif // #ifdef _ADC_DETECT_USB_CHARGER_ }
void ctp_cypress_cy8ctma340_exit_system_mode() { if((gpio_ctp_reset_pin != 0xFF) && (gpio_ctp_eint_pin != 0xFF)) { CTP_I2C_write_byte(HST_MODE_ADDR, HST_MODE_NORMAL); //normal operation mode ctp_i2c_udelay(200000); DclGPIO_Control(ctp_gpio_eint_handle, GPIO_CMD_WRITE_HIGH, NULL); DclGPIO_Control(ctp_gpio_eint_handle, GPIO_CMD_SET_MODE_1, NULL); DclGPIO_Control(ctp_gpio_eint_handle, GPIO_CMD_SET_DIR_IN, NULL); DclGPIO_Control(ctp_gpio_eint_handle, GPIO_CMD_ENABLE_PULL, NULL); DclGPIO_Control(ctp_gpio_eint_handle, GPIO_CMD_SET_PULL_HIGH, NULL); if(gpio_ctp_i2c_sda_pin != 0xFF) //SW I2C ctp_i2c_configure(CTP_SLAVE_ADDR, CTP_DELAY_TIME); else //HW I2C ctp_i2c_configure(CTP_SLAVE_ADDR, CTP_HW_I2C_SPEED); } }
static kal_uint8 gt818_reset( void ) { kal_uint8 ret = 1; kal_uint8 retry_count = 0; outbuf[0] = 1; outbuf[1] = 1; DclGPIO_Control(rst_handle, GPIO_CMD_WRITE_HIGH, NULL); kal_sleep_task(5); DclGPIO_Control(rst_handle, GPIO_CMD_WRITE_LOW, NULL); kal_sleep_task(5); DclGPIO_Control(rst_handle, GPIO_CMD_WRITE_HIGH, NULL); kal_sleep_task(120); search_i2c: //gt818_i2c_write( guitar_i2c_address, 0x00FF, outbuf, 1 ); //kal_sleep_task( 12 ); gt818_i2c_read( guitar_i2c_address, 0x00FF, inbuf, 1 ); if ( inbuf[0] != 0x55 ) { drv_trace2( TRACE_GROUP_7, CTP_GOODIX_DWN_REGISTER_TRACE, 0x00FF, inbuf[0] ); kal_sleep_task(10); if ( retry_count < 10 ) { retry_count++; goto search_i2c; } else { ASSERT(0); } } drv_trace1( TRACE_GROUP_7, CTP_GOODIX_DWN_DETECT_ADDR_TRACE, guitar_i2c_address ); kal_sleep_task(120); return ret; }
void ctp_cypress_cy8ctma340_enter_system_mode() { if((gpio_ctp_reset_pin != 0xFF) && (gpio_ctp_eint_pin != 0xFF)) { ctp_i2c_configure(CTP_SLAVE_ADDR, 50); DclGPIO_Control(ctp_gpio_eint_handle, GPIO_CMD_SET_MODE_0, NULL); DclGPIO_Control(ctp_gpio_eint_handle, GPIO_CMD_WRITE_LOW, NULL); DclGPIO_Control(ctp_gpio_eint_handle, GPIO_CMD_SET_DIR_OUT, NULL); DclGPIO_Control(ctp_gpio_eint_handle, GPIO_CMD_ENABLE_PULL, NULL); DclGPIO_Control(ctp_gpio_eint_handle, GPIO_CMD_SET_PULL_HIGH, NULL); ctp_i2c_udelay(100000); CTP_I2C_write_byte(HST_MODE_ADDR, HST_MODE_RESET); //system information mode ctp_i2c_udelay(200000); CTP_I2C_write_byte(HST_MODE_ADDR, HST_MODE_SYSTEM_INFORMATION); //system information mode ctp_i2c_udelay(200000); } }
/************************************************************************* * FUNCTION * bmt_charger_action * * DESCRIPTION * This function is to do something whenever AC is plug-in * * PARAMETERS * AC plug in or plug out * * RETURNS * None * * GLOBALS AFFECTED * *************************************************************************/ #ifdef __CUST_NEW__ //#define BMT_CHARGER_ACTION_WITH_GPIO #undef BMT_CHARGER_ACTION_WITH_GPIO #ifdef BMT_CHARGER_ACTION_WITH_GPIO extern const char gpio_bmt_charger_action_pin; #endif #endif /* __CUST_NEW__ */ void bmt_charger_action(kal_bool in) { #ifdef __CUST_NEW__ #ifdef BMT_CHARGER_ACTION_WITH_GPIO DCL_HANDLE gpio_handle; gpio_handle = DclGPIO_Open(DCL_GPIO, gpio_bmt_charger_action_pin); if(in==KAL_FALSE) DclGPIO_Control(gpio_handle, GPIO_CMD_WRITE_LOW, 0); else if(in==KAL_TRUE) DclGPIO_Control(gpio_handle, GPIO_CMD_WRITE_HIGH, 0); else { DclGPIO_Close(gpio_handle); ASSERT(0); } DclGPIO_Close(gpio_handle); #endif /* BMT_CHARGER_ACTION_WITH_GPIO */ #else /* __CUST_NEW__ */ kal_uint16 gpio_pin=0xff; DCL_HANDLE gpio_handle; gpio_handle = DclGPIO_Open(DCL_GPIO, gpio_pin); if(gpio_pin!=0xff) { DclGPIO_Control(gpio_handle,GPIO_CMD_SET_MODE_0,0); if(in==KAL_FALSE) DclGPIO_Control(gpio_handle, GPIO_CMD_WRITE_LOW, 0); else if(in==KAL_TRUE) DclGPIO_Control(gpio_handle, GPIO_CMD_WRITE_HIGH, 0); else { DclGPIO_Close(gpio_handle); ASSERT(0); } DclGPIO_Close(gpio_handle); } #endif /* __CUST_NEW__ */ }
void ctp_cypress_cy8ctma340_power(kal_bool ON) { static kal_bool power_status = KAL_FALSE; kal_bool sleep, wakeup; if(ON == power_status) //do not turn on/off pmu ldo again. return; power_status = ON; if(gpio_ctp_power_enable_pin != 0xFF) { DclGPIO_Control(ctp_gpio_power_handle, GPIO_CMD_SET_MODE_0, NULL); DclGPIO_Control(ctp_gpio_power_handle, GPIO_CMD_SET_DIR_OUT, NULL); } if(gpio_ctp_reset_pin != 0xFF) { DclGPIO_Control(ctp_gpio_reset_handle, GPIO_CMD_SET_MODE_0, NULL); DclGPIO_Control(ctp_gpio_reset_handle, GPIO_CMD_SET_DIR_OUT, NULL); } if(ON) { wakeup = CTP_I2C_write_byte(HST_MODE_ADDR, HST_MODE_NORMAL); //toggle the controller. if(gpio_ctp_power_enable_pin != 0xFF) DclGPIO_Control(ctp_gpio_power_handle, GPIO_CMD_WRITE_HIGH, NULL); ctp_i2c_udelay(1000); if(gpio_ctp_reset_pin != 0xFF) DclGPIO_Control(ctp_gpio_reset_handle, GPIO_CMD_WRITE_LOW, NULL); ctp_i2c_udelay(10000); if(gpio_ctp_reset_pin != 0xFF) DclGPIO_Control(ctp_gpio_reset_handle, GPIO_CMD_WRITE_HIGH, NULL); drv_trace2(TRACE_GROUP_10, CTP_CAPACITIVE_POWER, ON, wakeup); } else { sleep = CTP_I2C_write_byte(HST_MODE_ADDR, HST_MODE_DEEP_SLEEP); //toggle the controller. drv_trace2(TRACE_GROUP_10, CTP_CAPACITIVE_POWER, ON, sleep); if(!sleep) { if(gpio_ctp_power_enable_pin != 0xFF) DclGPIO_Control(ctp_gpio_power_handle, GPIO_CMD_WRITE_LOW, NULL); drv_trace0(TRACE_GROUP_10, CTP_CAPACITIVE_POWER_DOWN); } } ctp_i2c_power_on(ON, CTP_I2C_LDO, 0); }
kal_int32 init_gt818_download_module( kal_uint16 cur_ver, kal_uint8 *firmware_ptr ) { kal_int32 ret = 0; outbuf = (kal_uint8 *)get_ctrl_buffer( MAX_BUFFER_LEN ); inbuf = (kal_uint8 *)get_ctrl_buffer( MAX_BUFFER_LEN ); dbgbuf = (kal_char *)get_ctrl_buffer( MAX_BUFFER_LEN ); if ( ( outbuf == NULL ) || ( inbuf == NULL ) || ( dbgbuf == NULL ) ) { EXT_ASSERT(0, (kal_uint32)outbuf, (kal_uint32)inbuf, (kal_uint32)dbgbuf); return 0; } CTP_DWN_DEBUG_LINE_TRACE(); //rst_handle = DclGPIO_Open(DCL_GPIO, GPIO_CTP_SHUTDN_PIN); //int_handle = DclGPIO_Open(DCL_GPIO, GPIO_CTP_INT_PIN); int_handle = DclGPIO_Open(DCL_GPIO, gpio_ctp_eint_pin); rst_handle = DclGPIO_Open(DCL_GPIO, gpio_ctp_reset_pin); DclGPIO_Control(rst_handle, GPIO_CMD_SET_MODE_0, NULL); DclGPIO_Control(int_handle, GPIO_CMD_SET_MODE_0, NULL); DclGPIO_Control(int_handle, GPIO_CMD_SET_DIR_OUT, NULL); ret = gt818_downloader_probe( cur_ver, firmware_ptr ); //DclGPIO_Control(int_handle, GPIO_CMD_SET_DIR_IN, NULL); //DclGPIO_Control(int_handle, GPIO_CMD_SET_MODE_1, NULL); DclGPIO_Control(int_handle, GPIO_CMD_WRITE_HIGH, NULL); DclGPIO_Control(rst_handle, GPIO_CMD_WRITE_HIGH, NULL); kal_sleep_task(5); DclGPIO_Control(rst_handle, GPIO_CMD_WRITE_LOW, NULL); kal_sleep_task(5); DclGPIO_Control(rst_handle, GPIO_CMD_WRITE_HIGH, NULL); kal_sleep_task(120); free_ctrl_buffer( outbuf ); free_ctrl_buffer( inbuf ); free_ctrl_buffer( dbgbuf ); if ( downloader_errno ) EXT_ASSERT( 0, downloader_errno, 0, 0 ); return ret; }
AST_HIF_HW_RESULT ast_hif_hw_init(AST_HIF_HW_CONFIG_T* pConfigParam) { DCL_HANDLE gpio_handle; GPIO_CTRL_SET_CLK_OUT_T gpio_clk_data; #if defined(GET_AST_GPIO_CLK32K_LPCEID_BY_DCT_TOOL) ast_gpio_dct_init(); #endif ASSERT(pConfigParam != NULL); //enable 32k to AST1001 gpio_handle = DclGPIO_Open(DCL_GPIO_CLK, AST_GPIO_CLK32K_MODULE); gpio_clk_data.u2ClkNum=AST_GPIO_CLK32K_MODULE; gpio_clk_data.u2Mode=mode_f32k_ck; DclGPIO_Control(gpio_handle,GPIO_CMD_SET_CLK_OUT,(DCL_CTRL_DATA_T*)&gpio_clk_data); DclGPIO_Close(gpio_handle); ast_hif_hw_handle = hif_open(AST_HIF_PORT); ASSERT(ast_hif_hw_handle); ast_hif_hw_power_ctrl(KAL_TRUE); ast_hif_hw_config(pConfigParam); { HIF_REALTIME_CALLBACK_T HifRealTimeCB; HIF_ULTRA_HIGH_CTRL_T UltraHighCtrl; HifRealTimeCB.realtime_callback_en = KAL_TRUE; hif_ioctl(ast_hif_hw_handle,HIF_IOCTL_REALTIME_CALLBACK,&HifRealTimeCB); UltraHighCtrl.ultra_high_en = KAL_TRUE; hif_ioctl(ast_hif_hw_handle, HIF_IOCTL_ULTRA_HIGH_CTRL, &UltraHighCtrl); } ast_hif_hw_power_ctrl(KAL_FALSE); #if defined(MT6922) && (!defined(__NLD_CENTRAL_CTRL__)) #if defined(APOLLO22N_E2_EVB) set_lcd_driving_current(LCD_DRIVING_16MA); #else set_lcd_driving_current(LCD_DRIVING_8MA); #endif #endif return AST_HIF_HW_RESULT_OK; }
/******************************************************************************* * FUNCTION * RMMI_UART_PutBytes * DESCRIPTION * * * PARAMETERS * * RETURNS * * GLOBALS AFFECTED * *******************************************************************************/ kal_uint16 RMMI_UART_PutBytes(UART_PORT port, kal_uint8 * Buffaddr, kal_uint16 Length, module_type ownerid) { UART_CTRL_PUT_BYTES_T data; DCL_HANDLE handle = DclSerialPort_Open(port,0); #if defined(__DUAL_TALK_MODEM_SUPPORT__) DCL_HANDLE gpio_handle; if (RMMI_PTR->wake_up_ap == KAL_FALSE) { kal_brief_trace(TRACE_INFO, INFO_PULL_GPIO, GPIO_CMD_WRITE_LOW); gpio_handle = DclGPIO_Open(DCL_GPIO, gpio_dtk_wakeup_pin); DclGPIO_Control(gpio_handle, GPIO_CMD_WRITE_LOW, NULL); rmmi_start_wakeup_timer_hdlr(RMMI_WAKE_UP_AP); RMMI_PTR->wake_up_ap = KAL_TRUE; } #endif data.u2Length = Length; data.u4OwenrId = ownerid; data.puBuffaddr = Buffaddr; DclSerialPort_Control(handle, SIO_CMD_PUT_BYTES, (DCL_CTRL_DATA_T*) &data); return data.u2RetSize; }
DCL_STATUS gpio_led_init() { #if defined(GPIO_NUMBER_FOR_LED1) led1_handle = DclGPIO_Open(DCL_GPIO,GPIO_NUMBER_FOR_LED1); DclGPIO_Control(led1_handle,GPIO_CMD_SET_MODE_0,0); DclGPIO_Control(led1_handle,GPIO_CMD_SET_DIR_OUT,0); DclGPIO_Control(led1_handle,GPIO_CMD_WRITE_LOW,0); if(led1_timer == NULL) led1_timer = kal_create_timer("LED1_TIMER"); #endif #if defined(GPIO_NUMBER_FOR_LED2) led2_handle = DclGPIO_Open(DCL_GPIO,GPIO_NUMBER_FOR_LED2); DclGPIO_Control(led2_handle,GPIO_CMD_SET_MODE_0,0); DclGPIO_Control(led2_handle,GPIO_CMD_SET_DIR_OUT,0); DclGPIO_Control(led2_handle,GPIO_CMD_WRITE_LOW,0);//low level means led do not light if(led2_timer == NULL) led2_timer = kal_create_timer("LED2_TIMER"); #endif return STATUS_OK; }
DCL_STATUS gpio_15_segment_led_control(kal_uint8 word1, kal_uint8 word2) { #if defined(DRV_GPIO_FOR_LED_AND_15_SEGMENT) kal_uint32 savedMask; DCL_HANDLE handle; PMU_CTRL_LDO_BUCK_SET_EN val; PMU_CTRL_LDO_BUCK_SET_VOLTAGE val1; val1.voltage = PMU_VOLT_02_800000_V; val1.mod = VMC; handle = DclPMU_Open(DCL_PMU,FLAGS_NONE); DclPMU_Control(handle, LDO_BUCK_SET_VOLTAGE,(DCL_CTRL_DATA_T *)&val1); val.enable = DCL_TRUE; val.mod = VMC; DclPMU_Control(handle, LDO_BUCK_SET_EN,(DCL_CTRL_DATA_T *)&val); DclPMU_Close(handle); if(debug1_Handle == 0 || debug2_Handle == 0 || debug3_Handle == 0 || debug4_Handle == 0) { debug1_Handle = DclGPIO_Open(DCL_GPIO,62); debug2_Handle = DclGPIO_Open(DCL_GPIO,63); debug3_Handle = DclGPIO_Open(DCL_GPIO,64); debug4_Handle = DclGPIO_Open(DCL_GPIO,65); } if(fifteen_segment_timer == NULL) fifteen_segment_timer = kal_create_timer("15_segment_TIMER"); switch(word1) { case '2': { savedMask = SaveAndSetIRQMask(); word_to_display = char_to_display_table1; table_count = 6; RestoreIRQMask(savedMask); kal_set_timer(fifteen_segment_timer,(kal_timer_func_ptr) gpio_15_segment_display, NULL, 1, 1); break; } case '3': { if(word2 == 1) { savedMask = SaveAndSetIRQMask(); word_to_display = char_to_display_table7; table_count = 7; RestoreIRQMask(savedMask); kal_set_timer(fifteen_segment_timer,(kal_timer_func_ptr) gpio_15_segment_display, NULL, 1, 1); } else { savedMask = SaveAndSetIRQMask(); word_to_display = char_to_display_table6; table_count = 6; RestoreIRQMask(savedMask); kal_set_timer(fifteen_segment_timer, (kal_timer_func_ptr)gpio_15_segment_display,NULL, 1, 1); } break; } case '6': { if(word2 == 1) { savedMask = SaveAndSetIRQMask(); word_to_display = char_to_display_table3; table_count = 8; RestoreIRQMask(savedMask); kal_set_timer(fifteen_segment_timer, (kal_timer_func_ptr)gpio_15_segment_display, NULL, 1, 1); } else { savedMask = SaveAndSetIRQMask(); word_to_display = char_to_display_table2; table_count = 7; RestoreIRQMask(savedMask); kal_set_timer(fifteen_segment_timer,(kal_timer_func_ptr) gpio_15_segment_display, NULL, 1, 1); } break; } case 'd': { savedMask = SaveAndSetIRQMask(); word_to_display = char_to_display_table12; table_count = 7; RestoreIRQMask(savedMask); kal_set_timer(fifteen_segment_timer,(kal_timer_func_ptr) gpio_15_segment_display, NULL, 1, 1); break; } case 'E': { if(word2 == 1) { savedMask = SaveAndSetIRQMask(); word_to_display = char_to_display_table5; table_count = 7; RestoreIRQMask(savedMask); kal_set_timer(fifteen_segment_timer, (kal_timer_func_ptr)gpio_15_segment_display, NULL, 1, 1); } else { savedMask = SaveAndSetIRQMask(); word_to_display = char_to_display_table4; table_count = 6; RestoreIRQMask(savedMask); kal_set_timer(fifteen_segment_timer,(kal_timer_func_ptr) gpio_15_segment_display, NULL, 1, 1); } break; } case 'h': { if(word2 == 1) { savedMask = SaveAndSetIRQMask(); word_to_display = char_to_display_table9; table_count = 6; RestoreIRQMask(savedMask); kal_set_timer(fifteen_segment_timer, (kal_timer_func_ptr)gpio_15_segment_display, NULL, 1, 1); } else { savedMask = SaveAndSetIRQMask(); word_to_display = char_to_display_table8; table_count = 5; RestoreIRQMask(savedMask); kal_set_timer(fifteen_segment_timer, (kal_timer_func_ptr)gpio_15_segment_display, NULL, 1, 1); } break; } case 'H': { if(word2 == 1) { savedMask = SaveAndSetIRQMask(); word_to_display = char_to_display_table11; table_count = 7; RestoreIRQMask(savedMask); kal_set_timer(fifteen_segment_timer, (kal_timer_func_ptr)gpio_15_segment_display, NULL, 1, 1); } else { savedMask = SaveAndSetIRQMask(); word_to_display = char_to_display_table10; table_count = 6; RestoreIRQMask(savedMask); kal_set_timer(fifteen_segment_timer,(kal_timer_func_ptr) gpio_15_segment_display, NULL, 1, 1); } break; } case 'I': { savedMask = SaveAndSetIRQMask(); word_to_display = char_to_display_table17; table_count = 4; RestoreIRQMask(savedMask); kal_set_timer(fifteen_segment_timer, (kal_timer_func_ptr)gpio_15_segment_display, NULL, 1, 1); break; } case 'L': { savedMask = SaveAndSetIRQMask(); word_to_display = char_to_display_table15; table_count = 3; RestoreIRQMask(savedMask); kal_set_timer(fifteen_segment_timer,(kal_timer_func_ptr) gpio_15_segment_display, NULL, 1, 1); break; } case 'N': { savedMask = SaveAndSetIRQMask(); word_to_display = char_to_display_table16; table_count = 6; RestoreIRQMask(savedMask); kal_set_timer(fifteen_segment_timer,(kal_timer_func_ptr) gpio_15_segment_display, NULL, 1, 1); break; } case 'X': { savedMask = SaveAndSetIRQMask(); word_to_display = char_to_display_table13; table_count = 4; RestoreIRQMask(savedMask); kal_set_timer(fifteen_segment_timer,(kal_timer_func_ptr) gpio_15_segment_display, NULL, 1, 1); break; } case 0: { kal_cancel_timer(fifteen_segment_timer); DclGPIO_Control(debug1_Handle,GPIO_CMD_WRITE_HIGH,0); DclGPIO_Control(debug2_Handle,GPIO_CMD_WRITE_HIGH,0); DclGPIO_Control(debug3_Handle,GPIO_CMD_WRITE_HIGH,0); DclGPIO_Control(debug4_Handle,GPIO_CMD_WRITE_HIGH,0); break; } default: { ASSERT(0); return STATUS_INVALID_CTRL_DATA; } } return STATUS_OK; #else return STATUS_FAIL; #endif }
DCL_STATUS gpio_15_segment_led_init() { #if defined(DRV_GPIO_FOR_LED_AND_15_SEGMENT) debug1_Handle = DclGPIO_Open(DCL_GPIO,62); debug2_Handle = DclGPIO_Open(DCL_GPIO,63); debug3_Handle = DclGPIO_Open(DCL_GPIO,64); debug4_Handle = DclGPIO_Open(DCL_GPIO,65); DclGPIO_Control(debug1_Handle,GPIO_CMD_SET_MODE_0,0); DclGPIO_Control(debug1_Handle,GPIO_CMD_SET_DIR_OUT,0); DclGPIO_Control(debug1_Handle,GPIO_CMD_WRITE_HIGH,0); DclGPIO_Control(debug2_Handle,GPIO_CMD_SET_MODE_0,0); DclGPIO_Control(debug2_Handle,GPIO_CMD_SET_DIR_OUT,0); DclGPIO_Control(debug2_Handle,GPIO_CMD_WRITE_HIGH,0); DclGPIO_Control(debug3_Handle,GPIO_CMD_SET_MODE_0,0); DclGPIO_Control(debug3_Handle,GPIO_CMD_SET_DIR_OUT,0); DclGPIO_Control(debug3_Handle,GPIO_CMD_WRITE_HIGH,0); DclGPIO_Control(debug4_Handle,GPIO_CMD_SET_MODE_0,0); DclGPIO_Control(debug4_Handle,GPIO_CMD_SET_DIR_OUT,0); DclGPIO_Control(debug4_Handle,GPIO_CMD_WRITE_HIGH,0); if(fifteen_segment_timer == NULL) fifteen_segment_timer = kal_create_timer("15_segment_TIMER"); return STATUS_OK; #else return STATUS_FAIL; #endif }