亚洲免费在线-亚洲免费在线播放-亚洲免费在线观看-亚洲免费在线观看视频-亚洲免费在线看-亚洲免费在线视频

head.s分析(2):SYSCFG配置

系統 1922 0

快樂蝦

http://blog.csdn.net/lights_joy/

lights@hb165.com

本文適用于

ADI bf561 DSP

uclinux-2008r1.5-rc3 ( 移植到 vdsp5)

Visual DSP++ 5.0(update 5)

歡迎轉載,但請保留作者信息

/* Enable Cycle Counter and Nesting Of Interrupts */

#ifdef CONFIG_BFIN_SCRATCH_REG_CYCLES

R0 = SYSCFG_SNEN;

#else

R0 = SYSCFG_SNEN | SYSCFG_CCEN;

#endif

SYSCFG = R0;

這幾行代碼用于設置 SYSCFG 的值,關于 SYSCFG 這個寄存器, vdsp 文件這樣說:

The System Configuration Register (SYSCFG) shown in Figure 4-3 controls the configuration of the processor

對于 BF561 而言,只有 CCEN SSSTEP 兩位有效,在這里將 CCEN 位設置為 1 ,表示要啟用 64 位的 cycle counter 。而對 SNEN 的置位將被忽略。

System Configuration  Register

在啟用了 CCEN 之后, CYCLES CYCLES2 兩個寄存器將開始統計 CCLK 的個數。

下面是 vdsp 文檔中對 CYCLES CYCLES2 這兩個寄存器的一個說明:

The cycle counter counts CCLK cycles while the program is executing. All cycles, including execution, wait state, interrupts, and events, are counted while the processor is in User or Supervisor mode, but the cycle counter stops counting in Emulator mode.

The cycle counter is 64 bits wide and increments every cycle. The count value is stored in two 32-bit registers, CYCLES and CYCLES2 . The least significant 32 bits (LSBs) are stored in CYCLES. The most significant 32 bits (MSBs) are stored in CYCLES2 .

Note: To ensure read coherency, first read CYCLES , then CYCLES2 , and then CYCLES again, to detect if an overflow has occurred in the LSBs during the read operations.

In User mode, these two registers may be read, but not written. In Supervisor and Emulator modes, they are read/write registers.

To enable the cycle counters, set the CCEN bit in the SYSCFG register. The following example shows how to use the cycle counter:

R2 = 0;

CYCLES = R2;

CYCLES2 = R2;

R2 = SYSCFG;

BITSET(R2,1);

SYSCFG = R2;

/* Insert code to be benchmarked here. */

R2 = SYSCFG;

BITCLR(R2,1);

SYSCFG = R2;

通常這兩個寄存器可以用于性能統計。但是由于這兩個寄存器在幾種模式下均是可寫的,因此也可以將它們當成通用寄存器使用。在 uclinux 內核中,提供了一個叫 CONFIG_BFIN_SCRATCH_REG_CYCLES 的選項來控制 CYCLES 的用途:

config BFIN_SCRATCH_REG_CYCLES

bool "CYCLES"

help

Use the CYCLES register in the Blackfin exception handler

as a stack scratch register . This means you cannot

safely use the CYCLES performance registers on a Blackfin

board at anytime, but you can debug the system with a JTAG

ICE and use the NMI.

當設置了 CONFIG_BFIN_SCRATCH_REG_CYCLES 后,在 linux-2.6.x\arch\blackfin\mach-common\entry.S 文件中將 CYCLES 做為普通寄存器使用:

#if defined (CONFIG_BFIN_SCRATCH_REG_RETN)

# define EX_SCRATCH_REG RETN

#elif defined (CONFIG_BFIN_SCRATCH_REG_RETE)

# define EX_SCRATCH_REG RETE

#else

# define EX_SCRATCH_REG CYCLES

#endif

自然,在此時 CYCLES 是不應該自動計數的,因此 SYSCFG_CCEN 應該保持為 0

uclinux 內核代碼中搜索 CYCLES ,可以發現有以下幾個文件使用了它:

linux-2.6.x\drivers\char\bfin_timer_latency.c

linux-2.6.x\drivers\media\video\blackfin\blackfin_cam.c

linux-2.6.x\drivers\zaptel\bfsi-spi-framework.c

linux-2.6.x\drivers\zaptel\bfsi.c

當要使用這幾個驅動時,就一定需要使 SYSCFG_CCEN=1 。

1 參考資料

head.s 分析 (1) :保存 u-boot 傳遞過來的指針 (2009-1-19)

head.s分析(2):SYSCFG配置


更多文章、技術交流、商務合作、聯系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦?。?!

發表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 欧美日一级片 | 四虎国产 | 亚洲综合精品一区 | 久久久性视频 | 麻豆va一区二区三区久久浪 | 毛片aa| 曰批免费视频播放在线看片 | 久久久久久久99久久久毒国产 | 国产高清精品自在线看 | 欧美日韩中文字幕 | 免费99| 在线成人aa在线看片 | 日韩欧美在线一级一中文字暮 | a视频网站 | 台湾一级毛片永久免费 | 国产伦精品一区二区 | 久久这里只有精品免费看青草 | 天天碰天天操 | 中文字幕日韩欧美一区二区三区 | 国内精品久久久久久久999下 | 久久国产乱子伦精品免费强 | 米奇777第四久久久99 | 91国视频在线 | 国产精品热久久 | 国产精品国偷自产在线 | 久久机热re这里只有精品15 | 一级毛片日本特黄97人人 | 亚洲欧美一区二区三区不卡 | 天天做天天爱天天怼 | 狠狠色噜狠狠狠狠 | 成人在线视频网址 | 真人毛片免费拍拍拍aa视频 | 伊人久久在线观看 | 国产伦一区二区三区免费 | 久热这里只有精品在线 | 亚洲精品一区二区久久这里 | 夜夜躁日日躁狠狠久久 | 国内精品免费久久久久妲己 | 国产亚洲精品一区二区久久 | 亚洲综合色婷婷 | 亚洲综合久久久久久888 |