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

📄 main.mac

📁 pxa27x下rtc程序
💻 MAC
字号:
;------------------------------------------------------------------------------
;
;  COPYRIGHT (C) 2000, 2001 Intel Corporation.
;
;  This software as well as the software described in it is furnished under 
;  license and may only be used or copied in accordance with the terms of the 
;  license. The information in this file is furnished for informational use 
;  only, is subject to change without notice, and should not be construed as 
;  a commitment by Intel Corporation. Intel Corporation assumes no 
;  responsibility or liability for any errors or inaccuracies that may appear 
;  in this document or any software that may be provided in association with 
;  this document. 
;  Except as permitted by such license, no part of this document may be 
;  reproduced, stored in a retrieval system, or transmitted in any form or by 
;  any means without the express written consent of Intel Corporation. 
;
;  FILENAME: main.mac
;
;  PURPOSE:       This file contains macros used by the Diagnostic Manager.
;
;  LAST MODIFIED: $Modtime: $
;------------------------------------------------------------------------------
    IF :LNOT: :DEF: _main_mac_
_main_mac_   EQU     1

    MACRO
    VirtToPhys $startva, $sizeva, $startpa, $va, $pa, $t1, $t2, $t3, $t4

    ldr    $t1, =$startva          ; Starting virtual address
    ldr    $t2, =$sizeva           ; Size of virtual address space
    add    $t2, $t2, $t1           ; Ending virtual address    
    sub    $t2, $t2, #1            ;    minus 1 byte

    cmp    $va, $t1                ; Check VA and the starting address
    blt    %F10                    ; If VA < start, check next space
    cmp    $va, $t2                ; Check VA and the ending address
    bgt    %F10                    ; If VA > end, check next space

    sub    $t1, $va, $t1           ; Get the VA offset
    ldr    $t3, =$startpa          ; Get the starting physical address
    add    $t1, $t1, $t3           ; Calculate the physical address

    ldr    $t4, =0                 ; Success
    str    $t1, [$pa]              ; Return physical address
    b      %F20                    ; Return

10
    ldr    $t4, =-1

20
    MEND

    MACRO
    PhysToVirt $startpa, $sizepa, $startva, $pa, $va, $t1, $t2, $t3, $t4

    ldr    $t1, =$startpa          ; Starting virtual address
    ldr    $t2, =$sizepa           ; Size of virtual address space
    add    $t2, $t2, $t1           ; Ending virtual address    
    sub    $t2, $t2, #1            ;    minus 1 byte

    cmp    $pa, $t1                ; Check PA and the starting address
    blt    %F10                    ; If PA < start, check next space
    cmp    $pa, $t2                ; Check PA and the ending address
    bgt    %F10                    ; If VA > end, check next space

    sub    $t1, $pa, $t1           ; Get the PA offset
    ldr    $t3, =$startva          ; Get the starting virtual address
    add    $t1, $t1, $t3           ; Calculate the virtual address

    ldr    $t4, =0                 ; Success
    str    $t1, [$va]              ; Return virtual address
    b      %F20                    ; Return

10
    ldr    $t4, =-1

20
    MEND

    ENDIF

    END

⌨️ 快捷键说明

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