| 1 | /*
|
|---|
| 2 | * Copyright (c) 2010 Jiri Svoboda
|
|---|
| 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 |
|
|---|
| 29 | /** @addtogroup genarch
|
|---|
| 30 | * @{
|
|---|
| 31 | */
|
|---|
| 32 | /**
|
|---|
| 33 | * @file
|
|---|
| 34 | * @brief Samsung S3C24xx on-chip PWM timer driver.
|
|---|
| 35 | */
|
|---|
| 36 |
|
|---|
| 37 | #ifndef KERN_S3C24XX_TIMER_H_
|
|---|
| 38 | #define KERN_S3C24XX_TIMER_H_
|
|---|
| 39 |
|
|---|
| 40 | #include <typedefs.h>
|
|---|
| 41 |
|
|---|
| 42 | /** Physical address where S3C24XX on-chip PWM timer is mapped */
|
|---|
| 43 | #define S3C24XX_TIMER_ADDRESS 0x51000000
|
|---|
| 44 |
|
|---|
| 45 | /** S3C24xx on-chip PWM timer registers */
|
|---|
| 46 | typedef struct {
|
|---|
| 47 | ioport32_t tcfg0; /**< Timer configuration register 0 */
|
|---|
| 48 | ioport32_t tcfg1; /**< Timer configuration register 1 */
|
|---|
| 49 | ioport32_t tcon; /**< Timer control register */
|
|---|
| 50 |
|
|---|
| 51 | struct {
|
|---|
| 52 | ioport32_t cntb; /**< Count buffer register */
|
|---|
| 53 | ioport32_t cmpb; /**< Compare buffer register */
|
|---|
| 54 | ioport32_t cnto; /**< Count observation register */
|
|---|
| 55 | } timer[5];
|
|---|
| 56 | } s3c24xx_timer_t;
|
|---|
| 57 |
|
|---|
| 58 | /** Bits in the S3C24xx PWM timer TCON register. */
|
|---|
| 59 | enum s3c24xx_tcon_bits {
|
|---|
| 60 | TCON_T0_START = (1 << 0), /**< Timer 0 start */
|
|---|
| 61 | TCON_T0_MUPDATE = (1 << 1), /**< Timer 0 manual update */
|
|---|
| 62 | TCON_T0_INVERT = (1 << 2), /**< Timer 0 inverter on */
|
|---|
| 63 | TCON_T0_AUTO_RLD = (1 << 3), /**< Timer 0 auto reload */
|
|---|
| 64 |
|
|---|
| 65 | TCON_DEAD_ZONE = (1 << 4), /**< Dead zone enable */
|
|---|
| 66 |
|
|---|
| 67 | TCON_T1_START = (1 << 8), /**< Timer 1 start */
|
|---|
| 68 | TCON_T1_MUPDATE = (1 << 9), /**< Timer 1 manual update */
|
|---|
| 69 | TCON_T1_INVERT = (1 << 10), /**< Timer 1 inverter on */
|
|---|
| 70 | TCON_T1_AUTO_RLD = (1 << 11), /**< Timer 1 auto reload */
|
|---|
| 71 |
|
|---|
| 72 | TCON_T2_START = (1 << 12), /**< Timer 2 start */
|
|---|
| 73 | TCON_T2_MUPDATE = (1 << 13), /**< Timer 2 manual update */
|
|---|
| 74 | TCON_T2_INVERT = (1 << 14), /**< Timer 2 inverter on */
|
|---|
| 75 | TCON_T2_AUTO_RLD = (1 << 15), /**< Timer 2 auto reload */
|
|---|
| 76 |
|
|---|
| 77 | TCON_T3_START = (1 << 16), /**< Timer 3 start */
|
|---|
| 78 | TCON_T3_MUPDATE = (1 << 17), /**< Timer 3 manual update */
|
|---|
| 79 | TCON_T3_INVERT = (1 << 18), /**< Timer 3 inverter on */
|
|---|
| 80 | TCON_T3_AUTO_RLD = (1 << 19), /**< Timer 3 auto reload */
|
|---|
| 81 |
|
|---|
| 82 | TCON_T4_START = (1 << 20), /**< Timer 4 start */
|
|---|
| 83 | TCON_T4_MUPDATE = (1 << 21), /**< Timer 4 manual update */
|
|---|
| 84 | TCON_T4_AUTO_RLD = (1 << 22) /**< Timer 4 auto reload */
|
|---|
| 85 | };
|
|---|
| 86 |
|
|---|
| 87 | #endif
|
|---|
| 88 |
|
|---|
| 89 | /** @}
|
|---|
| 90 | */
|
|---|