/*******************************************************/
/*                                                     */ 
/*  Library for I-8000_ALL (40M or 80M CPU).           */
/*                                                     */ 
/*******************************************************/
Important notice:
    (A) must call InitLib(); first.
    (B) must call AddCom2Fun(); first when need to use COM2.
    
=====================================================================
== [Ver 2.04] =======================================================
=====================================================================
[2005/11/04]
RestoreCom_3()/RestoreCom_4() [WP_G
pGOb C836 V2.x ϥήɡA|t@ PORT ]Sϥήɤ~Is 
RestoreCom_34().

U٥iHu@NOnnb InstallCom_4() ɦ۰ʩIs 
EnableMonitorCom4();
oӳ[WܡA USER ]|K@ǡC
iHbϥ RDC  CPUɤ~IsAϥ AMD  CPU NΩIsC
LoLDէAӥ[WC

[2005/11/03]
1.Improve the compatibility of some functions for H/W C836 V2.5 ,
  So the code written for H/W C836 V1.2 can be used for H/W C836 V2.5.
  The functions are:
  InstallCom_3()/RestoreCom_3()
  InstallCOm_4()/RestoreCom_4()
  EnableMonitorCom4()/DisableMonitorCom4()
  
=====================================================================
== [Ver 2.03] =======================================================
=====================================================================
[2005/05/17]
Add functions for S256/S512. 

[2005/05/27]
Add two functions:
int SetDelayTimer(int no);
int SetUserTimer(int no);
for seting the timer used by the delay functions: Delay()/Delay_1()/Delay_2()
& InstallUserTimerFunction_us()/InstallUserTimerFunction_ms().
By defualt all these functions will use timer 0, Now it can be set to use timer 1.

[2005/07/22]
Fixed the bug in functions:
SendCmdTo7000()/ReceiveResponseFrom7000()/ReceiveResponseFrom7000_1() 
when using COM2.

[2005/09/15]
In 8000.H add the declaration of function "SetDataFormat()":
int SetDataFormat(int port,int databit,int parity,int stopbit);


=====================================================================
== [Ver 2.02] =======================================================
=====================================================================
[2004/11/16]
Add functions:

void InstallNewTimer(void);
int _IsSystemKey(void);
int _GetSystemKey(void);
void _ClearSystemKey(void);

[2004/11/29]
Add some functions for I-8114/8112/8144/8142

int GetCtsControlMode8000(int slot,int port);
int GetRtsControlMode8000(int slot,int port);
int GetCom8000TxBufferFreeSize(int slot, int port);
void ClearCom8000TxBuffer(int slot, int port);
int GetCurMsr8000(int slot,int port);
int GetMsrChanged8000(int slot,int port);
void ClrMsrChanged8000(int slot,int port);
int SetCom8000FifoTriggerLevel(int slot, int port, int level);
int GetCom8000FifoTriggerLevel(int slot, int port);

[2005/02/14] add
int InstallCom_34(unsigned long baud, int data, int parity,int stop);
int RestoreCom_34(void);

void SetPioDir(unsigned pin,int dir);
void SetPio(int pin,int mode);
int GetPio(int pin);

[2005/02/21] Add
void far * AllocateTopMemory(unsigned long size);

[2005/04/01] 
modify functions DO_16(),DO_32(),DIO_DO_16(),UDIO_WriteConfig_16(),
use two outp() to instead of one outpw().
(outpw() can not work well for 80M Hz CPU.)


=====================================================================
== [Ver 2.01] =======================================================
=====================================================================

[2004/06/25]
1.fix bug for RefreshWDT() to work with FlashErase()/FlashWrite().

[2004/07/05]
1.fix bug for ReadComn_3()/ReadComn_4()

[2004/07/26]
1.modify functions for i-8050.
2.add functions for COM4 DSR/DTR.
  The DSR/DTR functions (*) can work well only when COM4 can use interrupt mode(*2).

(*1)
the variables : 
    CurMsr_4,bMsrChanged_4.
the functions : 
    void SetDsrControlMode_4(int mode);/* not finished */
    void SetDtrControlMode_4(int mode);/* not finished */

(*2)
COM4 on I-8000 series can use interrupt mode when
1. the CPU of I-8000 is Am188ES.
or
2. COM0 does not use DMA mode.
(When the CPU is RDC R1120 or R8820 can not support both COM0 DMA & COM4 interrupt.) 

[2004/07/27]
Add functions for COM2 on I-8x1x.
InstallCom_2()/RestoreCom_2()/IsCom_2()/ReadCom_2()... always WORK.
But need call AddCom2Fun() for InstallCom(2,..)/RestoreCom(2)/IsCom(2)/ReadCom(2)... to work.

[2004/08/06]
fix bug: function ReadInitPin() will not return the right status on 40M CPU.

[2004/10/13]
Add function GetSerialNumber(). 
Now Only 40M CPU card for I-8x3x support 8 bytes H/W serial number.



