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:
1
libsrc/serial/.cvsignore
Normal file
1
libsrc/serial/.cvsignore
Normal file
@@ -0,0 +1 @@
|
||||
ser_load.s
|
||||
@@ -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
|
||||
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
|
||||
@@ -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
25
libsrc/serial/ser_get.s
Normal 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
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
24
libsrc/serial/ser_params.s
Normal file
24
libsrc/serial/ser_params.s
Normal 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
12
libsrc/serial/ser_pause.s
Normal 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
14
libsrc/serial/ser_put.s
Normal 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
|
||||
|
||||
21
libsrc/serial/ser_status.s
Normal file
21
libsrc/serial/ser_status.s
Normal 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
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
.include "ser-error.inc"
|
||||
.include "modload.inc"
|
||||
|
||||
|
||||
_ser_unload:
|
||||
lda _ser_drv
|
||||
ora _ser_drv+1
|
||||
|
||||
11
libsrc/serial/ser_unpause.s
Normal file
11
libsrc/serial/ser_unpause.s
Normal 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
|
||||
|
||||
Reference in New Issue
Block a user