Changeset 8ff0bd2 in mainline for kernel/arch/arm32/include/regutils.h
- Timestamp:
- 2011-09-04T11:30:58Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 03bc76a
- Parents:
- d2c67e7 (diff), deac215e (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/arm32/include/regutils.h
rd2c67e7 r8ff0bd2 30 30 * @{ 31 31 */ 32 /** 32 /** 33 33 * @file 34 34 * @brief Utilities for convenient manipulation with ARM registers. … … 38 38 #define KERN_arm32_REGUTILS_H_ 39 39 40 #define STATUS_REG_IRQ_DISABLED_BIT (1 << 7)41 #define STATUS_REG_MODE_MASK 0x1f40 #define STATUS_REG_IRQ_DISABLED_BIT (1 << 7) 41 #define STATUS_REG_MODE_MASK 0x1f 42 42 43 #define CP15_R1_HIGH_VECTORS_BIT (1 << 13) 44 43 #define CP15_R1_HIGH_VECTORS_BIT (1 << 13) 45 44 46 45 /* ARM Processor Operation Modes */ 47 #define USER_MODE 48 #define FIQ_MODE 49 #define IRQ_MODE0x1250 #define SUPERVISOR_MODE0x1351 #define ABORT_MODE0x1752 #define UNDEFINED_MODE0x1b53 #define SYSTEM_MODE0x1f46 #define USER_MODE 0x10 47 #define FIQ_MODE 0x11 48 #define IRQ_MODE 0x12 49 #define SUPERVISOR_MODE 0x13 50 #define ABORT_MODE 0x17 51 #define UNDEFINED_MODE 0x1b 52 #define SYSTEM_MODE 0x1f 54 53 55 54 /* [CS]PRS manipulation macros */ 56 #define GEN_STATUS_READ(nm,reg) \ 57 static inline uint32_t nm## _status_reg_read(void) \ 58 { \ 59 uint32_t retval; \ 60 asm volatile( \ 61 "mrs %[retval], " #reg \ 62 : [retval] "=r" (retval) \ 63 ); \ 64 return retval; \ 65 } 55 #define GEN_STATUS_READ(nm, reg) \ 56 static inline uint32_t nm## _status_reg_read(void) \ 57 { \ 58 uint32_t retval; \ 59 \ 60 asm volatile ( \ 61 "mrs %[retval], " #reg \ 62 : [retval] "=r" (retval) \ 63 ); \ 64 \ 65 return retval; \ 66 } 66 67 67 #define GEN_STATUS_WRITE(nm, reg,fieldname, field) \68 static inline void nm## _status_reg_ ##fieldname## _write(uint32_t value) \69 { \70 asm volatile( \71 "msr " #reg "_" #field ", %[value]" \72 :: [value] "r" (value) \73 ); \74 }68 #define GEN_STATUS_WRITE(nm, reg, fieldname, field) \ 69 static inline void nm## _status_reg_ ##fieldname## _write(uint32_t value) \ 70 { \ 71 asm volatile ( \ 72 "msr " #reg "_" #field ", %[value]" \ 73 :: [value] "r" (value) \ 74 ); \ 75 } 75 76 77 /** Return the value of CPSR (Current Program Status Register). */ 78 GEN_STATUS_READ(current, cpsr); 76 79 77 /** Returns the value of CPSR (Current Program Status Register). */ 78 GEN_STATUS_READ(current, cpsr) 79 80 81 /** Sets control bits of CPSR. */ 80 /** Set control bits of CPSR. */ 82 81 GEN_STATUS_WRITE(current, cpsr, control, c); 83 82 84 85 /** Returns the value of SPSR (Saved Program Status Register). */ 86 GEN_STATUS_READ(saved, spsr) 87 83 /** Return the value of SPSR (Saved Program Status Register). */ 84 GEN_STATUS_READ(saved, spsr); 88 85 89 86 #endif
Note:
See TracChangeset
for help on using the changeset viewer.