author | Lukasz Forynski <lukasz.forynski@gmail.com> |
Mon, 23 Aug 2010 02:29:41 +0100 | |
changeset 52 | 254b9435d75e |
parent 27 | 117faf51deac |
permissions | -rw-r--r-- |
27
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1 |
#include <kern_priv.h> |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
2 |
#include <beagle/beagle_gpio.h> |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
3 |
#include <beagle/variant.h> |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
4 |
#include <assp/omap3530_assp/omap3530_assp_priv.h> |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
5 |
#include <assp/omap3530_assp/omap3530_irqmap.h> // GPIO interrupts |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
6 |
#include <assp/omap3530_assp/omap3530_gpio.h> |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
7 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
8 |
#include <assp.h> // Required for definition of TIsr |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
9 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
10 |
#include <cyastoria.h> |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
11 |
#include <cyasmtp.h> |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
12 |
#include <cyasusbinit.h> |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
13 |
#include <cyasusbdescs.h> |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
14 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
15 |
TmtpAstDev g_AstDevice; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
16 |
TmtpAstDev * g_pAstDevice = &g_AstDevice ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
17 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
18 |
static uint16_t replybuf[512] ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
19 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
20 |
static uint8_t * |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
21 |
GetReplyArea(void) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
22 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
23 |
return (uint8_t *) replybuf ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
24 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
25 |
|
52
254b9435d75e
Fixed build warnings
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
27
diff
changeset
|
26 |
|
27
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
27 |
/* Globals */ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
28 |
/*static uint8_t pktbuffer3[512] ;*/ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
29 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
30 |
#ifdef CY_AS_USB_TB_FOUR |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
31 |
static uint8_t pktbuffer7[512] ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
32 |
#endif |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
33 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
34 |
#ifdef CY_AS_USB_TB_SIX |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
35 |
static uint8_t pktbuffer11[512] ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
36 |
#endif |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
37 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
38 |
/*static uint8_t turbopktbuffer[512] ;*/ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
39 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
40 |
static volatile CyBool gSetConfig = CyFalse ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
41 |
static volatile CyBool gAsyncStallDone = CyFalse ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
42 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
43 |
static volatile CyBool gStorageReleaseBus0 = CyFalse ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
44 |
static volatile CyBool gStorageReleaseBus1 = CyFalse ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
45 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
46 |
static volatile CyAsHalDeviceTag g_tag ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
47 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
48 |
static uint8_t MyConfiguration = 0 ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
49 |
static CyCh9ConfigurationDesc *desc_p = 0 ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
50 |
static CyCh9ConfigurationDesc *other_p = 0 ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
51 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
52 |
static volatile uint8_t gAsyncStallStale = 0; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
53 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
54 |
/* Forward declarations */ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
55 |
static int SetupUSBPPort(CyAsDeviceHandle h, uint8_t media, CyBool isTurbo) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
56 |
static void MyUsbEventCallbackMS(CyAsDeviceHandle h, CyAsUsbEvent ev, void *evdata) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
57 |
static void PrintData(const char *name, uint8_t *data, uint16_t size) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
58 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
59 |
static void |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
60 |
StallCallback(CyAsDeviceHandle h, CyAsReturnStatus_t status, uint32_t tag, CyAsFunctCBType cbtype, void *cbdata) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
61 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
62 |
(void)h ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
63 |
(void)cbtype ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
64 |
(void)cbdata ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
65 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
66 |
if (tag == 1) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
67 |
CyAsHalPrintMessage("*** Nak callback - status = %d\n", status) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
68 |
else |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
69 |
CyAsHalPrintMessage("*** Stall callback - status = %d\n", status) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
70 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
71 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
72 |
static void |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
73 |
StallCallbackEX(CyAsDeviceHandle h, |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
74 |
CyAsReturnStatus_t status, |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
75 |
uint32_t tag, |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
76 |
CyAsFunctCBType type, |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
77 |
void* data) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
78 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
79 |
(void)h ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
80 |
(void)type ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
81 |
(void)data ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
82 |
(void)status ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
83 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
84 |
if(tag == 18) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
85 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
86 |
CyAsReturnStatus_t ret = CyAsUsbClearStall(h, 3, StallCallbackEX, 21); |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
87 |
CyAsHalAssert(ret == CY_AS_ERROR_SUCCESS) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
88 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
89 |
else |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
90 |
gAsyncStallDone = CyTrue ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
91 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
92 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
93 |
static void |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
94 |
StallCallbackAsync(CyAsDeviceHandle h, CyAsReturnStatus_t status, uint32_t tag, CyAsFunctCBType cbtype, void *cbdata) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
95 |
{ |
52
254b9435d75e
Fixed build warnings
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
27
diff
changeset
|
96 |
#ifdef PRINT_DEBUG_INFO |
254b9435d75e
Fixed build warnings
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
27
diff
changeset
|
97 |
CyAsReturnStatus_t ret ; |
254b9435d75e
Fixed build warnings
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
27
diff
changeset
|
98 |
#endif |
27
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
99 |
(void)cbtype ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
100 |
(void)cbdata ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
101 |
(void)tag ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
102 |
(void)status ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
103 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
104 |
if(gAsyncStallStale == 0) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
105 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
106 |
gAsyncStallStale++; |
52
254b9435d75e
Fixed build warnings
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
27
diff
changeset
|
107 |
#ifdef PRINT_DEBUG_INFO |
254b9435d75e
Fixed build warnings
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
27
diff
changeset
|
108 |
ret = |
254b9435d75e
Fixed build warnings
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
27
diff
changeset
|
109 |
#endif |
254b9435d75e
Fixed build warnings
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
27
diff
changeset
|
110 |
CyAsUsbClearStall(h, 3, StallCallbackAsync, 21); |
27
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
111 |
CyAsHalAssert(ret == CY_AS_ERROR_SUCCESS) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
112 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
113 |
else |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
114 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
115 |
gAsyncStallDone = CyTrue ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
116 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
117 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
118 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
119 |
static void |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
120 |
MyStorageEventCBMS(CyAsDeviceHandle h, CyAsBusNumber_t bus, uint32_t device, CyAsStorageEvent evtype, void *evdata) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
121 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
122 |
(void)h ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
123 |
(void)evdata ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
124 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
125 |
switch (evtype) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
126 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
127 |
case CyAsStorageAntioch: |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
128 |
CyAsHalPrintMessage("CyAsStorageAntioch Event: bus=%d, device=%d\n", bus, device) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
129 |
switch (bus) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
130 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
131 |
case 0: |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
132 |
gStorageReleaseBus0 = CyTrue ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
133 |
break; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
134 |
case 1: |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
135 |
gStorageReleaseBus1 = CyTrue ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
136 |
break; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
137 |
default: |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
138 |
break; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
139 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
140 |
break; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
141 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
142 |
case CyAsStorageProcessor: |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
143 |
CyAsHalPrintMessage("CyAsStorageProcessor Event: bus=%d, device %d\n", bus, device) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
144 |
break; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
145 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
146 |
case CyAsStorageRemoved: |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
147 |
CyAsHalPrintMessage("Bus %d, device %d has been removed\n", bus, device) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
148 |
break; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
149 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
150 |
case CyAsStorageInserted: |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
151 |
CyAsHalPrintMessage("Bus %d, device %d has been inserted\n", bus, device) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
152 |
break; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
153 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
154 |
default: |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
155 |
break; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
156 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
157 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
158 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
159 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
160 |
/* |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
161 |
* This function exercises the USB module |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
162 |
*/ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
163 |
int CyAsAPIUsbInit(const char *pgm, CyAsDeviceHandle h, CyAsHalDeviceTag tag) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
164 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
165 |
CyAsReturnStatus_t ret ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
166 |
/*char buffer[16] ;*/ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
167 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
168 |
g_tag = tag ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
169 |
memset(g_pAstDevice,0, sizeof(g_AstDevice)); |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
170 |
g_pAstDevice->astHalTag = tag ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
171 |
g_pAstDevice->astDevHandle = h ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
172 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
173 |
/* |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
174 |
* Give a delay to allow any equipment to be ready (e.g. CATC) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
175 |
*/ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
176 |
/*CyAsHalPrintMessage("Press enter to begin USB operation (%s): ", "P Port Enumeration") ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
177 |
fgets(buffer, sizeof(buffer), stdin) ;*/ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
178 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
179 |
CyAsHalPrintMessage("*** CyAsStorageStart...\n") ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
180 |
ret = CyAsStorageStart(h, 0, 0) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
181 |
if (ret != CY_AS_ERROR_SUCCESS) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
182 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
183 |
CyAsHalPrintMessage("%s: CyAsStorageStart returned error code %d\n", pgm, ret) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
184 |
return 0 ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
185 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
186 |
CyAsHalPrintMessage("*** CyAsStorageStart...Done\n") ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
187 |
/* |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
188 |
* Register a storage event call-back so that the USB attached storage can be |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
189 |
* release when the USB connection has been made. |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
190 |
*/ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
191 |
CyAsHalPrintMessage("*** CyAsStorageRegisterCallback...\n") ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
192 |
ret = CyAsStorageRegisterCallback(h, MyStorageEventCBMS) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
193 |
if (ret != CY_AS_ERROR_SUCCESS) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
194 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
195 |
CyAsHalPrintMessage("%s: CyAsStorageRegisterCallbackMS returned error code %d\n", pgm, ret) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
196 |
return 0 ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
197 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
198 |
CyAsHalPrintMessage("*** CyAsStorageRegisterCallback...Done\n") ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
199 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
200 |
ret = CyAsStorageRelease(h, 1, 0, 0, 0) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
201 |
if (ret != CY_AS_ERROR_SUCCESS) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
202 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
203 |
CyAsHalPrintMessage("CyAsStorageReleaseMS returned error code %d\n", ret) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
204 |
return 0 ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
205 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
206 |
gStorageReleaseBus1 = CyFalse ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
207 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
208 |
/* |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
209 |
* Use the 24 MHz operating frequency, if the SD card is a low speed one. |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
210 |
*/ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
211 |
ret = CyAsMiscSetLowSpeedSDFreq(h, CY_AS_SD_RATED_FREQ, 0, 0) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
212 |
if ((ret != CY_AS_ERROR_SUCCESS) && (ret != CY_AS_ERROR_INVALID_RESPONSE)) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
213 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
214 |
CyAsHalPrintMessage("%s: CyAsMiscSetLowSpeedSDFreq returned error code %d\n", pgm, ret) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
215 |
return 0 ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
216 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
217 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
218 |
/* |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
219 |
* We are using P Port based enumeration |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
220 |
*/ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
221 |
#ifdef DEBUG_ZERO |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
222 |
if (!SetupUSBPPort(h, 2, 0)) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
223 |
#else |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
224 |
if (!SetupUSBPPort(h, 2, 1)) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
225 |
#endif |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
226 |
return 0 ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
227 |
/* |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
228 |
* Now we let the enumeration process happen via callbacks. When the set configuration |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
229 |
* request is processed, we are done with enumeration and ready to perform our function. |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
230 |
*/ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
231 |
while (!gSetConfig) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
232 |
CyAsHalSleep(100) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
233 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
234 |
CyAsHalPrintMessage("*** Configuration complete, starting echo function\n") ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
235 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
236 |
return 1 ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
237 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
238 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
239 |
static void |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
240 |
MyCyAsMTPEventCallback( |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
241 |
CyAsDeviceHandle handle, |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
242 |
CyAsMTPEvent evtype, |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
243 |
void* evdata) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
244 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
245 |
(void) handle; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
246 |
switch(evtype) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
247 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
248 |
case CyAsMTPSendObjectComplete: |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
249 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
250 |
CyAsMTPSendObjectCompleteData* sendObjData = (CyAsMTPSendObjectCompleteData*) evdata ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
251 |
CyAsHalPrintMessage("MTP EVENT: SendObjectComplete\n"); |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
252 |
CyAsHalPrintMessage("Bytes sent = %d\nSend status = %d",sendObjData->byte_count,sendObjData->status); |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
253 |
g_pAstDevice->tmtpSendCompleteData.byte_count = sendObjData->byte_count; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
254 |
g_pAstDevice->tmtpSendCompleteData.status = sendObjData->status; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
255 |
g_pAstDevice->tmtpSendCompleteData.transaction_id = sendObjData->transaction_id ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
256 |
g_pAstDevice->tmtpSendComplete = CyTrue ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
257 |
break; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
258 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
259 |
case CyAsMTPGetObjectComplete: |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
260 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
261 |
CyAsMTPGetObjectCompleteData* getObjData = (CyAsMTPGetObjectCompleteData*) evdata ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
262 |
CyAsHalPrintMessage("MTP EVENT: GetObjectComplete\n"); |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
263 |
CyAsHalPrintMessage("Bytes got = %d\nGet status = %d",getObjData->byte_count,getObjData->status); |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
264 |
g_pAstDevice->tmtpGetCompleteData.byte_count = getObjData->byte_count; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
265 |
g_pAstDevice->tmtpGetCompleteData.status = getObjData->status ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
266 |
g_pAstDevice->tmtpGetComplete = CyTrue ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
267 |
break; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
268 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
269 |
case CyAsMTPBlockTableNeeded: |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
270 |
g_pAstDevice->tmtpNeedNewBlkTbl = CyTrue ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
271 |
break; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
272 |
default: |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
273 |
; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
274 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
275 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
276 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
277 |
/* |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
278 |
* This function is responsible for initializing the USB function within West Bridge. This |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
279 |
* function initializes West Bridge for P port based enumeration. |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
280 |
*/ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
281 |
int SetupUSBPPort(CyAsDeviceHandle h, uint8_t bus, CyBool isTurbo) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
282 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
283 |
CyAsReturnStatus_t ret ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
284 |
CyAsUsbEnumControl config ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
285 |
#ifdef DEBUG_ZERO |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
286 |
CyAsUsbEndPointConfig epconfig ; |
52
254b9435d75e
Fixed build warnings
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
27
diff
changeset
|
287 |
(void)epconfig; |
27
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
288 |
#endif |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
289 |
uint32_t count = 0 ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
290 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
291 |
CyAsHalPrintMessage("*** SetupUSBPPort...\n") ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
292 |
/* |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
293 |
* Intialize the primary descriptor to be the full speed descriptor and the |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
294 |
* other descriptor to by the high speed descriptor. This will swap if we see a |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
295 |
* high speed event. |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
296 |
*/ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
297 |
#ifdef DEBUG_ZERO |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
298 |
desc_p = (CyCh9ConfigurationDesc *)&ConfigFSDesc ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
299 |
other_p = (CyCh9ConfigurationDesc *)&ConfigHSDesc ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
300 |
#else |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
301 |
desc_p = (CyCh9ConfigurationDesc *)&ZeroDesc ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
302 |
other_p = (CyCh9ConfigurationDesc *)&ZeroDesc ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
303 |
#endif |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
304 |
/* Step 1: Release the USB D+ and D- pins |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
305 |
* |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
306 |
* This code releases control of the D+ and D- pins if they have been previously |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
307 |
* acquired by the P Port processor. The physical D+ and D- pins are controlled either by |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
308 |
* West Bridge, or by some other hardware external to West Bridge. If external hardware is using |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
309 |
* these pins, West Bridge must put these pins in a high impedence state in order to insure there |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
310 |
* is no coflict over the use of the pins. Before we can initialize the USB capabilities of |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
311 |
* West Bridge, we must be sure West Bridge has ownership of the D+ and D- signals. West Bridge will take |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
312 |
* ownership of these pins as long as the P port processor has released them. This call |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
313 |
* releases control of these pins. Before calling the CyAsMiscReleaseResource(), the P port API |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
314 |
* must configure the hardware to release control of the D+ and D- pins by any external hardware. |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
315 |
* |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
316 |
* Note that this call can be made anywhere in the intialization sequence as long as it is done |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
317 |
* before the call to CyAsUsbConnect(). If not, when the CyAsUsbConnect() call is made, West Bridge |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
318 |
* will detect that it does not own the D+ and D- pins and the call to CyAsUsbConnect will fail. |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
319 |
*/ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
320 |
ret = CyAsMiscReleaseResource(h, CyAsBusUSB) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
321 |
if (ret != CY_AS_ERROR_SUCCESS && ret != CY_AS_ERROR_RESOURCE_NOT_OWNED) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
322 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
323 |
CyAsHalPrintMessage("Cannot Release USB reousrce: CyAsMiscReleaseResourceMS failed with error code %d\n", ret) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
324 |
return 0 ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
325 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
326 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
327 |
/* |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
328 |
* Step 2: Start the USB stack |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
329 |
* |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
330 |
* This code initializes the USB stack. It takes a handle to an West Bridge device |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
331 |
* previously created with a call to CyAsMiscCreateDevice(). |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
332 |
*/ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
333 |
ret = CyAsUsbStart(h, 0, 0) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
334 |
if (ret != CY_AS_ERROR_SUCCESS) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
335 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
336 |
CyAsHalPrintMessage("CyAsUsbStart failed with error code %d\n", ret) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
337 |
return 0 ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
338 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
339 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
340 |
/* |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
341 |
* Step 3: Register a callback |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
342 |
* |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
343 |
* This code registers a callback to handle USB events. This callback function will handle |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
344 |
* all setup packets during enumeration as well as other USB events (SUSPEND, RESUME, CONNECT, |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
345 |
* DISCONNECT, etc.) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
346 |
*/ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
347 |
ret = CyAsUsbRegisterCallback(h, MyUsbEventCallbackMS) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
348 |
if (ret != CY_AS_ERROR_SUCCESS) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
349 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
350 |
CyAsHalPrintMessage("CyAsUsbRegisterCallbackMS failed with error code %d\n", ret) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
351 |
return 0 ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
352 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
353 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
354 |
#ifdef DEBUG_ZERO |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
355 |
if ( isTurbo ) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
356 |
#endif |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
357 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
358 |
/* |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
359 |
* The SD/MMC resource needs to be released before the device |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
360 |
* can be successfully initialized by the firmware. |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
361 |
*/ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
362 |
ret = CyAsMiscReleaseResource(h, CyAsBus_1) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
363 |
if (ret != CY_AS_ERROR_SUCCESS && ret != CY_AS_ERROR_RESOURCE_NOT_OWNED) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
364 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
365 |
CyAsHalPrintMessage("CyAsMtpApp: CyAsMiscReleaseResource failed with error code %d\n", ret) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
366 |
return -ret; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
367 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
368 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
369 |
ret = CyAsStorageStart(h, 0, 0) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
370 |
if (ret != CY_AS_ERROR_SUCCESS) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
371 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
372 |
CyAsHalPrintMessage("CyAsMtpApp: CyAsStorageStart failed with error code %d\n", ret) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
373 |
return -ret; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
374 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
375 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
376 |
ret = CyAsStorageQueryMedia(h, CyAsMediaSDFlash, &count, 0, 0) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
377 |
if (ret != CY_AS_ERROR_SUCCESS) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
378 |
{ |
52
254b9435d75e
Fixed build warnings
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
27
diff
changeset
|
379 |
CyAsHalPrintMessage("CyAsMtpApp: Cannot query SD device count - Reason code %d\n", ret) ; |
27
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
380 |
return -ret ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
381 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
382 |
CyAsHalPrintMessage("CyAsMtpApp: %d %s device(s) found\n", count, media_name) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
383 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
384 |
ret = CyAsStorageClaim(h, CyAsBus_1, 0, 0, 0) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
385 |
if (ret != CY_AS_ERROR_SUCCESS) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
386 |
{ |
52
254b9435d75e
Fixed build warnings
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
27
diff
changeset
|
387 |
CyAsHalPrintMessage("CyAsMtpApp: Cannot claim SD media - Reason code %d\n", ret) ; |
27
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
388 |
return -ret; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
389 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
390 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
391 |
/* We know that there is only one */ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
392 |
g_pAstDevice->dev_data.bus = CyAsBus_1 ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
393 |
g_pAstDevice->dev_data.device = 0 ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
394 |
ret = CyAsStorageQueryDevice(h, &(g_pAstDevice->dev_data), 0, 0) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
395 |
if (ret != CY_AS_ERROR_SUCCESS) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
396 |
{ |
52
254b9435d75e
Fixed build warnings
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
27
diff
changeset
|
397 |
CyAsHalPrintMessage("CyAsMtpApp: Cannot query SD device - Reason code %d\n", ret) ; |
27
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
398 |
return -ret ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
399 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
400 |
CyAsHalPrintMessage("CyAsMtpApp: blocksize %d, %d units found\n", |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
401 |
g_pAstDevice->dev_data.desc_p.block_size, g_pAstDevice->dev_data.desc_p.number_units) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
402 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
403 |
g_pAstDevice->unit_data.bus = CyAsBus_1 ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
404 |
g_pAstDevice->unit_data.device = 0 ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
405 |
g_pAstDevice->unit_data.unit = 0 ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
406 |
/* We know that there is only one */ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
407 |
ret = CyAsStorageQueryUnit(h, &(g_pAstDevice->unit_data), 0, 0) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
408 |
if (ret != CY_AS_ERROR_SUCCESS) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
409 |
{ |
52
254b9435d75e
Fixed build warnings
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
27
diff
changeset
|
410 |
CyAsHalPrintMessage("CyAsMtpApp: Cannot query SD device unit - Reason code %d\n", ret) ; |
27
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
411 |
return -ret ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
412 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
413 |
CyAsHalPrintMessage("CyAsMtpApp: blocksize %d, %d Block(s) found\n", |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
414 |
g_pAstDevice->unit_data.desc_p.block_size, g_pAstDevice->unit_data.desc_p.unit_size) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
415 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
416 |
CyAsHalPrintMessage("CyAsMtpApp: Starting TMTP...\n"); |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
417 |
ret = CyAsMTPStart(h, MyCyAsMTPEventCallback, 0, 0) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
418 |
if (ret != CY_AS_ERROR_SUCCESS) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
419 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
420 |
CyAsHalPrintMessage("CyAsMTPStart failed with error code %d\n", ret) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
421 |
return 0 ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
422 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
423 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
424 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
425 |
/* |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
426 |
* Step 4: Setup the enumeration mode |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
427 |
* |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
428 |
* This code tells the West Bridge API how enumeration will be done. Specifically in this |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
429 |
* example we are configuring the API for P Port processor based enumeraton. This will cause |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
430 |
* all setup packets to be relayed to the P port processor via the USB event callback. See |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
431 |
* the function CyAsUsbRegisterEventCallback() for more information about this callback. |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
432 |
*/ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
433 |
config.antioch_enumeration = CyFalse ; /* P port will do enumeration, not West Bridge */ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
434 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
435 |
/* Set the media to enumerate through USB */ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
436 |
#ifdef DEBUG_ZERO |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
437 |
config.devices_to_enumerate[0][0] = CyFalse; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
438 |
config.devices_to_enumerate[1][0] = CyFalse; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
439 |
#else |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
440 |
config.devices_to_enumerate[0][0] = (bus & CY_TEST_BUS_0) ? CyTrue : CyFalse; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
441 |
config.devices_to_enumerate[1][0] = (bus & CY_TEST_BUS_1) ? CyTrue : CyFalse; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
442 |
#endif |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
443 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
444 |
if (isTurbo) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
445 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
446 |
/* Force SD bus */ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
447 |
config.devices_to_enumerate[0][0] = CyFalse; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
448 |
config.devices_to_enumerate[1][0] = CyTrue ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
449 |
/* No MSC in Turbo */ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
450 |
config.mass_storage_interface = 0 ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
451 |
config.mtp_interface = 1 ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
452 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
453 |
else |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
454 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
455 |
/* not Turbo here */ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
456 |
config.mtp_interface = 0 ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
457 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
458 |
#ifndef DEBUG_MSC |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
459 |
config.mass_storage_interface = 0 ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
460 |
config.mass_storage_callbacks = CyFalse ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
461 |
#else |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
462 |
/* Force SD bus */ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
463 |
config.devices_to_enumerate[1][0] = CyTrue ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
464 |
config.mass_storage_interface = 1 ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
465 |
config.mass_storage_callbacks = CyTrue ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
466 |
#endif |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
467 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
468 |
ret = CyAsUsbSetEnumConfig(h, &config, 0, 0) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
469 |
if (ret != CY_AS_ERROR_SUCCESS) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
470 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
471 |
CyAsHalPrintMessage("CyAsUsbSetEnumConfigMS failed with error code %d\n", ret) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
472 |
return 0 ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
473 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
474 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
475 |
#ifndef DEBUG_MSC |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
476 |
/* |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
477 |
* Step 5: set physical configuration |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
478 |
*/ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
479 |
#ifdef DEBUG_ZERO |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
480 |
/*nxz-debug-z ret = CyAsUsbSetPhysicalConfiguration(h, 5) ;*/ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
481 |
ret = CyAsUsbSetPhysicalConfiguration(h, 1) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
482 |
#else |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
483 |
ret = CyAsUsbSetPhysicalConfiguration(h, 5) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
484 |
#endif |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
485 |
if (ret != CY_AS_ERROR_SUCCESS) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
486 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
487 |
CyAsHalPrintMessage("CyAsUsbSetPhysicalConfiguration failed with error code %d\n", ret) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
488 |
return 0 ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
489 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
490 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
491 |
/* |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
492 |
* Step 5: Commit the endpoint configuration |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
493 |
*/ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
494 |
#ifdef DEBUG_ZERO |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
495 |
epconfig.enabled = CyTrue ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
496 |
epconfig.dir = CyAsUsbOut ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
497 |
epconfig.type = CyAsUsbBulk ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
498 |
epconfig.size = 0 ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
499 |
epconfig.physical = 1 ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
500 |
ret = CyAsUsbSetEndPointConfig(h, 3, &epconfig) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
501 |
if ( ret != CY_AS_ERROR_SUCCESS ) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
502 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
503 |
CyAsHalPrintMessage("CyAsUsbSetEndPointConfig failed with error code %d\n", ret) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
504 |
return 0 ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
505 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
506 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
507 |
epconfig.enabled = CyTrue ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
508 |
epconfig.dir = CyAsUsbIn ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
509 |
epconfig.type = CyAsUsbBulk ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
510 |
epconfig.size = 0 ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
511 |
epconfig.physical = 3 ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
512 |
ret = CyAsUsbSetEndPointConfig(h, 5, &epconfig) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
513 |
if ( ret != CY_AS_ERROR_SUCCESS ) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
514 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
515 |
CyAsHalPrintMessage("CyAsUsbSetEndPointConfig failed with error code %d\n", ret) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
516 |
return 0 ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
517 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
518 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
519 |
/*nxz-debug-z */ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
520 |
epconfig.enabled = CyTrue ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
521 |
epconfig.dir = CyAsUsbIn ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
522 |
epconfig.type = CyAsUsbInt ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
523 |
epconfig.size = 64 ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
524 |
epconfig.physical = 2 ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
525 |
ret = CyAsUsbSetEndPointConfig(h, 7, &epconfig) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
526 |
if ( ret != CY_AS_ERROR_SUCCESS ) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
527 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
528 |
CyAsHalPrintMessage("CyAsUsbSetEndPointConfig failed with error code %d\n", ret) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
529 |
return 0 ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
530 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
531 |
#endif |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
532 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
533 |
/* |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
534 |
* This code commits the endpoint configuration to the West Bridge hardware. |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
535 |
*/ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
536 |
ret = CyAsUsbCommitConfig(h, 0, 0) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
537 |
if (ret != CY_AS_ERROR_SUCCESS) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
538 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
539 |
CyAsHalPrintMessage("CyAsUsbCommitConfig failed with error code %d\n", ret) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
540 |
return 0 ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
541 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
542 |
#endif |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
543 |
/* |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
544 |
* Step 6: Connect to the USB host. |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
545 |
* |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
546 |
* This code actually connects the D+ and D- signals internal to West Bridge to the D+ and D- pins |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
547 |
* on the device. If the host is already physically connected, this will begin the enumeration |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
548 |
* process. Otherwise, the enumeration process will being when the host is connected. |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
549 |
*/ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
550 |
ret = CyAsUsbConnect(h, 0, 0) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
551 |
if (ret != CY_AS_ERROR_SUCCESS) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
552 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
553 |
CyAsHalPrintMessage("CyAsUsbConnect failed with error code %d\n", ret) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
554 |
return 0 ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
555 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
556 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
557 |
CyAsHalPrintMessage("*** SetupUSBPPort...Done\n") ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
558 |
return 1 ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
559 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
560 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
561 |
/* |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
562 |
* Print a block of data, useful for displaying data during debug. |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
563 |
*/ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
564 |
static void PrintData(const char *name_p, uint8_t *data, uint16_t size) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
565 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
566 |
uint32_t i = 0 ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
567 |
uint32_t linecnt = 0 ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
568 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
569 |
while (i < size) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
570 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
571 |
if (linecnt == 0) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
572 |
CyAsHalPrintMessage("%s @ %02x:", name_p, i) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
573 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
574 |
CyAsHalPrintMessage(" %02x", data[i]) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
575 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
576 |
linecnt++ ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
577 |
i++ ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
578 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
579 |
if (linecnt == 16) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
580 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
581 |
CyAsHalPrintMessage("\n") ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
582 |
linecnt = 0 ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
583 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
584 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
585 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
586 |
if (linecnt != 0) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
587 |
CyAsHalPrintMessage("\n") ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
588 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
589 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
590 |
/* |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
591 |
* This is the write callback for writes that happen as part of the setup operation. |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
592 |
*/ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
593 |
static void SetupWriteCallback(CyAsDeviceHandle h, CyAsEndPointNumber_t ep, uint32_t count, void *buf_p, CyAsReturnStatus_t status) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
594 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
595 |
(void)count ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
596 |
(void)h ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
597 |
(void)buf_p ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
598 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
599 |
if (status != CY_AS_ERROR_SUCCESS) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
600 |
CyAsHalPrintMessage("Error returned in SetupWriteCallback - %d\n", status) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
601 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
602 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
603 |
static CyAsReturnStatus_t |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
604 |
SetupWrite(CyAsDeviceHandle h, uint32_t requested, uint32_t dsize, void *data) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
605 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
606 |
CyBool spacket = CyTrue ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
607 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
608 |
if (requested == dsize) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
609 |
spacket = CyFalse ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
610 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
611 |
return CyAsUsbWriteDataAsync(h, 0, dsize, data, spacket, SetupWriteCallback) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
612 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
613 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
614 |
int mystrlen(char* str) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
615 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
616 |
int len = 0 ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
617 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
618 |
while( str && (*str != '\0') ) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
619 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
620 |
len++; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
621 |
str++; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
622 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
623 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
624 |
return len ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
625 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
626 |
/* |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
627 |
* Send the USB host a string descriptor. If the index is zero, send the |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
628 |
* array of supported languages, otherwise send the string itself per the USB |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
629 |
* Ch9 specification. |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
630 |
*/ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
631 |
static void SendStringDescriptor(CyAsDeviceHandle h, uint8_t *data) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
632 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
633 |
CyAsReturnStatus_t ret = CY_AS_ERROR_SUCCESS; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
634 |
int i = data[2] ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
635 |
int langid = data[4] | (data[5] << 8) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
636 |
uint16_t reqlen = data[6] | (data[7] << 8) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
637 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
638 |
CyAsHalPrintMessage("**** CY_CH9_GD_STRING - %d\n", i) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
639 |
if (i == 0) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
640 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
641 |
uint8_t *reply ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
642 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
643 |
reply = GetReplyArea() ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
644 |
reply[0] = 4 ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
645 |
reply[1] = CY_CH9_GD_STRING ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
646 |
reply[2] = CY_CH9_LANGID_ENGLISH_UNITED_STATES & 0xff ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
647 |
reply[3] = (CY_CH9_LANGID_ENGLISH_UNITED_STATES >> 8) & 0xff ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
648 |
ret = SetupWrite(h, reqlen, 4, reply) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
649 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
650 |
else if (i <= sizeof(UsbStrings)/sizeof(UsbStrings[0]) && langid == CY_CH9_LANGID_ENGLISH_UNITED_STATES) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
651 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
652 |
uint8_t *reply ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
653 |
uint16_t len = (uint16_t)mystrlen(UsbStrings[i - 1]) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
654 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
655 |
CyAsHalPrintMessage("*** Sending string '%s'\n", UsbStrings[i - 1]) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
656 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
657 |
reply = GetReplyArea() ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
658 |
reply[0] = (uint8_t)(len * 2 + 2) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
659 |
reply[1] = CY_CH9_GD_STRING ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
660 |
/* nxz-linux-port */ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
661 |
/*memcpy(reply + 2, UsbStrings[i - 1], len ) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
662 |
ret = SetupWrite(h, reqlen, len + 2, reply) ;*/ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
663 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
664 |
uint16_t index ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
665 |
uint16_t *rpy = (uint16_t *)(reply + 2) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
666 |
for (index = 0; index < len; index++) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
667 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
668 |
*rpy = (uint16_t)(UsbStrings[i - 1][index]) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
669 |
rpy++ ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
670 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
671 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
672 |
ret = SetupWrite(h, reqlen, len * 2 + 2, reply) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
673 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
674 |
else |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
675 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
676 |
/* |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
677 |
* If the host asks for an invalid string, we must stall EP 0 |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
678 |
*/ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
679 |
ret = CyAsUsbSetStall(h, 0, StallCallback, 0) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
680 |
if (ret != CY_AS_ERROR_SUCCESS) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
681 |
CyAsHalPrintMessage("**** cannot set stall state on EP 0\n") ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
682 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
683 |
CyAsHalPrintMessage("Host asked for invalid string or langid, index = 0x%04x, langid = 0x%04x\n", i, langid) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
684 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
685 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
686 |
if (ret != CY_AS_ERROR_SUCCESS) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
687 |
CyAsHalPrintMessage("****** ERROR WRITING USB DATA - %d\n", ret) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
688 |
else |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
689 |
CyAsHalPrintMessage("** Write Sucessful\n") ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
690 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
691 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
692 |
static CyAsReturnStatus_t |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
693 |
SendSetupData(CyAsDeviceHandle h, uint32_t reqlen, uint32_t size, void *data_p) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
694 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
695 |
CyAsReturnStatus_t ret ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
696 |
uint8_t *reply ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
697 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
698 |
/* |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
699 |
* Never send more data than was requested |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
700 |
*/ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
701 |
if (size > reqlen) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
702 |
size = reqlen ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
703 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
704 |
reply = GetReplyArea() ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
705 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
706 |
memcpy(reply, data_p, size) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
707 |
ret = SetupWrite(h, reqlen, size, reply) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
708 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
709 |
return ret ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
710 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
711 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
712 |
/* |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
713 |
* This function processes the GET DESCRIPTOR usb request. |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
714 |
*/ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
715 |
static void ProcessGetDescriptorRequest(CyAsDeviceHandle h, uint8_t *data) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
716 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
717 |
CyAsReturnStatus_t ret ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
718 |
uint16_t reqlen = data[6] | (data[7] << 8) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
719 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
720 |
if (data[3] == CY_CH9_GD_DEVICE) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
721 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
722 |
/* |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
723 |
* Return the device descriptor |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
724 |
*/ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
725 |
CyAsHalPrintMessage("**** CY_CH9_GD_DEVICE (size = %d)\n", sizeof(pport_device_desc)) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
726 |
PrintData("DD", (uint8_t *)&pport_device_desc, sizeof(pport_device_desc)) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
727 |
ret = SendSetupData(h, reqlen, sizeof(pport_device_desc), &pport_device_desc) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
728 |
if (ret != CY_AS_ERROR_SUCCESS) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
729 |
CyAsHalPrintMessage("****** ERROR WRITING USB DATA - %d\n", ret) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
730 |
else |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
731 |
CyAsHalPrintMessage("** Write Sucessful\n") ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
732 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
733 |
else if (data[3] == CY_CH9_GD_DEVICE_QUALIFIER) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
734 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
735 |
/* |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
736 |
* Return the device descriptor |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
737 |
*/ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
738 |
CyAsHalPrintMessage("**** CY_CH9_GD_DEVICE (size = %d)\n", sizeof(device_qualifier)) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
739 |
PrintData("DD", (uint8_t *)&device_qualifier, sizeof(device_qualifier)) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
740 |
ret = SendSetupData(h, reqlen, sizeof(device_qualifier), &device_qualifier) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
741 |
if (ret != CY_AS_ERROR_SUCCESS) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
742 |
CyAsHalPrintMessage("****** ERROR WRITING USB DATA - %d\n", ret) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
743 |
else |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
744 |
CyAsHalPrintMessage("** Write Sucessful\n") ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
745 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
746 |
else if (data[3] == CY_CH9_GD_CONFIGURATION) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
747 |
{ |
52
254b9435d75e
Fixed build warnings
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
27
diff
changeset
|
748 |
#ifdef PRINT_DEBUG_INFO |
254b9435d75e
Fixed build warnings
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
27
diff
changeset
|
749 |
const char *desc_name_p = "UNKNOWN" ; |
254b9435d75e
Fixed build warnings
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
27
diff
changeset
|
750 |
#endif |
254b9435d75e
Fixed build warnings
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
27
diff
changeset
|
751 |
uint16_t size = 0 ; |
27
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
752 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
753 |
/* |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
754 |
* Return the CONFIGURATION descriptor. |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
755 |
*/ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
756 |
if (desc_p == (CyCh9ConfigurationDesc *)&ConfigHSDesc) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
757 |
{ |
52
254b9435d75e
Fixed build warnings
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
27
diff
changeset
|
758 |
#ifdef PRINT_DEBUG_INFO |
27
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
759 |
desc_name_p = "HighSpeed" ; |
52
254b9435d75e
Fixed build warnings
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
27
diff
changeset
|
760 |
#endif |
27
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
761 |
size = sizeof(ConfigHSDesc) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
762 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
763 |
else if (desc_p == (CyCh9ConfigurationDesc *)&ConfigFSDesc) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
764 |
{ |
52
254b9435d75e
Fixed build warnings
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
27
diff
changeset
|
765 |
#ifdef PRINT_DEBUG_INFO |
27
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
766 |
desc_name_p = "FullSpeed" ; |
52
254b9435d75e
Fixed build warnings
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
27
diff
changeset
|
767 |
#endif |
27
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
768 |
size = sizeof(ConfigFSDesc) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
769 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
770 |
else if (desc_p == &ZeroDesc) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
771 |
{ |
52
254b9435d75e
Fixed build warnings
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
27
diff
changeset
|
772 |
#ifdef PRINT_DEBUG_INFO |
27
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
773 |
desc_name_p = "ZeroDesc" ; |
52
254b9435d75e
Fixed build warnings
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
27
diff
changeset
|
774 |
#endif |
27
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
775 |
size = sizeof(ZeroDesc) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
776 |
} |
52
254b9435d75e
Fixed build warnings
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
27
diff
changeset
|
777 |
|
27
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
778 |
CyAsHalPrintMessage("**** CY_CH9_GD_CONFIGURATION - %s (size = %d)\n", desc_name_p, size) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
779 |
if (size > 0) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
780 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
781 |
PrintData("CFG", (uint8_t *)desc_p, size) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
782 |
desc_p->bDescriptorType = CY_CH9_GD_CONFIGURATION; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
783 |
ret = SendSetupData(h, reqlen, size, desc_p) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
784 |
if (ret != CY_AS_ERROR_SUCCESS) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
785 |
CyAsHalPrintMessage("****** ERROR WRITING USB DATA - %d\n", ret) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
786 |
else |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
787 |
CyAsHalPrintMessage("** Write Sucessful\n") ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
788 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
789 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
790 |
else if (data[3] == CY_CH9_GD_OTHER_SPEED_CONFIGURATION) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
791 |
{ |
52
254b9435d75e
Fixed build warnings
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
27
diff
changeset
|
792 |
#ifdef PRINT_DEBUG_INFO |
254b9435d75e
Fixed build warnings
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
27
diff
changeset
|
793 |
const char *desc_name_p = "UNKNOWN" ; |
254b9435d75e
Fixed build warnings
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
27
diff
changeset
|
794 |
#endif |
254b9435d75e
Fixed build warnings
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
27
diff
changeset
|
795 |
uint16_t size = 0 ; |
27
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
796 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
797 |
/* |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
798 |
* Return the CONFIGURATION descriptor. |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
799 |
*/ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
800 |
if (other_p == (CyCh9ConfigurationDesc *)&ConfigHSDesc) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
801 |
{ |
52
254b9435d75e
Fixed build warnings
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
27
diff
changeset
|
802 |
#ifdef PRINT_DEBUG_INFO |
27
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
803 |
desc_name_p = "HighSpeed" ; |
52
254b9435d75e
Fixed build warnings
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
27
diff
changeset
|
804 |
#endif |
27
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
805 |
size = sizeof(ConfigHSDesc) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
806 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
807 |
else if (other_p == (CyCh9ConfigurationDesc *)&ConfigFSDesc) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
808 |
{ |
52
254b9435d75e
Fixed build warnings
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
27
diff
changeset
|
809 |
#ifdef PRINT_DEBUG_INFO |
27
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
810 |
desc_name_p = "FullSpeed" ; |
52
254b9435d75e
Fixed build warnings
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
27
diff
changeset
|
811 |
#endif |
27
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
812 |
size = sizeof(ConfigFSDesc) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
813 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
814 |
else if (other_p == &ZeroDesc) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
815 |
{ |
52
254b9435d75e
Fixed build warnings
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
27
diff
changeset
|
816 |
#ifdef PRINT_DEBUG_INFO |
27
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
817 |
desc_name_p = "ZeroDesc" ; |
52
254b9435d75e
Fixed build warnings
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
27
diff
changeset
|
818 |
#endif |
27
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
819 |
size = sizeof(ZeroDesc) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
820 |
} |
52
254b9435d75e
Fixed build warnings
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
27
diff
changeset
|
821 |
|
27
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
822 |
CyAsHalPrintMessage("**** CY_CH9_GD_OTHER_SPEED_CONFIGURATION - %s (size = %d)\n", desc_name_p, size) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
823 |
if (size > 0) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
824 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
825 |
PrintData("CFG", (uint8_t *)other_p, size) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
826 |
other_p->bDescriptorType = CY_CH9_GD_OTHER_SPEED_CONFIGURATION; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
827 |
ret = SendSetupData(h, reqlen, size, other_p) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
828 |
if (ret != CY_AS_ERROR_SUCCESS) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
829 |
CyAsHalPrintMessage("****** ERROR WRITING USB DATA - %d\n", ret) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
830 |
else |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
831 |
CyAsHalPrintMessage("** Write Sucessful\n") ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
832 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
833 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
834 |
else if (data[3] == CY_CH9_GD_STRING) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
835 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
836 |
SendStringDescriptor(h, data) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
837 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
838 |
else if (data[3] == CY_CH9_GD_REPORT) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
839 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
840 |
CyAsHalPrintMessage("**** CY_CH9_GD_REPORT\n") ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
841 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
842 |
else if (data[3] == CY_CH9_GD_HID) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
843 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
844 |
CyAsHalPrintMessage("**** CY_CH9_GD_HID\n") ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
845 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
846 |
else |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
847 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
848 |
CyAsHalPrintMessage("**** Unknown Descriptor request\n") ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
849 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
850 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
851 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
852 |
/* |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
853 |
static void EP0DataCallback(CyAsDeviceHandle h, CyAsEndPointNumber_t ep, uint32_t count, void *buf_p, CyAsReturnStatus_t status) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
854 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
855 |
(void)ep ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
856 |
(void)h ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
857 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
858 |
if (status == CY_AS_ERROR_SUCCESS) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
859 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
860 |
CyAsHalPrintMessage("Read data phase of setup packet from EP0\n") ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
861 |
PrintData("SetupData", buf_p, (uint16_t)count) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
862 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
863 |
else |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
864 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
865 |
CyAsHalPrintMessage("Error reading data from EP0\n") ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
866 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
867 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
868 |
*/ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
869 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
870 |
static void |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
871 |
ProcessSetupPacketRequest(CyAsDeviceHandle h, uint8_t *data) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
872 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
873 |
CyAsReturnStatus_t ret ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
874 |
uint16_t reqlen = data[6] | (data[7] << 8) ; |
52
254b9435d75e
Fixed build warnings
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
27
diff
changeset
|
875 |
(void)ret; |
27
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
876 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
877 |
if ((data[0] & CY_CH9_SETUP_TYPE_MASK) == CY_CH9_SETUP_STANDARD_REQUEST) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
878 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
879 |
switch(data[1]) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
880 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
881 |
case CY_CH9_SC_GET_DESCRIPTOR: |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
882 |
CyAsHalPrintMessage("USB EP0 : CY_CH9_SC_GET_DESCRIPTOR request\n") ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
883 |
ProcessGetDescriptorRequest(h, data) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
884 |
break ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
885 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
886 |
case CY_CH9_SC_GET_INTERFACE: |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
887 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
888 |
uint8_t *response = GetReplyArea() ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
889 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
890 |
*response = 0 ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
891 |
CyAsHalPrintMessage("************* USB EP0: CY_CH9_SC_GET_INTERFACE request - RETURNING ZERO\n") ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
892 |
ret = SetupWrite(h, reqlen, 1, response) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
893 |
if (ret != CY_AS_ERROR_SUCCESS) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
894 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
895 |
CyAsHalPrintMessage("****** ERROR WRITING USB DATA - %d\n", ret) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
896 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
897 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
898 |
break ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
899 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
900 |
case CY_CH9_SC_SET_INTERFACE: |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
901 |
CyAsHalPrintMessage("USB EP0 : CY_CH9_SC_SET_INTERFACE request\n") ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
902 |
break ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
903 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
904 |
case CY_CH9_SC_SET_CONFIGURATION: |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
905 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
906 |
/*CyAsReturnStatus_t ret = CY_AS_ERROR_SUCCESS ;*/ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
907 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
908 |
CyAsHalPrintMessage("USB EP0 : CY_CH9_SC_SET_CONFIGURATION request (%02x)\n", data[2]) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
909 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
910 |
gAsyncStallDone = CyFalse ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
911 |
gAsyncStallStale = 0; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
912 |
CyAsUsbSetStall(h, 3, StallCallbackEX, 18); |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
913 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
914 |
gSetConfig = CyTrue ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
915 |
g_pAstDevice->configDone = 1 ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
916 |
MyConfiguration = data[2]; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
917 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
918 |
/* Set configuration is the last step before host send MTP data to EP2 */ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
919 |
#if 0 |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
920 |
ret = CyAsUsbReadDataAsync(g_pAstDevice->astDevHandle, |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
921 |
CY_AS_MTP_BULK_OUT_EP, CyFalse, 512, |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
922 |
g_pAstDevice->astEPBuf, TmtpReadCallback) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
923 |
if(ret != CY_AS_ERROR_SUCCESS && ret != CY_AS_ERROR_ASYNC_PENDING) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
924 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
925 |
/*handle error in reading*/ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
926 |
CyAsHalPrintMessage("CyAsMtpApp: CyAsUsbReadDataAsync Failed. Reason code: %d\n",ret) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
927 |
return ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
928 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
929 |
#endif |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
930 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
931 |
break ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
932 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
933 |
case CY_CH9_SC_GET_CONFIGURATION: |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
934 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
935 |
uint8_t *response = GetReplyArea() ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
936 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
937 |
*response = MyConfiguration ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
938 |
CyAsHalPrintMessage("USB EP0 : CY_CH9_SC_GET_INTERFACE request\n") ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
939 |
ret = SetupWrite(h, reqlen, 1, response) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
940 |
if (ret != CY_AS_ERROR_SUCCESS) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
941 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
942 |
CyAsHalPrintMessage("****** ERROR WRITING USB DATA - %d\n", ret) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
943 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
944 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
945 |
CyAsHalPrintMessage("USB EP0 : CY_CH9_SC_GET_CONFIGURATION request\n") ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
946 |
break ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
947 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
948 |
case CY_CH9_SC_GET_STATUS: |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
949 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
950 |
uint16_t *response = (uint16_t *)GetReplyArea() ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
951 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
952 |
*response = 0 ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
953 |
CyAsHalPrintMessage("USB EP0 : CY_CH9_SC_GET_STATUS request\n") ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
954 |
ret = SetupWrite(h, reqlen, 2, response) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
955 |
if (ret != CY_AS_ERROR_SUCCESS) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
956 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
957 |
CyAsHalPrintMessage("****** ERROR WRITING USB DATA - %d\n", ret) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
958 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
959 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
960 |
break ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
961 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
962 |
case CY_CH9_SC_CLEAR_FEATURE: |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
963 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
964 |
uint16_t feature = data[2] | (data[3] << 8) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
965 |
CyAsHalPrintMessage("USB EP0 : CY_CH9_SC_CLEAR_FEATURE request\n") ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
966 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
967 |
if ((data[0] & CY_CH9_SETUP_DEST_MASK) == CY_CH9_SETUP_DEST_ENDPOINT && feature == 0) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
968 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
969 |
CyAsEndPointNumber_t ep = data[4] | (data[5] << 8) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
970 |
/* This is a clear feature/endpoint halt on an endpoint */ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
971 |
CyAsHalPrintMessage("Calling ClearStall on EP %d\n", ep) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
972 |
ret = CyAsUsbClearStall(h, ep, StallCallback, 0) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
973 |
if (ret != CY_AS_ERROR_SUCCESS) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
974 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
975 |
CyAsHalPrintMessage("******* ERROR SEND CLEAR STALL REQUEST - %d\n", ret) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
976 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
977 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
978 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
979 |
break ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
980 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
981 |
case CY_CH9_SC_SET_FEATURE: |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
982 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
983 |
uint16_t feature = data[2] | (data[3] << 8) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
984 |
CyAsHalPrintMessage("USB EP0 : CY_CH9_SC_SET_FEATURE request\n") ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
985 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
986 |
if ((data[0] & CY_CH9_SETUP_DEST_MASK) == CY_CH9_SETUP_DEST_ENDPOINT && feature == 0) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
987 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
988 |
CyAsEndPointNumber_t ep = data[4] | (data[5] << 8) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
989 |
/* This is a clear feature/endpoint halt on an endpoint */ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
990 |
CyAsHalPrintMessage("Calling SetStall on EP %d\n", ep) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
991 |
ret = CyAsUsbSetStall(h, ep, StallCallback, 0) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
992 |
if (ret != CY_AS_ERROR_SUCCESS) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
993 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
994 |
CyAsHalPrintMessage("******* ERROR SEND SET STALL REQUEST - %d\n", ret) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
995 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
996 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
997 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
998 |
break; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
999 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1000 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1001 |
else if ((data[0] & CY_CH9_SETUP_TYPE_MASK) == CY_CH9_SETUP_CLASS_REQUEST) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1002 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1003 |
/* |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1004 |
* Handle class requests other than Mass Storage |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1005 |
*/ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1006 |
ret = CyAsUsbSetStall(h, 0, StallCallback, 0) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1007 |
CyAsHalPrintMessage("Sending stall request\n") ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1008 |
if (ret != CY_AS_ERROR_SUCCESS) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1009 |
CyAsHalPrintMessage("**** cannot set stall state on EP 0\n") ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1010 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1011 |
else |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1012 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1013 |
static char buf[1024] ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1014 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1015 |
if ((data[0] & 0x80) == 0) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1016 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1017 |
if (reqlen != 0) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1018 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1019 |
CyAsHalPrintMessage("OUT setup request with additional data\n") ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1020 |
/* This is an OUT setup request, with additional data to follow */ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1021 |
/*ret = CyAsUsbReadDataAsync(h, 0, CyFalse, reqlen, buf, EP0DataCallback) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1022 |
if(ret != CY_AS_ERROR_SUCCESS && ret != CY_AS_ERROR_ASYNC_PENDING) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1023 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1024 |
CyAsHalPrintMessage("CyAsMtpApp: CyAsUsbReadDataAsync Failed. Reason code: %d\n",ret) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1025 |
}*/ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1026 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1027 |
else |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1028 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1029 |
CyAsHalPrintMessage("Call setnak\n") ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1030 |
ret = CyAsUsbSetNak(h, 3, StallCallback, 1) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1031 |
if (ret != CY_AS_ERROR_SUCCESS) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1032 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1033 |
CyAsHalPrintMessage("Error in CyAsUsbSetNak - %d\n", ret) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1034 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1035 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1036 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1037 |
else |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1038 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1039 |
if (reqlen != 0) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1040 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1041 |
/* |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1042 |
* This is an unknown setup packet, probably some type of generated packet or a class |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1043 |
* packet we do not understand. We just send back some data. |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1044 |
*/ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1045 |
CyAsHalMemSet(buf, 0x44, sizeof(buf)) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1046 |
ret = SendSetupData(h, reqlen, reqlen, buf) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1047 |
if (ret != CY_AS_ERROR_SUCCESS) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1048 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1049 |
CyAsHalPrintMessage("Error ending setup data in response to unknown packet\n") ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1050 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1051 |
else |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1052 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1053 |
CyAsHalPrintMessage("Sent setup data associated with the unknown setup packet\n") ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1054 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1055 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1056 |
else |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1057 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1058 |
CyAsHalPrintMessage("Call setnak\n") ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1059 |
ret = CyAsUsbSetNak(h, 3, StallCallback, 1) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1060 |
if (ret != CY_AS_ERROR_SUCCESS) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1061 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1062 |
CyAsHalPrintMessage("Error in CyAsUsbSetNak - %d\n", ret) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1063 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1064 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1065 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1066 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1067 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1068 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1069 |
static void |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1070 |
MyUsbEventCallbackMS(CyAsDeviceHandle h, CyAsUsbEvent ev, void *evdata) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1071 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1072 |
CyAsHalPrintMessage("------------------------------ IN -------------------------------------\n") ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1073 |
switch(ev) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1074 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1075 |
case CyAsEventUsbSuspend: |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1076 |
CyAsHalPrintMessage("CyAsEventUsbSuspend received\n") ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1077 |
break ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1078 |
case CyAsEventUsbResume: |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1079 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1080 |
/*CyAsReturnStatus_t ret = CY_AS_ERROR_SUCCESS;*/ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1081 |
CyAsHalPrintMessage("CyAsEventUsbResume received\n") ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1082 |
/*ret = CyAsUsbReadDataAsync(g_pAstDevice->astDevHandle, CY_AS_MTP_BULK_OUT_EP, |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1083 |
CyFalse, 512, g_pAstDevice->astEPBuf, |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1084 |
TmtpReadCallback) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1085 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1086 |
if(ret != CY_AS_ERROR_SUCCESS && ret != CY_AS_ERROR_ASYNC_PENDING) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1087 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1088 |
CyAsHalPrintMessage("CyAsMtpApp: CyAsUsbReadDataAsync Failed. Reason code: %d\n",ret) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1089 |
return ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1090 |
}*/ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1091 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1092 |
break ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1093 |
case CyAsEventUsbReset: |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1094 |
#ifdef DEBUG_ZERO |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1095 |
desc_p = (CyCh9ConfigurationDesc *)&ConfigFSDesc ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1096 |
other_p = (CyCh9ConfigurationDesc *)&ConfigHSDesc ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1097 |
#else |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1098 |
desc_p = (CyCh9ConfigurationDesc *)&ZeroDesc ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1099 |
other_p = (CyCh9ConfigurationDesc *)&ZeroDesc ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1100 |
#endif |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1101 |
CyAsHalPrintMessage("CyAsEventUsbReset received\n") ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1102 |
break ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1103 |
case CyAsEventUsbSpeedChange: |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1104 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1105 |
#ifdef DEBUG_ZERO |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1106 |
desc_p = (CyCh9ConfigurationDesc *)&ConfigHSDesc ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1107 |
other_p = (CyCh9ConfigurationDesc *)&ConfigFSDesc ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1108 |
#else |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1109 |
desc_p = (CyCh9ConfigurationDesc *)&ZeroDesc ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1110 |
other_p = (CyCh9ConfigurationDesc *)&ZeroDesc ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1111 |
#endif |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1112 |
CyAsHalPrintMessage("CyAsEventUsbSpeedChange received\n") ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1113 |
break ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1114 |
case CyAsEventUsbSetConfig: |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1115 |
CyAsHalPrintMessage("CyAsEventUsbSetConfig received\n") ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1116 |
gSetConfig = CyTrue ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1117 |
break ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1118 |
case CyAsEventUsbSetupPacket: |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1119 |
PrintData("CyAsEventUsbSetupPacket received: ", (uint8_t*)evdata, 8) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1120 |
ProcessSetupPacketRequest(h, (uint8_t *)evdata) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1121 |
break ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1122 |
case CyAsEventUsbStatusPacket: |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1123 |
CyAsHalPrintMessage("CyAsEventUsbStatusPacket received\n") ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1124 |
break ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1125 |
case CyAsEventUsbInquiryBefore: |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1126 |
CyAsHalPrintMessage("CyAsEventUsbInquiryBefore received\n") ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1127 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1128 |
CyAsUsbInquiryData *data = (CyAsUsbInquiryData *)evdata ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1129 |
data->updated = CyTrue ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1130 |
data = data ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1131 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1132 |
break ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1133 |
case CyAsEventUsbInquiryAfter: |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1134 |
CyAsHalPrintMessage("CyAsEventUsbInquiryAfter received\n") ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1135 |
break ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1136 |
case CyAsEventUsbStartStop: |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1137 |
CyAsHalPrintMessage("CyAsEventUsbStartStop received\n") ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1138 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1139 |
CyAsUsbStartStopData *data = (CyAsUsbStartStopData *)evdata ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1140 |
data = data ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1141 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1142 |
break ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1143 |
default: |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1144 |
break; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1145 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1146 |
CyAsHalPrintMessage("------------------------------ OUT -------------------------------------\n") ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1147 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1148 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1149 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1150 |
int CyAsSymbianStorageTest(const char *pgm, CyAsDeviceHandle h, CyAsHalDeviceTag tag) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1151 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1152 |
CyAsReturnStatus_t ret ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1153 |
uint32_t count = 0 ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1154 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1155 |
g_tag = tag ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1156 |
memset(g_pAstDevice,0, sizeof(g_AstDevice)); |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1157 |
g_pAstDevice->astHalTag = tag ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1158 |
g_pAstDevice->astDevHandle = h ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1159 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1160 |
/* |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1161 |
* Give a delay to allow any equipment to be ready (e.g. CATC) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1162 |
*/ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1163 |
/*CyAsHalPrintMessage("Press enter to begin USB operation (%s): ", "P Port Enumeration") ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1164 |
fgets(buffer, sizeof(buffer), stdin) ;*/ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1165 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1166 |
CyAsHalPrintMessage("*** CyAsStorageStart...\n") ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1167 |
ret = CyAsStorageStart(h, 0, 0) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1168 |
if (ret != CY_AS_ERROR_SUCCESS) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1169 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1170 |
CyAsHalPrintMessage("%s: CyAsStorageStart returned error code %d\n", pgm, ret) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1171 |
return 0 ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1172 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1173 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1174 |
CyAsHalPrintMessage("*** CyAsStorageQueryMedia...\n") ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1175 |
ret = CyAsStorageQueryMedia(h, CyAsMediaSDFlash, &count, 0, 0) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1176 |
if (ret != CY_AS_ERROR_SUCCESS) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1177 |
{ |
52
254b9435d75e
Fixed build warnings
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
27
diff
changeset
|
1178 |
CyAsHalPrintMessage("%s: Cannot query SD device count - Reason code %d\n", pgm, ret) ; |
27
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1179 |
return 0 ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1180 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1181 |
CyAsHalPrintMessage("%d %s device(s) found\n", count, media_name) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1182 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1183 |
CyAsHalPrintMessage("*** CyAsStorageClaim...\n") ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1184 |
ret = CyAsStorageClaim(h, CyAsBus_1, 0, 0, 0) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1185 |
if (ret != CY_AS_ERROR_SUCCESS) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1186 |
{ |
52
254b9435d75e
Fixed build warnings
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
27
diff
changeset
|
1187 |
CyAsHalPrintMessage("%s: Cannot claim SD media - Reason code %d\n", pgm, ret) ; |
27
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1188 |
return 0; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1189 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1190 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1191 |
/* We know that there is only one */ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1192 |
g_pAstDevice->dev_data.bus = CyAsBus_1 ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1193 |
g_pAstDevice->dev_data.device = 0 ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1194 |
ret = CyAsStorageQueryDevice(h, &(g_pAstDevice->dev_data), 0, 0) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1195 |
if (ret != CY_AS_ERROR_SUCCESS) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1196 |
{ |
52
254b9435d75e
Fixed build warnings
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
27
diff
changeset
|
1197 |
CyAsHalPrintMessage("%s: Cannot query SD device - Reason code %d\n", pgm, ret) ; |
27
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1198 |
return 0 ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1199 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1200 |
CyAsHalPrintMessage("blocksize %d, %d units found\n", |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1201 |
g_pAstDevice->dev_data.desc_p.block_size, g_pAstDevice->dev_data.desc_p.number_units) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1202 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1203 |
g_pAstDevice->unit_data.bus = CyAsBus_1 ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1204 |
g_pAstDevice->unit_data.device = 0 ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1205 |
g_pAstDevice->unit_data.unit = 0 ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1206 |
/* We know that there is only one */ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1207 |
ret = CyAsStorageQueryUnit(h, &(g_pAstDevice->unit_data), 0, 0) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1208 |
if (ret != CY_AS_ERROR_SUCCESS) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1209 |
{ |
52
254b9435d75e
Fixed build warnings
Lukasz Forynski <lukasz.forynski@gmail.com>
parents:
27
diff
changeset
|
1210 |
CyAsHalPrintMessage("%s: Cannot query SD device unit - Reason code %d\n", pgm, ret) ; |
27
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1211 |
return 0 ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1212 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1213 |
CyAsHalPrintMessage("blocksize %d, %d Block(s) found\n", |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1214 |
g_pAstDevice->unit_data.desc_p.block_size, g_pAstDevice->unit_data.desc_p.unit_size) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1215 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1216 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1217 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1218 |
int i = 0 , j; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1219 |
char buf[512] = {0} ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1220 |
char expBuf[512] = {0} ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1221 |
memset(buf, 0xa5, 512); |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1222 |
memset(expBuf, 0xa5, 512); |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1223 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1224 |
CyAsHalPrintMessage("Read SD card\n"); |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1225 |
ret = CyAsStorageRead( h, 1, 0, 0, 0, buf, 1); |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1226 |
if (ret != CY_AS_ERROR_SUCCESS) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1227 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1228 |
CyAsHalPrintMessage("%s: Cannot read first sector of SD card\n", pgm) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1229 |
return 0 ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1230 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1231 |
CyAsHalPrintMessage("Read Result\n"); |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1232 |
for ( i = 0 ; i < 512; i++ ) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1233 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1234 |
if ( (i != 0 ) && (i % 16 == 0)) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1235 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1236 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1237 |
CyAsHalPrintMessage("\t"); |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1238 |
for ( j = 0 ; j < 16 ; j++ ) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1239 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1240 |
if ( (buf[i+j] > 32) && (buf[i+j] < 127)) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1241 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1242 |
CyAsHalPrintMessage("%c",buf[i+j]); |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1243 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1244 |
else |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1245 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1246 |
CyAsHalPrintMessage("."); |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1247 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1248 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1249 |
CyAsHalPrintMessage("\n"); |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1250 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1251 |
CyAsHalPrintMessage("%02x ",buf[i]); |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1252 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1253 |
CyAsHalPrintMessage("\n"); |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1254 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1255 |
ret = CyAsStorageWrite(h, 1, 0, 0, 0, expBuf, 1); |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1256 |
if ( ret != CY_AS_ERROR_SUCCESS ) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1257 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1258 |
CyAsHalPrintMessage("%s: Cannot write to first sector of SD card\n",pgm) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1259 |
return 0 ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1260 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1261 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1262 |
memset(buf, 0xa5, 512); |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1263 |
ret = CyAsStorageRead(h, 1, 0, 0, 0, buf, 1); |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1264 |
if (ret != CY_AS_ERROR_SUCCESS) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1265 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1266 |
CyAsHalPrintMessage("%s: Cannot read first sector of SD card\n",pgm) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1267 |
return 0 ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1268 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1269 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1270 |
for ( i = 0 ; i < 512; i++ ) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1271 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1272 |
if ( buf[i] != expBuf[i] ) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1273 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1274 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1275 |
CyAsHalPrintMessage("EXP[%d]: 0x%02x",i,expBuf[i]); |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1276 |
CyAsHalPrintMessage("ACT[%d]: 0x%02x",i,buf[i]); |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1277 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1278 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1279 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1280 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1281 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1282 |
return 1 ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1283 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1284 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1285 |
int CyAsAPIGetHandle( CyAsDeviceHandle h, CyAsHalDeviceTag tag) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1286 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1287 |
g_tag = tag ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1288 |
memset(g_pAstDevice,0, sizeof(g_AstDevice)); |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1289 |
g_pAstDevice->astHalTag = tag ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1290 |
g_pAstDevice->astDevHandle = h ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1291 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1292 |
return 1 ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1293 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1294 |