Changeset 296 for trunk/hal/tsar_mips32/core/hal_remote.c
- Timestamp:
- Jul 31, 2017, 1:59:52 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/hal/tsar_mips32/core/hal_remote.c
r279 r296 30 30 uint8_t data ) 31 31 { 32 uint32_t save_sr; 33 uint32_t ptr = (uint32_t)GET_PTR( xp ); 34 uint32_t cxy = (uint32_t)GET_CXY( xp ); 35 36 /* TODO improve all hal remote functions to include SR handling in assembly code */ 37 /* as it is done below for hal_remote_sb */ 32 uint32_t ptr = (uint32_t)GET_PTR( xp ); 33 uint32_t cxy = (uint32_t)GET_CXY( xp ); 38 34 39 35 asm volatile( … … 44 40 "mtc0 $13, $12 \n" /* IRQ disabled */ 45 41 46 47 42 "mfc2 $15, $24 \n" /* $15 <= PADDR_EXT */ 48 43 "mtc2 %2, $24 \n" /* PADDR_EXT <= cxy */ … … 61 56 uint32_t data ) 62 57 { 63 uint32_t save_sr; 64 uint32_t ptr = (uint32_t)GET_PTR( xp ); 65 uint32_t cxy = (uint32_t)GET_CXY( xp ); 66 67 hal_disable_irq( &save_sr ); 68 69 asm volatile( "mfc2 $15, $24 \n" /* $15 <= PADDR_EXT */ 70 ".set noreorder \n" 71 "mtc2 %2, $24 \n" /* PADDR_EXT <= cxy */ 72 "sw %0, 0(%1) \n" /* *paddr <= value */ 73 "mtc2 $15, $24 \n" /* PADDR_EXT <= $15 */ 58 uint32_t ptr = (uint32_t)GET_PTR( xp ); 59 uint32_t cxy = (uint32_t)GET_CXY( xp ); 60 61 asm volatile( 62 ".set noreorder \n" 63 "mfc0 $14, $12 \n" /* $14 <= CP0_SR */ 64 "srl $13, $14, 1 \n" 65 "sll $13, $13, 1 \n" /* $13 <= SR masked */ 66 "mtc0 $13, $12 \n" /* IRQ disabled */ 67 68 "mfc2 $15, $24 \n" /* $15 <= PADDR_EXT */ 69 "mtc2 %2, $24 \n" /* PADDR_EXT <= cxy */ 70 "sw %0, 0(%1) \n" /* *paddr <= value */ 71 "mtc2 $15, $24 \n" /* PADDR_EXT <= $15 */ 72 73 "mtc0 $14, $12 \n" /* SR restored */ 74 74 75 "sync \n" 75 76 ".set reorder \n" 76 : : "r" (data), "r" (ptr), "r" (cxy) : "$15" ); 77 78 hal_restore_irq( save_sr ); 79 77 : : "r" (data), "r" (ptr), "r" (cxy) : "$13", "$14", "$15" ); 80 78 } 81 79 … … 84 82 uint64_t data ) 85 83 { 86 uint32_t save_sr;87 84 uint32_t ptr = (uint32_t)GET_PTR( xp ); 88 85 uint32_t cxy = (uint32_t)GET_CXY( xp ); … … 91 88 uint32_t data_msb = (uint32_t)(data>>32); 92 89 93 hal_disable_irq( &save_sr ); 94 95 asm volatile( 96 ".set noreorder \n" 97 "mfc2 $15, $24 \n" /* $15 <= PADDR_EXT */ 98 "mtc2 %3, $24 \n" /* PADDR_EXT <= cxy */ 99 "sw %0, 0(%2) \n" /* *paddr <= lsb */ 100 "sw %1, 4(%2) \n" /* *(paddr+4) <= msb */ 101 "mtc2 $15, $24 \n" /* PADDR_EXT <= $15 */ 90 asm volatile( 91 ".set noreorder \n" 92 "mfc0 $14, $12 \n" /* $14 <= CP0_SR */ 93 "srl $13, $14, 1 \n" 94 "sll $13, $13, 1 \n" /* $13 <= SR masked */ 95 "mtc0 $13, $12 \n" /* IRQ disabled */ 96 97 "mfc2 $15, $24 \n" /* $15 <= PADDR_EXT */ 98 "mtc2 %3, $24 \n" /* PADDR_EXT <= cxy */ 99 "sw %0, 0(%2) \n" /* *paddr <= lsb */ 100 "sw %1, 4(%2) \n" /* *(paddr+4) <= msb */ 101 "mtc2 $15, $24 \n" /* PADDR_EXT <= $15 */ 102 103 "mtc0 $14, $12 \n" /* SR restored */ 104 102 105 "sync \n" 103 106 ".set reorder \n" 104 : : "r" (data_lsb), "r" (data_msb), "r" (ptr), "r" (cxy) : "$15" ); 105 106 hal_restore_irq( save_sr ); 107 107 : : "r" (data_lsb), "r" (data_msb), "r" (ptr), "r" (cxy) : "$13", "$14", "$15" ); 108 108 } 109 109 … … 118 118 uint8_t hal_remote_lb( xptr_t xp ) 119 119 { 120 uint32_t save_sr;121 120 char data; 122 121 uint32_t ptr = (uint32_t)GET_PTR( xp ); 123 122 uint32_t cxy = (uint32_t)GET_CXY( xp ); 124 123 125 hal_disable_irq( &save_sr ); 126 127 asm volatile( 128 ".set noreorder \n" 124 asm volatile( 125 ".set noreorder \n" 126 "mfc0 $14, $12 \n" /* $14 <= CP0_SR */ 127 "srl $13, $14, 1 \n" 128 "sll $13, $13, 1 \n" /* $13 <= SR masked */ 129 "mtc0 $13, $12 \n" /* IRQ disabled */ 130 129 131 "mfc2 $15, $24 \n" /* $15 <= PADDR_EXT */ 130 132 "mtc2 %2, $24 \n" /* PADDR_EXT <= cxy */ 131 133 "lb %0, 0(%1) \n" /* data <= *paddr */ 132 134 "mtc2 $15, $24 \n" /* PADDR_EXT <= $15 */ 133 ".set reorder \n" 134 : "=r" (data) : "r" (ptr), "r" (cxy) : "$15" );135 136 hal_restore_irq( save_sr);135 136 "mtc0 $14, $12 \n" /* SR restored */ 137 ".set reorder \n" 138 : "=r" (data) : "r" (ptr), "r" (cxy) : "$13", "$14", "$15" ); 137 139 138 140 return ( data ); … … 142 144 uint32_t hal_remote_lw( xptr_t xp ) 143 145 { 144 uint32_t save_sr;145 146 uint32_t data; 146 147 uint32_t ptr = (uint32_t)GET_PTR( xp ); 147 148 uint32_t cxy = (uint32_t)GET_CXY( xp ); 148 149 149 hal_disable_irq( &save_sr ); 150 151 asm volatile( 152 ".set noreorder \n" 150 asm volatile( 151 ".set noreorder \n" 152 "mfc0 $14, $12 \n" /* $14 <= CP0_SR */ 153 "srl $13, $14, 1 \n" 154 "sll $13, $13, 1 \n" /* $13 <= SR masked */ 155 "mtc0 $13, $12 \n" /* IRQ disabled */ 156 153 157 "mfc2 $15, $24 \n" /* $15 <= PADDR_EXT */ 154 158 "mtc2 %2, $24 \n" /* PADDR_EXT <= cxy */ 155 159 "lw %0, 0(%1) \n" /* data <= *paddr */ 156 160 "mtc2 $15, $24 \n" /* PADDR_EXT <= $15 */ 157 ".set reorder \n" 158 : "=r" (data) : "r" (ptr), "r" (cxy) : "$15" );159 160 hal_restore_irq( save_sr);161 162 "mtc0 $14, $12 \n" /* SR restored */ 163 ".set reorder \n" 164 : "=r" (data) : "r" (ptr), "r" (cxy) : "$13", "$14", "$15" ); 161 165 162 166 return ( data ); … … 166 170 uint64_t hal_remote_lwd( xptr_t xp ) 167 171 { 168 uint32_t save_sr;169 172 uint32_t data_lsb; 170 173 uint32_t data_msb; … … 172 175 uint32_t cxy = (uint32_t)GET_CXY( xp ); 173 176 174 hal_disable_irq( &save_sr ); 175 176 asm volatile( 177 ".set noreorder \n" 177 asm volatile( 178 ".set noreorder \n" 179 "mfc0 $14, $12 \n" /* $14 <= CP0_SR */ 180 "srl $13, $14, 1 \n" 181 "sll $13, $13, 1 \n" /* $13 <= SR masked */ 182 "mtc0 $13, $12 \n" /* IRQ disabled */ 183 178 184 "mfc2 $15, $24 \n" /* $15 <= PADDR_EXT */ 179 185 "mtc2 %3, $24 \n" /* PADDR_EXT <= cxy */ … … 181 187 "lw %1, 4(%2) \n" /* data_msb <= *paddr+4 */ 182 188 "mtc2 $15, $24 \n" /* PADDR_EXT <= $15 */ 183 ".set reorder \n" 184 : "=r" (data_lsb), "=r"(data_msb) : "r" (ptr), "r" (cxy) : "$15" );185 186 hal_restore_irq( save_sr);189 190 "mtc0 $14, $12 \n" /* SR restored */ 191 ".set reorder \n" 192 : "=r" (data_lsb), "=r"(data_msb) : "r" (ptr), "r" (cxy) : "$13", "$14", "$15" ); 187 193 188 194 return ( (((uint64_t)data_msb)<<32) + (((uint64_t)data_lsb)) );
Note: See TracChangeset
for help on using the changeset viewer.