Statistics
| Branch: | Revision:

root / hw / sh_serial.c @ 9bfa659e

History | View | Annotate | Download (10.4 kB)

1 2f062c72 ths
/*
2 2f062c72 ths
 * QEMU SCI/SCIF serial port emulation
3 2f062c72 ths
 *
4 2f062c72 ths
 * Copyright (c) 2007 Magnus Damm
5 2f062c72 ths
 *
6 2f062c72 ths
 * Based on serial.c - QEMU 16450 UART emulation
7 2f062c72 ths
 * Copyright (c) 2003-2004 Fabrice Bellard
8 2f062c72 ths
 *
9 2f062c72 ths
 * Permission is hereby granted, free of charge, to any person obtaining a copy
10 2f062c72 ths
 * of this software and associated documentation files (the "Software"), to deal
11 2f062c72 ths
 * in the Software without restriction, including without limitation the rights
12 2f062c72 ths
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 2f062c72 ths
 * copies of the Software, and to permit persons to whom the Software is
14 2f062c72 ths
 * furnished to do so, subject to the following conditions:
15 2f062c72 ths
 *
16 2f062c72 ths
 * The above copyright notice and this permission notice shall be included in
17 2f062c72 ths
 * all copies or substantial portions of the Software.
18 2f062c72 ths
 *
19 2f062c72 ths
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 2f062c72 ths
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 2f062c72 ths
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 2f062c72 ths
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 2f062c72 ths
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 2f062c72 ths
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 2f062c72 ths
 * THE SOFTWARE.
26 2f062c72 ths
 */
27 87ecb68b pbrook
#include "hw.h"
28 87ecb68b pbrook
#include "sh.h"
29 87ecb68b pbrook
#include "qemu-char.h"
30 9a9d0b81 Benoît Canet
#include "exec-memory.h"
31 2f062c72 ths
32 2f062c72 ths
//#define DEBUG_SERIAL
33 2f062c72 ths
34 2f062c72 ths
#define SH_SERIAL_FLAG_TEND (1 << 0)
35 2f062c72 ths
#define SH_SERIAL_FLAG_TDE  (1 << 1)
36 2f062c72 ths
#define SH_SERIAL_FLAG_RDF  (1 << 2)
37 2f062c72 ths
#define SH_SERIAL_FLAG_BRK  (1 << 3)
38 2f062c72 ths
#define SH_SERIAL_FLAG_DR   (1 << 4)
39 2f062c72 ths
40 63242a00 aurel32
#define SH_RX_FIFO_LENGTH (16)
41 63242a00 aurel32
42 2f062c72 ths
typedef struct {
43 9a9d0b81 Benoît Canet
    MemoryRegion iomem;
44 9a9d0b81 Benoît Canet
    MemoryRegion iomem_p4;
45 9a9d0b81 Benoît Canet
    MemoryRegion iomem_a7;
46 2f062c72 ths
    uint8_t smr;
47 2f062c72 ths
    uint8_t brr;
48 2f062c72 ths
    uint8_t scr;
49 2f062c72 ths
    uint8_t dr; /* ftdr / tdr */
50 2f062c72 ths
    uint8_t sr; /* fsr / ssr */
51 2f062c72 ths
    uint16_t fcr;
52 2f062c72 ths
    uint8_t sptr;
53 2f062c72 ths
54 63242a00 aurel32
    uint8_t rx_fifo[SH_RX_FIFO_LENGTH]; /* frdr / rdr */
55 2f062c72 ths
    uint8_t rx_cnt;
56 63242a00 aurel32
    uint8_t rx_tail;
57 63242a00 aurel32
    uint8_t rx_head;
58 2f062c72 ths
59 2f062c72 ths
    int freq;
60 2f062c72 ths
    int feat;
61 2f062c72 ths
    int flags;
62 63242a00 aurel32
    int rtrg;
63 2f062c72 ths
64 2f062c72 ths
    CharDriverState *chr;
65 bf5b7423 aurel32
66 4e7ed2d1 aurel32
    qemu_irq eri;
67 4e7ed2d1 aurel32
    qemu_irq rxi;
68 4e7ed2d1 aurel32
    qemu_irq txi;
69 4e7ed2d1 aurel32
    qemu_irq tei;
70 4e7ed2d1 aurel32
    qemu_irq bri;
71 2f062c72 ths
} sh_serial_state;
72 2f062c72 ths
73 63242a00 aurel32
static void sh_serial_clear_fifo(sh_serial_state * s)
74 63242a00 aurel32
{
75 63242a00 aurel32
    memset(s->rx_fifo, 0, SH_RX_FIFO_LENGTH);
76 63242a00 aurel32
    s->rx_cnt = 0;
77 63242a00 aurel32
    s->rx_head = 0;
78 63242a00 aurel32
    s->rx_tail = 0;
79 63242a00 aurel32
}
80 63242a00 aurel32
81 9a9d0b81 Benoît Canet
static void sh_serial_write(void *opaque, target_phys_addr_t offs,
82 9a9d0b81 Benoît Canet
                            uint64_t val, unsigned size)
83 2f062c72 ths
{
84 2f062c72 ths
    sh_serial_state *s = opaque;
85 2f062c72 ths
    unsigned char ch;
86 2f062c72 ths
87 2f062c72 ths
#ifdef DEBUG_SERIAL
88 8da3ff18 pbrook
    printf("sh_serial: write offs=0x%02x val=0x%02x\n",
89 8da3ff18 pbrook
           offs, val);
90 2f062c72 ths
#endif
91 2f062c72 ths
    switch(offs) {
92 2f062c72 ths
    case 0x00: /* SMR */
93 2f062c72 ths
        s->smr = val & ((s->feat & SH_SERIAL_FEAT_SCIF) ? 0x7b : 0xff);
94 2f062c72 ths
        return;
95 2f062c72 ths
    case 0x04: /* BRR */
96 2f062c72 ths
        s->brr = val;
97 2f062c72 ths
        return;
98 2f062c72 ths
    case 0x08: /* SCR */
99 63242a00 aurel32
        /* TODO : For SH7751, SCIF mask should be 0xfb. */
100 bf5b7423 aurel32
        s->scr = val & ((s->feat & SH_SERIAL_FEAT_SCIF) ? 0xfa : 0xff);
101 2f062c72 ths
        if (!(val & (1 << 5)))
102 2f062c72 ths
            s->flags |= SH_SERIAL_FLAG_TEND;
103 bf5b7423 aurel32
        if ((s->feat & SH_SERIAL_FEAT_SCIF) && s->txi) {
104 4e7ed2d1 aurel32
            qemu_set_irq(s->txi, val & (1 << 7));
105 bf5b7423 aurel32
        }
106 4e7ed2d1 aurel32
        if (!(val & (1 << 6))) {
107 4e7ed2d1 aurel32
            qemu_set_irq(s->rxi, 0);
108 63242a00 aurel32
        }
109 2f062c72 ths
        return;
110 2f062c72 ths
    case 0x0c: /* FTDR / TDR */
111 2f062c72 ths
        if (s->chr) {
112 2f062c72 ths
            ch = val;
113 2cc6e0a1 Anthony Liguori
            qemu_chr_fe_write(s->chr, &ch, 1);
114 2f062c72 ths
        }
115 2f062c72 ths
        s->dr = val;
116 2f062c72 ths
        s->flags &= ~SH_SERIAL_FLAG_TDE;
117 2f062c72 ths
        return;
118 2f062c72 ths
#if 0
119 2f062c72 ths
    case 0x14: /* FRDR / RDR */
120 2f062c72 ths
        ret = 0;
121 2f062c72 ths
        break;
122 2f062c72 ths
#endif
123 2f062c72 ths
    }
124 2f062c72 ths
    if (s->feat & SH_SERIAL_FEAT_SCIF) {
125 2f062c72 ths
        switch(offs) {
126 2f062c72 ths
        case 0x10: /* FSR */
127 2f062c72 ths
            if (!(val & (1 << 6)))
128 2f062c72 ths
                s->flags &= ~SH_SERIAL_FLAG_TEND;
129 2f062c72 ths
            if (!(val & (1 << 5)))
130 2f062c72 ths
                s->flags &= ~SH_SERIAL_FLAG_TDE;
131 2f062c72 ths
            if (!(val & (1 << 4)))
132 2f062c72 ths
                s->flags &= ~SH_SERIAL_FLAG_BRK;
133 2f062c72 ths
            if (!(val & (1 << 1)))
134 2f062c72 ths
                s->flags &= ~SH_SERIAL_FLAG_RDF;
135 2f062c72 ths
            if (!(val & (1 << 0)))
136 2f062c72 ths
                s->flags &= ~SH_SERIAL_FLAG_DR;
137 63242a00 aurel32
138 63242a00 aurel32
            if (!(val & (1 << 1)) || !(val & (1 << 0))) {
139 4e7ed2d1 aurel32
                if (s->rxi) {
140 4e7ed2d1 aurel32
                    qemu_set_irq(s->rxi, 0);
141 63242a00 aurel32
                }
142 63242a00 aurel32
            }
143 2f062c72 ths
            return;
144 2f062c72 ths
        case 0x18: /* FCR */
145 2f062c72 ths
            s->fcr = val;
146 63242a00 aurel32
            switch ((val >> 6) & 3) {
147 63242a00 aurel32
            case 0:
148 63242a00 aurel32
                s->rtrg = 1;
149 63242a00 aurel32
                break;
150 63242a00 aurel32
            case 1:
151 63242a00 aurel32
                s->rtrg = 4;
152 63242a00 aurel32
                break;
153 63242a00 aurel32
            case 2:
154 63242a00 aurel32
                s->rtrg = 8;
155 63242a00 aurel32
                break;
156 63242a00 aurel32
            case 3:
157 63242a00 aurel32
                s->rtrg = 14;
158 63242a00 aurel32
                break;
159 63242a00 aurel32
            }
160 63242a00 aurel32
            if (val & (1 << 1)) {
161 63242a00 aurel32
                sh_serial_clear_fifo(s);
162 63242a00 aurel32
                s->sr &= ~(1 << 1);
163 63242a00 aurel32
            }
164 63242a00 aurel32
165 2f062c72 ths
            return;
166 2f062c72 ths
        case 0x20: /* SPTR */
167 63242a00 aurel32
            s->sptr = val & 0xf3;
168 2f062c72 ths
            return;
169 2f062c72 ths
        case 0x24: /* LSR */
170 2f062c72 ths
            return;
171 2f062c72 ths
        }
172 2f062c72 ths
    }
173 2f062c72 ths
    else {
174 2f062c72 ths
        switch(offs) {
175 d1f193b0 aurel32
#if 0
176 2f062c72 ths
        case 0x0c:
177 2f062c72 ths
            ret = s->dr;
178 2f062c72 ths
            break;
179 2f062c72 ths
        case 0x10:
180 2f062c72 ths
            ret = 0;
181 2f062c72 ths
            break;
182 d1f193b0 aurel32
#endif
183 2f062c72 ths
        case 0x1c:
184 d1f193b0 aurel32
            s->sptr = val & 0x8f;
185 d1f193b0 aurel32
            return;
186 2f062c72 ths
        }
187 2f062c72 ths
    }
188 2f062c72 ths
189 c1950a4e Peter Maydell
    fprintf(stderr, "sh_serial: unsupported write to 0x%02"
190 c1950a4e Peter Maydell
            TARGET_PRIxPHYS "\n", offs);
191 43dc2a64 Blue Swirl
    abort();
192 2f062c72 ths
}
193 2f062c72 ths
194 9a9d0b81 Benoît Canet
static uint64_t sh_serial_read(void *opaque, target_phys_addr_t offs,
195 9a9d0b81 Benoît Canet
                               unsigned size)
196 2f062c72 ths
{
197 2f062c72 ths
    sh_serial_state *s = opaque;
198 2f062c72 ths
    uint32_t ret = ~0;
199 2f062c72 ths
200 2f062c72 ths
#if 0
201 2f062c72 ths
    switch(offs) {
202 2f062c72 ths
    case 0x00:
203 2f062c72 ths
        ret = s->smr;
204 2f062c72 ths
        break;
205 2f062c72 ths
    case 0x04:
206 2f062c72 ths
        ret = s->brr;
207 2f062c72 ths
        break;
208 2f062c72 ths
    case 0x08:
209 2f062c72 ths
        ret = s->scr;
210 2f062c72 ths
        break;
211 2f062c72 ths
    case 0x14:
212 2f062c72 ths
        ret = 0;
213 2f062c72 ths
        break;
214 2f062c72 ths
    }
215 2f062c72 ths
#endif
216 2f062c72 ths
    if (s->feat & SH_SERIAL_FEAT_SCIF) {
217 2f062c72 ths
        switch(offs) {
218 bf5b7423 aurel32
        case 0x00: /* SMR */
219 bf5b7423 aurel32
            ret = s->smr;
220 bf5b7423 aurel32
            break;
221 bf5b7423 aurel32
        case 0x08: /* SCR */
222 bf5b7423 aurel32
            ret = s->scr;
223 bf5b7423 aurel32
            break;
224 2f062c72 ths
        case 0x10: /* FSR */
225 2f062c72 ths
            ret = 0;
226 2f062c72 ths
            if (s->flags & SH_SERIAL_FLAG_TEND)
227 2f062c72 ths
                ret |= (1 << 6);
228 2f062c72 ths
            if (s->flags & SH_SERIAL_FLAG_TDE)
229 2f062c72 ths
                ret |= (1 << 5);
230 2f062c72 ths
            if (s->flags & SH_SERIAL_FLAG_BRK)
231 2f062c72 ths
                ret |= (1 << 4);
232 2f062c72 ths
            if (s->flags & SH_SERIAL_FLAG_RDF)
233 2f062c72 ths
                ret |= (1 << 1);
234 2f062c72 ths
            if (s->flags & SH_SERIAL_FLAG_DR)
235 2f062c72 ths
                ret |= (1 << 0);
236 2f062c72 ths
237 63242a00 aurel32
            if (s->scr & (1 << 5))
238 2f062c72 ths
                s->flags |= SH_SERIAL_FLAG_TDE | SH_SERIAL_FLAG_TEND;
239 2f062c72 ths
240 2f062c72 ths
            break;
241 63242a00 aurel32
        case 0x14:
242 63242a00 aurel32
            if (s->rx_cnt > 0) {
243 63242a00 aurel32
                ret = s->rx_fifo[s->rx_tail++];
244 63242a00 aurel32
                s->rx_cnt--;
245 63242a00 aurel32
                if (s->rx_tail == SH_RX_FIFO_LENGTH)
246 63242a00 aurel32
                    s->rx_tail = 0;
247 63242a00 aurel32
                if (s->rx_cnt < s->rtrg)
248 63242a00 aurel32
                    s->flags &= ~SH_SERIAL_FLAG_RDF;
249 63242a00 aurel32
            }
250 63242a00 aurel32
            break;
251 2f062c72 ths
#if 0
252 2f062c72 ths
        case 0x18:
253 2f062c72 ths
            ret = s->fcr;
254 2f062c72 ths
            break;
255 2f062c72 ths
#endif
256 2f062c72 ths
        case 0x1c:
257 2f062c72 ths
            ret = s->rx_cnt;
258 2f062c72 ths
            break;
259 2f062c72 ths
        case 0x20:
260 2f062c72 ths
            ret = s->sptr;
261 2f062c72 ths
            break;
262 2f062c72 ths
        case 0x24:
263 2f062c72 ths
            ret = 0;
264 2f062c72 ths
            break;
265 2f062c72 ths
        }
266 2f062c72 ths
    }
267 2f062c72 ths
    else {
268 2f062c72 ths
        switch(offs) {
269 d1f193b0 aurel32
#if 0
270 2f062c72 ths
        case 0x0c:
271 2f062c72 ths
            ret = s->dr;
272 2f062c72 ths
            break;
273 2f062c72 ths
        case 0x10:
274 2f062c72 ths
            ret = 0;
275 2f062c72 ths
            break;
276 63242a00 aurel32
        case 0x14:
277 63242a00 aurel32
            ret = s->rx_fifo[0];
278 63242a00 aurel32
            break;
279 d1f193b0 aurel32
#endif
280 2f062c72 ths
        case 0x1c:
281 2f062c72 ths
            ret = s->sptr;
282 2f062c72 ths
            break;
283 2f062c72 ths
        }
284 2f062c72 ths
    }
285 2f062c72 ths
#ifdef DEBUG_SERIAL
286 8da3ff18 pbrook
    printf("sh_serial: read offs=0x%02x val=0x%x\n",
287 8da3ff18 pbrook
           offs, ret);
288 2f062c72 ths
#endif
289 2f062c72 ths
290 2f062c72 ths
    if (ret & ~((1 << 16) - 1)) {
291 c1950a4e Peter Maydell
        fprintf(stderr, "sh_serial: unsupported read from 0x%02"
292 c1950a4e Peter Maydell
                TARGET_PRIxPHYS "\n", offs);
293 43dc2a64 Blue Swirl
        abort();
294 2f062c72 ths
    }
295 2f062c72 ths
296 2f062c72 ths
    return ret;
297 2f062c72 ths
}
298 2f062c72 ths
299 2f062c72 ths
static int sh_serial_can_receive(sh_serial_state *s)
300 2f062c72 ths
{
301 63242a00 aurel32
    return s->scr & (1 << 4);
302 2f062c72 ths
}
303 2f062c72 ths
304 2f062c72 ths
static void sh_serial_receive_break(sh_serial_state *s)
305 2f062c72 ths
{
306 63242a00 aurel32
    if (s->feat & SH_SERIAL_FEAT_SCIF)
307 63242a00 aurel32
        s->sr |= (1 << 4);
308 2f062c72 ths
}
309 2f062c72 ths
310 2f062c72 ths
static int sh_serial_can_receive1(void *opaque)
311 2f062c72 ths
{
312 2f062c72 ths
    sh_serial_state *s = opaque;
313 2f062c72 ths
    return sh_serial_can_receive(s);
314 2f062c72 ths
}
315 2f062c72 ths
316 2f062c72 ths
static void sh_serial_receive1(void *opaque, const uint8_t *buf, int size)
317 2f062c72 ths
{
318 2f062c72 ths
    sh_serial_state *s = opaque;
319 b7d2b020 Aurelien Jarno
320 b7d2b020 Aurelien Jarno
    if (s->feat & SH_SERIAL_FEAT_SCIF) {
321 b7d2b020 Aurelien Jarno
        int i;
322 b7d2b020 Aurelien Jarno
        for (i = 0; i < size; i++) {
323 b7d2b020 Aurelien Jarno
            if (s->rx_cnt < SH_RX_FIFO_LENGTH) {
324 b7d2b020 Aurelien Jarno
                s->rx_fifo[s->rx_head++] = buf[i];
325 b7d2b020 Aurelien Jarno
                if (s->rx_head == SH_RX_FIFO_LENGTH) {
326 b7d2b020 Aurelien Jarno
                    s->rx_head = 0;
327 b7d2b020 Aurelien Jarno
                }
328 b7d2b020 Aurelien Jarno
                s->rx_cnt++;
329 b7d2b020 Aurelien Jarno
                if (s->rx_cnt >= s->rtrg) {
330 b7d2b020 Aurelien Jarno
                    s->flags |= SH_SERIAL_FLAG_RDF;
331 b7d2b020 Aurelien Jarno
                    if (s->scr & (1 << 6) && s->rxi) {
332 b7d2b020 Aurelien Jarno
                        qemu_set_irq(s->rxi, 1);
333 b7d2b020 Aurelien Jarno
                    }
334 b7d2b020 Aurelien Jarno
                }
335 b7d2b020 Aurelien Jarno
            }
336 b7d2b020 Aurelien Jarno
        }
337 b7d2b020 Aurelien Jarno
    } else {
338 b7d2b020 Aurelien Jarno
        s->rx_fifo[0] = buf[0];
339 b7d2b020 Aurelien Jarno
    }
340 2f062c72 ths
}
341 2f062c72 ths
342 2f062c72 ths
static void sh_serial_event(void *opaque, int event)
343 2f062c72 ths
{
344 2f062c72 ths
    sh_serial_state *s = opaque;
345 2f062c72 ths
    if (event == CHR_EVENT_BREAK)
346 2f062c72 ths
        sh_serial_receive_break(s);
347 2f062c72 ths
}
348 2f062c72 ths
349 9a9d0b81 Benoît Canet
static const MemoryRegionOps sh_serial_ops = {
350 9a9d0b81 Benoît Canet
    .read = sh_serial_read,
351 9a9d0b81 Benoît Canet
    .write = sh_serial_write,
352 9a9d0b81 Benoît Canet
    .endianness = DEVICE_NATIVE_ENDIAN,
353 2f062c72 ths
};
354 2f062c72 ths
355 9a9d0b81 Benoît Canet
void sh_serial_init(MemoryRegion *sysmem,
356 9a9d0b81 Benoît Canet
                    target_phys_addr_t base, int feat,
357 9a9d0b81 Benoît Canet
                    uint32_t freq, CharDriverState *chr,
358 9a9d0b81 Benoît Canet
                    qemu_irq eri_source,
359 9a9d0b81 Benoît Canet
                    qemu_irq rxi_source,
360 9a9d0b81 Benoît Canet
                    qemu_irq txi_source,
361 9a9d0b81 Benoît Canet
                    qemu_irq tei_source,
362 9a9d0b81 Benoît Canet
                    qemu_irq bri_source)
363 2f062c72 ths
{
364 2f062c72 ths
    sh_serial_state *s;
365 2f062c72 ths
366 7267c094 Anthony Liguori
    s = g_malloc0(sizeof(sh_serial_state));
367 2f062c72 ths
368 2f062c72 ths
    s->feat = feat;
369 2f062c72 ths
    s->flags = SH_SERIAL_FLAG_TEND | SH_SERIAL_FLAG_TDE;
370 63242a00 aurel32
    s->rtrg = 1;
371 2f062c72 ths
372 2f062c72 ths
    s->smr = 0;
373 2f062c72 ths
    s->brr = 0xff;
374 b7d35e65 balrog
    s->scr = 1 << 5; /* pretend that TX is enabled so early printk works */
375 2f062c72 ths
    s->sptr = 0;
376 2f062c72 ths
377 2f062c72 ths
    if (feat & SH_SERIAL_FEAT_SCIF) {
378 2f062c72 ths
        s->fcr = 0;
379 2f062c72 ths
    }
380 2f062c72 ths
    else {
381 2f062c72 ths
        s->dr = 0xff;
382 2f062c72 ths
    }
383 2f062c72 ths
384 63242a00 aurel32
    sh_serial_clear_fifo(s);
385 2f062c72 ths
386 9a9d0b81 Benoît Canet
    memory_region_init_io(&s->iomem, &sh_serial_ops, s,
387 9a9d0b81 Benoît Canet
                          "serial", 0x100000000ULL);
388 9a9d0b81 Benoît Canet
389 9a9d0b81 Benoît Canet
    memory_region_init_alias(&s->iomem_p4, "serial-p4", &s->iomem,
390 9a9d0b81 Benoît Canet
                             0, 0x28);
391 9a9d0b81 Benoît Canet
    memory_region_add_subregion(sysmem, P4ADDR(base), &s->iomem_p4);
392 9a9d0b81 Benoît Canet
393 9a9d0b81 Benoît Canet
    memory_region_init_alias(&s->iomem_a7, "serial-a7", &s->iomem,
394 9a9d0b81 Benoît Canet
                             0, 0x28);
395 9a9d0b81 Benoît Canet
    memory_region_add_subregion(sysmem, A7ADDR(base), &s->iomem_a7);
396 2f062c72 ths
397 2f062c72 ths
    s->chr = chr;
398 2f062c72 ths
399 2f062c72 ths
    if (chr)
400 2f062c72 ths
        qemu_chr_add_handlers(chr, sh_serial_can_receive1, sh_serial_receive1,
401 2f062c72 ths
                              sh_serial_event, s);
402 bf5b7423 aurel32
403 bf5b7423 aurel32
    s->eri = eri_source;
404 bf5b7423 aurel32
    s->rxi = rxi_source;
405 bf5b7423 aurel32
    s->txi = txi_source;
406 bf5b7423 aurel32
    s->tei = tei_source;
407 bf5b7423 aurel32
    s->bri = bri_source;
408 2f062c72 ths
}