Subversion Repositories svn.mios32

Rev

Rev 385 | Rev 1156 | 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 800 2009-12-22 23:44:00Z 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
 
18
// we are using 4 bits for pre-emption priority, and no bits for subpriority
19
// this means: subpriority can always be set to 0, therefore no special 
20
// define is available for thi setting
21
#define MIOS32_IRQ_PRIGROUP    NVIC_PriorityGroup_4
22
 
23
 
24
// than lower the value, than higher the priority!
25
 
26
// note that FreeRTOS allows priority level < 10 for "SysCalls"
27
// means: FreeRTOS tasks can be interrupted by level<10 IRQs
28
 
29
 
115 tk 30
// predefined user timer priorities (-> MIOS32_TIMER)
31
#define MIOS32_IRQ_PRIO_LOW       12  // lower than RTOS
32
#define MIOS32_IRQ_PRIO_MID        8  // higher than RTOS
385 tk 33
#define MIOS32_IRQ_PRIO_HIGH       5  // same like SPI, AIN, etc...
34
#define MIOS32_IRQ_PRIO_HIGHEST    4  // higher than SPI, AIN, etc...
115 tk 35
 
36
 
37
 
385 tk 38
// DMA Channel IRQ used by MIOS32_SPI
39
#define MIOS32_IRQ_SPI_DMA_PRIORITY    MIOS32_IRQ_PRIO_HIGH
87 tk 40
 
41
 
113 tk 42
// DMA Channel IRQ used by MIOS32_I2S, 
43
// period depends on sample buffer size, but usually 1..2 mS
44
// relaxed conditions (since samples are transfered in background)
800 tk 45
#define MIOS32_IRQ_I2S_DMA_PRIORITY     MIOS32_IRQ_PRIO_HIGH
113 tk 46
 
90 tk 47
// DMA Channel IRQ used by MIOS32_AIN, called after 
48
// all ADC channels have been converted
115 tk 49
#define MIOS32_IRQ_AIN_DMA_PRIORITY     MIOS32_IRQ_PRIO_HIGH
90 tk 50
 
51
 
87 tk 52
// IIC IRQs used by MIOS32_IIC, called rarely on IIC accesses
53
// should be very high to overcome peripheral flaws (see header of mios32_iic.c)
54
// estimated requirement for "reaction time": less than 9/400 kHz = 22.5 uS
55
// EV and ER IRQ should have same priority since they are sharing resources
56
#define MIOS32_IRQ_IIC_EV_PRIORITY      2
57
#define MIOS32_IRQ_IIC_ER_PRIORITY      2
58
 
90 tk 59
 
87 tk 60
// UART IRQs used by MIOS32_UART
61
// typically called each 320 mS if full MIDI bandwidth is used
62
// priority should be high to avoid data loss
115 tk 63
#define MIOS32_IRQ_UART_PRIORITY        MIOS32_IRQ_PRIO_HIGHEST
87 tk 64
 
65
 
99 tk 66
// USB provides flow control - this interrupt can run at low priority (but higher than RTOS tasks)
67
// The interrupt is called at least each mS and takes ca. 1 uS to service the SOF (Start of Frame) flag
68
 
115 tk 69
#define MIOS32_IRQ_USB_PRIORITY         MIOS32_IRQ_PRIO_MID
99 tk 70
 
71
 
121 tk 72
 
73
/////////////////////////////////////////////////////////////////////////////
74
// Prototypes
75
/////////////////////////////////////////////////////////////////////////////
76
 
77
extern s32 MIOS32_IRQ_Disable(void);
78
extern s32 MIOS32_IRQ_Enable(void);
79
 
80
 
87 tk 81
#endif /* _MIOS32_IRQ_H */