source: GPL/branches/1.1.x/lib32/misc.c@ 621

Last change on this file since 621 was 367, checked in by Brendan Oakley, 17 years ago

Reverse mistake in changeset:1

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