source: GPL/branches/uniaud32-2.1.x/drv32/read.cpp@ 548

Last change on this file since 548 was 548, checked in by David Azarewicz, 14 years ago

APIC interrupt fixes from trunk

File size: 1.5 KB
Line 
1#define INCL_NOPMAPI
2#include <os2.h>
3#include <devhelp.h>
4#include <devrp.h>
5#include <dbgos2.h>
6#include <string.h> // memcpy
7
8extern "C" {
9
10int rdOffset= 0;
11int wrOffset= 0;
12char *szprintBuf= 0;
13
14void * __ioremap(unsigned long physaddr, unsigned long size, unsigned long flags);
15void iounmap(void *addr);
16
17}
18
19extern DBGINT DbgInt;
20
21ULONG StratRead(RP __far* _rp)
22{
23 RPRWV __far* rp = (RPRWV __far*)_rp;
24
25 char *lin;
26 int transferCount= rp->Count;
27
28 if( szprintBuf )
29 {
30 lin= (char *)__ioremap( rp->Transfer, transferCount, 0 );
31 if( lin )
32 {
33 int diffCount;
34
35 if( rdOffset > wrOffset )
36 {
37 diffCount= DBG_MAX_BUF_SIZE - rdOffset + wrOffset;
38 } else
39 {
40 diffCount= wrOffset - rdOffset;
41 }
42 if( transferCount > diffCount )
43 transferCount= diffCount;
44
45 rp->Count= transferCount;
46 if( (rdOffset + transferCount) > DBG_MAX_BUF_SIZE )
47 {
48 diffCount= DBG_MAX_BUF_SIZE - rdOffset;
49 memcpy( lin, szprintBuf + rdOffset, diffCount );
50 transferCount= transferCount - diffCount;
51 rdOffset= 0;
52 } else
53 diffCount= 0;
54
55 if( transferCount )
56 {
57 memcpy( lin + diffCount, szprintBuf + rdOffset, transferCount );
58 rdOffset= rdOffset + transferCount;
59 }
60 iounmap( (void *)lin );
61 return RPDONE;
62 } else
63 return RPDONE | RPERR;
64 } else
65 {
66 rp->Count= 0;
67 return RPDONE;
68 }
69}
Note: See TracBrowser for help on using the repository browser.