ds390 library support
[fw/sdcc] / device / include / serial390.h
1 /*-------------------------------------------------------------------------
2   Include file for serial390.c. You can change some default's here.
3   
4    Written By - Johan Knol, johan.knol@iduna.nl
5     
6    This program is free software; you can redistribute it and/or modify it
7    under the terms of the GNU General Public License as published by the
8    Free Software Foundation; either version 2, or (at your option) any
9    later version.
10    
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15    
16    You should have received a copy of the GNU General Public License
17    along with this program; if not, write to the Free Software
18    Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19    
20    In other words, you are welcome to use, share and improve this program.
21    You are forbidden to forbid anyone else to use, share and improve
22    what you give them.   Help stamp out software-hoarding!  
23 -------------------------------------------------------------------------*/
24
25 #ifndef SERIAL390_H
26 #define SERIAL390_H
27
28 /* Here we have to decide whether or not to use interrupts for serial output.
29    If your debug messages (don't we use them all :), doesn't show up
30    like you expect (e.g. when you screwed up the stack or tilted the cpu 
31    otherwise) or if you're expecting a lot of them that might overflow 
32    the ring buffer, disable it. It will slow down other things you might be
33    doing, but will leave serial output synchronized with that. */
34 #define USE_SERIAL_INTERRUPTS 1
35
36 /* Define the size of the ring buffer.
37    This must be a binary number, since we shouldn't use mod (%) in
38    interrupt routines */
39 #define SERIAL_RECEIVE_BUFFER_SIZE 1024
40
41 /* I'd rather had this calculation be done in Serial390Init(),
42    but since the compiler generates e.g. _divuchar() calls
43    which aren't in the library yet, we do it here. */
44 #define BAUD_RATE 115200
45 #define OSCILLATOR 18432000L
46 #define TIMER1_RELOAD_VALUE -(OSCILLATOR/(32L*BAUD_RATE))
47
48 /* there shouldn't be any reason to change anything below this line.
49    If there is, please let me know */
50
51 extern void Serial390Init (void);
52
53 #if USE_SERIAL_INTERRUPTS
54
55 /* the interrupt vector will be automaticly set when the 
56    main program #include-s this file */
57 extern void Serial390Handler (void) interrupt 4;
58
59 #endif
60
61 #endif SERIAL390_H