Initial import of tinibios
[fw/sdcc] / device / include / tinibios.h
1 #ifndef TINIBIOS_H
2
3 #define TINIBIOS_H
4
5 #include <ds80c390.h>
6
7 #define Serial0GetChar getchar
8 #define Serial0PutChar putchar
9
10 void Serial0Init (unsigned long baud, unsigned char buffered);
11 char Serial0GetChar(void);
12 void Serial0PutChar(char);
13 char Serial0CharArrived(void);
14 void Serial0Baud(unsigned long baud);
15 void Serial0SendBreak(void);
16 void Serial0Flush(void);
17
18 void Serial1Init (unsigned long baud, unsigned char buffered);
19 char Serial1GetChar(void);
20 void Serial1PutChar(char);
21 char Serial1CharArrived(void);
22 void Serial1Baud(unsigned long baud);
23 void Serial1SendBreak(void);
24 void Serial1Flush(void);
25
26 unsigned long ClockTicks();
27 void ClockMilliSecondsDelay(unsigned long ms);
28 void ClockMicroSecondsDelay(unsigned int us);
29
30 #define SERIAL_0_BAUD 115200L
31 #define SERIAL_1_BAUD 9600L
32
33 // these need to be binary numbers
34 #define SERIAL_0_RECEIVE_BUFFER_SIZE 1024
35 #define SERIAL_1_RECEIVE_BUFFER_SIZE 64
36
37 // I know someone is fooling with the crystals
38 #define OSCILLATOR 18432000L
39
40 /* Set the cpu speed in clocks per machine cycle, valid values are:
41    1024: Divide-by-1024 (power management) mode (screws ALL timers and serial)
42       4: Standard 8051 divide-by-4 mode
43       2: Use 2x xtal multiplier 
44       1: Use 4x xtal multiplier (Don't do this with a TINI at 18.432MHz)
45 */
46 #define CPU_SPEED 2
47 void CpuSpeed(unsigned int speed);
48
49 // The MOVX stretch cycles, see datasheet
50 #define CPU_MOVX_STRETCH 0x01
51
52 // internal functions used by tinibios.c
53 unsigned char _sdcc_external_startup(void);
54 void Serial0IrqHandler (void) interrupt 4;
55 void Serial1IrqHandler (void) interrupt 7;
56 void ClockInit();
57 void ClockIrqHandler (void) interrupt 1;
58
59 #endif TINIBIOS_H