📄 ms_api.lst
字号:
84 for(_i = 0;_i < FW_TB_NUM;_i++)
85 {
86 /* buffer is empty */
87 fw_TB[_i][0].status |= FW_EBIT;
88 /* index of data buffer*/
89 fw_TB[_i][0].index = 0;
90 /* size = 0 */
91 fw_TB[_i][0].length = 0;
92 }
93 }
94 else
95 {
96 TRACE_ERROR( "Alloc TB faild\n\r");
97 TRACE_ERROR( "Num error : %d\n\r",_error);
98 /* free the IN FIFO */
99 po_rngDelete(&fw_fifoId);
\ 0000008E 301C MOV R0,R6
\ 00000090 ........ _BLF po_rngDelete,??po_rngDelete??rT
100 _status = USBMS_ERROR;
101 }
102 }
103 else
104 {
105 TRACE_ERROR( "IN FIFO faild\n\r");
106 _status = USBMS_ERROR;
\ ??usbms_init_5:
\ 00000094 6846 MOV R0,SP
\ 00000096 0021 MOV R1,#+0
\ 00000098 C943 MVN R1,R1 ;; #-1
\ 0000009A 0170 STRB R1,[R0, #+0]
107 }
108
109 /*initialization of global variables */
110 fw_controlData.state = FW_STATE_END;
\ ??usbms_init_10:
\ 0000009C 1648 LDR R0,??usbms_init_0+0x4 ;; fw_controlData
\ 0000009E 0021 MOV R1,#+0
\ 000000A0 0173 STRB R1,[R0, #+12]
111 fw_controlData.pData = NULL;
\ 000000A2 0161 STR R1,[R0, #+16]
112
113 fw_IsrCount = 0;
\ 000000A4 1548 LDR R0,??usbms_init_0+0x8 ;; fw_IsrCount
\ 000000A6 0160 STR R1,[R0, #+0]
114 /* at the beginning we wait until the connection is
115 _* done : the first SOF is received */
116 fw_deviceState |= FW_DS_COMHANG;
\ 000000A8 .... LDR R0,??DataTable10 ;; fw_deviceState
\ 000000AA 0178 LDRB R1,[R0, #+0]
\ 000000AC 8022 MOV R2,#+128
\ 000000AE 0A43 ORR R2,R1
\ 000000B0 0270 STRB R2,[R0, #+0]
117 fw_lastTxPacket = 0;
\ 000000B2 1348 LDR R0,??usbms_init_0+0xC ;; fw_lastTxPacket
\ 000000B4 0021 MOV R1,#+0
\ 000000B6 0170 STRB R1,[R0, #+0]
118
119 return _status;
\ 000000B8 6946 MOV R1,SP
\ 000000BA 0020 MOV R0,#+0
\ 000000BC 0856 LDRSB R0,[R1, R0]
\ ??usbms_init_4:
\ 000000BE 07B0 ADD SP,#+28
\ 000000C0 .... B ?Subroutine3
\ ??usbms_init_7:
\ 000000C2 641C ADD R4,R4,#+1
\ 000000C4 2006 LSL R0,R4,#+24
\ 000000C6 000E LSR R0,R0,#+24
\ 000000C8 0828 CMP R0,#+8
\ 000000CA CBD3 BCC ??usbms_init_6
\ 000000CC 0D48 LDR R0,??usbms_init_0+0x10 ;; fw_writeTB
\ 000000CE 0560 STR R5,[R0, #+0]
\ 000000D0 .... LDR R0,??DataTable5 ;; fw_readTB
\ 000000D2 0560 STR R5,[R0, #+0]
\ 000000D4 0024 MOV R4,#+0
\ 000000D6 0020 MOV R0,#+0
\ ??usbms_init_11:
\ 000000D8 A100 LSL R1,R4,#+2
\ 000000DA 6958 LDR R1,[R5, R1]
\ 000000DC 0A68 LDR R2,[R1, #+0]
\ 000000DE 4023 MOV R3,#+64
\ 000000E0 1343 ORR R3,R2
\ 000000E2 0B60 STR R3,[R1, #+0]
\ 000000E4 8860 STR R0,[R1, #+8]
\ 000000E6 4860 STR R0,[R1, #+4]
\ 000000E8 641C ADD R4,R4,#+1
\ 000000EA 2106 LSL R1,R4,#+24
\ 000000EC 090E LSR R1,R1,#+24
\ 000000EE 0829 CMP R1,#+8
\ 000000F0 D4D2 BCS ??usbms_init_10
\ 000000F2 F1E7 B ??usbms_init_11
\ ??usbms_init_0:
\ 000000F4 ........ DC32 usbms_context
\ 000000F8 ........ DC32 fw_controlData
\ 000000FC ........ DC32 fw_IsrCount
\ 00000100 ........ DC32 fw_lastTxPacket
\ 00000104 ........ DC32 fw_writeTB
120 }
\ In segment CODE, align 4, keep-with-next
\ ?Subroutine3:
\ 00000000 F0BC POP {R4-R7}
\ 00000002 02BC POP {R1}
\ 00000004 0847 BX R1 ;; return
121
122
123 /*****************************************************************
124 *
125 * ROUTINE ms_retreiveTb
126 *
127 *-----------------------------------------------------------------
128 *
129 * Purpose :
130 * scan the TB pool for valid buffers and pick data
131 *
132 * Input parameters : DataBuffer : buffer of data to be retreived
133 * length : length of data to read
134 *
135 * Output parameters : length of data read
136 *
137 * Global data : fw_TB : array of the buffer IDs
138 * fw_writeTB : TB currently used by the firmware
139 * fw_readTB :
140 *
141 *****************************************************************/
\ In segment CODE, align 4, keep-with-next
142 ULONG ms_retreiveTb( char *DataBuffer,ULONG length )
143 {
\ ms_retreiveTb:
\ 00000000 F3B5 PUSH {R0,R1,R4-R7,LR}
\ 00000002 82B0 SUB SP,#+8
144 ULONG _lengthRead = 0, _len = 0;
\ 00000004 0024 MOV R4,#+0
145 structTB *_TB;
146 UCHAR *_indexTB;
147 UCHAR _flag = 0;
\ 00000006 6846 MOV R0,SP
\ 00000008 0471 STRB R4,[R0, #+4]
\ 0000000A .... LDR R6,??DataTable5 ;; fw_readTB
\ 0000000C 1EE0 B ??ms_retreiveTb_0
148 ULONG *_sizeTB;
149
150 while(_lengthRead != length)
151 {
152 _TB = fw_readTB[0];
153
154 /* check the validity of the TB */
155 if(!(_TB->status & FW_VBIT))
156 {
157 break;
158 }
159
160 _sizeTB = (ULONG*)&_TB->length;
161 _indexTB = (UCHAR*)&_TB->data[_TB->index]; /* pointer to the current read position */
162
163 _len = length - _lengthRead;
164
165 /* if the length of data to read is larger than the number of data in the current TB */
166 if(*_sizeTB < _len)
167 {
168 _len = *_sizeTB;
169 }
170
171 /* read the data in the current */
172 po_memcpy( (DataBuffer + _lengthRead),_indexTB ,_len);
173
174 /* update the size in the TB and the size of data read*/
175 *_sizeTB -= _len;
176 _lengthRead += _len;
177
178 if(*_sizeTB == 0)
179 {
180 po_lock();
\ ??ms_retreiveTb_1:
\ 0000000E ........ _BLF po_lock,??po_lock??rT
181 /* let the TB be empty*/
182 _TB->status |= FW_EBIT;
\ 00000012 2868 LDR R0,[R5, #+0]
\ 00000014 4021 MOV R1,#+64
\ 00000016 0143 ORR R1,R0
\ 00000018 2960 STR R1,[R5, #+0]
183 USB_RX--;
\ 0000001A .... LDR R0,??DataTable6 ;; USB_RX
\ 0000001C 0168 LDR R1,[R0, #+0]
\ 0000001E 491E SUB R1,R1,#+1
\ 00000020 0160 STR R1,[R0, #+0]
184 /* index of data buffer*/
185 _TB->index = 0;
\ 00000022 0020 MOV R0,#+0
\ 00000024 A860 STR R0,[R5, #+8]
186 /* let the TB be unvalid */
187 _TB->status &= ~FW_VBIT;
\ 00000026 2868 LDR R0,[R5, #+0]
\ 00000028 8021 MOV R1,#+128
\ 0000002A 8843 BIC R0,R1
\ 0000002C 2860 STR R0,[R5, #+0]
188 po_unlock();
\ 0000002E ........ _BLF po_unlock,??po_unlock??rT
189
190 fw_readTB++;
\ 00000032 3068 LDR R0,[R6, #+0]
\ 00000034 001D ADD R0,R0,#+4
\ 00000036 3060 STR R0,[R6, #+0]
191 /* it is the end of the pool */
192 if(fw_readTB > (fw_TB + (FW_TB_NUM - 1)))
\ 00000038 .... LDR R0,??DataTable7 ;; fw_TB
\ 0000003A 011C MOV R1,R0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -