1: uhs_status_t Usbh_Cdc_RestartIntIN(
void* pContext)
2: {
3:
PCDC_DEVICE pCdcDevice;
4: uhs_status_t nRetvalResorce;
5: CDC_FUNC_STATUS nRetval;
6: uhs_ubit8_t u8CntDeviceId;
7: uhs_status_t nRetStatus;
8:
9:
10:
11:
12:
if( pContext == NULL ) {
13: DIAPI_CDC_REPORT_SUMMARY( USBCDC_LOG_SYS_PARAM_ERROR );
14:
return(
USBCDC_API_PARAM_ERROR );
15: }
16:
17:
18:
19:
20:
if( g_pCdcDriver == NULL ) {
21: DIAPI_CDC_REPORT_SUMMARY( USBCDC_LOG_NOT_INIT );
22:
return(
USBCDC_API_SYS_SYSTEM_ERROR );
23: }
24:
25:
26:
27:
28:
29: nRetStatus = Usbh_Cdc_CheckDeviceStatus(pContext, &pCdcDevice, &u8CntDeviceId, ID_API_DET);
30:
if(nRetStatus !=
USBCDC_API_SUCCESS){
31: DIAPI_CDC_REPORT_SUMMARY( USBCDC_LOG_SYS_SYSTEM_ERROR );
32:
return(nRetStatus);
33: }
34:
35:
36:
37:
38: nRetvalResorce = CdcUtils_AcquisitionSemaphore(pCdcDevice->pIntInExecuteLock, WAITFOREVER);
39:
if( nRetvalResorce != TRUE ){
40:
41:
42:
43: (
void)CdcUtils_ReleaseSemaphore( g_pCdcDriver->pApiDetAccessLock[u8CntDeviceId] );
44: DIAPI_CDC_REPORT_SUMMARY( USBCDC_LOG_SYS_OUT_OF_RESOURCE );
45:
return(
USBCDC_API_SYS_OUT_OF_RESOURCE );
46: }
47:
48:
49:
50:
51:
if( (pCdcDevice->nDeviceStat == CDC_DEVICE_STAT_CONNECTING) ||
52: (pCdcDevice->nDeviceStat == CDC_DEVICE_STAT_REGIST) ) {
53:
54:
55:
56: (
void)CdcUtils_ReleaseSemaphore( pCdcDevice->pIntInExecuteLock );
57: (
void)CdcUtils_ReleaseSemaphore( g_pCdcDriver->pApiDetAccessLock[u8CntDeviceId] );
58:
59: DIAPI_CDC_REPORT_SUMMARY( USBCDC_LOG_NOT_USE );
60:
return(
USBCDC_API_NOT_READY );
61: }
62:
else if( pCdcDevice->nDeviceStat == CDC_DEVICE_STAT_NO_SUPPORT ) {
63:
64:
65:
66: (
void)CdcUtils_ReleaseSemaphore( pCdcDevice->pIntInExecuteLock );
67: (
void)CdcUtils_ReleaseSemaphore( g_pCdcDriver->pApiDetAccessLock[u8CntDeviceId] );
68:
69: DIAPI_CDC_REPORT_SUMMARY( USBCDC_LOG_NO_SUPPORT );
70:
return(
USBCDC_API_NO_SUPPORT );
71: }
72:
else {
73: ;
74: }
75:
76:
77:
if( pCdcDevice->pIntInBuff->isIntINUserFlag == TRUE ) {
78:
79:
80: (
void)CdcUtils_ReleaseSemaphore( pCdcDevice->pIntInExecuteLock );
81:
82:
83:
84: (
void)CdcUtils_ReleaseSemaphore( g_pCdcDriver->pApiDetAccessLock[u8CntDeviceId] );
85:
86:
87: DIAPI_CDC_REPORT_SUMMARY( USBCDC_LOG_ALREADY_START_INTIN );
88:
return(
USBCDC_API_ALREADY_START_INTIN );
89: }
90:
91:
92:
93:
94: nRetval = Usbh_Cdc_IssueIntInMsg(pCdcDevice);
95:
if(nRetval != CDC_FUNC_STATUS_SUCCESS ) {
96:
97:
98: (
void)CdcUtils_ReleaseSemaphore( pCdcDevice->pIntInExecuteLock );
99:
100:
101:
102: (
void)CdcUtils_ReleaseSemaphore( g_pCdcDriver->pApiDetAccessLock[u8CntDeviceId] );
103:
104:
105: DIAPI_CDC_REPORT_SUMMARY( USBCDC_LOG_FAILED_INTERRUPT );
106:
return(
USBCDC_API_TRANS_INT_FAILED );
107: }
108:
109:
110:
111:
112: pCdcDevice->pIntInBuff->isIntINUserFlag = TRUE;
113:
114:
115:
116:
117: nRetvalResorce = CdcUtils_ReleaseSemaphore( pCdcDevice->pIntInExecuteLock );
118:
if(nRetvalResorce != TRUE){
119:
120:
121: (
void)CdcUtils_ReleaseSemaphore( g_pCdcDriver->pApiDetAccessLock[u8CntDeviceId] );
122:
123:
124: DIAPI_CDC_REPORT_SUMMARY( USBCDC_LOG_SYS_OUT_OF_RESOURCE );
125:
return(
USBCDC_API_SYS_OUT_OF_RESOURCE );
126: }
127:
128:
129:
130:
131: nRetvalResorce = CdcUtils_ReleaseSemaphore( g_pCdcDriver->pApiDetAccessLock[u8CntDeviceId] );
132:
if(nRetvalResorce != TRUE){
133:
134: DIAPI_CDC_REPORT_SUMMARY( USBCDC_LOG_SYS_OUT_OF_RESOURCE );
135:
return(
USBCDC_API_SYS_OUT_OF_RESOURCE );
136: }
137:
138:
return(
USBCDC_API_SUCCESS );
139: }