comparison chipsetsw/layer1/dyn_dwl_cfile/l1_dyn_dwl_func.c @ 27:8abeb95e9766

l1_memcpy_16bit() moved from l1_func.c into l1_dyn_dwl_func.c
author Mychaela Falconia <falcon@ivan.Harhan.ORG>
date Thu, 22 Oct 2015 22:35:35 +0000
parents 428835f700ef
children
comparison
equal deleted inserted replaced
26:428835f700ef 27:8abeb95e9766
126 #else 126 #else
127 *pp_dest_mcu = (UWORD16 *) API_address_dsp2mcu(l1a_apihisr_com.dyn_dwnld.copy_parameters.start_of_dwnld_area); 127 *pp_dest_mcu = (UWORD16 *) API_address_dsp2mcu(l1a_apihisr_com.dyn_dwnld.copy_parameters.start_of_dwnld_area);
128 #endif // CODE_VERSION == SIMULATION 128 #endif // CODE_VERSION == SIMULATION
129 129
130 *pp_src_mcu = (UWORD16 *) l1_apihisr.dyn_dwnld.running_source_pointer; 130 *pp_src_mcu = (UWORD16 *) l1_apihisr.dyn_dwnld.running_source_pointer;
131 }
132
133 /*--------------------------------------------------------*/
134 /* l1_memcpy_16bit() */
135 /*--------------------------------------------------------*/
136 /* */
137 /* Description: */
138 /* ------------ */
139 /* This function is equivalemt of memcopy. Thid function */
140 /* does only 8/16 bit accessed to both source and */
141 /* destination */
142 /* */
143 /* Input parameter: */
144 /* --------------- */
145 /* "src" - input pointer */
146 /* "len" - number of bytes to copy */
147 /* */
148 /* Output parameter: */
149 /* ---------------- */
150 /* "dst" - output pointer */
151 /* */
152 /*--------------------------------------------------------*/
153 void l1_memcpy_16bit(void *dst,void* src,unsigned int len)
154 {
155 unsigned int i;
156 unsigned int tempLen;
157 unsigned char *cdst,*csrc;
158 unsigned short *ssrc,*sdst;
159
160 cdst=dst;
161 csrc=src;
162 sdst=dst;
163 ssrc=src;
164
165 if(((unsigned int)src&0x01) || ((unsigned int)dst&0x01)){
166 // if either source or destination is not 16-bit aligned do the entire memcopy
167 // in 8-bit
168 for(i=0;i<len;i++){
169 *cdst++=*csrc++;
170 }
171 }
172 else{
173 // if both the source and destination are 16-bit aligned do the memcopy
174 // in 16-bits
175 tempLen = len>>1;
176 for(i=0;i<tempLen;i++){
177 *sdst++ = *ssrc++;
178 }
179 if(len & 0x1){
180 // if the caller wanted to copy odd number of bytes do a last 8-bit copy
181 cdst=(unsigned char*)sdst;
182 csrc=(unsigned char*)ssrc;
183 *cdst++ = *csrc++;
184 }
185 }
186 return;
131 } 187 }
132 188
133 /*---------------------------------------------------------------------------- */ 189 /*---------------------------------------------------------------------------- */
134 /* l1_copy_till_the_end_of_the_patch_and_update_write_pointer */ 190 /* l1_copy_till_the_end_of_the_patch_and_update_write_pointer */
135 /*---------------------------------------------------------------------------- */ 191 /*---------------------------------------------------------------------------- */