Subversion Repositories svn.mios32

Rev

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