Skip to content

Add low power implementations for CM3DS #8737

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
52 changes: 49 additions & 3 deletions targets/TARGET_ARM_SSG/TARGET_CM3DS_MPS2/device/device_cfg.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018 ARM Limited
* Copyright (c) 2018 Arm Limited
*
* Licensed under the Apache License Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -27,8 +27,54 @@
*/

/* CMSDK Timers */
#define ARM_CMSDK_TIMER0
#define ARM_CMSDK_TIMER1
#define ARM_CMSDK_DUALTIMER

/* Timer Peripherals are driven by APB System Core Clocks,
* defined in system_CMSDK_CM3DS.c
*/
#define TIMERS_INPUT_CLOCK_FREQ_HZ 25000000U

/* mbed usec high-resolution ticker configuration */
#define USEC_TIMER_DEV CMSDK_TIMER1_DEV

#define usec_interval_irq_handler TIMER1_IRQHandler
#define USEC_INTERVAL_IRQ TIMER1_IRQn

/* The us ticker uses CMSDK Timer1, that does not have HW prescaler.
* The reported shift define is necessary for the software emulated
* prescaler behavior, so the ticker works as if it was ticking on a
* virtually slower frequency. The value 5 sets up the ticker to work
* properly in the specified frequency interval.
*/
#define USEC_TIMER_BIT_WIDTH 32U
#define USEC_REPORTED_SHIFT 5U
#define USEC_REPORTED_FREQ_HZ (TIMERS_INPUT_CLOCK_FREQ_HZ >> \
USEC_REPORTED_SHIFT)
#define USEC_REPORTED_BITS (USEC_TIMER_BIT_WIDTH - USEC_REPORTED_SHIFT)

/* mbed low power ticker configuration */
#define LP_TIMER_DEV CMSDK_DUALTIMER_DEV

#define lp_interval_irq_handler DUALTIMER_IRQHandler
#define LP_INTERVAL_IRQ DUALTIMER_IRQn

/* The lp ticker a CMSDK Dual Timer that is capable of prescaling
* its input clock frequency by 256 at most. Having 25MHz as input
* frequency requires an additional slowing factor in order for the ticker
* to operate in the specified frequency interval, thus the effective
* prescaler value is going to be the sum of the HW and the virtual
* prescaler values.
*/
#define LP_TIMER_BIT_WIDTH 32U
#define LP_TIMER_HW_PRESCALER 8U
#define LP_REPORTED_SHIFT 1U
#define LP_REPORTED_FREQ_HZ (TIMERS_INPUT_CLOCK_FREQ_HZ >> \
(LP_TIMER_HW_PRESCALER+LP_REPORTED_SHIFT))
#define LP_REPORTED_BITS (LP_TIMER_BIT_WIDTH - LP_REPORTED_SHIFT)

/* RTC PL031 */
#define RTC_PL031

/* ARM GPIO */
#define ARM_GPIO0
Expand All @@ -51,7 +97,7 @@
#define ARM_SPI4

/* ARM UART */
#define DEFAULT_UART_BAUDRATE 9600
#define DEFAULT_UART_BAUDRATE 9600U
#define ARM_UART0
#define ARM_UART1
#define ARM_UART2
Expand Down
Loading