initial import of tinibios
authorjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Fri, 2 Feb 2001 09:36:19 +0000 (09:36 +0000)
committerjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Fri, 2 Feb 2001 09:36:19 +0000 (09:36 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@555 4a8a32a2-be11-0410-ad9d-d568d2c75423

device/include/serial390.h
device/lib/ds390/Makefile
device/lib/ds390/serial390.c [deleted file]
device/lib/ds390/startup390.c [deleted file]

index 426379df88379ac2cbc9c76a45942f2d404c6e3d..cc4cffabb13f62a237be97288eb939d22bbb659c 100644 (file)
@@ -1,61 +1,7 @@
-/*-------------------------------------------------------------------------
-  Include file for serial390.c. You can change some default's here.
-  
-   Written By - Johan Knol, johan.knol@iduna.nl
-    
-   This program is free software; you can redistribute it and/or modify it
-   under the terms of the GNU General Public License as published by the
-   Free Software Foundation; either version 2, or (at your option) any
-   later version.
-   
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-   
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-   
-   In other words, you are welcome to use, share and improve this program.
-   You are forbidden to forbid anyone else to use, share and improve
-   what you give them.   Help stamp out software-hoarding!  
--------------------------------------------------------------------------*/
-
 #ifndef SERIAL390_H
 #define SERIAL390_H
 
-/* Here we have to decide whether or not to use interrupts for serial output.
-   If your debug messages (don't we use them all :), doesn't show up
-   like you expect (e.g. when you screwed up the stack or tilted the cpu 
-   otherwise) or if you're expecting a lot of them that might overflow 
-   the ring buffer, disable it. It will slow down other things you might be
-   doing, but will leave serial output synchronized with that. */
-#define USE_SERIAL_INTERRUPTS 1
-
-/* Define the size of the ring buffer.
-   This must be a binary number, since we shouldn't use mod (%) in
-   interrupt routines */
-#define SERIAL_RECEIVE_BUFFER_SIZE 1024
-
-/* I'd rather had this calculation be done in Serial390Init(),
-   but since the compiler generates e.g. _divuchar() calls
-   which aren't in the library yet, we do it here. */
-#define BAUD_RATE 115200
-#define OSCILLATOR 18432000L
-#define TIMER1_RELOAD_VALUE -(OSCILLATOR/(32L*BAUD_RATE))
-
-/* there shouldn't be any reason to change anything below this line.
-   If there is, please let me know */
-
-extern void Serial390Init (void);
-
-#if USE_SERIAL_INTERRUPTS
-
-/* the interrupt vector will be automaticly set when the 
-   main program #include-s this file */
-extern void Serial390Handler (void) interrupt 4;
-
-#endif
+#warning "Please use <tinibios.h> instead of <serial390.h>"
+#include <tinibios.h>
 
 #endif SERIAL390_H
index 21c9b2bb1eac9cb06692d40cb6747d86aa4b736e..78a0ee898f903f68bfcf632bfaa6739b1da126f0 100755 (executable)
@@ -2,7 +2,7 @@ CC = ../../../bin/sdcc
 
 #VERBOSE = --verbose
 
-OBJECTS = startup390.rel serial390.rel memcpyx.rel
+OBJECTS = tinibios.rel memcpyx.rel
 
 SOURCES = $(patsubst %.rel,%.c,$(OBJECTS))
 
diff --git a/device/lib/ds390/serial390.c b/device/lib/ds390/serial390.c
deleted file mode 100644 (file)
index 1e1e9d1..0000000
+++ /dev/null
@@ -1,147 +0,0 @@
-/*-------------------------------------------------------------------------
-  serial390.c - serial routines for the DS80C390 (tested on TINI)
-  
-   Written By - Johan Knol, johan.knol@iduna.nl
-    
-   This program is free software; you can redistribute it and/or modify it
-   under the terms of the GNU General Public License as published by the
-   Free Software Foundation; either version 2, or (at your option) any
-   later version.
-   
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-   
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-   
-   In other words, you are welcome to use, share and improve this program.
-   You are forbidden to forbid anyone else to use, share and improve
-   what you give them.   Help stamp out software-hoarding!  
--------------------------------------------------------------------------*/
-
-// make sure that no int (16 bit) and long (32 bit) integer division, 
-// multiplication & modulus operations are used unless the lib-s are
-// compiled reentrant !!!!
-
-// if you want to changed defaults, do so in serial390.h
-
-#include <stdio.h>
-#include <ds80c390.h>
-#include <serial390.h>
-
-#if USE_SERIAL_INTERRUPTS
-
-// this is a ring buffer and can overflow at anytime!
-static volatile unsigned char receiveBuffer[SERIAL_RECEIVE_BUFFER_SIZE];
-static volatile int receiveBufferHead=0;
-static volatile int receiveBufferTail=0;
-// no buffering for transmit
-static volatile char transmitIsBusy=0;
-#endif
-
-void Serial390Init (void) {
-  
-  ES0 = 0; // disable serial channel 0 interrupt
-  TR1 = 0; // stop timer 1
-  
-  // set 8 bit uart with variable baud from timer 1
-  // enable receiver and clear RI and TI
-  SCON0 = 0x50;
-  
-  PCON |= 0x80; // clock is 16x bitrate
-  
-  TMOD = (TMOD&0x0f) | 0x20; // timer 1 is an 8bit auto-reload counter
-  
-  TL1 = TH1 = TIMER1_RELOAD_VALUE;
-  
-  TF1=0; // clear timer 1 overflow flag
-  TR1=1; // start timer 1
-  
-#if USE_SERIAL_INTERRUPTS
-  RI_0=TI_0=0; // clear "pending" interrupts
-  ES0 = 1; // enable serial channel 0 interrupt
-#else
-  RI_0=0; // receive buffer empty
-  TI_0=1; // transmit buffer empty
-#endif
-}
-
-#if USE_SERIAL_INTERRUPTS
-
-void Serial390Handler (void) interrupt 4 {
-  if (RI_0) {
-    receiveBuffer[receiveBufferHead]=SBUF0;
-    //receiveBufferHead=(receiveBufferHead+1)%SERIAL_RECEIVE_BUFFER_SIZE;
-    receiveBufferHead=(receiveBufferHead+1)&(SERIAL_RECEIVE_BUFFER_SIZE-1);
-    if (receiveBufferHead==receiveBufferTail) /* buffer overrun, sorry :) */
-      //receiveBufferTail=(receiveBufferTail+1)%SERIAL_RECEIVE_BUFFER_SIZE;
-      receiveBufferTail=(receiveBufferTail+1)&(SERIAL_RECEIVE_BUFFER_SIZE-1);
-    RI_0=0;
-  }
-  if (TI_0) {
-    TI_0=0;
-    transmitIsBusy=0;
-  }
-}
-
-void putchar (char c)
-{
-  while (transmitIsBusy)
-    ;
-  transmitIsBusy=1;
-  SBUF0=c;
-}
-
-char getchar (void)
-{
-  char c;
-  while (receiveBufferHead==receiveBufferTail)
-    ;
-  c=receiveBuffer[receiveBufferTail];
-  ES0=0; // disable serial interrupts
-  //receiveBufferTail=(receiveBufferTail+1)%SERIAL_RECEIVE_BUFFER_SIZE;
-  receiveBufferTail=(receiveBufferTail+1)&(SERIAL_RECEIVE_BUFFER_SIZE-1);
-  ES0=1; // enable serial interrupts
-  return c;
-}
-
-#else //ifdef USE_SERIALINTERRUPTS
-
-// dummy interupt handler
-void Serial390Handler (void) interrupt 4 {
-  // how did we got here?
-  ES0=0; // disable serial interrupts
-}
-
-void putchar (char c) {
-  while (!TI_0)
-    ;
-  TI_0=0;
-  SBUF0=c;
-}
-
-char getchar (void) {
-  char c;
-  while (!RI_0)
-    ;
-  c=SBUF0;
-  RI_0=0;
-  return c;
-}
-
-#endif // ifdef USE_SERIALINTERRUPTS
-
-#if 0
-static char hex[]="0123456789abcdef";
-
-void putint (unsigned int i) {
-  putchar (hex[(i>>12)&0x0f]);
-  putchar (hex[(i>> 8)&0x0f]);
-  putchar (hex[(i>> 4)&0x0f]);
-  putchar (hex[(i    )&0x0f]);
-}
-
-#endif
diff --git a/device/lib/ds390/startup390.c b/device/lib/ds390/startup390.c
deleted file mode 100755 (executable)
index fdf983f..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
-#include <ds80c390.h>
-#include <serial390.h>
-
-/* This routine is intended to setup the DS80C390 in contiguous addressing
-   mode, using a 10-bit stack (mapped to 0x400000).
-   It assumes that _sdcc_gsinit_startup is called from a boot loader
-   in 22-bit contiguous addressing mode */
-
-/* Uncomment this if you are using the tini loader 000515. Make sure 
-   XSEG starts at 0x100080 or it will overwrite your IVT. This won't harm 
-   if you are using the 990824 loader */
-#define TINI_LOADER_0515
-
-unsigned char _sdcc_external_startup(void)
-{
-  IE=0; // disable ALL interrupts
-
-  _asm
-    ; save the 24-bit return address
-    pop ar2; msb
-    pop ar1
-    pop ar0; lsb
-
-    ; use A19..16 and !CE3..0, no CAN
-    mov _TA,#0xaa; timed access
-    mov _TA,#0x55
-    mov _P4CNT,#0x3f
-
-    ; use !PCE3..0, serial 1 at P5.2/3
-    mov _TA,#0xaa; timed access
-    mov _TA,#0x55
-    mov _P5CNT,#0x27
-
-    ; disable watchdog
-    mov _EWT,#0x00
-
-    ; watchdog set to 9.1 seconds
-    ; timers at 1/4 xtal
-    ; no strech-cycles for movx
-    mov _CKCON,#0xf9;
-
-    ; use internal 4k RAM as data(stack) memory at 0x400000 and
-    ; move CANx memory access to 0x401000 and upwards
-    ; use !CE* for program and/or data memory access
-    mov _TA,#0xaa; timed access
-    mov _TA,#0x55
-    mov _MCON,#0xaf;
-
-    mov _PMR,#0x82; two clocks per cycle
-    mov _PMR,#0x92; enable multiplier
-_Startup390WaitForClock:
-    mov a,_EXIF
-    jnb acc.3,_Startup390WaitForClock; wait for multiplier to be ready
-    mov _PMR,#0x12; one clock per cycle, xtal*2
-
-    mov _TA,#0xaa; timed access
-    mov _TA,#0x55
-    mov _ACON,#0x06; 24-bit addresses, 10-bit stack at 0x400000
-
-    mov _ESP,#0x00; reinitialize the stack
-    mov _SP,#0x00
-
-    ; restore the 24-bit return address
-    push ar0; lsb
-    push ar1
-    push ar2; msb
-  _endasm;
-
-#ifdef TINI_LOADER_0515
-  // Copy the Interrupt Vector Table (128 bytes) from 0x10000 to 0x100000
-  // Make sure that XSEG starts at 0x100080 in this case!
-  _asm
-  push dpx
-  push dph
-  push dpl
-  push dps
-  push b
-  push acc
-  mov dps,#0x00 ; make sure no autoincrement in progress
-  mov dptr,#0x10000 ; from
-  inc dps ; switch to alternate dptr
-  mov dptr,#0x100000 ; to
-  mov b,#0x80 ; count
-
-_Startup390CopyIVT:
-  inc dps
-  movx a,@dptr
-  inc dptr
-  inc dps
-  movx @dptr,a
-  inc dptr
-  djnz b,_Startup390CopyIVT
-
-  pop acc
-  pop b
-  pop dps
-  pop dpl
-  pop dph
-  pop dpx
-  _endasm;
-#endif
-
-  // global interrupt enable, all masks cleared
-  // let the Gods be with us :)
-  IE = 0x80; 
-
-  // now that the stack is re-initialized, we can safely call
-  Serial390Init();
-
-  // signal _sdcc_gsinit_startup to initialize data (call _sdcc_init_data)
-  return 0; 
-}
-