Skip to content

Commit

Permalink
[bsp][nuvoton][rsoc] Fix compilation issues with bsp of nuvoton series
Browse files Browse the repository at this point in the history
  • Loading branch information
hydevcode committed Sep 28, 2024
1 parent 7506bfc commit f1a4e7f
Show file tree
Hide file tree
Showing 11 changed files with 114 additions and 114 deletions.
2 changes: 1 addition & 1 deletion bsp/nuvoton/libraries/m031/rtt_port/drv_adc.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,4 +151,4 @@ int rt_hw_adc_init(void)
INIT_BOARD_EXPORT(rt_hw_adc_init);


#endif /*#if defined(BSP_USING_ADC)*/
#endif /* #if defined(BSP_USING_ADC) */
62 changes: 31 additions & 31 deletions bsp/nuvoton/libraries/m2354/rtt_port/drv_usbhost.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#define NU_USBHOST_HUB_POLLING_INTERVAL (100)
#endif

#define NU_MAX_USBH_PORT 1 /*USB1.1 port*/
#define NU_MAX_USBH_PORT 1 /* USB1.1 port */
#define NU_MAX_USBH_PIPE 16
#define NU_USBH_THREAD_STACK_SIZE 2048

Expand Down Expand Up @@ -60,7 +60,7 @@
#define NU_USBHOST_UNLOCK()
#endif

/* Private typedef --------------------------------------------------------------*/
/* Private typedef -------------------------------------------------------------- */
typedef struct nu_port_dev
{
rt_bool_t bRHParent;
Expand Down Expand Up @@ -89,7 +89,7 @@ struct nu_usbh_dev
S_NU_RH_PORT_CTRL asPortCtrl[NU_MAX_USBH_PORT];
};

/* Private variables ------------------------------------------------------------*/
/* Private variables ------------------------------------------------------------ */
static struct nu_usbh_dev s_sUSBHDev;

static S_NU_RH_PORT_CTRL *
Expand All @@ -100,13 +100,13 @@ GetRHPortControlFromPipe(
int port;
if (pipe->inst->parent_hub->is_roothub)
{
/*case: device ---> root hub*/
/* case: device ---> root hub */
inst = pipe->inst;
port = inst->port;
}
else
{
/*case: device ---> hub ---> root hub*/
/* case: device ---> hub ---> root hub */
inst = pipe->inst->parent_hub->self;
port = inst->port;
}
Expand All @@ -132,11 +132,11 @@ GetPortDevFromPipe(

if (pipe->inst->parent_hub->is_roothub)
{
/*case: device ---> root hub*/
/* case: device ---> root hub */
return &psRHPortCtrl->sRHPortDev;
}

/*case: device ---> hub ---> root hub*/
/* case: device ---> hub ---> root hub */
for (i = 0 ; i < NU_MAX_USBH_HUB_PORT_DEV; i ++)
{
if (psRHPortCtrl->asHubPortDev[i].port_num == pipe->inst->port)
Expand Down Expand Up @@ -266,7 +266,7 @@ static rt_err_t nu_open_pipe(upipe_t pipe)

if ((psPortDev == NULL) || (psPortDev->pUDev == NULL))
{
/*allocate new dev for hub device*/
/* allocate new dev for hub device */
psPortDev = AllocateNewUDev(psPortCtrl);

if (psPortDev == RT_NULL)
Expand All @@ -291,7 +291,7 @@ static rt_err_t nu_open_pipe(upipe_t pipe)
psPortDev->bEnumDone = FALSE;
}

/*For ep0 control transfer*/
/* For ep0 control transfer */
if ((pipe->ep.bEndpointAddress & 0x7F) == 0)
{
pipe->pipe_index = 0;
Expand Down Expand Up @@ -339,7 +339,7 @@ static rt_err_t nu_close_pipe(upipe_t pipe)

psPortDev = GetPortDevFromPipe(pipe);

/*For ep0 control transfer*/
/* For ep0 control transfer */
if ((pipe->ep.bEndpointAddress & 0x7F) == 0)
{
if ((psPortDev) && (psPortDev->bRHParent == FALSE) && (psPortDev->bEnumDone == TRUE))
Expand Down Expand Up @@ -410,7 +410,7 @@ static int nu_bulk_xfer(
if (ret < 0)
return ret;

/*wait transfer done*/
/* wait transfer done */
if (rt_completion_wait(&(psPortDev->utr_completion), timeouts) < 0)
{
rt_kprintf("Request Timeout in %d ms!! (bulk_xfer)\n", timeouts);
Expand Down Expand Up @@ -465,7 +465,7 @@ static void xfer_done_cb(UTR_T *psUTR)
{
S_NU_PORT_DEV *psPortDev = (S_NU_PORT_DEV *)psUTR->context;

/*transfer done, signal utr_completion*/
/* transfer done, signal utr_completion */
rt_completion_done(&(psPortDev->utr_completion));
}

Expand Down Expand Up @@ -493,7 +493,7 @@ static int nu_pipe_xfer(upipe_t pipe, rt_uint8_t token, void *buffer, int nbytes
goto exit_nu_pipe_xfer;
}

/*ctrl xfer*/
/* ctrl xfer */
if (pipe->ep.bmAttributes == USB_EP_ATTR_CONTROL)
{
int ret;
Expand All @@ -507,27 +507,27 @@ static int nu_pipe_xfer(upipe_t pipe, rt_uint8_t token, void *buffer, int nbytes
/* Read data from USB device. */
if (psSetup->request_type & USB_REQ_TYPE_DIR_IN)
{
/*Store setup request*/
/* Store setup request */
rt_memcpy(&psPortCtrl->asHubPortDev->asSetupReq[pipe->pipe_index], psSetup, sizeof(struct urequest));
}
else
{
/* Write data to USB device. */
/*Trigger USBHostLib Ctrl_Xfer*/
/* Trigger USBHostLib Ctrl_Xfer */
ret = nu_ctrl_xfer(psPortDev, psSetup, NULL, timeouts);
if (ret != psSetup->wLength)
goto exit_nu_pipe_xfer;
}
}
else
{
/*token == USBH_PID_DATA*/
/* token == USBH_PID_DATA */
if (buffer_nonch && ((pipe->ep.bEndpointAddress & USB_DIR_MASK) == USB_DIR_IN))
{
struct urequest *psSetup = &psPortCtrl->asHubPortDev->asSetupReq[pipe->pipe_index];

/* Read data from USB device. */
/*Trigger USBHostLib Ctril_Xfer*/
/* Trigger USBHostLib Ctril_Xfer */
/*
* Workaround: HCD driver can readback all bytes of setup.wLength, but not support single packet transferring.
*/
Expand Down Expand Up @@ -556,10 +556,10 @@ static int nu_pipe_xfer(upipe_t pipe, rt_uint8_t token, void *buffer, int nbytes
LOG_D("%d == USBH_PID_DATA, nil buf-%d", token, nbytes);
}

} /*else*/
} /* else */
i32XferLen = nbytes;
goto exit_nu_pipe_xfer;
} /* if ( pipe->ep.bmAttributes == USB_EP_ATTR_CONTROL )*/
} /* if ( pipe->ep.bmAttributes == USB_EP_ATTR_CONTROL ) */
else
{

Expand All @@ -580,7 +580,7 @@ static int nu_pipe_xfer(upipe_t pipe, rt_uint8_t token, void *buffer, int nbytes
psUTR->bIsTransferDone = 0;
psUTR->status = 0;

/*others xfer*/
/* others xfer */
rt_completion_init(&(psPortDev->utr_completion));

if (pipe->ep.bmAttributes == USB_EP_ATTR_BULK)
Expand All @@ -596,7 +596,7 @@ static int nu_pipe_xfer(upipe_t pipe, rt_uint8_t token, void *buffer, int nbytes
if (nu_int_xfer(pipe, psPortDev, psUTR, timeouts) < 0)
{
LOG_D("nu_pipe_xfer ERROR: int transfer failed");
/*goto exit_nu_pipe_xfer;*/
/* goto exit_nu_pipe_xfer; */
}
else
{
Expand All @@ -606,25 +606,25 @@ static int nu_pipe_xfer(upipe_t pipe, rt_uint8_t token, void *buffer, int nbytes
}
else if (pipe->ep.bmAttributes == USB_EP_ATTR_ISOC)
{
/*TODO: ISO transfer*/
/* TODO: ISO transfer */
LOG_D("nu_pipe_xfer ERROR: isoc transfer not support");
goto exit_nu_pipe_xfer;
}

} /*else*/
} /* else */

failreport_nu_pipe_xfer:

if (psUTR->bIsTransferDone == 0)
{
/*Timeout*/
/* Timeout */
LOG_D("nu_pipe_xfer ERROR: timeout");
pipe->status = UPIPE_STATUS_ERROR;
usbh_quit_utr(psUTR);
}
else
{
/* Transfer Done. Get status*/
/* Transfer Done. Get status */
if (psUTR->status == 0)
{
pipe->status = UPIPE_STATUS_OK;
Expand All @@ -643,7 +643,7 @@ static int nu_pipe_xfer(upipe_t pipe, rt_uint8_t token, void *buffer, int nbytes

exit_nu_pipe_xfer:

/*Call callback*/
/* Call callback */
if (pipe->callback != RT_NULL)
{
pipe->callback(pipe);
Expand Down Expand Up @@ -742,7 +742,7 @@ static void nu_hcd_disconnect_callback(
}


/* USB host operations -----------------------------------------------------------*/
/* USB host operations ----------------------------------------------------------- */
static struct uhcd_ops nu_uhcd_ops =
{
nu_reset_port,
Expand All @@ -757,10 +757,10 @@ static rt_err_t nu_hcd_init(rt_device_t device)

usbh_core_init();

/*install connect/disconnect callback*/
/* install connect/disconnect callback */
usbh_install_conn_callback(nu_hcd_connect_callback, nu_hcd_disconnect_callback);

/*create thread for polling usbh port status*/
/* create thread for polling usbh port status */
/* create usb hub thread */
pNuUSBHDev->polling_thread = rt_thread_create("usbh_drv", nu_usbh_rh_thread_entry, RT_NULL,
NU_USBH_THREAD_STACK_SIZE, 8, 20);
Expand All @@ -772,7 +772,7 @@ static rt_err_t nu_hcd_init(rt_device_t device)
return RT_EOK;
}

/* global function for USB host library -----------------------------*/
/* global function for USB host library ----------------------------- */
uint32_t usbh_get_ticks(void)
{
return rt_tick_get();
Expand Down Expand Up @@ -880,7 +880,7 @@ int nu_usbh_register(void)
res = rt_device_register(&psUHCD->parent, "usbh", RT_DEVICE_FLAG_DEACTIVATE);
RT_ASSERT(res == RT_EOK);

/*initialize the usb host function */
/* initialize the usb host function */
res = rt_usb_host_init("usbh");
RT_ASSERT(res == RT_EOK);

Expand Down
2 changes: 1 addition & 1 deletion bsp/nuvoton/libraries/m460/rtt_port/drv_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ void nu_pin_set_function(rt_base_t pin, int data)
GPx_MFPx_org = *GPx_MFPx;
*GPx_MFPx = (GPx_MFPx_org & (~MFP_Msk)) | data;

/*rt_kprintf("Port[%d]-Pin[%d] Addr[%08x] Data[%08x] %08x -> %08x\n", port_index, pin_index, GPx_MFPx, data, GPx_MFPx_org, *GPx_MFPx);*/
/* rt_kprintf("Port[%d]-Pin[%d] Addr[%08x] Data[%08x] %08x -> %08x\n", port_index, pin_index, GPx_MFPx, data, GPx_MFPx_org, *GPx_MFPx); */
}

/**
Expand Down
2 changes: 1 addition & 1 deletion bsp/nuvoton/libraries/m480/rtt_port/drv_spi.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ void nu_spi_transfer(struct nu_spi *spi_bus, uint8_t *tx, uint8_t *rx, int lengt
rt_err_t nu_hw_spi_pdma_allocate(struct nu_spi *spi_bus);
#endif

#endif /* __DRV_SPI_H___*/
#endif /* __DRV_SPI_H___ */
Loading

0 comments on commit f1a4e7f

Please sign in to comment.