日韩久久久精品,亚洲精品久久久久久久久久久,亚洲欧美一区二区三区国产精品 ,一区二区福利

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

系統 1842 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條評論
主站蜘蛛池模板: 阿克陶县| 宾川县| 南投县| 长葛市| 江达县| 容城县| 商南县| 伽师县| 长宁区| 修水县| 乌海市| 象山县| 芮城县| 浏阳市| 贞丰县| 漠河县| 萨迦县| 哈尔滨市| 库伦旗| 和政县| 彭州市| 城市| 社会| 连江县| 丹巴县| 乌拉特后旗| 吉林省| 广昌县| 大埔县| 琼海市| 洮南市| 宜丰县| 汉沽区| 合作市| 海兴县| 吕梁市| 荔浦县| 阳原县| 鹤壁市| 大方县| 邳州市|