source: GPL/trunk/lib32/misc.c@ 63

Last change on this file since 63 was 61, checked in by vladest, 20 years ago

Looks like compiles at last

File size: 8.4 KB
Line 
1/* $Id: misc.c,v 1.1.1.1 2003/07/02 13:57:02 eleph Exp $ */
2/*
3 * OS/2 implementation of misc. Linux kernel services
4 *
5 * (C) 2000-2002 InnoTek Systemberatung GmbH
6 * (C) 2000-2001 Sander van Leeuwen (sandervl@xs4all.nl)
7 *
8 * hweight32 based on Linux code (bitops.h)
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License as
12 * published by the Free Software Foundation; either version 2 of
13 * the License, or (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public
21 * License along with this program; if not, write to the Free
22 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
23 * USA.
24 *
25 */
26
27#include "linux.h"
28#include <linux/init.h>
29#include <linux/fs.h>
30#include <linux/poll.h>
31#define CONFIG_PROC_FS
32#include <linux/proc_fs.h>
33#include <asm/uaccess.h>
34#include <asm/hardirq.h>
35#include <linux\ioport.h>
36#include <linux\utsname.h>
37#include <linux\module.h>
38#include <dbgos2.h>
39#include <printfos2.h>
40#include <limits.h>
41
42struct new_utsname system_utsname = {0};
43struct resource ioport_resource = {NULL, 0, 0, IORESOURCE_IO, NULL, NULL, NULL};
44struct resource iomem_resource = {NULL, 0, 0, IORESOURCE_MEM, NULL, NULL, NULL};
45mem_map_t *mem_map = 0;
46int this_module[64] = {0};
47
48#include <stdarg.h>
49
50char szLastALSAError1[128] = {0};
51char szOverrunTest1 = 0xCC;
52char szLastALSAError2[128] = {0};
53char szOverrunTest2 = 0xCC;
54int iLastError = 0;
55
56//******************************************************************************
57//Save error message in szLastALSAError; if card init failed, then we will
58//print it in drv32\init.cpp
59//******************************************************************************
60int printk(const char * fmt, ...)
61{
62 va_list argptr; /* -> variable argument list */
63
64 char *pszLastALSAError;
65
66 pszLastALSAError= iLastError ? szLastALSAError2 : szLastALSAError1;
67
68 va_start(argptr, fmt); /* get pointer to argument list */
69 vsprintf(pszLastALSAError, fmt, argptr);
70// strcat(pszLastALSAError, "\r");
71 va_end(argptr); /* done with variable arguments */
72
73 if(szOverrunTest1 != 0xCC || szOverrunTest2 != 0xCC) {
74 DebugInt3();
75 }
76
77 dprintf( (pszLastALSAError) );
78 if(++iLastError > 1) {
79 iLastError = 0;
80 }
81 return 0;
82}
83//******************************************************************************
84//******************************************************************************
85void schedule(void)
86{
87
88}
89//******************************************************************************
90//******************************************************************************
91void poll_wait(struct file * filp, wait_queue_head_t * wait_address, poll_table *p)
92{
93
94}
95//******************************************************************************
96//******************************************************************************
97int __check_region(struct resource *a, unsigned long b, unsigned long c)
98{
99 DebugInt3();
100 return 0;
101}
102
103/* --------------------------------------------------------------------- */
104/*
105 * hweightN: returns the hamming weight (i.e. the number
106 * of bits set) of a N-bit word
107 */
108
109#ifdef hweight32
110#undef hweight32
111#endif
112
113unsigned int hweight32(unsigned int w)
114{
115 unsigned int res = (w & 0x55555555) + ((w >> 1) & 0x55555555);
116 res = (res & 0x33333333) + ((res >> 2) & 0x33333333);
117 res = (res & 0x0F0F0F0F) + ((res >> 4) & 0x0F0F0F0F);
118 res = (res & 0x00FF00FF) + ((res >> 8) & 0x00FF00FF);
119 return (res & 0x0000FFFF) + ((res >> 16) & 0x0000FFFF);
120}
121//******************************************************************************
122//******************************************************************************
123mem_map_t *virt_to_page(int x)
124{
125 static mem_map_t map = {0};
126 return &map;
127}
128//******************************************************************************
129//******************************************************************************
130struct proc_dir_entry proc_root = {0};
131//******************************************************************************
132//******************************************************************************
133struct proc_dir_entry *create_proc_entry(const char *name, mode_t mode,
134 struct proc_dir_entry *parent)
135{
136 struct proc_dir_entry *proc;
137
138 proc = (struct proc_dir_entry *)kmalloc(sizeof(struct proc_dir_entry), 0);
139 memset(proc, 0, sizeof(struct proc_dir_entry));
140
141 proc->name = name;
142 proc->mode = mode;
143 proc->parent = parent;
144
145 return proc;
146}
147//******************************************************************************
148//******************************************************************************
149void remove_proc_entry(const char *name, struct proc_dir_entry *parent)
150{
151 return; //memory leak
152}
153//******************************************************************************
154//******************************************************************************
155int proc_register(struct proc_dir_entry *parent, struct proc_dir_entry *proc)
156{
157 return 0;
158}
159//******************************************************************************
160//******************************************************************************
161int proc_unregister(struct proc_dir_entry *proc, int bla)
162{
163 return 0;
164}
165//******************************************************************************
166//******************************************************************************
167int fasync_helper(int a, struct file *b, int c, struct fasync_struct **d)
168{
169 return 0;
170}
171//******************************************************************************
172//******************************************************************************
173void kill_fasync(struct fasync_struct *a, int b, int c)
174{
175}
176//******************************************************************************
177//******************************************************************************
178int request_dma(unsigned int dmanr, const char * device_id) /* reserve a DMA channel */
179{
180 DebugInt3();
181 return 0;
182}
183//******************************************************************************
184//******************************************************************************
185void free_dma(unsigned int dmanr)
186{
187 DebugInt3();
188}
189//******************************************************************************
190/* enable/disable a specific DMA channel */
191//******************************************************************************
192void enable_dma(unsigned int dmanr)
193{
194 DebugInt3();
195}
196//******************************************************************************
197//******************************************************************************
198void disable_dma(unsigned int dmanr)
199{
200 DebugInt3();
201}
202//******************************************************************************
203static struct notifier_block *reboot_notify_list = NULL;
204// No need to implement this right now. The ESS Maestro 3 driver uses it
205// to call pci_unregister_driver, which is always called from the shutdown
206// notification sent by OS2.
207// Same goes for es1968 & Yamaha's DS1/DS1E.
208//******************************************************************************
209int register_reboot_notifier(struct notifier_block *pnblock)
210{
211 return 0;
212}
213//******************************************************************************
214//******************************************************************************
215int unregister_reboot_notifier(struct notifier_block *pnblock)
216{
217 return 0;
218}
219//******************************************************************************
220//******************************************************************************
221void *snd_compat_kcalloc(size_t n, size_t size, int flags)
222{
223 void *ret = NULL;
224
225 if (n != 0 && size > INT_MAX / n)
226 return ret;
227
228 ret = kmalloc(n * size, flags);
229 if (ret)
230 memset(ret, 0, n * size);
231 return ret;
232}
233
Note: See TracBrowser for help on using the repository browser.