ex

Fork of mbed-os-example-mbed5-blinky by mbed-os-examples

Committer:
TMBOY
Date:
Tue Jul 18 16:54:45 2017 +0800
Revision:
47:9e361da97763
?

Who changed what in which revision?

UserRevisionLine numberNew contents of line
TMBOY 47:9e361da97763 1 /* ***** BEGIN LICENSE BLOCK *****
TMBOY 47:9e361da97763 2 * Version: RCSL 1.0/RPSL 1.0
TMBOY 47:9e361da97763 3 *
TMBOY 47:9e361da97763 4 * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved.
TMBOY 47:9e361da97763 5 *
TMBOY 47:9e361da97763 6 * The contents of this file, and the files included with this file, are
TMBOY 47:9e361da97763 7 * subject to the current version of the RealNetworks Public Source License
TMBOY 47:9e361da97763 8 * Version 1.0 (the "RPSL") available at
TMBOY 47:9e361da97763 9 * http://www.helixcommunity.org/content/rpsl unless you have licensed
TMBOY 47:9e361da97763 10 * the file under the RealNetworks Community Source License Version 1.0
TMBOY 47:9e361da97763 11 * (the "RCSL") available at http://www.helixcommunity.org/content/rcsl,
TMBOY 47:9e361da97763 12 * in which case the RCSL will apply. You may also obtain the license terms
TMBOY 47:9e361da97763 13 * directly from RealNetworks. You may not use this file except in
TMBOY 47:9e361da97763 14 * compliance with the RPSL or, if you have a valid RCSL with RealNetworks
TMBOY 47:9e361da97763 15 * applicable to this file, the RCSL. Please see the applicable RPSL or
TMBOY 47:9e361da97763 16 * RCSL for the rights, obligations and limitations governing use of the
TMBOY 47:9e361da97763 17 * contents of the file.
TMBOY 47:9e361da97763 18 *
TMBOY 47:9e361da97763 19 * This file is part of the Helix DNA Technology. RealNetworks is the
TMBOY 47:9e361da97763 20 * developer of the Original Code and owns the copyrights in the portions
TMBOY 47:9e361da97763 21 * it created.
TMBOY 47:9e361da97763 22 *
TMBOY 47:9e361da97763 23 * This file, and the files included with this file, is distributed and made
TMBOY 47:9e361da97763 24 * available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
TMBOY 47:9e361da97763 25 * EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES,
TMBOY 47:9e361da97763 26 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS
TMBOY 47:9e361da97763 27 * FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
TMBOY 47:9e361da97763 28 *
TMBOY 47:9e361da97763 29 * Technology Compatibility Kit Test Suite(s) Location:
TMBOY 47:9e361da97763 30 * http://www.helixcommunity.org/content/tck
TMBOY 47:9e361da97763 31 *
TMBOY 47:9e361da97763 32 * Contributor(s):
TMBOY 47:9e361da97763 33 *
TMBOY 47:9e361da97763 34 * ***** END LICENSE BLOCK ***** */
TMBOY 47:9e361da97763 35
TMBOY 47:9e361da97763 36 /**************************************************************************************
TMBOY 47:9e361da97763 37 * Fixed-point MP3 decoder
TMBOY 47:9e361da97763 38 * Jon Recker (jrecker@real.com), Ken Cooke (kenc@real.com)
TMBOY 47:9e361da97763 39 * June 2003
TMBOY 47:9e361da97763 40 *
TMBOY 47:9e361da97763 41 * assembly.h - assembly language functions and prototypes for supported platforms
TMBOY 47:9e361da97763 42 *
TMBOY 47:9e361da97763 43 * - inline rountines with access to 64-bit multiply results
TMBOY 47:9e361da97763 44 * - x86 (_WIN32) and ARM (ARM_ADS, _WIN32_WCE) versions included
TMBOY 47:9e361da97763 45 * - some inline functions are mix of asm and C for speed
TMBOY 47:9e361da97763 46 * - some functions are in native asm files, so only the prototype is given here
TMBOY 47:9e361da97763 47 *
TMBOY 47:9e361da97763 48 * MULSHIFT32(x, y) signed multiply of two 32-bit integers (x and y), returns top 32 bits of 64-bit result
TMBOY 47:9e361da97763 49 * FASTABS(x) branchless absolute value of signed integer x
TMBOY 47:9e361da97763 50 * CLZ(x) count leading zeros in x
TMBOY 47:9e361da97763 51 * MADD64(sum, x, y) (Windows only) sum [64-bit] += x [32-bit] * y [32-bit]
TMBOY 47:9e361da97763 52 * SHL64(sum, x, y) (Windows only) 64-bit left shift using __int64
TMBOY 47:9e361da97763 53 * SAR64(sum, x, y) (Windows only) 64-bit right shift using __int64
TMBOY 47:9e361da97763 54 */
TMBOY 47:9e361da97763 55
TMBOY 47:9e361da97763 56 #ifndef _ASSEMBLY_H
TMBOY 47:9e361da97763 57 #define _ASSEMBLY_H
TMBOY 47:9e361da97763 58
TMBOY 47:9e361da97763 59 #include <stdint.h>
TMBOY 47:9e361da97763 60
TMBOY 47:9e361da97763 61 #define RDA5991H
TMBOY 47:9e361da97763 62
TMBOY 47:9e361da97763 63 #if defined(RDA5991H)
TMBOY 47:9e361da97763 64
TMBOY 47:9e361da97763 65 #if defined(__ICCARM__)
TMBOY 47:9e361da97763 66 #define __inline __INLINE
TMBOY 47:9e361da97763 67 #endif
TMBOY 47:9e361da97763 68
TMBOY 47:9e361da97763 69 #if 1
TMBOY 47:9e361da97763 70 static __inline int FASTABS(int x)
TMBOY 47:9e361da97763 71 {
TMBOY 47:9e361da97763 72 return((x > 0) ? x : -(x));
TMBOY 47:9e361da97763 73 }
TMBOY 47:9e361da97763 74 #endif
TMBOY 47:9e361da97763 75
TMBOY 47:9e361da97763 76 #if 0
TMBOY 47:9e361da97763 77 static __inline int CLZ(int x)
TMBOY 47:9e361da97763 78 {
TMBOY 47:9e361da97763 79 return __CLZ(x);
TMBOY 47:9e361da97763 80 }
TMBOY 47:9e361da97763 81 #endif
TMBOY 47:9e361da97763 82
TMBOY 47:9e361da97763 83 #if 0
TMBOY 47:9e361da97763 84 static __inline int CLZ(int x)
TMBOY 47:9e361da97763 85 {
TMBOY 47:9e361da97763 86 int numZeros;
TMBOY 47:9e361da97763 87
TMBOY 47:9e361da97763 88 if (!x)
TMBOY 47:9e361da97763 89 return (sizeof(int) * 8);
TMBOY 47:9e361da97763 90
TMBOY 47:9e361da97763 91 numZeros = 0;
TMBOY 47:9e361da97763 92 while (!(x & 0x80000000)) {
TMBOY 47:9e361da97763 93 numZeros++;
TMBOY 47:9e361da97763 94 x <<= 1;
TMBOY 47:9e361da97763 95 }
TMBOY 47:9e361da97763 96
TMBOY 47:9e361da97763 97 return numZeros;
TMBOY 47:9e361da97763 98 }
TMBOY 47:9e361da97763 99 #endif
TMBOY 47:9e361da97763 100
TMBOY 47:9e361da97763 101 #if 1
TMBOY 47:9e361da97763 102 static __inline int CLZ(int x)
TMBOY 47:9e361da97763 103 {
TMBOY 47:9e361da97763 104 int numZeros;
TMBOY 47:9e361da97763 105
TMBOY 47:9e361da97763 106 if (!x)
TMBOY 47:9e361da97763 107 return (sizeof(int) * 8);
TMBOY 47:9e361da97763 108
TMBOY 47:9e361da97763 109 __asm{
TMBOY 47:9e361da97763 110 CLZ numZeros, x
TMBOY 47:9e361da97763 111 }
TMBOY 47:9e361da97763 112
TMBOY 47:9e361da97763 113 return numZeros;
TMBOY 47:9e361da97763 114 }
TMBOY 47:9e361da97763 115 #endif
TMBOY 47:9e361da97763 116
TMBOY 47:9e361da97763 117 #if 1
TMBOY 47:9e361da97763 118 static __inline int64_t SAR64(int64_t x, int n)
TMBOY 47:9e361da97763 119 {
TMBOY 47:9e361da97763 120 return (x >> n);
TMBOY 47:9e361da97763 121 }
TMBOY 47:9e361da97763 122 #endif
TMBOY 47:9e361da97763 123
TMBOY 47:9e361da97763 124 #if 1
TMBOY 47:9e361da97763 125 static __inline int MULSHIFT32(int x, int y)
TMBOY 47:9e361da97763 126 {
TMBOY 47:9e361da97763 127 int64_t tmp;
TMBOY 47:9e361da97763 128
TMBOY 47:9e361da97763 129 tmp = ((int64_t)x * (int64_t)y);
TMBOY 47:9e361da97763 130 return (tmp>>32);
TMBOY 47:9e361da97763 131 }
TMBOY 47:9e361da97763 132 #endif
TMBOY 47:9e361da97763 133
TMBOY 47:9e361da97763 134 #if 0
TMBOY 47:9e361da97763 135 static int __inline MULSHIFT32(int x, int y)
TMBOY 47:9e361da97763 136 {
TMBOY 47:9e361da97763 137 int tmp;
TMBOY 47:9e361da97763 138
TMBOY 47:9e361da97763 139 __asm{
TMBOY 47:9e361da97763 140 SMULL tmp, y, x, y
TMBOY 47:9e361da97763 141 }
TMBOY 47:9e361da97763 142
TMBOY 47:9e361da97763 143 return y;
TMBOY 47:9e361da97763 144 }
TMBOY 47:9e361da97763 145 #endif
TMBOY 47:9e361da97763 146
TMBOY 47:9e361da97763 147 #if 1
TMBOY 47:9e361da97763 148 static __inline int64_t MADD64(int64_t sum64, int x, int y)
TMBOY 47:9e361da97763 149 {
TMBOY 47:9e361da97763 150 return (sum64 + (int64_t)x * (int64_t)y);
TMBOY 47:9e361da97763 151 }
TMBOY 47:9e361da97763 152 #endif
TMBOY 47:9e361da97763 153
TMBOY 47:9e361da97763 154 #if 0
TMBOY 47:9e361da97763 155 static __inline int64_t MADD64(int64_t sum64, int x, int y)
TMBOY 47:9e361da97763 156 {
TMBOY 47:9e361da97763 157 unsigned int sum64Lo = ((unsigned int *)&sum64)[0];
TMBOY 47:9e361da97763 158 int sum64Hi = ((int *)&sum64)[1];
TMBOY 47:9e361da97763 159
TMBOY 47:9e361da97763 160 __asm{
TMBOY 47:9e361da97763 161 SMLAL sum64Lo, sum64Hi, x, y
TMBOY 47:9e361da97763 162 }
TMBOY 47:9e361da97763 163
TMBOY 47:9e361da97763 164 sum64 = (((int64_t) sum64Hi) << 32) | sum64Lo;
TMBOY 47:9e361da97763 165
TMBOY 47:9e361da97763 166 return sum64;
TMBOY 47:9e361da97763 167 }
TMBOY 47:9e361da97763 168 #endif
TMBOY 47:9e361da97763 169
TMBOY 47:9e361da97763 170 #else
TMBOY 47:9e361da97763 171 #error No assembly defined. See valid options in assembly.h
TMBOY 47:9e361da97763 172 #endif /** RDA5991H */
TMBOY 47:9e361da97763 173
TMBOY 47:9e361da97763 174 #endif /* _ASSEMBLY_H */