Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/arm32/include/regutils.h

    rc0699467 re762b43  
    3030 * @{
    3131 */
    32 /**
     32/** 
    3333 * @file
    3434 * @brief Utilities for convenient manipulation with ARM registers.
     
    3838#define KERN_arm32_REGUTILS_H_
    3939
    40 #define STATUS_REG_IRQ_DISABLED_BIT  (1 << 7)
    41 #define STATUS_REG_MODE_MASK         0x1f
     40#define STATUS_REG_IRQ_DISABLED_BIT (1 << 7)
     41#define STATUS_REG_MODE_MASK        0x1f
    4242
    43 #define CP15_R1_HIGH_VECTORS_BIT     (1 << 13)
     43#define CP15_R1_HIGH_VECTORS_BIT    (1 << 13)
     44
    4445
    4546/* ARM Processor Operation Modes */
    46 #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
     47#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
    5354
    5455/* [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) \
     57static 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}
    6766
    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         }
     67#define GEN_STATUS_WRITE(nm,reg,fieldname, field) \
     68static 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}
    7675
    77 /** Return the value of CPSR (Current Program Status Register). */
    78 GEN_STATUS_READ(current, cpsr);
    7976
    80 /** Set control bits of CPSR. */
     77/** Returns the value of CPSR (Current Program Status Register). */
     78GEN_STATUS_READ(current, cpsr)
     79
     80
     81/** Sets control bits of CPSR. */
    8182GEN_STATUS_WRITE(current, cpsr, control, c);
    8283
    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). */
     86GEN_STATUS_READ(saved, spsr)
     87
    8588
    8689#endif
Note: See TracChangeset for help on using the changeset viewer.