FIRQ15.cpp 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. #include "FIRQ15.h"
  2. #include "Error.h"
  3. void FIRQ15::test_fir_q15()
  4. {
  5. const q15_t *pSrc=samples.ptr();
  6. const q15_t *pCoefs=coefs.ptr();
  7. q15_t *pDst=output.ptr();
  8. arm_fir_q15(&instFir, pSrc, pDst, this->nbSamples);
  9. }
  10. void FIRQ15::test_lms_q15()
  11. {
  12. const q15_t *pSrc=samples.ptr();
  13. const q15_t *pRef=refs.ptr();
  14. q15_t *pDst=output.ptr();
  15. q15_t *pErr=error.ptr();
  16. arm_lms_q15(&instLms, pSrc, (q15_t*)pRef, pDst, pErr,this->nbSamples);
  17. }
  18. void FIRQ15::test_lms_norm_q15()
  19. {
  20. const q15_t *pSrc=samples.ptr();
  21. const q15_t *pRef=refs.ptr();
  22. q15_t *pDst=output.ptr();
  23. q15_t *pErr=error.ptr();
  24. arm_lms_norm_q15(&instLmsNorm, pSrc, (q15_t*)pRef, pDst, pErr,this->nbSamples);
  25. }
  26. void FIRQ15::setUp(Testing::testID_t id,std::vector<Testing::param_t>& params,Client::PatternMgr *mgr)
  27. {
  28. std::vector<Testing::param_t>::iterator it = params.begin();
  29. this->nbTaps = *it++;
  30. this->nbSamples = *it;
  31. samples.reload(FIRQ15::SAMPLES1_Q15_ID,mgr,this->nbSamples);
  32. coefs.reload(FIRQ15::COEFS1_Q15_ID,mgr,this->nbTaps);
  33. state.create(this->nbSamples + this->nbTaps - 1,FIRQ15::STATE_Q15_ID,mgr);
  34. output.create(this->nbSamples,FIRQ15::OUT_SAMPLES_Q15_ID,mgr);
  35. switch(id)
  36. {
  37. case TEST_FIR_Q15_1:
  38. arm_fir_init_q15(&instFir,this->nbTaps,coefs.ptr(),state.ptr(),this->nbSamples);
  39. break;
  40. case TEST_LMS_Q15_2:
  41. refs.reload(FIRQ15::REFS1_Q15_ID,mgr,this->nbSamples);
  42. error.create(this->nbSamples,FIRQ15::ERR_Q15_ID,mgr);
  43. arm_lms_init_q15(&instLms,this->nbTaps,coefs.ptr(),state.ptr(),100,this->nbSamples,1);
  44. break;
  45. case TEST_LMS_NORM_Q15_3:
  46. refs.reload(FIRQ15::REFS1_Q15_ID,mgr,this->nbSamples);
  47. error.create(this->nbSamples,FIRQ15::ERR_Q15_ID,mgr);
  48. arm_lms_norm_init_q15(&instLmsNorm,this->nbTaps,coefs.ptr(),state.ptr(),100,this->nbSamples,1);
  49. break;
  50. }
  51. }
  52. void FIRQ15::tearDown(Testing::testID_t id,Client::PatternMgr *mgr)
  53. {
  54. }