~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to drivers/gpu/pvr/pdump/handle.c

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**********************************************************************
 
2
 *
 
3
 * Copyright (C) Imagination Technologies Ltd. All rights reserved.
 
4
 *
 
5
 * This program is free software; you can redistribute it and/or modify it
 
6
 * under the terms and conditions of the GNU General Public License,
 
7
 * version 2, as published by the Free Software Foundation.
 
8
 *
 
9
 * This program is distributed in the hope it will be useful but, except
 
10
 * as otherwise stated in writing, without any warranty; without even the
 
11
 * implied warranty of merchantability or fitness for a particular purpose.
 
12
 * See the GNU General Public License for more details.
 
13
 *
 
14
 * You should have received a copy of the GNU General Public License along with
 
15
 * this program; if not, write to the Free Software Foundation, Inc.,
 
16
 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
 
17
 *
 
18
 * The full GNU General Public License is included in this distribution in
 
19
 * the file called "COPYING".
 
20
 *
 
21
 * Contact Information:
 
22
 * Imagination Technologies Ltd. <gpl-support@imgtec.com>
 
23
 * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK
 
24
 *
 
25
 ******************************************************************************/
 
26
 
 
27
#include "img_defs.h"
 
28
#include "dbgdrvif.h"
 
29
#include "dbgdriv.h"
 
30
 
 
31
#define MAX_SID_ENTRIES         8
 
32
 
 
33
typedef struct _SID_INFO
 
34
{
 
35
        PDBG_STREAM     psStream;
 
36
} SID_INFO, *PSID_INFO;
 
37
 
 
38
static SID_INFO gaSID_Xlat_Table[MAX_SID_ENTRIES];
 
39
 
 
40
IMG_SID PStream2SID(PDBG_STREAM psStream)
 
41
{
 
42
        if (psStream != (PDBG_STREAM)IMG_NULL)
 
43
        {
 
44
                IMG_INT32 iIdx;
 
45
 
 
46
                for (iIdx = 0; iIdx < MAX_SID_ENTRIES; iIdx++)
 
47
                {
 
48
                        if (psStream == gaSID_Xlat_Table[iIdx].psStream)
 
49
                        {
 
50
 
 
51
                                return (IMG_SID)iIdx+1;
 
52
                        }
 
53
                }
 
54
        }
 
55
 
 
56
        return (IMG_SID)0;
 
57
}
 
58
 
 
59
 
 
60
PDBG_STREAM SID2PStream(IMG_SID hStream)
 
61
{
 
62
 
 
63
        IMG_INT32 iIdx = (IMG_INT32)hStream-1;
 
64
 
 
65
        if (iIdx >= 0 && iIdx < MAX_SID_ENTRIES)
 
66
        {
 
67
                return gaSID_Xlat_Table[iIdx].psStream;
 
68
        }
 
69
        else
 
70
        {
 
71
        return (PDBG_STREAM)IMG_NULL;
 
72
    }
 
73
}
 
74
 
 
75
 
 
76
IMG_BOOL AddSIDEntry(PDBG_STREAM psStream)
 
77
{
 
78
        if (psStream != (PDBG_STREAM)IMG_NULL)
 
79
        {
 
80
                IMG_INT32 iIdx;
 
81
 
 
82
                for (iIdx = 0; iIdx < MAX_SID_ENTRIES; iIdx++)
 
83
                {
 
84
                        if (psStream == gaSID_Xlat_Table[iIdx].psStream)
 
85
                        {
 
86
 
 
87
                                return IMG_TRUE;
 
88
                        }
 
89
 
 
90
                        if (gaSID_Xlat_Table[iIdx].psStream == (PDBG_STREAM)IMG_NULL)
 
91
                        {
 
92
 
 
93
                                gaSID_Xlat_Table[iIdx].psStream = psStream;
 
94
                                return IMG_TRUE;
 
95
                        }
 
96
                }
 
97
        }
 
98
 
 
99
        return IMG_FALSE;
 
100
}
 
101
 
 
102
IMG_BOOL RemoveSIDEntry(PDBG_STREAM psStream)
 
103
{
 
104
        if (psStream != (PDBG_STREAM)IMG_NULL)
 
105
        {
 
106
                IMG_INT32 iIdx;
 
107
 
 
108
                for (iIdx = 0; iIdx < MAX_SID_ENTRIES; iIdx++)
 
109
                {
 
110
                        if (psStream == gaSID_Xlat_Table[iIdx].psStream)
 
111
                        {
 
112
                                gaSID_Xlat_Table[iIdx].psStream = (PDBG_STREAM)IMG_NULL;
 
113
                                return IMG_TRUE;
 
114
                        }
 
115
                }
 
116
        }
 
117
 
 
118
        return IMG_FALSE;
 
119
}
 
120
 
 
121