📄 usb_prop.s79
字号:
// 82
RSEG DATA_I:DATA:SORT:NOROOT(2)
// 83 ONE_DESCRIPTOR Config_Descriptor =
Config_Descriptor:
DS8 8
REQUIRE `?<Initializer for Config_Descriptor>`
// 84 {
// 85 (u8*)Virtual_Com_Port_ConfigDescriptor,
// 86 VIRTUAL_COM_PORT_SIZ_CONFIG_DESC
// 87 };
// 88
RSEG DATA_I:DATA:SORT:NOROOT(2)
// 89 ONE_DESCRIPTOR String_Descriptor[4] =
String_Descriptor:
DS8 32
REQUIRE `?<Initializer for String_Descriptor>`
// 90 {
// 91 {(u8*)Virtual_Com_Port_StringLangID, VIRTUAL_COM_PORT_SIZ_STRING_LANGID},
// 92 {(u8*)Virtual_Com_Port_StringVendor, VIRTUAL_COM_PORT_SIZ_STRING_VENDOR},
// 93 {(u8*)Virtual_Com_Port_StringProduct, VIRTUAL_COM_PORT_SIZ_STRING_PRODUCT},
// 94 {(u8*)Virtual_Com_Port_StringSerial, VIRTUAL_COM_PORT_SIZ_STRING_SERIAL}
// 95 };
// 96
// 97 /* Extern variables ----------------------------------------------------------*/
// 98 /* Private function prototypes -----------------------------------------------*/
// 99 /* Extern function prototypes ------------------------------------------------*/
// 100 /* Private functions ---------------------------------------------------------*/
// 101 /*******************************************************************************
// 102 * Function Name : Virtual_Com_Port_init.
// 103 * Description : Virtual COM Port Mouse init routine.
// 104 * Input : None.
// 105 * Output : None.
// 106 * Return : None.
// 107 *******************************************************************************/
RSEG CODE:CODE:NOROOT(2)
CFI Block cfiBlock0 Using cfiCommon0
CFI Function Virtual_Com_Port_init
THUMB
// 108 void Virtual_Com_Port_init(void)
// 109 {
Virtual_Com_Port_init:
PUSH {R4,LR}
CFI ?RET Frame(CFA, -4)
CFI R4 Frame(CFA, -8)
CFI CFA R13+8
// 110
// 111 /* Update the serial number string descriptor with the data from the unique
// 112 ID*/
// 113 Get_SerialNum();
_BLF Get_SerialNum,??Get_SerialNum??rT
// 114
// 115 pInformation->Current_Configuration = 0;
LDR.N R0,??DataTable13 ;; pInformation
MOVS R4,#+0
LDR R0,[R0, #+0]
STRB R4,[R0, #+10]
// 116
// 117 /* Connect the device */
// 118 PowerOn();
_BLF PowerOn,??PowerOn??rT
// 119 /* USB interrupts initialization */
// 120 /* clear pending interrupts */
// 121 _SetISTR(0);
LDR.N R0,??Virtual_Com_Port_init_0 ;; 0x40005c44
// 122 wInterrupt_Mask = IMR_MSK;
LDR.N R1,??Virtual_Com_Port_init_0+0x4 ;; wInterrupt_Mask
STR R4,[R0, #+0]
MOVS R0,#+34304
STRH R0,[R1, #+0]
// 123 /* set interrupts mask */
// 124 _SetCNTR(wInterrupt_Mask);
LDR.N R1,??Virtual_Com_Port_init_0+0x8 ;; 0x40005c40
STR R0,[R1, #+0]
// 125
// 126 /* configure the USART 1 to the default settings */
// 127 USART_Config_Default();
_BLF USART_Config_Default,??USART_Config_Default??rT
// 128
// 129 bDeviceState = UNCONNECTED;
LDR.N R0,??DataTable5 ;; bDeviceState
STR R4,[R0, #+0]
// 130 }
POP {R4,PC} ;; return
DATA
??Virtual_Com_Port_init_0:
DC32 0x40005c44
DC32 wInterrupt_Mask
DC32 0x40005c40
CFI EndBlock cfiBlock0
// 131
// 132 /*******************************************************************************
// 133 * Function Name : Virtual_Com_Port_Reset
// 134 * Description : Virtual_Com_Port Mouse reset routine
// 135 * Input : None.
// 136 * Output : None.
// 137 * Return : None.
// 138 *******************************************************************************/
RSEG CODE:CODE:NOROOT(2)
CFI Block cfiBlock1 Using cfiCommon0
CFI Function Virtual_Com_Port_Reset
THUMB
// 139 void Virtual_Com_Port_Reset(void)
// 140 {
// 141 /* Set Virtual_Com_Port DEVICE as not configured */
// 142 pInformation->Current_Configuration = 0;
Virtual_Com_Port_Reset:
LDR.N R1,??DataTable13 ;; pInformation
// 143
// 144 /* Current Feature initialization */
// 145 pInformation->Current_Feature = Virtual_Com_Port_ConfigDescriptor[7];
LDR.N R3,??Virtual_Com_Port_Reset_0 ;; Virtual_Com_Port_ConfigDescriptor + 7
PUSH {LR}
CFI ?RET Frame(CFA, -4)
CFI CFA R13+4
LDR R2,[R1, #+0]
MOVS R0,#+0
STRB R0,[R2, #+10]
LDR R2,[R1, #+0]
LDRB R3,[R3, #+0]
STRB R3,[R2, #+9]
// 146
// 147 /* Set Virtual_Com_Port DEVICE with the default Interface*/
// 148 pInformation->Current_Interface = 0;
LDR R1,[R1, #+0]
STRB R0,[R1, #+11]
// 149 SetBTABLE(BTABLE_ADDRESS);
_BLF SetBTABLE,??SetBTABLE??rT
// 150
// 151 /* Initialize Endpoint 0 */
// 152 SetEPType(ENDP0, EP_CONTROL);
MOVS R1,#+512
MOVS R0,#+0
_BLF SetEPType,??SetEPType??rT
// 153 SetEPTxStatus(ENDP0, EP_TX_STALL);
MOVS R1,#+16
MOVS R0,#+0
_BLF SetEPTxStatus,??SetEPTxStatus??rT
// 154 SetEPRxAddr(ENDP0, ENDP0_RXADDR);
MOVS R1,#+64
MOVS R0,#+0
_BLF SetEPRxAddr,??SetEPRxAddr??rT
// 155 SetEPTxAddr(ENDP0, ENDP0_TXADDR);
MOVS R1,#+128
MOVS R0,#+0
_BLF SetEPTxAddr,??SetEPTxAddr??rT
// 156 Clear_Status_Out(ENDP0);
MOVS R0,#+0
_BLF Clear_Status_Out,??Clear_Status_Out??rT
// 157 SetEPRxCount(ENDP0, Device_Property.MaxPacketSize);
LDR.N R0,??Virtual_Com_Port_Reset_0+0x4 ;; Device_Property + 44
LDRB R1,[R0, #+0]
MOVS R0,#+0
_BLF SetEPRxCount,??SetEPRxCount??rT
// 158 SetEPRxValid(ENDP0);
MOVS R0,#+0
_BLF SetEPRxValid,??SetEPRxValid??rT
// 159
// 160 /* Initialize Endpoint 1 */
// 161 SetEPType(ENDP1, EP_BULK);
MOVS R1,#+0
MOVS R0,#+1
_BLF SetEPType,??SetEPType??rT
// 162 SetEPTxAddr(ENDP1, ENDP1_TXADDR);
MOVS R1,#+192
MOVS R0,#+1
_BLF SetEPTxAddr,??SetEPTxAddr??rT
// 163 SetEPTxStatus(ENDP1, EP_TX_NAK);
MOVS R1,#+32
MOVS R0,#+1
_BLF SetEPTxStatus,??SetEPTxStatus??rT
// 164 SetEPRxStatus(ENDP1, EP_RX_DIS);
MOVS R1,#+0
MOVS R0,#+1
_BLF SetEPRxStatus,??SetEPRxStatus??rT
// 165
// 166 /* Initialize Endpoint 2 */
// 167 SetEPType(ENDP2, EP_INTERRUPT);
MOVS R1,#+1536
MOVS R0,#+2
_BLF SetEPType,??SetEPType??rT
// 168 SetEPTxAddr(ENDP2, ENDP2_TXADDR);
LDR.N R1,??Virtual_Com_Port_Reset_0+0x8 ;; 0x1bf
MOVS R0,#+2
_BLF SetEPTxAddr,??SetEPTxAddr??rT
// 169 SetEPRxStatus(ENDP2, EP_RX_DIS);
MOVS R1,#+0
MOVS R0,#+2
_BLF SetEPRxStatus,??SetEPRxStatus??rT
// 170 SetEPTxStatus(ENDP2, EP_TX_NAK);
MOVS R1,#+32
MOVS R0,#+2
_BLF SetEPTxStatus,??SetEPTxStatus??rT
// 171
// 172 /* Initialize Endpoint 3 */
// 173 SetEPType(ENDP3, EP_BULK);
MOVS R1,#+0
MOVS R0,#+3
_BLF SetEPType,??SetEPType??rT
// 174 SetEPRxAddr(ENDP3, ENDP3_RXADDR);
LDR.N R1,??Virtual_Com_Port_Reset_0+0xC ;; 0x1cf
MOVS R0,#+3
_BLF SetEPRxAddr,??SetEPRxAddr??rT
// 175 SetEPRxCount(ENDP3, VIRTUAL_COM_PORT_DATA_SIZE);
MOVS R1,#+255
MOVS R0,#+3
_BLF SetEPRxCount,??SetEPRxCount??rT
// 176 SetEPRxStatus(ENDP3, EP_RX_VALID);
MOVS R1,#+12288
MOVS R0,#+3
_BLF SetEPRxStatus,??SetEPRxStatus??rT
// 177 SetEPTxStatus(ENDP3, EP_TX_DIS);
MOVS R1,#+0
MOVS R0,#+3
_BLF SetEPTxStatus,??SetEPTxStatus??rT
// 178
// 179 /* Set this device to response on default address */
// 180 SetDeviceAddress(0);
MOVS R0,#+0
_BLF SetDeviceAddress,??SetDeviceAddress??rT
// 181
// 182 bDeviceState = ATTACHED;
LDR.N R0,??DataTable5 ;; bDeviceState
MOVS R1,#+1
STR R1,[R0, #+0]
// 183 }
POP {PC} ;; return
DATA
??Virtual_Com_Port_Reset_0:
DC32 Virtual_Com_Port_ConfigDescriptor + 7
DC32 Device_Property + 44
DC32 0x1bf
DC32 0x1cf
CFI EndBlock cfiBlock1
// 184
// 185 /*******************************************************************************
// 186 * Function Name : Virtual_Com_Port_SetConfiguration.
// 187 * Description : Udpade the device state to configured.
// 188 * Input : None.
// 189 * Output : None.
// 190 * Return : None.
// 191 *******************************************************************************/
RSEG CODE:CODE:NOROOT(2)
CFI Block cfiBlock2 Using cfiCommon0
CFI Function Virtual_Com_Port_SetConfiguration
THUMB
// 192 void Virtual_Com_Port_SetConfiguration(void)
// 193 {
// 194 DEVICE_INFO *pInfo = &Device_Info;
// 195
// 196 if (pInfo->Current_Configuration != 0)
Virtual_Com_Port_SetConfiguration:
LDR.N R0,??Virtual_Com_Port_SetConfiguration_0 ;; Device_Info + 10
LDRB R0,[R0, #+0]
CBZ R0,??Virtual_Com_Port_SetConfiguration_1
// 197 {
// 198 /* Device configured */
// 199 bDeviceState = CONFIGURED;
LDR.N R0,??DataTable5 ;; bDeviceState
MOVS R1,#+5
STR R1,[R0, #+0]
// 200 }
// 201 }
??Virtual_Com_Port_SetConfiguration_1:
BX LR ;; return
Nop
DATA
??Virtual_Com_Port_SetConfiguration_0:
DC32 Device_Info + 10
CFI EndBlock cfiBlock2
// 202
// 203 /*******************************************************************************
// 204 * Function Name : Virtual_Com_Port_SetConfiguration.
// 205 * Description : Udpade the device state to addressed.
// 206 * Input : None.
// 207 * Output : None.
// 208 * Return : None.
// 209 *******************************************************************************/
RSEG CODE:CODE:NOROOT(2)
CFI Block cfiBlock3 Using cfiCommon0
CFI Function Virtual_Com_Port_SetDeviceAddress
THUMB
// 210 void Virtual_Com_Port_SetDeviceAddress (void)
// 211 {
// 212 bDeviceState = ADDRESSED;
Virtual_Com_Port_SetDeviceAddress:
LDR.N R0,??DataTable5 ;; bDeviceState
MOVS R1,#+4
STR R1,[R0, #+0]
// 213 }
BX LR ;; return
CFI EndBlock cfiBlock3
RSEG CODE:CODE:NOROOT(2)
DATA
??DataTable5:
DC32 bDeviceState
// 214
// 215 /*******************************************************************************
// 216 * Function Name : Virtual_Com_Port_Status_In.
// 217 * Description : Virtual COM Port Status In Routine.
// 218 * Input : None.
// 219 * Output : None.
// 220 * Return : None.
// 221 *******************************************************************************/
RSEG CODE:CODE:NOROOT(2)
CFI Block cfiBlock4 Using cfiCommon0
CFI Function Virtual_Com_Port_Status_In
THUMB
// 222 void Virtual_Com_Port_Status_In(void)
// 223 {
Virtual_Com_Port_Status_In:
PUSH {R4,LR}
CFI ?RET Frame(CFA, -4)
CFI R4 Frame(CFA, -8)
CFI CFA R13+8
// 224 if (Request == SET_LINE_CODING)
LDR.N R4,??DataTable8 ;; Request
LDRB R0,[R4, #+0]
CMP R0,#+32
BNE.N ??Virtual_Com_Port_Status_In_0
// 225 {
// 226 USART_Config();
_BLF USART_Config,??USART_Config??rT
// 227 Request = 0;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -