| 1 | /*
|
|---|
| 2 | * Copyright (c) 2012 Maurizio Lombardi
|
|---|
| 3 | * All rights reserved.
|
|---|
| 4 | *
|
|---|
| 5 | * Redistribution and use in source and binary forms, with or without
|
|---|
| 6 | * modification, are permitted provided that the following conditions
|
|---|
| 7 | * are met:
|
|---|
| 8 | *
|
|---|
| 9 | * - Redistributions of source code must retain the above copyright
|
|---|
| 10 | * notice, this list of conditions and the following disclaimer.
|
|---|
| 11 | * - Redistributions in binary form must reproduce the above copyright
|
|---|
| 12 | * notice, this list of conditions and the following disclaimer in the
|
|---|
| 13 | * documentation and/or other materials provided with the distribution.
|
|---|
| 14 | * - The name of the author may not be used to endorse or promote products
|
|---|
| 15 | * derived from this software without specific prior written permission.
|
|---|
| 16 | *
|
|---|
| 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|---|
| 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|---|
| 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|---|
| 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|---|
| 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|---|
| 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|---|
| 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|---|
| 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|---|
| 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|---|
| 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|---|
| 27 | */
|
|---|
| 28 | /** @addtogroup genarch
|
|---|
| 29 | * @{
|
|---|
| 30 | */
|
|---|
| 31 | /**
|
|---|
| 32 | * @file
|
|---|
| 33 | * @brief Texas Instruments AM335x DMTIMER memory mapped registers.
|
|---|
| 34 | */
|
|---|
| 35 |
|
|---|
| 36 | #ifndef _KERN_AM335X_TIMER_REGS_H_
|
|---|
| 37 | #define _KERN_AM335X_TIMER_REGS_H_
|
|---|
| 38 |
|
|---|
| 39 | #include <typedefs.h>
|
|---|
| 40 |
|
|---|
| 41 | typedef struct am335x_timer_regs {
|
|---|
| 42 |
|
|---|
| 43 | /* This read only register contains the
|
|---|
| 44 | * revision number of the module
|
|---|
| 45 | */
|
|---|
| 46 | ioport32_t const tidr;
|
|---|
| 47 | #define AM335x_TIMER_TIDR_MINOR_MASK 0x3F
|
|---|
| 48 | #define AM335x_TIMER_TIDR_MINOR_SHIFT 0
|
|---|
| 49 | #define AM335x_TIMER_TIDR_CUSTOM_MASK 0x03
|
|---|
| 50 | #define AM335x_TIMER_TIDR_CUSTOM_SHIFT 6
|
|---|
| 51 | #define AM335x_TIMER_TIDR_MAJOR_MASK 0x07
|
|---|
| 52 | #define AM335x_TIMER_TIDR_MAJOR_SHIFT 8
|
|---|
| 53 | #define AM335x_TIMER_TIDR_RTL_MASK 0x1F
|
|---|
| 54 | #define AM335x_TIMER_TIDR_RTL_SHIFT 11
|
|---|
| 55 | #define AM335x_TIMER_TIDR_FUNC_MASK 0xFFF
|
|---|
| 56 | #define AM335x_TIMER_TIDR_FUNC_SHIFT 16
|
|---|
| 57 | #define AM335x_TIMER_TIDR_SCHEME_MASK 0x03
|
|---|
| 58 | #define AM335x_TIMER_TIDR_SCHEME_SHIFT 30
|
|---|
| 59 |
|
|---|
| 60 | ioport32_t const pad1[3];
|
|---|
| 61 |
|
|---|
| 62 | /* This register allows controlling various
|
|---|
| 63 | * parameters of the OCP interface.
|
|---|
| 64 | */
|
|---|
| 65 | ioport32_t tiocp_cfg;
|
|---|
| 66 | #define AM335x_TIMER_TIOCPCFG_SOFTRESET_FLAG (1 << 0)
|
|---|
| 67 | #define AM335x_TIMER_TIOCPCFG_EMUFREE_FLAG (1 << 1)
|
|---|
| 68 |
|
|---|
| 69 | #define AM335x_TIMER_TIOCPCFG_IDLEMODE_MASK 0x02
|
|---|
| 70 | #define AM335x_TIMER_TIOCPCFG_IDLEMODE_SHIFT 2
|
|---|
| 71 | # define AM335x_TIMER_TIOCCPCFG_IDLEMODE_FORCE 0x00
|
|---|
| 72 | # define AM335x_TIMER_TIOCCPCFG_IDLEMODE_DISABLED 0x01
|
|---|
| 73 | # define AM335x_TIMER_TIOCCPCFG_IDLEMODE_SMART 0x02
|
|---|
| 74 | # define AM335x_TIMER_TIOCCPCFG_IDLEMODE_SMART_WAKEUP 0x03
|
|---|
| 75 |
|
|---|
| 76 | ioport32_t const pad2[4];
|
|---|
| 77 |
|
|---|
| 78 | ioport32_t irqstatus_raw;
|
|---|
| 79 | #define AM335x_TIMER_IRQSTATUS_RAW_MAT_FLAG (1 << 0)
|
|---|
| 80 | #define AM335x_TIMER_IRQSTATUS_RAW_OVF_FLAG (1 << 1)
|
|---|
| 81 | #define AM335x_TIMER_IRQSTATUS_RAW_TCAR_FLAG (1 << 2)
|
|---|
| 82 |
|
|---|
| 83 | ioport32_t irqstatus;
|
|---|
| 84 | #define AM335x_TIMER_IRQSTATUS_MAT_FLAG (1 << 0)
|
|---|
| 85 | #define AM335x_TIMER_IRQSTATUS_OVF_FLAG (1 << 1)
|
|---|
| 86 | #define AM335x_TIMER_IRQSTATUS_TCAR_FLAG (1 << 2)
|
|---|
| 87 |
|
|---|
| 88 | ioport32_t irqenable_set;
|
|---|
| 89 | #define AM335x_TIMER_IRQENABLE_SET_MAT_FLAG (1 << 0)
|
|---|
| 90 | #define AM335x_TIMER_IRQENABLE_SET_OVF_FLAG (1 << 1)
|
|---|
| 91 | #define AM335x_TIMER_IRQENABLE_SET_TCAR_FLAG (1 << 2)
|
|---|
| 92 |
|
|---|
| 93 | ioport32_t irqenable_clr;
|
|---|
| 94 | #define AM335x_TIMER_IRQENABLE_CLR_MAT_FLAG (1 << 0)
|
|---|
| 95 | #define AM335x_TIMER_IRQENABLE_CLR_OVF_FLAG (1 << 1)
|
|---|
| 96 | #define AM335x_TIMER_IRQENABLE_CLR_TCAR_FLAG (1 << 2)
|
|---|
| 97 |
|
|---|
| 98 | /* Timer IRQ wakeup enable register */
|
|---|
| 99 | ioport32_t irqwakeen;
|
|---|
| 100 | #define AM335x_TIMER_IRQWAKEEN_MAT_FLAG (1 << 0)
|
|---|
| 101 | #define AM335x_TIMER_IRQWAKEEN_PVF_FLAG (1 << 1)
|
|---|
| 102 | #define AM335x_TIMER_IRQWAKEEN_TCAR_FLAG (1 << 2)
|
|---|
| 103 |
|
|---|
| 104 | /* Timer control register */
|
|---|
| 105 | ioport32_t tclr;
|
|---|
| 106 | #define AM335x_TIMER_TCLR_ST_FLAG (1 << 0)
|
|---|
| 107 | #define AM335x_TIMER_TCLR_AR_FLAG (1 << 1)
|
|---|
| 108 | #define AM335x_TIMER_TCLR_PTV_MASK 0x07
|
|---|
| 109 | #define AM335x_TIMER_TCLR_PTV_SHIFT 2
|
|---|
| 110 | #define AM335x_TIMER_TCLR_PRE_FLAG (1 << 5)
|
|---|
| 111 | #define AM335x_TIMER_TCLR_CE_FLAG (1 << 6)
|
|---|
| 112 | #define AM335x_TIMER_TCLR_SCPWM_FLAG (1 << 7)
|
|---|
| 113 | #define AM335x_TIMER_TCLR_TCM_MASK 0x03
|
|---|
| 114 | #define AM335x_TIMER_TCLR_TCM_SHIFT 8
|
|---|
| 115 | #define AM335x_TIMER_TCLR_TGR_MASK 0x03
|
|---|
| 116 | #define AM335x_TIMER_TCLR_TGR_SHIFT 10
|
|---|
| 117 | #define AM335x_TIMER_TCLR_PT_FLAG (1 << 12)
|
|---|
| 118 | #define AM335x_TIMER_TCLR_CAPT_MODE_FLAG (1 << 13)
|
|---|
| 119 | #define AM335x_TIMER_TCLR_GPO_CFG_FLAG (1 << 14)
|
|---|
| 120 |
|
|---|
| 121 | /* Timer counter register */
|
|---|
| 122 | ioport32_t tcrr;
|
|---|
| 123 |
|
|---|
| 124 | /* Timer load register */
|
|---|
| 125 | ioport32_t tldr;
|
|---|
| 126 |
|
|---|
| 127 | /* Timer trigger register */
|
|---|
| 128 | ioport32_t const ttgr;
|
|---|
| 129 |
|
|---|
| 130 | /* Timer write posted status register */
|
|---|
| 131 | ioport32_t twps;
|
|---|
| 132 | #define AM335x_TIMER_TWPS_PEND_TCLR (1 << 0)
|
|---|
| 133 | #define AM335x_TIMER_TWPS_PEND_TCRR (1 << 1)
|
|---|
| 134 | #define AM335x_TIMER_TWPS_PEND_TLDR (1 << 2)
|
|---|
| 135 | #define AM335x_TIMER_TWPS_PEND_TTGR (1 << 3)
|
|---|
| 136 | #define AM335x_TIMER_TWPS_PEND_TMAR (1 << 4)
|
|---|
| 137 |
|
|---|
| 138 | /* Timer match register */
|
|---|
| 139 | ioport32_t tmar;
|
|---|
| 140 |
|
|---|
| 141 | /* Timer capture register */
|
|---|
| 142 | ioport32_t tcar1;
|
|---|
| 143 |
|
|---|
| 144 | /* Timer synchronous interface control register */
|
|---|
| 145 | ioport32_t tsicr;
|
|---|
| 146 | #define AM335x_TIMER_TSICR_SFT_FLAG (1 << 1)
|
|---|
| 147 | #define AM335x_TIMER_TSICR_POSTED_FLAG (1 << 2)
|
|---|
| 148 |
|
|---|
| 149 | /* Timer capture register */
|
|---|
| 150 | ioport32_t tcar2;
|
|---|
| 151 |
|
|---|
| 152 | } am335x_timer_regs_t;
|
|---|
| 153 |
|
|---|
| 154 | #endif
|
|---|
| 155 |
|
|---|
| 156 | /**
|
|---|
| 157 | * @}
|
|---|
| 158 | */
|
|---|
| 159 |
|
|---|