U-boot-1.1.6-2008R1到vdsp5(bf561)的移植记录(16):*cplb_add

 
   在lib_blackfin/board.c中有一个函数:
void init_cplbtables(void)
{
     volatile uint32_t *ICPLB_ADDR, *ICPLB_DATA;
     volatile uint32_t *DCPLB_ADDR, *DCPLB_DATA;
     uint32_t extern_memory;
     size_t i;
 
     void icplb_add(uint32_t addr, uint32_t data)
     {
         *(ICPLB_ADDR + i) = addr;
         *(ICPLB_DATA + i) = data;
     }
     void dcplb_add(uint32_t addr, uint32_t data)
     {
         *(DCPLB_ADDR + i) = addr;
         *(DCPLB_DATA + i) = data;
     }
}
在这里它将icplb_add和dcpld_add这两个函数放到了init_cplbtables函数里面,而这在VDSP中是不允许的,因此将其提取到外面来。
static volatile uint32_t *ICPLB_ADDR, *ICPLB_DATA;
static volatile uint32_t *DCPLB_ADDR, *DCPLB_DATA;
static size_t g_iIndex;
static void icplb_add(uint32_t addr, uint32_t data)
{
     *(ICPLB_ADDR + g_iIndex) = addr;
     *(ICPLB_DATA + g_iIndex) = data;
}
static void dcplb_add(uint32_t addr, uint32_t data)
{
     *(DCPLB_ADDR + g_iIndex) = addr;
     *(DCPLB_DATA + g_iIndex) = data;
}
 
void init_cplbtables(void)
{
     uint32_t extern_memory;
 
     /* populate a few common entries ... we'll let
      * the memory map and cplb exception handler do
      * the rest of the work.
      */
     g_iIndex = 0;
     ICPLB_ADDR = (uint32_t *)ICPLB_ADDR0;
     ICPLB_DATA = (uint32_t *)ICPLB_DATA0;
     DCPLB_ADDR = (uint32_t *)DCPLB_ADDR0;
     DCPLB_DATA = (uint32_t *)DCPLB_DATA0;
 
     icplb_add(0xFFA00000, L1_IMEMORY);
     dcplb_add(0xFF800000, L1_DMEMORY);
     ++g_iIndex;
 
     icplb_add(CFG_MONITOR_BASE & CPLB_PAGE_MASK, SDRAM_IKERNEL);
     dcplb_add(CFG_MONITOR_BASE & CPLB_PAGE_MASK, SDRAM_DKERNEL);
     ++g_iIndex;
 
     /* If the monitor crosses a 4 meg boundary, we'll need
      * to lock two entries for it.
      */
     if ((CFG_MONITOR_BASE & CPLB_PAGE_MASK) != ((CFG_MONITOR_BASE + CFG_MONITOR_LEN) & CPLB_PAGE_MASK)) {
         icplb_add((CFG_MONITOR_BASE + CFG_MONITOR_LEN) & CPLB_PAGE_MASK, SDRAM_IKERNEL);
         dcplb_add((CFG_MONITOR_BASE + CFG_MONITOR_LEN) & CPLB_PAGE_MASK, SDRAM_DKERNEL);
         ++g_iIndex;
     }
 
     icplb_add(0x20000000, SDRAM_INON_CHBL);
     dcplb_add(0x20000000, SDRAM_EBIU);
     ++g_iIndex;
 
     /* Add entries for the rest of external RAM up to the bootrom */
     extern_memory = 0;
 
#ifdef CONFIG_DEBUG_NULL_PTR
     icplb_add(extern_memory, (SDRAM_IKERNEL & ~PAGE_SIZE_MASK) | PAGE_SIZE_1KB);
     dcplb_add(extern_memory, (SDRAM_DKERNEL & ~PAGE_SIZE_MASK) | PAGE_SIZE_1KB);
     ++g_iIndex;
     icplb_add(extern_memory, SDRAM_IKERNEL);
     dcplb_add(extern_memory, SDRAM_DKERNEL);
     extern_memory += CPLB_PAGE_SIZE;
     ++g_iIndex;
#endif
 
     while (g_iIndex < 16 && extern_memory < (CFG_MONITOR_BASE & CPLB_PAGE_MASK)) {
         icplb_add(extern_memory, SDRAM_IGENERIC);
         dcplb_add(extern_memory, SDRAM_DGENERIC);
         extern_memory += CPLB_PAGE_SIZE;
         ++g_iIndex;
     }
     while (g_iIndex < 16) {
         icplb_add(0, 0);
         dcplb_add(0, 0);
         ++g_iIndex;
     }
}
 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

嵌云阁主

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值