HWA
Bare metal programming with style
plla_2.h
Go to the documentation of this file.
1
2
/* This file is part of the HWA project.
3
* Copyright (c) 2017 Christophe Duparquet.
4
* All rights reserved. Read LICENSE.TXT for details.
5
*/
6
12
#define _hw_actions__plla , (configure,connect,power,stat,write)
13
#define _hwa_actions__plla , (configure,connect,power,stat,write)
14
28
/* Implemented in stm32/hwa_2.h */
29
47
#define hw_configure__plla , _hw_cfplla
48
#define _hw_cfplla(o,a,k,...) do{ HW_BW(_hwx_cfpllain,input,k)(_hw,o,k,__VA_ARGS__) }while(0)
49
50
#define hwa_configure__plla , _hwa_cfplla
51
#define _hwa_cfplla(o,a,k,...) do{ HW_BW(_hwx_cfpllain,input,k)(_hwa,o,k,__VA_ARGS__) }while(0)
52
53
/* Optionnal parameter `input`
54
*/
55
#define _hwx_cfpllain1(h,o,k,v,...) HW_BV(_hwx_cfpllain1,cfpllain_,v,h,o,v) (h,o,__VA_ARGS__)//PUSH
56
#define _hwx_cfpllain1_ _hwx_cfpllain10
57
#define _hwx_cfpllain10(v,...) HW_E(HW_EM_XNIL(v,(hsi/2, hse, hse/2)))
58
#define _hwx_cfpllain11(i,d,h,o,v) \
59
if ( i==0 && d==1.0/2 ) h##_write(o,src,0); \
60
else if ( i==1 && d==1.0 ) h##_write(o,xtpresrc,1);
/* xtpre=0, src=1 */
\
61
else if ( i==1 && d==1.0/2 ) h##_write(o,xtpresrc,3);
/* xtpre=1, src=1 */
\
62
else HWA_E(HW_EM_VAL(v,input,(hsi/2, hse, hse/2))); \
63
_hwx_cfpllain0 //POP
64
65
#define _hw_cfpllain_hsi , 0, 1.0 // 0:HSI, 1.0/x
66
#define _hw_cfpllain_hse , 1, 1.0 // 1:HSE, 1.0/x
67
68
#define _hwx_cfpllain0(h,o,k,...) HW_BW(_hwx_cfpllamul,multiplier,k)(h,o,k,__VA_ARGS__)
69
70
/* Optionnal parameter `multiplier`
71
*/
72
#define _hwx_cfpllamul1(h,o,k,v,...) \
73
if (v-1+1<2 || v-1+1>16) \
74
HWA_E(HW_EM_VL(v,(2..16))); \
75
else h##_write(o,mul,((uint8_t)(v)-2)); \
76
HW_EOL(__VA_ARGS__)
77
78
#define _hwx_cfpllamul0(h,o,...) HW_EOL(__VA_ARGS__)
79
80
94
#define hw_start__plla , _hw_srplla
95
#define _hw_srplla(o,a,...) _hw_write(o,on,1) HW_EOL(__VA_ARGS__)
96
97
#define hwa_start__plla , _hwa_srplla
98
#define _hwa_srplla(o,a,...) _hwa_write(o,on,1) HW_EOL(__VA_ARGS__)
99
100
#define hw_stop__plla , _hw_spplla
101
#define _hw_spplla(o,a,...) _hw_write(o,on,0) HW_EOL(__VA_ARGS__)
102
103
#define hwa_stop__plla , _hwa_spplla
104
#define _hwa_spplla(o,a,...) _hwa_write(o,on,0) HW_EOL(__VA_ARGS__)
105
106
119
typedef
struct
{
120
unsigned
int
_0_24 : 25 ;
121
unsigned
int
ready : 1 ;
122
unsigned
int
_26_31 : 6 ;
123
} _hw_stplla_t ;
124
125
#define hw_stat_t__plla , _hw_sttplla
126
#define _hw_sttplla(o,a,...) _hw_stplla_t HW_EOL(__VA_ARGS__)
127
128
#define hw_stat__plla , _hw_stplla
129
#define _hw_stplla(o,a,g,...) HW_B(_hw_stplla1_,g)(g)
130
#define _hw_stplla1_0(g) HW_E(HW_EM_G(g))
131
#define _hw_stplla1_1(g) (*(volatile _hw_stplla_t*)HW_ADDRESS((rcc,cr)))
Generated for HWA by
1.8.6