⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ct11mpcore_eb.c

📁 FDMP the body of the kernel, the Information-Technology Promotion Agency (IPA) adopted by the unexpl
💻 C
📖 第 1 页 / 共 2 页
字号:
        uart_ierdy_snd(siopcb->exinf);    }}/* *  SIOの充哈みサ〖ビスル〖チン */voiduart_isr(){    uart_isr_siop(&(siopcb_table[0]));}/* * * SCU簇息の簇眶 *   *//* * CP15のAUXILIARYレジスタのSAビットをセットしてSMPモ〖ドにする */Inline voidenable_sa(void){    UINT bits;    CP15_AUXILIARY_READ(bits);    bits |= CP15_AUXILIARY_SA_BIT;    CP15_AUXILIARY_WRITE(bits);}Inline voidscu_enable(void){    UINT scu_ctrl;        /* SCUを铜跟に */    scu_ctrl  = sil_rew_mem((void *)MPCORE_SCU_CTRL);    scu_ctrl |= MPCORE_SCU_CTRL_EN;    sil_wrw_mem((void *)MPCORE_SCU_CTRL, scu_ctrl);}/* * SMPモ〖ドに肋年する */voidmpcore_smp_mode_enable(void){    UINT sr;        /* 链充哈み敦贿 */    sr = current_sr();    set_sr(sr|CPSR_IRQ_BIT|CPSR_FIQ_BIT);    /* キャシュをクリ〖ン */    mpcore_dcache_clean_and_invalidate();    mpcore_icache_invalidate();    /* Data Synchronization Barrier */    mpcore_data_sync_barrier();    /* TLBの介袋步 */    mpcore_invalidate_unfied_tlb();    /* CP15のSMP/nAMP bit をセットする */    enable_sa();    #if PE1    /* SCU を铜跟にして SMPモ〖ドにセットする */        scu_enable();#endif            /* 充哈み敦贿觉轮を傅に提す */    set_sr(sr);}/* * キャッシュ簇息の介袋步 *//* * Dキャッシュを倡幌 */voidmpcore_dcache_enable(void){    UINT bits;    CP15_CONTROL_READ(bits);    /* すでにONならリタ〖ン */    if (bits & CP15_CONTROL_C_BIT){        return;    }    mpcore_dcache_invalidate();    bits |= CP15_CONTROL_C_BIT;    CP15_CONTROL_WRITE(bits);}/* * Dキャッシュを匿贿 */voidmpcore_dcache_disable(void){    UINT bits;    CP15_CONTROL_READ(bits);    bits &= ~CP15_CONTROL_C_BIT;    CP15_CONTROL_WRITE(bits);    mpcore_dcache_clean_and_invalidate();}/* * Iキャッシュの倡幌 */voidmpcore_icache_enable(void){    UINT bits;        CP15_CONTROL_READ(bits);    /*     * すでに铜跟ならリタ〖ン     */    if(bits & CP15_CONTROL_I_BIT){        return;    }    mpcore_icache_invalidate();    bits |= CP15_CONTROL_I_BIT;    CP15_CONTROL_WRITE(bits);}/* * Iキャッシュを匿贿 */voidmpcore_icache_disable(void){    UINT bits;        CP15_CONTROL_READ(bits);    bits &= ~CP15_CONTROL_I_BIT;    CP15_CONTROL_WRITE(bits);     mpcore_icache_invalidate();}/* * I/Dキャッシュを尉数を倡幌 */voidmpcore_cache_enable(void){    mpcore_dcache_enable();    mpcore_icache_enable();}/* * I/Dキャッシュを尉数を匿贿 */voidmpcore_cache_disable(void){    mpcore_dcache_disable();    mpcore_icache_disable();}/* * MMU簇息のコ〖ド *//* * メモリのベ〖スアドレスとサイズ */#define SDRAM_ADDR 0x00000000#define SRAM_ADDR  0x48000000#define SDRAM_SIZE 0x08000000 /* 128MB */#define SRAM_SIZE  0x00200000 /*   1MB */#define SIZE_1M    0x00100000#define DOMAIN_NO  1#define PAGE_TABLE_SIZE  0x00004000 /* 4KB */ /* * 恃垂テ〖ブルへの肋年柒推 * va   : 簿鳞アドレス * pa   : 湿妄アドレス * size : サイズ  * s    : 鼎铜回年 * tex  : C Bとの寥み圭わせで恃步 * ap   : アクセス涪 * c    : キャッシュ * c    : バッファ */typedef struct{    UINT   va;    UINT   pa;    UINT   size;        UB     s;    UB     tex;    UB     ap;    UB     c;    UB     b;    }MEMORY_ATTRIBUTE;/* * ペ〖ジテ〖ブル */UB PabeTable[PAGE_TABLE_SIZE];/* * ペ〖ジテ〖ブルのセクションを肋年する */static voidmmu_set_section(UINT va, UINT pa,                UB s, UB tex, UB ap,                 UB c, UB b){    UINT ttb;    UINT *sptr;    /*     * ペ〖ジテ〖ブルのベ〖スアドレスを艰评     */    CP15_TTB0_READ(ttb);    /*     * VAからセクションのアドレスを艰评     */    sptr  = (UINT *)((ttb & 0xFFFFC000) | (((va & 0xFFF00000) >> 20) << 2));    *sptr = pa | (s << 16) | (tex << 12) | (ap << 10) | (c << 3) | (b << 2) | (1 << 1);}/* * 回年に骄い,メモリのマッピングを乖う * マッピングの帽疤は1MB  */static voidmmu_map_memory(MEMORY_ATTRIBUTE *m_attribute){    UINT size;    UINT va;    UINT pa;        size = m_attribute->size;    va   = m_attribute->va;    pa   = m_attribute->pa;    /* MB帽疤になるようにサイズを肋年 */    size = (size + 0x000FFFFF) & ~0x000FFFFF;    while(size > 0){        mmu_set_section(va, pa,                        m_attribute->s,                        m_attribute->tex,                        m_attribute->ap,                        m_attribute->c,                        m_attribute->b);        va   += SIZE_1M;        pa   += SIZE_1M;        size -= SIZE_1M;    }}voidmpcore_mmu_init(void){    MEMORY_ATTRIBUTE m_attribute;        UINT bits = 0;    /* プリフェッチバッファをクリア */    mpcore_pbuffer_flash();            /*     * TTBR0を脱いる脱に回年     */    CP15_TTBCR_WRITE(0);    /*     * 恃垂テ〖ブル(TT)をSRAMの呵稿に16Kbyte澄瘦する(0x481fc000)     * Sharedビットをセット      */    CP15_TTB0_WRITE((((UINT)PabeTable)|CP15_TTB0_RGN_S|CP15_TTB0_RGN_WBWA));        /* プリフェッチバッファをクリア */    mpcore_pbuffer_flash();    /*     * 链セクションを湿妄アドレス = 簿鳞アドレス     * ノンキャッシャブル·ノンバッファブルとする      */    m_attribute.pa   = 0x00000000;    m_attribute.va   = m_attribute.pa;    m_attribute.size = 0x80000000;    m_attribute.s    = 1;          /* 鼎铜         */    m_attribute.ap   = 3;          /* フルアクセス */    m_attribute.tex  = 0;          /* Strongly Ordered */    m_attribute.c    = 0;    m_attribute.b    = 0;    mmu_map_memory (&m_attribute);      m_attribute.pa   = 0x80000000;    m_attribute.va   = m_attribute.pa;        mmu_map_memory (&m_attribute);        /*     * SDRAMの肋年     */    m_attribute.pa   = SDRAM_ADDR;    m_attribute.va   = m_attribute.pa;    m_attribute.size = SDRAM_SIZE;    m_attribute.s    = 1;          /* 鼎铜         */    m_attribute.ap   = 3;          /* フルアクセス */    m_attribute.tex  = 1;          /* Outer and Inner */    m_attribute.c    = 1;          /* Inner Write-Back, Write Allocate */     m_attribute.b    = 1;    mmu_map_memory (&m_attribute);        /*     * Enable caching for the SRAM     */    m_attribute.pa    = SRAM_ADDR;     /* pa is started from 0x48000000 (SRAM) */    m_attribute.va    = m_attribute.pa;    m_attribute.size  = SRAM_SIZE;     /* 2MB */    m_attribute.ap    = 3;             /* フルアクセス */        m_attribute.tex   = 1;             /* Outer and Inner */    m_attribute.c     = 1;             /* Inner Write-Back, Write Allocate */     m_attribute.b     = 1;        mmu_map_memory (&m_attribute);        /*     * ドメイン戎规をセット     */    CP15_DOMAINS_WRITE(DOMAIN_NO);    /*     * CONTROLコプロセッサの Mビット·XPビットをセットして·     * MMUを铜跟にする       */    CP15_CONTROL_READ(bits);    bits |= CP15_CONTROL_M_BIT | CP15_CONTROL_XP_BIT;    CP15_CONTROL_WRITE(bits);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -