/* 
 * File:   extern.h
 * Author: hamilton
 *
 * Created on January 27, 2014, 5:42 PM
 */

#include <dsp.h>
#include "config.h"
#include "can.h"
#include "types.h"

#ifndef EXTERN_H
#define	EXTERN_H


//These calibration contants are defined in "CalibrationConstants.c"
extern const int VBatt_cnt[2];
extern const  float VBatt_eng[2];

extern const int Ips_cnt[2];
extern const  float Ips_eng[2];

extern const int V_StopCharge_cnt[2];
extern const  float V_StopCharge_eng[2];

extern const int V_Balance_cnt[2];
extern const  float V_Balance_eng[2];

extern const int Rgroundfault_cnt[2];
extern const  float Rgroundfault_eng[2];

extern const int H2Sensor_cnt[2];
extern const  float H2Sensor_eng[2];

//The following global variables are defined in extern.c
extern volatile float time;


extern unsigned int uiTemp1;


extern int iTemp1;
extern int iTemp2;
extern int iTemp3;
extern int iTemp4;

extern float  fTemp1;
extern float  fTemp2;

extern FIRStruct ADC_Filter;

//extern abort(void)

extern volatile int outSamples[FILTERSAMPLES];

extern volatile int temp_inSamples[FILTERSAMPLES];
extern volatile int temp_outSamples[FILTERSAMPLES];

extern int raw;


extern volatile int VBatt_ADC[FILTERSAMPLES];
extern volatile int Ips_ADC[FILTERSAMPLES];
extern volatile int V_StopCharge_ADC[FILTERSAMPLES];
extern volatile int V_Balance_ADC[FILTERSAMPLES];
extern volatile int Rgroundfault_ADC[FILTERSAMPLES];
extern volatile int H2Sensor_ADC[FILTERSAMPLES];

extern volatile int VBatt_Buf[REPORTINGSAMPLES];
extern volatile int Ips_Buf[REPORTINGSAMPLES];
extern volatile int V_StopCharge_Buf[REPORTINGSAMPLES];
extern volatile int V_Balance_Buf[REPORTINGSAMPLES];
extern volatile int Rgroundfault_Buf[REPORTINGSAMPLES];
extern volatile int H2Sensor_Buf[REPORTINGSAMPLES];


extern unsigned int BufferA[FILTERSAMPLES*NUMAIO] __attribute__((space(dma),aligned(64)));
extern unsigned int BufferB[FILTERSAMPLES*NUMAIO] __attribute__((space(dma),aligned(64)));


extern unsigned int ECAN1MSGBUF[ECAN1_MSG_BUF_LENGTH][8] __attribute__((space(dma),aligned(ECAN1_MSG_BUF_LENGTH*16)));
//extern unsigned int BufferCAN1TX[CAN1TXBUFFSIZE] __attribute__((space(dma)));


extern CANmsg message[ECAN1_NUM_TX_BUFFERS-1];  //One message structure for each transmit buffer


extern volatile STATUS Status;


extern unsigned int Current;


#endif	/* EXTERN_H */

