/****************************************************************************** ** ** \brief Closes the front-end and disables the LNB power. ** ** \param index Internal index of front-end. ** ** \return Possible return codes: ** - #GD_OK ** - #GD_ERR_BAD_PARAMETER ** ******************************************************************************/ GERR GD_FE_Altobeam_Close(U8 index) { #if 0 GERR retVal; if (index >= GD_FE_MAX_NUM) return GD_ERR_BAD_PARAMETER; if(AntennaPowerInitial==GTRUE) { retVal = GD_GPIO_Close(&GPIO57Handle); if (retVal != GD_OK) { //GM_PrStr("\n[GD_FE_Altobeam_Close] ERR: GPIO could not be closed\n"); return (retVal); } retVal = GD_GPIO_Close(&GPIO58Handle); if (retVal != GD_OK) { //GM_PrStr("\n[GD_FE_Altobeam_Close] ERR: GPIO could not be closed\n"); return (retVal); } } else return GD_ERR_BAD_PARAMETER; #endif return GD_OK; }
/*! ******************************************************************************* ** ** \brief Controls the reset for the front ends. ** ** \param index Index of the front end to be resetted. ** \param cntrlVal Type of reset signal. ** \param pOption Optional parameters (not used yet). ** ** \return Possible return codes: ** - #GD_OK ** - #GD_ERR_BAD_PARAMETER ** ** \sa gd_fhw_ControlFeReset_SMARTMPEG_M_EVB ** ******************************************************************************/ static GERR gd_fhw_ControlFeReset_SMARTMPEG_M_EVB(S32 index, GD_GHW_RESET_CONTROL_E cntrlVal, void *pOption) { GERR retVal = GD_OK; GD_HANDLE h; U32 delay; U8 pinNum; /* on this board the front ends use separate reset signals, we need to distinguish according to index */ switch (index) { case 0: /* reset Front end 1 */ pinNum = GD_FHW_SMARTMPEG_M_EVB_FE1PIN; break; case 1: /* reset Front end 2 */ pinNum = GD_FHW_SMARTMPEG_M_EVB_FE2PIN; break; default: return (GD_ERR_BAD_PARAMETER); } switch(cntrlVal) { case(GD_GHW_RESET_INACTIVE): retVal = GD_GPIO_Open(GD_GPIO_39, GD_GPIO_TYPE_OUTPUT_1, NULL, &h); retVal = GD_GPIO_Write(h, 1); // FE reset high GD_GPIO_Close(&h); break; case(GD_GHW_RESET_ACTIVE): retVal = GD_GPIO_Open(GD_GPIO_39, GD_GPIO_TYPE_OUTPUT_1, NULL, &h); retVal = GD_GPIO_Write(h, 0); // FE reset low GD_GPIO_Close(&h); break; case(GD_GHW_RESET_PULSE): retVal = GD_GPIO_Open(GD_GPIO_39, GD_GPIO_TYPE_OUTPUT_1, NULL, &h); retVal = GD_GPIO_Write(h, 0); // FE reset low if (retVal != GD_OK) return (retVal); delay = GD_FHW_SIMPLE_RESET_DELAY; while (delay--); retVal = GD_GPIO_Write(h, 1); // FE reset high GD_GPIO_Close(&h); break; default: /* do nothing */ retVal = GD_ERR_BAD_PARAMETER; } return retVal; }
static GERR gd_fhw_ControlTsMuxing_SMARTMPEG_STB01(S32 index, GD_GHW_EXT_TS656_MUX_E cntrlVal, void *pOption) { GD_HANDLE h; U8 *pSel; int Option; pSel = pOption; Option = *pSel; if ((cntrlVal==GD_GHW_EXT_656_INP_P_MUX)||(cntrlVal==GD_GHW_EXT_656_INP_N_MUX)) { cntrlVal = GD_GHW_EXT_TS_INP_MUX; // this is the same } if (cntrlVal==GD_GHW_EXT_TS_INP_MUX) { if (Option==GD_FHW_TS656_EXT_MUX_DIRECT_TS_INDEX) { // XD_PrStr("\n->Configure TS-B-Input via LVDS-Interface"); GD_GPIO_Open(GD_GPIO_9, GD_GPIO_TYPE_OUTPUT_PUSH_PULL, NULL, &h); GD_GPIO_Write(h, 0); GD_GPIO_Close(&h); #if defined(GK6106) GD_TSD_InputSelector(GD_TSD_INPUT_FROM_OTHER_TSD, GD_TSD_INPUT_FROM_OTHER_TSD, GD_TSD_INPUT_FROM_OTHER_TSD, GD_TSD_INPUT_FROM_OTHER_TSD); #else GD_TSD_InputSelector(GD_TSD_INPUT_FROM_OTHER_TSD, GD_TSD_INPUT_FROM_OTHER_TSD); #endif } else if (Option==GD_FHW_TS656_EXT_MUX_FE0_INDEX) { // XD_PrStr("\n->Configure TS-A-Input from FE"); GD_GPIO_Open(GD_GPIO_9, GD_GPIO_TYPE_OUTPUT_PUSH_PULL, NULL, &h); GD_GPIO_Write(h, 1); GD_GPIO_Close(&h); #if defined(GK6106) GD_TSD_InputSelector(GD_TSD_INPUT_FROM_DEFAULT, GD_TSD_INPUT_FROM_DEFAULT, GD_TSD_INPUT_FROM_DEFAULT, GD_TSD_INPUT_FROM_DEFAULT); #else GD_TSD_InputSelector(GD_TSD_INPUT_FROM_DEFAULT, GD_TSD_INPUT_FROM_DEFAULT); #endif } } else if (cntrlVal==GD_GHW_EXT_656_OUT_P_MUX) { // XD_PrStr("\n->Configure TS-B 656 Output"); GD_GPIO_Open(GD_GPIO_9, GD_GPIO_TYPE_INPUT, NULL, &h); GD_GPIO_Close(&h); } return (GD_OK); }
/****************************************************************************** ** ** \brief Resets the front-end. ** ** \param index Internal index of front-end. ** ** \return Possible return codes: ** - #GD_OK ** - #GD_ERR_BAD_PARAMETER ** - #GD_ERR_FEATURE_NOT_SUPPORTED ** ******************************************************************************/ GERR GD_FE_Altobeam_Reset(U8 index) { #if 0 int i; //U32 data; GD_HANDLE handle; if (index >= GD_FE_MAX_NUM) return GD_ERR_BAD_PARAMETER; GD_GPIO_Open(GD_GPIO_2, GD_GPIO_TYPE_OUTPUT_1, NULL, &handle); GK5101_Delay(100); GD_GPIO_SetType(handle, GD_GPIO_TYPE_OUTPUT_0); //GK5101_Delay(100); //GD_GPIO_SetType(handle, GD_GPIO_TYPE_OUTPUT_1); //GK5101_Delay(100); GD_GPIO_Close(&handle); /*if(pTSD2Handle==NULL) return GD_ERR_NOT_INITIALIZED; data=GH_VE_getm_ITRU656DirData(); GD_GPIO_WriteTsd2(pTSD2Handle,(U16)data&0xFD); A1108_IBSP_Delay(10); GD_GPIO_WriteTsd2(pTSD2Handle,(U16)data|0x02); A1108_IBSP_Delay(10); */ #endif return GD_OK; }
/*! ******************************************************************************* ** ** \brief reconfigures a GPIO. ** ** \param number GPIO number. ** \param type Type of gpio (output, input, ...). ** \param pHandle Pointer to previous handle of the GPIO, can also be ** NULL if this GPIO was not opened before. ** ** \return Possible return codes: ** - #GD_OK ** - return codes from subroutines ** ** \sa gd_fhw_SMARTMPEG_STB01_reconfigGpio ** ******************************************************************************/ static GERR gd_fhw_SMARTMPEG_STB01_reconfigGpio (U8 number, GD_GPIO_TYPE_E type, GD_HANDLE* pHandle) { GERR retVal; /* it would be nicer if we could open the GPIOs in the init function just once. But to be able to reconfigure it from output to input we must close and open it again. */ if (*pHandle != NULL) { retVal = GD_GPIO_Close(pHandle); if (retVal != GD_OK) { #ifdef GD_FHW_SMARTMPEG_STB01_DEBUG GM_PrStr("\n[gh_fhw_SMARTMPEG_STB01_reconfigGpio] ERR: GPIO could not be closed\n"); #endif return (retVal); } } retVal = GD_GPIO_Open(number, type, NULL, pHandle); if (retVal != GD_OK) { #ifdef GD_FHW_SMARTMPEG_STB01_DEBUG GM_PrStr("\n[gh_fhw_SMARTMPEG_STB01_reconfigGpio] ERR: GPIO could not be opened\n"); #endif return (retVal); } return (GD_OK); }
/*! ******************************************************************************* ** ** \brief Cancel the write/read process of I2C bus. ** ** \sa GD_I2C_Read() <br> ** GD_I2C_Write() ** ******************************************************************************/ void GD_I2C_CancelProcess(void) { GERR ferr; int i; if (i2c_initialized == GFALSE) return; // GD_ERR_NOT_INITIALIZED; GD_GPIO_Close(&i2c_sda_handle); GD_GPIO_Close(&i2c_scl_handle); ferr = GD_GPIO_Open(i2c_sda_pin, I2C_GPIO_TYPE_OUTPUT, NULL, &i2c_sda_handle); ferr = GD_GPIO_Open(i2c_scl_pin, I2C_GPIO_TYPE_OUTPUT, NULL, &i2c_scl_handle); GD_GPIO_Write(i2c_sda_handle, 1); // set SDA to high GD_GPIO_Write(i2c_scl_handle, 1); // set SCL to high for (i = 0;i < SI2C_BUS_FREE_TIME;i++); // delay loop }
GERR GD_FE_LGS8GA6_Reset(U8 index) { GERR ferr = GD_OK; if ( index >= GD_FE_MAX_NUM ) { return GD_ERR_BAD_PARAMETER; } /* reset the LGS8GA6 chip */ if ( pData[index]->ghwIndex>= 0 ) { /* error = GD_GPIO_Open(pData[index]->ghwIndex, GD_GPIO_TYPE_OUTPUT_PUSH_PULL, NULL, &pData[index]->handleI2C); if ( error != GD_OK ) return(error);*/ ferr = GD_GPIO_Open(pData[index]->ghwIndex, GD_GPIO_TYPE_OUTPUT_1, NULL, &pData[index]->handleI2C); #ifdef GD_FE_LGS_DEBUG if(ferr != GD_OK) GM_PrStr("\nOpen GPIO 39 error"); #endif ferr = GD_GPIO_Write(pData[index]->handleI2C, 1); #ifdef GD_FE_LGS_DEBUG if(ferr != GD_OK) GM_PrStr("\nOpen GPIO 39 error"); #endif LGS_Waitms(10); ferr = GD_GPIO_Write(pData[index]->handleI2C, 0); #ifdef GD_FE_LGS_DEBUG if(ferr != GD_OK) GM_PrStr("\nOpen GPIO 39 error"); #endif LGS_Waitms(10); ferr = GD_GPIO_Write(pData[index]->handleI2C, 1); #ifdef GD_FE_LGS_DEBUG if(ferr != GD_OK) GM_PrStr("\nOpen GPIO 39 error"); #endif LGS_Waitms(10); GD_GPIO_Close(&pData[index]->handleI2C); } return ferr; }
/*! ***************************************************************************** ** \brief Exit the Ethernet driver. ** ** This function terminates Ethernet driver and deallocates internal buffers. ** ** \note This function is the implementation of ** GD_SYS_DriverT::exitDriverFunc. ** ** \sa GD_ETH_Init() ***************************************************************************** */ GERR GD_ETH_Exit(void) { if(ethIntHandle == 0) { return GD_ERR_NOT_INITIALIZED; } GD_INT_Enable(ðIntHandle, 0); GD_INT_Close(ðIntHandle); ethIntHandle = 0; if(ethdevice.phyreset) { GD_GPIO_Close(ðdevice.phyreset); ethdevice.phyreset = 0; } return GD_OK; }
/*! ******************************************************************************* ** ** \brief Disable PWM output ** ** This function disable the PWM output. ** ** \param channel The PWM channel that specified. ** ** \return ** - #GD_OK if successful ******************************************************************************/ GERR GD_PWM_Close( U8 channel ) { GH_PWM_set_Enable_enb(channel,0); GD_GPIO_Close(&Gpiohandle[channel]); return( GD_OK ); }