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