File: generic.h

package info (click to toggle)
vpb-driver 4.2.55-1
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 3,528 kB
  • sloc: cpp: 26,247; ansic: 19,041; sh: 3,210; perl: 1,132; makefile: 752; asm: 182
file content (130 lines) | stat: -rw-r--r-- 4,172 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
/*---------------------------------------------------------------------------*\

    FILE....: GENERIC.H
    TYPE....: C Functions
    AUTHOR..: David Rowe
    DATE....: 12/9/99

    This header file defines the interfaces of the generic functions
    that are used to access Operating System specific functions.


         Voicetronix Voice Processing Board (VPB) Software
         Copyright (C) 1999-2006 Voicetronix www.voicetronix.com.au

         This library is free software; you can redistribute it and/or
         modify it under the terms of the GNU Lesser General Public
         License as published by the Free Software Foundation; either
         version 2.1 of the License, or (at your option) any later version.

         This library is distributed in the hope that it will be useful,
         but WITHOUT ANY WARRANTY; without even the implied warranty of
         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
         Lesser General Public License for more details.

         You should have received a copy of the GNU Lesser General Public
         License along with this library; if not, write to the Free Software
         Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
         MA  02110-1301  USA

\*---------------------------------------------------------------------------*/

#ifndef __GENERIC__
#define __GENERIC__

#ifdef WIN32
#define	WINAPI	__stdcall
#else
#define	WINAPI
#endif
#ifdef __FreeBSD__
#include <sys/types.h>
#endif


// Critcal section functions

typedef struct { void *v; } GENERIC_CRITICAL_SECTION;

void WINAPI GenericInitializeCriticalSection(GENERIC_CRITICAL_SECTION *cs);
void WINAPI GenericDeleteCriticalSection(GENERIC_CRITICAL_SECTION *cs);
void WINAPI GenericEnterCriticalSection(GENERIC_CRITICAL_SECTION *cs);
void WINAPI GenericLeaveCriticalSection(GENERIC_CRITICAL_SECTION *cs);

int GenericDeviceIoControl(
	void	      *hndFile,	      // Handle to device
	long	      IoctlCode,      // IO Control code for Read
	void	      *InBuffer,      // Buffer to driver.
	long	      InBufferSize,
	void	      *OutBuffer,     // Buffer from driver
	long	      OutBufferSize,
	unsigned long *BytesReturned, // no. bytes returned from driver
	void	      *Overlapped
);

void *GenericOpenMk0Driver();
void *GenericOpenMk1Driver();
int GenericCloseHandle(void *hndFile);

unsigned long GenerictimeGetTime();

//XXX
// These only work for Open{Line,Log}
//int GenericGetCardType();
//int GenericGetNumCards(int vpb_model);
//int GenericGetNumCards(int ** cards);

// Get OS Type

#define GET_OS_WINDOWS_95	0
#define GET_OS_WINDOWS_NT	1
#define GET_OS_LINUX		2
#define GET_OS_USER		3
#define	GET_OS_FAIL	       -1

int GenericGetOS();

void GenericSleep(unsigned int ms);
void WINAPI Generic_beginthread(void(*func)(void*), int stack, void *data);
void WINAPI Generic_endthread();
void GenericSetThreadPriorityHigh();
void GenericSetThreadPriorityNormal();

// Linux Device driver (ISA)
int Generic_add_board(int fd, void *data);
int Generic_remove_board(int fd, void *data);
int Generic_block_write(int fd, void *data);
int Generic_block_read(int fd, void *data);
int Generic_open();
int Generic_close(int fd);

// Linux Driver driver (PCI)
int Generic_pci_dsp_reset(int fd, unsigned short board);
int Generic_pci_dsp_run(int fd, unsigned short board);
int Generic_pci_block_read(int            fd,
			   unsigned short board,
			   unsigned short addr,
			   unsigned short length,
			   unsigned short *buf);
int Generic_pci_block_write(int            fd,
			    unsigned short board,
			    unsigned short addr,
			    unsigned short length,
			    unsigned short *buf);
int Generic_pci_block_iicread(int            fd,
			      unsigned short board,
			      unsigned short addr,
			      unsigned short length,
			      unsigned short *buf);
int Generic_pci_block_iicwrite(int            fd,
			       unsigned short board,
			       unsigned short addr,
			       unsigned short length,
			       unsigned short *buf);
int Generic_pci_block_eeread(int            fd,
			     unsigned short board,
			     unsigned short addr,
			     unsigned short length,
			     unsigned short *buf);

#endif