Changeset 21aab25 in mainline


Ignore:
Timestamp:
2012-09-23T21:41:22Z (12 years ago)
Author:
Maurizio Lombardi <m.lombardi85@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a829a5b
Parents:
d085df10
Message:

am335x_irc: add functions to set/clear interrupt mask bits, improve comments.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/genarch/include/drivers/am335x_irc/am335x_irc.h

    rd085df10 r21aab25  
    5151        const uint8_t padd0[12];
    5252
     53        /* This register controls the various parameters
     54         * of the OCP interface.
     55         */
    5356        ioport32_t sysconfig;
    5457#define AM335x_IRC_SYSCONFIG_AUTOIDLE_FLAG   (1 << 0)
    5558#define AM335x_IRC_SYSCONFIG_SOFTRESET_FLAG  (1 << 1)
    5659
     60        /* This register provides status information about the module */
    5761        const ioport32_t sysstatus;
    5862#define AM335x_IRC_SYSSTATUS_RESET_DONE_FLAG (1 << 0)
     
    6064        const uint8_t padd1[40];
    6165
     66        /* This register supplies the currently active IRQ interrupt number */
    6267        ioport32_t sir_irq;
    6368#define AM335x_IRC_SIR_IRQ_ACTIVEIRQ_MASK       0x7F
    6469#define AM335x_IRC_SIR_IRQ_SPURIOUSIRQFLAG_MASK 0xFFFFFFF8
    6570
     71        /* This register supplies the currently active FIQ interrupt number */
    6672        const ioport32_t sir_fiq;
    6773#define AM335x_IRC_FIQ_IRQ_ACTIVEFIQ_MASK       0x7F
    6874#define AM335x_IRC_FIQ_IRQ_SPURIOUSFIQFLAG_MASK 0xFFFFFFF8
    6975
    70         ioport32_t control; /* New IRQ/FIQ agreement */
     76        /* This register contains the new interrupt agreement bits */
     77        ioport32_t control;
    7178#define AM335x_IRC_CONTROL_NEWIRQAGR_FLAG       (1 << 0)
    7279#define AM335x_IRC_CONTROL_NEWFIQAGR_FLAG       (1 << 1)
    7380
     81        /* This register controls protection of the other registers.
     82         * This register can only be accessed in priviledged mode, regardless
     83         * of the current value of the protection bit.
     84         */
    7485        ioport32_t protection;
    7586#define AM335x_IRC_PROTECTION_FLAG              (1 << 0)
    7687
     88        /* This register controls the clock auto-idle for the functional
     89         * clock and the input synchronizers.
     90         */
    7791        ioport32_t idle;
    7892#define AM335x_IRC_IDLE_FUNCIDLE_FLAG           (1 << 0)
     
    8195        const uint8_t padd2[12];
    8296
     97        /* This register supplies the currently active IRQ priority level */
    8398        const ioport32_t irq_priority;
    8499#define AM335x_IRC_IRQ_PRIORITY_IRQPRIORITY_MASK     0x7F
    85100#define AM335x_IRC_IRQ_PRIORITY_SPURIOUSIRQFLAG_MASK 0xFFFFFFF8
    86101
     102        /* This register supplies the currently active FIQ priority level */
    87103        const ioport32_t fiq_priority;
    88104#define AM335x_IRC_FIQ_PRIORITY_FIQPRIORITY_MASK     0x7F
    89105#define AM335x_IRC_FIQ_PRIORITY_SPURIOUSIRQFLAG_MASK 0xFFFFFFF8
    90106
     107        /* This register sets the priority threshold */
    91108        ioport32_t threshold;
    92109#define AM335x_IRC_THRESHOLD_PRIORITYTHRESHOLD_MASK     0xFF
     
    177194}
    178195
     196/** Get the currently active IRQ interrupt number
     197 *
     198 * @param regs     Pointer to the irc memory mapped registers
     199 *
     200 * @return         The active IRQ interrupt number
     201 */
     202static inline unsigned am335x_irc_inum_get(am335x_irc_regs_t *regs)
     203{
     204        return regs->sir_irq & AM335x_IRC_SIR_IRQ_ACTIVEIRQ_MASK;
     205}
     206
     207/** Reset IRQ output and enable new IRQ generation
     208 *
     209 * @param regs    Pointer to the irc memory mapped registers
     210 */
     211static inline void am335x_irc_irq_ack(am335x_irc_regs_t *regs)
     212{
     213        regs->control = AM335x_IRC_CONTROL_NEWIRQAGR_FLAG;
     214}
     215
     216/** Reset FIQ output and enable new FIQ generation
     217 *
     218 * @param regs    Pointer to the irc memory mapped registers
     219 */
     220static inline void am335x_irc_fiq_ack(am335x_irc_regs_t *regs)
     221{
     222        regs->control = AM335x_IRC_CONTROL_NEWFIQAGR_FLAG;
     223}
     224
     225/** Clear an interrupt mask bit
     226 *
     227 * @param regs    Pointer to the irc memory mapped registers
     228 * @param inum    The interrupt to be enabled
     229 */
     230static inline void am335x_irc_enable(am335x_irc_regs_t *regs, unsigned inum)
     231{
     232        ASSERT(inum < AM335x_IRC_IRQ_COUNT);
     233        const unsigned set = inum / 32;
     234        const unsigned pos = inum % 32;
     235        regs->interrupts[set].mir_clear = (1 << pos);
     236}
     237
     238/** Set an interrupt mask bit
     239 *
     240 * @param regs    Pointer to the irc memory mapped registers
     241 * @param inum    The interrupt to be disabled
     242 */
     243static inline void am335x_irc_disable(am335x_irc_regs_t *regs, unsigned inum)
     244{
     245        ASSERT(inum < AM335x_IRC_IRQ_COUNT);
     246        const unsigned set = inum / 32;
     247        const unsigned pos = inum % 32;
     248        regs->interrupts[set].mir_set = (1 << pos);
     249}
     250
    179251#endif
    180252
Note: See TracChangeset for help on using the changeset viewer.