Hackfix and re-enable strtoull and wcstoull, see bug #3798.
[sdcc.git] / sdcc / device / include / tinibios.h
blob5c90a3be404c3b7d517999faa0f216c8d5282a4a
1 /*-------------------------------------------------------------------------
2 time.h
4 Copyright (C) 2001, Johan Knol <johan.knol AT iduna.nl>
6 This library 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.
11 This library 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.
16 You should have received a copy of the GNU General Public License
17 along with this library; see the file COPYING. If not, write to the
18 Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
19 MA 02110-1301, USA.
21 As a special exception, if you link this library with other files,
22 some of which are compiled with SDCC, to produce an executable,
23 this library does not by itself cause the resulting executable to
24 be covered by the GNU General Public License. This exception does
25 not however invalidate any other reasons why the executable file
26 might be covered by the GNU General Public License.
27 -------------------------------------------------------------------------*/
29 #ifndef TINIBIOS_H
31 #define TINIBIOS_H
33 #include <ds80c390.h>
34 #include <time.h>
36 void Serial0Init (unsigned long baud, unsigned char buffered);
37 char Serial0GetChar(void);
38 void Serial0PutChar(char);
39 char Serial0CharArrived(void);
40 void Serial0Baud(unsigned long baud);
41 void Serial0SendBreak(void);
42 void Serial0Flush(void);
44 void Serial0SwitchToBuffered(void); /* ds400 only. */
46 void Serial1Init (unsigned long baud, unsigned char buffered);
47 char Serial1GetChar(void);
48 void Serial1PutChar(char);
49 char Serial1CharArrived(void);
50 void Serial1Baud(unsigned long baud);
51 void Serial1SendBreak(void);
52 void Serial1Flush(void);
54 unsigned long ClockTicks(void);
55 void ClockMilliSecondsDelay(unsigned long ms);
56 void ClockMicroSecondsDelay(unsigned int us);
58 #define SERIAL_0_BAUD 115200L
59 #define SERIAL_1_BAUD 9600L
61 /* these need to be binary numbers */
62 #define SERIAL_0_RECEIVE_BUFFER_SIZE 1024
63 #define SERIAL_1_RECEIVE_BUFFER_SIZE 64
65 /* I know someone is fooling with the crystals */
66 #if defined(__SDCC_ds400)
67 # define OSCILLATOR 14745600L
68 #else
69 # define OSCILLATOR 18432000L
70 #endif
72 /* Set the cpu speed in clocks per machine cycle, valid values are:
73 1024: Divide-by-1024 (power management) mode (screws ALL timers and serial)
74 4: Standard 8051 divide-by-4 mode
75 2: Use 2x xtal multiplier
76 1: Use 4x xtal multiplier (Don't do this with a TINI at 18.432MHz)
78 #define CPU_SPEED 2
79 void CpuSpeed(unsigned int speed);
81 /* The MOVX stretch cycles, see datasheet */
82 #define CPU_MOVX_STRETCH 0x01
84 /* from rtc390.c */
85 #define HAVE_RTC
86 unsigned char RtcRead(struct tm *rtcDate);
87 void RtcWrite(struct tm *rtcDate);
89 /* from lcd390.c */
90 extern void LcdInit(void);
91 extern void LcdOn(void);
92 extern void LcdOff(void);
93 extern void LcdClear(void);
94 extern void LcdHome(void);
95 extern void LcdGoto(unsigned int collumnRow);
96 extern void LcdPutChar(char c);
97 extern void LcdPutString(char *string);
98 extern void LcdLPutString(unsigned int collumnRow, char *string);
99 extern void LcdPrintf(const char *format, ...) __reentrant;
100 extern void LcdLPrintf(unsigned int collumnRow, const char *format, ...) __reentrant;
102 /* from i2c390.c */
103 #define I2C_BUFSIZE 128
104 extern char I2CReset(void);
105 extern char I2CStart(void);
106 extern char I2CStop(void);
107 extern char I2CSendStop(char addr, char count,
108 char send_stop);
109 extern char I2CReceive(char addr, char count);
110 extern char I2CSendReceive(char addr, char tx_count,
111 char rx_count);
112 /*extern char I2CByteOut(char);*/
113 /*extern void I2CDumpError(char);*/
115 /* global transfer buffers */
116 extern char i2cTransmitBuffer[I2C_BUFSIZE];
117 extern char i2cReceiveBuffer[I2C_BUFSIZE];
119 /* Macro for normal send transfer ending with a stop condition */
120 #define I2CSend(addr, count) I2CSendStop(addr, count, 1)
123 /* internal functions used by tinibios.c */
124 unsigned char _sdcc_external_startup(void);
125 void Serial0IrqHandler (void) __interrupt (4);
126 void Serial1IrqHandler (void) __interrupt (7);
128 #if !defined(__SDCC_ds400)
129 void ClockInit(void);
130 void ClockIrqHandler (void) __interrupt (1) __naked;
131 #endif
133 #if defined(__SDCC_ds400)
134 /* functions for dealing with the ds400 ROM firmware. */
136 /* A wrapper which calls rom_init allocating all available RAM in CE0
137 to the heap, sets the serial port to SERIAL_0_BAUD, sets up the
138 millisecond timer, and diddles the clock multiplier. */
140 /* Values for the romInit "speed" parameter. */
141 #define SPEED_1X 0 /* no clock multiplier, normal speed. */
142 #define SPEED_2X 1 /* 2x clock multiplier. */
143 #define SPEED_4X 2 /* 4x clock, DOESN'T WORK ON TINIm400! */
145 unsigned char romInit(unsigned char noisy,
146 char speed);
148 /* Install an interrupt handler. */
149 void installInterrupt(void (*isrPtr)(void), unsigned char offset);
150 #endif
153 #endif /* TINIBIOS_H */