Subversion Repositories svn.mios32


Rev 1180 | Go to most recent revision | View as "text/plain" | Blame | Compare with Previous | Last modification | View Log | RSS feed

// $Id: mios32_irq.h 1180 2011-04-19 23:24:32Z tk $
 * This file collects all interrupt priorities and provides prototypes to
 * MIOS32_IRQ_* functions
 * ==========================================================================
 *  Copyright (C) 2008 Thorsten Klose (
 *  Licensed for personal non-commercial use only.
 *  All other rights reserved.
 * ==========================================================================

#ifndef _MIOS32_IRQ_H
#define _MIOS32_IRQ_H

// we are using 4 bits for pre-emption priority, and no bits for subpriority
// this means: subpriority can always be set to 0, therefore no special
// define is available for this setting
#define MIOS32_IRQ_PRIGROUP    (0x300)

// than lower the value, than higher the priority!

// note that FreeRTOS allows priority level < 10 for "SysCalls"
// means: FreeRTOS tasks can be interrupted by level<10 IRQs

// predefined user timer priorities (-> MIOS32_TIMER)
#define MIOS32_IRQ_PRIO_LOW       12  // lower than RTOS
#define MIOS32_IRQ_PRIO_MID        8  // higher than RTOS
#define MIOS32_IRQ_PRIO_HIGH       5  // same like SPI, AIN, etc...
#define MIOS32_IRQ_PRIO_HIGHEST    4  // higher than SPI, AIN, etc...

// DMA Channel IRQ used by MIOS32_SPI

// DMA Channel IRQ used by MIOS32_I2S,
// period depends on sample buffer size, but usually 1..2 mS
// relaxed conditions (since samples are transfered in background)

// DMA Channel IRQ used by MIOS32_AIN, called after
// all ADC channels have been converted

// Shared DMA Channel IRQ used by LTC17xx port for all DMA channels!

// IIC IRQs used by MIOS32_IIC, called rarely on IIC accesses
// should be very high to overcome peripheral flaws (see header of mios32_iic.c)
// estimated requirement for "reaction time": less than 9/400 kHz = 22.5 uS
// EV and ER IRQ should have same priority since they are sharing resources
#define MIOS32_IRQ_IIC_EV_PRIORITY      2
#define MIOS32_IRQ_IIC_ER_PRIORITY      2

// UART IRQs used by MIOS32_UART
// typically called each 320 mS if full MIDI bandwidth is used
// priority should be high to avoid data loss

// USB provides flow control - this interrupt can run at low priority (but higher than RTOS tasks)
// The interrupt is called at least each mS and takes ca. 1 uS to service the SOF (Start of Frame) flag


// Prototypes

extern s32 MIOS32_IRQ_Disable(void);
extern s32 MIOS32_IRQ_Enable(void);

extern s32 MIOS32_IRQ_Install(u8 IRQn, u8 priority);
extern s32 MIOS32_IRQ_DeInstall(u8 IRQn);

#endif /* _MIOS32_IRQ_H */