14 |
14 |
15 TmtpAstDev g_AstDevice; |
15 TmtpAstDev g_AstDevice; |
16 TmtpAstDev * g_pAstDevice = &g_AstDevice ; |
16 TmtpAstDev * g_pAstDevice = &g_AstDevice ; |
17 |
17 |
18 static uint16_t replybuf[512] ; |
18 static uint16_t replybuf[512] ; |
19 static uint8_t *replyptr = (uint8_t *) replybuf ; |
|
20 |
19 |
21 static uint8_t * |
20 static uint8_t * |
22 GetReplyArea(void) |
21 GetReplyArea(void) |
23 { |
22 { |
24 /*assert(replyptr != 0) ;*/ |
|
25 replyptr = 0 ; |
|
26 return (uint8_t *) replybuf ; |
23 return (uint8_t *) replybuf ; |
27 } |
24 } |
28 |
25 |
29 static void |
|
30 RestoreReplyArea(void) |
|
31 { |
|
32 replyptr = (uint8_t *) replybuf ; |
|
33 } |
|
34 |
26 |
35 /* Globals */ |
27 /* Globals */ |
36 /*static uint8_t pktbuffer3[512] ;*/ |
28 /*static uint8_t pktbuffer3[512] ;*/ |
37 |
29 |
38 #ifdef CY_AS_USB_TB_FOUR |
30 #ifdef CY_AS_USB_TB_FOUR |
43 static uint8_t pktbuffer11[512] ; |
35 static uint8_t pktbuffer11[512] ; |
44 #endif |
36 #endif |
45 |
37 |
46 /*static uint8_t turbopktbuffer[512] ;*/ |
38 /*static uint8_t turbopktbuffer[512] ;*/ |
47 |
39 |
48 static CyBool gUsbTestDone = CyFalse ; |
|
49 static volatile CyBool gSetConfig = CyFalse ; |
40 static volatile CyBool gSetConfig = CyFalse ; |
50 static volatile CyBool gAsyncStallDone = CyFalse ; |
41 static volatile CyBool gAsyncStallDone = CyFalse ; |
51 |
42 |
52 static volatile CyBool gStorageReleaseBus0 = CyFalse ; |
43 static volatile CyBool gStorageReleaseBus0 = CyFalse ; |
53 static volatile CyBool gStorageReleaseBus1 = CyFalse ; |
44 static volatile CyBool gStorageReleaseBus1 = CyFalse ; |
55 static volatile CyAsHalDeviceTag g_tag ; |
46 static volatile CyAsHalDeviceTag g_tag ; |
56 |
47 |
57 static uint8_t MyConfiguration = 0 ; |
48 static uint8_t MyConfiguration = 0 ; |
58 static CyCh9ConfigurationDesc *desc_p = 0 ; |
49 static CyCh9ConfigurationDesc *desc_p = 0 ; |
59 static CyCh9ConfigurationDesc *other_p = 0 ; |
50 static CyCh9ConfigurationDesc *other_p = 0 ; |
60 static CyBool gSetupPending = CyFalse ; |
|
61 |
51 |
62 static volatile uint8_t gAsyncStallStale = 0; |
52 static volatile uint8_t gAsyncStallStale = 0; |
63 |
53 |
64 /* Forward declarations */ |
54 /* Forward declarations */ |
65 static int SetupUSBPPort(CyAsDeviceHandle h, uint8_t media, CyBool isTurbo) ; |
55 static int SetupUSBPPort(CyAsDeviceHandle h, uint8_t media, CyBool isTurbo) ; |
101 } |
91 } |
102 |
92 |
103 static void |
93 static void |
104 StallCallbackAsync(CyAsDeviceHandle h, CyAsReturnStatus_t status, uint32_t tag, CyAsFunctCBType cbtype, void *cbdata) |
94 StallCallbackAsync(CyAsDeviceHandle h, CyAsReturnStatus_t status, uint32_t tag, CyAsFunctCBType cbtype, void *cbdata) |
105 { |
95 { |
106 CyAsReturnStatus_t ret ; |
96 #ifdef PRINT_DEBUG_INFO |
|
97 CyAsReturnStatus_t ret ; |
|
98 #endif |
107 (void)cbtype ; |
99 (void)cbtype ; |
108 (void)cbdata ; |
100 (void)cbdata ; |
109 (void)tag ; |
101 (void)tag ; |
110 (void)status ; |
102 (void)status ; |
111 |
103 |
112 if(gAsyncStallStale == 0) |
104 if(gAsyncStallStale == 0) |
113 { |
105 { |
114 gAsyncStallStale++; |
106 gAsyncStallStale++; |
115 ret = CyAsUsbClearStall(h, 3, StallCallbackAsync, 21); |
107 #ifdef PRINT_DEBUG_INFO |
|
108 ret = |
|
109 #endif |
|
110 CyAsUsbClearStall(h, 3, StallCallbackAsync, 21); |
116 CyAsHalAssert(ret == CY_AS_ERROR_SUCCESS) ; |
111 CyAsHalAssert(ret == CY_AS_ERROR_SUCCESS) ; |
117 } |
112 } |
118 else |
113 else |
119 { |
114 { |
120 gAsyncStallDone = CyTrue ; |
115 gAsyncStallDone = CyTrue ; |
287 { |
282 { |
288 CyAsReturnStatus_t ret ; |
283 CyAsReturnStatus_t ret ; |
289 CyAsUsbEnumControl config ; |
284 CyAsUsbEnumControl config ; |
290 #ifdef DEBUG_ZERO |
285 #ifdef DEBUG_ZERO |
291 CyAsUsbEndPointConfig epconfig ; |
286 CyAsUsbEndPointConfig epconfig ; |
|
287 (void)epconfig; |
292 #endif |
288 #endif |
293 uint32_t count = 0 ; |
289 uint32_t count = 0 ; |
294 char *media_name = "SD"; |
|
295 |
|
296 gUsbTestDone = CyFalse ; |
|
297 |
290 |
298 CyAsHalPrintMessage("*** SetupUSBPPort...\n") ; |
291 CyAsHalPrintMessage("*** SetupUSBPPort...\n") ; |
299 /* |
292 /* |
300 * Intialize the primary descriptor to be the full speed descriptor and the |
293 * Intialize the primary descriptor to be the full speed descriptor and the |
301 * other descriptor to by the high speed descriptor. This will swap if we see a |
294 * other descriptor to by the high speed descriptor. This will swap if we see a |
381 } |
374 } |
382 |
375 |
383 ret = CyAsStorageQueryMedia(h, CyAsMediaSDFlash, &count, 0, 0) ; |
376 ret = CyAsStorageQueryMedia(h, CyAsMediaSDFlash, &count, 0, 0) ; |
384 if (ret != CY_AS_ERROR_SUCCESS) |
377 if (ret != CY_AS_ERROR_SUCCESS) |
385 { |
378 { |
386 CyAsHalPrintMessage("CyAsMtpApp: Cannot query %s device count - Reason code %d\n", media_name, ret) ; |
379 CyAsHalPrintMessage("CyAsMtpApp: Cannot query SD device count - Reason code %d\n", ret) ; |
387 return -ret ; |
380 return -ret ; |
388 } |
381 } |
389 CyAsHalPrintMessage("CyAsMtpApp: %d %s device(s) found\n", count, media_name) ; |
382 CyAsHalPrintMessage("CyAsMtpApp: %d %s device(s) found\n", count, media_name) ; |
390 |
383 |
391 ret = CyAsStorageClaim(h, CyAsBus_1, 0, 0, 0) ; |
384 ret = CyAsStorageClaim(h, CyAsBus_1, 0, 0, 0) ; |
392 if (ret != CY_AS_ERROR_SUCCESS) |
385 if (ret != CY_AS_ERROR_SUCCESS) |
393 { |
386 { |
394 CyAsHalPrintMessage("CyAsMtpApp: Cannot claim %s media - Reason code %d\n", media_name, ret) ; |
387 CyAsHalPrintMessage("CyAsMtpApp: Cannot claim SD media - Reason code %d\n", ret) ; |
395 return -ret; |
388 return -ret; |
396 } |
389 } |
397 |
390 |
398 /* We know that there is only one */ |
391 /* We know that there is only one */ |
399 g_pAstDevice->dev_data.bus = CyAsBus_1 ; |
392 g_pAstDevice->dev_data.bus = CyAsBus_1 ; |
400 g_pAstDevice->dev_data.device = 0 ; |
393 g_pAstDevice->dev_data.device = 0 ; |
401 ret = CyAsStorageQueryDevice(h, &(g_pAstDevice->dev_data), 0, 0) ; |
394 ret = CyAsStorageQueryDevice(h, &(g_pAstDevice->dev_data), 0, 0) ; |
402 if (ret != CY_AS_ERROR_SUCCESS) |
395 if (ret != CY_AS_ERROR_SUCCESS) |
403 { |
396 { |
404 CyAsHalPrintMessage("CyAsMtpApp: Cannot query %s device - Reason code %d\n", media_name, ret) ; |
397 CyAsHalPrintMessage("CyAsMtpApp: Cannot query SD device - Reason code %d\n", ret) ; |
405 return -ret ; |
398 return -ret ; |
406 } |
399 } |
407 CyAsHalPrintMessage("CyAsMtpApp: blocksize %d, %d units found\n", |
400 CyAsHalPrintMessage("CyAsMtpApp: blocksize %d, %d units found\n", |
408 g_pAstDevice->dev_data.desc_p.block_size, g_pAstDevice->dev_data.desc_p.number_units) ; |
401 g_pAstDevice->dev_data.desc_p.block_size, g_pAstDevice->dev_data.desc_p.number_units) ; |
409 |
402 |
412 g_pAstDevice->unit_data.unit = 0 ; |
405 g_pAstDevice->unit_data.unit = 0 ; |
413 /* We know that there is only one */ |
406 /* We know that there is only one */ |
414 ret = CyAsStorageQueryUnit(h, &(g_pAstDevice->unit_data), 0, 0) ; |
407 ret = CyAsStorageQueryUnit(h, &(g_pAstDevice->unit_data), 0, 0) ; |
415 if (ret != CY_AS_ERROR_SUCCESS) |
408 if (ret != CY_AS_ERROR_SUCCESS) |
416 { |
409 { |
417 CyAsHalPrintMessage("CyAsMtpApp: Cannot query %s device unit - Reason code %d\n", media_name, ret) ; |
410 CyAsHalPrintMessage("CyAsMtpApp: Cannot query SD device unit - Reason code %d\n", ret) ; |
418 return -ret ; |
411 return -ret ; |
419 } |
412 } |
420 CyAsHalPrintMessage("CyAsMtpApp: blocksize %d, %d Block(s) found\n", |
413 CyAsHalPrintMessage("CyAsMtpApp: blocksize %d, %d Block(s) found\n", |
421 g_pAstDevice->unit_data.desc_p.block_size, g_pAstDevice->unit_data.desc_p.unit_size) ; |
414 g_pAstDevice->unit_data.desc_p.block_size, g_pAstDevice->unit_data.desc_p.unit_size) ; |
422 |
415 |
601 { |
594 { |
602 (void)count ; |
595 (void)count ; |
603 (void)h ; |
596 (void)h ; |
604 (void)buf_p ; |
597 (void)buf_p ; |
605 |
598 |
606 /*assert(ep == 0) ; |
|
607 assert(buf_p == replybuf) ;*/ |
|
608 |
|
609 RestoreReplyArea() ; |
|
610 if (status != CY_AS_ERROR_SUCCESS) |
599 if (status != CY_AS_ERROR_SUCCESS) |
611 CyAsHalPrintMessage("Error returned in SetupWriteCallback - %d\n", status) ; |
600 CyAsHalPrintMessage("Error returned in SetupWriteCallback - %d\n", status) ; |
612 |
|
613 gSetupPending = CyFalse ; |
|
614 } |
601 } |
615 |
602 |
616 static CyAsReturnStatus_t |
603 static CyAsReturnStatus_t |
617 SetupWrite(CyAsDeviceHandle h, uint32_t requested, uint32_t dsize, void *data) |
604 SetupWrite(CyAsDeviceHandle h, uint32_t requested, uint32_t dsize, void *data) |
618 { |
605 { |
738 /* |
722 /* |
739 * Return the device descriptor |
723 * Return the device descriptor |
740 */ |
724 */ |
741 CyAsHalPrintMessage("**** CY_CH9_GD_DEVICE (size = %d)\n", sizeof(pport_device_desc)) ; |
725 CyAsHalPrintMessage("**** CY_CH9_GD_DEVICE (size = %d)\n", sizeof(pport_device_desc)) ; |
742 PrintData("DD", (uint8_t *)&pport_device_desc, sizeof(pport_device_desc)) ; |
726 PrintData("DD", (uint8_t *)&pport_device_desc, sizeof(pport_device_desc)) ; |
743 |
|
744 ret = SendSetupData(h, reqlen, sizeof(pport_device_desc), &pport_device_desc) ; |
727 ret = SendSetupData(h, reqlen, sizeof(pport_device_desc), &pport_device_desc) ; |
745 if (ret != CY_AS_ERROR_SUCCESS) |
728 if (ret != CY_AS_ERROR_SUCCESS) |
746 CyAsHalPrintMessage("****** ERROR WRITING USB DATA - %d\n", ret) ; |
729 CyAsHalPrintMessage("****** ERROR WRITING USB DATA - %d\n", ret) ; |
747 else |
730 else |
748 CyAsHalPrintMessage("** Write Sucessful\n") ; |
731 CyAsHalPrintMessage("** Write Sucessful\n") ; |
752 /* |
735 /* |
753 * Return the device descriptor |
736 * Return the device descriptor |
754 */ |
737 */ |
755 CyAsHalPrintMessage("**** CY_CH9_GD_DEVICE (size = %d)\n", sizeof(device_qualifier)) ; |
738 CyAsHalPrintMessage("**** CY_CH9_GD_DEVICE (size = %d)\n", sizeof(device_qualifier)) ; |
756 PrintData("DD", (uint8_t *)&device_qualifier, sizeof(device_qualifier)) ; |
739 PrintData("DD", (uint8_t *)&device_qualifier, sizeof(device_qualifier)) ; |
757 |
|
758 ret = SendSetupData(h, reqlen, sizeof(device_qualifier), &device_qualifier) ; |
740 ret = SendSetupData(h, reqlen, sizeof(device_qualifier), &device_qualifier) ; |
759 if (ret != CY_AS_ERROR_SUCCESS) |
741 if (ret != CY_AS_ERROR_SUCCESS) |
760 CyAsHalPrintMessage("****** ERROR WRITING USB DATA - %d\n", ret) ; |
742 CyAsHalPrintMessage("****** ERROR WRITING USB DATA - %d\n", ret) ; |
761 else |
743 else |
762 CyAsHalPrintMessage("** Write Sucessful\n") ; |
744 CyAsHalPrintMessage("** Write Sucessful\n") ; |
763 } |
745 } |
764 else if (data[3] == CY_CH9_GD_CONFIGURATION) |
746 else if (data[3] == CY_CH9_GD_CONFIGURATION) |
765 { |
747 { |
766 const char *desc_name_p ; |
748 #ifdef PRINT_DEBUG_INFO |
767 uint16_t size ; |
749 const char *desc_name_p = "UNKNOWN" ; |
|
750 #endif |
|
751 uint16_t size = 0 ; |
768 |
752 |
769 /* |
753 /* |
770 * Return the CONFIGURATION descriptor. |
754 * Return the CONFIGURATION descriptor. |
771 */ |
755 */ |
772 if (desc_p == (CyCh9ConfigurationDesc *)&ConfigHSDesc) |
756 if (desc_p == (CyCh9ConfigurationDesc *)&ConfigHSDesc) |
773 { |
757 { |
|
758 #ifdef PRINT_DEBUG_INFO |
774 desc_name_p = "HighSpeed" ; |
759 desc_name_p = "HighSpeed" ; |
|
760 #endif |
775 size = sizeof(ConfigHSDesc) ; |
761 size = sizeof(ConfigHSDesc) ; |
776 } |
762 } |
777 else if (desc_p == (CyCh9ConfigurationDesc *)&ConfigFSDesc) |
763 else if (desc_p == (CyCh9ConfigurationDesc *)&ConfigFSDesc) |
778 { |
764 { |
|
765 #ifdef PRINT_DEBUG_INFO |
779 desc_name_p = "FullSpeed" ; |
766 desc_name_p = "FullSpeed" ; |
|
767 #endif |
780 size = sizeof(ConfigFSDesc) ; |
768 size = sizeof(ConfigFSDesc) ; |
781 } |
769 } |
782 else if (desc_p == &ZeroDesc) |
770 else if (desc_p == &ZeroDesc) |
783 { |
771 { |
|
772 #ifdef PRINT_DEBUG_INFO |
784 desc_name_p = "ZeroDesc" ; |
773 desc_name_p = "ZeroDesc" ; |
|
774 #endif |
785 size = sizeof(ZeroDesc) ; |
775 size = sizeof(ZeroDesc) ; |
786 } |
776 } |
787 else |
777 |
788 { |
|
789 desc_name_p = "UNKNOWN" ; |
|
790 size = 0 ; |
|
791 } |
|
792 CyAsHalPrintMessage("**** CY_CH9_GD_CONFIGURATION - %s (size = %d)\n", desc_name_p, size) ; |
778 CyAsHalPrintMessage("**** CY_CH9_GD_CONFIGURATION - %s (size = %d)\n", desc_name_p, size) ; |
793 if (size > 0) |
779 if (size > 0) |
794 { |
780 { |
795 PrintData("CFG", (uint8_t *)desc_p, size) ; |
781 PrintData("CFG", (uint8_t *)desc_p, size) ; |
796 desc_p->bDescriptorType = CY_CH9_GD_CONFIGURATION; |
782 desc_p->bDescriptorType = CY_CH9_GD_CONFIGURATION; |
801 CyAsHalPrintMessage("** Write Sucessful\n") ; |
787 CyAsHalPrintMessage("** Write Sucessful\n") ; |
802 } |
788 } |
803 } |
789 } |
804 else if (data[3] == CY_CH9_GD_OTHER_SPEED_CONFIGURATION) |
790 else if (data[3] == CY_CH9_GD_OTHER_SPEED_CONFIGURATION) |
805 { |
791 { |
806 const char *desc_name_p ; |
792 #ifdef PRINT_DEBUG_INFO |
807 uint16_t size ; |
793 const char *desc_name_p = "UNKNOWN" ; |
|
794 #endif |
|
795 uint16_t size = 0 ; |
808 |
796 |
809 /* |
797 /* |
810 * Return the CONFIGURATION descriptor. |
798 * Return the CONFIGURATION descriptor. |
811 */ |
799 */ |
812 if (other_p == (CyCh9ConfigurationDesc *)&ConfigHSDesc) |
800 if (other_p == (CyCh9ConfigurationDesc *)&ConfigHSDesc) |
813 { |
801 { |
|
802 #ifdef PRINT_DEBUG_INFO |
814 desc_name_p = "HighSpeed" ; |
803 desc_name_p = "HighSpeed" ; |
|
804 #endif |
815 size = sizeof(ConfigHSDesc) ; |
805 size = sizeof(ConfigHSDesc) ; |
816 } |
806 } |
817 else if (other_p == (CyCh9ConfigurationDesc *)&ConfigFSDesc) |
807 else if (other_p == (CyCh9ConfigurationDesc *)&ConfigFSDesc) |
818 { |
808 { |
|
809 #ifdef PRINT_DEBUG_INFO |
819 desc_name_p = "FullSpeed" ; |
810 desc_name_p = "FullSpeed" ; |
|
811 #endif |
820 size = sizeof(ConfigFSDesc) ; |
812 size = sizeof(ConfigFSDesc) ; |
821 } |
813 } |
822 else if (other_p == &ZeroDesc) |
814 else if (other_p == &ZeroDesc) |
823 { |
815 { |
|
816 #ifdef PRINT_DEBUG_INFO |
824 desc_name_p = "ZeroDesc" ; |
817 desc_name_p = "ZeroDesc" ; |
|
818 #endif |
825 size = sizeof(ZeroDesc) ; |
819 size = sizeof(ZeroDesc) ; |
826 } |
820 } |
827 else |
821 |
828 { |
|
829 desc_name_p = "UNKNOWN" ; |
|
830 size = 0 ; |
|
831 } |
|
832 CyAsHalPrintMessage("**** CY_CH9_GD_OTHER_SPEED_CONFIGURATION - %s (size = %d)\n", desc_name_p, size) ; |
822 CyAsHalPrintMessage("**** CY_CH9_GD_OTHER_SPEED_CONFIGURATION - %s (size = %d)\n", desc_name_p, size) ; |
833 if (size > 0) |
823 if (size > 0) |
834 { |
824 { |
835 PrintData("CFG", (uint8_t *)other_p, size) ; |
825 PrintData("CFG", (uint8_t *)other_p, size) ; |
836 other_p->bDescriptorType = CY_CH9_GD_OTHER_SPEED_CONFIGURATION; |
826 other_p->bDescriptorType = CY_CH9_GD_OTHER_SPEED_CONFIGURATION; |
1160 |
1149 |
1161 int CyAsSymbianStorageTest(const char *pgm, CyAsDeviceHandle h, CyAsHalDeviceTag tag) |
1150 int CyAsSymbianStorageTest(const char *pgm, CyAsDeviceHandle h, CyAsHalDeviceTag tag) |
1162 { |
1151 { |
1163 CyAsReturnStatus_t ret ; |
1152 CyAsReturnStatus_t ret ; |
1164 uint32_t count = 0 ; |
1153 uint32_t count = 0 ; |
1165 char *media_name = "SD"; |
|
1166 |
1154 |
1167 g_tag = tag ; |
1155 g_tag = tag ; |
1168 memset(g_pAstDevice,0, sizeof(g_AstDevice)); |
1156 memset(g_pAstDevice,0, sizeof(g_AstDevice)); |
1169 g_pAstDevice->astHalTag = tag ; |
1157 g_pAstDevice->astHalTag = tag ; |
1170 g_pAstDevice->astDevHandle = h ; |
1158 g_pAstDevice->astDevHandle = h ; |
1185 |
1173 |
1186 CyAsHalPrintMessage("*** CyAsStorageQueryMedia...\n") ; |
1174 CyAsHalPrintMessage("*** CyAsStorageQueryMedia...\n") ; |
1187 ret = CyAsStorageQueryMedia(h, CyAsMediaSDFlash, &count, 0, 0) ; |
1175 ret = CyAsStorageQueryMedia(h, CyAsMediaSDFlash, &count, 0, 0) ; |
1188 if (ret != CY_AS_ERROR_SUCCESS) |
1176 if (ret != CY_AS_ERROR_SUCCESS) |
1189 { |
1177 { |
1190 CyAsHalPrintMessage("%s: Cannot query %s device count - Reason code %d\n", pgm, media_name, ret) ; |
1178 CyAsHalPrintMessage("%s: Cannot query SD device count - Reason code %d\n", pgm, ret) ; |
1191 return 0 ; |
1179 return 0 ; |
1192 } |
1180 } |
1193 CyAsHalPrintMessage("%d %s device(s) found\n", count, media_name) ; |
1181 CyAsHalPrintMessage("%d %s device(s) found\n", count, media_name) ; |
1194 |
1182 |
1195 CyAsHalPrintMessage("*** CyAsStorageClaim...\n") ; |
1183 CyAsHalPrintMessage("*** CyAsStorageClaim...\n") ; |
1196 ret = CyAsStorageClaim(h, CyAsBus_1, 0, 0, 0) ; |
1184 ret = CyAsStorageClaim(h, CyAsBus_1, 0, 0, 0) ; |
1197 if (ret != CY_AS_ERROR_SUCCESS) |
1185 if (ret != CY_AS_ERROR_SUCCESS) |
1198 { |
1186 { |
1199 CyAsHalPrintMessage("%s: Cannot claim %s media - Reason code %d\n", pgm, media_name, ret) ; |
1187 CyAsHalPrintMessage("%s: Cannot claim SD media - Reason code %d\n", pgm, ret) ; |
1200 return 0; |
1188 return 0; |
1201 } |
1189 } |
1202 |
1190 |
1203 /* We know that there is only one */ |
1191 /* We know that there is only one */ |
1204 g_pAstDevice->dev_data.bus = CyAsBus_1 ; |
1192 g_pAstDevice->dev_data.bus = CyAsBus_1 ; |
1205 g_pAstDevice->dev_data.device = 0 ; |
1193 g_pAstDevice->dev_data.device = 0 ; |
1206 ret = CyAsStorageQueryDevice(h, &(g_pAstDevice->dev_data), 0, 0) ; |
1194 ret = CyAsStorageQueryDevice(h, &(g_pAstDevice->dev_data), 0, 0) ; |
1207 if (ret != CY_AS_ERROR_SUCCESS) |
1195 if (ret != CY_AS_ERROR_SUCCESS) |
1208 { |
1196 { |
1209 CyAsHalPrintMessage("%s: Cannot query %s device - Reason code %d\n", pgm, media_name, ret) ; |
1197 CyAsHalPrintMessage("%s: Cannot query SD device - Reason code %d\n", pgm, ret) ; |
1210 return 0 ; |
1198 return 0 ; |
1211 } |
1199 } |
1212 CyAsHalPrintMessage("blocksize %d, %d units found\n", |
1200 CyAsHalPrintMessage("blocksize %d, %d units found\n", |
1213 g_pAstDevice->dev_data.desc_p.block_size, g_pAstDevice->dev_data.desc_p.number_units) ; |
1201 g_pAstDevice->dev_data.desc_p.block_size, g_pAstDevice->dev_data.desc_p.number_units) ; |
1214 |
1202 |
1217 g_pAstDevice->unit_data.unit = 0 ; |
1205 g_pAstDevice->unit_data.unit = 0 ; |
1218 /* We know that there is only one */ |
1206 /* We know that there is only one */ |
1219 ret = CyAsStorageQueryUnit(h, &(g_pAstDevice->unit_data), 0, 0) ; |
1207 ret = CyAsStorageQueryUnit(h, &(g_pAstDevice->unit_data), 0, 0) ; |
1220 if (ret != CY_AS_ERROR_SUCCESS) |
1208 if (ret != CY_AS_ERROR_SUCCESS) |
1221 { |
1209 { |
1222 CyAsHalPrintMessage("%s: Cannot query %s device unit - Reason code %d\n", pgm, media_name, ret) ; |
1210 CyAsHalPrintMessage("%s: Cannot query SD device unit - Reason code %d\n", pgm, ret) ; |
1223 return 0 ; |
1211 return 0 ; |
1224 } |
1212 } |
1225 CyAsHalPrintMessage("blocksize %d, %d Block(s) found\n", |
1213 CyAsHalPrintMessage("blocksize %d, %d Block(s) found\n", |
1226 g_pAstDevice->unit_data.desc_p.block_size, g_pAstDevice->unit_data.desc_p.unit_size) ; |
1214 g_pAstDevice->unit_data.desc_p.block_size, g_pAstDevice->unit_data.desc_p.unit_size) ; |
1227 |
1215 |