comparison L1/dyn_dwl_cfile/l1_dyn_dwl_func.c @ 21:dfc7b0bc468a

L1/dyn_dwl_cfile/*.c: initial import from tcs211-l1-reconst
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 10 Jun 2016 08:59:53 +0000
parents 75a11d740a02
children fc33e796507a
comparison
equal deleted inserted replaced
20:5fd4e7669c93 21:dfc7b0bc468a
7 * 7 *
8 ************* Revision Controle System Header *************/ 8 ************* Revision Controle System Header *************/
9 9
10 #include <stdio.h> 10 #include <stdio.h>
11 #include <string.h> 11 #include <string.h>
12 #include "config.h"
13 #include "l1_confg.h" 12 #include "l1_confg.h"
14 #include "l1_types.h" 13 #include "l1_types.h"
15 #include "l1_const.h" 14 #include "l1_const.h"
16 #include "l1_signa.h" 15 #include "l1_signa.h"
17 #include "sys_types.h" 16 #include "sys_types.h"
127 #else 126 #else
128 *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);
129 #endif // CODE_VERSION == SIMULATION 128 #endif // CODE_VERSION == SIMULATION
130 129
131 *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;
132 } 187 }
133 188
134 /*---------------------------------------------------------------------------- */ 189 /*---------------------------------------------------------------------------- */
135 /* 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 */
136 /*---------------------------------------------------------------------------- */ 191 /*---------------------------------------------------------------------------- */