aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/platforms/SPC5xx/eMIOS200_v1/spc5_emios.h
blob: 97bff1ce9bb1f277edfe0cce7688af0c2cd4b6f7 (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
/*
    SPC5 HAL - Copyright (C) 2013 STMicroelectronics

    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.
*/

/**
 * @file    SPC5xx/eMIOS200_v1/spc5_emios.h
 * @brief   eMIOS200 helper driver header.
 *
 * @addtogroup SPC5xx_eMIOS200
 * @{
 */

#ifndef _SPC5_EMIOS_H_
#define _SPC5_EMIOS_H_

#if HAL_USE_ICU || HAL_USE_PWM || defined(__DOXYGEN__)

/*===========================================================================*/
/* Driver constants.                                                         */
/*===========================================================================*/

#define EMIOSMCR_MDIS                       (1 << 30)
#define EMIOSMCR_FRZ                        (1 << 29)
#define EMIOSMCR_GTBE                       (1 << 28)
#define EMIOSMCR_GPREN                      (1 << 26)
#define EMIOSMCR_GPRE(n)                    ((n) << 8)

#define EMIOSC_FREN                         (1 << 31)
#define EMIOSC_UCPRE(n)                     ((n) << 26)
#define EMIOSC_UCPREN                       (1 << 25)
#define EMIOSC_DMA                          (1 << 24)
#define EMIOSC_IF(n)                        ((n) << 19)
#define EMIOSC_FCK                          (1 << 18)
#define EMIOSC_FEN                          (1 << 17)
#define EMIOSC_FORCMA                       (1 << 13)
#define EMIOSC_FORCMB                       (1 << 12)
#define EMIOSC_BSL(n)                       ((n) << 9)
#define EMIOSC_EDSEL                        (1 << 8)
#define EMIOSC_EDPOL                        (1 << 7)
#define EMIOSC_MODE(n)                      ((n) << 0)

#define EMIOS_BSL_COUNTER_BUS_A             0
#define EMIOS_BSL_COUNTER_BUS_2             1
#define EMIOS_BSL_INTERNAL_COUNTER          3

#define EMIOS_CCR_MODE_GPIO_IN              0
#define EMIOS_CCR_MODE_GPIO_OUT             1
#define EMIOS_CCR_MODE_SAIC                 2
#define EMIOS_CCR_MODE_SAOC                 3
#define EMIOS_CCR_MODE_IPWM                 4
#define EMIOS_CCR_MODE_IPM                  5
#define EMIOS_CCR_MODE_DAOC_B_MATCH         6
#define EMIOS_CCR_MODE_DAOC_BOTH_MATCH      7
#define EMIOS_CCR_MODE_MC_CMS               16
#define EMIOS_CCR_MODE_MC_CME               17
#define EMIOS_CCR_MODE_MC_UP_DOWN           18
#define EMIOS_CCR_MODE_OPWMT                38
#define EMIOS_CCR_MODE_MCB_UP               80
#define EMIOS_CCR_MODE_MCB_UP_DOWN          84
#define EMIOS_CCR_MODE_OPWFMB               88
#define EMIOS_CCR_MODE_OPWMCB_TE            92
#define EMIOS_CCR_MODE_OPWMCB_LE            93
#define EMIOS_CCR_MODE_OPWMB                96

#define EMIOSS_OVR                          (1 << 31)
#define EMIOSS_OVRC                         (1 << 31)
#define EMIOSS_OVFL                         (1 << 15)
#define EMIOSS_OVFLC                        (1 << 15)
#define EMIOSS_FLAG                         (1 << 0)
#define EMIOSS_FLAGC                        (1 << 0)

/*===========================================================================*/
/* Driver pre-compile time settings.                                         */
/*===========================================================================*/

/*===========================================================================*/
/* Derived constants and error checks.                                       */
/*===========================================================================*/

/*===========================================================================*/
/* Driver data structures and types.                                         */
/*===========================================================================*/

/*===========================================================================*/
/* Driver macros.                                                            */
/*===========================================================================*/

/*===========================================================================*/
/* External declarations.                                                    */
/*===========================================================================*/

void reset_emios_active_channels(void);
uint32_t get_emios_active_channels(void);;
void increase_emios_active_channels(void);
void decrease_emios_active_channels(void);
void active_emios_clock(ICUDriver *icup, PWMDriver *pwmp);
void deactive_emios_clock(void);

#endif /* HAL_USE_ICU || HAL_USE_PWM */

#endif /* _SPC5_EMIOS_H_ */

/** @} */