[PATCH] DVB: Fixes ifs in ves1820 set symbolrate().
[linux-2.6/zen-sources.git] / drivers / char / drm / via_ds.h
blobd2bb9f37ca38374f8b5519ad685b6bb4406bd5c4
1 /*
2 * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
3 * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
4 * Copyright 2000 Silicon Integrated Systems Corp, Inc., HsinChu, Taiwan.
5 * All rights reserved.
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sub license,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
16 * of the Software.
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
21 * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
22 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
23 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
24 * DEALINGS IN THE SOFTWARE.
26 #ifndef _via_ds_h_
27 #define _via_ds_h_
29 #include "drmP.h"
31 /* Set Data Structure */
32 #define SET_SIZE 5000
33 typedef unsigned long ITEM_TYPE;
35 typedef struct {
36 ITEM_TYPE val;
37 int alloc_next, free_next;
38 } list_item_t;
40 typedef struct {
41 int alloc;
42 int free;
43 int trace;
44 list_item_t list[SET_SIZE];
45 } set_t;
47 set_t *via_setInit(void);
48 int via_setAdd(set_t * set, ITEM_TYPE item);
49 int via_setDel(set_t * set, ITEM_TYPE item);
50 int via_setFirst(set_t * set, ITEM_TYPE * item);
51 int via_setNext(set_t * set, ITEM_TYPE * item);
52 int via_setDestroy(set_t * set);
54 #endif
56 #ifndef MM_INC
57 #define MM_INC
59 struct mem_block_t {
60 struct mem_block_t *next;
61 struct mem_block_t *heap;
62 int ofs, size;
63 int align;
64 unsigned int free:1;
65 unsigned int reserved:1;
67 typedef struct mem_block_t TMemBlock;
68 typedef struct mem_block_t *PMemBlock;
70 /* a heap is just the first block in a chain */
71 typedef struct mem_block_t memHeap_t;
73 static __inline__ int mmBlockSize(PMemBlock b)
75 return b->size;
78 static __inline__ int mmOffset(PMemBlock b)
80 return b->ofs;
83 static __inline__ void mmMarkReserved(PMemBlock b)
85 b->reserved = 1;
89 * input: total size in bytes
90 * return: a heap pointer if OK, NULL if error
92 memHeap_t *via_mmInit(int ofs, int size);
94 PMemBlock via_mmAllocMem(memHeap_t * heap, int size, int align2,
95 int startSearch);
98 * Free block starts at offset
99 * input: pointer to a block
100 * return: 0 if OK, -1 if error
102 int via_mmFreeMem(PMemBlock b);
104 #endif