static void mcsdl_read_32bits( UINT8 *pData ) { int i, j; MCSDL_GPIO_SCL_SET_LOW(); MCSDL_GPIO_SDA_SET_LOW(); MCSDL_GPIO_SDA_SET_INPUT(); for (i=3; i>=0; i--){ pData[i] = 0; for (j=0; j<8; j++){ pData[i] <<= 1; MCSDL_GPIO_SCL_SET_LOW(); mcsdl_delay(MCSDL_DELAY_1US); MCSDL_GPIO_SCL_SET_HIGH(); mcsdl_delay(MCSDL_DELAY_1US); if (MCSDL_GPIO_SDA_IS_HIGH()) pData[i] |= 0x01; } } MCSDL_GPIO_SDA_SET_LOW(); MCSDL_GPIO_SDA_SET_OUTPUT(0); }
static void mcsdl_reboot_mcs(void) { //-------------------------------------------- // Tkey module reset //-------------------------------------------- MCSDL_VDD_SET_LOW(); //MCSDL_CE_SET_LOW(); //MCSDL_CE_SET_OUTPUT(); MCSDL_GPIO_SDA_SET_HIGH(); MCSDL_GPIO_SDA_SET_OUTPUT(1); MCSDL_GPIO_SCL_SET_HIGH(); MCSDL_GPIO_SCL_SET_OUTPUT(1); //MCSDL_SET_HW_I2C(); MCSDL_RESETB_SET_LOW(); MCSDL_RESETB_SET_OUTPUT(1); mcsdl_delay(MCSDL_DELAY_25MS); // Delay for Stable VDD MCSDL_VDD_SET_HIGH(); MCSDL_RESETB_SET_HIGH(); MCSDL_RESETB_SET_INPUT(); MCSDL_GPIO_SCL_SET_INPUT(); MCSDL_GPIO_SDA_SET_INPUT(); mcsdl_delay(MCSDL_DELAY_30MS); // Delay '25 msec' }
static void mcsdl_reboot_mcs(void) { MCSDL_VDD_SET_LOW(); MCSDL_CE_SET_LOW(); MCSDL_CE_SET_OUTPUT(0); MCSDL_GPIO_SDA_SET_HIGH(); MCSDL_GPIO_SDA_SET_OUTPUT(1); MCSDL_GPIO_SCL_SET_HIGH(); MCSDL_GPIO_SCL_SET_OUTPUT(1); MCSDL_RESETB_SET_LOW(); MCSDL_RESETB_SET_OUTPUT(0); mcsdl_delay(MCSDL_DELAY_25MS); /* Delay for Stable VDD */ MCSDL_VDD_SET_HIGH(); /*MCSDL_CE_SET_HIGH();*/ MCSDL_RESETB_SET_HIGH(); MCSDL_RESETB_SET_INPUT(); MCSDL_GPIO_SCL_SET_INPUT(); MCSDL_GPIO_SDA_SET_INPUT(); mcsdl_delay(MCSDL_DELAY_30MS); /* Delay '25 msec' */ }
static void mcsdl_read_32bits( UINT8 *pData ) { int i, j; MCSDL_GPIO_SDA_SET_INPUT(); #ifdef ENABLE_LITTLE_ENDIAN for (i=0; i<=3; i++){ #else // BIG_ENDIAN for (i=3; i>=0; i--){ #endif pData[i] = 0; for (j=0; j<8; j++){ pData[i] <<= 1; MCSDL_GPIO_SCL_SET_HIGH(); mcsdl_mcs7000_delay(MCSDL_DELAY_5US); if ( MCSDL_GPIO_SDA_IS_HIGH()) pData[i] |= 0x01; MCSDL_GPIO_SCL_SET_LOW(); mcsdl_mcs7000_delay(MCSDL_DELAY_5US); } } } static void mcsdl_write_bits(UINT32 wordData, int nBits) { int i; MCSDL_GPIO_SDA_SET_LOW(); MCSDL_GPIO_SDA_SET_OUTPUT(); for (i=0; i<nBits; i++){ if ( wordData & 0x80000000 ) { MCSDL_GPIO_SDA_SET_HIGH(); } else { MCSDL_GPIO_SDA_SET_LOW(); } mcsdl_mcs7000_delay(MCSDL_DELAY_3US); MCSDL_GPIO_SCL_SET_HIGH(); mcsdl_mcs7000_delay(MCSDL_DELAY_3US); MCSDL_GPIO_SCL_SET_LOW(); mcsdl_mcs7000_delay(MCSDL_DELAY_3US); wordData <<= 1; } }
void MFS_reboot(void) { MCSDL_VDD_SET_LOW(); MCSDL_GPIO_SDA_SET_HIGH(); MCSDL_GPIO_SDA_SET_OUTPUT(1); MCSDL_GPIO_SCL_SET_HIGH(); MCSDL_GPIO_SCL_SET_OUTPUT(1); MCSDL_RESETB_SET_LOW(); MCSDL_RESETB_SET_OUTPUT(1); MFS_ms_delay(25); MCSDL_VDD_SET_HIGH(); MCSDL_RESETB_SET_HIGH(); MCSDL_RESETB_SET_INPUT(); MCSDL_GPIO_SCL_SET_INPUT(); MCSDL_GPIO_SDA_SET_INPUT(); MFS_ms_delay(25); }