From: Brett Gordon Date: Fri, 3 Jun 2016 12:39:14 +0000 (-0400) Subject: coco3: add flag to dw_transaction optionally do user mode xfer X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=0586eb6262029d72c126efd728056f919e665dfe;p=FUZIX.git coco3: add flag to dw_transaction optionally do user mode xfer --- diff --git a/Kernel/dev/devdw.h b/Kernel/dev/devdw.h index 8605869e..3ec0a00e 100644 --- a/Kernel/dev/devdw.h +++ b/Kernel/dev/devdw.h @@ -10,7 +10,7 @@ int dw_open(uint8_t minor, uint16_t flag); uint8_t dw_reset(void); uint8_t dw_operation(uint8_t *cmd); uint16_t dw_transaction( unsigned char *send, uint16_t scnt, - unsigned char *recv, uint16_t rcnt ); + unsigned char *recv, uint16_t rcnt, uint8_t rawf ); #endif /* __DEVDW_DOT_H__ */ diff --git a/Kernel/platform-coco3/drivewire.s b/Kernel/platform-coco3/drivewire.s index 02f7bd74..214d4686 100644 --- a/Kernel/platform-coco3/drivewire.s +++ b/Kernel/platform-coco3/drivewire.s @@ -19,29 +19,33 @@ ;;; machine isn't fast enough to catch the host's reply packet ;;; , the write and read functions must be "close" together. ;;; uint16_t dw_transaction( char *send, uint16_t scnt, -;;; char *recv, uint16_t rcnt ) +;;; char *recv, uint16_t rcnt, uint8_t rawf ) ;;; x=send cc y ret scnt recv rcnt ;;; Brett M. Gordon _dw_transaction: pshs cc,y ; save caller orcc #0x50 ; stop interrupts - ldy 5,s ; Y = number of bytes to send - beq out@ ; no byte to write - leave + tstb ; rawflag? + beq skip@ ; nope - then skip switching to process map + jsr map_process_always +skip@ ldy 5,s ; Y = number of bytes to send + beq ok@ ; no byte to write - leave jsr DWWrite ; send to DW ldx 7,s ; X is receive buffer ldy 9,s ; Y = number of bytes to receive - beq out@ ; no bytes to send - leave + beq ok@ ; no bytes to send - leave jsr DWRead ; read in that many bytes bcs frame@ ; C set on framing error bne part@ ; Z zet on all bytes received -out@ ldx #0 ; no error +ok@ ldx #0 ; no error +out@ jsr map_kernel puls cc,y,pc ; return frame@ ldx #-1 ; frame error - puls cc,y,pc ; return + bra out@ part@ ldx #-2 ; not all bytes received! - puls cc,y,pc ; return + bra out@ + - _dw_reset: ; maybe reinitalise PIA here? ; and send DW_INIT request to server? diff --git a/Kernel/platform-coco3/ttydw.c b/Kernel/platform-coco3/ttydw.c index 8172f889..0383681b 100644 --- a/Kernel/platform-coco3/ttydw.c +++ b/Kernel/platform-coco3/ttydw.c @@ -46,12 +46,13 @@ "dw_transaction" routine/function: int16_t dw_transaction( char *send, uint16_t scnt, - char *recv, uint16_t rcnt ) + char *recv, uint16_t rcnt, uint8_t rawf ) where "send" is a data buffer to send "scnt" is the size of the send buffer "recv" is a data buffer for the received reply "rcnt" is the size of the recv buffer + "rawf" rd/wr drirectly to userspace returns: 0 on no error -1 on DW reception framing error (too slow!!) -2 on not all bytes received @@ -155,7 +156,7 @@ void dw_putc( uint8_t minor, unsigned char c ){ unsigned char buf[2]; buf[0]=DW_FASTWRITE | dw_port( minor ) ; buf[1]=c; - dw_transaction( buf, 2, NULL, 0 ); + dw_transaction( buf, 2, NULL, 0, 0 ); } @@ -168,7 +169,7 @@ void dw_vopen( uint8_t minor ){ buf[1]=dw_port( minor ); buf[2]=DW_VOPEN; if( ! ( p->flags & DW_FLG_OPEN ) ){ - dw_transaction( buf, 3, NULL, 0 ); + dw_transaction( buf, 3, NULL, 0, 0 ); open_ports++; } p->flags |= DW_FLG_OPEN; @@ -182,7 +183,7 @@ void dw_vclose( uint8_t minor){ buf[1]=dw_port( minor ); buf[2]=DW_VCLOSE; if( p->flags & DW_FLG_OPEN ){ - dw_transaction( buf, 3, NULL, 0 ); + dw_transaction( buf, 3, NULL, 0, 0 ); } } @@ -208,7 +209,7 @@ void dw_vpoll( ){ /* up to four transactions at a poll */ for( i=0; i<4; i++){ buf[0]=DW_SERREAD; - dw_transaction( buf, 1, buf, 2 ); + dw_transaction( buf, 1, buf, 2, 0 ); /* nothing waiting ? */ if( ! (buf[0] & 0x7f) ) { wait=MAX_WAIT; @@ -246,7 +247,7 @@ void dw_vpoll( ){ wait=1; break; } - dw_transaction( b,3,tbuf, min ); + dw_transaction( b,3,tbuf, min, 0 ); for( i=0; i