author | arunabha |
Tue, 13 Jul 2010 13:08:00 +0100 | |
changeset 41 | e73f15023e91 |
parent 23 | 117faf51deac |
permissions | -rw-r--r-- |
23
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
1 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
2 |
#include <kern_priv.h> |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
3 |
//#include <beagle/beagle_gpio.h> |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
4 |
#include <beagle/variant.h> |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
5 |
//#include <assp/omap3530_assp/omap3530_assp_priv.h> |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
6 |
//#include <assp/omap3530_assp/omap3530_irqmap.h> // GPIO interrupts |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
7 |
//#include <assp/omap3530_assp/omap3530_gpio.h> |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
8 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
9 |
//#include <assp.h> // Required for definition of TIsr |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
10 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
11 |
#include <cyastoria.h> |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
12 |
#include <cyasmtp.h> |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
13 |
#include <cyasusbinit.h> |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
14 |
//#include <cyasusbdescs.h> |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
15 |
#include "CyAsSymbianStorageDriver.h" |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
16 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
17 |
extern TmtpAstDev g_AstDevice; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
18 |
extern TmtpAstDev * g_pAstDevice; |
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 |
_LIT(KLitWbAPIMutex,"WBAPIMutex"); |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
21 |
static DMutex *WbApiMutex; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
22 |
const TUint8 KMutexOrdWB = 0x11; /**< @internalComponent */ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
23 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
24 |
TInt64 iMediaTotalSize; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
25 |
EXPORT_C int CyAsSymbianStorageDriver::Open(void) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
26 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
27 |
//CyAsHalDeviceTag tag; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
28 |
CyAsDeviceHandle h; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
29 |
CyAsReturnStatus_t ret ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
30 |
char *media_name = "SD"; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
31 |
uint32_t count = 0 ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
32 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
33 |
Kern::MutexCreate(WbApiMutex, KLitWbAPIMutex, KMutexOrdWB); |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
34 |
//tag = g_pAstDevice->astHalTag ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
35 |
h = g_pAstDevice->astDevHandle ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
36 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
37 |
Kern::Printf("*** CyAsStorageStart...\n") ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
38 |
ret = CyAsStorageStart(h, 0, 0) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
39 |
if (ret != CY_AS_ERROR_SUCCESS) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
40 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
41 |
Kern::Printf("CyAsSymbianStorageOpen: CyAsStorageStart returned error code %d\n", ret) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
42 |
return 0 ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
43 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
44 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
45 |
Kern::Printf("*** CyAsStorageQueryMedia...\n") ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
46 |
ret = CyAsStorageQueryMedia(h, CyAsMediaSDFlash, &count, 0, 0) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
47 |
if (ret != CY_AS_ERROR_SUCCESS) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
48 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
49 |
Kern::Printf("CyAsSymbianStorageOpen: Cannot query %s device count - Reason code %d\n", media_name, ret) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
50 |
return 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 |
Kern::Printf("%d %s device(s) found\n", count, media_name) ; |
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 |
Kern::Printf("*** CyAsStorageClaim...\n") ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
55 |
ret = CyAsStorageClaim(h, CyAsBus_1, 0, 0, 0) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
56 |
if (ret != CY_AS_ERROR_SUCCESS) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
57 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
58 |
Kern::Printf("CyAsSymbianStorageOpen: Cannot claim %s media - Reason code %d\n", media_name, ret) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
59 |
return 0; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
60 |
} |
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 |
/* We know that there is only one */ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
63 |
g_pAstDevice->dev_data.bus = CyAsBus_1 ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
64 |
g_pAstDevice->dev_data.device = 0 ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
65 |
ret = CyAsStorageQueryDevice(h, &(g_pAstDevice->dev_data), 0, 0) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
66 |
if (ret != CY_AS_ERROR_SUCCESS) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
67 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
68 |
Kern::Printf("CyAsSymbianStorageOpen: Cannot query %s device - Reason code %d\n", media_name, ret) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
69 |
return 0 ; |
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 |
g_pAstDevice->unit_data.bus = CyAsBus_1 ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
73 |
g_pAstDevice->unit_data.device = 0 ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
74 |
g_pAstDevice->unit_data.unit = 0 ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
75 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
76 |
/* We know that there is only one */ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
77 |
ret = CyAsStorageQueryUnit(h, &(g_pAstDevice->unit_data), 0, 0) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
78 |
if (ret != CY_AS_ERROR_SUCCESS) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
79 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
80 |
Kern::Printf("CyAsSymbianStorageOpen: Cannot query %s device unit - Reason code %d\n", media_name, ret) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
81 |
return 0 ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
82 |
} |
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 |
iMediaTotalSize = (TInt64)g_pAstDevice->dev_data.desc_p.block_size * (TInt64)g_pAstDevice->unit_data.desc_p.unit_size; |
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 |
#if 0 |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
87 |
Kern::Printf("========================================================") ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
88 |
Kern::Printf("WBStorageInfo.type - %d", g_pAstDevice->dev_data.desc_p.type) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
89 |
Kern::Printf("WBStorageInfo.removable - %d", g_pAstDevice->dev_data.desc_p.removable) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
90 |
Kern::Printf("WBStorageInfo.writeable - %d", g_pAstDevice->dev_data.desc_p.writeable) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
91 |
Kern::Printf("WBStorageInfo.block_size - %d Bytes", g_pAstDevice->dev_data.desc_p.block_size) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
92 |
Kern::Printf("WBStorageInfo.number_units - %d", g_pAstDevice->dev_data.desc_p.number_units) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
93 |
Kern::Printf("WBStorageInfo.locked - %d", g_pAstDevice->dev_data.desc_p.locked) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
94 |
Kern::Printf("WBStorageInfo.erase_unit_size - %d Bytes", g_pAstDevice->dev_data.desc_p.erase_unit_size) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
95 |
Kern::Printf("WBStorageInfo.unit_size - %d", g_pAstDevice->unit_data.desc_p.unit_size) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
96 |
Kern::Printf("WBStorageInfo.start_block - %d", g_pAstDevice->unit_data.desc_p.start_block) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
97 |
Kern::Printf("WBStorageInfo.totalsize - %d Bytes", iMediaTotalSize) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
98 |
Kern::Printf("========================================================\n") ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
99 |
#endif |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
100 |
return 1; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
101 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
102 |
EXPORT_C int CyAsSymbianStorageDriver::Close(void) |
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 |
CyAsDeviceHandle h; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
105 |
CyAsReturnStatus_t ret ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
106 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
107 |
//tag = g_pAstDevice->astHalTag ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
108 |
h = g_pAstDevice->astDevHandle ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
109 |
Kern::Printf("*** CyAsStorageStop...\n") ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
110 |
ret = CyAsStorageStop(h, 0, 0) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
111 |
if (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 |
Kern::Printf("CyAsStorageStop: CyAsStorageStop returned error code %d\n", ret) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
114 |
return 0 ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
115 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
116 |
return 1; |
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 |
EXPORT_C int CyAsSymbianStorageDriver::Read(int pos, int num_block, void* cybuf) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
120 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
121 |
//CyAsHalDeviceTag tag; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
122 |
CyAsDeviceHandle h; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
123 |
CyAsReturnStatus_t ret ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
124 |
char *tmpbuf; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
125 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
126 |
Kern::MutexWait(*WbApiMutex); |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
127 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
128 |
tmpbuf = (char *)cybuf; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
129 |
//tag = g_pAstDevice->astHalTag ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
130 |
h = g_pAstDevice->astDevHandle ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
131 |
//CyAsHalPrintMessage("Read SD card\n"); |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
132 |
ret = CyAsStorageRead( h, 1, 0, 0, pos, tmpbuf, num_block); |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
133 |
if (ret != CY_AS_ERROR_SUCCESS) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
134 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
135 |
Kern::Printf("CyAsSymbianStorageRead: Cannot read sector %d (%d@%d)\n", ret, num_block, pos) ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
136 |
return 0 ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
137 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
138 |
Kern::MutexSignal(*WbApiMutex); |
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 |
return 1; |
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 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
143 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
144 |
EXPORT_C int CyAsSymbianStorageDriver::Write(int pos, int num_block, void* cybuf) |
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 |
//CyAsHalDeviceTag tag; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
147 |
CyAsDeviceHandle h; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
148 |
CyAsReturnStatus_t ret ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
149 |
char *tmpbuf; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
150 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
151 |
Kern::MutexWait(*WbApiMutex); |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
152 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
153 |
tmpbuf = (char *)cybuf; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
154 |
//tag = g_pAstDevice->astHalTag ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
155 |
h = g_pAstDevice->astDevHandle ; |
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 |
ret = CyAsStorageWrite(h, 1, 0, 0, pos, tmpbuf, num_block); |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
158 |
if ( ret != CY_AS_ERROR_SUCCESS ) |
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 |
Kern::Printf("CyAsSymbianStorageWrite: Cannot write to first sector of SD card\n") ; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
161 |
return 0 ; |
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 |
Kern::MutexSignal(*WbApiMutex); |
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 |
return 1; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
166 |
} |
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 |
EXPORT_C TInt CyAsSymbianStorageDriver::GetMediaType(void) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
169 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
170 |
/* Type of device */ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
171 |
return (TInt)g_pAstDevice->dev_data.desc_p.type; |
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 |
EXPORT_C TInt CyAsSymbianStorageDriver::GetIsRemovable(void) |
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 |
/* Is the device removable */ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
177 |
return g_pAstDevice->dev_data.desc_p.removable; |
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 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
180 |
EXPORT_C TInt CyAsSymbianStorageDriver::GetIsWriteable(void) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
181 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
182 |
/* Is the device writeable */ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
183 |
return g_pAstDevice->dev_data.desc_p.writeable; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
184 |
} |
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 |
EXPORT_C TUint16 CyAsSymbianStorageDriver::GetBlockSize(void) |
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 |
/* Basic block size for device */ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
189 |
return g_pAstDevice->dev_data.desc_p.block_size; |
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 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
192 |
EXPORT_C TUint CyAsSymbianStorageDriver::GetNumberOfUnits(void) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
193 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
194 |
/* Number of LUNs on the device */ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
195 |
return g_pAstDevice->dev_data.desc_p.number_units; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
196 |
} |
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 |
EXPORT_C TInt CyAsSymbianStorageDriver::GetIsLocked(void) |
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 |
/* Is the device password locked */ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
201 |
return g_pAstDevice->dev_data.desc_p.locked; |
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 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
204 |
EXPORT_C TUint CyAsSymbianStorageDriver::GetEraseBlockSize(void) |
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 |
/* Size in bytes of an Erase Unit. Block erase operation is only supported for SD storage, |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
207 |
and the erase_unit_size is invalid for all other kinds of storage. */ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
208 |
return g_pAstDevice->dev_data.desc_p.erase_unit_size; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
209 |
} |
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 |
EXPORT_C TUint CyAsSymbianStorageDriver::GetUnitSize(void) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
212 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
213 |
/* Number of blocks in the LUN */ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
214 |
return g_pAstDevice->unit_data.desc_p.unit_size; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
215 |
} |
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 |
EXPORT_C TUint CyAsSymbianStorageDriver::GetStartBlock(void) |
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 |
/* Physical start block for LUN */ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
220 |
return g_pAstDevice->unit_data.desc_p.start_block; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
221 |
} |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
222 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
223 |
EXPORT_C TInt64 CyAsSymbianStorageDriver::GetMediaSize(void) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
224 |
{ |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
225 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
226 |
/*(Basic block size for device x Number of LUNs on the device) |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
227 |
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
|
228 |
return iMediaTotalSize; |
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
229 |
} |
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 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
232 |
|
117faf51deac
Bug 1996 - Contribution for West Bridge Astoria Symbian Storage Driver
arunabha
parents:
diff
changeset
|
233 |