Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
c493fa9
Update submodule pointer to personal fork
chinglee-iot May 26, 2022
0af0f46
Merge branch 'FreeRTOS:main' into smp-integration
chinglee-iot Oct 6, 2022
0d067f5
Add Raspberry pi pico SMP demo
chinglee-iot Oct 6, 2022
0d07d7b
Update submodule pointer
chinglee-iot Oct 6, 2022
73cf6f2
Update unit test
chinglee-iot Oct 14, 2022
df70edb
Fix FreeRTOS submodule
chinglee-iot Oct 16, 2022
ca2634b
Fix submodule pointer
chinglee-iot Oct 17, 2022
74269f0
Update submodule pointer
chinglee-iot Oct 17, 2022
db44232
Fix uncrustify in submodule pointer
chinglee-iot Oct 17, 2022
b933714
Add support for SMP functional tests
joshzarr Oct 21, 2022
2e69725
Remove vYieldCores in test cases
chinglee-iot Nov 2, 2022
f87f090
Add CMock functional tests for SMP verification
joshzarr Nov 16, 2022
3b9b3f1
Add task yield test cases
chinglee-iot Dec 16, 2022
cbb1b3c
Update comment and fix typo
chinglee-iot Dec 22, 2022
8a5ed27
Add the vSetCurrentCore function in header
chinglee-iot Jan 6, 2023
af7a487
Rename the test_task_yield_run_equal_priority
chinglee-iot Jan 9, 2023
d6b7825
Update single priority timeslice test cases
chinglee-iot Jan 11, 2023
39ec2bb
Update single priority timeslice test cases
chinglee-iot Jan 11, 2023
95db909
Fixes the number cycle error on shifting core
rawalexe Jan 26, 2023
1a5a8e5
Added 2 function coverage
rawalexe Jan 31, 2023
3f68b66
Fixes the old comment
rawalexe Jan 31, 2023
c159172
Fixes the old comment
rawalexe Jan 31, 2023
3cb64d4
Update kernel submodule pointer
chinglee-iot Jan 31, 2023
80eb1aa
Update PR review suggestion
chinglee-iot Jan 31, 2023
797c0e8
Merge branch 'add-task-yield-unit-test-cases' into update-xTaskIncrem…
chinglee-iot Jan 31, 2023
a2830f0
Merge branch 'jzarr-new-tests' into update-xTaskIncrementTick-test-cases
chinglee-iot Feb 1, 2023
9e5ffd2
Reduce unnecessary change
chinglee-iot Feb 1, 2023
85101ce
Increased the number of function coverage
rawalexe Feb 1, 2023
5583590
More functions covered
rawalexe Feb 2, 2023
ea2b41e
All the functions are covered but the porttask for idle has bugs
rawalexe Feb 2, 2023
f83bcc0
Update comment
chinglee-iot Feb 2, 2023
0008f8a
Update kernel submodule pointer to fix task yield and xTickIncrement…
chinglee-iot Feb 2, 2023
589d99e
New tmp test for minimal idle yeild
rawalexe Feb 2, 2023
08cffa3
New tmp test for minimal idle yeild
rawalexe Feb 2, 2023
4cd9df4
prvMinimalIdleTask function is fully covered now
rawalexe Feb 2, 2023
8958826
code cleanup
rawalexe Feb 2, 2023
fbad152
Name correction
rawalexe Feb 2, 2023
1ed1921
Merge branch 'joshzarr:jzarr-new-tests' into jzarr-new-tests
rawalexe Feb 2, 2023
621d62d
Covers 100% of functions
rawalexe Feb 2, 2023
e60ce6e
Fixed formating
rawalexe Feb 2, 2023
f3d9047
Added branch coverage
rawalexe Feb 2, 2023
069611b
Added branch coverage
rawalexe Feb 2, 2023
9885671
Removed bogus files
rawalexe Feb 3, 2023
d79a533
Remove covg test folders (#5)
chinglee-iot Feb 9, 2023
b9d6fc0
UnitTest: cover some configASSERT in tasks.c
alfred2g Feb 10, 2023
f84239a
Remove covg test folders (#5)
chinglee-iot Feb 9, 2023
a3f62b6
Adding coverage test for TaskResumeFromISR (#4)
chinglee-iot Feb 11, 2023
3710b70
Add coverage for prvAddNewTaskToReadyList and vTaskCoreAffinitySet.
adam-scislowicz Feb 13, 2023
6201d02
changes based on code review comments.
adam-scislowicz Feb 14, 2023
6d8c223
remove the config comment section from the tests I am adding.
adam-scislowicz Feb 15, 2023
09ed1b7
add covergae for vTaskGetInfo and xTaskGenericNotify.
adam-scislowicz Feb 15, 2023
7260955
add tickless idle variant config.
adam-scislowicz Feb 15, 2023
e7de660
add test cases for xTaskResumeFromISR.
adam-scislowicz Feb 15, 2023
a8ffdfe
separate newer changes from this PR. They should be in a separate PR.
adam-scislowicz Feb 16, 2023
9aa52ea
remove debug from coverage test in response of PR feedback.
adam-scislowicz Feb 16, 2023
d81b777
use doxygen compatible comment format and remove tests that are in an…
adam-scislowicz Feb 17, 2023
ea3935f
include mcoked access to operationally unreachable code, but ifdefed …
adam-scislowicz Feb 20, 2023
943c89a
Merge pull request #6 from chinglee-iot/adammds/smp-unit-test-covg
adam-scislowicz Feb 20, 2023
5556cba
new wave of additions to achieve SMP coverage.
adam-scislowicz Feb 21, 2023
b720f6a
Cover vTaskExitCriticalFromISR.
adam-scislowicz Feb 21, 2023
773a881
update comment to reference proper section being covred by the test.
adam-scislowicz Feb 21, 2023
1995cc5
add xTaskPriorityDisinherit
adam-scislowicz Feb 22, 2023
19f63aa
remove tests that went into PR8 from group3
adam-scislowicz Feb 24, 2023
1e67c2a
add tests for xTaskResumeAll
adam-scislowicz Mar 1, 2023
2bf2c3d
add xTaskPriorityDisinherit code.
adam-scislowicz Mar 3, 2023
6dab374
add xTaskPriorityDisinherit* coverage tests.
adam-scislowicz Mar 3, 2023
2558663
cover more branches within vTaskPriorityDisinheritAfterTimeout
adam-scislowicz Mar 3, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[submodule "FreeRTOS/Source"]
path = FreeRTOS/Source
url = https://github.com/FreeRTOS/FreeRTOS-Kernel.git
#url = https://github.com/joshzarr/FreeRTOS-Kernel.git
url = https://github.com/chinglee-iot/FreeRTOS-Kernel.git
[submodule "FreeRTOS/Test/CMock/CMock"]
path = FreeRTOS/Test/CMock/CMock
url = https://github.com/ThrowTheSwitch/CMock.git
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ include(pico_sdk_import.cmake)

PROJECT(examples)

set( FREERTOS_KERNEL_PATH "../../../../../Source" )

add_subdirectory(OnEitherCore)
add_subdirectory(Standard)
add_subdirectory(UsingCMSIS)
add_subdirectory(UsingCMSIS)
add_subdirectory(Standard_smp)
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
*/

/* SMP port only */
#define configNUM_CORES 2
#define configNUM_CORES 1
#define configTICK_CORE 0
#define configRUN_MULTIPLE_PRIORITIES 0

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
cmake_minimum_required(VERSION 3.13)

# Pull in SDK (must be before project)
include(pico_sdk_import.cmake)

# Pull in FreeRTOS
include(FreeRTOS_Kernel_import.cmake)

project(example C CXX ASM)
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)

pico_sdk_init()

add_executable(main_full_smp
main.c
main_full.c
IntQueueTimer.c
RegTest.s
../../../../Common/Minimal/blocktim.c
../../../../Common/Minimal/countsem.c
../../../../Common/Minimal/dynamic.c
../../../../Common/Minimal/recmutex.c
../../../../Common/Minimal/QueueOverwrite.c
../../../../Common/Minimal/EventGroupsDemo.c
../../../../Common/Minimal/IntSemTest.c
../../../../Common/Minimal/IntQueue.c
../../../../Common/Minimal/TaskNotify.c
../../../../Common/Minimal/TimerDemo.c
../../../../Common/Minimal/GenQTest.c
../../../../Common/Minimal/death.c
../../../../Common/Minimal/semtest.c
../../../../Common/Minimal/BlockQ.c
../../../../Common/Minimal/flop.c
)

target_compile_definitions(main_full_smp PRIVATE
mainCREATE_SIMPLE_BLINKY_DEMO_ONLY=0
)

target_include_directories(main_full_smp PRIVATE
${CMAKE_CURRENT_LIST_DIR}
${CMAKE_CURRENT_LIST_DIR}/../../../../Common/include)

target_compile_definitions(main_full_smp PRIVATE
PICO_STDIO_STACK_BUFFER_SIZE=64 # use a small printf on stack buffer
)
target_link_libraries(main_full_smp pico_stdlib FreeRTOS-Kernel FreeRTOS-Kernel-Heap4)
pico_add_extra_outputs(main_full_smp)

add_executable(main_blinky_smp
main.c
main_blinky.c
)

target_compile_definitions(main_blinky_smp PRIVATE
mainCREATE_SIMPLE_BLINKY_DEMO_ONLY=1
)

target_include_directories(main_blinky_smp PRIVATE
${CMAKE_CURRENT_LIST_DIR}
${CMAKE_CURRENT_LIST_DIR}/../../../../Common/include)

target_link_libraries(main_blinky_smp pico_stdlib FreeRTOS-Kernel FreeRTOS-Kernel-Heap1)
pico_add_extra_outputs(main_blinky_smp)
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
/*
* FreeRTOS V202107.00
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* http://www.FreeRTOS.org
* http://aws.amazon.com/freertos
*
* 1 tab == 4 spaces!
*/

#ifndef FREERTOS_CONFIG_H
#define FREERTOS_CONFIG_H

/*-----------------------------------------------------------
* Application specific definitions.
*
* These definitions should be adjusted for your particular hardware and
* application requirements.
*
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
*
* See http://www.freertos.org/a00110.html
*----------------------------------------------------------*/

/* Scheduler Related */
#define configUSE_PREEMPTION 1
#define configUSE_TICKLESS_IDLE 0
#define configUSE_IDLE_HOOK 0
#define configUSE_TICK_HOOK 1
#define configTICK_RATE_HZ ( ( TickType_t ) 1000 )
#define configMAX_PRIORITIES 32
#define configMINIMAL_STACK_SIZE ( configSTACK_DEPTH_TYPE ) 256
#define configUSE_16_BIT_TICKS 0

#define configIDLE_SHOULD_YIELD 1

/* Synchronization Related */
#define configUSE_MUTEXES 1
#define configUSE_RECURSIVE_MUTEXES 1
#define configUSE_APPLICATION_TASK_TAG 0
#define configUSE_COUNTING_SEMAPHORES 1
#define configQUEUE_REGISTRY_SIZE 8
#define configUSE_QUEUE_SETS 1
#define configUSE_TIME_SLICING 1
#define configUSE_NEWLIB_REENTRANT 0
#define configENABLE_BACKWARD_COMPATIBILITY 0
#define configNUM_THREAD_LOCAL_STORAGE_POINTERS 5

/* System */
#define configSTACK_DEPTH_TYPE uint32_t
#define configMESSAGE_BUFFER_LENGTH_TYPE size_t

/* Memory allocation related definitions. */
#define configSUPPORT_STATIC_ALLOCATION 0
#define configSUPPORT_DYNAMIC_ALLOCATION 1
#define configTOTAL_HEAP_SIZE (128*1024)
#define configAPPLICATION_ALLOCATED_HEAP 0

/* Hook function related definitions. */
#define configCHECK_FOR_STACK_OVERFLOW 2
#define configUSE_MALLOC_FAILED_HOOK 1
#define configUSE_DAEMON_TASK_STARTUP_HOOK 0

/* Run time and task stats gathering related definitions. */
#define configGENERATE_RUN_TIME_STATS 0
#define configUSE_TRACE_FACILITY 1
#define configUSE_STATS_FORMATTING_FUNCTIONS 0

/* Co-routine related definitions. */
#define configUSE_CO_ROUTINES 0
#define configMAX_CO_ROUTINE_PRIORITIES 1

/* Software timer related definitions. */
#define configUSE_TIMERS 1
#define configTIMER_TASK_PRIORITY ( configMAX_PRIORITIES - 1 )
#define configTIMER_QUEUE_LENGTH 10
#define configTIMER_TASK_STACK_DEPTH 1024

/* Interrupt nesting behaviour configuration. */
/*
#define configKERNEL_INTERRUPT_PRIORITY [dependent of processor]
#define configMAX_SYSCALL_INTERRUPT_PRIORITY [dependent on processor and application]
#define configMAX_API_CALL_INTERRUPT_PRIORITY [dependent on processor and application]
*/

/* SMP port only */
#define configNUM_CORES 2
#define configTICK_CORE 0
#define configRUN_MULTIPLE_PRIORITIES 0

/* RP2040 specific */
#define configSUPPORT_PICO_SYNC_INTEROP 1
#define configSUPPORT_PICO_TIME_INTEROP 1

#include <assert.h>
/* Define to trap errors during development. */
#define configASSERT(x) assert(x)

/* Set the following definitions to 1 to include the API function, or zero
to exclude the API function. */
#define INCLUDE_vTaskPrioritySet 1
#define INCLUDE_uxTaskPriorityGet 1
#define INCLUDE_vTaskDelete 1
#define INCLUDE_vTaskSuspend 1
#define INCLUDE_vTaskDelayUntil 1
#define INCLUDE_vTaskDelay 1
#define INCLUDE_xTaskGetSchedulerState 1
#define INCLUDE_xTaskGetCurrentTaskHandle 1
#define INCLUDE_uxTaskGetStackHighWaterMark 1
#define INCLUDE_xTaskGetIdleTaskHandle 1
#define INCLUDE_eTaskGetState 1
#define INCLUDE_xTimerPendFunctionCall 1
#define INCLUDE_xTaskAbortDelay 1
#define INCLUDE_xTaskGetHandle 1
#define INCLUDE_xTaskResumeFromISR 1
#define INCLUDE_xQueueGetMutexHolder 1

/* A header file that defines trace macro can be included here. */

/* SMP Related config. */
#define configUSE_MINIMAL_IDLE_HOOK 0
#define portCRITICAL_NESTING_IN_TCB 1
#define portSUPPORT_SMP 1

#endif /* FREERTOS_CONFIG_H */

Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# This is a copy of <FREERTOS_KERNEL_PATH>/portable/ThirdParty/GCC/RP2040/FREERTOS_KERNEL_import.cmake

# This can be dropped into an external project to help locate the FreeRTOS kernel
# It should be include()ed prior to project(). Alternatively this file may
# or the CMakeLists.txt in this directory may be included or added via add_subdirectory
# respectively.

if (DEFINED ENV{FREERTOS_KERNEL_PATH} AND (NOT FREERTOS_KERNEL_PATH))
set(FREERTOS_KERNEL_PATH $ENV{FREERTOS_KERNEL_PATH})
message("Using FREERTOS_KERNEL_PATH from environment ('${FREERTOS_KERNEL_PATH}')")
endif ()

set(FREERTOS_KERNEL_RP2040_RELATIVE_PATH "portable/ThirdParty/GCC/RP2040")
# undo the above
set(FREERTOS_KERNEL_RP2040_BACK_PATH "../../../..")

if (NOT FREERTOS_KERNEL_PATH)
# check if we are inside the FreeRTOS kernel tree (i.e. this file has been included directly)
get_filename_component(_ACTUAL_PATH ${CMAKE_CURRENT_LIST_DIR} REALPATH)
get_filename_component(_POSSIBLE_PATH ${CMAKE_CURRENT_LIST_DIR}/${FREERTOS_KERNEL_RP2040_BACK_PATH}/${FREERTOS_KERNEL_RP2040_RELATIVE_PATH} REALPATH)
if (_ACTUAL_PATH STREQUAL _POSSIBLE_PATH)
get_filename_component(FREERTOS_KERNEL_PATH ${CMAKE_CURRENT_LIST_DIR}/${FREERTOS_KERNEL_RP2040_BACK_PATH} REALPATH)
endif()
if (_ACTUAL_PATH STREQUAL _POSSIBLE_PATH)
get_filename_component(FREERTOS_KERNEL_PATH ${CMAKE_CURRENT_LIST_DIR}/${FREERTOS_KERNEL_RP2040_BACK_PATH} REALPATH)
message("Setting FREERTOS_KERNEL_PATH to ${FREERTOS_KERNEL_PATH} based on location of FreeRTOS-Kernel-import.cmake")
elseif (PICO_SDK_PATH AND EXISTS "${PICO_SDK_PATH}/../FreeRTOS-Kernel")
set(FREERTOS_KERNEL_PATH ${PICO_SDK_PATH}/../FreeRTOS-Kernel)
message("Defaulting FREERTOS_KERNEL_PATH as sibling of PICO_SDK_PATH: ${FREERTOS_KERNEL_PATH}")
endif()
endif ()

if (NOT FREERTOS_KERNEL_PATH)
foreach(POSSIBLE_SUFFIX Source FreeRTOS-Kernel FreeRTOS/Source)
# check if FreeRTOS-Kernel exists under directory that included us
set(SEARCH_ROOT ${CMAKE_CURRENT_SOURCE_DIR}})
set(SEARCH_ROOT ../../../..)
get_filename_component(_POSSIBLE_PATH ${SEARCH_ROOT}/${POSSIBLE_SUFFIX} REALPATH)
if (EXISTS ${_POSSIBLE_PATH}/${FREERTOS_KERNEL_RP2040_RELATIVE_PATH}/CMakeLists.txt)
get_filename_component(FREERTOS_KERNEL_PATH ${_POSSIBLE_PATH} REALPATH)
message("Setting FREERTOS_KERNEL_PATH to '${FREERTOS_KERNEL_PATH}' found relative to enclosing project")
break()
endif()
endforeach()
endif()

if (NOT FREERTOS_KERNEL_PATH)
message(FATAL_ERROR "FreeRTOS location was not specified. Please set FREERTOS_KERNEL_PATH.")
endif()

set(FREERTOS_KERNEL_PATH "${FREERTOS_KERNEL_PATH}" CACHE PATH "Path to the FreeRTOS Kernel")

get_filename_component(FREERTOS_KERNEL_PATH "${FREERTOS_KERNEL_PATH}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}")
if (NOT EXISTS ${FREERTOS_KERNEL_PATH})
message(FATAL_ERROR "Directory '${FREERTOS_KERNEL_PATH}' not found")
endif()
if (NOT EXISTS ${FREERTOS_KERNEL_PATH}/${FREERTOS_KERNEL_RP2040_RELATIVE_PATH}/CMakeLists.txt)
message(FATAL_ERROR "Directory '${FREERTOS_KERNEL_PATH}' does not contain an RP2040 port here: ${FREERTOS_KERNEL_RP2040_RELATIVE_PATH}")
endif()
set(FREERTOS_KERNEL_PATH ${FREERTOS_KERNEL_PATH} CACHE PATH "Path to the FreeRTOS_KERNEL" FORCE)

add_subdirectory(${FREERTOS_KERNEL_PATH}/${FREERTOS_KERNEL_RP2040_RELATIVE_PATH} FREERTOS_KERNEL)
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
/*
* FreeRTOS V202107.00
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* http://www.FreeRTOS.org
* http://aws.amazon.com/freertos
*
* 1 tab == 4 spaces!
*/

/* Scheduler includes. */
#include "FreeRTOS.h"
#include "task.h"

/* Demo includes. */
#include "IntQueueTimer.h"
#include "IntQueue.h"

/* SDK APIs.*/
#include "pico/time.h"
#include "hardware/irq.h"

/* The priorities for the two timers. Note that a priority of 0 is the highest
possible on Cortex-M devices. */
#define tmrMAX_PRIORITY ( 0UL )
#define trmSECOND_HIGHEST_PRIORITY ( tmrMAX_PRIORITY + 0x40 )

#define FIRST_TIMER_PERIOD_US 500
#define SECOND_TIMER_PERIOD_US 487

void prvAlarm0Callback( uint timer )
{
configASSERT(timer == 0);
BaseType_t xHigherPriorityTaskWoken = xFirstTimerHandler();
hardware_alarm_set_target(0, make_timeout_time_us( FIRST_TIMER_PERIOD_US) );
portEND_SWITCHING_ISR(xHigherPriorityTaskWoken);
}

void prvAlarm1Callback( uint timer )
{
configASSERT(timer == 1);
BaseType_t xHigherPriorityTaskWoken = xSecondTimerHandler();
hardware_alarm_set_target(1, make_timeout_time_us( SECOND_TIMER_PERIOD_US) );
portEND_SWITCHING_ISR(xHigherPriorityTaskWoken);
}

void vInitialiseTimerForIntQueueTest( void )
{
/* Use raw hardware alarms so we have nested interrupts */
hardware_alarm_claim(0);
hardware_alarm_claim(1);

/* Don't generate interrupts until the scheduler has been started.
Interrupts will be automatically enabled when the first task starts
running. */
taskDISABLE_INTERRUPTS();

/* Initialize timers. */

/* Set the timer interrupts to be above the kernel. The interrupts are
assigned different priorities so they nest with each other. */
irq_set_priority(TIMER_IRQ_0, tmrMAX_PRIORITY);
irq_set_priority(TIMER_IRQ_1, trmSECOND_HIGHEST_PRIORITY);
hardware_alarm_set_callback(0, prvAlarm0Callback);
hardware_alarm_set_callback(1, prvAlarm1Callback);
hardware_alarm_set_target(0, make_timeout_time_us( FIRST_TIMER_PERIOD_US) );
hardware_alarm_set_target(1, make_timeout_time_us( SECOND_TIMER_PERIOD_US) );
}
Loading