blob: ef111330ac2ede5560b0a747fcbaf5339bd5d807 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
|
#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/USB_Communication/USBCDCD.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
//*****************************************************************************
//
// 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;
//MessageContainer createContainer(MessageType type, char* token, protobuf_c_boolean completed, void* response, size_t (*packPtr)(void*, uint8_t*), size_t (*sizePtr)(void*));
//*****************************************************************************
//
// Interrupt handler for the system tick counter.
//
//*****************************************************************************
void SysTickHandler(void)
{
// Update our system time.
g_ui32SysTickCount++;
}
int main(void)
{
// Enable interrupts to the processor.
//
ROM_IntMasterDisable();
//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();
//ROM_IntDisable(INT_ADC0SS0);
ReportInitParams InitParams;
InitParams.DistributorQueueMaxMsgs = 20;
InitParams.DistributorTaskPriority = 6;
InitParams.MaxNumOfFilterNames = 1;
InitParams.MaxNumberOfPrivateDistributors = 2;
ReportInit (InitParams);
//
// 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();
//messageHostInit();
//InitUSBMSCHFatFs();
//EMAC_initEMAC();
ControlInit();
Heaters_Init();
JobInit();
PrintingsInit();
//LoadManual();
//Semaphore_post(sdCardSem);
RegisterReceiveCallback(&receive_callback);
//StartUSB(ui32SysClock);
// Enable interrupts to the processor.
//
ROM_IntMasterEnable();
BIOS_start();
return (0);
//while(1){};
}
|