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