source: GPL/trunk/drv32/read.c@ 679

Last change on this file since 679 was 679, checked in by David Azarewicz, 4 years ago

Merge changes from Paul's uniaud32next branch.

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