1 // #========================================================================
5 // # FIQ handler for EB7209 audio stream
7 // #========================================================================
8 //####ECOSGPLCOPYRIGHTBEGIN####
9 // -------------------------------------------
10 // This file is part of eCos, the Embedded Configurable Operating System.
11 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
13 // eCos is free software; you can redistribute it and/or modify it under
14 // the terms of the GNU General Public License as published by the Free
15 // Software Foundation; either version 2 or (at your option) any later version.
17 // eCos is distributed in the hope that it will be useful, but WITHOUT ANY
18 // WARRANTY; without even the implied warranty of MERCHANTABILITY or
19 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 // You should have received a copy of the GNU General Public License along
23 // with eCos; if not, write to the Free Software Foundation, Inc.,
24 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
26 // As a special exception, if other files instantiate templates or use macros
27 // or inline functions from this file, or you compile this file and link it
28 // with other works to produce a work based on this file, this file does not
29 // by itself cause the resulting work to be covered by the GNU General Public
30 // License. However the source code for this file must still be made available
31 // in accordance with section (3) of the GNU General Public License.
33 // This exception does not invalidate any other reasons why a work based on
34 // this file might be covered by the GNU General Public License.
36 // Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
37 // at http://sources.redhat.com/ecos/ecos-license/
38 // -------------------------------------------
39 //####ECOSGPLCOPYRIGHTEND####
40 // #========================================================================
41 // ######DESCRIPTIONBEGIN####
43 // # Author(s): gthomas
44 // # Contributors: gthomas
46 // # Purpose: Support EB7209 audio interrupts
47 // # Description: This routine will send data to the audio FIFOs.
49 // #####DESCRIPTIONEND####
51 // #========================================================================
53 #include <cyg/hal/hal_edb7xxx.h>
55 // .file "i2s_audio_FIQ.S"
59 // These defines must mimic the data structure used by the main program
60 #define audio_buf_left_ptr 0x0
61 #define audio_buf_right_ptr 0x4
62 #define audio_buf_length 0x8
67 // Note: when handling an FIQ, registers r8-r14 are free to use
68 // since they are unique (banked).
78 ldr r11,=I2S_LEFT_FIFO
79 ldr r12,=I2S_RIGHT_FIFO
81 // Empty the record FIFOs
82 // Note: without this, the audio hardware gets stuck
92 // See if there is a buffer to play
94 ldr r9,[r8,#audio_buf_length]
98 ldr r9,[r8,#audio_buf_left_ptr]
99 ldr r10,[r8,#audio_buf_right_ptr]
101 // Move 4 [16-bit] values to each FIFO
123 str r9,[r8,#audio_buf_left_ptr]
124 str r10,[r8,#audio_buf_right_ptr]
127 ldr r9,[r8,#audio_buf_length]
129 str r9,[r8,#audio_buf_length]
133 // Switch to next buffer
135 ldr r10,[r9,#audio_buf_left_ptr]
136 str r10,[r8,#audio_buf_left_ptr]
137 ldr r10,[r9,#audio_buf_right_ptr]
138 str r10,[r8,#audio_buf_right_ptr]
139 ldr r10,[r9,#audio_buf_length]
140 str r10,[r8,#audio_buf_length]
142 str r13,[r9,#audio_buf_length] // Free buffer
146 // Disable further interrupts
149 bic r9,r9,#INTSR3_I2SINT
153 ldr r11,=I2S_STAT // Clear status bits
154 // ldr r10,=(I2S_STAT_RCTSR|I2S_STAT_RCRS|I2S_STAT_LCTSR|I2S_STAT_LCRSR|I2S_STAT_RCTNF|I2S_STAT_RCRNE|I2S_STAT_LCTNF|I2S_STAT_LCRNE)
158 subs pc,lr,#4 // return from interrupt
160 .global hal_disable_interrupts
161 hal_disable_interrupts:
162 mrs r0,cpsr // current state
163 orr r1,r0,#0x80 // mask IRQ
165 bx lr // exit, _old_ in r0