<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{6F924F92-611B-41CF-A6E6-443E69D4CA83}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>Tango.MachineStudio.Publisher.CLI</RootNamespace>
<AssemblyName>ms-publish</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\Build\Machine Studio\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\Build\Machine Studio\Debug\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="CommandLine, Version=1.9.71.2, Culture=neutral, PublicKeyToken=de6f01bd326f8c32, processorArchitecture=MSIL">
<HintPath>..\..\packages\CommandLineParser.1.9.71\lib\net45\CommandLine.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include#include <Container.h>
#include "include.h"
/*#include <stdbool.h>
#include <stdio.h>
#include <xdc/runtime/System.h>
#include <ti/sysbios/BIOS.h>
#include <ti/sysbios/knl/Task.h>
//#include <ti/drivers/USBMSCHFatFs.h>
#include <driverlib/sysctl.h>
#include <driverlib/interrupt.h>
#include <driverlib/rom_map.h>
#include <ti/sysbios/knl/Semaphore.h>
*/
#include <driverlib/sysctl.h>
#include "Drivers/USB_Communication/USBCDCD.h"
#include "Drivers/I2C_Communication/I2C.h"
#include "PMR/common/MessageContainer.pb-c.h"
#include "Common/Sys_PinOut_Config/Pin.h"
#include "Common/Sys_PinOut_Config/Pin_config.h"
#include "Common/utilities/idle_task.h"
#include "Drivers/ADC_Sampling/ADC.h"
#include "drivers/Heater/Heater.h"
#include "drivers/Motors/Motor.h"
#include "Communication/CommunicationTask.h"
#include <xdc/runtime/Error.h>
#include <xdc/runtime/System.h>
#include <xdc/runtime/Types.h>
#include <xdc/runtime/Main.h>
#include <xdc/runtime/Assert.h>
#include <drivers/Flash_Memory/Flash_Memory.h>
#include "drivers/Flash_ram/FlashProgram.h"
#include "drivers/Flash_ram/MCU_E2Prom.h"
#include <DataDef.h>
#include "Sys_PinOut_Config/MCU_MAIN_pinout.h"
/*
#include "Drivers/SPI_SDCARD/SDSPI.h"
#include "Drivers/SPI_SDCARD/SDCardSPI.h"
#include "Drivers/Ethernet_Config/EMACCommon.h"
#include "Drivers/USBStick_FileSys/USBstick.h"
#include "Drivers/USBStick_FileSys/USBMSCHFatFs.h"
*/
#include "Modules/Control/control.h"
#include "Modules/Control/MillisecTask.h"
#include "Modules/Heaters/Heaters_ex.h"
#include "Modules/Ids/Ids_ex.h"
#include "StateMachines/Printing/PrintingSTM.h"
#include "StateMachines/Initialization/InitSequence.h"
#include "StateMachines/Initialization/PowerIdle.h"
#include <Drivers/SSI_Comm/SSI_Comm.h>
#include "drivers/SPI/SPI_Comm.h"
#include "drivers/Uart_Comm/Uart.h"
#include "drivers/valves/valve.h"
#include "drivers/FPGA/FPGA.h"
#include <drivers/FPGA/FPGA_Comm.h>
#include <drivers/FPGA/FPGA_INTERRUPTS/fpga_interrupts.h>
#include "Drivers/I2C_Communication/I2C.h"
#include "Drivers/I2C_Communication/Dispenser_Card/EEPROM/Dispenser_EEPROM.h"
#include "drivers/FPGA/FPGA_GPIO/FPGA_GPIO.h"
#include "drivers/Flash_Memory/FATFS/ff.h"
#include "drivers/Flash_Memory/FATFS/Control_File_System.h"
#include "Modules/General/buttons.h"
#include "Modules/Waste/Waste.h"
#include <Drivers/I2C_Communication/Dispenser_Card/IO_Ports/Dispenser_IO.h>
#include "Drivers/I2C_Communication/Main_Board_EEPROM/Main_EEPROM.h"
#include "delay.h"
#include "Drivers/I2C_Communication/Head_Card/IO_Ports/Head_IO.h"
//*****************************************************************************
//
// The system tick rate expressed both as ticks per second and a millisecond
// period.
//
//*****************************************************************************
#define TICKS_PER_SECOND 1000
//*****************************************************************************
//
// Global system tick counter
//
//*****************************************************************************
static volatile uint32_t g_ui32SysTickCount = 0;
// Flags used to pass commands from interrupt context to the main loop.
static volatile uint32_t g_ui32Flags;
bool Machine_Idle_Mode = false;
F2_CTRL_REG F2_CTRL_Reg;
F1_GPO_REG F1_GPO_Reg;
F3_GPO_01_REG F3_GPO_01_Reg;
Types_Site *site;
Error_Id eid;
int eCode;
char ErrorPath[50] = "0://ErrFile.txt";
bool UpdateFlag = false;
/* ======== errHook ======== */
Void errHook(Error_Block *eb)
{
FRESULT Fresult = FR_OK;
FIL *FileHandle = 0; //the system supports a single active file
uint32_t Bytes = 0;
char File[50] = "";
char message[300];
int len;
STATUS_GREEN_LED_OFF;
ACTIVITY_GREEN_LED_OFF;
COMM_GREEN_LED_OFF;
STATUS_RED_LED_ON;
ACTIVITY_RED_LED_ON;
COMM_RED_LED_ON;
site = Error_getSite(eb);
eid = Error_getId(eb);
eCode = Error_getCode(eb);
if (UpdateFlag == true)
return;
FileHandle = my_malloc(sizeof(FIL));
if (FileHandle == 0)
Fresult = FR_DENIED;
else
{
Fresult = f_open(FileHandle,ErrorPath,FA_OPEN_ALWAYS | FA_WRITE | FA_READ);
if (Fresult == FR_OK)
{
f_lseek(FileHandle, FileHandle->fsize);
strncpy(File,site->file,49);
len = usnprintf(message, 80, "\r\n%s %s",__DATE__, __TIME__);
Fresult = f_write(FileHandle,message,len,&Bytes );
/* print user supplied error code */
len = usnprintf(message, 300, "\r\nerror %d, eid %d mod %d file %s line %d",
eCode, eid,site->mod,
site->file,site->line);
Fresult = f_write(FileHandle,message,len,&Bytes );
LOG_ERROR (eCode, "error # ");
/* check originator's mod id against known mods */
if (site->mod == Main_Module_id()) {
Fresult = f_write(FileHandle,"\r\napp error: ",12,&Bytes );
}
/* check error id against known errors */
if (eid == Error_E_generic) {
Fresult = f_write(FileHandle,"generic: ",10,&Bytes );
}
else if (eid == Assert_E_assertFailed) {
System_printf("assertion violation: ");
Fresult = f_write(FileHandle,"\r\nassertion violation: ",22,&Bytes );
}
/* perform default error output */
f_close(FileHandle);
}
Task_sleep (200);
my_free(FileHandle);
}
#ifdef WATCHDOG
//Power_Reset();
SysCtlReset();
#endif
}
//*****************************************************************************
//
// Interrupt handler for the system tick counter.
//
//*****************************************************************************
void SysTickHandler(void)
{
// Update our system time.
g_ui32SysTickCount++;
}
void Init_EVB()
{
InitPinOutPullUps();
#ifdef Stub_Mode
//MOTOR Driver L6470 SPI
SPI2_Init();
init_BUSY_Pin();
//Danser_ENC:
SSI1_Init(); // Read dancer ENC SSI
#endif
}
int main(void)
{
// Enable interrupts to the processor.
//
ROM_IntMasterDisable();
//Set the clock 120MHz
uint32_t ui32SysClock = MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480), SYS_CLK_FREQ);
// Enable the system tick.
ROM_SysTickPeriodSet(ui32SysClock / TICKS_PER_SECOND);
ROM_SysTickIntEnable();
ROM_SysTickEnable();
// FlashInit();
Calculateinit();
PortFunctionInit();
#ifndef EVALUATION_BOARD
MCU_E2PromInit();
#endif
#ifdef EVALUATION_BOARD
Init_EVB();
#endif
Init_All_I2C();
Block_Main_MUX_TCA9548A_0xE4();//unused, same i2c as head and whs cards
#ifndef EVALUATION_BOARD
STATUS_RED_LED_ON;
STATUS_GREEN_LED_ON;
FPGA_Init();
#endif
MAP_FPULazyStackingEnable();
SysCtlUSBPLLEnable();
#ifndef EVALUATION_BOARD
DeActivateAllSSR();
Control_Dryer_Fan(STOP,0);//Preventing unwanted movement at power up, since the default from FPGA is "0" (= START)
#endif
#ifdef WATCHDOG
InitWatchdog(ui32SysClock*3);
#endif
//FlashInitAndLoad();
CommunicationTaskInit();
utilsInit(ui32SysClock);
#ifndef EVALUATION_BOARD
//Turn_the_Blower_On();//Turn on with the Default_Voltage
ActivateChiller();//WHS Cooler SSR9
//ActivateHeadMagnet();
#endif
//EMAC_initEMAC();
ControlInit();
MillisecInit();
ControlStart();
Heaters_Init();
MotorsInit();
//Shai WHS_HW_test(); // for WHS sensor test
#ifndef EVALUATION_BOARD
Init_Machine_Leds();
#endif
#ifndef EVALUATION_BOARD
//WHS_init();
//IDS_ModuleInit();
Valve_Set(VALVE_MIXCHIP_WASTECH, Mixer_Waste);
#endif
////////////////////////////
//FPGA_Read_limit_Switches_Registers();
//calibration(); //test vme communication
FRESULT iFResult = Init_Flash_File_System(false);// true
if(iFResult != FR_OK)
{
LOG_ERROR (iFResult, "Error during init Flash File System");
assert(iFResult);
}
//FlashInitAndLoad();
//Control_File_System();// test file system
//IDS_ModuleInit();
//GetFiles(); - to start jtag
//GetVmeByte();
//I2C_NFC_Test();
//
//test_avi(); //example for shai
#ifndef EVALUATION_BOARD
//Set_Speed_Sensor_TypeII_Registers(2,2);//set default values
#endif
//Read_Speed_Sensor_TypeII();//must be delay between Set_Speed_Sensor_TypeII_Registers to Read_Speed_Sensor_TypeII
//Test_ADS120_Internal_Temperature_Sensor(0);
#ifdef Use_Head_Card
Head_IO_Init();
#endif
#ifndef EVALUATION_BOARD
Main_EEPROM_Read_Main_Card_SN();
#endif
// Enable interrupts to the processor.
//
ROM_IntMasterEnable();
IDLE_TASK_package_init();
Start_InitSequence();
PowerIdleInit();
BIOS_start();
return (0);
//while(1){};
}