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

📄 mem.h62

📁 SEED的VPM642测试程序-板级支持库
💻 H62
字号:
;
;  Copyright 2003 by Texas Instruments Incorporated.
;  All rights reserved. Property of Texas Instruments Incorporated.
;  Restricted rights to use, duplicate or disclose this code are
;  granted through contract.
;  
;
; "@(#) DSP/BIOS 4.90.270 12-18-03 (barracuda-o04)"
;
;  ======== mem.h62 ========
;
;

	.if ($isdefed("MEM_") = 0)  ; prevent multiple includes of this file
MEM_	.set	1

    .include std.h62

;
;# ======== MEM_Obj ========
;
;#
;# Preconditions:
;#      none
;#
;# Postconditions:
;#      none
;#
;
    .asg    "", MEM_Obj$regs
MEM_Obj    .macro cflag, name, id, _len, _iHeap, _iSegZero, _iHeapId

    .if :cflag: == 1

        .asg -1, idxVal    ; default index value
    
      .if    :_len:

        .if :_iHeap:

            .global :name:$B    ; heap base address
            .global :name:$L    ; heap length

            ;
            ; Define an entry in _MEM_memtab[] (allocated out of bss in
            ; MEM_config.
            ; The following block must match the MEM_Segment structure
            ; in mem.h.
            ;
            .sect ".cinit"
            .align STD_TARGALIGN
            .if    $symcmp(":name:", ":_iSegZero:") == 0
                  .word 3 * STD_TARGWORDMAUS
                  .word _MEM_memtab   
                  .eval 0, idxVal
            .else
                  .word 3 * STD_TARGWORDMAUS
                  .word _MEM_memtab + MEM_tabIdx *3 * STD_TARGWORDMAUS
                  ; assign meaningful index value
                  .eval MEM_tabIdx, idxVal

                  ; post-increment macro variable for next pass
                  .eval    MEM_tabIdx + 1, MEM_tabIdx
            .endif
                  .word :name:$B
                  .word :name:$L
                  .word 1

                  ; create array index variable (using the segment's name)
                  .bss :name:, 1 * STD_TARGWORDMAUS, STD_TARGWORDMAUS
                  .sect ".cinit"
                  .align STD_TARGALIGN
                  .word 1 * STD_TARGWORDMAUS
                  .word :name:   
                  .word idxVal

                 ; create array index variable (using the segment's name)
		.if $symcmp(":_iHeapId:", "segment_name") != 0
		    .global :_iHeapId:
:_iHeapId:	    .set :name:
		.endif


:name:$idx .set    idxVal    ; used by MEM_config

        .else
:name: .set -1        ; To satisfy assignment of C alias in *cfg.cmd file.

        .endif            ; .if :iHeap:

      .endif            ; .if :_len:

    .endif                ; .if :cflag: == 1

    .endm

;
;# ======== MEM_config ========
;  Called within configuration file (prior to MEM_init)
;
;#
;# Preconditions:
;#      none
;#
;# Postconditions:
;#      none
;#

    .asg    "", MEM_config$regs
MEM_config    .macro _gNumHeap, _segzero, _mallocseg

    ;
    ; Proceed only if there are heaps declared.
    ;
    .if :_gNumHeap:
        .global _MEM        ; Pointer to configuration parameters
        .global _MEM_memtab        ; Array of memory heaps
        .global __MEM_NUMSEGMENTS    ; Number of memory heaps

        ;
        ; The following two .bss/.cinit sets make configured values readable
        ; in the established SPOX manner, e.g., MEM->MALLOCSEG.
        ;
MEM_config    .usect    ".mem", 1 * STD_TARGWORDMAUS, STD_TARGWORDMAUS

        .sect ".cinit"
        .align STD_TARGALIGN
        .word 1 * STD_TARGWORDMAUS
        .word MEM_config   

	;; If MALLOCSEG = MEM_NULL then put in an err value in for MALLOCSEG$idx
        .if ($symcmp(":_mallocseg:", "MEM_NULL") == 0)
            .word -1
        .else
            .word :_MALLOCSEG:$idx
        .endif

        .sect ".cinit"
        .align STD_TARGALIGN
        .word 1 * STD_TARGWORDMAUS
        .word _MEM   
        .word MEM_config

        ;
        ; This declares space for the array of configured heaps, the .cinit
        ; parts are defined for each task in MEM_Obj.  This space has to be
        ; reserved NOW, before the MEM_Obj macro is called and the elements
        ; of the table are defined.
        ;
        .bss _MEM_memtab, :_gNumHeap: * 3 * STD_TARGWORDMAUS, STD_TARGWORDMAUS

	;
	; Set MEM_tabIdx to 1 if _segzero is set to a MEM segment other then
	; MEM_NULL because the MEM segment will in the 0th place.
	; If _segzero is MEM_NULL then set MEM_tabIdx to 0 since MEM_NULL is
	; only a place holder and not a real MEM segment with a heap.
	;
	.if $symcmp("MEM_NULL", ":_segzero:") == 0
            .asg    0, MEM_tabIdx        ; Index into MEM_memtab
	.else
            .asg    1, MEM_tabIdx        ; Index into MEM_memtab
	.endif

    ;
    ; _MEM_memtab needs to be set to zero if no heap are defined
    ;
    .else
    .global _MEM_memtab
_MEM_memtab .set 00h
    .endif        ; .if :_gNumHeap:

    .endm

;
;# ======== MEM_end ========
;  Invoked at the end of all other configuration
;  declarations.
;
;#
;# Preconditions:
;#      none
;#
;# Postconditions:
;#      none
;#
    .asg    ":MEM_Obj$regs:", MEM_end$regs
MEM_end    .macro
    .endm


;
;# ======== MEM_startup ========
;
;#
;# Preconditions:
;#      none
;#
;# Postconditions:
;#      none
;#
    .asg    "", MEM_startup$regs
MEM_startup        .macro
    .endm

;
;# ======== MEM_init ========
;  Runtime initialization for MEM
;
;#
;# Preconditions:
;#      none
;#
;# Postconditions:
;#      none
;#
        .asg    "", MEM_init$regs
MEM_init .macro

	; only expand if dyanmic memory heaps on configured by the user
	.if (MEM_gNumHeap > 0)
                .global _MEM_init

	        mvkl	_MEM_init, a4
	        mvkh    _MEM_init, a4
                b       a4
                mvkl	meminit?, b3
                mvkh    meminit?, b3
                nop     3
meminit?:

	.endif              

	.endm

	.endif		; if MEM_ is not defined

⌨️ 快捷键说明

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