equal
deleted
inserted
replaced
34 static CyAsDevice *gDeviceList = 0 ; |
34 static CyAsDevice *gDeviceList = 0 ; |
35 |
35 |
36 /* |
36 /* |
37 * The current debug level |
37 * The current debug level |
38 */ |
38 */ |
39 static uint8_t DebugLevel = 0 ; |
39 #ifdef CY_AS_LOG_SUPPORT |
|
40 static uint8_t DebugLevel = 0 ; //commented out as it's not |
40 |
41 |
41 /* |
42 /* |
42 * This function sets the debug level for the API |
43 * This function sets the debug level for the API |
43 * |
44 * |
44 */ |
45 */ |
46 CyAsMiscSetLogLevel(uint8_t level) |
47 CyAsMiscSetLogLevel(uint8_t level) |
47 { |
48 { |
48 DebugLevel = level ; |
49 DebugLevel = level ; |
49 } |
50 } |
50 |
51 |
51 #ifdef CY_AS_LOG_SUPPORT |
52 //#ifdef CY_AS_LOG_SUPPORT |
52 |
53 |
53 /* |
54 /* |
54 * This function is a low level logger for the API. |
55 * This function is a low level logger for the API. |
55 */ |
56 */ |
56 void |
57 void |
1144 MyHandleResponseReset(CyAsDevice* dev_p, |
1145 MyHandleResponseReset(CyAsDevice* dev_p, |
1145 CyAsLLRequestResponse *req_p, |
1146 CyAsLLRequestResponse *req_p, |
1146 CyAsLLRequestResponse *reply_p, |
1147 CyAsLLRequestResponse *reply_p, |
1147 CyAsResetType type) |
1148 CyAsResetType type) |
1148 { |
1149 { |
1149 uint16_t v ; |
|
1150 |
|
1151 (void)req_p ; |
1150 (void)req_p ; |
1152 (void)reply_p ; |
1151 (void)reply_p ; |
1153 |
1152 |
1154 /* |
1153 /* |
1155 * If the device is in suspend mode, it needs to be woken up so that the write |
1154 * If the device is in suspend mode, it needs to be woken up so that the write |
1156 * to the reset control register succeeds. We need not however wait for the |
1155 * to the reset control register succeeds. We need not however wait for the |
1157 * wake up procedure to be complete. |
1156 * wake up procedure to be complete. |
1158 */ |
1157 */ |
1159 if (CyAsDeviceIsInSuspendMode(dev_p)) |
1158 if (CyAsDeviceIsInSuspendMode(dev_p)) |
1160 { |
1159 { |
1161 v = CyAsHalReadRegister(dev_p->tag, CY_AS_MEM_CM_WB_CFG_ID) ; |
1160 CyAsHalReadRegister(dev_p->tag, CY_AS_MEM_CM_WB_CFG_ID) ; |
1162 CyAsHalSleep (1) ; |
1161 CyAsHalSleep (1) ; |
1163 } |
1162 } |
1164 |
1163 |
1165 if (type == CyAsResetHard) |
1164 if (type == CyAsResetHard) |
1166 { |
1165 { |
1518 CyAsCheckDeviceReady(dev_p) ; |
1517 CyAsCheckDeviceReady(dev_p) ; |
1519 |
1518 |
1520 if (CyAsDeviceIsInSuspendMode(dev_p)) |
1519 if (CyAsDeviceIsInSuspendMode(dev_p)) |
1521 return CY_AS_ERROR_IN_SUSPEND ; |
1520 return CY_AS_ERROR_IN_SUSPEND ; |
1522 |
1521 |
1523 if (bus < 0 || bus >= CY_AS_MAX_BUSES) |
1522 if (bus >= CY_AS_MAX_BUSES) |
1524 return CY_AS_ERROR_NO_SUCH_BUS ; |
1523 return CY_AS_ERROR_NO_SUCH_BUS ; |
1525 |
1524 |
1526 if (device >= CY_AS_MAX_STORAGE_DEVICES) |
1525 if (device >= CY_AS_MAX_STORAGE_DEVICES) |
1527 return CY_AS_ERROR_NO_SUCH_DEVICE ; |
1526 return CY_AS_ERROR_NO_SUCH_DEVICE ; |
1528 |
1527 |
3090 CyAsHalEnableInterrupts(int_state) ; |
3089 CyAsHalEnableInterrupts(int_state) ; |
3091 } |
3090 } |
3092 |
3091 |
3093 void MyPrintFuncCBNode(CyAsFuncCBNode* node) |
3092 void MyPrintFuncCBNode(CyAsFuncCBNode* node) |
3094 { |
3093 { |
3095 CyAsFunctCBType type = CyAsFunctCBTypeGetType(node->dataType) ; |
|
3096 CyAsHalPrintMessage("[cd:%2u dt:%2u cb:0x%08x d:0x%08x nt:%1i]", |
3094 CyAsHalPrintMessage("[cd:%2u dt:%2u cb:0x%08x d:0x%08x nt:%1i]", |
3097 node->client_data, type, (uint32_t)node->cb_p, (uint32_t)node->data, node->nodeType) ; |
3095 node->client_data, CyAsFunctCBTypeGetType(node->dataType), (uint32_t)node->cb_p, (uint32_t)node->data, node->nodeType) ; |
3098 } |
3096 } |
3099 |
3097 |
3100 void MyPrintCBQueue(CyAsCBQueue* queue_p) |
3098 void MyPrintCBQueue(CyAsCBQueue* queue_p) |
3101 { |
3099 { |
3102 uint32_t i = 0 ; |
3100 uint32_t i = 0 ; |
3330 default: |
3328 default: |
3331 ret = CY_AS_ERROR_INVALID_RESPONSE ; |
3329 ret = CY_AS_ERROR_INVALID_RESPONSE ; |
3332 CyAsHalAssert(CyFalse) ; |
3330 CyAsHalAssert(CyFalse) ; |
3333 break ; |
3331 break ; |
3334 } |
3332 } |
3335 |
3333 (void) type; |
3336 /* |
3334 /* |
3337 * If the low level layer returns a direct error, use the corresponding error code. |
3335 * If the low level layer returns a direct error, use the corresponding error code. |
3338 * If not, use the error code based on the response from firmware. |
3336 * If not, use the error code based on the response from firmware. |
3339 */ |
3337 */ |
3340 if (stat == CY_AS_ERROR_SUCCESS) |
3338 if (stat == CY_AS_ERROR_SUCCESS) |
3344 node->cb_p((CyAsDeviceHandle)dev_p, stat, node->client_data, (CyAsFunctCBType)node->dataType, node->data) ; |
3342 node->cb_p((CyAsDeviceHandle)dev_p, stat, node->client_data, (CyAsFunctCBType)node->dataType, node->data) ; |
3345 if(cntxt == CY_RQT_GENERAL_RQT_CONTEXT) |
3343 if(cntxt == CY_RQT_GENERAL_RQT_CONTEXT) |
3346 CyAsRemoveCBNode(dev_p->func_cbs_misc) ; |
3344 CyAsRemoveCBNode(dev_p->func_cbs_misc) ; |
3347 else |
3345 else |
3348 CyAsRemoveCBNode(dev_p->func_cbs_res) ; |
3346 CyAsRemoveCBNode(dev_p->func_cbs_res) ; |
3349 |
|
3350 } |
3347 } |
3351 |
3348 |
3352 |
3349 |
3353 /* This includes the implementation of the deprecated functions for backward |
3350 /* This includes the implementation of the deprecated functions for backward |
3354 * compatibility |
3351 * compatibility |