t
Fork of mbed-dev by
targets/TARGET_ONSEMI/TARGET_NCS36510/ticker.h@178:c26431f84b0d, 2017-11-09 (annotated)
- Committer:
- amithy
- Date:
- Thu Nov 09 22:14:37 2017 +0000
- Revision:
- 178:c26431f84b0d
- Parent:
- 149:156823d33999
test export
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
<> | 149:156823d33999 | 1 | /** |
<> | 149:156823d33999 | 2 | ****************************************************************************** |
<> | 149:156823d33999 | 3 | * @file ticker.h |
<> | 149:156823d33999 | 4 | * @brief Microcontroller uSec ticker |
<> | 149:156823d33999 | 5 | * @internal |
<> | 149:156823d33999 | 6 | * @author ON Semiconductor. |
<> | 149:156823d33999 | 7 | * $Rev: |
<> | 149:156823d33999 | 8 | * $Date: |
<> | 149:156823d33999 | 9 | ****************************************************************************** |
<> | 149:156823d33999 | 10 | * Copyright 2016 Semiconductor Components Industries LLC (d/b/a ON Semiconductor). |
<> | 149:156823d33999 | 11 | * All rights reserved. This software and/or documentation is licensed by ON Semiconductor |
<> | 149:156823d33999 | 12 | * under limited terms and conditions. The terms and conditions pertaining to the software |
<> | 149:156823d33999 | 13 | * and/or documentation are available at http://www.onsemi.com/site/pdf/ONSEMI_T&C.pdf |
<> | 149:156823d33999 | 14 | * (ON Semiconductor Standard Terms and Conditions of Sale, Section 8 Software) and |
<> | 149:156823d33999 | 15 | * if applicable the software license agreement. Do not use this software and/or |
<> | 149:156823d33999 | 16 | * documentation unless you have carefully read and you agree to the limited terms and |
<> | 149:156823d33999 | 17 | * conditions. By using this software and/or documentation, you agree to the limited |
<> | 149:156823d33999 | 18 | * terms and conditions. |
<> | 149:156823d33999 | 19 | * |
<> | 149:156823d33999 | 20 | * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED |
<> | 149:156823d33999 | 21 | * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF |
<> | 149:156823d33999 | 22 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. |
<> | 149:156823d33999 | 23 | * ON SEMICONDUCTOR SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, |
<> | 149:156823d33999 | 24 | * INCIDENTAL, OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. |
<> | 149:156823d33999 | 25 | * @endinternal |
<> | 149:156823d33999 | 26 | * |
<> | 149:156823d33999 | 27 | * |
<> | 149:156823d33999 | 28 | */ |
<> | 149:156823d33999 | 29 | |
<> | 149:156823d33999 | 30 | #ifndef TICKER_H_ |
<> | 149:156823d33999 | 31 | #define TICKER_H_ |
<> | 149:156823d33999 | 32 | |
<> | 149:156823d33999 | 33 | #include "types.h" |
<> | 149:156823d33999 | 34 | |
<> | 149:156823d33999 | 35 | /** Core frequency definitions. / |
<> | 149:156823d33999 | 36 | * |
<> | 149:156823d33999 | 37 | * These definitions should be adjusted to setup Orion core frequencies. |
<> | 149:156823d33999 | 38 | */ |
<> | 149:156823d33999 | 39 | #define CPU_CLOCK_ROOT_HZ ( ( unsigned long ) 32000000) /**< <b> Orion 32MHz root frequency </b> */ |
<> | 149:156823d33999 | 40 | #define CPU_CLOCK_DIV_32M ( 1 ) /**< <b> Divider to set up core frequency at 32MHz </b> */ |
<> | 149:156823d33999 | 41 | #define CPU_CLOCK_DIV_16M ( 2 ) /**< <b> Divider to set up core frequency at 16MHz </b> */ |
<> | 149:156823d33999 | 42 | #define CPU_CLOCK_DIV_8M ( 4 ) /**< <b> Divider to set up core frequency at 8MHz </b> */ |
<> | 149:156823d33999 | 43 | #define CPU_CLOCK_DIV_4M ( 8 ) /**< <b> Divider to set up core frequency at 4MHz </b> */ |
<> | 149:156823d33999 | 44 | |
<> | 149:156823d33999 | 45 | #define CPU_CLOCK_DIV CPU_CLOCK_DIV_32M /**< <b> Selected divider to be used by application code </b> */ |
<> | 149:156823d33999 | 46 | |
<> | 149:156823d33999 | 47 | #define configCPU_CLOCK_HZ ( ( unsigned long ) (CPU_CLOCK_ROOT_HZ/CPU_CLOCK_DIV) ) |
<> | 149:156823d33999 | 48 | #define configTICK_RATE_HZ ( ( unsigned long ) 1000000 ) // 1uSec ticker rate |
<> | 149:156823d33999 | 49 | |
<> | 149:156823d33999 | 50 | |
<> | 149:156823d33999 | 51 | /* Lowest priority */ |
<> | 149:156823d33999 | 52 | |
<> | 149:156823d33999 | 53 | #define configKERNEL_INTERRUPT_PRIORITY ( 0xFF ) |
<> | 149:156823d33999 | 54 | #define configMAX_SYSCALL_INTERRUPT_PRIORITY ( 0x8F ) |
<> | 149:156823d33999 | 55 | |
<> | 149:156823d33999 | 56 | #define configSYSTICK_CLOCK_HZ configCPU_CLOCK_HZ |
<> | 149:156823d33999 | 57 | |
<> | 149:156823d33999 | 58 | /* Constants required to manipulate the core. Registers first... */ |
<> | 149:156823d33999 | 59 | #define portNVIC_SYSTICK_CTRL_REG ( * ( ( volatile unsigned long * ) 0xe000e010 ) ) |
<> | 149:156823d33999 | 60 | #define portNVIC_SYSTICK_LOAD_REG ( * ( ( volatile unsigned long * ) 0xe000e014 ) ) |
<> | 149:156823d33999 | 61 | #define portNVIC_SYSTICK_CURRENT_VALUE_REG ( * ( ( volatile unsigned long * ) 0xe000e018 ) ) |
<> | 149:156823d33999 | 62 | #define portNVIC_INT_CTRL_REG ( * ( ( volatile unsigned long * ) 0xe000ed04 ) ) |
<> | 149:156823d33999 | 63 | #define portNVIC_SYSPRI2_REG ( * ( ( volatile unsigned long * ) 0xe000ed20 ) ) |
<> | 149:156823d33999 | 64 | |
<> | 149:156823d33999 | 65 | /* ...then bits in the registers. */ |
<> | 149:156823d33999 | 66 | #define portNVIC_SYSTICK_CLK_BIT ( 1UL << 2UL ) |
<> | 149:156823d33999 | 67 | #define portNVIC_SYSTICK_INT_BIT ( 1UL << 1UL ) |
<> | 149:156823d33999 | 68 | #define portNVIC_SYSTICK_ENABLE_BIT ( 1UL << 0UL ) |
<> | 149:156823d33999 | 69 | #define portNVIC_SYSTICK_COUNT_FLAG_BIT ( 1UL << 16UL ) |
<> | 149:156823d33999 | 70 | |
<> | 149:156823d33999 | 71 | /* Orion has 4 interrupt priority bits |
<> | 149:156823d33999 | 72 | */ |
<> | 149:156823d33999 | 73 | #define portNVIC_SYSTICK_PRI ( ( ( unsigned long ) configKERNEL_INTERRUPT_PRIORITY ) << 24 ) |
<> | 149:156823d33999 | 74 | |
<> | 149:156823d33999 | 75 | /* API definitions */ |
<> | 149:156823d33999 | 76 | void fSysTickInit(void); |
<> | 149:156823d33999 | 77 | |
<> | 149:156823d33999 | 78 | void fSysTickHandler(void); |
<> | 149:156823d33999 | 79 | |
<> | 149:156823d33999 | 80 | uint32_t fSysTickRead(void); |
<> | 149:156823d33999 | 81 | |
<> | 149:156823d33999 | 82 | void fSysTickEnableInterrupt (void); |
<> | 149:156823d33999 | 83 | |
<> | 149:156823d33999 | 84 | void fSysTickDisableInterrupt (void); |
<> | 149:156823d33999 | 85 | #endif // TICKER_H_ |