Код
void mci_config(void)
{
// Enable peripherial A
AT91C_BASE_PIOA->PIO_ASR = BIT(6)|BIT(7)|BIT(8)|BIT(9)|BIT(10)|BIT(11);
//Enables the Multi-Media Interface
AT91C_BASE_MCI->MCI_CR=AT91C_MCI_MCIEN;
// Enable the MCI clock
AT91C_BASE_PMC->PMC_PCER=(1<<9);
// Software reset
AT91C_BASE_MCI->MCI_CR=AT91C_MCI_SWRST;
// Disable the MCI
AT91C_BASE_MCI->MCI_CR=AT91C_MCI_MCIDIS | AT91C_MCI_PWSDIS;
// Disable all the interrupts
AT91C_BASE_MCI->MCI_IDR=0xFFFFFFFF;
// Set the Data Timeout Register
AT91C_BASE_MCI->MCI_DTOR=DTOR_1MEGA_CYCLES;
// Set the Mode Register: 400KHz for MCK = 48MHz (CLKDIV = 58)
AT91C_BASE_MCI->MCI_MR= AT91C_MCI_PWSDIV|2;
//Set bus width 4 line, select slot A
AT91C_BASE_MCI->MCI_SDCR = AT91C_MCI_SCDBUS;
// Enable the MCI and the Power Saving
AT91C_BASE_MCI->MCI_CR=AT91C_MCI_MCIEN;
}
unsigned int send_cmd(uint com,uint arg)
{
AT91C_BASE_MCI->MCI_ARGR=arg;
AT91C_BASE_MCI->MCI_CMDR=com;
while(!AT91C_BASE_MCI->MCI_SR&AT91C_MCI_CMDRDY);
return RESPONSE[0];
}
{
// Enable peripherial A
AT91C_BASE_PIOA->PIO_ASR = BIT(6)|BIT(7)|BIT(8)|BIT(9)|BIT(10)|BIT(11);
//Enables the Multi-Media Interface
AT91C_BASE_MCI->MCI_CR=AT91C_MCI_MCIEN;
// Enable the MCI clock
AT91C_BASE_PMC->PMC_PCER=(1<<9);
// Software reset
AT91C_BASE_MCI->MCI_CR=AT91C_MCI_SWRST;
// Disable the MCI
AT91C_BASE_MCI->MCI_CR=AT91C_MCI_MCIDIS | AT91C_MCI_PWSDIS;
// Disable all the interrupts
AT91C_BASE_MCI->MCI_IDR=0xFFFFFFFF;
// Set the Data Timeout Register
AT91C_BASE_MCI->MCI_DTOR=DTOR_1MEGA_CYCLES;
// Set the Mode Register: 400KHz for MCK = 48MHz (CLKDIV = 58)
AT91C_BASE_MCI->MCI_MR= AT91C_MCI_PWSDIV|2;
//Set bus width 4 line, select slot A
AT91C_BASE_MCI->MCI_SDCR = AT91C_MCI_SCDBUS;
// Enable the MCI and the Power Saving
AT91C_BASE_MCI->MCI_CR=AT91C_MCI_MCIEN;
}
unsigned int send_cmd(uint com,uint arg)
{
AT91C_BASE_MCI->MCI_ARGR=arg;
AT91C_BASE_MCI->MCI_CMDR=com;
while(!AT91C_BASE_MCI->MCI_SR&AT91C_MCI_CMDRDY);
return RESPONSE[0];
}
Далее посылаю команду, смотрю осциллом на клок, но тот не дергается даже. Подскажите, что я забыл включить, либо ошибки какие-то имеются.