OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [hal/] [arm/] [edb7xxx/] [v2_0/] [misc/] [i2s_audio_fiq.S] - Blame information for rev 174

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 unneback
// #========================================================================
2
// #
3
// #    i2s_audio_FIQ.S
4
// #
5
// #    FIQ handler for EB7209 audio stream
6
// #
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.
12
//
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.
16
//
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
20
// for more details.
21
//
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.
25
//
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.
32
//
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.
35
//
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####
42
// #
43
// # Author(s):     gthomas
44
// # Contributors:  gthomas
45
// # Date:          1999-09-10
46
// # Purpose:       Support EB7209 audio interrupts
47
// # Description:   This routine will send data to the audio FIFOs.
48
// #
49
// #####DESCRIPTIONEND####
50
// #
51
// #========================================================================
52
 
53
#include 
54
 
55
//        .file   "i2s_audio_FIQ.S"
56
 
57
        .extern cur_buf
58
        .extern next_buf
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
63
 
64
        .code   32
65
        .text
66
 
67
// Note: when handling an FIQ, registers r8-r14 are free to use
68
// since they are unique (banked).
69
 
70
        .globl  i2s_FIQ
71
i2s_FIQ:
72
 
73
        ldr     r11,=FIQ_count
74
        ldr     r12,[r11]
75
        add     r12,r12,#1
76
        str     r12,[r11]
77
 
78
        ldr     r11,=I2S_LEFT_FIFO
79
        ldr     r12,=I2S_RIGHT_FIFO
80
 
81
// Empty the record FIFOs
82
// Note: without this, the audio hardware gets stuck
83
        ldr     r13,[r11]
84
        ldr     r13,[r12]
85
        ldr     r13,[r11]
86
        ldr     r13,[r12]
87
        ldr     r13,[r11]
88
        ldr     r13,[r12]
89
        ldr     r13,[r11]
90
        ldr     r13,[r12]
91
 
92
// See if there is a buffer to play
93
        ldr     r8,=cur_buf
94
        ldr     r9,[r8,#audio_buf_length]
95
        cmp     r9,#0
96
        beq     05f
97
 
98
        ldr     r9,[r8,#audio_buf_left_ptr]
99
        ldr     r10,[r8,#audio_buf_right_ptr]
100
 
101
// Move 4 [16-bit] values to each FIFO
102
        ldrh    r13,[r9],#2
103
        str     r13,[r11]
104
        ldrh    r13,[r10],#2
105
        str     r13,[r12]
106
 
107
        ldrh    r13,[r9],#2
108
        str     r13,[r11]
109
        ldrh    r13,[r10],#2
110
        str     r13,[r12]
111
 
112
        ldrh    r13,[r9],#2
113
        str     r13,[r11]
114
        ldrh    r13,[r10],#2
115
        str     r13,[r12]
116
 
117
        ldrh    r13,[r9],#2
118
        str     r13,[r11]
119
        ldrh    r13,[r10],#2
120
        str     r13,[r12]
121
 
122
// Update pointers
123
        str     r9,[r8,#audio_buf_left_ptr]
124
        str     r10,[r8,#audio_buf_right_ptr]
125
 
126
// Update count
127
        ldr     r9,[r8,#audio_buf_length]
128
        sub     r9,r9,#4
129
        str     r9,[r8,#audio_buf_length]
130
        cmp     r9,#0
131
        bgt     10f
132
 
133
// Switch to next buffer
134
05:     ldr     r9,=next_buf
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]
141
        mov     r13,#0
142
        str     r13,[r9,#audio_buf_length]      // Free buffer
143
        cmp     r10,#0
144
        bne     10f
145
 
146
// Disable further interrupts
147
        ldr     r8,=INTMR3
148
        ldr     r9,[r8]
149
        bic     r9,r9,#INTSR3_I2SINT
150
        str     r9,[r8]
151
 
152
10:
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)
155
        ldr     r10,=0xFFF0F
156
        str     r10,[r11]
157
 
158
        subs    pc,lr,#4        // return from interrupt
159
 
160
        .global hal_disable_interrupts
161
hal_disable_interrupts:
162
        mrs     r0,cpsr                 // current state
163
        orr     r1,r0,#0x80             // mask IRQ
164
        msr     cpsr,r1
165
        bx      lr                      // exit, _old_ in r0
166
 
167
        .data
168
        .global FIQ_count
169
FIQ_count:
170
        .long   0

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.