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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [hal/] [arm/] [edb7xxx/] [current/] [misc/] [i2s_audio_fiq.S] - Blame information for rev 856

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 786 skrzyp
// #========================================================================
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 Free Software Foundation, 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
16
// version.
17
//
18
// eCos is distributed in the hope that it will be useful, but WITHOUT
19
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
21
// for more details.
22
//
23
// You should have received a copy of the GNU General Public License
24
// along with eCos; if not, write to the Free Software Foundation, Inc.,
25
// 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
26
//
27
// As a special exception, if other files instantiate templates or use
28
// macros or inline functions from this file, or you compile this file
29
// and link it with other works to produce a work based on this file,
30
// this file does not by itself cause the resulting work to be covered by
31
// the GNU General Public License. However the source code for this file
32
// must still be made available in accordance with section (3) of the GNU
33
// General Public License v2.
34
//
35
// This exception does not invalidate any other reasons why a work based
36
// on this file might be covered by the GNU General Public License.
37
// -------------------------------------------
38
// ####ECOSGPLCOPYRIGHTEND####
39
// #========================================================================
40
// ######DESCRIPTIONBEGIN####
41
// #
42
// # Author(s):     gthomas
43
// # Contributors:  gthomas
44
// # Date:          1999-09-10
45
// # Purpose:       Support EB7209 audio interrupts
46
// # Description:   This routine will send data to the audio FIFOs.
47
// #
48
// #####DESCRIPTIONEND####
49
// #
50
// #========================================================================
51
 
52
#include 
53
 
54
//        .file   "i2s_audio_FIQ.S"
55
 
56
        .extern cur_buf
57
        .extern next_buf
58
// These defines must mimic the data structure used by the main program
59
#define audio_buf_left_ptr   0x0
60
#define audio_buf_right_ptr  0x4
61
#define audio_buf_length     0x8
62
 
63
        .code   32
64
        .text
65
 
66
// Note: when handling an FIQ, registers r8-r14 are free to use
67
// since they are unique (banked).
68
 
69
        .globl  i2s_FIQ
70
i2s_FIQ:
71
 
72
        ldr     r11,=FIQ_count
73
        ldr     r12,[r11]
74
        add     r12,r12,#1
75
        str     r12,[r11]
76
 
77
        ldr     r11,=I2S_LEFT_FIFO
78
        ldr     r12,=I2S_RIGHT_FIFO
79
 
80
// Empty the record FIFOs
81
// Note: without this, the audio hardware gets stuck
82
        ldr     r13,[r11]
83
        ldr     r13,[r12]
84
        ldr     r13,[r11]
85
        ldr     r13,[r12]
86
        ldr     r13,[r11]
87
        ldr     r13,[r12]
88
        ldr     r13,[r11]
89
        ldr     r13,[r12]
90
 
91
// See if there is a buffer to play
92
        ldr     r8,=cur_buf
93
        ldr     r9,[r8,#audio_buf_length]
94
        cmp     r9,#0
95
        beq     05f
96
 
97
        ldr     r9,[r8,#audio_buf_left_ptr]
98
        ldr     r10,[r8,#audio_buf_right_ptr]
99
 
100
// Move 4 [16-bit] values to each FIFO
101
        ldrh    r13,[r9],#2
102
        str     r13,[r11]
103
        ldrh    r13,[r10],#2
104
        str     r13,[r12]
105
 
106
        ldrh    r13,[r9],#2
107
        str     r13,[r11]
108
        ldrh    r13,[r10],#2
109
        str     r13,[r12]
110
 
111
        ldrh    r13,[r9],#2
112
        str     r13,[r11]
113
        ldrh    r13,[r10],#2
114
        str     r13,[r12]
115
 
116
        ldrh    r13,[r9],#2
117
        str     r13,[r11]
118
        ldrh    r13,[r10],#2
119
        str     r13,[r12]
120
 
121
// Update pointers
122
        str     r9,[r8,#audio_buf_left_ptr]
123
        str     r10,[r8,#audio_buf_right_ptr]
124
 
125
// Update count
126
        ldr     r9,[r8,#audio_buf_length]
127
        sub     r9,r9,#4
128
        str     r9,[r8,#audio_buf_length]
129
        cmp     r9,#0
130
        bgt     10f
131
 
132
// Switch to next buffer
133
05:     ldr     r9,=next_buf
134
        ldr     r10,[r9,#audio_buf_left_ptr]
135
        str     r10,[r8,#audio_buf_left_ptr]
136
        ldr     r10,[r9,#audio_buf_right_ptr]
137
        str     r10,[r8,#audio_buf_right_ptr]
138
        ldr     r10,[r9,#audio_buf_length]
139
        str     r10,[r8,#audio_buf_length]
140
        mov     r13,#0
141
        str     r13,[r9,#audio_buf_length]      // Free buffer
142
        cmp     r10,#0
143
        bne     10f
144
 
145
// Disable further interrupts
146
        ldr     r8,=INTMR3
147
        ldr     r9,[r8]
148
        bic     r9,r9,#INTSR3_I2SINT
149
        str     r9,[r8]
150
 
151
10:
152
        ldr     r11,=I2S_STAT   // Clear status bits
153
//        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)
154
        ldr     r10,=0xFFF0F
155
        str     r10,[r11]
156
 
157
        subs    pc,lr,#4        // return from interrupt
158
 
159
        .global hal_disable_interrupts
160
hal_disable_interrupts:
161
        mrs     r0,cpsr                 // current state
162
        orr     r1,r0,#0x80             // mask IRQ
163
        msr     cpsr,r1
164
        bx      lr                      // exit, _old_ in r0
165
 
166
        .data
167
        .global FIQ_count
168
FIQ_count:
169
        .long   0

powered by: WebSVN 2.1.0

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