// Aida header file generator version: VERSION 21.04.2016 11:00 A.M.
// Selected DSP: ADAU144x
/*
  AidaFW.h - Aida DSP library
 Copyright (c) 2015 Aida DSP Team.  All right reserved.

 This library is free software; you can redistribute it and/or
 modify it under the terms of the GNU Lesser General Public
 License as published by the Free Software Foundation; either
 version 2.1 of the License, or (at your option) any later version.

 This library is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 Lesser General Public License for more details.

 You should have received a copy of the GNU Lesser General Public
 License along with this library; if not, write to the Free Software
 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */
#ifndef _AIDAFW_H_
#define _AIDAFW_H_

#include <AidaDSP2.h>

#define DEVICE_ADDR 0x70
#define DEVICE_ADDR_7bit DEVICE_ADDR>>1
#define ADAU144x


#define NonModRamAllocAddr 	0
#define NonModRamAllocSize 	4
const PROGMEM unsigned char NonModRamAllocData[4]={0x00, 0x00, 0x1F, 0xFE};


#define Start_Pulse_Select1Addr 	57888
#define Start_Pulse_Select1Size 	2
const PROGMEM unsigned char Start_Pulse_Select1Data[2]={0x00, 0x1C};


#define Core_Run_Bit1Addr 	57896
#define Core_Run_Bit1Size 	2
const PROGMEM unsigned char Core_Run_Bit1Data[2]={0x00, 0x00};


#define ProgramDataAddr 	8192
#define ProgramDataSize 	474
const PROGMEM unsigned char ProgramDataData[474]={
0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x06, 0x03, 0x80, 0x00, 
0x00, 0x00, 0x06, 0x04, 0xD0, 
0x00, 0x00, 0x00, 0x06, 0x04, 
0xB0, 0x00, 0x00, 0x00, 0x06, 
0x05, 0x50, 0x00, 0x00, 0x00, 
0x06, 0x05, 0x70, 0x00, 0x00, 
0x00, 0x07, 0xFF, 0xD1, 0x08, 
0x20, 0x00, 0x06, 0x04, 0xE0, 
0x00, 0x00, 0x00, 0x06, 0x06, 
0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x06, 0x03, 0xA0, 0x0C, 
0x00, 0x00, 0x06, 0x00, 0xC0, 
0x00, 0xE2, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x07, 0xFF, 0xA0, 0x07, 
0x20, 0x08, 0x00, 0x00, 0x00, 
0x06, 0xA0, 0x00, 0x07, 0xFF, 
0x80, 0x00, 0xC0, 0x00, 0x06, 
0x06, 0x00, 0x07, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x06, 0x04, 0x00, 0x00, 
0x00, 0x00, 0x06, 0x03, 0x00, 
0x1F, 0x00, 0x27, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x06, 
0x03, 0xA0, 0x1B, 0x00, 0x00, 
0x07, 0xFF, 0xA0, 0x01, 0x20, 
0x00, 0x07, 0xFE, 0xE0, 0x01, 
0x03, 0x00, 0x00, 0x00, 0x18, 
0x06, 0x00, 0x00, 0x06, 0x04, 
0x20, 0x00, 0x00, 0x00, 0x07, 
0xFF, 0xD0, 0x00, 0x20, 0x00, 
0x07, 0xFE, 0xE0, 0x07, 0x02, 
0x00, 0x00, 0x00, 0x71, 0x1F, 
0x20, 0x00, 0x00, 0x00, 0x31, 
0x08, 0x22, 0x00, 0x00, 0x00, 
0x00, 0x09, 0xA0, 0x00, 0x07, 
0xFF, 0x91, 0x18, 0x22, 0x00, 
0x00, 0x00, 0x00, 0x08, 0xA0, 
0x00, 0x00, 0x00, 0x40, 0x00, 
0xEA, 0x00, 0x00, 0x00, 0x80, 
0x00, 0xF2, 0x00, 0x00, 0x00, 
0x40, 0x00, 0xC0, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x07, 0xFF, 0xB0, 0x01, 
0x21, 0x00, 0x00, 0x00, 0x10, 
0x00, 0xA1, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x07, 
0xFF, 0x91, 0x08, 0x22, 0x40, 
0x00, 0x00, 0xA0, 0x00, 0xE2, 
0x00, 0x00, 0x00, 0x80, 0x00, 
0xC0, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 
0xBF, 0xFF, 0x20, 0x00, 0x07, 
0xFF, 0x91, 0x08, 0x22, 0x00, 
0x00, 0x00, 0xC0, 0x00, 0xE2, 
0x00, 0x00, 0x00, 0xC0, 0x0A, 
0x20, 0x00, 0x00, 0x00, 0x00, 
0x00, 0xE2, 0x00, 0x03, 0xFF, 
0xC0, 0x0D, 0x20, 0x00, 0x03, 
0xFF, 0xC0, 0x0C, 0x34, 0x00, 
0x03, 0xFF, 0xE0, 0x0B, 0x22, 
0x00, 0x07, 0xFE, 0xE0, 0x0C, 
0x02, 0x00, 0x07, 0xFE, 0xE0, 
0x0D, 0x12, 0x00, 0x00, 0x00, 
0x00, 0x0C, 0x20, 0x00, 0x00, 
0x01, 0x00, 0x00, 0xE2, 0x00, 
0x00, 0x01, 0x11, 0x08, 0x20, 
0x00, 0x04, 0x18, 0x00, 0x00, 
0xE2, 0x00, 0x00, 0x01, 0x11, 
0x08, 0x20, 0x00, 0x04, 0x18, 
0x20, 0x00, 0xE2, 0x00, 0x00, 
0x01, 0x11, 0x08, 0x20, 0x00, 
0x04, 0x18, 0x40, 0x00, 0xE2, 
0x00, 0x00, 0x01, 0x11, 0x08, 
0x20, 0x00, 0x04, 0x18, 0x60, 
0x00, 0xE2, 0x00, 0x00, 0x01, 
0x11, 0x08, 0x20, 0x00, 0x04, 
0x18, 0x80, 0x00, 0xE2, 0x00, 
0x00, 0x01, 0x00, 0x0E, 0x20, 
0x00, 0x00, 0x01, 0x20, 0x00, 
0xE2, 0x00, 0x00, 0x01, 0x31, 
0x08, 0x20, 0x00, 0x04, 0x18, 
0xA0, 0x00, 0xE2, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 
0x06, 0x00, 0xC0, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x06, 0x03, 0x00, 
0x10, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00};


#define SerialInputModesAddr 	57344
#define SerialInputModesSize 	18
const PROGMEM unsigned char SerialInputModesData[18]={0xA4, 0x00, 0x24, 0x00, 0x24, 0x00, 0x24, 0x00, 0x24, 0x00, 0x24, 0x00, 0x24, 0x00, 0x24, 0x00, 0x24, 0x00};


#define SerialOutputModesAddr 	57408
#define SerialOutputModesSize 	18
const PROGMEM unsigned char SerialOutputModesData[18]={0x24, 0x00, 0x24, 0x00, 0xA4, 0x02, 0x24, 0x00, 0x24, 0x00, 0x24, 0x00, 0x24, 0x00, 0x24, 0x00, 0xA4, 0x00};


#define HighSpeedSlaveInterfaceModeAddr 	57417
#define HighSpeedSlaveInterfaceModeSize 	2
const PROGMEM unsigned char HighSpeedSlaveInterfaceModeData[2]={0x00, 0x00};


#define RoutingMatrixASRCInputDataSelectorAddr 	57472
#define RoutingMatrixASRCInputDataSelectorSize 	16
const PROGMEM unsigned char RoutingMatrixASRCInputDataSelectorData[16]={0x00, 0x3F, 0x00, 0x3F, 0x00, 0x3F, 0x00, 0x3F, 0x00, 0x3F, 0x00, 0x3F, 0x00, 0x3F, 0x00, 0x3F};


#define RoutingMatrixASRCOutputRateSelectorAddr 	57480
#define RoutingMatrixASRCOutputRateSelectorSize 	16
const PROGMEM unsigned char RoutingMatrixASRCOutputRateSelectorData[16]={0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x3F, 0x00, 0x3F, 0x00, 0x3F, 0x00, 0x3F};


#define RoutingMatrixSerialOutputDataSelectorAddr 	57488
#define RoutingMatrixSerialOutputDataSelectorSize 	24
const PROGMEM unsigned char RoutingMatrixSerialOutputDataSelectorData[24]={0x00, 0x3F, 0x00, 0x3F, 0x00, 0x3F, 0x00, 0x3F, 0x00, 0x10, 0x00, 0x11, 0x00, 0x3F, 0x00, 0x3F, 0x00, 0x3F, 0x00, 0x3F, 0x00, 0x3F, 0x00, 0x12};


#define SPDIFRegsAddr 	57536
#define SPDIFRegsSize 	24
const PROGMEM unsigned char SPDIFRegsData[24]={0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01};


#define ASRC103Addr 	57601
#define ASRC103Size 	2
const PROGMEM unsigned char ASRC103Data[2]={0x00, 0x00};


#define ASRC247Addr 	57665
#define ASRC247Size 	2
const PROGMEM unsigned char ASRC247Data[2]={0x00, 0x00};


#define SerialInFlexModesAddr 	57728
#define SerialInFlexModesSize 	48
const PROGMEM unsigned char SerialInFlexModesData[48]={0x01, 0x3F, 0x01, 0x3F, 0x01, 0x3F, 0x01, 0x3F, 0x01, 0x3F, 0x01, 0x3F, 0x01, 0x3F, 0x01, 0x3F, 0x01, 0x3F, 0x01, 0x3F, 0x01, 0x3F, 0x01, 0x3F, 0x01, 0x3F, 0x01, 0x3F, 0x01, 0x3F, 0x01, 0x3F, 0x01, 0x3F, 0x01, 0x3F, 0x01, 0x3F, 0x01, 0x3F, 0x01, 0x3F, 0x01, 0x3F, 0x01, 0x3F, 0x01, 0x3F};


#define SerialOutFlexModesAddr 	57792
#define SerialOutFlexModesSize 	64
const PROGMEM unsigned char SerialOutFlexModesData[64]={0x80, 0x80, 0x84, 0x84, 0x88, 0x88, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80};


#define DSPRegsAddr 	57856
#define DSPRegsSize 	84
const PROGMEM unsigned char DSPRegsData[84]={0x31, 0x82, 0xE0, 0x3B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x01, 0x06, 0x71, 0x00, 0x00, 0x10, 0x00, 0x00, 0x01, 0x00, 0x00, 0x20, 0x00, 0x00, 0x1C, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C};


#define OtherDSPModes1Addr 	57920
#define OtherDSPModes1Size 	4
const PROGMEM unsigned char OtherDSPModes1Data[4]={0x00, 0x3F, 0x00, 0x00};


#define OtherDSPModes2Addr 	57927
#define OtherDSPModes2Size 	12
const PROGMEM unsigned char OtherDSPModes2Data[12]={0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};


#define EnableRegisterAddr 	57984
#define EnableRegisterSize 	2
const PROGMEM unsigned char EnableRegisterData[2]={0x01, 0x27};


#define regParamAddr 	0
#define regParamSize 	60
const PROGMEM unsigned char regParamData[60]={
0x00, 0x00, 0x1F, 0xFE, 
0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0xFF, 
0x00, 0x02, 0xAA, 0xAB, 
0x00, 0x80, 0x00, 0x00, 
0x00, 0x80, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 
0x0F, 0x80, 0x00, 0x00};


#define ModuloDataMemoryRegisterAddr 	57887
#define ModuloDataMemoryRegisterSize 	2
const PROGMEM unsigned char ModuloDataMemoryRegisterData[2]={0x1F, 0xFE};


#define NonModuloRAMAddr 	24574
#define NonModuloRAMSize 	8
const PROGMEM unsigned char NonModuloRAMData[8]={0x00, 0x7F, 0xF2, 0x59, 0x00, 0x00, 0x0D, 0xA7};


#define Start_Pulse_Select2Addr 	57888
#define Start_Pulse_Select2Size 	2
const PROGMEM unsigned char Start_Pulse_Select2Data[2]={0x00, 0x00};


#define Core_Run_Bit2Addr 	57896
#define Core_Run_Bit2Size 	2
const PROGMEM unsigned char Core_Run_Bit2Data[2]={0x00, 0x01};


#define R23Dejitter_Window0Addr 	57889
#define R23Dejitter_Window0Size 	2
const PROGMEM unsigned char R23Dejitter_Window0Data[2]={0x00, 0x00};


#define R24Dejitter_Window1Addr 	57889
#define R24Dejitter_Window1Size 	2
const PROGMEM unsigned char R24Dejitter_Window1Data[2]={0x00, 0x05};


#define Tone1Addr 	        8
#define MasterVolumeAddr 	11
#define Inv1Addr 	14

void program_download() {
	AIDA_WRITE_REGISTER_BLOCK( DEVICE_ADDR_7bit, NonModRamAllocAddr, NonModRamAllocSize, NonModRamAllocData );
	AIDA_WRITE_REGISTER_BLOCK( DEVICE_ADDR_7bit, Start_Pulse_Select1Addr, Start_Pulse_Select1Size, Start_Pulse_Select1Data );
	AIDA_WRITE_REGISTER_BLOCK( DEVICE_ADDR_7bit, Core_Run_Bit1Addr, Core_Run_Bit1Size, Core_Run_Bit1Data );
	AIDA_WRITE_REGISTER_BLOCK( DEVICE_ADDR_7bit, ProgramDataAddr, ProgramDataSize, ProgramDataData );
	AIDA_WRITE_REGISTER_BLOCK( DEVICE_ADDR_7bit, SerialInputModesAddr, SerialInputModesSize, SerialInputModesData );
	AIDA_WRITE_REGISTER_BLOCK( DEVICE_ADDR_7bit, SerialOutputModesAddr, SerialOutputModesSize, SerialOutputModesData );
	AIDA_WRITE_REGISTER_BLOCK( DEVICE_ADDR_7bit, HighSpeedSlaveInterfaceModeAddr, HighSpeedSlaveInterfaceModeSize, HighSpeedSlaveInterfaceModeData );
	AIDA_WRITE_REGISTER_BLOCK( DEVICE_ADDR_7bit, RoutingMatrixASRCInputDataSelectorAddr, RoutingMatrixASRCInputDataSelectorSize, RoutingMatrixASRCInputDataSelectorData );
	AIDA_WRITE_REGISTER_BLOCK( DEVICE_ADDR_7bit, RoutingMatrixASRCOutputRateSelectorAddr, RoutingMatrixASRCOutputRateSelectorSize, RoutingMatrixASRCOutputRateSelectorData );
	AIDA_WRITE_REGISTER_BLOCK( DEVICE_ADDR_7bit, RoutingMatrixSerialOutputDataSelectorAddr, RoutingMatrixSerialOutputDataSelectorSize, RoutingMatrixSerialOutputDataSelectorData );
	AIDA_WRITE_REGISTER_BLOCK( DEVICE_ADDR_7bit, SPDIFRegsAddr, SPDIFRegsSize, SPDIFRegsData );
	AIDA_WRITE_REGISTER_BLOCK( DEVICE_ADDR_7bit, ASRC103Addr, ASRC103Size, ASRC103Data );
	AIDA_WRITE_REGISTER_BLOCK( DEVICE_ADDR_7bit, ASRC247Addr, ASRC247Size, ASRC247Data );
	AIDA_WRITE_REGISTER_BLOCK( DEVICE_ADDR_7bit, SerialInFlexModesAddr, SerialInFlexModesSize, SerialInFlexModesData );
	AIDA_WRITE_REGISTER_BLOCK( DEVICE_ADDR_7bit, SerialOutFlexModesAddr, SerialOutFlexModesSize, SerialOutFlexModesData );
	AIDA_WRITE_REGISTER_BLOCK( DEVICE_ADDR_7bit, DSPRegsAddr, DSPRegsSize, DSPRegsData );
	AIDA_WRITE_REGISTER_BLOCK( DEVICE_ADDR_7bit, OtherDSPModes1Addr, OtherDSPModes1Size, OtherDSPModes1Data );
	AIDA_WRITE_REGISTER_BLOCK( DEVICE_ADDR_7bit, OtherDSPModes2Addr, OtherDSPModes2Size, OtherDSPModes2Data );
	AIDA_WRITE_REGISTER_BLOCK( DEVICE_ADDR_7bit, EnableRegisterAddr, EnableRegisterSize, EnableRegisterData );
	AIDA_WRITE_REGISTER_BLOCK( DEVICE_ADDR_7bit, regParamAddr, regParamSize, regParamData );
	AIDA_WRITE_REGISTER_BLOCK( DEVICE_ADDR_7bit, ModuloDataMemoryRegisterAddr, ModuloDataMemoryRegisterSize, ModuloDataMemoryRegisterData );
	AIDA_WRITE_REGISTER_BLOCK( DEVICE_ADDR_7bit, NonModuloRAMAddr, NonModuloRAMSize, NonModuloRAMData );
	AIDA_WRITE_REGISTER_BLOCK( DEVICE_ADDR_7bit, Start_Pulse_Select2Addr, Start_Pulse_Select2Size, Start_Pulse_Select2Data );
	AIDA_WRITE_REGISTER_BLOCK( DEVICE_ADDR_7bit, Core_Run_Bit2Addr, Core_Run_Bit2Size, Core_Run_Bit2Data );
	AIDA_WRITE_REGISTER_BLOCK( DEVICE_ADDR_7bit, R23Dejitter_Window0Addr, R23Dejitter_Window0Size, R23Dejitter_Window0Data );
	AIDA_WRITE_REGISTER_BLOCK( DEVICE_ADDR_7bit, R24Dejitter_Window1Addr, R24Dejitter_Window1Size, R24Dejitter_Window1Data );
}


#endif
