Last change
on this file since 313 was 268, checked in by Brendan Oakley, 18 years ago |
Make debug buffer larger, and fix alsahlp line endings, from Allan
|
File size:
1.6 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 |
|
---|
8 | extern "C" {
|
---|
9 |
|
---|
10 | int rdOffset= 0;
|
---|
11 | int wrOffset= 0;
|
---|
12 | char *szprintBuf= 0;
|
---|
13 | #ifdef DEBUG
|
---|
14 | int max_buf_size= 0x100000;
|
---|
15 | #else
|
---|
16 | int max_buf_size= 0x10000;
|
---|
17 | #endif
|
---|
18 |
|
---|
19 | void * __ioremap(unsigned long physaddr, unsigned long size, unsigned long flags);
|
---|
20 | void iounmap(void *addr);
|
---|
21 |
|
---|
22 | }
|
---|
23 |
|
---|
24 | ULONG StratRead(RP __far* _rp)
|
---|
25 | {
|
---|
26 | RPRWV __far* rp = (RPRWV __far*)_rp;
|
---|
27 |
|
---|
28 | char *lin;
|
---|
29 | int transferCount= rp->Count;
|
---|
30 |
|
---|
31 | if( szprintBuf )
|
---|
32 | {
|
---|
33 | lin= (char *)__ioremap( rp->Transfer, transferCount, 0 );
|
---|
34 | if( lin )
|
---|
35 | {
|
---|
36 | int diffCount;
|
---|
37 |
|
---|
38 | if( rdOffset > wrOffset )
|
---|
39 | {
|
---|
40 | diffCount= max_buf_size - rdOffset + wrOffset;
|
---|
41 | } else
|
---|
42 | {
|
---|
43 | diffCount= wrOffset - rdOffset;
|
---|
44 | }
|
---|
45 | if( transferCount > diffCount )
|
---|
46 | transferCount= diffCount;
|
---|
47 |
|
---|
48 | rp->Count= transferCount;
|
---|
49 | if( (rdOffset + transferCount) > max_buf_size )
|
---|
50 | {
|
---|
51 | diffCount= max_buf_size - rdOffset;
|
---|
52 | memcpy( lin, szprintBuf + rdOffset, diffCount );
|
---|
53 | transferCount= transferCount - diffCount;
|
---|
54 | rdOffset= 0;
|
---|
55 | } else
|
---|
56 | diffCount= 0;
|
---|
57 |
|
---|
58 | if( transferCount )
|
---|
59 | {
|
---|
60 | memcpy( lin + diffCount, szprintBuf + rdOffset, transferCount );
|
---|
61 | rdOffset= rdOffset + transferCount;
|
---|
62 | }
|
---|
63 | iounmap( (void *)lin );
|
---|
64 | return RPDONE;
|
---|
65 | } else
|
---|
66 | return RPDONE | RPERR;
|
---|
67 | } else
|
---|
68 | {
|
---|
69 | rp->Count= 0;
|
---|
70 | return RPDONE;
|
---|
71 | }
|
---|
72 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.