source: GPL/branches/uniaud-2.0/lib32/misc.c@ 313

Last change on this file since 313 was 305, checked in by Paul Smedley, 17 years ago

Update source to ALSA 1.0.16 level

File size: 8.1 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#include <limits.h>
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
41struct new_utsname system_utsname = {0};
42struct resource ioport_resource = {NULL, 0, 0, IORESOURCE_IO, NULL, NULL, NULL};
43struct resource iomem_resource = {NULL, 0, 0, IORESOURCE_MEM, NULL, NULL, NULL};
44mem_map_t *mem_map = 0;
45int this_module[64] = {0};
46
47#include <stdarg.h>
48
49char szLastALSAError1[128] = {0};
50char szOverrunTest1 = 0xCC;
51char szLastALSAError2[128] = {0};
52char szOverrunTest2 = 0xCC;
53int iLastError = 0;
54
55//******************************************************************************
56//Save error message in szLastALSAError; if card init failed, then we will
57//print it in drv32\init.cpp
58//******************************************************************************
59int printk(const char * fmt, ...)
60{
61 va_list argptr; /* -> variable argument list */
62
63 char *pszLastALSAError;
64
65 pszLastALSAError= iLastError ? szLastALSAError2 : szLastALSAError1;
66
67 va_start(argptr, fmt); /* get pointer to argument list */
68 vsprintf(pszLastALSAError, fmt, argptr);
69// strcat(pszLastALSAError, "\r");
70 va_end(argptr); /* done with variable arguments */
71
72 if(szOverrunTest1 != 0xCC || szOverrunTest2 != 0xCC) {
73 DebugInt3();
74 }
75
76 dprintf( (pszLastALSAError) );
77 if(++iLastError > 1) {
78 iLastError = 0;
79 }
80 return 0;
81}
82//******************************************************************************
83//******************************************************************************
84void schedule(void)
85{
86
87}
88//******************************************************************************
89//******************************************************************************
90void poll_wait(struct file * filp, wait_queue_head_t * wait_address, poll_table *p)
91{
92
93}
94//******************************************************************************
95//******************************************************************************
96int __check_region(struct resource *a, unsigned long b, unsigned long c)
97{
98 DebugInt3();
99 return 0;
100}
101
102/* --------------------------------------------------------------------- */
103/*
104 * hweightN: returns the hamming weight (i.e. the number
105 * of bits set) of a N-bit word
106 */
107
108#ifdef hweight32
109#undef hweight32
110#endif
111
112unsigned int hweight32(unsigned int w)
113{
114 unsigned int res = (w & 0x55555555) + ((w >> 1) & 0x55555555);
115 res = (res & 0x33333333) + ((res >> 2) & 0x33333333);
116 res = (res & 0x0F0F0F0F) + ((res >> 4) & 0x0F0F0F0F);
117 res = (res & 0x00FF00FF) + ((res >> 8) & 0x00FF00FF);
118 return (res & 0x0000FFFF) + ((res >> 16) & 0x0000FFFF);
119}
120//******************************************************************************
121//******************************************************************************
122#if 0
123mem_map_t *virt_to_page(int x)
124{
125 static mem_map_t map = {0};
126 return &map;
127}
128#endif
129//******************************************************************************
130//******************************************************************************
131struct proc_dir_entry proc_root = {0};
132//******************************************************************************
133//******************************************************************************
134struct proc_dir_entry *create_proc_entry(const char *name, mode_t mode,
135 struct proc_dir_entry *parent)
136{
137 struct proc_dir_entry *proc;
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//******************************************************************************
Note: See TracBrowser for help on using the repository browser.