コード例 #1
0
ファイル: main.c プロジェクト: Karamax/arrakis
int main(int argc, char **argv)
{
    cm2_init();
    ti_twl6030_init();
    ctrlmod_init();
    cm2_enable_hsmmc1();
    sdmmc1_enable_power();

    mmchs_init();

    init_service();

    return 0;
}
コード例 #2
0
ファイル: mmchs.c プロジェクト: CoryXie/BarrelfishOS
void mmchs_init(void)
{
    cm2_init();

    lvaddr_t mmchs_vaddr;
    errval_t err = map_device_register(MMCHS_BASE, 0x1000, &mmchs_vaddr);
    assert(err_is_ok(err));
    
    // Initialize devices
    omap44xx_mmchs_initialize(&mmchs, (mackerel_addr_t)mmchs_vaddr);
    sdhc_initialize(&sdhc, (mackerel_addr_t) mmchs_vaddr + 0x200);
    ctrlmod_init();

    printf("\nmmchs: entered init().\n");

    // Enable interrupts
    err = inthandler_setup_arm(mmchs_handle_irq, NULL, MMC1_IRQ);
    assert(err_is_ok(err));

    // Configure Pad multiplexing
    // Does not change anything ctrlmod_init();

    // Enable power
    cm2_enable_hsmmc1();

    // Configure device
    mmchs_pre_configure();
    mmchs_configure();

    /* // Change clock frequency to 50 MHz (as Linux) */
    /* mmchs_change_clock_frequency(0x2); */
    /* mmchs_do_state_machine_reset(); */

    switch (sdhc_rev_srev_rdf(&sdhc)) {
    case 0x0:
        printf("SD Host Specification Version 1.0\n");
        break;
    case 0x1:
        printf("SD Host Specification Version 2.0\n");
        break;
    default:
        assert(!"Don't understand SREV field");
    }
    

    mmchs_init_stream();
    mmchs_detect_card();
    /* mmchs_init_and_ident_card(); */


    /* printf("mmchs_detect_card\n"); */
    /* /\* mmchs_detect_card(); *\/ */
    /* sdhc_ie_wr(&sdhc, ~0x0); */
    /* sdhc_ise_wr(&sdhc, ~0x0); */
    
    /* mmchs_print_power_state(); */

    /* int resp; */
    /* int loop = 0; */

    /* do { */

    /*     printf("Trying to init card, step %d\n", ++loop); */
        
    /*     /\* mmchs_wait_msec(100); *\/ */
        
    /*     /\* // See diagram 24-48 for details on how to set card frequency *\/ */
    /*     /\* mmchs_change_clock_frequency(); *\/ */

    /*     mmchs_wait_msec(100); */
    /*     printf("Init and ident card .. \n"); */
    /*     resp = mmchs_init_and_ident_card(); */

    /*     mmchs_wait_msec(1000); */

    /* } while(resp!=MMCHS_RESP_SUCCESS && loop<100); */

}