1 /*
2  * Copyright (c) 2017-2020 Arm Limited. All rights reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 /**
18  * \file device_definition.c
19  * \brief This file defines exports the structures based on the peripheral
20  * definitions from device_cfg.h.
21  * This file is meant to be used as a helper for baremetal
22  * applications and/or as an example of how to configure the generic
23  * driver structures.
24  */
25 
26 #include "device_cfg.h"
27 #include "device_definition.h"
28 #include "platform_description.h"
29 
30 /* ======= Peripheral configuration structure definitions ======= */
31 
32 /* CMSDK GPIO driver structures */
33 #ifdef GPIO0_CMSDK_S
34 static const struct gpio_cmsdk_dev_cfg_t GPIO0_CMSDK_DEV_CFG_S = {
35     .base = MUSCA_S1_GPIO_S_BASE};
36 struct gpio_cmsdk_dev_t GPIO0_CMSDK_DEV_S = {&(GPIO0_CMSDK_DEV_CFG_S)};
37 #endif
38 
39 /* CMSDK Timers driver structures */
40 #ifdef CMSDK_TIMER0_S
41 static const struct timer_cmsdk_dev_cfg_t CMSDK_TIMER0_DEV_CFG_S = {
42     .base = TMR01_BASE};
43 static struct timer_cmsdk_dev_data_t CMSDK_TIMER0_DEV_DATA_S = {
44     .is_initialized = 0};
45 struct timer_cmsdk_dev_t CMSDK_TIMER0_DEV_S = {&(CMSDK_TIMER0_DEV_CFG_S),
46                                                &(CMSDK_TIMER0_DEV_DATA_S)};
47 #endif
48 
49 #ifdef CMSDK_TIMER1_S
50 static const struct timer_cmsdk_dev_cfg_t CMSDK_TIMER1_DEV_CFG_S = {
51     .base = TMR};
52 static struct timer_cmsdk_dev_data_t CMSDK_TIMER1_DEV_DATA_S = {
53     .is_initialized = 0};
54 struct timer_cmsdk_dev_t CMSDK_TIMER1_DEV_S = {&(CMSDK_TIMER1_DEV_CFG_S),
55                                                &(CMSDK_TIMER1_DEV_DATA_S)};
56 #endif
57 
58 #ifdef CMSDK_TIMER2_NS
59 static const struct timer_cmsdk_dev_cfg_t CMSDK_TIMER2_DEV_CFG_NS = {
60     .base = TMR23_BASE+NS_OFFSET };
61 static struct timer_cmsdk_dev_data_t CMSDK_TIMER2_DEV_DATA_NS = {
62     .is_initialized = 0 };
63 struct timer_cmsdk_dev_t CMSDK_TIMER2_DEV_NS = { &(CMSDK_TIMER2_DEV_CFG_NS),
64                                                 &(CMSDK_TIMER2_DEV_DATA_NS) };
65 #endif
66