1: uhs_status_t Usbh_Cdc_StopIntIN(
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:
30: nRetStatus = Usbh_Cdc_CheckDeviceStatus(pContext, &pCdcDevice, &u8CntDeviceId, ID_API_DET);
31:
if(nRetStatus !=
USBCDC_API_SUCCESS){
32: DIAPI_CDC_REPORT_SUMMARY( USBCDC_LOG_SYS_SYSTEM_ERROR );
33:
return(nRetStatus);
34: }
35:
36:
37:
38:
39: nRetvalResorce = CdcUtils_AcquisitionSemaphore(pCdcDevice->pIntInExecuteLock, WAITFOREVER);
40:
if( nRetvalResorce != TRUE ){
41:
42:
43:
44: (
void)CdcUtils_ReleaseSemaphore( g_pCdcDriver->pApiDetAccessLock[u8CntDeviceId] );
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: DIAPI_CDC_REPORT_SUMMARY( USBCDC_LOG_NOT_USE );
59:
return(
USBCDC_API_NOT_READY );
60: }
61:
else if( pCdcDevice->nDeviceStat == CDC_DEVICE_STAT_NO_SUPPORT ) {
62:
63:
64:
65: (
void)CdcUtils_ReleaseSemaphore( pCdcDevice->pIntInExecuteLock );
66: (
void)CdcUtils_ReleaseSemaphore( g_pCdcDriver->pApiDetAccessLock[u8CntDeviceId] );
67:
68: DIAPI_CDC_REPORT_SUMMARY( USBCDC_LOG_NO_SUPPORT );
69:
return(
USBCDC_API_NO_SUPPORT );
70: }
71:
else {
72: ;
73: }
74:
75:
76:
if( pCdcDevice->pIntInBuff->isIntINUserFlag == FALSE ) {
77:
78:
79: (
void)CdcUtils_ReleaseSemaphore( pCdcDevice->pIntInExecuteLock );
80:
81:
82:
83: (
void)CdcUtils_ReleaseSemaphore( g_pCdcDriver->pApiDetAccessLock[u8CntDeviceId] );
84:
85:
86: DIAPI_CDC_REPORT_SUMMARY( USBCDC_LOG_ALREADY_STOP_INTIN );
87:
return(
USBCDC_API_ALREADY_STOP_INTIN );
88: }
89:
90:
91:
92:
93: nRetval = Usbh_Cdc_StopIntINMsg(pCdcDevice);
94:
if(nRetval != CDC_FUNC_STATUS_SUCCESS ) {
95:
96:
97: (
void)CdcUtils_ReleaseSemaphore( pCdcDevice->pIntInExecuteLock );
98:
99:
100:
101: (
void)CdcUtils_ReleaseSemaphore( g_pCdcDriver->pApiDetAccessLock[u8CntDeviceId] );
102:
103:
104: DIAPI_CDC_REPORT_SUMMARY( USBCDC_LOG_FAILED_INTERRUPT );
105:
return(
USBCDC_API_TRANS_INT_FAILED );
106: }
107:
108:
109:
110:
111: pCdcDevice->pIntInBuff->isIntINUserFlag = FALSE;
112:
113:
114:
115:
116: nRetvalResorce = CdcUtils_ReleaseSemaphore( pCdcDevice->pIntInExecuteLock );
117:
if(nRetvalResorce != TRUE){
118:
119:
120: (
void)CdcUtils_ReleaseSemaphore( g_pCdcDriver->pApiDetAccessLock[u8CntDeviceId] );
121:
122:
123: DIAPI_CDC_REPORT_SUMMARY( USBCDC_LOG_SYS_OUT_OF_RESOURCE );
124:
return(
USBCDC_API_SYS_OUT_OF_RESOURCE );
125: }
126:
127:
128:
129:
130: nRetvalResorce = CdcUtils_ReleaseSemaphore( g_pCdcDriver->pApiDetAccessLock[u8CntDeviceId] );
131:
if(nRetvalResorce != TRUE){
132:
133: DIAPI_CDC_REPORT_SUMMARY( USBCDC_LOG_SYS_OUT_OF_RESOURCE );
134:
return(
USBCDC_API_SYS_OUT_OF_RESOURCE );
135: }
136:
137:
return(
USBCDC_API_SUCCESS );
138: }