HWA
Bare metal programming with style
psa_2.h
Go to the documentation of this file.
1
2
/* This file is part of the HWA project.
3
* Copyright (c) 2012,2015 Christophe Duparquet.
4
* All rights reserved. Read LICENSE.TXT for details.
5
*/
6
26
#define hw_reset__psa , _hw_psa_reset
27
28
#define _hw_psa_reset(o,a,...) _hw_resetpsa(o) HW_EOL(__VA_ARGS__)
29
30
#define _hw_resetpsa(o) _hw_write(o,psr,1)
31
32
42
#define hw_clear__psa , _hw_psa_reset
43
44
61
#define hw_turn__psa , _hw_psa_turn
62
#define _hw_psa_turn(o,a,v,...) \
63
HW_G2(_hw_turnpsa, HW_IS(,_hw_state_##v))(o,v) \
64
HW_EOL(__VA_ARGS__)
65
66
#define _hw_turnpsa_0(o,v) HW_E(HW_EM_ST(v))
67
#define _hw_turnpsa_1(o,v) HW_G2(_hw_turnpsa_1,HW_A1(_hw_state_##v))(o)
68
69
/* Stopping the prescaler requires setting its `tsm` and `psr` bits to 1
70
*/
71
#define _hw_turnpsa_1_0(o) _hw_write(o,tsmpsr,3)
72
73
/* Releasing the prescaler requires setting its `tsm` bit to 0
74
*/
75
#define _hw_turnpsa_1_1(o) _hw_write(o,tsm,0)
76
77
89
#define hwa_configure__psa , _hwa_cfpsa
90
91
/* Mandatory argument `clock`
92
*/
93
#define _hwa_cfpsa(o,a,k,...) \
94
do { HW_B(_hwa_cfpsa_kclock_,_hw_is_clock_##k)(o,k,__VA_ARGS__,,) } while(0)
95
96
#define _hwa_cfpsa_kclock_0(o,k,...) HW_E(HW_EM_AN(k,clock))
97
98
#define _hwa_cfpsa_kclock_1(o,k,v,...) \
99
HW_B(_hwa_cfpsa_vclock_,_hw_psa_clock_##v)(o,v,__VA_ARGS__)
100
101
#define _hw_psa_clock_ioclk , 0
102
103
#define _hwa_cfpsa_vclock_0(o,v,...) \
104
HW_E(HW_EM_VAL(v,clock,(ioclk)))
105
106
#define _hwa_cfpsa_vclock_1(o,v,...) \
107
HW_EOL(__VA_ARGS__)
Generated for HWA by
1.8.6