Changeset 32e8cd1 in mainline for kernel/arch/sparc32/include/arch/asm.h
- Timestamp:
- 2013-12-28T17:16:44Z (10 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- c1023bcb
- Parents:
- f6f22cdb
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/sparc32/include/arch/asm.h
rf6f22cdb r32e8cd1 43 43 NO_TRACE static inline void asm_delay_loop(uint32_t usec) 44 44 { 45 // FIXME TODO 45 46 } 46 47 47 48 NO_TRACE static inline __attribute__((noreturn)) void cpu_halt(void) 48 49 { 49 /* On real hardware this should stop processing further 50 instructions on the CPU (and possibly putting it into 51 low-power mode) without any possibility of exitting 52 this function. */ 53 50 // FIXME TODO 54 51 while (true); 55 52 } … … 57 54 NO_TRACE static inline void cpu_sleep(void) 58 55 { 59 /* On real hardware this should put the CPU into low-power 60 mode. However, the CPU is free to continue processing 61 futher instructions any time. The CPU also wakes up 62 upon an interrupt. */ 56 // FIXME TODO 63 57 } 64 58 … … 68 62 } 69 63 70 /** Word to port71 *72 * Output word to port73 *74 * @param port Port to write to75 * @param val Value to write76 *77 */78 64 NO_TRACE static inline void pio_write_16(ioport16_t *port, uint16_t val) 79 65 { … … 81 67 } 82 68 83 /** Double word to port84 *85 * Output double word to port86 *87 * @param port Port to write to88 * @param val Value to write89 *90 */91 69 NO_TRACE static inline void pio_write_32(ioport32_t *port, uint32_t val) 92 70 { … … 94 72 } 95 73 96 /** Byte from port97 *98 * Get byte from port99 *100 * @param port Port to read from101 * @return Value read102 *103 */104 74 NO_TRACE static inline uint8_t pio_read_8(ioport8_t *port) 105 75 { … … 107 77 } 108 78 109 /** Word from port110 *111 * Get word from port112 *113 * @param port Port to read from114 * @return Value read115 *116 */117 79 NO_TRACE static inline uint16_t pio_read_16(ioport16_t *port) 118 80 { … … 120 82 } 121 83 122 /** Double word from port123 *124 * Get double word from port125 *126 * @param port Port to read from127 * @return Value read128 *129 */130 84 NO_TRACE static inline uint32_t pio_read_32(ioport32_t *port) 131 85 { … … 133 87 } 134 88 135 NO_TRACE static inline uint32_t psr_read( )89 NO_TRACE static inline uint32_t psr_read(void) 136 90 { 137 91 uint32_t v; 138 92 139 93 asm volatile ( 140 94 "mov %%psr, %[v]\n" 141 95 : [v] "=r" (v) 142 96 ); 143 144 return v; 145 } 146 147 NO_TRACE static inline uint32_t wim_read( )97 98 return v; 99 } 100 101 NO_TRACE static inline uint32_t wim_read(void) 148 102 { 149 103 uint32_t v; 150 104 151 105 asm volatile ( 152 106 "mov %%wim, %[v]\n" 153 107 : [v] "=r" (v) 154 108 ); 155 156 return v; 157 } 158 159 NO_TRACE static inline uint32_t asi_u32_read( int asi, uintptr_t va)109 110 return v; 111 } 112 113 NO_TRACE static inline uint32_t asi_u32_read(unsigned int asi, uintptr_t va) 160 114 { 161 115 uint32_t v; 162 116 163 117 asm volatile ( 164 118 "lda [%[va]] %[asi], %[v]\n" 165 119 : [v] "=r" (v) 166 120 : [va] "r" (va), 167 [asi] "i" ((unsigned int) asi) 168 ); 169 170 return v; 171 } 172 173 NO_TRACE static inline void asi_u32_write(int asi, uintptr_t va, uint32_t v) 121 [asi] "i" (asi) 122 ); 123 124 return v; 125 } 126 127 NO_TRACE static inline void asi_u32_write(unsigned int asi, uintptr_t va, 128 uint32_t v) 174 129 { 175 130 asm volatile ( … … 177 132 :: [v] "r" (v), 178 133 [va] "r" (va), 179 [asi] "i" ( (unsigned int)asi)134 [asi] "i" (asi) 180 135 : "memory" 181 136 ); … … 200 155 NO_TRACE static inline ipl_t interrupts_enable(void) 201 156 { 157 psr_reg_t psr; 158 psr.value = psr_read(); 159 202 160 ipl_t pil; 203 204 psr_reg_t psr;205 psr.value = psr_read();206 161 pil = psr.pil; 207 psr.pil = 0xf; 162 163 psr.pil = 0x0f; 208 164 psr_write(psr.value); 209 165 210 166 return pil; 211 167 } … … 213 169 NO_TRACE static inline ipl_t interrupts_disable(void) 214 170 { 171 psr_reg_t psr; 172 psr.value = psr_read(); 173 215 174 ipl_t pil; 216 217 psr_reg_t psr;218 psr.value = psr_read();219 175 pil = psr.pil; 176 220 177 psr.pil = 0; 221 178 psr_write(psr.value); 222 179 223 180 return pil; 224 181 }
Note:
See TracChangeset
for help on using the changeset viewer.