annotate f103c8/Drivers/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_shift_q15.c @ 2:0c59e7a7782a

Working on GPIO and RCC
author cin
date Mon, 16 Jan 2017 11:04:47 +0300
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1 /* ----------------------------------------------------------------------
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
2 * Copyright (C) 2010-2014 ARM Limited. All rights reserved.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
3 *
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
4 * $Date: 19. March 2015
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
5 * $Revision: V.1.4.5
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
6 *
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
7 * Project: CMSIS DSP Library
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
8 * Title: arm_shift_q15.c
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
9 *
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
10 * Description: Shifts the elements of a Q15 vector by a specified number of bits.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
11 *
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
12 * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
13 *
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
14 * Redistribution and use in source and binary forms, with or without
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
15 * modification, are permitted provided that the following conditions
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
16 * are met:
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
17 * - Redistributions of source code must retain the above copyright
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
18 * notice, this list of conditions and the following disclaimer.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
19 * - Redistributions in binary form must reproduce the above copyright
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
20 * notice, this list of conditions and the following disclaimer in
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
21 * the documentation and/or other materials provided with the
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
22 * distribution.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
23 * - Neither the name of ARM LIMITED nor the names of its contributors
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
24 * may be used to endorse or promote products derived from this
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
25 * software without specific prior written permission.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
26 *
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
27 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
28 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
29 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
30 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
31 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
32 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
33 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
34 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
35 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
36 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
37 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
38 * POSSIBILITY OF SUCH DAMAGE.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
39 * -------------------------------------------------------------------- */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
40
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
41 #include "arm_math.h"
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
42
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
43 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
44 * @ingroup groupMath
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
45 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
46
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
47 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
48 * @addtogroup shift
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
49 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
50 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
51
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
52 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
53 * @brief Shifts the elements of a Q15 vector a specified number of bits.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
54 * @param[in] *pSrc points to the input vector
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
55 * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
56 * @param[out] *pDst points to the output vector
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
57 * @param[in] blockSize number of samples in the vector
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
58 * @return none.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
59 *
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
60 * <b>Scaling and Overflow Behavior:</b>
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
61 * \par
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
62 * The function uses saturating arithmetic.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
63 * Results outside of the allowable Q15 range [0x8000 0x7FFF] will be saturated.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
64 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
65
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
66 void arm_shift_q15(
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
67 q15_t * pSrc,
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
68 int8_t shiftBits,
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
69 q15_t * pDst,
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
70 uint32_t blockSize)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
71 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
72 uint32_t blkCnt; /* loop counter */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
73 uint8_t sign; /* Sign of shiftBits */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
74
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
75 #ifndef ARM_MATH_CM0_FAMILY
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
76
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
77 /* Run the below code for Cortex-M4 and Cortex-M3 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
78
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
79 q15_t in1, in2; /* Temporary variables */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
80
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
81
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
82 /*loop Unrolling */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
83 blkCnt = blockSize >> 2u;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
84
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
85 /* Getting the sign of shiftBits */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
86 sign = (shiftBits & 0x80);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
87
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
88 /* If the shift value is positive then do right shift else left shift */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
89 if(sign == 0u)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
90 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
91 /* First part of the processing with loop unrolling. Compute 4 outputs at a time.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
92 ** a second loop below computes the remaining 1 to 3 samples. */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
93 while(blkCnt > 0u)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
94 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
95 /* Read 2 inputs */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
96 in1 = *pSrc++;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
97 in2 = *pSrc++;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
98 /* C = A << shiftBits */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
99 /* Shift the inputs and then store the results in the destination buffer. */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
100 #ifndef ARM_MATH_BIG_ENDIAN
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
101
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
102 *__SIMD32(pDst)++ = __PKHBT(__SSAT((in1 << shiftBits), 16),
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
103 __SSAT((in2 << shiftBits), 16), 16);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
104
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
105 #else
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
106
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
107 *__SIMD32(pDst)++ = __PKHBT(__SSAT((in2 << shiftBits), 16),
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
108 __SSAT((in1 << shiftBits), 16), 16);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
109
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
110 #endif /* #ifndef ARM_MATH_BIG_ENDIAN */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
111
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
112 in1 = *pSrc++;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
113 in2 = *pSrc++;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
114
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
115 #ifndef ARM_MATH_BIG_ENDIAN
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
116
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
117 *__SIMD32(pDst)++ = __PKHBT(__SSAT((in1 << shiftBits), 16),
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
118 __SSAT((in2 << shiftBits), 16), 16);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
119
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
120 #else
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
121
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
122 *__SIMD32(pDst)++ = __PKHBT(__SSAT((in2 << shiftBits), 16),
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
123 __SSAT((in1 << shiftBits), 16), 16);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
124
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
125 #endif /* #ifndef ARM_MATH_BIG_ENDIAN */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
126
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
127 /* Decrement the loop counter */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
128 blkCnt--;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
129 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
130
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
131 /* If the blockSize is not a multiple of 4, compute any remaining output samples here.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
132 ** No loop unrolling is used. */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
133 blkCnt = blockSize % 0x4u;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
134
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
135 while(blkCnt > 0u)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
136 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
137 /* C = A << shiftBits */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
138 /* Shift and then store the results in the destination buffer. */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
139 *pDst++ = __SSAT((*pSrc++ << shiftBits), 16);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
140
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
141 /* Decrement the loop counter */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
142 blkCnt--;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
143 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
144 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
145 else
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
146 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
147 /* First part of the processing with loop unrolling. Compute 4 outputs at a time.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
148 ** a second loop below computes the remaining 1 to 3 samples. */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
149 while(blkCnt > 0u)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
150 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
151 /* Read 2 inputs */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
152 in1 = *pSrc++;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
153 in2 = *pSrc++;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
154
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
155 /* C = A >> shiftBits */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
156 /* Shift the inputs and then store the results in the destination buffer. */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
157 #ifndef ARM_MATH_BIG_ENDIAN
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
158
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
159 *__SIMD32(pDst)++ = __PKHBT((in1 >> -shiftBits),
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
160 (in2 >> -shiftBits), 16);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
161
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
162 #else
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
163
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
164 *__SIMD32(pDst)++ = __PKHBT((in2 >> -shiftBits),
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
165 (in1 >> -shiftBits), 16);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
166
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
167 #endif /* #ifndef ARM_MATH_BIG_ENDIAN */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
168
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
169 in1 = *pSrc++;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
170 in2 = *pSrc++;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
171
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
172 #ifndef ARM_MATH_BIG_ENDIAN
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
173
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
174 *__SIMD32(pDst)++ = __PKHBT((in1 >> -shiftBits),
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
175 (in2 >> -shiftBits), 16);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
176
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
177 #else
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
178
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
179 *__SIMD32(pDst)++ = __PKHBT((in2 >> -shiftBits),
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
180 (in1 >> -shiftBits), 16);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
181
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
182 #endif /* #ifndef ARM_MATH_BIG_ENDIAN */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
183
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
184 /* Decrement the loop counter */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
185 blkCnt--;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
186 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
187
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
188 /* If the blockSize is not a multiple of 4, compute any remaining output samples here.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
189 ** No loop unrolling is used. */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
190 blkCnt = blockSize % 0x4u;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
191
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
192 while(blkCnt > 0u)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
193 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
194 /* C = A >> shiftBits */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
195 /* Shift the inputs and then store the results in the destination buffer. */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
196 *pDst++ = (*pSrc++ >> -shiftBits);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
197
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
198 /* Decrement the loop counter */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
199 blkCnt--;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
200 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
201 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
202
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
203 #else
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
204
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
205 /* Run the below code for Cortex-M0 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
206
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
207 /* Getting the sign of shiftBits */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
208 sign = (shiftBits & 0x80);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
209
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
210 /* If the shift value is positive then do right shift else left shift */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
211 if(sign == 0u)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
212 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
213 /* Initialize blkCnt with number of samples */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
214 blkCnt = blockSize;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
215
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
216 while(blkCnt > 0u)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
217 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
218 /* C = A << shiftBits */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
219 /* Shift and then store the results in the destination buffer. */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
220 *pDst++ = __SSAT(((q31_t) * pSrc++ << shiftBits), 16);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
221
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
222 /* Decrement the loop counter */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
223 blkCnt--;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
224 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
225 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
226 else
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
227 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
228 /* Initialize blkCnt with number of samples */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
229 blkCnt = blockSize;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
230
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
231 while(blkCnt > 0u)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
232 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
233 /* C = A >> shiftBits */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
234 /* Shift the inputs and then store the results in the destination buffer. */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
235 *pDst++ = (*pSrc++ >> -shiftBits);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
236
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
237 /* Decrement the loop counter */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
238 blkCnt--;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
239 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
240 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
241
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
242 #endif /* #ifndef ARM_MATH_CM0_FAMILY */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
243
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
244 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
245
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
246 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
247 * @} end of shift group
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
248 */