aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW/Embedded/Main.c
diff options
context:
space:
mode:
authorShlomo Hecht <shlomo@twine-s.com>2018-03-06 12:09:02 +0200
committerShlomo Hecht <shlomo@twine-s.com>2018-03-06 12:09:02 +0200
commitfb2d080fbbcea3a91e598b4ea8837a230de6a319 (patch)
tree6b3ce09a252d2ebab8189a92b3326ffbba6dbe4b /Software/Embedded_SW/Embedded/Main.c
parentd734bb5cf08ba2433b74fc86a8858d2437d1a237 (diff)
downloadTango-fb2d080fbbcea3a91e598b4ea8837a230de6a319.tar.gz
Tango-fb2d080fbbcea3a91e598b4ea8837a230de6a319.zip
A new forlder for embedded software in our common structure
Diffstat (limited to 'Software/Embedded_SW/Embedded/Main.c')
-rw-r--r--Software/Embedded_SW/Embedded/Main.c92
1 files changed, 92 insertions, 0 deletions
diff --git a/Software/Embedded_SW/Embedded/Main.c b/Software/Embedded_SW/Embedded/Main.c
new file mode 100644
index 000000000..4d828b0ea
--- /dev/null
+++ b/Software/Embedded_SW/Embedded/Main.c
@@ -0,0 +1,92 @@
+#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 <Modules/Stubs_Handler/DataDef.h>
+#include "drivers/twine_usblib/usb_serial_adapter.h"
+#include "PMR/common/MessageContainer.pb-c.h"
+#include "Common/Sys_PinOut_Config/Pin.h"
+#include "Common/Sys_PinOut_Config/Pin_config.h"
+#include "Drivers/ADC_Sampling/ADC.h"
+#include "Drivers/Peripheral_GPIO/GPIO.h"
+#include "Modules/Stubs_Handler/Container.h"
+
+#include "drivers/twine_graphicslib/graphics_adapter.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 "StateMachines/Printing/PrintingSTM.h"
+extern Semaphore_Handle sdCardSem;
+//#define WATCHDOG
+
+int main(void)
+{
+ //Set the clock 120MHz
+ uint32_t ui32SysClock = SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480), SYS_CLK_FREQ);
+ // Set the system clock to run at 120MHz from the PLL.
+
+ // Save the PLL rate used by this application.
+ //SysCtlVCOGet(SYSCTL_XTAL_25MHZ, &ui32PLLRate);
+
+ // Enable the system tick.
+ ROM_SysTickPeriodSet(ui32SysClock / TICKS_PER_SECOND);
+ ROM_SysTickIntEnable();
+ ROM_SysTickEnable();
+
+ PortFunctionInit();
+
+ InitPinOutPullUps();
+
+ // Enable interrupts to the processor.
+ //
+ MAP_IntMasterEnable();
+
+ //
+ // Enable lazy stacking for interrupt handlers. This allows floating-point
+ // instructions to be used within interrupt handlers, but at the expense of
+ // extra stack usage.
+ //
+ MAP_FPULazyStackingEnable();
+
+ SysCtlUSBPLLEnable();
+
+#ifdef WATCHDOG
+ InitWatchdog(ui32SysClock);
+#endif
+
+ utilsInit(ui32SysClock);
+ init_graphics(ui32SysClock);
+ clear();
+
+ RegisterReceiveCallback(&receive_callback);
+ StartUSB(ui32SysClock);
+ //messageHostInit();
+ //InitUSBMSCHFatFs();
+
+ //EMAC_initEMAC();
+ ControlInit();
+ JobInit();
+ PrintingsInit();
+ //LoadManual();
+ //Semaphore_post(sdCardSem);
+
+
+ BIOS_start();
+
+ return (0);
+}