Changes in kernel/arch/arm32/include/regutils.h [c0699467:e762b43] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/arm32/include/regutils.h
rc0699467 re762b43 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 41 #define STATUS_REG_MODE_MASK 40 #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) 43 #define CP15_R1_HIGH_VECTORS_BIT (1 << 13) 44 44 45 45 46 /* ARM Processor Operation Modes */ 46 #define USER_MODE 0x1047 #define FIQ_MODE 0x1148 #define IRQ_MODE0x1249 #define SUPERVISOR_MODE0x1350 #define ABORT_MODE0x1751 #define UNDEFINED_MODE0x1b52 #define SYSTEM_MODE0x1f47 #define USER_MODE 0x10 48 #define FIQ_MODE 0x11 49 #define IRQ_MODE 0x12 50 #define SUPERVISOR_MODE 0x13 51 #define ABORT_MODE 0x17 52 #define UNDEFINED_MODE 0x1b 53 #define SYSTEM_MODE 0x1f 53 54 54 55 /* [CS]PRS manipulation macros */ 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 } 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 } 67 66 68 #define GEN_STATUS_WRITE(nm, reg,fieldname, field) \69 70 71 asm volatile( \72 73 74 75 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 } 76 75 77 /** Return the value of CPSR (Current Program Status Register). */78 GEN_STATUS_READ(current, cpsr);79 76 80 /** Set control bits of CPSR. */ 77 /** Returns the value of CPSR (Current Program Status Register). */ 78 GEN_STATUS_READ(current, cpsr) 79 80 81 /** Sets control bits of CPSR. */ 81 82 GEN_STATUS_WRITE(current, cpsr, control, c); 82 83 83 /** Return the value of SPSR (Saved Program Status Register). */ 84 GEN_STATUS_READ(saved, spsr); 84 85 /** Returns the value of SPSR (Saved Program Status Register). */ 86 GEN_STATUS_READ(saved, spsr) 87 85 88 86 89 #endif
Note:
See TracChangeset
for help on using the changeset viewer.