~ubuntu-branches/ubuntu/precise/linux-lowlatency/precise

« back to all changes in this revision

Viewing changes to drivers/staging/tidspbridge/core/_msg_sm.h

  • Committer: Package Import Robot
  • Author(s): Alessio Igor Bogani
  • Date: 2011-10-26 11:13:05 UTC
  • Revision ID: package-import@ubuntu.com-20111026111305-tz023xykf0i6eosh
Tags: upstream-3.2.0
ImportĀ upstreamĀ versionĀ 3.2.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * _msg_sm.h
 
3
 *
 
4
 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
 
5
 *
 
6
 * Private header file defining msg_ctrl manager objects and defines needed
 
7
 * by IO manager.
 
8
 *
 
9
 * Copyright (C) 2005-2006 Texas Instruments, Inc.
 
10
 *
 
11
 * This package is free software; you can redistribute it and/or modify
 
12
 * it under the terms of the GNU General Public License version 2 as
 
13
 * published by the Free Software Foundation.
 
14
 *
 
15
 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
 
16
 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
 
17
 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 
18
 */
 
19
 
 
20
#ifndef _MSG_SM_
 
21
#define _MSG_SM_
 
22
 
 
23
#include <linux/list.h>
 
24
#include <dspbridge/msgdefs.h>
 
25
 
 
26
/*
 
27
 *  These target side symbols define the beginning and ending addresses
 
28
 *  of the section of shared memory used for messages. They are
 
29
 *  defined in the *cfg.cmd file by cdb code.
 
30
 */
 
31
#define MSG_SHARED_BUFFER_BASE_SYM      "_MSG_BEG"
 
32
#define MSG_SHARED_BUFFER_LIMIT_SYM     "_MSG_END"
 
33
 
 
34
#ifndef _CHNL_WORDSIZE
 
35
#define _CHNL_WORDSIZE 4        /* default _CHNL_WORDSIZE is 2 bytes/word */
 
36
#endif
 
37
 
 
38
/*
 
39
 *  ======== msg_ctrl ========
 
40
 *  There is a control structure for messages to the DSP, and a control
 
41
 *  structure for messages from the DSP. The shared memory region for
 
42
 *  transferring messages is partitioned as follows:
 
43
 *
 
44
 *  ----------------------------------------------------------
 
45
 *  |Control | Messages from DSP | Control | Messages to DSP |
 
46
 *  ----------------------------------------------------------
 
47
 *
 
48
 *  msg_ctrl control structure for messages to the DSP is used in the following
 
49
 *  way:
 
50
 *
 
51
 *  buf_empty -      This flag is set to FALSE by the GPP after it has output
 
52
 *                  messages for the DSP. The DSP host driver sets it to
 
53
 *                  TRUE after it has copied the messages.
 
54
 *  post_swi -       Set to 1 by the GPP after it has written the messages,
 
55
 *                  set the size, and set buf_empty to FALSE.
 
56
 *                  The DSP Host driver uses SWI_andn of the post_swi field
 
57
 *                  when a host interrupt occurs. The host driver clears
 
58
 *                  this after posting the SWI.
 
59
 *  size -          Number of messages to be read by the DSP.
 
60
 *
 
61
 *  For messages from the DSP:
 
62
 *  buf_empty -      This flag is set to FALSE by the DSP after it has output
 
63
 *                  messages for the GPP. The DPC on the GPP sets it to
 
64
 *                  TRUE after it has copied the messages.
 
65
 *  post_swi -       Set to 1 the DPC on the GPP after copying the messages.
 
66
 *  size -          Number of messages to be read by the GPP.
 
67
 */
 
68
struct msg_ctrl {
 
69
        u32 buf_empty;          /* to/from DSP buffer is empty */
 
70
        u32 post_swi;           /* Set to "1" to post msg_ctrl SWI */
 
71
        u32 size;               /* Number of messages to/from the DSP */
 
72
        u32 resvd;
 
73
};
 
74
 
 
75
/*
 
76
 *  ======== msg_mgr ========
 
77
 *  The msg_mgr maintains a list of all MSG_QUEUEs. Each NODE object can
 
78
 *  have msg_queue to hold all messages that come up from the corresponding
 
79
 *  node on the DSP. The msg_mgr also has a shared queue of messages
 
80
 *  ready to go to the DSP.
 
81
 */
 
82
struct msg_mgr {
 
83
        /* The first field must match that in msgobj.h */
 
84
 
 
85
        /* Function interface to Bridge driver */
 
86
        struct bridge_drv_interface *intf_fxns;
 
87
 
 
88
        struct io_mgr *iomgr;           /* IO manager */
 
89
        struct list_head queue_list;    /* List of MSG_QUEUEs */
 
90
        spinlock_t msg_mgr_lock;        /* For critical sections */
 
91
        /* Signalled when MsgFrame is available */
 
92
        struct sync_object *sync_event;
 
93
        struct list_head msg_free_list; /* Free MsgFrames ready to be filled */
 
94
        struct list_head msg_used_list; /* MsgFrames ready to go to DSP */
 
95
        u32 msgs_pending;       /* # of queued messages to go to DSP */
 
96
        u32 max_msgs;           /* Max # of msgs that fit in buffer */
 
97
        msg_onexit on_exit;     /* called when RMS_EXIT is received */
 
98
};
 
99
 
 
100
/*
 
101
 *  ======== msg_queue ========
 
102
 *  Each NODE has a msg_queue for receiving messages from the
 
103
 *  corresponding node on the DSP. The msg_queue object maintains a list
 
104
 *  of messages that have been sent to the host, but not yet read (MSG_Get),
 
105
 *  and a list of free frames that can be filled when new messages arrive
 
106
 *  from the DSP.
 
107
 *  The msg_queue's hSynEvent gets posted when a message is ready.
 
108
 */
 
109
struct msg_queue {
 
110
        struct list_head list_elem;
 
111
        struct msg_mgr *msg_mgr;
 
112
        u32 max_msgs;           /* Node message depth */
 
113
        u32 msgq_id;            /* Node environment pointer */
 
114
        struct list_head msg_free_list; /* Free MsgFrames ready to be filled */
 
115
        /* Filled MsgFramess waiting to be read */
 
116
        struct list_head msg_used_list;
 
117
        void *arg;              /* Handle passed to mgr on_exit callback */
 
118
        struct sync_object *sync_event; /* Signalled when message is ready */
 
119
        struct sync_object *sync_done;  /* For synchronizing cleanup */
 
120
        struct sync_object *sync_done_ack;      /* For synchronizing cleanup */
 
121
        struct ntfy_object *ntfy_obj;   /* For notification of message ready */
 
122
        bool done;              /* TRUE <==> deleting the object */
 
123
        u32 io_msg_pend;        /* Number of pending MSG_get/put calls */
 
124
};
 
125
 
 
126
/*
 
127
 *  ======== msg_dspmsg ========
 
128
 */
 
129
struct msg_dspmsg {
 
130
        struct dsp_msg msg;
 
131
        u32 msgq_id;            /* Identifies the node the message goes to */
 
132
};
 
133
 
 
134
/*
 
135
 *  ======== msg_frame ========
 
136
 */
 
137
struct msg_frame {
 
138
        struct list_head list_elem;
 
139
        struct msg_dspmsg msg_data;
 
140
};
 
141
 
 
142
#endif /* _MSG_SM_ */