X-Git-Url: http://git.osdn.net/view?p=chnosproject%2FCHNOSProject.git;a=blobdiff_plain;f=CHNOSProject%2Fchnos%2Ftolset_chn_000%2Fchnos_010%2Fchnos%2Fserial.c;fp=CHNOSProject%2Fchnos%2Ftolset_chn_000%2Fchnos_010%2Fchnos%2Fserial.c;h=527471484b95960c689e5563c42998135de5d622;hp=0000000000000000000000000000000000000000;hb=7ad2ef33b005253914c33f34658c5a35a74554a3;hpb=bcbf8f3753455cca09c00d4d971518e1da897cbc diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/serial.c b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/serial.c new file mode 100644 index 0000000..5274714 --- /dev/null +++ b/CHNOSProject/chnos/tolset_chn_000/chnos_010/chnos/serial.c @@ -0,0 +1,32 @@ + +#include "core.h" + +void Initialize_SerialPort(void) +{ + IO_Out8(COM1_CTRL_LINE, 0x80); //ƒ{[ƒŒ[ƒgÝ’èŠJŽn + IO_Out8(COM1_BAUD_LSB, 0x06); //0x06 = 19.2bps + IO_Out8(COM1_CTRL_LINE, 0x03); //ƒ{[ƒŒ[ƒgÝ’èI—¹A‘—ŽóMƒf[ƒ^8bit + IO_Out8(COM1_CTRL_MODEM, 0x0b); //Š„‚荞‚Ý—LŒøARTSADTRƒsƒ“‚ðƒAƒNƒeƒBƒu‰» +// IO_Out8(COM1_INTR_ENBL, 0x04); //ƒ‰ƒCƒ“ƒXƒe[ƒ^ƒXŠ„‚荞‚Ý + IO_Out8(COM1_INTR_ENBL, 0x00); //Š„‚荞‚Ý‚È‚µ + + return; +} + +void SerialPort_Send(const uchar s[]) +{ + for (; *s != 0x00; s++){ + if(*s == '\n'){ + IO_Out8(COM1_TX, '\r'); + for(; (IO_In8(COM1_STA_LINE) & 0x40) == 0; ){ + + } + } + IO_Out8(COM1_TX, *s); + for(; (IO_In8(COM1_STA_LINE) & 0x40) == 0; ){ + + } + } + + return; +}