; *********************************************************************** ; * * ; * Header File for ELEC2041 Experiment 5, Third Version * ; * * ; *********************************************************************** ; Author: John Zaitseff ; Date: 28th May, 2003 ; Version: 1.2 ; This header file contains definitions needed for the various Push-button ; Switch programs, as used in ELEC2041 Experiment 5. This header file is ; used by numerous files: pb-poll.s, boot-pbirq-v1.s, pb-irq-v1.s, ; boot-pbirq-v2.s, pb-irq-v2.s, boot-timer.s and timer-irq.s (written by ; the student). ; ----------------------------------------------------------------------- ; ARM Processor definitions ; The following lines define some of the bits in the Current Processor ; Status Register and the various Saved Processor Status Registers. .set ARM_PSR_i, 0b10000000 ; I bit in CPSR/SPSR .set ARM_PSR_f, 0b01000000 ; F bit in CPSR/SPSR .set ARM_PSR_t, 0b00100000 ; T bit in CPSR/SPSR ; The bottom five bits of the CPSR/SPSR define the processor mode; the ; following lines define the values that can appear in these five bits. ; The ARM_PSR_mode_mask is used to "mask off" these bits, and is used when ; reading and/or writing to the CPSR/SPSRs. .set ARM_PSR_mode_mask, 0b11111 ; Processor modes mask .set ARM_PSR_mode_usr, 0b10000 ; User mode .set ARM_PSR_mode_fiq, 0b10001 ; Fast Interrupt mode .set ARM_PSR_mode_irq, 0b10010 ; Interrupt mode .set ARM_PSR_mode_svc, 0b10011 ; Supervisor mode .set ARM_PSR_mode_abt, 0b10111 ; Abort mode .set ARM_PSR_mode_und, 0b11011 ; Undefined mode .set ARM_PSR_mode_sys, 0b11111 ; System mode ; ----------------------------------------------------------------------- ; DSLMU Microcontroller Board-specific definitions ; The following lines contain definitions specific to the Komodo ARM ; environment running on the DSLMU Microcontroller Board. ; ; Please note that this header file defines each of the ports as OFFSETS ; relative to "iobase". Thus, for example, you need to add "iobase" and ; "portB" together to get the address of Port B. This can be done in two ; ways: either by using the GNU Assembler, or by using register + offset ; when using the LDRB/STRB instructions. For example: ; ldr r0, =(iobase + portB) ; strb r1, [r0] ; or ; ldr r0, =iobase ; strb r1, [r0, #portB] ; The second method is the prefered one. ; ; Not every port available on the DSLMU Microcontroller Board is defined ; here: only those needed for ELEC2041 Experiment 5 are listed. ; DSLMU Microcontroller Board port definitions .set iobase, 0x10000000 ; Base of Microcontroller I/O space .set portA, 0x00 ; Microcontroller Port A offset .set portB, 0x04 ; Microcontroller Port B offset .set timer_port, 0x08 ; Timer port offset .set timer_cmp, 0x0C ; Timer Compare port offset .set irq_status, 0x18 ; IRQ Status port offset .set irq_enable, 0x1C ; IRQ Enable port offset ; Port B bit definitions .set portB_pbs2, 0b10000000 ; Bit 7 = Push-button switch S2 .set portB_pbs3, 0b01000000 ; Bit 6 = Push-button switch S3 ; IRQ Status and IRQ Enable port bit definitions .set irq_pbs2, 0b10000000 ; Bit 7 = Push-button switch S2 IRQ .set irq_pbs3, 0b01000000 ; Bit 6 = Push-button switch S3 IRQ .set irq_timer, 0b00000001 ; Bit 0 = Timer Compare IRQ ; Program-specific definitions .set left_leds, 0b00000111 ; Value to turn on the left LEDs .set right_leds, 0b01110000 ; Value to turn on the right LEDs ; Please see the file header-v1.s for the reason why the ".end" assembler ; directive must never appear in header files.