HWA
Bare metal programming with style
usba_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 
27 #define hw_write_usbprescaler , _hw_wrusbpsc
28 #define hwa_write_usbprescaler , _hwa_wrusbpsc
29 
30 #define _hw_wrusbpsc(i,a,v,g,...) HW_B(_hwx_wrusbpsc1_,g)(_hw,v,g)
31 #define _hwa_wrusbpsc(i,a,v,g,...) HW_B(_hwx_wrusbpsc1_,g)(_hwa,v,g)
32 
33 /* Can not check that 'v' is not void since the preprocessor does not accept to
34  * concatenate '1.5'. Let's do it another way.
35  */
36 #define _hwx_wrusbpsc1_0(h,v,g) HW_E(HW_EM_G(g))
37 #define _hwx_wrusbpsc1_1(h,v,g) \
38  do{ \
39  if (v-1+1== 1) h##_write(rcc,usbpre,1); \
40  else if (v-1+1==1.5) h##_write(rcc,usbpre,0); \
41  else HWA_E(HW_EM_VL(v,(1, 1.5))); \
42  }while(0)