HWA
Bare metal programming with style
apba_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__apba , (clock)
13 #define _hwa_actions__apba , (clock)
14 
32 #define hw_clock__apba , _hw_ckapba
33 #define _hw_ckapba(o,a,v,...) do{ HW_BV(_hwx_ckapba,ckapba_,v,_hw,o,v,__VA_ARGS__) }while(0)
34 
35 #define hwa_clock__apba , _hwa_ckapba
36 #define _hwa_ckapba(o,a,v,...) do{ HW_BV(_hwx_ckapba,ckapba_,v,_hwa,o,v,__VA_ARGS__) }while(0)
37 
38 #define _hw_ckapba_ahb , 1
39 
40 #define _hwx_ckapba0(v,...) HW_E(HW_EM_XNIL(v,(ahb)))
41 #define _hwx_ckapba1(r,h,o,v,...) \
42  if ( r == 1 ) h##_write(rcc,o,0); \
43  else if ( 2*r == 1 ) h##_write(rcc,o,4); \
44  else if ( 4*r == 1 ) h##_write(rcc,o,5); \
45  else if ( 8*r == 1 ) h##_write(rcc,o,6); \
46  else if ( 16*r == 1 ) h##_write(rcc,o,7); \
47  else HWA_E(HW_EM_VAL(v,clock,(ahb, ahb/2, ahb/4, ahb/8, ahb/16))); \
48  HW_EOL(__VA_ARGS__)