📄 juno_comm.inc
字号:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Copyright 1999, 2000 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.;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; $Workfile: juno_comm.inc;; $Modtime: 9/15/00 5:50p $;; $Author: A0187334 $;; $Revision: 5 $;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; $Description: $;;;; Assembly include file for Juno Testing.;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;DEVICE_BASE .equ 0x08100000 ; ARM925DC Peripherals RegistersEVM_REGISTER_BASE .equ 0x11000000 ; EVM HIO FPGA Registers; HID Constants ; FPGA HID Register Bit Patterns MOSI_CLK_HI .equ 0x3HID_HOST_ACTIVE .equ 0x80ATN_ACTIVE .equ 0x20SS_ACTIVE .equ 0x04SS_INACTIVE .equ 0xfbCLK_LOW .equ 0xfeCLK_LOW_MOSI_LOW .equ 0xfcCLK_HIGH .equ 0x1 MISO_BIT .equ 0x10; Packet Values SIMP_HDR .equ 0x80WRITE_REG .equ 0x83READ_REG .equ 0x84WRITE_BLOCK .equ 0x85INIT_CMD .equ 0x0LRC_INIT .equ 0x40 INIT_CMPLT .equ 0x1 LRC_CMPLT .equ 0x41; TIMER Offsets PerseusDC READ_TIM_OFFSET .equ 2LOAD_TIM_OFFSET .equ 2 CNTL_TIM_OFFSET .equ 0WD_TIMER_ENABLE .equ 0x80WD_AUTO_RELOAD .equ 0x0100WD_ONE_SHOT .equ 0x0WD_TIMER_FREE .equ 0x02WD_TICK_VAL .equ 463 MAX_NO_PRESCALE .equ 141; HID SPI register offsetHID_OFFSET .equ 8 ; Peripheral Register offset for the PerseusDC FPGAPERIPH_RESET .equ 1HID_ACTIVE .equ 0x4; Synchronous Communications Timing Parameters Tmac .equ 100Tslow .equ 2Tmib .equ 150Tmnext .equ 120Tssc .equ 100Tsna .equ 100 ; Read/Write Register Macros ; Macros that function as wrappers around the _packet_write and READ Functions; Since C code will call the _packet_write, _packet_read functions most of the; time these macros are provided for calling these functions via assembly code.; The simply reduce the amount of text in the assembly source file. ; Packet Write, Read Macro where label is the address (label) of the byte array ; that gets passed to _packet_write and number is the number of bytes in the array.; fpga_ptr is a pointer to the FPGA (physical address 0x11000000) that contains; the HID SPI register, timer_ptr is a pointer to the TI925DC or MM's(Perseus) ; timer 0 register (physical address 0x810A000 on the DC), MHz is the speed in ; MHz of the processor packet_writem16 .macro label, number, fpga_ptr, timer_ptr, MHz bx pc nop .state32 stmdb sp!, {r0, r1, r2, r3} mov r3, MHz sub sp, sp, #4 str r3, [sp] mov r2, fpga_ptr mov r3, timer_ptr mov r1, #number adr r0, label bl $packet_write add sp, sp, #4 add r3, pc, #1 bx r3 nop .state16 pop {r0, r1, r2, r3} .endmpacket_readm16 .macro label, fpga_ptr, timer_ptr, MHz bx pc nop .state32 stmdb sp!, {r0, r1, r2, r3} mov r3, MHz mov r2, timer_ptr mov r1, fpga_ptr ldr r0, label ldr r0, [r0] bl $packet_read add r3, pc, #1 bx r3 nop .state16 pop {r0, r1, r2, r3} .endm; With this macro we are writing to a C array (r1) so we don't; have to calculate (via adr) the address of the label packet_read2 .macro fpga_ptr, timer_ptr, MHz stmdb sp!, {r0, r1, r2, r3} mov r3, MHz mov r2, timer_ptr mov r0, r1 ; r1 has the response_array pointer mov r1, fpga_ptr bl _packet_read ldmia sp!, {r0, r1, r2, r3} .endm; Pause Macro; This Macro functions as a wrapper around the PAUSE function. It is meant to be used; to calling the PAUSE function via assembly code.; Packet Write, Read Macro where label is the address (label) of the byte array ; that gets passed to _packet_write and number is the number of bytes in the array. pausem .macro clock_freq, delay_time, timer_reg_ptr stmdb sp!, {r0, r1, r2, r3} mov r0, clock_freq mov r2, timer_reg_ptr mov r1, #delay_time bl PAUSE ldmia sp!, {r0, r1, r2, r3} .endmpausem16 .macro clock_freq, delay_time, timer_reg_ptr bx pc nop .state32 stmdb sp!, {r0, r1, r2, r3} mov r0, clock_freq mov r2, timer_reg_ptr mov r1, #delay_time bl PAUSE add r3, pc, #1 bx r3 nop .state16 pop {r0, r1, r2, r3} .endm; Wait Macro; This Macro functions as a wrapper around the Wait function. It is meant to be used; to calling the WAIT function via assembly code.; clock_freq is frequency (in MHZ) delay_time is the delay time in milliseonds; timer_reg_ptr is the pointer to the timer register ; that gets passed to _packet_write and number is the number of bytes in the array. waitm .macro clock_freq, delay_time, timer_reg_ptr stmdb sp!, {r0, r1, r2, r3} mov r0, clock_freq mov r2, timer_reg_ptr mov r1, #delay_time bl _wait ldmia sp!, {r0, r1, r2, r3} .endm
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -