6989|5

10

帖子

0

TA的资源

一粒金砂(初级)

楼主
 

ccs宏定义与调用问题 [复制链接]

5芯积分
  1. #ifdef __cplusplus
  2. extern "C" {
  3. #endif
  4. void PolyphaseMono(short *pcm, int *vbuf, const int *coefBase);
  5. void PolyphaseStereo(short *pcm, int *vbuf, const int *coefBase);
  6. #ifdef __cplusplus
  7. }
  8. #endif
复制代码
  1. #if (defined _WIN32 && !defined _WIN32_WCE) || (defined __WINS__ && defined _SYMBIAN) || defined(_OPENWAVE_SIMULATOR) || defined(WINCE_EMULATOR) /* Symbian emulator for Ix86 */

  2. #pragma warning( disable : 4035 )        /* complains about inline asm not returning a value */

  3. static __inline int MULSHIFT32(int x, int y)       
  4. {
  5. __asm {
  6. mov         eax, x
  7. imul        y
  8. mov         eax, edx
  9. }
  10. }

  11. static __inline int FASTABS(int x)
  12. {
  13. int sign;

  14. sign = x >> (sizeof(int) * 8 - 1);
  15. x ^= sign;
  16. x -= sign;

  17. return x;
  18. }

  19. static __inline int CLZ(int x)
  20. {
  21. int numZeros;

  22. if (!x)
  23. return (sizeof(int) * 8);

  24. numZeros = 0;
  25. while (!(x & 0x80000000)) {
  26. numZeros++;
  27. x <<= 1;
  28. }

  29. return numZeros;
  30. }

  31. /* MADD64, SHL64, SAR64:
  32. * write in assembly to avoid dependency on run-time lib for 64-bit shifts, muls
  33. * (sometimes compiler thunks to function calls instead of code generating)
  34. * required for Symbian emulator
  35. */
  36. #ifdef __CW32__
  37. typedef long long Word64;
  38. #else
  39. typedef __int64 Word64;
  40. #endif

  41. static __inline Word64 MADD64(Word64 sum, int x, int y)
  42. {
  43. unsigned int sumLo = ((unsigned int *)&sum)[0];
  44. int sumHi = ((int *)&sum)[1];

  45. __asm {
  46. mov         eax, x
  47. imul        y
  48. add         eax, sumLo
  49. adc         edx, sumHi
  50. }

  51. /* equivalent to return (sum + ((__int64)x * y)); */
  52. }

  53. static __inline Word64 SHL64(Word64 x, int n)
  54. {
  55. unsigned int xLo = ((unsigned int *)&x)[0];
  56. int xHi = ((int *)&x)[1];
  57. unsigned char nb = (unsigned char)n;

  58. if (n < 32) {
  59. __asm {
  60. mov         edx, xHi
  61. mov         eax, xLo
  62. mov         cl, nb
  63. shld edx, eax, cl
  64. shl eax, cl
  65. }
  66. } else if (n < 64) {
  67. /* shl masks cl to 0x1f */
  68. __asm {
  69. mov         edx, xLo
  70. mov         cl, nb
  71. xor eax, eax
  72. shl edx, cl
  73. }
  74. } else {
  75. __asm {
  76. xor         edx, edx
  77. xor         eax, eax
  78. }
  79. }
  80. }

  81. static __inline Word64 SAR64(Word64 x, int n)
  82. {
  83. unsigned int xLo = ((unsigned int *)&x)[0];
  84. int xHi = ((int *)&x)[1];
  85. unsigned char nb = (unsigned char)n;

  86. if (n < 32) {
  87. __asm {
  88. mov         edx, xHi
  89. mov         eax, xLo
  90. mov         cl, nb
  91. shrd        eax, edx, cl
  92. sar         edx, cl
  93. }
  94. } else if (n < 64) {
  95. /* sar masks cl to 0x1f */
  96. __asm {
  97. mov         edx, xHi
  98. mov         eax, xHi
  99. mov         cl, nb
  100. sar         edx, 31
  101. sar         eax, cl
  102. }
  103. } else {
  104. __asm {
  105. sar         xHi, 31
  106. mov         eax, xHi
  107. mov         edx, xHi
  108. }
  109. }
  110. }

  111. #elif (defined _WIN32) && (defined _WIN32_WCE)

  112. /* use asm function for now (EVC++ 3.0 does horrible job compiling __int64 version) */
  113. #define MULSHIFT32        xmp3_MULSHIFT32
  114. int MULSHIFT32(int x, int y);

  115. static __inline int FASTABS(int x)
  116. {
  117. int sign;

  118. sign = x >> (sizeof(int) * 8 - 1);
  119. x ^= sign;
  120. x -= sign;

  121. return x;
  122. }

  123. static __inline int CLZ(int x)
  124. {
  125. int numZeros;

  126. if (!x)
  127. return (sizeof(int) * 8);

  128. numZeros = 0;
  129. while (!(x & 0x80000000)) {
  130. numZeros++;
  131. x <<= 1;
  132. }

  133. return numZeros;
  134. }

  135. #elif defined ARM_ADS

  136. static __inline int MULSHIFT32(int x, int y)
  137. {

  138. int zlow;
  139. __asm {
  140. smull zlow,y,x,y
  141. }

  142. return y;
  143. }

  144. static __inline int FASTABS(int x)
  145. {
  146. int t=0; /*Really is not necessary to initialiaze only to avoid warning*/

  147. __asm {
  148. eor        t, x, x, asr #31 // T:=X XOR (X>>31)
  149. sub        t, t, x, asr #31 // T:=T-(X>>31)
  150. }

  151. return t;
  152. }

  153. static __inline int CLZ(int x)
  154. {
  155. int numZeros;

  156. if (!x)
  157. return (sizeof(int) * 8);

  158. numZeros = 0;
  159. while (!(x & 0x80000000)) {
  160. numZeros++;
  161. x <<= 1;
  162. }

  163. return numZeros;
  164. }

  165. #elif defined(__GNUC__) && defined(ARM)

  166. typedef long long Word64;

  167. #define MULSHIFT32        xmp3_MULSHIFT32
  168. extern int MULSHIFT32(int x, int y);


  169. #define FASTABS        xmp3_FASTABS
  170. int FASTABS(int x);


  171. static __inline int CLZ(int x)
  172. {
  173. int numZeros;

  174. if (!x)
  175. return (sizeof(int) * 8);

  176. numZeros = 0;
  177. while (!(x & 0x80000000)) {
  178. numZeros++;
  179. x <<= 1;
  180. }

  181. return numZeros;
  182. }

  183. #else

  184. #error Unsupported platform in assembly.h

  185. #endif        /* platforms */

  186. #endif /* _ASSEMBLY_H */
复制代码

如上在一个头文件里面这样定义了,在.c文件里调用的时候就提示(.c文件里包含了这些头文件)
  1. Description        Resource        Path        Location        Type
  2. unresolved symbol FASTABS, first referenced in ./stproc.obj        mp3_6         C/C++ Problem
  3. unresolved symbol MULSHIFT32, first referenced in ./stproc.obj        mp3_6         C/C++ Problem
  4. unresolved symbol PolyphaseMono, first referenced in ./subband.obj        mp3_6         C/C++ Problem
复制代码
这是为什么

最新回复

应该是在多个地方定义了同一个变量吧。  详情 回复 发表于 2015-6-15 08:32
 
点赞 关注

回复
举报

1万

帖子

25

TA的资源

裸片初长成(高级)

沙发
 
楼主帖了那么多,等有时间了再看吧。
 
 

回复

10

帖子

0

TA的资源

一粒金砂(初级)

板凳
 
dontium 发表于 2015-6-14 17:25
楼主帖了那么多,等有时间了再看吧。

其实也不多,就是关于这3个函数的条件编译,,我调用这3个函数时就报错说unresolved symbol
 
 
 

回复

1万

帖子

25

TA的资源

裸片初长成(高级)

4
 
1、 FASTABS, 已经在stproc.c中定义了,其它文件不要再重复定义
2、 MULSHIFT32也是这样
3、PolyphaseMono, 已经在subband.C中定义了
 
 
 

回复

2886

帖子

0

TA的资源

五彩晶圆(初级)

5
 
 
个人签名昵称:灰小子
 
 

回复

2700

帖子

0

TA的资源

五彩晶圆(初级)

6
 
应该是在多个地方定义了同一个变量吧。
 
个人签名作为一个水军,就是尽量的多回帖,因为懂的技术少,所以回帖水分大,见谅!
EEWORLD开发板置换群:309018200,——电工们免费装β的天堂,商家勿入!加群暗号:喵
 
 

回复
您需要登录后才可以回帖 登录 | 注册

随便看看
查找数据手册?

EEWorld Datasheet 技术支持

相关文章 更多>>
关闭
站长推荐上一条 1/8 下一条

 
EEWorld订阅号

 
EEWorld服务号

 
汽车开发圈

About Us 关于我们 客户服务 联系方式 器件索引 网站地图 最新更新 手机版

站点相关: 国产芯 安防电子 汽车电子 手机便携 工业控制 家用电子 医疗电子 测试测量 网络通信 物联网

北京市海淀区中关村大街18号B座15层1530室 电话:(010)82350740 邮编:100190

电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2025 EEWORLD.com.cn, Inc. All rights reserved
快速回复 返回顶部 返回列表