|
| 1 | +/* |
| 2 | + * FreeRTOS V202411.00 |
| 3 | + * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. |
| 4 | + * |
| 5 | + * Permission is hereby granted, free of charge, to any person obtaining a copy of |
| 6 | + * this software and associated documentation files (the "Software"), to deal in |
| 7 | + * the Software without restriction, including without limitation the rights to |
| 8 | + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of |
| 9 | + * the Software, and to permit persons to whom the Software is furnished to do so, |
| 10 | + * subject to the following conditions: |
| 11 | + * |
| 12 | + * The above copyright notice and this permission notice shall be included in all |
| 13 | + * copies or substantial portions of the Software. If you wish to use our Amazon |
| 14 | + * FreeRTOS name, please do so in a fair use way that does not cause confusion. |
| 15 | + * |
| 16 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 17 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS |
| 18 | + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR |
| 19 | + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER |
| 20 | + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
| 21 | + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 22 | + * |
| 23 | + * https://www.FreeRTOS.org |
| 24 | + * https://github.com/FreeRTOS |
| 25 | + * |
| 26 | + */ |
| 27 | + |
| 28 | +/* Scheduler includes. */ |
| 29 | +#include "FreeRTOS.h" |
| 30 | +#include "task.h" |
| 31 | + |
| 32 | +/* Demo includes. */ |
| 33 | +#include "IntQueueTimer.h" |
| 34 | +#include "IntQueue.h" |
| 35 | + |
| 36 | +/* Hardware includes. */ |
| 37 | +#include "device.h" |
| 38 | +#include "cputimer.h" |
| 39 | +#include "interrupt.h" |
| 40 | + |
| 41 | +__attribute__((interrupt("INT"))) void Timer1_Handler(void); |
| 42 | + |
| 43 | +/*-----------------------------------------------------------*/ |
| 44 | + |
| 45 | +void vInitialiseTimerForIntQueueTest( void ) |
| 46 | +{ |
| 47 | + // Initialize hardware timer CPUTIMER1 */ |
| 48 | + |
| 49 | + CPUTimer_stopTimer(CPUTIMER1_BASE); |
| 50 | + CPUTimer_setPeriod(CPUTIMER1_BASE, ((uint32_t)((DEVICE_SYSCLK_FREQ / 200)))); |
| 51 | + CPUTimer_setPreScaler(CPUTIMER1_BASE, 0U); |
| 52 | + CPUTimer_reloadTimerCounter(CPUTIMER1_BASE); |
| 53 | + CPUTimer_setEmulationMode(CPUTIMER1_BASE, CPUTIMER_EMULATIONMODE_STOPAFTERNEXTDECREMENT); |
| 54 | + CPUTimer_clearOverflowFlag(CPUTIMER1_BASE); |
| 55 | + CPUTimer_enableInterrupt(CPUTIMER1_BASE); |
| 56 | + |
| 57 | + Interrupt_disable(INT_TIMER1); |
| 58 | + Interrupt_clearFlag(INT_TIMER1); |
| 59 | + Interrupt_clearOverflowFlag(INT_TIMER1); |
| 60 | + Interrupt_register(INT_TIMER1, &Timer1_Handler); |
| 61 | + Interrupt_setPriority(INT_TIMER1, 10U); |
| 62 | + Interrupt_enable(INT_TIMER1); |
| 63 | + |
| 64 | + CPUTimer_startTimer(CPUTIMER1_BASE); |
| 65 | +} |
| 66 | + |
| 67 | +/*-----------------------------------------------------------*/ |
| 68 | + |
| 69 | +__attribute__((interrupt("INT"))) void Timer1_Handler(void) |
| 70 | +{ |
| 71 | + IntQueueTestTimerHandler(); |
| 72 | +} |
| 73 | + |
| 74 | +void IntQueueTestTimerHandler( void ) |
| 75 | +{ |
| 76 | + portYIELD_FROM_ISR( xSecondTimerHandler() ); |
| 77 | +} |
| 78 | +/*-----------------------------------------------------------*/ |
0 commit comments