summaryrefslogtreecommitdiff
path: root/firmware/target/arm/tms320dm320/dsp/ipc.h
blob: 030febd02125bd091dffa27acd28d77fde9c404d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/***************************************************************************
 *             __________               __   ___.
 *   Open      \______   \ ____   ____ |  | _\_ |__   _______  ___
 *   Source     |       _//  _ \_/ ___\|  |/ /| __ \ /  _ \  \/  /
 *   Jukebox    |    |   (  <_> )  \___|    < | \_\ (  <_> > <  <
 *   Firmware   |____|_  /\____/ \___  >__|_ \|___  /\____/__/\_ \
 *                     \/            \/     \/    \/            \/
 * $Id$
 *
 * Copyright (C) 2008 by Catalin Patulea
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
 * KIND, either express or implied.
 *
 ****************************************************************************/

#ifndef IPC_H
#define IPC_H

/* Inter-Processor Communication */

/* Meant to be included by both DSP and ARM code. */
#ifdef __GNUC__
/* aligned(2) is VERY IMPORTANT. It ensures gcc generates code with "STRH"
   instead of with "STRB". STRB in the DSP memory range is broken because
   the HPI is in 16-bit mode. */
#define PACKED __attribute__((packed)) __attribute__((aligned (2)))
#else
#define PACKED
#endif

/* Define this if you want to use debugf on the DSP.  This consumes quite a bit
 *  of space so it is disabled by default. */
/* #define HAVE_DEBUG */

struct sdram_buffer {
    unsigned long addr;
    unsigned short bytes;
} PACKED;

struct ipc_message {
    unsigned short msg;
    union {
#define MSG_INIT 1
        struct msg_init {
            unsigned short sdem_addrl;
            unsigned short sdem_addrh;
        } init PACKED;
#define MSG_DEBUGF 2
        struct {
            short buffer[80];
        } debugf PACKED;
#define MSG_REFILL 3
        struct {
            unsigned short topbottom; /* byte offset to unlocked half-buffer */

            unsigned short _DMA_TRG;
            unsigned short _SDEM_ADDRH;
            unsigned short _SDEM_ADDRL;
            unsigned short _DSP_ADDRH;
            unsigned short _DSP_ADDRL;
            unsigned short _DMA_SIZE;
        } refill PACKED;
    } payload PACKED;
} PACKED;
#endif