void SerialCommInit(void) { GPIO_ModeSetup(SCL,0); GPIO_ModeSetup(SDA,0); GPIO_ModeSetup(BUSENABLE,0); GPIO_InitIO(1,SCL); GPIO_InitIO(1,BUSENABLE); }
void SerialCommPullLow(void) { GPIO_ModeSetup(SCL,0); GPIO_ModeSetup(SDA,0); GPIO_InitIO(1,SDA); GPIO_InitIO(1,SCL); GPIO_WriteIO(0,SCL); GPIO_WriteIO(0,SDA); }
void SerialCommInit(void) { GPIO_ModeSetup(SCL,0); GPIO_ModeSetup(SDA,0); GPIO_ModeSetup(LE,0); GPIO_InitIO(1,SCL); GPIO_InitIO(1,LE); GPIO_WriteIO(1,SCL); GPIO_InitIO(0,SDA); GPIO_WriteIO(0,LE); }
void RDA_bt_SerialCommInit(void) { GPIO_ModeSetup(RDA5868_SCL,0); GPIO_ModeSetup(RDA5868_SDA,0); GPIO_InitIO(1,RDA5868_SCL); GPIO_InitIO(1,RDA5868_SDA); GPIO_WriteIO(1,RDA5868_SCL); GPIO_WriteIO(1,RDA5868_SDA); DELAY(DURATION_LOW); }
void HorseRace_PowerOff(void) { GPIO_ModeSetup(gpio_horserace_latch_pin,0); GPIO_ModeSetup(gpio_horserace_sdin_pin, 0); GPIO_ModeSetup(gpio_horserace_clk_pin, 0); GPIO_InitIO(1, gpio_horserace_latch_pin); GPIO_InitIO(1, gpio_horserace_sdin_pin); GPIO_InitIO(1, gpio_horserace_clk_pin); GPIO_WriteIO(0, gpio_horserace_sdin_pin);/*输入数据*/ GPIO_WriteIO(0, gpio_horserace_clk_pin);/*时钟*/ GPIO_WriteIO(0, gpio_horserace_latch_pin);/*锁存*/ }
void SerialCommCryClkOff(void) { #if !defined( MT6205B ) && !defined( MT6208 ) GPIO_ModeSetup(CRYCLK,0); #else /// Config GPO2 as SRCLKENA. GPO_ModeSetup(2, 1); #endif }
void SerialCommCryClkOn(void) { #if !defined( MT6205B ) && !defined( MT6208 ) GPIO_ModeSetup(CRYCLK,3); /* 32.768kHz reference frequency */ #else /// Config SRCLKENA as GPO2 and set the output to 1 to keep 26M clock alive. GPO_ModeSetup(2, 0); GPO_WriteIO(1, 2); #endif }
/****************************************************************************** * Function: * GPSLocateVibSensorStart * * Usage: * Start vibration sensor monitor * * Parameters: * None * * Return: * None ******************************************************************************/ void GPSLocateVibSensorStart(void) { kal_bool bResult; kal_uint8 SilenceThreshold; if (gGPSVibSensorTimer != NULL) { //has already started, do nothing return; } bResult = GPSLocateNvramReadRecord( GPS_NVRAM_RECID_VIBSENSOR_POLLINGINTERVAL, &gGPSVibSensorPollingInterval, sizeof(kal_uint8) ); if (bResult != KAL_TRUE) { return; } bResult = GPSLocateNvramReadRecord( GPS_NVRAM_RECID_VIBSENSOR_SILENCETHRESHOLD, &SilenceThreshold, sizeof(kal_uint8) ); if (bResult != KAL_TRUE) { return; } /* NOTE: unit of SilenceThreshold is minute unit of gGPSVibSensorPollingInterval is 50ms so, the following convert is needed. */ gGPSVibSensorSilenceThreshold = (SilenceThreshold*60*1000)/(gGPSVibSensorPollingInterval*50); gGPSVibSensorTimer = GPSAppTimer_Create( GENERAL_GPSAPP_TIMERID, GPSLocateVibSensorExpireProc, gGPSVibSensorPollingInterval*KAL_TICKS_50_MSEC, gGPSVibSensorPollingInterval*KAL_TICKS_50_MSEC, KAL_TRUE ); /* Configurate GPIO: input, pull-up/down disable */ GPIO_ModeSetup(GPS_VIBRATION_SENSOR_GPIO, 0); GPIO_InitIO(INPUT, GPS_VIBRATION_SENSOR_GPIO); GPIO_PullenSetup(GPS_VIBRATION_SENSOR_GPIO, KAL_FALSE); //get the initial IO value gGPSVibSensorPreviousIOValue = GPIO_ReadIO(GPS_VIBRATION_SENSOR_GPIO); //initialize the state gGPSVibSensorCurrState = GPSLOCATE_VIBSENSORSTATUS_SILENCE; //initialize silence counter gSilenceCounter = 0; }
/************************************************************************* * FUNCTION * serial_init * * DESCRIPTION * This function initializes serial interface. * * PARAMETERS * None * RETURNS * None * * GLOBALS AFFECTED * *************************************************************************/ void serial_init(void) { kal_uint16 delay; kal_int16 x, y; GPIO_WriteIO(0,SPI_CS_PIN); GPIO_ModeSetup(SPI_DIN_PIN, 0x0); GPIO_ModeSetup(SPI_CLK_PIN, 0x0); GPIO_ModeSetup(SPI_DOUT_PIN, 0x0); GPIO_ModeSetup(SPI_CS_PIN, 0x0); GPIO_ModeSetup(SPI_BUSY_PIN, 0x0); GPIO_InitIO(OUTPUT,SPI_DIN_PIN); GPIO_InitIO(OUTPUT,SPI_CLK_PIN); GPIO_InitIO(INPUT,SPI_DOUT_PIN); GPIO_InitIO(OUTPUT,SPI_CS_PIN); GPIO_InitIO(INPUT,SPI_BUSY_PIN); GPIO_WriteIO(0,SPI_CS_PIN); /*AR7643 needs this, so weird*/ for(delay=0;delay<1000;delay++){}; //tp_read_adc(&x, &y); }
void irda_switch_to_sir(void) { #if defined(__IRDA_VISHAY_6102__) /*Vishay 6614*/ #ifndef __CUST_NEW__ GPIO_ModeSetup(IRDA_GPIO_MODE_SWITCH, 0); GPIO_InitIO(OUTPUT, IRDA_GPIO_MODE_SWITCH); #endif /* __CUST_NEW__ */ GPIO_WriteIO(0, IRDA_GPIO_MODE_SWITCH); #elif defined(__IRDA_AGILENT_3220__)||defined(__IRDA_VISHAY_6614__) DRV_WriteReg(IR_TRANSCEIVER_PDN,0x1); irda_delay(irda_test_delay); DRV_WriteReg(IR_TRANSCEIVER_PDN,0x5); irda_delay(irda_test_delay); DRV_WriteReg(IR_TRANSCEIVER_PDN,0x4); irda_delay(irda_test_delay); DRV_WriteReg(IR_TRANSCEIVER_PDN,0x0); #endif }
/****************************************************************************** * Function: * GPSLocateVibSensorInit * * Usage: * Init vibration sensor monitor * * Parameters: * None * * Return: * None ******************************************************************************/ void GPSLocateVibSensorInit(void) { #if 0 /* Configurate GPIO: input, pull-up/down disable */ GPIO_ModeSetup(GPS_VIBRATION_SENSOR_GPIO, 0); GPIO_InitIO(INPUT, GPS_VIBRATION_SENSOR_GPIO); GPIO_PullenSetup(GPS_VIBRATION_SENSOR_GPIO, KAL_FALSE); // config gpio 31 as above because of eint 1 is connect to gpio 31 as a temp solution #endif EINT_Set_HW_Debounce(GPS_VIBSENSOR_EINT_NO, 1); gbCurrentPolarity = KAL_FALSE; EINT_Registration(GPS_VIBSENSOR_EINT_NO, KAL_TRUE, gbCurrentPolarity, GPSLocateVibSensorHISR, KAL_TRUE ); //Mask this EINT after registration, unmask it before using it EINT_Mask(GPS_VIBSENSOR_EINT_NO); }
void ExtSwitchInit(void) { GPIO_ModeSetup(FM_SWITCH, 0); GPIO_InitIO(1, FM_SWITCH); GPIO_WriteIO(FM_SWITCH, SPEECH_PATH); }
void SerialCommInit(void) { GPIO_ModeSetup(SCL,0); GPIO_ModeSetup(SDA,0); GPIO_InitIO(OUTPUT,SCL); }
void SerialCommCryClkOff(void) { GPIO_ModeSetup(CRYCLK,0); SerialCommPullLow(); // For EV200 only, solve a hardware bug }
/* * FUNCTION * GPIO_init * * DESCRIPTION * This function is to initialize the GPIO pins as all GPIO, * and configure them as output. * * CALLS * None * * PARAMETERS * None * * RETURNS * None * * GLOBALS AFFECTED * external_global */ void GPIO_init(void) { #ifdef __CUST_NEW__ GPIO_setting_init(); //for LED and 15_segment init #if defined(__MTK_TARGET__) && defined(DRV_GPIO_FOR_LED_AND_15_SEGMENT) GPIO_ModeSetup(61, 0);//set mode 0 GPIO_ModeSetup(62, 0); GPIO_ModeSetup(63, 0); GPIO_ModeSetup(64, 0); GPIO_ModeSetup(65, 0); GPIO_ModeSetup(66, 0); GPIO_InitIO(1, 61);//set direction output GPIO_InitIO(1, 62); GPIO_InitIO(1, 63); GPIO_InitIO(1, 64); GPIO_InitIO(1, 65); GPIO_InitIO(1, 66); GPIO_WriteIO(0, 61); //set output 1 GPIO_WriteIO(1, 62); GPIO_WriteIO(1, 63); GPIO_WriteIO(1, 64); GPIO_WriteIO(1, 65); GPIO_WriteIO(0, 66); #endif #else /* __CUST_NEW__ */ DRV_WriteReg(GPIO_MODE1,0x4000); DRV_WriteReg(GPIO_MODE2,0x5a55); DRV_WriteReg(GPIO_MODE3,0x5555); DRV_WriteReg(GPIO_MODE4,0x1555); //DRV_WriteReg(GPIO_MODE5,0x5555); //DRV_WriteReg(GPIO_MODE6,0x0055); //DRV_WriteReg(GPIO_MODE7,0x1505); // Add by GuoXin for MT6268A init boot (Should be removed after boot ready) // Set Bit[9..8] = 0x01, GPIO_52, UART2 RX // Set Bit[11..10] = 0x01, GPIO_53, UART2 TX DRV_WriteReg(GPIO_MODE7,0x0555); /* set GPIO for LCD */ //*(volatile kal_uint16 *)0x84021a00 = 0x01460; DRV_WriteReg(GPIO_MODEB,0x01460); // Add by Morse for MT6268A Testing // Set Bit[13..12] = 0x01, GPIO_93, UART3 RX // Set Bit[11..10] = 0x01, GPIO_94, UART3 TX DRV_WriteReg(GPIO_MODEC,0x1540); #ifdef __BTMODULE_RFMD3500__ //add by shine, 2006/06/17 GPIO_InitIO(1, 2); // set GPIO2 as the output GPIO_InitIO(1, 3); // set GPIO2 as the output GPIO_WriteIO(0,2); GPIO_WriteIO(0,3); #endif #ifdef __OTG_ENABLE__ /* GPIO84 is for USB 20 IP drive chagre pump */ GPIO_ModeSetup(84, 1); #endif /*__USB_ENABLE__*/ #endif /* __CUST_NEW__ */ }
kal_bool custom_cfg_gpio_set_level(kal_uint8 gpio_dev_type, kal_uint8 gpio_dev_level ) { volatile kal_uint16 j, iDelay; kal_uint8 iPulse = 0, BL_Port = 21; kal_uint32 savedMask; switch(gpio_dev_type) { case GPIO_DEV_LED_MAINLCD: #if 0 //del by hongzhe.liu 20080603 #ifndef CRYSTAL25V3_DEMO_BB if (gpio_dev_level == LED_LIGHT_LEVEL0) { GPIO_WriteIO(GPIO_OFF, custom_cfg_outward_gpio_port(GPIO_LABEL_LED_LCD)); }else { GPIO_WriteIO(GPIO_ON, custom_cfg_outward_gpio_port(GPIO_LABEL_LED_LCD)); } PWM2_level(gpio_dev_level); break; #else BL_Port = custom_cfg_outward_gpio_port(GPIO_LABEL_LED_LCD); GPIO_ModeSetup(BL_Port, 0); if (gpio_dev_level == LED_LIGHT_LEVEL0) { GPIO_WriteIO(GPIO_OFF, BL_Port); GPIO_WriteIO(0, custom_cfg_outward_gpio_port(GPIO_LABEL_DEV_LED_CAPSENSE)); #if (defined(TOUCH_PAD_SUPPORT) && defined(__MTK_TARGET__)) //Touchpad_PowerOn(KAL_FALSE); #endif }else { #if (defined(TOUCH_PAD_SUPPORT) && defined(__MTK_TARGET__)) //Touchpad_PowerOn(KAL_TRUE); #endif GPIO_WriteIO(1, custom_cfg_outward_gpio_port(GPIO_LABEL_DEV_LED_CAPSENSE)); GPIO_WriteIO(GPIO_ON, BL_Port); for (j = 0; j < 30; j++); // GPIO_WriteIO(GPIO_OFF, BL_Port); for (j = 0 ; j < 30; j++); // iPulse = PWM2_Level_Info[gpio_dev_level-1][1] ;// iDelay = PWM2_Level_Info[gpio_dev_level-1][0]; // if (iPulse > 32) { iPulse = 32; //max pulse } if (iDelay > 300) { iDelay = 300; //max tLO 64us < 75us } savedMask = SaveAndSetIRQMask(); //disable interrupt while (iPulse--) { GPIO_WriteIO(GPIO_OFF, BL_Port); for (j = 0; j < iDelay; j++); GPIO_WriteIO(GPIO_ON, BL_Port); for (j = 0; j < iDelay; j++); } RestoreIRQMask(savedMask); // turn on interrupt } #endif // CRYSTAL25_DEMO_BB #else if (gpio_dev_level == LED_LIGHT_LEVEL0) { GPIO_WriteIO(GPIO_OFF, gpio_led_mainbl_en_pin); }else { GPIO_WriteIO(GPIO_ON, gpio_led_mainbl_en_pin); } PWM_level(gpio_dev_level); break; #endif case GPIO_DEV_LED_SUBLCD: break; case GPIO_DEV_LED_STATUS_1: break; case GPIO_DEV_LED_STATUS_2: break; case GPIO_DEV_LED_STATUS_3: break; case GPIO_DEV_LED_KEY: { #if 0 //del by hongzhe.liu 20080603 #ifndef CRYSTAL25_DEMO_BB if (gpio_dev_level == LED_LIGHT_LEVEL0) { GPIO_WriteIO(GPIO_OFF, custom_cfg_outward_gpio_port(GPIO_LABEL_DEV_LED_KEY)); }else { GPIO_WriteIO(GPIO_ON, custom_cfg_outward_gpio_port(GPIO_LABEL_DEV_LED_KEY)); } PWM_level(gpio_dev_level); break; #else if (gpio_dev_level == LED_LIGHT_LEVEL0) { GPIO_WriteIO(0, custom_cfg_outward_gpio_port(GPIO_LABEL_DEV_LED_KEY)); }else { GPIO_WriteIO(1, custom_cfg_outward_gpio_port(GPIO_LABEL_DEV_LED_KEY)); } break; #endif // CRYSTAL25_DEMO_BB #else if (gpio_dev_level == LED_LIGHT_LEVEL0) { //SC.WU LCD BACKLIGHT GPIO_ModeSetup(gpio_led_keybl_en_pin, 0); GPIO_WriteIO(GPIO_OFF, gpio_led_keybl_en_pin); }else { GPIO_ModeSetup(gpio_led_keybl_en_pin, 0); GPIO_WriteIO(GPIO_ON, gpio_led_keybl_en_pin); } PWM2_level(gpio_dev_level); Alter_level(gpio_dev_level); break; #endif } case GPIO_DEV_VIBRATOR: if (gpio_dev_level == VIBRATOR_OFF) { GPIO_WriteIO(GPIO_OFF, custom_cfg_outward_gpio_port(GPIO_LABEL_DEV_VIBRATOR)); }else { GPIO_WriteIO(GPIO_ON, custom_cfg_outward_gpio_port(GPIO_LABEL_DEV_VIBRATOR)); } break; default: /* error undefine */ return KAL_FALSE; } return KAL_TRUE; }
void SerialCommCryClkOn(void) { GPIO_ModeSetup(CRYCLK,3); /* 32.768kHz reference frequency */ }
void SerialCommCryClkOff(void) { GPIO_ModeSetup(CRYCLK,0); }
/*-----------------------------------------------------------------------* * FUNCTION * DclGPIO_Control * * DESCRIPTION * This function is to send command to control the GPIO module. * * PARAMETERS * handle - a valid handle return by DclGPIO_Open() * cmd - a control command for GPIO module * 1. GPIO_CMD_READ: to read the input value from the GPIO port contain in handle. * 2. GPIO_CMD_WRITE_LOW: to write low to the output of GPIO port contain in handle. * 3. GPIO_CMD_WRITE_HIGH: to write high to the output of GPIO port contain in handle. * 4. GPIO_CMD_SET_MODE_0: to set the mode of the GPIO port contain in handle as mode 0. * 5. GPIO_CMD_SET_MODE_1: to set the mode of the GPIO port contain in handle as mode 1. * 6. GPIO_CMD_SET_MODE_2: to set the mode of the GPIO port contain in handle as mode 2. * 7. GPIO_CMD_SET_MODE_3: to set the mode of the GPIO port contain in handle as mode 3. * 8. GPIO_CMD_SET_DIR_OUT: to set the direction of the GPIO port as output. * 9. GPIO_CMD_SET_DIR_IN: to set the direction of the GPIO port as input. * 10. GPIO_CMD_RETURN_MODE: to get the mode of the GPIO port * 11. GPIO_CMD_RETURN_DIR: to get the direction of the GPIO port * 12. GPIO_CMD_RETURN_OUT: to return the output value of the GPIO port * 13. GPIO_CMD_ENABLE_PULL: to enable the pull resister for a GPIO port * 14. GPIO_CMD_DISABLE_PULL: to disenable the pull resister for a GPIO port * 15. GPIO_CMD_SET_PULL_HIGH: to select the pull up for a GPIO port * 16. GPIO_CMD_SET_PULL_LOW: to select the pull down for a GPIO port * 17. GPIO_CMD_SET_DINV: to set the inversion of a GPIO port * 18. GPIO_CMD_SET_DEBUG: to enable or disable debug mode * 19. GPIO_CMD_SET_CLK_OUT: to set the clock frequency for a clock output * * 20. GPO_CMD_RETURN_MODE: to get the mode of the GPO port * 21. GPO_CMD_RETURN_OUT: to return the output value of the GPO port * 22. GPO_CMD_WRITE_HIGH: to write high to the output of GPO port contain in handle. * 23. GPO_CMD_WRITE_LOW: to write low to the output of GPO port contain in handle. * 24. GPO_CMD_MODE_SET_0: to set the mode of the GPIO port contain in handle as mode 0. * 25. GPO_CMD_MODE_SET_1: to set the mode of the GPI1 port contain in handle as mode 1. * 26. GPO_CMD_MODE_SET_2: to set the mode of the GPI2 port contain in handle as mode 2. * 27. GPO_CMD_MODE_SET_3: to set the mode of the GPI3 port contain in handle as mode 3. * 28. GPIO_CMD_SET_DIR_OUT_NO_IRQ_MASK_T: to set the direction of the GPIO port as output without IRQ protect. * 29. GPIO_CMD_SET_DIR_IN_NO_IRQ_MASK_T: to set the direction of the GPIO port as input without IRQ protect * 30. GPIO_CMD_WRITE_HIGH_NO_IRQ_MASK_T: to write high to the output of GPIO port contain in handle without IRQ protect. * 31. GPIO_CMD_WRITE_LOW_NO_IRQ_MASK_T: to write low to the output of GPIO port contain in handle without IRQ protect. * 32. GPIO_CMD_READ_NO_IRQ_MASK_T: to read the input value from the GPIO port contain in handle without IRQ protect.. * 33. GPIO_CMD_WRITE_FOR_SPI_T: * data - for 1. GPIO_CMD_READ: * 1. GPIO_CMD_READ: pointer to a GPIO_CTRLS structure * 2. GPIO_CMD_WRITE_LOW: NULL. * 3. GPIO_CMD_WRITE_HIGH: NULL. * 4. GPIO_CMD_SET_MODE_0: NULL. * 5. GPIO_CMD_SET_MODE_1: NULL. * 6. GPIO_CMD_SET_MODE_2: NULL. * 7. GPIO_CMD_SET_MODE_3: NULL. * 8. GPIO_CMD_SET_DIR_OUT: NULL. * 9. GPIO_CMD_SET_DIR_IN: NULL. * 10. GPIO_CMD_RETURN_MODE: pointer to a GPIO_CTRL_RETURN_MODE_T structure * 11. GPIO_CMD_RETURN_DIR: pointer to a GPIO_CTRL_SET_DIR_T structure * 12. GPIO_CMD_RETURN_OUT: pointer to a GPIO_CTRL_RETURN_OUT_T structure * 13. GPIO_CMD_ENABLE_PULL: NULL. * 14. GPIO_CMD_DISABLE_PULL: NULL. * 15. GPIO_CMD_SET_PULL_HIGH: NULL. * 16. GPIO_CMD_SET_PULL_LOW: NULL. * 17. GPIO_CMD_SET_DINV: pointer to a GPIO_CTRL_SET_DINV_T structure * 18. GPIO_CMD_SET_DEBUG: pointer to a GPIO_CTRL_SET_DEBUG_T structure * 19. GPIO_CMD_SET_CLK_OUT: pointer to a GPIO_CTRL_SET_CLK_OUT_T structure * * 20. GPO_CMD_RETURN_MODE: pointer to a GPO_CTRL_RETURN_MODE_T structure * 21. GPO_CMD_RETURN_OUT: pointer to a GPO_CTRL_RETURN_OUT_T structure * 22. GPO_CMD_WRITE_HIGH: NULL. * 23. GPO_CMD_WRITE_LOW: NULL. * 24. GPO_CMD_MODE_SET_0: NULL.. * 25. GPO_CMD_MODE_SET_1: NULL.. * 26. GPO_CMD_MODE_SET_2: NULL. * 27. GPO_CMD_MODE_SET_3: NULL. * 28. GPIO_CMD_SET_DIR_OUT_NO_IRQ_MASK_T: NULL. * 29. GPIO_CMD_SET_DIR_IN_NO_IRQ_MASK_T: NULL. * 30. GPIO_CMD_WRITE_HIGH_NO_IRQ_MASK_T: NULL. * 31. GPIO_CMD_WRITE_LOW_NO_IRQ_MASK_T: NULL. * 32. GPIO_CMD_READ_NO_IRQ_MASK_T: pointer to a GPIO_CTRLS structure * 33. GPIO_CMD_WRITE_FOR_SPI_T: pointer to * RETURNS * STATUS_OK - command is executed successfully. * STATUS_FAIL - command is failed. * STATUS_INVALID_CMD - The command is invalid. * STATUS_INVALID_HANDLE - The handle is invalid. * STATUS_INVALID_CTRL_DATA - The ctrl data is not valid. *-----------------------------------------------------------------------*/ DCL_STATUS DclGPIO_Control(DCL_HANDLE handle, DCL_CTRL_CMD cmd, DCL_CTRL_DATA_T *data) { kal_char port; port= 0x000000FF & handle; if(DCL_GPIO_IS_HANDLE_MAGIC(handle)) { switch(cmd) { case GPIO_CMD_READ: { GPIO_CTRL_READ_T *prRead; prRead = &(data->rRead); prRead->u1IOData = GPIO_ReadIO(port); break; } case GPIO_CMD_WRITE_LOW: { GPIO_WriteIO(GPIO_IO_LOW, port); break; } case GPIO_CMD_WRITE_HIGH: { GPIO_WriteIO(GPIO_IO_HIGH, port); break; } case GPIO_CMD_SET_MODE_0: { GPIO_ModeSetup(port, GPIO_MODE_0); break; } case GPIO_CMD_SET_MODE_1: { GPIO_ModeSetup(port, GPIO_MODE_1); break; } case GPIO_CMD_SET_MODE_2: { GPIO_ModeSetup(port, GPIO_MODE_2); break; } case GPIO_CMD_SET_MODE_3: { GPIO_ModeSetup(port, GPIO_MODE_3); break; } case GPIO_CMD_SET_MODE_4: //mode4-7 only for chip support more than 3bit mode control. { GPIO_ModeSetup(port, GPIO_MODE_4); break; } case GPIO_CMD_SET_MODE_5: { GPIO_ModeSetup(port, GPIO_MODE_5); break; } case GPIO_CMD_SET_MODE_6: { GPIO_ModeSetup(port, GPIO_MODE_6); break; } case GPIO_CMD_SET_MODE_7: { GPIO_ModeSetup(port, GPIO_MODE_7); break; } case GPIO_CMD_SET_MODE_8: { GPIO_ModeSetup(port, GPIO_MODE_8); break; } case GPIO_CMD_SET_DIR_OUT: { GPIO_InitIO(GPIO_DIR_OUT,port); break; } case GPIO_CMD_SET_DIR_IN: { GPIO_InitIO(GPIO_DIR_IN,port); break; } case GPIO_CMD_RETURN_MODE: { GPIO_CTRL_RETURN_MODE_T *prReturnMode; prReturnMode = &(data->rReturnMode); prReturnMode->u1RetMode = GPIO_ReturnMode(port); break; } case GPIO_CMD_RETURN_DIR: { GPIO_CTRL_RETURN_DIR_T *prReturnDir; prReturnDir = &(data->rReturnDir); prReturnDir->u1RetDirData =GPIO_ReturnDir(port); break; } case GPIO_CMD_RETURN_OUT: { GPIO_CTRL_RETURN_OUT_T *prReturnOut; prReturnOut = &(data->rReturnOut); prReturnOut->u1RetOutData = GPIO_ReturnDout(port); break; } case GPIO_CMD_ENABLE_PULL: { GPIO_PullenSetup(port, (kal_bool)GPIO_PULL_ENABLE); break; } case GPIO_CMD_DISABLE_PULL: { GPIO_PullenSetup(port, (kal_bool)GPIO_PULL_DISABLE); break; } case GPIO_CMD_SET_PULL_HIGH: { GPIO_PullSelSetup(port,(kal_bool) GPIO_PULL_HIGH); break; } case GPIO_CMD_SET_PULL_LOW: { GPIO_PullSelSetup(port, (kal_bool)GPIO_PULL_LOW); break; } case GPIO_CMD_SET_DINV: { GPIO_CTRL_SET_DINV_T *prSetDinv; prSetDinv = &(data->rSetDinv); GPIO_DinvSetup(port,(kal_bool)( prSetDinv->fgSetDinv)); break; } case GPIO_CMD_SET_DEBUG: { GPIO_CTRL_SET_DEBUG_T *prSetDebug; prSetDebug = &(data->rSetDebug); GPIO_SetDebugMode((kal_bool)(prSetDebug->fgSetDebug)); break; } #ifdef __CUST_NEW__ case GPIO_CMD_SET_DIR_OUT_NO_IRQ_MASK: { GPIO_InitIO_FAST(GPIO_DIR_OUT,port); break; } case GPIO_CMD_SET_DIR_IN_NO_IRQ_MASK: { GPIO_InitIO_FAST(GPIO_DIR_IN,port); break; } case GPIO_CMD_WRITE_HIGH_NO_IRQ_MASK: { GPIO_WriteIO_FAST(GPIO_IO_HIGH,port); break; } case GPIO_CMD_WRITE_LOW_NO_IRQ_MASK: { GPIO_WriteIO_FAST(GPIO_IO_LOW,port); break; } case GPIO_CMD_READ_NO_IRQ_MASK: { GPIO_CTRL_READ_T *prRead; prRead = &(data->rRead); prRead->u1IOData = GPIO_ReadIO_FAST(port); break; } #endif case GPIO_CMD_WRITE_FOR_SPI: { GPIO_CTRL_WRITE_FOR_SPI_T *prWrite; prWrite = &(data->rWriteSpi); GPIO_WriteIO_FAST2(prWrite->data,prWrite->no,prWrite->remainder_shift); break; } default: EXT_ASSERT(0,handle,cmd,0); return STATUS_INVALID_CMD; } } else if(DCL_GPO_IS_HANDLE_MAGIC(handle)) { switch(cmd) { case GPO_CMD_MODE_SET_0: { GPO_ModeSetup(port,GPO_MODE_0); break; } case GPO_CMD_MODE_SET_1: { GPO_ModeSetup(port,GPO_MODE_1); break; } case GPO_CMD_MODE_SET_2: { GPO_ModeSetup(port,GPO_MODE_2); break; } case GPO_CMD_MODE_SET_3: { GPO_ModeSetup(port,GPO_MODE_3); break; } case GPO_CMD_WRITE_LOW : { GPO_WriteIO(port,GPO_IO_LOW); break; } case GPO_CMD_WRITE_HIGH: { GPO_WriteIO(port,GPO_IO_HIGH); break; } case GPO_CMD_RETURN_OUT: { GPO_CTRL_RETURN_OUT_T *prReturnOut; prReturnOut = &(data->oReturnOut); prReturnOut->u1RetOutData = GPO_ReturnDout(port); break; } case GPO_CMD_RETURN_MODE: { GPO_CTRL_RETURN_MODE_T *prReturnMode; prReturnMode = &(data->oReturnMode); prReturnMode->u1RetMode = GPO_ReturnMode(port); break; } default: EXT_ASSERT(0,handle,cmd,0); return STATUS_INVALID_CMD; } } else if (DCL_GPIO_CLK_IS_HANDLE_MAGIC(handle)) { switch(cmd) { case GPIO_CMD_SET_CLK_OUT: { kal_uint8 mode=0; kal_uint8 clknum=0; GPIO_CTRL_SET_CLK_OUT_T *prSetClkOut; prSetClkOut = &(data->rSetClkOut); mode = get_mode(prSetClkOut->u2Mode); clknum=get_clknum(prSetClkOut->u2ClkNum); GPIO_SetClkOut(clknum,(gpio_clk_mode)mode); break; } case GPIO_CMD_SET_CLK_DIV: { kal_uint8 clknum=0; GPIO_CTRL_SET_CLK_DIV_T *prSetClkDiv; prSetClkDiv= &(data->rSetClkDiv); clknum=get_clknum(prSetClkDiv->u2ClkNum); GPIO_SetClkDiv(clknum,prSetClkDiv->u2Div); break; } default: EXT_ASSERT(0,handle,cmd,0); return STATUS_INVALID_CMD; } } else { EXT_ASSERT(0,handle,cmd,0); return STATUS_INVALID_DCL_HANDLE; } return STATUS_OK; }