diff options
author | Randall Spangler <rspangler@chromium.org> | 2013-04-17 14:53:31 -0700 |
---|---|---|
committer | ChromeBot <chrome-bot@google.com> | 2013-04-17 18:47:05 -0700 |
commit | 36317d46f7be6ea6f6b4ed82012ae2c5a5a95d48 (patch) | |
tree | 6d96f1f13a76d11cd57396d0f1c421d94ea203dc | |
parent | 6fec5d1397d76eead29772c75fcde9630841b7b7 (diff) | |
download | chrome-ec-36317d46f7be6ea6f6b4ed82012ae2c5a5a95d48.tar.gz |
Move STM32 timer regs struct to registers.h
This is a struct representation of the STM32 timer registers, so
belongs in registers.h instead of the platform-independent hwtimer.h.
Note that there are other problems with the use of this struct. It
should be volatile, and if it's a win vs. the macros we should replace
ALL macro'd timer register accesses with the struct instead of just
those in hwtimer.c (that is, we shouldn't do things both ways). I'll
address those in a subsequent CL after testing which way generates the
most compact code.
No functional changes, just moving the struct definition.
BUG=chrome-os-partner:18343
BRANCH=none
TEST=build all platforms
Change-Id: If29d008fb38b9cc847b69eda1ee7c05e67f6e5e7
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/48415
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
-rw-r--r-- | chip/stm32/registers.h | 30 | ||||
-rw-r--r-- | include/hwtimer.h | 31 |
2 files changed, 31 insertions, 30 deletions
diff --git a/chip/stm32/registers.h b/chip/stm32/registers.h index ea97318606..b5ed731890 100644 --- a/chip/stm32/registers.h +++ b/chip/stm32/registers.h @@ -164,6 +164,36 @@ #define STM32_TIM_DMAR(n) STM32_TIM_REG(n, 0x4C) #define STM32_TIM_OR(n) STM32_TIM_REG(n, 0x50) +/* Timer registers as struct */ +struct timer_ctlr { + unsigned cr1; + unsigned cr2; + unsigned smcr; + unsigned dier; + + unsigned sr; + unsigned egr; + unsigned ccmr1; + unsigned ccmr2; + + unsigned ccer; + unsigned cnt; + unsigned psc; + unsigned arr; + + unsigned reserved30; + unsigned ccr1; + unsigned ccr2; + unsigned ccr3; + + unsigned ccr4; + unsigned reserved44; + unsigned dcr; + unsigned dmar; + + unsigned or; +}; + /* --- GPIO --- */ #define GPIO_A STM32_GPIOA_BASE diff --git a/include/hwtimer.h b/include/hwtimer.h index b9b2270fd6..06344bbb4b 100644 --- a/include/hwtimer.h +++ b/include/hwtimer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2012 The Chromium OS Authors. All rights reserved. +/* Copyright (c) 2013 The Chromium OS Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ @@ -8,35 +8,6 @@ #ifndef __CROS_EC_HWTIMER_H #define __CROS_EC_HWTIMER_H -struct timer_ctlr { - unsigned cr1; - unsigned cr2; - unsigned smcr; - unsigned dier; - - unsigned sr; - unsigned egr; - unsigned ccmr1; - unsigned ccmr2; - - unsigned ccer; - unsigned cnt; - unsigned psc; - unsigned arr; - - unsigned reserved30; - unsigned ccr1; - unsigned ccr2; - unsigned ccr3; - - unsigned ccr4; - unsigned reserved44; - unsigned dcr; - unsigned dmar; - - unsigned or; -}; - /** * Programs when the next timer should fire an interrupt. * deadline: timestamp of the event. |