void LeweiTcpClient::writeRom(String value) { for(int i =0;i<52;i++) { EEPROM.write(i, value.charAt(i)); } softwareReset(); }
void Mci::initialise(mci::CardSlot_t cardSlot) { OSDeviceDebug::putString("avr32::uc3::Mci::initialise()"); OSDeviceDebug::putNewLine(); m_shadowStatusRegister = 0; softwareReset(); disableInterface(); disableAllInterrupts(); clearConfiguration(); clearModeBits(); // Set the Data Timeout Register to 1 Mega Cycles initDataTimeout(MCI_DEFAULT_DTOLMUL, MCI_DEFAULT_DTOLCYC); // Start with low speed configureClockFrequencyHz(400000); // Set the Mode register // The two bits, Read Proof Enable and Write Proof Enable in the // MR register (MR.RDPROOF and MR.WRPROOF) allow stopping the // MCI Clock (CLK) during read or write access if the internal // FIFO is full. This will guarantee data integrity, not bandwidth enableModeBits( (MCI_DEFAULT_PWSDIV << AVR32_MCI_MR_PWSDIV) | AVR32_MCI_MR_RDPROOF_MASK | AVR32_MCI_MR_WRPROOF_MASK); // Set the SD/MMC Card register // Start with bus width = 1bit configureSdCardBusWidthAndSlot(mci::BusWidth::_1bit, cardSlot); // Enable the MCI and the Power Saving // The Power Save Mode Enable bit in the CR register (CR.PWSEN) // saves power by dividing the MCI clock (CLK) by 2PWSDIV + 1 // when the bus is inactive. The Power Saving Divider field locates // in the Mode Register (MR.PWSDIV). enableInterface(); }
uint32_t sdHalInit() { enableIfaceAndFunctionalClock(); if ( softwareReset() ) { return 1; } if ( resetLines( MMCHS_SYSCTL_SRA_BIT ) ) { return 1; } selectSupportedVoltage( MMCHS_CAPA_VS18_BIT | MMCHS_CAPA_VS30_BIT ); // want enable wakeup when card is inserted systemConfig( MMCHS_SYSCONFIG_AUTOIDLE_BIT /*| MMCHS_SYSCONFIG_ENAWAKEUP_BIT */ ); setBusWidth( BUS_WIDTH_1BIT ); setBusVoltage( MMCHS_HCTL_SDVS_30V_BIT ); if ( setBusPower( TRUE ) ) { return 1; } // need some initial clock divider otherwise would not work to set the bus frequency MMCHS_SYSCTL = 0x0000a007; if ( setBusFrequency( SDMMC_CONTROLLER_CLOCK, SDMMC_BUS_CLOCK, FALSE ) ) { return 1; } /* // wake-up event enabled on card-insertion MMCHS_HCTL |= MMCHS_HCTL_INS_BIT; // clear all and set card-interrupt enable MMCHS_ISE = MMCHS_ISE_CIRQ_SIGEN_BIT; // TODO: the next only when card is inserted! */ sendInitStream(); if ( identifyCard() ) { return 1; } if ( configBusWidth() ) { return 1; } configTransferSpeed(); return 0; }