67
67
//! The USB controller will send STATUS ACK to USB Host regardless of the
68
68
//! selection.
69
69
//
70
- #define AM_HAL_USB_CTRL_XFR_WAIT_STATUS_ACK_ZLP_FROM_STACK
70
+ // #define AM_HAL_USB_CTRL_XFR_WAIT_STATUS_ACK_ZLP_FROM_STACK
71
71
72
72
73
73
//*****************************************************************
@@ -238,10 +238,10 @@ typedef struct
238
238
//! Endpoint transfer complete callback
239
239
am_hal_usb_ep_xfer_complete_callback ep_xfer_complete_callback ;
240
240
241
- #ifndef AM_HAL_USB_CTRL_XFR_WAIT_STATUS_ACK_ZLP_FROM_STACK
241
+ #ifndef AM_HAL_USB_CTRL_XFR_WAIT_STATUS_ACK_ZLP_FROM_STACK
242
242
bool bPendingInEndData ;
243
243
bool bPendingOutEndData ;
244
- #endif
244
+ #endif
245
245
}
246
246
am_hal_usb_state_t ;
247
247
@@ -806,7 +806,6 @@ am_hal_usb_power_control(void *pHandle,
806
806
bool bRetainState )
807
807
{
808
808
809
-
810
809
#ifndef AM_HAL_DISABLE_API_VALIDATION
811
810
//
812
811
// Check to make sure this is a valid handle.
@@ -822,7 +821,6 @@ am_hal_usb_power_control(void *pHandle,
822
821
am_hal_usb_state_t * pState = (am_hal_usb_state_t * ) pHandle ;
823
822
uint32_t ui32Module = pState -> ui32Module ;
824
823
825
-
826
824
#ifndef AM_HAL_DISABLE_API_VALIDATION
827
825
if ( ui32Module >= AM_REG_USB_NUM_MODULES )
828
826
{
@@ -1852,9 +1850,9 @@ am_hal_usb_ep0_xfer(am_hal_usb_state_t *pState, uint8_t ui8EpNum, uint8_t ui8EpD
1852
1850
1853
1851
switch ( pState -> eEP0State )
1854
1852
{
1855
- #ifndef AM_HAL_USB_CTRL_XFR_WAIT_STATUS_ACK_ZLP_FROM_STACK
1853
+ #ifndef AM_HAL_USB_CTRL_XFR_WAIT_STATUS_ACK_ZLP_FROM_STACK
1856
1854
case AM_HAL_USB_EP0_STATE_IDLE :
1857
- if ((pState -> bPendingInEndData || pState -> bPendingOutEndData ) && (ui16Len == 0 ))
1855
+ if ((pState -> bPendingInEndData || pState -> bPendingOutEndData ) && (ui16Len == 0 ))
1858
1856
{
1859
1857
// Reset EP0 state and wait for the next command from host.
1860
1858
am_hal_usb_ep0_state_reset (pState );
@@ -1867,12 +1865,12 @@ am_hal_usb_ep0_xfer(am_hal_usb_state_t *pState, uint8_t ui8EpNum, uint8_t ui8EpD
1867
1865
return AM_HAL_STATUS_FAIL ;
1868
1866
}
1869
1867
break ;
1870
- #endif
1868
+ #endif
1871
1869
1872
1870
case AM_HAL_USB_EP0_STATE_SETUP :
1873
1871
if (ui16Len == 0x0 )
1874
1872
{
1875
- #ifndef AM_HAL_USB_CTRL_XFR_WAIT_STATUS_ACK_ZLP_FROM_STACK
1873
+ #ifndef AM_HAL_USB_CTRL_XFR_WAIT_STATUS_ACK_ZLP_FROM_STACK
1876
1874
// There are 2 conditions that we are entering to this handling:
1877
1875
// 1. Previous command was with data stage. However, the subsequent SETUP is
1878
1876
// received in ISR before the ACK stage handling is done. For this case,
@@ -1881,7 +1879,7 @@ am_hal_usb_ep0_xfer(am_hal_usb_state_t *pState, uint8_t ui8EpNum, uint8_t ui8EpD
1881
1879
// back to IDLE so that it is able to receive next SETUP correctly.
1882
1880
1883
1881
// Case 1:
1884
- if (pState -> bPendingOutEndData || pState -> bPendingInEndData )
1882
+ if (pState -> bPendingOutEndData || pState -> bPendingInEndData )
1885
1883
{
1886
1884
am_hal_usb_xfer_reset (& pState -> ep0_xfer );
1887
1885
pState -> bPendingOutEndData = false;
@@ -1898,7 +1896,7 @@ am_hal_usb_ep0_xfer(am_hal_usb_state_t *pState, uint8_t ui8EpNum, uint8_t ui8EpD
1898
1896
pState -> eEP0State =
1899
1897
(ui8EpDir == AM_HAL_USB_EP_DIR_IN ) ? AM_HAL_USB_EP0_STATE_STATUS_TX : AM_HAL_USB_EP0_STATE_STATUS_RX ;
1900
1898
}
1901
- #else
1899
+ #else
1902
1900
// Upper layer USB stack just use zero length packet to confirm no data stage
1903
1901
// some requests like CLEAR_FEARURE, SET_ADDRESS, SET_CONFIGRATION, etc.
1904
1902
// end the control transfer from device side
@@ -1908,7 +1906,7 @@ am_hal_usb_ep0_xfer(am_hal_usb_state_t *pState, uint8_t ui8EpNum, uint8_t ui8EpD
1908
1906
// Will indicate request is completed
1909
1907
pState -> eEP0State =
1910
1908
(ui8EpDir == AM_HAL_USB_EP_DIR_IN ) ? AM_HAL_USB_EP0_STATE_STATUS_TX : AM_HAL_USB_EP0_STATE_STATUS_RX ;
1911
- #endif
1909
+ #endif
1912
1910
}
1913
1911
else
1914
1912
{
@@ -1928,11 +1926,11 @@ am_hal_usb_ep0_xfer(am_hal_usb_state_t *pState, uint8_t ui8EpNum, uint8_t ui8EpD
1928
1926
// Read requests handling
1929
1927
case AM_HAL_USB_EP_DIR_IN :
1930
1928
1931
- #ifndef AM_HAL_USB_CTRL_XFR_WAIT_STATUS_ACK_ZLP_FROM_STACK
1929
+ #ifndef AM_HAL_USB_CTRL_XFR_WAIT_STATUS_ACK_ZLP_FROM_STACK
1932
1930
// Flag that we need to handle End Data later for OUT
1933
1931
// direction
1934
1932
pState -> bPendingOutEndData = true;
1935
- #endif
1933
+ #endif
1936
1934
1937
1935
// Load the first packet
1938
1936
if (ui16Len < maxpacket )
@@ -1958,11 +1956,11 @@ am_hal_usb_ep0_xfer(am_hal_usb_state_t *pState, uint8_t ui8EpNum, uint8_t ui8EpD
1958
1956
// Write requests handling
1959
1957
// Waiting the host sending the data to the device
1960
1958
1961
- #ifndef AM_HAL_USB_CTRL_XFR_WAIT_STATUS_ACK_ZLP_FROM_STACK
1959
+ #ifndef AM_HAL_USB_CTRL_XFR_WAIT_STATUS_ACK_ZLP_FROM_STACK
1962
1960
// Flag that we need to handle End Data later for IN
1963
1961
// direction
1964
1962
pState -> bPendingInEndData = true;
1965
- #endif
1963
+ #endif
1966
1964
1967
1965
pState -> ep0_xfer .remaining = ui16Len ;
1968
1966
pState -> eEP0State = AM_HAL_USB_EP0_STATE_DATA_RX ;
@@ -3099,8 +3097,8 @@ am_hal_usb_control(am_hal_usb_control_e eControl, void *pArgs)
3099
3097
ui32RetVal = AM_HAL_STATUS_INVALID_ARG ;
3100
3098
break ;
3101
3099
}
3102
- ui32RetVal = am_hal_usb_setHFRC2 ( * ((am_hal_usb_hs_clock_type * ) pArgs )) ;
3103
- break ;
3100
+ ui32RetVal = am_hal_usb_setHFRC2 ( * ((am_hal_usb_hs_clock_type * ) pArgs ));
3101
+ break ;
3104
3102
3105
3103
default :
3106
3104
ui32RetVal = AM_HAL_STATUS_INVALID_ARG ;
0 commit comments