more clean up use inline bit funciton instead of macros
This commit is contained in:
		@@ -375,7 +375,7 @@ void USBD_IRQHandler(void)
 | 
			
		||||
 | 
			
		||||
  for(uint8_t i=0; i<USBD_INTEN_EPDATA_Pos+1; i++)
 | 
			
		||||
  {
 | 
			
		||||
    if ( TU_BIT_TEST(inten, i) && regevt[i]  )
 | 
			
		||||
    if ( tu_bit_test(inten, i) && regevt[i]  )
 | 
			
		||||
    {
 | 
			
		||||
      int_status |= TU_BIT(i);
 | 
			
		||||
 | 
			
		||||
@@ -477,7 +477,7 @@ void USBD_IRQHandler(void)
 | 
			
		||||
   */
 | 
			
		||||
  for(uint8_t epnum=0; epnum<8; epnum++)
 | 
			
		||||
  {
 | 
			
		||||
    if ( TU_BIT_TEST(int_status, USBD_INTEN_ENDEPOUT0_Pos+epnum))
 | 
			
		||||
    if ( tu_bit_test(int_status, USBD_INTEN_ENDEPOUT0_Pos+epnum))
 | 
			
		||||
    {
 | 
			
		||||
      xfer_td_t* xfer = get_td(epnum, TUSB_DIR_OUT);
 | 
			
		||||
      uint8_t const xact_len = NRF_USBD->EPOUT[epnum].AMOUNT;
 | 
			
		||||
@@ -517,7 +517,7 @@ void USBD_IRQHandler(void)
 | 
			
		||||
    // CBI In: Endpoint -> Host (transaction complete)
 | 
			
		||||
    for(uint8_t epnum=0; epnum<8; epnum++)
 | 
			
		||||
    {
 | 
			
		||||
      if ( TU_BIT_TEST(data_status, epnum ) || ( epnum == 0 && is_control_in) )
 | 
			
		||||
      if ( tu_bit_test(data_status, epnum ) || ( epnum == 0 && is_control_in) )
 | 
			
		||||
      {
 | 
			
		||||
        xfer_td_t* xfer = get_td(epnum, TUSB_DIR_IN);
 | 
			
		||||
 | 
			
		||||
@@ -538,7 +538,7 @@ void USBD_IRQHandler(void)
 | 
			
		||||
    // CBI OUT: Host -> Endpoint
 | 
			
		||||
    for(uint8_t epnum=0; epnum<8; epnum++)
 | 
			
		||||
    {
 | 
			
		||||
      if ( TU_BIT_TEST(data_status, 16+epnum ) || ( epnum == 0 && is_control_out) )
 | 
			
		||||
      if ( tu_bit_test(data_status, 16+epnum ) || ( epnum == 0 && is_control_out) )
 | 
			
		||||
      {
 | 
			
		||||
        xfer_td_t* xfer = get_td(epnum, TUSB_DIR_OUT);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -279,7 +279,7 @@ static void process_xfer_isr(uint32_t int_status)
 | 
			
		||||
{
 | 
			
		||||
  for(uint8_t ep_id = 0; ep_id < EP_COUNT; ep_id++ )
 | 
			
		||||
  {
 | 
			
		||||
    if ( TU_BIT_TEST(int_status, ep_id) )
 | 
			
		||||
    if ( tu_bit_test(int_status, ep_id) )
 | 
			
		||||
    {
 | 
			
		||||
      ep_cmd_sts_t * ep_cs = &_dcd.ep[ep_id][0];
 | 
			
		||||
      xfer_dma_t* xfer_dma = &_dcd.dma[ep_id];
 | 
			
		||||
@@ -354,7 +354,7 @@ void USB_IRQHandler(void)
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // Setup Receive
 | 
			
		||||
  if ( TU_BIT_TEST(int_status, 0) && (dev_cmd_stat & CMDSTAT_SETUP_RECEIVED_MASK) )
 | 
			
		||||
  if ( tu_bit_test(int_status, 0) && (dev_cmd_stat & CMDSTAT_SETUP_RECEIVED_MASK) )
 | 
			
		||||
  {
 | 
			
		||||
    // Follow UM flowchart to clear Active & Stall on both Control IN/OUT endpoints
 | 
			
		||||
    _dcd.ep[0][0].active = _dcd.ep[1][0].active = 0;
 | 
			
		||||
@@ -368,7 +368,7 @@ void USB_IRQHandler(void)
 | 
			
		||||
    _dcd.ep[0][1].buffer_offset = get_buf_offset(_dcd.setup_packet);
 | 
			
		||||
 | 
			
		||||
    // clear bit0
 | 
			
		||||
    int_status = TU_BIT_CLEAR(int_status, 0);
 | 
			
		||||
    int_status = tu_bit_clear(int_status, 0);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // Endpoint transfer complete interrupt
 | 
			
		||||
 
 | 
			
		||||
@@ -530,7 +530,7 @@ void hal_dcd_isr(uint8_t rhport)
 | 
			
		||||
  {
 | 
			
		||||
    for ( uint8_t ep_id = 3; ep_id < DCD_ENDPOINT_MAX; ep_id += 2 )
 | 
			
		||||
    {
 | 
			
		||||
      if ( TU_BIT_TEST(ep_int_status, ep_id) )
 | 
			
		||||
      if ( tu_bit_test(ep_int_status, ep_id) )
 | 
			
		||||
      {
 | 
			
		||||
        LPC_USB->EpIntClr = TU_BIT(ep_id);
 | 
			
		||||
 | 
			
		||||
@@ -553,7 +553,7 @@ void hal_dcd_isr(uint8_t rhport)
 | 
			
		||||
 | 
			
		||||
    for ( uint8_t ep_id = 2; ep_id < DCD_ENDPOINT_MAX; ep_id++ )
 | 
			
		||||
    {
 | 
			
		||||
      if ( TU_BIT_TEST(eot, ep_id) )
 | 
			
		||||
      if ( tu_bit_test(eot, ep_id) )
 | 
			
		||||
      {
 | 
			
		||||
        if ( ep_id & 0x01 )
 | 
			
		||||
        {
 | 
			
		||||
 
 | 
			
		||||
@@ -341,7 +341,7 @@ void hal_dcd_isr(uint8_t rhport)
 | 
			
		||||
    {
 | 
			
		||||
      for(uint8_t ep_idx = 0; ep_idx < QHD_MAX; ep_idx++)
 | 
			
		||||
      {
 | 
			
		||||
        if ( TU_BIT_TEST(edpt_complete, ep_idx2bit(ep_idx)) )
 | 
			
		||||
        if ( tu_bit_test(edpt_complete, ep_idx2bit(ep_idx)) )
 | 
			
		||||
        {
 | 
			
		||||
          // 23.10.12.3 Failed QTD also get ENDPTCOMPLETE set
 | 
			
		||||
          dcd_qtd_t * p_qtd = &dcd_data_ptr[rhport]->qtd[ep_idx];
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user