FIRQ15.cpp 2.3 KB

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