// 
//  Project: Experiment 7.6.3 ETSI normalize LMS filter - Chapter 7
//  File name: ETSI_nlms.h   
//
//  Description: This is the normalize LMS experiment header file
//
//  For the book "Real Time Digital Signal Processing: 
//                Implementation and Application, 2nd Ed"
//                By Sen M. Kuo, Bob H. Lee, and Wenshun Tian
//                Publisher: John Wiley and Sons, Ltd
//
//  Tools used: CCS v.2.12.07
//              TMS320VC5510 DSK Rev-C
//

#define L       64                    // LMS adaptive filter length
#define ALPHA   (1.0*32767)            // LMS adaptive filter step size
#define ROUND   0x4000                 // Rounding for fixed point arithmatic
#define C       0x20                   // Safty factor
#define BETA    (short)(0.99*32767)    // Beta for compute integrator
#define ONE_MINUS_BETA (32767-BETA)

typedef struct {
  long alpha;                 // Alpha
  short in;                   // Input data
  short des;                  // Desired data
  short out;                  // Output data
  short order;                // Filter length
  short err;                  // Error
  short c;                    // Safty factor
  short power;                // Power
  short *w;                   // Pointer to coefficients
  short *x;                   // Pointer to data delay line
} LMS;

void intrinsic_nlms(LMS *lmsObj);
