Question: solve 1 and 2 with arm assembly ( not pseudocode or C ) : GLOBAL _ _ main AREA main, CODE, READONLY EXPORT _ _
solve and with arm assembly not pseudocode or C:
GLOBAL main
AREA main, CODE, READONLY
EXPORT main
EXPORT usetworegionmemory
usetworegionmemory EQU
EXPORT SystemInit
EXPORT virtualgpioin
EXPORT virtualgpioout
ENTRY
GET BOARD.S
iodelay EQU
iolen EQU
; System Init routine
SystemInit
BX LR
;
main
;
LDR Riodata
LDR Rvirtualgpioin
LDR Rvirtualgpioout
LDR Rx
LDR Riodelay
LDR Riolen
BL edgedetectorreset
playbackloop
LDR RR #
STR RR
PUSH RR
;
BL edgedetector
;
POP RR
BL delay
SUBS R #
BNE playbackloop
;
MOV R #
LDR R
fills
STR RR
EOR R #xffffffff
SUBS R #
BNE fills
MOV R #
STR RR
LDR Riodata
LDR Rx
LDR Riolen
BL edgedetectorreset
playbackloop
LDR RR #
STR RR
PUSH RR
;
BL edgedetector
;
POP RR
BL delay
SUBS R #
BNE playbackloop
;
; Test 'calcpllcfg
;
; Next inputs must return R and Rwrong input parameter
;
LDR R
BL calcpllcfg
;
LDR R
BL calcpllcfg
;
; Calculate M and P to run PLL at MHz Using PLLCFGMSELxxx and PLLCFGPSELxxx constants
; store P and M into R
; Use this number to check the output R of your function.
;
; LDR RPLLCFGMSEL:OR:PLLCFGPSEL
;
;
; For all examples below, resulting actual CLK R must be
;
LDR R
BL calcpllcfg
;
LDR R
BL calcpllcfg
;
LDR R
BL calcpllcfg
;
; Calculate M and P to run PLL at MHz Using PLLCFGMSELxxx and PLLCFGPSELxxx constants
; store P and M into R
; Use this number to check the output R of your function.
;
; LDR RPLLCFGMSEL:OR:PLLCFGPSEL
;
;
; For the example below, resulting actual CLK R must be
;
LDR R
BL calcpllcfg
;
stop
B stop ; Loop forever!
delay
PUSH R LR
TEQ R #
delayloop
POPEQ R PC
SUBS R #
B delayloop
;
; Edge detector. Write a function that outputs a short pulse on bit of "virtualgpioout" when
; rising edge is detected on one of bit of "virtualgpioin The bit to detect the rising edge
; bit mask is passed via R The 'rising edge' is changing bit from to
;
; Parameters:
; R Address of "virtualgpioin
; R Address of "virtualgpioout"
; R bit mask. The bit the 'rising edge' conditions should be detected for.
;
; Output:
; Bit if "virtualgpioout" should be set to when 'rising edge' is detected,
; Bit should be for all other conditions falling edge, stable or stable
;
edgedetector
PUSH LR ; You may need to modify this command
; Instructions of your function is here
POP PC ; You may need to modify this command
;
; a You may need one additional function to reset the 'edge detector'.
;
edgedetectorreset
PUSH LR ; You may need to modify this command
; Instructions of your function is here
POP PC ; You may need to modify this command
;
; Write a function that calculates the PLLCFG register values P and M PLL parameters
; for a given PLL output frequency.
;
; Input clock Frequency MHz or Hz
;
; Valid values for the PLL frequency are MHz MHz The function must check the
; validity of the required frequency.
;
; If the preset frequency cannot be obtained, the function must set the nearest possible
; PLL frequency.
;
; Parameters:
;
; R Output: PLLCFG value or xFFFFFFFF if required output frequency is not correct.
; R Input: Required output PLL clock rate in HzSo is MHz
; Output: Actual clock rate or if required output frequency is not correct.
;
; Preserve the values of any registers you are using in your function.
;
calcpllcfg
;
; MHz MHz
;
; R Output : PLLCFG value xFFFFFFFF if input is not correct
; R Input required clock rate, Output actual clock rate. if input is not correct
;
; R constant MHzMHz MHz
; R M
; R CLK MHz P
; R constant MHz MHz
; R working CLK P
;
; Put your instructions here...
stopnofunction
B stopnofunction ; Loop forever!
ALIGN
LTORG
iodata
DCD
DCD
DCD
DCD
DCD
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
