vmwgfx: Fix assignment in vmw_framebuffer_create_handle
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / drivers / staging / cxt1e1 / sbecom_inline_linux.h
blob9ea2c0c2061f84b60ecf62cb7a73daad4e02ed34
1 /*
2 * $Id: sbecom_inline_linux.h,v 1.2 2007/08/15 22:51:35 rickd PMCC4_3_1B $
3 */
5 #ifndef _INC_SBECOM_INLNX_H_
6 #define _INC_SBECOM_INLNX_H_
8 /*-----------------------------------------------------------------------------
9 * sbecom_inline_linux.h - SBE common Linux inlined routines
11 * Copyright (C) 2007 One Stop Systems, Inc.
12 * Copyright (C) 2005 SBE, Inc.
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * For further information, contact via email: support@onestopsystems.com
25 * One Stop Systems, Inc. Escondido, California U.S.A.
26 *-----------------------------------------------------------------------------
27 * RCS info:
28 * RCS revision: $Revision: 1.2 $
29 * Last changed on $Date: 2007/08/15 22:51:35 $
30 * Changed by $Author: rickd $
31 *-----------------------------------------------------------------------------
32 * $Log: sbecom_inline_linux.h,v $
33 * Revision 1.2 2007/08/15 22:51:35 rickd
34 * Remove duplicate version.h entry.
36 * Revision 1.1 2007/08/15 22:50:29 rickd
37 * Update linux/config for 2.6.18 and later.
39 * Revision 1.0 2005/09/28 00:10:09 rickd
40 * Initial revision
42 *-----------------------------------------------------------------------------
46 #include <linux/types.h>
47 #include <linux/module.h>
48 #include <linux/kernel.h> /* resolves kmalloc references */
49 #include <linux/skbuff.h> /* resolves skb references */
50 #include <linux/netdevice.h> /* resolves dev_kree_skb_any */
51 #include <asm/byteorder.h> /* resolves cpu_to_le32 */
53 /* forward reference */
54 u_int32_t pci_read_32 (u_int32_t *p);
55 void pci_write_32 (u_int32_t *p, u_int32_t v);
59 * system dependent callbacks
62 /**********/
63 /* malloc */
64 /**********/
66 static inline void *
67 OS_kmalloc (size_t size)
69 char *ptr = kmalloc (size, GFP_KERNEL | GFP_DMA);
71 if (ptr)
72 memset (ptr, 0, size);
73 return ptr;
76 static inline void
77 OS_kfree (void *x)
79 kfree (x);
83 /****************/
84 /* memory token */
85 /****************/
87 static inline void *
88 OS_mem_token_alloc (size_t size)
90 struct sk_buff *skb;
92 skb = dev_alloc_skb (size);
93 if (!skb)
95 //pr_warning("no mem in OS_mem_token_alloc !\n");
96 return 0;
98 return skb;
102 static inline void
103 OS_mem_token_free (void *token)
105 dev_kfree_skb_any (token);
109 static inline void
110 OS_mem_token_free_irq (void *token)
112 dev_kfree_skb_irq (token);
116 static inline void *
117 OS_mem_token_data (void *token)
119 return ((struct sk_buff *) token)->data;
123 static inline void *
124 OS_mem_token_next (void *token)
126 return 0;
130 static inline int
131 OS_mem_token_len (void *token)
133 return ((struct sk_buff *) token)->len;
137 static inline int
138 OS_mem_token_tlen (void *token)
140 return ((struct sk_buff *) token)->len;
144 /***************************************/
145 /* virtual to physical addr conversion */
146 /***************************************/
148 static inline u_long
149 OS_phystov (void *addr)
151 return (u_long) __va (addr);
155 static inline u_long
156 OS_vtophys (void *addr)
158 return __pa (addr);
162 /**********/
163 /* semops */
164 /**********/
166 void OS_sem_init (void *, int);
169 static inline void
170 OS_sem_free (void *sem)
173 * NOOP - since semaphores structures predeclared w/in structures, no
174 * longer malloc'd
178 #define SD_SEM_TAKE(sem,desc) down(sem)
179 #define SD_SEM_GIVE(sem) up(sem)
180 #define SEM_AVAILABLE 1
181 #define SEM_TAKEN 0
184 /**********************/
185 /* watchdog functions */
186 /**********************/
188 struct watchdog
190 struct timer_list h;
191 struct work_struct work;
192 void *softc;
193 void (*func) (void *softc);
194 int ticks;
195 int init_tq;
199 static inline int
200 OS_start_watchdog (struct watchdog * wd)
202 wd->h.expires = jiffies + wd->ticks;
203 add_timer (&wd->h);
204 return 0;
208 static inline int
209 OS_stop_watchdog (struct watchdog * wd)
211 del_timer_sync (&wd->h);
212 return 0;
216 static inline int
217 OS_free_watchdog (struct watchdog * wd)
219 OS_stop_watchdog (wd);
220 OS_kfree (wd);
221 return 0;
225 /* sleep in microseconds */
226 void OS_uwait (int usec, char *description);
227 void OS_uwait_dummy (void);
230 /* watchdog functions */
231 int OS_init_watchdog(struct watchdog *wdp, void (*f) (void *), void *ci, int usec);
234 #endif /*** _INC_SBECOM_INLNX_H_ ***/