\r
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.addtools.printsize.306588546" name="Print size" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.addtools.printsize" useByScannerDiscovery="false" value="true" valueType="boolean"/>\r
\r
- <option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.level.1940053873" name="Optimization Level" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.level" useByScannerDiscovery="true" value="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.level.none" valueType="enumerated"/>\r
+ <option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.level.1940053873" name="Optimization Level" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.level" useByScannerDiscovery="true" value="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.level.most" valueType="enumerated"/>\r
\r
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.messagelength.565243439" name="Message length (-fmessage-length=0)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.messagelength" useByScannerDiscovery="true" value="false" valueType="boolean"/>\r
\r
\r
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.freestanding.224053313" name="Assume freestanding environment (-ffreestanding)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.freestanding" useByScannerDiscovery="true" value="false" valueType="boolean"/>\r
\r
- <option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.noinlinefunctions.1322946455" name="Do not inline functions (-fno-inline-functions)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.noinlinefunctions" value="false" valueType="boolean"/>\r
+ <option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.noinlinefunctions.1322946455" name="Do not inline functions (-fno-inline-functions)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.noinlinefunctions" useByScannerDiscovery="true" value="false" valueType="boolean"/>\r
\r
- <option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.nobuiltin.1525203912" name="Disable builtin (-fno-builtin)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.nobuiltin" value="true" valueType="boolean"/>\r
+ <option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.nobuiltin.1525203912" name="Disable builtin (-fno-builtin)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.nobuiltin" useByScannerDiscovery="true" value="true" valueType="boolean"/>\r
\r
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="ilg.gnumcueclipse.managedbuild.cross.riscv.targetPlatform.1851994667" isAbstract="false" osList="all" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.targetPlatform"/>\r
\r
\r
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.assembler.usepreprocessor.1853992692" name="Use preprocessor" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.assembler.usepreprocessor" useByScannerDiscovery="false" value="true" valueType="boolean"/>\r
\r
+ <option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.assembler.include.paths.1792818218" name="Include paths (-I)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.assembler.include.paths" useByScannerDiscovery="true" valueType="includePath">\r
+ \r
+ <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/FreeRTOS_Source/portable/GCC/RISC-V-RV32/CLINT}""/>\r
+ \r
+ </option>\r
+ \r
<inputType id="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.assembler.input.1786331150" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.assembler.input"/>\r
\r
</tool>\r
\r
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>\r
\r
- <provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-564858745062802889" id="ilg.gnumcueclipse.managedbuild.cross.riscv.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT RISC-V Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">\r
+ <provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="247273655846757705" id="ilg.gnumcueclipse.managedbuild.cross.riscv.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT RISC-V Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">\r
\r
<language-scope id="org.eclipse.cdt.core.gcc"/>\r
\r
#define configASSERT( x ) if( ( x ) == 0 ) { taskDISABLE_INTERRUPTS(); __asm volatile( "ebreak" ); for( ;; ); }\r
\r
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0\r
+\r
+#define handle_m_ext_interrupt vPortHandleInterrupt\r
+\r
+\r
#endif /* FREERTOS_CONFIG_H */\r
/*******************************************************************************\r
* (c) Copyright 2016-2018 Microsemi SoC Products Group. All rights reserved.\r
- * \r
+ *\r
* file name : microsemi-riscv-igloo2.ld\r
* Mi-V soft processor linker script for creating a SoftConsole downloadable\r
* image executing in eNVM.\r
- * \r
+ *\r
* This linker script assumes that the eNVM is connected at on the Mi-V soft\r
- * processor memory space. \r
+ * processor memory space.\r
*\r
* SVN $Revision: 9661 $\r
* SVN $Date: 2018-01-15 16:13:33 +0530 (Mon, 15 Jan 2018) $\r
*/\r
- \r
+\r
OUTPUT_ARCH( "riscv" )\r
ENTRY(_start)\r
\r
\r
RAM_START_ADDRESS = 0x80000000; /* Must be the same value MEMORY region ram ORIGIN above. */\r
RAM_SIZE = 64k; /* Must be the same value MEMORY region ram LENGTH above. */\r
-STACK_SIZE = 2k; /* needs to be calculated for your application */ \r
+STACK_SIZE = 2k; /* needs to be calculated for your application */\r
HEAP_SIZE = 2k; /* needs to be calculated for your application */\r
\r
SECTIONS\r
{\r
.text : ALIGN(0x10)\r
{\r
- KEEP (*(SORT_NONE(.text.entry))) \r
+ KEEP (*(SORT_NONE(.text.entry)))\r
. = ALIGN(0x10);\r
*(.text .text.* .gnu.linkonce.t.*)\r
*(.plt)\r
. = ALIGN(0x10);\r
- \r
+\r
KEEP (*crtbegin.o(.ctors))\r
KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))\r
KEEP (*(SORT(.ctors.*)))\r
KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))\r
KEEP (*(SORT(.dtors.*)))\r
KEEP (*crtend.o(.dtors))\r
- \r
+\r
*(.rodata .rodata.* .gnu.linkonce.r.*)\r
- *(.gcc_except_table) \r
+ *(.gcc_except_table)\r
*(.eh_frame_hdr)\r
*(.eh_frame)\r
- \r
+\r
KEEP (*(.init))\r
KEEP (*(.fini))\r
\r
KEEP (*(SORT(.fini_array.*)))\r
PROVIDE_HIDDEN (__fini_array_end = .);\r
. = ALIGN(0x10);\r
- \r
+\r
} >envm\r
\r
/* short/global data section */\r
.sdata : ALIGN(0x10)\r
{\r
__sdata_load = LOADADDR(.sdata);\r
- __sdata_start = .; \r
+ __sdata_start = .;\r
PROVIDE( __global_pointer$ = . + 0x800);\r
*(.srodata.cst16) *(.srodata.cst8) *(.srodata.cst4) *(.srodata.cst2)\r
*(.srodata*)\r
\r
/* data section */\r
.data : ALIGN(0x10)\r
- { \r
+ {\r
__data_load = LOADADDR(.data);\r
- __data_start = .; \r
+ __data_start = .;\r
*(.got.plt) *(.got)\r
*(.shdata)\r
*(.data .data.* .gnu.linkonce.d.*)\r
. = ALIGN(0x10);\r
__sbss_end = .;\r
} > ram\r
- \r
+\r
/* sbss section */\r
.bss : ALIGN(0x10)\r
- { \r
+ {\r
__bss_start = .;\r
*(.shbss)\r
*(.bss .bss.* .gnu.linkonce.b.*)\r
\r
/* End of uninitialized data segment */\r
_end = .;\r
- \r
+\r
.heap : ALIGN(0x10)\r
{\r
__heap_start = .;\r
. = ALIGN(0x10);\r
_heap_end = __heap_end;\r
} > ram\r
- \r
+\r
.stack : ALIGN(0x10)\r
{\r
__stack_bottom = .;\r
. += STACK_SIZE;\r
__stack_top = .;\r
_sp = .;\r
+ __freertos_irq_stack_top = .;\r
} > ram\r
}\r
\r
/*******************************************************************************\r
* (c) Copyright 2016-2018 Microsemi SoC Products Group. All rights reserved.\r
- * \r
+ *\r
* file name : microsemi-riscv-ram.ld\r
* Mi-V soft processor linker script for creating a SoftConsole downloadable\r
* debug image executing in SRAM.\r
- * \r
+ *\r
* This linker script assumes that the SRAM is connected at on the Mi-V soft\r
* processor memory space. The start address and size of the memory space must\r
* be correct as per the Libero design.\r
* SVN $Revision: 9661 $\r
* SVN $Date: 2018-01-15 16:13:33 +0530 (Mon, 15 Jan 2018) $\r
*/\r
- \r
+\r
OUTPUT_ARCH( "riscv" )\r
ENTRY(_start)\r
\r
\r
RAM_START_ADDRESS = 0x80000000; /* Must be the same value MEMORY region ram ORIGIN above. */\r
RAM_SIZE = 512k; /* Must be the same value MEMORY region ram LENGTH above. */\r
-STACK_SIZE = 64k; /* needs to be calculated for your application */ \r
+STACK_SIZE = 64k; /* needs to be calculated for your application */\r
HEAP_SIZE = 64k; /* needs to be calculated for your application */\r
\r
SECTIONS\r
{\r
.text : ALIGN(0x10)\r
{\r
- KEEP (*(SORT_NONE(.text.entry))) \r
+ KEEP (*(SORT_NONE(.text.entry)))\r
. = ALIGN(0x10);\r
*(.text .text.* .gnu.linkonce.t.*)\r
*(.plt)\r
. = ALIGN(0x10);\r
- \r
+\r
KEEP (*crtbegin.o(.ctors))\r
KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))\r
KEEP (*(SORT(.ctors.*)))\r
KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))\r
KEEP (*(SORT(.dtors.*)))\r
KEEP (*crtend.o(.dtors))\r
- \r
+\r
*(.rodata .rodata.* .gnu.linkonce.r.*)\r
- *(.gcc_except_table) \r
+ *(.gcc_except_table)\r
*(.eh_frame_hdr)\r
*(.eh_frame)\r
- \r
+\r
KEEP (*(.init))\r
KEEP (*(.fini))\r
\r
KEEP (*(SORT(.fini_array.*)))\r
PROVIDE_HIDDEN (__fini_array_end = .);\r
. = ALIGN(0x10);\r
- \r
+\r
} > ram\r
\r
/* short/global data section */\r
.sdata : ALIGN(0x10)\r
{\r
__sdata_load = LOADADDR(.sdata);\r
- __sdata_start = .; \r
+ __sdata_start = .;\r
PROVIDE( __global_pointer$ = . + 0x800);\r
*(.srodata.cst16) *(.srodata.cst8) *(.srodata.cst4) *(.srodata.cst2)\r
*(.srodata*)\r
\r
/* data section */\r
.data : ALIGN(0x10)\r
- { \r
+ {\r
__data_load = LOADADDR(.data);\r
- __data_start = .; \r
+ __data_start = .;\r
*(.got.plt) *(.got)\r
*(.shdata)\r
*(.data .data.* .gnu.linkonce.d.*)\r
. = ALIGN(0x10);\r
__sbss_end = .;\r
} > ram\r
- \r
+\r
/* sbss section */\r
.bss : ALIGN(0x10)\r
- { \r
+ {\r
__bss_start = .;\r
*(.shbss)\r
*(.bss .bss.* .gnu.linkonce.b.*)\r
\r
/* End of uninitialized data segment */\r
_end = .;\r
- \r
+\r
.heap : ALIGN(0x10)\r
{\r
__heap_start = .;\r
. = ALIGN(0x10);\r
_heap_end = __heap_end;\r
} > ram\r
- \r
+\r
.stack : ALIGN(0x10)\r
{\r
__stack_bottom = .;\r
. += STACK_SIZE;\r
__stack_top = .;\r
_sp = .;\r
+ __freertos_irq_stack_top = .;\r
} > ram\r
}\r
\r
-#if 0\r
/*******************************************************************************\r
* (c) Copyright 2016-2018 Microsemi SoC Products Group. All rights reserved.\r
*\r
\r
#include "riscv_hal.h"\r
\r
+#include "FreeRTOS.h"\r
+\r
#ifdef __cplusplus\r
extern "C" {\r
#endif\r
extern void Software_IRQHandler(void);\r
extern void Timer_IRQHandle( void );\r
\r
-/*------------------------------------------------------------------------------\r
- * Increment value for the mtimecmp register in order to achieve a system tick\r
- * interrupt as specified through the SysTick_Config() function.\r
- */\r
-static uint64_t g_systick_increment = 0U;\r
-\r
-/*------------------------------------------------------------------------------\r
- * Disable all interrupts.\r
- */\r
-void __disable_irq(void)\r
-{\r
- clear_csr(mstatus, MSTATUS_MPIE);\r
- clear_csr(mstatus, MSTATUS_MIE);\r
-}\r
-\r
-/*------------------------------------------------------------------------------\r
- * Enabler all interrupts.\r
- */\r
-void __enable_irq(void)\r
-{\r
- set_csr(mstatus, MSTATUS_MIE);\r
-}\r
-\r
-/*------------------------------------------------------------------------------\r
- * Configure the machine timer to generate an interrupt.\r
- */\r
-uint32_t SysTick_Config(uint32_t ticks)\r
-{\r
- uint32_t ret_val = ERROR;\r
-\r
- g_systick_increment = (uint64_t)(ticks) / RTC_PRESCALER;\r
-\r
- if (g_systick_increment > 0U)\r
- {\r
- uint32_t mhart_id = read_csr(mhartid);\r
-\r
- PRCI->MTIMECMP[mhart_id] = PRCI->MTIME + g_systick_increment;\r
-\r
- set_csr(mie, MIP_MTIP);\r
-\r
- __enable_irq();\r
-\r
- ret_val = SUCCESS;\r
- }\r
-\r
- return ret_val;\r
-}\r
-\r
-/*------------------------------------------------------------------------------\r
- * RISC-V interrupt handler for machine timer interrupts.\r
- */\r
-volatile uint32_t ulTimerInterrupts = 0;\r
-extern void Timer_IRQHandler( void );\r
-static void handle_m_timer_interrupt(void)\r
-{\r
-// clear_csr(mie, MIP_MTIP);\r
-\r
- Timer_IRQHandler();\r
-\r
-// PRCI->MTIMECMP[read_csr(mhartid)] = PRCI->MTIME + g_systick_increment;\r
-\r
-// set_csr(mie, MIP_MTIP);\r
-}\r
-\r
/*------------------------------------------------------------------------------\r
* RISC-V interrupt handler for external interrupts.\r
*/\r
/*------------------------------------------------------------------------------\r
*\r
*/\r
-static void handle_m_ext_interrupt(void)\r
+void handle_m_ext_interrupt(void)\r
{\r
uint32_t int_num = PLIC_ClaimIRQ();\r
uint8_t disable = EXT_IRQ_KEEP_ENABLED;\r
}\r
}\r
\r
-static void handle_m_soft_interrupt(void)\r
-{\r
- Software_IRQHandler();\r
-\r
- /*Clear software interrupt*/\r
- PRCI->MSIP[0] = 0x00U;\r
-}\r
-\r
-/*------------------------------------------------------------------------------\r
- * Trap/Interrupt handler\r
- */\r
-#define ENV_CALL_FROM_M_MODE 11\r
-extern void vTaskSwitchContext( void );\r
-\r
-uintptr_t handle_trap(uintptr_t mcause, uintptr_t mepc)\r
-{\r
- /*_RB_*/\r
- if( mcause == ENV_CALL_FROM_M_MODE )\r
- {\r
- vTaskSwitchContext();\r
-\r
- /* Ensure not to return to the instruction that generated the exception. */\r
- mepc += 4;\r
- } else\r
- /*end _RB_*/\r
- if ((mcause & MCAUSE_INT) && ((mcause & MCAUSE_CAUSE) == IRQ_M_EXT))\r
- {\r
- handle_m_ext_interrupt();\r
- }\r
- else if ((mcause & MCAUSE_INT) && ((mcause & MCAUSE_CAUSE) == IRQ_M_TIMER))\r
- {\r
- handle_m_timer_interrupt();\r
- }\r
- else if ( (mcause & MCAUSE_INT) && ((mcause & MCAUSE_CAUSE) == IRQ_M_SOFT))\r
- {\r
- handle_m_soft_interrupt();\r
- }\r
- else\r
- {\r
-#ifndef NDEBUG\r
- /*\r
- Arguments supplied to this function are mcause, mepc (exception PC) and stack pointer\r
- based onprivileged-isa specification\r
- mcause values and meanings are:\r
- 0 Instruction address misaligned (mtval/mbadaddr is the address)\r
- 1 Instruction access fault (mtval/mbadaddr is the address)\r
- 2 Illegal instruction (mtval/mbadaddr contains the offending instruction opcode)\r
- 3 Breakpoint\r
- 4 Load address misaligned (mtval/mbadaddr is the address)\r
- 5 Load address fault (mtval/mbadaddr is the address)\r
- 6 Store/AMO address fault (mtval/mbadaddr is the address)\r
- 7 Store/AMO access fault (mtval/mbadaddr is the address)\r
- 8 Environment call from U-mode\r
- 9 Environment call from S-mode\r
- A Environment call from M-mode\r
- B Instruction page fault\r
- C Load page fault (mtval/mbadaddr is the address)\r
- E Store page fault (mtval/mbadaddr is the address)\r
- */\r
-\r
- uintptr_t mip = read_csr(mip); /* interrupt pending */\r
- uintptr_t mbadaddr = read_csr(mbadaddr); /* additional info and meaning depends on mcause */\r
- uintptr_t mtvec = read_csr(mtvec); /* trap vector */\r
- uintptr_t mscratch = read_csr(mscratch); /* temporary, sometimes might hold temporary value of a0 */\r
- uintptr_t mstatus = read_csr(mstatus); /* status contains many smaller fields: */\r
-\r
- /* breakpoint*/\r
- __asm("ebreak");\r
-#else\r
- _exit(1 + mcause);\r
-#endif\r
- }\r
- return mepc;\r
-}\r
\r
#ifdef __cplusplus\r
}\r
#endif\r
-#endif\r
PLIC->TARGET[hart_id].PRIORITY_THRESHOLD = 0;\r
\r
/* Enable machine external interrupts. */\r
-// set_csr(mie, MIP_MEIP);\r
+ set_csr(mie, MIP_MEIP);\r
}\r
\r
/*==============================================================================\r
#include "timers.h"\r
#include "semphr.h"\r
\r
+/* Microsemi incldues. */\r
+#include "core_timer.h"\r
+#include "riscv_hal.h"\r
+\r
/* Standard demo application includes. */\r
#include "dynamic.h"\r
#include "blocktim.h"\r
*/\r
static void prvCheckTask( void *pvParameters );\r
\r
+/*\r
+ * Initialise and start the peripheral timers that are used to exercise external\r
+ * interrupt processing.\r
+ */\r
+static void prvSetupPeripheralTimers( void );\r
+\r
/*\r
* Register check tasks as described at the top of this file. The nature of\r
* these files necessitates that they are written in an assembly file, but the\r
\r
/*-----------------------------------------------------------*/\r
\r
+/* Timers used to exercise external interrupt processing. */\r
+static timer_instance_t g_timer0, g_timer1;\r
+\r
+/* Variables incremented by the peripheral timers used to exercise external\r
+interrupts. */\r
+volatile uint32_t ulTimer0Interrupts = 0, ulTimer1Interrupts = 0;\r
+\r
/* The following two variables are used to communicate the status of the\r
register check tasks to the check task. If the variables keep incrementing,\r
then the register check tasks have not discovered any errors. If a variable\r
running. */\r
vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY );\r
\r
+ /* Start the timers that are used to exercise external interrupt handling. */\r
+ prvSetupPeripheralTimers();\r
+\r
/* Start the scheduler. */\r
vTaskStartScheduler();\r
\r
{\r
TickType_t xDelayPeriod = mainNO_ERROR_CHECK_TASK_PERIOD;\r
TickType_t xLastExecutionTime;\r
-static unsigned long ulLastRegTest1Value = 0, ulLastRegTest2Value = 0;\r
+uint32_t ulLastRegTest1Value = 0, ulLastRegTest2Value = 0;\r
+uint32_t ulLastTimer0Interrupts = 0, ulLastTimer1Interrupts = 0;\r
char * const pcPassMessage = "Pass.\r\n";\r
char * pcStatusMessage = pcPassMessage;\r
extern void vSendString( const char * const pcString );\r
}\r
ulLastRegTest2Value = ulRegTest2LoopCounter;\r
\r
+ /* Check interrupts from the peripheral timers are being handled. */\r
+ if( ulLastTimer0Interrupts == ulTimer0Interrupts )\r
+ {\r
+ pcStatusMessage = "ERROR: Peripheral timer 0.\r\n";\r
+ }\r
+ ulLastTimer0Interrupts = ulTimer0Interrupts;\r
+\r
+ if( ulLastTimer1Interrupts == ulTimer1Interrupts )\r
+ {\r
+ pcStatusMessage = "ERROR: Peripheral timer 1.\r\n";\r
+ }\r
+ ulLastTimer1Interrupts = ulTimer1Interrupts;\r
+\r
/* Write the status message to the UART. */\r
vSendString( pcStatusMessage );\r
- vToggleLED();\r
\r
/* If an error has been found then increase the LED toggle rate by\r
increasing the cycle frequency. */\r
/* Called from vApplicationTickHook() when the project is configured to\r
build the full test/demo applications. */\r
}\r
+/*-----------------------------------------------------------*/\r
+\r
+static void prvSetupPeripheralTimers( void )\r
+{\r
+ TMR_init( &g_timer0,\r
+ CORETIMER0_BASE_ADDR,\r
+ TMR_CONTINUOUS_MODE,\r
+ PRESCALER_DIV_1024,\r
+ 83000 );\r
+\r
+ TMR_init( &g_timer1,\r
+ CORETIMER1_BASE_ADDR,\r
+ TMR_CONTINUOUS_MODE,\r
+ PRESCALER_DIV_512,\r
+ 42000 );\r
+\r
+ /* In this version of the PLIC, the priorities are fixed at 1.\r
+ Lower numbered devices have higher priorities. But this code is given as\r
+ an example.\r
+ */\r
+ PLIC_SetPriority( External_30_IRQn, 1 );\r
+ PLIC_SetPriority( External_31_IRQn, 1 );\r
+\r
+ /*Enable Timer 1 & 0 Interrupt*/\r
+ PLIC_EnableIRQ( External_30_IRQn );\r
+ PLIC_EnableIRQ( External_31_IRQn );\r
+\r
+ /* Enable the timers */\r
+ TMR_enable_int( &g_timer0 );\r
+ TMR_enable_int( &g_timer1 );\r
+\r
+ /* Make sure timers don't interrupt until the scheduler is running. */\r
+ portDISABLE_INTERRUPTS();\r
+\r
+ /*Start the timer*/\r
+ TMR_start( &g_timer0 );\r
+ TMR_start( &g_timer1 );\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+/*Core Timer 0 Interrupt Handler*/\r
+uint8_t External_30_IRQHandler( void )\r
+{\r
+ ulTimer0Interrupts++;\r
+ TMR_clear_int(&g_timer0);\r
+ return( EXT_IRQ_KEEP_ENABLED );\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+/*Core Timer 1 Interrupt Handler*/\r
+uint8_t External_31_IRQHandler( void )\r
+{\r
+ ulTimer1Interrupts++;\r
+ TMR_clear_int(&g_timer1);\r
+\r
+ return( EXT_IRQ_KEEP_ENABLED );\r
+}\r
{\r
PLIC_init();\r
UART_init( &g_uart, COREUARTAPB0_BASE_ADDR, BAUD_VALUE_115200, ( DATA_8_BITS | NO_PARITY ) );\r
- GPIO_init( &g_gpio_out, COREGPIO_OUT_BASE_ADDR, GPIO_APB_32_BITS_BUS );\r
}\r
/*-----------------------------------------------------------*/\r
\r
}\r
#endif\r
}\r
+\r
+\r