aboutsummaryrefslogtreecommitdiff
path: root/lib/chibios/os/hal/boards/ADICUP360/board.c
blob: 4b2fbb6df2b946ff5220bbc61788c232b633a8f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
/*
    ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
*/

/*
 * This file has been automatically generated using ChibiStudio board
 * generator plugin. Do not edit manually.
 */

#include "hal.h"
#include "aducm_gp.h"

/*===========================================================================*/
/* Driver local definitions.                                                 */
/*===========================================================================*/

/*===========================================================================*/
/* Driver exported variables.                                                */
/*===========================================================================*/

/*===========================================================================*/
/* Driver local variables and types.                                         */
/*===========================================================================*/

/**
 * @brief   Type of ADUCM36x GP port setup.
 */
typedef struct {
  uint32_t              con;
  uint32_t              oen;
  uint32_t              pul;
  uint32_t              oce;
} gp_setup_t;

/**
 * @brief   Type of ADUCM36x GPIO initialization data.
 */
typedef struct {
  gp_setup_t            GP0Data;
  gp_setup_t            GP1Data;
  gp_setup_t            GP2Data;
} gp_config_t;

/**
 * @brief   STM32 GPIO static initialization data.
 */
static const gp_config_t gp_default_config = {
  {VAL_GP0CON, VAL_GP0OEN, VAL_GP0PUL, VAL_GP0OCE},
  {VAL_GP1CON, VAL_GP1OEN, VAL_GP1PUL, VAL_GP1OCE},
  {VAL_GP2CON, VAL_GP2OEN, VAL_GP2PUL, VAL_GP2OCE}
};

/*===========================================================================*/
/* Driver local functions.                                                   */
/*===========================================================================*/

static void gp_init(aducm_gp_t *gpp, const gp_setup_t *config) {

  gpp->CON  = config->con;
  gpp->OEN  = config->oen;
  gpp->PUL  = config->pul;
  gpp->OCE  = config->oce;
}

static void aducm_gpio_init(void) {

  /* Initializing all the defined GP ports.*/
  gp_init(GP0, &gp_default_config.GP0Data);
  gp_init(GP1, &gp_default_config.GP1Data);
  gp_init(GP2, &gp_default_config.GP2Data);
}

/*===========================================================================*/
/* Driver interrupt handlers.                                                */
/*===========================================================================*/

/*===========================================================================*/
/* Driver exported functions.                                                */
/*===========================================================================*/

/**
 * @brief   Early initialization code.
 * @details GP ports and system clocks are initialized before everything
 *          else.
 */
void __early_init(void) {

  aducm_gpio_init();
  aducm_clock_init();
}

#if HAL_USE_SDC || defined(__DOXYGEN__)
/**
 * @brief   SDC card detection.
 */
bool sdc_lld_is_card_inserted(SDCDriver *sdcp) {

  (void)sdcp;
  /* CHTODO: Fill the implementation.*/
  return true;
}

/**
 * @brief   SDC card write protection detection.
 */
bool sdc_lld_is_write_protected(SDCDriver *sdcp) {

  (void)sdcp;
  /* CHTODO: Fill the implementation.*/
  return false;
}
#endif /* HAL_USE_SDC */

#if HAL_USE_MMC_SPI || defined(__DOXYGEN__)
/**
 * @brief   MMC_SPI card detection.
 */
bool mmc_lld_is_card_inserted(MMCDriver *mmcp) {

  (void)mmcp;
  /* CHTODO: Fill the implementation.*/
  return true;
}

/**
 * @brief   MMC_SPI card write protection detection.
 */
bool mmc_lld_is_write_protected(MMCDriver *mmcp) {

  (void)mmcp;
  /* CHTODO: Fill the implementation.*/
  return false;
}
#endif

/**
 * @brief   Board-specific initialization code.
 * @note    You can add your board-specific code here.
 */
void boardInit(void) {

}