本文整理汇总了C++中DWC_WARN函数的典型用法代码示例。如果您正苦于以下问题:C++ DWC_WARN函数的具体用法?C++ DWC_WARN怎么用?C++ DWC_WARN使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DWC_WARN函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DWC_DEBUGPL
/**
* This function allocates an I/O buffer to be used for a transfer
* to/from the specified endpoint.
*
* @param usb_ep The endpoint to be used with with the request
* @param bytes The desired number of bytes for the buffer
* @param dma Pointer to the buffer's DMA address; must be valid
* @param gfp_flags the GFP_* flags to use.
* @return address of a new buffer or null is buffer could not be allocated.
*/
static void *dwc_otg_pcd_alloc_buffer(struct usb_ep *usb_ep, unsigned bytes,
dma_addr_t * dma, gfp_t gfp_flags)
{
void *buf;
dwc_otg_pcd_t *pcd = 0;
pcd = gadget_wrapper->pcd;
DWC_DEBUGPL(DBG_PCDV, "%s(%p,%d,%p,%0x)\n", __func__, usb_ep, bytes,
dma, gfp_flags);
/* Check dword alignment */
if ((bytes & 0x3UL) != 0) {
DWC_WARN("%s() Buffer size is not a multiple of"
"DWORD size (%d)", __func__, bytes);
}
buf = dma_alloc_coherent(NULL, bytes, dma, gfp_flags);
/* Check dword alignment */
if (((int)buf & 0x3UL) != 0) {
DWC_WARN("%s() Buffer is not DWORD aligned (%p)",
__func__, buf);
}
return buf;
}
示例2: container_of
/**
* This function allocates an I/O buffer to be used for a transfer
* to/from the specified endpoint.
*
* @param _ep The endpoint to be used with with the request
* @param _bytes The desired number of bytes for the buffer
* @param _dma Pointer to the buffer's DMA address; must be valid
* @param _gfp_flags the GFP_* flags to use.
* @return address of a new buffer or null is buffer could not be allocated.
*/
static void *dwc_otg_pcd_alloc_buffer(struct usb_ep *_ep, unsigned _bytes,
dma_addr_t *_dma, unsigned _gfp_flags)
{
void *buf;
dwc_otg_pcd_ep_t *ep;
dwc_otg_pcd_t *pcd = 0;
ep = container_of(_ep, dwc_otg_pcd_ep_t, ep);
pcd = ep->pcd;
DWC_DEBUGPL(DBG_PCDV,"%s(%p,%d,%p,%0x)\n", __func__, _ep, _bytes,
_dma, _gfp_flags);
/* Check dword alignment */
if ((_bytes & 0x3UL) != 0) {
DWC_WARN("%s() Buffer size is not a multiple of"
"DWORD size (%d)",__func__, _bytes);
}
if (GET_CORE_IF(pcd)->dma_enable) {
buf = dma_alloc_coherent (NULL, _bytes, _dma, _gfp_flags);
}
else {
buf = kmalloc( _bytes, _gfp_flags);
}
/* Check dword alignment */
if (((long)buf & 0x3UL) != 0) {
DWC_WARN("%s() Buffer is not DWORD aligned (%p)",
__func__, buf);
}
return buf;
}
示例3: ep_queue
/**
* This function is used to submit an I/O Request to an EP.
*
* - When the request completes the request's completion callback
* is called to return the request to the driver.
* - An EP, except control EPs, may have multiple requests
* pending.
* - Once submitted the request cannot be examined or modified.
* - Each request is turned into one or more packets.
* - A BULK EP can queue any amount of data; the transfer is
* packetized.
* - Zero length Packets are specified with the request 'zero'
* flag.
*/
static int ep_queue(struct usb_ep *usb_ep, struct usb_request *usb_req,
gfp_t gfp_flags)
{
dwc_otg_pcd_t *pcd;
int retval = 0;
//trace_printk("(%p,%p,%d)\n",
// usb_ep, usb_req, gfp_flags);
if (!usb_req || !usb_req->complete ||
(!gadget_wrapper->gadget.sg_supported &&
!usb_req->buf)) {
DWC_WARN("bad params\n");
return -EINVAL;
}
if (!usb_ep) {
DWC_WARN("bad ep\n");
return -EINVAL;
}
pcd = gadget_wrapper->pcd;
if (!gadget_wrapper->driver ||
gadget_wrapper->gadget.speed == USB_SPEED_UNKNOWN) {
DWC_DEBUGPL(DBG_PCDV, "gadget.speed=%d\n",
gadget_wrapper->gadget.speed);
DWC_WARN("bogus device state\n");
return -ESHUTDOWN;
}
//trace_printk( "%s queue req %p, len %d buf %p\n",
// usb_ep->name, usb_req, usb_req->length, usb_req->buf);
usb_req->status = -EINPROGRESS;
usb_req->actual = 0;
retval = dwc_otg_pcd_ep_queue(pcd, usb_ep, usb_req->buf, usb_req->dma/*dma_addr*/,
usb_req->length, usb_req->zero, usb_req->num_sgs,
usb_req->sg, usb_req, gfp_flags == GFP_ATOMIC ? 1 : 0);
if (retval) {
pr_err("%s, cannot enqueue a renquest, err :%d\n", __func__,
retval);
pr_info( "%s queue req %p, len %d buf %p\n",
usb_ep->name, usb_req, usb_req->length, usb_req->buf);
return -EINVAL;
}
return 0;
}
示例4: iso_ep_start
/**
* This function is used to submit an ISOC Transfer Request to an EP.
*
* - Every time a sync period completes the request's completion callback
* is called to provide data to the gadget driver.
* - Once submitted the request cannot be modified.
* - Each request is turned into periodic data packets untill ISO
* Transfer is stopped..
*/
static int iso_ep_start(struct usb_ep *usb_ep, struct usb_iso_request *req,
gfp_t gfp_flags)
{
int retval = 0;
if (!req || !req->process_buffer || !req->buf0 || !req->buf1) {
DWC_WARN("bad params\n");
return -EINVAL;
}
if (!usb_ep) {
DWC_PRINTF("bad params\n");
return -EINVAL;
}
req->status = -EINPROGRESS;
retval =
dwc_otg_pcd_iso_ep_start(gadget_wrapper->pcd, usb_ep, req->buf0,
req->buf1, req->dma0, req->dma1,
req->sync_frame, req->data_pattern_frame,
req->data_per_frame,
req->flags & USB_REQ_ISO_ASAP ? -1 : req->
start_frame, req->buf_proc_intrvl, req,
gfp_flags == GFP_ATOMIC ? 1 : 0);
if (retval) {
return -EINVAL;
}
return retval;
}
示例5: ep_dequeue
/**
* This function cancels an I/O request from an EP.
*/
static int ep_dequeue(struct usb_ep *usb_ep, struct usb_request *usb_req)
{
if (!usb_ep || !usb_req) {
DWC_WARN("bad argument\n");
return -EINVAL;
}
if (!gadget_wrapper->driver ||
gadget_wrapper->gadget.speed == USB_SPEED_UNKNOWN) {
DWC_WARN("bogus device state\n");
return -ESHUTDOWN;
}
if (dwc_otg_pcd_ep_dequeue(gadget_wrapper->pcd, usb_ep, usb_req)) {
return -EINVAL;
}
return 0;
}
示例6: ep_queue
/**
* This function is used to submit an I/O Request to an EP.
*
* - When the request completes the request's completion callback
* is called to return the request to the driver.
* - An EP, except control EPs, may have multiple requests
* pending.
* - Once submitted the request cannot be examined or modified.
* - Each request is turned into one or more packets.
* - A BULK EP can queue any amount of data; the transfer is
* packetized.
* - Zero length Packets are specified with the request 'zero'
* flag.
*/
static int ep_queue(struct usb_ep *usb_ep, struct usb_request *usb_req,
gfp_t gfp_flags)
{
dwc_otg_pcd_t *pcd;
int retval;
DWC_DEBUGPL(DBG_PCDV, "%s(%p,%p,%d)\n",
__func__, usb_ep, usb_req, gfp_flags);
if (!usb_req || !usb_req->complete || !usb_req->buf) {
DWC_WARN("bad params\n");
return -EINVAL;
}
if (!usb_ep) {
DWC_WARN("bad ep\n");
return -EINVAL;
}
pcd = gadget_wrapper->pcd;
if (!gadget_wrapper->driver ||
gadget_wrapper->gadget.speed == USB_SPEED_UNKNOWN) {
DWC_DEBUGPL(DBG_PCDV, "gadget.speed=%d\n",
gadget_wrapper->gadget.speed);
DWC_WARN("bogus device state\n");
return -ESHUTDOWN;
}
DWC_DEBUGPL(DBG_PCD, "%s queue req %p, len %d buf %p\n",
usb_ep->name, usb_req, usb_req->length, usb_req->buf);
usb_req->status = -EINPROGRESS;
usb_req->actual = 0;
retval = dwc_otg_pcd_ep_queue(pcd, usb_ep, usb_req->buf, usb_req->dma,
usb_req->length, usb_req->zero, usb_req,
gfp_flags == GFP_ATOMIC ? 1 : 0);
if (retval) {
return -EINVAL;
}
return 0;
}
示例7: DWC_DEBUGPL
/**
* This function allocates a request object to use with the specified
* endpoint.
*
* @param ep The endpoint to be used with with the request
* @param gfp_flags the GFP_* flags to use.
*/
static struct usb_request *dwc_otg_pcd_alloc_request(struct usb_ep *ep,
gfp_t gfp_flags)
{
struct usb_request *usb_req;
DWC_DEBUGPL(DBG_PCDV, "%s(%p,%d)\n", __func__, ep, gfp_flags);
if (0 == ep) {
DWC_WARN("%s() %s\n", __func__, "Invalid EP!\n");
return 0;
}
usb_req = kmalloc(sizeof(*usb_req), gfp_flags);
if (0 == usb_req) {
DWC_WARN("%s() %s\n", __func__, "request allocation failed!\n");
return 0;
}
memset(usb_req, 0, sizeof(*usb_req));
usb_req->dma = DWC_INVALID_DMA_ADDR;
return usb_req;
}
示例8: dwc_otg_handle_mode_mismatch_intr
/** This function will log a debug message
*
* @param core_if Programming view of DWC_otg controller.
*/
int32_t dwc_otg_handle_mode_mismatch_intr(dwc_otg_core_if_t * core_if)
{
gintsts_data_t gintsts;
DWC_WARN("Mode Mismatch Interrupt: currently in %s mode\n",
dwc_otg_mode(core_if) ? "Host" : "Device");
/* Clear interrupt */
gintsts.d32 = 0;
gintsts.b.modemismatch = 1;
DWC_WRITE_REG32(&core_if->core_global_regs->gintsts, gintsts.d32);
return 1;
}
示例9: iso_ep_stop
/**
* This function stops ISO EP Periodic Data Transfer.
*/
static int iso_ep_stop(struct usb_ep *usb_ep, struct usb_iso_request *req)
{
int retval = 0;
if (!usb_ep) {
DWC_WARN("bad ep\n");
}
if (!gadget_wrapper->driver ||
gadget_wrapper->gadget.speed == USB_SPEED_UNKNOWN) {
DWC_DEBUGPL(DBG_PCDV, "gadget.speed=%d\n",
gadget_wrapper->gadget.speed);
DWC_WARN("bogus device state\n");
}
dwc_otg_pcd_iso_ep_stop(gadget_wrapper->pcd, usb_ep, req);
if (retval) {
retval = -EINVAL;
}
return retval;
}
示例10: dwc_otg_pcd_free_request
/**
* This function frees a request object.
*
* @param ep The endpoint associated with the request
* @param req The request being freed
*/
static void dwc_otg_pcd_free_request(struct usb_ep *ep, struct usb_request *req)
{
DWC_DEBUGPL(DBG_PCDV, "%s(%p,%p)\n", __func__, ep, req);
if (0 == ep || 0 == req) {
DWC_WARN("%s() %s\n", __func__,
"Invalid ep or req argument!\n");
return;
}
kfree(req);
}
示例11: ep_enable
/**
* This function is called by the Gadget Driver for each EP to be
* configured for the current configuration (SET_CONFIGURATION).
*
* This function initializes the dwc_otg_ep_t data structure, and then
* calls dwc_otg_ep_activate.
*/
static int ep_enable(struct usb_ep *usb_ep,
const struct usb_endpoint_descriptor *ep_desc)
{
int retval;
DWC_DEBUGPL(DBG_PCDV, "%s(%p,%p)\n", __func__, usb_ep, ep_desc);
if (!usb_ep || !ep_desc || ep_desc->bDescriptorType != USB_DT_ENDPOINT) {
DWC_WARN("%s, bad ep or descriptor\n", __func__);
return -EINVAL;
}
if (usb_ep == &gadget_wrapper->ep0) {
DWC_WARN("%s, bad ep(0)\n", __func__);
return -EINVAL;
}
/* Check FIFO size? */
if (!ep_desc->wMaxPacketSize) {
DWC_WARN("%s, bad %s maxpacket\n", __func__, usb_ep->name);
return -ERANGE;
}
if (!gadget_wrapper->driver ||
gadget_wrapper->gadget.speed == USB_SPEED_UNKNOWN) {
DWC_WARN("%s, bogus device state\n", __func__);
return -ESHUTDOWN;
}
retval = dwc_otg_pcd_ep_enable(gadget_wrapper->pcd,
(const uint8_t *)ep_desc,
(void *)usb_ep);
if (retval) {
DWC_WARN("dwc_otg_pcd_ep_enable failed\n");
return -EINVAL;
}
usb_ep->maxpacket = le16_to_cpu(ep_desc->wMaxPacketSize);
return 0;
}
示例12: ep_halt
/**
* usb_ep_set_halt stalls an endpoint.
*
* usb_ep_clear_halt clears an endpoint halt and resets its data
* toggle.
*
* Both of these functions are implemented with the same underlying
* function. The behavior depends on the value argument.
*
* @param[in] usb_ep the Endpoint to halt or clear halt.
* @param[in] value
* - 0 means clear_halt.
* - 1 means set_halt,
* - 2 means clear stall lock flag.
* - 3 means set stall lock flag.
*/
static int ep_halt(struct usb_ep *usb_ep, int value)
{
int retval = 0;
DWC_DEBUGPL(DBG_PCD, "HALT %s %d\n", usb_ep->name, value);
if (!usb_ep) {
DWC_WARN("bad ep\n");
return -EINVAL;
}
retval = dwc_otg_pcd_ep_halt(gadget_wrapper->pcd, usb_ep, value);
if (retval == -DWC_E_AGAIN) {
return -EAGAIN;
} else if (retval) {
retval = -EINVAL;
}
return retval;
}
示例13: ep_wedge
/**
* ep_wedge: sets the halt feature and ignores clear requests
*
* @usb_ep: the endpoint being wedged
*
* Use this to stall an endpoint and ignore CLEAR_FEATURE(HALT_ENDPOINT)
* requests. If the gadget driver clears the halt status, it will
* automatically unwedge the endpoint.
*
* Returns zero on success, else negative errno. *
* Check usb_ep_set_wedge() at "usb_gadget.h" for details
*/
static int ep_wedge(struct usb_ep *usb_ep)
{
int retval = 0;
DWC_DEBUGPL(DBG_PCD, "WEDGE %s\n", usb_ep->name);
if (!usb_ep) {
DWC_WARN("bad ep\n");
return -EINVAL;
}
retval = dwc_otg_pcd_ep_wedge(gadget_wrapper->pcd, usb_ep);
if (retval == -DWC_E_AGAIN) {
retval = -EAGAIN;
} else if (retval) {
retval = -EINVAL;
}
return retval;
}
示例14: sizeof
static struct usb_iso_request *alloc_iso_request(struct usb_ep *ep,
int packets, gfp_t gfp_flags)
{
struct usb_iso_request *pReq = NULL;
uint32_t req_size;
req_size = sizeof(struct usb_iso_request);
req_size +=
(2 * packets * (sizeof(struct usb_gadget_iso_packet_descriptor)));
pReq = kmalloc(req_size, gfp_flags);
if (!pReq) {
DWC_WARN("Can't allocate Iso Request\n");
return 0;
}
pReq->iso_packet_desc0 = (void *)(pReq + 1);
pReq->iso_packet_desc1 = pReq->iso_packet_desc0 + packets;
return pReq;
}
示例15: dwc_otg_pcd_ep_enable
/**
* This function is called by the Gadget Driver for each EP to be
* configured for the current configuration (SET_CONFIGURATION).
*
* This function initializes the dwc_otg_ep_t data structure, and then
* calls dwc_otg_ep_activate.
*/
static int dwc_otg_pcd_ep_enable(struct usb_ep *_ep,
const struct usb_endpoint_descriptor *_desc)
{
dwc_otg_pcd_ep_t *ep = 0;
dwc_otg_pcd_t *pcd = 0;
unsigned long flags;
DWC_DEBUGPL(DBG_PCDV,"%s(%p,%p)\n", __func__, _ep, _desc );
ep = container_of(_ep, dwc_otg_pcd_ep_t, ep);
if (!_ep || !_desc || ep->desc ||
_desc->bDescriptorType != USB_DT_ENDPOINT) {
DWC_WARN( "%s, bad ep or descriptor\n", __func__);
return -EINVAL;
}
if (ep == &ep->pcd->ep[0]){
DWC_WARN("%s, bad ep(0)\n", __func__);
return -EINVAL;
}
/* Check FIFO size? */
if (!_desc->wMaxPacketSize) {
DWC_WARN("%s, bad %s maxpacket\n", __func__, _ep->name);
return -ERANGE;
}
pcd = ep->pcd;
if (!pcd->driver || pcd->gadget.speed == USB_SPEED_UNKNOWN) {
DWC_WARN("%s, bogus device state\n", __func__);
return -ESHUTDOWN;
}
spin_lock_irqsave(&pcd->lock, flags);
ep->desc = _desc;
ep->ep.maxpacket = le16_to_cpu (_desc->wMaxPacketSize);
/*
* Activate the EP
*/
ep->stopped = 0;
ep->dwc_ep.is_in = (USB_DIR_IN & _desc->bEndpointAddress) != 0;
ep->dwc_ep.maxpacket = ep->ep.maxpacket;
ep->dwc_ep.tx_fifo_num = 0;
ep->dwc_ep.type = _desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK;
if ((_desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
USB_ENDPOINT_XFER_ISOC ) {
/*
* if ISOC EP then assign a Periodic Tx FIFO.
*/
/** @todo NGS Determine Tx FIFO for periodic EP.
* Currently using 1.
*/
ep->dwc_ep.tx_fifo_num = 1;
}
/* Set initial data PID. */
if ((_desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
USB_ENDPOINT_XFER_BULK ) {
ep->dwc_ep.data_pid_start = 0;
}
DWC_DEBUGPL(DBG_PCD, "Activate %s-%s: type=%d, mps=%d desc=%p\n",
ep->ep.name, (ep->dwc_ep.is_in ?"IN":"OUT"),
ep->dwc_ep.type, ep->dwc_ep.maxpacket, ep->desc );
dwc_otg_ep_activate( GET_CORE_IF(pcd), &ep->dwc_ep );
spin_unlock_irqrestore(&pcd->lock, flags);
return 0;
}