From 296b417502d6c6a6909f60a866a29f1e3cc2eac2 Mon Sep 17 00:00:00 2001 From: cuz Date: Fri, 22 Aug 2003 11:23:48 +0000 Subject: [PATCH] API changes git-svn-id: svn://svn.cc65.org/cc65/trunk@2406 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- asminc/ser-kernel.inc | 27 ++++++++++++--------------- include/serial.h | 13 +++++-------- libsrc/serial/Makefile | 7 +++---- libsrc/serial/ser-kernel.s | 5 ++--- libsrc/serial/ser_close.s | 12 ++++++++++++ libsrc/serial/ser_open.s | 24 ++++++++++++++++++++++++ libsrc/serial/ser_pause.s | 12 ------------ libsrc/serial/ser_unpause.s | 11 ----------- 8 files changed, 58 insertions(+), 53 deletions(-) create mode 100644 libsrc/serial/ser_close.s create mode 100644 libsrc/serial/ser_open.s delete mode 100644 libsrc/serial/ser_pause.s delete mode 100644 libsrc/serial/ser_unpause.s diff --git a/asminc/ser-kernel.inc b/asminc/ser-kernel.inc index 938799cc6..30aa9b0f5 100644 --- a/asminc/ser-kernel.inc +++ b/asminc/ser-kernel.inc @@ -42,15 +42,14 @@ SER_HDR_VERSION = 3 ; Interface version SER_HDR_JUMPTAB = 4 SER_HDR_INSTALL = SER_HDR_JUMPTAB+0 ; INSTALL routine SER_HDR_UNINSTALL = SER_HDR_JUMPTAB+2 ; UNINSTALL routine -SER_HDR_PARAMS = SER_HDR_JUMPTAB+4 ; PARAMS routine -SER_HDR_GET = SER_HDR_JUMPTAB+6 ; GET routine -SER_HDR_PUT = SER_HDR_JUMPTAB+8 ; PUT routine -SER_HDR_PAUSE = SER_HDR_JUMPTAB+10 ; PAUSE routine -SER_HDR_UNPAUSE = SER_HDR_JUMPTAB+12 ; UNPAUSE routine -SER_HDR_STATUS = SER_HDR_JUMPTAB+14 ; STATUS routine -SER_HDR_IOCTL = SER_HDR_JUMPTAB+16 ; IOCTL routine +SER_HDR_OPEN = SER_HDR_JUMPTAB+4 ; OPEN routine +SER_HDR_CLOSE = SER_HDR_JUMPTAB+6 ; CLOSE routine +SER_HDR_GET = SER_HDR_JUMPTAB+8 ; GET routine +SER_HDR_PUT = SER_HDR_JUMPTAB+10 ; PUT routine +SER_HDR_STATUS = SER_HDR_JUMPTAB+12 ; STATUS routine +SER_HDR_IOCTL = SER_HDR_JUMPTAB+14 ; IOCTL routine -SER_HDR_JUMPCOUNT = 9 ; Number of jump vectors +SER_HDR_JUMPCOUNT = 8 ; Number of jump vectors ;------------------------------------------------------------------------------ ; Offsets into the struct passed to ser_params @@ -85,7 +84,7 @@ SER_BAUD_38400 = $10 SER_BAUD_57600 = $11 SER_BAUD_115200 = $12 SER_BAUD_230400 = $13 - + ; Data bit settings SER_BITS_5 = $00 SER_BITS_6 = $01 @@ -125,11 +124,10 @@ SER_STATUS_DSR = $40 ; NOT data set ready .global ser_install .global ser_uninstall - .global ser_params + .global ser_open + .global ser_close .global ser_get .global ser_put - .global ser_pause - .global ser_unpause .global ser_status .global ser_ioctl @@ -140,11 +138,10 @@ SER_STATUS_DSR = $40 ; NOT data set ready .global _ser_unload .global _ser_install .global _ser_uninstall - .global _ser_params + .global _ser_open + .global _ser_close .global _ser_get .global _ser_put - .global _ser_pause - .global _ser_unpause .global _ser_status .global _ser_ioctl diff --git a/include/serial.h b/include/serial.h index 5079a96d8..23934e926 100644 --- a/include/serial.h +++ b/include/serial.h @@ -139,8 +139,11 @@ unsigned char __fastcall__ ser_uninstall (void); * Note: This call does not free allocated memory. */ -unsigned char __fastcall__ ser_params (const struct ser_params* params); -/* Set the port parameters. This will also enable the port. */ +unsigned char __fastcall__ ser_open (const struct ser_params* params); +/* "Open" the port by setting the port parameters and enable interrupts. */ + +unsigned char __fastcall__ ser_close (void); +/* "Close" the port. Clear buffers and and disable interrupts. */ unsigned char __fastcall__ ser_get (char* b); /* Get a character from the serial port. If no characters are available, the @@ -153,12 +156,6 @@ unsigned char __fastcall__ ser_put (char b); * SER_ERR_OVERFLOW if there is no space left in the transmit buffer. */ -unsigned char __fastcall__ ser_pause (void); -/* Assert flow control and disable interrupts. */ - -unsigned char __fastcall__ ser_unpause (void); -/* Re-enable interrupts and release flow control */ - unsigned char __fastcall__ ser_status (unsigned char* status); /* Return the serial port status. */ diff --git a/libsrc/serial/Makefile b/libsrc/serial/Makefile index 10af8bb07..e1dbfbd00 100644 --- a/libsrc/serial/Makefile +++ b/libsrc/serial/Makefile @@ -20,13 +20,12 @@ C_OBJS = ser_load.o S_OBJS = ser-kernel.o \ + ser_close.o \ ser_get.o \ - ser_params.o \ - ser_pause.o \ + ser_open.o \ ser_put.o \ ser_status.o \ - ser_unload.o \ - ser_unpause.o + ser_unload.o #-------------------------------------------------------------------------- diff --git a/libsrc/serial/ser-kernel.s b/libsrc/serial/ser-kernel.s index 8d9159d13..daa6580a3 100644 --- a/libsrc/serial/ser-kernel.s +++ b/libsrc/serial/ser-kernel.s @@ -24,11 +24,10 @@ _ser_drv: .res 2 ; Pointer to driver ser_vectors: ser_install: jmp return0 ser_uninstall: jmp return0 -ser_params: jmp return0 +ser_open: jmp return0 +ser_close: jmp return0 ser_get: jmp return0 ser_put: jmp return0 -ser_pause: jmp return0 -ser_unpause: jmp return0 ser_status: jmp return0 ser_ioctl: jmp return0 diff --git a/libsrc/serial/ser_close.s b/libsrc/serial/ser_close.s new file mode 100644 index 000000000..b49419a49 --- /dev/null +++ b/libsrc/serial/ser_close.s @@ -0,0 +1,12 @@ +; +; Ullrich von Bassewitz, 2003-08-22 +; +; unsigned char __fastcall__ ser_close (void); +; /* "Close" the port. Clear buffers and and disable interrupts. */ + + + .include "ser-kernel.inc" + + _ser_close = ser_close + + diff --git a/libsrc/serial/ser_open.s b/libsrc/serial/ser_open.s new file mode 100644 index 000000000..22ac98d4b --- /dev/null +++ b/libsrc/serial/ser_open.s @@ -0,0 +1,24 @@ +; +; Ullrich von Bassewitz, 2003-08-22 +; +; unsigned char __fastcall__ ser_open (const struct ser_params* params); +; /* "Open" the port by setting the port parameters and enable interrupts. */ + + + + .importzp ptr1 + + .include "ser-kernel.inc" + + + +.proc _ser_open + + sta ptr1 + stx ptr1+1 ; Save pointer to params + jmp ser_open ; Call the driver + +.endproc + + + diff --git a/libsrc/serial/ser_pause.s b/libsrc/serial/ser_pause.s deleted file mode 100644 index c77d0acf7..000000000 --- a/libsrc/serial/ser_pause.s +++ /dev/null @@ -1,12 +0,0 @@ -; -; Ullrich von Bassewitz, 2003-04-18 -; -; unsigned char __fastcall__ ser_pause (void); -; /* Assert flow control and disable interrupts. */ - - - - .include "ser-kernel.inc" - - _ser_pause = ser_pause - diff --git a/libsrc/serial/ser_unpause.s b/libsrc/serial/ser_unpause.s deleted file mode 100644 index 31ad42204..000000000 --- a/libsrc/serial/ser_unpause.s +++ /dev/null @@ -1,11 +0,0 @@ -; -; Ullrich von Bassewitz, 2003-04-18 -; -; unsigned char __fastcall__ ser_unpause (void); -; /* Re-enable interrupts and release flow control */ - - - .include "ser-kernel.inc" - - _ser_unpause = ser_unpause - -- 2.39.5