Changeset 653 for trunk/softs/tsar_boot/src/reset_utils.c
- Timestamp:
- Mar 3, 2014, 5:11:06 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/softs/tsar_boot/src/reset_utils.c
r586 r653 9 9 #include <reset_utils.h> 10 10 11 /***************************************** 11 /******************************************************************** 12 12 * proctime() 13 13 * 14 14 * Returns processor local time. 15 **************************************** /15 ********************************************************************/ 16 16 inline unsigned int proctime() 17 17 { … … 21 21 } 22 22 23 /***************************************** 23 /******************************************************************** 24 24 * memcpy( _dst, _src, size ) 25 25 * … … 30 30 * \param size : Number of bytes to transfer 31 31 * 32 **************************************** /32 ********************************************************************/ 33 33 void * memcpy(void *_dst, const void *_src, unsigned int size) 34 34 { … … 52 52 } 53 53 54 /***************************************** 54 /******************************************************************** 55 55 * memset( _dst, value, size ) 56 56 * … … 61 61 * \param size : Number of bytes to initialize 62 62 * 63 **************************************** /63 ********************************************************************/ 64 64 void * memset(void *_dst, const int value, unsigned int size) 65 65 { … … 71 71 } 72 72 73 /***************************************** 73 /******************************************************************** 74 74 * reset_print_elf_phdr( elf_phdr_ptr ) 75 75 * … … 78 78 * \param elf_phdr_ptr : Pointer to the ELF program header to print 79 79 * 80 **************************************** /80 ********************************************************************/ 81 81 void reset_print_elf_phdr(Elf32_Phdr * elf_phdr_ptr) 82 82 { … … 106 106 } 107 107 108 109 /******************************************************************** 110 * reset_mcc_inval() 111 * 112 * Invalidate all data cache lines corresponding to a memory buffer 113 * (identified by an address and a size) in L2 cache. 114 ********************************************************************/ 115 #if USE_IOB 116 void reset_mcc_invalidate ( const void * buffer, 117 unsigned int size) 118 { 119 unsigned int * mcc_address = (unsigned int *)MCC_PADDR_BASE; 120 121 // get the hard lock assuring exclusive access to MEMC 122 while (ioread32(&mcc_address[MCC_LOCK])); 123 124 // write invalidate paremeters on the memory cache this preloader 125 // use only the cluster 0 and then the HI bits are not used 126 127 iowrite32(&mcc_address[MCC_ADDR_LO], (unsigned int) buffer); 128 iowrite32(&mcc_address[MCC_ADDR_HI], (unsigned int) 0); 129 iowrite32(&mcc_address[MCC_LENGTH] , (unsigned int) size); 130 iowrite32(&mcc_address[MCC_CMD] , (unsigned int) MCC_CMD_INVAL); 131 132 // release the lock protecting MEMC 133 iowrite32(&mcc_address[MCC_LOCK], (unsigned int) 0); 134 } 135 #endif 136 137 /******************************************************************** 138 * reset_dcache_buf_invalidate() 139 * 140 * Invalidate all data cache lines corresponding to a memory buffer 141 * (identified by an address and a size) in L1 cache and L2 cache. 142 ********************************************************************/ 143 #if (CACHE_COHERENCE == 0) || USE_IOB 144 void reset_buf_invalidate ( const void * buffer, 145 unsigned int line_size, 146 unsigned int size) 147 { 148 unsigned int i; 149 150 // iterate on cache lines 151 for (i = 0; i <= size; i += line_size) 152 { 153 asm volatile( 154 " cache %0, %1" 155 :// no outputs 156 :"i" (0x11), "R" (*((unsigned char *) buffer + i)) 157 ); 158 } 159 160 #if USE_IOB 161 reset_mcc_invalidate(buffer, count * 512); 162 #endif 163 } 164 #endif 165 108 166 // vim: tabstop=4 : softtabstop=4 : shiftwidth=4 : expandtab
Note: See TracChangeset
for help on using the changeset viewer.