Working on new serial API

git-svn-id: svn://svn.cc65.org/cc65/trunk@2069 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz
2003-04-18 16:29:51 +00:00
parent 2cba160622
commit a07cc4a4c1
14 changed files with 339 additions and 5 deletions

1
libsrc/serial/.cvsignore Normal file
View File

@@ -0,0 +1 @@
ser_load.s

View File

@@ -20,7 +20,13 @@
C_OBJS = ser_load.o
S_OBJS = ser-kernel.o \
ser_unload.o
ser_get.o \
ser_params.o \
ser_pause.o \
ser_put.o \
ser_status.o \
ser_unload.o \
ser_unpause.o
#--------------------------------------------------------------------------

View File

@@ -24,6 +24,12 @@ _ser_drv: .res 2 ; Pointer to driver
ser_vectors:
ser_install: jmp return0
ser_uninstall: jmp return0
ser_params: jmp return0
ser_get: jmp return0
ser_put: jmp return0
ser_pause: jmp return0
ser_unpause: jmp return0
ser_status: jmp return0
; Driver header signature
.rodata

25
libsrc/serial/ser_get.s Normal file
View File

@@ -0,0 +1,25 @@
;
; Ullrich von Bassewitz, 2003-04-18
;
; unsigned char __fastcall__ ser_get (char* b);
; /* Get a character from the serial port. If no characters are available, the
; * function will return SER_ERR_NO_DATA, so this is not a fatal error.
; */
.importzp ptr1
.include "ser-kernel.inc"
.proc _ser_get
sta ptr1
stx ptr1+1 ; Save pointer to char
jmp ser_get ; Call the driver
.endproc

View File

@@ -36,8 +36,24 @@
#include <string.h>
#include <fcntl.h>
#include <modload.h>
#include <ser.h>
#include <ser/ser-kernel.h>
#include <serial.h>
/*****************************************************************************/
/* Data */
/*****************************************************************************/
/* Pointer to serial driver, exported from ser-kernel.s */
extern void* ser_drv;
/*****************************************************************************/
/* Code */
/*****************************************************************************/
@@ -79,4 +95,3 @@ unsigned char __fastcall__ ser_load_driver (const char* name)

View File

@@ -0,0 +1,24 @@
;
; Ullrich von Bassewitz, 2003-04-18
;
; unsigned char __fastcall__ ser_params (const struct ser_params* params);
; /* Set the port parameters. This will also enable the port. */
.importzp ptr1
.include "ser-kernel.inc"
.proc _ser_params
sta ptr1
stx ptr1+1 ; Save pointer to params
jmp ser_params ; Call the driver
.endproc

12
libsrc/serial/ser_pause.s Normal file
View File

@@ -0,0 +1,12 @@
;
; 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

14
libsrc/serial/ser_put.s Normal file
View File

@@ -0,0 +1,14 @@
;
; Ullrich von Bassewitz, 2003-04-18
;
; unsigned char __fastcall__ ser_put (char b);
; /* Send a character via the serial port. There is a transmit buffer, but
; * transmitting is not done via interrupt. The function returns
; * SER_ERR_OVERFLOW if there is no space left in the transmit buffer.
; */
.include "ser-kernel.inc"
_ser_put = ser_put

View File

@@ -0,0 +1,21 @@
;
; Ullrich von Bassewitz, 2003-04-18
;
; unsigned char __fastcall__ ser_status (unsigned char* status);
; /* Return the serial port status. */
.importzp ptr1
.include "ser-kernel.inc"
.proc _ser_status
sta ptr1
stx ptr1+1 ; Save pointer to status
jmp ser_status ; Call the driver
.endproc

View File

@@ -11,6 +11,7 @@
.include "ser-error.inc"
.include "modload.inc"
_ser_unload:
lda _ser_drv
ora _ser_drv+1

View File

@@ -0,0 +1,11 @@
;
; 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