Subversion Repositories svn.mios32

Rev

Rev 1180 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
87 tk 1
// $Id: mios32_irq.h 1180 2011-04-19 23:24:32Z tk $
2
/*
121 tk 3
 * This file collects all interrupt priorities and provides prototypes to
4
 * MIOS32_IRQ_* functions
87 tk 5
 *
6
 * ==========================================================================
7
 *
8
 *  Copyright (C) 2008 Thorsten Klose (tk@midibox.org)
9
 *  Licensed for personal non-commercial use only.
10
 *  All other rights reserved.
11
 *
12
 * ==========================================================================
13
 */
14
 
15
#ifndef _MIOS32_IRQ_H
16
#define _MIOS32_IRQ_H
17
 
1156 tk 18
 
87 tk 19
// we are using 4 bits for pre-emption priority, and no bits for subpriority
20
// this means: subpriority can always be set to 0, therefore no special 
1180 tk 21
// define is available for this setting
22
#define MIOS32_IRQ_PRIGROUP    (0x300)
87 tk 23
 
24
 
25
// than lower the value, than higher the priority!
26
 
27
// note that FreeRTOS allows priority level < 10 for "SysCalls"
28
// means: FreeRTOS tasks can be interrupted by level<10 IRQs
29
 
30
 
115 tk 31
// predefined user timer priorities (-> MIOS32_TIMER)
32
#define MIOS32_IRQ_PRIO_LOW       12  // lower than RTOS
33
#define MIOS32_IRQ_PRIO_MID        8  // higher than RTOS
385 tk 34
#define MIOS32_IRQ_PRIO_HIGH       5  // same like SPI, AIN, etc...
35
#define MIOS32_IRQ_PRIO_HIGHEST    4  // higher than SPI, AIN, etc...
115 tk 36
 
37
 
38
 
385 tk 39
// DMA Channel IRQ used by MIOS32_SPI
40
#define MIOS32_IRQ_SPI_DMA_PRIORITY    MIOS32_IRQ_PRIO_HIGH
87 tk 41
 
42
 
113 tk 43
// DMA Channel IRQ used by MIOS32_I2S, 
44
// period depends on sample buffer size, but usually 1..2 mS
45
// relaxed conditions (since samples are transfered in background)
800 tk 46
#define MIOS32_IRQ_I2S_DMA_PRIORITY     MIOS32_IRQ_PRIO_HIGH
113 tk 47
 
90 tk 48
// DMA Channel IRQ used by MIOS32_AIN, called after 
49
// all ADC channels have been converted
115 tk 50
#define MIOS32_IRQ_AIN_DMA_PRIORITY     MIOS32_IRQ_PRIO_HIGH
90 tk 51
 
1161 tk 52
// Shared DMA Channel IRQ used by LTC17xx port for all DMA channels!
53
#define MIOS32_IRQ_GLOBAL_DMA_PRIORITY    MIOS32_IRQ_PRIO_HIGH
90 tk 54
 
1161 tk 55
 
56
 
87 tk 57
// IIC IRQs used by MIOS32_IIC, called rarely on IIC accesses
58
// should be very high to overcome peripheral flaws (see header of mios32_iic.c)
59
// estimated requirement for "reaction time": less than 9/400 kHz = 22.5 uS
60
// EV and ER IRQ should have same priority since they are sharing resources
61
#define MIOS32_IRQ_IIC_EV_PRIORITY      2
62
#define MIOS32_IRQ_IIC_ER_PRIORITY      2
63
 
90 tk 64
 
87 tk 65
// UART IRQs used by MIOS32_UART
66
// typically called each 320 mS if full MIDI bandwidth is used
67
// priority should be high to avoid data loss
115 tk 68
#define MIOS32_IRQ_UART_PRIORITY        MIOS32_IRQ_PRIO_HIGHEST
87 tk 69
 
70
 
99 tk 71
// USB provides flow control - this interrupt can run at low priority (but higher than RTOS tasks)
72
// The interrupt is called at least each mS and takes ca. 1 uS to service the SOF (Start of Frame) flag
73
 
115 tk 74
#define MIOS32_IRQ_USB_PRIORITY         MIOS32_IRQ_PRIO_MID
99 tk 75
 
76
 
121 tk 77
 
78
/////////////////////////////////////////////////////////////////////////////
79
// Prototypes
80
/////////////////////////////////////////////////////////////////////////////
81
 
82
extern s32 MIOS32_IRQ_Disable(void);
83
extern s32 MIOS32_IRQ_Enable(void);
84
 
1179 tk 85
extern s32 MIOS32_IRQ_Install(u8 IRQn, u8 priority);
86
extern s32 MIOS32_IRQ_DeInstall(u8 IRQn);
121 tk 87
 
87 tk 88
#endif /* _MIOS32_IRQ_H */