-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.c
130 lines (99 loc) · 3.65 KB
/
main.c
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
/*==========================================================
* Copyright 2020 QuickLogic Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*==========================================================*/
#include "Fw_global_config.h" // This defines application specific charactersitics
#include <stdio.h>
#include "FreeRTOS.h"
#include "task.h"
#include "semphr.h"
#include "timers.h"
#include "RtosTask.h"
/* Include the generic headers required for QORC */
#include "eoss3_hal_gpio.h"
#include "eoss3_hal_rtc.h"
#include "ql_time.h"
#include "s3x_clock_hal.h"
#include "s3x_clock.h"
#include"eoss3_hal_timer.h"
#include "s3x_pi.h"
#include "dbg_uart.h"
#include "cli.h"
#include "hal_fpga_onion.h"
#include "hal_fpga_onion_gpioctrl.h"
extern const struct cli_cmd_entry my_main_menu[];
const char *SOFTWARE_VERSION_STR;
/*
* Global variable definition
*/
void qorc_hardwareSetup(void);
static void nvic_init(void);
int main(void)
{
SOFTWARE_VERSION_STR = "qorc-onion-apps/qorc_fpga_gpioctrl";
qorc_hardwareSetup();
nvic_init();
dbg_str("\n\n");
dbg_str( "##########################\n");
dbg_str( "ONION FPGA GPIO Controller Experiment\n");
dbg_str( "SW Version: ");
dbg_str( SOFTWARE_VERSION_STR );
dbg_str( "\n" );
dbg_str( __DATE__ " " __TIME__ "\n" );
dbg_str( "##########################\n\n");
dbg_str( "\n\nHello GPIO CONTROLLER!\n\n"); // <<<<<<<<<<<<<<<<<<<<< Change me!
CLI_start_task( my_main_menu );
HAL_Delay_Init();
// print DEVICE ID:
dbg_str_hex32("FPGA Device ID", hal_fpga_onion_get_device_id());
#if 0 // WB ACCESS TESTCASES
hal_fpga_onion_test_wb();
#endif
// Visual Init Sequence Test.
hal_fpga_onion_gpioctrl_set_output(22, 1);
hal_fpga_onion_gpioctrl_set_output(18, 1);
HAL_DelayUSec(400000);
hal_fpga_onion_gpioctrl_set_output(22, 0);
hal_fpga_onion_gpioctrl_set_output(18, 0);
HAL_DelayUSec(400000);
hal_fpga_onion_gpioctrl_set_output(22, 1);
hal_fpga_onion_gpioctrl_set_output(18, 1);
HAL_DelayUSec(400000);
hal_fpga_onion_gpioctrl_set_output(22, 0);
hal_fpga_onion_gpioctrl_set_output(18, 0);
HAL_DelayUSec(400000);
hal_fpga_onion_gpioctrl_set_output(22, 1);
hal_fpga_onion_gpioctrl_set_output(18, 1);
HAL_DelayUSec(400000);
hal_fpga_onion_gpioctrl_set_output(22, 0);
hal_fpga_onion_gpioctrl_set_output(18, 0);
/* Start the tasks and timer running. */
vTaskStartScheduler();
dbg_str("\n");
while(1);
}
static void nvic_init(void)
{
// To initialize system, this interrupt should be triggered at main.
// So, we will set its priority just before calling vTaskStartScheduler(), not the time of enabling each irq.
NVIC_SetPriority(Ffe0_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY);
NVIC_SetPriority(SpiMs_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY);
NVIC_SetPriority(CfgDma_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY);
NVIC_SetPriority(Uart_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY);
NVIC_SetPriority(FbMsg_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY);
}
//needed for startup_EOSS3b.s asm file
void SystemInit(void)
{
}