HWA
Bare metal programming with style
cta_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 
35 #define hw_class__cta
36 
37 #define HW_BITS__cta , _hw_bits_cta
38 #define _hw_bits_cta(...) 8
39 
40 /* Return the counting register of a _cta
41  */
42 #define hw__cta_reg , _hw_cta_reg
43 #define _hw_cta_reg(o,a) HW_XOR(o,count) /* HW_CODR is blued */
44 
45 
46 #if !defined __ASSEMBLER__
47 
48 /* HWA context
49  */
50 typedef struct {
51 
52  /* Hardware registers
53  */
54  hwa_r8_t ccra ;
55  hwa_r8_t ccrb ;
56  hwa_r8_t count ;
57  hwa_r8_t imsk ;
58  hwa_r8_t ifr ;
59  hwa_r8_t ocr0 ;
60  hwa_r8_t ocr1 ;
61 
62  /* Registers used for high-level configuration
63  */
64  struct {
65  uint8_t clock, direction, top, overflow ;
66  } config ;
67 
68  /* Computed logical register values
69  */
70  struct {
71  uint8_t cs, wgm ;
72  } solved ;
73 
74  hwa_oca_t compare0 ;
75  hwa_oca_t compare1 ;
76 
77 } hwa_cta_t ;
78 
79 #endif