HWA
Bare metal programming with style
ioa_1.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 
23 #define hw_class__ioa
24 
25 #define _hw_is__ioa__ioa , 1
26 
27 #define HW_ADDRESS__ioa , _hw_adioa
28 
29 #define _hw_adioa(o,p,bn,bp,...) _hw_adioa01(hw_##p,bn,bp)
30 #define _hw_adioa01(...) _hw_adioa02(__VA_ARGS__)
31 #define _hw_adioa02(c,a,bn,bp) (((bn-1)*16+bp)*0x10000 + a)
32 
33 #define HW_BITS__ioa , _hw_bits_ioa
34 #define _hw_bits_ioa(o,p,bn,bp,...) bn
35 
36 #define HW_POSITION__ioa , _hw_position_ioa
37 #define _hw_position_ioa(o,p,bn,bp,...) bp
38 
39 
62 #define hw__ioa_ , _hw_ioa_
63 #define _hw_ioa_(o,r,p,bn,bp) _HW_B(_hw_ioa_,_hw_is_1_##bn)(o,r,p,bn,bp)
64 #define _hw_ioa_0(o,r,...) ,(o,r),HW_EM_OO(o,r)
65 #define _hw_ioa_1(o,r,p,bn,bp) _HW_B(_hw_ioa1_,_hw_isa_3bn_##r)(o,r,p,bn,bp)
66 #define _hw_ioa1_1(o,r,p,bn,bp) _ioa,p##_##bp##_##r,(p,bp,r)
67 #define _hw_ioa1_0(o,r,p,bn,bp) _hw_ioa10(o,r,p,bn,bp,hw_##p##_##bn##_##bp##_##r)
68 #define _hw_ioa10(...) _hw_ioa11(__VA_ARGS__)
69 #define _hw_ioa11(o,r,p,bn,bp,...) _HW_B(_hw_ioa2,_hw_isa_reg_##__VA_ARGS__)(o,r,p,bn,bp,__VA_ARGS__)
70 #define _hw_ioa21(o,r,p,bn,bp,cr,...) HW_OXR(cr,r,__VA_ARGS__,_ioa,o,__VA_ARGS__)
71 
72 #define _hw_ioa20(o,r,p,bn,bp,...) _hw_ioa22(o,r,p,bn,bp,HW_XO(__VA_ARGS__))
73 #define _hw_ioa22(...) _hw_ioa23(__VA_ARGS__)
74 #define _hw_ioa23(o,r,p,bn,bp,x,...) _HW_B(_hw_ioa23,x)(o,r,p,bn,bp,x,__VA_ARGS__)
75 #define _hw_ioa231(o,r,p,bn,bp,...) ,(o),HW_EM_OO(o,r)
76 #define _hw_ioa230(o,r,p,bn,bp,...) __VA_ARGS__
77 
78 #define hw__ioa_port , _hw_ioa_port
79 #define _hw_ioa_port(o,p,...) _hw_ioa_port1(p,hw_##p)
80 #define _hw_ioa_port1(...) _hw_ioa_port2(__VA_ARGS__)
81 #define _hw_ioa_port2(p,c,...) c,p,(__VA_ARGS__)