SoftUart.s43
上传用户:xhjmsc
上传日期:2019-09-13
资源大小:389k
文件大小:13k
- NAME SoftUart
- RTMODEL "__double_size", "32"
- RTMODEL "__pic", "no"
- RTMODEL "__reg_r4", "free"
- RTMODEL "__reg_r5", "free"
- RTMODEL "__rt_version", "1"
- RSEG CSTACK:DATA:SORT:NOROOT(1)
- EXTERN gucGeneralStatus
- EXTERN delay1us
- FUNCTION delay1us,0202H
- EXTERN gucFrhErrorStatus
- EXTERN gwTimeOverflowCount
- EXTERN ?longjmp_r4
- EXTERN ?longjmp_r5
- EXTERN ?setjmp_r4
- EXTERN ?setjmp_r5
- PUBWEAK ?setjmp_save_r4
- PUBWEAK ?setjmp_save_r5
- PUBLIC Delay1us
- FUNCTION Delay1us,0203H
- LOCFRAME CSTACK, 2, STACK
- PUBWEAK P1IN
- PUBWEAK P6IN
- PUBWEAK P6OUT
- PUBLIC SoftUartDelay
- FUNCTION SoftUartDelay,0203H
- LOCFRAME CSTACK, 2, STACK
- PUBLIC SoftUartDelay7us
- FUNCTION SoftUartDelay7us,0203H
- LOCFRAME CSTACK, 2, STACK
- PUBLIC SoftUartDelay8p7us
- FUNCTION SoftUartDelay8p7us,0203H
- LOCFRAME CSTACK, 2, STACK
- PUBLIC SoftUartDelayHalf
- FUNCTION SoftUartDelayHalf,0203H
- LOCFRAME CSTACK, 2, STACK
- PUBLIC SoftUartRxOneFrame
- FUNCTION SoftUartRxOneFrame,021203H
- LOCFRAME CSTACK, 6, STACK
- PUBLIC SoftUartTxOneFrame
- FUNCTION SoftUartTxOneFrame,021203H
- LOCFRAME CSTACK, 6, STACK
-
- CFI Names cfiNames0
- CFI StackFrame CFA SP DATA
- CFI Resource PC:16, SP:16, SR:16, R4:16, R5:16, R6:16, R7:16, R8:16
- CFI Resource R9:16, R10:16, R11:16, R12:16, R13:16, R14:16, R15:16
- CFI EndNames cfiNames0
-
- CFI Common cfiCommon0 Using cfiNames0
- CFI CodeAlign 2
- CFI DataAlign 2
- CFI ReturnAddress PC CODE
- CFI CFA SP+2
- CFI PC Frame(CFA, -2)
- CFI SR Undefined
- CFI R4 SameValue
- CFI R5 SameValue
- CFI R6 SameValue
- CFI R7 SameValue
- CFI R8 SameValue
- CFI R9 SameValue
- CFI R10 SameValue
- CFI R11 SameValue
- CFI R12 Undefined
- CFI R13 Undefined
- CFI R14 Undefined
- CFI R15 Undefined
- CFI EndCommon cfiCommon0
-
- // E:projectFaxProgramVson_Bryan_Fax_Conexant_070423filesSoftUart.c
- // 1 //soft UART
- // 2 //new bryan Jan. 23, 2007
- // 3 //
- // 4
- // 5 #include "includeH.h"
- ASEGN DATA16_AN:DATA:NOROOT,020H
- // unsigned char const volatile __data P1IN
- P1IN:
- DS8 1
- ASEGN DATA16_AN:DATA:NOROOT,034H
- // unsigned char const volatile __data P6IN
- P6IN:
- DS8 1
- ASEGN DATA16_AN:DATA:NOROOT,035H
- // unsigned char volatile __data P6OUT
- P6OUT:
- DS8 1
- // 6
- // 7
- // 8
- RSEG CODE:CODE:NOROOT(1)
- // 9 unsigned char SoftUartRxOneFrame(void)
- SoftUartRxOneFrame:
- CFI Block cfiBlock0 Using cfiCommon0
- CFI Function SoftUartRxOneFrame
- // 10 {
- FUNCALL SoftUartRxOneFrame, delay1us
- LOCFRAME CSTACK, 6, STACK
- FUNCALL SoftUartRxOneFrame, delay1us
- LOCFRAME CSTACK, 6, STACK
- FUNCALL SoftUartRxOneFrame, delay1us
- LOCFRAME CSTACK, 6, STACK
- PUSH.W R10
- CFI R10 Frame(CFA, -4)
- CFI CFA SP+4
- PUSH.W R11
- CFI R11 Frame(CFA, -6)
- CFI CFA SP+6
- // 11 unsigned char ucGeneralCount=0,ucSoftUartRxData=0;
- MOV.B #0x0, R11
- MOV.B #0x0, R10
- // 12 while ((SOFTUART_PORT_IN & bitSOFTUARTRX) == bitSOFTUARTRX)//wait start bit Low
- ??SoftUartRxOneFrame_0:
- BIT.B #0x2, &0x34
- JNC ??SoftUartRxOneFrame_3
- // 13 {
- // 14 if ((gucGeneralStatus & bitModemActive) == bitModemActive)
- BIT.B #0x2, &gucGeneralStatus
- JC ??SoftUartRxOneFrame_3
- // 15 break;
- // 16 if (((KEY_PORT_IN & bitKeyRingNumDec) != bitKeyRingNumDec) ||
- // 17 ((KEY_PORT_IN & bitKeyRingNumAdd) != bitKeyRingNumAdd) ||
- // 18 ((KEY_PORT_IN & bitKeyAutoMode) != bitKeyAutoMode) ||
- // 19 ((KEY_PORT_IN & bitKeyManualMode) != bitKeyManualMode)) //||
- BIT.B #0x1, &0x20
- JNC ??SoftUartRxOneFrame_3
- BIT.B #0x2, &0x20
- JNC ??SoftUartRxOneFrame_3
- BIT.B #0x4, &0x20
- JNC ??SoftUartRxOneFrame_3
- BIT.B #0x8, &0x20
- JC ??SoftUartRxOneFrame_0
- // 20 //((KEY_PORT_IN & bitKeySendFaxSignal) != bitKeySendFaxSignal))
- // 21 break;
- // 22 }
- // 23 if ( (SOFTUART_PORT_IN & bitSOFTUARTRX) != bitSOFTUARTRX)
- ??SoftUartRxOneFrame_3:
- BIT.B #0x2, &0x34
- JC ??SoftUartRxOneFrame_4
- // 24 {
- // 25 delay1us(6);//SoftUartDelay();
- MOV.W #0x6, R12
- CALL #delay1us
- // 26 for (ucGeneralCount=0;ucGeneralCount<8;ucGeneralCount++)
- MOV.B #0x0, R11
- ??SoftUartRxOneFrame_1:
- CMP.B #0x8, R11
- JC ??SoftUartRxOneFrame_2
- // 27 {
- // 28 delay1us(2);//SoftUartDelayHalf();
- MOV.W #0x2, R12
- CALL #delay1us
- // 29 ucSoftUartRxData=ucSoftUartRxData>>1;
- CLRC
- RRC.B R10
- // 30 if ((SOFTUART_PORT_IN & bitSOFTUARTRX) == bitSOFTUARTRX)
- BIT.B #0x2, &0x34
- JNC ??SoftUartRxOneFrame_5
- // 31 ucSoftUartRxData |= BIT7;//BIT7;//(1<<ucGeneralCount);//set Rx bit
- BIS.B #0x80, R10
- JMP ??SoftUartRxOneFrame_6
- // 32 else
- // 33 {ucSoftUartRxData &= ~BIT7;__no_operation();__no_operation();__no_operation();}//~BIT7;//~(1<<ucGeneralCount);//set Rx bit
- ??SoftUartRxOneFrame_5:
- BIC.B #0x80, R10
- NOP
- NOP
- NOP
- // 34
- // 35 delay1us(2);//SoftUartDelayHalf();
- ??SoftUartRxOneFrame_6:
- MOV.W #0x2, R12
- CALL #delay1us
- // 36 __no_operation();
- NOP
- // 37 __no_operation();
- NOP
- // 38 __no_operation();
- NOP
- // 39 __no_operation();
- NOP
- // 40 __no_operation();
- NOP
- // 41 }
- ADD.B #0x1, R11
- JMP ??SoftUartRxOneFrame_1
- // 42 //delay1us(6);
- // 43 while ((SOFTUART_PORT_IN & bitSOFTUARTRX) != bitSOFTUARTRX) //wait stop bit High
- ??SoftUartRxOneFrame_2:
- BIT.B #0x2, &0x34
- JC ??SoftUartRxOneFrame_4
- // 44 {
- // 45 if ((SOFTUART_PORT_IN & bitSOFTUARTRX) == bitSOFTUARTRX)
- BIT.B #0x2, &0x34
- JC ??SoftUartRxOneFrame_4
- // 46 break;
- // 47 gucFrhErrorStatus=0x00;//
- MOV.B #0x0, &gucFrhErrorStatus
- // 48 if (gwTimeOverflowCount++ == 0xffff)
- MOV.W &gwTimeOverflowCount, R14
- MOV.W #0x1, R15
- ADD.W R14, R15
- MOV.W R15, &gwTimeOverflowCount
- CMP.W #0xffff, R14
- JNE ??SoftUartRxOneFrame_2
- // 49 {gucFrhErrorStatus=0x03;gwTimeOverflowCount=0;break;}
- MOV.B #0x3, &gucFrhErrorStatus
- MOV.W #0x0, &gwTimeOverflowCount
- // 50 }
- // 51 //delay1us(6);//SoftUartDelay();
- // 52 }
- // 53 return ucSoftUartRxData;
- ??SoftUartRxOneFrame_4:
- MOV.B R10, R12
- POP.W R11
- CFI R11 SameValue
- CFI CFA SP+4
- POP.W R10
- CFI R10 SameValue
- CFI CFA SP+2
- RET
- CFI EndBlock cfiBlock0
- // 54 }
- // 55
- RSEG CODE:CODE:NOROOT(1)
- // 56 void SoftUartTxOneFrame(unsigned char ucSoftUartTxData)
- SoftUartTxOneFrame:
- CFI Block cfiBlock1 Using cfiCommon0
- CFI Function SoftUartTxOneFrame
- // 57 {
- FUNCALL SoftUartTxOneFrame, delay1us
- LOCFRAME CSTACK, 6, STACK
- FUNCALL SoftUartTxOneFrame, delay1us
- LOCFRAME CSTACK, 6, STACK
- FUNCALL SoftUartTxOneFrame, delay1us
- LOCFRAME CSTACK, 6, STACK
- PUSH.W R10
- CFI R10 Frame(CFA, -4)
- CFI CFA SP+4
- PUSH.W R11
- CFI R11 Frame(CFA, -6)
- CFI CFA SP+6
- MOV.B R12, R10
- // 58 unsigned char ucGeneralCount=0;
- MOV.B #0x0, R11
- // 59 __disable_interrupt();
- DINT
- // 60 SOFTUART_PORT_OUT &= ~bitSOFTUARTTX; //reset Tx bit
- BIC.B #0x1, &0x35
- // 61 delay1us(7);//115 9600//57 19200//17 57600 //7 115200
- MOV.W #0x7, R12
- CALL #delay1us
- // 62 //__no_operation();
- // 63 //__no_operation();
- // 64 //__no_operation();
- // 65 //delay1us(8);
- // 66 for (ucGeneralCount=0;ucGeneralCount<8;ucGeneralCount++)
- MOV.B #0x0, R11
- ??SoftUartTxOneFrame_0:
- CMP.B #0x8, R11
- JC ??SoftUartTxOneFrame_1
- // 67 {
- // 68
- // 69 if ((ucSoftUartTxData & BIT0) == BIT0)
- BIT.B #0x1, R10
- JNC ??SoftUartTxOneFrame_2
- // 70 {SOFTUART_PORT_OUT |= bitSOFTUARTTX;} //set Tx bit
- BIS.B #0x1, &0x35
- JMP ??SoftUartTxOneFrame_3
- // 71 else
- // 72 {SOFTUART_PORT_OUT &= ~bitSOFTUARTTX;__no_operation();__no_operation();__no_operation();} //reset Tx bit
- ??SoftUartTxOneFrame_2:
- BIC.B #0x1, &0x35
- NOP
- NOP
- NOP
- // 73 delay1us(6);//115 9600 //56 19200//16 57600 //6 115200
- ??SoftUartTxOneFrame_3:
- MOV.W #0x6, R12
- CALL #delay1us
- // 74 //__no_operation();
- // 75 __no_operation();
- NOP
- // 76 ucSoftUartTxData=ucSoftUartTxData>>1;
- CLRC
- RRC.B R10
- // 77
- // 78 }
- ADD.B #0x1, R11
- JMP ??SoftUartTxOneFrame_0
- // 79 __no_operation();
- ??SoftUartTxOneFrame_1:
- NOP
- // 80 __no_operation();
- NOP
- // 81 SOFTUART_PORT_OUT |= bitSOFTUARTTX; //set Tx bit
- BIS.B #0x1, &0x35
- // 82 delay1us(7);//115 9600 //17 57600//7 115200
- MOV.W #0x7, R12
- CALL #delay1us
- // 83 _EINT(); //enable interrupt
- EINT
- // 84 }
- POP.W R11
- CFI R11 SameValue
- CFI CFA SP+4
- POP.W R10
- CFI R10 SameValue
- CFI CFA SP+2
- RET
- CFI EndBlock cfiBlock1
- // 85
- // 86
- RSEG CODE:CODE:NOROOT(1)
- // 87 void SoftUartDelay7us(void)
- SoftUartDelay7us:
- CFI Block cfiBlock2 Using cfiCommon0
- CFI Function SoftUartDelay7us
- // 88 {
- // 89 unsigned wGeneralCount=0;
- MOV.W #0x0, R14
- // 90 //BauRate1200 wGeneralCount<831 BauRate9600 wGeneralCount<96 BauRate115200 6 42 19200
- // 91 for (wGeneralCount=0;wGeneralCount<4;wGeneralCount++)
- MOV.W #0x0, R14
- ??SoftUartDelay7us_0:
- CMP.W #0x4, R14
- JC ??SoftUartDelay7us_1
- // 92 {
- // 93 __no_operation();
- NOP
- // 94 }
- ADD.W #0x1, R14
- JMP ??SoftUartDelay7us_0
- // 95
- // 96 }
- ??SoftUartDelay7us_1:
- RET
- CFI EndBlock cfiBlock2
- // 97
- RSEG CODE:CODE:NOROOT(1)
- // 98 void SoftUartDelay8p7us(void)
- SoftUartDelay8p7us:
- CFI Block cfiBlock3 Using cfiCommon0
- CFI Function SoftUartDelay8p7us
- // 99 {
- // 100 unsigned wGeneralCount=0;
- MOV.W #0x0, R14
- // 101 //BauRate1200 wGeneralCount<831 BauRate9600 wGeneralCount<96 BauRate115200 6 42 19200
- // 102 for (wGeneralCount=0;wGeneralCount<4;wGeneralCount++)
- MOV.W #0x0, R14
- ??SoftUartDelay8p7us_0:
- CMP.W #0x4, R14
- JC ??SoftUartDelay8p7us_1
- // 103 {
- // 104 __no_operation();
- NOP
- // 105 __no_operation();
- NOP
- // 106 }
- ADD.W #0x1, R14
- JMP ??SoftUartDelay8p7us_0
- // 107
- // 108 }
- ??SoftUartDelay8p7us_1:
- RET
- CFI EndBlock cfiBlock3
- // 109
- RSEG CODE:CODE:NOROOT(1)
- // 110 void SoftUartDelay(void)
- SoftUartDelay:
- CFI Block cfiBlock4 Using cfiCommon0
- CFI Function SoftUartDelay
- // 111 {
- // 112 unsigned wGeneralCount=0;
- MOV.W #0x0, R14
- // 113 //BauRate1200 wGeneralCount<831 BauRate9600 wGeneralCount<96 BauRate115200 6 42 19200
- // 114 for (wGeneralCount=0;wGeneralCount<96;wGeneralCount++)
- MOV.W #0x0, R14
- ??SoftUartDelay_0:
- CMP.W #0x60, R14
- JC ??SoftUartDelay_1
- // 115 {
- // 116 __no_operation();
- NOP
- // 117 }
- ADD.W #0x1, R14
- JMP ??SoftUartDelay_0
- // 118 }
- ??SoftUartDelay_1:
- RET
- CFI EndBlock cfiBlock4
- // 119
- RSEG CODE:CODE:NOROOT(1)
- // 120 void SoftUartDelayHalf(void)
- SoftUartDelayHalf:
- CFI Block cfiBlock5 Using cfiCommon0
- CFI Function SoftUartDelayHalf
- // 121 {
- // 122 unsigned wGeneralCount=0;
- MOV.W #0x0, R14
- // 123 for (wGeneralCount=0;wGeneralCount<48;wGeneralCount++)//BauRate1200 wGeneralCount<831 BauRate9600 wGeneralCount<96
- MOV.W #0x0, R14
- ??SoftUartDelayHalf_0:
- CMP.W #0x30, R14
- JC ??SoftUartDelayHalf_1
- // 124 {
- // 125 __no_operation();
- NOP
- // 126 }
- ADD.W #0x1, R14
- JMP ??SoftUartDelayHalf_0
- // 127
- // 128 }
- ??SoftUartDelayHalf_1:
- RET
- CFI EndBlock cfiBlock5
- // 129
- RSEG CODE:CODE:SORT:NOROOT(1)
- // 130 void Delay1us(void)
- Delay1us:
- CFI Block cfiBlock6 Using cfiCommon0
- CFI Function Delay1us
- // 131 {
- // 132 __no_operation();
- NOP
- // 133 __no_operation();
- NOP
- // 134 __no_operation();
- NOP
- // 135 __no_operation();
- NOP
- // 136 __no_operation();
- NOP
- // 137 __no_operation();
- NOP
- // 138 __no_operation();
- NOP
- // 139 __no_operation();
- NOP
- // 140
- // 141 }
- RET
- CFI EndBlock cfiBlock6
- RSEG CODE:CODE:NOROOT(1)
- ?setjmp_save_r4:
- REQUIRE ?setjmp_r4
- REQUIRE ?longjmp_r4
- RSEG CODE:CODE:NOROOT(1)
- ?setjmp_save_r5:
- REQUIRE ?setjmp_r5
- REQUIRE ?longjmp_r5
- END
- //
- // 344 bytes in segment CODE
- // 3 bytes in segment DATA16_AN
- //
- // 344 bytes of CODE memory
- // 0 bytes of DATA memory (+ 3 bytes shared)
- //
- //Errors: none
- //Warnings: none