clean up helper func
This commit is contained in:
		@@ -201,7 +201,7 @@ bool dcd_init(uint8_t rhport)
 | 
			
		||||
 | 
			
		||||
static void bus_reset(void)
 | 
			
		||||
{
 | 
			
		||||
  memclr_(&dcd_data, sizeof(dcd_11u_13u_data_t));
 | 
			
		||||
  tu_memclr(&dcd_data, sizeof(dcd_11u_13u_data_t));
 | 
			
		||||
  for(uint8_t ep_id = 2; ep_id < DCD_11U_13U_QHD_COUNT; ep_id++)
 | 
			
		||||
  { // disable all non-control endpoints on bus reset
 | 
			
		||||
    dcd_data.qhd[ep_id][0].disable = dcd_data.qhd[ep_id][1].disable = 1;
 | 
			
		||||
@@ -473,7 +473,7 @@ edpt_hdl_t dcd_edpt_open(uint8_t rhport, tusb_desc_endpoint_t const * p_endpoint
 | 
			
		||||
 | 
			
		||||
  TU_ASSERT( dcd_data.qhd[ep_id][0].disable && dcd_data.qhd[ep_id][1].disable, null_handle ); // endpoint must not previously opened, normally this means running out of endpoints
 | 
			
		||||
 | 
			
		||||
  memclr_(dcd_data.qhd[ep_id], 2*sizeof(dcd_11u_13u_qhd_t));
 | 
			
		||||
  tu_memclr(dcd_data.qhd[ep_id], 2*sizeof(dcd_11u_13u_qhd_t));
 | 
			
		||||
  dcd_data.qhd[ep_id][0].is_isochronous = dcd_data.qhd[ep_id][1].is_isochronous = (p_endpoint_desc->bmAttributes.xfer == TUSB_XFER_ISOCHRONOUS);
 | 
			
		||||
  dcd_data.class_code[ep_id] = class_code;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -119,7 +119,7 @@ static void bus_reset(void)
 | 
			
		||||
	LPC_USB->USBNDDRIntClr   = 0xFFFFFFFF;
 | 
			
		||||
	LPC_USB->USBSysErrIntClr = 0xFFFFFFFF;
 | 
			
		||||
 | 
			
		||||
	memclr_(&dcd_data, sizeof(dcd_data_t));
 | 
			
		||||
	tu_memclr(&dcd_data, sizeof(dcd_data_t));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool dcd_init(uint8_t rhport)
 | 
			
		||||
@@ -432,7 +432,7 @@ edpt_hdl_t dcd_edpt_open(uint8_t rhport, tusb_desc_endpoint_t const * p_endpoint
 | 
			
		||||
 | 
			
		||||
	//------------- first DD prepare -------------//
 | 
			
		||||
	dcd_dma_descriptor_t* const p_dd = &dcd_data.dd[ep_id][0];
 | 
			
		||||
	memclr_(p_dd, sizeof(dcd_dma_descriptor_t));
 | 
			
		||||
	tu_memclr(p_dd, sizeof(dcd_dma_descriptor_t));
 | 
			
		||||
 | 
			
		||||
	p_dd->is_isochronous  = (p_endpoint_desc->bmAttributes.xfer == TUSB_XFER_ISOCHRONOUS) ? 1 : 0;
 | 
			
		||||
	p_dd->max_packet_size = p_endpoint_desc->wMaxPacketSize.size;
 | 
			
		||||
@@ -498,7 +498,7 @@ tusb_error_t dcd_edpt_xfer(edpt_hdl_t edpt_hdl, uint8_t* buffer, uint16_t total_
 | 
			
		||||
  {
 | 
			
		||||
    // setup new dd
 | 
			
		||||
    dcd_dma_descriptor_t* const p_dd = &dcd_data.dd[ edpt_hdl.index ][1];
 | 
			
		||||
    memclr_(p_dd, sizeof(dcd_dma_descriptor_t));
 | 
			
		||||
    tu_memclr(p_dd, sizeof(dcd_dma_descriptor_t));
 | 
			
		||||
 | 
			
		||||
    dd_xfer_init(p_dd, buffer, total_bytes);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -133,7 +133,7 @@ static void bus_reset(uint8_t rhport)
 | 
			
		||||
  //------------- Queue Head & Queue TD -------------//
 | 
			
		||||
  dcd_data_t* p_dcd = dcd_data_ptr[rhport];
 | 
			
		||||
 | 
			
		||||
  memclr_(p_dcd, sizeof(dcd_data_t));
 | 
			
		||||
  tu_memclr(p_dcd, sizeof(dcd_data_t));
 | 
			
		||||
 | 
			
		||||
  //------------- Set up Control Endpoints (0 OUT, 1 IN) -------------//
 | 
			
		||||
	p_dcd->qhd[0].zero_length_termination = p_dcd->qhd[1].zero_length_termination = 1;
 | 
			
		||||
@@ -149,7 +149,7 @@ bool dcd_init(uint8_t rhport)
 | 
			
		||||
  LPC_USB0_Type* const lpc_usb = LPC_USB[rhport];
 | 
			
		||||
  dcd_data_t* p_dcd = dcd_data_ptr[rhport];
 | 
			
		||||
 | 
			
		||||
  memclr_(p_dcd, sizeof(dcd_data_t));
 | 
			
		||||
  tu_memclr(p_dcd, sizeof(dcd_data_t));
 | 
			
		||||
 | 
			
		||||
  lpc_usb->ENDPOINTLISTADDR = (uint32_t) p_dcd->qhd; // Endpoint List Address has to be 2K alignment
 | 
			
		||||
  lpc_usb->USBSTS_D  = lpc_usb->USBSTS_D;
 | 
			
		||||
@@ -196,7 +196,7 @@ static inline uint8_t edpt_phy2log(uint8_t physical_endpoint)
 | 
			
		||||
 | 
			
		||||
static void qtd_init(dcd_qtd_t* p_qtd, void * data_ptr, uint16_t total_bytes)
 | 
			
		||||
{
 | 
			
		||||
  memclr_(p_qtd, sizeof(dcd_qtd_t));
 | 
			
		||||
  tu_memclr(p_qtd, sizeof(dcd_qtd_t));
 | 
			
		||||
 | 
			
		||||
  p_qtd->used        = 1;
 | 
			
		||||
 | 
			
		||||
@@ -303,7 +303,7 @@ bool dcd_edpt_open(uint8_t rhport, tusb_desc_endpoint_t const * p_endpoint_desc)
 | 
			
		||||
  uint8_t ep_idx    = edpt_addr2phy(p_endpoint_desc->bEndpointAddress);
 | 
			
		||||
  dcd_qhd_t * p_qhd = &dcd_data_ptr[rhport]->qhd[ep_idx];
 | 
			
		||||
 | 
			
		||||
  memclr_(p_qhd, sizeof(dcd_qhd_t));
 | 
			
		||||
  tu_memclr(p_qhd, sizeof(dcd_qhd_t));
 | 
			
		||||
 | 
			
		||||
  p_qhd->zero_length_termination = 1;
 | 
			
		||||
  p_qhd->max_package_size        = p_endpoint_desc->wMaxPacketSize.size;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user