aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Cross <david.cross@cypress.com>2010-09-23 17:24:45 -0700
committerGreg Kroah-Hartman <gregkh@suse.de>2010-09-29 18:28:26 -0700
commit0769c38d26bdb2941385c32ff66a25beeb987f75 (patch)
tree9bf7d7801a2df098dc3b1aadfe562ce8fc5bb776
parent9ebed608bde8e27a1993f1b12eff16e04c8c419e (diff)
Staging: west bridge, removal of " " before ";"
This patch fixes removes all of the the " ;"'s in the west bridge driver and instead replaces them with ";" only. Although this is a large patch, this is the only thing that it does. I can break it up on a file basis if needed. Signed-off-by: David Cross <david.cross@cypress.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/staging/westbridge/astoria/api/src/cyasdma.c556
-rw-r--r--drivers/staging/westbridge/astoria/api/src/cyasintr.c74
-rw-r--r--drivers/staging/westbridge/astoria/api/src/cyaslep2pep.c158
-rw-r--r--drivers/staging/westbridge/astoria/api/src/cyaslowlevel.c818
-rw-r--r--drivers/staging/westbridge/astoria/api/src/cyasmisc.c2258
-rw-r--r--drivers/staging/westbridge/astoria/api/src/cyasmtp.c742
-rw-r--r--drivers/staging/westbridge/astoria/api/src/cyasstorage.c2300
-rw-r--r--drivers/staging/westbridge/astoria/api/src/cyasusb.c2592
-rw-r--r--drivers/staging/westbridge/astoria/arch/arm/mach-omap2/cyashalomap_kernel.c250
-rw-r--r--drivers/staging/westbridge/astoria/arch/arm/plat-omap/include/mach/westbridge/cyashaldef.h2
-rw-r--r--drivers/staging/westbridge/astoria/arch/arm/plat-omap/include/mach/westbridge/westbridge-omap3-pnand-hal/cyashalomap_kernel.h54
-rw-r--r--drivers/staging/westbridge/astoria/arch/arm/plat-omap/include/mach/westbridge/westbridge-omap3-pnand-hal/cyasomapdev_kernel.h2
-rw-r--r--drivers/staging/westbridge/astoria/block/cyasblkdev_block.c162
-rw-r--r--drivers/staging/westbridge/astoria/block/cyasblkdev_queue.c6
-rw-r--r--drivers/staging/westbridge/astoria/block/cyasblkdev_queue.h2
-rw-r--r--drivers/staging/westbridge/astoria/device/cyandevice_export.h144
-rw-r--r--drivers/staging/westbridge/astoria/device/cyasdevice.c128
-rw-r--r--drivers/staging/westbridge/astoria/gadget/cyasgadget.h16
-rw-r--r--drivers/staging/westbridge/astoria/gadget/cyasgadget_ioctl.h20
-rw-r--r--drivers/staging/westbridge/astoria/include/linux/westbridge/cyanmisc.h76
-rw-r--r--drivers/staging/westbridge/astoria/include/linux/westbridge/cyanstorage.h56
-rw-r--r--drivers/staging/westbridge/astoria/include/linux/westbridge/cyantypes.h6
-rw-r--r--drivers/staging/westbridge/astoria/include/linux/westbridge/cyanusb.h110
-rw-r--r--drivers/staging/westbridge/astoria/include/linux/westbridge/cyasdevice.h344
-rw-r--r--drivers/staging/westbridge/astoria/include/linux/westbridge/cyasdma.h20
-rw-r--r--drivers/staging/westbridge/astoria/include/linux/westbridge/cyashalcb.h2
-rw-r--r--drivers/staging/westbridge/astoria/include/linux/westbridge/cyashaldoc.h60
-rw-r--r--drivers/staging/westbridge/astoria/include/linux/westbridge/cyasintr.h6
-rw-r--r--drivers/staging/westbridge/astoria/include/linux/westbridge/cyaslep2pep.h6
-rw-r--r--drivers/staging/westbridge/astoria/include/linux/westbridge/cyaslowlevel.h38
-rw-r--r--drivers/staging/westbridge/astoria/include/linux/westbridge/cyasmedia.h2
-rw-r--r--drivers/staging/westbridge/astoria/include/linux/westbridge/cyasmisc.h90
-rw-r--r--drivers/staging/westbridge/astoria/include/linux/westbridge/cyasmtp.h40
-rw-r--r--drivers/staging/westbridge/astoria/include/linux/westbridge/cyasstorage.h98
-rw-r--r--drivers/staging/westbridge/astoria/include/linux/westbridge/cyasstorage_dep.h50
-rw-r--r--drivers/staging/westbridge/astoria/include/linux/westbridge/cyastypes.h6
-rw-r--r--drivers/staging/westbridge/astoria/include/linux/westbridge/cyasusb.h144
-rw-r--r--drivers/staging/westbridge/astoria/include/linux/westbridge/cyasusb_dep.h68
38 files changed, 5753 insertions, 5753 deletions
diff --git a/drivers/staging/westbridge/astoria/api/src/cyasdma.c b/drivers/staging/westbridge/astoria/api/src/cyasdma.c
index 152591d93ec..de67e131050 100644
--- a/drivers/staging/westbridge/astoria/api/src/cyasdma.c
+++ b/drivers/staging/westbridge/astoria/api/src/cyasdma.c
@@ -32,13 +32,13 @@ static void
cy_as_dma_add_request_to_free_queue(cy_as_device *dev_p,
cy_as_dma_queue_entry *req_p)
{
- uint32_t imask ;
- imask = cy_as_hal_disable_interrupts() ;
+ uint32_t imask;
+ imask = cy_as_hal_disable_interrupts();
- req_p->next_p = dev_p->dma_freelist_p ;
- dev_p->dma_freelist_p = req_p ;
+ req_p->next_p = dev_p->dma_freelist_p;
+ dev_p->dma_freelist_p = req_p;
- cy_as_hal_enable_interrupts(imask) ;
+ cy_as_hal_enable_interrupts(imask);
}
/*
@@ -47,17 +47,17 @@ cy_as_dma_add_request_to_free_queue(cy_as_device *dev_p,
static cy_as_dma_queue_entry *
cy_as_dma_get_dma_queue_entry(cy_as_device *dev_p)
{
- cy_as_dma_queue_entry *req_p ;
- uint32_t imask ;
+ cy_as_dma_queue_entry *req_p;
+ uint32_t imask;
- cy_as_hal_assert(dev_p->dma_freelist_p != 0) ;
+ cy_as_hal_assert(dev_p->dma_freelist_p != 0);
- imask = cy_as_hal_disable_interrupts() ;
- req_p = dev_p->dma_freelist_p ;
- dev_p->dma_freelist_p = req_p->next_p ;
- cy_as_hal_enable_interrupts(imask) ;
+ imask = cy_as_hal_disable_interrupts();
+ req_p = dev_p->dma_freelist_p;
+ dev_p->dma_freelist_p = req_p->next_p;
+ cy_as_hal_enable_interrupts(imask);
- return req_p ;
+ return req_p;
}
/*
@@ -74,11 +74,11 @@ cy_as_dma_set_max_dma_size(cy_as_device *dev_p,
/* In MTP mode, EP2 is allowed to have all max sizes. */
if ((!dev_p->is_mtp_firmware) || (ep != 0x02)) {
if (size < 64 || size > 1024)
- return CY_AS_ERROR_INVALID_SIZE ;
+ return CY_AS_ERROR_INVALID_SIZE;
}
- CY_AS_NUM_EP(dev_p, ep)->maxhwdata = (uint16_t)size ;
- return CY_AS_ERROR_SUCCESS ;
+ CY_AS_NUM_EP(dev_p, ep)->maxhwdata = (uint16_t)size;
+ return CY_AS_ERROR_SUCCESS;
}
/*
@@ -96,13 +96,13 @@ cy_as_dma_request_callback(
cy_as_ll_request_response *resp_p,
cy_as_return_status_t ret)
{
- uint16_t v ;
- uint16_t datacnt ;
- cy_as_end_point_number_t ep ;
+ uint16_t v;
+ uint16_t datacnt;
+ cy_as_end_point_number_t ep;
- (void)context ;
+ (void)context;
- cy_as_log_debug_message(5, "cy_as_dma_request_callback called") ;
+ cy_as_log_debug_message(5, "cy_as_dma_request_callback called");
/*
* extract the return code from the firmware
@@ -110,17 +110,17 @@ cy_as_dma_request_callback(
if (ret == CY_AS_ERROR_SUCCESS) {
if (cy_as_ll_request_response__get_code(resp_p) !=
CY_RESP_SUCCESS_FAILURE)
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
else
- ret = cy_as_ll_request_response__get_word(resp_p, 0) ;
+ ret = cy_as_ll_request_response__get_word(resp_p, 0);
}
/*
* extract the endpoint number and the transferred byte count
* from the request.
*/
- v = cy_as_ll_request_response__get_word(req_p, 0) ;
- ep = (cy_as_end_point_number_t)((v >> 13) & 0x01) ;
+ v = cy_as_ll_request_response__get_word(req_p, 0);
+ ep = (cy_as_end_point_number_t)((v >> 13) & 0x01);
if (ret == CY_AS_ERROR_SUCCESS) {
/*
@@ -129,12 +129,12 @@ cy_as_dma_request_callback(
* transferred. there are no partial
* transfers.
*/
- datacnt = v & 0x3FF ;
+ datacnt = v & 0x3FF;
} else {
/*
* if the firmware returned an error, no data was transferred.
*/
- datacnt = 0 ;
+ datacnt = 0;
}
/*
@@ -142,11 +142,11 @@ cy_as_dma_request_callback(
* next EP0 or EP1 request.
*/
if (ep == 0) {
- dev_p->usb_ep0_dma_req = req_p ;
- dev_p->usb_ep0_dma_resp = resp_p ;
+ dev_p->usb_ep0_dma_req = req_p;
+ dev_p->usb_ep0_dma_resp = resp_p;
} else {
- dev_p->usb_ep1_dma_req = req_p ;
- dev_p->usb_ep1_dma_resp = resp_p ;
+ dev_p->usb_ep1_dma_req = req_p;
+ dev_p->usb_ep1_dma_resp = resp_p;
}
/*
@@ -159,7 +159,7 @@ cy_as_dma_request_callback(
* function.
*/
if (ret != CY_AS_ERROR_CANCELED)
- cy_as_dma_completed_callback(dev_p->tag, ep, datacnt, ret) ;
+ cy_as_dma_completed_callback(dev_p->tag, ep, datacnt, ret);
}
/*
@@ -171,35 +171,35 @@ static void
cy_as_dma_set_drq(cy_as_device *dev_p,
cy_as_end_point_number_t ep, cy_bool state)
{
- uint16_t mask ;
- uint16_t v ;
- uint32_t intval ;
+ uint16_t mask;
+ uint16_t v;
+ uint32_t intval;
/*
* there are not DRQ register bits for EP0 and EP1
*/
if (ep == 0 || ep == 1)
- return ;
+ return;
/*
* disable interrupts while we do this to be sure the state of the
* DRQ mask register is always well defined.
*/
- intval = cy_as_hal_disable_interrupts() ;
+ intval = cy_as_hal_disable_interrupts();
/*
* set the DRQ bit to the given state for the ep given
*/
- mask = (1 << ep) ;
- v = cy_as_hal_read_register(dev_p->tag, CY_AS_MEM_P0_DRQ_MASK) ;
+ mask = (1 << ep);
+ v = cy_as_hal_read_register(dev_p->tag, CY_AS_MEM_P0_DRQ_MASK);
if (state)
- v |= mask ;
+ v |= mask;
else
- v &= ~mask ;
+ v &= ~mask;
- cy_as_hal_write_register(dev_p->tag, CY_AS_MEM_P0_DRQ_MASK, v) ;
- cy_as_hal_enable_interrupts(intval) ;
+ cy_as_hal_write_register(dev_p->tag, CY_AS_MEM_P0_DRQ_MASK, v);
+ cy_as_hal_enable_interrupts(intval);
}
/*
@@ -208,14 +208,14 @@ cy_as_dma_set_drq(cy_as_device *dev_p,
static void
cy_as_dma_send_next_dma_request(cy_as_device *dev_p, cy_as_dma_end_point *ep_p)
{
- uint32_t datacnt ;
- void *buf_p ;
- cy_as_dma_queue_entry *dma_p ;
+ uint32_t datacnt;
+ void *buf_p;
+ cy_as_dma_queue_entry *dma_p;
- cy_as_log_debug_message(6, "cy_as_dma_send_next_dma_request called") ;
+ cy_as_log_debug_message(6, "cy_as_dma_send_next_dma_request called");
/* If the queue is empty, nothing to do */
- dma_p = ep_p->queue_p ;
+ dma_p = ep_p->queue_p;
if (dma_p == 0) {
/*
* there are no pending DMA requests
@@ -224,18 +224,18 @@ cy_as_dma_send_next_dma_request(cy_as_device *dev_p, cy_as_dma_end_point *ep_p)
* will be triggered by this endpoint
* until someone is interested in the data.
*/
- cy_as_dma_set_drq(dev_p, ep_p->ep, cy_false) ;
- return ;
+ cy_as_dma_set_drq(dev_p, ep_p->ep, cy_false);
+ return;
}
- cy_as_dma_end_point_set_running(ep_p) ;
+ cy_as_dma_end_point_set_running(ep_p);
/*
* get the number of words that still
* need to be xferred in this request.
*/
- datacnt = dma_p->size - dma_p->offset ;
- cy_as_hal_assert(datacnt >= 0) ;
+ datacnt = dma_p->size - dma_p->offset;
+ cy_as_hal_assert(datacnt >= 0);
/*
* the HAL layer should never limit the size
@@ -244,7 +244,7 @@ cy_as_dma_send_next_dma_request(cy_as_device *dev_p, cy_as_dma_end_point *ep_p)
* in packets that are not correct in size.
*/
cy_as_hal_assert(ep_p->maxhaldata == CY_AS_DMA_MAX_SIZE_HW_SIZE
- || ep_p->maxhaldata >= ep_p->maxhwdata) ;
+ || ep_p->maxhaldata >= ep_p->maxhwdata);
/*
* update the number of words that need to be xferred yet
@@ -252,10 +252,10 @@ cy_as_dma_send_next_dma_request(cy_as_device *dev_p, cy_as_dma_end_point *ep_p)
*/
if (ep_p->maxhaldata == CY_AS_DMA_MAX_SIZE_HW_SIZE) {
if (datacnt > ep_p->maxhwdata)
- datacnt = ep_p->maxhwdata ;
+ datacnt = ep_p->maxhwdata;
} else {
if (datacnt > ep_p->maxhaldata)
- datacnt = ep_p->maxhaldata ;
+ datacnt = ep_p->maxhaldata;
}
/*
@@ -266,7 +266,7 @@ cy_as_dma_send_next_dma_request(cy_as_device *dev_p, cy_as_dma_end_point *ep_p)
/*
* mark a request in transit
*/
- cy_as_dma_end_point_set_in_transit(ep_p) ;
+ cy_as_dma_end_point_set_in_transit(ep_p);
if (ep_p->ep == 0 || ep_p->ep == 1) {
/*
@@ -280,62 +280,62 @@ cy_as_dma_send_next_dma_request(cy_as_device *dev_p, cy_as_dma_end_point *ep_p)
* the data back into the DMA module.
*/
if (dma_p->readreq == cy_false) {
- uint16_t v ;
- uint16_t len ;
- cy_as_ll_request_response *resp_p ;
- cy_as_ll_request_response *req_p ;
- cy_as_return_status_t ret ;
+ uint16_t v;
+ uint16_t len;
+ cy_as_ll_request_response *resp_p;
+ cy_as_ll_request_response *req_p;
+ cy_as_return_status_t ret;
- len = (uint16_t)(datacnt / 2) ;
+ len = (uint16_t)(datacnt / 2);
if (datacnt % 2)
- len++ ;
+ len++;
- len++ ;
+ len++;
if (ep_p->ep == 0) {
- req_p = dev_p->usb_ep0_dma_req ;
- resp_p = dev_p->usb_ep0_dma_resp ;
- dev_p->usb_ep0_dma_req = 0 ;
- dev_p->usb_ep0_dma_resp = 0 ;
+ req_p = dev_p->usb_ep0_dma_req;
+ resp_p = dev_p->usb_ep0_dma_resp;
+ dev_p->usb_ep0_dma_req = 0;
+ dev_p->usb_ep0_dma_resp = 0;
} else {
- req_p = dev_p->usb_ep1_dma_req ;
- resp_p = dev_p->usb_ep1_dma_resp ;
- dev_p->usb_ep1_dma_req = 0 ;
- dev_p->usb_ep1_dma_resp = 0 ;
+ req_p = dev_p->usb_ep1_dma_req;
+ resp_p = dev_p->usb_ep1_dma_resp;
+ dev_p->usb_ep1_dma_req = 0;
+ dev_p->usb_ep1_dma_resp = 0;
}
- cy_as_hal_assert(req_p != 0) ;
- cy_as_hal_assert(resp_p != 0) ;
- cy_as_hal_assert(len <= 64) ;
+ cy_as_hal_assert(req_p != 0);
+ cy_as_hal_assert(resp_p != 0);
+ cy_as_hal_assert(len <= 64);
cy_as_ll_init_request(req_p, CY_RQT_USB_EP_DATA,
- CY_RQT_USB_RQT_CONTEXT, len) ;
+ CY_RQT_USB_RQT_CONTEXT, len);
- v = (uint16_t)(datacnt | (ep_p->ep << 13) | (1 << 14)) ;
+ v = (uint16_t)(datacnt | (ep_p->ep << 13) | (1 << 14));
if (dma_p->offset == 0)
- v |= (1 << 12) ;/* Set the first packet bit */
+ v |= (1 << 12);/* Set the first packet bit */
if (dma_p->offset + datacnt == dma_p->size)
- v |= (1 << 11) ;/* Set the last packet bit */
+ v |= (1 << 11);/* Set the last packet bit */
- cy_as_ll_request_response__set_word(req_p, 0, v) ;
+ cy_as_ll_request_response__set_word(req_p, 0, v);
cy_as_ll_request_response__pack(req_p,
- 1, datacnt, buf_p) ;
+ 1, datacnt, buf_p);
- cy_as_ll_init_response(resp_p, 1) ;
+ cy_as_ll_init_response(resp_p, 1);
ret = cy_as_ll_send_request(dev_p, req_p, resp_p,
- cy_false, cy_as_dma_request_callback) ;
+ cy_false, cy_as_dma_request_callback);
if (ret == CY_AS_ERROR_SUCCESS)
cy_as_log_debug_message(5,
- "+++ send EP 0/1 data via mailbox registers") ;
+ "+++ send EP 0/1 data via mailbox registers");
else
cy_as_log_debug_message(5,
"+++ error sending EP 0/1 data via mailbox "
- "registers - CY_AS_ERROR_TIMEOUT") ;
+ "registers - CY_AS_ERROR_TIMEOUT");
if (ret != CY_AS_ERROR_SUCCESS)
cy_as_dma_completed_callback(dev_p->tag,
- ep_p->ep, 0, ret) ;
+ ep_p->ep, 0, ret);
}
} else {
/*
@@ -353,16 +353,16 @@ cy_as_dma_send_next_dma_request(cy_as_device *dev_p, cy_as_dma_end_point *ep_p)
*/
if (cy_as_dma_end_point_is_direction_in(ep_p))
cy_as_hal_dma_setup_write(dev_p->tag,
- ep_p->ep, buf_p, datacnt, ep_p->maxhwdata) ;
+ ep_p->ep, buf_p, datacnt, ep_p->maxhwdata);
else
cy_as_hal_dma_setup_read(dev_p->tag,
- ep_p->ep, buf_p, datacnt, ep_p->maxhwdata) ;
+ ep_p->ep, buf_p, datacnt, ep_p->maxhwdata);
/*
* the DRQ interrupt for this endpoint should be enabled
* so that the data transfer progresses at interrupt time.
*/
- cy_as_dma_set_drq(dev_p, ep_p->ep, cy_true) ;
+ cy_as_dma_set_drq(dev_p, ep_p->ep, cy_true);
}
}
@@ -377,27 +377,27 @@ void
cy_as_dma_completed_callback(cy_as_hal_device_tag tag,
cy_as_end_point_number_t ep, uint32_t cnt, cy_as_return_status_t status)
{
- uint32_t mask ;
- cy_as_dma_queue_entry *req_p ;
- cy_as_dma_end_point *ep_p ;
- cy_as_device *dev_p = cy_as_device_find_from_tag(tag) ;
+ uint32_t mask;
+ cy_as_dma_queue_entry *req_p;
+ cy_as_dma_end_point *ep_p;
+ cy_as_device *dev_p = cy_as_device_find_from_tag(tag);
/* Make sure the HAL layer gave us good parameters */
- cy_as_hal_assert(dev_p != 0) ;
- cy_as_hal_assert(dev_p->sig == CY_AS_DEVICE_HANDLE_SIGNATURE) ;
- cy_as_hal_assert(ep < 16) ;
+ cy_as_hal_assert(dev_p != 0);
+ cy_as_hal_assert(dev_p->sig == CY_AS_DEVICE_HANDLE_SIGNATURE);
+ cy_as_hal_assert(ep < 16);
/* Get the endpoint ptr */
- ep_p = CY_AS_NUM_EP(dev_p, ep) ;
- cy_as_hal_assert(ep_p->queue_p != 0) ;
+ ep_p = CY_AS_NUM_EP(dev_p, ep);
+ cy_as_hal_assert(ep_p->queue_p != 0);
/* Get a pointer to the current entry in the queue */
- mask = cy_as_hal_disable_interrupts() ;
- req_p = ep_p->queue_p ;
+ mask = cy_as_hal_disable_interrupts();
+ req_p = ep_p->queue_p;
/* Update the offset to reflect the data actually received or sent */
- req_p->offset += cnt ;
+ req_p->offset += cnt;
/*
* if we are still sending/receiving the current packet,
@@ -422,7 +422,7 @@ cy_as_dma_completed_callback(cy_as_hal_device_tag tag,
((ep != CY_AS_MTP_READ_ENDPOINT) ||
(cnt == dev_p->usb_max_tx_size)))))
|| ((ep == 1) && (status == CY_AS_ERROR_TIMEOUT))) {
- cy_as_hal_enable_interrupts(mask) ;
+ cy_as_hal_enable_interrupts(mask);
/*
* and send the request again to send the next block of
@@ -433,9 +433,9 @@ cy_as_dma_completed_callback(cy_as_hal_device_tag tag,
if ((ep == CY_AS_MTP_WRITE_ENDPOINT) || (
(ep == CY_AS_MTP_READ_ENDPOINT) &&
(!cy_as_dma_end_point_is_direction_in(ep_p))))
- cy_as_dma_end_point_set_stopped(ep_p) ;
+ cy_as_dma_end_point_set_stopped(ep_p);
else
- cy_as_dma_send_next_dma_request(dev_p, ep_p) ;
+ cy_as_dma_send_next_dma_request(dev_p, ep_p);
} else {
/*
* we get here if ...
@@ -449,18 +449,18 @@ cy_as_dma_completed_callback(cy_as_hal_device_tag tag,
/*
* remove this entry from the DMA queue for this endpoint.
*/
- cy_as_dma_end_point_clear_in_transit(ep_p) ;
- ep_p->queue_p = req_p->next_p ;
+ cy_as_dma_end_point_clear_in_transit(ep_p);
+ ep_p->queue_p = req_p->next_p;
if (ep_p->last_p == req_p) {
/*
* we have removed the last packet from the DMA queue,
* disable the interrupt associated with this interrupt.
*/
- ep_p->last_p = 0 ;
- cy_as_hal_enable_interrupts(mask) ;
- cy_as_dma_set_drq(dev_p, ep, cy_false) ;
+ ep_p->last_p = 0;
+ cy_as_hal_enable_interrupts(mask);
+ cy_as_dma_set_drq(dev_p, ep, cy_false);
} else
- cy_as_hal_enable_interrupts(mask) ;
+ cy_as_hal_enable_interrupts(mask);
if (req_p->cb) {
/*
@@ -472,32 +472,32 @@ cy_as_dma_completed_callback(cy_as_hal_device_tag tag,
* cannot recursively call an API function that is
* synchronous only from a callback.
*/
- cy_as_device_set_in_callback(dev_p) ;
+ cy_as_device_set_in_callback(dev_p);
(*req_p->cb)(dev_p, ep, req_p->buf_p,
- req_p->offset, status) ;
- cy_as_device_clear_in_callback(dev_p) ;
+ req_p->offset, status);
+ cy_as_device_clear_in_callback(dev_p);
}
/*
* we are done with this request, put it on the freelist to be
* reused at a later time.
*/
- cy_as_dma_add_request_to_free_queue(dev_p, req_p) ;
+ cy_as_dma_add_request_to_free_queue(dev_p, req_p);
if (ep_p->queue_p == 0) {
/*
* if the endpoint is out of DMA entries, set the
* endpoint as stopped.
*/
- cy_as_dma_end_point_set_stopped(ep_p) ;
+ cy_as_dma_end_point_set_stopped(ep_p);
/*
* the DMA queue is empty, wake any task waiting on
* the QUEUE to drain.
*/
if (cy_as_dma_end_point_is_sleeping(ep_p)) {
- cy_as_dma_end_point_set_wake_state(ep_p) ;
- cy_as_hal_wake(&ep_p->channel) ;
+ cy_as_dma_end_point_set_wake_state(ep_p);
+ cy_as_hal_wake(&ep_p->channel);
}
} else {
/*
@@ -512,9 +512,9 @@ cy_as_dma_completed_callback(cy_as_hal_device_tag tag,
(!cy_as_device_is_p2s_dma_start_recvd(dev_p)))
|| ((ep == dev_p->storage_write_endpoint) &&
(!cy_as_device_is_p2s_dma_start_recvd(dev_p))))
- cy_as_dma_end_point_set_stopped(ep_p) ;
+ cy_as_dma_end_point_set_stopped(ep_p);
else
- cy_as_dma_send_next_dma_request(dev_p, ep_p) ;
+ cy_as_dma_send_next_dma_request(dev_p, ep_p);
}
}
}
@@ -529,17 +529,17 @@ cy_as_dma_completed_callback(cy_as_hal_device_tag tag,
cy_as_return_status_t
cy_as_dma_kick_start(cy_as_device *dev_p, cy_as_end_point_number_t ep)
{
- cy_as_dma_end_point *ep_p ;
- cy_as_hal_assert(dev_p->sig == CY_AS_DEVICE_HANDLE_SIGNATURE) ;
+ cy_as_dma_end_point *ep_p;
+ cy_as_hal_assert(dev_p->sig == CY_AS_DEVICE_HANDLE_SIGNATURE);
- ep_p = CY_AS_NUM_EP(dev_p, ep) ;
+ ep_p = CY_AS_NUM_EP(dev_p, ep);
/* We are already running */
if (cy_as_dma_end_point_is_running(ep_p))
- return CY_AS_ERROR_SUCCESS ;
+ return CY_AS_ERROR_SUCCESS;
cy_as_dma_send_next_dma_request(dev_p, ep_p);
- return CY_AS_ERROR_SUCCESS ;
+ return CY_AS_ERROR_SUCCESS;
}
/*
@@ -550,37 +550,37 @@ cy_as_dma_kick_start(cy_as_device *dev_p, cy_as_end_point_number_t ep)
static cy_as_return_status_t
cy_as_dma_stop_end_point(cy_as_device *dev_p, cy_as_end_point_number_t ep)
{
- cy_as_return_status_t ret ;
- cy_as_dma_end_point *ep_p = CY_AS_NUM_EP(dev_p, ep) ;
+ cy_as_return_status_t ret;
+ cy_as_dma_end_point *ep_p = CY_AS_NUM_EP(dev_p, ep);
/*
* cancel any pending DMA requests associated with this endpoint. this
* cancels any DMA requests at the HAL layer as well as dequeues any
* request that is currently pending.
*/
- ret = cy_as_dma_cancel(dev_p, ep, CY_AS_ERROR_CANCELED) ;
+ ret = cy_as_dma_cancel(dev_p, ep, CY_AS_ERROR_CANCELED);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
/*
* destroy the sleep channel
*/
if (!cy_as_hal_destroy_sleep_channel(&ep_p->channel)
&& ret == CY_AS_ERROR_SUCCESS)
- ret = CY_AS_ERROR_DESTROY_SLEEP_CHANNEL_FAILED ;
+ ret = CY_AS_ERROR_DESTROY_SLEEP_CHANNEL_FAILED;
/*
* free the memory associated with this endpoint
*/
- cy_as_hal_free(ep_p) ;
+ cy_as_hal_free(ep_p);
/*
* set the data structure ptr to something sane since the
* previous pointer is now free.
*/
- dev_p->endp[ep] = 0 ;
+ dev_p->endp[ep] = 0;
- return ret ;
+ return ret;
}
/*
@@ -591,18 +591,18 @@ cy_as_dma_stop_end_point(cy_as_device *dev_p, cy_as_end_point_number_t ep)
static cy_as_return_status_t
cy_as_dma_stop_internal(cy_as_device *dev_p)
{
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
- cy_as_return_status_t lret ;
- cy_as_end_point_number_t i ;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
+ cy_as_return_status_t lret;
+ cy_as_end_point_number_t i;
/*
* stop all of the endpoints. this cancels all DMA requests, and
* frees all resources associated with each endpoint.
*/
- for (i = 0 ; i < sizeof(dev_p->endp)/(sizeof(dev_p->endp[0])) ; i++) {
- lret = cy_as_dma_stop_end_point(dev_p, i) ;
+ for (i = 0; i < sizeof(dev_p->endp)/(sizeof(dev_p->endp[0])); i++) {
+ lret = cy_as_dma_stop_end_point(dev_p, i);
if (lret != CY_AS_ERROR_SUCCESS && ret == CY_AS_ERROR_SUCCESS)
- ret = lret ;
+ ret = lret;
}
/*
@@ -610,23 +610,23 @@ cy_as_dma_stop_internal(cy_as_device *dev_p)
* DMA requests.
*/
while (dev_p->dma_freelist_p) {
- cy_as_dma_queue_entry *req_p ;
- uint32_t imask = cy_as_hal_disable_interrupts() ;
+ cy_as_dma_queue_entry *req_p;
+ uint32_t imask = cy_as_hal_disable_interrupts();
- req_p = dev_p->dma_freelist_p ;
- dev_p->dma_freelist_p = req_p->next_p ;
+ req_p = dev_p->dma_freelist_p;
+ dev_p->dma_freelist_p = req_p->next_p;
- cy_as_hal_enable_interrupts(imask) ;
+ cy_as_hal_enable_interrupts(imask);
- cy_as_hal_free(req_p) ;
+ cy_as_hal_free(req_p);
}
- cy_as_ll_destroy_request(dev_p, dev_p->usb_ep0_dma_req) ;
- cy_as_ll_destroy_request(dev_p, dev_p->usb_ep1_dma_req) ;
- cy_as_ll_destroy_response(dev_p, dev_p->usb_ep0_dma_resp) ;
- cy_as_ll_destroy_response(dev_p, dev_p->usb_ep1_dma_resp) ;
+ cy_as_ll_destroy_request(dev_p, dev_p->usb_ep0_dma_req);
+ cy_as_ll_destroy_request(dev_p, dev_p->usb_ep1_dma_req);
+ cy_as_ll_destroy_response(dev_p, dev_p->usb_ep0_dma_resp);
+ cy_as_ll_destroy_response(dev_p, dev_p->usb_ep1_dma_resp);
- return ret ;
+ return ret;
}
@@ -642,12 +642,12 @@ cy_as_dma_stop_internal(cy_as_device *dev_p)
cy_as_return_status_t
cy_as_dma_stop(cy_as_device *dev_p)
{
- cy_as_return_status_t ret ;
+ cy_as_return_status_t ret;
- ret = cy_as_dma_stop_internal(dev_p) ;
- cy_as_device_set_dma_stopped(dev_p) ;
+ ret = cy_as_dma_stop_internal(dev_p);
+ cy_as_device_set_dma_stopped(dev_p);
- return ret ;
+ return ret;
}
/*
@@ -658,23 +658,23 @@ cy_as_dma_stop(cy_as_device *dev_p)
cy_as_return_status_t
cy_as_dma_start(cy_as_device *dev_p)
{
- cy_as_end_point_number_t i ;
- uint16_t cnt ;
+ cy_as_end_point_number_t i;
+ uint16_t cnt;
if (cy_as_device_is_dma_running(dev_p))
- return CY_AS_ERROR_ALREADY_RUNNING ;
+ return CY_AS_ERROR_ALREADY_RUNNING;
/*
* pre-allocate DMA queue structures to be used in the interrupt context
*/
- for (cnt = 0 ; cnt < 32 ; cnt++) {
+ for (cnt = 0; cnt < 32; cnt++) {
cy_as_dma_queue_entry *entry_p = (cy_as_dma_queue_entry *)
- cy_as_hal_alloc(sizeof(cy_as_dma_queue_entry)) ;
+ cy_as_hal_alloc(sizeof(cy_as_dma_queue_entry));
if (entry_p == 0) {
- cy_as_dma_stop_internal(dev_p) ;
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ cy_as_dma_stop_internal(dev_p);
+ return CY_AS_ERROR_OUT_OF_MEMORY;
}
- cy_as_dma_add_request_to_free_queue(dev_p, entry_p) ;
+ cy_as_dma_add_request_to_free_queue(dev_p, entry_p);
}
/*
@@ -682,52 +682,52 @@ cy_as_dma_start(cy_as_device *dev_p)
* and EP1 data to west bridge
*/
dev_p->usb_ep0_dma_req = cy_as_ll_create_request(dev_p,
- CY_RQT_USB_EP_DATA, CY_RQT_USB_RQT_CONTEXT, 64) ;
+ CY_RQT_USB_EP_DATA, CY_RQT_USB_RQT_CONTEXT, 64);
dev_p->usb_ep1_dma_req = cy_as_ll_create_request(dev_p,
- CY_RQT_USB_EP_DATA, CY_RQT_USB_RQT_CONTEXT, 64) ;
+ CY_RQT_USB_EP_DATA, CY_RQT_USB_RQT_CONTEXT, 64);
if (dev_p->usb_ep0_dma_req == 0 || dev_p->usb_ep1_dma_req == 0) {
- cy_as_dma_stop_internal(dev_p) ;
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ cy_as_dma_stop_internal(dev_p);
+ return CY_AS_ERROR_OUT_OF_MEMORY;
}
- dev_p->usb_ep0_dma_req_save = dev_p->usb_ep0_dma_req ;
+ dev_p->usb_ep0_dma_req_save = dev_p->usb_ep0_dma_req;
- dev_p->usb_ep0_dma_resp = cy_as_ll_create_response(dev_p, 1) ;
- dev_p->usb_ep1_dma_resp = cy_as_ll_create_response(dev_p, 1) ;
+ dev_p->usb_ep0_dma_resp = cy_as_ll_create_response(dev_p, 1);
+ dev_p->usb_ep1_dma_resp = cy_as_ll_create_response(dev_p, 1);
if (dev_p->usb_ep0_dma_resp == 0 || dev_p->usb_ep1_dma_resp == 0) {
- cy_as_dma_stop_internal(dev_p) ;
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ cy_as_dma_stop_internal(dev_p);
+ return CY_AS_ERROR_OUT_OF_MEMORY;
}
- dev_p->usb_ep0_dma_resp_save = dev_p->usb_ep0_dma_resp ;
+ dev_p->usb_ep0_dma_resp_save = dev_p->usb_ep0_dma_resp;
/*
* set the dev_p->endp to all zeros to insure cleanup is possible if
* an error occurs during initialization.
*/
- cy_as_hal_mem_set(dev_p->endp, 0, sizeof(dev_p->endp)) ;
+ cy_as_hal_mem_set(dev_p->endp, 0, sizeof(dev_p->endp));
/*
* now, iterate through each of the endpoints and initialize each
* one.
*/
- for (i = 0 ; i < sizeof(dev_p->endp)/sizeof(dev_p->endp[0]) ; i++) {
+ for (i = 0; i < sizeof(dev_p->endp)/sizeof(dev_p->endp[0]); i++) {
dev_p->endp[i] = (cy_as_dma_end_point *)
- cy_as_hal_alloc(sizeof(cy_as_dma_end_point)) ;
+ cy_as_hal_alloc(sizeof(cy_as_dma_end_point));
if (dev_p->endp[i] == 0) {
- cy_as_dma_stop_internal(dev_p) ;
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ cy_as_dma_stop_internal(dev_p);
+ return CY_AS_ERROR_OUT_OF_MEMORY;
}
cy_as_hal_mem_set(dev_p->endp[i], 0,
- sizeof(cy_as_dma_end_point)) ;
+ sizeof(cy_as_dma_end_point));
- dev_p->endp[i]->ep = i ;
- dev_p->endp[i]->queue_p = 0 ;
- dev_p->endp[i]->last_p = 0 ;
+ dev_p->endp[i]->ep = i;
+ dev_p->endp[i]->queue_p = 0;
+ dev_p->endp[i]->last_p = 0;
- cy_as_dma_set_drq(dev_p, i, cy_false) ;
+ cy_as_dma_set_drq(dev_p, i, cy_false);
if (!cy_as_hal_create_sleep_channel(&dev_p->endp[i]->channel))
- return CY_AS_ERROR_CREATE_SLEEP_CHANNEL_FAILED ;
+ return CY_AS_ERROR_CREATE_SLEEP_CHANNEL_FAILED;
}
/*
@@ -735,14 +735,14 @@ cy_as_dma_start(cy_as_device *dev_p)
* HAL layer completes a DMA request
*/
cy_as_hal_dma_register_callback(dev_p->tag,
- cy_as_dma_completed_callback) ;
+ cy_as_dma_completed_callback);
/*
* mark DMA as up and running on this device
*/
- cy_as_device_set_dma_running(dev_p) ;
+ cy_as_device_set_dma_running(dev_p);
- return CY_AS_ERROR_SUCCESS ;
+ return CY_AS_ERROR_SUCCESS;
}
/*
@@ -755,53 +755,53 @@ cy_as_return_status_t
cy_as_dma_drain_queue(cy_as_device *dev_p,
cy_as_end_point_number_t ep, cy_bool kickstart)
{
- cy_as_dma_end_point *ep_p ;
- int loopcount = 1000 ;
- uint32_t mask ;
+ cy_as_dma_end_point *ep_p;
+ int loopcount = 1000;
+ uint32_t mask;
/*
* make sure the endpoint is valid
*/
if (ep >= sizeof(dev_p->endp)/sizeof(dev_p->endp[0]))
- return CY_AS_ERROR_INVALID_ENDPOINT ;
+ return CY_AS_ERROR_INVALID_ENDPOINT;
/* Get the endpoint pointer based on the endpoint number */
- ep_p = CY_AS_NUM_EP(dev_p, ep) ;
+ ep_p = CY_AS_NUM_EP(dev_p, ep);
/*
* if the endpoint is empty of traffic, we return
* with success immediately
*/
- mask = cy_as_hal_disable_interrupts() ;
+ mask = cy_as_hal_disable_interrupts();
if (ep_p->queue_p == 0) {
- cy_as_hal_enable_interrupts(mask) ;
- return CY_AS_ERROR_SUCCESS ;
+ cy_as_hal_enable_interrupts(mask);
+ return CY_AS_ERROR_SUCCESS;
} else {
/*
* add 10 seconds to the time out value for each 64 KB segment
* of data to be transferred.
*/
if (ep_p->queue_p->size > 0x10000)
- loopcount += ((ep_p->queue_p->size / 0x10000) * 1000) ;
+ loopcount += ((ep_p->queue_p->size / 0x10000) * 1000);
}
- cy_as_hal_enable_interrupts(mask) ;
+ cy_as_hal_enable_interrupts(mask);
/* If we are already sleeping on this endpoint, it is an error */
if (cy_as_dma_end_point_is_sleeping(ep_p))
- return CY_AS_ERROR_NESTED_SLEEP ;
+ return CY_AS_ERROR_NESTED_SLEEP;
/*
* we disable the endpoint while the queue drains to
* prevent any additional requests from being queued while we are waiting
*/
cy_as_dma_enable_end_point(dev_p, ep,
- cy_false, cy_as_direction_dont_change) ;
+ cy_false, cy_as_direction_dont_change);
if (kickstart) {
/*
* now, kick start the DMA if necessary
*/
- cy_as_dma_kick_start(dev_p, ep) ;
+ cy_as_dma_kick_start(dev_p, ep);
}
/*
@@ -810,8 +810,8 @@ cy_as_dma_drain_queue(cy_as_device *dev_p,
*/
if (ep_p->queue_p == 0) {
cy_as_dma_enable_end_point(dev_p, ep, cy_true,
- cy_as_direction_dont_change) ;
- return CY_AS_ERROR_SUCCESS ;
+ cy_as_direction_dont_change);
+ return CY_AS_ERROR_SUCCESS;
}
while (loopcount-- > 0) {
@@ -819,11 +819,11 @@ cy_as_dma_drain_queue(cy_as_device *dev_p,
* sleep for 10 ms maximum (per loop) while
* waiting for the transfer to complete.
*/
- cy_as_dma_end_point_set_sleep_state(ep_p) ;
- cy_as_hal_sleep_on(&ep_p->channel, 10) ;
+ cy_as_dma_end_point_set_sleep_state(ep_p);
+ cy_as_hal_sleep_on(&ep_p->channel, 10);
/* If we timed out, the sleep bit will still be set */
- cy_as_dma_end_point_set_wake_state(ep_p) ;
+ cy_as_dma_end_point_set_wake_state(ep_p);
/* Check the queue to see if is drained */
if (ep_p->queue_p == 0) {
@@ -831,12 +831,12 @@ cy_as_dma_drain_queue(cy_as_device *dev_p,
* clear the endpoint running and in transit flags
* for the endpoint, now that its DMA queue is empty.
*/
- cy_as_dma_end_point_clear_in_transit(ep_p) ;
- cy_as_dma_end_point_set_stopped(ep_p) ;
+ cy_as_dma_end_point_clear_in_transit(ep_p);
+ cy_as_dma_end_point_set_stopped(ep_p);
cy_as_dma_enable_end_point(dev_p, ep,
- cy_true, cy_as_direction_dont_change) ;
- return CY_AS_ERROR_SUCCESS ;
+ cy_true, cy_as_direction_dont_change);
+ return CY_AS_ERROR_SUCCESS;
}
}
@@ -844,10 +844,10 @@ cy_as_dma_drain_queue(cy_as_device *dev_p,
* the DMA operation that has timed out can be cancelled, so that later
* operations on this queue can proceed.
*/
- cy_as_dma_cancel(dev_p, ep, CY_AS_ERROR_TIMEOUT) ;
+ cy_as_dma_cancel(dev_p, ep, CY_AS_ERROR_TIMEOUT);
cy_as_dma_enable_end_point(dev_p, ep,
- cy_true, cy_as_direction_dont_change) ;
- return CY_AS_ERROR_TIMEOUT ;
+ cy_true, cy_as_direction_dont_change);
+ return CY_AS_ERROR_TIMEOUT;
}
/*
@@ -860,41 +860,41 @@ cy_as_dma_queue_request(cy_as_device *dev_p,
cy_as_end_point_number_t ep, void *mem_p,
uint32_t size, cy_bool pkt, cy_bool readreq, cy_as_dma_callback cb)
{
- uint32_t mask ;
- cy_as_dma_queue_entry *entry_p ;
- cy_as_dma_end_point *ep_p ;
+ uint32_t mask;
+ cy_as_dma_queue_entry *entry_p;
+ cy_as_dma_end_point *ep_p;
/*
* make sure the endpoint is valid
*/
if (ep >= sizeof(dev_p->endp)/sizeof(dev_p->endp[0]))
- return CY_AS_ERROR_INVALID_ENDPOINT ;
+ return CY_AS_ERROR_INVALID_ENDPOINT;
/* Get the endpoint pointer based on the endpoint number */
- ep_p = CY_AS_NUM_EP(dev_p, ep) ;
+ ep_p = CY_AS_NUM_EP(dev_p, ep);
if (!cy_as_dma_end_point_is_enabled(ep_p))
- return CY_AS_ERROR_ENDPOINT_DISABLED ;
+ return CY_AS_ERROR_ENDPOINT_DISABLED;
- entry_p = cy_as_dma_get_dma_queue_entry(dev_p) ;
+ entry_p = cy_as_dma_get_dma_queue_entry(dev_p);
- entry_p->buf_p = mem_p ;
- entry_p->cb = cb ;
- entry_p->size = size ;
- entry_p->offset = 0 ;
- entry_p->packet = pkt ;
- entry_p->readreq = readreq ;
+ entry_p->buf_p = mem_p;
+ entry_p->cb = cb;
+ entry_p->size = size;
+ entry_p->offset = 0;
+ entry_p->packet = pkt;
+ entry_p->readreq = readreq;
- mask = cy_as_hal_disable_interrupts() ;
- entry_p->next_p = 0 ;
+ mask = cy_as_hal_disable_interrupts();
+ entry_p->next_p = 0;
if (ep_p->last_p)
- ep_p->last_p->next_p = entry_p ;
- ep_p->last_p = entry_p ;
+ ep_p->last_p->next_p = entry_p;
+ ep_p->last_p = entry_p;
if (ep_p->queue_p == 0)
- ep_p->queue_p = entry_p ;
- cy_as_hal_enable_interrupts(mask) ;
+ ep_p->queue_p = entry_p;
+ cy_as_hal_enable_interrupts(mask);
- return CY_AS_ERROR_SUCCESS ;
+ return CY_AS_ERROR_SUCCESS;
}
/*
@@ -906,21 +906,21 @@ cy_as_return_status_t
cy_as_dma_enable_end_point(cy_as_device *dev_p,
cy_as_end_point_number_t ep, cy_bool enable, cy_as_dma_direction dir)
{
- cy_as_dma_end_point *ep_p ;
+ cy_as_dma_end_point *ep_p;
/*
* make sure the endpoint is valid
*/
if (ep >= sizeof(dev_p->endp)/sizeof(dev_p->endp[0]))
- return CY_AS_ERROR_INVALID_ENDPOINT ;
+ return CY_AS_ERROR_INVALID_ENDPOINT;
/* Get the endpoint pointer based on the endpoint number */
- ep_p = CY_AS_NUM_EP(dev_p, ep) ;
+ ep_p = CY_AS_NUM_EP(dev_p, ep);
if (dir == cy_as_direction_out)
- cy_as_dma_end_point_set_direction_out(ep_p) ;
+ cy_as_dma_end_point_set_direction_out(ep_p);
else if (dir == cy_as_direction_in)
- cy_as_dma_end_point_set_direction_in(ep_p) ;
+ cy_as_dma_end_point_set_direction_in(ep_p);
/*
* get the maximum size of data buffer the HAL
@@ -935,17 +935,17 @@ cy_as_dma_enable_end_point(cy_as_device *dev_p,
* endpoints.
*/
if (ep == 0 || ep == 1)
- ep_p->maxhaldata = 64 ;
+ ep_p->maxhaldata = 64;
else
ep_p->maxhaldata = cy_as_hal_dma_max_request_size(
- dev_p->tag, ep) ;
+ dev_p->tag, ep);
if (enable)
- cy_as_dma_end_point_enable(ep_p) ;
+ cy_as_dma_end_point_enable(ep_p);
else
- cy_as_dma_end_point_disable(ep_p) ;
+ cy_as_dma_end_point_disable(ep_p);
- return CY_AS_ERROR_SUCCESS ;
+ return CY_AS_ERROR_SUCCESS;
}
/*
@@ -958,81 +958,81 @@ cy_as_dma_cancel(
cy_as_end_point_number_t ep,
cy_as_return_status_t err)
{
- uint32_t mask ;
- cy_as_dma_end_point *ep_p ;
- cy_as_dma_queue_entry *entry_p ;
- cy_bool epstate ;
+ uint32_t mask;
+ cy_as_dma_end_point *ep_p;
+ cy_as_dma_queue_entry *entry_p;
+ cy_bool epstate;
/*
* make sure the endpoint is valid
*/
if (ep >= sizeof(dev_p->endp)/sizeof(dev_p->endp[0]))
- return CY_AS_ERROR_INVALID_ENDPOINT ;
+ return CY_AS_ERROR_INVALID_ENDPOINT;
/* Get the endpoint pointer based on the endpoint number */
- ep_p = CY_AS_NUM_EP(dev_p, ep) ;
+ ep_p = CY_AS_NUM_EP(dev_p, ep);
if (ep_p) {
/* Remember the state of the endpoint */
- epstate = cy_as_dma_end_point_is_enabled(ep_p) ;
+ epstate = cy_as_dma_end_point_is_enabled(ep_p);
/*
* disable the endpoint so no more DMA packets can be
* queued.
*/
cy_as_dma_enable_end_point(dev_p, ep,
- cy_false, cy_as_direction_dont_change) ;
+ cy_false, cy_as_direction_dont_change);
/*
* don't allow any interrupts from this endpoint
* while we get the most current request off of
* the queue.
*/
- cy_as_dma_set_drq(dev_p, ep, cy_false) ;
+ cy_as_dma_set_drq(dev_p, ep, cy_false);
/*
* cancel any pending request queued in the HAL layer
*/
if (cy_as_dma_end_point_in_transit(ep_p))
- cy_as_hal_dma_cancel_request(dev_p->tag, ep_p->ep) ;
+ cy_as_hal_dma_cancel_request(dev_p->tag, ep_p->ep);
/*
* shutdown the DMA for this endpoint so no
* more data is transferred
*/
- cy_as_dma_end_point_set_stopped(ep_p) ;
+ cy_as_dma_end_point_set_stopped(ep_p);
/*
* mark the endpoint as not in transit, because we are
* going to consume any queued requests
*/
- cy_as_dma_end_point_clear_in_transit(ep_p) ;
+ cy_as_dma_end_point_clear_in_transit(ep_p);
/*
* now, remove each entry in the queue and call the
* associated callback stating that the request was
* canceled.
*/
- ep_p->last_p = 0 ;
+ ep_p->last_p = 0;
while (ep_p->queue_p != 0) {
/* Disable interrupts to manipulate the queue */
- mask = cy_as_hal_disable_interrupts() ;
+ mask = cy_as_hal_disable_interrupts();
/* Remove an entry from the queue */
- entry_p = ep_p->queue_p ;
- ep_p->queue_p = entry_p->next_p ;
+ entry_p = ep_p->queue_p;
+ ep_p->queue_p = entry_p->next_p;
/* Ok, the queue has been updated, we can
* turn interrupts back on */
- cy_as_hal_enable_interrupts(mask) ;
+ cy_as_hal_enable_interrupts(mask);
/* Call the callback indicating we have
* canceled the DMA */
if (entry_p->cb)
entry_p->cb(dev_p, ep,
- entry_p->buf_p, entry_p->size, err) ;
+ entry_p->buf_p, entry_p->size, err);
- cy_as_dma_add_request_to_free_queue(dev_p, entry_p) ;
+ cy_as_dma_add_request_to_free_queue(dev_p, entry_p);
}
if (ep == 0 || ep == 1) {
@@ -1042,7 +1042,7 @@ cy_as_dma_cancel(
* requests as these are pending requests to send
* data to the west bridge device.
*/
- cy_as_ll_remove_ep_data_requests(dev_p, ep) ;
+ cy_as_ll_remove_ep_data_requests(dev_p, ep);
}
if (epstate) {
@@ -1051,33 +1051,33 @@ cy_as_dma_cancel(
* re-enable the endpoint here.
*/
cy_as_dma_enable_end_point(dev_p, ep,
- cy_true, cy_as_direction_dont_change) ;
+ cy_true, cy_as_direction_dont_change);
}
}
- return CY_AS_ERROR_SUCCESS ;
+ return CY_AS_ERROR_SUCCESS;
}
cy_as_return_status_t
cy_as_dma_received_data(cy_as_device *dev_p,
cy_as_end_point_number_t ep, uint32_t dsize, void *data)
{
- cy_as_dma_queue_entry *dma_p ;
- uint8_t *src_p, *dest_p ;
- cy_as_dma_end_point *ep_p ;
- uint32_t xfersize ;
+ cy_as_dma_queue_entry *dma_p;
+ uint8_t *src_p, *dest_p;
+ cy_as_dma_end_point *ep_p;
+ uint32_t xfersize;
/*
* make sure the endpoint is valid
*/
if (ep != 0 && ep != 1)
- return CY_AS_ERROR_INVALID_ENDPOINT ;
+ return CY_AS_ERROR_INVALID_ENDPOINT;
/* Get the endpoint pointer based on the endpoint number */
- ep_p = CY_AS_NUM_EP(dev_p, ep) ;
- dma_p = ep_p->queue_p ;
+ ep_p = CY_AS_NUM_EP(dev_p, ep);
+ dma_p = ep_p->queue_p;
if (dma_p == 0)
- return CY_AS_ERROR_SUCCESS ;
+ return CY_AS_ERROR_SUCCESS;
/*
* if the data received exceeds the size of the DMA buffer,
@@ -1086,22 +1086,22 @@ cy_as_dma_received_data(cy_as_device *dev_p,
* non-packet reads on the other endpoints.
*/
if (dsize > dma_p->size - dma_p->offset)
- dsize = dma_p->size - dma_p->offset ;
+ dsize = dma_p->size - dma_p->offset;
/*
* copy the data from the request packet to the DMA buffer
* for the endpoint
*/
- src_p = (uint8_t *)data ;
- dest_p = ((uint8_t *)(dma_p->buf_p)) + dma_p->offset ;
- xfersize = dsize ;
+ src_p = (uint8_t *)data;
+ dest_p = ((uint8_t *)(dma_p->buf_p)) + dma_p->offset;
+ xfersize = dsize;
while (xfersize-- > 0)
- *dest_p++ = *src_p++ ;
+ *dest_p++ = *src_p++;
/* Signal the DMA module that we have
* received data for this EP request */
cy_as_dma_completed_callback(dev_p->tag,
- ep, dsize, CY_AS_ERROR_SUCCESS) ;
+ ep, dsize, CY_AS_ERROR_SUCCESS);
- return CY_AS_ERROR_SUCCESS ;
+ return CY_AS_ERROR_SUCCESS;
}
diff --git a/drivers/staging/westbridge/astoria/api/src/cyasintr.c b/drivers/staging/westbridge/astoria/api/src/cyasintr.c
index aea6c3ebf06..b60f69ce598 100644
--- a/drivers/staging/westbridge/astoria/api/src/cyasintr.c
+++ b/drivers/staging/westbridge/astoria/api/src/cyasintr.c
@@ -24,80 +24,80 @@
#include "../../include/linux/westbridge/cyasregs.h"
#include "../../include/linux/westbridge/cyaserr.h"
-extern void cy_as_mail_box_interrupt_handler(cy_as_device *) ;
+extern void cy_as_mail_box_interrupt_handler(cy_as_device *);
void
cy_as_mcu_interrupt_handler(cy_as_device *dev_p)
{
/* Read and clear the interrupt. */
- uint16_t v ;
+ uint16_t v;
- v = cy_as_hal_read_register(dev_p->tag, CY_AS_MEM_P0_MCU_STAT) ;
- v = v ;
+ v = cy_as_hal_read_register(dev_p->tag, CY_AS_MEM_P0_MCU_STAT);
+ v = v;
}
void
cy_as_power_management_interrupt_handler(cy_as_device *dev_p)
{
- uint16_t v ;
+ uint16_t v;
- v = cy_as_hal_read_register(dev_p->tag, CY_AS_MEM_PWR_MAGT_STAT) ;
- v = v ;
+ v = cy_as_hal_read_register(dev_p->tag, CY_AS_MEM_PWR_MAGT_STAT);
+ v = v;
}
void
cy_as_pll_lock_loss_interrupt_handler(cy_as_device *dev_p)
{
- uint16_t v ;
+ uint16_t v;
- v = cy_as_hal_read_register(dev_p->tag, CY_AS_MEM_PLL_LOCK_LOSS_STAT) ;
- v = v ;
+ v = cy_as_hal_read_register(dev_p->tag, CY_AS_MEM_PLL_LOCK_LOSS_STAT);
+ v = v;
}
uint32_t cy_as_intr_start(cy_as_device *dev_p, cy_bool dmaintr)
{
- uint16_t v ;
+ uint16_t v;
- cy_as_hal_assert(dev_p->sig == CY_AS_DEVICE_HANDLE_SIGNATURE) ;
+ cy_as_hal_assert(dev_p->sig == CY_AS_DEVICE_HANDLE_SIGNATURE);
if (cy_as_device_is_intr_running(dev_p) != 0)
- return CY_AS_ERROR_ALREADY_RUNNING ;
+ return CY_AS_ERROR_ALREADY_RUNNING;
v = CY_AS_MEM_P0_INT_MASK_REG_MMCUINT |
CY_AS_MEM_P0_INT_MASK_REG_MMBINT |
- CY_AS_MEM_P0_INT_MASK_REG_MPMINT ;
+ CY_AS_MEM_P0_INT_MASK_REG_MPMINT;
if (dmaintr)
- v |= CY_AS_MEM_P0_INT_MASK_REG_MDRQINT ;
+ v |= CY_AS_MEM_P0_INT_MASK_REG_MDRQINT;
/* Enable the interrupts of interest */
- cy_as_hal_write_register(dev_p->tag, CY_AS_MEM_P0_INT_MASK_REG, v) ;
+ cy_as_hal_write_register(dev_p->tag, CY_AS_MEM_P0_INT_MASK_REG, v);
/* Mark the interrupt module as initialized */
- cy_as_device_set_intr_running(dev_p) ;
+ cy_as_device_set_intr_running(dev_p);
- return CY_AS_ERROR_SUCCESS ;
+ return CY_AS_ERROR_SUCCESS;
}
uint32_t cy_as_intr_stop(cy_as_device *dev_p)
{
- cy_as_hal_assert(dev_p->sig == CY_AS_DEVICE_HANDLE_SIGNATURE) ;
+ cy_as_hal_assert(dev_p->sig == CY_AS_DEVICE_HANDLE_SIGNATURE);
if (cy_as_device_is_intr_running(dev_p) == 0)
- return CY_AS_ERROR_NOT_RUNNING ;
+ return CY_AS_ERROR_NOT_RUNNING;
- cy_as_hal_write_register(dev_p->tag, CY_AS_MEM_P0_INT_MASK_REG, 0) ;
- cy_as_device_set_intr_stopped(dev_p) ;
+ cy_as_hal_write_register(dev_p->tag, CY_AS_MEM_P0_INT_MASK_REG, 0);
+ cy_as_device_set_intr_stopped(dev_p);
- return CY_AS_ERROR_SUCCESS ;
+ return CY_AS_ERROR_SUCCESS;
}
void cy_as_intr_service_interrupt(cy_as_hal_device_tag tag)
{
- uint16_t v ;
- cy_as_device *dev_p ;
+ uint16_t v;
+ cy_as_device *dev_p;
- dev_p = cy_as_device_find_from_tag(tag) ;
+ dev_p = cy_as_device_find_from_tag(tag);
/*
* only power management interrupts can occur before the
@@ -105,39 +105,39 @@ void cy_as_intr_service_interrupt(cy_as_hal_device_tag tag)
* handle it here; otherwise output a warning message.
*/
if (dev_p == 0) {
- v = cy_as_hal_read_register(tag, CY_AS_MEM_P0_INTR_REG) ;
+ v = cy_as_hal_read_register(tag, CY_AS_MEM_P0_INTR_REG);
if (v == CY_AS_MEM_P0_INTR_REG_PMINT) {
/* Read the PWR_MAGT_STAT register
* to clear this interrupt. */
v = cy_as_hal_read_register(tag,
- CY_AS_MEM_PWR_MAGT_STAT) ;
+ CY_AS_MEM_PWR_MAGT_STAT);
} else
cy_as_hal_print_message("stray antioch "
"interrupt detected"
", tag not associated "
- "with any created device.") ;
- return ;
+ "with any created device.");
+ return;
}
/* Make sure we got a valid object from CyAsDeviceFindFromTag */
- cy_as_hal_assert(dev_p->sig == CY_AS_DEVICE_HANDLE_SIGNATURE) ;
+ cy_as_hal_assert(dev_p->sig == CY_AS_DEVICE_HANDLE_SIGNATURE);
- v = cy_as_hal_read_register(dev_p->tag, CY_AS_MEM_P0_INTR_REG) ;
+ v = cy_as_hal_read_register(dev_p->tag, CY_AS_MEM_P0_INTR_REG);
if (v & CY_AS_MEM_P0_INTR_REG_MCUINT)
- cy_as_mcu_interrupt_handler(dev_p) ;
+ cy_as_mcu_interrupt_handler(dev_p);
if (v & CY_AS_MEM_P0_INTR_REG_PMINT)
- cy_as_power_management_interrupt_handler(dev_p) ;
+ cy_as_power_management_interrupt_handler(dev_p);
if (v & CY_AS_MEM_P0_INTR_REG_PLLLOCKINT)
- cy_as_pll_lock_loss_interrupt_handler(dev_p) ;
+ cy_as_pll_lock_loss_interrupt_handler(dev_p);
/* If the interrupt module is not running, no mailbox
* interrupts are expected from the west bridge. */
if (cy_as_device_is_intr_running(dev_p) == 0)
- return ;
+ return;
if (v & CY_AS_MEM_P0_INTR_REG_MBINT)
- cy_as_mail_box_interrupt_handler(dev_p) ;
+ cy_as_mail_box_interrupt_handler(dev_p);
}
diff --git a/drivers/staging/westbridge/astoria/api/src/cyaslep2pep.c b/drivers/staging/westbridge/astoria/api/src/cyaslep2pep.c
index b28e33a1ce9..60b6f352533 100644
--- a/drivers/staging/westbridge/astoria/api/src/cyaslep2pep.c
+++ b/drivers/staging/westbridge/astoria/api/src/cyaslep2pep.c
@@ -40,7 +40,7 @@ typedef enum cy_as_physical_endpoint_state {
* LEP register indexes into actual EP numbers.
*/
static cy_as_end_point_number_t end_point_map[] = {
- 3, 5, 7, 9, 10, 11, 12, 13, 14, 15 } ;
+ 3, 5, 7, 9, 10, 11, 12, 13, 14, 15 };
#define CY_AS_EPCFG_1024 (1 << 3)
#define CY_AS_EPCFG_DBL (0x02)
@@ -116,23 +116,23 @@ static uint8_t pep_register_values[12][4] = {
CY_AS_EPCFG_DBL,
},/* Config 12 - PEP1 (4 * 1024), PEP2 (N/A),
* PEP3 (N/A), PEP4 (N/A) */
-} ;
+};
static cy_as_return_status_t
find_endpoint_directions(cy_as_device *dev_p,
cy_as_physical_endpoint_state epstate[4])
{
- int i ;
- cy_as_physical_endpoint_state desired ;
+ int i;
+ cy_as_physical_endpoint_state desired;
/*
* note, there is no error checking here becuase
* ISO error checking happens when the API is called.
*/
- for (i = 0 ; i < 10 ; i++) {
- int epno = end_point_map[i] ;
+ for (i = 0; i < 10; i++) {
+ int epno = end_point_map[i];
if (dev_p->usb_config[epno].enabled) {
- int pep = dev_p->usb_config[epno].physical ;
+ int pep = dev_p->usb_config[epno].physical;
if (dev_p->usb_config[epno].type == cy_as_usb_iso) {
/*
* marking this as an ISO endpoint, removes the
@@ -140,14 +140,14 @@ find_endpoint_directions(cy_as_device *dev_p,
* mapping the remaining E_ps.
*/
if (dev_p->usb_config[epno].dir == cy_as_usb_in)
- desired = cy_as_e_p_iso_in ;
+ desired = cy_as_e_p_iso_in;
else
- desired = cy_as_e_p_iso_out ;
+ desired = cy_as_e_p_iso_out;
} else {
if (dev_p->usb_config[epno].dir == cy_as_usb_in)
- desired = cy_as_e_p_in ;
+ desired = cy_as_e_p_in;
else
- desired = cy_as_e_p_out ;
+ desired = cy_as_e_p_out;
}
/*
@@ -157,9 +157,9 @@ find_endpoint_directions(cy_as_device *dev_p,
*/
if (epstate[pep - 1] !=
cy_as_e_p_free && epstate[pep - 1] != desired)
- return CY_AS_ERROR_INVALID_CONFIGURATION ;
+ return CY_AS_ERROR_INVALID_CONFIGURATION;
- epstate[pep - 1] = desired ;
+ epstate[pep - 1] = desired;
}
}
@@ -167,91 +167,91 @@ find_endpoint_directions(cy_as_device *dev_p,
* create the EP1 config values directly.
* both EP1OUT and EP1IN are invalid by default.
*/
- dev_p->usb_ep1cfg[0] = 0 ;
- dev_p->usb_ep1cfg[1] = 0 ;
+ dev_p->usb_ep1cfg[0] = 0;
+ dev_p->usb_ep1cfg[1] = 0;
if (dev_p->usb_config[1].enabled) {
if ((dev_p->usb_config[1].dir == cy_as_usb_out) ||
(dev_p->usb_config[1].dir == cy_as_usb_in_out)) {
/* Set the valid bit and type field. */
- dev_p->usb_ep1cfg[0] = (1 << 7) ;
+ dev_p->usb_ep1cfg[0] = (1 << 7);
if (dev_p->usb_config[1].type == cy_as_usb_bulk)
- dev_p->usb_ep1cfg[0] |= (2 << 4) ;
+ dev_p->usb_ep1cfg[0] |= (2 << 4);
else
- dev_p->usb_ep1cfg[0] |= (3 << 4) ;
+ dev_p->usb_ep1cfg[0] |= (3 << 4);
}
if ((dev_p->usb_config[1].dir == cy_as_usb_in) ||
(dev_p->usb_config[1].dir == cy_as_usb_in_out)) {
/* Set the valid bit and type field. */
- dev_p->usb_ep1cfg[1] = (1 << 7) ;
+ dev_p->usb_ep1cfg[1] = (1 << 7);
if (dev_p->usb_config[1].type == cy_as_usb_bulk)
- dev_p->usb_ep1cfg[1] |= (2 << 4) ;
+ dev_p->usb_ep1cfg[1] |= (2 << 4);
else
- dev_p->usb_ep1cfg[1] |= (3 << 4) ;
+ dev_p->usb_ep1cfg[1] |= (3 << 4);
}
}
- return CY_AS_ERROR_SUCCESS ;
+ return CY_AS_ERROR_SUCCESS;
}
static void
create_register_settings(cy_as_device *dev_p,
cy_as_physical_endpoint_state epstate[4])
{
- int i ;
- uint8_t v ;
+ int i;
+ uint8_t v;
- for (i = 0 ; i < 4 ; i++) {
+ for (i = 0; i < 4; i++) {
if (i == 0) {
/* Start with the values that specify size */
dev_p->usb_pepcfg[i] =
pep_register_values
- [dev_p->usb_phy_config - 1][0] ;
+ [dev_p->usb_phy_config - 1][0];
} else if (i == 2) {
/* Start with the values that specify size */
dev_p->usb_pepcfg[i] =
pep_register_values
- [dev_p->usb_phy_config - 1][1] ;
+ [dev_p->usb_phy_config - 1][1];
} else
- dev_p->usb_pepcfg[i] = 0 ;
+ dev_p->usb_pepcfg[i] = 0;
/* Adjust direction if it is in */
if (epstate[i] == cy_as_e_p_iso_in ||
epstate[i] == cy_as_e_p_in)
- dev_p->usb_pepcfg[i] |= (1 << 6) ;
+ dev_p->usb_pepcfg[i] |= (1 << 6);
}
/* Configure the logical EP registers */
- for (i = 0 ; i < 10 ; i++) {
- int val ;
- int epnum = end_point_map[i] ;
+ for (i = 0; i < 10; i++) {
+ int val;
+ int epnum = end_point_map[i];
- v = 0x10 ; /* PEP 1, Bulk Endpoint, EP not valid */
+ v = 0x10; /* PEP 1, Bulk Endpoint, EP not valid */
if (dev_p->usb_config[epnum].enabled) {
- v |= (1 << 7) ; /* Enabled */
+ v |= (1 << 7); /* Enabled */
- val = dev_p->usb_config[epnum].physical - 1 ;
- cy_as_hal_assert(val >= 0 && val <= 3) ;
- v |= (val << 5) ;
+ val = dev_p->usb_config[epnum].physical - 1;
+ cy_as_hal_assert(val >= 0 && val <= 3);
+ v |= (val << 5);
switch (dev_p->usb_config[epnum].type) {
case cy_as_usb_bulk:
- val = 2 ;
- break ;
+ val = 2;
+ break;
case cy_as_usb_int:
- val = 3 ;
- break ;
+ val = 3;
+ break;
case cy_as_usb_iso:
- val = 1 ;
- break ;
+ val = 1;
+ break;
default:
- cy_as_hal_assert(cy_false) ;
- break ;
+ cy_as_hal_assert(cy_false);
+ break;
}
- v |= (val << 3) ;
+ v |= (val << 3);
}
- dev_p->usb_lepcfg[i] = v ;
+ dev_p->usb_lepcfg[i] = v;
}
}
@@ -259,100 +259,100 @@ create_register_settings(cy_as_device *dev_p,
cy_as_return_status_t
cy_as_usb_map_logical2_physical(cy_as_device *dev_p)
{
- cy_as_return_status_t ret ;
+ cy_as_return_status_t ret;
/* Physical EPs 3 5 7 9 respectively in the array */
cy_as_physical_endpoint_state epstate[4] = {
cy_as_e_p_free, cy_as_e_p_free,
- cy_as_e_p_free, cy_as_e_p_free } ;
+ cy_as_e_p_free, cy_as_e_p_free };
/* Find the direction for the endpoints */
- ret = find_endpoint_directions(dev_p, epstate) ;
+ ret = find_endpoint_directions(dev_p, epstate);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
/*
* now create the register settings based on the given
* assigned of logical E_ps to physical endpoints.
*/
- create_register_settings(dev_p, epstate) ;
+ create_register_settings(dev_p, epstate);
- return ret ;
+ return ret;
}
static uint16_t
get_max_dma_size(cy_as_device *dev_p, cy_as_end_point_number_t ep)
{
- uint16_t size = dev_p->usb_config[ep].size ;
+ uint16_t size = dev_p->usb_config[ep].size;
if (size == 0) {
switch (dev_p->usb_config[ep].type) {
case cy_as_usb_control:
- size = 64 ;
- break ;
+ size = 64;
+ break;
case cy_as_usb_bulk:
size = cy_as_device_is_usb_high_speed(dev_p) ?
- 512 : 64 ;
- break ;
+ 512 : 64;
+ break;
case cy_as_usb_int:
size = cy_as_device_is_usb_high_speed(dev_p) ?
- 1024 : 64 ;
- break ;
+ 1024 : 64;
+ break;
case cy_as_usb_iso:
size = cy_as_device_is_usb_high_speed(dev_p) ?
- 1024 : 1023 ;
- break ;
+ 1024 : 1023;
+ break;
}
}
- return size ;
+ return size;
}
cy_as_return_status_t
cy_as_usb_set_dma_sizes(cy_as_device *dev_p)
{
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
- uint32_t i ;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
+ uint32_t i;
- for (i = 0 ; i < 10 ; i++) {
+ for (i = 0; i < 10; i++) {
cy_as_usb_end_point_config *config_p =
- &dev_p->usb_config[end_point_map[i]] ;
+ &dev_p->usb_config[end_point_map[i]];
if (config_p->enabled) {
ret = cy_as_dma_set_max_dma_size(dev_p,
end_point_map[i],
- get_max_dma_size(dev_p, end_point_map[i])) ;
+ get_max_dma_size(dev_p, end_point_map[i]));
if (ret != CY_AS_ERROR_SUCCESS)
- break ;
+ break;
}
}
- return ret ;
+ return ret;
}
cy_as_return_status_t
cy_as_usb_setup_dma(cy_as_device *dev_p)
{
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
- uint32_t i ;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
+ uint32_t i;
- for (i = 0 ; i < 10 ; i++) {
+ for (i = 0; i < 10; i++) {
cy_as_usb_end_point_config *config_p =
- &dev_p->usb_config[end_point_map[i]] ;
+ &dev_p->usb_config[end_point_map[i]];
if (config_p->enabled) {
/* Map the endpoint direction to the DMA direction */
- cy_as_dma_direction dir = cy_as_direction_out ;
+ cy_as_dma_direction dir = cy_as_direction_out;
if (config_p->dir == cy_as_usb_in)
- dir = cy_as_direction_in ;
+ dir = cy_as_direction_in;
ret = cy_as_dma_enable_end_point(dev_p,
- end_point_map[i], cy_true, dir) ;
+ end_point_map[i], cy_true, dir);
if (ret != CY_AS_ERROR_SUCCESS)
- break ;
+ break;
}
}
- return ret ;
+ return ret;
}
diff --git a/drivers/staging/westbridge/astoria/api/src/cyaslowlevel.c b/drivers/staging/westbridge/astoria/api/src/cyaslowlevel.c
index 70d56e9b060..d43dd858de5 100644
--- a/drivers/staging/westbridge/astoria/api/src/cyaslowlevel.c
+++ b/drivers/staging/westbridge/astoria/api/src/cyaslowlevel.c
@@ -27,11 +27,11 @@
#include "../../include/linux/westbridge/cyaserr.h"
#include "../../include/linux/westbridge/cyasregs.h"
-static const uint32_t cy_as_low_level_timeout_count = 65536 * 4 ;
+static const uint32_t cy_as_low_level_timeout_count = 65536 * 4;
/* Forward declaration */
static cy_as_return_status_t cy_as_send_one(cy_as_device *dev_p,
- cy_as_ll_request_response *req_p) ;
+ cy_as_ll_request_response *req_p);
/*
* This array holds the size of the largest request we will ever recevie from
@@ -45,7 +45,7 @@ static uint16_t max_request_length[CY_RQT_CONTEXT_COUNT] = {
8, /* CY_RQT_STORAGE_RQT_CONTEXT - CY_RQT_MEDIA_CHANGED */
128, /* CY_RQT_USB_RQT_CONTEXT - CY_RQT_USB_EVENT */
8 /* CY_RQT_TUR_RQT_CONTEXT - CY_RQT_TURBO_CMD_FROM_HOST */
-} ;
+};
/*
* For the given context, this function removes the request node at the head
@@ -56,20 +56,20 @@ static uint16_t max_request_length[CY_RQT_CONTEXT_COUNT] = {
static void
cy_as_ll_remove_request_queue_head(cy_as_device *dev_p, cy_as_context *ctxt_p)
{
- uint32_t mask, state ;
- cy_as_ll_request_list_node *node_p ;
+ uint32_t mask, state;
+ cy_as_ll_request_list_node *node_p;
- (void)dev_p ;
- cy_as_hal_assert(ctxt_p->request_queue_p != 0) ;
+ (void)dev_p;
+ cy_as_hal_assert(ctxt_p->request_queue_p != 0);
- mask = cy_as_hal_disable_interrupts() ;
- node_p = ctxt_p->request_queue_p ;
- ctxt_p->request_queue_p = node_p->next ;
- cy_as_hal_enable_interrupts(mask) ;
+ mask = cy_as_hal_disable_interrupts();
+ node_p = ctxt_p->request_queue_p;
+ ctxt_p->request_queue_p = node_p->next;
+ cy_as_hal_enable_interrupts(mask);
- node_p->callback = 0 ;
- node_p->rqt = 0 ;
- node_p->resp = 0 ;
+ node_p->callback = 0;
+ node_p->rqt = 0;
+ node_p->resp = 0;
/*
* note that the caller allocates and destroys the request and
@@ -80,9 +80,9 @@ cy_as_ll_remove_request_queue_head(cy_as_device *dev_p, cy_as_context *ctxt_p)
* the caller to deal with these in any case. the caller can do
* this in the request/response callback function.
*/
- state = cy_as_hal_disable_interrupts() ;
- cy_as_hal_c_b_free(node_p) ;
- cy_as_hal_enable_interrupts(state) ;
+ state = cy_as_hal_disable_interrupts();
+ cy_as_hal_c_b_free(node_p);
+ cy_as_hal_enable_interrupts(state);
}
/*
@@ -93,36 +93,36 @@ cy_as_ll_remove_request_queue_head(cy_as_device *dev_p, cy_as_context *ctxt_p)
static void
cy_as_ll_send_next_request(cy_as_device *dev_p, cy_as_context *ctxt_p)
{
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
/*
* ret == ret is equivalent to while (1) but eliminates compiler
* warnings for some compilers.
*/
while (ret == ret) {
- cy_as_ll_request_list_node *node_p = ctxt_p->request_queue_p ;
+ cy_as_ll_request_list_node *node_p = ctxt_p->request_queue_p;
if (node_p == 0)
- break ;
+ break;
if (cy_as_request_get_node_state(node_p) !=
CY_AS_REQUEST_LIST_STATE_QUEUED)
- break ;
+ break;
cy_as_request_set_node_state(node_p,
- CY_AS_REQUEST_LIST_STATE_WAITING) ;
- ret = cy_as_send_one(dev_p, node_p->rqt) ;
+ CY_AS_REQUEST_LIST_STATE_WAITING);
+ ret = cy_as_send_one(dev_p, node_p->rqt);
if (ret == CY_AS_ERROR_SUCCESS)
- break ;
+ break;
/*
* if an error occurs in sending the request, tell the requester
* about the error and remove the request from the queue.
*/
cy_as_request_set_node_state(node_p,
- CY_AS_REQUEST_LIST_STATE_RECEIVED) ;
+ CY_AS_REQUEST_LIST_STATE_RECEIVED);
node_p->callback(dev_p, ctxt_p->number,
- node_p->rqt, node_p->resp, ret) ;
- cy_as_ll_remove_request_queue_head(dev_p, ctxt_p) ;
+ node_p->rqt, node_p->resp, ret);
+ cy_as_ll_remove_request_queue_head(dev_p, ctxt_p);
/*
* this falls through to the while loop to send the next request
@@ -139,80 +139,80 @@ cy_as_remove_request_result_t
cy_as_ll_remove_request(cy_as_device *dev_p, cy_as_context *ctxt_p,
cy_as_ll_request_response *req_p, cy_bool force)
{
- uint32_t imask ;
- cy_as_ll_request_list_node *node_p ;
- cy_as_ll_request_list_node *tmp_p ;
- uint32_t state ;
+ uint32_t imask;
+ cy_as_ll_request_list_node *node_p;
+ cy_as_ll_request_list_node *tmp_p;
+ uint32_t state;
- imask = cy_as_hal_disable_interrupts() ;
+ imask = cy_as_hal_disable_interrupts();
if (ctxt_p->request_queue_p != 0 &&
ctxt_p->request_queue_p->rqt == req_p) {
- node_p = ctxt_p->request_queue_p ;
+ node_p = ctxt_p->request_queue_p;
if ((cy_as_request_get_node_state(node_p) ==
CY_AS_REQUEST_LIST_STATE_WAITING) && (!force)) {
- cy_as_hal_enable_interrupts(imask) ;
- return cy_as_remove_request_in_transit ;
+ cy_as_hal_enable_interrupts(imask);
+ return cy_as_remove_request_in_transit;
}
- ctxt_p->request_queue_p = node_p->next ;
+ ctxt_p->request_queue_p = node_p->next;
} else {
- tmp_p = ctxt_p->request_queue_p ;
+ tmp_p = ctxt_p->request_queue_p;
while (tmp_p != 0 && tmp_p->next != 0 &&
tmp_p->next->rqt != req_p)
- tmp_p = tmp_p->next ;
+ tmp_p = tmp_p->next;
if (tmp_p == 0 || tmp_p->next == 0) {
- cy_as_hal_enable_interrupts(imask) ;
- return cy_as_remove_request_not_found ;
+ cy_as_hal_enable_interrupts(imask);
+ return cy_as_remove_request_not_found;
}
- node_p = tmp_p->next ;
- tmp_p->next = node_p->next ;
+ node_p = tmp_p->next;
+ tmp_p->next = node_p->next;
}
if (node_p->callback)
node_p->callback(dev_p, ctxt_p->number, node_p->rqt,
- node_p->resp, CY_AS_ERROR_CANCELED) ;
+ node_p->resp, CY_AS_ERROR_CANCELED);
- state = cy_as_hal_disable_interrupts() ;
- cy_as_hal_c_b_free(node_p) ;
- cy_as_hal_enable_interrupts(state) ;
+ state = cy_as_hal_disable_interrupts();
+ cy_as_hal_c_b_free(node_p);
+ cy_as_hal_enable_interrupts(state);
- cy_as_hal_enable_interrupts(imask) ;
- return cy_as_remove_request_sucessful ;
+ cy_as_hal_enable_interrupts(imask);
+ return cy_as_remove_request_sucessful;
}
void
cy_as_ll_remove_all_requests(cy_as_device *dev_p, cy_as_context *ctxt_p)
{
- cy_as_ll_request_list_node *node = ctxt_p->request_queue_p ;
+ cy_as_ll_request_list_node *node = ctxt_p->request_queue_p;
while (node) {
if (cy_as_request_get_node_state(ctxt_p->request_queue_p) !=
CY_AS_REQUEST_LIST_STATE_RECEIVED)
cy_as_ll_remove_request(dev_p, ctxt_p,
- node->rqt, cy_true) ;
- node = node->next ;
+ node->rqt, cy_true);
+ node = node->next;
}
}
static cy_bool
cy_as_ll_is_in_queue(cy_as_context *ctxt_p, cy_as_ll_request_response *req_p)
{
- uint32_t mask ;
- cy_as_ll_request_list_node *node_p ;
+ uint32_t mask;
+ cy_as_ll_request_list_node *node_p;
- mask = cy_as_hal_disable_interrupts() ;
- node_p = ctxt_p->request_queue_p ;
+ mask = cy_as_hal_disable_interrupts();
+ node_p = ctxt_p->request_queue_p;
while (node_p) {
if (node_p->rqt == req_p) {
- cy_as_hal_enable_interrupts(mask) ;
- return cy_true ;
+ cy_as_hal_enable_interrupts(mask);
+ return cy_true;
}
- node_p = node_p->next ;
+ node_p = node_p->next;
}
- cy_as_hal_enable_interrupts(mask) ;
- return cy_false ;
+ cy_as_hal_enable_interrupts(mask);
+ return cy_false;
}
/*
@@ -226,83 +226,83 @@ cy_as_ll_is_in_queue(cy_as_context *ctxt_p, cy_as_ll_request_response *req_p)
void
cy_as_ll_queue_mailbox_data(cy_as_device *dev_p)
{
- cy_as_context *ctxt_p ;
- uint8_t context ;
- uint16_t data[4] ;
- int32_t i ;
+ cy_as_context *ctxt_p;
+ uint8_t context;
+ uint16_t data[4];
+ int32_t i;
/* Read the data from mailbox 0 to determine what to do with the data */
- for (i = 3 ; i >= 0 ; i--)
+ for (i = 3; i >= 0; i--)
data[i] = cy_as_hal_read_register(dev_p->tag,
- cy_cast_int2U_int16(CY_AS_MEM_P0_MAILBOX0 + i)) ;
+ cy_cast_int2U_int16(CY_AS_MEM_P0_MAILBOX0 + i));
- context = cy_as_mbox_get_context(data[0]) ;
+ context = cy_as_mbox_get_context(data[0]);
if (context >= CY_RQT_CONTEXT_COUNT) {
cy_as_hal_print_message("mailbox request/response received "
- "with invalid context value (%d)\n", context) ;
- return ;
+ "with invalid context value (%d)\n", context);
+ return;
}
- ctxt_p = dev_p->context[context] ;
+ ctxt_p = dev_p->context[context];
/*
* if we have queued too much data, drop future data.
*/
cy_as_hal_assert(ctxt_p->queue_index * sizeof(uint16_t) +
- sizeof(data) <= sizeof(ctxt_p->data_queue)) ;
+ sizeof(data) <= sizeof(ctxt_p->data_queue));
- for (i = 0 ; i < 4 ; i++)
- ctxt_p->data_queue[ctxt_p->queue_index++] = data[i] ;
+ for (i = 0; i < 4; i++)
+ ctxt_p->data_queue[ctxt_p->queue_index++] = data[i];
- cy_as_hal_assert((ctxt_p->queue_index % 4) == 0) ;
- dev_p->ll_queued_data = cy_true ;
+ cy_as_hal_assert((ctxt_p->queue_index % 4) == 0);
+ dev_p->ll_queued_data = cy_true;
}
void
cy_as_mail_box_process_data(cy_as_device *dev_p, uint16_t *data)
{
- cy_as_context *ctxt_p ;
- uint8_t context ;
- uint16_t *len_p ;
- cy_as_ll_request_response *rec_p ;
- uint8_t st ;
- uint16_t src, dest ;
-
- context = cy_as_mbox_get_context(data[0]) ;
+ cy_as_context *ctxt_p;
+ uint8_t context;
+ uint16_t *len_p;
+ cy_as_ll_request_response *rec_p;
+ uint8_t st;
+ uint16_t src, dest;
+
+ context = cy_as_mbox_get_context(data[0]);
if (context >= CY_RQT_CONTEXT_COUNT) {
cy_as_hal_print_message("mailbox request/response received "
- "with invalid context value (%d)\n", context) ;
- return ;
+ "with invalid context value (%d)\n", context);
+ return;
}
- ctxt_p = dev_p->context[context] ;
+ ctxt_p = dev_p->context[context];
if (cy_as_mbox_is_request(data[0])) {
- cy_as_hal_assert(ctxt_p->req_p != 0) ;
- rec_p = ctxt_p->req_p ;
- len_p = &ctxt_p->request_length ;
+ cy_as_hal_assert(ctxt_p->req_p != 0);
+ rec_p = ctxt_p->req_p;
+ len_p = &ctxt_p->request_length;
} else {
if (ctxt_p->request_queue_p == 0 ||
cy_as_request_get_node_state(ctxt_p->request_queue_p)
!= CY_AS_REQUEST_LIST_STATE_WAITING) {
cy_as_hal_print_message("mailbox response received on "
- "context that was not expecting a response\n") ;
+ "context that was not expecting a response\n");
cy_as_hal_print_message(" context: %d\n", context);
cy_as_hal_print_message(" contents: 0x%04x 0x%04x "
"0x%04x 0x%04x\n",
- data[0], data[1], data[2], data[3]) ;
+ data[0], data[1], data[2], data[3]);
if (ctxt_p->request_queue_p != 0)
cy_as_hal_print_message(" state: 0x%02x\n",
- ctxt_p->request_queue_p->state) ;
- return ;
+ ctxt_p->request_queue_p->state);
+ return;
}
/* Make sure the request has an associated response */
- cy_as_hal_assert(ctxt_p->request_queue_p->resp != 0) ;
+ cy_as_hal_assert(ctxt_p->request_queue_p->resp != 0);
- rec_p = ctxt_p->request_queue_p->resp ;
- len_p = &ctxt_p->request_queue_p->length ;
+ rec_p = ctxt_p->request_queue_p->resp;
+ len_p = &ctxt_p->request_queue_p->length;
}
if (rec_p->stored == 0) {
@@ -310,27 +310,27 @@ cy_as_mail_box_process_data(cy_as_device *dev_p, uint16_t *data)
* this is the first cycle of the response
*/
cy_as_ll_request_response__set_code(rec_p,
- cy_as_mbox_get_code(data[0])) ;
- cy_as_ll_request_response__set_context(rec_p, context) ;
+ cy_as_mbox_get_code(data[0]));
+ cy_as_ll_request_response__set_context(rec_p, context);
if (cy_as_mbox_is_last(data[0])) {
/* This is a single cycle response */
- *len_p = rec_p->length ;
- st = 1 ;
+ *len_p = rec_p->length;
+ st = 1;
} else {
/* Ensure that enough memory has been
* reserved for the response. */
- cy_as_hal_assert(rec_p->length >= data[1]) ;
+ cy_as_hal_assert(rec_p->length >= data[1]);
*len_p = (data[1] < rec_p->length) ?
- data[1] : rec_p->length ;
- st = 2 ;
+ data[1] : rec_p->length;
+ st = 2;
}
} else
- st = 1 ;
+ st = 1;
/* Trasnfer the data from the mailboxes to the response */
while (rec_p->stored < *len_p && st < 4)
- rec_p->data[rec_p->stored++] = data[st++] ;
+ rec_p->data[rec_p->stored++] = data[st++];
if (cy_as_mbox_is_last(data[0])) {
/* NB: The call-back that is made below can cause the
@@ -343,16 +343,16 @@ cy_as_mail_box_process_data(cy_as_device *dev_p, uint16_t *data)
*/
if ((ctxt_p->rqt_index > 0) &&
(ctxt_p->rqt_index <= ctxt_p->queue_index)) {
- dest = 0 ;
- src = ctxt_p->rqt_index ;
+ dest = 0;
+ src = ctxt_p->rqt_index;
while (src < ctxt_p->queue_index)
ctxt_p->data_queue[dest++] =
- ctxt_p->data_queue[src++] ;
+ ctxt_p->data_queue[src++];
- ctxt_p->rqt_index = 0 ;
- ctxt_p->queue_index = dest ;
- cy_as_hal_assert((ctxt_p->queue_index % 4) == 0) ;
+ ctxt_p->rqt_index = 0;
+ ctxt_p->queue_index = dest;
+ cy_as_hal_assert((ctxt_p->queue_index % 4) == 0);
}
if (ctxt_p->request_queue_p != 0 && rec_p ==
@@ -362,34 +362,34 @@ cy_as_mail_box_process_data(cy_as_device *dev_p, uint16_t *data)
* callback and reset for the next response.
*/
cy_as_ll_request_response *resp_p =
- ctxt_p->request_queue_p->resp ;
- resp_p->length = ctxt_p->request_queue_p->length ;
+ ctxt_p->request_queue_p->resp;
+ resp_p->length = ctxt_p->request_queue_p->length;
cy_as_request_set_node_state(ctxt_p->request_queue_p,
- CY_AS_REQUEST_LIST_STATE_RECEIVED) ;
+ CY_AS_REQUEST_LIST_STATE_RECEIVED);
- cy_as_device_set_in_callback(dev_p) ;
+ cy_as_device_set_in_callback(dev_p);
ctxt_p->request_queue_p->callback(dev_p, context,
ctxt_p->request_queue_p->rqt,
- resp_p, CY_AS_ERROR_SUCCESS) ;
+ resp_p, CY_AS_ERROR_SUCCESS);
- cy_as_device_clear_in_callback(dev_p) ;
+ cy_as_device_clear_in_callback(dev_p);
- cy_as_ll_remove_request_queue_head(dev_p, ctxt_p) ;
- cy_as_ll_send_next_request(dev_p, ctxt_p) ;
+ cy_as_ll_remove_request_queue_head(dev_p, ctxt_p);
+ cy_as_ll_send_next_request(dev_p, ctxt_p);
} else {
/* Send the request to the appropriate
* module to handle */
- cy_as_ll_request_response *request_p = ctxt_p->req_p ;
- ctxt_p->req_p = 0 ;
+ cy_as_ll_request_response *request_p = ctxt_p->req_p;
+ ctxt_p->req_p = 0;
if (ctxt_p->request_callback) {
- cy_as_device_set_in_callback(dev_p) ;
+ cy_as_device_set_in_callback(dev_p);
ctxt_p->request_callback(dev_p, context,
- request_p, 0, CY_AS_ERROR_SUCCESS) ;
- cy_as_device_clear_in_callback(dev_p) ;
+ request_p, 0, CY_AS_ERROR_SUCCESS);
+ cy_as_device_clear_in_callback(dev_p);
}
cy_as_ll_init_request(request_p, 0,
- context, request_p->length) ;
- ctxt_p->req_p = request_p ;
+ context, request_p->length);
+ ctxt_p->req_p = request_p;
}
}
}
@@ -400,7 +400,7 @@ cy_as_mail_box_process_data(cy_as_device *dev_p, uint16_t *data)
void
cy_as_mail_box_queued_data_handler(cy_as_device *dev_p)
{
- uint16_t i ;
+ uint16_t i;
/*
* if more data gets queued in between our entering this call
@@ -408,20 +408,20 @@ cy_as_mail_box_queued_data_handler(cy_as_device *dev_p)
* continue processing the queued data.
*/
while (dev_p->ll_queued_data) {
- dev_p->ll_queued_data = cy_false ;
- for (i = 0 ; i < CY_RQT_CONTEXT_COUNT ; i++) {
- uint16_t offset ;
- cy_as_context *ctxt_p = dev_p->context[i] ;
- cy_as_hal_assert((ctxt_p->queue_index % 4) == 0) ;
+ dev_p->ll_queued_data = cy_false;
+ for (i = 0; i < CY_RQT_CONTEXT_COUNT; i++) {
+ uint16_t offset;
+ cy_as_context *ctxt_p = dev_p->context[i];
+ cy_as_hal_assert((ctxt_p->queue_index % 4) == 0);
- offset = 0 ;
+ offset = 0;
while (offset < ctxt_p->queue_index) {
- ctxt_p->rqt_index = offset + 4 ;
+ ctxt_p->rqt_index = offset + 4;
cy_as_mail_box_process_data(dev_p,
- ctxt_p->data_queue + offset) ;
- offset = ctxt_p->rqt_index ;
+ ctxt_p->data_queue + offset);
+ offset = ctxt_p->rqt_index;
}
- ctxt_p->queue_index = 0 ;
+ ctxt_p->queue_index = 0;
}
}
}
@@ -437,52 +437,52 @@ cy_as_mail_box_queued_data_handler(cy_as_device *dev_p)
void
cy_as_mail_box_interrupt_handler(cy_as_device *dev_p)
{
- cy_as_hal_assert(dev_p->sig == CY_AS_DEVICE_HANDLE_SIGNATURE) ;
+ cy_as_hal_assert(dev_p->sig == CY_AS_DEVICE_HANDLE_SIGNATURE);
/*
* queue the mailbox data to preserve
* order for later processing.
*/
- cy_as_ll_queue_mailbox_data(dev_p) ;
+ cy_as_ll_queue_mailbox_data(dev_p);
/*
* process what was queued and anything that may be pending
*/
- cy_as_mail_box_queued_data_handler(dev_p) ;
+ cy_as_mail_box_queued_data_handler(dev_p);
}
cy_as_return_status_t
cy_as_ll_start(cy_as_device *dev_p)
{
- uint16_t i ;
+ uint16_t i;
if (cy_as_device_is_low_level_running(dev_p))
- return CY_AS_ERROR_ALREADY_RUNNING ;
+ return CY_AS_ERROR_ALREADY_RUNNING;
- dev_p->ll_sending_rqt = cy_false ;
- dev_p->ll_abort_curr_rqt = cy_false ;
+ dev_p->ll_sending_rqt = cy_false;
+ dev_p->ll_abort_curr_rqt = cy_false;
- for (i = 0 ; i < CY_RQT_CONTEXT_COUNT ; i++) {
+ for (i = 0; i < CY_RQT_CONTEXT_COUNT; i++) {
dev_p->context[i] = (cy_as_context *)
- cy_as_hal_alloc(sizeof(cy_as_context)) ;
+ cy_as_hal_alloc(sizeof(cy_as_context));
if (dev_p->context[i] == 0)
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ return CY_AS_ERROR_OUT_OF_MEMORY;
- dev_p->context[i]->number = (uint8_t)i ;
- dev_p->context[i]->request_callback = 0 ;
- dev_p->context[i]->request_queue_p = 0 ;
- dev_p->context[i]->last_node_p = 0 ;
+ dev_p->context[i]->number = (uint8_t)i;
+ dev_p->context[i]->request_callback = 0;
+ dev_p->context[i]->request_queue_p = 0;
+ dev_p->context[i]->last_node_p = 0;
dev_p->context[i]->req_p = cy_as_ll_create_request(dev_p,
- 0, (uint8_t)i, max_request_length[i]) ;
- dev_p->context[i]->queue_index = 0 ;
+ 0, (uint8_t)i, max_request_length[i]);
+ dev_p->context[i]->queue_index = 0;
if (!cy_as_hal_create_sleep_channel
(&dev_p->context[i]->channel))
- return CY_AS_ERROR_CREATE_SLEEP_CHANNEL_FAILED ;
+ return CY_AS_ERROR_CREATE_SLEEP_CHANNEL_FAILED;
}
- cy_as_device_set_low_level_running(dev_p) ;
- return CY_AS_ERROR_SUCCESS ;
+ cy_as_device_set_low_level_running(dev_p);
+ return CY_AS_ERROR_SUCCESS;
}
/*
@@ -492,27 +492,27 @@ cy_as_ll_start(cy_as_device *dev_p)
cy_as_return_status_t
cy_as_ll_stop(cy_as_device *dev_p)
{
- uint8_t i ;
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
- cy_as_context *ctxt_p ;
- uint32_t mask ;
+ uint8_t i;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
+ cy_as_context *ctxt_p;
+ uint32_t mask;
- for (i = 0 ; i < CY_RQT_CONTEXT_COUNT ; i++) {
- ctxt_p = dev_p->context[i] ;
+ for (i = 0; i < CY_RQT_CONTEXT_COUNT; i++) {
+ ctxt_p = dev_p->context[i];
if (!cy_as_hal_destroy_sleep_channel(&ctxt_p->channel))
- return CY_AS_ERROR_DESTROY_SLEEP_CHANNEL_FAILED ;
+ return CY_AS_ERROR_DESTROY_SLEEP_CHANNEL_FAILED;
/*
* now, free any queued requests and assocaited responses
*/
while (ctxt_p->request_queue_p) {
- uint32_t state ;
+ uint32_t state;
cy_as_ll_request_list_node *node_p =
- ctxt_p->request_queue_p ;
+ ctxt_p->request_queue_p;
/* Mark this pair as in a cancel operation */
cy_as_request_set_node_state(node_p,
- CY_AS_REQUEST_LIST_STATE_CANCELING) ;
+ CY_AS_REQUEST_LIST_STATE_CANCELING);
/* Tell the caller that we are canceling this request */
/* NB: The callback is responsible for destroying the
@@ -520,27 +520,27 @@ cy_as_ll_stop(cy_as_device *dev_p)
* contents of these two after calling the callback.
*/
node_p->callback(dev_p, i, node_p->rqt,
- node_p->resp, CY_AS_ERROR_CANCELED) ;
+ node_p->resp, CY_AS_ERROR_CANCELED);
/* Remove the pair from the queue */
- mask = cy_as_hal_disable_interrupts() ;
- ctxt_p->request_queue_p = node_p->next ;
- cy_as_hal_enable_interrupts(mask) ;
+ mask = cy_as_hal_disable_interrupts();
+ ctxt_p->request_queue_p = node_p->next;
+ cy_as_hal_enable_interrupts(mask);
/* Free the list node */
- state = cy_as_hal_disable_interrupts() ;
- cy_as_hal_c_b_free(node_p) ;
- cy_as_hal_enable_interrupts(state) ;
+ state = cy_as_hal_disable_interrupts();
+ cy_as_hal_c_b_free(node_p);
+ cy_as_hal_enable_interrupts(state);
}
- cy_as_ll_destroy_request(dev_p, dev_p->context[i]->req_p) ;
- cy_as_hal_free(dev_p->context[i]) ;
- dev_p->context[i] = 0 ;
+ cy_as_ll_destroy_request(dev_p, dev_p->context[i]->req_p);
+ cy_as_hal_free(dev_p->context[i]);
+ dev_p->context[i] = 0;
}
- cy_as_device_set_low_level_stopped(dev_p) ;
+ cy_as_device_set_low_level_stopped(dev_p);
- return ret ;
+ return ret;
}
void
@@ -548,13 +548,13 @@ cy_as_ll_init_request(cy_as_ll_request_response *req_p,
uint16_t code, uint16_t context, uint16_t length)
{
uint16_t totallen = sizeof(cy_as_ll_request_response) +
- (length - 1) * sizeof(uint16_t) ;
+ (length - 1) * sizeof(uint16_t);
- cy_as_hal_mem_set(req_p, 0, totallen) ;
- req_p->length = length ;
- cy_as_ll_request_response__set_code(req_p, code) ;
- cy_as_ll_request_response__set_context(req_p, context) ;
- cy_as_ll_request_response__set_request(req_p) ;
+ cy_as_hal_mem_set(req_p, 0, totallen);
+ req_p->length = length;
+ cy_as_ll_request_response__set_code(req_p, code);
+ cy_as_ll_request_response__set_context(req_p, context);
+ cy_as_ll_request_response__set_request(req_p);
}
/*
@@ -564,20 +564,20 @@ cy_as_ll_request_response *
cy_as_ll_create_request(cy_as_device *dev_p, uint16_t code,
uint8_t context, uint16_t length)
{
- cy_as_ll_request_response *req_p ;
- uint32_t state ;
+ cy_as_ll_request_response *req_p;
+ uint32_t state;
uint16_t totallen = sizeof(cy_as_ll_request_response) +
- (length - 1) * sizeof(uint16_t) ;
+ (length - 1) * sizeof(uint16_t);
- (void)dev_p ;
+ (void)dev_p;
- state = cy_as_hal_disable_interrupts() ;
- req_p = cy_as_hal_c_b_alloc(totallen) ;
- cy_as_hal_enable_interrupts(state) ;
+ state = cy_as_hal_disable_interrupts();
+ req_p = cy_as_hal_c_b_alloc(totallen);
+ cy_as_hal_enable_interrupts(state);
if (req_p)
- cy_as_ll_init_request(req_p, code, context, length) ;
+ cy_as_ll_init_request(req_p, code, context, length);
- return req_p ;
+ return req_p;
}
/*
@@ -586,13 +586,13 @@ cy_as_ll_create_request(cy_as_device *dev_p, uint16_t code,
void
cy_as_ll_destroy_request(cy_as_device *dev_p, cy_as_ll_request_response *req_p)
{
- uint32_t state ;
- (void)dev_p ;
- (void)req_p ;
+ uint32_t state;
+ (void)dev_p;
+ (void)req_p;
- state = cy_as_hal_disable_interrupts() ;
- cy_as_hal_c_b_free(req_p) ;
- cy_as_hal_enable_interrupts(state) ;
+ state = cy_as_hal_disable_interrupts();
+ cy_as_hal_c_b_free(req_p);
+ cy_as_hal_enable_interrupts(state);
}
@@ -600,11 +600,11 @@ void
cy_as_ll_init_response(cy_as_ll_request_response *req_p, uint16_t length)
{
uint16_t totallen = sizeof(cy_as_ll_request_response) +
- (length - 1) * sizeof(uint16_t) ;
+ (length - 1) * sizeof(uint16_t);
- cy_as_hal_mem_set(req_p, 0, totallen) ;
- req_p->length = length ;
- cy_as_ll_request_response__set_response(req_p) ;
+ cy_as_hal_mem_set(req_p, 0, totallen);
+ req_p->length = length;
+ cy_as_ll_request_response__set_response(req_p);
}
/*
@@ -613,20 +613,20 @@ cy_as_ll_init_response(cy_as_ll_request_response *req_p, uint16_t length)
cy_as_ll_request_response *
cy_as_ll_create_response(cy_as_device *dev_p, uint16_t length)
{
- cy_as_ll_request_response *req_p ;
- uint32_t state ;
+ cy_as_ll_request_response *req_p;
+ uint32_t state;
uint16_t totallen = sizeof(cy_as_ll_request_response) +
- (length - 1) * sizeof(uint16_t) ;
+ (length - 1) * sizeof(uint16_t);
- (void)dev_p ;
+ (void)dev_p;
- state = cy_as_hal_disable_interrupts() ;
- req_p = cy_as_hal_c_b_alloc(totallen) ;
- cy_as_hal_enable_interrupts(state) ;
+ state = cy_as_hal_disable_interrupts();
+ req_p = cy_as_hal_c_b_alloc(totallen);
+ cy_as_hal_enable_interrupts(state);
if (req_p)
- cy_as_ll_init_response(req_p, length) ;
+ cy_as_ll_init_response(req_p, length);
- return req_p ;
+ return req_p;
}
/*
@@ -635,21 +635,21 @@ cy_as_ll_create_response(cy_as_device *dev_p, uint16_t length)
void
cy_as_ll_destroy_response(cy_as_device *dev_p, cy_as_ll_request_response *req_p)
{
- uint32_t state ;
- (void)dev_p ;
- (void)req_p ;
+ uint32_t state;
+ (void)dev_p;
+ (void)req_p;
- state = cy_as_hal_disable_interrupts() ;
- cy_as_hal_c_b_free(req_p) ;
- cy_as_hal_enable_interrupts(state) ;
+ state = cy_as_hal_disable_interrupts();
+ cy_as_hal_c_b_free(req_p);
+ cy_as_hal_enable_interrupts(state);
}
static uint16_t
cy_as_read_intr_status(
cy_as_device *dev_p)
{
- uint32_t mask ;
- cy_bool bloop = cy_true ;
+ uint32_t mask;
+ cy_bool bloop = cy_true;
uint16_t v = 0, last = 0xffff;
/*
@@ -664,15 +664,15 @@ cy_as_read_intr_status(
* here and have the interrupt routine try to read this data
* as well.
*/
- mask = cy_as_hal_disable_interrupts() ;
+ mask = cy_as_hal_disable_interrupts();
/*
* see if there is data to be read.
*/
- v = cy_as_hal_read_register(dev_p->tag, CY_AS_MEM_P0_INTR_REG) ;
+ v = cy_as_hal_read_register(dev_p->tag, CY_AS_MEM_P0_INTR_REG);
if ((v & CY_AS_MEM_P0_INTR_REG_MBINT) == 0) {
- cy_as_hal_enable_interrupts(mask) ;
- break ;
+ cy_as_hal_enable_interrupts(mask);
+ break;
}
/*
@@ -680,30 +680,30 @@ cy_as_read_intr_status(
* this allows the firmware to move forward and
* service the requst from the P port.
*/
- cy_as_ll_queue_mailbox_data(dev_p) ;
+ cy_as_ll_queue_mailbox_data(dev_p);
/*
* enable interrupts again to service mailbox
* interrupts appropriately
*/
- cy_as_hal_enable_interrupts(mask) ;
+ cy_as_hal_enable_interrupts(mask);
}
/*
* now, all data is received
*/
last = cy_as_hal_read_register(dev_p->tag,
- CY_AS_MEM_MCU_MB_STAT) & CY_AS_MEM_P0_MCU_MBNOTRD ;
+ CY_AS_MEM_MCU_MB_STAT) & CY_AS_MEM_P0_MCU_MBNOTRD;
while (bloop) {
v = cy_as_hal_read_register(dev_p->tag,
- CY_AS_MEM_MCU_MB_STAT) & CY_AS_MEM_P0_MCU_MBNOTRD ;
+ CY_AS_MEM_MCU_MB_STAT) & CY_AS_MEM_P0_MCU_MBNOTRD;
if (v == last)
- break ;
+ break;
- last = v ;
+ last = v;
}
- return v ;
+ return v;
}
/*
@@ -716,50 +716,50 @@ cy_as_send_one(
cy_as_device *dev_p,
cy_as_ll_request_response *req_p)
{
- int i ;
- uint16_t mb0, v ;
- int32_t loopcount ;
- uint32_t int_stat ;
+ int i;
+ uint16_t mb0, v;
+ int32_t loopcount;
+ uint32_t int_stat;
#ifdef _DEBUG
if (cy_as_ll_request_response__is_request(req_p)) {
switch (cy_as_ll_request_response__get_context(req_p)) {
case CY_RQT_GENERAL_RQT_CONTEXT:
cy_as_hal_assert(req_p->length * 2 + 2 <
- CY_CTX_GEN_MAX_DATA_SIZE) ;
- break ;
+ CY_CTX_GEN_MAX_DATA_SIZE);
+ break;
case CY_RQT_RESOURCE_RQT_CONTEXT:
cy_as_hal_assert(req_p->length * 2 + 2 <
- CY_CTX_RES_MAX_DATA_SIZE) ;
- break ;
+ CY_CTX_RES_MAX_DATA_SIZE);
+ break;
case CY_RQT_STORAGE_RQT_CONTEXT:
cy_as_hal_assert(req_p->length * 2 + 2 <
- CY_CTX_STR_MAX_DATA_SIZE) ;
- break ;
+ CY_CTX_STR_MAX_DATA_SIZE);
+ break;
case CY_RQT_USB_RQT_CONTEXT:
cy_as_hal_assert(req_p->length * 2 + 2 <
- CY_CTX_USB_MAX_DATA_SIZE) ;
- break ;
+ CY_CTX_USB_MAX_DATA_SIZE);
+ break;
}
}
#endif
/* Write the request to the mail box registers */
if (req_p->length > 3) {
- uint16_t length = req_p->length ;
- int which = 0 ;
- int st = 1 ;
+ uint16_t length = req_p->length;
+ int which = 0;
+ int st = 1;
- dev_p->ll_sending_rqt = cy_true ;
+ dev_p->ll_sending_rqt = cy_true;
while (which < length) {
- loopcount = cy_as_low_level_timeout_count ;
+ loopcount = cy_as_low_level_timeout_count;
do {
- v = cy_as_read_intr_status(dev_p) ;
+ v = cy_as_read_intr_status(dev_p);
- } while (v && loopcount-- > 0) ;
+ } while (v && loopcount-- > 0);
if (v) {
cy_as_hal_print_message(
@@ -772,17 +772,17 @@ cy_as_send_one(
cy_as_hal_read_register(dev_p->tag,
CY_AS_MEM_MCU_MAILBOX2),
cy_as_hal_read_register(dev_p->tag,
- CY_AS_MEM_MCU_MAILBOX3)) ;
- return CY_AS_ERROR_TIMEOUT ;
+ CY_AS_MEM_MCU_MAILBOX3));
+ return CY_AS_ERROR_TIMEOUT;
}
if (dev_p->ll_abort_curr_rqt) {
- dev_p->ll_sending_rqt = cy_false ;
- dev_p->ll_abort_curr_rqt = cy_false ;
- return CY_AS_ERROR_CANCELED ;
+ dev_p->ll_sending_rqt = cy_false;
+ dev_p->ll_abort_curr_rqt = cy_false;
+ return CY_AS_ERROR_CANCELED;
}
- int_stat = cy_as_hal_disable_interrupts() ;
+ int_stat = cy_as_hal_disable_interrupts();
/*
* check again whether the mailbox is free.
@@ -792,18 +792,18 @@ cy_as_send_one(
*/
v = cy_as_hal_read_register(dev_p->tag,
CY_AS_MEM_MCU_MB_STAT) &
- CY_AS_MEM_P0_MCU_MBNOTRD ;
+ CY_AS_MEM_P0_MCU_MBNOTRD;
if (v) {
/* Go back to the original check since
* the mailbox is not free. */
- cy_as_hal_enable_interrupts(int_stat) ;
- continue ;
+ cy_as_hal_enable_interrupts(int_stat);
+ continue;
}
if (which == 0) {
cy_as_hal_write_register(dev_p->tag,
- CY_AS_MEM_MCU_MAILBOX1, length) ;
- st = 2 ;
+ CY_AS_MEM_MCU_MAILBOX1, length);
+ st = 2;
} else {
st = 1;
}
@@ -812,29 +812,29 @@ cy_as_send_one(
cy_as_hal_write_register(dev_p->tag,
cy_cast_int2U_int16
(CY_AS_MEM_MCU_MAILBOX0 + st),
- req_p->data[which++]) ;
- st++ ;
+ req_p->data[which++]);
+ st++;
}
- mb0 = req_p->box0 ;
+ mb0 = req_p->box0;
if (which == length) {
- dev_p->ll_sending_rqt = cy_false ;
- mb0 |= CY_AS_REQUEST_RESPONSE_LAST_MASK ;
+ dev_p->ll_sending_rqt = cy_false;
+ mb0 |= CY_AS_REQUEST_RESPONSE_LAST_MASK;
}
if (dev_p->ll_abort_curr_rqt) {
- dev_p->ll_sending_rqt = cy_false ;
- dev_p->ll_abort_curr_rqt = cy_false ;
- cy_as_hal_enable_interrupts(int_stat) ;
- return CY_AS_ERROR_CANCELED ;
+ dev_p->ll_sending_rqt = cy_false;
+ dev_p->ll_abort_curr_rqt = cy_false;
+ cy_as_hal_enable_interrupts(int_stat);
+ return CY_AS_ERROR_CANCELED;
}
cy_as_hal_write_register(dev_p->tag,
- CY_AS_MEM_MCU_MAILBOX0, mb0) ;
+ CY_AS_MEM_MCU_MAILBOX0, mb0);
/* Wait for the MBOX interrupt to be high */
- cy_as_hal_sleep150() ;
- cy_as_hal_enable_interrupts(int_stat) ;
+ cy_as_hal_sleep150();
+ cy_as_hal_enable_interrupts(int_stat);
}
} else {
check_mailbox_availability:
@@ -844,11 +844,11 @@ check_mailbox_availability:
* to accept requests at interrupt time and queue them for
* future processing.
*/
- loopcount = cy_as_low_level_timeout_count ;
+ loopcount = cy_as_low_level_timeout_count;
do {
- v = cy_as_read_intr_status(dev_p) ;
+ v = cy_as_read_intr_status(dev_p);
- } while (v && loopcount-- > 0) ;
+ } while (v && loopcount-- > 0);
if (v) {
cy_as_hal_print_message(
@@ -860,8 +860,8 @@ check_mailbox_availability:
cy_as_hal_read_register(dev_p->tag,
CY_AS_MEM_MCU_MAILBOX2),
cy_as_hal_read_register(dev_p->tag,
- CY_AS_MEM_MCU_MAILBOX3)) ;
- return CY_AS_ERROR_TIMEOUT ;
+ CY_AS_MEM_MCU_MAILBOX3));
+ return CY_AS_ERROR_TIMEOUT;
}
int_stat = cy_as_hal_disable_interrupts();
@@ -872,31 +872,31 @@ check_mailbox_availability:
* mailboxes since we last checked the status.
*/
v = cy_as_hal_read_register(dev_p->tag, CY_AS_MEM_MCU_MB_STAT) &
- CY_AS_MEM_P0_MCU_MBNOTRD ;
+ CY_AS_MEM_P0_MCU_MBNOTRD;
if (v) {
/* Go back to the original check
* since the mailbox is not free. */
- cy_as_hal_enable_interrupts(int_stat) ;
- goto check_mailbox_availability ;
+ cy_as_hal_enable_interrupts(int_stat);
+ goto check_mailbox_availability;
}
/* Write the data associated with the request
* into the mbox registers 1 - 3 */
- v = 0 ;
- for (i = req_p->length - 1 ; i >= 0 ; i--)
+ v = 0;
+ for (i = req_p->length - 1; i >= 0; i--)
cy_as_hal_write_register(dev_p->tag,
cy_cast_int2U_int16(CY_AS_MEM_MCU_MAILBOX1 + i),
- req_p->data[i]) ;
+ req_p->data[i]);
/* Write the mbox register 0 to trigger the interrupt */
cy_as_hal_write_register(dev_p->tag, CY_AS_MEM_MCU_MAILBOX0,
- req_p->box0 | CY_AS_REQUEST_RESPONSE_LAST_MASK) ;
+ req_p->box0 | CY_AS_REQUEST_RESPONSE_LAST_MASK);
- cy_as_hal_sleep150() ;
+ cy_as_hal_sleep150();
cy_as_hal_enable_interrupts(int_stat);
}
- return CY_AS_ERROR_SUCCESS ;
+ return CY_AS_ERROR_SUCCESS;
}
/*
@@ -916,57 +916,57 @@ cy_as_ll_send_request(
cy_as_response_callback cb
)
{
- cy_as_context *ctxt_p ;
- uint16_t box0 = req->box0 ;
- uint8_t context ;
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
- cy_as_ll_request_list_node *node_p ;
- uint32_t mask, state ;
+ cy_as_context *ctxt_p;
+ uint16_t box0 = req->box0;
+ uint8_t context;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
+ cy_as_ll_request_list_node *node_p;
+ uint32_t mask, state;
cy_as_hal_assert(dev_p->sig == CY_AS_DEVICE_HANDLE_SIGNATURE);
- context = cy_as_mbox_get_context(box0) ;
- cy_as_hal_assert(context < CY_RQT_CONTEXT_COUNT) ;
- ctxt_p = dev_p->context[context] ;
+ context = cy_as_mbox_get_context(box0);
+ cy_as_hal_assert(context < CY_RQT_CONTEXT_COUNT);
+ ctxt_p = dev_p->context[context];
/* Allocate the list node */
- state = cy_as_hal_disable_interrupts() ;
- node_p = cy_as_hal_c_b_alloc(sizeof(cy_as_ll_request_list_node)) ;
- cy_as_hal_enable_interrupts(state) ;
+ state = cy_as_hal_disable_interrupts();
+ node_p = cy_as_hal_c_b_alloc(sizeof(cy_as_ll_request_list_node));
+ cy_as_hal_enable_interrupts(state);
if (node_p == 0)
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ return CY_AS_ERROR_OUT_OF_MEMORY;
/* Initialize the list node */
- node_p->callback = cb ;
- node_p->length = 0 ;
- node_p->next = 0 ;
- node_p->resp = resp ;
- node_p->rqt = req ;
- node_p->state = CY_AS_REQUEST_LIST_STATE_QUEUED ;
+ node_p->callback = cb;
+ node_p->length = 0;
+ node_p->next = 0;
+ node_p->resp = resp;
+ node_p->rqt = req;
+ node_p->state = CY_AS_REQUEST_LIST_STATE_QUEUED;
if (sync)
- cy_as_request_node_set_sync(node_p) ;
+ cy_as_request_node_set_sync(node_p);
/* Put the request into the queue */
- mask = cy_as_hal_disable_interrupts() ;
+ mask = cy_as_hal_disable_interrupts();
if (ctxt_p->request_queue_p == 0) {
/* Empty queue */
- ctxt_p->request_queue_p = node_p ;
- ctxt_p->last_node_p = node_p ;
+ ctxt_p->request_queue_p = node_p;
+ ctxt_p->last_node_p = node_p;
} else {
- ctxt_p->last_node_p->next = node_p ;
- ctxt_p->last_node_p = node_p ;
+ ctxt_p->last_node_p->next = node_p;
+ ctxt_p->last_node_p = node_p;
}
- cy_as_hal_enable_interrupts(mask) ;
- cy_as_ll_send_next_request(dev_p, ctxt_p) ;
+ cy_as_hal_enable_interrupts(mask);
+ cy_as_ll_send_next_request(dev_p, ctxt_p);
if (!cy_as_device_is_in_callback(dev_p)) {
- mask = cy_as_hal_disable_interrupts() ;
- cy_as_mail_box_queued_data_handler(dev_p) ;
- cy_as_hal_enable_interrupts(mask) ;
+ mask = cy_as_hal_disable_interrupts();
+ cy_as_mail_box_queued_data_handler(dev_p);
+ cy_as_hal_enable_interrupts(mask);
}
- return ret ;
+ return ret;
}
static void
@@ -977,22 +977,22 @@ cy_as_ll_send_callback(
cy_as_ll_request_response *resp,
cy_as_return_status_t ret)
{
- (void)rqt ;
- (void)resp ;
- (void)ret ;
+ (void)rqt;
+ (void)resp;
+ (void)ret;
- cy_as_hal_assert(dev_p->sig == CY_AS_DEVICE_HANDLE_SIGNATURE) ;
+ cy_as_hal_assert(dev_p->sig == CY_AS_DEVICE_HANDLE_SIGNATURE);
/*
* storage the state to return to the caller
*/
- dev_p->ll_error = ret ;
+ dev_p->ll_error = ret;
/*
* now wake the caller
*/
- cy_as_hal_wake(&dev_p->context[context]->channel) ;
+ cy_as_hal_wake(&dev_p->context[context]->channel);
}
cy_as_return_status_t
@@ -1005,22 +1005,22 @@ cy_as_ll_send_request_wait_reply(
cy_as_ll_request_response *resp
)
{
- cy_as_return_status_t ret ;
- uint8_t context ;
+ cy_as_return_status_t ret;
+ uint8_t context;
/* Larger 8 sec time-out to handle the init
* delay for slower storage devices in USB FS. */
- uint32_t loopcount = 800 ;
- cy_as_context *ctxt_p ;
+ uint32_t loopcount = 800;
+ cy_as_context *ctxt_p;
/* Get the context for the request */
- context = cy_as_ll_request_response__get_context(req) ;
- cy_as_hal_assert(context < CY_RQT_CONTEXT_COUNT) ;
- ctxt_p = dev_p->context[context] ;
+ context = cy_as_ll_request_response__get_context(req);
+ cy_as_hal_assert(context < CY_RQT_CONTEXT_COUNT);
+ ctxt_p = dev_p->context[context];
ret = cy_as_ll_send_request(dev_p, req, resp,
- cy_true, cy_as_ll_send_callback) ;
+ cy_true, cy_as_ll_send_callback);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
while (loopcount-- > 0) {
/*
@@ -1029,7 +1029,7 @@ cy_as_ll_send_request_wait_reply(
* tries) before we timeout. note if the reply arrives, we will
* not sleep the entire 10 ms, just til the reply arrives.
*/
- cy_as_hal_sleep_on(&ctxt_p->channel, 10) ;
+ cy_as_hal_sleep_on(&ctxt_p->channel, 10);
/*
* if the request has left the queue, it means the request has
@@ -1037,13 +1037,13 @@ cy_as_ll_send_request_wait_reply(
* return to the caller and be sure the reply has been received.
*/
if (!cy_as_ll_is_in_queue(ctxt_p, req))
- return dev_p->ll_error ;
+ return dev_p->ll_error;
}
/* Remove the QueueListNode for this request. */
- cy_as_ll_remove_request(dev_p, ctxt_p, req, cy_true) ;
+ cy_as_ll_remove_request(dev_p, ctxt_p, req, cy_true);
- return CY_AS_ERROR_TIMEOUT ;
+ return CY_AS_ERROR_TIMEOUT;
}
cy_as_return_status_t
@@ -1052,12 +1052,12 @@ cy_as_ll_register_request_callback(
uint8_t context,
cy_as_response_callback cb)
{
- cy_as_context *ctxt_p ;
- cy_as_hal_assert(context < CY_RQT_CONTEXT_COUNT) ;
- ctxt_p = dev_p->context[context] ;
+ cy_as_context *ctxt_p;
+ cy_as_hal_assert(context < CY_RQT_CONTEXT_COUNT);
+ ctxt_p = dev_p->context[context];
- ctxt_p->request_callback = cb ;
- return CY_AS_ERROR_SUCCESS ;
+ ctxt_p->request_callback = cb;
+ return CY_AS_ERROR_SUCCESS;
}
void
@@ -1067,20 +1067,20 @@ cy_as_ll_request_response__pack(
uint32_t length,
void *data_p)
{
- uint16_t dt ;
- uint8_t *dp = (uint8_t *)data_p ;
+ uint16_t dt;
+ uint8_t *dp = (uint8_t *)data_p;
while (length > 1) {
- dt = ((*dp++) << 8) ;
- dt |= (*dp++) ;
- cy_as_ll_request_response__set_word(req_p, offset, dt) ;
- offset++ ;
- length -= 2 ;
+ dt = ((*dp++) << 8);
+ dt |= (*dp++);
+ cy_as_ll_request_response__set_word(req_p, offset, dt);
+ offset++;
+ length -= 2;
}
if (length == 1) {
- dt = (*dp << 8) ;
- cy_as_ll_request_response__set_word(req_p, offset, dt) ;
+ dt = (*dp << 8);
+ cy_as_ll_request_response__set_word(req_p, offset, dt);
}
}
@@ -1091,16 +1091,16 @@ cy_as_ll_request_response__unpack(
uint32_t length,
void *data_p)
{
- uint8_t *dp = (uint8_t *)data_p ;
+ uint8_t *dp = (uint8_t *)data_p;
while (length-- > 0) {
uint16_t val = cy_as_ll_request_response__get_word
- (req_p, offset++) ;
- *dp++ = (uint8_t)((val >> 8) & 0xff) ;
+ (req_p, offset++);
+ *dp++ = (uint8_t)((val >> 8) & 0xff);
if (length) {
- length-- ;
- *dp++ = (uint8_t)(val & 0xff) ;
+ length--;
+ *dp++ = (uint8_t)(val & 0xff);
}
}
}
@@ -1112,24 +1112,24 @@ cy_as_ll_send_status_response(
uint16_t code,
uint8_t clear_storage)
{
- cy_as_return_status_t ret ;
- cy_as_ll_request_response resp ;
- cy_as_ll_request_response *resp_p = &resp ;
+ cy_as_return_status_t ret;
+ cy_as_ll_request_response resp;
+ cy_as_ll_request_response *resp_p = &resp;
- cy_as_hal_mem_set(resp_p, 0, sizeof(resp)) ;
- resp_p->length = 1 ;
- cy_as_ll_request_response__set_response(resp_p) ;
- cy_as_ll_request_response__set_context(resp_p, context) ;
+ cy_as_hal_mem_set(resp_p, 0, sizeof(resp));
+ resp_p->length = 1;
+ cy_as_ll_request_response__set_response(resp_p);
+ cy_as_ll_request_response__set_context(resp_p, context);
if (clear_storage)
- cy_as_ll_request_response__set_clear_storage_flag(resp_p) ;
+ cy_as_ll_request_response__set_clear_storage_flag(resp_p);
- cy_as_ll_request_response__set_code(resp_p, CY_RESP_SUCCESS_FAILURE) ;
- cy_as_ll_request_response__set_word(resp_p, 0, code) ;
+ cy_as_ll_request_response__set_code(resp_p, CY_RESP_SUCCESS_FAILURE);
+ cy_as_ll_request_response__set_word(resp_p, 0, code);
- ret = cy_as_send_one(dev_p, resp_p) ;
+ ret = cy_as_send_one(dev_p, resp_p);
- return ret ;
+ return ret;
}
extern cy_as_return_status_t
@@ -1140,90 +1140,90 @@ cy_as_ll_send_data_response(
uint16_t length,
void *data)
{
- cy_as_ll_request_response *resp_p ;
- uint16_t wlen ;
- uint8_t respbuf[256] ;
+ cy_as_ll_request_response *resp_p;
+ uint16_t wlen;
+ uint8_t respbuf[256];
if (length > 192)
- return CY_AS_ERROR_INVALID_SIZE ;
+ return CY_AS_ERROR_INVALID_SIZE;
/* Word length for bytes */
- wlen = length / 2 ;
+ wlen = length / 2;
/* If byte length odd, add one more */
if (length % 2)
- wlen++ ;
+ wlen++;
/* One for the length of field */
- wlen++ ;
+ wlen++;
- resp_p = (cy_as_ll_request_response *)respbuf ;
- cy_as_hal_mem_set(resp_p, 0, sizeof(respbuf)) ;
- resp_p->length = wlen ;
- cy_as_ll_request_response__set_context(resp_p, context) ;
- cy_as_ll_request_response__set_code(resp_p, code) ;
+ resp_p = (cy_as_ll_request_response *)respbuf;
+ cy_as_hal_mem_set(resp_p, 0, sizeof(respbuf));
+ resp_p->length = wlen;
+ cy_as_ll_request_response__set_context(resp_p, context);
+ cy_as_ll_request_response__set_code(resp_p, code);
- cy_as_ll_request_response__set_word(resp_p, 0, length) ;
- cy_as_ll_request_response__pack(resp_p, 1, length, data) ;
+ cy_as_ll_request_response__set_word(resp_p, 0, length);
+ cy_as_ll_request_response__pack(resp_p, 1, length, data);
- return cy_as_send_one(dev_p, resp_p) ;
+ return cy_as_send_one(dev_p, resp_p);
}
static cy_bool
cy_as_ll_is_e_p_transfer_related_request(cy_as_ll_request_response *rqt_p,
cy_as_end_point_number_t ep)
{
- uint16_t v ;
- uint8_t type = cy_as_ll_request_response__get_code(rqt_p) ;
+ uint16_t v;
+ uint8_t type = cy_as_ll_request_response__get_code(rqt_p);
if (cy_as_ll_request_response__get_context(rqt_p) !=
CY_RQT_USB_RQT_CONTEXT)
- return cy_false ;
+ return cy_false;
/*
* when cancelling outstanding EP0 data transfers, any pending
* setup ACK requests also need to be cancelled.
*/
if ((ep == 0) && (type == CY_RQT_ACK_SETUP_PACKET))
- return cy_true ;
+ return cy_true;
if (type != CY_RQT_USB_EP_DATA)
- return cy_false ;
+ return cy_false;
- v = cy_as_ll_request_response__get_word(rqt_p, 0) ;
+ v = cy_as_ll_request_response__get_word(rqt_p, 0);
if ((cy_as_end_point_number_t)((v >> 13) & 1) != ep)
- return cy_false ;
+ return cy_false;
- return cy_true ;
+ return cy_true;
}
cy_as_return_status_t
cy_as_ll_remove_ep_data_requests(cy_as_device *dev_p,
cy_as_end_point_number_t ep)
{
- cy_as_context *ctxt_p ;
- cy_as_ll_request_list_node *node_p ;
- uint32_t imask ;
+ cy_as_context *ctxt_p;
+ cy_as_ll_request_list_node *node_p;
+ uint32_t imask;
/*
* first, remove any queued requests
*/
- ctxt_p = dev_p->context[CY_RQT_USB_RQT_CONTEXT] ;
+ ctxt_p = dev_p->context[CY_RQT_USB_RQT_CONTEXT];
if (ctxt_p) {
for (node_p = ctxt_p->request_queue_p; node_p;
node_p = node_p->next) {
if (cy_as_ll_is_e_p_transfer_related_request
(node_p->rqt, ep)) {
cy_as_ll_remove_request(dev_p, ctxt_p,
- node_p->rqt, cy_false) ;
- break ;
+ node_p->rqt, cy_false);
+ break;
}
}
/*
* now, deal with any request that may be in transit
*/
- imask = cy_as_hal_disable_interrupts() ;
+ imask = cy_as_hal_disable_interrupts();
if (ctxt_p->request_queue_p != 0 &&
cy_as_ll_is_e_p_transfer_related_request
@@ -1231,7 +1231,7 @@ cy_as_ll_remove_ep_data_requests(cy_as_device *dev_p,
cy_as_request_get_node_state(ctxt_p->request_queue_p) ==
CY_AS_REQUEST_LIST_STATE_WAITING) {
cy_as_hal_print_message("need to remove an in-transit "
- "request to antioch\n") ;
+ "request to antioch\n");
/*
* if the request has not been fully sent to west bridge
@@ -1240,25 +1240,25 @@ cy_as_ll_remove_ep_data_requests(cy_as_device *dev_p,
* terminated this transfer.
*/
if (dev_p->ll_sending_rqt)
- dev_p->ll_abort_curr_rqt = cy_true ;
+ dev_p->ll_abort_curr_rqt = cy_true;
else {
- uint32_t state ;
+ uint32_t state;
- node_p = ctxt_p->request_queue_p ;
+ node_p = ctxt_p->request_queue_p;
if (node_p->callback)
node_p->callback(dev_p, ctxt_p->number,
node_p->rqt, node_p->resp,
- CY_AS_ERROR_CANCELED) ;
+ CY_AS_ERROR_CANCELED);
- ctxt_p->request_queue_p = node_p->next ;
- state = cy_as_hal_disable_interrupts() ;
- cy_as_hal_c_b_free(node_p) ;
- cy_as_hal_enable_interrupts(state) ;
+ ctxt_p->request_queue_p = node_p->next;
+ state = cy_as_hal_disable_interrupts();
+ cy_as_hal_c_b_free(node_p);
+ cy_as_hal_enable_interrupts(state);
}
}
- cy_as_hal_enable_interrupts(imask) ;
+ cy_as_hal_enable_interrupts(imask);
}
- return CY_AS_ERROR_SUCCESS ;
+ return CY_AS_ERROR_SUCCESS;
}
diff --git a/drivers/staging/westbridge/astoria/api/src/cyasmisc.c b/drivers/staging/westbridge/astoria/api/src/cyasmisc.c
index 7c1c945873d..10a52a1ac6f 100644
--- a/drivers/staging/westbridge/astoria/api/src/cyasmisc.c
+++ b/drivers/staging/westbridge/astoria/api/src/cyasmisc.c
@@ -45,7 +45,7 @@ static uint8_t debug_level;
void
cy_as_misc_set_log_level(uint8_t level)
{
- debug_level = level ;
+ debug_level = level;
}
#ifdef CY_AS_LOG_SUPPORT
@@ -57,7 +57,7 @@ void
cy_as_log_debug_message(int level, const char *str)
{
if (level <= debug_level)
- cy_as_hal_print_message("log %d: %s\n", level, str) ;
+ cy_as_hal_print_message("log %d: %s\n", level, str);
}
#endif
@@ -66,27 +66,27 @@ cy_as_log_debug_message(int level, const char *str)
{\
if (!(dev_p) || ((dev_p)->sig != \
CY_AS_DEVICE_HANDLE_SIGNATURE)) \
- return CY_AS_ERROR_INVALID_HANDLE ; \
+ return CY_AS_ERROR_INVALID_HANDLE; \
\
if (!cy_as_device_is_configured(dev_p)) \
- return CY_AS_ERROR_NOT_CONFIGURED ; \
+ return CY_AS_ERROR_NOT_CONFIGURED; \
\
if (!cy_as_device_is_firmware_loaded(dev_p))\
- return CY_AS_ERROR_NO_FIRMWARE ; \
+ return CY_AS_ERROR_NO_FIRMWARE; \
}
/* Find an West Bridge device based on a TAG */
cy_as_device *
cy_as_device_find_from_tag(cy_as_hal_device_tag tag)
{
- cy_as_device *dev_p ;
+ cy_as_device *dev_p;
for (dev_p = g_device_list; dev_p != 0; dev_p = dev_p->next_p) {
if (dev_p->tag == tag)
- return dev_p ;
+ return dev_p;
}
- return 0 ;
+ return 0;
}
/* Map a pre-V1.2 media type to the V1.2+ bus number */
@@ -95,9 +95,9 @@ cy_as_bus_from_media_type(cy_as_media_type type,
cy_as_bus_number_t *bus)
{
if (type == cy_as_media_nand)
- *bus = 0 ;
+ *bus = 0;
else
- *bus = 1 ;
+ *bus = 1;
}
static cy_as_return_status_t
@@ -105,18 +105,18 @@ my_handle_response_no_data(cy_as_device *dev_p,
cy_as_ll_request_response *req_p,
cy_as_ll_request_response *reply_p)
{
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
if (cy_as_ll_request_response__get_code(reply_p) !=
CY_RESP_SUCCESS_FAILURE)
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
else
- ret = cy_as_ll_request_response__get_word(reply_p, 0) ;
+ ret = cy_as_ll_request_response__get_word(reply_p, 0);
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
- return ret ;
+ return ret;
}
/*
@@ -126,104 +126,104 @@ cy_as_return_status_t
cy_as_misc_create_device(cy_as_device_handle *handle_p,
cy_as_hal_device_tag tag)
{
- cy_as_device *dev_p ;
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
+ cy_as_device *dev_p;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
- cy_as_log_debug_message(6, "cy_as_misc_create_device called") ;
+ cy_as_log_debug_message(6, "cy_as_misc_create_device called");
- dev_p = (cy_as_device *)cy_as_hal_alloc(sizeof(cy_as_device)) ;
+ dev_p = (cy_as_device *)cy_as_hal_alloc(sizeof(cy_as_device));
if (dev_p == 0)
- return CY_AS_ERROR_OUT_OF_MEMORY ;
- cy_as_hal_mem_set(dev_p, 0, sizeof(cy_as_device)) ;
+ return CY_AS_ERROR_OUT_OF_MEMORY;
+ cy_as_hal_mem_set(dev_p, 0, sizeof(cy_as_device));
/*
* dynamically allocating this buffer to ensure that it is
* word aligned.
*/
- dev_p->usb_ep_data = (uint8_t *)cy_as_hal_alloc(64 * sizeof(uint8_t)) ;
+ dev_p->usb_ep_data = (uint8_t *)cy_as_hal_alloc(64 * sizeof(uint8_t));
if (dev_p->usb_ep_data == 0) {
- cy_as_hal_free(dev_p) ;
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ cy_as_hal_free(dev_p);
+ return CY_AS_ERROR_OUT_OF_MEMORY;
}
- dev_p->sig = CY_AS_DEVICE_HANDLE_SIGNATURE ;
- dev_p->tag = tag ;
- dev_p->usb_max_tx_size = 0x40 ;
+ dev_p->sig = CY_AS_DEVICE_HANDLE_SIGNATURE;
+ dev_p->tag = tag;
+ dev_p->usb_max_tx_size = 0x40;
- dev_p->storage_write_endpoint = CY_AS_P2S_WRITE_ENDPOINT ;
- dev_p->storage_read_endpoint = CY_AS_P2S_READ_ENDPOINT ;
+ dev_p->storage_write_endpoint = CY_AS_P2S_WRITE_ENDPOINT;
+ dev_p->storage_read_endpoint = CY_AS_P2S_READ_ENDPOINT;
- dev_p->func_cbs_misc = cy_as_create_c_b_queue(CYAS_FUNC_CB) ;
+ dev_p->func_cbs_misc = cy_as_create_c_b_queue(CYAS_FUNC_CB);
if (dev_p->func_cbs_misc == 0)
- goto destroy ;
+ goto destroy;
- dev_p->func_cbs_res = cy_as_create_c_b_queue(CYAS_FUNC_CB) ;
+ dev_p->func_cbs_res = cy_as_create_c_b_queue(CYAS_FUNC_CB);
if (dev_p->func_cbs_res == 0)
- goto destroy ;
+ goto destroy;
- dev_p->func_cbs_stor = cy_as_create_c_b_queue(CYAS_FUNC_CB) ;
+ dev_p->func_cbs_stor = cy_as_create_c_b_queue(CYAS_FUNC_CB);
if (dev_p->func_cbs_stor == 0)
- goto destroy ;
+ goto destroy;
- dev_p->func_cbs_usb = cy_as_create_c_b_queue(CYAS_FUNC_CB) ;
+ dev_p->func_cbs_usb = cy_as_create_c_b_queue(CYAS_FUNC_CB);
if (dev_p->func_cbs_usb == 0)
- goto destroy ;
+ goto destroy;
- dev_p->func_cbs_mtp = cy_as_create_c_b_queue(CYAS_FUNC_CB) ;
+ dev_p->func_cbs_mtp = cy_as_create_c_b_queue(CYAS_FUNC_CB);
if (dev_p->func_cbs_mtp == 0)
- goto destroy ;
+ goto destroy;
/*
* allocate memory for the DMA module here. it is then marked idle, and
* will be activated when cy_as_misc_configure_device is called.
*/
- ret = cy_as_dma_start(dev_p) ;
+ ret = cy_as_dma_start(dev_p);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
- cy_as_device_set_dma_stopped(dev_p) ;
+ cy_as_device_set_dma_stopped(dev_p);
/*
* allocate memory for the low level module here. this module is also
* activated only when cy_as_misc_configure_device is called.
*/
- ret = cy_as_ll_start(dev_p) ;
+ ret = cy_as_ll_start(dev_p);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
- cy_as_device_set_low_level_stopped(dev_p) ;
+ cy_as_device_set_low_level_stopped(dev_p);
- dev_p->next_p = g_device_list ;
- g_device_list = dev_p ;
+ dev_p->next_p = g_device_list;
+ g_device_list = dev_p;
- *handle_p = dev_p ;
- cy_as_hal_init_dev_registers(tag, cy_false) ;
- return CY_AS_ERROR_SUCCESS ;
+ *handle_p = dev_p;
+ cy_as_hal_init_dev_registers(tag, cy_false);
+ return CY_AS_ERROR_SUCCESS;
destroy:
/* Free any queues that were successfully allocated. */
if (dev_p->func_cbs_misc)
- cy_as_destroy_c_b_queue(dev_p->func_cbs_misc) ;
+ cy_as_destroy_c_b_queue(dev_p->func_cbs_misc);
if (dev_p->func_cbs_res)
- cy_as_destroy_c_b_queue(dev_p->func_cbs_res) ;
+ cy_as_destroy_c_b_queue(dev_p->func_cbs_res);
if (dev_p->func_cbs_stor)
- cy_as_destroy_c_b_queue(dev_p->func_cbs_stor) ;
+ cy_as_destroy_c_b_queue(dev_p->func_cbs_stor);
if (dev_p->func_cbs_usb)
- cy_as_destroy_c_b_queue(dev_p->func_cbs_usb) ;
+ cy_as_destroy_c_b_queue(dev_p->func_cbs_usb);
if (dev_p->func_cbs_mtp)
- cy_as_destroy_c_b_queue(dev_p->func_cbs_mtp) ;
+ cy_as_destroy_c_b_queue(dev_p->func_cbs_mtp);
- cy_as_hal_free(dev_p->usb_ep_data) ;
- cy_as_hal_free(dev_p) ;
+ cy_as_hal_free(dev_p->usb_ep_data);
+ cy_as_hal_free(dev_p);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
else
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ return CY_AS_ERROR_OUT_OF_MEMORY;
}
/*
@@ -232,81 +232,81 @@ destroy:
cy_as_return_status_t
cy_as_misc_destroy_device(cy_as_device_handle handle)
{
- cy_as_return_status_t ret ;
- cy_as_device *dev_p ;
+ cy_as_return_status_t ret;
+ cy_as_device *dev_p;
- cy_as_log_debug_message(6, "cy_as_misc_destroy_device called") ;
+ cy_as_log_debug_message(6, "cy_as_misc_destroy_device called");
- dev_p = (cy_as_device *)handle ;
+ dev_p = (cy_as_device *)handle;
if (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE))
- return CY_AS_ERROR_INVALID_HANDLE ;
+ return CY_AS_ERROR_INVALID_HANDLE;
/*
* if the USB stack is still running,
* it must be stopped first
*/
if (dev_p->usb_count > 0)
- return CY_AS_ERROR_STILL_RUNNING ;
+ return CY_AS_ERROR_STILL_RUNNING;
/*
* if the STORAGE stack is still running,
* it must be stopped first
*/
if (dev_p->storage_count > 0)
- return CY_AS_ERROR_STILL_RUNNING ;
+ return CY_AS_ERROR_STILL_RUNNING;
if (cy_as_device_is_intr_running(dev_p))
- ret = cy_as_intr_stop(dev_p) ;
+ ret = cy_as_intr_stop(dev_p);
- ret = cy_as_ll_stop(dev_p) ;
+ ret = cy_as_ll_stop(dev_p);
if (ret != CY_AS_ERROR_SUCCESS) {
- cy_as_intr_start(dev_p, dev_p->use_int_drq) ;
- return ret ;
+ cy_as_intr_start(dev_p, dev_p->use_int_drq);
+ return ret;
}
- ret = cy_as_dma_stop(dev_p) ;
+ ret = cy_as_dma_stop(dev_p);
if (ret != CY_AS_ERROR_SUCCESS) {
- cy_as_intr_start(dev_p, dev_p->use_int_drq) ;
- return ret ;
+ cy_as_intr_start(dev_p, dev_p->use_int_drq);
+ return ret;
}
/* Reset the West Bridge device. */
cy_as_hal_write_register(dev_p->tag, CY_AS_MEM_RST_CTRL_REG,
- CY_AS_MEM_RST_CTRL_REG_HARD) ;
+ CY_AS_MEM_RST_CTRL_REG_HARD);
/*
* remove the device from the device list
*/
if (g_device_list == dev_p) {
- g_device_list = dev_p->next_p ;
+ g_device_list = dev_p->next_p;
} else {
- cy_as_device *tmp_p = g_device_list ;
+ cy_as_device *tmp_p = g_device_list;
while (tmp_p && tmp_p->next_p != dev_p)
- tmp_p = tmp_p->next_p ;
+ tmp_p = tmp_p->next_p;
- cy_as_hal_assert(tmp_p != 0) ;
- tmp_p->next_p = dev_p->next_p ;
+ cy_as_hal_assert(tmp_p != 0);
+ tmp_p->next_p = dev_p->next_p;
}
/*
* reset the signature so this will not be detected
* as a valid handle
*/
- dev_p->sig = 0 ;
+ dev_p->sig = 0;
- cy_as_destroy_c_b_queue(dev_p->func_cbs_misc) ;
- cy_as_destroy_c_b_queue(dev_p->func_cbs_res) ;
- cy_as_destroy_c_b_queue(dev_p->func_cbs_stor) ;
- cy_as_destroy_c_b_queue(dev_p->func_cbs_usb) ;
- cy_as_destroy_c_b_queue(dev_p->func_cbs_mtp) ;
+ cy_as_destroy_c_b_queue(dev_p->func_cbs_misc);
+ cy_as_destroy_c_b_queue(dev_p->func_cbs_res);
+ cy_as_destroy_c_b_queue(dev_p->func_cbs_stor);
+ cy_as_destroy_c_b_queue(dev_p->func_cbs_usb);
+ cy_as_destroy_c_b_queue(dev_p->func_cbs_mtp);
/*
* free the memory associated with the device
*/
- cy_as_hal_free(dev_p->usb_ep_data) ;
- cy_as_hal_free(dev_p) ;
+ cy_as_hal_free(dev_p->usb_ep_data);
+ cy_as_hal_free(dev_p);
- return CY_AS_ERROR_SUCCESS ;
+ return CY_AS_ERROR_SUCCESS;
}
/*
@@ -330,7 +330,7 @@ cy_as_setup_endian_mode(cy_as_device *dev_p)
* change the endian-ness of west bridge.
*/
cy_as_hal_write_register(dev_p->tag, CY_AS_MEM_P0_ENDIAN,
- CY_AS_LITTLE_ENDIAN) ;
+ CY_AS_LITTLE_ENDIAN);
}
/*
@@ -339,21 +339,21 @@ cy_as_setup_endian_mode(cy_as_device *dev_p)
cy_as_return_status_t
cy_as_misc_in_standby(cy_as_device_handle handle, cy_bool *standby)
{
- cy_as_device *dev_p ;
+ cy_as_device *dev_p;
- cy_as_log_debug_message(6, "cy_as_misc_in_standby called") ;
+ cy_as_log_debug_message(6, "cy_as_misc_in_standby called");
- dev_p = (cy_as_device *)handle ;
+ dev_p = (cy_as_device *)handle;
if (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE))
- return CY_AS_ERROR_INVALID_HANDLE ;
+ return CY_AS_ERROR_INVALID_HANDLE;
if (cy_as_device_is_pin_standby(dev_p) ||
cy_as_device_is_register_standby(dev_p)) {
- *standby = cy_true ;
+ *standby = cy_true;
} else
- *standby = cy_false ;
+ *standby = cy_false;
- return CY_AS_ERROR_SUCCESS ;
+ return CY_AS_ERROR_SUCCESS;
}
static void
@@ -361,7 +361,7 @@ cy_as_misc_func_callback(cy_as_device *dev_p,
uint8_t context,
cy_as_ll_request_response *rqt,
cy_as_ll_request_response *resp,
- cy_as_return_status_t ret) ;
+ cy_as_return_status_t ret);
static void
@@ -370,19 +370,19 @@ my_misc_callback(cy_as_device *dev_p, uint8_t context,
cy_as_ll_request_response *resp_p,
cy_as_return_status_t ret)
{
- (void)resp_p ;
- (void)context ;
- (void)ret ;
+ (void)resp_p;
+ (void)context;
+ (void)ret;
switch (cy_as_ll_request_response__get_code(req_p)) {
case CY_RQT_INITIALIZATION_COMPLETE:
{
- uint16_t v ;
+ uint16_t v;
cy_as_ll_send_status_response(dev_p,
CY_RQT_GENERAL_RQT_CONTEXT,
- CY_AS_ERROR_SUCCESS, 0) ;
- cy_as_device_set_firmware_loaded(dev_p) ;
+ CY_AS_ERROR_SUCCESS, 0);
+ cy_as_device_set_firmware_loaded(dev_p);
if (cy_as_device_is_waking(dev_p)) {
/*
@@ -395,56 +395,56 @@ my_misc_callback(cy_as_device *dev_p, uint8_t context,
if (dev_p->misc_event_cb)
dev_p->misc_event_cb(
(cy_as_device_handle)dev_p,
- cy_as_event_misc_awake, 0) ;
- cy_as_device_clear_waking(dev_p) ;
+ cy_as_event_misc_awake, 0);
+ cy_as_device_clear_waking(dev_p);
} else {
v = cy_as_ll_request_response__get_word
- (req_p, 3) ;
+ (req_p, 3);
/*
* store the media supported on
* each of the device buses.
*/
dev_p->media_supported[0] =
- (uint8_t)(v & 0xFF) ;
+ (uint8_t)(v & 0xFF);
dev_p->media_supported[1] =
- (uint8_t)((v >> 8) & 0xFF) ;
+ (uint8_t)((v >> 8) & 0xFF);
v = cy_as_ll_request_response__get_word
- (req_p, 4) ;
+ (req_p, 4);
dev_p->is_mtp_firmware =
- (cy_bool)((v >> 8) & 0xFF) ;
+ (cy_bool)((v >> 8) & 0xFF);
if (dev_p->misc_event_cb)
dev_p->misc_event_cb(
(cy_as_device_handle)dev_p,
- cy_as_event_misc_initialized, 0) ;
+ cy_as_event_misc_initialized, 0);
}
v = cy_as_hal_read_register(dev_p->tag,
- CY_AS_MEM_P0_VM_SET) ;
+ CY_AS_MEM_P0_VM_SET);
if (v & CY_AS_MEM_P0_VM_SET_CFGMODE)
cy_as_hal_print_message(
"initialization message "
"recieved, but config bit "
- "still set\n") ;
+ "still set\n");
v = cy_as_hal_read_register(dev_p->tag,
- CY_AS_MEM_RST_CTRL_REG) ;
+ CY_AS_MEM_RST_CTRL_REG);
if ((v & CY_AS_MEM_RST_RSTCMPT) == 0)
cy_as_hal_print_message(
"initialization message "
"recieved, but reset complete "
- "bit still not set\n") ;
+ "bit still not set\n");
}
- break ;
+ break;
case CY_RQT_OUT_OF_SUSPEND:
cy_as_ll_send_status_response(dev_p, CY_RQT_GENERAL_RQT_CONTEXT,
- CY_AS_ERROR_SUCCESS, 0) ;
- cy_as_device_clear_suspend_mode(dev_p) ;
+ CY_AS_ERROR_SUCCESS, 0);
+ cy_as_device_clear_suspend_mode(dev_p);
/*
* if the wakeup was caused by an async cy_as_misc_leave_suspend
@@ -452,31 +452,31 @@ my_misc_callback(cy_as_device *dev_p, uint8_t context,
*/
if (dev_p->func_cbs_misc->count > 0) {
cy_as_func_c_b_node *node = (cy_as_func_c_b_node *)
- dev_p->func_cbs_misc->head_p ;
- cy_as_hal_assert(node) ;
+ dev_p->func_cbs_misc->head_p;
+ cy_as_hal_assert(node);
if (cy_as_funct_c_b_type_get_type(node->data_type) ==
CY_FUNCT_CB_MISC_LEAVESUSPEND) {
- cy_as_hal_assert(node->cb_p != 0) ;
+ cy_as_hal_assert(node->cb_p != 0);
node->cb_p((cy_as_device_handle)dev_p,
CY_AS_ERROR_SUCCESS, node->client_data,
- CY_FUNCT_CB_MISC_LEAVESUSPEND, 0) ;
- cy_as_remove_c_b_node(dev_p->func_cbs_misc) ;
+ CY_FUNCT_CB_MISC_LEAVESUSPEND, 0);
+ cy_as_remove_c_b_node(dev_p->func_cbs_misc);
}
}
if (dev_p->misc_event_cb)
dev_p->misc_event_cb((cy_as_device_handle)dev_p,
- cy_as_event_misc_wakeup, 0) ;
- break ;
+ cy_as_event_misc_wakeup, 0);
+ break;
case CY_RQT_DEBUG_MESSAGE:
if ((req_p->data[0] == 0) && (req_p->data[1] == 0) &&
(req_p->data[2] == 0)) {
if (dev_p->misc_event_cb)
dev_p->misc_event_cb((cy_as_device_handle)dev_p,
- cy_as_event_misc_heart_beat, 0) ;
+ cy_as_event_misc_heart_beat, 0);
} else {
cy_as_hal_print_message(
"**** debug message: %02x "
@@ -486,41 +486,41 @@ my_misc_callback(cy_as_device *dev_p, uint8_t context,
req_p->data[1] & 0xff,
(req_p->data[1] >> 8) & 0xff,
req_p->data[2] & 0xff,
- (req_p->data[2] >> 8) & 0xff) ;
+ (req_p->data[2] >> 8) & 0xff);
}
- break ;
+ break;
case CY_RQT_WB_DEVICE_MISMATCH:
{
if (dev_p->misc_event_cb)
dev_p->misc_event_cb((cy_as_device_handle)dev_p,
- cy_as_event_misc_device_mismatch, 0) ;
+ cy_as_event_misc_device_mismatch, 0);
}
- break ;
+ break;
case CY_RQT_BOOTLOAD_NO_FIRMWARE:
{
/* TODO Handle case when firmware is
* not found during bootloading. */
cy_as_hal_print_message("no firmware image found "
- "during bootload. device not started\n") ;
+ "during bootload. device not started\n");
}
- break ;
+ break;
default:
- cy_as_hal_assert(0) ;
+ cy_as_hal_assert(0);
}
}
static cy_bool
is_valid_silicon_id(uint16_t v)
{
- cy_bool idok = cy_false ;
+ cy_bool idok = cy_false;
/*
* remove the revision number from the ID value
*/
- v = v & CY_AS_MEM_CM_WB_CFG_ID_HDID_MASK ;
+ v = v & CY_AS_MEM_CM_WB_CFG_ID_HDID_MASK;
/*
* if this is west bridge, then we are OK.
@@ -528,9 +528,9 @@ is_valid_silicon_id(uint16_t v)
if (v == CY_AS_MEM_CM_WB_CFG_ID_HDID_ANTIOCH_VALUE ||
v == CY_AS_MEM_CM_WB_CFG_ID_HDID_ASTORIA_FPGA_VALUE ||
v == CY_AS_MEM_CM_WB_CFG_ID_HDID_ASTORIA_VALUE)
- idok = cy_true ;
+ idok = cy_true;
- return idok ;
+ return idok;
}
/*
@@ -540,79 +540,79 @@ cy_as_return_status_t
cy_as_misc_configure_device(cy_as_device_handle handle,
cy_as_device_config *config_p)
{
- cy_as_return_status_t ret ;
- cy_bool standby ;
- cy_as_device *dev_p ;
- uint16_t v ;
+ cy_as_return_status_t ret;
+ cy_bool standby;
+ cy_as_device *dev_p;
+ uint16_t v;
uint16_t fw_present;
- cy_as_log_debug_message(6, "cy_as_misc_configure_device called") ;
+ cy_as_log_debug_message(6, "cy_as_misc_configure_device called");
- dev_p = (cy_as_device *)handle ;
+ dev_p = (cy_as_device *)handle;
if (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE))
- return CY_AS_ERROR_INVALID_HANDLE ;
+ return CY_AS_ERROR_INVALID_HANDLE;
/* Setup big endian vs little endian */
- cy_as_setup_endian_mode(dev_p) ;
+ cy_as_setup_endian_mode(dev_p);
/* Now, confirm that we can talk to the West Bridge device */
dev_p->silicon_id = cy_as_hal_read_register(dev_p->tag,
- CY_AS_MEM_CM_WB_CFG_ID) ;
+ CY_AS_MEM_CM_WB_CFG_ID);
fw_present = cy_as_hal_read_register(dev_p->tag,
- CY_AS_MEM_RST_CTRL_REG) ;
+ CY_AS_MEM_RST_CTRL_REG);
if (!(fw_present & CY_AS_MEM_RST_RSTCMPT)) {
if (!is_valid_silicon_id(dev_p->silicon_id))
- return CY_AS_ERROR_NO_ANTIOCH ;
+ return CY_AS_ERROR_NO_ANTIOCH;
}
/* Check for standby mode */
- ret = cy_as_misc_in_standby(handle, &standby) ;
+ ret = cy_as_misc_in_standby(handle, &standby);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
if (ret)
- return CY_AS_ERROR_IN_STANDBY ;
+ return CY_AS_ERROR_IN_STANDBY;
/* Setup P-port interface mode (CRAM / SRAM). */
if (cy_as_device_is_astoria_dev(dev_p)) {
if (config_p->srammode)
- v = CY_AS_MEM_P0_VM_SET_VMTYPE_SRAM ;
+ v = CY_AS_MEM_P0_VM_SET_VMTYPE_SRAM;
else
- v = CY_AS_MEM_P0_VM_SET_VMTYPE_RAM ;
+ v = CY_AS_MEM_P0_VM_SET_VMTYPE_RAM;
} else
- v = CY_AS_MEM_P0_VM_SET_VMTYPE_RAM ;
+ v = CY_AS_MEM_P0_VM_SET_VMTYPE_RAM;
/* Setup synchronous versus asynchronous mode */
if (config_p->sync)
- v |= CY_AS_MEM_P0_VM_SET_IFMODE ;
+ v |= CY_AS_MEM_P0_VM_SET_IFMODE;
if (config_p->dackmode == cy_as_device_dack_ack)
- v |= CY_AS_MEM_P0_VM_SET_DACKEOB ;
+ v |= CY_AS_MEM_P0_VM_SET_DACKEOB;
if (config_p->drqpol)
- v |= CY_AS_MEM_P0_VM_SET_DRQPOL ;
+ v |= CY_AS_MEM_P0_VM_SET_DRQPOL;
if (config_p->dackpol)
- v |= CY_AS_MEM_P0_VM_SET_DACKPOL ;
- cy_as_hal_write_register(dev_p->tag, CY_AS_MEM_P0_VM_SET, v) ;
+ v |= CY_AS_MEM_P0_VM_SET_DACKPOL;
+ cy_as_hal_write_register(dev_p->tag, CY_AS_MEM_P0_VM_SET, v);
if (config_p->crystal)
- cy_as_device_set_crystal(dev_p) ;
+ cy_as_device_set_crystal(dev_p);
else
- cy_as_device_set_external_clock(dev_p) ;
+ cy_as_device_set_external_clock(dev_p);
/* Register a callback to handle MISC requests from the firmware */
cy_as_ll_register_request_callback(dev_p,
- CY_RQT_GENERAL_RQT_CONTEXT, my_misc_callback) ;
+ CY_RQT_GENERAL_RQT_CONTEXT, my_misc_callback);
/* Now mark the DMA and low level modules as active. */
- cy_as_device_set_dma_running(dev_p) ;
- cy_as_device_set_low_level_running(dev_p) ;
+ cy_as_device_set_dma_running(dev_p);
+ cy_as_device_set_low_level_running(dev_p);
/* Now, initialize the interrupt module */
- dev_p->use_int_drq = config_p->dmaintr ;
- ret = cy_as_intr_start(dev_p, config_p->dmaintr) ;
+ dev_p->use_int_drq = config_p->dmaintr;
+ ret = cy_as_intr_start(dev_p, config_p->dmaintr);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
/* Mark the interface as initialized */
- cy_as_device_set_configured(dev_p) ;
+ cy_as_device_set_configured(dev_p);
- return CY_AS_ERROR_SUCCESS ;
+ return CY_AS_ERROR_SUCCESS;
}
static void
@@ -623,19 +623,19 @@ my_dma_callback(cy_as_device *dev_p,
cy_as_return_status_t ret
)
{
- cy_as_dma_end_point *ep_p ;
+ cy_as_dma_end_point *ep_p;
- (void)size ;
+ (void)size;
/* Get the endpoint pointer based on the endpoint number */
- ep_p = CY_AS_NUM_EP(dev_p, ep) ;
+ ep_p = CY_AS_NUM_EP(dev_p, ep);
/* Check the queue to see if is drained */
if (ep_p->queue_p == 0) {
cy_as_func_c_b_node *node =
- (cy_as_func_c_b_node *)dev_p->func_cbs_misc->head_p ;
+ (cy_as_func_c_b_node *)dev_p->func_cbs_misc->head_p;
- cy_as_hal_assert(node) ;
+ cy_as_hal_assert(node);
if (ret == CY_AS_ERROR_SUCCESS) {
/*
@@ -644,7 +644,7 @@ my_dma_callback(cy_as_device *dev_p,
*/
cy_as_dma_enable_end_point(dev_p,
CY_AS_FIRMWARE_ENDPOINT,
- cy_false, cy_as_direction_in) ;
+ cy_false, cy_as_direction_in);
/*
* clear the reset register. this releases the
@@ -652,20 +652,20 @@ my_dma_callback(cy_as_device *dev_p,
* running the code at address zero.
*/
cy_as_hal_write_register(dev_p->tag,
- CY_AS_MEM_RST_CTRL_REG, 0x00) ;
+ CY_AS_MEM_RST_CTRL_REG, 0x00);
}
/* Call the user Callback */
node->cb_p((cy_as_device_handle)dev_p, ret, node->client_data,
- node->data_type, node->data) ;
- cy_as_remove_c_b_node(dev_p->func_cbs_misc) ;
+ node->data_type, node->data);
+ cy_as_remove_c_b_node(dev_p->func_cbs_misc);
} else {
/* This is the header data that was allocated in the
* download firmware function, and can be safely freed
* here. */
- uint32_t state = cy_as_hal_disable_interrupts() ;
- cy_as_hal_c_b_free(mem_p) ;
- cy_as_hal_enable_interrupts(state) ;
+ uint32_t state = cy_as_hal_disable_interrupts();
+ cy_as_hal_c_b_free(mem_p);
+ cy_as_hal_enable_interrupts(state);
}
}
@@ -676,126 +676,126 @@ cy_as_misc_download_firmware(cy_as_device_handle handle,
cy_as_function_callback cb,
uint32_t client)
{
- uint8_t *header ;
- cy_as_return_status_t ret ;
- cy_bool standby ;
- cy_as_device *dev_p ;
- cy_as_dma_callback dmacb = 0 ;
- uint32_t state ;
+ uint8_t *header;
+ cy_as_return_status_t ret;
+ cy_bool standby;
+ cy_as_device *dev_p;
+ cy_as_dma_callback dmacb = 0;
+ uint32_t state;
- cy_as_log_debug_message(6, "cy_as_misc_download_firmware called") ;
+ cy_as_log_debug_message(6, "cy_as_misc_download_firmware called");
/* Make sure we have a valid device */
- dev_p = (cy_as_device *)handle ;
+ dev_p = (cy_as_device *)handle;
if (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE))
- return CY_AS_ERROR_INVALID_HANDLE ;
+ return CY_AS_ERROR_INVALID_HANDLE;
/*
* if the device has not been initialized, we cannot download firmware
* to the device.
*/
if (!cy_as_device_is_configured(dev_p))
- return CY_AS_ERROR_NOT_CONFIGURED ;
+ return CY_AS_ERROR_NOT_CONFIGURED;
/*
* make sure west bridge is not in standby
*/
- ret = cy_as_misc_in_standby(dev_p, &standby) ;
+ ret = cy_as_misc_in_standby(dev_p, &standby);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
if (standby)
- return CY_AS_ERROR_IN_STANDBY ;
+ return CY_AS_ERROR_IN_STANDBY;
if (cy_as_device_is_in_suspend_mode(dev_p))
- return CY_AS_ERROR_IN_SUSPEND ;
+ return CY_AS_ERROR_IN_SUSPEND;
/*
* make sure we are in configuration mode
*/
if ((cy_as_hal_read_register(dev_p->tag, CY_AS_MEM_P0_VM_SET) &
CY_AS_MEM_P0_VM_SET_CFGMODE) == 0)
- return CY_AS_ERROR_NOT_IN_CONFIG_MODE ;
+ return CY_AS_ERROR_NOT_IN_CONFIG_MODE;
/* Maximum firmware size is 24k */
if (size > CY_AS_MAXIMUM_FIRMWARE_SIZE)
- return CY_AS_ERROR_INVALID_SIZE ;
+ return CY_AS_ERROR_INVALID_SIZE;
/* Make sure the size is an even number of bytes as well */
if (size & 0x01)
- return CY_AS_ERROR_ALIGNMENT_ERROR ;
+ return CY_AS_ERROR_ALIGNMENT_ERROR;
/*
* write the two word header that gives the base address and
* size of the firmware image to download
*/
- state = cy_as_hal_disable_interrupts() ;
- header = (uint8_t *)cy_as_hal_c_b_alloc(4) ;
- cy_as_hal_enable_interrupts(state) ;
+ state = cy_as_hal_disable_interrupts();
+ header = (uint8_t *)cy_as_hal_c_b_alloc(4);
+ cy_as_hal_enable_interrupts(state);
if (header == NULL)
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ return CY_AS_ERROR_OUT_OF_MEMORY;
- header[0] = 0x00 ;
- header[1] = 0x00 ;
- header[2] = (uint8_t)(size & 0xff) ;
- header[3] = (uint8_t)((size >> 8) & 0xff) ;
+ header[0] = 0x00;
+ header[1] = 0x00;
+ header[2] = (uint8_t)(size & 0xff);
+ header[3] = (uint8_t)((size >> 8) & 0xff);
/* Enable the firmware endpoint */
ret = cy_as_dma_enable_end_point(dev_p, CY_AS_FIRMWARE_ENDPOINT,
- cy_true, cy_as_direction_in) ;
+ cy_true, cy_as_direction_in);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
/*
* setup DMA for 64 byte packets. this is the requirement for downloading
* firmware to west bridge.
*/
- cy_as_dma_set_max_dma_size(dev_p, CY_AS_FIRMWARE_ENDPOINT, 64) ;
+ cy_as_dma_set_max_dma_size(dev_p, CY_AS_FIRMWARE_ENDPOINT, 64);
if (cb)
- dmacb = my_dma_callback ;
+ dmacb = my_dma_callback;
ret = cy_as_dma_queue_request(dev_p, CY_AS_FIRMWARE_ENDPOINT, header,
- 4, cy_false, cy_false, dmacb) ;
+ 4, cy_false, cy_false, dmacb);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
/*
* write the firmware image to the west bridge device
*/
ret = cy_as_dma_queue_request(dev_p, CY_AS_FIRMWARE_ENDPOINT,
- (void *)mem_p, size, cy_false, cy_false, dmacb) ;
+ (void *)mem_p, size, cy_false, cy_false, dmacb);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
if (cb) {
cy_as_func_c_b_node *cbnode = cy_as_create_func_c_b_node_data(
- cb, client, CY_FUNCT_CB_MISC_DOWNLOADFIRMWARE, 0) ;
+ cb, client, CY_FUNCT_CB_MISC_DOWNLOADFIRMWARE, 0);
if (cbnode == 0)
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ return CY_AS_ERROR_OUT_OF_MEMORY;
else
- cy_as_insert_c_b_node(dev_p->func_cbs_misc, cbnode) ;
+ cy_as_insert_c_b_node(dev_p->func_cbs_misc, cbnode);
- ret = cy_as_dma_kick_start(dev_p, CY_AS_FIRMWARE_ENDPOINT) ;
+ ret = cy_as_dma_kick_start(dev_p, CY_AS_FIRMWARE_ENDPOINT);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
} else {
ret = cy_as_dma_drain_queue(dev_p,
- CY_AS_FIRMWARE_ENDPOINT, cy_true) ;
+ CY_AS_FIRMWARE_ENDPOINT, cy_true);
/* Free the header memory that was allocated earlier. */
- cy_as_hal_c_b_free(header) ;
+ cy_as_hal_c_b_free(header);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
/*
* disable EP 2. the storage module will
* enable this EP if necessary.
*/
cy_as_dma_enable_end_point(dev_p, CY_AS_FIRMWARE_ENDPOINT,
- cy_false, cy_as_direction_in) ;
+ cy_false, cy_as_direction_in);
/*
* clear the reset register. this releases the west bridge
@@ -803,7 +803,7 @@ cy_as_misc_download_firmware(cy_as_device_handle handle,
* address zero.
*/
cy_as_hal_write_register(dev_p->tag,
- CY_AS_MEM_RST_CTRL_REG, 0x00) ;
+ CY_AS_MEM_RST_CTRL_REG, 0x00);
}
/*
@@ -811,7 +811,7 @@ cy_as_misc_download_firmware(cy_as_device_handle handle,
* initializes west bridge and a request is sent from west bridge
* to the P port processor indicating that west bridge is ready.
*/
- return CY_AS_ERROR_SUCCESS ;
+ return CY_AS_ERROR_SUCCESS;
}
@@ -822,28 +822,28 @@ my_handle_response_get_firmware_version(cy_as_device *dev_p,
cy_as_get_firmware_version_data *data_p)
{
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
- uint16_t val ;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
+ uint16_t val;
if (cy_as_ll_request_response__get_code(reply_p)
!= CY_RESP_FIRMWARE_VERSION) {
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
- goto destroy ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
+ goto destroy;
}
- data_p->major = cy_as_ll_request_response__get_word(reply_p, 0) ;
- data_p->minor = cy_as_ll_request_response__get_word(reply_p, 1) ;
- data_p->build = cy_as_ll_request_response__get_word(reply_p, 2) ;
- val = cy_as_ll_request_response__get_word(reply_p, 3) ;
- data_p->media_type = (uint8_t)(((val >> 8) & 0xFF) | (val & 0xFF)) ;
- val = cy_as_ll_request_response__get_word(reply_p, 4) ;
- data_p->is_debug_mode = (cy_bool)(val & 0xFF) ;
+ data_p->major = cy_as_ll_request_response__get_word(reply_p, 0);
+ data_p->minor = cy_as_ll_request_response__get_word(reply_p, 1);
+ data_p->build = cy_as_ll_request_response__get_word(reply_p, 2);
+ val = cy_as_ll_request_response__get_word(reply_p, 3);
+ data_p->media_type = (uint8_t)(((val >> 8) & 0xFF) | (val & 0xFF));
+ val = cy_as_ll_request_response__get_word(reply_p, 4);
+ data_p->is_debug_mode = (cy_bool)(val & 0xFF);
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
- return ret ;
+ return ret;
}
cy_as_return_status_t
@@ -852,79 +852,79 @@ cy_as_misc_get_firmware_version(cy_as_device_handle handle,
cy_as_function_callback cb,
uint32_t client)
{
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
- cy_bool standby ;
- cy_as_ll_request_response *req_p, *reply_p ;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
+ cy_bool standby;
+ cy_as_ll_request_response *req_p, *reply_p;
- cy_as_device *dev_p ;
+ cy_as_device *dev_p;
- (void)client ;
+ (void)client;
- cy_as_log_debug_message(6, "cy_as_misc_get_firmware_version called") ;
+ cy_as_log_debug_message(6, "cy_as_misc_get_firmware_version called");
/* Make sure we have a valid device */
- dev_p = (cy_as_device *)handle ;
- cy_as_check_device_ready(dev_p) ;
+ dev_p = (cy_as_device *)handle;
+ cy_as_check_device_ready(dev_p);
/*
* make sure antioch is not in standby
*/
- ret = cy_as_misc_in_standby(dev_p, &standby) ;
+ ret = cy_as_misc_in_standby(dev_p, &standby);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
if (standby)
- return CY_AS_ERROR_IN_STANDBY ;
+ return CY_AS_ERROR_IN_STANDBY;
/* Make sure the Antioch is not in suspend mode. */
if (cy_as_device_is_in_suspend_mode(dev_p))
- return CY_AS_ERROR_IN_SUSPEND ;
+ return CY_AS_ERROR_IN_SUSPEND;
/* Create the request to send to the West Bridge device */
req_p = cy_as_ll_create_request(dev_p, CY_RQT_GET_FIRMWARE_VERSION,
- CY_RQT_GENERAL_RQT_CONTEXT, 0) ;
+ CY_RQT_GENERAL_RQT_CONTEXT, 0);
if (req_p == 0)
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ return CY_AS_ERROR_OUT_OF_MEMORY;
/*
* Reserve space for the reply, the reply data
* will not exceed three words
*/
- reply_p = cy_as_ll_create_response(dev_p, 5) ;
+ reply_p = cy_as_ll_create_response(dev_p, 5);
if (reply_p == 0) {
- cy_as_ll_destroy_request(dev_p, req_p) ;
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ return CY_AS_ERROR_OUT_OF_MEMORY;
}
if (cb == 0) {
- ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p) ;
+ ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
/* Request and response are freed in
* MyHandleResponseGetFirmwareVersion. */
ret = my_handle_response_get_firmware_version(dev_p,
- req_p, reply_p, data) ;
- return ret ;
+ req_p, reply_p, data);
+ return ret;
} else {
ret = cy_as_misc_send_request(dev_p, cb, client,
CY_FUNCT_CB_MISC_GETFIRMWAREVERSION, data,
dev_p->func_cbs_misc, CY_AS_REQUEST_RESPONSE_EX,
- req_p, reply_p, cy_as_misc_func_callback) ;
+ req_p, reply_p, cy_as_misc_func_callback);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
/* The request and response are freed
* as part of the MiscFuncCallback */
- return ret ;
+ return ret;
}
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
- return ret ;
+ return ret;
}
static cy_as_return_status_t
my_handle_response_read_m_c_u_register(cy_as_device *dev_p,
@@ -933,22 +933,22 @@ my_handle_response_read_m_c_u_register(cy_as_device *dev_p,
uint8_t *data_p)
{
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
if (cy_as_ll_request_response__get_code(reply_p)
!= CY_RESP_MCU_REGISTER_DATA) {
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
- goto destroy ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
+ goto destroy;
}
*data_p = (uint8_t)
- (cy_as_ll_request_response__get_word(reply_p, 0)) ;
+ (cy_as_ll_request_response__get_word(reply_p, 0));
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
- return ret ;
+ return ret;
}
static cy_as_return_status_t
@@ -958,19 +958,19 @@ my_handle_response_get_gpio_value(cy_as_device *dev_p,
uint8_t *data_p)
{
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
if (cy_as_ll_request_response__get_code(reply_p)
!= CY_RESP_GPIO_STATE) {
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
} else
*data_p = (uint8_t)
- (cy_as_ll_request_response__get_word(reply_p, 0)) ;
+ (cy_as_ll_request_response__get_word(reply_p, 0));
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
- return ret ;
+ return ret;
}
@@ -980,64 +980,64 @@ cy_as_return_status_t cy_as_misc_set_sd_power_polarity(
cy_as_function_callback cb,
uint32_t client)
{
- cy_as_ll_request_response *req_p, *reply_p ;
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
- cy_as_device *dev_p = (cy_as_device *)handle ;
+ cy_as_ll_request_response *req_p, *reply_p;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
+ cy_as_device *dev_p = (cy_as_device *)handle;
if (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE))
- return CY_AS_ERROR_INVALID_HANDLE ;
+ return CY_AS_ERROR_INVALID_HANDLE;
if (!cy_as_device_is_configured(dev_p))
- return CY_AS_ERROR_NOT_CONFIGURED ;
+ return CY_AS_ERROR_NOT_CONFIGURED;
if (!cy_as_device_is_firmware_loaded(dev_p))
- return CY_AS_ERROR_NO_FIRMWARE ;
+ return CY_AS_ERROR_NO_FIRMWARE;
if (cy_as_device_is_in_suspend_mode(dev_p))
- return CY_AS_ERROR_IN_SUSPEND ;
+ return CY_AS_ERROR_IN_SUSPEND;
req_p = cy_as_ll_create_request(dev_p, CY_RQT_SDPOLARITY,
- CY_RQT_GENERAL_RQT_CONTEXT, 1) ;
+ CY_RQT_GENERAL_RQT_CONTEXT, 1);
if (req_p == 0)
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ return CY_AS_ERROR_OUT_OF_MEMORY;
cy_as_ll_request_response__set_word(req_p, 0,
- (uint16_t)polarity) ;
+ (uint16_t)polarity);
/*
* Reserve space for the reply, the reply data will
* not exceed one word
*/
- reply_p = cy_as_ll_create_response(dev_p, 1) ;
+ reply_p = cy_as_ll_create_response(dev_p, 1);
if (reply_p == 0) {
- cy_as_ll_destroy_request(dev_p, req_p) ;
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ return CY_AS_ERROR_OUT_OF_MEMORY;
}
if (cb == 0) {
- ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p) ;
+ ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
- return (my_handle_response_no_data(dev_p, req_p, reply_p)) ;
+ return (my_handle_response_no_data(dev_p, req_p, reply_p));
} else {
ret = cy_as_misc_send_request(dev_p, cb, client,
CY_FUNCT_CB_MISC_SETSDPOLARITY, 0, dev_p->func_cbs_misc,
CY_AS_REQUEST_RESPONSE_EX, req_p, reply_p,
- cy_as_misc_func_callback) ;
+ cy_as_misc_func_callback);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
/* The request and response are freed
* as part of the FuncCallback */
- return ret ;
+ return ret;
}
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
- return ret ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
+ return ret;
}
@@ -1048,72 +1048,72 @@ cy_as_misc_read_m_c_u_register(cy_as_device_handle handle,
cy_as_function_callback cb,
uint32_t client)
{
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
- cy_as_ll_request_response *req_p, *reply_p ;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
+ cy_as_ll_request_response *req_p, *reply_p;
- cy_as_device *dev_p ;
+ cy_as_device *dev_p;
- cy_as_log_debug_message(6, "cy_as_misc_read_m_c_u_register called") ;
+ cy_as_log_debug_message(6, "cy_as_misc_read_m_c_u_register called");
- dev_p = (cy_as_device *)handle ;
- cy_as_check_device_ready(dev_p) ;
+ dev_p = (cy_as_device *)handle;
+ cy_as_check_device_ready(dev_p);
/* Check whether the firmware supports this command. */
if (cy_as_device_is_nand_storage_supported(dev_p))
- return CY_AS_ERROR_NOT_SUPPORTED ;
+ return CY_AS_ERROR_NOT_SUPPORTED;
/* Make sure the Antioch is not in suspend mode. */
if (cy_as_device_is_in_suspend_mode(dev_p))
- return CY_AS_ERROR_IN_SUSPEND ;
+ return CY_AS_ERROR_IN_SUSPEND;
/* Create the request to send to the West Bridge device */
req_p = cy_as_ll_create_request(dev_p, CY_RQT_READ_MCU_REGISTER,
- CY_RQT_GENERAL_RQT_CONTEXT, 1) ;
+ CY_RQT_GENERAL_RQT_CONTEXT, 1);
if (req_p == 0)
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ return CY_AS_ERROR_OUT_OF_MEMORY;
- cy_as_ll_request_response__set_word(req_p, 0, (uint16_t)address) ;
+ cy_as_ll_request_response__set_word(req_p, 0, (uint16_t)address);
/* Reserve space for the reply, the reply
* data will not exceed one word */
- reply_p = cy_as_ll_create_response(dev_p, 1) ;
+ reply_p = cy_as_ll_create_response(dev_p, 1);
if (reply_p == 0) {
- cy_as_ll_destroy_request(dev_p, req_p) ;
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ return CY_AS_ERROR_OUT_OF_MEMORY;
}
if (cb == 0) {
- ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p) ;
+ ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
if (cy_as_ll_request_response__get_code(reply_p) !=
CY_RESP_MCU_REGISTER_DATA) {
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
- goto destroy ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
+ goto destroy;
}
*value = (uint8_t)(cy_as_ll_request_response__get_word
- (reply_p, 0)) ;
+ (reply_p, 0));
} else {
ret = cy_as_misc_send_request(dev_p, cb, client,
CY_FUNCT_CB_MISC_READMCUREGISTER, value,
dev_p->func_cbs_misc, CY_AS_REQUEST_RESPONSE_EX,
- req_p, reply_p, cy_as_misc_func_callback) ;
+ req_p, reply_p, cy_as_misc_func_callback);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
/* The request and response are freed
* as part of the MiscFuncCallback */
- return ret ;
+ return ret;
}
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
- return ret ;
+ return ret;
}
@@ -1125,76 +1125,76 @@ cy_as_misc_write_m_c_u_register(cy_as_device_handle handle,
cy_as_function_callback cb,
uint32_t client)
{
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
- cy_as_ll_request_response *req_p, *reply_p ;
- cy_as_device *dev_p ;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
+ cy_as_ll_request_response *req_p, *reply_p;
+ cy_as_device *dev_p;
- cy_as_log_debug_message(6, "cy_as_misc_write_m_c_u_register called") ;
+ cy_as_log_debug_message(6, "cy_as_misc_write_m_c_u_register called");
- dev_p = (cy_as_device *)handle ;
- cy_as_check_device_ready(dev_p) ;
+ dev_p = (cy_as_device *)handle;
+ cy_as_check_device_ready(dev_p);
/* Check whether the firmware supports this command. */
if (cy_as_device_is_nand_storage_supported(dev_p))
- return CY_AS_ERROR_NOT_SUPPORTED ;
+ return CY_AS_ERROR_NOT_SUPPORTED;
/* Make sure the Antioch is not in suspend mode. */
if (cy_as_device_is_in_suspend_mode(dev_p))
- return CY_AS_ERROR_IN_SUSPEND ;
+ return CY_AS_ERROR_IN_SUSPEND;
/* Create the request to send to the West Bridge device */
req_p = cy_as_ll_create_request(dev_p, CY_RQT_WRITE_MCU_REGISTER,
- CY_RQT_GENERAL_RQT_CONTEXT, 2) ;
+ CY_RQT_GENERAL_RQT_CONTEXT, 2);
if (req_p == 0)
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ return CY_AS_ERROR_OUT_OF_MEMORY;
- cy_as_ll_request_response__set_word(req_p, 0, (uint16_t)address) ;
+ cy_as_ll_request_response__set_word(req_p, 0, (uint16_t)address);
cy_as_ll_request_response__set_word(req_p, 1,
- (uint16_t)((mask << 8) | value)) ;
+ (uint16_t)((mask << 8) | value));
/*
* Reserve space for the reply, the reply data
* will not exceed one word
*/
- reply_p = cy_as_ll_create_response(dev_p, 1) ;
+ reply_p = cy_as_ll_create_response(dev_p, 1);
if (reply_p == 0) {
- cy_as_ll_destroy_request(dev_p, req_p) ;
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ return CY_AS_ERROR_OUT_OF_MEMORY;
}
if (cb == 0) {
- ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p) ;
+ ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
if (cy_as_ll_request_response__get_code(reply_p) !=
CY_RESP_SUCCESS_FAILURE) {
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
- goto destroy ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
+ goto destroy;
}
- ret = cy_as_ll_request_response__get_word(reply_p, 0) ;
+ ret = cy_as_ll_request_response__get_word(reply_p, 0);
} else {
ret = cy_as_misc_send_request(dev_p, cb, client,
CY_FUNCT_CB_MISC_WRITEMCUREGISTER, 0,
dev_p->func_cbs_misc, CY_AS_REQUEST_RESPONSE_EX,
- req_p, reply_p, cy_as_misc_func_callback) ;
+ req_p, reply_p, cy_as_misc_func_callback);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
/*
* The request and response are freed as part of the
* MiscFuncCallback
*/
- return ret ;
+ return ret;
}
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
- return ret ;
+ return ret;
}
cy_as_return_status_t
@@ -1203,10 +1203,10 @@ my_handle_response_reset(cy_as_device *dev_p,
cy_as_ll_request_response *reply_p,
cy_as_reset_type type)
{
- uint16_t v ;
+ uint16_t v;
- (void)req_p ;
- (void)reply_p ;
+ (void)req_p;
+ (void)reply_p;
/*
* if the device is in suspend mode, it needs to be woken up
@@ -1216,33 +1216,33 @@ my_handle_response_reset(cy_as_device *dev_p,
*/
if (cy_as_device_is_in_suspend_mode(dev_p)) {
v = cy_as_hal_read_register(dev_p->tag,
- CY_AS_MEM_CM_WB_CFG_ID) ;
- cy_as_hal_sleep(1) ;
+ CY_AS_MEM_CM_WB_CFG_ID);
+ cy_as_hal_sleep(1);
}
if (type == cy_as_reset_hard) {
- cy_as_misc_cancel_ex_requests(dev_p) ;
+ cy_as_misc_cancel_ex_requests(dev_p);
cy_as_hal_write_register(dev_p->tag, CY_AS_MEM_RST_CTRL_REG,
- CY_AS_MEM_RST_CTRL_REG_HARD) ;
- cy_as_device_set_unconfigured(dev_p) ;
- cy_as_device_set_firmware_not_loaded(dev_p) ;
- cy_as_device_set_dma_stopped(dev_p) ;
- cy_as_device_set_low_level_stopped(dev_p) ;
- cy_as_device_set_intr_stopped(dev_p) ;
- cy_as_device_clear_suspend_mode(dev_p) ;
- cy_as_usb_cleanup(dev_p) ;
- cy_as_storage_cleanup(dev_p) ;
+ CY_AS_MEM_RST_CTRL_REG_HARD);
+ cy_as_device_set_unconfigured(dev_p);
+ cy_as_device_set_firmware_not_loaded(dev_p);
+ cy_as_device_set_dma_stopped(dev_p);
+ cy_as_device_set_low_level_stopped(dev_p);
+ cy_as_device_set_intr_stopped(dev_p);
+ cy_as_device_clear_suspend_mode(dev_p);
+ cy_as_usb_cleanup(dev_p);
+ cy_as_storage_cleanup(dev_p);
/*
* wait for a small amount of time to
* allow reset to be complete.
*/
- cy_as_hal_sleep(100) ;
+ cy_as_hal_sleep(100);
}
- cy_as_device_clear_reset_pending(dev_p) ;
+ cy_as_device_clear_reset_pending(dev_p);
- return CY_AS_ERROR_SUCCESS ;
+ return CY_AS_ERROR_SUCCESS;
}
cy_as_return_status_t
@@ -1252,39 +1252,39 @@ cy_as_misc_reset(cy_as_device_handle handle,
cy_as_function_callback cb,
uint32_t client)
{
- cy_as_device *dev_p ;
- cy_as_end_point_number_t i ;
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
- (void)client ;
- (void)cb ;
+ cy_as_device *dev_p;
+ cy_as_end_point_number_t i;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
+ (void)client;
+ (void)cb;
- cy_as_log_debug_message(6, "cy_as_misc_reset_e_x called") ;
+ cy_as_log_debug_message(6, "cy_as_misc_reset_e_x called");
/* Make sure the device is ready for the command. */
- dev_p = (cy_as_device *)handle ;
- cy_as_check_device_ready(dev_p) ;
+ dev_p = (cy_as_device *)handle;
+ cy_as_check_device_ready(dev_p);
/*
* soft reset is not supported until we close on the issues
* in the firmware with what needs to happen.
*/
if (type == cy_as_reset_soft)
- return CY_AS_ERROR_NOT_YET_SUPPORTED ;
+ return CY_AS_ERROR_NOT_YET_SUPPORTED;
- cy_as_device_set_reset_pending(dev_p) ;
+ cy_as_device_set_reset_pending(dev_p);
if (flush) {
/* Unable to DrainQueues in polling mode */
if ((dev_p->storage_cb || dev_p->storage_cb_ms) &&
cy_as_hal_is_polling())
- return CY_AS_ERROR_ASYNC_PENDING ;
+ return CY_AS_ERROR_ASYNC_PENDING;
/*
* shutdown the endpoints so no more traffic can be queued
*/
for (i = 0; i < 15; i++)
cy_as_dma_enable_end_point(dev_p, i, cy_false,
- cy_as_direction_dont_change) ;
+ cy_as_direction_dont_change);
/*
* if we are in normal mode, drain all traffic across all
@@ -1296,16 +1296,16 @@ cy_as_misc_reset(cy_as_device_handle handle,
if (cy_as_device_is_in_suspend_mode(dev_p)) {
for (i = 0; i < 15; i++)
cy_as_dma_cancel(dev_p, i,
- CY_AS_ERROR_CANCELED) ;
+ CY_AS_ERROR_CANCELED);
} else {
for (i = 0; i < 15; i++) {
if ((i == CY_AS_P2S_WRITE_ENDPOINT) ||
(i == CY_AS_P2S_READ_ENDPOINT))
cy_as_dma_drain_queue(dev_p, i,
- cy_false) ;
+ cy_false);
else
cy_as_dma_drain_queue(dev_p, i,
- cy_true) ;
+ cy_true);
}
}
} else {
@@ -1315,73 +1315,73 @@ cy_as_misc_reset(cy_as_device_handle handle,
if (cy_as_device_is_storage_async_pending(dev_p)) {
for (i = 0; i < 15; i++)
cy_as_dma_cancel(dev_p, i,
- CY_AS_ERROR_CANCELED) ;
+ CY_AS_ERROR_CANCELED);
}
}
- ret = my_handle_response_reset(dev_p, 0, 0, type) ;
+ ret = my_handle_response_reset(dev_p, 0, 0, type);
if (cb)
/* Even though no mailbox communication was needed,
* issue the callback so the user does not need to
* special case their code. */
cb((cy_as_device_handle)dev_p, ret, client,
- CY_FUNCT_CB_MISC_RESET, 0) ;
+ CY_FUNCT_CB_MISC_RESET, 0);
/*
* initialize any registers that may have been
* changed when the device was reset.
*/
- cy_as_hal_init_dev_registers(dev_p->tag, cy_false) ;
+ cy_as_hal_init_dev_registers(dev_p->tag, cy_false);
- return ret ;
+ return ret;
}
static cy_as_return_status_t
get_unallocated_resource(cy_as_device *dev_p, cy_as_resource_type resource)
{
- uint8_t shift = 0 ;
- uint16_t v ;
- cy_as_return_status_t ret = CY_AS_ERROR_NOT_ACQUIRED ;
+ uint8_t shift = 0;
+ uint16_t v;
+ cy_as_return_status_t ret = CY_AS_ERROR_NOT_ACQUIRED;
switch (resource) {
case cy_as_bus_u_s_b:
- shift = 4 ;
- break ;
+ shift = 4;
+ break;
case cy_as_bus_1:
- shift = 0 ;
- break ;
+ shift = 0;
+ break;
case cy_as_bus_0:
- shift = 2 ;
- break ;
+ shift = 2;
+ break;
default:
- cy_as_hal_assert(cy_false) ;
- break ;
+ cy_as_hal_assert(cy_false);
+ break;
}
/* Get the semaphore value for this resource */
- v = cy_as_hal_read_register(dev_p->tag, CY_AS_MEM_P0_RSE_ALLOCATE) ;
- v = (v >> shift) & 0x03 ;
+ v = cy_as_hal_read_register(dev_p->tag, CY_AS_MEM_P0_RSE_ALLOCATE);
+ v = (v >> shift) & 0x03;
if (v == 0x03) {
- ret = CY_AS_ERROR_RESOURCE_ALREADY_OWNED ;
+ ret = CY_AS_ERROR_RESOURCE_ALREADY_OWNED;
} else if ((v & 0x01) == 0) {
/* The resource is not owned by anyone, we can try to get it */
cy_as_hal_write_register(dev_p->tag,
- CY_AS_MEM_P0_RSE_MASK, (0x03 << shift)) ;
- v = cy_as_hal_read_register(dev_p->tag, CY_AS_MEM_P0_RSE_MASK) ;
+ CY_AS_MEM_P0_RSE_MASK, (0x03 << shift));
+ v = cy_as_hal_read_register(dev_p->tag, CY_AS_MEM_P0_RSE_MASK);
cy_as_hal_write_register(dev_p->tag,
- CY_AS_MEM_P0_RSE_ALLOCATE, (0x01 << shift)) ;
- v = cy_as_hal_read_register(dev_p->tag, CY_AS_MEM_P0_RSE_MASK) ;
+ CY_AS_MEM_P0_RSE_ALLOCATE, (0x01 << shift));
+ v = cy_as_hal_read_register(dev_p->tag, CY_AS_MEM_P0_RSE_MASK);
v = cy_as_hal_read_register(dev_p->tag,
- CY_AS_MEM_P0_RSE_ALLOCATE) ;
- v = (v >> shift) & 0x03 ;
+ CY_AS_MEM_P0_RSE_ALLOCATE);
+ v = (v >> shift) & 0x03;
if (v == 0x03)
- ret = CY_AS_ERROR_SUCCESS ;
+ ret = CY_AS_ERROR_SUCCESS;
}
- return ret ;
+ return ret;
}
static cy_as_return_status_t
@@ -1390,25 +1390,25 @@ my_handle_response_acquire_resource(cy_as_device *dev_p,
cy_as_ll_request_response *reply_p,
cy_as_resource_type *resource)
{
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
if (cy_as_ll_request_response__get_code(reply_p) !=
CY_RESP_SUCCESS_FAILURE) {
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
- goto destroy ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
+ goto destroy;
}
if (ret == CY_AS_ERROR_SUCCESS) {
- ret = get_unallocated_resource(dev_p, *resource) ;
+ ret = get_unallocated_resource(dev_p, *resource);
if (ret != CY_AS_ERROR_NOT_ACQUIRED)
- ret = CY_AS_ERROR_SUCCESS ;
+ ret = CY_AS_ERROR_SUCCESS;
}
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
- return ret ;
+ return ret;
}
cy_as_return_status_t
@@ -1418,29 +1418,29 @@ cy_as_misc_acquire_resource(cy_as_device_handle handle,
cy_as_function_callback cb,
uint32_t client)
{
- cy_as_ll_request_response *req_p, *reply_p ;
- cy_as_return_status_t ret ;
+ cy_as_ll_request_response *req_p, *reply_p;
+ cy_as_return_status_t ret;
- cy_as_device *dev_p ;
+ cy_as_device *dev_p;
- (void)client ;
+ (void)client;
- cy_as_log_debug_message(6, "cy_as_misc_acquire_resource called") ;
+ cy_as_log_debug_message(6, "cy_as_misc_acquire_resource called");
if (*resource != cy_as_bus_u_s_b && *resource !=
cy_as_bus_0 && *resource != cy_as_bus_1)
- return CY_AS_ERROR_INVALID_RESOURCE ;
+ return CY_AS_ERROR_INVALID_RESOURCE;
/* Make sure the device is ready to accept the command. */
- dev_p = (cy_as_device *)handle ;
- cy_as_check_device_ready(dev_p) ;
+ dev_p = (cy_as_device *)handle;
+ cy_as_check_device_ready(dev_p);
if (cy_as_device_is_in_suspend_mode(dev_p))
- return CY_AS_ERROR_IN_SUSPEND ;
+ return CY_AS_ERROR_IN_SUSPEND;
- ret = get_unallocated_resource(dev_p, *resource) ;
+ ret = get_unallocated_resource(dev_p, *resource);
/*
* make sure that the callback is called if the resource is
@@ -1448,117 +1448,117 @@ cy_as_misc_acquire_resource(cy_as_device_handle handle,
*/
if ((ret == CY_AS_ERROR_SUCCESS) && (cb != 0))
cb(handle, ret, client,
- CY_FUNCT_CB_MISC_ACQUIRERESOURCE, resource) ;
+ CY_FUNCT_CB_MISC_ACQUIRERESOURCE, resource);
if (ret != CY_AS_ERROR_NOT_ACQUIRED)
- return ret ;
+ return ret;
if (!force)
- return CY_AS_ERROR_NOT_ACQUIRED ;
+ return CY_AS_ERROR_NOT_ACQUIRED;
/* Create the request to acquire the resource */
req_p = cy_as_ll_create_request(dev_p, CY_RQT_ACQUIRE_RESOURCE,
- CY_RQT_RESOURCE_RQT_CONTEXT, 1) ;
+ CY_RQT_RESOURCE_RQT_CONTEXT, 1);
if (req_p == 0)
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ return CY_AS_ERROR_OUT_OF_MEMORY;
- cy_as_ll_request_response__set_word(req_p, 0, (uint16_t)(*resource)) ;
+ cy_as_ll_request_response__set_word(req_p, 0, (uint16_t)(*resource));
- reply_p = cy_as_ll_create_response(dev_p, 1) ;
+ reply_p = cy_as_ll_create_response(dev_p, 1);
if (reply_p == 0) {
- cy_as_ll_destroy_request(dev_p, req_p) ;
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ return CY_AS_ERROR_OUT_OF_MEMORY;
}
if (cb == 0) {
- ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p) ;
+ ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
if (cy_as_ll_request_response__get_code(reply_p) !=
CY_RESP_SUCCESS_FAILURE) {
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
- goto destroy ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
+ goto destroy;
}
- ret = cy_as_ll_request_response__get_word(reply_p, 0) ;
+ ret = cy_as_ll_request_response__get_word(reply_p, 0);
} else {
ret = cy_as_misc_send_request(dev_p, cb, client,
CY_FUNCT_CB_MISC_ACQUIRERESOURCE, resource,
dev_p->func_cbs_res, CY_AS_REQUEST_RESPONSE_EX,
- req_p, reply_p, cy_as_misc_func_callback) ;
+ req_p, reply_p, cy_as_misc_func_callback);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
/* The request and response are freed
* as part of the MiscFuncCallback */
- return ret ;
+ return ret;
}
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
if (ret == CY_AS_ERROR_SUCCESS) {
- ret = get_unallocated_resource(dev_p, *resource) ;
+ ret = get_unallocated_resource(dev_p, *resource);
if (ret != CY_AS_ERROR_NOT_ACQUIRED)
- ret = CY_AS_ERROR_SUCCESS ;
+ ret = CY_AS_ERROR_SUCCESS;
}
- return ret ;
+ return ret;
}
cy_as_return_status_t
cy_as_misc_release_resource(cy_as_device_handle handle,
cy_as_resource_type resource)
{
- uint8_t shift = 0 ;
- uint16_t v ;
+ uint8_t shift = 0;
+ uint16_t v;
- cy_as_device *dev_p ;
+ cy_as_device *dev_p;
- cy_as_log_debug_message(6, "cy_as_misc_release_resource called") ;
+ cy_as_log_debug_message(6, "cy_as_misc_release_resource called");
/* Make sure the device is ready for the command. */
- dev_p = (cy_as_device *)handle ;
- cy_as_check_device_ready(dev_p) ;
+ dev_p = (cy_as_device *)handle;
+ cy_as_check_device_ready(dev_p);
if (cy_as_device_is_in_suspend_mode(dev_p))
- return CY_AS_ERROR_IN_SUSPEND ;
+ return CY_AS_ERROR_IN_SUSPEND;
if (resource != cy_as_bus_u_s_b && resource !=
cy_as_bus_0 && resource != cy_as_bus_1)
- return CY_AS_ERROR_INVALID_RESOURCE ;
+ return CY_AS_ERROR_INVALID_RESOURCE;
switch (resource) {
case cy_as_bus_u_s_b:
- shift = 4 ;
- break ;
+ shift = 4;
+ break;
case cy_as_bus_1:
- shift = 0 ;
- break ;
+ shift = 0;
+ break;
case cy_as_bus_0:
- shift = 2 ;
- break ;
+ shift = 2;
+ break;
default:
- cy_as_hal_assert(cy_false) ;
- break ;
+ cy_as_hal_assert(cy_false);
+ break;
}
/* Get the semaphore value for this resource */
v = (cy_as_hal_read_register(dev_p->tag,
- CY_AS_MEM_P0_RSE_ALLOCATE) >> shift) & 0x03 ;
+ CY_AS_MEM_P0_RSE_ALLOCATE) >> shift) & 0x03;
if (v == 0 || v == 1 || v == 2)
- return CY_AS_ERROR_RESOURCE_NOT_OWNED ;
+ return CY_AS_ERROR_RESOURCE_NOT_OWNED;
cy_as_hal_write_register(dev_p->tag,
- CY_AS_MEM_P0_RSE_MASK, (0x03 << shift)) ;
+ CY_AS_MEM_P0_RSE_MASK, (0x03 << shift));
cy_as_hal_write_register(dev_p->tag,
- CY_AS_MEM_P0_RSE_ALLOCATE, (0x02 << shift)) ;
+ CY_AS_MEM_P0_RSE_ALLOCATE, (0x02 << shift));
cy_as_hal_write_register(dev_p->tag,
- CY_AS_MEM_P0_RSE_MASK, 0) ;
+ CY_AS_MEM_P0_RSE_MASK, 0);
- return CY_AS_ERROR_SUCCESS ;
+ return CY_AS_ERROR_SUCCESS;
}
cy_as_return_status_t
@@ -1570,84 +1570,84 @@ cy_as_misc_set_trace_level(cy_as_device_handle handle,
cy_as_function_callback cb,
uint32_t client)
{
- cy_as_ll_request_response *req_p, *reply_p ;
- cy_as_return_status_t ret ;
- cy_as_device *dev_p ;
+ cy_as_ll_request_response *req_p, *reply_p;
+ cy_as_return_status_t ret;
+ cy_as_device *dev_p;
- cy_as_log_debug_message(6, "cy_as_misc_set_trace_level called") ;
+ cy_as_log_debug_message(6, "cy_as_misc_set_trace_level called");
/* Make sure the device is ready for the command. */
- dev_p = (cy_as_device *)handle ;
- cy_as_check_device_ready(dev_p) ;
+ dev_p = (cy_as_device *)handle;
+ cy_as_check_device_ready(dev_p);
if (cy_as_device_is_in_suspend_mode(dev_p))
- return CY_AS_ERROR_IN_SUSPEND ;
+ return CY_AS_ERROR_IN_SUSPEND;
if (bus < 0 || bus >= CY_AS_MAX_BUSES)
- return CY_AS_ERROR_NO_SUCH_BUS ;
+ return CY_AS_ERROR_NO_SUCH_BUS;
if (device >= CY_AS_MAX_STORAGE_DEVICES)
- return CY_AS_ERROR_NO_SUCH_DEVICE ;
+ return CY_AS_ERROR_NO_SUCH_DEVICE;
if (unit > 255)
- return CY_AS_ERROR_NO_SUCH_UNIT ;
+ return CY_AS_ERROR_NO_SUCH_UNIT;
if (level >= CYAS_FW_TRACE_MAX_LEVEL)
- return CY_AS_ERROR_INVALID_TRACE_LEVEL ;
+ return CY_AS_ERROR_INVALID_TRACE_LEVEL;
/* Create the request to send to the West Bridge device */
req_p = cy_as_ll_create_request(dev_p, CY_RQT_SET_TRACE_LEVEL,
- CY_RQT_GENERAL_RQT_CONTEXT, 2) ;
+ CY_RQT_GENERAL_RQT_CONTEXT, 2);
if (req_p == 0)
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ return CY_AS_ERROR_OUT_OF_MEMORY;
cy_as_ll_request_response__set_word(req_p, 0,
- (uint16_t)level) ;
+ (uint16_t)level);
cy_as_ll_request_response__set_word(req_p, 1,
- (uint16_t)((bus << 12) | (device << 8) | (unit))) ;
+ (uint16_t)((bus << 12) | (device << 8) | (unit)));
/*
* Reserve space for the reply, the reply data will not
* exceed three words
*/
- reply_p = cy_as_ll_create_response(dev_p, 2) ;
+ reply_p = cy_as_ll_create_response(dev_p, 2);
if (reply_p == 0) {
- cy_as_ll_destroy_request(dev_p, req_p) ;
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ return CY_AS_ERROR_OUT_OF_MEMORY;
}
if (cb == 0) {
- ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p) ;
+ ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
if (cy_as_ll_request_response__get_code(reply_p) !=
CY_RESP_SUCCESS_FAILURE) {
- ret = CY_AS_ERROR_NOT_SUPPORTED ;
- goto destroy ;
+ ret = CY_AS_ERROR_NOT_SUPPORTED;
+ goto destroy;
}
- ret = cy_as_ll_request_response__get_word(reply_p, 0) ;
+ ret = cy_as_ll_request_response__get_word(reply_p, 0);
} else {
ret = cy_as_misc_send_request(dev_p, cb, client,
CY_FUNCT_CB_MISC_SETTRACELEVEL, 0, dev_p->func_cbs_misc,
CY_AS_REQUEST_RESPONSE_EX, req_p, reply_p,
- cy_as_misc_func_callback) ;
+ cy_as_misc_func_callback);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
/* The request and response are freed as part of the
* MiscFuncCallback */
- return ret ;
+ return ret;
}
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
- return ret ;
+ return ret;
}
cy_as_return_status_t
@@ -1656,67 +1656,67 @@ cy_as_misc_heart_beat_control(cy_as_device_handle handle,
cy_as_function_callback cb,
uint32_t client)
{
- cy_as_ll_request_response *req_p, *reply_p ;
- cy_as_return_status_t ret ;
- cy_as_device *dev_p ;
+ cy_as_ll_request_response *req_p, *reply_p;
+ cy_as_return_status_t ret;
+ cy_as_device *dev_p;
- cy_as_log_debug_message(6, "cy_as_misc_heart_beat_control called") ;
+ cy_as_log_debug_message(6, "cy_as_misc_heart_beat_control called");
/* Make sure the device is ready for the command. */
- dev_p = (cy_as_device *)handle ;
- cy_as_check_device_ready(dev_p) ;
+ dev_p = (cy_as_device *)handle;
+ cy_as_check_device_ready(dev_p);
if (cy_as_device_is_in_suspend_mode(dev_p))
- return CY_AS_ERROR_IN_SUSPEND ;
+ return CY_AS_ERROR_IN_SUSPEND;
/* Create the request to send to the West Bridge device */
req_p = cy_as_ll_create_request(dev_p, CY_RQT_CONTROL_ANTIOCH_HEARTBEAT,
- CY_RQT_GENERAL_RQT_CONTEXT, 1) ;
+ CY_RQT_GENERAL_RQT_CONTEXT, 1);
if (req_p == 0)
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ return CY_AS_ERROR_OUT_OF_MEMORY;
- cy_as_ll_request_response__set_word(req_p, 0, (uint16_t)enable) ;
+ cy_as_ll_request_response__set_word(req_p, 0, (uint16_t)enable);
/* Reserve space for the reply, the reply
* data will not exceed one word */
- reply_p = cy_as_ll_create_response(dev_p, 1) ;
+ reply_p = cy_as_ll_create_response(dev_p, 1);
if (reply_p == 0) {
- cy_as_ll_destroy_request(dev_p, req_p) ;
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ return CY_AS_ERROR_OUT_OF_MEMORY;
}
if (cb == 0) {
- ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p) ;
+ ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
if (cy_as_ll_request_response__get_code(reply_p) !=
CY_RESP_SUCCESS_FAILURE) {
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
- goto destroy ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
+ goto destroy;
}
- ret = cy_as_ll_request_response__get_word(reply_p, 0) ;
+ ret = cy_as_ll_request_response__get_word(reply_p, 0);
} else {
ret = cy_as_misc_send_request(dev_p, cb, client,
CY_FUNCT_CB_MISC_HEARTBEATCONTROL, 0,
dev_p->func_cbs_misc, CY_AS_REQUEST_RESPONSE_EX,
- req_p, reply_p, cy_as_misc_func_callback) ;
+ req_p, reply_p, cy_as_misc_func_callback);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
/* The request and response are freed as part of the
* MiscFuncCallback */
- return ret ;
+ return ret;
}
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
- return ret ;
+ return ret;
}
static cy_as_return_status_t
@@ -1727,58 +1727,58 @@ my_set_sd_clock_freq(
cy_as_function_callback cb,
uint32_t client)
{
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
- cy_as_ll_request_response *req_p, *reply_p ;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
+ cy_as_ll_request_response *req_p, *reply_p;
if (cy_as_device_is_in_callback(dev_p) && (cb == 0))
- return CY_AS_ERROR_INVALID_IN_CALLBACK ;
+ return CY_AS_ERROR_INVALID_IN_CALLBACK;
req_p = cy_as_ll_create_request(dev_p, CY_RQT_SET_SD_CLOCK_FREQ,
- CY_RQT_GENERAL_RQT_CONTEXT, 1) ;
+ CY_RQT_GENERAL_RQT_CONTEXT, 1);
if (req_p == 0)
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ return CY_AS_ERROR_OUT_OF_MEMORY;
cy_as_ll_request_response__set_word(req_p, 0,
- (uint16_t)((card_type << 8) | setting)) ;
+ (uint16_t)((card_type << 8) | setting));
/* Reserve space for the reply, which will not exceed one word. */
- reply_p = cy_as_ll_create_response(dev_p, 1) ;
+ reply_p = cy_as_ll_create_response(dev_p, 1);
if (reply_p == 0) {
- cy_as_ll_destroy_request(dev_p, req_p) ;
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ return CY_AS_ERROR_OUT_OF_MEMORY;
}
if (cb == 0) {
- ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p) ;
+ ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
if (cy_as_ll_request_response__get_code(reply_p) !=
CY_RESP_SUCCESS_FAILURE) {
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
- goto destroy ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
+ goto destroy;
}
- ret = cy_as_ll_request_response__get_word(reply_p, 0) ;
+ ret = cy_as_ll_request_response__get_word(reply_p, 0);
} else {
ret = cy_as_misc_send_request(dev_p, cb, client,
CY_FUNCT_CB_MISC_SETSDFREQ, 0, dev_p->func_cbs_misc,
CY_AS_REQUEST_RESPONSE_EX, req_p, reply_p,
- cy_as_misc_func_callback) ;
+ cy_as_misc_func_callback);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
/* The request and response are freed as part of the
* MiscFuncCallback */
- return ret ;
+ return ret;
}
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
- return ret ;
+ return ret;
}
cy_as_return_status_t
@@ -1788,22 +1788,22 @@ cy_as_misc_set_low_speed_sd_freq(
cy_as_function_callback cb,
uint32_t client)
{
- cy_as_device *dev_p ;
+ cy_as_device *dev_p;
- cy_as_log_debug_message(6, "cy_as_misc_set_low_speed_sd_freq called") ;
+ cy_as_log_debug_message(6, "cy_as_misc_set_low_speed_sd_freq called");
/* Make sure the device is ready for the command. */
- dev_p = (cy_as_device *)handle ;
- cy_as_check_device_ready(dev_p) ;
+ dev_p = (cy_as_device *)handle;
+ cy_as_check_device_ready(dev_p);
if (cy_as_device_is_in_suspend_mode(dev_p))
- return CY_AS_ERROR_IN_SUSPEND ;
+ return CY_AS_ERROR_IN_SUSPEND;
if ((setting != CY_AS_SD_DEFAULT_FREQ) &&
(setting != CY_AS_SD_RATED_FREQ))
- return CY_AS_ERROR_INVALID_PARAMETER ;
+ return CY_AS_ERROR_INVALID_PARAMETER;
- return my_set_sd_clock_freq(dev_p, 0, (uint8_t)setting, cb, client) ;
+ return my_set_sd_clock_freq(dev_p, 0, (uint8_t)setting, cb, client);
}
cy_as_return_status_t
@@ -1813,22 +1813,22 @@ cy_as_misc_set_high_speed_sd_freq(
cy_as_function_callback cb,
uint32_t client)
{
- cy_as_device *dev_p ;
+ cy_as_device *dev_p;
- cy_as_log_debug_message(6, "cy_as_misc_set_high_speed_sd_freq called") ;
+ cy_as_log_debug_message(6, "cy_as_misc_set_high_speed_sd_freq called");
/* Make sure the device is ready for the command. */
- dev_p = (cy_as_device *)handle ;
- cy_as_check_device_ready(dev_p) ;
+ dev_p = (cy_as_device *)handle;
+ cy_as_check_device_ready(dev_p);
if (cy_as_device_is_in_suspend_mode(dev_p))
- return CY_AS_ERROR_IN_SUSPEND ;
+ return CY_AS_ERROR_IN_SUSPEND;
if ((setting != CY_AS_HS_SD_FREQ_24) &&
(setting != CY_AS_HS_SD_FREQ_48))
- return CY_AS_ERROR_INVALID_PARAMETER ;
+ return CY_AS_ERROR_INVALID_PARAMETER;
- return my_set_sd_clock_freq(dev_p, 1, (uint8_t)setting, cb, client) ;
+ return my_set_sd_clock_freq(dev_p, 1, (uint8_t)setting, cb, client);
}
cy_as_return_status_t
@@ -1838,88 +1838,88 @@ cy_as_misc_get_gpio_value(cy_as_device_handle handle,
cy_as_function_callback cb,
uint32_t client)
{
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
- cy_as_ll_request_response *req_p, *reply_p ;
- cy_as_device *dev_p ;
- uint16_t v ;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
+ cy_as_ll_request_response *req_p, *reply_p;
+ cy_as_device *dev_p;
+ uint16_t v;
- cy_as_log_debug_message(6, "cy_as_misc_get_gpio_value called") ;
+ cy_as_log_debug_message(6, "cy_as_misc_get_gpio_value called");
/* Make sure the device is ready for the command. */
- dev_p = (cy_as_device *)handle ;
- cy_as_check_device_ready(dev_p) ;
+ dev_p = (cy_as_device *)handle;
+ cy_as_check_device_ready(dev_p);
/* If the pin specified is UVALID, there is no need
* for firmware to be loaded. */
if (pin == cy_as_misc_gpio_U_valid) {
- v = cy_as_hal_read_register(dev_p->tag, CY_AS_MEM_PMU_UPDATE) ;
- *value = (uint8_t)(v & CY_AS_MEM_PMU_UPDATE_UVALID) ;
+ v = cy_as_hal_read_register(dev_p->tag, CY_AS_MEM_PMU_UPDATE);
+ *value = (uint8_t)(v & CY_AS_MEM_PMU_UPDATE_UVALID);
if (cb != 0)
cb(dev_p, ret, client,
- CY_FUNCT_CB_MISC_GETGPIOVALUE, value) ;
+ CY_FUNCT_CB_MISC_GETGPIOVALUE, value);
- return ret ;
+ return ret;
}
/* Check whether the firmware supports this command. */
if (cy_as_device_is_nand_storage_supported(dev_p))
- return CY_AS_ERROR_NOT_SUPPORTED ;
+ return CY_AS_ERROR_NOT_SUPPORTED;
if (cy_as_device_is_in_suspend_mode(dev_p))
- return CY_AS_ERROR_IN_SUSPEND ;
+ return CY_AS_ERROR_IN_SUSPEND;
/* Make sure the pin selected is valid */
if ((pin != cy_as_misc_gpio_1) && (pin != cy_as_misc_gpio_0))
- return CY_AS_ERROR_INVALID_PARAMETER ;
+ return CY_AS_ERROR_INVALID_PARAMETER;
req_p = cy_as_ll_create_request(dev_p, CY_RQT_GET_GPIO_STATE,
- CY_RQT_GENERAL_RQT_CONTEXT, 1) ;
+ CY_RQT_GENERAL_RQT_CONTEXT, 1);
if (req_p == 0)
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ return CY_AS_ERROR_OUT_OF_MEMORY;
- cy_as_ll_request_response__set_word(req_p, 0, ((uint8_t)pin << 8)) ;
+ cy_as_ll_request_response__set_word(req_p, 0, ((uint8_t)pin << 8));
/* Reserve space for the reply, which will not exceed one word. */
- reply_p = cy_as_ll_create_response(dev_p, 1) ;
+ reply_p = cy_as_ll_create_response(dev_p, 1);
if (reply_p == 0) {
- cy_as_ll_destroy_request(dev_p, req_p) ;
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ return CY_AS_ERROR_OUT_OF_MEMORY;
}
if (cb == 0) {
- ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p) ;
+ ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
if (cy_as_ll_request_response__get_code(reply_p) !=
CY_RESP_GPIO_STATE) {
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
- goto destroy ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
+ goto destroy;
}
*value = (uint8_t)
- cy_as_ll_request_response__get_word(reply_p, 0) ;
+ cy_as_ll_request_response__get_word(reply_p, 0);
} else {
ret = cy_as_misc_send_request(dev_p, cb, client,
CY_FUNCT_CB_MISC_GETGPIOVALUE, value,
dev_p->func_cbs_misc, CY_AS_REQUEST_RESPONSE_EX,
- req_p, reply_p, cy_as_misc_func_callback) ;
+ req_p, reply_p, cy_as_misc_func_callback);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
/* The request and response are freed as part of the
* MiscFuncCallback */
- return ret ;
+ return ret;
}
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
- return ret ;
+ return ret;
}
@@ -1930,118 +1930,118 @@ cy_as_misc_set_gpio_value(cy_as_device_handle handle,
cy_as_function_callback cb,
uint32_t client)
{
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
- cy_as_ll_request_response *req_p, *reply_p ;
- cy_as_device *dev_p ;
- uint16_t v ;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
+ cy_as_ll_request_response *req_p, *reply_p;
+ cy_as_device *dev_p;
+ uint16_t v;
- cy_as_log_debug_message(6, "cy_as_misc_set_gpio_value called") ;
+ cy_as_log_debug_message(6, "cy_as_misc_set_gpio_value called");
/* Make sure the device is ready for the command. */
- dev_p = (cy_as_device *)handle ;
- cy_as_check_device_ready(dev_p) ;
+ dev_p = (cy_as_device *)handle;
+ cy_as_check_device_ready(dev_p);
/* If the pin specified is UVALID, there is
* no need for firmware to be loaded. */
if (pin == cy_as_misc_gpio_U_valid) {
- v = cy_as_hal_read_register(dev_p->tag, CY_AS_MEM_PMU_UPDATE) ;
+ v = cy_as_hal_read_register(dev_p->tag, CY_AS_MEM_PMU_UPDATE);
if (value)
cy_as_hal_write_register(dev_p->tag,
CY_AS_MEM_PMU_UPDATE,
- (v | CY_AS_MEM_PMU_UPDATE_UVALID)) ;
+ (v | CY_AS_MEM_PMU_UPDATE_UVALID));
else
cy_as_hal_write_register(dev_p->tag,
CY_AS_MEM_PMU_UPDATE,
- (v & ~CY_AS_MEM_PMU_UPDATE_UVALID)) ;
+ (v & ~CY_AS_MEM_PMU_UPDATE_UVALID));
if (cb != 0)
cb(dev_p, ret, client,
- CY_FUNCT_CB_MISC_SETGPIOVALUE, 0) ;
- return ret ;
+ CY_FUNCT_CB_MISC_SETGPIOVALUE, 0);
+ return ret;
}
/* Check whether the firmware supports this command. */
if (cy_as_device_is_nand_storage_supported(dev_p))
- return CY_AS_ERROR_NOT_SUPPORTED ;
+ return CY_AS_ERROR_NOT_SUPPORTED;
if (cy_as_device_is_in_suspend_mode(dev_p))
- return CY_AS_ERROR_IN_SUSPEND ;
+ return CY_AS_ERROR_IN_SUSPEND;
/* Make sure the pin selected is valid */
if ((pin < cy_as_misc_gpio_0) || (pin > cy_as_misc_gpio_U_valid))
- return CY_AS_ERROR_INVALID_PARAMETER ;
+ return CY_AS_ERROR_INVALID_PARAMETER;
/* Create and initialize the low level request to the firmware. */
req_p = cy_as_ll_create_request(dev_p, CY_RQT_SET_GPIO_STATE,
- CY_RQT_GENERAL_RQT_CONTEXT, 1) ;
+ CY_RQT_GENERAL_RQT_CONTEXT, 1);
if (req_p == 0)
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ return CY_AS_ERROR_OUT_OF_MEMORY;
- v = (uint16_t)(((uint8_t)pin << 8) | (value > 0)) ;
- cy_as_ll_request_response__set_word(req_p, 0, v) ;
+ v = (uint16_t)(((uint8_t)pin << 8) | (value > 0));
+ cy_as_ll_request_response__set_word(req_p, 0, v);
/* Reserve space for the reply, which will not exceed one word. */
- reply_p = cy_as_ll_create_response(dev_p, 1) ;
+ reply_p = cy_as_ll_create_response(dev_p, 1);
if (reply_p == 0) {
- cy_as_ll_destroy_request(dev_p, req_p) ;
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ return CY_AS_ERROR_OUT_OF_MEMORY;
}
if (cb == 0) {
- ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p) ;
+ ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
if (cy_as_ll_request_response__get_code(reply_p) !=
CY_RESP_SUCCESS_FAILURE) {
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
- goto destroy ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
+ goto destroy;
}
- ret = cy_as_ll_request_response__get_word(reply_p, 0) ;
+ ret = cy_as_ll_request_response__get_word(reply_p, 0);
} else {
ret = cy_as_misc_send_request(dev_p, cb, client,
CY_FUNCT_CB_MISC_SETGPIOVALUE, 0,
dev_p->func_cbs_misc, CY_AS_REQUEST_RESPONSE_EX,
- req_p, reply_p, cy_as_misc_func_callback) ;
+ req_p, reply_p, cy_as_misc_func_callback);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
/* The request and response are freed as part of the
* MiscFuncCallback */
- return ret ;
+ return ret;
}
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
- return ret ;
+ return ret;
}
static cy_as_return_status_t
my_enter_standby(cy_as_device *dev_p, cy_bool pin)
{
- cy_as_misc_cancel_ex_requests(dev_p) ;
+ cy_as_misc_cancel_ex_requests(dev_p);
/* Save the current values in the critical P-port
* registers, where necessary. */
- cy_as_hal_read_regs_before_standby(dev_p->tag) ;
+ cy_as_hal_read_regs_before_standby(dev_p->tag);
if (pin) {
if (cy_as_hal_set_wakeup_pin(dev_p->tag, cy_false))
- cy_as_device_set_pin_standby(dev_p) ;
+ cy_as_device_set_pin_standby(dev_p);
else
- return CY_AS_ERROR_SETTING_WAKEUP_PIN ;
+ return CY_AS_ERROR_SETTING_WAKEUP_PIN;
} else {
/*
* put antioch in the standby mode
*/
cy_as_hal_write_register(dev_p->tag,
- CY_AS_MEM_PWR_MAGT_STAT, 0x02) ;
- cy_as_device_set_register_standby(dev_p) ;
+ CY_AS_MEM_PWR_MAGT_STAT, 0x02);
+ cy_as_device_set_register_standby(dev_p);
}
/*
@@ -2049,7 +2049,7 @@ my_enter_standby(cy_as_device *dev_p, cy_bool pin)
* the firmware initialization completes before sending other
* requests down.
*/
- cy_as_device_set_firmware_not_loaded(dev_p) ;
+ cy_as_device_set_firmware_not_loaded(dev_p);
/*
* keep west bridge interrupt disabled until the device is being woken
@@ -2057,7 +2057,7 @@ my_enter_standby(cy_as_device *dev_p, cy_bool pin)
*/
dev_p->stby_int_mask = cy_as_hal_disable_interrupts();
- return CY_AS_ERROR_SUCCESS ;
+ return CY_AS_ERROR_SUCCESS;
}
static cy_as_return_status_t
@@ -2066,26 +2066,26 @@ my_handle_response_enter_standby(cy_as_device *dev_p,
cy_as_ll_request_response *reply_p,
cy_bool pin)
{
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
if (cy_as_ll_request_response__get_code(reply_p) !=
CY_RESP_SUCCESS_FAILURE) {
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
- goto destroy ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
+ goto destroy;
}
- ret = cy_as_ll_request_response__get_word(reply_p, 0) ;
+ ret = cy_as_ll_request_response__get_word(reply_p, 0);
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
- ret = my_enter_standby(dev_p, pin) ;
+ ret = my_enter_standby(dev_p, pin);
- return ret ;
+ return ret;
}
cy_as_return_status_t
@@ -2094,28 +2094,28 @@ cy_as_misc_enter_standby(cy_as_device_handle handle,
cy_as_function_callback cb,
uint32_t client)
{
- cy_as_device *dev_p ;
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
- cy_as_ll_request_response *req_p, *reply_p ;
- cy_bool standby ;
+ cy_as_device *dev_p;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
+ cy_as_ll_request_response *req_p, *reply_p;
+ cy_bool standby;
- cy_as_log_debug_message(6, "cy_as_misc_enter_standby called") ;
+ cy_as_log_debug_message(6, "cy_as_misc_enter_standby called");
/* Make sure we have a valid device */
- dev_p = (cy_as_device *)handle ;
+ dev_p = (cy_as_device *)handle;
if (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE))
- return CY_AS_ERROR_INVALID_HANDLE ;
+ return CY_AS_ERROR_INVALID_HANDLE;
/*
* if we already are in standby, do not do it again and let the
* user know via the error return.
*/
- ret = cy_as_misc_in_standby(handle, &standby) ;
+ ret = cy_as_misc_in_standby(handle, &standby);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
if (standby == cy_true)
- return CY_AS_ERROR_ALREADY_STANDBY ;
+ return CY_AS_ERROR_ALREADY_STANDBY;
/*
* if the user wants to transition from suspend mode to standby mode,
@@ -2123,7 +2123,7 @@ cy_as_misc_enter_standby(cy_as_device_handle handle,
* operations.
*/
if (cy_as_device_is_in_suspend_mode(dev_p))
- cy_as_misc_leave_suspend(dev_p, 0, 0) ;
+ cy_as_misc_leave_suspend(dev_p, 0, 0);
if (dev_p->usb_count) {
/*
@@ -2131,7 +2131,7 @@ cy_as_misc_enter_standby(cy_as_device_handle handle,
* USB stack is initialized. you must stop the USB stack in
* order to enter standby mode.
*/
- return CY_AS_ERROR_USB_RUNNING ;
+ return CY_AS_ERROR_USB_RUNNING;
}
/*
@@ -2147,71 +2147,71 @@ cy_as_misc_enter_standby(cy_as_device_handle handle,
if (cy_as_device_is_storage_async_pending(dev_p)) {
/* DrainQueue will not work in polling mode */
if (cy_as_hal_is_polling())
- return CY_AS_ERROR_ASYNC_PENDING ;
+ return CY_AS_ERROR_ASYNC_PENDING;
cy_as_dma_drain_queue(dev_p,
- CY_AS_P2S_READ_ENDPOINT, cy_false) ;
+ CY_AS_P2S_READ_ENDPOINT, cy_false);
cy_as_dma_drain_queue(dev_p,
- CY_AS_P2S_WRITE_ENDPOINT, cy_false) ;
+ CY_AS_P2S_WRITE_ENDPOINT, cy_false);
/*
* if more storage operations were queued
* at this stage, return an error.
*/
if (cy_as_device_is_storage_async_pending(dev_p))
- return CY_AS_ERROR_ASYNC_PENDING ;
+ return CY_AS_ERROR_ASYNC_PENDING;
}
req_p = cy_as_ll_create_request(dev_p,
CY_RQT_PREPARE_FOR_STANDBY,
- CY_RQT_GENERAL_RQT_CONTEXT, 1) ;
+ CY_RQT_GENERAL_RQT_CONTEXT, 1);
if (req_p == 0)
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ return CY_AS_ERROR_OUT_OF_MEMORY;
- reply_p = cy_as_ll_create_response(dev_p, 1) ;
+ reply_p = cy_as_ll_create_response(dev_p, 1);
if (reply_p == 0) {
- cy_as_ll_destroy_request(dev_p, req_p) ;
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ return CY_AS_ERROR_OUT_OF_MEMORY;
}
if (!cb) {
ret = cy_as_ll_send_request_wait_reply(dev_p,
- req_p, reply_p) ;
+ req_p, reply_p);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
/* The request and response are freed
* in the HandleResponse */
return my_handle_response_enter_standby(dev_p,
- req_p, reply_p, pin) ;
+ req_p, reply_p, pin);
} else {
ret = cy_as_misc_send_request(dev_p, cb, client,
CY_FUNCT_CB_MISC_ENTERSTANDBY, (void *)pin,
dev_p->func_cbs_misc, CY_AS_REQUEST_RESPONSE_EX,
- req_p, reply_p, cy_as_misc_func_callback) ;
+ req_p, reply_p, cy_as_misc_func_callback);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
/* The request and response are freed
* as part of the MiscFuncCallback */
- return ret ;
+ return ret;
}
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
} else {
- ret = my_enter_standby(dev_p, pin) ;
+ ret = my_enter_standby(dev_p, pin);
if (cb)
/* Even though no mailbox communication was
* needed, issue the callback so the user
* does not need to special case their code. */
cb((cy_as_device_handle)dev_p, ret, client,
- CY_FUNCT_CB_MISC_ENTERSTANDBY, 0) ;
+ CY_FUNCT_CB_MISC_ENTERSTANDBY, 0);
}
- return ret ;
+ return ret;
}
cy_as_return_status_t
@@ -2221,39 +2221,39 @@ cy_as_misc_enter_standby_e_x_u(cy_as_device_handle handle,
cy_as_function_callback cb,
uint32_t client)
{
- cy_as_device *dev_p ;
+ cy_as_device *dev_p;
- dev_p = (cy_as_device *)handle ;
+ dev_p = (cy_as_device *)handle;
if (uvalid_special)
- cy_as_hal_write_register(dev_p->tag, 0xc5, 0x4) ;
+ cy_as_hal_write_register(dev_p->tag, 0xc5, 0x4);
- return cy_as_misc_enter_standby(handle, pin, cb, client) ;
+ return cy_as_misc_enter_standby(handle, pin, cb, client);
}
cy_as_return_status_t
cy_as_misc_leave_standby(cy_as_device_handle handle,
cy_as_resource_type resource)
{
- cy_as_device *dev_p ;
- uint16_t v ;
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
- uint32_t count = 8 ;
- uint8_t retry = 1 ;
+ cy_as_device *dev_p;
+ uint16_t v;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
+ uint32_t count = 8;
+ uint8_t retry = 1;
- cy_as_log_debug_message(6, "cy_as_misc_leave_standby called") ;
- (void)resource ;
+ cy_as_log_debug_message(6, "cy_as_misc_leave_standby called");
+ (void)resource;
/* Make sure we have a valid device */
- dev_p = (cy_as_device *)handle ;
+ dev_p = (cy_as_device *)handle;
if (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE))
- return CY_AS_ERROR_INVALID_HANDLE ;
+ return CY_AS_ERROR_INVALID_HANDLE;
if (cy_as_device_is_register_standby(dev_p)) {
/*
* set a flag to indicate that the west bridge is waking
* up from standby.
*/
- cy_as_device_set_waking(dev_p) ;
+ cy_as_device_set_waking(dev_p);
/*
* the initial read will not succeed, but will just wake
@@ -2261,7 +2261,7 @@ cy_as_misc_leave_standby(cy_as_device_handle handle,
* should succeed and in that way we know west bridge is awake.
*/
v = cy_as_hal_read_register(dev_p->tag,
- CY_AS_MEM_CM_WB_CFG_ID) ;
+ CY_AS_MEM_CM_WB_CFG_ID);
do {
/*
@@ -2272,12 +2272,12 @@ cy_as_misc_leave_standby(cy_as_device_handle handle,
*/
if (cy_as_device_is_crystal(dev_p))
cy_as_hal_sleep(
- CY_AS_LEAVE_STANDBY_DELAY_CRYSTAL) ;
+ CY_AS_LEAVE_STANDBY_DELAY_CRYSTAL);
else
cy_as_hal_sleep(
- CY_AS_LEAVE_STANDBY_DELAY_CLOCK) ;
+ CY_AS_LEAVE_STANDBY_DELAY_CLOCK);
v = cy_as_hal_read_register(dev_p->tag,
- CY_AS_MEM_CM_WB_CFG_ID) ;
+ CY_AS_MEM_CM_WB_CFG_ID);
/*
* if the P-SPI interface mode is in use, there may be a
@@ -2288,11 +2288,11 @@ cy_as_misc_leave_standby(cy_as_device_handle handle,
if (cy_as_hal_sync_device_clocks(dev_p->tag) !=
cy_true) {
cy_as_hal_enable_interrupts(
- dev_p->stby_int_mask) ;
- return CY_AS_ERROR_TIMEOUT ;
+ dev_p->stby_int_mask);
+ return CY_AS_ERROR_TIMEOUT;
}
}
- } while (!is_valid_silicon_id(v) && count-- > 0) ;
+ } while (!is_valid_silicon_id(v) && count-- > 0);
/*
* if we tried to read the register and could not,
@@ -2300,8 +2300,8 @@ cy_as_misc_leave_standby(cy_as_device_handle handle,
*/
if (count == 0) {
cy_as_hal_enable_interrupts(
- dev_p->stby_int_mask) ;
- return CY_AS_ERROR_TIMEOUT ;
+ dev_p->stby_int_mask);
+ return CY_AS_ERROR_TIMEOUT;
}
/*
@@ -2310,19 +2310,19 @@ cy_as_misc_leave_standby(cy_as_device_handle handle,
* initialization, is ensured by marking the firmware as
* not loaded until the init event is received.
*/
- cy_as_device_clear_register_standby(dev_p) ;
+ cy_as_device_clear_register_standby(dev_p);
/*
* initialize any registers that may have been changed
* while the device was in standby mode.
*/
- cy_as_hal_init_dev_registers(dev_p->tag, cy_true) ;
+ cy_as_hal_init_dev_registers(dev_p->tag, cy_true);
} else if (cy_as_device_is_pin_standby(dev_p)) {
/*
* set a flag to indicate that the west bridge is waking
* up from standby.
*/
- cy_as_device_set_waking(dev_p) ;
+ cy_as_device_set_waking(dev_p);
try_wakeup_again:
/*
@@ -2330,8 +2330,8 @@ try_wakeup_again:
* layer, return this failure to the user.
*/
if (!cy_as_hal_set_wakeup_pin(dev_p->tag, cy_true)) {
- cy_as_hal_enable_interrupts(dev_p->stby_int_mask) ;
- return CY_AS_ERROR_SETTING_WAKEUP_PIN ;
+ cy_as_hal_enable_interrupts(dev_p->stby_int_mask);
+ return CY_AS_ERROR_SETTING_WAKEUP_PIN;
}
/*
@@ -2341,15 +2341,15 @@ try_wakeup_again:
* and we can talk to the device.
*/
if (cy_as_device_is_crystal(dev_p))
- cy_as_hal_sleep(CY_AS_LEAVE_STANDBY_DELAY_CRYSTAL) ;
+ cy_as_hal_sleep(CY_AS_LEAVE_STANDBY_DELAY_CRYSTAL);
else
- cy_as_hal_sleep(CY_AS_LEAVE_STANDBY_DELAY_CLOCK) ;
+ cy_as_hal_sleep(CY_AS_LEAVE_STANDBY_DELAY_CLOCK);
/*
* initialize any registers that may have been changed
* while the device was in standby mode.
*/
- cy_as_hal_init_dev_registers(dev_p->tag, cy_true) ;
+ cy_as_hal_init_dev_registers(dev_p->tag, cy_true);
/*
* the standby flag is cleared here, after the action to
@@ -2357,34 +2357,34 @@ try_wakeup_again:
* initialization, is ensured by marking the firmware as
* not loaded until the init event is received.
*/
- cy_as_device_clear_pin_standby(dev_p) ;
+ cy_as_device_clear_pin_standby(dev_p);
} else {
- return CY_AS_ERROR_NOT_IN_STANDBY ;
+ return CY_AS_ERROR_NOT_IN_STANDBY;
}
/*
* the west bridge interrupt can be enabled now.
*/
- cy_as_hal_enable_interrupts(dev_p->stby_int_mask) ;
+ cy_as_hal_enable_interrupts(dev_p->stby_int_mask);
/*
* release the west bridge micro-_controller from reset,
* so that firmware initialization can complete. the attempt
* to release antioch reset is made upto 8 times.
*/
- v = 0x03 ;
- count = 0x08 ;
+ v = 0x03;
+ count = 0x08;
while ((v & 0x03) && (count)) {
cy_as_hal_write_register(dev_p->tag,
- CY_AS_MEM_RST_CTRL_REG, 0x00) ;
+ CY_AS_MEM_RST_CTRL_REG, 0x00);
v = cy_as_hal_read_register(dev_p->tag,
- CY_AS_MEM_RST_CTRL_REG) ;
- count-- ;
+ CY_AS_MEM_RST_CTRL_REG);
+ count--;
}
if (v & 0x03) {
- cy_as_hal_print_message("failed to clear antioch reset\n") ;
- return CY_AS_ERROR_TIMEOUT ;
+ cy_as_hal_print_message("failed to clear antioch reset\n");
+ return CY_AS_ERROR_TIMEOUT;
}
/*
@@ -2394,36 +2394,36 @@ try_wakeup_again:
* again in an attempt to start the firmware properly.
*/
if (retry) {
- count = 10 ;
+ count = 10;
while (count) {
/* If the wake-up event has been received,
* we can return. */
if (cy_as_device_is_firmware_loaded(dev_p))
- break ;
+ break;
/* If we are in polling mode, the interrupt may
* not have been serviced as yet. read the
* interrupt status register. if a pending mailbox
* interrupt is seen, we can assume that the
* wake-up event will be received soon. */
v = cy_as_hal_read_register(dev_p->tag,
- CY_AS_MEM_P0_INTR_REG) ;
+ CY_AS_MEM_P0_INTR_REG);
if (v & CY_AS_MEM_P0_INTR_REG_MBINT)
- break ;
+ break;
- cy_as_hal_sleep(10) ;
- count-- ;
+ cy_as_hal_sleep(10);
+ count--;
}
if (!count) {
- retry = 0 ;
- dev_p->stby_int_mask = cy_as_hal_disable_interrupts() ;
- cy_as_hal_set_wakeup_pin(dev_p->tag, cy_false) ;
- cy_as_hal_sleep(10) ;
- goto try_wakeup_again ;
+ retry = 0;
+ dev_p->stby_int_mask = cy_as_hal_disable_interrupts();
+ cy_as_hal_set_wakeup_pin(dev_p->tag, cy_false);
+ cy_as_hal_sleep(10);
+ goto try_wakeup_again;
}
}
- return ret ;
+ return ret;
}
cy_as_return_status_t
@@ -2434,17 +2434,17 @@ cy_as_misc_register_callback(
cy_as_misc_event_callback callback
)
{
- cy_as_device *dev_p ;
+ cy_as_device *dev_p;
- cy_as_log_debug_message(6, "cy_as_misc_register_callback called") ;
+ cy_as_log_debug_message(6, "cy_as_misc_register_callback called");
/* Make sure we have a valid device */
- dev_p = (cy_as_device *)handle ;
+ dev_p = (cy_as_device *)handle;
if (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE))
- return CY_AS_ERROR_INVALID_HANDLE ;
+ return CY_AS_ERROR_INVALID_HANDLE;
- dev_p->misc_event_cb = callback ;
- return CY_AS_ERROR_SUCCESS ;
+ dev_p->misc_event_cb = callback;
+ return CY_AS_ERROR_SUCCESS;
}
cy_as_return_status_t
@@ -2452,79 +2452,79 @@ cy_as_misc_storage_changed(cy_as_device_handle handle,
cy_as_function_callback cb,
uint32_t client)
{
- cy_as_device *dev_p ;
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
- cy_bool standby ;
- cy_as_ll_request_response *req_p, *reply_p ;
+ cy_as_device *dev_p;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
+ cy_bool standby;
+ cy_as_ll_request_response *req_p, *reply_p;
- cy_as_log_debug_message(6, "cy_as_misc_storage_changed called") ;
+ cy_as_log_debug_message(6, "cy_as_misc_storage_changed called");
/* Make sure the device is ready for the command. */
- dev_p = (cy_as_device *)handle ;
- cy_as_check_device_ready(dev_p) ;
+ dev_p = (cy_as_device *)handle;
+ cy_as_check_device_ready(dev_p);
/*
* make sure antioch is not in standby
*/
- ret = cy_as_misc_in_standby(dev_p, &standby) ;
+ ret = cy_as_misc_in_standby(dev_p, &standby);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
if (standby)
- return CY_AS_ERROR_IN_STANDBY ;
+ return CY_AS_ERROR_IN_STANDBY;
/*
* make sure westbridge is not in suspend mode.
*/
if (cy_as_device_is_in_suspend_mode(dev_p))
- return CY_AS_ERROR_IN_SUSPEND ;
+ return CY_AS_ERROR_IN_SUSPEND;
/* Create the request to send to the West Bridge device */
req_p = cy_as_ll_create_request(dev_p, CY_RQT_STORAGE_MEDIA_CHANGED,
- CY_RQT_GENERAL_RQT_CONTEXT, 0) ;
+ CY_RQT_GENERAL_RQT_CONTEXT, 0);
if (req_p == 0)
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ return CY_AS_ERROR_OUT_OF_MEMORY;
/* Reserve space for the reply, the reply data will
* not exceed one word */
- reply_p = cy_as_ll_create_response(dev_p, 1) ;
+ reply_p = cy_as_ll_create_response(dev_p, 1);
if (reply_p == 0) {
- cy_as_ll_destroy_request(dev_p, req_p) ;
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ return CY_AS_ERROR_OUT_OF_MEMORY;
}
if (cb == 0) {
- ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p) ;
+ ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
if (cy_as_ll_request_response__get_code(reply_p) !=
CY_RESP_SUCCESS_FAILURE) {
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
- goto destroy ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
+ goto destroy;
}
- ret = cy_as_ll_request_response__get_word(reply_p, 0) ;
+ ret = cy_as_ll_request_response__get_word(reply_p, 0);
} else {
ret = cy_as_misc_send_request(dev_p, cb, client,
CY_FUNCT_CB_MISC_STORAGECHANGED, 0,
dev_p->func_cbs_misc, CY_AS_REQUEST_RESPONSE_EX,
- req_p, reply_p, cy_as_misc_func_callback) ;
+ req_p, reply_p, cy_as_misc_func_callback);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
/* The request and response are freed as part of the
* MiscFuncCallback */
- return ret ;
+ return ret;
}
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
- return ret ;
+ return ret;
}
@@ -2536,73 +2536,73 @@ cy_as_misc_enter_suspend(
cy_as_function_callback cb,
uint32_t client)
{
- cy_as_device *dev_p ;
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
- cy_bool standby ;
- cy_as_ll_request_response *req_p, *reply_p ;
- uint16_t value ;
- uint32_t int_state ;
+ cy_as_device *dev_p;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
+ cy_bool standby;
+ cy_as_ll_request_response *req_p, *reply_p;
+ uint16_t value;
+ uint32_t int_state;
- cy_as_log_debug_message(6, "cy_as_misc_enter_suspend called") ;
+ cy_as_log_debug_message(6, "cy_as_misc_enter_suspend called");
/*
* basic sanity checks to ensure that the device is initialised.
*/
- dev_p = (cy_as_device *)handle ;
- cy_as_check_device_ready(dev_p) ;
+ dev_p = (cy_as_device *)handle;
+ cy_as_check_device_ready(dev_p);
/*
* make sure west bridge is not already in standby
*/
- cy_as_misc_in_standby(dev_p, &standby) ;
+ cy_as_misc_in_standby(dev_p, &standby);
if (standby)
- return CY_AS_ERROR_IN_STANDBY ;
+ return CY_AS_ERROR_IN_STANDBY;
/*
* make sure that the device is not already in suspend mode.
*/
if (cy_as_device_is_in_suspend_mode(dev_p))
- return CY_AS_ERROR_IN_SUSPEND ;
+ return CY_AS_ERROR_IN_SUSPEND;
/*
* make sure there is no active USB connection.
*/
if ((cy_as_device_is_usb_connected(dev_p)) && (dev_p->usb_last_event
!= cy_as_event_usb_suspend))
- return CY_AS_ERROR_USB_CONNECTED ;
+ return CY_AS_ERROR_USB_CONNECTED;
/*
* make sure that there are no async requests at this point in time.
*/
- int_state = cy_as_hal_disable_interrupts() ;
+ int_state = cy_as_hal_disable_interrupts();
if ((dev_p->func_cbs_misc->count) || (dev_p->func_cbs_res->count) ||
(dev_p->func_cbs_stor->count) || (dev_p->func_cbs_usb->count)) {
- cy_as_hal_enable_interrupts(int_state) ;
- return CY_AS_ERROR_ASYNC_PENDING ;
+ cy_as_hal_enable_interrupts(int_state);
+ return CY_AS_ERROR_ASYNC_PENDING;
}
- cy_as_hal_enable_interrupts(int_state) ;
+ cy_as_hal_enable_interrupts(int_state);
/* Create the request to send to the Antioch device */
req_p = cy_as_ll_create_request(dev_p, CY_RQT_ENTER_SUSPEND_MODE,
- CY_RQT_GENERAL_RQT_CONTEXT, 1) ;
+ CY_RQT_GENERAL_RQT_CONTEXT, 1);
if (req_p == 0)
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ return CY_AS_ERROR_OUT_OF_MEMORY;
/* Reserve space for the reply, the reply data will not
* exceed one word */
- reply_p = cy_as_ll_create_response(dev_p, 1) ;
+ reply_p = cy_as_ll_create_response(dev_p, 1);
if (reply_p == 0) {
- cy_as_ll_destroy_request(dev_p, req_p) ;
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ return CY_AS_ERROR_OUT_OF_MEMORY;
}
/* Wakeup control flags. */
- value = 0x0001 ;
+ value = 0x0001;
if (usb_wakeup_en)
- value |= 0x04 ;
+ value |= 0x04;
if (gpio_wakeup_en)
- value |= 0x02 ;
- cy_as_ll_request_response__set_word(req_p, 0, value) ;
+ value |= 0x02;
+ cy_as_ll_request_response__set_word(req_p, 0, value);
if (cb != 0) {
@@ -2610,29 +2610,29 @@ cy_as_misc_enter_suspend(
CY_FUNCT_CB_MISC_ENTERSUSPEND,
0, dev_p->func_cbs_misc, CY_AS_REQUEST_RESPONSE_EX,
req_p, reply_p,
- cy_as_misc_func_callback) ;
+ cy_as_misc_func_callback);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
- return CY_AS_ERROR_SUCCESS ;
+ return CY_AS_ERROR_SUCCESS;
} else {
- ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p) ;
+ ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p);
if (cy_as_ll_request_response__get_code(reply_p) !=
CY_RESP_SUCCESS_FAILURE)
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
else
- ret = cy_as_ll_request_response__get_word(reply_p, 0) ;
+ ret = cy_as_ll_request_response__get_word(reply_p, 0);
}
destroy:
if (ret == CY_AS_ERROR_SUCCESS)
- cy_as_device_set_suspend_mode(dev_p) ;
+ cy_as_device_set_suspend_mode(dev_p);
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
- return ret ;
+ return ret;
}
cy_as_return_status_t
@@ -2641,26 +2641,26 @@ cy_as_misc_leave_suspend(
cy_as_function_callback cb,
uint32_t client)
{
- cy_as_device *dev_p ;
- uint16_t v, count ;
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
+ cy_as_device *dev_p;
+ uint16_t v, count;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
- cy_as_log_debug_message(6, "cy_as_misc_leave_suspend called") ;
+ cy_as_log_debug_message(6, "cy_as_misc_leave_suspend called");
/* Make sure we have a valid device */
- dev_p = (cy_as_device *)handle ;
- cy_as_check_device_ready(dev_p) ;
+ dev_p = (cy_as_device *)handle;
+ cy_as_check_device_ready(dev_p);
/* Make sure we are in suspend mode. */
if (cy_as_device_is_in_suspend_mode(dev_p)) {
if (cb) {
cy_as_func_c_b_node *cbnode =
cy_as_create_func_c_b_node_data(cb, client,
- CY_FUNCT_CB_MISC_LEAVESUSPEND, 0) ;
+ CY_FUNCT_CB_MISC_LEAVESUSPEND, 0);
if (cbnode == 0)
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ return CY_AS_ERROR_OUT_OF_MEMORY;
- cy_as_insert_c_b_node(dev_p->func_cbs_misc, cbnode) ;
+ cy_as_insert_c_b_node(dev_p->func_cbs_misc, cbnode);
}
/*
@@ -2668,15 +2668,15 @@ cy_as_misc_leave_suspend(
* will wake west bridge. the read is repeated until the
* read comes back with valid data.
*/
- count = 8 ;
+ count = 8;
v = cy_as_hal_read_register(dev_p->tag,
- CY_AS_MEM_CM_WB_CFG_ID) ;
+ CY_AS_MEM_CM_WB_CFG_ID);
while (!is_valid_silicon_id(v) && count-- > 0) {
- cy_as_hal_sleep(CY_AS_LEAVE_STANDBY_DELAY_CLOCK) ;
+ cy_as_hal_sleep(CY_AS_LEAVE_STANDBY_DELAY_CLOCK);
v = cy_as_hal_read_register(dev_p->tag,
- CY_AS_MEM_CM_WB_CFG_ID) ;
+ CY_AS_MEM_CM_WB_CFG_ID);
}
/*
@@ -2684,25 +2684,25 @@ cy_as_misc_leave_suspend(
* return a timeout
*/
if (count == 0)
- return CY_AS_ERROR_TIMEOUT ;
+ return CY_AS_ERROR_TIMEOUT;
} else
- return CY_AS_ERROR_NOT_IN_SUSPEND ;
+ return CY_AS_ERROR_NOT_IN_SUSPEND;
if (cb == 0) {
/*
* wait until the in suspend mode flag is cleared.
*/
- count = 20 ;
+ count = 20;
while ((cy_as_device_is_in_suspend_mode(dev_p))
&& (count--)) {
- cy_as_hal_sleep(CY_AS_LEAVE_STANDBY_DELAY_CLOCK) ;
+ cy_as_hal_sleep(CY_AS_LEAVE_STANDBY_DELAY_CLOCK);
}
if (cy_as_device_is_in_suspend_mode(dev_p))
- ret = CY_AS_ERROR_TIMEOUT ;
+ ret = CY_AS_ERROR_TIMEOUT;
}
- return ret ;
+ return ret;
}
cy_as_return_status_t
@@ -2711,83 +2711,83 @@ cy_as_misc_reserve_l_n_a_boot_area(cy_as_device_handle handle,
cy_as_function_callback cb,
uint32_t client)
{
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
- cy_bool standby ;
- cy_as_ll_request_response *req_p, *reply_p ;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
+ cy_bool standby;
+ cy_as_ll_request_response *req_p, *reply_p;
- cy_as_device *dev_p ;
+ cy_as_device *dev_p;
- (void)client ;
+ (void)client;
- cy_as_log_debug_message(6, "cy_as_misc_switch_pnand_mode called") ;
+ cy_as_log_debug_message(6, "cy_as_misc_switch_pnand_mode called");
/* Make sure we have a valid device */
- dev_p = (cy_as_device *)handle ;
- cy_as_check_device_ready(dev_p) ;
+ dev_p = (cy_as_device *)handle;
+ cy_as_check_device_ready(dev_p);
/*
* make sure antioch is not in standby
*/
- ret = cy_as_misc_in_standby(dev_p, &standby) ;
+ ret = cy_as_misc_in_standby(dev_p, &standby);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
if (standby)
- return CY_AS_ERROR_IN_STANDBY ;
+ return CY_AS_ERROR_IN_STANDBY;
/* Make sure the Antioch is not in suspend mode. */
if (cy_as_device_is_in_suspend_mode(dev_p))
- return CY_AS_ERROR_IN_SUSPEND ;
+ return CY_AS_ERROR_IN_SUSPEND;
/* Create the request to send to the West Bridge device */
req_p = cy_as_ll_create_request(dev_p,
CY_RQT_RESERVE_LNA_BOOT_AREA,
- CY_RQT_GENERAL_RQT_CONTEXT, 1) ;
+ CY_RQT_GENERAL_RQT_CONTEXT, 1);
if (req_p == 0)
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ return CY_AS_ERROR_OUT_OF_MEMORY;
cy_as_ll_request_response__set_word(req_p,
- 0, (uint16_t)numzones) ;
+ 0, (uint16_t)numzones);
/* Reserve space for the reply, the reply data will not
* exceed one word */
- reply_p = cy_as_ll_create_response(dev_p, 1) ;
+ reply_p = cy_as_ll_create_response(dev_p, 1);
if (reply_p == 0) {
- cy_as_ll_destroy_request(dev_p, req_p) ;
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ return CY_AS_ERROR_OUT_OF_MEMORY;
}
if (cb == 0) {
ret = cy_as_ll_send_request_wait_reply(dev_p,
- req_p, reply_p) ;
+ req_p, reply_p);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
if (cy_as_ll_request_response__get_code(reply_p) !=
CY_RESP_SUCCESS_FAILURE) {
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
- goto destroy ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
+ goto destroy;
}
- ret = cy_as_ll_request_response__get_word(reply_p, 0) ;
+ ret = cy_as_ll_request_response__get_word(reply_p, 0);
} else {
ret = cy_as_misc_send_request(dev_p, cb, client,
CY_FUNCT_CB_MISC_RESERVELNABOOTAREA,
0, dev_p->func_cbs_misc, CY_AS_REQUEST_RESPONSE_EX,
- req_p, reply_p, cy_as_misc_func_callback) ;
+ req_p, reply_p, cy_as_misc_func_callback);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
/* The request and response are freed as part of the
* MiscFuncCallback */
- return ret ;
+ return ret;
}
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
- return ret ;
+ return ret;
}
cy_as_func_c_b_node*
@@ -2796,23 +2796,23 @@ cy_as_create_func_c_b_node_data(cy_as_function_callback cb,
cy_as_funct_c_b_type type,
void *data)
{
- uint32_t state = cy_as_hal_disable_interrupts() ;
+ uint32_t state = cy_as_hal_disable_interrupts();
cy_as_func_c_b_node *node = cy_as_hal_c_b_alloc(
- sizeof(cy_as_func_c_b_node)) ;
- cy_as_hal_enable_interrupts(state) ;
+ sizeof(cy_as_func_c_b_node));
+ cy_as_hal_enable_interrupts(state);
if (node != 0) {
- node->node_type = CYAS_FUNC_CB ;
- node->cb_p = cb ;
- node->client_data = client ;
- node->data_type = type ;
+ node->node_type = CYAS_FUNC_CB;
+ node->cb_p = cb;
+ node->client_data = client;
+ node->data_type = type;
if (data != 0)
- node->data_type |= CY_FUNCT_CB_DATA ;
+ node->data_type |= CY_FUNCT_CB_DATA;
else
- node->data_type |= CY_FUNCT_CB_NODATA ;
- node->data = data ;
- node->next_p = 0 ;
+ node->data_type |= CY_FUNCT_CB_NODATA;
+ node->data = data;
+ node->next_p = 0;
}
- return node ;
+ return node;
}
cy_as_func_c_b_node*
@@ -2820,73 +2820,73 @@ cy_as_create_func_c_b_node(cy_as_function_callback cb,
uint32_t client)
{
return cy_as_create_func_c_b_node_data(cb, client,
- CY_FUNCT_CB_NODATA, 0) ;
+ CY_FUNCT_CB_NODATA, 0);
}
void
cy_as_destroy_func_c_b_node(cy_as_func_c_b_node *node)
{
- uint32_t state ;
+ uint32_t state;
- node->node_type = CYAS_INVALID ;
- state = cy_as_hal_disable_interrupts() ;
- cy_as_hal_c_b_free(node) ;
- cy_as_hal_enable_interrupts(state) ;
+ node->node_type = CYAS_INVALID;
+ state = cy_as_hal_disable_interrupts();
+ cy_as_hal_c_b_free(node);
+ cy_as_hal_enable_interrupts(state);
}
cy_as_usb_func_c_b_node*
cy_as_create_usb_func_c_b_node(
cy_as_usb_function_callback cb, uint32_t client)
{
- uint32_t state = cy_as_hal_disable_interrupts() ;
+ uint32_t state = cy_as_hal_disable_interrupts();
cy_as_usb_func_c_b_node *node = cy_as_hal_c_b_alloc(
- sizeof(cy_as_usb_func_c_b_node)) ;
- cy_as_hal_enable_interrupts(state) ;
+ sizeof(cy_as_usb_func_c_b_node));
+ cy_as_hal_enable_interrupts(state);
if (node != 0) {
- node->type = CYAS_USB_FUNC_CB ;
- node->cb_p = cb ;
- node->client_data = client ;
- node->next_p = 0 ;
+ node->type = CYAS_USB_FUNC_CB;
+ node->cb_p = cb;
+ node->client_data = client;
+ node->next_p = 0;
}
- return node ;
+ return node;
}
void
cy_as_destroy_usb_func_c_b_node(cy_as_usb_func_c_b_node *node)
{
- uint32_t state ;
+ uint32_t state;
- node->type = CYAS_INVALID ;
- state = cy_as_hal_disable_interrupts() ;
- cy_as_hal_c_b_free(node) ;
- cy_as_hal_enable_interrupts(state) ;
+ node->type = CYAS_INVALID;
+ state = cy_as_hal_disable_interrupts();
+ cy_as_hal_c_b_free(node);
+ cy_as_hal_enable_interrupts(state);
}
cy_as_usb_io_c_b_node*
cy_as_create_usb_io_c_b_node(cy_as_usb_io_callback cb)
{
- uint32_t state = cy_as_hal_disable_interrupts() ;
+ uint32_t state = cy_as_hal_disable_interrupts();
cy_as_usb_io_c_b_node *node = cy_as_hal_c_b_alloc(
- sizeof(cy_as_usb_io_c_b_node)) ;
- cy_as_hal_enable_interrupts(state) ;
+ sizeof(cy_as_usb_io_c_b_node));
+ cy_as_hal_enable_interrupts(state);
if (node != 0) {
- node->type = CYAS_USB_IO_CB ;
- node->cb_p = cb ;
- node->next_p = 0 ;
+ node->type = CYAS_USB_IO_CB;
+ node->cb_p = cb;
+ node->next_p = 0;
}
- return node ;
+ return node;
}
void
cy_as_destroy_usb_io_c_b_node(cy_as_usb_io_c_b_node *node)
{
- uint32_t state ;
+ uint32_t state;
- node->type = CYAS_INVALID ;
+ node->type = CYAS_INVALID;
- state = cy_as_hal_disable_interrupts() ;
- cy_as_hal_c_b_free(node) ;
- cy_as_hal_enable_interrupts(state) ;
+ state = cy_as_hal_disable_interrupts();
+ cy_as_hal_c_b_free(node);
+ cy_as_hal_enable_interrupts(state);
}
cy_as_storage_io_c_b_node*
@@ -2896,63 +2896,63 @@ cy_as_create_storage_io_c_b_node(cy_as_storage_callback cb,
cy_as_ll_request_response *req_p,
cy_as_ll_request_response *reply_p)
{
- uint32_t state = cy_as_hal_disable_interrupts() ;
+ uint32_t state = cy_as_hal_disable_interrupts();
cy_as_storage_io_c_b_node *node = cy_as_hal_c_b_alloc(
- sizeof(cy_as_storage_io_c_b_node)) ;
- cy_as_hal_enable_interrupts(state) ;
+ sizeof(cy_as_storage_io_c_b_node));
+ cy_as_hal_enable_interrupts(state);
if (node != 0) {
- node->type = CYAS_STORAGE_IO_CB ;
- node->cb_p = cb ;
- node->media = media ;
- node->device_index = device_index ;
- node->unit = unit ;
- node->block_addr = block_addr ;
- node->oper = oper ;
- node->req_p = req_p ;
- node->reply_p = reply_p ;
- node->next_p = 0 ;
+ node->type = CYAS_STORAGE_IO_CB;
+ node->cb_p = cb;
+ node->media = media;
+ node->device_index = device_index;
+ node->unit = unit;
+ node->block_addr = block_addr;
+ node->oper = oper;
+ node->req_p = req_p;
+ node->reply_p = reply_p;
+ node->next_p = 0;
}
- return node ;
+ return node;
}
void
cy_as_destroy_storage_io_c_b_node(cy_as_storage_io_c_b_node *node)
{
- uint32_t state ;
- node->type = CYAS_INVALID ;
- state = cy_as_hal_disable_interrupts() ;
- cy_as_hal_c_b_free(node) ;
- cy_as_hal_enable_interrupts(state) ;
+ uint32_t state;
+ node->type = CYAS_INVALID;
+ state = cy_as_hal_disable_interrupts();
+ cy_as_hal_c_b_free(node);
+ cy_as_hal_enable_interrupts(state);
}
cy_as_c_b_queue *
cy_as_create_c_b_queue(cy_as_c_b_node_type type)
{
- uint32_t state = cy_as_hal_disable_interrupts() ;
+ uint32_t state = cy_as_hal_disable_interrupts();
cy_as_c_b_queue *queue = cy_as_hal_c_b_alloc(
- sizeof(cy_as_c_b_queue)) ;
- cy_as_hal_enable_interrupts(state) ;
+ sizeof(cy_as_c_b_queue));
+ cy_as_hal_enable_interrupts(state);
if (queue) {
- queue->type = type ;
- queue->head_p = 0 ;
- queue->tail_p = 0 ;
- queue->count = 0 ;
+ queue->type = type;
+ queue->head_p = 0;
+ queue->tail_p = 0;
+ queue->count = 0;
}
- return queue ;
+ return queue;
}
void
cy_as_destroy_c_b_queue(cy_as_c_b_queue *queue)
{
- uint32_t state ;
- queue->type = CYAS_INVALID ;
- queue->head_p = 0 ;
- queue->tail_p = 0 ;
- queue->count = 0 ;
- state = cy_as_hal_disable_interrupts() ;
- cy_as_hal_c_b_free(queue) ;
- cy_as_hal_enable_interrupts(state) ;
+ uint32_t state;
+ queue->type = CYAS_INVALID;
+ queue->head_p = 0;
+ queue->tail_p = 0;
+ queue->count = 0;
+ state = cy_as_hal_disable_interrupts();
+ cy_as_hal_c_b_free(queue);
+ cy_as_hal_enable_interrupts(state);
}
/* Inserts a CyAsCBNode into the queue, the
@@ -2960,106 +2960,106 @@ cy_as_destroy_c_b_queue(cy_as_c_b_queue *queue)
void
cy_as_insert_c_b_node(cy_as_c_b_queue *queue_p, void*cbnode)
{
- uint32_t int_state ;
+ uint32_t int_state;
- int_state = cy_as_hal_disable_interrupts() ;
+ int_state = cy_as_hal_disable_interrupts();
- cy_as_hal_assert(queue_p != 0) ;
+ cy_as_hal_assert(queue_p != 0);
switch (queue_p->type) {
case CYAS_USB_FUNC_CB:
{
cy_as_usb_func_c_b_node *node =
- (cy_as_usb_func_c_b_node *)cbnode ;
+ (cy_as_usb_func_c_b_node *)cbnode;
cy_as_usb_func_c_b_node *tail =
- (cy_as_usb_func_c_b_node *)queue_p->tail_p ;
+ (cy_as_usb_func_c_b_node *)queue_p->tail_p;
- cy_as_hal_assert(node->type == CYAS_USB_FUNC_CB) ;
+ cy_as_hal_assert(node->type == CYAS_USB_FUNC_CB);
cy_as_hal_assert(tail == 0 ||
- tail->type == CYAS_USB_FUNC_CB) ;
+ tail->type == CYAS_USB_FUNC_CB);
if (queue_p->head_p == 0)
- queue_p->head_p = node ;
+ queue_p->head_p = node;
else
- tail->next_p = node ;
+ tail->next_p = node;
- queue_p->tail_p = node ;
+ queue_p->tail_p = node;
}
- break ;
+ break;
case CYAS_USB_IO_CB:
{
cy_as_usb_io_c_b_node *node =
- (cy_as_usb_io_c_b_node *)cbnode ;
+ (cy_as_usb_io_c_b_node *)cbnode;
cy_as_usb_io_c_b_node *tail =
- (cy_as_usb_io_c_b_node *)queue_p->tail_p ;
+ (cy_as_usb_io_c_b_node *)queue_p->tail_p;
- cy_as_hal_assert(node->type == CYAS_USB_IO_CB) ;
+ cy_as_hal_assert(node->type == CYAS_USB_IO_CB);
cy_as_hal_assert(tail == 0 ||
- tail->type == CYAS_USB_IO_CB) ;
+ tail->type == CYAS_USB_IO_CB);
if (queue_p->head_p == 0)
- queue_p->head_p = node ;
+ queue_p->head_p = node;
else
- tail->next_p = node ;
+ tail->next_p = node;
- queue_p->tail_p = node ;
+ queue_p->tail_p = node;
}
- break ;
+ break;
case CYAS_STORAGE_IO_CB:
{
cy_as_storage_io_c_b_node *node =
- (cy_as_storage_io_c_b_node *)cbnode ;
+ (cy_as_storage_io_c_b_node *)cbnode;
cy_as_storage_io_c_b_node *tail =
- (cy_as_storage_io_c_b_node *)queue_p->tail_p ;
+ (cy_as_storage_io_c_b_node *)queue_p->tail_p;
- cy_as_hal_assert(node->type == CYAS_STORAGE_IO_CB) ;
+ cy_as_hal_assert(node->type == CYAS_STORAGE_IO_CB);
cy_as_hal_assert(tail == 0 ||
- tail->type == CYAS_STORAGE_IO_CB) ;
+ tail->type == CYAS_STORAGE_IO_CB);
if (queue_p->head_p == 0)
- queue_p->head_p = node ;
+ queue_p->head_p = node;
else
- tail->next_p = node ;
+ tail->next_p = node;
- queue_p->tail_p = node ;
+ queue_p->tail_p = node;
}
- break ;
+ break;
case CYAS_FUNC_CB:
{
cy_as_func_c_b_node *node =
- (cy_as_func_c_b_node *)cbnode ;
+ (cy_as_func_c_b_node *)cbnode;
cy_as_func_c_b_node *tail =
- (cy_as_func_c_b_node *)queue_p->tail_p ;
+ (cy_as_func_c_b_node *)queue_p->tail_p;
- cy_as_hal_assert(node->node_type == CYAS_FUNC_CB) ;
+ cy_as_hal_assert(node->node_type == CYAS_FUNC_CB);
cy_as_hal_assert(tail == 0 ||
- tail->node_type == CYAS_FUNC_CB) ;
+ tail->node_type == CYAS_FUNC_CB);
if (queue_p->head_p == 0)
- queue_p->head_p = node ;
+ queue_p->head_p = node;
else
- tail->next_p = node ;
+ tail->next_p = node;
- queue_p->tail_p = node ;
+ queue_p->tail_p = node;
}
- break ;
+ break;
default:
- cy_as_hal_assert(cy_false) ;
- break ;
+ cy_as_hal_assert(cy_false);
+ break;
}
- queue_p->count++ ;
+ queue_p->count++;
- cy_as_hal_enable_interrupts(int_state) ;
+ cy_as_hal_enable_interrupts(int_state);
}
/* Removes the tail node from the queue and frees it */
void
cy_as_remove_c_b_tail_node(cy_as_c_b_queue *queue_p)
{
- uint32_t int_state ;
+ uint32_t int_state;
- int_state = cy_as_hal_disable_interrupts() ;
+ int_state = cy_as_hal_disable_interrupts();
if (queue_p->count > 0) {
/*
@@ -3073,183 +3073,183 @@ cy_as_remove_c_b_tail_node(cy_as_c_b_queue *queue_p)
{
cy_as_func_c_b_node *node =
(cy_as_func_c_b_node *)
- queue_p->head_p ;
+ queue_p->head_p;
cy_as_func_c_b_node *tail =
(cy_as_func_c_b_node *)
- queue_p->tail_p ;
+ queue_p->tail_p;
if (node != tail) {
while (node->next_p != tail)
- node = node->next_p ;
- node->next_p = 0 ;
- queue_p->tail_p = node ;
+ node = node->next_p;
+ node->next_p = 0;
+ queue_p->tail_p = node;
}
- cy_as_destroy_func_c_b_node(tail) ;
+ cy_as_destroy_func_c_b_node(tail);
}
- break ;
+ break;
case CYAS_USB_FUNC_CB:
{
cy_as_usb_func_c_b_node *node =
(cy_as_usb_func_c_b_node *)
- queue_p->head_p ;
+ queue_p->head_p;
cy_as_usb_func_c_b_node *tail =
(cy_as_usb_func_c_b_node *)
- queue_p->tail_p ;
+ queue_p->tail_p;
if (node != tail) {
while (node->next_p != tail)
- node = node->next_p ;
- node->next_p = 0 ;
- queue_p->tail_p = node ;
+ node = node->next_p;
+ node->next_p = 0;
+ queue_p->tail_p = node;
}
- cy_as_destroy_usb_func_c_b_node(tail) ;
+ cy_as_destroy_usb_func_c_b_node(tail);
}
- break ;
+ break;
case CYAS_USB_IO_CB:
{
cy_as_usb_io_c_b_node *node =
(cy_as_usb_io_c_b_node *)
- queue_p->head_p ;
+ queue_p->head_p;
cy_as_usb_io_c_b_node *tail =
(cy_as_usb_io_c_b_node *)
- queue_p->tail_p ;
+ queue_p->tail_p;
if (node != tail) {
while (node->next_p != tail)
- node = node->next_p ;
- node->next_p = 0 ;
- queue_p->tail_p = node ;
+ node = node->next_p;
+ node->next_p = 0;
+ queue_p->tail_p = node;
}
- cy_as_destroy_usb_io_c_b_node(tail) ;
+ cy_as_destroy_usb_io_c_b_node(tail);
}
- break ;
+ break;
case CYAS_STORAGE_IO_CB:
{
cy_as_storage_io_c_b_node *node =
(cy_as_storage_io_c_b_node *)
- queue_p->head_p ;
+ queue_p->head_p;
cy_as_storage_io_c_b_node *tail =
(cy_as_storage_io_c_b_node *)
- queue_p->tail_p ;
+ queue_p->tail_p;
if (node != tail) {
while (node->next_p != tail)
- node = node->next_p ;
- node->next_p = 0 ;
- queue_p->tail_p = node ;
+ node = node->next_p;
+ node->next_p = 0;
+ queue_p->tail_p = node;
}
- cy_as_destroy_storage_io_c_b_node(tail) ;
+ cy_as_destroy_storage_io_c_b_node(tail);
}
- break ;
+ break;
default:
- cy_as_hal_assert(cy_false) ;
+ cy_as_hal_assert(cy_false);
}
- queue_p->count-- ;
+ queue_p->count--;
if (queue_p->count == 0) {
- queue_p->head_p = 0 ;
- queue_p->tail_p = 0 ;
+ queue_p->head_p = 0;
+ queue_p->tail_p = 0;
}
}
- cy_as_hal_enable_interrupts(int_state) ;
+ cy_as_hal_enable_interrupts(int_state);
}
/* Removes the first CyAsCBNode from the queue and frees it */
void
cy_as_remove_c_b_node(cy_as_c_b_queue *queue_p)
{
- uint32_t int_state ;
+ uint32_t int_state;
- int_state = cy_as_hal_disable_interrupts() ;
+ int_state = cy_as_hal_disable_interrupts();
- cy_as_hal_assert(queue_p->count >= 0) ;
+ cy_as_hal_assert(queue_p->count >= 0);
if (queue_p->count > 0) {
if (queue_p->type == CYAS_USB_FUNC_CB) {
cy_as_usb_func_c_b_node *node =
(cy_as_usb_func_c_b_node *)
- queue_p->head_p ;
- queue_p->head_p = node->next_p ;
- cy_as_destroy_usb_func_c_b_node(node) ;
+ queue_p->head_p;
+ queue_p->head_p = node->next_p;
+ cy_as_destroy_usb_func_c_b_node(node);
} else if (queue_p->type == CYAS_USB_IO_CB) {
cy_as_usb_io_c_b_node *node =
(cy_as_usb_io_c_b_node *)
- queue_p->head_p ;
- queue_p->head_p = node->next_p ;
- cy_as_destroy_usb_io_c_b_node(node) ;
+ queue_p->head_p;
+ queue_p->head_p = node->next_p;
+ cy_as_destroy_usb_io_c_b_node(node);
} else if (queue_p->type == CYAS_STORAGE_IO_CB) {
cy_as_storage_io_c_b_node *node =
(cy_as_storage_io_c_b_node *)
- queue_p->head_p ;
- queue_p->head_p = node->next_p ;
- cy_as_destroy_storage_io_c_b_node(node) ;
+ queue_p->head_p;
+ queue_p->head_p = node->next_p;
+ cy_as_destroy_storage_io_c_b_node(node);
} else if (queue_p->type == CYAS_FUNC_CB) {
cy_as_func_c_b_node *node =
(cy_as_func_c_b_node *)
- queue_p->head_p ;
- queue_p->head_p = node->next_p ;
- cy_as_destroy_func_c_b_node(node) ;
+ queue_p->head_p;
+ queue_p->head_p = node->next_p;
+ cy_as_destroy_func_c_b_node(node);
} else {
- cy_as_hal_assert(cy_false) ;
+ cy_as_hal_assert(cy_false);
}
- queue_p->count-- ;
+ queue_p->count--;
if (queue_p->count == 0) {
- queue_p->head_p = 0 ;
- queue_p->tail_p = 0 ;
+ queue_p->head_p = 0;
+ queue_p->tail_p = 0;
}
}
- cy_as_hal_enable_interrupts(int_state) ;
+ cy_as_hal_enable_interrupts(int_state);
}
void my_print_func_c_b_node(cy_as_func_c_b_node *node)
{
cy_as_funct_c_b_type type =
- cy_as_funct_c_b_type_get_type(node->data_type) ;
+ cy_as_funct_c_b_type_get_type(node->data_type);
cy_as_hal_print_message("[cd:%2u dt:%2u cb:0x%08x "
"d:0x%08x nt:%1i]", node->client_data, type,
(uint32_t)node->cb_p, (uint32_t)node->data,
- node->node_type) ;
+ node->node_type);
}
void my_print_c_b_queue(cy_as_c_b_queue *queue_p)
{
- uint32_t i = 0 ;
+ uint32_t i = 0;
- cy_as_hal_print_message("| count: %u type: ", queue_p->count) ;
+ cy_as_hal_print_message("| count: %u type: ", queue_p->count);
if (queue_p->type == CYAS_USB_FUNC_CB) {
- cy_as_hal_print_message("USB_FUNC_CB\n") ;
+ cy_as_hal_print_message("USB_FUNC_CB\n");
} else if (queue_p->type == CYAS_USB_IO_CB) {
- cy_as_hal_print_message("USB_IO_CB\n") ;
+ cy_as_hal_print_message("USB_IO_CB\n");
} else if (queue_p->type == CYAS_STORAGE_IO_CB) {
- cy_as_hal_print_message("STORAGE_IO_CB\n") ;
+ cy_as_hal_print_message("STORAGE_IO_CB\n");
} else if (queue_p->type == CYAS_FUNC_CB) {
- cy_as_func_c_b_node *node = queue_p->head_p ;
- cy_as_hal_print_message("FUNC_CB\n") ;
+ cy_as_func_c_b_node *node = queue_p->head_p;
+ cy_as_hal_print_message("FUNC_CB\n");
if (queue_p->count > 0) {
- cy_as_hal_print_message("| head->") ;
+ cy_as_hal_print_message("| head->");
for (i = 0; i < queue_p->count; i++) {
if (node) {
- cy_as_hal_print_message("->") ;
- my_print_func_c_b_node(node) ;
- node = node->next_p ;
+ cy_as_hal_print_message("->");
+ my_print_func_c_b_node(node);
+ node = node->next_p;
} else
- cy_as_hal_print_message("->[NULL]\n") ;
+ cy_as_hal_print_message("->[NULL]\n");
}
- cy_as_hal_print_message("\n| tail->") ;
- my_print_func_c_b_node(queue_p->tail_p) ;
- cy_as_hal_print_message("\n") ;
+ cy_as_hal_print_message("\n| tail->");
+ my_print_func_c_b_node(queue_p->tail_p);
+ cy_as_hal_print_message("\n");
}
} else {
- cy_as_hal_print_message("INVALID\n") ;
+ cy_as_hal_print_message("INVALID\n");
}
- cy_as_hal_print_message("|----------\n") ;
+ cy_as_hal_print_message("|----------\n");
}
@@ -3257,12 +3257,12 @@ void my_print_c_b_queue(cy_as_c_b_queue *queue_p)
void
cy_as_clear_c_b_queue(cy_as_c_b_queue *queue_p)
{
- uint32_t int_state = cy_as_hal_disable_interrupts() ;
+ uint32_t int_state = cy_as_hal_disable_interrupts();
while (queue_p->count != 0)
- cy_as_remove_c_b_node(queue_p) ;
+ cy_as_remove_c_b_node(queue_p);
- cy_as_hal_enable_interrupts(int_state) ;
+ cy_as_hal_enable_interrupts(int_state);
}
cy_as_return_status_t
@@ -3279,29 +3279,29 @@ cy_as_misc_send_request(cy_as_device *dev_p,
{
cy_as_func_c_b_node *cbnode = cy_as_create_func_c_b_node_data(cb,
- client, type, data) ;
- cy_as_return_status_t ret ;
+ client, type, data);
+ cy_as_return_status_t ret;
if (cbnode == 0)
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ return CY_AS_ERROR_OUT_OF_MEMORY;
else
- cy_as_insert_c_b_node(queue, cbnode) ;
+ cy_as_insert_c_b_node(queue, cbnode);
- req_p->flags |= req_type ;
+ req_p->flags |= req_type;
- ret = cy_as_ll_send_request(dev_p, req_p, reply_p, cy_false, rcb) ;
+ ret = cy_as_ll_send_request(dev_p, req_p, reply_p, cy_false, rcb);
if (ret != CY_AS_ERROR_SUCCESS)
- cy_as_remove_c_b_tail_node(queue) ;
+ cy_as_remove_c_b_tail_node(queue);
- return ret ;
+ return ret;
}
void
cy_as_misc_cancel_ex_requests(cy_as_device *dev_p)
{
- int i ;
+ int i;
for (i = 0; i < CY_RQT_CONTEXT_COUNT; i++)
- cy_as_ll_remove_all_requests(dev_p, dev_p->context[i]) ;
+ cy_as_ll_remove_all_requests(dev_p, dev_p->context[i]);
}
@@ -3312,143 +3312,143 @@ cy_as_misc_func_callback(cy_as_device *dev_p,
cy_as_ll_request_response *resp,
cy_as_return_status_t stat)
{
- cy_as_func_c_b_node *node = NULL ;
- cy_as_return_status_t ret ;
+ cy_as_func_c_b_node *node = NULL;
+ cy_as_return_status_t ret;
cy_bool ex_request = (rqt->flags & CY_AS_REQUEST_RESPONSE_EX)
- == CY_AS_REQUEST_RESPONSE_EX ;
+ == CY_AS_REQUEST_RESPONSE_EX;
cy_bool ms_request = (rqt->flags & CY_AS_REQUEST_RESPONSE_MS)
- == CY_AS_REQUEST_RESPONSE_MS ;
- uint8_t code ;
- uint32_t type ;
- uint8_t cntxt ;
+ == CY_AS_REQUEST_RESPONSE_MS;
+ uint8_t code;
+ uint32_t type;
+ uint8_t cntxt;
- cy_as_hal_assert(ex_request || ms_request) ;
+ cy_as_hal_assert(ex_request || ms_request);
(void) ex_request;
(void) ms_request;
- (void)context ;
+ (void)context;
- cntxt = cy_as_ll_request_response__get_context(rqt) ;
- code = cy_as_ll_request_response__get_code(rqt) ;
+ cntxt = cy_as_ll_request_response__get_context(rqt);
+ code = cy_as_ll_request_response__get_code(rqt);
switch (cntxt) {
case CY_RQT_GENERAL_RQT_CONTEXT:
- cy_as_hal_assert(dev_p->func_cbs_misc->count != 0) ;
- cy_as_hal_assert(dev_p->func_cbs_misc->type == CYAS_FUNC_CB) ;
- node = (cy_as_func_c_b_node *)dev_p->func_cbs_misc->head_p ;
- type = cy_as_funct_c_b_type_get_type(node->data_type) ;
+ cy_as_hal_assert(dev_p->func_cbs_misc->count != 0);
+ cy_as_hal_assert(dev_p->func_cbs_misc->type == CYAS_FUNC_CB);
+ node = (cy_as_func_c_b_node *)dev_p->func_cbs_misc->head_p;
+ type = cy_as_funct_c_b_type_get_type(node->data_type);
switch (code) {
case CY_RQT_GET_FIRMWARE_VERSION:
- cy_as_hal_assert(node->data != 0) ;
+ cy_as_hal_assert(node->data != 0);
cy_as_hal_assert(type ==
- CY_FUNCT_CB_MISC_GETFIRMWAREVERSION) ;
+ CY_FUNCT_CB_MISC_GETFIRMWAREVERSION);
ret = my_handle_response_get_firmware_version(dev_p,
rqt, resp,
(cy_as_get_firmware_version_data *)node->data);
- break ;
+ break;
case CY_RQT_READ_MCU_REGISTER:
- cy_as_hal_assert(node->data != 0) ;
+ cy_as_hal_assert(node->data != 0);
cy_as_hal_assert(type ==
- CY_FUNCT_CB_MISC_READMCUREGISTER) ;
+ CY_FUNCT_CB_MISC_READMCUREGISTER);
ret = my_handle_response_read_m_c_u_register(dev_p, rqt,
- resp, (uint8_t *)node->data) ;
- break ;
+ resp, (uint8_t *)node->data);
+ break;
case CY_RQT_GET_GPIO_STATE:
- cy_as_hal_assert(node->data != 0) ;
+ cy_as_hal_assert(node->data != 0);
cy_as_hal_assert(type ==
- CY_FUNCT_CB_MISC_GETGPIOVALUE) ;
+ CY_FUNCT_CB_MISC_GETGPIOVALUE);
ret = my_handle_response_get_gpio_value(dev_p, rqt,
- resp, (uint8_t *)node->data) ;
- break ;
+ resp, (uint8_t *)node->data);
+ break;
case CY_RQT_SET_SD_CLOCK_FREQ:
- cy_as_hal_assert(type == CY_FUNCT_CB_MISC_SETSDFREQ) ;
- ret = my_handle_response_no_data(dev_p, rqt, resp) ;
- break ;
+ cy_as_hal_assert(type == CY_FUNCT_CB_MISC_SETSDFREQ);
+ ret = my_handle_response_no_data(dev_p, rqt, resp);
+ break;
case CY_RQT_CONTROL_ANTIOCH_HEARTBEAT:
cy_as_hal_assert(type ==
- CY_FUNCT_CB_MISC_HEARTBEATCONTROL) ;
- ret = my_handle_response_no_data(dev_p, rqt, resp) ;
- break ;
+ CY_FUNCT_CB_MISC_HEARTBEATCONTROL);
+ ret = my_handle_response_no_data(dev_p, rqt, resp);
+ break;
case CY_RQT_WRITE_MCU_REGISTER:
cy_as_hal_assert(type ==
- CY_FUNCT_CB_MISC_WRITEMCUREGISTER) ;
- ret = my_handle_response_no_data(dev_p, rqt, resp) ;
- break ;
+ CY_FUNCT_CB_MISC_WRITEMCUREGISTER);
+ ret = my_handle_response_no_data(dev_p, rqt, resp);
+ break;
case CY_RQT_STORAGE_MEDIA_CHANGED:
cy_as_hal_assert(type ==
- CY_FUNCT_CB_MISC_STORAGECHANGED) ;
- ret = my_handle_response_no_data(dev_p, rqt, resp) ;
- break ;
+ CY_FUNCT_CB_MISC_STORAGECHANGED);
+ ret = my_handle_response_no_data(dev_p, rqt, resp);
+ break;
case CY_RQT_SET_GPIO_STATE:
cy_as_hal_assert(type ==
- CY_FUNCT_CB_MISC_SETGPIOVALUE) ;
- ret = my_handle_response_no_data(dev_p, rqt, resp) ;
- break ;
+ CY_FUNCT_CB_MISC_SETGPIOVALUE);
+ ret = my_handle_response_no_data(dev_p, rqt, resp);
+ break;
case CY_RQT_SET_TRACE_LEVEL:
cy_as_hal_assert(type ==
- CY_FUNCT_CB_MISC_SETTRACELEVEL) ;
- ret = my_handle_response_no_data(dev_p, rqt, resp) ;
+ CY_FUNCT_CB_MISC_SETTRACELEVEL);
+ ret = my_handle_response_no_data(dev_p, rqt, resp);
if (ret == CY_AS_ERROR_INVALID_RESPONSE)
- ret = CY_AS_ERROR_NOT_SUPPORTED ;
- break ;
+ ret = CY_AS_ERROR_NOT_SUPPORTED;
+ break;
case CY_RQT_PREPARE_FOR_STANDBY:
cy_as_hal_assert(type ==
- CY_FUNCT_CB_MISC_ENTERSTANDBY) ;
+ CY_FUNCT_CB_MISC_ENTERSTANDBY);
ret = my_handle_response_enter_standby(dev_p, rqt, resp,
- (cy_bool)node->data) ;
- break ;
+ (cy_bool)node->data);
+ break;
case CY_RQT_ENTER_SUSPEND_MODE:
cy_as_hal_assert(type ==
- CY_FUNCT_CB_MISC_ENTERSUSPEND) ;
- ret = my_handle_response_no_data(dev_p, rqt, resp) ;
+ CY_FUNCT_CB_MISC_ENTERSUSPEND);
+ ret = my_handle_response_no_data(dev_p, rqt, resp);
if (ret == CY_AS_ERROR_SUCCESS)
- cy_as_device_set_suspend_mode(dev_p) ;
+ cy_as_device_set_suspend_mode(dev_p);
- break ;
+ break;
case CY_RQT_RESERVE_LNA_BOOT_AREA:
cy_as_hal_assert(type ==
- CY_FUNCT_CB_MISC_RESERVELNABOOTAREA) ;
- ret = my_handle_response_no_data(dev_p, rqt, resp) ;
- break ;
+ CY_FUNCT_CB_MISC_RESERVELNABOOTAREA);
+ ret = my_handle_response_no_data(dev_p, rqt, resp);
+ break;
case CY_RQT_SDPOLARITY:
cy_as_hal_assert(type ==
- CY_FUNCT_CB_MISC_SETSDPOLARITY) ;
- ret = my_handle_response_no_data(dev_p, rqt, resp) ;
- break ;
+ CY_FUNCT_CB_MISC_SETSDPOLARITY);
+ ret = my_handle_response_no_data(dev_p, rqt, resp);
+ break;
default:
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
- cy_as_hal_assert(cy_false) ;
- break ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
+ cy_as_hal_assert(cy_false);
+ break;
}
- break ;
+ break;
case CY_RQT_RESOURCE_RQT_CONTEXT:
- cy_as_hal_assert(dev_p->func_cbs_res->count != 0) ;
- cy_as_hal_assert(dev_p->func_cbs_res->type == CYAS_FUNC_CB) ;
- node = (cy_as_func_c_b_node *)dev_p->func_cbs_res->head_p ;
- type = cy_as_funct_c_b_type_get_type(node->data_type) ;
+ cy_as_hal_assert(dev_p->func_cbs_res->count != 0);
+ cy_as_hal_assert(dev_p->func_cbs_res->type == CYAS_FUNC_CB);
+ node = (cy_as_func_c_b_node *)dev_p->func_cbs_res->head_p;
+ type = cy_as_funct_c_b_type_get_type(node->data_type);
switch (code) {
case CY_RQT_ACQUIRE_RESOURCE:
/* The node->data field is actually an enum value
* which could be 0, thus no assert is done */
cy_as_hal_assert(type ==
- CY_FUNCT_CB_MISC_ACQUIRERESOURCE) ;
+ CY_FUNCT_CB_MISC_ACQUIRERESOURCE);
ret = my_handle_response_acquire_resource(dev_p, rqt,
- resp, (cy_as_resource_type *)node->data) ;
- break ;
+ resp, (cy_as_resource_type *)node->data);
+ break;
default:
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
- cy_as_hal_assert(cy_false) ;
- break ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
+ cy_as_hal_assert(cy_false);
+ break;
}
- break ;
+ break;
default:
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
- cy_as_hal_assert(cy_false) ;
- break ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
+ cy_as_hal_assert(cy_false);
+ break;
}
/*
@@ -3457,15 +3457,15 @@ cy_as_misc_func_callback(cy_as_device *dev_p,
* based on the response from firmware.
*/
if (stat == CY_AS_ERROR_SUCCESS)
- stat = ret ;
+ stat = ret;
/* Call the user Callback */
node->cb_p((cy_as_device_handle)dev_p, stat, node->client_data,
- node->data_type, node->data) ;
+ node->data_type, node->data);
if (cntxt == CY_RQT_GENERAL_RQT_CONTEXT)
- cy_as_remove_c_b_node(dev_p->func_cbs_misc) ;
+ cy_as_remove_c_b_node(dev_p->func_cbs_misc);
else
- cy_as_remove_c_b_node(dev_p->func_cbs_res) ;
+ cy_as_remove_c_b_node(dev_p->func_cbs_res);
}
diff --git a/drivers/staging/westbridge/astoria/api/src/cyasmtp.c b/drivers/staging/westbridge/astoria/api/src/cyasmtp.c
index 3725800aa7b..d5a8e45010d 100644
--- a/drivers/staging/westbridge/astoria/api/src/cyasmtp.c
+++ b/drivers/staging/westbridge/astoria/api/src/cyasmtp.c
@@ -30,24 +30,24 @@ cy_as_mtp_func_callback(cy_as_device *dev_p,
uint8_t context,
cy_as_ll_request_response *rqt,
cy_as_ll_request_response *resp,
- cy_as_return_status_t stat) ;
+ cy_as_return_status_t stat);
static cy_as_return_status_t
is_mtp_active(cy_as_device *dev_p)
{
if (!cy_as_device_is_configured(dev_p))
- return CY_AS_ERROR_NOT_CONFIGURED ;
+ return CY_AS_ERROR_NOT_CONFIGURED;
if (!cy_as_device_is_firmware_loaded(dev_p))
- return CY_AS_ERROR_NO_FIRMWARE ;
+ return CY_AS_ERROR_NO_FIRMWARE;
if (dev_p->mtp_count == 0)
- return CY_AS_ERROR_NOT_RUNNING ;
+ return CY_AS_ERROR_NOT_RUNNING;
if (cy_as_device_is_in_suspend_mode(dev_p))
- return CY_AS_ERROR_IN_SUSPEND ;
+ return CY_AS_ERROR_IN_SUSPEND;
- return CY_AS_ERROR_SUCCESS ;
+ return CY_AS_ERROR_SUCCESS;
}
static void
@@ -57,75 +57,75 @@ my_mtp_request_callback(cy_as_device *dev_p,
cy_as_ll_request_response *resp_p,
cy_as_return_status_t ret)
{
- uint16_t val, ev, status ;
- uint16_t mtp_datalen = 0 ;
- uint32_t bytecount_l, bytecount_h ;
- cy_as_mtp_send_object_complete_data send_obj_data ;
- cy_as_mtp_get_object_complete_data get_obj_data ;
- cy_as_dma_end_point *ep_p ;
+ uint16_t val, ev, status;
+ uint16_t mtp_datalen = 0;
+ uint32_t bytecount_l, bytecount_h;
+ cy_as_mtp_send_object_complete_data send_obj_data;
+ cy_as_mtp_get_object_complete_data get_obj_data;
+ cy_as_dma_end_point *ep_p;
- uint8_t code = cy_as_ll_request_response__get_code(req_p) ;
+ uint8_t code = cy_as_ll_request_response__get_code(req_p);
- (void)resp_p ;
- (void)context ;
- (void)ret ;
+ (void)resp_p;
+ (void)context;
+ (void)ret;
switch (code) {
case CY_RQT_MTP_EVENT:
- val = cy_as_ll_request_response__get_word(req_p, 0) ;
+ val = cy_as_ll_request_response__get_word(req_p, 0);
/* MSB indicates status of read/write */
- status = (val >> 8) & 0xFF ;
+ status = (val >> 8) & 0xFF;
/* event type */
- ev = val & 0xFF ;
+ ev = val & 0xFF;
switch (ev) {
case 0: /* SendObject Complete */
{
bytecount_l =
cy_as_ll_request_response__get_word
- (req_p, 1) ;
+ (req_p, 1);
bytecount_h =
cy_as_ll_request_response__get_word
- (req_p, 2) ;
+ (req_p, 2);
send_obj_data.byte_count =
- (bytecount_h << 16) | bytecount_l ;
+ (bytecount_h << 16) | bytecount_l;
- send_obj_data.status = status ;
+ send_obj_data.status = status;
/* use the byte count again */
bytecount_l =
cy_as_ll_request_response__get_word
- (req_p, 3) ;
+ (req_p, 3);
bytecount_h =
cy_as_ll_request_response__get_word
- (req_p, 4) ;
+ (req_p, 4);
send_obj_data.transaction_id =
- (bytecount_h << 16) | bytecount_l ;
+ (bytecount_h << 16) | bytecount_l;
- dev_p->mtp_turbo_active = cy_false ;
+ dev_p->mtp_turbo_active = cy_false;
if (dev_p->mtp_event_cb)
dev_p->mtp_event_cb(
(cy_as_device_handle) dev_p,
cy_as_mtp_send_object_complete,
- &send_obj_data) ;
+ &send_obj_data);
}
- break ;
+ break;
case 1: /* GetObject Complete */
{
bytecount_l =
cy_as_ll_request_response__get_word
- (req_p, 1) ;
+ (req_p, 1);
bytecount_h =
cy_as_ll_request_response__get_word
- (req_p, 2) ;
+ (req_p, 2);
get_obj_data.byte_count =
- (bytecount_h << 16) | bytecount_l ;
+ (bytecount_h << 16) | bytecount_l;
- get_obj_data.status = status ;
+ get_obj_data.status = status;
- dev_p->mtp_turbo_active = cy_false ;
+ dev_p->mtp_turbo_active = cy_false;
if (dev_p->mtp_event_cb)
dev_p->mtp_event_cb(
@@ -133,7 +133,7 @@ my_mtp_request_callback(cy_as_device *dev_p,
cy_as_mtp_get_object_complete,
&get_obj_data);
}
- break ;
+ break;
case 2: /* BlockTable Needed */
{
@@ -142,40 +142,40 @@ my_mtp_request_callback(cy_as_device *dev_p,
(cy_as_device_handle) dev_p,
cy_as_mtp_block_table_needed, 0);
}
- break ;
+ break;
default:
- cy_as_hal_print_message("invalid event type\n") ;
+ cy_as_hal_print_message("invalid event type\n");
cy_as_ll_send_data_response(dev_p,
CY_RQT_TUR_RQT_CONTEXT,
CY_RESP_MTP_INVALID_EVENT,
- sizeof(ev), &ev) ;
- break ;
+ sizeof(ev), &ev);
+ break;
}
- break ;
+ break;
case CY_RQT_TURBO_CMD_FROM_HOST:
{
mtp_datalen =
- cy_as_ll_request_response__get_word(req_p, 1) ;
+ cy_as_ll_request_response__get_word(req_p, 1);
/* Get the endpoint pointer based on
* the endpoint number */
- ep_p = CY_AS_NUM_EP(dev_p, CY_AS_MTP_READ_ENDPOINT) ;
+ ep_p = CY_AS_NUM_EP(dev_p, CY_AS_MTP_READ_ENDPOINT);
/* The event should arrive only after the DMA operation
* has been queued. */
- cy_as_hal_assert(ep_p->queue_p != 0) ;
+ cy_as_hal_assert(ep_p->queue_p != 0);
/* Put the len in ep data information in
* dmaqueue and kick start the queue */
- cy_as_hal_assert(ep_p->queue_p->size >= mtp_datalen) ;
+ cy_as_hal_assert(ep_p->queue_p->size >= mtp_datalen);
if (mtp_datalen == 0) {
cy_as_dma_completed_callback(dev_p->tag,
CY_AS_MTP_READ_ENDPOINT, 0,
- CY_AS_ERROR_SUCCESS) ;
+ CY_AS_ERROR_SUCCESS);
} else {
- ep_p->maxhwdata = mtp_datalen ;
+ ep_p->maxhwdata = mtp_datalen;
/*
* make sure that the DMA status for this
@@ -187,14 +187,14 @@ my_mtp_request_callback(cy_as_device *dev_p,
* status here and start the next packet
* transfer.
*/
- cy_as_dma_end_point_set_stopped(ep_p) ;
+ cy_as_dma_end_point_set_stopped(ep_p);
/* Kick start the queue if it is not running */
cy_as_dma_kick_start(dev_p,
CY_AS_MTP_READ_ENDPOINT);
}
}
- break ;
+ break;
case CY_RQT_TURBO_START_WRITE_DMA:
{
@@ -207,23 +207,23 @@ my_mtp_request_callback(cy_as_device *dev_p,
*/
cy_as_ll_send_status_response(dev_p,
CY_RQT_TUR_RQT_CONTEXT,
- CY_AS_ERROR_SUCCESS, 0) ;
+ CY_AS_ERROR_SUCCESS, 0);
- ep_p = CY_AS_NUM_EP(dev_p, CY_AS_MTP_WRITE_ENDPOINT) ;
- cy_as_hal_assert(ep_p->queue_p != 0) ;
+ ep_p = CY_AS_NUM_EP(dev_p, CY_AS_MTP_WRITE_ENDPOINT);
+ cy_as_hal_assert(ep_p->queue_p != 0);
- cy_as_dma_end_point_set_stopped(ep_p) ;
- cy_as_dma_kick_start(dev_p, CY_AS_MTP_WRITE_ENDPOINT) ;
+ cy_as_dma_end_point_set_stopped(ep_p);
+ cy_as_dma_kick_start(dev_p, CY_AS_MTP_WRITE_ENDPOINT);
}
- break ;
+ break;
default:
cy_as_hal_print_message("invalid request received "
- "on TUR context\n") ;
- val = req_p->box0 ;
+ "on TUR context\n");
+ val = req_p->box0;
cy_as_ll_send_data_response(dev_p, CY_RQT_TUR_RQT_CONTEXT,
- CY_RESP_INVALID_REQUEST, sizeof(val), &val) ;
- break ;
+ CY_RESP_INVALID_REQUEST, sizeof(val), &val);
+ break;
}
}
@@ -232,21 +232,21 @@ my_handle_response_no_data(cy_as_device *dev_p,
cy_as_ll_request_response *req_p,
cy_as_ll_request_response *reply_p)
{
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
if (cy_as_ll_request_response__get_code(reply_p) !=
CY_RESP_SUCCESS_FAILURE) {
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
- goto destroy ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
+ goto destroy;
}
- ret = cy_as_ll_request_response__get_word(reply_p, 0) ;
+ ret = cy_as_ll_request_response__get_word(reply_p, 0);
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
- return ret ;
+ return ret;
}
static cy_as_return_status_t
@@ -256,48 +256,48 @@ my_handle_response_mtp_start(cy_as_device *dev_p,
cy_as_return_status_t ret)
{
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
if (cy_as_ll_request_response__get_code(reply_p) !=
CY_RESP_SUCCESS_FAILURE) {
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
- goto destroy ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
+ goto destroy;
}
- ret = cy_as_ll_request_response__get_word(reply_p, 0) ;
+ ret = cy_as_ll_request_response__get_word(reply_p, 0);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
- dev_p->mtp_count++ ;
+ dev_p->mtp_count++;
cy_as_dma_enable_end_point(dev_p, CY_AS_MTP_READ_ENDPOINT,
- cy_true, cy_as_direction_out) ;
- dev_p->usb_config[CY_AS_MTP_READ_ENDPOINT].enabled = cy_true ;
- dev_p->usb_config[CY_AS_MTP_READ_ENDPOINT].dir = cy_as_usb_out ;
- dev_p->usb_config[CY_AS_MTP_READ_ENDPOINT].type = cy_as_usb_bulk ;
+ cy_true, cy_as_direction_out);
+ dev_p->usb_config[CY_AS_MTP_READ_ENDPOINT].enabled = cy_true;
+ dev_p->usb_config[CY_AS_MTP_READ_ENDPOINT].dir = cy_as_usb_out;
+ dev_p->usb_config[CY_AS_MTP_READ_ENDPOINT].type = cy_as_usb_bulk;
cy_as_dma_enable_end_point(dev_p, CY_AS_MTP_WRITE_ENDPOINT,
- cy_true, cy_as_direction_in) ;
- dev_p->usb_config[CY_AS_MTP_WRITE_ENDPOINT].enabled = cy_true ;
- dev_p->usb_config[CY_AS_MTP_WRITE_ENDPOINT].dir = cy_as_usb_in ;
- dev_p->usb_config[CY_AS_MTP_WRITE_ENDPOINT].type = cy_as_usb_bulk ;
+ cy_true, cy_as_direction_in);
+ dev_p->usb_config[CY_AS_MTP_WRITE_ENDPOINT].enabled = cy_true;
+ dev_p->usb_config[CY_AS_MTP_WRITE_ENDPOINT].dir = cy_as_usb_in;
+ dev_p->usb_config[CY_AS_MTP_WRITE_ENDPOINT].type = cy_as_usb_bulk;
/* Packet size is 512 bytes */
- cy_as_dma_set_max_dma_size(dev_p, 0x02, 0x0200) ;
+ cy_as_dma_set_max_dma_size(dev_p, 0x02, 0x0200);
/* Packet size is 64 bytes until a switch to high speed happens.*/
- cy_as_dma_set_max_dma_size(dev_p, 0x06, 0x40) ;
+ cy_as_dma_set_max_dma_size(dev_p, 0x06, 0x40);
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
if (ret != CY_AS_ERROR_SUCCESS)
cy_as_ll_register_request_callback(dev_p,
- CY_RQT_TUR_RQT_CONTEXT, 0) ;
+ CY_RQT_TUR_RQT_CONTEXT, 0);
- cy_as_device_clear_m_s_s_pending(dev_p) ;
+ cy_as_device_clear_m_s_s_pending(dev_p);
- return ret ;
+ return ret;
}
@@ -308,99 +308,99 @@ cy_as_mtp_start(cy_as_device_handle handle,
uint32_t client
)
{
- cy_as_ll_request_response *req_p, *reply_p ;
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
- cy_as_device *dev_p ;
+ cy_as_ll_request_response *req_p, *reply_p;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
+ cy_as_device *dev_p;
- dev_p = (cy_as_device *)handle ;
+ dev_p = (cy_as_device *)handle;
if (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE))
- return CY_AS_ERROR_INVALID_HANDLE ;
+ return CY_AS_ERROR_INVALID_HANDLE;
if (!cy_as_device_is_configured(dev_p))
- return CY_AS_ERROR_NOT_CONFIGURED ;
+ return CY_AS_ERROR_NOT_CONFIGURED;
if (!cy_as_device_is_firmware_loaded(dev_p))
- return CY_AS_ERROR_NO_FIRMWARE ;
+ return CY_AS_ERROR_NO_FIRMWARE;
if (cy_as_device_is_in_suspend_mode(dev_p))
- return CY_AS_ERROR_IN_SUSPEND ;
+ return CY_AS_ERROR_IN_SUSPEND;
if (cy_as_device_is_in_callback(dev_p))
- return CY_AS_ERROR_INVALID_IN_CALLBACK ;
+ return CY_AS_ERROR_INVALID_IN_CALLBACK;
if (cy_as_device_is_m_s_s_pending(dev_p))
- return CY_AS_ERROR_STARTSTOP_PENDING ;
+ return CY_AS_ERROR_STARTSTOP_PENDING;
if (dev_p->storage_count == 0)
- return CY_AS_ERROR_NOT_RUNNING ;
+ return CY_AS_ERROR_NOT_RUNNING;
if (dev_p->usb_count == 0)
- return CY_AS_ERROR_NOT_RUNNING ;
+ return CY_AS_ERROR_NOT_RUNNING;
if (dev_p->is_mtp_firmware == 0)
- return CY_AS_ERROR_NOT_SUPPORTED ;
+ return CY_AS_ERROR_NOT_SUPPORTED;
- cy_as_device_set_m_s_s_pending(dev_p) ;
+ cy_as_device_set_m_s_s_pending(dev_p);
if (dev_p->mtp_count == 0) {
- dev_p->mtp_event_cb = event_c_b ;
+ dev_p->mtp_event_cb = event_c_b;
/*
* we register here becuase the start request may cause
* events to occur before the response to the start request.
*/
cy_as_ll_register_request_callback(dev_p,
- CY_RQT_TUR_RQT_CONTEXT, my_mtp_request_callback) ;
+ CY_RQT_TUR_RQT_CONTEXT, my_mtp_request_callback);
/* Create the request to send to the West Bridge device */
req_p = cy_as_ll_create_request(dev_p,
- CY_RQT_START_MTP, CY_RQT_TUR_RQT_CONTEXT, 0) ;
+ CY_RQT_START_MTP, CY_RQT_TUR_RQT_CONTEXT, 0);
if (req_p == 0) {
- cy_as_device_clear_m_s_s_pending(dev_p) ;
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ cy_as_device_clear_m_s_s_pending(dev_p);
+ return CY_AS_ERROR_OUT_OF_MEMORY;
}
/* Reserve space for the reply, the reply data will
* not exceed one word */
- reply_p = cy_as_ll_create_response(dev_p, 1) ;
+ reply_p = cy_as_ll_create_response(dev_p, 1);
if (reply_p == 0) {
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_device_clear_m_s_s_pending(dev_p) ;
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_device_clear_m_s_s_pending(dev_p);
+ return CY_AS_ERROR_OUT_OF_MEMORY;
}
if (cb == 0) {
ret = cy_as_ll_send_request_wait_reply(dev_p,
- req_p, reply_p) ;
+ req_p, reply_p);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
return my_handle_response_mtp_start(dev_p, req_p,
- reply_p, ret) ;
+ reply_p, ret);
} else {
ret = cy_as_misc_send_request(dev_p, cb, client,
CY_FUNCT_CB_MTP_START, 0, dev_p->func_cbs_mtp,
CY_AS_REQUEST_RESPONSE_EX, req_p, reply_p,
- cy_as_mtp_func_callback) ;
+ cy_as_mtp_func_callback);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
- return ret ;
+ return ret;
}
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
} else {
- dev_p->mtp_count++ ;
+ dev_p->mtp_count++;
if (cb)
- cb(handle, ret, client, CY_FUNCT_CB_MTP_START, 0) ;
+ cb(handle, ret, client, CY_FUNCT_CB_MTP_START, 0);
}
- cy_as_device_clear_m_s_s_pending(dev_p) ;
+ cy_as_device_clear_m_s_s_pending(dev_p);
- return ret ;
+ return ret;
}
static cy_as_return_status_t
@@ -410,35 +410,35 @@ my_handle_response_mtp_stop(cy_as_device *dev_p,
cy_as_return_status_t ret)
{
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
if (cy_as_ll_request_response__get_code(reply_p) !=
CY_RESP_SUCCESS_FAILURE) {
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
- goto destroy ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
+ goto destroy;
}
- ret = cy_as_ll_request_response__get_word(reply_p, 0) ;
+ ret = cy_as_ll_request_response__get_word(reply_p, 0);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
/*
* we sucessfully shutdown the stack, so decrement
* to make the count zero.
*/
- dev_p->mtp_count-- ;
+ dev_p->mtp_count--;
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
if (ret != CY_AS_ERROR_SUCCESS)
cy_as_ll_register_request_callback(dev_p,
- CY_RQT_TUR_RQT_CONTEXT, 0) ;
+ CY_RQT_TUR_RQT_CONTEXT, 0);
- cy_as_device_clear_m_s_s_pending(dev_p) ;
+ cy_as_device_clear_m_s_s_pending(dev_p);
- return ret ;
+ return ret;
}
cy_as_return_status_t
@@ -447,81 +447,81 @@ cy_as_mtp_stop(cy_as_device_handle handle,
uint32_t client
)
{
- cy_as_ll_request_response *req_p = 0, *reply_p = 0 ;
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
+ cy_as_ll_request_response *req_p = 0, *reply_p = 0;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
- cy_as_device *dev_p ;
+ cy_as_device *dev_p;
- cy_as_log_debug_message(6, "cy_as_mtp_stop called") ;
+ cy_as_log_debug_message(6, "cy_as_mtp_stop called");
- dev_p = (cy_as_device *)handle ;
+ dev_p = (cy_as_device *)handle;
if (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE))
- return CY_AS_ERROR_INVALID_HANDLE ;
+ return CY_AS_ERROR_INVALID_HANDLE;
- ret = is_mtp_active(dev_p) ;
+ ret = is_mtp_active(dev_p);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
if (cy_as_device_is_in_callback(dev_p))
- return CY_AS_ERROR_INVALID_IN_CALLBACK ;
+ return CY_AS_ERROR_INVALID_IN_CALLBACK;
if (cy_as_device_is_m_s_s_pending(dev_p))
- return CY_AS_ERROR_STARTSTOP_PENDING ;
+ return CY_AS_ERROR_STARTSTOP_PENDING;
- cy_as_device_set_m_s_s_pending(dev_p) ;
+ cy_as_device_set_m_s_s_pending(dev_p);
if (dev_p->mtp_count == 1) {
/* Create the request to send to the West
* Bridge device */
req_p = cy_as_ll_create_request(dev_p, CY_RQT_STOP_MTP,
- CY_RQT_TUR_RQT_CONTEXT, 0) ;
+ CY_RQT_TUR_RQT_CONTEXT, 0);
if (req_p == 0) {
- ret = CY_AS_ERROR_OUT_OF_MEMORY ;
- goto destroy ;
+ ret = CY_AS_ERROR_OUT_OF_MEMORY;
+ goto destroy;
}
/* Reserve space for the reply, the reply data will
* not exceed one word */
- reply_p = cy_as_ll_create_response(dev_p, 1) ;
+ reply_p = cy_as_ll_create_response(dev_p, 1);
if (reply_p == 0) {
- ret = CY_AS_ERROR_OUT_OF_MEMORY ;
- goto destroy ;
+ ret = CY_AS_ERROR_OUT_OF_MEMORY;
+ goto destroy;
}
if (cb == 0) {
ret = cy_as_ll_send_request_wait_reply(dev_p,
- req_p, reply_p) ;
+ req_p, reply_p);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
return my_handle_response_mtp_stop(dev_p, req_p,
- reply_p, ret) ;
+ reply_p, ret);
} else {
ret = cy_as_misc_send_request(dev_p, cb, client,
CY_FUNCT_CB_MTP_STOP, 0, dev_p->func_cbs_mtp,
CY_AS_REQUEST_RESPONSE_EX, req_p, reply_p,
- cy_as_mtp_func_callback) ;
+ cy_as_mtp_func_callback);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
- return ret ;
+ return ret;
}
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
} else if (dev_p->mtp_count > 1) {
- dev_p->mtp_count-- ;
+ dev_p->mtp_count--;
if (cb)
- cb(handle, ret, client, CY_FUNCT_CB_MTP_STOP, 0) ;
+ cb(handle, ret, client, CY_FUNCT_CB_MTP_STOP, 0);
}
- cy_as_device_clear_m_s_s_pending(dev_p) ;
+ cy_as_device_clear_m_s_s_pending(dev_p);
- return ret ;
+ return ret;
}
static void
@@ -532,24 +532,24 @@ mtp_write_callback(
cy_as_ll_request_response *resp,
cy_as_return_status_t ret)
{
- cy_as_hal_assert(context == CY_RQT_TUR_RQT_CONTEXT) ;
+ cy_as_hal_assert(context == CY_RQT_TUR_RQT_CONTEXT);
if (ret == CY_AS_ERROR_SUCCESS) {
if (cy_as_ll_request_response__get_code(resp) !=
CY_RESP_SUCCESS_FAILURE)
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
else
- ret = cy_as_ll_request_response__get_word(resp, 0) ;
+ ret = cy_as_ll_request_response__get_word(resp, 0);
}
if (ret != CY_AS_ERROR_SUCCESS) {
/* Firmware failed the request. Cancel the DMA transfer. */
- cy_as_dma_cancel(dev_p, 0x04, CY_AS_ERROR_CANCELED) ;
- cy_as_device_clear_storage_async_pending(dev_p) ;
+ cy_as_dma_cancel(dev_p, 0x04, CY_AS_ERROR_CANCELED);
+ cy_as_device_clear_storage_async_pending(dev_p);
}
- cy_as_ll_destroy_response(dev_p, resp) ;
- cy_as_ll_destroy_request(dev_p, rqt) ;
+ cy_as_ll_destroy_response(dev_p, resp);
+ cy_as_ll_destroy_request(dev_p, rqt);
}
static void
@@ -557,25 +557,25 @@ async_write_request_callback(cy_as_device *dev_p,
cy_as_end_point_number_t ep, void *buf_p, uint32_t size,
cy_as_return_status_t err)
{
- cy_as_device_handle h ;
- cy_as_function_callback cb ;
+ cy_as_device_handle h;
+ cy_as_function_callback cb;
- (void)size ;
- (void)buf_p ;
- (void)ep ;
+ (void)size;
+ (void)buf_p;
+ (void)ep;
- cy_as_log_debug_message(6, "async_write_request_callback called") ;
+ cy_as_log_debug_message(6, "async_write_request_callback called");
- h = (cy_as_device_handle)dev_p ;
+ h = (cy_as_device_handle)dev_p;
- cb = dev_p->mtp_cb ;
- dev_p->mtp_cb = 0 ;
+ cb = dev_p->mtp_cb;
+ dev_p->mtp_cb = 0;
- cy_as_device_clear_storage_async_pending(dev_p) ;
+ cy_as_device_clear_storage_async_pending(dev_p);
if (cb)
- cb(h, err, dev_p->mtp_client, dev_p->mtp_op, 0) ;
+ cb(h, err, dev_p->mtp_client, dev_p->mtp_op, 0);
}
@@ -583,11 +583,11 @@ static void
sync_mtp_callback(cy_as_device *dev_p, cy_as_end_point_number_t ep,
void *buf_p, uint32_t size, cy_as_return_status_t err)
{
- (void)ep ;
- (void)buf_p ;
- (void)size ;
+ (void)ep;
+ (void)buf_p;
+ (void)size;
- dev_p->mtp_error = err ;
+ dev_p->mtp_error = err;
}
static cy_as_return_status_t
@@ -600,131 +600,131 @@ cy_as_mtp_operation(cy_as_device *dev_p,
uint8_t rqttype
)
{
- cy_as_ll_request_response *req_p = 0, *reply_p = 0 ;
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
- uint32_t mask = 0 ;
- cy_as_funct_c_b_type mtp_cb_op = 0 ;
- uint16_t size = 2 ;
+ cy_as_ll_request_response *req_p = 0, *reply_p = 0;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
+ uint32_t mask = 0;
+ cy_as_funct_c_b_type mtp_cb_op = 0;
+ uint16_t size = 2;
if (dev_p->mtp_count == 0)
- return CY_AS_ERROR_NOT_RUNNING ;
+ return CY_AS_ERROR_NOT_RUNNING;
if (rqttype == CY_RQT_INIT_SEND_OBJECT) {
- mtp_cb_op = CY_FUNCT_CB_MTP_INIT_SEND_OBJECT ;
- dev_p->mtp_turbo_active = cy_true ;
+ mtp_cb_op = CY_FUNCT_CB_MTP_INIT_SEND_OBJECT;
+ dev_p->mtp_turbo_active = cy_true;
} else if (rqttype == CY_RQT_INIT_GET_OBJECT) {
- mtp_cb_op = CY_FUNCT_CB_MTP_INIT_GET_OBJECT ;
- dev_p->mtp_turbo_active = cy_true ;
+ mtp_cb_op = CY_FUNCT_CB_MTP_INIT_GET_OBJECT;
+ dev_p->mtp_turbo_active = cy_true;
} else
- mtp_cb_op = CY_FUNCT_CB_MTP_SEND_BLOCK_TABLE ;
+ mtp_cb_op = CY_FUNCT_CB_MTP_SEND_BLOCK_TABLE;
- ret = is_mtp_active(dev_p) ;
+ ret = is_mtp_active(dev_p);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
if (CY_RQT_INIT_GET_OBJECT == rqttype)
- size = 4 ;
+ size = 4;
/* Create the request to send to the West
* Bridge device */
req_p = cy_as_ll_create_request(dev_p, rqttype,
- CY_RQT_TUR_RQT_CONTEXT, size) ;
+ CY_RQT_TUR_RQT_CONTEXT, size);
if (req_p == 0) {
- ret = CY_AS_ERROR_OUT_OF_MEMORY ;
- goto destroy ;
+ ret = CY_AS_ERROR_OUT_OF_MEMORY;
+ goto destroy;
}
/* Reserve space for the reply, the reply data will
* not exceed one word */
- reply_p = cy_as_ll_create_response(dev_p, 1) ;
+ reply_p = cy_as_ll_create_response(dev_p, 1);
if (reply_p == 0) {
- ret = CY_AS_ERROR_OUT_OF_MEMORY ;
- goto destroy ;
+ ret = CY_AS_ERROR_OUT_OF_MEMORY;
+ goto destroy;
}
cy_as_ll_request_response__set_word(req_p, 0,
- (uint16_t)(num_bytes & 0xFFFF)) ;
+ (uint16_t)(num_bytes & 0xFFFF));
cy_as_ll_request_response__set_word(req_p, 1,
- (uint16_t)((num_bytes >> 16) & 0xFFFF)) ;
+ (uint16_t)((num_bytes >> 16) & 0xFFFF));
/* If it is GET_OBJECT, send transaction id as well*/
if (CY_RQT_INIT_GET_OBJECT == rqttype) {
cy_as_ll_request_response__set_word(req_p, 2,
- (uint16_t)(transaction_id & 0xFFFF)) ;
+ (uint16_t)(transaction_id & 0xFFFF));
cy_as_ll_request_response__set_word(req_p, 3,
- (uint16_t)((transaction_id >> 16) & 0xFFFF)) ;
+ (uint16_t)((transaction_id >> 16) & 0xFFFF));
}
if (cb == 0) {
/* Queue the DMA request for block table write */
ret = cy_as_dma_queue_request(dev_p, 4, blk_table,
sizeof(cy_as_mtp_block_table), cy_false,
- cy_false, sync_mtp_callback) ;
+ cy_false, sync_mtp_callback);
ret = cy_as_ll_send_request_wait_reply(dev_p,
- req_p, reply_p) ;
+ req_p, reply_p);
if (ret != CY_AS_ERROR_SUCCESS) {
- cy_as_dma_cancel(dev_p, 4, CY_AS_ERROR_CANCELED) ;
- cy_as_device_clear_storage_async_pending(dev_p) ;
+ cy_as_dma_cancel(dev_p, 4, CY_AS_ERROR_CANCELED);
+ cy_as_device_clear_storage_async_pending(dev_p);
- goto destroy ;
+ goto destroy;
}
- ret = cy_as_dma_drain_queue(dev_p, 4, cy_true) ;
+ ret = cy_as_dma_drain_queue(dev_p, 4, cy_true);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
- ret = dev_p->mtp_error ;
- goto destroy ;
+ ret = dev_p->mtp_error;
+ goto destroy;
} else {
#if 0
ret = cy_as_misc_send_request(dev_p, cb, client,
CY_FUNCT_CB_MTP_INIT_SEND_OBJECT,
0, dev_p->func_cbs_mtp, CY_AS_REQUEST_RESPONSE_EX,
- req_p, reply_p, cy_as_mtp_func_callback) ;
+ req_p, reply_p, cy_as_mtp_func_callback);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
#endif
/* Protection from interrupt driven code */
/* since we are using storage EP4 check if any
* storage activity is pending */
- mask = cy_as_hal_disable_interrupts() ;
+ mask = cy_as_hal_disable_interrupts();
if ((cy_as_device_is_storage_async_pending(dev_p)) ||
(dev_p->storage_wait)) {
- cy_as_hal_enable_interrupts(mask) ;
- return CY_AS_ERROR_ASYNC_PENDING ;
+ cy_as_hal_enable_interrupts(mask);
+ return CY_AS_ERROR_ASYNC_PENDING;
}
- cy_as_device_set_storage_async_pending(dev_p) ;
- cy_as_hal_enable_interrupts(mask) ;
+ cy_as_device_set_storage_async_pending(dev_p);
+ cy_as_hal_enable_interrupts(mask);
- dev_p->mtp_cb = cb ;
- dev_p->mtp_client = client ;
- dev_p->mtp_op = mtp_cb_op ;
+ dev_p->mtp_cb = cb;
+ dev_p->mtp_client = client;
+ dev_p->mtp_op = mtp_cb_op;
ret = cy_as_ll_send_request(dev_p, req_p, reply_p,
- cy_false, mtp_write_callback) ;
+ cy_false, mtp_write_callback);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
ret = cy_as_dma_queue_request(dev_p, 4, blk_table,
sizeof(cy_as_mtp_block_table), cy_false, cy_false,
- async_write_request_callback) ;
+ async_write_request_callback);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
/* Kick start the queue if it is not running */
- cy_as_dma_kick_start(dev_p, 4) ;
+ cy_as_dma_kick_start(dev_p, 4);
- return CY_AS_ERROR_SUCCESS ;
+ return CY_AS_ERROR_SUCCESS;
}
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
- return ret ;
+ return ret;
}
cy_as_return_status_t
@@ -735,13 +735,13 @@ cy_as_mtp_init_send_object(cy_as_device_handle handle,
uint32_t client
)
{
- cy_as_device *dev_p ;
- dev_p = (cy_as_device *)handle ;
+ cy_as_device *dev_p;
+ dev_p = (cy_as_device *)handle;
if (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE))
- return CY_AS_ERROR_INVALID_HANDLE ;
+ return CY_AS_ERROR_INVALID_HANDLE;
return cy_as_mtp_operation(dev_p, blk_table, num_bytes, 0, cb,
- client, CY_RQT_INIT_SEND_OBJECT) ;
+ client, CY_RQT_INIT_SEND_OBJECT);
}
@@ -754,13 +754,13 @@ cy_as_mtp_init_get_object(cy_as_device_handle handle,
uint32_t client
)
{
- cy_as_device *dev_p ;
- dev_p = (cy_as_device *)handle ;
+ cy_as_device *dev_p;
+ dev_p = (cy_as_device *)handle;
if (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE))
- return CY_AS_ERROR_INVALID_HANDLE ;
+ return CY_AS_ERROR_INVALID_HANDLE;
return cy_as_mtp_operation(dev_p, blk_table, num_bytes,
- transaction_id, cb, client, CY_RQT_INIT_GET_OBJECT) ;
+ transaction_id, cb, client, CY_RQT_INIT_GET_OBJECT);
}
@@ -771,24 +771,24 @@ my_handle_response_cancel_send_object(cy_as_device *dev_p,
cy_as_return_status_t ret)
{
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
if (cy_as_ll_request_response__get_code(reply_p) !=
CY_RESP_SUCCESS_FAILURE) {
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
- goto destroy ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
+ goto destroy;
}
- ret = cy_as_ll_request_response__get_word(reply_p, 0) ;
+ ret = cy_as_ll_request_response__get_word(reply_p, 0);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
- return ret ;
+ return ret;
}
cy_as_return_status_t
@@ -797,58 +797,58 @@ cy_as_mtp_cancel_send_object(cy_as_device_handle handle,
uint32_t client
)
{
- cy_as_ll_request_response *req_p = 0, *reply_p = 0 ;
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
- cy_as_device *dev_p ;
+ cy_as_ll_request_response *req_p = 0, *reply_p = 0;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
+ cy_as_device *dev_p;
- dev_p = (cy_as_device *)handle ;
+ dev_p = (cy_as_device *)handle;
if (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE))
- return CY_AS_ERROR_INVALID_HANDLE ;
+ return CY_AS_ERROR_INVALID_HANDLE;
if (dev_p->mtp_count == 0)
- return CY_AS_ERROR_NOT_RUNNING ;
+ return CY_AS_ERROR_NOT_RUNNING;
/* Create the request to send to the West Bridge device */
req_p = cy_as_ll_create_request(dev_p,
- CY_RQT_CANCEL_SEND_OBJECT, CY_RQT_TUR_RQT_CONTEXT, 0) ;
+ CY_RQT_CANCEL_SEND_OBJECT, CY_RQT_TUR_RQT_CONTEXT, 0);
if (req_p == 0) {
- ret = CY_AS_ERROR_OUT_OF_MEMORY ;
- goto destroy ;
+ ret = CY_AS_ERROR_OUT_OF_MEMORY;
+ goto destroy;
}
/* Reserve space for the reply, the reply data will
* not exceed one word */
- reply_p = cy_as_ll_create_response(dev_p, 1) ;
+ reply_p = cy_as_ll_create_response(dev_p, 1);
if (reply_p == 0) {
- ret = CY_AS_ERROR_OUT_OF_MEMORY ;
- goto destroy ;
+ ret = CY_AS_ERROR_OUT_OF_MEMORY;
+ goto destroy;
}
if (cb == 0) {
ret = cy_as_ll_send_request_wait_reply(dev_p,
- req_p, reply_p) ;
+ req_p, reply_p);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
return my_handle_response_cancel_send_object(dev_p,
- req_p, reply_p, ret) ;
+ req_p, reply_p, ret);
} else {
ret = cy_as_misc_send_request(dev_p, cb, client,
CY_FUNCT_CB_MTP_CANCEL_SEND_OBJECT, 0,
dev_p->func_cbs_mtp, CY_AS_REQUEST_RESPONSE_EX,
- req_p, reply_p, cy_as_mtp_func_callback) ;
+ req_p, reply_p, cy_as_mtp_func_callback);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
- return ret ;
+ return ret;
}
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
- return ret ;
+ return ret;
}
static cy_as_return_status_t
@@ -858,24 +858,24 @@ my_handle_response_cancel_get_object(cy_as_device *dev_p,
cy_as_return_status_t ret)
{
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
if (cy_as_ll_request_response__get_code(reply_p) !=
CY_RESP_SUCCESS_FAILURE) {
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
- goto destroy ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
+ goto destroy;
}
- ret = cy_as_ll_request_response__get_word(reply_p, 0) ;
+ ret = cy_as_ll_request_response__get_word(reply_p, 0);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
- return ret ;
+ return ret;
}
cy_as_return_status_t
@@ -884,58 +884,58 @@ cy_as_mtp_cancel_get_object(cy_as_device_handle handle,
uint32_t client
)
{
- cy_as_ll_request_response *req_p = 0, *reply_p = 0 ;
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
- cy_as_device *dev_p ;
+ cy_as_ll_request_response *req_p = 0, *reply_p = 0;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
+ cy_as_device *dev_p;
- dev_p = (cy_as_device *)handle ;
+ dev_p = (cy_as_device *)handle;
if (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE))
- return CY_AS_ERROR_INVALID_HANDLE ;
+ return CY_AS_ERROR_INVALID_HANDLE;
if (dev_p->mtp_count == 0)
- return CY_AS_ERROR_NOT_RUNNING ;
+ return CY_AS_ERROR_NOT_RUNNING;
/* Create the request to send to the West Bridge device */
req_p = cy_as_ll_create_request(dev_p, CY_RQT_CANCEL_GET_OBJECT,
- CY_RQT_TUR_RQT_CONTEXT, 0) ;
+ CY_RQT_TUR_RQT_CONTEXT, 0);
if (req_p == 0) {
- ret = CY_AS_ERROR_OUT_OF_MEMORY ;
- goto destroy ;
+ ret = CY_AS_ERROR_OUT_OF_MEMORY;
+ goto destroy;
}
/* Reserve space for the reply, the reply data will
* not exceed one word */
- reply_p = cy_as_ll_create_response(dev_p, 1) ;
+ reply_p = cy_as_ll_create_response(dev_p, 1);
if (reply_p == 0) {
- ret = CY_AS_ERROR_OUT_OF_MEMORY ;
- goto destroy ;
+ ret = CY_AS_ERROR_OUT_OF_MEMORY;
+ goto destroy;
}
if (cb == 0) {
ret = cy_as_ll_send_request_wait_reply(dev_p,
- req_p, reply_p) ;
+ req_p, reply_p);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
return my_handle_response_cancel_get_object(dev_p,
- req_p, reply_p, ret) ;
+ req_p, reply_p, ret);
} else {
ret = cy_as_misc_send_request(dev_p, cb, client,
CY_FUNCT_CB_MTP_CANCEL_GET_OBJECT, 0,
dev_p->func_cbs_mtp, CY_AS_REQUEST_RESPONSE_EX,
- req_p, reply_p, cy_as_mtp_func_callback) ;
+ req_p, reply_p, cy_as_mtp_func_callback);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
- return ret ;
+ return ret;
}
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
- return ret ;
+ return ret;
}
cy_as_return_status_t
@@ -944,13 +944,13 @@ cy_as_mtp_send_block_table(cy_as_device_handle handle,
cy_as_function_callback cb,
uint32_t client)
{
- cy_as_device *dev_p ;
- dev_p = (cy_as_device *)handle ;
+ cy_as_device *dev_p;
+ dev_p = (cy_as_device *)handle;
if (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE))
- return CY_AS_ERROR_INVALID_HANDLE ;
+ return CY_AS_ERROR_INVALID_HANDLE;
return cy_as_mtp_operation(dev_p, blk_table, 0, 0, cb,
- client, CY_RQT_SEND_BLOCK_TABLE) ;
+ client, CY_RQT_SEND_BLOCK_TABLE);
}
static void
@@ -961,67 +961,67 @@ cy_as_mtp_func_callback(cy_as_device *dev_p,
cy_as_return_status_t stat)
{
cy_as_func_c_b_node* node = (cy_as_func_c_b_node *)
- dev_p->func_cbs_mtp->head_p ;
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
- uint8_t code ;
- cy_bool delay_callback = cy_false ;
+ dev_p->func_cbs_mtp->head_p;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
+ uint8_t code;
+ cy_bool delay_callback = cy_false;
- cy_as_hal_assert(dev_p->func_cbs_mtp->count != 0) ;
- cy_as_hal_assert(dev_p->func_cbs_mtp->type == CYAS_FUNC_CB) ;
+ cy_as_hal_assert(dev_p->func_cbs_mtp->count != 0);
+ cy_as_hal_assert(dev_p->func_cbs_mtp->type == CYAS_FUNC_CB);
- (void)context ;
+ (void)context;
/* The Handlers are responsible for Deleting the
* rqt and resp when they are finished
*/
- code = cy_as_ll_request_response__get_code(rqt) ;
+ code = cy_as_ll_request_response__get_code(rqt);
switch (code) {
case CY_RQT_START_MTP:
ret = my_handle_response_mtp_start(dev_p, rqt,
- resp, stat) ;
- break ;
+ resp, stat);
+ break;
case CY_RQT_STOP_MTP:
ret = my_handle_response_mtp_stop(dev_p, rqt,
- resp, stat) ;
- break ;
+ resp, stat);
+ break;
#if 0
case CY_RQT_INIT_SEND_OBJECT:
ret = my_handle_response_init_send_object(dev_p,
- rqt, resp, stat, cy_true) ;
- delay_callback = cy_true ;
- break ;
+ rqt, resp, stat, cy_true);
+ delay_callback = cy_true;
+ break;
#endif
case CY_RQT_CANCEL_SEND_OBJECT:
ret = my_handle_response_cancel_send_object(dev_p,
- rqt, resp, stat) ;
- break ;
+ rqt, resp, stat);
+ break;
#if 0
case CY_RQT_INIT_GET_OBJECT:
ret = my_handle_response_init_get_object(dev_p,
- rqt, resp, stat, cy_true) ;
- delay_callback = cy_true ;
- break ;
+ rqt, resp, stat, cy_true);
+ delay_callback = cy_true;
+ break;
#endif
case CY_RQT_CANCEL_GET_OBJECT:
ret = my_handle_response_cancel_get_object(dev_p,
- rqt, resp, stat) ;
- break ;
+ rqt, resp, stat);
+ break;
#if 0
case CY_RQT_SEND_BLOCK_TABLE:
ret = my_handle_response_send_block_table(dev_p, rqt,
- resp, stat, cy_true) ;
- delay_callback = cy_true ;
- break ;
+ resp, stat, cy_true);
+ delay_callback = cy_true;
+ break;
#endif
case CY_RQT_ENABLE_USB_PATH:
- ret = my_handle_response_no_data(dev_p, rqt, resp) ;
+ ret = my_handle_response_no_data(dev_p, rqt, resp);
if (ret == CY_AS_ERROR_SUCCESS)
- dev_p->is_storage_only_mode = cy_false ;
- break ;
+ dev_p->is_storage_only_mode = cy_false;
+ break;
default:
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
- cy_as_hal_assert(cy_false) ;
- break ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
+ cy_as_hal_assert(cy_false);
+ break;
}
/*
@@ -1030,33 +1030,33 @@ cy_as_mtp_func_callback(cy_as_device *dev_p,
* based on the response from firmware.
*/
if (stat == CY_AS_ERROR_SUCCESS)
- stat = ret ;
+ stat = ret;
if (!delay_callback) {
node->cb_p((cy_as_device_handle)dev_p, stat, node->client_data,
- node->data_type, node->data) ;
- cy_as_remove_c_b_node(dev_p->func_cbs_mtp) ;
+ node->data_type, node->data);
+ cy_as_remove_c_b_node(dev_p->func_cbs_mtp);
}
}
cy_as_return_status_t
cy_as_mtp_storage_only_start(cy_as_device_handle handle)
{
- cy_as_device *dev_p = (cy_as_device *)handle ;
+ cy_as_device *dev_p = (cy_as_device *)handle;
if (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE))
- return CY_AS_ERROR_INVALID_HANDLE ;
+ return CY_AS_ERROR_INVALID_HANDLE;
if (!cy_as_device_is_configured(dev_p))
- return CY_AS_ERROR_NOT_CONFIGURED ;
+ return CY_AS_ERROR_NOT_CONFIGURED;
if (!cy_as_device_is_firmware_loaded(dev_p))
- return CY_AS_ERROR_NO_FIRMWARE ;
+ return CY_AS_ERROR_NO_FIRMWARE;
if (dev_p->storage_count == 0)
- return CY_AS_ERROR_NOT_RUNNING ;
+ return CY_AS_ERROR_NOT_RUNNING;
- dev_p->is_storage_only_mode = cy_true ;
- return CY_AS_ERROR_SUCCESS ;
+ dev_p->is_storage_only_mode = cy_true;
+ return CY_AS_ERROR_SUCCESS;
}
cy_as_return_status_t
@@ -1064,65 +1064,65 @@ cy_as_mtp_storage_only_stop(cy_as_device_handle handle,
cy_as_function_callback cb,
uint32_t client)
{
- cy_as_device *dev_p = (cy_as_device *)handle ;
- cy_as_ll_request_response *req_p, *reply_p ;
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
+ cy_as_device *dev_p = (cy_as_device *)handle;
+ cy_as_ll_request_response *req_p, *reply_p;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
if (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE))
- return CY_AS_ERROR_INVALID_HANDLE ;
+ return CY_AS_ERROR_INVALID_HANDLE;
if (!cy_as_device_is_configured(dev_p))
- return CY_AS_ERROR_NOT_CONFIGURED ;
+ return CY_AS_ERROR_NOT_CONFIGURED;
if (!cy_as_device_is_firmware_loaded(dev_p))
- return CY_AS_ERROR_NO_FIRMWARE ;
+ return CY_AS_ERROR_NO_FIRMWARE;
if (dev_p->storage_count == 0)
- return CY_AS_ERROR_NOT_RUNNING ;
+ return CY_AS_ERROR_NOT_RUNNING;
if (dev_p->is_storage_only_mode == cy_false)
- return CY_AS_ERROR_SUCCESS ;
+ return CY_AS_ERROR_SUCCESS;
if (cy_as_device_is_in_callback(dev_p))
- return CY_AS_ERROR_INVALID_IN_CALLBACK ;
+ return CY_AS_ERROR_INVALID_IN_CALLBACK;
req_p = cy_as_ll_create_request(dev_p,
- CY_RQT_ENABLE_USB_PATH, CY_RQT_TUR_RQT_CONTEXT, 1) ;
+ CY_RQT_ENABLE_USB_PATH, CY_RQT_TUR_RQT_CONTEXT, 1);
if (req_p == 0)
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ return CY_AS_ERROR_OUT_OF_MEMORY;
- reply_p = cy_as_ll_create_response(dev_p, 1) ;
+ reply_p = cy_as_ll_create_response(dev_p, 1);
if (reply_p == 0) {
- cy_as_ll_destroy_request(dev_p, req_p) ;
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ return CY_AS_ERROR_OUT_OF_MEMORY;
}
if (cb == 0) {
ret = cy_as_ll_send_request_wait_reply(dev_p,
- req_p, reply_p) ;
+ req_p, reply_p);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
ret = my_handle_response_no_data(dev_p, req_p,
- reply_p) ;
+ reply_p);
if (ret == CY_AS_ERROR_SUCCESS)
- dev_p->is_storage_only_mode = cy_false ;
- return ret ;
+ dev_p->is_storage_only_mode = cy_false;
+ return ret;
} else {
ret = cy_as_misc_send_request(dev_p, cb, client,
CY_FUNCT_CB_MTP_STOP_STORAGE_ONLY, 0,
dev_p->func_cbs_mtp, CY_AS_REQUEST_RESPONSE_EX,
- req_p, reply_p, cy_as_mtp_func_callback) ;
+ req_p, reply_p, cy_as_mtp_func_callback);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
- return ret ;
+ return ret;
}
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
- return ret ;
+ return ret;
}
diff --git a/drivers/staging/westbridge/astoria/api/src/cyasstorage.c b/drivers/staging/westbridge/astoria/api/src/cyasstorage.c
index c7c3cda261d..083d869e57c 100644
--- a/drivers/staging/westbridge/astoria/api/src/cyasstorage.c
+++ b/drivers/staging/westbridge/astoria/api/src/cyasstorage.c
@@ -43,16 +43,16 @@ cy_as_return_status_t
cy_an_map_bus_from_media_type(cy_as_device *dev_p,
cy_as_media_type type, cy_as_bus_number_t *bus)
{
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
- uint8_t code = (uint8_t)(1 << type) ;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
+ uint8_t code = (uint8_t)(1 << type);
if (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE))
- return CY_AS_ERROR_INVALID_HANDLE ;
+ return CY_AS_ERROR_INVALID_HANDLE;
if (!cy_as_device_is_configured(dev_p))
- return CY_AS_ERROR_NOT_CONFIGURED ;
+ return CY_AS_ERROR_NOT_CONFIGURED;
if (!cy_as_device_is_firmware_loaded(dev_p))
- return CY_AS_ERROR_NO_FIRMWARE ;
+ return CY_AS_ERROR_NO_FIRMWARE;
if (dev_p->media_supported[0] & code) {
@@ -61,100 +61,100 @@ cy_an_map_bus_from_media_type(cy_as_device *dev_p,
* this media type could be supported on multiple
* buses. so, report an address resolution error.
*/
- ret = CY_AS_ERROR_ADDRESS_RESOLUTION_ERROR ;
+ ret = CY_AS_ERROR_ADDRESS_RESOLUTION_ERROR;
} else
- *bus = 0 ;
+ *bus = 0;
} else {
if (dev_p->media_supported[1] & code)
- *bus = 1 ;
+ *bus = 1;
else
- ret = CY_AS_ERROR_NO_SUCH_MEDIA ;
+ ret = CY_AS_ERROR_NO_SUCH_MEDIA;
}
- return ret ;
+ return ret;
}
static uint16_t
create_address(cy_as_bus_number_t bus, uint32_t device, uint8_t unit)
{
- cy_as_hal_assert(bus >= 0 && bus < CY_AS_MAX_BUSES) ;
- cy_as_hal_assert(device < 16) ;
+ cy_as_hal_assert(bus >= 0 && bus < CY_AS_MAX_BUSES);
+ cy_as_hal_assert(device < 16);
- return (uint16_t)(((uint8_t)bus << 12) | (device << 8) | unit) ;
+ return (uint16_t)(((uint8_t)bus << 12) | (device << 8) | unit);
}
cy_as_media_type
cy_as_storage_get_media_from_address(uint16_t v)
{
- cy_as_media_type media = cy_as_media_max_media_value ;
+ cy_as_media_type media = cy_as_media_max_media_value;
switch (v & 0xFF) {
case 0x00:
break;
case 0x01:
- media = cy_as_media_nand ;
- break ;
+ media = cy_as_media_nand;
+ break;
case 0x02:
- media = cy_as_media_sd_flash ;
- break ;
+ media = cy_as_media_sd_flash;
+ break;
case 0x04:
- media = cy_as_media_mmc_flash ;
- break ;
+ media = cy_as_media_mmc_flash;
+ break;
case 0x08:
- media = cy_as_media_ce_ata ;
- break ;
+ media = cy_as_media_ce_ata;
+ break;
case 0x10:
- media = cy_as_media_sdio ;
- break ;
+ media = cy_as_media_sdio;
+ break;
default:
- cy_as_hal_assert(0) ;
- break ;
+ cy_as_hal_assert(0);
+ break;
}
- return media ;
+ return media;
}
cy_as_bus_number_t
cy_as_storage_get_bus_from_address(uint16_t v)
{
- cy_as_bus_number_t bus = (cy_as_bus_number_t)((v >> 12) & 0x0f) ;
- cy_as_hal_assert(bus >= 0 && bus < CY_AS_MAX_BUSES) ;
- return bus ;
+ cy_as_bus_number_t bus = (cy_as_bus_number_t)((v >> 12) & 0x0f);
+ cy_as_hal_assert(bus >= 0 && bus < CY_AS_MAX_BUSES);
+ return bus;
}
uint32_t
cy_as_storage_get_device_from_address(uint16_t v)
{
- return (uint32_t)((v >> 8) & 0x0f) ;
+ return (uint32_t)((v >> 8) & 0x0f);
}
static uint8_t
get_unit_from_address(uint16_t v)
{
- return (uint8_t)(v & 0xff) ;
+ return (uint8_t)(v & 0xff);
}
static cy_as_return_status_t
cy_as_map_bad_addr(uint16_t val)
{
- cy_as_return_status_t ret = CY_AS_ERROR_INVALID_RESPONSE ;
+ cy_as_return_status_t ret = CY_AS_ERROR_INVALID_RESPONSE;
switch (val) {
case 0:
- ret = CY_AS_ERROR_NO_SUCH_BUS ;
- break ;
+ ret = CY_AS_ERROR_NO_SUCH_BUS;
+ break;
case 1:
- ret = CY_AS_ERROR_NO_SUCH_DEVICE ;
- break ;
+ ret = CY_AS_ERROR_NO_SUCH_DEVICE;
+ break;
case 2:
- ret = CY_AS_ERROR_NO_SUCH_UNIT ;
- break ;
+ ret = CY_AS_ERROR_NO_SUCH_UNIT;
+ break;
case 3:
- ret = CY_AS_ERROR_INVALID_BLOCK ;
- break ;
+ ret = CY_AS_ERROR_INVALID_BLOCK;
+ break;
}
- return ret ;
+ return ret;
}
static void
@@ -164,157 +164,157 @@ my_storage_request_callback(cy_as_device *dev_p,
cy_as_ll_request_response *resp_p,
cy_as_return_status_t ret)
{
- uint16_t val ;
- uint16_t addr ;
+ uint16_t val;
+ uint16_t addr;
cy_as_bus_number_t bus;
uint32_t device;
- cy_as_device_handle h = (cy_as_device_handle)dev_p ;
- cy_as_dma_end_point *ep_p = NULL ;
+ cy_as_device_handle h = (cy_as_device_handle)dev_p;
+ cy_as_dma_end_point *ep_p = NULL;
- (void)resp_p ;
- (void)context ;
- (void)ret ;
+ (void)resp_p;
+ (void)context;
+ (void)ret;
switch (cy_as_ll_request_response__get_code(req_p)) {
case CY_RQT_MEDIA_CHANGED:
cy_as_ll_send_status_response(dev_p,
- CY_RQT_STORAGE_RQT_CONTEXT, CY_AS_ERROR_SUCCESS, 0) ;
+ CY_RQT_STORAGE_RQT_CONTEXT, CY_AS_ERROR_SUCCESS, 0);
/* Media has either been inserted or removed */
- addr = cy_as_ll_request_response__get_word(req_p, 0) ;
+ addr = cy_as_ll_request_response__get_word(req_p, 0);
bus = cy_as_storage_get_bus_from_address(addr);
device = cy_as_storage_get_device_from_address(addr);
/* Clear the entry for this device to force re-query later */
cy_as_hal_mem_set(&(dev_p->storage_device_info[bus][device]), 0,
- sizeof(dev_p->storage_device_info[bus][device])) ;
+ sizeof(dev_p->storage_device_info[bus][device]));
- val = cy_as_ll_request_response__get_word(req_p, 1) ;
+ val = cy_as_ll_request_response__get_word(req_p, 1);
if (dev_p->storage_event_cb_ms) {
if (val == 1)
dev_p->storage_event_cb_ms(h, bus,
- device, cy_as_storage_removed, 0) ;
+ device, cy_as_storage_removed, 0);
else
dev_p->storage_event_cb_ms(h, bus,
- device, cy_as_storage_inserted, 0) ;
+ device, cy_as_storage_inserted, 0);
} else if (dev_p->storage_event_cb) {
if (val == 1)
dev_p->storage_event_cb(h, bus,
- cy_as_storage_removed, 0) ;
+ cy_as_storage_removed, 0);
else
dev_p->storage_event_cb(h, bus,
- cy_as_storage_inserted, 0) ;
+ cy_as_storage_inserted, 0);
}
- break ;
+ break;
case CY_RQT_ANTIOCH_CLAIM:
cy_as_ll_send_status_response(dev_p,
- CY_RQT_STORAGE_RQT_CONTEXT, CY_AS_ERROR_SUCCESS, 0) ;
+ CY_RQT_STORAGE_RQT_CONTEXT, CY_AS_ERROR_SUCCESS, 0);
if (dev_p->storage_event_cb || dev_p->storage_event_cb_ms) {
- val = cy_as_ll_request_response__get_word(req_p, 0) ;
+ val = cy_as_ll_request_response__get_word(req_p, 0);
if (dev_p->storage_event_cb_ms) {
if (val & 0x0100)
dev_p->storage_event_cb_ms(h, 0, 0,
- cy_as_storage_antioch, 0) ;
+ cy_as_storage_antioch, 0);
if (val & 0x0200)
dev_p->storage_event_cb_ms(h, 1, 0,
- cy_as_storage_antioch, 0) ;
+ cy_as_storage_antioch, 0);
} else {
if (val & 0x01)
dev_p->storage_event_cb(h,
cy_as_media_nand,
- cy_as_storage_antioch, 0) ;
+ cy_as_storage_antioch, 0);
if (val & 0x02)
dev_p->storage_event_cb(h,
cy_as_media_sd_flash,
- cy_as_storage_antioch, 0) ;
+ cy_as_storage_antioch, 0);
if (val & 0x04)
dev_p->storage_event_cb(h,
cy_as_media_mmc_flash,
- cy_as_storage_antioch, 0) ;
+ cy_as_storage_antioch, 0);
if (val & 0x08)
dev_p->storage_event_cb(h,
cy_as_media_ce_ata,
- cy_as_storage_antioch, 0) ;
+ cy_as_storage_antioch, 0);
}
}
- break ;
+ break;
case CY_RQT_ANTIOCH_RELEASE:
cy_as_ll_send_status_response(dev_p,
- CY_RQT_STORAGE_RQT_CONTEXT, CY_AS_ERROR_SUCCESS, 0) ;
- val = cy_as_ll_request_response__get_word(req_p, 0) ;
+ CY_RQT_STORAGE_RQT_CONTEXT, CY_AS_ERROR_SUCCESS, 0);
+ val = cy_as_ll_request_response__get_word(req_p, 0);
if (dev_p->storage_event_cb_ms) {
if (val & 0x0100)
dev_p->storage_event_cb_ms(h, 0, 0,
- cy_as_storage_processor, 0) ;
+ cy_as_storage_processor, 0);
if (val & 0x0200)
dev_p->storage_event_cb_ms(h, 1, 0,
- cy_as_storage_processor, 0) ;
+ cy_as_storage_processor, 0);
} else if (dev_p->storage_event_cb) {
if (val & 0x01)
dev_p->storage_event_cb(h,
cy_as_media_nand,
- cy_as_storage_processor, 0) ;
+ cy_as_storage_processor, 0);
if (val & 0x02)
dev_p->storage_event_cb(h,
cy_as_media_sd_flash,
- cy_as_storage_processor, 0) ;
+ cy_as_storage_processor, 0);
if (val & 0x04)
dev_p->storage_event_cb(h,
cy_as_media_mmc_flash,
- cy_as_storage_processor, 0) ;
+ cy_as_storage_processor, 0);
if (val & 0x08)
dev_p->storage_event_cb(h,
cy_as_media_ce_ata,
- cy_as_storage_processor, 0) ;
+ cy_as_storage_processor, 0);
}
- break ;
+ break;
case CY_RQT_SDIO_INTR:
cy_as_ll_send_status_response(dev_p,
- CY_RQT_STORAGE_RQT_CONTEXT, CY_AS_ERROR_SUCCESS, 0) ;
- val = cy_as_ll_request_response__get_word(req_p, 0) ;
+ CY_RQT_STORAGE_RQT_CONTEXT, CY_AS_ERROR_SUCCESS, 0);
+ val = cy_as_ll_request_response__get_word(req_p, 0);
if (dev_p->storage_event_cb_ms) {
if (val & 0x0100)
dev_p->storage_event_cb_ms(h, 1, 0,
- cy_as_sdio_interrupt, 0) ;
+ cy_as_sdio_interrupt, 0);
else
dev_p->storage_event_cb_ms(h, 0, 0,
- cy_as_sdio_interrupt, 0) ;
+ cy_as_sdio_interrupt, 0);
} else if (dev_p->storage_event_cb) {
dev_p->storage_event_cb(h,
- cy_as_media_sdio, cy_as_sdio_interrupt, 0) ;
+ cy_as_media_sdio, cy_as_sdio_interrupt, 0);
}
break;
case CY_RQT_P2S_DMA_START:
/* Do the DMA setup for the waiting operation. */
cy_as_ll_send_status_response(dev_p,
- CY_RQT_STORAGE_RQT_CONTEXT, CY_AS_ERROR_SUCCESS, 0) ;
- cy_as_device_set_p2s_dma_start_recvd(dev_p) ;
+ CY_RQT_STORAGE_RQT_CONTEXT, CY_AS_ERROR_SUCCESS, 0);
+ cy_as_device_set_p2s_dma_start_recvd(dev_p);
if (dev_p->storage_oper == cy_as_op_read) {
- ep_p = CY_AS_NUM_EP(dev_p, CY_AS_P2S_READ_ENDPOINT) ;
- cy_as_dma_end_point_set_stopped(ep_p) ;
- cy_as_dma_kick_start(dev_p, CY_AS_P2S_READ_ENDPOINT) ;
+ ep_p = CY_AS_NUM_EP(dev_p, CY_AS_P2S_READ_ENDPOINT);
+ cy_as_dma_end_point_set_stopped(ep_p);
+ cy_as_dma_kick_start(dev_p, CY_AS_P2S_READ_ENDPOINT);
} else {
- ep_p = CY_AS_NUM_EP(dev_p, CY_AS_P2S_WRITE_ENDPOINT) ;
- cy_as_dma_end_point_set_stopped(ep_p) ;
- cy_as_dma_kick_start(dev_p, CY_AS_P2S_WRITE_ENDPOINT) ;
+ ep_p = CY_AS_NUM_EP(dev_p, CY_AS_P2S_WRITE_ENDPOINT);
+ cy_as_dma_end_point_set_stopped(ep_p);
+ cy_as_dma_kick_start(dev_p, CY_AS_P2S_WRITE_ENDPOINT);
}
- break ;
+ break;
default:
cy_as_hal_print_message("invalid request received "
- "on storage context\n") ;
- val = req_p->box0 ;
+ "on storage context\n");
+ val = req_p->box0;
cy_as_ll_send_data_response(dev_p, CY_RQT_STORAGE_RQT_CONTEXT,
- CY_RESP_INVALID_REQUEST, sizeof(val), &val) ;
- break ;
+ CY_RESP_INVALID_REQUEST, sizeof(val), &val);
+ break;
}
}
@@ -322,18 +322,18 @@ static cy_as_return_status_t
is_storage_active(cy_as_device *dev_p)
{
if (!cy_as_device_is_configured(dev_p))
- return CY_AS_ERROR_NOT_CONFIGURED ;
+ return CY_AS_ERROR_NOT_CONFIGURED;
if (!cy_as_device_is_firmware_loaded(dev_p))
- return CY_AS_ERROR_NO_FIRMWARE ;
+ return CY_AS_ERROR_NO_FIRMWARE;
if (dev_p->storage_count == 0)
- return CY_AS_ERROR_NOT_RUNNING ;
+ return CY_AS_ERROR_NOT_RUNNING;
if (cy_as_device_is_in_suspend_mode(dev_p))
- return CY_AS_ERROR_IN_SUSPEND ;
+ return CY_AS_ERROR_IN_SUSPEND;
- return CY_AS_ERROR_SUCCESS ;
+ return CY_AS_ERROR_SUCCESS;
}
static void
@@ -341,28 +341,28 @@ cy_as_storage_func_callback(cy_as_device *dev_p,
uint8_t context,
cy_as_ll_request_response *rqt,
cy_as_ll_request_response *resp,
- cy_as_return_status_t ret) ;
+ cy_as_return_status_t ret);
static cy_as_return_status_t
my_handle_response_no_data(cy_as_device *dev_p,
cy_as_ll_request_response *req_p,
cy_as_ll_request_response *reply_p)
{
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
if (cy_as_ll_request_response__get_code(reply_p) !=
CY_RESP_SUCCESS_FAILURE) {
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
- goto destroy ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
+ goto destroy;
}
- ret = cy_as_ll_request_response__get_word(reply_p, 0) ;
+ ret = cy_as_ll_request_response__get_word(reply_p, 0);
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
- return ret ;
+ return ret;
}
static cy_as_return_status_t
@@ -372,75 +372,75 @@ my_handle_response_storage_start(cy_as_device *dev_p,
cy_as_return_status_t ret)
{
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
if (cy_as_ll_request_response__get_code(reply_p) !=
CY_RESP_SUCCESS_FAILURE) {
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
- goto destroy ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
+ goto destroy;
}
- ret = cy_as_ll_request_response__get_word(reply_p, 0) ;
+ ret = cy_as_ll_request_response__get_word(reply_p, 0);
if (dev_p->storage_count > 0 && ret ==
CY_AS_ERROR_ALREADY_RUNNING)
- ret = CY_AS_ERROR_SUCCESS ;
+ ret = CY_AS_ERROR_SUCCESS;
ret = cy_as_dma_enable_end_point(dev_p,
- CY_AS_P2S_WRITE_ENDPOINT, cy_true, cy_as_direction_in) ;
+ CY_AS_P2S_WRITE_ENDPOINT, cy_true, cy_as_direction_in);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
ret = cy_as_dma_set_max_dma_size(dev_p,
- CY_AS_P2S_WRITE_ENDPOINT, CY_AS_STORAGE_EP_SIZE) ;
+ CY_AS_P2S_WRITE_ENDPOINT, CY_AS_STORAGE_EP_SIZE);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
ret = cy_as_dma_enable_end_point(dev_p,
- CY_AS_P2S_READ_ENDPOINT, cy_true, cy_as_direction_out) ;
+ CY_AS_P2S_READ_ENDPOINT, cy_true, cy_as_direction_out);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
ret = cy_as_dma_set_max_dma_size(dev_p,
- CY_AS_P2S_READ_ENDPOINT, CY_AS_STORAGE_EP_SIZE) ;
+ CY_AS_P2S_READ_ENDPOINT, CY_AS_STORAGE_EP_SIZE);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
cy_as_ll_register_request_callback(dev_p,
- CY_RQT_STORAGE_RQT_CONTEXT, my_storage_request_callback) ;
+ CY_RQT_STORAGE_RQT_CONTEXT, my_storage_request_callback);
/* Create the request/response used for storage reads and writes. */
dev_p->storage_rw_req_p = cy_as_ll_create_request(dev_p,
- 0, CY_RQT_STORAGE_RQT_CONTEXT, 5) ;
+ 0, CY_RQT_STORAGE_RQT_CONTEXT, 5);
if (dev_p->storage_rw_req_p == 0) {
ret = CY_AS_ERROR_OUT_OF_MEMORY;
goto destroy;
}
- dev_p->storage_rw_resp_p = cy_as_ll_create_response(dev_p, 5) ;
+ dev_p->storage_rw_resp_p = cy_as_ll_create_response(dev_p, 5);
if (dev_p->storage_rw_resp_p == 0) {
- cy_as_ll_destroy_request(dev_p, dev_p->storage_rw_req_p) ;
- ret = CY_AS_ERROR_OUT_OF_MEMORY ;
+ cy_as_ll_destroy_request(dev_p, dev_p->storage_rw_req_p);
+ ret = CY_AS_ERROR_OUT_OF_MEMORY;
}
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
/* Increment the storage count only if
* the above functionality succeeds.*/
if (ret == CY_AS_ERROR_SUCCESS) {
if (dev_p->storage_count == 0) {
cy_as_hal_mem_set(dev_p->storage_device_info,
- 0, sizeof(dev_p->storage_device_info)) ;
- dev_p->is_storage_only_mode = cy_false ;
+ 0, sizeof(dev_p->storage_device_info));
+ dev_p->is_storage_only_mode = cy_false;
}
- dev_p->storage_count++ ;
+ dev_p->storage_count++;
}
- cy_as_device_clear_s_s_s_pending(dev_p) ;
+ cy_as_device_clear_s_s_s_pending(dev_p);
- return ret ;
+ return ret;
}
cy_as_return_status_t
@@ -448,79 +448,79 @@ cy_as_storage_start(cy_as_device_handle handle,
cy_as_function_callback cb,
uint32_t client)
{
- cy_as_ll_request_response *req_p, *reply_p ;
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
- cy_as_device *dev_p = (cy_as_device *)handle ;
+ cy_as_ll_request_response *req_p, *reply_p;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
+ cy_as_device *dev_p = (cy_as_device *)handle;
if (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE))
- return CY_AS_ERROR_INVALID_HANDLE ;
+ return CY_AS_ERROR_INVALID_HANDLE;
if (!cy_as_device_is_configured(dev_p))
- return CY_AS_ERROR_NOT_CONFIGURED ;
+ return CY_AS_ERROR_NOT_CONFIGURED;
if (!cy_as_device_is_firmware_loaded(dev_p))
- return CY_AS_ERROR_NO_FIRMWARE ;
+ return CY_AS_ERROR_NO_FIRMWARE;
if (cy_as_device_is_in_suspend_mode(dev_p))
- return CY_AS_ERROR_IN_SUSPEND ;
+ return CY_AS_ERROR_IN_SUSPEND;
if (cy_as_device_is_s_s_s_pending(dev_p))
- return CY_AS_ERROR_STARTSTOP_PENDING ;
+ return CY_AS_ERROR_STARTSTOP_PENDING;
- cy_as_device_set_s_s_s_pending(dev_p) ;
+ cy_as_device_set_s_s_s_pending(dev_p);
if (dev_p->storage_count == 0) {
/* Create the request to send to the West Bridge device */
req_p = cy_as_ll_create_request(dev_p,
- CY_RQT_START_STORAGE, CY_RQT_STORAGE_RQT_CONTEXT, 1) ;
+ CY_RQT_START_STORAGE, CY_RQT_STORAGE_RQT_CONTEXT, 1);
if (req_p == 0) {
- cy_as_device_clear_s_s_s_pending(dev_p) ;
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ cy_as_device_clear_s_s_s_pending(dev_p);
+ return CY_AS_ERROR_OUT_OF_MEMORY;
}
/* Reserve space for the reply, the reply data
* will not exceed one word */
- reply_p = cy_as_ll_create_response(dev_p, 1) ;
+ reply_p = cy_as_ll_create_response(dev_p, 1);
if (reply_p == 0) {
- cy_as_device_clear_s_s_s_pending(dev_p) ;
- cy_as_ll_destroy_request(dev_p, req_p) ;
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ cy_as_device_clear_s_s_s_pending(dev_p);
+ cy_as_ll_destroy_request(dev_p, req_p);
+ return CY_AS_ERROR_OUT_OF_MEMORY;
}
if (cb == 0) {
ret = cy_as_ll_send_request_wait_reply(dev_p,
- req_p, reply_p) ;
+ req_p, reply_p);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
return my_handle_response_storage_start(dev_p,
- req_p, reply_p, ret) ;
+ req_p, reply_p, ret);
} else {
ret = cy_as_misc_send_request(dev_p, cb, client,
CY_FUNCT_CB_STOR_START, 0, dev_p->func_cbs_stor,
CY_AS_REQUEST_RESPONSE_EX, req_p, reply_p,
- cy_as_storage_func_callback) ;
+ cy_as_storage_func_callback);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
/* The request and response are freed as
* part of the FuncCallback */
- return ret ;
+ return ret;
}
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
} else {
- dev_p->storage_count++ ;
+ dev_p->storage_count++;
if (cb)
- cb(handle, ret, client, CY_FUNCT_CB_STOR_START, 0) ;
+ cb(handle, ret, client, CY_FUNCT_CB_STOR_START, 0);
}
- cy_as_device_clear_s_s_s_pending(dev_p) ;
+ cy_as_device_clear_s_s_s_pending(dev_p);
- return ret ;
+ return ret;
}
@@ -531,129 +531,129 @@ my_handle_response_storage_stop(cy_as_device *dev_p,
cy_as_return_status_t ret)
{
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
if (cy_as_ll_request_response__get_code(reply_p) !=
CY_RESP_SUCCESS_FAILURE) {
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
- goto destroy ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
+ goto destroy;
}
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
if (ret == CY_AS_ERROR_SUCCESS) {
- cy_as_ll_destroy_request(dev_p, dev_p->storage_rw_req_p) ;
- cy_as_ll_destroy_response(dev_p, dev_p->storage_rw_resp_p) ;
- dev_p->storage_count-- ;
+ cy_as_ll_destroy_request(dev_p, dev_p->storage_rw_req_p);
+ cy_as_ll_destroy_response(dev_p, dev_p->storage_rw_resp_p);
+ dev_p->storage_count--;
}
- cy_as_device_clear_s_s_s_pending(dev_p) ;
+ cy_as_device_clear_s_s_s_pending(dev_p);
- return ret ;
+ return ret;
}
cy_as_return_status_t
cy_as_storage_stop(cy_as_device_handle handle,
cy_as_function_callback cb,
uint32_t client)
{
- cy_as_ll_request_response *req_p , *reply_p ;
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
+ cy_as_ll_request_response *req_p , *reply_p;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
- cy_as_device *dev_p = (cy_as_device *)handle ;
+ cy_as_device *dev_p = (cy_as_device *)handle;
if (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE))
- return CY_AS_ERROR_INVALID_HANDLE ;
+ return CY_AS_ERROR_INVALID_HANDLE;
- ret = is_storage_active(dev_p) ;
+ ret = is_storage_active(dev_p);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
if (cy_as_device_is_storage_async_pending(dev_p))
- return CY_AS_ERROR_ASYNC_PENDING ;
+ return CY_AS_ERROR_ASYNC_PENDING;
if (cy_as_device_is_s_s_s_pending(dev_p))
- return CY_AS_ERROR_STARTSTOP_PENDING ;
+ return CY_AS_ERROR_STARTSTOP_PENDING;
- cy_as_device_set_s_s_s_pending(dev_p) ;
+ cy_as_device_set_s_s_s_pending(dev_p);
if (dev_p->storage_count == 1) {
/* Create the request to send to the West Bridge device */
req_p = cy_as_ll_create_request(dev_p,
- CY_RQT_STOP_STORAGE, CY_RQT_STORAGE_RQT_CONTEXT, 0) ;
+ CY_RQT_STOP_STORAGE, CY_RQT_STORAGE_RQT_CONTEXT, 0);
if (req_p == 0) {
- cy_as_device_clear_s_s_s_pending(dev_p) ;
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ cy_as_device_clear_s_s_s_pending(dev_p);
+ return CY_AS_ERROR_OUT_OF_MEMORY;
}
/* Reserve space for the reply, the reply data
* will not exceed one word */
- reply_p = cy_as_ll_create_response(dev_p, 1) ;
+ reply_p = cy_as_ll_create_response(dev_p, 1);
if (reply_p == 0) {
- cy_as_device_clear_s_s_s_pending(dev_p) ;
- cy_as_ll_destroy_request(dev_p, req_p) ;
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ cy_as_device_clear_s_s_s_pending(dev_p);
+ cy_as_ll_destroy_request(dev_p, req_p);
+ return CY_AS_ERROR_OUT_OF_MEMORY;
}
if (cb == 0) {
ret = cy_as_ll_send_request_wait_reply(dev_p,
- req_p, reply_p) ;
+ req_p, reply_p);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
return my_handle_response_storage_stop(dev_p,
- req_p, reply_p, ret) ;
+ req_p, reply_p, ret);
} else {
ret = cy_as_misc_send_request(dev_p, cb, client,
CY_FUNCT_CB_STOR_STOP, 0, dev_p->func_cbs_stor,
CY_AS_REQUEST_RESPONSE_EX, req_p, reply_p,
- cy_as_storage_func_callback) ;
+ cy_as_storage_func_callback);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
/* The request and response are freed
* as part of the MiscFuncCallback */
- return ret ;
+ return ret;
}
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
} else if (dev_p->storage_count > 1) {
- dev_p->storage_count-- ;
+ dev_p->storage_count--;
if (cb)
- cb(handle, ret, client, CY_FUNCT_CB_STOR_STOP, 0) ;
+ cb(handle, ret, client, CY_FUNCT_CB_STOR_STOP, 0);
}
- cy_as_device_clear_s_s_s_pending(dev_p) ;
+ cy_as_device_clear_s_s_s_pending(dev_p);
- return ret ;
+ return ret;
}
cy_as_return_status_t
cy_as_storage_register_callback(cy_as_device_handle handle,
cy_as_storage_event_callback callback)
{
- cy_as_device *dev_p = (cy_as_device *)handle ;
+ cy_as_device *dev_p = (cy_as_device *)handle;
if (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE))
- return CY_AS_ERROR_INVALID_HANDLE ;
+ return CY_AS_ERROR_INVALID_HANDLE;
if (!cy_as_device_is_configured(dev_p))
- return CY_AS_ERROR_NOT_CONFIGURED ;
+ return CY_AS_ERROR_NOT_CONFIGURED;
if (!cy_as_device_is_firmware_loaded(dev_p))
- return CY_AS_ERROR_NO_FIRMWARE ;
+ return CY_AS_ERROR_NO_FIRMWARE;
if (dev_p->storage_count == 0)
- return CY_AS_ERROR_NOT_RUNNING ;
+ return CY_AS_ERROR_NOT_RUNNING;
- dev_p->storage_event_cb = NULL ;
- dev_p->storage_event_cb_ms = callback ;
+ dev_p->storage_event_cb = NULL;
+ dev_p->storage_event_cb_ms = callback;
- return CY_AS_ERROR_SUCCESS ;
+ return CY_AS_ERROR_SUCCESS;
}
@@ -663,19 +663,19 @@ my_handle_response_storage_claim(cy_as_device *dev_p,
cy_as_ll_request_response *req_p,
cy_as_ll_request_response *reply_p)
{
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
if (cy_as_ll_request_response__get_code(reply_p) ==
CY_RESP_NO_SUCH_ADDRESS) {
ret = cy_as_map_bad_addr(
- cy_as_ll_request_response__get_word(reply_p, 3)) ;
- goto destroy ;
+ cy_as_ll_request_response__get_word(reply_p, 3));
+ goto destroy;
}
if (cy_as_ll_request_response__get_code(reply_p) !=
CY_RESP_MEDIA_CLAIMED_RELEASED) {
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
- goto destroy ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
+ goto destroy;
}
/* The response must be about the address I am
@@ -688,18 +688,18 @@ my_handle_response_storage_claim(cy_as_device *dev_p,
cy_as_ll_request_response__get_word(req_p, 0)) !=
cy_as_storage_get_device_from_address(
cy_as_ll_request_response__get_word(reply_p, 0)))) {
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
- goto destroy ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
+ goto destroy;
}
if (cy_as_ll_request_response__get_word(reply_p, 1) != 1)
- ret = CY_AS_ERROR_NOT_ACQUIRED ;
+ ret = CY_AS_ERROR_NOT_ACQUIRED;
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
- return ret ;
+ return ret;
}
static cy_as_return_status_t
@@ -711,61 +711,61 @@ my_storage_claim(cy_as_device *dev_p,
cy_as_function_callback cb,
uint32_t client)
{
- cy_as_ll_request_response *req_p , *reply_p ;
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
+ cy_as_ll_request_response *req_p , *reply_p;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
if (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE))
- return CY_AS_ERROR_INVALID_HANDLE ;
+ return CY_AS_ERROR_INVALID_HANDLE;
- ret = is_storage_active(dev_p) ;
+ ret = is_storage_active(dev_p);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
if (dev_p->mtp_count > 0)
- return CY_AS_ERROR_NOT_VALID_IN_MTP ;
+ return CY_AS_ERROR_NOT_VALID_IN_MTP;
/* Create the request to send to the West Bridge device */
req_p = cy_as_ll_create_request(dev_p,
- CY_RQT_CLAIM_STORAGE, CY_RQT_STORAGE_RQT_CONTEXT, 1) ;
+ CY_RQT_CLAIM_STORAGE, CY_RQT_STORAGE_RQT_CONTEXT, 1);
if (req_p == 0)
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ return CY_AS_ERROR_OUT_OF_MEMORY;
cy_as_ll_request_response__set_word(req_p,
- 0, create_address(bus, device, 0)) ;
+ 0, create_address(bus, device, 0));
/* Reserve space for the reply, the reply data will
* not exceed one word */
- reply_p = cy_as_ll_create_response(dev_p, 4) ;
+ reply_p = cy_as_ll_create_response(dev_p, 4);
if (reply_p == 0) {
- cy_as_ll_destroy_request(dev_p, req_p) ;
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ return CY_AS_ERROR_OUT_OF_MEMORY;
}
if (cb == 0) {
- ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p) ;
+ ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
- return my_handle_response_storage_claim(dev_p, req_p, reply_p) ;
+ return my_handle_response_storage_claim(dev_p, req_p, reply_p);
} else {
ret = cy_as_misc_send_request(dev_p, cb, client,
CY_FUNCT_CB_STOR_CLAIM, data, dev_p->func_cbs_stor,
req_flags, req_p, reply_p,
- cy_as_storage_func_callback) ;
+ cy_as_storage_func_callback);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
/* The request and response are freed as part of
* the MiscFuncCallback */
- return ret ;
+ return ret;
}
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
- return ret ;
+ return ret;
}
cy_as_return_status_t
@@ -775,13 +775,13 @@ cy_as_storage_claim(cy_as_device_handle handle,
cy_as_function_callback cb,
uint32_t client)
{
- cy_as_device *dev_p = (cy_as_device *)handle ;
+ cy_as_device *dev_p = (cy_as_device *)handle;
if (bus < 0 || bus >= CY_AS_MAX_BUSES)
- return CY_AS_ERROR_NO_SUCH_BUS ;
+ return CY_AS_ERROR_NO_SUCH_BUS;
return my_storage_claim(dev_p, NULL, bus, device,
- CY_AS_REQUEST_RESPONSE_MS, cb, client) ;
+ CY_AS_REQUEST_RESPONSE_MS, cb, client);
}
static cy_as_return_status_t
@@ -789,19 +789,19 @@ my_handle_response_storage_release(cy_as_device *dev_p,
cy_as_ll_request_response *req_p,
cy_as_ll_request_response *reply_p)
{
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
if (cy_as_ll_request_response__get_code(reply_p) ==
CY_RESP_NO_SUCH_ADDRESS) {
ret = cy_as_map_bad_addr(
- cy_as_ll_request_response__get_word(reply_p, 3)) ;
- goto destroy ;
+ cy_as_ll_request_response__get_word(reply_p, 3));
+ goto destroy;
}
if (cy_as_ll_request_response__get_code(reply_p) !=
CY_RESP_MEDIA_CLAIMED_RELEASED) {
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
- goto destroy ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
+ goto destroy;
}
/* The response must be about the address I am
@@ -814,19 +814,19 @@ my_handle_response_storage_release(cy_as_device *dev_p,
cy_as_ll_request_response__get_word(req_p, 0)) !=
cy_as_storage_get_device_from_address(
cy_as_ll_request_response__get_word(reply_p, 0)))) {
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
- goto destroy ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
+ goto destroy;
}
if (cy_as_ll_request_response__get_word(reply_p, 1) != 0)
- ret = CY_AS_ERROR_NOT_RELEASED ;
+ ret = CY_AS_ERROR_NOT_RELEASED;
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
- return ret ;
+ return ret;
}
static cy_as_return_status_t
@@ -838,62 +838,62 @@ my_storage_release(cy_as_device *dev_p,
cy_as_function_callback cb,
uint32_t client)
{
- cy_as_ll_request_response *req_p , *reply_p ;
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
+ cy_as_ll_request_response *req_p , *reply_p;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
if (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE))
- return CY_AS_ERROR_INVALID_HANDLE ;
+ return CY_AS_ERROR_INVALID_HANDLE;
- ret = is_storage_active(dev_p) ;
+ ret = is_storage_active(dev_p);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
if (dev_p->mtp_count > 0)
- return CY_AS_ERROR_NOT_VALID_IN_MTP ;
+ return CY_AS_ERROR_NOT_VALID_IN_MTP;
/* Create the request to send to the West Bridge device */
req_p = cy_as_ll_create_request(dev_p, CY_RQT_RELEASE_STORAGE,
- CY_RQT_STORAGE_RQT_CONTEXT, 1) ;
+ CY_RQT_STORAGE_RQT_CONTEXT, 1);
if (req_p == 0)
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ return CY_AS_ERROR_OUT_OF_MEMORY;
cy_as_ll_request_response__set_word(
- req_p, 0, create_address(bus, device, 0)) ;
+ req_p, 0, create_address(bus, device, 0));
/* Reserve space for the reply, the reply
* data will not exceed one word */
- reply_p = cy_as_ll_create_response(dev_p, 4) ;
+ reply_p = cy_as_ll_create_response(dev_p, 4);
if (reply_p == 0) {
- cy_as_ll_destroy_request(dev_p, req_p) ;
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ return CY_AS_ERROR_OUT_OF_MEMORY;
}
if (cb == 0) {
- ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p) ;
+ ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
return my_handle_response_storage_release(
- dev_p, req_p, reply_p) ;
+ dev_p, req_p, reply_p);
} else {
ret = cy_as_misc_send_request(dev_p, cb, client,
CY_FUNCT_CB_STOR_RELEASE, data, dev_p->func_cbs_stor,
req_flags, req_p, reply_p,
- cy_as_storage_func_callback) ;
+ cy_as_storage_func_callback);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
/* The request and response are freed as
* part of the MiscFuncCallback */
- return ret ;
+ return ret;
}
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
- return ret ;
+ return ret;
}
cy_as_return_status_t
@@ -903,13 +903,13 @@ cy_as_storage_release(cy_as_device_handle handle,
cy_as_function_callback cb,
uint32_t client)
{
- cy_as_device *dev_p = (cy_as_device *)handle ;
+ cy_as_device *dev_p = (cy_as_device *)handle;
if (bus < 0 || bus >= CY_AS_MAX_BUSES)
- return CY_AS_ERROR_NO_SUCH_BUS ;
+ return CY_AS_ERROR_NO_SUCH_BUS;
return my_storage_release(dev_p, NULL, bus, device,
- CY_AS_REQUEST_RESPONSE_MS, cb, client) ;
+ CY_AS_REQUEST_RESPONSE_MS, cb, client);
}
static cy_as_return_status_t
@@ -918,18 +918,18 @@ my_handle_response_storage_query_bus(cy_as_device *dev_p,
cy_as_ll_request_response *reply_p,
uint32_t *count)
{
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
- uint8_t code = cy_as_ll_request_response__get_code(reply_p) ;
- uint16_t v ;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
+ uint8_t code = cy_as_ll_request_response__get_code(reply_p);
+ uint16_t v;
if (code == CY_RESP_NO_SUCH_ADDRESS) {
- ret = CY_AS_ERROR_NO_SUCH_BUS ;
- goto destroy ;
+ ret = CY_AS_ERROR_NO_SUCH_BUS;
+ goto destroy;
}
if (code != CY_RESP_BUS_DESCRIPTOR) {
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
- goto destroy ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
+ goto destroy;
}
/*
@@ -939,20 +939,20 @@ my_handle_response_storage_query_bus(cy_as_device *dev_p,
cy_as_ll_request_response__get_word(req_p, 0)) !=
cy_as_storage_get_bus_from_address(
cy_as_ll_request_response__get_word(reply_p, 0))) {
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
- goto destroy ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
+ goto destroy;
}
- v = cy_as_ll_request_response__get_word(reply_p, 1) ;
+ v = cy_as_ll_request_response__get_word(reply_p, 1);
if (req_p->flags & CY_AS_REQUEST_RESPONSE_MS) {
/*
* this request is only for the count of devices
* on the bus. there is no need to check the media type.
*/
if (v)
- *count = 1 ;
+ *count = 1;
else
- *count = 0 ;
+ *count = 0;
} else {
/*
* this request is for the count of devices of a
@@ -960,21 +960,21 @@ my_handle_response_storage_query_bus(cy_as_device *dev_p,
* type found matches the queried type.
*/
cy_as_media_type queried = (cy_as_media_type)
- cy_as_ll_request_response__get_word(req_p, 1) ;
+ cy_as_ll_request_response__get_word(req_p, 1);
cy_as_media_type found =
cy_as_storage_get_media_from_address(v);
if (queried == found)
- *count = 1 ;
+ *count = 1;
else
- *count = 0 ;
+ *count = 0;
}
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
- return ret ;
+ return ret;
}
cy_as_return_status_t
@@ -986,65 +986,65 @@ my_storage_query_bus(cy_as_device *dev_p,
cy_as_function_callback cb,
uint32_t client)
{
- cy_as_return_status_t ret ;
- cy_as_ll_request_response *req_p, *reply_p ;
- cy_as_funct_c_b_type cb_type = CY_FUNCT_CB_STOR_QUERYBUS ;
+ cy_as_return_status_t ret;
+ cy_as_ll_request_response *req_p, *reply_p;
+ cy_as_funct_c_b_type cb_type = CY_FUNCT_CB_STOR_QUERYBUS;
if (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE))
- return CY_AS_ERROR_INVALID_HANDLE ;
+ return CY_AS_ERROR_INVALID_HANDLE;
- ret = is_storage_active(dev_p) ;
+ ret = is_storage_active(dev_p);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
/* Create the request to send to the Antioch device */
req_p = cy_as_ll_create_request(dev_p,
- CY_RQT_QUERY_BUS, CY_RQT_STORAGE_RQT_CONTEXT, 2) ;
+ CY_RQT_QUERY_BUS, CY_RQT_STORAGE_RQT_CONTEXT, 2);
if (req_p == 0)
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ return CY_AS_ERROR_OUT_OF_MEMORY;
cy_as_ll_request_response__set_word(req_p,
- 0, create_address(bus, 0, 0)) ;
- cy_as_ll_request_response__set_word(req_p, 1, (uint16_t)type) ;
+ 0, create_address(bus, 0, 0));
+ cy_as_ll_request_response__set_word(req_p, 1, (uint16_t)type);
/* Reserve space for the reply, the reply data
* will not exceed two words. */
- reply_p = cy_as_ll_create_response(dev_p, 2) ;
+ reply_p = cy_as_ll_create_response(dev_p, 2);
if (reply_p == 0) {
- cy_as_ll_destroy_request(dev_p, req_p) ;
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ return CY_AS_ERROR_OUT_OF_MEMORY;
}
if (cb == 0) {
ret = cy_as_ll_send_request_wait_reply(dev_p,
- req_p, reply_p) ;
+ req_p, reply_p);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
req_p->flags |= req_flags;
return my_handle_response_storage_query_bus(dev_p,
- req_p, reply_p, count) ;
+ req_p, reply_p, count);
} else {
if (req_flags == CY_AS_REQUEST_RESPONSE_EX)
- cb_type = CY_FUNCT_CB_STOR_QUERYMEDIA ;
+ cb_type = CY_FUNCT_CB_STOR_QUERYMEDIA;
ret = cy_as_misc_send_request(dev_p, cb, client, cb_type,
count, dev_p->func_cbs_stor, req_flags,
- req_p, reply_p, cy_as_storage_func_callback) ;
+ req_p, reply_p, cy_as_storage_func_callback);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
/* The request and response are freed as part of
* the MiscFuncCallback */
- return ret ;
+ return ret;
}
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
- return ret ;
+ return ret;
}
cy_as_return_status_t
@@ -1054,10 +1054,10 @@ cy_as_storage_query_bus(cy_as_device_handle handle,
cy_as_function_callback cb,
uint32_t client)
{
- cy_as_device *dev_p = (cy_as_device *)handle ;
+ cy_as_device *dev_p = (cy_as_device *)handle;
return my_storage_query_bus(dev_p, bus, cy_as_media_max_media_value,
- CY_AS_REQUEST_RESPONSE_MS, count, cb, client) ;
+ CY_AS_REQUEST_RESPONSE_MS, count, cb, client);
}
cy_as_return_status_t
@@ -1067,24 +1067,24 @@ cy_as_storage_query_media(cy_as_device_handle handle,
cy_as_function_callback cb,
uint32_t client)
{
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
- cy_as_bus_number_t bus ;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
+ cy_as_bus_number_t bus;
- cy_as_device *dev_p = (cy_as_device *)handle ;
+ cy_as_device *dev_p = (cy_as_device *)handle;
if (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE))
- return CY_AS_ERROR_INVALID_HANDLE ;
+ return CY_AS_ERROR_INVALID_HANDLE;
- ret = is_storage_active(dev_p) ;
+ ret = is_storage_active(dev_p);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
- ret = cy_an_map_bus_from_media_type(dev_p, type, &bus) ;
+ ret = cy_an_map_bus_from_media_type(dev_p, type, &bus);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
return my_storage_query_bus(dev_p, bus, type, CY_AS_REQUEST_RESPONSE_EX,
- count, cb, client) ;
+ count, cb, client);
}
static cy_as_return_status_t
@@ -1093,94 +1093,94 @@ my_handle_response_storage_query_device(cy_as_device *dev_p,
cy_as_ll_request_response *reply_p,
void *data_p)
{
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
- uint16_t v ;
- cy_as_bus_number_t bus ;
- cy_as_media_type type ;
- uint32_t device ;
- cy_bool removable ;
- cy_bool writeable ;
- cy_bool locked ;
- uint16_t block_size ;
- uint32_t number_units ;
- uint32_t number_eus ;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
+ uint16_t v;
+ cy_as_bus_number_t bus;
+ cy_as_media_type type;
+ uint32_t device;
+ cy_bool removable;
+ cy_bool writeable;
+ cy_bool locked;
+ uint16_t block_size;
+ uint32_t number_units;
+ uint32_t number_eus;
if (cy_as_ll_request_response__get_code(reply_p)
== CY_RESP_NO_SUCH_ADDRESS) {
ret = cy_as_map_bad_addr(
- cy_as_ll_request_response__get_word(reply_p, 3)) ;
- goto destroy ;
+ cy_as_ll_request_response__get_word(reply_p, 3));
+ goto destroy;
}
if (cy_as_ll_request_response__get_code(reply_p) !=
CY_RESP_DEVICE_DESCRIPTOR) {
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
- goto destroy ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
+ goto destroy;
}
/* Unpack the response */
- v = cy_as_ll_request_response__get_word(reply_p, 0) ;
- type = cy_as_storage_get_media_from_address(v) ;
- bus = cy_as_storage_get_bus_from_address(v) ;
- device = cy_as_storage_get_device_from_address(v) ;
+ v = cy_as_ll_request_response__get_word(reply_p, 0);
+ type = cy_as_storage_get_media_from_address(v);
+ bus = cy_as_storage_get_bus_from_address(v);
+ device = cy_as_storage_get_device_from_address(v);
- block_size = cy_as_ll_request_response__get_word(reply_p, 1) ;
+ block_size = cy_as_ll_request_response__get_word(reply_p, 1);
- v = cy_as_ll_request_response__get_word(reply_p, 2) ;
- removable = (v & 0x8000) ? cy_true : cy_false ;
- writeable = (v & 0x0100) ? cy_true : cy_false ;
- locked = (v & 0x0200) ? cy_true : cy_false ;
- number_units = (v & 0xff) ;
+ v = cy_as_ll_request_response__get_word(reply_p, 2);
+ removable = (v & 0x8000) ? cy_true : cy_false;
+ writeable = (v & 0x0100) ? cy_true : cy_false;
+ locked = (v & 0x0200) ? cy_true : cy_false;
+ number_units = (v & 0xff);
number_eus = (cy_as_ll_request_response__get_word(reply_p, 3) << 16)
- | cy_as_ll_request_response__get_word(reply_p, 4) ;
+ | cy_as_ll_request_response__get_word(reply_p, 4);
/* Store the results based on the version of originating function */
if (req_p->flags & CY_AS_REQUEST_RESPONSE_MS) {
cy_as_storage_query_device_data *store_p =
- (cy_as_storage_query_device_data *)data_p ;
+ (cy_as_storage_query_device_data *)data_p;
/* Make sure the response is about the address we asked
* about - if not, firmware error */
if ((bus != store_p->bus) || (device != store_p->device)) {
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
- goto destroy ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
+ goto destroy;
}
- store_p->desc_p.type = type ;
- store_p->desc_p.removable = removable ;
- store_p->desc_p.writeable = writeable ;
- store_p->desc_p.block_size = block_size ;
- store_p->desc_p.number_units = number_units ;
- store_p->desc_p.locked = locked ;
- store_p->desc_p.erase_unit_size = number_eus ;
- dev_p->storage_device_info[bus][device] = store_p->desc_p ;
+ store_p->desc_p.type = type;
+ store_p->desc_p.removable = removable;
+ store_p->desc_p.writeable = writeable;
+ store_p->desc_p.block_size = block_size;
+ store_p->desc_p.number_units = number_units;
+ store_p->desc_p.locked = locked;
+ store_p->desc_p.erase_unit_size = number_eus;
+ dev_p->storage_device_info[bus][device] = store_p->desc_p;
} else {
cy_as_storage_query_device_data_dep *store_p =
- (cy_as_storage_query_device_data_dep *)data_p ;
+ (cy_as_storage_query_device_data_dep *)data_p;
/* Make sure the response is about the address we asked
* about - if not, firmware error */
if ((type != store_p->type) || (device != store_p->device)) {
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
- goto destroy ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
+ goto destroy;
}
- store_p->desc_p.type = type ;
- store_p->desc_p.removable = removable ;
- store_p->desc_p.writeable = writeable ;
- store_p->desc_p.block_size = block_size ;
- store_p->desc_p.number_units = number_units ;
- store_p->desc_p.locked = locked ;
- store_p->desc_p.erase_unit_size = number_eus ;
- dev_p->storage_device_info[bus][device] = store_p->desc_p ;
+ store_p->desc_p.type = type;
+ store_p->desc_p.removable = removable;
+ store_p->desc_p.writeable = writeable;
+ store_p->desc_p.block_size = block_size;
+ store_p->desc_p.number_units = number_units;
+ store_p->desc_p.locked = locked;
+ store_p->desc_p.erase_unit_size = number_eus;
+ dev_p->storage_device_info[bus][device] = store_p->desc_p;
}
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
- return ret ;
+ return ret;
}
static cy_as_return_status_t
@@ -1192,61 +1192,61 @@ my_storage_query_device(cy_as_device *dev_p,
cy_as_function_callback cb,
uint32_t client)
{
- cy_as_ll_request_response *req_p , *reply_p ;
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
+ cy_as_ll_request_response *req_p , *reply_p;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
if (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE))
- return CY_AS_ERROR_INVALID_HANDLE ;
+ return CY_AS_ERROR_INVALID_HANDLE;
- ret = is_storage_active(dev_p) ;
+ ret = is_storage_active(dev_p);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
/* Create the request to send to the Antioch device */
req_p = cy_as_ll_create_request(dev_p,
- CY_RQT_QUERY_DEVICE, CY_RQT_STORAGE_RQT_CONTEXT, 1) ;
+ CY_RQT_QUERY_DEVICE, CY_RQT_STORAGE_RQT_CONTEXT, 1);
if (req_p == 0)
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ return CY_AS_ERROR_OUT_OF_MEMORY;
cy_as_ll_request_response__set_word(req_p, 0,
- create_address(bus, device, 0)) ;
+ create_address(bus, device, 0));
/* Reserve space for the reply, the reply data
* will not exceed five words. */
- reply_p = cy_as_ll_create_response(dev_p, 5) ;
+ reply_p = cy_as_ll_create_response(dev_p, 5);
if (reply_p == 0) {
- cy_as_ll_destroy_request(dev_p, req_p) ;
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ return CY_AS_ERROR_OUT_OF_MEMORY;
}
if (cb == 0) {
- ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p) ;
+ ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
req_p->flags |= req_flags;
return my_handle_response_storage_query_device(dev_p,
- req_p, reply_p, data_p) ;
+ req_p, reply_p, data_p);
} else {
ret = cy_as_misc_send_request(dev_p, cb, client,
CY_FUNCT_CB_STOR_QUERYDEVICE, data_p,
dev_p->func_cbs_stor, req_flags, req_p,
- reply_p, cy_as_storage_func_callback) ;
+ reply_p, cy_as_storage_func_callback);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
/* The request and response are freed as part of the
* MiscFuncCallback */
- return ret ;
+ return ret;
}
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
- return ret ;
+ return ret;
}
cy_as_return_status_t
@@ -1255,10 +1255,10 @@ cy_as_storage_query_device(cy_as_device_handle handle,
cy_as_function_callback cb,
uint32_t client)
{
- cy_as_device *dev_p = (cy_as_device *)handle ;
+ cy_as_device *dev_p = (cy_as_device *)handle;
return my_storage_query_device(dev_p, data_p,
CY_AS_REQUEST_RESPONSE_MS, data_p->bus,
- data_p->device, cb, client) ;
+ data_p->device, cb, client);
}
static cy_as_return_status_t
@@ -1267,88 +1267,88 @@ my_handle_response_storage_query_unit(cy_as_device *dev_p,
cy_as_ll_request_response *reply_p,
void *data_p)
{
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
- cy_as_bus_number_t bus ;
- uint32_t device ;
- uint32_t unit ;
- cy_as_media_type type ;
- uint16_t block_size ;
- uint32_t start_block ;
- uint32_t unit_size ;
- uint16_t v ;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
+ cy_as_bus_number_t bus;
+ uint32_t device;
+ uint32_t unit;
+ cy_as_media_type type;
+ uint16_t block_size;
+ uint32_t start_block;
+ uint32_t unit_size;
+ uint16_t v;
if (cy_as_ll_request_response__get_code(reply_p) ==
CY_RESP_NO_SUCH_ADDRESS) {
ret = cy_as_map_bad_addr(
- cy_as_ll_request_response__get_word(reply_p, 3)) ;
- goto destroy ;
+ cy_as_ll_request_response__get_word(reply_p, 3));
+ goto destroy;
}
if (cy_as_ll_request_response__get_code(reply_p) !=
CY_RESP_UNIT_DESCRIPTOR) {
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
- goto destroy ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
+ goto destroy;
}
/* Unpack the response */
- v = cy_as_ll_request_response__get_word(reply_p, 0) ;
- bus = cy_as_storage_get_bus_from_address(v) ;
- device = cy_as_storage_get_device_from_address(v) ;
- unit = get_unit_from_address(v) ;
+ v = cy_as_ll_request_response__get_word(reply_p, 0);
+ bus = cy_as_storage_get_bus_from_address(v);
+ device = cy_as_storage_get_device_from_address(v);
+ unit = get_unit_from_address(v);
type = cy_as_storage_get_media_from_address(
cy_as_ll_request_response__get_word(reply_p, 1));
- block_size = cy_as_ll_request_response__get_word(reply_p, 2) ;
+ block_size = cy_as_ll_request_response__get_word(reply_p, 2);
start_block = cy_as_ll_request_response__get_word(reply_p, 3)
- | (cy_as_ll_request_response__get_word(reply_p, 4) << 16) ;
+ | (cy_as_ll_request_response__get_word(reply_p, 4) << 16);
unit_size = cy_as_ll_request_response__get_word(reply_p, 5)
- | (cy_as_ll_request_response__get_word(reply_p, 6) << 16) ;
+ | (cy_as_ll_request_response__get_word(reply_p, 6) << 16);
/* Store the results based on the version of
* originating function */
if (req_p->flags & CY_AS_REQUEST_RESPONSE_MS) {
cy_as_storage_query_unit_data *store_p =
- (cy_as_storage_query_unit_data *)data_p ;
+ (cy_as_storage_query_unit_data *)data_p;
/* Make sure the response is about the address we
* asked about - if not, firmware error */
if (bus != store_p->bus || device != store_p->device ||
unit != store_p->unit) {
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
- goto destroy ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
+ goto destroy;
}
- store_p->desc_p.type = type ;
- store_p->desc_p.block_size = block_size ;
- store_p->desc_p.start_block = start_block ;
- store_p->desc_p.unit_size = unit_size ;
+ store_p->desc_p.type = type;
+ store_p->desc_p.block_size = block_size;
+ store_p->desc_p.start_block = start_block;
+ store_p->desc_p.unit_size = unit_size;
} else {
cy_as_storage_query_unit_data_dep *store_p =
- (cy_as_storage_query_unit_data_dep *)data_p ;
+ (cy_as_storage_query_unit_data_dep *)data_p;
/* Make sure the response is about the media type we asked
* about - if not, firmware error */
if ((type != store_p->type) || (device != store_p->device) ||
(unit != store_p->unit)) {
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
- goto destroy ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
+ goto destroy;
}
- store_p->desc_p.type = type ;
- store_p->desc_p.block_size = block_size ;
- store_p->desc_p.start_block = start_block ;
- store_p->desc_p.unit_size = unit_size ;
+ store_p->desc_p.type = type;
+ store_p->desc_p.block_size = block_size;
+ store_p->desc_p.start_block = start_block;
+ store_p->desc_p.unit_size = unit_size;
}
- dev_p->storage_device_info[bus][device].type = type ;
- dev_p->storage_device_info[bus][device].block_size = block_size ;
+ dev_p->storage_device_info[bus][device].type = type;
+ dev_p->storage_device_info[bus][device].block_size = block_size;
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
- return ret ;
+ return ret;
}
static cy_as_return_status_t
@@ -1361,67 +1361,67 @@ my_storage_query_unit(cy_as_device *dev_p,
cy_as_function_callback cb,
uint32_t client)
{
- cy_as_ll_request_response *req_p , *reply_p ;
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
+ cy_as_ll_request_response *req_p , *reply_p;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
if (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE))
- return CY_AS_ERROR_INVALID_HANDLE ;
+ return CY_AS_ERROR_INVALID_HANDLE;
- ret = is_storage_active(dev_p) ;
+ ret = is_storage_active(dev_p);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
/* Create the request to send to the West Bridge device */
req_p = cy_as_ll_create_request(dev_p,
- CY_RQT_QUERY_UNIT, CY_RQT_STORAGE_RQT_CONTEXT, 1) ;
+ CY_RQT_QUERY_UNIT, CY_RQT_STORAGE_RQT_CONTEXT, 1);
if (req_p == 0)
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ return CY_AS_ERROR_OUT_OF_MEMORY;
if (device > 255)
- return CY_AS_ERROR_NO_SUCH_DEVICE ;
+ return CY_AS_ERROR_NO_SUCH_DEVICE;
if (unit > 255)
- return CY_AS_ERROR_NO_SUCH_UNIT ;
+ return CY_AS_ERROR_NO_SUCH_UNIT;
cy_as_ll_request_response__set_word(req_p, 0,
- create_address(bus, device, (uint8_t)unit)) ;
+ create_address(bus, device, (uint8_t)unit));
/* Reserve space for the reply, the reply data
* will be of seven words. */
- reply_p = cy_as_ll_create_response(dev_p, 7) ;
+ reply_p = cy_as_ll_create_response(dev_p, 7);
if (reply_p == 0) {
- cy_as_ll_destroy_request(dev_p, req_p) ;
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ return CY_AS_ERROR_OUT_OF_MEMORY;
}
if (cb == 0) {
- ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p) ;
+ ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
- req_p->flags |= req_flags ;
+ req_p->flags |= req_flags;
return my_handle_response_storage_query_unit(dev_p,
- req_p, reply_p, data_p) ;
+ req_p, reply_p, data_p);
} else {
ret = cy_as_misc_send_request(dev_p, cb, client,
CY_FUNCT_CB_STOR_QUERYUNIT, data_p,
dev_p->func_cbs_stor, req_flags, req_p, reply_p,
- cy_as_storage_func_callback) ;
+ cy_as_storage_func_callback);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
/* The request and response are freed
* as part of the MiscFuncCallback */
- return ret ;
+ return ret;
}
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
- return ret ;
+ return ret;
}
cy_as_return_status_t
@@ -1430,9 +1430,9 @@ cy_as_storage_query_unit(cy_as_device_handle handle,
cy_as_function_callback cb,
uint32_t client)
{
- cy_as_device *dev_p = (cy_as_device *)handle ;
+ cy_as_device *dev_p = (cy_as_device *)handle;
return my_storage_query_unit(dev_p, data_p, CY_AS_REQUEST_RESPONSE_MS,
- data_p->bus, data_p->device, data_p->unit, cb, client) ;
+ data_p->bus, data_p->device, data_p->unit, cb, client);
}
@@ -1442,39 +1442,39 @@ cy_as_get_block_size(cy_as_device *dev_p,
uint32_t device,
cy_as_function_callback cb)
{
- cy_as_ll_request_response *req_p , *reply_p ;
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
+ cy_as_ll_request_response *req_p , *reply_p;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
/* Create the request to send to the West Bridge device */
req_p = cy_as_ll_create_request(dev_p, CY_RQT_QUERY_DEVICE,
- CY_RQT_STORAGE_RQT_CONTEXT, 1) ;
+ CY_RQT_STORAGE_RQT_CONTEXT, 1);
if (req_p == 0)
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ return CY_AS_ERROR_OUT_OF_MEMORY;
cy_as_ll_request_response__set_word(req_p, 0,
- create_address(bus, device, 0)) ;
+ create_address(bus, device, 0));
- reply_p = cy_as_ll_create_response(dev_p, 4) ;
+ reply_p = cy_as_ll_create_response(dev_p, 4);
if (reply_p == 0) {
- cy_as_ll_destroy_request(dev_p, req_p) ;
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ return CY_AS_ERROR_OUT_OF_MEMORY;
}
if (cb == 0) {
- ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p) ;
+ ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
if (cy_as_ll_request_response__get_code(reply_p)
== CY_RESP_NO_SUCH_ADDRESS) {
- ret = CY_AS_ERROR_NO_SUCH_BUS ;
- goto destroy ;
+ ret = CY_AS_ERROR_NO_SUCH_BUS;
+ goto destroy;
}
if (cy_as_ll_request_response__get_code(reply_p) !=
CY_RESP_DEVICE_DESCRIPTOR) {
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
- goto destroy ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
+ goto destroy;
}
/* Make sure the response is about the media type we asked
@@ -1484,21 +1484,21 @@ cy_as_get_block_size(cy_as_device *dev_p,
!= bus) || (cy_as_storage_get_device_from_address
(cy_as_ll_request_response__get_word(reply_p, 0))
!= device)) {
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
- goto destroy ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
+ goto destroy;
}
dev_p->storage_device_info[bus][device].block_size =
- cy_as_ll_request_response__get_word(reply_p, 1) ;
+ cy_as_ll_request_response__get_word(reply_p, 1);
} else
- ret = CY_AS_ERROR_INVALID_REQUEST ;
+ ret = CY_AS_ERROR_INVALID_REQUEST;
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
- return ret ;
+ return ret;
}
cy_as_return_status_t
@@ -1512,29 +1512,29 @@ my_storage_device_control(
cy_as_function_callback cb,
uint32_t client)
{
- cy_as_ll_request_response *req_p , *reply_p ;
- cy_as_return_status_t ret ;
- cy_bool use_gpio = cy_false ;
+ cy_as_ll_request_response *req_p , *reply_p;
+ cy_as_return_status_t ret;
+ cy_bool use_gpio = cy_false;
- (void)device ;
+ (void)device;
if (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE))
- return CY_AS_ERROR_INVALID_HANDLE ;
+ return CY_AS_ERROR_INVALID_HANDLE;
if (!cy_as_device_is_configured(dev_p))
- return CY_AS_ERROR_NOT_CONFIGURED ;
+ return CY_AS_ERROR_NOT_CONFIGURED;
if (!cy_as_device_is_firmware_loaded(dev_p))
- return CY_AS_ERROR_NO_FIRMWARE ;
+ return CY_AS_ERROR_NO_FIRMWARE;
if (cy_as_device_is_in_suspend_mode(dev_p))
- return CY_AS_ERROR_IN_SUSPEND ;
+ return CY_AS_ERROR_IN_SUSPEND;
if (bus < 0 || bus >= CY_AS_MAX_BUSES)
- return CY_AS_ERROR_NO_SUCH_BUS ;
+ return CY_AS_ERROR_NO_SUCH_BUS;
if (device >= CY_AS_MAX_STORAGE_DEVICES)
- return CY_AS_ERROR_NO_SUCH_DEVICE ;
+ return CY_AS_ERROR_NO_SUCH_DEVICE;
/* If SD is not supported on the specified bus,
* then return ERROR */
@@ -1543,61 +1543,61 @@ my_storage_device_control(
return CY_AS_ERROR_NOT_SUPPORTED;
if (config_detect == cy_as_storage_detect_GPIO)
- use_gpio = cy_true ;
+ use_gpio = cy_true;
else if (config_detect == cy_as_storage_detect_SDAT_3)
- use_gpio = cy_false ;
+ use_gpio = cy_false;
else
- return CY_AS_ERROR_INVALID_PARAMETER ;
+ return CY_AS_ERROR_INVALID_PARAMETER;
/* Create the request to send to the West Bridge device */
req_p = cy_as_ll_create_request(dev_p,
- CY_RQT_SD_INTERFACE_CONTROL, CY_RQT_STORAGE_RQT_CONTEXT, 2) ;
+ CY_RQT_SD_INTERFACE_CONTROL, CY_RQT_STORAGE_RQT_CONTEXT, 2);
if (req_p == 0)
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ return CY_AS_ERROR_OUT_OF_MEMORY;
cy_as_ll_request_response__set_word(req_p,
- 0, create_address(bus, device, 0)) ;
+ 0, create_address(bus, device, 0));
cy_as_ll_request_response__set_word(req_p,
1, (((uint16_t)card_detect_en << 8) |
- ((uint16_t)use_gpio << 1) | (uint16_t)write_prot_en)) ;
+ ((uint16_t)use_gpio << 1) | (uint16_t)write_prot_en));
- reply_p = cy_as_ll_create_response(dev_p, 1) ;
+ reply_p = cy_as_ll_create_response(dev_p, 1);
if (reply_p == 0) {
- cy_as_ll_destroy_request(dev_p, req_p) ;
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ return CY_AS_ERROR_OUT_OF_MEMORY;
}
if (cb == 0) {
- ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p) ;
+ ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
if (cy_as_ll_request_response__get_code(reply_p) !=
CY_RESP_SUCCESS_FAILURE) {
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
- goto destroy ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
+ goto destroy;
}
- ret = cy_as_ll_request_response__get_word(reply_p, 0) ;
+ ret = cy_as_ll_request_response__get_word(reply_p, 0);
} else {
ret = cy_as_misc_send_request(dev_p, cb, client,
CY_FUNCT_CB_STOR_DEVICECONTROL,
0, dev_p->func_cbs_stor, CY_AS_REQUEST_RESPONSE_EX,
- req_p, reply_p, cy_as_storage_func_callback) ;
+ req_p, reply_p, cy_as_storage_func_callback);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
/* The request and response are freed as part of the
* MiscFuncCallback */
- return ret ;
+ return ret;
}
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
- return ret ;
+ return ret;
}
cy_as_return_status_t
@@ -1610,7 +1610,7 @@ cy_as_storage_device_control(cy_as_device_handle handle,
cy_as_function_callback cb,
uint32_t client)
{
- cy_as_device *dev_p = (cy_as_device *)handle ;
+ cy_as_device *dev_p = (cy_as_device *)handle;
return my_storage_device_control(dev_p, bus, device, card_detect_en,
write_prot_en, config_detect, cb, client);
@@ -1621,14 +1621,14 @@ cy_as_async_storage_callback(cy_as_device *dev_p,
cy_as_end_point_number_t ep, void *buf_p, uint32_t size,
cy_as_return_status_t ret)
{
- cy_as_storage_callback_dep cb ;
- cy_as_storage_callback cb_ms ;
+ cy_as_storage_callback_dep cb;
+ cy_as_storage_callback cb_ms;
- (void)size ;
- (void)buf_p ;
- (void)ep ;
+ (void)size;
+ (void)buf_p;
+ (void)ep;
- cy_as_device_clear_storage_async_pending(dev_p) ;
+ cy_as_device_clear_storage_async_pending(dev_p);
/*
* if the LL request callback has already been called,
@@ -1636,15 +1636,15 @@ cy_as_async_storage_callback(cy_as_device *dev_p,
*/
if (!dev_p->storage_wait) {
cy_as_hal_assert(dev_p->storage_cb != NULL ||
- dev_p->storage_cb_ms != NULL) ;
- cb = dev_p->storage_cb ;
- cb_ms = dev_p->storage_cb_ms ;
+ dev_p->storage_cb_ms != NULL);
+ cb = dev_p->storage_cb;
+ cb_ms = dev_p->storage_cb_ms;
- dev_p->storage_cb = 0 ;
- dev_p->storage_cb_ms = 0 ;
+ dev_p->storage_cb = 0;
+ dev_p->storage_cb_ms = 0;
if (ret == CY_AS_ERROR_SUCCESS)
- ret = dev_p->storage_error ;
+ ret = dev_p->storage_error;
if (cb_ms) {
cb_ms((cy_as_device_handle)dev_p,
@@ -1652,7 +1652,7 @@ cy_as_async_storage_callback(cy_as_device *dev_p,
dev_p->storage_device_index,
dev_p->storage_unit,
dev_p->storage_block_addr,
- dev_p->storage_oper, ret) ;
+ dev_p->storage_oper, ret);
} else {
cb((cy_as_device_handle)dev_p,
dev_p->storage_device_info
@@ -1661,10 +1661,10 @@ cy_as_async_storage_callback(cy_as_device *dev_p,
dev_p->storage_device_index,
dev_p->storage_unit,
dev_p->storage_block_addr,
- dev_p->storage_oper, ret) ;
+ dev_p->storage_oper, ret);
}
} else
- dev_p->storage_error = ret ;
+ dev_p->storage_error = ret;
}
static void
@@ -1675,35 +1675,35 @@ cy_as_async_storage_reply_callback(
cy_as_ll_request_response *resp,
cy_as_return_status_t ret)
{
- cy_as_storage_callback_dep cb ;
- cy_as_storage_callback cb_ms ;
- uint8_t reqtype ;
- (void)rqt ;
- (void)context ;
+ cy_as_storage_callback_dep cb;
+ cy_as_storage_callback cb_ms;
+ uint8_t reqtype;
+ (void)rqt;
+ (void)context;
- reqtype = cy_as_ll_request_response__get_code(rqt) ;
+ reqtype = cy_as_ll_request_response__get_code(rqt);
if (ret == CY_AS_ERROR_SUCCESS) {
if (cy_as_ll_request_response__get_code(resp) ==
CY_RESP_ANTIOCH_DEFERRED_ERROR) {
ret = cy_as_ll_request_response__get_word
- (resp, 0) & 0x00FF ;
+ (resp, 0) & 0x00FF;
} else if (cy_as_ll_request_response__get_code(resp) !=
CY_RESP_SUCCESS_FAILURE) {
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
}
}
if (ret != CY_AS_ERROR_SUCCESS) {
if (reqtype == CY_RQT_READ_BLOCK)
cy_as_dma_cancel(dev_p,
- dev_p->storage_read_endpoint, ret) ;
+ dev_p->storage_read_endpoint, ret);
else
cy_as_dma_cancel(dev_p,
- dev_p->storage_write_endpoint, ret) ;
+ dev_p->storage_write_endpoint, ret);
}
- dev_p->storage_wait = cy_false ;
+ dev_p->storage_wait = cy_false;
/*
* if the DMA callback has already been called, the
@@ -1711,15 +1711,15 @@ cy_as_async_storage_reply_callback(
*/
if (!cy_as_device_is_storage_async_pending(dev_p)) {
cy_as_hal_assert(dev_p->storage_cb != NULL ||
- dev_p->storage_cb_ms != NULL) ;
- cb = dev_p->storage_cb ;
- cb_ms = dev_p->storage_cb_ms ;
+ dev_p->storage_cb_ms != NULL);
+ cb = dev_p->storage_cb;
+ cb_ms = dev_p->storage_cb_ms;
- dev_p->storage_cb = 0 ;
- dev_p->storage_cb_ms = 0 ;
+ dev_p->storage_cb = 0;
+ dev_p->storage_cb_ms = 0;
if (ret == CY_AS_ERROR_SUCCESS)
- ret = dev_p->storage_error ;
+ ret = dev_p->storage_error;
if (cb_ms) {
cb_ms((cy_as_device_handle)dev_p,
@@ -1727,7 +1727,7 @@ cy_as_async_storage_reply_callback(
dev_p->storage_device_index,
dev_p->storage_unit,
dev_p->storage_block_addr,
- dev_p->storage_oper, ret) ;
+ dev_p->storage_oper, ret);
} else {
cb((cy_as_device_handle)dev_p,
dev_p->storage_device_info
@@ -1736,10 +1736,10 @@ cy_as_async_storage_reply_callback(
dev_p->storage_device_index,
dev_p->storage_unit,
dev_p->storage_block_addr,
- dev_p->storage_oper, ret) ;
+ dev_p->storage_oper, ret);
}
} else
- dev_p->storage_error = ret ;
+ dev_p->storage_error = ret;
}
static cy_as_return_status_t
@@ -1749,22 +1749,22 @@ cy_as_storage_async_oper(cy_as_device *dev_p, cy_as_end_point_number_t ep,
uint16_t num_blocks, cy_as_storage_callback_dep callback,
cy_as_storage_callback callback_ms)
{
- uint32_t mask ;
- cy_as_ll_request_response *req_p , *reply_p ;
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
+ uint32_t mask;
+ cy_as_ll_request_response *req_p , *reply_p;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
- ret = is_storage_active(dev_p) ;
+ ret = is_storage_active(dev_p);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
if (bus < 0 || bus >= CY_AS_MAX_BUSES)
- return CY_AS_ERROR_NO_SUCH_BUS ;
+ return CY_AS_ERROR_NO_SUCH_BUS;
if (device >= CY_AS_MAX_STORAGE_DEVICES)
- return CY_AS_ERROR_NO_SUCH_DEVICE ;
+ return CY_AS_ERROR_NO_SUCH_DEVICE;
if (unit > 255)
- return CY_AS_ERROR_NO_SUCH_UNIT ;
+ return CY_AS_ERROR_NO_SUCH_UNIT;
/* We are supposed to return sucess if the number of
* blocks is zero
@@ -1775,20 +1775,20 @@ cy_as_storage_async_oper(cy_as_device *dev_p, cy_as_end_point_number_t ep,
bus, device, unit, block,
((reqtype == CY_RQT_WRITE_BLOCK)
? cy_as_op_write : cy_as_op_read),
- CY_AS_ERROR_SUCCESS) ;
+ CY_AS_ERROR_SUCCESS);
else
callback((cy_as_device_handle)dev_p,
dev_p->storage_device_info[bus][device].type,
device, unit, block,
((reqtype == CY_RQT_WRITE_BLOCK) ?
cy_as_op_write : cy_as_op_read),
- CY_AS_ERROR_SUCCESS) ;
+ CY_AS_ERROR_SUCCESS);
- return CY_AS_ERROR_SUCCESS ;
+ return CY_AS_ERROR_SUCCESS;
}
if (dev_p->storage_device_info[bus][device].block_size == 0)
- return CY_AS_ERROR_QUERY_DEVICE_NEEDED ;
+ return CY_AS_ERROR_QUERY_DEVICE_NEEDED;
/*
* since async operations can be triggered by interrupt
@@ -1797,38 +1797,38 @@ cy_as_storage_async_oper(cy_as_device *dev_p, cy_as_end_point_number_t ep,
* test and set operation from interrupts. also need to
* check for pending async MTP writes
*/
- mask = cy_as_hal_disable_interrupts() ;
+ mask = cy_as_hal_disable_interrupts();
if ((cy_as_device_is_storage_async_pending(dev_p)) ||
(dev_p->storage_wait) ||
(cy_as_device_is_usb_async_pending(dev_p, 6))) {
- cy_as_hal_enable_interrupts(mask) ;
- return CY_AS_ERROR_ASYNC_PENDING ;
+ cy_as_hal_enable_interrupts(mask);
+ return CY_AS_ERROR_ASYNC_PENDING;
}
- cy_as_device_set_storage_async_pending(dev_p) ;
- cy_as_device_clear_p2s_dma_start_recvd(dev_p) ;
- cy_as_hal_enable_interrupts(mask) ;
+ cy_as_device_set_storage_async_pending(dev_p);
+ cy_as_device_clear_p2s_dma_start_recvd(dev_p);
+ cy_as_hal_enable_interrupts(mask);
/*
* storage information about the currently outstanding request
*/
- dev_p->storage_cb = callback ;
- dev_p->storage_cb_ms = callback_ms ;
- dev_p->storage_bus_index = bus ;
- dev_p->storage_device_index = device ;
- dev_p->storage_unit = unit ;
- dev_p->storage_block_addr = block ;
+ dev_p->storage_cb = callback;
+ dev_p->storage_cb_ms = callback_ms;
+ dev_p->storage_bus_index = bus;
+ dev_p->storage_device_index = device;
+ dev_p->storage_unit = unit;
+ dev_p->storage_block_addr = block;
/* Initialise the request to send to the West Bridge. */
- req_p = dev_p->storage_rw_req_p ;
- cy_as_ll_init_request(req_p, reqtype, CY_RQT_STORAGE_RQT_CONTEXT, 5) ;
+ req_p = dev_p->storage_rw_req_p;
+ cy_as_ll_init_request(req_p, reqtype, CY_RQT_STORAGE_RQT_CONTEXT, 5);
/* Initialise the space for reply from the West Bridge. */
- reply_p = dev_p->storage_rw_resp_p ;
- cy_as_ll_init_response(reply_p, 5) ;
+ reply_p = dev_p->storage_rw_resp_p;
+ cy_as_ll_init_response(reply_p, 5);
/* Remember which version of the API originated the request */
- req_p->flags |= req_flags ;
+ req_p->flags |= req_flags;
/* Setup the DMA request and adjust the storage
* operation if we are reading */
@@ -1836,31 +1836,31 @@ cy_as_storage_async_oper(cy_as_device *dev_p, cy_as_end_point_number_t ep,
ret = cy_as_dma_queue_request(dev_p, ep, data_p,
dev_p->storage_device_info[bus][device].block_size
* num_blocks, cy_false, cy_true,
- cy_as_async_storage_callback) ;
- dev_p->storage_oper = cy_as_op_read ;
+ cy_as_async_storage_callback);
+ dev_p->storage_oper = cy_as_op_read;
} else if (reqtype == CY_RQT_WRITE_BLOCK) {
ret = cy_as_dma_queue_request(dev_p, ep, data_p,
dev_p->storage_device_info[bus][device].block_size *
num_blocks, cy_false, cy_false,
- cy_as_async_storage_callback) ;
- dev_p->storage_oper = cy_as_op_write ;
+ cy_as_async_storage_callback);
+ dev_p->storage_oper = cy_as_op_write;
}
if (ret != CY_AS_ERROR_SUCCESS) {
- cy_as_device_clear_storage_async_pending(dev_p) ;
- return ret ;
+ cy_as_device_clear_storage_async_pending(dev_p);
+ return ret;
}
cy_as_ll_request_response__set_word(req_p,
- 0, create_address(bus, (uint8_t)device, (uint8_t)unit)) ;
+ 0, create_address(bus, (uint8_t)device, (uint8_t)unit));
cy_as_ll_request_response__set_word(req_p,
- 1, (uint16_t)((block >> 16) & 0xffff)) ;
+ 1, (uint16_t)((block >> 16) & 0xffff));
cy_as_ll_request_response__set_word(req_p,
- 2, (uint16_t)(block & 0xffff)) ;
+ 2, (uint16_t)(block & 0xffff));
cy_as_ll_request_response__set_word(req_p,
- 3, (uint16_t)((num_blocks >> 8) & 0x00ff)) ;
+ 3, (uint16_t)((num_blocks >> 8) & 0x00ff));
cy_as_ll_request_response__set_word(req_p,
- 4, (uint16_t)((num_blocks << 8) & 0xff00)) ;
+ 4, (uint16_t)((num_blocks << 8) & 0xff00));
/* Set the burst mode flag. */
if (dev_p->is_storage_only_mode)
@@ -1868,15 +1868,15 @@ cy_as_storage_async_oper(cy_as_device *dev_p, cy_as_end_point_number_t ep,
/* Send the request and wait for completion
* of storage request */
- dev_p->storage_wait = cy_true ;
+ dev_p->storage_wait = cy_true;
ret = cy_as_ll_send_request(dev_p, req_p, reply_p,
- cy_true, cy_as_async_storage_reply_callback) ;
+ cy_true, cy_as_async_storage_reply_callback);
if (ret != CY_AS_ERROR_SUCCESS) {
- cy_as_dma_cancel(dev_p, ep, CY_AS_ERROR_CANCELED) ;
- cy_as_device_clear_storage_async_pending(dev_p) ;
+ cy_as_dma_cancel(dev_p, ep, CY_AS_ERROR_CANCELED);
+ cy_as_device_clear_storage_async_pending(dev_p);
}
- return ret ;
+ return ret;
}
static void
@@ -1884,11 +1884,11 @@ cy_as_sync_storage_callback(cy_as_device *dev_p,
cy_as_end_point_number_t ep, void *buf_p,
uint32_t size, cy_as_return_status_t err)
{
- (void)ep ;
- (void)buf_p ;
- (void)size ;
+ (void)ep;
+ (void)buf_p;
+ (void)size;
- dev_p->storage_error = err ;
+ dev_p->storage_error = err;
}
static void
@@ -1899,34 +1899,34 @@ cy_as_sync_storage_reply_callback(
cy_as_ll_request_response *resp,
cy_as_return_status_t ret)
{
- uint8_t reqtype ;
- (void)rqt ;
+ uint8_t reqtype;
+ (void)rqt;
- reqtype = cy_as_ll_request_response__get_code(rqt) ;
+ reqtype = cy_as_ll_request_response__get_code(rqt);
if (cy_as_ll_request_response__get_code(resp) ==
CY_RESP_ANTIOCH_DEFERRED_ERROR) {
- ret = cy_as_ll_request_response__get_word(resp, 0) & 0x00FF ;
+ ret = cy_as_ll_request_response__get_word(resp, 0) & 0x00FF;
if (ret != CY_AS_ERROR_SUCCESS) {
if (reqtype == CY_RQT_READ_BLOCK)
cy_as_dma_cancel(dev_p,
- dev_p->storage_read_endpoint, ret) ;
+ dev_p->storage_read_endpoint, ret);
else
cy_as_dma_cancel(dev_p,
- dev_p->storage_write_endpoint, ret) ;
+ dev_p->storage_write_endpoint, ret);
}
} else if (cy_as_ll_request_response__get_code(resp) !=
CY_RESP_SUCCESS_FAILURE) {
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
}
- dev_p->storage_wait = cy_false ;
- dev_p->storage_error = ret ;
+ dev_p->storage_wait = cy_false;
+ dev_p->storage_error = ret;
/* Wake any threads/processes that are waiting on
* the read/write completion. */
- cy_as_hal_wake(&dev_p->context[context]->channel) ;
+ cy_as_hal_wake(&dev_p->context[context]->channel);
}
static cy_as_return_status_t
@@ -1936,37 +1936,37 @@ cy_as_storage_sync_oper(cy_as_device *dev_p,
uint32_t unit, uint32_t block, void *data_p,
uint16_t num_blocks)
{
- cy_as_ll_request_response *req_p , *reply_p ;
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
- cy_as_context *ctxt_p ;
- uint32_t loopcount = 200 ;
+ cy_as_ll_request_response *req_p , *reply_p;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
+ cy_as_context *ctxt_p;
+ uint32_t loopcount = 200;
- ret = is_storage_active(dev_p) ;
+ ret = is_storage_active(dev_p);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
if (bus < 0 || bus >= CY_AS_MAX_BUSES)
- return CY_AS_ERROR_NO_SUCH_BUS ;
+ return CY_AS_ERROR_NO_SUCH_BUS;
if (device >= CY_AS_MAX_STORAGE_DEVICES)
- return CY_AS_ERROR_NO_SUCH_DEVICE ;
+ return CY_AS_ERROR_NO_SUCH_DEVICE;
if (unit > 255)
- return CY_AS_ERROR_NO_SUCH_UNIT ;
+ return CY_AS_ERROR_NO_SUCH_UNIT;
if ((cy_as_device_is_storage_async_pending(dev_p)) ||
(dev_p->storage_wait))
- return CY_AS_ERROR_ASYNC_PENDING ;
+ return CY_AS_ERROR_ASYNC_PENDING;
/* Also need to check for pending Async MTP writes */
if (cy_as_device_is_usb_async_pending(dev_p, 6))
- return CY_AS_ERROR_ASYNC_PENDING ;
+ return CY_AS_ERROR_ASYNC_PENDING;
/* We are supposed to return sucess if the number of
* blocks is zero
*/
if (num_blocks == 0)
- return CY_AS_ERROR_SUCCESS ;
+ return CY_AS_ERROR_SUCCESS;
if (dev_p->storage_device_info[bus][device].block_size == 0) {
/*
@@ -1974,50 +1974,50 @@ cy_as_storage_sync_oper(cy_as_device *dev_p,
* the query device call before a read request is issued.
* therefore, this normally will not be run.
*/
- ret = cy_as_get_block_size(dev_p, bus, device, 0) ;
+ ret = cy_as_get_block_size(dev_p, bus, device, 0);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
}
/* Initialise the request to send to the West Bridge. */
- req_p = dev_p->storage_rw_req_p ;
+ req_p = dev_p->storage_rw_req_p;
cy_as_ll_init_request(req_p, reqtype,
- CY_RQT_STORAGE_RQT_CONTEXT, 5) ;
+ CY_RQT_STORAGE_RQT_CONTEXT, 5);
/* Initialise the space for reply from
* the West Bridge. */
- reply_p = dev_p->storage_rw_resp_p ;
- cy_as_ll_init_response(reply_p, 5) ;
- cy_as_device_clear_p2s_dma_start_recvd(dev_p) ;
+ reply_p = dev_p->storage_rw_resp_p;
+ cy_as_ll_init_response(reply_p, 5);
+ cy_as_device_clear_p2s_dma_start_recvd(dev_p);
/* Setup the DMA request */
if (reqtype == CY_RQT_READ_BLOCK) {
ret = cy_as_dma_queue_request(dev_p, ep, data_p,
dev_p->storage_device_info[bus][device].block_size *
num_blocks, cy_false,
- cy_true, cy_as_sync_storage_callback) ;
- dev_p->storage_oper = cy_as_op_read ;
+ cy_true, cy_as_sync_storage_callback);
+ dev_p->storage_oper = cy_as_op_read;
} else if (reqtype == CY_RQT_WRITE_BLOCK) {
ret = cy_as_dma_queue_request(dev_p, ep, data_p,
dev_p->storage_device_info[bus][device].block_size *
num_blocks, cy_false, cy_false,
- cy_as_sync_storage_callback) ;
- dev_p->storage_oper = cy_as_op_write ;
+ cy_as_sync_storage_callback);
+ dev_p->storage_oper = cy_as_op_write;
}
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
cy_as_ll_request_response__set_word(req_p, 0,
- create_address(bus, (uint8_t)device, (uint8_t)unit)) ;
+ create_address(bus, (uint8_t)device, (uint8_t)unit));
cy_as_ll_request_response__set_word(req_p, 1,
- (uint16_t)((block >> 16) & 0xffff)) ;
+ (uint16_t)((block >> 16) & 0xffff));
cy_as_ll_request_response__set_word(req_p, 2,
- (uint16_t)(block & 0xffff)) ;
+ (uint16_t)(block & 0xffff));
cy_as_ll_request_response__set_word(req_p, 3,
- (uint16_t)((num_blocks >> 8) & 0x00ff)) ;
+ (uint16_t)((num_blocks >> 8) & 0x00ff));
cy_as_ll_request_response__set_word(req_p, 4,
- (uint16_t)((num_blocks << 8) & 0xff00)) ;
+ (uint16_t)((num_blocks << 8) & 0xff00));
/* Set the burst mode flag. */
if (dev_p->is_storage_only_mode)
@@ -2025,33 +2025,33 @@ cy_as_storage_sync_oper(cy_as_device *dev_p,
/* Send the request and wait for
* completion of storage request */
- dev_p->storage_wait = cy_true ;
+ dev_p->storage_wait = cy_true;
ret = cy_as_ll_send_request(dev_p, req_p, reply_p, cy_true,
- cy_as_sync_storage_reply_callback) ;
+ cy_as_sync_storage_reply_callback);
if (ret != CY_AS_ERROR_SUCCESS) {
- cy_as_dma_cancel(dev_p, ep, CY_AS_ERROR_CANCELED) ;
+ cy_as_dma_cancel(dev_p, ep, CY_AS_ERROR_CANCELED);
} else {
/* Setup the DMA request */
- ctxt_p = dev_p->context[CY_RQT_STORAGE_RQT_CONTEXT] ;
- ret = cy_as_dma_drain_queue(dev_p, ep, cy_false) ;
+ ctxt_p = dev_p->context[CY_RQT_STORAGE_RQT_CONTEXT];
+ ret = cy_as_dma_drain_queue(dev_p, ep, cy_false);
while (loopcount-- > 0) {
if (dev_p->storage_wait == cy_false)
- break ;
- cy_as_hal_sleep_on(&ctxt_p->channel, 10) ;
+ break;
+ cy_as_hal_sleep_on(&ctxt_p->channel, 10);
}
if (dev_p->storage_wait == cy_true) {
- dev_p->storage_wait = cy_false ;
- cy_as_ll_remove_request(dev_p, ctxt_p, req_p, cy_true) ;
- ret = CY_AS_ERROR_TIMEOUT ;
+ dev_p->storage_wait = cy_false;
+ cy_as_ll_remove_request(dev_p, ctxt_p, req_p, cy_true);
+ ret = CY_AS_ERROR_TIMEOUT;
}
if (ret == CY_AS_ERROR_SUCCESS)
- ret = dev_p->storage_error ;
+ ret = dev_p->storage_error;
}
- return ret ;
+ return ret;
}
cy_as_return_status_t
@@ -2060,14 +2060,14 @@ cy_as_storage_read(cy_as_device_handle handle,
uint32_t unit, uint32_t block,
void *data_p, uint16_t num_blocks)
{
- cy_as_device *dev_p = (cy_as_device *)handle ;
+ cy_as_device *dev_p = (cy_as_device *)handle;
if (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE))
- return CY_AS_ERROR_INVALID_HANDLE ;
+ return CY_AS_ERROR_INVALID_HANDLE;
return cy_as_storage_sync_oper(dev_p, dev_p->storage_read_endpoint,
CY_RQT_READ_BLOCK, bus, device,
- unit, block, data_p, num_blocks) ;
+ unit, block, data_p, num_blocks);
}
cy_as_return_status_t
@@ -2076,18 +2076,18 @@ cy_as_storage_write(cy_as_device_handle handle,
uint32_t unit, uint32_t block, void *data_p,
uint16_t num_blocks)
{
- cy_as_device *dev_p = (cy_as_device *)handle ;
+ cy_as_device *dev_p = (cy_as_device *)handle;
if (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE))
- return CY_AS_ERROR_INVALID_HANDLE ;
+ return CY_AS_ERROR_INVALID_HANDLE;
if (dev_p->mtp_turbo_active)
- return CY_AS_ERROR_NOT_VALID_DURING_MTP ;
+ return CY_AS_ERROR_NOT_VALID_DURING_MTP;
return cy_as_storage_sync_oper(dev_p,
dev_p->storage_write_endpoint,
CY_RQT_WRITE_BLOCK, bus, device,
- unit, block, data_p, num_blocks) ;
+ unit, block, data_p, num_blocks);
}
@@ -2097,13 +2097,13 @@ cy_as_storage_read_async(cy_as_device_handle handle,
uint32_t block, void *data_p, uint16_t num_blocks,
cy_as_storage_callback callback)
{
- cy_as_device *dev_p = (cy_as_device *)handle ;
+ cy_as_device *dev_p = (cy_as_device *)handle;
if (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE))
- return CY_AS_ERROR_INVALID_HANDLE ;
+ return CY_AS_ERROR_INVALID_HANDLE;
if (callback == 0)
- return CY_AS_ERROR_NULL_CALLBACK ;
+ return CY_AS_ERROR_NULL_CALLBACK;
return cy_as_storage_async_oper(dev_p,
dev_p->storage_read_endpoint, CY_RQT_READ_BLOCK,
@@ -2117,16 +2117,16 @@ cy_as_storage_write_async(cy_as_device_handle handle,
uint32_t block, void *data_p, uint16_t num_blocks,
cy_as_storage_callback callback)
{
- cy_as_device *dev_p = (cy_as_device *)handle ;
+ cy_as_device *dev_p = (cy_as_device *)handle;
if (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE))
- return CY_AS_ERROR_INVALID_HANDLE ;
+ return CY_AS_ERROR_INVALID_HANDLE;
if (callback == 0)
- return CY_AS_ERROR_NULL_CALLBACK ;
+ return CY_AS_ERROR_NULL_CALLBACK;
if (dev_p->mtp_turbo_active)
- return CY_AS_ERROR_NOT_VALID_DURING_MTP ;
+ return CY_AS_ERROR_NOT_VALID_DURING_MTP;
return cy_as_storage_async_oper(dev_p,
dev_p->storage_write_endpoint, CY_RQT_WRITE_BLOCK,
@@ -2143,32 +2143,32 @@ my_storage_cancel_callback(
cy_as_ll_request_response *resp,
cy_as_return_status_t stat)
{
- (void)context ;
- (void)stat ;
+ (void)context;
+ (void)stat;
/* Nothing to do here, except free up the
* request and response structures. */
- cy_as_ll_destroy_response(dev_p, resp) ;
- cy_as_ll_destroy_request(dev_p, rqt) ;
+ cy_as_ll_destroy_response(dev_p, resp);
+ cy_as_ll_destroy_request(dev_p, rqt);
}
cy_as_return_status_t
cy_as_storage_cancel_async(cy_as_device_handle handle)
{
- cy_as_return_status_t ret ;
- cy_as_ll_request_response *req_p , *reply_p ;
+ cy_as_return_status_t ret;
+ cy_as_ll_request_response *req_p , *reply_p;
- cy_as_device *dev_p = (cy_as_device *)handle ;
+ cy_as_device *dev_p = (cy_as_device *)handle;
if (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE))
- return CY_AS_ERROR_INVALID_HANDLE ;
+ return CY_AS_ERROR_INVALID_HANDLE;
- ret = is_storage_active(dev_p) ;
+ ret = is_storage_active(dev_p);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
if (!cy_as_device_is_storage_async_pending(dev_p))
- return CY_AS_ERROR_ASYNC_NOT_PENDING ;
+ return CY_AS_ERROR_ASYNC_NOT_PENDING;
/*
* create and send a mailbox request to firmware
@@ -2177,24 +2177,24 @@ cy_as_storage_cancel_async(cy_as_device_handle handle)
* driven through the callbacks for the read/write call.
*/
req_p = cy_as_ll_create_request(dev_p, CY_RQT_ABORT_P2S_XFER,
- CY_RQT_GENERAL_RQT_CONTEXT, 1) ;
+ CY_RQT_GENERAL_RQT_CONTEXT, 1);
if (req_p == 0)
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ return CY_AS_ERROR_OUT_OF_MEMORY;
- reply_p = cy_as_ll_create_response(dev_p, 1) ;
+ reply_p = cy_as_ll_create_response(dev_p, 1);
if (reply_p == 0) {
- cy_as_ll_destroy_request(dev_p, req_p) ;
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ return CY_AS_ERROR_OUT_OF_MEMORY;
}
ret = cy_as_ll_send_request(dev_p, req_p,
- reply_p, cy_false, my_storage_cancel_callback) ;
+ reply_p, cy_false, my_storage_cancel_callback);
if (ret) {
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
}
- return CY_AS_ERROR_SUCCESS ;
+ return CY_AS_ERROR_SUCCESS;
}
/*
@@ -2204,17 +2204,17 @@ cy_as_storage_cancel_async(cy_as_device_handle handle)
void cy_as_storage_cleanup(cy_as_device *dev_p)
{
if (dev_p->storage_count) {
- cy_as_ll_destroy_request(dev_p, dev_p->storage_rw_req_p) ;
- cy_as_ll_destroy_response(dev_p, dev_p->storage_rw_resp_p) ;
- dev_p->storage_count = 0 ;
- cy_as_device_clear_scsi_messages(dev_p) ;
+ cy_as_ll_destroy_request(dev_p, dev_p->storage_rw_req_p);
+ cy_as_ll_destroy_response(dev_p, dev_p->storage_rw_resp_p);
+ dev_p->storage_count = 0;
+ cy_as_device_clear_scsi_messages(dev_p);
cy_as_hal_mem_set(dev_p->storage_device_info,
- 0, sizeof(dev_p->storage_device_info)) ;
+ 0, sizeof(dev_p->storage_device_info));
- cy_as_device_clear_storage_async_pending(dev_p) ;
- dev_p->storage_cb = 0 ;
- dev_p->storage_cb_ms = 0 ;
- dev_p->storage_wait = cy_false ;
+ cy_as_device_clear_storage_async_pending(dev_p);
+ dev_p->storage_cb = 0;
+ dev_p->storage_cb_ms = 0;
+ dev_p->storage_wait = cy_false;
}
}
@@ -2225,49 +2225,49 @@ my_handle_response_sd_reg_read(
cy_as_ll_request_response *reply_p,
cy_as_storage_sd_reg_read_data *info)
{
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
- uint8_t resp_type, i ;
- uint16_t resp_len ;
- uint8_t length = info->length ;
- uint8_t *data_p = info->buf_p ;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
+ uint8_t resp_type, i;
+ uint16_t resp_len;
+ uint8_t length = info->length;
+ uint8_t *data_p = info->buf_p;
- resp_type = cy_as_ll_request_response__get_code(reply_p) ;
+ resp_type = cy_as_ll_request_response__get_code(reply_p);
if (resp_type == CY_RESP_SD_REGISTER_DATA) {
- uint16_t *resp_p = reply_p->data + 1 ;
- uint16_t temp ;
+ uint16_t *resp_p = reply_p->data + 1;
+ uint16_t temp;
- resp_len = cy_as_ll_request_response__get_word(reply_p, 0) ;
- cy_as_hal_assert(resp_len >= length) ;
+ resp_len = cy_as_ll_request_response__get_word(reply_p, 0);
+ cy_as_hal_assert(resp_len >= length);
/*
* copy the values into the output buffer after doing the
* necessary bit shifting. the bit shifting is required because
* the data comes out of the west bridge with a 6 bit offset.
*/
- i = 0 ;
+ i = 0;
while (length) {
- temp = ((resp_p[i] << 6) | (resp_p[i + 1] >> 10)) ;
- i++ ;
+ temp = ((resp_p[i] << 6) | (resp_p[i + 1] >> 10));
+ i++;
- *data_p++ = (uint8_t)(temp >> 8) ;
- length-- ;
+ *data_p++ = (uint8_t)(temp >> 8);
+ length--;
if (length) {
- *data_p++ = (uint8_t)(temp & 0xFF) ;
- length-- ;
+ *data_p++ = (uint8_t)(temp & 0xFF);
+ length--;
}
}
} else {
if (resp_type == CY_RESP_SUCCESS_FAILURE)
- ret = cy_as_ll_request_response__get_word(reply_p, 0) ;
+ ret = cy_as_ll_request_response__get_word(reply_p, 0);
else
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
}
- cy_as_ll_destroy_response(dev_p, reply_p) ;
- cy_as_ll_destroy_request(dev_p, req_p) ;
+ cy_as_ll_destroy_response(dev_p, reply_p);
+ cy_as_ll_destroy_request(dev_p, req_p);
- return ret ;
+ return ret;
}
cy_as_return_status_t
@@ -2280,32 +2280,32 @@ cy_as_storage_sd_register_read(
cy_as_function_callback cb,
uint32_t client)
{
- cy_as_ll_request_response *req_p , *reply_p ;
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
- uint8_t length ;
+ cy_as_ll_request_response *req_p , *reply_p;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
+ uint8_t length;
/*
* sanity checks required before sending the request to the
* firmware.
*/
- cy_as_device *dev_p = (cy_as_device *)handle ;
+ cy_as_device *dev_p = (cy_as_device *)handle;
if (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE))
- return CY_AS_ERROR_INVALID_HANDLE ;
+ return CY_AS_ERROR_INVALID_HANDLE;
- ret = is_storage_active(dev_p) ;
+ ret = is_storage_active(dev_p);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
if (device >= CY_AS_MAX_STORAGE_DEVICES)
- return CY_AS_ERROR_NO_SUCH_DEVICE ;
+ return CY_AS_ERROR_NO_SUCH_DEVICE;
if (reg_type > cy_as_sd_reg_CSD)
- return CY_AS_ERROR_INVALID_PARAMETER ;
+ return CY_AS_ERROR_INVALID_PARAMETER;
/* If SD/MMC media is not supported on the
* addressed bus, return error. */
if ((dev_p->media_supported[bus] & (1 << cy_as_media_sd_flash)) == 0)
- return CY_AS_ERROR_INVALID_PARAMETER ;
+ return CY_AS_ERROR_INVALID_PARAMETER;
/*
* find the amount of data to be returned. this will be the minimum of
@@ -2313,66 +2313,66 @@ cy_as_storage_sd_register_read(
*/
switch (reg_type) {
case cy_as_sd_reg_OCR:
- length = CY_AS_SD_REG_OCR_LENGTH ;
- break ;
+ length = CY_AS_SD_REG_OCR_LENGTH;
+ break;
case cy_as_sd_reg_CID:
- length = CY_AS_SD_REG_CID_LENGTH ;
- break ;
+ length = CY_AS_SD_REG_CID_LENGTH;
+ break;
case cy_as_sd_reg_CSD:
- length = CY_AS_SD_REG_CSD_LENGTH ;
- break ;
+ length = CY_AS_SD_REG_CSD_LENGTH;
+ break;
default:
- length = 0 ;
- cy_as_hal_assert(0) ;
+ length = 0;
+ cy_as_hal_assert(0);
}
if (length < data_p->length)
- data_p->length = length ;
- length = data_p->length ;
+ data_p->length = length;
+ length = data_p->length;
/* Create the request to send to the West Bridge device */
req_p = cy_as_ll_create_request(dev_p, CY_RQT_SD_REGISTER_READ,
- CY_RQT_STORAGE_RQT_CONTEXT, 1) ;
+ CY_RQT_STORAGE_RQT_CONTEXT, 1);
if (req_p == 0)
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ return CY_AS_ERROR_OUT_OF_MEMORY;
cy_as_ll_request_response__set_word(req_p, 0,
- (create_address(bus, device, 0) | (uint16_t)reg_type)) ;
+ (create_address(bus, device, 0) | (uint16_t)reg_type));
reply_p = cy_as_ll_create_response(dev_p,
- CY_AS_SD_REG_MAX_RESP_LENGTH) ;
+ CY_AS_SD_REG_MAX_RESP_LENGTH);
if (reply_p == 0) {
- cy_as_ll_destroy_request(dev_p, req_p) ;
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ return CY_AS_ERROR_OUT_OF_MEMORY;
}
if (cb == 0) {
- ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p) ;
+ ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
return my_handle_response_sd_reg_read(dev_p,
- req_p, reply_p, data_p) ;
+ req_p, reply_p, data_p);
} else {
ret = cy_as_misc_send_request(dev_p, cb, client,
CY_FUNCT_CB_STOR_SDREGISTERREAD, data_p,
dev_p->func_cbs_stor, CY_AS_REQUEST_RESPONSE_EX,
- req_p, reply_p, cy_as_storage_func_callback) ;
+ req_p, reply_p, cy_as_storage_func_callback);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
/* The request and response are freed as part of the
* MiscFuncCallback */
- return ret ;
+ return ret;
}
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
- return ret ;
+ return ret;
}
cy_as_return_status_t
@@ -2386,69 +2386,69 @@ cy_as_storage_create_p_partition(
cy_as_function_callback cb,
uint32_t client)
{
- cy_as_ll_request_response *req_p, *reply_p ;
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
- cy_as_device *dev_p = (cy_as_device *)handle ;
+ cy_as_ll_request_response *req_p, *reply_p;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
+ cy_as_device *dev_p = (cy_as_device *)handle;
if (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE))
- return CY_AS_ERROR_INVALID_HANDLE ;
+ return CY_AS_ERROR_INVALID_HANDLE;
- ret = is_storage_active(dev_p) ;
+ ret = is_storage_active(dev_p);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
/* Partitions cannot be created or deleted while
* the USB stack is active. */
if (dev_p->usb_count)
- return CY_AS_ERROR_USB_RUNNING ;
+ return CY_AS_ERROR_USB_RUNNING;
/* Create the request to send to the West Bridge device */
req_p = cy_as_ll_create_request(dev_p, CY_RQT_PARTITION_STORAGE,
- CY_RQT_STORAGE_RQT_CONTEXT, 3) ;
+ CY_RQT_STORAGE_RQT_CONTEXT, 3);
if (req_p == 0)
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ return CY_AS_ERROR_OUT_OF_MEMORY;
/* Reserve space for the reply, the reply
* data will not exceed one word */
- reply_p = cy_as_ll_create_response(dev_p, 1) ;
+ reply_p = cy_as_ll_create_response(dev_p, 1);
if (reply_p == 0) {
- cy_as_ll_destroy_request(dev_p, req_p) ;
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ return CY_AS_ERROR_OUT_OF_MEMORY;
}
cy_as_ll_request_response__set_word(req_p, 0,
create_address(bus, (uint8_t)device, 0x00));
cy_as_ll_request_response__set_word(req_p, 1,
- (uint16_t)((size >> 16) & 0xffff)) ;
+ (uint16_t)((size >> 16) & 0xffff));
cy_as_ll_request_response__set_word(req_p, 2,
- (uint16_t)(size & 0xffff)) ;
+ (uint16_t)(size & 0xffff));
if (cb == 0) {
- ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p) ;
+ ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
- return my_handle_response_no_data(dev_p, req_p, reply_p) ;
+ return my_handle_response_no_data(dev_p, req_p, reply_p);
} else {
ret = cy_as_misc_send_request(dev_p, cb, client,
CY_FUNCT_CB_STOR_PARTITION, 0, dev_p->func_cbs_stor,
CY_AS_REQUEST_RESPONSE_EX, req_p, reply_p,
- cy_as_storage_func_callback) ;
+ cy_as_storage_func_callback);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
/* The request and response are freed as part of the
* FuncCallback */
- return ret ;
+ return ret;
}
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
- return ret ;
+ return ret;
}
cy_as_return_status_t
@@ -2459,65 +2459,65 @@ cy_as_storage_remove_p_partition(
cy_as_function_callback cb,
uint32_t client)
{
- cy_as_ll_request_response *req_p, *reply_p ;
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
- cy_as_device *dev_p = (cy_as_device *)handle ;
+ cy_as_ll_request_response *req_p, *reply_p;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
+ cy_as_device *dev_p = (cy_as_device *)handle;
if (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE))
- return CY_AS_ERROR_INVALID_HANDLE ;
+ return CY_AS_ERROR_INVALID_HANDLE;
- ret = is_storage_active(dev_p) ;
+ ret = is_storage_active(dev_p);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
/* Partitions cannot be created or deleted while
* the USB stack is active. */
if (dev_p->usb_count)
- return CY_AS_ERROR_USB_RUNNING ;
+ return CY_AS_ERROR_USB_RUNNING;
/* Create the request to send to the West Bridge device */
req_p = cy_as_ll_create_request(dev_p, CY_RQT_PARTITION_ERASE,
- CY_RQT_STORAGE_RQT_CONTEXT, 1) ;
+ CY_RQT_STORAGE_RQT_CONTEXT, 1);
if (req_p == 0)
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ return CY_AS_ERROR_OUT_OF_MEMORY;
/* Reserve space for the reply, the reply
* data will not exceed one word */
- reply_p = cy_as_ll_create_response(dev_p, 1) ;
+ reply_p = cy_as_ll_create_response(dev_p, 1);
if (reply_p == 0) {
- cy_as_ll_destroy_request(dev_p, req_p) ;
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ return CY_AS_ERROR_OUT_OF_MEMORY;
}
cy_as_ll_request_response__set_word(req_p,
0, create_address(bus, (uint8_t)device, 0x00));
if (cb == 0) {
- ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p) ;
+ ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
- return my_handle_response_no_data(dev_p, req_p, reply_p) ;
+ return my_handle_response_no_data(dev_p, req_p, reply_p);
} else {
ret = cy_as_misc_send_request(dev_p, cb, client,
CY_FUNCT_CB_NODATA, 0, dev_p->func_cbs_stor,
CY_AS_REQUEST_RESPONSE_EX, req_p, reply_p,
- cy_as_storage_func_callback) ;
+ cy_as_storage_func_callback);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
/* The request and response are freed
* as part of the FuncCallback */
- return ret ;
+ return ret;
}
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
- return ret ;
+ return ret;
}
static cy_as_return_status_t
@@ -2526,28 +2526,28 @@ my_handle_response_get_transfer_amount(cy_as_device *dev_p,
cy_as_ll_request_response *reply_p,
cy_as_m_s_c_progress_data *data)
{
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
- uint8_t code = cy_as_ll_request_response__get_code(reply_p) ;
- uint16_t v1, v2 ;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
+ uint8_t code = cy_as_ll_request_response__get_code(reply_p);
+ uint16_t v1, v2;
if (code != CY_RESP_TRANSFER_COUNT) {
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
- goto destroy ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
+ goto destroy;
}
- v1 = cy_as_ll_request_response__get_word(reply_p, 0) ;
- v2 = cy_as_ll_request_response__get_word(reply_p, 1) ;
- data->wr_count = (uint32_t)((v1 << 16) | v2) ;
+ v1 = cy_as_ll_request_response__get_word(reply_p, 0);
+ v2 = cy_as_ll_request_response__get_word(reply_p, 1);
+ data->wr_count = (uint32_t)((v1 << 16) | v2);
- v1 = cy_as_ll_request_response__get_word(reply_p, 2) ;
- v2 = cy_as_ll_request_response__get_word(reply_p, 3) ;
- data->rd_count = (uint32_t)((v1 << 16) | v2) ;
+ v1 = cy_as_ll_request_response__get_word(reply_p, 2);
+ v2 = cy_as_ll_request_response__get_word(reply_p, 3);
+ data->rd_count = (uint32_t)((v1 << 16) | v2);
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
- return ret ;
+ return ret;
}
cy_as_return_status_t
@@ -2560,65 +2560,65 @@ cy_as_storage_get_transfer_amount(
uint32_t client
)
{
- cy_as_ll_request_response *req_p, *reply_p ;
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
- cy_as_device *dev_p = (cy_as_device *)handle ;
+ cy_as_ll_request_response *req_p, *reply_p;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
+ cy_as_device *dev_p = (cy_as_device *)handle;
if (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE))
- return CY_AS_ERROR_INVALID_HANDLE ;
+ return CY_AS_ERROR_INVALID_HANDLE;
- ret = is_storage_active(dev_p) ;
+ ret = is_storage_active(dev_p);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
/* Check if the firmware image supports this feature. */
if ((dev_p->media_supported[0]) && (dev_p->media_supported[0]
== (1 << cy_as_media_nand)))
- return CY_AS_ERROR_NOT_SUPPORTED ;
+ return CY_AS_ERROR_NOT_SUPPORTED;
/* Create the request to send to the West Bridge device */
req_p = cy_as_ll_create_request(dev_p, CY_RQT_GET_TRANSFER_AMOUNT,
- CY_RQT_STORAGE_RQT_CONTEXT, 1) ;
+ CY_RQT_STORAGE_RQT_CONTEXT, 1);
if (req_p == 0)
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ return CY_AS_ERROR_OUT_OF_MEMORY;
/* Reserve space for the reply, the reply data
* will not exceed four words. */
- reply_p = cy_as_ll_create_response(dev_p, 4) ;
+ reply_p = cy_as_ll_create_response(dev_p, 4);
if (reply_p == 0) {
- cy_as_ll_destroy_request(dev_p, req_p) ;
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ return CY_AS_ERROR_OUT_OF_MEMORY;
}
cy_as_ll_request_response__set_word(req_p, 0,
create_address(bus, (uint8_t)device, 0x00));
if (cb == 0) {
- ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p) ;
+ ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
return my_handle_response_get_transfer_amount(dev_p,
- req_p, reply_p, data_p) ;
+ req_p, reply_p, data_p);
} else {
ret = cy_as_misc_send_request(dev_p, cb, client,
CY_FUNCT_CB_STOR_GETTRANSFERAMOUNT, (void *)data_p,
dev_p->func_cbs_stor, CY_AS_REQUEST_RESPONSE_EX,
- req_p, reply_p, cy_as_storage_func_callback) ;
+ req_p, reply_p, cy_as_storage_func_callback);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
/* The request and response are freed as part of the
* FuncCallback */
- return ret ;
+ return ret;
}
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
- return ret ;
+ return ret;
}
@@ -2633,25 +2633,25 @@ cy_as_storage_erase(
uint32_t client
)
{
- cy_as_ll_request_response *req_p, *reply_p ;
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
- cy_as_device *dev_p = (cy_as_device *)handle ;
+ cy_as_ll_request_response *req_p, *reply_p;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
+ cy_as_device *dev_p = (cy_as_device *)handle;
if (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE))
- return CY_AS_ERROR_INVALID_HANDLE ;
+ return CY_AS_ERROR_INVALID_HANDLE;
- ret = is_storage_active(dev_p) ;
+ ret = is_storage_active(dev_p);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
if (bus < 0 || bus >= CY_AS_MAX_BUSES)
- return CY_AS_ERROR_NO_SUCH_BUS ;
+ return CY_AS_ERROR_NO_SUCH_BUS;
if (device >= CY_AS_MAX_STORAGE_DEVICES)
- return CY_AS_ERROR_NO_SUCH_DEVICE ;
+ return CY_AS_ERROR_NO_SUCH_DEVICE;
if (dev_p->storage_device_info[bus][device].block_size == 0)
- return CY_AS_ERROR_QUERY_DEVICE_NEEDED ;
+ return CY_AS_ERROR_QUERY_DEVICE_NEEDED;
/* If SD is not supported on the specified bus, then return ERROR */
if (dev_p->storage_device_info[bus][device].type !=
@@ -2659,40 +2659,40 @@ cy_as_storage_erase(
return CY_AS_ERROR_NOT_SUPPORTED;
if (num_erase_units == 0)
- return CY_AS_ERROR_SUCCESS ;
+ return CY_AS_ERROR_SUCCESS;
/* Create the request to send to the West Bridge device */
req_p = cy_as_ll_create_request(dev_p, CY_RQT_ERASE,
- CY_RQT_STORAGE_RQT_CONTEXT, 5) ;
+ CY_RQT_STORAGE_RQT_CONTEXT, 5);
if (req_p == 0)
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ return CY_AS_ERROR_OUT_OF_MEMORY;
/* Reserve space for the reply, the reply
* data will not exceed four words. */
- reply_p = cy_as_ll_create_response(dev_p, 4) ;
+ reply_p = cy_as_ll_create_response(dev_p, 4);
if (reply_p == 0) {
- cy_as_ll_destroy_request(dev_p, req_p) ;
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ return CY_AS_ERROR_OUT_OF_MEMORY;
}
cy_as_ll_request_response__set_word(req_p, 0,
create_address(bus, (uint8_t)device, 0x00));
cy_as_ll_request_response__set_word(req_p, 1,
- (uint16_t)((erase_unit >> 16) & 0xffff)) ;
+ (uint16_t)((erase_unit >> 16) & 0xffff));
cy_as_ll_request_response__set_word(req_p, 2,
- (uint16_t)(erase_unit & 0xffff)) ;
+ (uint16_t)(erase_unit & 0xffff));
cy_as_ll_request_response__set_word(req_p, 3,
- (uint16_t)((num_erase_units >> 8) & 0x00ff)) ;
+ (uint16_t)((num_erase_units >> 8) & 0x00ff));
cy_as_ll_request_response__set_word(req_p, 4,
- (uint16_t)((num_erase_units << 8) & 0xff00)) ;
+ (uint16_t)((num_erase_units << 8) & 0xff00));
if (cb == 0) {
- ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p) ;
+ ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
- ret = my_handle_response_no_data(dev_p, req_p, reply_p) ;
+ ret = my_handle_response_no_data(dev_p, req_p, reply_p);
/* If error = "invalid response", this (very likely) means
* that we are not using the SD-only firmware module which
@@ -2701,26 +2701,26 @@ cy_as_storage_erase(
if (ret == CY_AS_ERROR_INVALID_RESPONSE)
ret = CY_AS_ERROR_NOT_SUPPORTED;
- return ret ;
+ return ret;
} else {
ret = cy_as_misc_send_request(dev_p, cb, client,
CY_FUNCT_CB_STOR_ERASE, 0, dev_p->func_cbs_stor,
CY_AS_REQUEST_RESPONSE_EX, req_p, reply_p,
- cy_as_storage_func_callback) ;
+ cy_as_storage_func_callback);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
/* The request and response are freed
* as part of the FuncCallback */
- return ret ;
+ return ret;
}
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
- return ret ;
+ return ret;
}
static void
@@ -2731,80 +2731,80 @@ cy_as_storage_func_callback(cy_as_device *dev_p,
cy_as_return_status_t stat)
{
cy_as_func_c_b_node *node = (cy_as_func_c_b_node *)
- dev_p->func_cbs_stor->head_p ;
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
+ dev_p->func_cbs_stor->head_p;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
cy_bool ex_request = (rqt->flags & CY_AS_REQUEST_RESPONSE_EX)
- == CY_AS_REQUEST_RESPONSE_EX ;
+ == CY_AS_REQUEST_RESPONSE_EX;
cy_bool ms_request = (rqt->flags & CY_AS_REQUEST_RESPONSE_MS)
- == CY_AS_REQUEST_RESPONSE_MS ;
- uint8_t code ;
- uint8_t cntxt ;
+ == CY_AS_REQUEST_RESPONSE_MS;
+ uint8_t code;
+ uint8_t cntxt;
- cy_as_hal_assert(ex_request || ms_request) ;
- cy_as_hal_assert(dev_p->func_cbs_stor->count != 0) ;
- cy_as_hal_assert(dev_p->func_cbs_stor->type == CYAS_FUNC_CB) ;
+ cy_as_hal_assert(ex_request || ms_request);
+ cy_as_hal_assert(dev_p->func_cbs_stor->count != 0);
+ cy_as_hal_assert(dev_p->func_cbs_stor->type == CYAS_FUNC_CB);
(void) ex_request;
(void) ms_request;
- (void)context ;
+ (void)context;
- cntxt = cy_as_ll_request_response__get_context(rqt) ;
- cy_as_hal_assert(cntxt == CY_RQT_STORAGE_RQT_CONTEXT) ;
+ cntxt = cy_as_ll_request_response__get_context(rqt);
+ cy_as_hal_assert(cntxt == CY_RQT_STORAGE_RQT_CONTEXT);
- code = cy_as_ll_request_response__get_code(rqt) ;
+ code = cy_as_ll_request_response__get_code(rqt);
switch (code) {
case CY_RQT_START_STORAGE:
- ret = my_handle_response_storage_start(dev_p, rqt, resp, stat) ;
- break ;
+ ret = my_handle_response_storage_start(dev_p, rqt, resp, stat);
+ break;
case CY_RQT_STOP_STORAGE:
- ret = my_handle_response_storage_stop(dev_p, rqt, resp, stat) ;
- break ;
+ ret = my_handle_response_storage_stop(dev_p, rqt, resp, stat);
+ break;
case CY_RQT_CLAIM_STORAGE:
- ret = my_handle_response_storage_claim(dev_p, rqt, resp) ;
- break ;
+ ret = my_handle_response_storage_claim(dev_p, rqt, resp);
+ break;
case CY_RQT_RELEASE_STORAGE:
- ret = my_handle_response_storage_release(dev_p, rqt, resp) ;
- break ;
+ ret = my_handle_response_storage_release(dev_p, rqt, resp);
+ break;
case CY_RQT_QUERY_MEDIA:
- cy_as_hal_assert(cy_false) ;/* Not used any more. */
- break ;
+ cy_as_hal_assert(cy_false);/* Not used any more. */
+ break;
case CY_RQT_QUERY_BUS:
- cy_as_hal_assert(node->data != 0) ;
+ cy_as_hal_assert(node->data != 0);
ret = my_handle_response_storage_query_bus(dev_p,
- rqt, resp, (uint32_t *)node->data) ;
- break ;
+ rqt, resp, (uint32_t *)node->data);
+ break;
case CY_RQT_QUERY_DEVICE:
- cy_as_hal_assert(node->data != 0) ;
+ cy_as_hal_assert(node->data != 0);
ret = my_handle_response_storage_query_device(dev_p,
- rqt, resp, node->data) ;
- break ;
+ rqt, resp, node->data);
+ break;
case CY_RQT_QUERY_UNIT:
- cy_as_hal_assert(node->data != 0) ;
+ cy_as_hal_assert(node->data != 0);
ret = my_handle_response_storage_query_unit(dev_p,
- rqt, resp, node->data) ;
- break ;
+ rqt, resp, node->data);
+ break;
case CY_RQT_SD_INTERFACE_CONTROL:
- ret = my_handle_response_no_data(dev_p, rqt, resp) ;
- break ;
+ ret = my_handle_response_no_data(dev_p, rqt, resp);
+ break;
case CY_RQT_SD_REGISTER_READ:
- cy_as_hal_assert(node->data != 0) ;
+ cy_as_hal_assert(node->data != 0);
ret = my_handle_response_sd_reg_read(dev_p, rqt, resp,
- (cy_as_storage_sd_reg_read_data *)node->data) ;
- break ;
+ (cy_as_storage_sd_reg_read_data *)node->data);
+ break;
case CY_RQT_PARTITION_STORAGE:
ret = my_handle_response_no_data(dev_p, rqt, resp);
- break ;
+ break;
case CY_RQT_PARTITION_ERASE:
- ret = my_handle_response_no_data(dev_p, rqt, resp) ;
- break ;
+ ret = my_handle_response_no_data(dev_p, rqt, resp);
+ break;
case CY_RQT_GET_TRANSFER_AMOUNT:
- cy_as_hal_assert(node->data != 0) ;
+ cy_as_hal_assert(node->data != 0);
ret = my_handle_response_get_transfer_amount(dev_p,
- rqt, resp, (cy_as_m_s_c_progress_data *)node->data) ;
- break ;
+ rqt, resp, (cy_as_m_s_c_progress_data *)node->data);
+ break;
case CY_RQT_ERASE:
- ret = my_handle_response_no_data(dev_p, rqt, resp) ;
+ ret = my_handle_response_no_data(dev_p, rqt, resp);
/* If error = "invalid response", this (very likely)
* means that we are not using the SD-only firmware
@@ -2813,12 +2813,12 @@ cy_as_storage_func_callback(cy_as_device *dev_p,
if (ret == CY_AS_ERROR_INVALID_RESPONSE)
ret = CY_AS_ERROR_NOT_SUPPORTED;
- break ;
+ break;
default:
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
- cy_as_hal_assert(cy_false) ;
- break ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
+ cy_as_hal_assert(cy_false);
+ break;
}
/*
@@ -2827,13 +2827,13 @@ cy_as_storage_func_callback(cy_as_device *dev_p,
* based on the response from firmware.
*/
if (stat == CY_AS_ERROR_SUCCESS)
- stat = ret ;
+ stat = ret;
/* Call the user callback, if there is one */
if (node->cb_p)
node->cb_p((cy_as_device_handle)dev_p, stat,
- node->client_data, node->data_type, node->data) ;
- cy_as_remove_c_b_node(dev_p->func_cbs_stor) ;
+ node->client_data, node->data_type, node->data);
+ cy_as_remove_c_b_node(dev_p->func_cbs_stor);
}
@@ -2845,34 +2845,34 @@ cy_as_sdio_sync_reply_callback(
cy_as_ll_request_response *resp,
cy_as_return_status_t ret)
{
- (void)rqt ;
+ (void)rqt;
if ((cy_as_ll_request_response__get_code(resp) ==
CY_RESP_SDIO_GET_TUPLE) ||
(cy_as_ll_request_response__get_code(resp) ==
CY_RESP_SDIO_EXT)) {
- ret = cy_as_ll_request_response__get_word(resp, 0) ;
+ ret = cy_as_ll_request_response__get_word(resp, 0);
if ((ret & 0x00FF) != CY_AS_ERROR_SUCCESS) {
if (cy_as_ll_request_response__get_code(rqt) ==
CY_RQT_SDIO_READ_EXTENDED)
cy_as_dma_cancel(dev_p,
- dev_p->storage_read_endpoint, ret) ;
+ dev_p->storage_read_endpoint, ret);
else
cy_as_dma_cancel(dev_p,
- dev_p->storage_write_endpoint, ret) ;
+ dev_p->storage_write_endpoint, ret);
}
} else {
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
}
dev_p->storage_rw_resp_p = resp;
- dev_p->storage_wait = cy_false ;
+ dev_p->storage_wait = cy_false;
if (((ret & 0x00FF) == CY_AS_ERROR_IO_ABORTED) || ((ret & 0x00FF)
== CY_AS_ERROR_IO_SUSPENDED))
dev_p->storage_error = (ret & 0x00FF);
else
dev_p->storage_error = (ret & 0x00FF) ?
- CY_AS_ERROR_INVALID_RESPONSE : CY_AS_ERROR_SUCCESS ;
+ CY_AS_ERROR_INVALID_RESPONSE : CY_AS_ERROR_SUCCESS;
/* Wake any threads/processes that are waiting on
* the read/write completion. */
@@ -2886,18 +2886,18 @@ cy_as_sdio_device_check(
uint32_t device)
{
if (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE))
- return CY_AS_ERROR_INVALID_HANDLE ;
+ return CY_AS_ERROR_INVALID_HANDLE;
if (bus < 0 || bus >= CY_AS_MAX_BUSES)
- return CY_AS_ERROR_NO_SUCH_BUS ;
+ return CY_AS_ERROR_NO_SUCH_BUS;
if (device >= CY_AS_MAX_STORAGE_DEVICES)
- return CY_AS_ERROR_NO_SUCH_DEVICE ;
+ return CY_AS_ERROR_NO_SUCH_DEVICE;
if (!cy_as_device_is_astoria_dev(dev_p))
- return CY_AS_ERROR_NOT_SUPPORTED ;
+ return CY_AS_ERROR_NOT_SUPPORTED;
- return (is_storage_active(dev_p)) ;
+ return (is_storage_active(dev_p));
}
cy_as_return_status_t
@@ -2912,15 +2912,15 @@ cy_as_sdio_direct_io(
uint8_t is_write,
uint8_t *data_p)
{
- cy_as_ll_request_response *req_p , *reply_p ;
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
+ cy_as_ll_request_response *req_p , *reply_p;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
uint16_t resp_data;
/*
* sanity checks required before sending the request to the
* firmware.
*/
- cy_as_device *dev_p = (cy_as_device *)handle ;
+ cy_as_device *dev_p = (cy_as_device *)handle;
ret = cy_as_sdio_device_check(dev_p, bus, device);
if (ret != CY_AS_ERROR_SUCCESS)
return ret;
@@ -2934,14 +2934,14 @@ cy_as_sdio_direct_io(
req_p = cy_as_ll_create_request(dev_p, (is_write == cy_true) ?
CY_RQT_SDIO_WRITE_DIRECT : CY_RQT_SDIO_READ_DIRECT,
- CY_RQT_STORAGE_RQT_CONTEXT, 3) ;
+ CY_RQT_STORAGE_RQT_CONTEXT, 3);
if (req_p == 0)
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ return CY_AS_ERROR_OUT_OF_MEMORY;
/*Setting up request*/
cy_as_ll_request_response__set_word(req_p, 0,
- create_address(bus, (uint8_t)device, n_function_no)) ;
+ create_address(bus, (uint8_t)device, n_function_no));
/* D1 */
if (is_write == cy_true) {
cy_as_ll_request_response__set_word(req_p, 1,
@@ -2956,39 +2956,39 @@ cy_as_sdio_direct_io(
}
/* D2 */
cy_as_ll_request_response__set_word(req_p, 2,
- ((uint16_t)((address&0x00007fff)<<1))) ;
+ ((uint16_t)((address&0x00007fff)<<1)));
/*Create response*/
- reply_p = cy_as_ll_create_response(dev_p, 2) ;
+ reply_p = cy_as_ll_create_response(dev_p, 2);
if (reply_p == 0) {
- cy_as_ll_destroy_request(dev_p, req_p) ;
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ return CY_AS_ERROR_OUT_OF_MEMORY;
}
/*Sending the request*/
- ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p) ;
+ ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
/*Check reply type*/
if (cy_as_ll_request_response__get_code(reply_p) ==
CY_RESP_SDIO_DIRECT) {
- resp_data = cy_as_ll_request_response__get_word(reply_p, 0) ;
+ resp_data = cy_as_ll_request_response__get_word(reply_p, 0);
if (resp_data >> 8)
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
else if (data_p != 0)
*(uint8_t *)(data_p) = (uint8_t)(resp_data&0x00ff);
} else {
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
}
destroy:
if (req_p != 0)
- cy_as_ll_destroy_request(dev_p, req_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
if (reply_p != 0)
- cy_as_ll_destroy_response(dev_p, reply_p) ;
- return ret ;
+ cy_as_ll_destroy_response(dev_p, reply_p);
+ return ret;
}
@@ -3035,16 +3035,16 @@ cy_as_sdio_extended_i_o(
uint8_t *data_p ,
uint8_t is_resume)
{
- cy_as_ll_request_response *req_p , *reply_p ;
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
+ cy_as_ll_request_response *req_p , *reply_p;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
uint8_t resp_type;
uint8_t reqtype;
uint16_t resp_data;
- cy_as_context *ctxt_p ;
+ cy_as_context *ctxt_p;
uint32_t dmasize, loopcount = 200;
cy_as_end_point_number_t ep;
- cy_as_device *dev_p = (cy_as_device *)handle ;
+ cy_as_device *dev_p = (cy_as_device *)handle;
ret = cy_as_sdio_device_check(dev_p, bus, device);
if (ret != CY_AS_ERROR_SUCCESS)
return ret;
@@ -3058,7 +3058,7 @@ cy_as_sdio_extended_i_o(
if ((cy_as_device_is_storage_async_pending(dev_p)) ||
(dev_p->storage_wait))
- return CY_AS_ERROR_ASYNC_PENDING ;
+ return CY_AS_ERROR_ASYNC_PENDING;
/* Request for 0 bytes of blocks is returned as a success*/
if (argument == 0)
@@ -3073,12 +3073,12 @@ cy_as_sdio_extended_i_o(
ep = dev_p->storage_read_endpoint;
}
- req_p = dev_p->storage_rw_req_p ;
- cy_as_ll_init_request(req_p, reqtype, CY_RQT_STORAGE_RQT_CONTEXT, 3) ;
+ req_p = dev_p->storage_rw_req_p;
+ cy_as_ll_init_request(req_p, reqtype, CY_RQT_STORAGE_RQT_CONTEXT, 3);
/* Initialise the space for reply from the Antioch. */
- reply_p = dev_p->storage_rw_resp_p ;
- cy_as_ll_init_response(reply_p, 2) ;
+ reply_p = dev_p->storage_rw_resp_p;
+ cy_as_ll_init_response(reply_p, 2);
/* Setup the DMA request */
if (!(misc_buf&CY_SDIO_BLOCKMODE)) {
@@ -3101,61 +3101,61 @@ cy_as_sdio_extended_i_o(
ret = cy_as_dma_queue_request(dev_p, ep, (void *)(data_p),
dmasize, cy_false, (is_write & cy_true) ? cy_false :
- cy_true, cy_as_sync_storage_callback) ;
+ cy_true, cy_as_sync_storage_callback);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
cy_as_ll_request_response__set_word(req_p, 0,
create_address(bus, (uint8_t)device,
- n_function_no | ((is_resume) ? 0x80 : 0x00))) ;
+ n_function_no | ((is_resume) ? 0x80 : 0x00)));
cy_as_ll_request_response__set_word(req_p, 1,
((uint16_t)n_function_no)<<12|
((uint16_t)(misc_buf & (CY_SDIO_BLOCKMODE|CY_SDIO_OP_INCR)))
<< 9 | (uint16_t)(address >> 7) |
- ((is_write == cy_true) ? 0x8000 : 0x0000)) ;
+ ((is_write == cy_true) ? 0x8000 : 0x0000));
cy_as_ll_request_response__set_word(req_p, 2,
- ((uint16_t)(address&0x0000ffff) << 9) | argument) ;
+ ((uint16_t)(address&0x0000ffff) << 9) | argument);
/* Send the request and wait for completion of storage request */
- dev_p->storage_wait = cy_true ;
+ dev_p->storage_wait = cy_true;
ret = cy_as_ll_send_request(dev_p, req_p, reply_p,
- cy_true, cy_as_sdio_sync_reply_callback) ;
+ cy_true, cy_as_sdio_sync_reply_callback);
if (ret != CY_AS_ERROR_SUCCESS) {
- cy_as_dma_cancel(dev_p, ep, CY_AS_ERROR_CANCELED) ;
+ cy_as_dma_cancel(dev_p, ep, CY_AS_ERROR_CANCELED);
} else {
/* Setup the DMA request */
- ctxt_p = dev_p->context[CY_RQT_STORAGE_RQT_CONTEXT] ;
- ret = cy_as_dma_drain_queue(dev_p, ep, cy_true) ;
+ ctxt_p = dev_p->context[CY_RQT_STORAGE_RQT_CONTEXT];
+ ret = cy_as_dma_drain_queue(dev_p, ep, cy_true);
while (loopcount-- > 0) {
if (dev_p->storage_wait == cy_false)
break;
- cy_as_hal_sleep_on(&ctxt_p->channel, 10) ;
+ cy_as_hal_sleep_on(&ctxt_p->channel, 10);
}
if (dev_p->storage_wait == cy_true) {
- dev_p->storage_wait = cy_false ;
- cy_as_ll_remove_request(dev_p, ctxt_p, req_p, cy_true) ;
- dev_p->storage_error = CY_AS_ERROR_TIMEOUT ;
+ dev_p->storage_wait = cy_false;
+ cy_as_ll_remove_request(dev_p, ctxt_p, req_p, cy_true);
+ dev_p->storage_error = CY_AS_ERROR_TIMEOUT;
}
ret = dev_p->storage_error;
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
resp_type = cy_as_ll_request_response__get_code(
- dev_p->storage_rw_resp_p) ;
+ dev_p->storage_rw_resp_p);
if (resp_type == CY_RESP_SDIO_EXT) {
resp_data = cy_as_ll_request_response__get_word
- (reply_p, 0)&0x00ff ;
+ (reply_p, 0)&0x00ff;
if (resp_data)
- ret = CY_AS_ERROR_INVALID_REQUEST ;
+ ret = CY_AS_ERROR_INVALID_REQUEST;
} else {
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
}
}
return ret;
@@ -3170,54 +3170,54 @@ cy_as_sdio_async_reply_callback(
cy_as_ll_request_response *resp,
cy_as_return_status_t ret)
{
- cy_as_storage_callback cb_ms ;
- uint8_t reqtype ;
+ cy_as_storage_callback cb_ms;
+ uint8_t reqtype;
uint32_t pendingblocks;
- (void)rqt ;
- (void)context ;
+ (void)rqt;
+ (void)context;
pendingblocks = 0;
- reqtype = cy_as_ll_request_response__get_code(rqt) ;
+ reqtype = cy_as_ll_request_response__get_code(rqt);
if (ret == CY_AS_ERROR_SUCCESS) {
if ((cy_as_ll_request_response__get_code(resp) ==
CY_RESP_SUCCESS_FAILURE) ||
(cy_as_ll_request_response__get_code(resp) ==
CY_RESP_SDIO_EXT)) {
- ret = cy_as_ll_request_response__get_word(resp, 0) ;
- ret &= 0x00FF ;
+ ret = cy_as_ll_request_response__get_word(resp, 0);
+ ret &= 0x00FF;
} else {
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
}
}
if (ret != CY_AS_ERROR_SUCCESS) {
if (reqtype == CY_RQT_SDIO_READ_EXTENDED)
cy_as_dma_cancel(dev_p,
- dev_p->storage_read_endpoint, ret) ;
+ dev_p->storage_read_endpoint, ret);
else
cy_as_dma_cancel(dev_p,
- dev_p->storage_write_endpoint, ret) ;
+ dev_p->storage_write_endpoint, ret);
dev_p->storage_error = ret;
}
- dev_p->storage_wait = cy_false ;
+ dev_p->storage_wait = cy_false;
/*
* if the DMA callback has already been called,
* the user callback has to be called from here.
*/
if (!cy_as_device_is_storage_async_pending(dev_p)) {
- cy_as_hal_assert(dev_p->storage_cb_ms != NULL) ;
- cb_ms = dev_p->storage_cb_ms ;
+ cy_as_hal_assert(dev_p->storage_cb_ms != NULL);
+ cb_ms = dev_p->storage_cb_ms;
- dev_p->storage_cb = 0 ;
- dev_p->storage_cb_ms = 0 ;
+ dev_p->storage_cb = 0;
+ dev_p->storage_cb_ms = 0;
if ((ret == CY_AS_ERROR_SUCCESS) ||
(ret == CY_AS_ERROR_IO_ABORTED) ||
(ret == CY_AS_ERROR_IO_SUSPENDED)) {
- ret = dev_p->storage_error ;
+ ret = dev_p->storage_error;
pendingblocks = ((uint32_t)
cy_as_ll_request_response__get_word
(resp, 1)) << 16;
@@ -3227,9 +3227,9 @@ cy_as_sdio_async_reply_callback(
cb_ms((cy_as_device_handle)dev_p, dev_p->storage_bus_index,
dev_p->storage_device_index,
(dev_p->storage_unit | pendingblocks),
- dev_p->storage_block_addr, dev_p->storage_oper, ret) ;
+ dev_p->storage_block_addr, dev_p->storage_oper, ret);
} else
- dev_p->storage_error = ret ;
+ dev_p->storage_error = ret;
}
@@ -3247,13 +3247,13 @@ cy_as_sdio_extended_i_o_async(
cy_as_storage_callback callback)
{
- uint32_t mask ;
+ uint32_t mask;
uint32_t dmasize;
- cy_as_ll_request_response *req_p , *reply_p ;
+ cy_as_ll_request_response *req_p , *reply_p;
uint8_t reqtype;
cy_as_end_point_number_t ep;
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
- cy_as_device *dev_p = (cy_as_device *)handle ;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
+ cy_as_device *dev_p = (cy_as_device *)handle;
ret = cy_as_sdio_device_check(dev_p, bus, device);
if (ret != CY_AS_ERROR_SUCCESS)
@@ -3266,7 +3266,7 @@ cy_as_sdio_extended_i_o_async(
return CY_AS_ERROR_FUNCTION_SUSPENDED;
if (callback == 0)
- return CY_AS_ERROR_NULL_CALLBACK ;
+ return CY_AS_ERROR_NULL_CALLBACK;
/* We are supposed to return sucess if the number of
* blocks is zero
@@ -3274,8 +3274,8 @@ cy_as_sdio_extended_i_o_async(
if (((misc_buf&CY_SDIO_BLOCKMODE) != 0) && (argument == 0)) {
callback(handle, bus, device, n_function_no, address,
((is_write) ? cy_as_op_write : cy_as_op_read),
- CY_AS_ERROR_SUCCESS) ;
- return CY_AS_ERROR_SUCCESS ;
+ CY_AS_ERROR_SUCCESS);
+ return CY_AS_ERROR_SUCCESS;
}
@@ -3285,25 +3285,25 @@ cy_as_sdio_extended_i_o_async(
* operations going at one time and protect this test and
* set operation from interrupts.
*/
- mask = cy_as_hal_disable_interrupts() ;
+ mask = cy_as_hal_disable_interrupts();
if ((cy_as_device_is_storage_async_pending(dev_p)) ||
(dev_p->storage_wait)) {
- cy_as_hal_enable_interrupts(mask) ;
- return CY_AS_ERROR_ASYNC_PENDING ;
+ cy_as_hal_enable_interrupts(mask);
+ return CY_AS_ERROR_ASYNC_PENDING;
}
- cy_as_device_set_storage_async_pending(dev_p) ;
- cy_as_hal_enable_interrupts(mask) ;
+ cy_as_device_set_storage_async_pending(dev_p);
+ cy_as_hal_enable_interrupts(mask);
/*
* storage information about the currently
* outstanding request
*/
- dev_p->storage_cb_ms = callback ;
- dev_p->storage_bus_index = bus ;
- dev_p->storage_device_index = device ;
- dev_p->storage_unit = n_function_no ;
- dev_p->storage_block_addr = address ;
+ dev_p->storage_cb_ms = callback;
+ dev_p->storage_bus_index = bus;
+ dev_p->storage_device_index = device;
+ dev_p->storage_unit = n_function_no;
+ dev_p->storage_block_addr = address;
if (is_write == cy_true) {
reqtype = CY_RQT_SDIO_WRITE_EXTENDED;
@@ -3314,13 +3314,13 @@ cy_as_sdio_extended_i_o_async(
}
/* Initialise the request to send to the West Bridge. */
- req_p = dev_p->storage_rw_req_p ;
+ req_p = dev_p->storage_rw_req_p;
cy_as_ll_init_request(req_p, reqtype,
- CY_RQT_STORAGE_RQT_CONTEXT, 3) ;
+ CY_RQT_STORAGE_RQT_CONTEXT, 3);
/* Initialise the space for reply from the West Bridge. */
- reply_p = dev_p->storage_rw_resp_p ;
- cy_as_ll_init_response(reply_p, 2) ;
+ reply_p = dev_p->storage_rw_resp_p;
+ cy_as_ll_init_response(reply_p, 2);
if (!(misc_buf&CY_SDIO_BLOCKMODE)) {
if (argument >
@@ -3343,42 +3343,42 @@ cy_as_sdio_extended_i_o_async(
if (reqtype == CY_RQT_SDIO_READ_EXTENDED) {
ret = cy_as_dma_queue_request(dev_p, ep,
(void *)data_p, dmasize , cy_false, cy_true,
- cy_as_async_storage_callback) ;
- dev_p->storage_oper = cy_as_op_read ;
+ cy_as_async_storage_callback);
+ dev_p->storage_oper = cy_as_op_read;
} else if (reqtype == CY_RQT_SDIO_WRITE_EXTENDED) {
ret = cy_as_dma_queue_request(dev_p, ep, (void *)data_p,
- dmasize, cy_false, cy_false, cy_as_async_storage_callback) ;
- dev_p->storage_oper = cy_as_op_write ;
+ dmasize, cy_false, cy_false, cy_as_async_storage_callback);
+ dev_p->storage_oper = cy_as_op_write;
}
if (ret != CY_AS_ERROR_SUCCESS) {
- cy_as_device_clear_storage_async_pending(dev_p) ;
- return ret ;
+ cy_as_device_clear_storage_async_pending(dev_p);
+ return ret;
}
cy_as_ll_request_response__set_word(req_p, 0,
- create_address(bus, (uint8_t)device, n_function_no)) ;
+ create_address(bus, (uint8_t)device, n_function_no));
cy_as_ll_request_response__set_word(req_p, 1,
((uint16_t)n_function_no) << 12 |
((uint16_t)(misc_buf & (CY_SDIO_BLOCKMODE | CY_SDIO_OP_INCR)))
<< 9 | (uint16_t)(address>>7) |
- ((is_write == cy_true) ? 0x8000 : 0x0000)) ;
+ ((is_write == cy_true) ? 0x8000 : 0x0000));
cy_as_ll_request_response__set_word(req_p, 2,
- ((uint16_t)(address&0x0000ffff) << 9) | argument) ;
+ ((uint16_t)(address&0x0000ffff) << 9) | argument);
/* Send the request and wait for completion of storage request */
- dev_p->storage_wait = cy_true ;
+ dev_p->storage_wait = cy_true;
ret = cy_as_ll_send_request(dev_p, req_p, reply_p, cy_true,
- cy_as_sdio_async_reply_callback) ;
+ cy_as_sdio_async_reply_callback);
if (ret != CY_AS_ERROR_SUCCESS) {
- cy_as_dma_cancel(dev_p, ep, CY_AS_ERROR_CANCELED) ;
- cy_as_device_clear_storage_async_pending(dev_p) ;
+ cy_as_dma_cancel(dev_p, ep, CY_AS_ERROR_CANCELED);
+ cy_as_device_clear_storage_async_pending(dev_p);
} else {
- cy_as_dma_kick_start(dev_p, ep) ;
+ cy_as_dma_kick_start(dev_p, ep);
}
- return ret ;
+ return ret;
}
/* CMD53 Extended Read*/
@@ -3439,13 +3439,13 @@ cy_as_sdio_get_c_i_s_info(
uint8_t *data_p)
{
- cy_as_ll_request_response *req_p , *reply_p ;
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
+ cy_as_ll_request_response *req_p , *reply_p;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
uint16_t resp_data;
- cy_as_context *ctxt_p ;
+ cy_as_context *ctxt_p;
uint32_t loopcount = 200;
- cy_as_device *dev_p = (cy_as_device *)handle ;
+ cy_as_device *dev_p = (cy_as_device *)handle;
ret = cy_as_sdio_device_check(dev_p, bus, device);
if (ret != CY_AS_ERROR_SUCCESS)
@@ -3456,73 +3456,73 @@ cy_as_sdio_get_c_i_s_info(
if ((cy_as_device_is_storage_async_pending(dev_p)) ||
(dev_p->storage_wait))
- return CY_AS_ERROR_ASYNC_PENDING ;
+ return CY_AS_ERROR_ASYNC_PENDING;
/* Initialise the request to send to the Antioch. */
- req_p = dev_p->storage_rw_req_p ;
+ req_p = dev_p->storage_rw_req_p;
cy_as_ll_init_request(req_p, CY_RQT_SDIO_GET_TUPLE,
- CY_RQT_STORAGE_RQT_CONTEXT, 2) ;
+ CY_RQT_STORAGE_RQT_CONTEXT, 2);
/* Initialise the space for reply from the Antioch. */
- reply_p = dev_p->storage_rw_resp_p ;
- cy_as_ll_init_response(reply_p, 3) ;
+ reply_p = dev_p->storage_rw_resp_p;
+ cy_as_ll_init_response(reply_p, 3);
/* Setup the DMA request */
ret = cy_as_dma_queue_request(dev_p, dev_p->storage_read_endpoint,
- data_p+1, 255, cy_false, cy_true, cy_as_sync_storage_callback) ;
+ data_p+1, 255, cy_false, cy_true, cy_as_sync_storage_callback);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
cy_as_ll_request_response__set_word(req_p, 0,
- create_address(bus, (uint8_t)device, n_function_no)) ;
+ create_address(bus, (uint8_t)device, n_function_no));
/* Set tuple id to fetch. */
- cy_as_ll_request_response__set_word(req_p, 1, tuple_id<<8) ;
+ cy_as_ll_request_response__set_word(req_p, 1, tuple_id<<8);
/* Send the request and wait for completion of storage request */
- dev_p->storage_wait = cy_true ;
+ dev_p->storage_wait = cy_true;
ret = cy_as_ll_send_request(dev_p, req_p, reply_p, cy_true,
- cy_as_sdio_sync_reply_callback) ;
+ cy_as_sdio_sync_reply_callback);
if (ret != CY_AS_ERROR_SUCCESS) {
cy_as_dma_cancel(dev_p,
- dev_p->storage_read_endpoint, CY_AS_ERROR_CANCELED) ;
+ dev_p->storage_read_endpoint, CY_AS_ERROR_CANCELED);
} else {
/* Setup the DMA request */
- ctxt_p = dev_p->context[CY_RQT_STORAGE_RQT_CONTEXT] ;
+ ctxt_p = dev_p->context[CY_RQT_STORAGE_RQT_CONTEXT];
ret = cy_as_dma_drain_queue(dev_p,
- dev_p->storage_read_endpoint, cy_true) ;
+ dev_p->storage_read_endpoint, cy_true);
while (loopcount-- > 0) {
if (dev_p->storage_wait == cy_false)
break;
- cy_as_hal_sleep_on(&ctxt_p->channel, 10) ;
+ cy_as_hal_sleep_on(&ctxt_p->channel, 10);
}
if (dev_p->storage_wait == cy_true) {
- dev_p->storage_wait = cy_false ;
- cy_as_ll_remove_request(dev_p, ctxt_p, req_p, cy_true) ;
- return CY_AS_ERROR_TIMEOUT ;
+ dev_p->storage_wait = cy_false;
+ cy_as_ll_remove_request(dev_p, ctxt_p, req_p, cy_true);
+ return CY_AS_ERROR_TIMEOUT;
}
- ret = dev_p->storage_error ;
+ ret = dev_p->storage_error;
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
if (cy_as_ll_request_response__get_code
(dev_p->storage_rw_resp_p) == CY_RESP_SDIO_GET_TUPLE) {
resp_data = cy_as_ll_request_response__get_word
- (reply_p, 0) ;
+ (reply_p, 0);
if (resp_data) {
- ret = CY_AS_ERROR_INVALID_REQUEST ;
+ ret = CY_AS_ERROR_INVALID_REQUEST;
} else if (data_p != 0)
*(uint8_t *)data_p = (uint8_t)
(cy_as_ll_request_response__get_word
(reply_p, 0)&0x00ff);
} else {
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
}
}
return ret;
@@ -3536,11 +3536,11 @@ cy_as_sdio_query_card(
uint32_t device,
cy_as_sdio_card *data_p)
{
- cy_as_ll_request_response *req_p , *reply_p ;
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
+ cy_as_ll_request_response *req_p , *reply_p;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
uint8_t resp_type;
- cy_as_device *dev_p = (cy_as_device *)handle ;
+ cy_as_device *dev_p = (cy_as_device *)handle;
ret = cy_as_sdio_device_check(dev_p, bus, device);
if (ret != CY_AS_ERROR_SUCCESS)
@@ -3551,24 +3551,24 @@ cy_as_sdio_query_card(
cy_as_hal_mem_set(&dev_p->sdiocard[bus], 0, sizeof(cy_as_sdio_device));
req_p = cy_as_ll_create_request(dev_p, CY_RQT_SDIO_QUERY_CARD,
- CY_RQT_STORAGE_RQT_CONTEXT, 1) ;
+ CY_RQT_STORAGE_RQT_CONTEXT, 1);
if (req_p == 0)
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ return CY_AS_ERROR_OUT_OF_MEMORY;
cy_as_ll_request_response__set_word(req_p, 0,
- create_address(bus, (uint8_t)device, 0)) ;
+ create_address(bus, (uint8_t)device, 0));
- reply_p = cy_as_ll_create_response(dev_p, 5) ;
+ reply_p = cy_as_ll_create_response(dev_p, 5);
if (reply_p == 0) {
- cy_as_ll_destroy_request(dev_p, req_p) ;
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ return CY_AS_ERROR_OUT_OF_MEMORY;
}
ret = cy_as_ll_send_request_wait_reply(dev_p,
- req_p, reply_p) ;
+ req_p, reply_p);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
resp_type = cy_as_ll_request_response__get_code(reply_p);
if (resp_type == CY_RESP_SDIO_QUERY_CARD) {
@@ -3606,16 +3606,16 @@ cy_as_sdio_query_card(
dev_p->sdiocard[bus].card.sdio_version;
} else {
if (resp_type == CY_RESP_SUCCESS_FAILURE)
- ret = cy_as_ll_request_response__get_word(reply_p, 0) ;
+ ret = cy_as_ll_request_response__get_word(reply_p, 0);
else
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
}
destroy:
if (req_p != 0)
- cy_as_ll_destroy_request(dev_p, req_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
if (reply_p != 0)
- cy_as_ll_destroy_response(dev_p, reply_p) ;
- return ret ;
+ cy_as_ll_destroy_response(dev_p, reply_p);
+ return ret;
}
/*Reset SDIO card. */
@@ -3626,10 +3626,10 @@ cy_as_sdio_reset_card(
uint32_t device)
{
- cy_as_ll_request_response *req_p , *reply_p ;
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
+ cy_as_ll_request_response *req_p , *reply_p;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
uint8_t resp_type;
- cy_as_device *dev_p = (cy_as_device *)handle ;
+ cy_as_device *dev_p = (cy_as_device *)handle;
ret = cy_as_sdio_device_check(dev_p, bus, device);
@@ -3642,42 +3642,42 @@ cy_as_sdio_reset_card(
}
req_p = cy_as_ll_create_request(dev_p, CY_RQT_SDIO_RESET_DEV,
- CY_RQT_STORAGE_RQT_CONTEXT, 1) ;
+ CY_RQT_STORAGE_RQT_CONTEXT, 1);
if (req_p == 0)
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ return CY_AS_ERROR_OUT_OF_MEMORY;
/*Setup mailbox */
cy_as_ll_request_response__set_word(req_p, 0,
- create_address(bus, (uint8_t)device, 0)) ;
+ create_address(bus, (uint8_t)device, 0));
- reply_p = cy_as_ll_create_response(dev_p, 2) ;
+ reply_p = cy_as_ll_create_response(dev_p, 2);
if (reply_p == 0) {
- cy_as_ll_destroy_request(dev_p, req_p) ;
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ return CY_AS_ERROR_OUT_OF_MEMORY;
}
ret = cy_as_ll_send_request_wait_reply(dev_p,
- req_p, reply_p) ;
+ req_p, reply_p);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
- resp_type = cy_as_ll_request_response__get_code(reply_p) ;
+ resp_type = cy_as_ll_request_response__get_code(reply_p);
if (resp_type == CY_RESP_SUCCESS_FAILURE) {
- ret = cy_as_ll_request_response__get_word(reply_p, 0) ;
+ ret = cy_as_ll_request_response__get_word(reply_p, 0);
if (ret == CY_AS_ERROR_SUCCESS)
ret = cy_as_sdio_query_card(handle, bus, device, 0);
} else
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
destroy:
if (req_p != 0)
- cy_as_ll_destroy_request(dev_p, req_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
if (reply_p != 0)
- cy_as_ll_destroy_response(dev_p, reply_p) ;
- return ret ;
+ cy_as_ll_destroy_response(dev_p, reply_p);
+ return ret;
}
/* Initialise an IO function*/
@@ -3689,10 +3689,10 @@ cy_as_sdio_init_function(
uint8_t n_function_no,
uint8_t misc_buf)
{
- cy_as_ll_request_response *req_p , *reply_p ;
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
+ cy_as_ll_request_response *req_p , *reply_p;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
uint8_t resp_type;
- cy_as_device *dev_p = (cy_as_device *)handle ;
+ cy_as_device *dev_p = (cy_as_device *)handle;
ret = cy_as_sdio_device_check(dev_p, bus, device);
@@ -3713,25 +3713,25 @@ cy_as_sdio_init_function(
}
req_p = cy_as_ll_create_request(dev_p,
- CY_RQT_SDIO_INIT_FUNCTION, CY_RQT_STORAGE_RQT_CONTEXT, 1) ;
+ CY_RQT_SDIO_INIT_FUNCTION, CY_RQT_STORAGE_RQT_CONTEXT, 1);
if (req_p == 0)
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ return CY_AS_ERROR_OUT_OF_MEMORY;
cy_as_ll_request_response__set_word(req_p, 0,
- create_address(bus, (uint8_t)device, n_function_no)) ;
+ create_address(bus, (uint8_t)device, n_function_no));
- reply_p = cy_as_ll_create_response(dev_p, 5) ;
+ reply_p = cy_as_ll_create_response(dev_p, 5);
if (reply_p == 0) {
- cy_as_ll_destroy_request(dev_p, req_p) ;
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ return CY_AS_ERROR_OUT_OF_MEMORY;
}
- ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p) ;
+ ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
- resp_type = cy_as_ll_request_response__get_code(reply_p) ;
+ resp_type = cy_as_ll_request_response__get_code(reply_p);
if (resp_type == CY_RESP_SDIO_INIT_FUNCTION) {
dev_p->sdiocard[bus].function[n_function_no-1].function_code =
@@ -3755,17 +3755,17 @@ cy_as_sdio_init_function(
} else {
if (resp_type == CY_RESP_SUCCESS_FAILURE)
- ret = cy_as_ll_request_response__get_word(reply_p, 0) ;
+ ret = cy_as_ll_request_response__get_word(reply_p, 0);
else
- ret = CY_AS_ERROR_INVALID_FUNCTION ;
+ ret = CY_AS_ERROR_INVALID_FUNCTION;
}
destroy:
if (req_p != 0)
- cy_as_ll_destroy_request(dev_p, req_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
if (reply_p != 0)
- cy_as_ll_destroy_response(dev_p, reply_p) ;
- return ret ;
+ cy_as_ll_destroy_response(dev_p, reply_p);
+ return ret;
}
/*Query individual functions. */
@@ -3777,7 +3777,7 @@ cy_as_sdio_query_function(
uint8_t n_function_no,
cy_as_sdio_func *data_p)
{
- cy_as_device *dev_p = (cy_as_device *)handle ;
+ cy_as_device *dev_p = (cy_as_device *)handle;
cy_as_return_status_t ret;
ret = cy_as_sdio_device_check(dev_p, bus, device);
@@ -3815,10 +3815,10 @@ cy_as_sdio_abort_function(
uint32_t device,
uint8_t n_function_no)
{
- cy_as_ll_request_response *req_p , *reply_p ;
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
+ cy_as_ll_request_response *req_p , *reply_p;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
uint8_t resp_type;
- cy_as_device *dev_p = (cy_as_device *)handle ;
+ cy_as_device *dev_p = (cy_as_device *)handle;
ret = cy_as_sdio_device_check(dev_p, bus, device);
if (ret != CY_AS_ERROR_SUCCESS)
@@ -3836,39 +3836,39 @@ cy_as_sdio_abort_function(
}
req_p = cy_as_ll_create_request(dev_p, CY_RQT_SDIO_ABORT_IO,
- CY_RQT_GENERAL_RQT_CONTEXT, 1) ;
+ CY_RQT_GENERAL_RQT_CONTEXT, 1);
if (req_p == 0)
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ return CY_AS_ERROR_OUT_OF_MEMORY;
/*Setup mailbox */
cy_as_ll_request_response__set_word(req_p, 0,
- create_address(bus, (uint8_t)device, n_function_no)) ;
+ create_address(bus, (uint8_t)device, n_function_no));
- reply_p = cy_as_ll_create_response(dev_p, 2) ;
+ reply_p = cy_as_ll_create_response(dev_p, 2);
if (reply_p == 0) {
- cy_as_ll_destroy_request(dev_p, req_p) ;
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ return CY_AS_ERROR_OUT_OF_MEMORY;
}
- ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p) ;
+ ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
- resp_type = cy_as_ll_request_response__get_code(reply_p) ;
+ resp_type = cy_as_ll_request_response__get_code(reply_p);
if (resp_type == CY_RESP_SUCCESS_FAILURE)
- ret = cy_as_ll_request_response__get_word(reply_p, 0) ;
+ ret = cy_as_ll_request_response__get_word(reply_p, 0);
else
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
destroy:
if (req_p != 0)
- cy_as_ll_destroy_request(dev_p, req_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
if (reply_p != 0)
- cy_as_ll_destroy_response(dev_p, reply_p) ;
- return ret ;
+ cy_as_ll_destroy_response(dev_p, reply_p);
+ return ret;
}
/* Suspend IO to current function*/
@@ -3879,9 +3879,9 @@ cy_as_sdio_suspend(
uint32_t device,
uint8_t n_function_no)
{
- cy_as_ll_request_response *req_p , *reply_p ;
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
- cy_as_device *dev_p = (cy_as_device *)handle ;
+ cy_as_ll_request_response *req_p , *reply_p;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
+ cy_as_device *dev_p = (cy_as_device *)handle;
ret = cy_as_sdio_device_check(dev_p, bus, device);
if (ret != CY_AS_ERROR_SUCCESS)
@@ -3898,32 +3898,32 @@ cy_as_sdio_suspend(
return CY_AS_ERROR_FUNCTION_SUSPENDED;
req_p = cy_as_ll_create_request(dev_p,
- CY_RQT_SDIO_SUSPEND, CY_RQT_GENERAL_RQT_CONTEXT, 1) ;
+ CY_RQT_SDIO_SUSPEND, CY_RQT_GENERAL_RQT_CONTEXT, 1);
if (req_p == 0)
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ return CY_AS_ERROR_OUT_OF_MEMORY;
/*Setup mailbox */
cy_as_ll_request_response__set_word(req_p, 0,
- create_address(bus, (uint8_t)device, n_function_no)) ;
+ create_address(bus, (uint8_t)device, n_function_no));
- reply_p = cy_as_ll_create_response(dev_p, 2) ;
+ reply_p = cy_as_ll_create_response(dev_p, 2);
if (reply_p == 0) {
- cy_as_ll_destroy_request(dev_p, req_p) ;
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ return CY_AS_ERROR_OUT_OF_MEMORY;
}
- ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p) ;
+ ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p);
if (ret == CY_AS_ERROR_SUCCESS) {
- ret = cy_as_ll_request_response__get_code(reply_p) ;
+ ret = cy_as_ll_request_response__get_code(reply_p);
cy_as_sdio_set_function_suspended(handle, bus, n_function_no);
}
if (req_p != 0)
- cy_as_ll_destroy_request(dev_p, req_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
if (reply_p != 0)
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_response(dev_p, reply_p);
- return ret ;
+ return ret;
}
/*Resume suspended function*/
@@ -3939,9 +3939,9 @@ cy_as_sdio_resume(
uint8_t *data_p
)
{
- cy_as_ll_request_response *req_p , *reply_p ;
- cy_as_return_status_t resp_data, ret = CY_AS_ERROR_SUCCESS ;
- cy_as_device *dev_p = (cy_as_device *)handle ;
+ cy_as_ll_request_response *req_p , *reply_p;
+ cy_as_return_status_t resp_data, ret = CY_AS_ERROR_SUCCESS;
+ cy_as_device *dev_p = (cy_as_device *)handle;
ret = cy_as_sdio_device_check(dev_p, bus, device);
if (ret != CY_AS_ERROR_SUCCESS)
@@ -3961,27 +3961,27 @@ cy_as_sdio_resume(
return CY_AS_ERROR_INVALID_FUNCTION;
req_p = cy_as_ll_create_request(dev_p,
- CY_RQT_SDIO_RESUME, CY_RQT_STORAGE_RQT_CONTEXT, 1) ;
+ CY_RQT_SDIO_RESUME, CY_RQT_STORAGE_RQT_CONTEXT, 1);
if (req_p == 0)
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ return CY_AS_ERROR_OUT_OF_MEMORY;
/*Setup mailbox */
cy_as_ll_request_response__set_word(req_p, 0,
- create_address(bus, (uint8_t)device, n_function_no)) ;
+ create_address(bus, (uint8_t)device, n_function_no));
- reply_p = cy_as_ll_create_response(dev_p, 2) ;
+ reply_p = cy_as_ll_create_response(dev_p, 2);
if (reply_p == 0) {
- cy_as_ll_destroy_request(dev_p, req_p) ;
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ return CY_AS_ERROR_OUT_OF_MEMORY;
}
- ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p) ;
+ ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
if (cy_as_ll_request_response__get_code(reply_p) ==
CY_RESP_SDIO_RESUME) {
- resp_data = cy_as_ll_request_response__get_word(reply_p, 0) ;
+ resp_data = cy_as_ll_request_response__get_word(reply_p, 0);
if (resp_data & 0x00ff) {
/* Send extended read request to resume the read. */
if (op == cy_as_op_read) {
@@ -3997,16 +3997,16 @@ cy_as_sdio_resume(
ret = CY_AS_ERROR_SUCCESS;
}
} else {
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
}
destroy:
cy_as_sdio_clear_function_suspended(handle, bus, n_function_no);
if (req_p != 0)
- cy_as_ll_destroy_request(dev_p, req_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
if (reply_p != 0)
- cy_as_ll_destroy_response(dev_p, reply_p) ;
- return ret ;
+ cy_as_ll_destroy_response(dev_p, reply_p);
+ return ret;
}
@@ -4021,7 +4021,7 @@ cy_as_sdio_set_blocksize(
uint16_t blocksize)
{
cy_as_return_status_t ret;
- cy_as_device *dev_p = (cy_as_device *)handle ;
+ cy_as_device *dev_p = (cy_as_device *)handle;
ret = cy_as_sdio_device_check(dev_p, bus, device);
if (ret != CY_AS_ERROR_SUCCESS)
return ret;
diff --git a/drivers/staging/westbridge/astoria/api/src/cyasusb.c b/drivers/staging/westbridge/astoria/api/src/cyasusb.c
index d0ffc2cfe77..5a219701206 100644
--- a/drivers/staging/westbridge/astoria/api/src/cyasusb.c
+++ b/drivers/staging/westbridge/astoria/api/src/cyasusb.c
@@ -36,7 +36,7 @@ cy_as_usb_ack_setup_packet(
cy_as_function_callback cb,
/* Client supplied data */
uint32_t client
- ) ;
+ );
static void
cy_as_usb_func_callback(
@@ -44,21 +44,21 @@ cy_as_usb_func_callback(
uint8_t context,
cy_as_ll_request_response *rqt,
cy_as_ll_request_response *resp,
- cy_as_return_status_t ret) ;
+ cy_as_return_status_t ret);
/*
* Reset the USB EP0 state
*/
static void
cy_as_usb_reset_e_p0_state(cy_as_device *dev_p)
{
- cy_as_log_debug_message(6, "cy_as_usb_reset_e_p0_state called") ;
+ cy_as_log_debug_message(6, "cy_as_usb_reset_e_p0_state called");
- cy_as_device_clear_ack_delayed(dev_p) ;
- cy_as_device_clear_setup_packet(dev_p) ;
+ cy_as_device_clear_ack_delayed(dev_p);
+ cy_as_device_clear_setup_packet(dev_p);
if (cy_as_device_is_usb_async_pending(dev_p, 0))
- cy_as_usb_cancel_async((cy_as_device_handle)dev_p, 0) ;
+ cy_as_usb_cancel_async((cy_as_device_handle)dev_p, 0);
- dev_p->usb_pending_buffer = 0 ;
+ dev_p->usb_pending_buffer = 0;
}
/*
@@ -68,18 +68,18 @@ static cy_as_return_status_t
is_usb_active(cy_as_device *dev_p)
{
if (!cy_as_device_is_configured(dev_p))
- return CY_AS_ERROR_NOT_CONFIGURED ;
+ return CY_AS_ERROR_NOT_CONFIGURED;
if (!cy_as_device_is_firmware_loaded(dev_p))
- return CY_AS_ERROR_NO_FIRMWARE ;
+ return CY_AS_ERROR_NO_FIRMWARE;
if (dev_p->usb_count == 0)
- return CY_AS_ERROR_NOT_RUNNING ;
+ return CY_AS_ERROR_NOT_RUNNING;
if (cy_as_device_is_in_suspend_mode(dev_p))
- return CY_AS_ERROR_IN_SUSPEND ;
+ return CY_AS_ERROR_IN_SUSPEND;
- return CY_AS_ERROR_SUCCESS ;
+ return CY_AS_ERROR_SUCCESS;
}
static void
@@ -89,69 +89,69 @@ usb_ack_callback(cy_as_device_handle h,
cy_as_funct_c_b_type type,
void *data)
{
- cy_as_device *dev_p = (cy_as_device *)h ;
+ cy_as_device *dev_p = (cy_as_device *)h;
- (void)client ;
- (void)status ;
- (void)data ;
+ (void)client;
+ (void)status;
+ (void)data;
- cy_as_hal_assert(type == CY_FUNCT_CB_NODATA) ;
+ cy_as_hal_assert(type == CY_FUNCT_CB_NODATA);
if (dev_p->usb_pending_buffer) {
- cy_as_usb_io_callback cb ;
+ cy_as_usb_io_callback cb;
- cb = dev_p->usb_cb[0] ;
- dev_p->usb_cb[0] = 0 ;
- cy_as_device_clear_usb_async_pending(dev_p, 0) ;
+ cb = dev_p->usb_cb[0];
+ dev_p->usb_cb[0] = 0;
+ cy_as_device_clear_usb_async_pending(dev_p, 0);
if (cb)
cb(h, 0, dev_p->usb_pending_size,
- dev_p->usb_pending_buffer, dev_p->usb_error) ;
+ dev_p->usb_pending_buffer, dev_p->usb_error);
- dev_p->usb_pending_buffer = 0 ;
+ dev_p->usb_pending_buffer = 0;
}
- cy_as_device_clear_setup_packet(dev_p) ;
+ cy_as_device_clear_setup_packet(dev_p);
}
static void
my_usb_request_callback_usb_event(cy_as_device *dev_p,
cy_as_ll_request_response *req_p)
{
- uint16_t ev ;
- uint16_t val ;
- cy_as_device_handle h = (cy_as_device_handle)dev_p ;
+ uint16_t ev;
+ uint16_t val;
+ cy_as_device_handle h = (cy_as_device_handle)dev_p;
- ev = cy_as_ll_request_response__get_word(req_p, 0) ;
+ ev = cy_as_ll_request_response__get_word(req_p, 0);
switch (ev) {
case 0: /* Reserved */
cy_as_ll_send_status_response(dev_p, CY_RQT_USB_RQT_CONTEXT,
- CY_AS_ERROR_INVALID_REQUEST, 0) ;
- break ;
+ CY_AS_ERROR_INVALID_REQUEST, 0);
+ break;
case 1: /* Reserved */
cy_as_ll_send_status_response(dev_p, CY_RQT_USB_RQT_CONTEXT,
- CY_AS_ERROR_INVALID_REQUEST, 0) ;
- break ;
+ CY_AS_ERROR_INVALID_REQUEST, 0);
+ break;
case 2: /* USB Suspend */
- dev_p->usb_last_event = cy_as_event_usb_suspend ;
+ dev_p->usb_last_event = cy_as_event_usb_suspend;
if (dev_p->usb_event_cb_ms)
- dev_p->usb_event_cb_ms(h, cy_as_event_usb_suspend, 0) ;
+ dev_p->usb_event_cb_ms(h, cy_as_event_usb_suspend, 0);
else if (dev_p->usb_event_cb)
- dev_p->usb_event_cb(h, cy_as_event_usb_suspend, 0) ;
+ dev_p->usb_event_cb(h, cy_as_event_usb_suspend, 0);
cy_as_ll_send_status_response(dev_p,
- CY_RQT_USB_RQT_CONTEXT, CY_AS_ERROR_SUCCESS, 0) ;
+ CY_RQT_USB_RQT_CONTEXT, CY_AS_ERROR_SUCCESS, 0);
break;
case 3: /* USB Resume */
- dev_p->usb_last_event = cy_as_event_usb_resume ;
+ dev_p->usb_last_event = cy_as_event_usb_resume;
if (dev_p->usb_event_cb_ms)
- dev_p->usb_event_cb_ms(h, cy_as_event_usb_resume, 0) ;
+ dev_p->usb_event_cb_ms(h, cy_as_event_usb_resume, 0);
else if (dev_p->usb_event_cb)
- dev_p->usb_event_cb(h, cy_as_event_usb_resume, 0) ;
+ dev_p->usb_event_cb(h, cy_as_event_usb_resume, 0);
cy_as_ll_send_status_response(dev_p,
- CY_RQT_USB_RQT_CONTEXT, CY_AS_ERROR_SUCCESS, 0) ;
- break ;
+ CY_RQT_USB_RQT_CONTEXT, CY_AS_ERROR_SUCCESS, 0);
+ break;
case 4: /* USB Reset */
/*
@@ -161,75 +161,75 @@ my_usb_request_callback_usb_event(cy_as_device *dev_p,
* enumeration based requests.
*/
if (cy_as_device_is_ack_delayed(dev_p))
- cy_as_usb_reset_e_p0_state(dev_p) ;
+ cy_as_usb_reset_e_p0_state(dev_p);
- dev_p->usb_last_event = cy_as_event_usb_reset ;
+ dev_p->usb_last_event = cy_as_event_usb_reset;
if (dev_p->usb_event_cb_ms)
- dev_p->usb_event_cb_ms(h, cy_as_event_usb_reset, 0) ;
+ dev_p->usb_event_cb_ms(h, cy_as_event_usb_reset, 0);
else if (dev_p->usb_event_cb)
- dev_p->usb_event_cb(h, cy_as_event_usb_reset, 0) ;
+ dev_p->usb_event_cb(h, cy_as_event_usb_reset, 0);
cy_as_ll_send_status_response(dev_p,
- CY_RQT_USB_RQT_CONTEXT, CY_AS_ERROR_SUCCESS, 0) ;
- cy_as_device_clear_usb_high_speed(dev_p) ;
- cy_as_usb_set_dma_sizes(dev_p) ;
- dev_p->usb_max_tx_size = 0x40 ;
- cy_as_dma_set_max_dma_size(dev_p, 0x06, 0x40) ;
- break ;
+ CY_RQT_USB_RQT_CONTEXT, CY_AS_ERROR_SUCCESS, 0);
+ cy_as_device_clear_usb_high_speed(dev_p);
+ cy_as_usb_set_dma_sizes(dev_p);
+ dev_p->usb_max_tx_size = 0x40;
+ cy_as_dma_set_max_dma_size(dev_p, 0x06, 0x40);
+ break;
case 5: /* USB Set Configuration */
/* The configuration to set */
- val = cy_as_ll_request_response__get_word(req_p, 1) ;
- dev_p->usb_last_event = cy_as_event_usb_set_config ;
+ val = cy_as_ll_request_response__get_word(req_p, 1);
+ dev_p->usb_last_event = cy_as_event_usb_set_config;
if (dev_p->usb_event_cb_ms)
dev_p->usb_event_cb_ms(h,
- cy_as_event_usb_set_config, &val) ;
+ cy_as_event_usb_set_config, &val);
else if (dev_p->usb_event_cb)
dev_p->usb_event_cb(h,
- cy_as_event_usb_set_config, &val) ;
+ cy_as_event_usb_set_config, &val);
cy_as_ll_send_status_response(dev_p,
- CY_RQT_USB_RQT_CONTEXT, CY_AS_ERROR_SUCCESS, 0) ;
- break ;
+ CY_RQT_USB_RQT_CONTEXT, CY_AS_ERROR_SUCCESS, 0);
+ break;
case 6: /* USB Speed change */
/* Connect speed */
- val = cy_as_ll_request_response__get_word(req_p, 1) ;
- dev_p->usb_last_event = cy_as_event_usb_speed_change ;
+ val = cy_as_ll_request_response__get_word(req_p, 1);
+ dev_p->usb_last_event = cy_as_event_usb_speed_change;
if (dev_p->usb_event_cb_ms)
dev_p->usb_event_cb_ms(h,
- cy_as_event_usb_speed_change, &val) ;
+ cy_as_event_usb_speed_change, &val);
else if (dev_p->usb_event_cb)
dev_p->usb_event_cb(h,
- cy_as_event_usb_speed_change, &val) ;
+ cy_as_event_usb_speed_change, &val);
cy_as_ll_send_status_response(dev_p,
- CY_RQT_USB_RQT_CONTEXT, CY_AS_ERROR_SUCCESS, 0) ;
- cy_as_device_set_usb_high_speed(dev_p) ;
- cy_as_usb_set_dma_sizes(dev_p) ;
- dev_p->usb_max_tx_size = 0x200 ;
- cy_as_dma_set_max_dma_size(dev_p, 0x06, 0x200) ;
- break ;
+ CY_RQT_USB_RQT_CONTEXT, CY_AS_ERROR_SUCCESS, 0);
+ cy_as_device_set_usb_high_speed(dev_p);
+ cy_as_usb_set_dma_sizes(dev_p);
+ dev_p->usb_max_tx_size = 0x200;
+ cy_as_dma_set_max_dma_size(dev_p, 0x06, 0x200);
+ break;
case 7: /* USB Clear Feature */
/* EP Number */
- val = cy_as_ll_request_response__get_word(req_p, 1) ;
+ val = cy_as_ll_request_response__get_word(req_p, 1);
if (dev_p->usb_event_cb_ms)
dev_p->usb_event_cb_ms(h,
- cy_as_event_usb_clear_feature, &val) ;
+ cy_as_event_usb_clear_feature, &val);
if (dev_p->usb_event_cb)
dev_p->usb_event_cb(h,
- cy_as_event_usb_clear_feature, &val) ;
+ cy_as_event_usb_clear_feature, &val);
cy_as_ll_send_status_response(dev_p,
- CY_RQT_USB_RQT_CONTEXT, CY_AS_ERROR_SUCCESS, 0) ;
- break ;
+ CY_RQT_USB_RQT_CONTEXT, CY_AS_ERROR_SUCCESS, 0);
+ break;
default:
- cy_as_hal_print_message("invalid event type\n") ;
+ cy_as_hal_print_message("invalid event type\n");
cy_as_ll_send_data_response(dev_p, CY_RQT_USB_RQT_CONTEXT,
- CY_RESP_USB_INVALID_EVENT, sizeof(ev), &ev) ;
- break ;
+ CY_RESP_USB_INVALID_EVENT, sizeof(ev), &ev);
+ break;
}
}
@@ -237,21 +237,21 @@ static void
my_usb_request_callback_usb_data(cy_as_device *dev_p,
cy_as_ll_request_response *req_p)
{
- cy_as_end_point_number_t ep ;
- uint8_t type ;
- uint16_t len ;
- uint16_t val ;
- cy_as_device_handle h = (cy_as_device_handle)dev_p ;
+ cy_as_end_point_number_t ep;
+ uint8_t type;
+ uint16_t len;
+ uint16_t val;
+ cy_as_device_handle h = (cy_as_device_handle)dev_p;
- val = cy_as_ll_request_response__get_word(req_p, 0) ;
- ep = (cy_as_end_point_number_t)((val >> 13) & 0x01) ;
- len = (val & 0x1ff) ;
+ val = cy_as_ll_request_response__get_word(req_p, 0);
+ ep = (cy_as_end_point_number_t)((val >> 13) & 0x01);
+ len = (val & 0x1ff);
- cy_as_hal_assert(len <= 64) ;
+ cy_as_hal_assert(len <= 64);
cy_as_ll_request_response__unpack(req_p,
- 1, len, dev_p->usb_ep_data) ;
+ 1, len, dev_p->usb_ep_data);
- type = (uint8_t)((val >> 14) & 0x03) ;
+ type = (uint8_t)((val >> 14) & 0x03);
if (type == 0) {
if (cy_as_device_is_ack_delayed(dev_p)) {
/*
@@ -260,59 +260,59 @@ my_usb_request_callback_usb_data(cy_as_device *dev_p,
* our state with respect to EP0 to be ready
* to process the new packet.
*/
- cy_as_usb_reset_e_p0_state(dev_p) ;
+ cy_as_usb_reset_e_p0_state(dev_p);
}
if (len != 8)
cy_as_ll_send_status_response(dev_p,
CY_RQT_USB_RQT_CONTEXT,
- CY_AS_ERROR_INVALID_REQUEST, 0) ;
+ CY_AS_ERROR_INVALID_REQUEST, 0);
else {
- cy_as_device_clear_ep0_stalled(dev_p) ;
- cy_as_device_set_setup_packet(dev_p) ;
+ cy_as_device_clear_ep0_stalled(dev_p);
+ cy_as_device_set_setup_packet(dev_p);
cy_as_ll_send_status_response(dev_p,
CY_RQT_USB_RQT_CONTEXT,
- CY_AS_ERROR_SUCCESS, 0) ;
+ CY_AS_ERROR_SUCCESS, 0);
if (dev_p->usb_event_cb_ms)
dev_p->usb_event_cb_ms(h,
cy_as_event_usb_setup_packet,
- dev_p->usb_ep_data) ;
+ dev_p->usb_ep_data);
else
dev_p->usb_event_cb(h,
cy_as_event_usb_setup_packet,
- dev_p->usb_ep_data) ;
+ dev_p->usb_ep_data);
if ((!cy_as_device_is_ack_delayed(dev_p)) &&
(!cy_as_device_is_ep0_stalled(dev_p)))
cy_as_usb_ack_setup_packet(h,
- usb_ack_callback, 0) ;
+ usb_ack_callback, 0);
}
} else if (type == 2) {
if (len != 0)
cy_as_ll_send_status_response(dev_p,
CY_RQT_USB_RQT_CONTEXT,
- CY_AS_ERROR_INVALID_REQUEST, 0) ;
+ CY_AS_ERROR_INVALID_REQUEST, 0);
else {
if (dev_p->usb_event_cb_ms)
dev_p->usb_event_cb_ms(h,
- cy_as_event_usb_status_packet, 0) ;
+ cy_as_event_usb_status_packet, 0);
else
dev_p->usb_event_cb(h,
- cy_as_event_usb_status_packet, 0) ;
+ cy_as_event_usb_status_packet, 0);
cy_as_ll_send_status_response(dev_p,
CY_RQT_USB_RQT_CONTEXT,
- CY_AS_ERROR_SUCCESS, 0) ;
+ CY_AS_ERROR_SUCCESS, 0);
}
} else if (type == 1) {
/*
* we need to hand the data associated with these
* endpoints to the DMA module.
*/
- cy_as_dma_received_data(dev_p, ep, len, dev_p->usb_ep_data) ;
+ cy_as_dma_received_data(dev_p, ep, len, dev_p->usb_ep_data);
cy_as_ll_send_status_response(dev_p,
- CY_RQT_USB_RQT_CONTEXT, CY_AS_ERROR_SUCCESS, 0) ;
+ CY_RQT_USB_RQT_CONTEXT, CY_AS_ERROR_SUCCESS, 0);
}
}
@@ -320,79 +320,79 @@ static void
my_usb_request_callback_inquiry(cy_as_device *dev_p,
cy_as_ll_request_response *req_p)
{
- cy_as_usb_inquiry_data_dep cbdata ;
- cy_as_usb_inquiry_data cbdata_ms ;
- void *data ;
- uint16_t val ;
- cy_as_device_handle h = (cy_as_device_handle)dev_p ;
- uint8_t def_inq_data[64] ;
- uint8_t evpd ;
- uint8_t codepage ;
- cy_bool updated ;
- uint16_t length ;
+ cy_as_usb_inquiry_data_dep cbdata;
+ cy_as_usb_inquiry_data cbdata_ms;
+ void *data;
+ uint16_t val;
+ cy_as_device_handle h = (cy_as_device_handle)dev_p;
+ uint8_t def_inq_data[64];
+ uint8_t evpd;
+ uint8_t codepage;
+ cy_bool updated;
+ uint16_t length;
- cy_as_bus_number_t bus ;
- uint32_t device ;
- cy_as_media_type media ;
+ cy_as_bus_number_t bus;
+ uint32_t device;
+ cy_as_media_type media;
- val = cy_as_ll_request_response__get_word(req_p, 0) ;
- bus = cy_as_storage_get_bus_from_address(val) ;
- device = cy_as_storage_get_device_from_address(val) ;
- media = cy_as_storage_get_media_from_address(val) ;
+ val = cy_as_ll_request_response__get_word(req_p, 0);
+ bus = cy_as_storage_get_bus_from_address(val);
+ device = cy_as_storage_get_device_from_address(val);
+ media = cy_as_storage_get_media_from_address(val);
- val = cy_as_ll_request_response__get_word(req_p, 1) ;
- evpd = (uint8_t)((val >> 8) & 0x01) ;
- codepage = (uint8_t)(val & 0xff) ;
+ val = cy_as_ll_request_response__get_word(req_p, 1);
+ evpd = (uint8_t)((val >> 8) & 0x01);
+ codepage = (uint8_t)(val & 0xff);
- length = cy_as_ll_request_response__get_word(req_p, 2) ;
- data = (void *)def_inq_data ;
+ length = cy_as_ll_request_response__get_word(req_p, 2);
+ data = (void *)def_inq_data;
- updated = cy_false ;
+ updated = cy_false;
if (dev_p->usb_event_cb_ms) {
- cbdata_ms.bus = bus ;
- cbdata_ms.device = device ;
- cbdata_ms.updated = updated ;
- cbdata_ms.evpd = evpd ;
- cbdata_ms.codepage = codepage ;
- cbdata_ms.length = length ;
- cbdata_ms.data = data ;
-
- cy_as_hal_assert(cbdata_ms.length <= sizeof(def_inq_data)) ;
+ cbdata_ms.bus = bus;
+ cbdata_ms.device = device;
+ cbdata_ms.updated = updated;
+ cbdata_ms.evpd = evpd;
+ cbdata_ms.codepage = codepage;
+ cbdata_ms.length = length;
+ cbdata_ms.data = data;
+
+ cy_as_hal_assert(cbdata_ms.length <= sizeof(def_inq_data));
cy_as_ll_request_response__unpack(req_p,
- 3, cbdata_ms.length, cbdata_ms.data) ;
+ 3, cbdata_ms.length, cbdata_ms.data);
dev_p->usb_event_cb_ms(h,
- cy_as_event_usb_inquiry_before, &cbdata_ms) ;
+ cy_as_event_usb_inquiry_before, &cbdata_ms);
updated = cbdata_ms.updated;
- data = cbdata_ms.data ;
- length = cbdata_ms.length ;
+ data = cbdata_ms.data;
+ length = cbdata_ms.length;
} else if (dev_p->usb_event_cb) {
- cbdata.media = media ;
- cbdata.updated = updated ;
- cbdata.evpd = evpd ;
- cbdata.codepage = codepage ;
- cbdata.length = length ;
- cbdata.data = data ;
+ cbdata.media = media;
+ cbdata.updated = updated;
+ cbdata.evpd = evpd;
+ cbdata.codepage = codepage;
+ cbdata.length = length;
+ cbdata.data = data;
cy_as_hal_assert(cbdata.length <=
- sizeof(def_inq_data)) ;
+ sizeof(def_inq_data));
cy_as_ll_request_response__unpack(req_p, 3,
- cbdata.length, cbdata.data) ;
+ cbdata.length, cbdata.data);
dev_p->usb_event_cb(h,
- cy_as_event_usb_inquiry_before, &cbdata) ;
+ cy_as_event_usb_inquiry_before, &cbdata);
- updated = cbdata.updated ;
- data = cbdata.data ;
- length = cbdata.length ;
+ updated = cbdata.updated;
+ data = cbdata.data;
+ length = cbdata.length;
}
if (updated && length > 192)
cy_as_hal_print_message("an inquiry result from a "
"cy_as_event_usb_inquiry_before event "
- "was greater than 192 bytes.") ;
+ "was greater than 192 bytes.");
/* Now send the reply with the data back
* to the West Bridge device */
@@ -403,175 +403,175 @@ my_usb_request_callback_inquiry(cy_as_device *dev_p,
*/
cy_as_ll_send_data_response(dev_p,
CY_RQT_USB_RQT_CONTEXT,
- CY_RESP_INQUIRY_DATA, length, data) ;
+ CY_RESP_INQUIRY_DATA, length, data);
} else {
/*
* the callback did not modify the data, just acknowledge
* that we processed the request
*/
cy_as_ll_send_status_response(dev_p,
- CY_RQT_USB_RQT_CONTEXT, CY_AS_ERROR_SUCCESS, 1) ;
+ CY_RQT_USB_RQT_CONTEXT, CY_AS_ERROR_SUCCESS, 1);
}
if (dev_p->usb_event_cb_ms)
dev_p->usb_event_cb_ms(h,
- cy_as_event_usb_inquiry_after, &cbdata_ms) ;
+ cy_as_event_usb_inquiry_after, &cbdata_ms);
else if (dev_p->usb_event_cb)
dev_p->usb_event_cb(h,
- cy_as_event_usb_inquiry_after, &cbdata) ;
+ cy_as_event_usb_inquiry_after, &cbdata);
}
static void
my_usb_request_callback_start_stop(cy_as_device *dev_p,
cy_as_ll_request_response *req_p)
{
- cy_as_bus_number_t bus ;
- cy_as_media_type media ;
- uint32_t device ;
- uint16_t val ;
+ cy_as_bus_number_t bus;
+ cy_as_media_type media;
+ uint32_t device;
+ uint16_t val;
if (dev_p->usb_event_cb_ms || dev_p->usb_event_cb) {
- cy_bool loej ;
- cy_bool start ;
- cy_as_device_handle h = (cy_as_device_handle)dev_p ;
+ cy_bool loej;
+ cy_bool start;
+ cy_as_device_handle h = (cy_as_device_handle)dev_p;
- val = cy_as_ll_request_response__get_word(req_p, 0) ;
- bus = cy_as_storage_get_bus_from_address(val) ;
- device = cy_as_storage_get_device_from_address(val) ;
- media = cy_as_storage_get_media_from_address(val) ;
+ val = cy_as_ll_request_response__get_word(req_p, 0);
+ bus = cy_as_storage_get_bus_from_address(val);
+ device = cy_as_storage_get_device_from_address(val);
+ media = cy_as_storage_get_media_from_address(val);
- val = cy_as_ll_request_response__get_word(req_p, 1) ;
- loej = (val & 0x02) ? cy_true : cy_false ;
- start = (val & 0x01) ? cy_true : cy_false ;
+ val = cy_as_ll_request_response__get_word(req_p, 1);
+ loej = (val & 0x02) ? cy_true : cy_false;
+ start = (val & 0x01) ? cy_true : cy_false;
if (dev_p->usb_event_cb_ms) {
- cy_as_usb_start_stop_data cbdata_ms ;
+ cy_as_usb_start_stop_data cbdata_ms;
- cbdata_ms.bus = bus ;
- cbdata_ms.device = device ;
- cbdata_ms.loej = loej ;
- cbdata_ms.start = start ;
+ cbdata_ms.bus = bus;
+ cbdata_ms.device = device;
+ cbdata_ms.loej = loej;
+ cbdata_ms.start = start;
dev_p->usb_event_cb_ms(h,
- cy_as_event_usb_start_stop, &cbdata_ms) ;
+ cy_as_event_usb_start_stop, &cbdata_ms);
} else if (dev_p->usb_event_cb) {
- cy_as_usb_start_stop_data_dep cbdata ;
+ cy_as_usb_start_stop_data_dep cbdata;
- cbdata.media = media ;
- cbdata.loej = loej ;
- cbdata.start = start ;
+ cbdata.media = media;
+ cbdata.loej = loej;
+ cbdata.start = start;
dev_p->usb_event_cb(h,
- cy_as_event_usb_start_stop, &cbdata) ;
+ cy_as_event_usb_start_stop, &cbdata);
}
}
cy_as_ll_send_status_response(dev_p,
- CY_RQT_USB_RQT_CONTEXT, CY_AS_ERROR_SUCCESS, 1) ;
+ CY_RQT_USB_RQT_CONTEXT, CY_AS_ERROR_SUCCESS, 1);
}
static void
my_usb_request_callback_uknown_c_b_w(cy_as_device *dev_p,
cy_as_ll_request_response *req_p)
{
- uint16_t val ;
- cy_as_device_handle h = (cy_as_device_handle)dev_p ;
- uint8_t buf[16] ;
+ uint16_t val;
+ cy_as_device_handle h = (cy_as_device_handle)dev_p;
+ uint8_t buf[16];
- uint8_t response[4] ;
- uint16_t reqlen ;
- void *request ;
- uint8_t status ;
- uint8_t key ;
- uint8_t asc ;
- uint8_t ascq ;
+ uint8_t response[4];
+ uint16_t reqlen;
+ void *request;
+ uint8_t status;
+ uint8_t key;
+ uint8_t asc;
+ uint8_t ascq;
- val = cy_as_ll_request_response__get_word(req_p, 0) ;
+ val = cy_as_ll_request_response__get_word(req_p, 0);
/* Failed by default */
- status = 1 ;
+ status = 1;
/* Invalid command */
- key = 0x05 ;
+ key = 0x05;
/* Invalid command */
- asc = 0x20 ;
+ asc = 0x20;
/* Invalid command */
- ascq = 0x00 ;
- reqlen = cy_as_ll_request_response__get_word(req_p, 1) ;
- request = buf ;
+ ascq = 0x00;
+ reqlen = cy_as_ll_request_response__get_word(req_p, 1);
+ request = buf;
- cy_as_hal_assert(reqlen <= sizeof(buf)) ;
- cy_as_ll_request_response__unpack(req_p, 2, reqlen, request) ;
+ cy_as_hal_assert(reqlen <= sizeof(buf));
+ cy_as_ll_request_response__unpack(req_p, 2, reqlen, request);
if (dev_p->usb_event_cb_ms) {
- cy_as_usb_unknown_command_data cbdata_ms ;
- cbdata_ms.bus = cy_as_storage_get_bus_from_address(val) ;
+ cy_as_usb_unknown_command_data cbdata_ms;
+ cbdata_ms.bus = cy_as_storage_get_bus_from_address(val);
cbdata_ms.device =
- cy_as_storage_get_device_from_address(val) ;
- cbdata_ms.reqlen = reqlen ;
- cbdata_ms.request = request ;
- cbdata_ms.status = status ;
- cbdata_ms.key = key ;
- cbdata_ms.asc = asc ;
- cbdata_ms.ascq = ascq ;
+ cy_as_storage_get_device_from_address(val);
+ cbdata_ms.reqlen = reqlen;
+ cbdata_ms.request = request;
+ cbdata_ms.status = status;
+ cbdata_ms.key = key;
+ cbdata_ms.asc = asc;
+ cbdata_ms.ascq = ascq;
dev_p->usb_event_cb_ms(h,
- cy_as_event_usb_unknown_storage, &cbdata_ms) ;
- status = cbdata_ms.status ;
- key = cbdata_ms.key ;
- asc = cbdata_ms.asc ;
- ascq = cbdata_ms.ascq ;
+ cy_as_event_usb_unknown_storage, &cbdata_ms);
+ status = cbdata_ms.status;
+ key = cbdata_ms.key;
+ asc = cbdata_ms.asc;
+ ascq = cbdata_ms.ascq;
} else if (dev_p->usb_event_cb) {
- cy_as_usb_unknown_command_data_dep cbdata ;
+ cy_as_usb_unknown_command_data_dep cbdata;
cbdata.media =
- cy_as_storage_get_media_from_address(val) ;
- cbdata.reqlen = reqlen ;
- cbdata.request = request ;
- cbdata.status = status ;
- cbdata.key = key ;
- cbdata.asc = asc ;
- cbdata.ascq = ascq ;
+ cy_as_storage_get_media_from_address(val);
+ cbdata.reqlen = reqlen;
+ cbdata.request = request;
+ cbdata.status = status;
+ cbdata.key = key;
+ cbdata.asc = asc;
+ cbdata.ascq = ascq;
dev_p->usb_event_cb(h,
- cy_as_event_usb_unknown_storage, &cbdata) ;
- status = cbdata.status ;
- key = cbdata.key ;
- asc = cbdata.asc ;
- ascq = cbdata.ascq ;
+ cy_as_event_usb_unknown_storage, &cbdata);
+ status = cbdata.status;
+ key = cbdata.key;
+ asc = cbdata.asc;
+ ascq = cbdata.ascq;
}
- response[0] = status ;
- response[1] = key ;
- response[2] = asc ;
- response[3] = ascq ;
+ response[0] = status;
+ response[1] = key;
+ response[2] = asc;
+ response[3] = ascq;
cy_as_ll_send_data_response(dev_p, CY_RQT_USB_RQT_CONTEXT,
- CY_RESP_UNKNOWN_SCSI_COMMAND, sizeof(response), response) ;
+ CY_RESP_UNKNOWN_SCSI_COMMAND, sizeof(response), response);
}
static void
my_usb_request_callback_m_s_c_progress(cy_as_device *dev_p,
cy_as_ll_request_response *req_p)
{
- uint16_t val1, val2 ;
- cy_as_device_handle h = (cy_as_device_handle)dev_p ;
+ uint16_t val1, val2;
+ cy_as_device_handle h = (cy_as_device_handle)dev_p;
if ((dev_p->usb_event_cb) || (dev_p->usb_event_cb_ms)) {
- cy_as_m_s_c_progress_data cbdata ;
+ cy_as_m_s_c_progress_data cbdata;
- val1 = cy_as_ll_request_response__get_word(req_p, 0) ;
- val2 = cy_as_ll_request_response__get_word(req_p, 1) ;
- cbdata.wr_count = (uint32_t)((val1 << 16) | val2) ;
+ val1 = cy_as_ll_request_response__get_word(req_p, 0);
+ val2 = cy_as_ll_request_response__get_word(req_p, 1);
+ cbdata.wr_count = (uint32_t)((val1 << 16) | val2);
- val1 = cy_as_ll_request_response__get_word(req_p, 2) ;
- val2 = cy_as_ll_request_response__get_word(req_p, 3) ;
- cbdata.rd_count = (uint32_t)((val1 << 16) | val2) ;
+ val1 = cy_as_ll_request_response__get_word(req_p, 2);
+ val2 = cy_as_ll_request_response__get_word(req_p, 3);
+ cbdata.rd_count = (uint32_t)((val1 << 16) | val2);
if (dev_p->usb_event_cb)
dev_p->usb_event_cb(h,
- cy_as_event_usb_m_s_c_progress, &cbdata) ;
+ cy_as_event_usb_m_s_c_progress, &cbdata);
else
dev_p->usb_event_cb_ms(h,
- cy_as_event_usb_m_s_c_progress, &cbdata) ;
+ cy_as_event_usb_m_s_c_progress, &cbdata);
}
cy_as_ll_send_status_response(dev_p,
- CY_RQT_USB_RQT_CONTEXT, CY_AS_ERROR_SUCCESS, 0) ;
+ CY_RQT_USB_RQT_CONTEXT, CY_AS_ERROR_SUCCESS, 0);
}
/*
@@ -586,50 +586,50 @@ my_usb_request_callback(cy_as_device *dev_p, uint8_t context,
cy_as_ll_request_response *resp_p,
cy_as_return_status_t ret)
{
- uint16_t val ;
- uint8_t code = cy_as_ll_request_response__get_code(req_p) ;
+ uint16_t val;
+ uint8_t code = cy_as_ll_request_response__get_code(req_p);
- (void)resp_p ;
- (void)context ;
- (void)ret ;
+ (void)resp_p;
+ (void)context;
+ (void)ret;
switch (code) {
case CY_RQT_USB_EVENT:
- my_usb_request_callback_usb_event(dev_p, req_p) ;
- break ;
+ my_usb_request_callback_usb_event(dev_p, req_p);
+ break;
case CY_RQT_USB_EP_DATA:
- dev_p->usb_last_event = cy_as_event_usb_setup_packet ;
- my_usb_request_callback_usb_data(dev_p, req_p) ;
- break ;
+ dev_p->usb_last_event = cy_as_event_usb_setup_packet;
+ my_usb_request_callback_usb_data(dev_p, req_p);
+ break;
case CY_RQT_SCSI_INQUIRY_COMMAND:
- dev_p->usb_last_event = cy_as_event_usb_inquiry_after ;
- my_usb_request_callback_inquiry(dev_p, req_p) ;
- break ;
+ dev_p->usb_last_event = cy_as_event_usb_inquiry_after;
+ my_usb_request_callback_inquiry(dev_p, req_p);
+ break;
case CY_RQT_SCSI_START_STOP_COMMAND:
- dev_p->usb_last_event = cy_as_event_usb_start_stop ;
- my_usb_request_callback_start_stop(dev_p, req_p) ;
- break ;
+ dev_p->usb_last_event = cy_as_event_usb_start_stop;
+ my_usb_request_callback_start_stop(dev_p, req_p);
+ break;
case CY_RQT_SCSI_UNKNOWN_COMMAND:
- dev_p->usb_last_event = cy_as_event_usb_unknown_storage ;
- my_usb_request_callback_uknown_c_b_w(dev_p, req_p) ;
- break ;
+ dev_p->usb_last_event = cy_as_event_usb_unknown_storage;
+ my_usb_request_callback_uknown_c_b_w(dev_p, req_p);
+ break;
case CY_RQT_USB_ACTIVITY_UPDATE:
- dev_p->usb_last_event = cy_as_event_usb_m_s_c_progress ;
- my_usb_request_callback_m_s_c_progress(dev_p, req_p) ;
- break ;
+ dev_p->usb_last_event = cy_as_event_usb_m_s_c_progress;
+ my_usb_request_callback_m_s_c_progress(dev_p, req_p);
+ break;
default:
cy_as_hal_print_message("invalid request "
- "received on USB context\n") ;
- val = req_p->box0 ;
+ "received on USB context\n");
+ val = req_p->box0;
cy_as_ll_send_data_response(dev_p, CY_RQT_USB_RQT_CONTEXT,
- CY_RESP_INVALID_REQUEST, sizeof(val), &val) ;
- break ;
+ CY_RESP_INVALID_REQUEST, sizeof(val), &val);
+ break;
}
}
@@ -640,39 +640,39 @@ my_handle_response_usb_start(cy_as_device *dev_p,
cy_as_return_status_t ret)
{
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
if (cy_as_ll_request_response__get_code(reply_p) !=
CY_RESP_SUCCESS_FAILURE) {
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
- goto destroy ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
+ goto destroy;
}
- ret = cy_as_ll_request_response__get_word(reply_p, 0) ;
+ ret = cy_as_ll_request_response__get_word(reply_p, 0);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
/*
* mark EP 0 and EP1 as 64 byte endpoints
*/
- cy_as_dma_set_max_dma_size(dev_p, 0, 64) ;
- cy_as_dma_set_max_dma_size(dev_p, 1, 64) ;
+ cy_as_dma_set_max_dma_size(dev_p, 0, 64);
+ cy_as_dma_set_max_dma_size(dev_p, 1, 64);
- dev_p->usb_count++ ;
+ dev_p->usb_count++;
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
if (ret != CY_AS_ERROR_SUCCESS) {
- cy_as_destroy_c_b_queue(dev_p->usb_func_cbs) ;
+ cy_as_destroy_c_b_queue(dev_p->usb_func_cbs);
cy_as_ll_register_request_callback(dev_p,
- CY_RQT_USB_RQT_CONTEXT, 0) ;
+ CY_RQT_USB_RQT_CONTEXT, 0);
}
- cy_as_device_clear_u_s_s_pending(dev_p) ;
+ cy_as_device_clear_u_s_s_pending(dev_p);
- return ret ;
+ return ret;
}
@@ -691,125 +691,125 @@ cy_as_usb_start(cy_as_device_handle handle,
cy_as_function_callback cb,
uint32_t client)
{
- cy_as_ll_request_response *req_p, *reply_p ;
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
+ cy_as_ll_request_response *req_p, *reply_p;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
- cy_as_device *dev_p ;
+ cy_as_device *dev_p;
- cy_as_log_debug_message(6, "cy_as_usb_start called") ;
+ cy_as_log_debug_message(6, "cy_as_usb_start called");
- dev_p = (cy_as_device *)handle ;
+ dev_p = (cy_as_device *)handle;
if (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE))
- return CY_AS_ERROR_INVALID_HANDLE ;
+ return CY_AS_ERROR_INVALID_HANDLE;
if (!cy_as_device_is_configured(dev_p))
- return CY_AS_ERROR_NOT_CONFIGURED ;
+ return CY_AS_ERROR_NOT_CONFIGURED;
if (!cy_as_device_is_firmware_loaded(dev_p))
- return CY_AS_ERROR_NO_FIRMWARE ;
+ return CY_AS_ERROR_NO_FIRMWARE;
if (cy_as_device_is_in_suspend_mode(dev_p))
- return CY_AS_ERROR_IN_SUSPEND ;
+ return CY_AS_ERROR_IN_SUSPEND;
if (cy_as_device_is_in_callback(dev_p))
- return CY_AS_ERROR_INVALID_IN_CALLBACK ;
+ return CY_AS_ERROR_INVALID_IN_CALLBACK;
if (cy_as_device_is_u_s_s_pending(dev_p))
- return CY_AS_ERROR_STARTSTOP_PENDING ;
+ return CY_AS_ERROR_STARTSTOP_PENDING;
- cy_as_device_set_u_s_s_pending(dev_p) ;
+ cy_as_device_set_u_s_s_pending(dev_p);
if (dev_p->usb_count == 0) {
/*
* since we are just starting the stack,
* mark USB as not connected to the remote host
*/
- cy_as_device_clear_usb_connected(dev_p) ;
- dev_p->usb_phy_config = 0 ;
+ cy_as_device_clear_usb_connected(dev_p);
+ dev_p->usb_phy_config = 0;
/* Queue for 1.0 Async Requests, kept for
* backwards compatibility */
- dev_p->usb_func_cbs = cy_as_create_c_b_queue(CYAS_USB_FUNC_CB) ;
+ dev_p->usb_func_cbs = cy_as_create_c_b_queue(CYAS_USB_FUNC_CB);
if (dev_p->usb_func_cbs == 0) {
- cy_as_device_clear_u_s_s_pending(dev_p) ;
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ cy_as_device_clear_u_s_s_pending(dev_p);
+ return CY_AS_ERROR_OUT_OF_MEMORY;
}
/* Reset the EP0 state */
- cy_as_usb_reset_e_p0_state(dev_p) ;
+ cy_as_usb_reset_e_p0_state(dev_p);
/*
* we register here becuase the start request may cause
* events to occur before the response to the start request.
*/
cy_as_ll_register_request_callback(dev_p,
- CY_RQT_USB_RQT_CONTEXT, my_usb_request_callback) ;
+ CY_RQT_USB_RQT_CONTEXT, my_usb_request_callback);
/* Create the request to send to the West Bridge device */
req_p = cy_as_ll_create_request(dev_p,
- CY_RQT_START_USB, CY_RQT_USB_RQT_CONTEXT, 0) ;
+ CY_RQT_START_USB, CY_RQT_USB_RQT_CONTEXT, 0);
if (req_p == 0) {
- cy_as_destroy_c_b_queue(dev_p->usb_func_cbs) ;
- dev_p->usb_func_cbs = 0 ;
- cy_as_device_clear_u_s_s_pending(dev_p) ;
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ cy_as_destroy_c_b_queue(dev_p->usb_func_cbs);
+ dev_p->usb_func_cbs = 0;
+ cy_as_device_clear_u_s_s_pending(dev_p);
+ return CY_AS_ERROR_OUT_OF_MEMORY;
}
/* Reserve space for the reply, the reply data
* will not exceed one word */
- reply_p = cy_as_ll_create_response(dev_p, 1) ;
+ reply_p = cy_as_ll_create_response(dev_p, 1);
if (reply_p == 0) {
- cy_as_destroy_c_b_queue(dev_p->usb_func_cbs) ;
- dev_p->usb_func_cbs = 0 ;
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_device_clear_u_s_s_pending(dev_p) ;
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ cy_as_destroy_c_b_queue(dev_p->usb_func_cbs);
+ dev_p->usb_func_cbs = 0;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_device_clear_u_s_s_pending(dev_p);
+ return CY_AS_ERROR_OUT_OF_MEMORY;
}
if (cb == 0) {
ret = cy_as_ll_send_request_wait_reply(dev_p,
- req_p, reply_p) ;
+ req_p, reply_p);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
return my_handle_response_usb_start(dev_p,
- req_p, reply_p, ret) ;
+ req_p, reply_p, ret);
} else {
ret = cy_as_misc_send_request(dev_p, cb,
client, CY_FUNCT_CB_USB_START, 0,
dev_p->func_cbs_usb,
CY_AS_REQUEST_RESPONSE_EX, req_p, reply_p,
- cy_as_usb_func_callback) ;
+ cy_as_usb_func_callback);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
- return ret ;
+ return ret;
}
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
} else {
- dev_p->usb_count++ ;
+ dev_p->usb_count++;
if (cb)
- cb(handle, ret, client, CY_FUNCT_CB_USB_START, 0) ;
+ cb(handle, ret, client, CY_FUNCT_CB_USB_START, 0);
}
- cy_as_device_clear_u_s_s_pending(dev_p) ;
+ cy_as_device_clear_u_s_s_pending(dev_p);
- return ret ;
+ return ret;
}
void
cy_as_usb_reset(cy_as_device *dev_p)
{
- int i ;
+ int i;
- cy_as_device_clear_usb_connected(dev_p) ;
+ cy_as_device_clear_usb_connected(dev_p);
- for (i = 0 ; i < sizeof(dev_p->usb_config) /
- sizeof(dev_p->usb_config[0]) ; i++) {
+ for (i = 0; i < sizeof(dev_p->usb_config) /
+ sizeof(dev_p->usb_config[0]); i++) {
/*
* cancel all pending USB read/write operations, as it is
* possible that the USB stack comes up in a different
@@ -817,13 +817,13 @@ cy_as_usb_reset(cy_as_device *dev_p)
*/
if (cy_as_device_is_usb_async_pending(dev_p, i))
cy_as_usb_cancel_async(dev_p,
- (cy_as_end_point_number_t)i) ;
+ (cy_as_end_point_number_t)i);
- dev_p->usb_cb[i] = 0 ;
- dev_p->usb_config[i].enabled = cy_false ;
+ dev_p->usb_cb[i] = 0;
+ dev_p->usb_config[i].enabled = cy_false;
}
- dev_p->usb_phy_config = 0 ;
+ dev_p->usb_phy_config = 0;
}
/*
@@ -836,13 +836,13 @@ void
cy_as_usb_cleanup(cy_as_device *dev_p)
{
if (dev_p->usb_count) {
- cy_as_usb_reset_e_p0_state(dev_p) ;
- cy_as_usb_reset(dev_p) ;
+ cy_as_usb_reset_e_p0_state(dev_p);
+ cy_as_usb_reset(dev_p);
cy_as_hal_mem_set(dev_p->usb_config, 0,
- sizeof(dev_p->usb_config)) ;
- cy_as_destroy_c_b_queue(dev_p->usb_func_cbs) ;
+ sizeof(dev_p->usb_config));
+ cy_as_destroy_c_b_queue(dev_p->usb_func_cbs);
- dev_p->usb_count = 0 ;
+ dev_p->usb_count = 0;
}
}
@@ -853,35 +853,35 @@ my_handle_response_usb_stop(cy_as_device *dev_p,
cy_as_return_status_t ret)
{
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
if (cy_as_ll_request_response__get_code(reply_p) !=
CY_RESP_SUCCESS_FAILURE) {
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
- goto destroy ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
+ goto destroy;
}
- ret = cy_as_ll_request_response__get_word(reply_p, 0) ;
+ ret = cy_as_ll_request_response__get_word(reply_p, 0);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
/*
* we sucessfully shutdown the stack, so
* decrement to make the count zero.
*/
- cy_as_usb_cleanup(dev_p) ;
+ cy_as_usb_cleanup(dev_p);
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
if (ret != CY_AS_ERROR_SUCCESS)
cy_as_ll_register_request_callback(dev_p,
- CY_RQT_USB_RQT_CONTEXT, 0) ;
+ CY_RQT_USB_RQT_CONTEXT, 0);
- cy_as_device_clear_u_s_s_pending(dev_p) ;
+ cy_as_device_clear_u_s_s_pending(dev_p);
- return ret ;
+ return ret;
}
/*
@@ -895,87 +895,87 @@ cy_as_usb_stop(cy_as_device_handle handle,
cy_as_function_callback cb,
uint32_t client)
{
- cy_as_ll_request_response *req_p = 0, *reply_p = 0 ;
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
+ cy_as_ll_request_response *req_p = 0, *reply_p = 0;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
- cy_as_device *dev_p ;
+ cy_as_device *dev_p;
- cy_as_log_debug_message(6, "cy_as_usb_stop called") ;
+ cy_as_log_debug_message(6, "cy_as_usb_stop called");
- dev_p = (cy_as_device *)handle ;
+ dev_p = (cy_as_device *)handle;
if (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE))
- return CY_AS_ERROR_INVALID_HANDLE ;
+ return CY_AS_ERROR_INVALID_HANDLE;
- ret = is_usb_active(dev_p) ;
+ ret = is_usb_active(dev_p);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
if (cy_as_device_is_usb_connected(dev_p))
- return CY_AS_ERROR_USB_CONNECTED ;
+ return CY_AS_ERROR_USB_CONNECTED;
if (cy_as_device_is_in_callback(dev_p))
- return CY_AS_ERROR_INVALID_IN_CALLBACK ;
+ return CY_AS_ERROR_INVALID_IN_CALLBACK;
if (cy_as_device_is_u_s_s_pending(dev_p))
- return CY_AS_ERROR_STARTSTOP_PENDING ;
+ return CY_AS_ERROR_STARTSTOP_PENDING;
- cy_as_device_set_u_s_s_pending(dev_p) ;
+ cy_as_device_set_u_s_s_pending(dev_p);
if (dev_p->usb_count == 1) {
/* Create the request to send to the West Bridge device */
req_p = cy_as_ll_create_request(dev_p, CY_RQT_STOP_USB,
- CY_RQT_USB_RQT_CONTEXT, 0) ;
+ CY_RQT_USB_RQT_CONTEXT, 0);
if (req_p == 0) {
- ret = CY_AS_ERROR_OUT_OF_MEMORY ;
- goto destroy ;
+ ret = CY_AS_ERROR_OUT_OF_MEMORY;
+ goto destroy;
}
/* Reserve space for the reply, the reply data will not
* exceed one word */
- reply_p = cy_as_ll_create_response(dev_p, 1) ;
+ reply_p = cy_as_ll_create_response(dev_p, 1);
if (reply_p == 0) {
- ret = CY_AS_ERROR_OUT_OF_MEMORY ;
- goto destroy ;
+ ret = CY_AS_ERROR_OUT_OF_MEMORY;
+ goto destroy;
}
if (cb == 0) {
ret = cy_as_ll_send_request_wait_reply(dev_p,
- req_p, reply_p) ;
+ req_p, reply_p);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
return my_handle_response_usb_stop(dev_p,
- req_p, reply_p, ret) ;
+ req_p, reply_p, ret);
} else {
ret = cy_as_misc_send_request(dev_p, cb, client,
CY_FUNCT_CB_USB_STOP, 0, dev_p->func_cbs_usb,
CY_AS_REQUEST_RESPONSE_EX, req_p, reply_p,
- cy_as_usb_func_callback) ;
+ cy_as_usb_func_callback);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
- return ret ;
+ return ret;
}
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
} else if (dev_p->usb_count > 1) {
/*
* reset all LE_ps to inactive state, after cleaning
* up any pending async read/write calls.
*/
- cy_as_usb_reset(dev_p) ;
- dev_p->usb_count-- ;
+ cy_as_usb_reset(dev_p);
+ dev_p->usb_count--;
if (cb)
- cb(handle, ret, client, CY_FUNCT_CB_USB_STOP, 0) ;
+ cb(handle, ret, client, CY_FUNCT_CB_USB_STOP, 0);
}
- cy_as_device_clear_u_s_s_pending(dev_p) ;
+ cy_as_device_clear_u_s_s_pending(dev_p);
- return ret ;
+ return ret;
}
/*
@@ -986,23 +986,23 @@ cy_as_return_status_t
cy_as_usb_register_callback(cy_as_device_handle handle,
cy_as_usb_event_callback callback)
{
- cy_as_device *dev_p ;
+ cy_as_device *dev_p;
- cy_as_log_debug_message(6, "cy_as_usb_register_callback called") ;
+ cy_as_log_debug_message(6, "cy_as_usb_register_callback called");
- dev_p = (cy_as_device *)handle ;
+ dev_p = (cy_as_device *)handle;
if (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE))
- return CY_AS_ERROR_INVALID_HANDLE ;
+ return CY_AS_ERROR_INVALID_HANDLE;
if (!cy_as_device_is_configured(dev_p))
- return CY_AS_ERROR_NOT_CONFIGURED ;
+ return CY_AS_ERROR_NOT_CONFIGURED;
if (!cy_as_device_is_firmware_loaded(dev_p))
- return CY_AS_ERROR_NO_FIRMWARE ;
+ return CY_AS_ERROR_NO_FIRMWARE;
- dev_p->usb_event_cb = NULL ;
- dev_p->usb_event_cb_ms = callback ;
- return CY_AS_ERROR_SUCCESS ;
+ dev_p->usb_event_cb = NULL;
+ dev_p->usb_event_cb_ms = callback;
+ return CY_AS_ERROR_SUCCESS;
}
@@ -1011,18 +1011,18 @@ my_handle_response_no_data(cy_as_device *dev_p,
cy_as_ll_request_response *req_p,
cy_as_ll_request_response *reply_p)
{
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
if (cy_as_ll_request_response__get_code(reply_p) !=
CY_RESP_SUCCESS_FAILURE)
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
else
- ret = cy_as_ll_request_response__get_word(reply_p, 0) ;
+ ret = cy_as_ll_request_response__get_word(reply_p, 0);
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
- return ret ;
+ return ret;
}
static cy_as_return_status_t
@@ -1032,23 +1032,23 @@ my_handle_response_connect(cy_as_device *dev_p,
cy_as_return_status_t ret)
{
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
if (cy_as_ll_request_response__get_code(reply_p) !=
CY_RESP_SUCCESS_FAILURE) {
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
- goto destroy ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
+ goto destroy;
}
- ret = cy_as_ll_request_response__get_word(reply_p, 0) ;
+ ret = cy_as_ll_request_response__get_word(reply_p, 0);
if (ret == CY_AS_ERROR_SUCCESS)
- cy_as_device_set_usb_connected(dev_p) ;
+ cy_as_device_set_usb_connected(dev_p);
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
- return ret ;
+ return ret;
}
@@ -1065,64 +1065,64 @@ cy_as_usb_connect(cy_as_device_handle handle,
cy_as_function_callback cb,
uint32_t client)
{
- cy_as_ll_request_response *req_p , *reply_p ;
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
+ cy_as_ll_request_response *req_p , *reply_p;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
- cy_as_device *dev_p ;
+ cy_as_device *dev_p;
- cy_as_log_debug_message(6, "cy_as_usb_connect called") ;
+ cy_as_log_debug_message(6, "cy_as_usb_connect called");
- dev_p = (cy_as_device *)handle ;
+ dev_p = (cy_as_device *)handle;
if (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE))
- return CY_AS_ERROR_INVALID_HANDLE ;
+ return CY_AS_ERROR_INVALID_HANDLE;
- ret = is_usb_active(dev_p) ;
+ ret = is_usb_active(dev_p);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
if (cy_as_device_is_in_callback(dev_p))
- return CY_AS_ERROR_INVALID_IN_CALLBACK ;
+ return CY_AS_ERROR_INVALID_IN_CALLBACK;
/* Create the request to send to the West Bridge device */
req_p = cy_as_ll_create_request(dev_p,
- CY_RQT_SET_CONNECT_STATE, CY_RQT_USB_RQT_CONTEXT, 1) ;
+ CY_RQT_SET_CONNECT_STATE, CY_RQT_USB_RQT_CONTEXT, 1);
if (req_p == 0)
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ return CY_AS_ERROR_OUT_OF_MEMORY;
/* 1 = Connect request */
- cy_as_ll_request_response__set_word(req_p, 0, 1) ;
+ cy_as_ll_request_response__set_word(req_p, 0, 1);
/* Reserve space for the reply, the reply
* data will not exceed one word */
- reply_p = cy_as_ll_create_response(dev_p, 1) ;
+ reply_p = cy_as_ll_create_response(dev_p, 1);
if (reply_p == 0) {
- cy_as_ll_destroy_request(dev_p, req_p) ;
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ return CY_AS_ERROR_OUT_OF_MEMORY;
}
if (cb == 0) {
- ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p) ;
+ ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
- return my_handle_response_connect(dev_p, req_p, reply_p, ret) ;
+ return my_handle_response_connect(dev_p, req_p, reply_p, ret);
} else {
ret = cy_as_misc_send_request(dev_p, cb, client,
CY_FUNCT_CB_USB_CONNECT, 0, dev_p->func_cbs_usb,
CY_AS_REQUEST_RESPONSE_EX, req_p, reply_p,
- cy_as_usb_func_callback) ;
+ cy_as_usb_func_callback);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
- return ret ;
+ return ret;
}
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
- return ret ;
+ return ret;
}
static cy_as_return_status_t
@@ -1132,23 +1132,23 @@ my_handle_response_disconnect(cy_as_device *dev_p,
cy_as_return_status_t ret)
{
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
if (cy_as_ll_request_response__get_code(reply_p) !=
CY_RESP_SUCCESS_FAILURE) {
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
- goto destroy ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
+ goto destroy;
}
- ret = cy_as_ll_request_response__get_word(reply_p, 0) ;
+ ret = cy_as_ll_request_response__get_word(reply_p, 0);
if (ret == CY_AS_ERROR_SUCCESS)
- cy_as_device_clear_usb_connected(dev_p) ;
+ cy_as_device_clear_usb_connected(dev_p);
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
- return ret ;
+ return ret;
}
/*
* This method forces a disconnect of the D+ and D- pins
@@ -1161,66 +1161,66 @@ cy_as_usb_disconnect(cy_as_device_handle handle,
cy_as_function_callback cb,
uint32_t client)
{
- cy_as_ll_request_response *req_p , *reply_p ;
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
+ cy_as_ll_request_response *req_p , *reply_p;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
- cy_as_device *dev_p ;
+ cy_as_device *dev_p;
- cy_as_log_debug_message(6, "cy_as_usb_disconnect called") ;
+ cy_as_log_debug_message(6, "cy_as_usb_disconnect called");
- dev_p = (cy_as_device *)handle ;
+ dev_p = (cy_as_device *)handle;
if (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE))
- return CY_AS_ERROR_INVALID_HANDLE ;
+ return CY_AS_ERROR_INVALID_HANDLE;
- ret = is_usb_active(dev_p) ;
+ ret = is_usb_active(dev_p);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
if (cy_as_device_is_in_callback(dev_p))
- return CY_AS_ERROR_INVALID_IN_CALLBACK ;
+ return CY_AS_ERROR_INVALID_IN_CALLBACK;
if (!cy_as_device_is_usb_connected(dev_p))
- return CY_AS_ERROR_USB_NOT_CONNECTED ;
+ return CY_AS_ERROR_USB_NOT_CONNECTED;
/* Create the request to send to the West Bridge device */
req_p = cy_as_ll_create_request(dev_p,
- CY_RQT_SET_CONNECT_STATE, CY_RQT_USB_RQT_CONTEXT, 1) ;
+ CY_RQT_SET_CONNECT_STATE, CY_RQT_USB_RQT_CONTEXT, 1);
if (req_p == 0)
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ return CY_AS_ERROR_OUT_OF_MEMORY;
- cy_as_ll_request_response__set_word(req_p, 0, 0) ;
+ cy_as_ll_request_response__set_word(req_p, 0, 0);
/* Reserve space for the reply, the reply
* data will not exceed two bytes */
- reply_p = cy_as_ll_create_response(dev_p, 1) ;
+ reply_p = cy_as_ll_create_response(dev_p, 1);
if (reply_p == 0) {
- cy_as_ll_destroy_request(dev_p, req_p) ;
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ return CY_AS_ERROR_OUT_OF_MEMORY;
}
if (cb == 0) {
- ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p) ;
+ ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
return my_handle_response_disconnect(dev_p,
- req_p, reply_p, ret) ;
+ req_p, reply_p, ret);
} else {
ret = cy_as_misc_send_request(dev_p, cb, client,
CY_FUNCT_CB_USB_DISCONNECT, 0, dev_p->func_cbs_usb,
CY_AS_REQUEST_RESPONSE_EX, req_p, reply_p,
- cy_as_usb_func_callback) ;
+ cy_as_usb_func_callback);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
- return ret ;
+ return ret;
}
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
- return ret ;
+ return ret;
}
static cy_as_return_status_t
@@ -1228,15 +1228,15 @@ my_handle_response_set_enum_config(cy_as_device *dev_p,
cy_as_ll_request_response *req_p,
cy_as_ll_request_response *reply_p)
{
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
if (cy_as_ll_request_response__get_code(reply_p) !=
CY_RESP_SUCCESS_FAILURE) {
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
- goto destroy ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
+ goto destroy;
}
- ret = cy_as_ll_request_response__get_word(reply_p, 0) ;
+ ret = cy_as_ll_request_response__get_word(reply_p, 0);
if (ret == CY_AS_ERROR_SUCCESS) {
/*
@@ -1244,21 +1244,21 @@ my_handle_response_set_enum_config(cy_as_device *dev_p,
* enumeration is going to happen on the P port
* processor. now we must enable endpoint zero
*/
- cy_as_usb_end_point_config config ;
+ cy_as_usb_end_point_config config;
- config.dir = cy_as_usb_in_out ;
- config.type = cy_as_usb_control ;
- config.enabled = cy_true ;
+ config.dir = cy_as_usb_in_out;
+ config.type = cy_as_usb_control;
+ config.enabled = cy_true;
ret = cy_as_usb_set_end_point_config((cy_as_device_handle *)
- dev_p, 0, &config) ;
+ dev_p, 0, &config);
}
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
- return ret ;
+ return ret;
}
/*
@@ -1276,111 +1276,111 @@ my_usb_set_enum_config(cy_as_device *dev_p,
cy_as_function_callback cb,
uint32_t client)
{
- cy_as_ll_request_response *req_p , *reply_p ;
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
+ cy_as_ll_request_response *req_p , *reply_p;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
- cy_as_log_debug_message(6, "cy_as_usb_set_enum_config called") ;
+ cy_as_log_debug_message(6, "cy_as_usb_set_enum_config called");
if (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE))
- return CY_AS_ERROR_INVALID_HANDLE ;
+ return CY_AS_ERROR_INVALID_HANDLE;
- ret = is_usb_active(dev_p) ;
+ ret = is_usb_active(dev_p);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
if (cy_as_device_is_usb_connected(dev_p))
- return CY_AS_ERROR_USB_CONNECTED ;
+ return CY_AS_ERROR_USB_CONNECTED;
if (cy_as_device_is_in_callback(dev_p))
- return CY_AS_ERROR_INVALID_IN_CALLBACK ;
+ return CY_AS_ERROR_INVALID_IN_CALLBACK;
/* if we are using MTP firmware: */
if (dev_p->is_mtp_firmware == 1) {
/* we cannot enumerate MSC */
if (mass_storage_interface != 0)
- return CY_AS_ERROR_INVALID_CONFIGURATION ;
+ return CY_AS_ERROR_INVALID_CONFIGURATION;
if (bus_mask == 0) {
if (mtp_interface != 0)
- return CY_AS_ERROR_INVALID_CONFIGURATION ;
+ return CY_AS_ERROR_INVALID_CONFIGURATION;
} else if (bus_mask == 2) {
/* enable EP 1 as it will be used */
cy_as_dma_enable_end_point(dev_p, 1, cy_true,
- cy_as_direction_in) ;
- dev_p->usb_config[1].enabled = cy_true ;
- dev_p->usb_config[1].dir = cy_as_usb_in ;
- dev_p->usb_config[1].type = cy_as_usb_int ;
+ cy_as_direction_in);
+ dev_p->usb_config[1].enabled = cy_true;
+ dev_p->usb_config[1].dir = cy_as_usb_in;
+ dev_p->usb_config[1].type = cy_as_usb_int;
} else {
- return CY_AS_ERROR_INVALID_CONFIGURATION ;
+ return CY_AS_ERROR_INVALID_CONFIGURATION;
}
/* if we are not using MTP firmware, we cannot enumerate MTP */
} else if (mtp_interface != 0)
- return CY_AS_ERROR_INVALID_CONFIGURATION ;
+ return CY_AS_ERROR_INVALID_CONFIGURATION;
/*
* if we are not enumerating mass storage, we should
* not be providing an interface number.
*/
if (bus_mask == 0 && mass_storage_interface != 0)
- return CY_AS_ERROR_INVALID_CONFIGURATION ;
+ return CY_AS_ERROR_INVALID_CONFIGURATION;
/*
* if we are going to use mtp_interface, bus mask must be 2.
*/
if (mtp_interface != 0 && bus_mask != 2)
- return CY_AS_ERROR_INVALID_CONFIGURATION ;
+ return CY_AS_ERROR_INVALID_CONFIGURATION;
/* Create the request to send to the West Bridge device */
req_p = cy_as_ll_create_request(dev_p,
- CY_RQT_SET_USB_CONFIG, CY_RQT_USB_RQT_CONTEXT, 4) ;
+ CY_RQT_SET_USB_CONFIG, CY_RQT_USB_RQT_CONTEXT, 4);
if (req_p == 0)
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ return CY_AS_ERROR_OUT_OF_MEMORY;
/* Marshal the structure */
cy_as_ll_request_response__set_word(req_p, 0,
- (uint16_t)((media_mask << 8) | bus_mask)) ;
+ (uint16_t)((media_mask << 8) | bus_mask));
cy_as_ll_request_response__set_word(req_p, 1,
- (uint16_t)use_antioch_enumeration) ;
+ (uint16_t)use_antioch_enumeration);
cy_as_ll_request_response__set_word(req_p, 2,
dev_p->is_mtp_firmware ? mtp_interface :
- mass_storage_interface) ;
+ mass_storage_interface);
cy_as_ll_request_response__set_word(req_p, 3,
- (uint16_t)mass_storage_callbacks) ;
+ (uint16_t)mass_storage_callbacks);
/* Reserve space for the reply, the reply
* data will not exceed one word */
- reply_p = cy_as_ll_create_response(dev_p, 1) ;
+ reply_p = cy_as_ll_create_response(dev_p, 1);
if (reply_p == 0) {
- cy_as_ll_destroy_request(dev_p, req_p) ;
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ return CY_AS_ERROR_OUT_OF_MEMORY;
}
if (cb == 0) {
- ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p) ;
+ ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
return my_handle_response_set_enum_config(dev_p,
- req_p, reply_p) ;
+ req_p, reply_p);
} else {
ret = cy_as_misc_send_request(dev_p, cb, client,
CY_FUNCT_CB_USB_SETENUMCONFIG, 0, dev_p->func_cbs_usb,
CY_AS_REQUEST_RESPONSE_EX, req_p, reply_p,
- cy_as_usb_func_callback) ;
+ cy_as_usb_func_callback);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
- return ret ;
+ return ret;
}
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
- return ret ;
+ return ret;
}
/*
@@ -1393,21 +1393,21 @@ cy_as_usb_set_enum_config(cy_as_device_handle handle,
cy_as_function_callback cb,
uint32_t client)
{
- cy_as_device *dev_p = (cy_as_device *)handle ;
- uint8_t bus_mask, media_mask ;
- uint32_t bus, device ;
- cy_as_return_status_t ret ;
+ cy_as_device *dev_p = (cy_as_device *)handle;
+ uint8_t bus_mask, media_mask;
+ uint32_t bus, device;
+ cy_as_return_status_t ret;
- dev_p = (cy_as_device *)handle ;
+ dev_p = (cy_as_device *)handle;
if (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE))
- return CY_AS_ERROR_INVALID_HANDLE ;
+ return CY_AS_ERROR_INVALID_HANDLE;
- ret = is_usb_active(dev_p) ;
+ ret = is_usb_active(dev_p);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
if ((cy_as_device_is_in_callback(dev_p)) && (cb != 0))
- return CY_AS_ERROR_INVALID_IN_CALLBACK ;
+ return CY_AS_ERROR_INVALID_IN_CALLBACK;
/* Since we are mapping the media types to bus with NAND to 0
* and the rest to 1, and we are only allowing for enumerating
@@ -1415,16 +1415,16 @@ cy_as_usb_set_enum_config(cy_as_device_handle handle,
* positions where there a device is enabled and mark the bus
* to be enumerated.
*/
- bus_mask = 0 ;
- media_mask = 0 ;
- media_mask = 0 ;
+ bus_mask = 0;
+ media_mask = 0;
+ media_mask = 0;
for (bus = 0; bus < CY_AS_MAX_BUSES; bus++) {
for (device = 0; device < CY_AS_MAX_STORAGE_DEVICES; device++) {
if (config_p->devices_to_enumerate[bus][device] ==
cy_true) {
- bus_mask |= (0x01 << bus) ;
- media_mask |= dev_p->media_supported[bus] ;
- media_mask |= dev_p->media_supported[bus] ;
+ bus_mask |= (0x01 << bus);
+ media_mask |= dev_p->media_supported[bus];
+ media_mask |= dev_p->media_supported[bus];
}
}
}
@@ -1436,7 +1436,7 @@ cy_as_usb_set_enum_config(cy_as_device_handle handle,
config_p->mass_storage_callbacks,
cb,
client
- ) ;
+ );
}
@@ -1446,53 +1446,53 @@ my_handle_response_get_enum_config(cy_as_device *dev_p,
cy_as_ll_request_response *reply_p,
void *config_p)
{
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
- uint16_t val ;
- uint8_t bus_mask ;
- uint32_t bus ;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
+ uint16_t val;
+ uint8_t bus_mask;
+ uint32_t bus;
if (cy_as_ll_request_response__get_code(reply_p) !=
CY_RESP_USB_CONFIG) {
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
- goto destroy ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
+ goto destroy;
}
/* Marshal the reply */
if (req_p->flags & CY_AS_REQUEST_RESPONSE_MS) {
- uint32_t device ;
+ uint32_t device;
cy_bool state;
cy_as_usb_enum_control *ms_config_p =
(cy_as_usb_enum_control *)config_p;
bus_mask = (uint8_t)
(cy_as_ll_request_response__get_word
- (reply_p, 0) & 0xFF) ;
+ (reply_p, 0) & 0xFF);
for (bus = 0; bus < CY_AS_MAX_BUSES; bus++) {
if (bus_mask & (1 << bus))
- state = cy_true ;
+ state = cy_true;
else
- state = cy_false ;
+ state = cy_false;
for (device = 0; device < CY_AS_MAX_STORAGE_DEVICES;
device++)
ms_config_p->devices_to_enumerate[bus][device]
- = state ;
+ = state;
}
ms_config_p->antioch_enumeration =
(cy_bool)cy_as_ll_request_response__get_word
- (reply_p, 1) ;
+ (reply_p, 1);
- val = cy_as_ll_request_response__get_word(reply_p, 2) ;
+ val = cy_as_ll_request_response__get_word(reply_p, 2);
if (dev_p->is_mtp_firmware) {
- ms_config_p->mass_storage_interface = 0 ;
- ms_config_p->mtp_interface = (uint8_t)(val & 0xFF) ;
+ ms_config_p->mass_storage_interface = 0;
+ ms_config_p->mtp_interface = (uint8_t)(val & 0xFF);
} else {
ms_config_p->mass_storage_interface =
- (uint8_t)(val & 0xFF) ;
- ms_config_p->mtp_interface = 0 ;
+ (uint8_t)(val & 0xFF);
+ ms_config_p->mtp_interface = 0;
}
- ms_config_p->mass_storage_callbacks = (cy_bool)(val >> 8) ;
+ ms_config_p->mass_storage_callbacks = (cy_bool)(val >> 8);
/*
* firmware returns an invalid interface number for mass storage,
@@ -1501,9 +1501,9 @@ my_handle_response_get_enum_config(cy_as_device *dev_p,
*/
if (bus_mask == 0) {
if (dev_p->is_mtp_firmware)
- ms_config_p->mtp_interface = 0 ;
+ ms_config_p->mtp_interface = 0;
else
- ms_config_p->mass_storage_interface = 0 ;
+ ms_config_p->mass_storage_interface = 0;
}
} else {
cy_as_usb_enum_control_dep *ex_config_p =
@@ -1511,13 +1511,13 @@ my_handle_response_get_enum_config(cy_as_device *dev_p,
ex_config_p->enum_mass_storage = (uint8_t)
((cy_as_ll_request_response__get_word
- (reply_p, 0) >> 8) & 0xFF) ;
+ (reply_p, 0) >> 8) & 0xFF);
ex_config_p->antioch_enumeration = (cy_bool)
- cy_as_ll_request_response__get_word(reply_p, 1) ;
+ cy_as_ll_request_response__get_word(reply_p, 1);
- val = cy_as_ll_request_response__get_word(reply_p, 2) ;
- ex_config_p->mass_storage_interface = (uint8_t)(val & 0xFF) ;
- ex_config_p->mass_storage_callbacks = (cy_bool)(val >> 8) ;
+ val = cy_as_ll_request_response__get_word(reply_p, 2);
+ ex_config_p->mass_storage_interface = (uint8_t)(val & 0xFF);
+ ex_config_p->mass_storage_callbacks = (cy_bool)(val >> 8);
/*
* firmware returns an invalid interface number for mass
@@ -1525,14 +1525,14 @@ my_handle_response_get_enum_config(cy_as_device *dev_p,
* be converted to zero to match the input configuration.
*/
if (ex_config_p->enum_mass_storage == 0)
- ex_config_p->mass_storage_interface = 0 ;
+ ex_config_p->mass_storage_interface = 0;
}
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
- return ret ;
+ return ret;
}
/*
@@ -1547,65 +1547,65 @@ my_usb_get_enum_config(cy_as_device_handle handle,
cy_as_function_callback cb,
uint32_t client)
{
- cy_as_ll_request_response *req_p , *reply_p ;
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
+ cy_as_ll_request_response *req_p , *reply_p;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
- cy_as_device *dev_p ;
+ cy_as_device *dev_p;
- cy_as_log_debug_message(6, "cy_as_usb_get_enum_config called") ;
+ cy_as_log_debug_message(6, "cy_as_usb_get_enum_config called");
- dev_p = (cy_as_device *)handle ;
+ dev_p = (cy_as_device *)handle;
if (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE))
- return CY_AS_ERROR_INVALID_HANDLE ;
+ return CY_AS_ERROR_INVALID_HANDLE;
- ret = is_usb_active(dev_p) ;
+ ret = is_usb_active(dev_p);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
if (cy_as_device_is_in_callback(dev_p))
- return CY_AS_ERROR_INVALID_IN_CALLBACK ;
+ return CY_AS_ERROR_INVALID_IN_CALLBACK;
/* Create the request to send to the West Bridge device */
req_p = cy_as_ll_create_request(dev_p,
- CY_RQT_GET_USB_CONFIG, CY_RQT_USB_RQT_CONTEXT, 0) ;
+ CY_RQT_GET_USB_CONFIG, CY_RQT_USB_RQT_CONTEXT, 0);
if (req_p == 0)
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ return CY_AS_ERROR_OUT_OF_MEMORY;
/* Reserve space for the reply, the reply data
* will not exceed two bytes */
- reply_p = cy_as_ll_create_response(dev_p, 3) ;
+ reply_p = cy_as_ll_create_response(dev_p, 3);
if (reply_p == 0) {
- cy_as_ll_destroy_request(dev_p, req_p) ;
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ return CY_AS_ERROR_OUT_OF_MEMORY;
}
if (cb == 0) {
- ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p) ;
+ ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
/* we need to know the type of request to
* know how to manage the data */
req_p->flags |= req_flags;
return my_handle_response_get_enum_config(dev_p,
- req_p, reply_p, config_p) ;
+ req_p, reply_p, config_p);
} else {
ret = cy_as_misc_send_request(dev_p, cb, client,
CY_FUNCT_CB_USB_GETENUMCONFIG, config_p,
dev_p->func_cbs_usb, req_flags, req_p, reply_p,
- cy_as_usb_func_callback) ;
+ cy_as_usb_func_callback);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
- return ret ;
+ return ret;
}
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
- return ret ;
+ return ret;
}
/*
@@ -1637,74 +1637,74 @@ cy_as_usb_set_descriptor(cy_as_device_handle handle,
cy_as_function_callback cb,
uint32_t client)
{
- cy_as_ll_request_response *req_p , *reply_p ;
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
- uint16_t pktlen ;
+ cy_as_ll_request_response *req_p , *reply_p;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
+ uint16_t pktlen;
- cy_as_device *dev_p ;
+ cy_as_device *dev_p;
- cy_as_log_debug_message(6, "cy_as_usb_set_descriptor called") ;
+ cy_as_log_debug_message(6, "cy_as_usb_set_descriptor called");
- dev_p = (cy_as_device *)handle ;
+ dev_p = (cy_as_device *)handle;
if (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE))
- return CY_AS_ERROR_INVALID_HANDLE ;
+ return CY_AS_ERROR_INVALID_HANDLE;
- ret = is_usb_active(dev_p) ;
+ ret = is_usb_active(dev_p);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
if (cy_as_device_is_in_callback(dev_p))
- return CY_AS_ERROR_INVALID_IN_CALLBACK ;
+ return CY_AS_ERROR_INVALID_IN_CALLBACK;
if (length > CY_AS_MAX_USB_DESCRIPTOR_SIZE)
- return CY_AS_ERROR_INVALID_DESCRIPTOR ;
+ return CY_AS_ERROR_INVALID_DESCRIPTOR;
- pktlen = (uint16_t)length / 2 ;
+ pktlen = (uint16_t)length / 2;
if (length % 2)
- pktlen++ ;
- pktlen += 2 ; /* 1 for type, 1 for length */
+ pktlen++;
+ pktlen += 2; /* 1 for type, 1 for length */
/* Create the request to send to the West Bridge device */
req_p = cy_as_ll_create_request(dev_p, CY_RQT_SET_DESCRIPTOR,
- CY_RQT_USB_RQT_CONTEXT, (uint16_t)pktlen) ;
+ CY_RQT_USB_RQT_CONTEXT, (uint16_t)pktlen);
if (req_p == 0)
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ return CY_AS_ERROR_OUT_OF_MEMORY;
cy_as_ll_request_response__set_word(req_p, 0,
- (uint16_t)((uint8_t)type | (index << 8))) ;
+ (uint16_t)((uint8_t)type | (index << 8)));
cy_as_ll_request_response__set_word(req_p, 1,
- (uint16_t)length) ;
- cy_as_ll_request_response__pack(req_p, 2, length, desc_p) ;
+ (uint16_t)length);
+ cy_as_ll_request_response__pack(req_p, 2, length, desc_p);
- reply_p = cy_as_ll_create_response(dev_p, 1) ;
+ reply_p = cy_as_ll_create_response(dev_p, 1);
if (reply_p == 0) {
- cy_as_ll_destroy_request(dev_p, req_p) ;
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ return CY_AS_ERROR_OUT_OF_MEMORY;
}
if (cb == 0) {
- ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p) ;
+ ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
- return my_handle_response_no_data(dev_p, req_p, reply_p) ;
+ return my_handle_response_no_data(dev_p, req_p, reply_p);
} else {
ret = cy_as_misc_send_request(dev_p, cb, client,
CY_FUNCT_CB_USB_SETDESCRIPTOR, 0, dev_p->func_cbs_usb,
CY_AS_REQUEST_RESPONSE_EX, req_p, reply_p,
- cy_as_usb_func_callback) ;
+ cy_as_usb_func_callback);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
- return ret ;
+ return ret;
}
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
- return ret ;
+ return ret;
}
/*
@@ -1716,61 +1716,61 @@ cy_as_usb_clear_descriptors(cy_as_device_handle handle,
cy_as_function_callback cb,
uint32_t client)
{
- cy_as_ll_request_response *req_p , *reply_p ;
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
+ cy_as_ll_request_response *req_p , *reply_p;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
- cy_as_device *dev_p ;
+ cy_as_device *dev_p;
- cy_as_log_debug_message(6, "cy_as_usb_clear_descriptors called") ;
+ cy_as_log_debug_message(6, "cy_as_usb_clear_descriptors called");
- dev_p = (cy_as_device *)handle ;
+ dev_p = (cy_as_device *)handle;
if (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE))
- return CY_AS_ERROR_INVALID_HANDLE ;
+ return CY_AS_ERROR_INVALID_HANDLE;
- ret = is_usb_active(dev_p) ;
+ ret = is_usb_active(dev_p);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
if ((cy_as_device_is_in_callback(dev_p)) && (cb == 0))
- return CY_AS_ERROR_INVALID_IN_CALLBACK ;
+ return CY_AS_ERROR_INVALID_IN_CALLBACK;
/* Create the request to send to the West Bridge device */
req_p = cy_as_ll_create_request(dev_p,
- CY_RQT_CLEAR_DESCRIPTORS, CY_RQT_USB_RQT_CONTEXT, 1) ;
+ CY_RQT_CLEAR_DESCRIPTORS, CY_RQT_USB_RQT_CONTEXT, 1);
if (req_p == 0)
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ return CY_AS_ERROR_OUT_OF_MEMORY;
- reply_p = cy_as_ll_create_response(dev_p, 1) ;
+ reply_p = cy_as_ll_create_response(dev_p, 1);
if (reply_p == 0) {
- cy_as_ll_destroy_request(dev_p, req_p) ;
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ return CY_AS_ERROR_OUT_OF_MEMORY;
}
if (cb == 0) {
- ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p) ;
+ ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
- return my_handle_response_no_data(dev_p, req_p, reply_p) ;
+ return my_handle_response_no_data(dev_p, req_p, reply_p);
} else {
ret = cy_as_misc_send_request(dev_p, cb, client,
CY_FUNCT_CB_USB_CLEARDESCRIPTORS, 0,
dev_p->func_cbs_usb,
CY_AS_REQUEST_RESPONSE_EX, req_p, reply_p,
- cy_as_usb_func_callback) ;
+ cy_as_usb_func_callback);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
- return ret ;
+ return ret;
}
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
- return ret ;
+ return ret;
}
static cy_as_return_status_t
@@ -1779,34 +1779,34 @@ my_handle_response_get_descriptor(cy_as_device *dev_p,
cy_as_ll_request_response *reply_p,
cy_as_get_descriptor_data *data)
{
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
- uint32_t retlen ;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
+ uint32_t retlen;
if (cy_as_ll_request_response__get_code(reply_p) ==
CY_RESP_SUCCESS_FAILURE) {
- ret = cy_as_ll_request_response__get_word(reply_p, 0) ;
- goto destroy ;
+ ret = cy_as_ll_request_response__get_word(reply_p, 0);
+ goto destroy;
} else if (cy_as_ll_request_response__get_code(reply_p) !=
CY_RESP_USB_DESCRIPTOR) {
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
- goto destroy ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
+ goto destroy;
}
- retlen = cy_as_ll_request_response__get_word(reply_p, 0) ;
+ retlen = cy_as_ll_request_response__get_word(reply_p, 0);
if (retlen > data->length) {
- ret = CY_AS_ERROR_INVALID_SIZE ;
- goto destroy ;
+ ret = CY_AS_ERROR_INVALID_SIZE;
+ goto destroy;
}
- ret = CY_AS_ERROR_SUCCESS ;
+ ret = CY_AS_ERROR_SUCCESS;
cy_as_ll_request_response__unpack(reply_p, 1,
- retlen, data->desc_p) ;
+ retlen, data->desc_p);
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
- return ret ;
+ return ret;
}
/*
@@ -1820,96 +1820,96 @@ cy_as_usb_get_descriptor(cy_as_device_handle handle,
cy_as_function_callback cb,
uint32_t client)
{
- cy_as_return_status_t ret ;
- cy_as_ll_request_response *req_p , *reply_p ;
+ cy_as_return_status_t ret;
+ cy_as_ll_request_response *req_p , *reply_p;
- cy_as_device *dev_p ;
+ cy_as_device *dev_p;
- cy_as_log_debug_message(6, "cy_as_usb_get_descriptor called") ;
+ cy_as_log_debug_message(6, "cy_as_usb_get_descriptor called");
- dev_p = (cy_as_device *)handle ;
+ dev_p = (cy_as_device *)handle;
if (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE))
- return CY_AS_ERROR_INVALID_HANDLE ;
+ return CY_AS_ERROR_INVALID_HANDLE;
- ret = is_usb_active(dev_p) ;
+ ret = is_usb_active(dev_p);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
if (cy_as_device_is_in_callback(dev_p))
- return CY_AS_ERROR_INVALID_IN_CALLBACK ;
+ return CY_AS_ERROR_INVALID_IN_CALLBACK;
/* Create the request to send to the West Bridge device */
req_p = cy_as_ll_create_request(dev_p,
- CY_RQT_GET_DESCRIPTOR, CY_RQT_USB_RQT_CONTEXT, 1) ;
+ CY_RQT_GET_DESCRIPTOR, CY_RQT_USB_RQT_CONTEXT, 1);
if (req_p == 0)
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ return CY_AS_ERROR_OUT_OF_MEMORY;
cy_as_ll_request_response__set_word(req_p, 0,
- (uint16_t)((uint8_t)type | (index << 8))) ;
+ (uint16_t)((uint8_t)type | (index << 8)));
/* Add one for the length field */
reply_p = cy_as_ll_create_response(dev_p,
- CY_AS_MAX_USB_DESCRIPTOR_SIZE + 1) ;
+ CY_AS_MAX_USB_DESCRIPTOR_SIZE + 1);
if (reply_p == 0) {
- cy_as_ll_destroy_request(dev_p, req_p) ;
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ return CY_AS_ERROR_OUT_OF_MEMORY;
}
if (cb == 0) {
ret = cy_as_ll_send_request_wait_reply(
- dev_p, req_p, reply_p) ;
+ dev_p, req_p, reply_p);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
return my_handle_response_get_descriptor(dev_p,
- req_p, reply_p, data) ;
+ req_p, reply_p, data);
} else {
ret = cy_as_misc_send_request(dev_p, cb, client,
CY_FUNCT_CB_USB_GETDESCRIPTOR, data,
dev_p->func_cbs_usb,
CY_AS_REQUEST_RESPONSE_EX, req_p,
- reply_p, cy_as_usb_func_callback) ;
+ reply_p, cy_as_usb_func_callback);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
- return ret ;
+ return ret;
}
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
- return ret ;
+ return ret;
}
cy_as_return_status_t
cy_as_usb_set_physical_configuration(cy_as_device_handle handle,
uint8_t config)
{
- cy_as_return_status_t ret ;
- cy_as_device *dev_p ;
+ cy_as_return_status_t ret;
+ cy_as_device *dev_p;
cy_as_log_debug_message(6,
- "cy_as_usb_set_physical_configuration called") ;
+ "cy_as_usb_set_physical_configuration called");
- dev_p = (cy_as_device *)handle ;
+ dev_p = (cy_as_device *)handle;
if (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE))
- return CY_AS_ERROR_INVALID_HANDLE ;
+ return CY_AS_ERROR_INVALID_HANDLE;
- ret = is_usb_active(dev_p) ;
+ ret = is_usb_active(dev_p);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
if (cy_as_device_is_usb_connected(dev_p))
- return CY_AS_ERROR_USB_CONNECTED ;
+ return CY_AS_ERROR_USB_CONNECTED;
if (config < 1 || config > 12)
- return CY_AS_ERROR_INVALID_CONFIGURATION ;
+ return CY_AS_ERROR_INVALID_CONFIGURATION;
- dev_p->usb_phy_config = config ;
+ dev_p->usb_phy_config = config;
- return CY_AS_ERROR_SUCCESS ;
+ return CY_AS_ERROR_SUCCESS;
}
static cy_bool
@@ -1928,9 +1928,9 @@ is_physical_valid(uint8_t config, cy_as_end_point_number_t ep)
0x0d, /* Config 10 - 1, 3, 4 */
0x09, /* Config 11 - 1, 4 */
0x01 /* Config 12 - 1 */
- } ;
+ };
- return (validmask[config - 1] & (1 << (ep - 1))) ? cy_true : cy_false ;
+ return (validmask[config - 1] & (1 << (ep - 1))) ? cy_true : cy_false;
}
/*
@@ -1940,35 +1940,35 @@ cy_as_return_status_t
cy_as_usb_set_end_point_config(cy_as_device_handle handle,
cy_as_end_point_number_t ep, cy_as_usb_end_point_config *config_p)
{
- cy_as_return_status_t ret ;
- cy_as_device *dev_p ;
+ cy_as_return_status_t ret;
+ cy_as_device *dev_p;
- cy_as_log_debug_message(6, "cy_as_usb_set_end_point_config called") ;
+ cy_as_log_debug_message(6, "cy_as_usb_set_end_point_config called");
- dev_p = (cy_as_device *)handle ;
+ dev_p = (cy_as_device *)handle;
if (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE))
- return CY_AS_ERROR_INVALID_HANDLE ;
+ return CY_AS_ERROR_INVALID_HANDLE;
- ret = is_usb_active(dev_p) ;
+ ret = is_usb_active(dev_p);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
if (cy_as_device_is_usb_connected(dev_p))
- return CY_AS_ERROR_USB_CONNECTED ;
+ return CY_AS_ERROR_USB_CONNECTED;
if (ep >= 16 || ep == 2 || ep == 4 || ep == 6 || ep == 8)
- return CY_AS_ERROR_INVALID_ENDPOINT ;
+ return CY_AS_ERROR_INVALID_ENDPOINT;
if (ep == 0) {
/* Endpoint 0 must be 64 byte, dir IN/OUT,
* and control type */
if (config_p->dir != cy_as_usb_in_out ||
config_p->type != cy_as_usb_control)
- return CY_AS_ERROR_INVALID_CONFIGURATION ;
+ return CY_AS_ERROR_INVALID_CONFIGURATION;
} else if (ep == 1) {
if ((dev_p->is_mtp_firmware == 1) &&
(dev_p->usb_config[1].enabled == cy_true)) {
- return CY_AS_ERROR_INVALID_ENDPOINT ;
+ return CY_AS_ERROR_INVALID_ENDPOINT;
}
/*
@@ -1977,15 +1977,15 @@ cy_as_usb_set_end_point_config(cy_as_device_handle handle,
if ((config_p->type == cy_as_usb_control) ||
(config_p->type == cy_as_usb_iso) ||
(config_p->dir == cy_as_usb_in_out))
- return CY_AS_ERROR_INVALID_CONFIGURATION ;
+ return CY_AS_ERROR_INVALID_CONFIGURATION;
} else {
if (config_p->dir == cy_as_usb_in_out ||
config_p->type == cy_as_usb_control)
- return CY_AS_ERROR_INVALID_CONFIGURATION ;
+ return CY_AS_ERROR_INVALID_CONFIGURATION;
if (!is_physical_valid(dev_p->usb_phy_config,
config_p->physical))
- return CY_AS_ERROR_INVALID_PHYSICAL_ENDPOINT ;
+ return CY_AS_ERROR_INVALID_PHYSICAL_ENDPOINT;
/*
* ISO endpoints must be on E_ps 3, 5, 7 or 9 as
@@ -1994,25 +1994,25 @@ cy_as_usb_set_end_point_config(cy_as_device_handle handle,
*/
if (config_p->type == cy_as_usb_iso) {
if (ep != 3 && ep != 5 && ep != 7 && ep != 9)
- return CY_AS_ERROR_INVALID_CONFIGURATION ;
+ return CY_AS_ERROR_INVALID_CONFIGURATION;
if (ep == 3 && config_p->physical != 1)
- return CY_AS_ERROR_INVALID_CONFIGURATION ;
+ return CY_AS_ERROR_INVALID_CONFIGURATION;
if (ep == 5 && config_p->physical != 2)
- return CY_AS_ERROR_INVALID_CONFIGURATION ;
+ return CY_AS_ERROR_INVALID_CONFIGURATION;
if (ep == 7 && config_p->physical != 3)
- return CY_AS_ERROR_INVALID_CONFIGURATION ;
+ return CY_AS_ERROR_INVALID_CONFIGURATION;
if (ep == 9 && config_p->physical != 4)
- return CY_AS_ERROR_INVALID_CONFIGURATION ;
+ return CY_AS_ERROR_INVALID_CONFIGURATION;
}
}
/* Store the configuration information until a
* CyAsUsbCommitConfig is done */
- dev_p->usb_config[ep] = *config_p ;
+ dev_p->usb_config[ep] = *config_p;
/* If the endpoint is enabled, enable DMA associated
* with the endpoint */
@@ -2023,36 +2023,36 @@ cy_as_usb_set_end_point_config(cy_as_device_handle handle,
*/
cy_as_hal_assert((int)cy_as_usb_in == (int)cy_as_direction_in);
cy_as_hal_assert((int)cy_as_usb_out == (int)cy_as_direction_out);
- cy_as_hal_assert((int)cy_as_usb_in_out == (int)cy_as_direction_in_out) ;
+ cy_as_hal_assert((int)cy_as_usb_in_out == (int)cy_as_direction_in_out);
return cy_as_dma_enable_end_point(dev_p, ep,
- config_p->enabled, (cy_as_dma_direction)config_p->dir) ;
+ config_p->enabled, (cy_as_dma_direction)config_p->dir);
}
cy_as_return_status_t
cy_as_usb_get_end_point_config(cy_as_device_handle handle,
cy_as_end_point_number_t ep, cy_as_usb_end_point_config *config_p)
{
- cy_as_return_status_t ret ;
+ cy_as_return_status_t ret;
- cy_as_device *dev_p ;
+ cy_as_device *dev_p;
- cy_as_log_debug_message(6, "cy_as_usb_get_end_point_config called") ;
+ cy_as_log_debug_message(6, "cy_as_usb_get_end_point_config called");
- dev_p = (cy_as_device *)handle ;
+ dev_p = (cy_as_device *)handle;
if (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE))
- return CY_AS_ERROR_INVALID_HANDLE ;
+ return CY_AS_ERROR_INVALID_HANDLE;
- ret = is_usb_active(dev_p) ;
+ ret = is_usb_active(dev_p);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
if (ep >= 16 || ep == 2 || ep == 4 || ep == 6 || ep == 8)
- return CY_AS_ERROR_INVALID_ENDPOINT ;
+ return CY_AS_ERROR_INVALID_ENDPOINT;
- *config_p = dev_p->usb_config[ep] ;
+ *config_p = dev_p->usb_config[ep];
- return CY_AS_ERROR_SUCCESS ;
+ return CY_AS_ERROR_SUCCESS;
}
/*
@@ -2063,27 +2063,27 @@ cy_as_usb_commit_config(cy_as_device_handle handle,
cy_as_function_callback cb,
uint32_t client)
{
- uint32_t i ;
- cy_as_return_status_t ret ;
- cy_as_ll_request_response *req_p , *reply_p ;
- cy_as_device *dev_p ;
- uint16_t data ;
+ uint32_t i;
+ cy_as_return_status_t ret;
+ cy_as_ll_request_response *req_p , *reply_p;
+ cy_as_device *dev_p;
+ uint16_t data;
- cy_as_log_debug_message(6, "cy_as_usb_commit_config called") ;
+ cy_as_log_debug_message(6, "cy_as_usb_commit_config called");
- dev_p = (cy_as_device *)handle ;
+ dev_p = (cy_as_device *)handle;
if (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE))
- return CY_AS_ERROR_INVALID_HANDLE ;
+ return CY_AS_ERROR_INVALID_HANDLE;
- ret = is_usb_active(dev_p) ;
+ ret = is_usb_active(dev_p);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
if (cy_as_device_is_usb_connected(dev_p))
- return CY_AS_ERROR_USB_CONNECTED ;
+ return CY_AS_ERROR_USB_CONNECTED;
if (cy_as_device_is_in_callback(dev_p))
- return CY_AS_ERROR_INVALID_IN_CALLBACK ;
+ return CY_AS_ERROR_INVALID_IN_CALLBACK;
/*
* this performs the mapping based on informatation that was
@@ -2092,9 +2092,9 @@ cy_as_usb_commit_config(cy_as_device_handle handle,
* setting the the 14 register values contained in usb_lepcfg
* and usb_pepcfg
*/
- ret = cy_as_usb_map_logical2_physical(dev_p) ;
+ ret = cy_as_usb_map_logical2_physical(dev_p);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
/*
* now, package the information about the various logical and
@@ -2102,17 +2102,17 @@ cy_as_usb_commit_config(cy_as_device_handle handle,
* across to the west bridge device.
*/
req_p = cy_as_ll_create_request(dev_p,
- CY_RQT_SET_USB_CONFIG_REGISTERS, CY_RQT_USB_RQT_CONTEXT, 8) ;
+ CY_RQT_SET_USB_CONFIG_REGISTERS, CY_RQT_USB_RQT_CONTEXT, 8);
if (req_p == 0)
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ return CY_AS_ERROR_OUT_OF_MEMORY;
cy_as_hal_print_message("USB configuration: %d\n",
- dev_p->usb_phy_config) ;
+ dev_p->usb_phy_config);
cy_as_hal_print_message("EP1OUT: 0x%02x EP1IN: 0x%02x\n",
- dev_p->usb_ep1cfg[0], dev_p->usb_ep1cfg[1]) ;
+ dev_p->usb_ep1cfg[0], dev_p->usb_ep1cfg[1]);
cy_as_hal_print_message("PEP registers: 0x%02x 0x%02x 0x%02x 0x%02x\n",
dev_p->usb_pepcfg[0], dev_p->usb_pepcfg[1],
- dev_p->usb_pepcfg[2], dev_p->usb_pepcfg[3]) ;
+ dev_p->usb_pepcfg[2], dev_p->usb_pepcfg[3]);
cy_as_hal_print_message("LEP registers: 0x%02x 0x%02x 0x%02x "
"0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n",
@@ -2120,66 +2120,66 @@ cy_as_usb_commit_config(cy_as_device_handle handle,
dev_p->usb_lepcfg[2], dev_p->usb_lepcfg[3],
dev_p->usb_lepcfg[4], dev_p->usb_lepcfg[5],
dev_p->usb_lepcfg[6], dev_p->usb_lepcfg[7],
- dev_p->usb_lepcfg[8], dev_p->usb_lepcfg[9]) ;
+ dev_p->usb_lepcfg[8], dev_p->usb_lepcfg[9]);
/* Write the EP1OUTCFG and EP1INCFG data in the first word. */
data = (uint16_t)((dev_p->usb_ep1cfg[0] << 8) |
- dev_p->usb_ep1cfg[1]) ;
- cy_as_ll_request_response__set_word(req_p, 0, data) ;
+ dev_p->usb_ep1cfg[1]);
+ cy_as_ll_request_response__set_word(req_p, 0, data);
/* Write the PEP CFG data in the next 2 words */
- for (i = 0 ; i < 4 ; i += 2) {
+ for (i = 0; i < 4; i += 2) {
data = (uint16_t)((dev_p->usb_pepcfg[i] << 8) |
- dev_p->usb_pepcfg[i + 1]) ;
+ dev_p->usb_pepcfg[i + 1]);
cy_as_ll_request_response__set_word(req_p,
- 1 + i / 2, data) ;
+ 1 + i / 2, data);
}
/* Write the LEP CFG data in the next 5 words */
- for (i = 0 ; i < 10 ; i += 2) {
+ for (i = 0; i < 10; i += 2) {
data = (uint16_t)((dev_p->usb_lepcfg[i] << 8) |
- dev_p->usb_lepcfg[i + 1]) ;
+ dev_p->usb_lepcfg[i + 1]);
cy_as_ll_request_response__set_word(req_p,
- 3 + i / 2, data) ;
+ 3 + i / 2, data);
}
/* A single status word response type */
- reply_p = cy_as_ll_create_response(dev_p, 1) ;
+ reply_p = cy_as_ll_create_response(dev_p, 1);
if (reply_p == 0) {
- cy_as_ll_destroy_request(dev_p, req_p) ;
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ return CY_AS_ERROR_OUT_OF_MEMORY;
}
if (cb == 0) {
ret = cy_as_ll_send_request_wait_reply(dev_p,
- req_p, reply_p) ;
+ req_p, reply_p);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
ret = my_handle_response_no_data(dev_p,
- req_p, reply_p) ;
+ req_p, reply_p);
if (ret == CY_AS_ERROR_SUCCESS)
- ret = cy_as_usb_setup_dma(dev_p) ;
+ ret = cy_as_usb_setup_dma(dev_p);
- return ret ;
+ return ret;
} else {
ret = cy_as_misc_send_request(dev_p, cb, client,
CY_FUNCT_CB_USB_COMMITCONFIG, 0, dev_p->func_cbs_usb,
CY_AS_REQUEST_RESPONSE_EX, req_p, reply_p,
- cy_as_usb_func_callback) ;
+ cy_as_usb_func_callback);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
- return ret ;
+ return ret;
}
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
- return ret ;
+ return ret;
}
static void
@@ -2187,11 +2187,11 @@ sync_request_callback(cy_as_device *dev_p,
cy_as_end_point_number_t ep, void *buf_p,
uint32_t size, cy_as_return_status_t err)
{
- (void)ep ;
- (void)buf_p ;
+ (void)ep;
+ (void)buf_p;
- dev_p->usb_error = err ;
- dev_p->usb_actual_cnt = size ;
+ dev_p->usb_error = err;
+ dev_p->usb_actual_cnt = size;
}
static void
@@ -2199,26 +2199,26 @@ async_read_request_callback(cy_as_device *dev_p,
cy_as_end_point_number_t ep, void *buf_p,
uint32_t size, cy_as_return_status_t err)
{
- cy_as_device_handle h ;
+ cy_as_device_handle h;
cy_as_log_debug_message(6,
- "async_read_request_callback called") ;
+ "async_read_request_callback called");
- h = (cy_as_device_handle)dev_p ;
+ h = (cy_as_device_handle)dev_p;
if (ep == 0 && cy_as_device_is_ack_delayed(dev_p)) {
- dev_p->usb_pending_buffer = buf_p ;
- dev_p->usb_pending_size = size ;
- dev_p->usb_error = err ;
- cy_as_usb_ack_setup_packet(h, usb_ack_callback, 0) ;
+ dev_p->usb_pending_buffer = buf_p;
+ dev_p->usb_pending_size = size;
+ dev_p->usb_error = err;
+ cy_as_usb_ack_setup_packet(h, usb_ack_callback, 0);
} else {
- cy_as_usb_io_callback cb ;
+ cy_as_usb_io_callback cb;
- cb = dev_p->usb_cb[ep] ;
- dev_p->usb_cb[ep] = 0 ;
- cy_as_device_clear_usb_async_pending(dev_p, ep) ;
+ cb = dev_p->usb_cb[ep];
+ dev_p->usb_cb[ep] = 0;
+ cy_as_device_clear_usb_async_pending(dev_p, ep);
if (cb)
- cb(h, ep, size, buf_p, err) ;
+ cb(h, ep, size, buf_p, err);
}
}
@@ -2227,29 +2227,29 @@ async_write_request_callback(cy_as_device *dev_p,
cy_as_end_point_number_t ep, void *buf_p,
uint32_t size, cy_as_return_status_t err)
{
- cy_as_device_handle h ;
+ cy_as_device_handle h;
cy_as_log_debug_message(6,
- "async_write_request_callback called") ;
+ "async_write_request_callback called");
- h = (cy_as_device_handle)dev_p ;
+ h = (cy_as_device_handle)dev_p;
if (ep == 0 && cy_as_device_is_ack_delayed(dev_p)) {
- dev_p->usb_pending_buffer = buf_p ;
- dev_p->usb_pending_size = size ;
- dev_p->usb_error = err ;
+ dev_p->usb_pending_buffer = buf_p;
+ dev_p->usb_pending_size = size;
+ dev_p->usb_error = err;
/* The west bridge protocol generates ZLPs as required. */
- cy_as_usb_ack_setup_packet(h, usb_ack_callback, 0) ;
+ cy_as_usb_ack_setup_packet(h, usb_ack_callback, 0);
} else {
- cy_as_usb_io_callback cb ;
+ cy_as_usb_io_callback cb;
- cb = dev_p->usb_cb[ep] ;
- dev_p->usb_cb[ep] = 0 ;
+ cb = dev_p->usb_cb[ep];
+ dev_p->usb_cb[ep] = 0;
- cy_as_device_clear_usb_async_pending(dev_p, ep) ;
+ cy_as_device_clear_usb_async_pending(dev_p, ep);
if (cb)
- cb(h, ep, size, buf_p, err) ;
+ cb(h, ep, size, buf_p, err);
}
}
@@ -2260,24 +2260,24 @@ my_turbo_rqt_callback(cy_as_device *dev_p,
cy_as_ll_request_response *resp,
cy_as_return_status_t stat)
{
- uint8_t code ;
+ uint8_t code;
- (void)context ;
- (void)stat ;
+ (void)context;
+ (void)stat;
/* The Handlers are responsible for Deleting the rqt and resp when
* they are finished
*/
- code = cy_as_ll_request_response__get_code(rqt) ;
+ code = cy_as_ll_request_response__get_code(rqt);
switch (code) {
case CY_RQT_TURBO_SWITCH_ENDPOINT:
- cy_as_hal_assert(stat == CY_AS_ERROR_SUCCESS) ;
- cy_as_ll_destroy_request(dev_p, rqt) ;
- cy_as_ll_destroy_response(dev_p, resp) ;
+ cy_as_hal_assert(stat == CY_AS_ERROR_SUCCESS);
+ cy_as_ll_destroy_request(dev_p, rqt);
+ cy_as_ll_destroy_response(dev_p, resp);
break;
default:
- cy_as_hal_assert(cy_false) ;
- break ;
+ cy_as_hal_assert(cy_false);
+ break;
}
}
@@ -2285,39 +2285,39 @@ my_turbo_rqt_callback(cy_as_device *dev_p,
static cy_as_return_status_t
my_send_turbo_switch(cy_as_device *dev_p, uint32_t size, cy_bool pktread)
{
- cy_as_return_status_t ret ;
- cy_as_ll_request_response *req_p , *reply_p ;
+ cy_as_return_status_t ret;
+ cy_as_ll_request_response *req_p , *reply_p;
/* Create the request to send to the West Bridge device */
req_p = cy_as_ll_create_request(dev_p,
- CY_RQT_TURBO_SWITCH_ENDPOINT, CY_RQT_TUR_RQT_CONTEXT, 3) ;
+ CY_RQT_TURBO_SWITCH_ENDPOINT, CY_RQT_TUR_RQT_CONTEXT, 3);
if (req_p == 0)
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ return CY_AS_ERROR_OUT_OF_MEMORY;
/* Reserve space for the reply, the reply data will
* not exceed one word */
- reply_p = cy_as_ll_create_response(dev_p, 1) ;
+ reply_p = cy_as_ll_create_response(dev_p, 1);
if (reply_p == 0) {
- cy_as_ll_destroy_request(dev_p, req_p) ;
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ return CY_AS_ERROR_OUT_OF_MEMORY;
}
cy_as_ll_request_response__set_word(req_p, 0,
- (uint16_t)pktread) ;
+ (uint16_t)pktread);
cy_as_ll_request_response__set_word(req_p, 1,
- (uint16_t)((size >> 16) & 0xFFFF)) ;
+ (uint16_t)((size >> 16) & 0xFFFF));
cy_as_ll_request_response__set_word(req_p, 2,
- (uint16_t)(size & 0xFFFF)) ;
+ (uint16_t)(size & 0xFFFF));
ret = cy_as_ll_send_request(dev_p, req_p,
- reply_p, cy_false, my_turbo_rqt_callback) ;
+ reply_p, cy_false, my_turbo_rqt_callback);
if (ret != CY_AS_ERROR_SUCCESS) {
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_request(dev_p, reply_p) ;
- return ret ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_request(dev_p, reply_p);
+ return ret;
}
- return CY_AS_ERROR_SUCCESS ;
+ return CY_AS_ERROR_SUCCESS;
}
cy_as_return_status_t
@@ -2325,62 +2325,62 @@ cy_as_usb_read_data(cy_as_device_handle handle,
cy_as_end_point_number_t ep, cy_bool pktread,
uint32_t dsize, uint32_t *dataread, void *data)
{
- cy_as_return_status_t ret ;
- cy_as_device *dev_p ;
+ cy_as_return_status_t ret;
+ cy_as_device *dev_p;
- cy_as_log_debug_message(6, "cy_as_usb_read_data called") ;
+ cy_as_log_debug_message(6, "cy_as_usb_read_data called");
- dev_p = (cy_as_device *)handle ;
+ dev_p = (cy_as_device *)handle;
if (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE))
- return CY_AS_ERROR_INVALID_HANDLE ;
+ return CY_AS_ERROR_INVALID_HANDLE;
- ret = is_usb_active(dev_p) ;
+ ret = is_usb_active(dev_p);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
if (cy_as_device_is_in_callback(dev_p))
- return CY_AS_ERROR_INVALID_IN_CALLBACK ;
+ return CY_AS_ERROR_INVALID_IN_CALLBACK;
if (ep >= 16 || ep == 4 || ep == 6 || ep == 8)
- return CY_AS_ERROR_INVALID_ENDPOINT ;
+ return CY_AS_ERROR_INVALID_ENDPOINT;
/* EP2 is available for reading when MTP is active */
if (dev_p->mtp_count == 0 && ep == CY_AS_MTP_READ_ENDPOINT)
- return CY_AS_ERROR_INVALID_ENDPOINT ;
+ return CY_AS_ERROR_INVALID_ENDPOINT;
/* If the endpoint is disabled, we cannot
* write data to the endpoint */
if (!dev_p->usb_config[ep].enabled)
- return CY_AS_ERROR_ENDPOINT_DISABLED ;
+ return CY_AS_ERROR_ENDPOINT_DISABLED;
if (dev_p->usb_config[ep].dir != cy_as_usb_out)
- return CY_AS_ERROR_USB_BAD_DIRECTION ;
+ return CY_AS_ERROR_USB_BAD_DIRECTION;
ret = cy_as_dma_queue_request(dev_p, ep, data, dsize,
- pktread, cy_true, sync_request_callback) ;
+ pktread, cy_true, sync_request_callback);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
if (ep == CY_AS_MTP_READ_ENDPOINT) {
- ret = my_send_turbo_switch(dev_p, dsize, pktread) ;
+ ret = my_send_turbo_switch(dev_p, dsize, pktread);
if (ret != CY_AS_ERROR_SUCCESS) {
- cy_as_dma_cancel(dev_p, ep, ret) ;
- return ret ;
+ cy_as_dma_cancel(dev_p, ep, ret);
+ return ret;
}
- ret = cy_as_dma_drain_queue(dev_p, ep, cy_false) ;
+ ret = cy_as_dma_drain_queue(dev_p, ep, cy_false);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
} else {
- ret = cy_as_dma_drain_queue(dev_p, ep, cy_true) ;
+ ret = cy_as_dma_drain_queue(dev_p, ep, cy_true);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
}
- ret = dev_p->usb_error ;
- *dataread = dev_p->usb_actual_cnt ;
+ ret = dev_p->usb_error;
+ *dataread = dev_p->usb_actual_cnt;
- return ret ;
+ return ret;
}
cy_as_return_status_t
@@ -2388,35 +2388,35 @@ cy_as_usb_read_data_async(cy_as_device_handle handle,
cy_as_end_point_number_t ep, cy_bool pktread,
uint32_t dsize, void *data, cy_as_usb_io_callback cb)
{
- cy_as_return_status_t ret ;
- uint32_t mask ;
- cy_as_device *dev_p ;
+ cy_as_return_status_t ret;
+ uint32_t mask;
+ cy_as_device *dev_p;
- cy_as_log_debug_message(6, "cy_as_usb_read_data_async called") ;
+ cy_as_log_debug_message(6, "cy_as_usb_read_data_async called");
- dev_p = (cy_as_device *)handle ;
+ dev_p = (cy_as_device *)handle;
if (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE))
- return CY_AS_ERROR_INVALID_HANDLE ;
+ return CY_AS_ERROR_INVALID_HANDLE;
- ret = is_usb_active(dev_p) ;
+ ret = is_usb_active(dev_p);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
if (ep >= 16 || ep == 4 || ep == 6 || ep == 8)
- return CY_AS_ERROR_INVALID_ENDPOINT ;
+ return CY_AS_ERROR_INVALID_ENDPOINT;
/* EP2 is available for reading when MTP is active */
if (dev_p->mtp_count == 0 && ep == CY_AS_MTP_READ_ENDPOINT)
- return CY_AS_ERROR_INVALID_ENDPOINT ;
+ return CY_AS_ERROR_INVALID_ENDPOINT;
/* If the endpoint is disabled, we cannot
* write data to the endpoint */
if (!dev_p->usb_config[ep].enabled)
- return CY_AS_ERROR_ENDPOINT_DISABLED ;
+ return CY_AS_ERROR_ENDPOINT_DISABLED;
if (dev_p->usb_config[ep].dir != cy_as_usb_out &&
dev_p->usb_config[ep].dir != cy_as_usb_in_out)
- return CY_AS_ERROR_USB_BAD_DIRECTION ;
+ return CY_AS_ERROR_USB_BAD_DIRECTION;
/*
* since async operations can be triggered by interrupt
@@ -2424,153 +2424,153 @@ cy_as_usb_read_data_async(cy_as_device_handle handle,
* operations going at one time and protect this test and
* set operation from interrupts.
*/
- mask = cy_as_hal_disable_interrupts() ;
+ mask = cy_as_hal_disable_interrupts();
if (cy_as_device_is_usb_async_pending(dev_p, ep)) {
- cy_as_hal_enable_interrupts(mask) ;
- return CY_AS_ERROR_ASYNC_PENDING ;
+ cy_as_hal_enable_interrupts(mask);
+ return CY_AS_ERROR_ASYNC_PENDING;
}
- cy_as_device_set_usb_async_pending(dev_p, ep) ;
+ cy_as_device_set_usb_async_pending(dev_p, ep);
/*
* if this is for EP0, we set this bit to delay the
* ACK response until after this read has completed.
*/
if (ep == 0)
- cy_as_device_set_ack_delayed(dev_p) ;
+ cy_as_device_set_ack_delayed(dev_p);
- cy_as_hal_enable_interrupts(mask) ;
+ cy_as_hal_enable_interrupts(mask);
- cy_as_hal_assert(dev_p->usb_cb[ep] == 0) ;
- dev_p->usb_cb[ep] = cb ;
+ cy_as_hal_assert(dev_p->usb_cb[ep] == 0);
+ dev_p->usb_cb[ep] = cb;
ret = cy_as_dma_queue_request(dev_p, ep, data, dsize,
- pktread, cy_true, async_read_request_callback) ;
+ pktread, cy_true, async_read_request_callback);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
if (ep == CY_AS_MTP_READ_ENDPOINT) {
- ret = my_send_turbo_switch(dev_p, dsize, pktread) ;
+ ret = my_send_turbo_switch(dev_p, dsize, pktread);
if (ret != CY_AS_ERROR_SUCCESS) {
- cy_as_dma_cancel(dev_p, ep, ret) ;
- return ret ;
+ cy_as_dma_cancel(dev_p, ep, ret);
+ return ret;
}
} else {
/* Kick start the queue if it is not running */
- cy_as_dma_kick_start(dev_p, ep) ;
+ cy_as_dma_kick_start(dev_p, ep);
}
- return ret ;
+ return ret;
}
cy_as_return_status_t
cy_as_usb_write_data(cy_as_device_handle handle,
cy_as_end_point_number_t ep, uint32_t dsize, void *data)
{
- cy_as_return_status_t ret ;
- cy_as_device *dev_p ;
+ cy_as_return_status_t ret;
+ cy_as_device *dev_p;
- cy_as_log_debug_message(6, "cy_as_usb_write_data called") ;
+ cy_as_log_debug_message(6, "cy_as_usb_write_data called");
- dev_p = (cy_as_device *)handle ;
+ dev_p = (cy_as_device *)handle;
if (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE))
- return CY_AS_ERROR_INVALID_HANDLE ;
+ return CY_AS_ERROR_INVALID_HANDLE;
- ret = is_usb_active(dev_p) ;
+ ret = is_usb_active(dev_p);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
if (cy_as_device_is_in_callback(dev_p))
- return CY_AS_ERROR_INVALID_IN_CALLBACK ;
+ return CY_AS_ERROR_INVALID_IN_CALLBACK;
if (ep >= 16 || ep == 2 || ep == 4 || ep == 8)
- return CY_AS_ERROR_INVALID_ENDPOINT ;
+ return CY_AS_ERROR_INVALID_ENDPOINT;
/* EP6 is available for writing when MTP is active */
if (dev_p->mtp_count == 0 && ep == CY_AS_MTP_WRITE_ENDPOINT)
- return CY_AS_ERROR_INVALID_ENDPOINT ;
+ return CY_AS_ERROR_INVALID_ENDPOINT;
/* If the endpoint is disabled, we cannot
* write data to the endpoint */
if (!dev_p->usb_config[ep].enabled)
- return CY_AS_ERROR_ENDPOINT_DISABLED ;
+ return CY_AS_ERROR_ENDPOINT_DISABLED;
if (dev_p->usb_config[ep].dir != cy_as_usb_in &&
dev_p->usb_config[ep].dir != cy_as_usb_in_out)
- return CY_AS_ERROR_USB_BAD_DIRECTION ;
+ return CY_AS_ERROR_USB_BAD_DIRECTION;
/* Write on Turbo endpoint */
if (ep == CY_AS_MTP_WRITE_ENDPOINT) {
- cy_as_ll_request_response *req_p, *reply_p ;
+ cy_as_ll_request_response *req_p, *reply_p;
req_p = cy_as_ll_create_request(dev_p,
CY_RQT_TURBO_SEND_RESP_DATA_TO_HOST,
- CY_RQT_TUR_RQT_CONTEXT, 3) ;
+ CY_RQT_TUR_RQT_CONTEXT, 3);
if (req_p == 0)
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ return CY_AS_ERROR_OUT_OF_MEMORY;
cy_as_ll_request_response__set_word(req_p,
- 0, 0x0006) ; /* EP number to use. */
+ 0, 0x0006); /* EP number to use. */
cy_as_ll_request_response__set_word(req_p,
- 1, (uint16_t)((dsize >> 16) & 0xFFFF)) ;
+ 1, (uint16_t)((dsize >> 16) & 0xFFFF));
cy_as_ll_request_response__set_word(req_p,
- 2, (uint16_t)(dsize & 0xFFFF)) ;
+ 2, (uint16_t)(dsize & 0xFFFF));
/* Reserve space for the reply, the reply data
* will not exceed one word */
- reply_p = cy_as_ll_create_response(dev_p, 1) ;
+ reply_p = cy_as_ll_create_response(dev_p, 1);
if (reply_p == 0) {
- cy_as_ll_destroy_request(dev_p, req_p) ;
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ return CY_AS_ERROR_OUT_OF_MEMORY;
}
if (dsize) {
ret = cy_as_dma_queue_request(dev_p,
ep, data, dsize, cy_false,
- cy_false, sync_request_callback) ;
+ cy_false, sync_request_callback);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
}
- ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p) ;
+ ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p);
if (ret == CY_AS_ERROR_SUCCESS) {
if (cy_as_ll_request_response__get_code(reply_p) !=
CY_RESP_SUCCESS_FAILURE)
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
else
ret = cy_as_ll_request_response__get_word
(reply_p, 0);
}
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
if (ret != CY_AS_ERROR_SUCCESS) {
if (dsize)
- cy_as_dma_cancel(dev_p, ep, ret) ;
- return ret ;
+ cy_as_dma_cancel(dev_p, ep, ret);
+ return ret;
}
/* If this is a zero-byte write, firmware will
* handle it. there is no need to do any work here.
*/
if (!dsize)
- return CY_AS_ERROR_SUCCESS ;
+ return CY_AS_ERROR_SUCCESS;
} else {
ret = cy_as_dma_queue_request(dev_p, ep, data, dsize,
- cy_false, cy_false, sync_request_callback) ;
+ cy_false, cy_false, sync_request_callback);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
}
if (ep != CY_AS_MTP_WRITE_ENDPOINT)
- ret = cy_as_dma_drain_queue(dev_p, ep, cy_true) ;
+ ret = cy_as_dma_drain_queue(dev_p, ep, cy_true);
else
- ret = cy_as_dma_drain_queue(dev_p, ep, cy_false) ;
+ ret = cy_as_dma_drain_queue(dev_p, ep, cy_false);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
- ret = dev_p->usb_error ;
- return ret ;
+ ret = dev_p->usb_error;
+ return ret;
}
static void
@@ -2581,43 +2581,43 @@ mtp_write_callback(
cy_as_ll_request_response *resp,
cy_as_return_status_t ret)
{
- cy_as_usb_io_callback cb ;
- cy_as_device_handle h = (cy_as_device_handle)dev_p ;
+ cy_as_usb_io_callback cb;
+ cy_as_device_handle h = (cy_as_device_handle)dev_p;
- cy_as_hal_assert(context == CY_RQT_TUR_RQT_CONTEXT) ;
+ cy_as_hal_assert(context == CY_RQT_TUR_RQT_CONTEXT);
if (ret == CY_AS_ERROR_SUCCESS) {
if (cy_as_ll_request_response__get_code(resp) !=
CY_RESP_SUCCESS_FAILURE)
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
else
- ret = cy_as_ll_request_response__get_word(resp, 0) ;
+ ret = cy_as_ll_request_response__get_word(resp, 0);
}
/* If this was a zero byte transfer request, we can
* call the callback from here. */
if ((cy_as_ll_request_response__get_word(rqt, 1) == 0) &&
(cy_as_ll_request_response__get_word(rqt, 2) == 0)) {
- cb = dev_p->usb_cb[CY_AS_MTP_WRITE_ENDPOINT] ;
- dev_p->usb_cb[CY_AS_MTP_WRITE_ENDPOINT] = 0 ;
+ cb = dev_p->usb_cb[CY_AS_MTP_WRITE_ENDPOINT];
+ dev_p->usb_cb[CY_AS_MTP_WRITE_ENDPOINT] = 0;
cy_as_device_clear_usb_async_pending(dev_p,
- CY_AS_MTP_WRITE_ENDPOINT) ;
+ CY_AS_MTP_WRITE_ENDPOINT);
if (cb)
- cb(h, CY_AS_MTP_WRITE_ENDPOINT, 0, 0, ret) ;
+ cb(h, CY_AS_MTP_WRITE_ENDPOINT, 0, 0, ret);
- goto destroy ;
+ goto destroy;
}
if (ret != CY_AS_ERROR_SUCCESS) {
/* Firmware failed the request. Cancel the DMA transfer. */
- cy_as_dma_cancel(dev_p, 0x06, CY_AS_ERROR_CANCELED) ;
- dev_p->usb_cb[0x06] = 0 ;
- cy_as_device_clear_usb_async_pending(dev_p, 0x06) ;
+ cy_as_dma_cancel(dev_p, 0x06, CY_AS_ERROR_CANCELED);
+ dev_p->usb_cb[0x06] = 0;
+ cy_as_device_clear_usb_async_pending(dev_p, 0x06);
}
destroy:
- cy_as_ll_destroy_response(dev_p, resp) ;
- cy_as_ll_destroy_request(dev_p, rqt) ;
+ cy_as_ll_destroy_response(dev_p, resp);
+ cy_as_ll_destroy_request(dev_p, rqt);
}
cy_as_return_status_t
@@ -2625,35 +2625,35 @@ cy_as_usb_write_data_async(cy_as_device_handle handle,
cy_as_end_point_number_t ep, uint32_t dsize, void *data,
cy_bool spacket, cy_as_usb_io_callback cb)
{
- uint32_t mask ;
- cy_as_return_status_t ret ;
- cy_as_device *dev_p ;
+ uint32_t mask;
+ cy_as_return_status_t ret;
+ cy_as_device *dev_p;
- cy_as_log_debug_message(6, "cy_as_usb_write_data_async called") ;
+ cy_as_log_debug_message(6, "cy_as_usb_write_data_async called");
- dev_p = (cy_as_device *)handle ;
+ dev_p = (cy_as_device *)handle;
if (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE))
- return CY_AS_ERROR_INVALID_HANDLE ;
+ return CY_AS_ERROR_INVALID_HANDLE;
- ret = is_usb_active(dev_p) ;
+ ret = is_usb_active(dev_p);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
if (ep >= 16 || ep == 2 || ep == 4 || ep == 8)
- return CY_AS_ERROR_INVALID_ENDPOINT ;
+ return CY_AS_ERROR_INVALID_ENDPOINT;
/* EP6 is available for writing when MTP is active */
if (dev_p->mtp_count == 0 && ep == CY_AS_MTP_WRITE_ENDPOINT)
- return CY_AS_ERROR_INVALID_ENDPOINT ;
+ return CY_AS_ERROR_INVALID_ENDPOINT;
/* If the endpoint is disabled, we cannot
* write data to the endpoint */
if (!dev_p->usb_config[ep].enabled)
- return CY_AS_ERROR_ENDPOINT_DISABLED ;
+ return CY_AS_ERROR_ENDPOINT_DISABLED;
if (dev_p->usb_config[ep].dir != cy_as_usb_in &&
dev_p->usb_config[ep].dir != cy_as_usb_in_out)
- return CY_AS_ERROR_USB_BAD_DIRECTION ;
+ return CY_AS_ERROR_USB_BAD_DIRECTION;
/*
* since async operations can be triggered by interrupt
@@ -2661,81 +2661,81 @@ cy_as_usb_write_data_async(cy_as_device_handle handle,
* async operations going at one time and
* protect this test and set operation from interrupts.
*/
- mask = cy_as_hal_disable_interrupts() ;
+ mask = cy_as_hal_disable_interrupts();
if (cy_as_device_is_usb_async_pending(dev_p, ep)) {
- cy_as_hal_enable_interrupts(mask) ;
- return CY_AS_ERROR_ASYNC_PENDING ;
+ cy_as_hal_enable_interrupts(mask);
+ return CY_AS_ERROR_ASYNC_PENDING;
}
- cy_as_device_set_usb_async_pending(dev_p, ep) ;
+ cy_as_device_set_usb_async_pending(dev_p, ep);
if (ep == 0)
- cy_as_device_set_ack_delayed(dev_p) ;
+ cy_as_device_set_ack_delayed(dev_p);
- cy_as_hal_enable_interrupts(mask) ;
+ cy_as_hal_enable_interrupts(mask);
- cy_as_hal_assert(dev_p->usb_cb[ep] == 0) ;
- dev_p->usb_cb[ep] = cb ;
- dev_p->usb_spacket[ep] = spacket ;
+ cy_as_hal_assert(dev_p->usb_cb[ep] == 0);
+ dev_p->usb_cb[ep] = cb;
+ dev_p->usb_spacket[ep] = spacket;
/* Write on Turbo endpoint */
if (ep == CY_AS_MTP_WRITE_ENDPOINT) {
- cy_as_ll_request_response *req_p, *reply_p ;
+ cy_as_ll_request_response *req_p, *reply_p;
req_p = cy_as_ll_create_request(dev_p,
CY_RQT_TURBO_SEND_RESP_DATA_TO_HOST,
- CY_RQT_TUR_RQT_CONTEXT, 3) ;
+ CY_RQT_TUR_RQT_CONTEXT, 3);
if (req_p == 0)
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ return CY_AS_ERROR_OUT_OF_MEMORY;
cy_as_ll_request_response__set_word(req_p, 0,
- 0x0006) ; /* EP number to use. */
+ 0x0006); /* EP number to use. */
cy_as_ll_request_response__set_word(req_p, 1,
- (uint16_t)((dsize >> 16) & 0xFFFF)) ;
+ (uint16_t)((dsize >> 16) & 0xFFFF));
cy_as_ll_request_response__set_word(req_p, 2,
- (uint16_t)(dsize & 0xFFFF)) ;
+ (uint16_t)(dsize & 0xFFFF));
/* Reserve space for the reply, the reply data
* will not exceed one word */
- reply_p = cy_as_ll_create_response(dev_p, 1) ;
+ reply_p = cy_as_ll_create_response(dev_p, 1);
if (reply_p == 0) {
- cy_as_ll_destroy_request(dev_p, req_p) ;
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ return CY_AS_ERROR_OUT_OF_MEMORY;
}
if (dsize) {
ret = cy_as_dma_queue_request(dev_p, ep, data,
dsize, cy_false, cy_false,
- async_write_request_callback) ;
+ async_write_request_callback);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
}
ret = cy_as_ll_send_request(dev_p, req_p, reply_p,
- cy_false, mtp_write_callback) ;
+ cy_false, mtp_write_callback);
if (ret != CY_AS_ERROR_SUCCESS) {
if (dsize)
- cy_as_dma_cancel(dev_p, ep, ret) ;
- return ret ;
+ cy_as_dma_cancel(dev_p, ep, ret);
+ return ret;
}
/* Firmware will handle a zero byte transfer
* without any DMA transfers. */
if (!dsize)
- return CY_AS_ERROR_SUCCESS ;
+ return CY_AS_ERROR_SUCCESS;
} else {
ret = cy_as_dma_queue_request(dev_p, ep, data, dsize,
- cy_false, cy_false, async_write_request_callback) ;
+ cy_false, cy_false, async_write_request_callback);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
}
/* Kick start the queue if it is not running */
if (ep != CY_AS_MTP_WRITE_ENDPOINT)
- cy_as_dma_kick_start(dev_p, ep) ;
+ cy_as_dma_kick_start(dev_p, ep);
- return CY_AS_ERROR_SUCCESS ;
+ return CY_AS_ERROR_SUCCESS;
}
static void
@@ -2746,25 +2746,25 @@ my_usb_cancel_async_callback(
cy_as_ll_request_response *resp,
cy_as_return_status_t ret)
{
- uint8_t ep ;
- (void)context ;
+ uint8_t ep;
+ (void)context;
- ep = (uint8_t)cy_as_ll_request_response__get_word(rqt, 0) ;
+ ep = (uint8_t)cy_as_ll_request_response__get_word(rqt, 0);
if (ret == CY_AS_ERROR_SUCCESS) {
if (cy_as_ll_request_response__get_code(resp) !=
CY_RESP_SUCCESS_FAILURE)
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
else
- ret = cy_as_ll_request_response__get_word(resp, 0) ;
+ ret = cy_as_ll_request_response__get_word(resp, 0);
}
- cy_as_ll_destroy_request(dev_p, rqt) ;
- cy_as_ll_destroy_response(dev_p, resp) ;
+ cy_as_ll_destroy_request(dev_p, rqt);
+ cy_as_ll_destroy_response(dev_p, resp);
if (ret == CY_AS_ERROR_SUCCESS) {
- cy_as_dma_cancel(dev_p, ep, CY_AS_ERROR_CANCELED) ;
- dev_p->usb_cb[ep] = 0 ;
- cy_as_device_clear_usb_async_pending(dev_p, ep) ;
+ cy_as_dma_cancel(dev_p, ep, CY_AS_ERROR_CANCELED);
+ dev_p->usb_cb[ep] = 0;
+ cy_as_device_clear_usb_async_pending(dev_p, ep);
}
}
@@ -2772,61 +2772,61 @@ cy_as_return_status_t
cy_as_usb_cancel_async(cy_as_device_handle handle,
cy_as_end_point_number_t ep)
{
- cy_as_return_status_t ret ;
- cy_as_ll_request_response *req_p, *reply_p ;
+ cy_as_return_status_t ret;
+ cy_as_ll_request_response *req_p, *reply_p;
- cy_as_device *dev_p = (cy_as_device *)handle ;
+ cy_as_device *dev_p = (cy_as_device *)handle;
if (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE))
- return CY_AS_ERROR_INVALID_HANDLE ;
+ return CY_AS_ERROR_INVALID_HANDLE;
ep &= 0x7F; /* Remove the direction bit. */
if (!cy_as_device_is_usb_async_pending(dev_p, ep))
return CY_AS_ERROR_ASYNC_NOT_PENDING;
- ret = is_usb_active(dev_p) ;
+ ret = is_usb_active(dev_p);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
if (cy_as_device_is_in_suspend_mode(dev_p))
- return CY_AS_ERROR_IN_SUSPEND ;
+ return CY_AS_ERROR_IN_SUSPEND;
if ((ep == CY_AS_MTP_WRITE_ENDPOINT) ||
(ep == CY_AS_MTP_READ_ENDPOINT)) {
/* Need firmware support for the cancel operation. */
req_p = cy_as_ll_create_request(dev_p,
CY_RQT_CANCEL_ASYNC_TRANSFER,
- CY_RQT_TUR_RQT_CONTEXT, 1) ;
+ CY_RQT_TUR_RQT_CONTEXT, 1);
if (req_p == 0)
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ return CY_AS_ERROR_OUT_OF_MEMORY;
- reply_p = cy_as_ll_create_response(dev_p, 1) ;
+ reply_p = cy_as_ll_create_response(dev_p, 1);
if (reply_p == 0) {
- cy_as_ll_destroy_request(dev_p, req_p) ;
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ return CY_AS_ERROR_OUT_OF_MEMORY;
}
cy_as_ll_request_response__set_word(req_p, 0,
- (uint16_t)ep) ;
+ (uint16_t)ep);
ret = cy_as_ll_send_request(dev_p, req_p, reply_p,
- cy_false, my_usb_cancel_async_callback) ;
+ cy_false, my_usb_cancel_async_callback);
if (ret != CY_AS_ERROR_SUCCESS) {
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
- return ret ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
+ return ret;
}
} else {
- ret = cy_as_dma_cancel(dev_p, ep, CY_AS_ERROR_CANCELED) ;
+ ret = cy_as_dma_cancel(dev_p, ep, CY_AS_ERROR_CANCELED);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
- dev_p->usb_cb[ep] = 0 ;
- cy_as_device_clear_usb_async_pending(dev_p, ep) ;
+ dev_p->usb_cb[ep] = 0;
+ cy_as_device_clear_usb_async_pending(dev_p, ep);
}
- return CY_AS_ERROR_SUCCESS ;
+ return CY_AS_ERROR_SUCCESS;
}
static void
@@ -2838,25 +2838,25 @@ cy_as_usb_ack_callback(
cy_as_return_status_t ret)
{
cy_as_func_c_b_node *node = (cy_as_func_c_b_node *)
- dev_p->func_cbs_usb->head_p ;
+ dev_p->func_cbs_usb->head_p;
- (void)context ;
+ (void)context;
if (ret == CY_AS_ERROR_SUCCESS) {
if (cy_as_ll_request_response__get_code(resp) !=
CY_RESP_SUCCESS_FAILURE)
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
else
- ret = cy_as_ll_request_response__get_word(resp, 0) ;
+ ret = cy_as_ll_request_response__get_word(resp, 0);
}
node->cb_p((cy_as_device_handle)dev_p, ret,
- node->client_data, node->data_type, node->data) ;
- cy_as_remove_c_b_node(dev_p->func_cbs_usb) ;
+ node->client_data, node->data_type, node->data);
+ cy_as_remove_c_b_node(dev_p->func_cbs_usb);
- cy_as_ll_destroy_request(dev_p, rqt) ;
- cy_as_ll_destroy_response(dev_p, resp) ;
- cy_as_device_clear_ack_delayed(dev_p) ;
+ cy_as_ll_destroy_request(dev_p, rqt);
+ cy_as_ll_destroy_response(dev_p, resp);
+ cy_as_device_clear_ack_delayed(dev_p);
}
static cy_as_return_status_t
@@ -2864,51 +2864,51 @@ cy_as_usb_ack_setup_packet(cy_as_device_handle handle,
cy_as_function_callback cb,
uint32_t client)
{
- cy_as_return_status_t ret ;
- cy_as_ll_request_response *req_p ;
- cy_as_ll_request_response *reply_p ;
- cy_as_func_c_b_node *cbnode ;
+ cy_as_return_status_t ret;
+ cy_as_ll_request_response *req_p;
+ cy_as_ll_request_response *reply_p;
+ cy_as_func_c_b_node *cbnode;
- cy_as_device *dev_p = (cy_as_device *)handle ;
+ cy_as_device *dev_p = (cy_as_device *)handle;
if (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE))
- return CY_AS_ERROR_INVALID_HANDLE ;
+ return CY_AS_ERROR_INVALID_HANDLE;
- ret = is_usb_active(dev_p) ;
+ ret = is_usb_active(dev_p);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
if (cy_as_device_is_in_callback(dev_p) && cb == 0)
- return CY_AS_ERROR_INVALID_IN_CALLBACK ;
+ return CY_AS_ERROR_INVALID_IN_CALLBACK;
- cy_as_hal_assert(cb != 0) ;
+ cy_as_hal_assert(cb != 0);
cbnode = cy_as_create_func_c_b_node(cb, client);
if (cbnode == 0)
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ return CY_AS_ERROR_OUT_OF_MEMORY;
req_p = cy_as_ll_create_request(dev_p, 0,
- CY_RQT_USB_RQT_CONTEXT, 2) ;
+ CY_RQT_USB_RQT_CONTEXT, 2);
if (req_p == 0)
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ return CY_AS_ERROR_OUT_OF_MEMORY;
- reply_p = cy_as_ll_create_response(dev_p, 1) ;
+ reply_p = cy_as_ll_create_response(dev_p, 1);
if (reply_p == 0) {
- cy_as_ll_destroy_request(dev_p, req_p) ;
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ return CY_AS_ERROR_OUT_OF_MEMORY;
}
cy_as_ll_init_request(req_p, CY_RQT_ACK_SETUP_PACKET,
- CY_RQT_USB_RQT_CONTEXT, 1) ;
- cy_as_ll_init_response(reply_p, 1) ;
+ CY_RQT_USB_RQT_CONTEXT, 1);
+ cy_as_ll_init_response(reply_p, 1);
- req_p->flags |= CY_AS_REQUEST_RESPONSE_EX ;
+ req_p->flags |= CY_AS_REQUEST_RESPONSE_EX;
- cy_as_insert_c_b_node(dev_p->func_cbs_usb, cbnode) ;
+ cy_as_insert_c_b_node(dev_p->func_cbs_usb, cbnode);
ret = cy_as_ll_send_request(dev_p, req_p, reply_p,
- cy_false, cy_as_usb_ack_callback) ;
+ cy_false, cy_as_usb_ack_callback);
- return ret ;
+ return ret;
}
/*
@@ -2921,18 +2921,18 @@ cy_as_usb_flush_logical_e_p(
cy_as_device *dev_p,
uint16_t ep)
{
- uint16_t addr, val, count ;
+ uint16_t addr, val, count;
- addr = CY_AS_MEM_P0_EP2_DMA_REG + ep - 2 ;
- val = cy_as_hal_read_register(dev_p->tag, addr) ;
+ addr = CY_AS_MEM_P0_EP2_DMA_REG + ep - 2;
+ val = cy_as_hal_read_register(dev_p->tag, addr);
while (val) {
- count = ((val & 0xFFF) + 1) / 2 ;
+ count = ((val & 0xFFF) + 1) / 2;
while (count--)
- val = cy_as_hal_read_register(dev_p->tag, ep) ;
+ val = cy_as_hal_read_register(dev_p->tag, ep);
- cy_as_hal_write_register(dev_p->tag, addr, 0) ;
- val = cy_as_hal_read_register(dev_p->tag, addr) ;
+ cy_as_hal_write_register(dev_p->tag, addr, 0);
+ val = cy_as_hal_read_register(dev_p->tag, addr);
}
}
@@ -2945,111 +2945,111 @@ cy_as_usb_nak_stall_request(cy_as_device_handle handle,
cy_as_function_callback fcb,
uint32_t client)
{
- cy_as_return_status_t ret ;
- cy_as_ll_request_response *req_p , *reply_p ;
- uint16_t data ;
+ cy_as_return_status_t ret;
+ cy_as_ll_request_response *req_p , *reply_p;
+ uint16_t data;
- cy_as_device *dev_p = (cy_as_device *)handle ;
+ cy_as_device *dev_p = (cy_as_device *)handle;
if (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE))
- return CY_AS_ERROR_INVALID_HANDLE ;
+ return CY_AS_ERROR_INVALID_HANDLE;
if (cb)
- cy_as_hal_assert(fcb == 0) ;
+ cy_as_hal_assert(fcb == 0);
if (fcb)
- cy_as_hal_assert(cb == 0) ;
+ cy_as_hal_assert(cb == 0);
- ret = is_usb_active(dev_p) ;
+ ret = is_usb_active(dev_p);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
if (cy_as_device_is_in_callback(dev_p) && cb == 0 && fcb == 0)
- return CY_AS_ERROR_INVALID_IN_CALLBACK ;
+ return CY_AS_ERROR_INVALID_IN_CALLBACK;
req_p = cy_as_ll_create_request(dev_p,
- request, CY_RQT_USB_RQT_CONTEXT, 2) ;
+ request, CY_RQT_USB_RQT_CONTEXT, 2);
if (req_p == 0)
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ return CY_AS_ERROR_OUT_OF_MEMORY;
/* A single status word response type */
- reply_p = cy_as_ll_create_response(dev_p, 1) ;
+ reply_p = cy_as_ll_create_response(dev_p, 1);
if (reply_p == 0) {
- cy_as_ll_destroy_request(dev_p, req_p) ;
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ return CY_AS_ERROR_OUT_OF_MEMORY;
}
/* Set the endpoint */
- data = (uint8_t)ep ;
- cy_as_ll_request_response__set_word(req_p, 0, data) ;
+ data = (uint8_t)ep;
+ cy_as_ll_request_response__set_word(req_p, 0, data);
/* Set stall state to stalled */
- cy_as_ll_request_response__set_word(req_p, 1, (uint8_t)state) ;
+ cy_as_ll_request_response__set_word(req_p, 1, (uint8_t)state);
if (cb || fcb) {
- void *cbnode ;
- cy_as_c_b_queue *queue ;
+ void *cbnode;
+ cy_as_c_b_queue *queue;
if (cb) {
- cbnode = cy_as_create_usb_func_c_b_node(cb, client) ;
- queue = dev_p->usb_func_cbs ;
+ cbnode = cy_as_create_usb_func_c_b_node(cb, client);
+ queue = dev_p->usb_func_cbs;
} else {
- cbnode = cy_as_create_func_c_b_node(fcb, client) ;
- queue = dev_p->func_cbs_usb ;
- req_p->flags |= CY_AS_REQUEST_RESPONSE_EX ;
+ cbnode = cy_as_create_func_c_b_node(fcb, client);
+ queue = dev_p->func_cbs_usb;
+ req_p->flags |= CY_AS_REQUEST_RESPONSE_EX;
}
if (cbnode == 0) {
- ret = CY_AS_ERROR_OUT_OF_MEMORY ;
- goto destroy ;
+ ret = CY_AS_ERROR_OUT_OF_MEMORY;
+ goto destroy;
} else
- cy_as_insert_c_b_node(queue, cbnode) ;
+ cy_as_insert_c_b_node(queue, cbnode);
if (cy_as_device_is_setup_packet(dev_p)) {
/* No Ack is needed on a stall request on EP0 */
if ((state == cy_true) && (ep == 0)) {
- cy_as_device_set_ep0_stalled(dev_p) ;
+ cy_as_device_set_ep0_stalled(dev_p);
} else {
- cy_as_device_set_ack_delayed(dev_p) ;
+ cy_as_device_set_ack_delayed(dev_p);
req_p->flags |=
- CY_AS_REQUEST_RESPONSE_DELAY_ACK ;
+ CY_AS_REQUEST_RESPONSE_DELAY_ACK;
}
}
ret = cy_as_ll_send_request(dev_p, req_p,
- reply_p, cy_false, cy_as_usb_func_callback) ;
+ reply_p, cy_false, cy_as_usb_func_callback);
if (ret != CY_AS_ERROR_SUCCESS) {
if (req_p->flags & CY_AS_REQUEST_RESPONSE_DELAY_ACK)
- cy_as_device_rem_ack_delayed(dev_p) ;
- cy_as_remove_c_b_tail_node(queue) ;
+ cy_as_device_rem_ack_delayed(dev_p);
+ cy_as_remove_c_b_tail_node(queue);
- goto destroy ;
+ goto destroy;
}
} else {
ret = cy_as_ll_send_request_wait_reply(dev_p,
- req_p, reply_p) ;
+ req_p, reply_p);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
if (cy_as_ll_request_response__get_code(reply_p) !=
CY_RESP_SUCCESS_FAILURE) {
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
- goto destroy ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
+ goto destroy;
}
- ret = cy_as_ll_request_response__get_word(reply_p, 0) ;
+ ret = cy_as_ll_request_response__get_word(reply_p, 0);
if ((ret == CY_AS_ERROR_SUCCESS) &&
(request == CY_RQT_STALL_ENDPOINT)) {
if ((ep > 1) && (state != 0) &&
(dev_p->usb_config[ep].dir == cy_as_usb_out))
- cy_as_usb_flush_logical_e_p(dev_p, ep) ;
+ cy_as_usb_flush_logical_e_p(dev_p, ep);
}
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
}
- return ret ;
+ return ret;
}
static cy_as_return_status_t
@@ -3058,26 +3058,26 @@ my_handle_response_get_stall(cy_as_device *dev_p,
cy_as_ll_request_response *reply_p,
cy_bool *state_p)
{
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
- uint8_t code = cy_as_ll_request_response__get_code(reply_p) ;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
+ uint8_t code = cy_as_ll_request_response__get_code(reply_p);
if (code == CY_RESP_SUCCESS_FAILURE) {
- ret = cy_as_ll_request_response__get_word(reply_p, 0) ;
- goto destroy ;
+ ret = cy_as_ll_request_response__get_word(reply_p, 0);
+ goto destroy;
} else if (code != CY_RESP_ENDPOINT_STALL) {
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
- goto destroy ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
+ goto destroy;
}
- *state_p = (cy_bool)cy_as_ll_request_response__get_word(reply_p, 0) ;
- ret = CY_AS_ERROR_SUCCESS ;
+ *state_p = (cy_bool)cy_as_ll_request_response__get_word(reply_p, 0);
+ ret = CY_AS_ERROR_SUCCESS;
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
- return ret ;
+ return ret;
}
static cy_as_return_status_t
@@ -3086,26 +3086,26 @@ my_handle_response_get_nak(cy_as_device *dev_p,
cy_as_ll_request_response *reply_p,
cy_bool *state_p)
{
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
- uint8_t code = cy_as_ll_request_response__get_code(reply_p) ;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
+ uint8_t code = cy_as_ll_request_response__get_code(reply_p);
if (code == CY_RESP_SUCCESS_FAILURE) {
- ret = cy_as_ll_request_response__get_word(reply_p, 0) ;
- goto destroy ;
+ ret = cy_as_ll_request_response__get_word(reply_p, 0);
+ goto destroy;
} else if (code != CY_RESP_ENDPOINT_NAK) {
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
- goto destroy ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
+ goto destroy;
}
- *state_p = (cy_bool)cy_as_ll_request_response__get_word(reply_p, 0) ;
- ret = CY_AS_ERROR_SUCCESS ;
+ *state_p = (cy_bool)cy_as_ll_request_response__get_word(reply_p, 0);
+ ret = CY_AS_ERROR_SUCCESS;
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
- return ret ;
+ return ret;
}
static cy_as_return_status_t
@@ -3117,76 +3117,76 @@ cy_as_usb_get_nak_stall(cy_as_device_handle handle,
cy_as_function_callback cb,
uint32_t client)
{
- cy_as_return_status_t ret ;
- cy_as_ll_request_response *req_p , *reply_p ;
- uint16_t data ;
+ cy_as_return_status_t ret;
+ cy_as_ll_request_response *req_p , *reply_p;
+ uint16_t data;
- cy_as_device *dev_p = (cy_as_device *)handle ;
+ cy_as_device *dev_p = (cy_as_device *)handle;
- (void)response ;
+ (void)response;
if (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE))
- return CY_AS_ERROR_INVALID_HANDLE ;
+ return CY_AS_ERROR_INVALID_HANDLE;
- ret = is_usb_active(dev_p) ;
+ ret = is_usb_active(dev_p);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
if (cy_as_device_is_in_callback(dev_p) && !cb)
- return CY_AS_ERROR_INVALID_IN_CALLBACK ;
+ return CY_AS_ERROR_INVALID_IN_CALLBACK;
req_p = cy_as_ll_create_request(dev_p, request,
- CY_RQT_USB_RQT_CONTEXT, 1) ;
+ CY_RQT_USB_RQT_CONTEXT, 1);
if (req_p == 0)
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ return CY_AS_ERROR_OUT_OF_MEMORY;
/* Set the endpoint */
- data = (uint8_t)ep ;
- cy_as_ll_request_response__set_word(req_p, 0, (uint16_t)ep) ;
+ data = (uint8_t)ep;
+ cy_as_ll_request_response__set_word(req_p, 0, (uint16_t)ep);
/* A single status word response type */
- reply_p = cy_as_ll_create_response(dev_p, 1) ;
+ reply_p = cy_as_ll_create_response(dev_p, 1);
if (reply_p == 0) {
- cy_as_ll_destroy_request(dev_p, req_p) ;
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ return CY_AS_ERROR_OUT_OF_MEMORY;
}
if (cb == 0) {
ret = cy_as_ll_send_request_wait_reply(dev_p,
- req_p, reply_p) ;
+ req_p, reply_p);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
if (request == CY_RQT_GET_STALL)
return my_handle_response_get_stall(dev_p,
- req_p, reply_p, state_p) ;
+ req_p, reply_p, state_p);
else
return my_handle_response_get_nak(dev_p,
- req_p, reply_p, state_p) ;
+ req_p, reply_p, state_p);
} else {
- cy_as_funct_c_b_type type ;
+ cy_as_funct_c_b_type type;
if (request == CY_RQT_GET_STALL)
- type = CY_FUNCT_CB_USB_GETSTALL ;
+ type = CY_FUNCT_CB_USB_GETSTALL;
else
- type = CY_FUNCT_CB_USB_GETNAK ;
+ type = CY_FUNCT_CB_USB_GETNAK;
ret = cy_as_misc_send_request(dev_p, cb, client, type,
state_p, dev_p->func_cbs_usb, CY_AS_REQUEST_RESPONSE_EX,
- req_p, reply_p, cy_as_usb_func_callback) ;
+ req_p, reply_p, cy_as_usb_func_callback);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
- return ret ;
+ return ret;
}
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
- return ret ;
+ return ret;
}
cy_as_return_status_t
@@ -3195,23 +3195,23 @@ cy_as_usb_set_nak(cy_as_device_handle handle,
cy_as_function_callback cb,
uint32_t client)
{
- cy_as_device *dev_p = (cy_as_device *)handle ;
+ cy_as_device *dev_p = (cy_as_device *)handle;
if (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE))
- return CY_AS_ERROR_INVALID_HANDLE ;
+ return CY_AS_ERROR_INVALID_HANDLE;
/*
* we send the firmware the EP# with the appropriate direction
* bit, regardless of what the user gave us.
*/
- ep &= 0x0f ;
+ ep &= 0x0f;
if (dev_p->usb_config[ep].dir == cy_as_usb_in)
- ep |= 0x80 ;
+ ep |= 0x80;
if (dev_p->mtp_count > 0)
- return CY_AS_ERROR_NOT_VALID_IN_MTP ;
+ return CY_AS_ERROR_NOT_VALID_IN_MTP;
return cy_as_usb_nak_stall_request(handle, ep,
- CY_RQT_ENDPOINT_SET_NAK, cy_true, 0, cb, client) ;
+ CY_RQT_ENDPOINT_SET_NAK, cy_true, 0, cb, client);
}
@@ -3221,23 +3221,23 @@ cy_as_usb_clear_nak(cy_as_device_handle handle,
cy_as_function_callback cb,
uint32_t client)
{
- cy_as_device *dev_p = (cy_as_device *)handle ;
+ cy_as_device *dev_p = (cy_as_device *)handle;
if (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE))
- return CY_AS_ERROR_INVALID_HANDLE ;
+ return CY_AS_ERROR_INVALID_HANDLE;
/*
* we send the firmware the EP# with the appropriate
* direction bit, regardless of what the user gave us.
*/
- ep &= 0x0f ;
+ ep &= 0x0f;
if (dev_p->usb_config[ep].dir == cy_as_usb_in)
- ep |= 0x80 ;
+ ep |= 0x80;
if (dev_p->mtp_count > 0)
- return CY_AS_ERROR_NOT_VALID_IN_MTP ;
+ return CY_AS_ERROR_NOT_VALID_IN_MTP;
return cy_as_usb_nak_stall_request(handle, ep,
- CY_RQT_ENDPOINT_SET_NAK, cy_false, 0, cb, client) ;
+ CY_RQT_ENDPOINT_SET_NAK, cy_false, 0, cb, client);
}
cy_as_return_status_t
@@ -3247,24 +3247,24 @@ cy_as_usb_get_nak(cy_as_device_handle handle,
cy_as_function_callback cb,
uint32_t client)
{
- cy_as_device *dev_p = (cy_as_device *)handle ;
+ cy_as_device *dev_p = (cy_as_device *)handle;
if (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE))
- return CY_AS_ERROR_INVALID_HANDLE ;
+ return CY_AS_ERROR_INVALID_HANDLE;
/*
* we send the firmware the EP# with the appropriate
* direction bit, regardless of what the user gave us.
*/
- ep &= 0x0f ;
+ ep &= 0x0f;
if (dev_p->usb_config[ep].dir == cy_as_usb_in)
- ep |= 0x80 ;
+ ep |= 0x80;
if (dev_p->mtp_count > 0)
- return CY_AS_ERROR_NOT_VALID_IN_MTP ;
+ return CY_AS_ERROR_NOT_VALID_IN_MTP;
return cy_as_usb_get_nak_stall(handle, ep,
CY_RQT_GET_ENDPOINT_NAK, CY_RESP_ENDPOINT_NAK,
- nak_p, cb, client) ;
+ nak_p, cb, client);
}
@@ -3274,23 +3274,23 @@ cy_as_usb_set_stall(cy_as_device_handle handle,
cy_as_function_callback cb,
uint32_t client)
{
- cy_as_device *dev_p = (cy_as_device *)handle ;
+ cy_as_device *dev_p = (cy_as_device *)handle;
if (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE))
- return CY_AS_ERROR_INVALID_HANDLE ;
+ return CY_AS_ERROR_INVALID_HANDLE;
/*
* we send the firmware the EP# with the appropriate
* direction bit, regardless of what the user gave us.
*/
- ep &= 0x0f ;
+ ep &= 0x0f;
if (dev_p->usb_config[ep].dir == cy_as_usb_in)
- ep |= 0x80 ;
+ ep |= 0x80;
if (dev_p->mtp_turbo_active)
- return CY_AS_ERROR_NOT_VALID_DURING_MTP ;
+ return CY_AS_ERROR_NOT_VALID_DURING_MTP;
return cy_as_usb_nak_stall_request(handle, ep,
- CY_RQT_STALL_ENDPOINT, cy_true, 0, cb, client) ;
+ CY_RQT_STALL_ENDPOINT, cy_true, 0, cb, client);
}
cy_as_return_status_t
@@ -3299,23 +3299,23 @@ cy_as_usb_clear_stall(cy_as_device_handle handle,
cy_as_function_callback cb,
uint32_t client)
{
- cy_as_device *dev_p = (cy_as_device *)handle ;
+ cy_as_device *dev_p = (cy_as_device *)handle;
if (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE))
- return CY_AS_ERROR_INVALID_HANDLE ;
+ return CY_AS_ERROR_INVALID_HANDLE;
/*
* we send the firmware the EP# with the appropriate
* direction bit, regardless of what the user gave us.
*/
- ep &= 0x0f ;
+ ep &= 0x0f;
if (dev_p->usb_config[ep].dir == cy_as_usb_in)
- ep |= 0x80 ;
+ ep |= 0x80;
if (dev_p->mtp_turbo_active)
- return CY_AS_ERROR_NOT_VALID_DURING_MTP ;
+ return CY_AS_ERROR_NOT_VALID_DURING_MTP;
return cy_as_usb_nak_stall_request(handle, ep,
- CY_RQT_STALL_ENDPOINT, cy_false, 0, cb, client) ;
+ CY_RQT_STALL_ENDPOINT, cy_false, 0, cb, client);
}
cy_as_return_status_t
@@ -3325,23 +3325,23 @@ cy_as_usb_get_stall(cy_as_device_handle handle,
cy_as_function_callback cb,
uint32_t client)
{
- cy_as_device *dev_p = (cy_as_device *)handle ;
+ cy_as_device *dev_p = (cy_as_device *)handle;
if (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE))
- return CY_AS_ERROR_INVALID_HANDLE ;
+ return CY_AS_ERROR_INVALID_HANDLE;
/*
* we send the firmware the EP# with the appropriate
* direction bit, regardless of what the user gave us.
*/
- ep &= 0x0f ;
+ ep &= 0x0f;
if (dev_p->usb_config[ep].dir == cy_as_usb_in)
- ep |= 0x80 ;
+ ep |= 0x80;
if (dev_p->mtp_turbo_active)
- return CY_AS_ERROR_NOT_VALID_DURING_MTP ;
+ return CY_AS_ERROR_NOT_VALID_DURING_MTP;
return cy_as_usb_get_nak_stall(handle, ep,
- CY_RQT_GET_STALL, CY_RESP_ENDPOINT_STALL, stall_p, cb, client) ;
+ CY_RQT_GET_STALL, CY_RESP_ENDPOINT_STALL, stall_p, cb, client);
}
cy_as_return_status_t
@@ -3349,62 +3349,62 @@ cy_as_usb_signal_remote_wakeup(cy_as_device_handle handle,
cy_as_function_callback cb,
uint32_t client)
{
- cy_as_return_status_t ret ;
- cy_as_ll_request_response *req_p , *reply_p ;
+ cy_as_return_status_t ret;
+ cy_as_ll_request_response *req_p , *reply_p;
- cy_as_device *dev_p = (cy_as_device *)handle ;
+ cy_as_device *dev_p = (cy_as_device *)handle;
if (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE))
- return CY_AS_ERROR_INVALID_HANDLE ;
+ return CY_AS_ERROR_INVALID_HANDLE;
- ret = is_usb_active(dev_p) ;
+ ret = is_usb_active(dev_p);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
if (cy_as_device_is_in_callback(dev_p))
- return CY_AS_ERROR_INVALID_IN_CALLBACK ;
+ return CY_AS_ERROR_INVALID_IN_CALLBACK;
if (dev_p->usb_last_event != cy_as_event_usb_suspend)
- return CY_AS_ERROR_NOT_IN_SUSPEND ;
+ return CY_AS_ERROR_NOT_IN_SUSPEND;
req_p = cy_as_ll_create_request(dev_p,
- CY_RQT_USB_REMOTE_WAKEUP, CY_RQT_USB_RQT_CONTEXT, 0) ;
+ CY_RQT_USB_REMOTE_WAKEUP, CY_RQT_USB_RQT_CONTEXT, 0);
if (req_p == 0)
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ return CY_AS_ERROR_OUT_OF_MEMORY;
/* A single status word response type */
- reply_p = cy_as_ll_create_response(dev_p, 1) ;
+ reply_p = cy_as_ll_create_response(dev_p, 1);
if (reply_p == 0) {
- cy_as_ll_destroy_request(dev_p, req_p) ;
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ return CY_AS_ERROR_OUT_OF_MEMORY;
}
if (cb == 0) {
- ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p) ;
+ ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
if (cy_as_ll_request_response__get_code(reply_p) ==
CY_RESP_SUCCESS_FAILURE)
- ret = cy_as_ll_request_response__get_word(reply_p, 0) ;
+ ret = cy_as_ll_request_response__get_word(reply_p, 0);
else
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
} else {
ret = cy_as_misc_send_request(dev_p, cb, client,
CY_FUNCT_CB_USB_SIGNALREMOTEWAKEUP, 0,
dev_p->func_cbs_usb,
CY_AS_REQUEST_RESPONSE_EX, req_p,
- reply_p, cy_as_usb_func_callback) ;
+ reply_p, cy_as_usb_func_callback);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
- return ret ;
+ goto destroy;
+ return ret;
}
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
- return ret ;
+ return ret;
}
cy_as_return_status_t
@@ -3414,74 +3414,74 @@ cy_as_usb_set_m_s_report_threshold(cy_as_device_handle handle,
cy_as_function_callback cb,
uint32_t client)
{
- cy_as_return_status_t ret ;
- cy_as_ll_request_response *req_p , *reply_p ;
+ cy_as_return_status_t ret;
+ cy_as_ll_request_response *req_p , *reply_p;
- cy_as_device *dev_p = (cy_as_device *)handle ;
+ cy_as_device *dev_p = (cy_as_device *)handle;
if (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE))
- return CY_AS_ERROR_INVALID_HANDLE ;
+ return CY_AS_ERROR_INVALID_HANDLE;
- ret = is_usb_active(dev_p) ;
+ ret = is_usb_active(dev_p);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
if ((cb == 0) && (cy_as_device_is_in_callback(dev_p)))
- return CY_AS_ERROR_INVALID_IN_CALLBACK ;
+ return CY_AS_ERROR_INVALID_IN_CALLBACK;
/* Check if the firmware version supports this feature. */
if ((dev_p->media_supported[0]) && (dev_p->media_supported[0] ==
(1 << cy_as_media_nand)))
- return CY_AS_ERROR_NOT_SUPPORTED ;
+ return CY_AS_ERROR_NOT_SUPPORTED;
req_p = cy_as_ll_create_request(dev_p, CY_RQT_USB_STORAGE_MONITOR,
- CY_RQT_USB_RQT_CONTEXT, 4) ;
+ CY_RQT_USB_RQT_CONTEXT, 4);
if (req_p == 0)
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ return CY_AS_ERROR_OUT_OF_MEMORY;
/* A single status word response type */
- reply_p = cy_as_ll_create_response(dev_p, 1) ;
+ reply_p = cy_as_ll_create_response(dev_p, 1);
if (reply_p == 0) {
- cy_as_ll_destroy_request(dev_p, req_p) ;
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ return CY_AS_ERROR_OUT_OF_MEMORY;
}
/* Set the read and write count parameters into
* the request structure. */
cy_as_ll_request_response__set_word(req_p, 0,
- (uint16_t)((wr_sectors >> 16) & 0xFFFF)) ;
+ (uint16_t)((wr_sectors >> 16) & 0xFFFF));
cy_as_ll_request_response__set_word(req_p, 1,
- (uint16_t)(wr_sectors & 0xFFFF)) ;
+ (uint16_t)(wr_sectors & 0xFFFF));
cy_as_ll_request_response__set_word(req_p, 2,
- (uint16_t)((rd_sectors >> 16) & 0xFFFF)) ;
+ (uint16_t)((rd_sectors >> 16) & 0xFFFF));
cy_as_ll_request_response__set_word(req_p, 3,
- (uint16_t)(rd_sectors & 0xFFFF)) ;
+ (uint16_t)(rd_sectors & 0xFFFF));
if (cb == 0) {
- ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p) ;
+ ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
if (cy_as_ll_request_response__get_code(reply_p) ==
CY_RESP_SUCCESS_FAILURE)
- ret = cy_as_ll_request_response__get_word(reply_p, 0) ;
+ ret = cy_as_ll_request_response__get_word(reply_p, 0);
else
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
} else {
ret = cy_as_misc_send_request(dev_p, cb, client,
CY_FUNCT_CB_USB_SET_MSREPORT_THRESHOLD, 0,
dev_p->func_cbs_usb, CY_AS_REQUEST_RESPONSE_EX,
- req_p, reply_p, cy_as_usb_func_callback) ;
+ req_p, reply_p, cy_as_usb_func_callback);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
- return ret ;
+ goto destroy;
+ return ret;
}
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
- return ret ;
+ return ret;
}
cy_as_return_status_t
@@ -3493,76 +3493,76 @@ cy_as_usb_select_m_s_partitions(
cy_as_function_callback cb,
uint32_t client)
{
- cy_as_return_status_t ret ;
- cy_as_ll_request_response *req_p , *reply_p ;
- uint16_t val ;
+ cy_as_return_status_t ret;
+ cy_as_ll_request_response *req_p , *reply_p;
+ uint16_t val;
- cy_as_device *dev_p = (cy_as_device *)handle ;
+ cy_as_device *dev_p = (cy_as_device *)handle;
if (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE))
- return CY_AS_ERROR_INVALID_HANDLE ;
+ return CY_AS_ERROR_INVALID_HANDLE;
- ret = is_usb_active(dev_p) ;
+ ret = is_usb_active(dev_p);
if (ret != CY_AS_ERROR_SUCCESS)
- return ret ;
+ return ret;
/* This API has to be made before SetEnumConfig is called. */
if (dev_p->usb_config[0].enabled)
- return CY_AS_ERROR_INVALID_CALL_SEQUENCE ;
+ return CY_AS_ERROR_INVALID_CALL_SEQUENCE;
if ((cb == 0) && (cy_as_device_is_in_callback(dev_p)))
- return CY_AS_ERROR_INVALID_IN_CALLBACK ;
+ return CY_AS_ERROR_INVALID_IN_CALLBACK;
req_p = cy_as_ll_create_request(dev_p, CY_RQT_MS_PARTITION_SELECT,
- CY_RQT_USB_RQT_CONTEXT, 2) ;
+ CY_RQT_USB_RQT_CONTEXT, 2);
if (req_p == 0)
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ return CY_AS_ERROR_OUT_OF_MEMORY;
/* A single status word response type */
- reply_p = cy_as_ll_create_response(dev_p, 1) ;
+ reply_p = cy_as_ll_create_response(dev_p, 1);
if (reply_p == 0) {
- cy_as_ll_destroy_request(dev_p, req_p) ;
- return CY_AS_ERROR_OUT_OF_MEMORY ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ return CY_AS_ERROR_OUT_OF_MEMORY;
}
/* Set the read and write count parameters into
* the request structure. */
cy_as_ll_request_response__set_word(req_p, 0,
- (uint16_t)((bus << 8) | device)) ;
+ (uint16_t)((bus << 8) | device));
- val = 0 ;
+ val = 0;
if ((type == cy_as_usb_m_s_unit0) || (type == cy_as_usb_m_s_both))
- val |= 1 ;
+ val |= 1;
if ((type == cy_as_usb_m_s_unit1) || (type == cy_as_usb_m_s_both))
- val |= (1 << 8) ;
+ val |= (1 << 8);
- cy_as_ll_request_response__set_word(req_p, 1, val) ;
+ cy_as_ll_request_response__set_word(req_p, 1, val);
if (cb == 0) {
- ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p) ;
+ ret = cy_as_ll_send_request_wait_reply(dev_p, req_p, reply_p);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
+ goto destroy;
if (cy_as_ll_request_response__get_code(reply_p) ==
CY_RESP_SUCCESS_FAILURE)
- ret = cy_as_ll_request_response__get_word(reply_p, 0) ;
+ ret = cy_as_ll_request_response__get_word(reply_p, 0);
else
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
} else {
ret = cy_as_misc_send_request(dev_p, cb, client,
CY_FUNCT_CB_NODATA, 0, dev_p->func_cbs_usb,
CY_AS_REQUEST_RESPONSE_EX, req_p, reply_p,
- cy_as_usb_func_callback) ;
+ cy_as_usb_func_callback);
if (ret != CY_AS_ERROR_SUCCESS)
- goto destroy ;
- return ret ;
+ goto destroy;
+ return ret;
}
destroy:
- cy_as_ll_destroy_request(dev_p, req_p) ;
- cy_as_ll_destroy_response(dev_p, reply_p) ;
+ cy_as_ll_destroy_request(dev_p, req_p);
+ cy_as_ll_destroy_response(dev_p, reply_p);
- return ret ;
+ return ret;
}
static void
@@ -3574,113 +3574,113 @@ cy_as_usb_func_callback(
cy_as_return_status_t stat)
{
cy_as_usb_func_c_b_node* node = (cy_as_usb_func_c_b_node *)
- dev_p->usb_func_cbs->head_p ;
+ dev_p->usb_func_cbs->head_p;
cy_as_func_c_b_node* fnode = (cy_as_func_c_b_node *)
- dev_p->func_cbs_usb->head_p ;
- cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ;
+ dev_p->func_cbs_usb->head_p;
+ cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
- cy_as_device_handle h = (cy_as_device_handle)dev_p ;
+ cy_as_device_handle h = (cy_as_device_handle)dev_p;
cy_bool delayed_ack = (rqt->flags & CY_AS_REQUEST_RESPONSE_DELAY_ACK)
== CY_AS_REQUEST_RESPONSE_DELAY_ACK;
cy_bool ex_request = (rqt->flags & CY_AS_REQUEST_RESPONSE_EX)
- == CY_AS_REQUEST_RESPONSE_EX ;
+ == CY_AS_REQUEST_RESPONSE_EX;
cy_bool ms_request = (rqt->flags & CY_AS_REQUEST_RESPONSE_MS)
- == CY_AS_REQUEST_RESPONSE_MS ;
- uint8_t code ;
- uint8_t ep, state ;
+ == CY_AS_REQUEST_RESPONSE_MS;
+ uint8_t code;
+ uint8_t ep, state;
if (!ex_request && !ms_request) {
- cy_as_hal_assert(dev_p->usb_func_cbs->count != 0) ;
+ cy_as_hal_assert(dev_p->usb_func_cbs->count != 0);
cy_as_hal_assert(dev_p->usb_func_cbs->type ==
- CYAS_USB_FUNC_CB) ;
+ CYAS_USB_FUNC_CB);
} else {
- cy_as_hal_assert(dev_p->func_cbs_usb->count != 0) ;
- cy_as_hal_assert(dev_p->func_cbs_usb->type == CYAS_FUNC_CB) ;
+ cy_as_hal_assert(dev_p->func_cbs_usb->count != 0);
+ cy_as_hal_assert(dev_p->func_cbs_usb->type == CYAS_FUNC_CB);
}
- (void)context ;
+ (void)context;
/* The Handlers are responsible for Deleting the rqt and resp when
* they are finished
*/
- code = cy_as_ll_request_response__get_code(rqt) ;
+ code = cy_as_ll_request_response__get_code(rqt);
switch (code) {
case CY_RQT_START_USB:
- ret = my_handle_response_usb_start(dev_p, rqt, resp, stat) ;
- break ;
+ ret = my_handle_response_usb_start(dev_p, rqt, resp, stat);
+ break;
case CY_RQT_STOP_USB:
- ret = my_handle_response_usb_stop(dev_p, rqt, resp, stat) ;
- break ;
+ ret = my_handle_response_usb_stop(dev_p, rqt, resp, stat);
+ break;
case CY_RQT_SET_CONNECT_STATE:
if (!cy_as_ll_request_response__get_word(rqt, 0))
ret = my_handle_response_disconnect(
- dev_p, rqt, resp, stat) ;
+ dev_p, rqt, resp, stat);
else
ret = my_handle_response_connect(
- dev_p, rqt, resp, stat) ;
- break ;
+ dev_p, rqt, resp, stat);
+ break;
case CY_RQT_GET_CONNECT_STATE:
- break ;
+ break;
case CY_RQT_SET_USB_CONFIG:
- ret = my_handle_response_set_enum_config(dev_p, rqt, resp) ;
- break ;
+ ret = my_handle_response_set_enum_config(dev_p, rqt, resp);
+ break;
case CY_RQT_GET_USB_CONFIG:
- cy_as_hal_assert(fnode->data != 0) ;
+ cy_as_hal_assert(fnode->data != 0);
ret = my_handle_response_get_enum_config(dev_p,
- rqt, resp, fnode->data) ;
- break ;
+ rqt, resp, fnode->data);
+ break;
case CY_RQT_STALL_ENDPOINT:
- ep = (uint8_t)cy_as_ll_request_response__get_word(rqt, 0) ;
- state = (uint8_t)cy_as_ll_request_response__get_word(rqt, 1) ;
- ret = my_handle_response_no_data(dev_p, rqt, resp) ;
+ ep = (uint8_t)cy_as_ll_request_response__get_word(rqt, 0);
+ state = (uint8_t)cy_as_ll_request_response__get_word(rqt, 1);
+ ret = my_handle_response_no_data(dev_p, rqt, resp);
if ((ret == CY_AS_ERROR_SUCCESS) && (ep > 1) && (state != 0)
&& (dev_p->usb_config[ep].dir == cy_as_usb_out))
- cy_as_usb_flush_logical_e_p(dev_p, ep) ;
- break ;
+ cy_as_usb_flush_logical_e_p(dev_p, ep);
+ break;
case CY_RQT_GET_STALL:
- cy_as_hal_assert(fnode->data != 0) ;
+ cy_as_hal_assert(fnode->data != 0);
ret = my_handle_response_get_stall(dev_p,
- rqt, resp, (cy_bool *)fnode->data) ;
- break ;
+ rqt, resp, (cy_bool *)fnode->data);
+ break;
case CY_RQT_SET_DESCRIPTOR:
- ret = my_handle_response_no_data(dev_p, rqt, resp) ;
- break ;
+ ret = my_handle_response_no_data(dev_p, rqt, resp);
+ break;
case CY_RQT_GET_DESCRIPTOR:
- cy_as_hal_assert(fnode->data != 0) ;
+ cy_as_hal_assert(fnode->data != 0);
ret = my_handle_response_get_descriptor(dev_p,
- rqt, resp, (cy_as_get_descriptor_data *)fnode->data) ;
+ rqt, resp, (cy_as_get_descriptor_data *)fnode->data);
break;
case CY_RQT_SET_USB_CONFIG_REGISTERS:
- ret = my_handle_response_no_data(dev_p, rqt, resp) ;
+ ret = my_handle_response_no_data(dev_p, rqt, resp);
if (ret == CY_AS_ERROR_SUCCESS)
- ret = cy_as_usb_setup_dma(dev_p) ;
- break ;
+ ret = cy_as_usb_setup_dma(dev_p);
+ break;
case CY_RQT_ENDPOINT_SET_NAK:
- ret = my_handle_response_no_data(dev_p, rqt, resp) ;
- break ;
+ ret = my_handle_response_no_data(dev_p, rqt, resp);
+ break;
case CY_RQT_GET_ENDPOINT_NAK:
- cy_as_hal_assert(fnode->data != 0) ;
+ cy_as_hal_assert(fnode->data != 0);
ret = my_handle_response_get_nak(dev_p,
- rqt, resp, (cy_bool *)fnode->data) ;
- break ;
+ rqt, resp, (cy_bool *)fnode->data);
+ break;
case CY_RQT_ACK_SETUP_PACKET:
- break ;
+ break;
case CY_RQT_USB_REMOTE_WAKEUP:
- ret = my_handle_response_no_data(dev_p, rqt, resp) ;
- break ;
+ ret = my_handle_response_no_data(dev_p, rqt, resp);
+ break;
case CY_RQT_CLEAR_DESCRIPTORS:
- ret = my_handle_response_no_data(dev_p, rqt, resp) ;
- break ;
+ ret = my_handle_response_no_data(dev_p, rqt, resp);
+ break;
case CY_RQT_USB_STORAGE_MONITOR:
- ret = my_handle_response_no_data(dev_p, rqt, resp) ;
- break ;
+ ret = my_handle_response_no_data(dev_p, rqt, resp);
+ break;
case CY_RQT_MS_PARTITION_SELECT:
- ret = my_handle_response_no_data(dev_p, rqt, resp) ;
- break ;
+ ret = my_handle_response_no_data(dev_p, rqt, resp);
+ break;
default:
- ret = CY_AS_ERROR_INVALID_RESPONSE ;
- cy_as_hal_assert(cy_false) ;
- break ;
+ ret = CY_AS_ERROR_INVALID_RESPONSE;
+ cy_as_hal_assert(cy_false);
+ break;
}
/*
@@ -3689,28 +3689,28 @@ cy_as_usb_func_callback(
* code based on the response from firmware.
*/
if (stat == CY_AS_ERROR_SUCCESS)
- stat = ret ;
+ stat = ret;
if (ex_request || ms_request) {
fnode->cb_p((cy_as_device_handle)dev_p, stat,
- fnode->client_data, fnode->data_type, fnode->data) ;
- cy_as_remove_c_b_node(dev_p->func_cbs_usb) ;
+ fnode->client_data, fnode->data_type, fnode->data);
+ cy_as_remove_c_b_node(dev_p->func_cbs_usb);
} else {
node->cb_p((cy_as_device_handle)dev_p, stat,
- node->client_data) ;
- cy_as_remove_c_b_node(dev_p->usb_func_cbs) ;
+ node->client_data);
+ cy_as_remove_c_b_node(dev_p->usb_func_cbs);
}
if (delayed_ack) {
- cy_as_hal_assert(cy_as_device_is_ack_delayed(dev_p)) ;
- cy_as_device_rem_ack_delayed(dev_p) ;
+ cy_as_hal_assert(cy_as_device_is_ack_delayed(dev_p));
+ cy_as_device_rem_ack_delayed(dev_p);
/*
* send the ACK if required.
*/
if (!cy_as_device_is_ack_delayed(dev_p))
cy_as_usb_ack_setup_packet(h,
- usb_ack_callback, 0) ;
+ usb_ack_callback, 0);
}
}
diff --git a/drivers/staging/westbridge/astoria/arch/arm/mach-omap2/cyashalomap_kernel.c b/drivers/staging/westbridge/astoria/arch/arm/mach-omap2/cyashalomap_kernel.c
index ac3a4cf4216..a6780296888 100644
--- a/drivers/staging/westbridge/astoria/arch/arm/mach-omap2/cyashalomap_kernel.c
+++ b/drivers/staging/westbridge/astoria/arch/arm/mach-omap2/cyashalomap_kernel.c
@@ -135,7 +135,7 @@ typedef enum cy_as_hal_dma_type {
cy_as_hal_read,
cy_as_hal_write,
cy_as_hal_none
-} cy_as_hal_dma_type ;
+} cy_as_hal_dma_type;
/*
@@ -146,9 +146,9 @@ typedef enum cy_as_hal_dma_type {
((struct scatterlist *) ((sg)->page_link & ~0x03))
*/
typedef struct cy_as_hal_endpoint_dma {
- cy_bool buffer_valid ;
- uint8_t *data_p ;
- uint32_t size ;
+ cy_bool buffer_valid;
+ uint8_t *data_p;
+ uint32_t size;
/*
* sg_list_enabled - if true use, r/w DMA transfers use sg list,
* FALSE use pointer to a buffer
@@ -162,14 +162,14 @@ typedef struct cy_as_hal_endpoint_dma {
* req_length - total request length
*/
bool sg_list_enabled;
- struct scatterlist *sg_p ;
+ struct scatterlist *sg_p;
uint16_t dma_xfer_sz;
uint32_t seg_xfer_cnt;
uint16_t req_xfer_cnt;
uint16_t req_length;
- cy_as_hal_dma_type type ;
- cy_bool pending ;
-} cy_as_hal_endpoint_dma ;
+ cy_as_hal_dma_type type;
+ cy_bool pending;
+} cy_as_hal_endpoint_dma;
/*
* The list of OMAP devices (should be one)
@@ -184,7 +184,7 @@ static cy_as_hal_dma_complete_callback callback;
/*
* Pending data size for the endpoints
*/
-static cy_as_hal_endpoint_dma end_points[16] ;
+static cy_as_hal_endpoint_dma end_points[16];
/*
* Forward declaration
@@ -193,7 +193,7 @@ static void cy_handle_d_r_q_interrupt(cy_as_omap_dev_kernel *dev_p);
static uint16_t intr_sequence_num;
static uint8_t intr__enable;
-spinlock_t int_lock ;
+spinlock_t int_lock;
static u32 iomux_vma;
static u32 csa_phy;
@@ -201,7 +201,7 @@ static u32 csa_phy;
/*
* gpmc I/O registers VMA
*/
-static u32 gpmc_base ;
+static u32 gpmc_base;
/*
* gpmc data VMA associated with CS4 (ASTORIA CS on GPMC)
@@ -496,8 +496,8 @@ static irqreturn_t cy_astoria_int_handler(int irq,
void *dev_id, struct pt_regs *regs)
{
cy_as_omap_dev_kernel *dev_p;
- uint16_t read_val = 0 ;
- uint16_t mask_val = 0 ;
+ uint16_t read_val = 0;
+ uint16_t mask_val = 0;
/*
* debug stuff, counts number of loops per one intr trigger
@@ -520,7 +520,7 @@ static irqreturn_t cy_astoria_int_handler(int irq,
/*
* this one just for debugging
*/
- intr_sequence_num++ ;
+ intr_sequence_num++;
/*
* astoria device handle
@@ -531,13 +531,13 @@ static irqreturn_t cy_astoria_int_handler(int irq,
* read Astoria intr register
*/
read_val = cy_as_hal_read_register((cy_as_hal_device_tag)dev_p,
- CY_AS_MEM_P0_INTR_REG) ;
+ CY_AS_MEM_P0_INTR_REG);
/*
* save current mask value
*/
mask_val = cy_as_hal_read_register((cy_as_hal_device_tag)dev_p,
- CY_AS_MEM_P0_INT_MASK_REG) ;
+ CY_AS_MEM_P0_INT_MASK_REG);
DBGPRN("<1>HAL__intr__enter:_seq:%d, P0_INTR_REG:%x\n",
intr_sequence_num, read_val);
@@ -546,7 +546,7 @@ static irqreturn_t cy_astoria_int_handler(int irq,
* Disable WB interrupt signal generation while we are in ISR
*/
cy_as_hal_write_register((cy_as_hal_device_tag)dev_p,
- CY_AS_MEM_P0_INT_MASK_REG, 0x0000) ;
+ CY_AS_MEM_P0_INT_MASK_REG, 0x0000);
/*
* this is a DRQ Interrupt
@@ -559,7 +559,7 @@ static irqreturn_t cy_astoria_int_handler(int irq,
*/
drq_loop_cnt++;
- cy_handle_d_r_q_interrupt(dev_p) ;
+ cy_handle_d_r_q_interrupt(dev_p);
/*
* spending to much time in ISR may impact
@@ -577,7 +577,7 @@ static irqreturn_t cy_astoria_int_handler(int irq,
}
if (read_val & sentinel)
- cy_as_intr_service_interrupt((cy_as_hal_device_tag)dev_p) ;
+ cy_as_intr_service_interrupt((cy_as_hal_device_tag)dev_p);
DBGPRN("<1>_hal:_intr__exit seq:%d, mask=%4.4x,"
"int_pin:%d DRQ_jobs:%d\n",
@@ -590,9 +590,9 @@ static irqreturn_t cy_astoria_int_handler(int irq,
* re-enable WB hw interrupts
*/
cy_as_hal_write_register((cy_as_hal_device_tag)dev_p,
- CY_AS_MEM_P0_INT_MASK_REG, mask_val) ;
+ CY_AS_MEM_P0_INT_MASK_REG, mask_val);
- return IRQ_HANDLED ;
+ return IRQ_HANDLED;
}
static int cy_as_hal_configure_interrupts(void *dev_p)
@@ -827,34 +827,34 @@ void cy_as_hal_omap_hardware_deinit(cy_as_omap_dev_kernel *dev_p)
*/
int stop_o_m_a_p_kernel(const char *pgm, cy_as_hal_device_tag tag)
{
- cy_as_omap_dev_kernel *dev_p = (cy_as_omap_dev_kernel *)tag ;
+ cy_as_omap_dev_kernel *dev_p = (cy_as_omap_dev_kernel *)tag;
/*
* TODO: Need to disable WB interrupt handlere 1st
*/
if (0 == dev_p)
- return 1 ;
+ return 1;
cy_as_hal_print_message("<1>_stopping OMAP34xx HAL layer object\n");
if (dev_p->m_sig != CY_AS_OMAP_KERNEL_HAL_SIG) {
cy_as_hal_print_message("<1>%s: %s: bad HAL tag\n",
- pgm, __func__) ;
- return 1 ;
+ pgm, __func__);
+ return 1;
}
/*
* disable interrupt
*/
cy_as_hal_write_register((cy_as_hal_device_tag)dev_p,
- CY_AS_MEM_P0_INT_MASK_REG, 0x0000) ;
+ CY_AS_MEM_P0_INT_MASK_REG, 0x0000);
#if 0
if (dev_p->thread_flag == 0) {
- dev_p->thread_flag = 1 ;
- wait_for_completion(&dev_p->thread_complete) ;
+ dev_p->thread_flag = 1;
+ wait_for_completion(&dev_p->thread_complete);
cy_as_hal_print_message("cyasomaphal:"
"done cleaning thread\n");
- cy_as_hal_destroy_sleep_channel(&dev_p->thread_sc) ;
+ cy_as_hal_destroy_sleep_channel(&dev_p->thread_sc);
}
#endif
@@ -864,9 +864,9 @@ int stop_o_m_a_p_kernel(const char *pgm, cy_as_hal_device_tag tag)
* Rearrange the list
*/
if (m_omap_list_p == dev_p)
- m_omap_list_p = dev_p->m_next_p ;
+ m_omap_list_p = dev_p->m_next_p;
- cy_as_hal_free(dev_p) ;
+ cy_as_hal_free(dev_p);
cy_as_hal_print_message(KERN_INFO"OMAP_kernel_hal stopped\n");
return 0;
@@ -874,23 +874,23 @@ int stop_o_m_a_p_kernel(const char *pgm, cy_as_hal_device_tag tag)
int omap_start_intr(cy_as_hal_device_tag tag)
{
- cy_as_omap_dev_kernel *dev_p = (cy_as_omap_dev_kernel *)tag ;
- int ret = 0 ;
+ cy_as_omap_dev_kernel *dev_p = (cy_as_omap_dev_kernel *)tag;
+ int ret = 0;
const uint16_t mask = CY_AS_MEM_P0_INTR_REG_DRQINT |
- CY_AS_MEM_P0_INTR_REG_MBINT ;
+ CY_AS_MEM_P0_INTR_REG_MBINT;
/*
* register for interrupts
*/
- ret = cy_as_hal_configure_interrupts(dev_p) ;
+ ret = cy_as_hal_configure_interrupts(dev_p);
/*
* enable only MBox & DRQ interrupts for now
*/
cy_as_hal_write_register((cy_as_hal_device_tag)dev_p,
- CY_AS_MEM_P0_INT_MASK_REG, mask) ;
+ CY_AS_MEM_P0_INT_MASK_REG, mask);
- return 1 ;
+ return 1;
}
/*
@@ -1175,7 +1175,7 @@ static void p_nand_lbd_read(u16 col_addr, u32 row_addr, u16 count, void *buff)
ptr32 = buff;
do {
- pfe_status = IORD32(GPMC_VMA(GPMC_PREFETCH_STATUS)) ;
+ pfe_status = IORD32(GPMC_VMA(GPMC_PREFETCH_STATUS));
rd_cnt = pfe_status >> (24+2);
while (rd_cnt--)
@@ -1481,14 +1481,14 @@ void cy_as_hal_write_register(
*/
uint16_t cy_as_hal_read_register(cy_as_hal_device_tag tag, uint16_t addr)
{
- uint16_t data = 0 ;
+ uint16_t data = 0;
/*
* READ ASTORIA REGISTER USING CASDO
*/
data = ast_p_nand_casdo_read((u8)addr);
- return data ;
+ return data;
}
/*
@@ -1587,7 +1587,7 @@ static inline bool prep_for_next_xfer(cy_as_hal_device_tag tag, uint8_t ep)
static void cy_service_e_p_dma_read_request(
cy_as_omap_dev_kernel *dev_p, uint8_t ep)
{
- cy_as_hal_device_tag tag = (cy_as_hal_device_tag)dev_p ;
+ cy_as_hal_device_tag tag = (cy_as_hal_device_tag)dev_p;
uint16_t v, size;
void *dptr;
uint16_t col_addr = 0x0000;
@@ -1628,7 +1628,7 @@ static void cy_service_e_p_dma_read_request(
/*
* clear DMAVALID bit indicating that the data has been read
*/
- cy_as_hal_write_register(tag, ep_dma_reg, 0) ;
+ cy_as_hal_write_register(tag, ep_dma_reg, 0);
end_points[ep].seg_xfer_cnt += size;
end_points[ep].req_xfer_cnt += size;
@@ -1646,12 +1646,12 @@ static void cy_service_e_p_dma_read_request(
* data we are going to xfer next
*/
v = end_points[ep].dma_xfer_sz/*HAL_DMA_PKT_SZ*/ |
- CY_AS_MEM_P0_E_pn_DMA_REG_DMAVAL ;
+ CY_AS_MEM_P0_E_pn_DMA_REG_DMAVAL;
cy_as_hal_write_register(tag, ep_dma_reg, v);
} else {
- end_points[ep].pending = cy_false ;
- end_points[ep].type = cy_as_hal_none ;
- end_points[ep].buffer_valid = cy_false ;
+ end_points[ep].pending = cy_false;
+ end_points[ep].type = cy_as_hal_none;
+ end_points[ep].buffer_valid = cy_false;
/*
* notify the API that we are done with rq on this EP
@@ -1679,13 +1679,13 @@ static void cy_service_e_p_dma_write_request(
uint32_t row_addr = CYAS_DEV_CALC_EP_ADDR(ep);
void *dptr;
- cy_as_hal_device_tag tag = (cy_as_hal_device_tag)dev_p ;
+ cy_as_hal_device_tag tag = (cy_as_hal_device_tag)dev_p;
/*
* note: size here its the size of the dma transfer could be
* anything > 0 && < P_PORT packet size
*/
- size = end_points[ep].dma_xfer_sz ;
- dptr = end_points[ep].data_p ;
+ size = end_points[ep].dma_xfer_sz;
+ dptr = end_points[ep].data_p;
/*
* perform the soft DMA transfer, soft in this case
@@ -1708,8 +1708,8 @@ static void cy_service_e_p_dma_write_request(
* or used internally.
*/
- addr = CY_AS_MEM_P0_EP2_DMA_REG + ep - 2 ;
- cy_as_hal_write_register(tag, addr, size) ;
+ addr = CY_AS_MEM_P0_EP2_DMA_REG + ep - 2;
+ cy_as_hal_write_register(tag, addr, size);
/*
* finally, tell the USB subsystem that the
@@ -1721,13 +1721,13 @@ static void cy_service_e_p_dma_write_request(
* There is more data to go. Re-init the WestBridge DMA side
*/
v = end_points[ep].dma_xfer_sz |
- CY_AS_MEM_P0_E_pn_DMA_REG_DMAVAL ;
- cy_as_hal_write_register(tag, addr, v) ;
+ CY_AS_MEM_P0_E_pn_DMA_REG_DMAVAL;
+ cy_as_hal_write_register(tag, addr, v);
} else {
- end_points[ep].pending = cy_false ;
- end_points[ep].type = cy_as_hal_none ;
- end_points[ep].buffer_valid = cy_false ;
+ end_points[ep].pending = cy_false;
+ end_points[ep].type = cy_as_hal_none;
+ end_points[ep].buffer_valid = cy_false;
/*
* notify the API that we are done with rq on this EP
@@ -1749,17 +1749,17 @@ static void cy_service_e_p_dma_write_request(
*/
static void cy_handle_d_r_q_interrupt(cy_as_omap_dev_kernel *dev_p)
{
- uint16_t v ;
- static uint8_t service_ep = 2 ;
+ uint16_t v;
+ static uint8_t service_ep = 2;
/*
* We've got DRQ INT, read DRQ STATUS Register */
v = cy_as_hal_read_register((cy_as_hal_device_tag)dev_p,
- CY_AS_MEM_P0_DRQ) ;
+ CY_AS_MEM_P0_DRQ);
if (v == 0) {
#ifndef WESTBRIDGE_NDEBUG
- cy_as_hal_print_message("stray DRQ interrupt detected\n") ;
+ cy_as_hal_print_message("stray DRQ interrupt detected\n");
#endif
return;
}
@@ -1773,9 +1773,9 @@ static void cy_handle_d_r_q_interrupt(cy_as_omap_dev_kernel *dev_p)
while ((v & (1 << service_ep)) == 0) {
if (service_ep == 15)
- service_ep = 2 ;
+ service_ep = 2;
else
- service_ep++ ;
+ service_ep++;
}
if (end_points[service_ep].type == cy_as_hal_write) {
@@ -1783,19 +1783,19 @@ static void cy_handle_d_r_q_interrupt(cy_as_omap_dev_kernel *dev_p)
* handle DMA WRITE REQUEST: app_cpu will
* write data into astoria EP buffer
*/
- cy_service_e_p_dma_write_request(dev_p, service_ep) ;
+ cy_service_e_p_dma_write_request(dev_p, service_ep);
} else if (end_points[service_ep].type == cy_as_hal_read) {
/*
* handle DMA READ REQUEST: cpu will
* read EP buffer from Astoria
*/
- cy_service_e_p_dma_read_request(dev_p, service_ep) ;
+ cy_service_e_p_dma_read_request(dev_p, service_ep);
}
#ifndef WESTBRIDGE_NDEBUG
else
cy_as_hal_print_message("cyashalomap:interrupt,"
" w/o pending DMA job,"
- "-check DRQ_MASK logic\n") ;
+ "-check DRQ_MASK logic\n");
#endif
/*
@@ -1804,9 +1804,9 @@ static void cy_handle_d_r_q_interrupt(cy_as_omap_dev_kernel *dev_p)
*/
if (end_points[service_ep].type == cy_as_hal_none) {
if (service_ep == 15)
- service_ep = 2 ;
+ service_ep = 2;
else
- service_ep++ ;
+ service_ep++;
}
}
@@ -1818,7 +1818,7 @@ void cy_as_hal_dma_cancel_request(cy_as_hal_device_tag tag, uint8_t ep)
cy_as_hal_write_register(tag,
CY_AS_MEM_P0_EP2_DMA_REG + ep - 2, 0);
- end_points[ep].buffer_valid = cy_false ;
+ end_points[ep].buffer_valid = cy_false;
end_points[ep].type = cy_as_hal_none;
}
@@ -1845,7 +1845,7 @@ void cy_as_hal_dma_setup_write(cy_as_hal_device_tag tag,
uint8_t ep, void *buf,
uint32_t size, uint16_t maxsize)
{
- uint32_t addr = 0 ;
+ uint32_t addr = 0;
uint16_t v = 0;
/*
@@ -1853,15 +1853,15 @@ void cy_as_hal_dma_setup_write(cy_as_hal_device_tag tag,
* "maxsize" - is the P port fragment size
* No EP0 or EP1 traffic should get here
*/
- cy_as_hal_assert(ep != 0 && ep != 1) ;
+ cy_as_hal_assert(ep != 0 && ep != 1);
/*
* If this asserts, we have an ordering problem. Another DMA request
* is coming down before the previous one has completed.
*/
- cy_as_hal_assert(end_points[ep].buffer_valid == cy_false) ;
- end_points[ep].buffer_valid = cy_true ;
- end_points[ep].type = cy_as_hal_write ;
+ cy_as_hal_assert(end_points[ep].buffer_valid == cy_false);
+ end_points[ep].buffer_valid = cy_true;
+ end_points[ep].type = cy_as_hal_write;
end_points[ep].pending = cy_true;
/*
@@ -1899,7 +1899,7 @@ void cy_as_hal_dma_setup_write(cy_as_hal_device_tag tag,
*/
end_points[ep].sg_p = buf;
end_points[ep].data_p = sg_virt(end_points[ep].sg_p);
- end_points[ep].seg_xfer_cnt = 0 ;
+ end_points[ep].seg_xfer_cnt = 0;
end_points[ep].req_xfer_cnt = 0;
#ifdef DBGPRN_DMA_SETUP_WR
@@ -1940,11 +1940,11 @@ void cy_as_hal_dma_setup_write(cy_as_hal_device_tag tag,
* Tell WB we are ready to send data on the given endpoint
*/
v = (end_points[ep].dma_xfer_sz & CY_AS_MEM_P0_E_pn_DMA_REG_COUNT_MASK)
- | CY_AS_MEM_P0_E_pn_DMA_REG_DMAVAL ;
+ | CY_AS_MEM_P0_E_pn_DMA_REG_DMAVAL;
- addr = CY_AS_MEM_P0_EP2_DMA_REG + ep - 2 ;
+ addr = CY_AS_MEM_P0_EP2_DMA_REG + ep - 2;
- cy_as_hal_write_register(tag, addr, v) ;
+ cy_as_hal_write_register(tag, addr, v);
}
/*
@@ -1957,15 +1957,15 @@ void cy_as_hal_dma_setup_read(cy_as_hal_device_tag tag,
uint8_t ep, void *buf,
uint32_t size, uint16_t maxsize)
{
- uint32_t addr ;
- uint16_t v ;
+ uint32_t addr;
+ uint16_t v;
/*
* Note: "size" is the actual request size
* "maxsize" - is the P port fragment size
* No EP0 or EP1 traffic should get here
*/
- cy_as_hal_assert(ep != 0 && ep != 1) ;
+ cy_as_hal_assert(ep != 0 && ep != 1);
/*
* If this asserts, we have an ordering problem.
@@ -1976,8 +1976,8 @@ void cy_as_hal_dma_setup_read(cy_as_hal_device_tag tag,
cy_as_hal_assert(end_points[ep].buffer_valid == cy_false);
- end_points[ep].buffer_valid = cy_true ;
- end_points[ep].type = cy_as_hal_read ;
+ end_points[ep].buffer_valid = cy_true;
+ end_points[ep].type = cy_as_hal_read;
end_points[ep].pending = cy_true;
end_points[ep].req_xfer_cnt = 0;
end_points[ep].req_length = size;
@@ -1996,7 +1996,7 @@ void cy_as_hal_dma_setup_read(cy_as_hal_device_tag tag,
end_points[ep].dma_xfer_sz = size;
}
- addr = CY_AS_MEM_P0_EP2_DMA_REG + ep - 2 ;
+ addr = CY_AS_MEM_P0_EP2_DMA_REG + ep - 2;
if (end_points[ep].sg_list_enabled) {
/*
@@ -2005,7 +2005,7 @@ void cy_as_hal_dma_setup_read(cy_as_hal_device_tag tag,
* buf - pointer to the SG list
* data_p - data pointer for the 1st DMA segment
*/
- end_points[ep].seg_xfer_cnt = 0 ;
+ end_points[ep].seg_xfer_cnt = 0;
end_points[ep].sg_p = buf;
end_points[ep].data_p = sg_virt(end_points[ep].sg_p);
@@ -2020,7 +2020,7 @@ void cy_as_hal_dma_setup_read(cy_as_hal_device_tag tag,
#endif
v = (end_points[ep].dma_xfer_sz &
CY_AS_MEM_P0_E_pn_DMA_REG_COUNT_MASK) |
- CY_AS_MEM_P0_E_pn_DMA_REG_DMAVAL ;
+ CY_AS_MEM_P0_E_pn_DMA_REG_DMAVAL;
cy_as_hal_write_register(tag, addr, v);
} else {
/*
@@ -2045,7 +2045,7 @@ void cy_as_hal_dma_setup_read(cy_as_hal_device_tag tag,
if (is_storage_e_p(ep)) {
v = (end_points[ep].dma_xfer_sz &
CY_AS_MEM_P0_E_pn_DMA_REG_COUNT_MASK) |
- CY_AS_MEM_P0_E_pn_DMA_REG_DMAVAL ;
+ CY_AS_MEM_P0_E_pn_DMA_REG_DMAVAL;
cy_as_hal_write_register(tag, addr, v);
}
}
@@ -2061,7 +2061,7 @@ void cy_as_hal_dma_register_callback(cy_as_hal_device_tag tag,
{
DBGPRN("<1>\n%s: WB API has registered a dma_complete callback:%x\n",
__func__, (uint32_t)cb);
- callback = cb ;
+ callback = cb;
}
/*
@@ -2106,14 +2106,14 @@ cy_bool cy_as_hal_set_wakeup_pin(cy_as_hal_device_tag tag, cy_bool state)
/*
* Not supported as of now.
*/
- return cy_false ;
+ return cy_false;
}
void cy_as_hal_pll_lock_loss_handler(cy_as_hal_device_tag tag)
{
- cy_as_hal_print_message("error: astoria PLL lock is lost\n") ;
+ cy_as_hal_print_message("error: astoria PLL lock is lost\n");
cy_as_hal_print_message("please check the input voltage levels");
- cy_as_hal_print_message("and clock, and restart the system\n") ;
+ cy_as_hal_print_message("and clock, and restart the system\n");
}
/*
@@ -2127,10 +2127,10 @@ void cy_as_hal_pll_lock_loss_handler(cy_as_hal_device_tag tag)
*/
void *cy_as_hal_alloc(uint32_t cnt)
{
- void *ret_p ;
+ void *ret_p;
- ret_p = kmalloc(cnt, GFP_ATOMIC) ;
- return ret_p ;
+ ret_p = kmalloc(cnt, GFP_ATOMIC);
+ return ret_p;
}
/*
@@ -2140,7 +2140,7 @@ void *cy_as_hal_alloc(uint32_t cnt)
*/
void cy_as_hal_free(void *mem_p)
{
- kfree(mem_p) ;
+ kfree(mem_p);
}
/*
@@ -2150,10 +2150,10 @@ void cy_as_hal_free(void *mem_p)
*/
void *cy_as_hal_c_b_alloc(uint32_t cnt)
{
- void *ret_p ;
+ void *ret_p;
- ret_p = kmalloc(cnt, GFP_ATOMIC) ;
- return ret_p ;
+ ret_p = kmalloc(cnt, GFP_ATOMIC);
+ return ret_p;
}
/*
@@ -2163,7 +2163,7 @@ void *cy_as_hal_c_b_alloc(uint32_t cnt)
*/
void cy_as_hal_mem_set(void *ptr, uint8_t value, uint32_t cnt)
{
- memset(ptr, value, cnt) ;
+ memset(ptr, value, cnt);
}
/*
@@ -2176,8 +2176,8 @@ void cy_as_hal_mem_set(void *ptr, uint8_t value, uint32_t cnt)
*/
cy_bool cy_as_hal_create_sleep_channel(cy_as_hal_sleep_channel *channel)
{
- init_waitqueue_head(&channel->wq) ;
- return cy_true ;
+ init_waitqueue_head(&channel->wq);
+ return cy_true;
}
/*
@@ -2187,7 +2187,7 @@ cy_bool cy_as_hal_create_sleep_channel(cy_as_hal_sleep_channel *channel)
*/
cy_bool cy_as_hal_destroy_sleep_channel(cy_as_hal_sleep_channel *channel)
{
- return cy_true ;
+ return cy_true;
}
/*
@@ -2195,8 +2195,8 @@ cy_bool cy_as_hal_destroy_sleep_channel(cy_as_hal_sleep_channel *channel)
*/
cy_bool cy_as_hal_sleep_on(cy_as_hal_sleep_channel *channel, uint32_t ms)
{
- wait_event_interruptible_timeout(channel->wq, 0, ((ms * HZ)/1000)) ;
- return cy_true ;
+ wait_event_interruptible_timeout(channel->wq, 0, ((ms * HZ)/1000));
+ return cy_true;
}
/*
@@ -2205,7 +2205,7 @@ cy_bool cy_as_hal_sleep_on(cy_as_hal_sleep_channel *channel, uint32_t ms)
cy_bool cy_as_hal_wake(cy_as_hal_sleep_channel *channel)
{
wake_up_interruptible_all(&channel->wq);
- return cy_true ;
+ return cy_true;
}
uint32_t cy_as_hal_disable_interrupts()
@@ -2213,13 +2213,13 @@ uint32_t cy_as_hal_disable_interrupts()
if (0 == intr__enable)
;
- intr__enable++ ;
- return 0 ;
+ intr__enable++;
+ return 0;
}
void cy_as_hal_enable_interrupts(uint32_t val)
{
- intr__enable-- ;
+ intr__enable--;
if (0 == intr__enable)
;
}
@@ -2240,9 +2240,9 @@ void cy_as_hal_sleep(uint32_t ms)
{
cy_as_hal_sleep_channel channel;
- cy_as_hal_create_sleep_channel(&channel) ;
- cy_as_hal_sleep_on(&channel, ms) ;
- cy_as_hal_destroy_sleep_channel(&channel) ;
+ cy_as_hal_create_sleep_channel(&channel);
+ cy_as_hal_sleep_on(&channel, ms);
+ cy_as_hal_destroy_sleep_channel(&channel);
}
cy_bool cy_as_hal_is_polling()
@@ -2287,7 +2287,7 @@ cy_bool cy_as_hal_sync_device_clocks(cy_as_hal_device_tag tag)
int start_o_m_a_p_kernel(const char *pgm,
cy_as_hal_device_tag *tag, cy_bool debug)
{
- cy_as_omap_dev_kernel *dev_p ;
+ cy_as_omap_dev_kernel *dev_p;
int i;
u16 data16[4];
u8 pncfg_reg;
@@ -2302,11 +2302,11 @@ int start_o_m_a_p_kernel(const char *pgm,
/*
* Initialize the HAL level endpoint DMA data.
*/
- for (i = 0 ; i < sizeof(end_points)/sizeof(end_points[0]) ; i++) {
- end_points[i].data_p = 0 ;
- end_points[i].pending = cy_false ;
- end_points[i].size = 0 ;
- end_points[i].type = cy_as_hal_none ;
+ for (i = 0; i < sizeof(end_points)/sizeof(end_points[0]); i++) {
+ end_points[i].data_p = 0;
+ end_points[i].pending = cy_false;
+ end_points[i].size = 0;
+ end_points[i].type = cy_as_hal_none;
end_points[i].sg_list_enabled = cy_false;
/*
@@ -2321,11 +2321,11 @@ int start_o_m_a_p_kernel(const char *pgm,
* allocate memory for OMAP HAL
*/
dev_p = (cy_as_omap_dev_kernel *)cy_as_hal_alloc(
- sizeof(cy_as_omap_dev_kernel)) ;
+ sizeof(cy_as_omap_dev_kernel));
if (dev_p == 0) {
cy_as_hal_print_message("out of memory allocating OMAP"
- "device structure\n") ;
- return 0 ;
+ "device structure\n");
+ return 0;
}
dev_p->m_sig = CY_AS_OMAP_KERNEL_HAL_SIG;
@@ -2403,11 +2403,11 @@ int start_o_m_a_p_kernel(const char *pgm,
"after cfg_wr:%4.4x\n\n",
data16[0], pncfg_reg, data16[1]);
- dev_p->thread_flag = 1 ;
- spin_lock_init(&int_lock) ;
- dev_p->m_next_p = m_omap_list_p ;
+ dev_p->thread_flag = 1;
+ spin_lock_init(&int_lock);
+ dev_p->m_next_p = m_omap_list_p;
- m_omap_list_p = dev_p ;
+ m_omap_list_p = dev_p;
*tag = dev_p;
cy_as_hal_configure_interrupts((void *)dev_p);
@@ -2421,7 +2421,7 @@ int start_o_m_a_p_kernel(const char *pgm,
cy_as_hal_set_ep_dma_mode(4, true);
cy_as_hal_set_ep_dma_mode(8, true);
- return 1 ;
+ return 1;
/*
* there's been a NAND bus access error or
@@ -2433,7 +2433,7 @@ bus_acc_error:
* so the device will not call omap_stop
*/
cy_as_hal_omap_hardware_deinit(dev_p);
- cy_as_hal_free(dev_p) ;
+ cy_as_hal_free(dev_p);
return 0;
}
diff --git a/drivers/staging/westbridge/astoria/arch/arm/plat-omap/include/mach/westbridge/cyashaldef.h b/drivers/staging/westbridge/astoria/arch/arm/plat-omap/include/mach/westbridge/cyashaldef.h
index 6ce78ae6c3b..c05e6d6cb70 100644
--- a/drivers/staging/westbridge/astoria/arch/arm/plat-omap/include/mach/westbridge/cyashaldef.h
+++ b/drivers/staging/westbridge/astoria/arch/arm/plat-omap/include/mach/westbridge/cyashaldef.h
@@ -47,7 +47,7 @@
#if !defined(__doxygen__)
-typedef int cy_bool ;
+typedef int cy_bool;
#define cy_true (1)
#define cy_false (0)
#endif
diff --git a/drivers/staging/westbridge/astoria/arch/arm/plat-omap/include/mach/westbridge/westbridge-omap3-pnand-hal/cyashalomap_kernel.h b/drivers/staging/westbridge/astoria/arch/arm/plat-omap/include/mach/westbridge/westbridge-omap3-pnand-hal/cyashalomap_kernel.h
index c40279b2910..80dd530bc4f 100644
--- a/drivers/staging/westbridge/astoria/arch/arm/plat-omap/include/mach/westbridge/westbridge-omap3-pnand-hal/cyashalomap_kernel.h
+++ b/drivers/staging/westbridge/astoria/arch/arm/plat-omap/include/mach/westbridge/westbridge-omap3-pnand-hal/cyashalomap_kernel.h
@@ -38,8 +38,8 @@
*/
#include <linux/../../arch/arm/plat-omap/include/plat/gpmc.h>
typedef struct cy_as_hal_sleep_channel_t {
- wait_queue_head_t wq ;
-} cy_as_hal_sleep_channel ;
+ wait_queue_head_t wq;
+} cy_as_hal_sleep_channel;
/* moved to staging location, eventual location
* considered is here
@@ -61,7 +61,7 @@ typedef struct cy_as_hal_sleep_channel_t {
* device in the system. In this case the tag is a void * which is
* really an OMAP device pointer
*/
-typedef void *cy_as_hal_device_tag ;
+typedef void *cy_as_hal_device_tag;
/* This must be included after the CyAsHalDeviceTag type is defined */
@@ -84,7 +84,7 @@ typedef void *cy_as_hal_device_tag ;
*/
void
cy_as_hal_write_register(cy_as_hal_device_tag tag,
- uint16_t addr, uint16_t data) ;
+ uint16_t addr, uint16_t data);
/*
* This function must be defined to read a register from
@@ -93,7 +93,7 @@ cy_as_hal_write_register(cy_as_hal_device_tag tag,
* of the west bridge device.
*/
uint16_t
-cy_as_hal_read_register(cy_as_hal_device_tag tag, uint16_t addr) ;
+cy_as_hal_read_register(cy_as_hal_device_tag tag, uint16_t addr);
/*
* This function must be defined to transfer a block of data
@@ -103,7 +103,7 @@ cy_as_hal_read_register(cy_as_hal_device_tag tag, uint16_t addr) ;
*/
void
cy_as_hal_dma_setup_write(cy_as_hal_device_tag tag,
- uint8_t ep, void *buf, uint32_t size, uint16_t maxsize) ;
+ uint8_t ep, void *buf, uint32_t size, uint16_t maxsize);
/*
* This function must be defined to transfer a block of data
@@ -113,13 +113,13 @@ cy_as_hal_dma_setup_write(cy_as_hal_device_tag tag,
*/
void
cy_as_hal_dma_setup_read(cy_as_hal_device_tag tag, uint8_t ep,
- void *buf, uint32_t size, uint16_t maxsize) ;
+ void *buf, uint32_t size, uint16_t maxsize);
/*
* This function must be defined to cancel any pending DMA request.
*/
void
-cy_as_hal_dma_cancel_request(cy_as_hal_device_tag tag, uint8_t ep) ;
+cy_as_hal_dma_cancel_request(cy_as_hal_device_tag tag, uint8_t ep);
/*
* This function must be defined to allow the Antioch API to
@@ -128,7 +128,7 @@ cy_as_hal_dma_cancel_request(cy_as_hal_device_tag tag, uint8_t ep) ;
*/
void
cy_as_hal_dma_register_callback(cy_as_hal_device_tag tag,
- cy_as_hal_dma_complete_callback cb) ;
+ cy_as_hal_dma_complete_callback cb);
/*
* This function must be defined to return the maximum size of DMA
@@ -138,7 +138,7 @@ cy_as_hal_dma_register_callback(cy_as_hal_device_tag tag,
*/
uint32_t
cy_as_hal_dma_max_request_size(cy_as_hal_device_tag tag,
- cy_as_end_point_number_t ep) ;
+ cy_as_end_point_number_t ep);
/*
* This function must be defined to set the state of the WAKEUP pin
@@ -146,14 +146,14 @@ cy_as_hal_dma_max_request_size(cy_as_hal_device_tag tag,
* type.
*/
cy_bool
-cy_as_hal_set_wakeup_pin(cy_as_hal_device_tag tag, cy_bool state) ;
+cy_as_hal_set_wakeup_pin(cy_as_hal_device_tag tag, cy_bool state);
/*
* This function is called when the Antioch PLL loses lock, because
* of a problem in the supply voltage or the input clock.
*/
void
-cy_as_hal_pll_lock_loss_handler(cy_as_hal_device_tag tag) ;
+cy_as_hal_pll_lock_loss_handler(cy_as_hal_device_tag tag);
/**********************************************************************
@@ -168,14 +168,14 @@ cy_as_hal_pll_lock_loss_handler(cy_as_hal_device_tag tag) ;
* is expected to work exactly like malloc().
*/
void *
-cy_as_hal_alloc(uint32_t cnt) ;
+cy_as_hal_alloc(uint32_t cnt);
/*
* This function is required by the API to free memory allocated with
* CyAsHalAlloc(). This function is expected to work exacly like free().
*/
void
-cy_as_hal_free(void *mem_p) ;
+cy_as_hal_free(void *mem_p);
/*
* This function is required by the API to allocate memory during a
@@ -183,21 +183,21 @@ cy_as_hal_free(void *mem_p) ;
* time.
*/
void *
-cy_as_hal_c_b_alloc(uint32_t cnt) ;
+cy_as_hal_c_b_alloc(uint32_t cnt);
/*
* This function is required by the API to free memory allocated with
* CyAsCBHalAlloc().
*/
void
-cy_as_hal_c_b_free(void *ptr) ;
+cy_as_hal_c_b_free(void *ptr);
/*
* This function is required to set a block of memory to a specific
* value. This function is expected to work exactly like memset()
*/
void
-cy_as_hal_mem_set(void *ptr, uint8_t value, uint32_t cnt) ;
+cy_as_hal_mem_set(void *ptr, uint8_t value, uint32_t cnt);
/*
* This function is expected to create a sleep channel. The data
@@ -205,7 +205,7 @@ cy_as_hal_mem_set(void *ptr, uint8_t value, uint32_t cnt) ;
* pointer in the argument.
*/
cy_bool
-cy_as_hal_create_sleep_channel(cy_as_hal_sleep_channel *channel) ;
+cy_as_hal_create_sleep_channel(cy_as_hal_sleep_channel *channel);
/*
* This function is expected to destroy a sleep channel. The data
@@ -215,16 +215,16 @@ cy_as_hal_create_sleep_channel(cy_as_hal_sleep_channel *channel) ;
cy_bool
-cy_as_hal_destroy_sleep_channel(cy_as_hal_sleep_channel *channel) ;
+cy_as_hal_destroy_sleep_channel(cy_as_hal_sleep_channel *channel);
cy_bool
-cy_as_hal_sleep_on(cy_as_hal_sleep_channel *channel, uint32_t ms) ;
+cy_as_hal_sleep_on(cy_as_hal_sleep_channel *channel, uint32_t ms);
cy_bool
-cy_as_hal_wake(cy_as_hal_sleep_channel *channel) ;
+cy_as_hal_wake(cy_as_hal_sleep_channel *channel);
uint32_t
-cy_as_hal_disable_interrupts(void) ;
+cy_as_hal_disable_interrupts(void);
void
cy_as_hal_enable_interrupts(uint32_t);
@@ -283,7 +283,7 @@ void cy_as_hal_read_regs_before_standby(cy_as_hal_device_tag tag);
/*
CyAsMiscSetLogLevel(uint8_t level)
{
- debug_level = level ;
+ debug_level = level;
}
#ifdef CY_AS_LOG_SUPPORT
@@ -292,7 +292,7 @@ void
cy_as_log_debug_message(int level, const char *str)
{
if (level <= debug_level)
- cy_as_hal_print_message("log %d: %s\n", level, str) ;
+ cy_as_hal_print_message("log %d: %s\n", level, str);
}
*/
@@ -307,9 +307,9 @@ void cyashal_prn_buf(void *buf, uint16_t offset, int len);
* but are required to be called for this HAL.
*/
int start_o_m_a_p_kernel(const char *pgm,
- cy_as_hal_device_tag *tag, cy_bool debug) ;
-int stop_o_m_a_p_kernel(const char *pgm, cy_as_hal_device_tag tag) ;
-int omap_start_intr(cy_as_hal_device_tag tag) ;
+ cy_as_hal_device_tag *tag, cy_bool debug);
+int stop_o_m_a_p_kernel(const char *pgm, cy_as_hal_device_tag tag);
+int omap_start_intr(cy_as_hal_device_tag tag);
void cy_as_hal_set_ep_dma_mode(uint8_t ep, bool sg_xfer_enabled);
/* moved to staging location
diff --git a/drivers/staging/westbridge/astoria/arch/arm/plat-omap/include/mach/westbridge/westbridge-omap3-pnand-hal/cyasomapdev_kernel.h b/drivers/staging/westbridge/astoria/arch/arm/plat-omap/include/mach/westbridge/westbridge-omap3-pnand-hal/cyasomapdev_kernel.h
index 896e23281db..5a64bb6bb05 100644
--- a/drivers/staging/westbridge/astoria/arch/arm/plat-omap/include/mach/westbridge/westbridge-omap3-pnand-hal/cyasomapdev_kernel.h
+++ b/drivers/staging/westbridge/astoria/arch/arm/plat-omap/include/mach/westbridge/westbridge-omap3-pnand-hal/cyasomapdev_kernel.h
@@ -44,7 +44,7 @@
*/
typedef struct cy_as_omap_dev_kernel {
/* This is the signature for this data structure */
- unsigned int m_sig ;
+ unsigned int m_sig;
/* Address base of Antioch Device */
void *m_addr_base;
diff --git a/drivers/staging/westbridge/astoria/block/cyasblkdev_block.c b/drivers/staging/westbridge/astoria/block/cyasblkdev_block.c
index 58b89b16787..99d3e7e158b 100644
--- a/drivers/staging/westbridge/astoria/block/cyasblkdev_block.c
+++ b/drivers/staging/westbridge/astoria/block/cyasblkdev_block.c
@@ -155,7 +155,7 @@ struct cyasblkdev_blk_data {
};
/* pointer to west bridge block data device superstructure */
-static struct cyasblkdev_blk_data *gl_bd ;
+static struct cyasblkdev_blk_data *gl_bd;
static DECLARE_MUTEX(open_lock);
@@ -203,7 +203,7 @@ static struct cyasblkdev_blk_data *cyasblkdev_blk_get(
bd->usage++;
#ifndef NBDEBUG
cy_as_hal_print_message(
- "cyasblkdev_blk_get: usage = %d\n", bd->usage) ;
+ "cyasblkdev_blk_get: usage = %d\n", bd->usage);
#endif
}
up(&open_lock);
@@ -232,7 +232,7 @@ static void cyasblkdev_blk_put(
bd->usage);
#endif
up(&open_lock);
- return ;
+ return;
}
if (bd->usage == 0) {
@@ -245,7 +245,7 @@ static void cyasblkdev_blk_put(
cy_as_storage_release(bd->dev_handle, 0, 0, 0, 0)) {
#ifndef WESTBRIDGE_NDEBUG
cy_as_hal_print_message(
- "cyasblkdev: cannot release bus 0\n") ;
+ "cyasblkdev: cannot release bus 0\n");
#endif
}
@@ -253,7 +253,7 @@ static void cyasblkdev_blk_put(
cy_as_storage_release(bd->dev_handle, 1, 0, 0, 0)) {
#ifndef WESTBRIDGE_NDEBUG
cy_as_hal_print_message(
- "cyasblkdev: cannot release bus 1\n") ;
+ "cyasblkdev: cannot release bus 1\n");
#endif
}
@@ -261,7 +261,7 @@ static void cyasblkdev_blk_put(
cy_as_storage_stop(bd->dev_handle, 0, 0)) {
#ifndef WESTBRIDGE_NDEBUG
cy_as_hal_print_message(
- "cyasblkdev: cannot stop storage stack\n") ;
+ "cyasblkdev: cannot stop storage stack\n");
#endif
}
@@ -269,18 +269,18 @@ static void cyasblkdev_blk_put(
/* If the SCM Kernel HAL is being used, disable the use
* of scatter/gather lists at the end of block driver usage.
*/
- cy_as_hal_disable_scatter_list(cyasdevice_gethaltag()) ;
+ cy_as_hal_disable_scatter_list(cyasdevice_gethaltag());
#endif
/*ptr to global struct cyasblkdev_blk_data */
- gl_bd = NULL ;
+ gl_bd = NULL;
kfree(bd);
}
#ifndef WESTBRIDGE_NDEBUG
cy_as_hal_print_message(
"cyasblkdev (blk_put): usage = %d\n",
- bd->usage) ;
+ bd->usage);
#endif
up(&open_lock);
}
@@ -498,7 +498,7 @@ static void cyasblkdev_issuecallback(
#ifndef WESTBRIDGE_NDEBUG
cy_as_hal_print_message(
"%s: async r/w: op:%d failed with error %d at address %d\n",
- __func__, op, status, block_number) ;
+ __func__, op, status, block_number);
#endif
}
@@ -507,7 +507,7 @@ static void cyasblkdev_issuecallback(
"%s calling blk_end_request from issue_callback "
"req=0x%x, status=0x%x, nr_sectors=0x%x\n",
__func__, (unsigned int) gl_bd->queue.req, status,
- (unsigned int) blk_rq_sectors(gl_bd->queue.req)) ;
+ (unsigned int) blk_rq_sectors(gl_bd->queue.req));
#endif
/* note: blk_end_request w/o __ prefix should
@@ -560,7 +560,7 @@ static int cyasblkdev_blk_issue_rq(
)
{
struct cyasblkdev_blk_data *bd = bq->data;
- int index = 0 ;
+ int index = 0;
int ret = CY_AS_ERROR_SUCCESS;
uint32_t req_sector = 0;
uint32_t req_nr_sectors = 0;
@@ -648,7 +648,7 @@ static int cyasblkdev_blk_issue_rq(
req_nr_sectors*512))
;
- bq->req = NULL ;
+ bq->req = NULL;
}
} else {
ret = cy_as_storage_write_async(bd->dev_handle, bus_num, 0,
@@ -669,7 +669,7 @@ static int cyasblkdev_blk_issue_rq(
req_nr_sectors*512))
;
- bq->req = NULL ;
+ bq->req = NULL;
}
}
@@ -741,7 +741,7 @@ uint32_t cyasblkdev_get_vfat_offset(int bus_num, int unit_no)
*/
#ifndef WESTBRIDGE_NDEBUG
cy_as_hal_print_message(
- "%s scanning media for vfat partition...\n", __func__) ;
+ "%s scanning media for vfat partition...\n", __func__);
#endif
for (sect_no = 0; sect_no < SECTORS_TO_SCAN; sect_no++) {
@@ -808,7 +808,7 @@ uint32_t cyasblkdev_get_vfat_offset(int bus_num, int unit_no)
}
}
-cy_as_storage_query_device_data dev_data = {0} ;
+cy_as_storage_query_device_data dev_data = {0};
static int cyasblkdev_add_disks(int bus_num,
struct cyasblkdev_blk_data *bd,
@@ -818,7 +818,7 @@ static int cyasblkdev_add_disks(int bus_num,
int ret = 0;
uint64_t disk_cap;
int lcl_unit_no;
- cy_as_storage_query_unit_data unit_data = {0} ;
+ cy_as_storage_query_unit_data unit_data = {0};
#ifndef WESTBRIDGE_NDEBUG
cy_as_hal_print_message("%s:query device: "
@@ -843,29 +843,29 @@ static int cyasblkdev_add_disks(int bus_num,
"%s: device is locked\n", __func__);
#endif
ret = cy_as_storage_release(
- bd->dev_handle, bus_num, 0, 0, 0) ;
+ bd->dev_handle, bus_num, 0, 0, 0);
if (ret != CY_AS_ERROR_SUCCESS) {
#ifndef WESTBRIDGE_NDEBUG
cy_as_hal_print_message("%s cannot release"
- " storage\n", __func__) ;
+ " storage\n", __func__);
#endif
goto out;
}
goto out;
}
- unit_data.device = 0 ;
- unit_data.unit = 0 ;
+ unit_data.device = 0;
+ unit_data.unit = 0;
unit_data.bus = bus_num;
ret = cy_as_storage_query_unit(bd->dev_handle,
- &unit_data, 0, 0) ;
+ &unit_data, 0, 0);
if (ret != CY_AS_ERROR_SUCCESS) {
#ifndef WESTBRIDGE_NDEBUG
cy_as_hal_print_message("%s: cannot query "
"%d device unit - reason code %d\n",
- __func__, bus_num, ret) ;
+ __func__, bus_num, ret);
#endif
- goto out ;
+ goto out;
}
if (private_partition_bus == bus_num) {
@@ -906,15 +906,15 @@ static int cyasblkdev_add_disks(int bus_num,
bd->dev_handle, bus_num, 0,
private_partition_size, 0, 0);
if (ret == CY_AS_ERROR_SUCCESS) {
- unit_data.bus = bus_num ;
- unit_data.device = 0 ;
- unit_data.unit = 1 ;
+ unit_data.bus = bus_num;
+ unit_data.device = 0;
+ unit_data.unit = 1;
} else {
#ifndef WESTBRIDGE_NDEBUG
cy_as_hal_print_message(
"%s: cy_as_storage_create_p_partition "
"after removal unexpectedly failed "
- "with error %d\n", __func__, ret) ;
+ "with error %d\n", __func__, ret);
#endif
/* need to requery bus
@@ -922,22 +922,22 @@ static int cyasblkdev_add_disks(int bus_num,
* successful and create
* failed we have changed
* the disk properties */
- unit_data.bus = bus_num ;
- unit_data.device = 0 ;
- unit_data.unit = 0 ;
+ unit_data.bus = bus_num;
+ unit_data.device = 0;
+ unit_data.unit = 0;
}
ret = cy_as_storage_query_unit(
bd->dev_handle,
- &unit_data, 0, 0) ;
+ &unit_data, 0, 0);
if (ret != CY_AS_ERROR_SUCCESS) {
#ifndef WESTBRIDGE_NDEBUG
cy_as_hal_print_message(
"%s: cannot query %d "
"device unit - reason code %d\n",
- __func__, bus_num, ret) ;
+ __func__, bus_num, ret);
#endif
- goto out ;
+ goto out;
} else {
disk_cap = (uint64_t)
(unit_data.desc_p.unit_size);
@@ -952,27 +952,27 @@ static int cyasblkdev_add_disks(int bus_num,
__func__, ret);
#endif
- unit_data.bus = bus_num ;
- unit_data.device = 0 ;
- unit_data.unit = 1 ;
+ unit_data.bus = bus_num;
+ unit_data.device = 0;
+ unit_data.unit = 1;
ret = cy_as_storage_query_unit(
- bd->dev_handle, &unit_data, 0, 0) ;
+ bd->dev_handle, &unit_data, 0, 0);
if (ret != CY_AS_ERROR_SUCCESS) {
#ifndef WESTBRIDGE_NDEBUG
cy_as_hal_print_message(
"%s: cannot query %d "
"device unit - reason "
"code %d\n", __func__,
- bus_num, ret) ;
+ bus_num, ret);
#endif
- goto out ;
+ goto out;
}
disk_cap = (uint64_t)
(unit_data.desc_p.unit_size);
lcl_unit_no =
- unit_data.unit ;
+ unit_data.unit;
}
} else {
#ifndef WESTBRIDGE_NDEBUG
@@ -983,25 +983,25 @@ static int cyasblkdev_add_disks(int bus_num,
/*partition already existed,
* need to query second unit*/
- unit_data.bus = bus_num ;
- unit_data.device = 0 ;
- unit_data.unit = 1 ;
+ unit_data.bus = bus_num;
+ unit_data.device = 0;
+ unit_data.unit = 1;
ret = cy_as_storage_query_unit(
- bd->dev_handle, &unit_data, 0, 0) ;
+ bd->dev_handle, &unit_data, 0, 0);
if (ret != CY_AS_ERROR_SUCCESS) {
#ifndef WESTBRIDGE_NDEBUG
cy_as_hal_print_message(
"%s: cannot query %d "
"device unit "
"- reason code %d\n",
- __func__, bus_num, ret) ;
+ __func__, bus_num, ret);
#endif
- goto out ;
+ goto out;
} else {
disk_cap = (uint64_t)
(unit_data.desc_p.unit_size);
- lcl_unit_no = unit_data.unit ;
+ lcl_unit_no = unit_data.unit;
}
}
} else {
@@ -1067,7 +1067,7 @@ static int cyasblkdev_add_disks(int bus_num,
/* this will create a
* queue kernel thread */
cyasblkdev_init_queue(
- &bd->queue, &bd->lock) ;
+ &bd->queue, &bd->lock);
bd->queue.prep_fn = cyasblkdev_blk_prep_rq;
bd->queue.issue_fn = cyasblkdev_blk_issue_rq;
@@ -1261,7 +1261,7 @@ static int cyasblkdev_add_disks(int bus_num,
if (bd->system_disk == NULL) {
kfree(bd);
bd = ERR_PTR(-ENOMEM);
- return bd ;
+ return bd;
}
disk_cap = (uint64_t)
(private_partition_size);
@@ -1294,7 +1294,7 @@ static int cyasblkdev_add_disks(int bus_num,
else {
cy_as_hal_print_message(
"%s: system disk already allocated %d\n",
- __func__, bus_num) ;
+ __func__, bus_num);
}
#endif
}
@@ -1305,8 +1305,8 @@ out:
static struct cyasblkdev_blk_data *cyasblkdev_blk_alloc(void)
{
struct cyasblkdev_blk_data *bd;
- int ret = 0 ;
- cy_as_return_status_t stat = -1 ;
+ int ret = 0;
+ cy_as_return_status_t stat = -1;
int bus_num = 0;
int total_media_count = 0;
int devidx = 0;
@@ -1322,7 +1322,7 @@ static struct cyasblkdev_blk_data *cyasblkdev_blk_alloc(void)
bd = kzalloc(sizeof(struct cyasblkdev_blk_data), GFP_KERNEL);
if (bd) {
- gl_bd = bd ;
+ gl_bd = bd;
spin_lock_init(&bd->lock);
bd->usage = 1;
@@ -1331,14 +1331,14 @@ static struct cyasblkdev_blk_data *cyasblkdev_blk_alloc(void)
bd->blkops = &cyasblkdev_bdops;
/* Get the device handle */
- bd->dev_handle = cyasdevice_getdevhandle() ;
+ bd->dev_handle = cyasdevice_getdevhandle();
if (0 == bd->dev_handle) {
#ifndef WESTBRIDGE_NDEBUG
cy_as_hal_print_message(
- "%s: get device failed\n", __func__) ;
+ "%s: get device failed\n", __func__);
#endif
- ret = ENODEV ;
- goto out ;
+ ret = ENODEV;
+ goto out;
}
#ifndef WESTBRIDGE_NDEBUG
@@ -1350,7 +1350,7 @@ static struct cyasblkdev_blk_data *cyasblkdev_blk_alloc(void)
* device we are interested in. */
/* Error code to use if the conditions are not satisfied. */
- ret = ENOMEDIUM ;
+ ret = ENOMEDIUM;
stat = cy_as_misc_release_resource(bd->dev_handle, cy_as_bus_0);
if ((stat != CY_AS_ERROR_SUCCESS) &&
@@ -1358,7 +1358,7 @@ static struct cyasblkdev_blk_data *cyasblkdev_blk_alloc(void)
#ifndef WESTBRIDGE_NDEBUG
cy_as_hal_print_message("%s: cannot release "
"resource bus 0 - reason code %d\n",
- __func__, stat) ;
+ __func__, stat);
#endif
}
@@ -1368,16 +1368,16 @@ static struct cyasblkdev_blk_data *cyasblkdev_blk_alloc(void)
#ifndef WESTBRIDGE_NDEBUG
cy_as_hal_print_message("%s: cannot release "
"resource bus 0 - reason code %d\n",
- __func__, stat) ;
+ __func__, stat);
#endif
}
/* start storage stack*/
- stat = cy_as_storage_start(bd->dev_handle, 0, 0x101) ;
+ stat = cy_as_storage_start(bd->dev_handle, 0, 0x101);
if (stat != CY_AS_ERROR_SUCCESS) {
#ifndef WESTBRIDGE_NDEBUG
cy_as_hal_print_message("%s: cannot start storage "
- "stack - reason code %d\n", __func__, stat) ;
+ "stack - reason code %d\n", __func__, stat);
#endif
goto out;
}
@@ -1392,14 +1392,14 @@ static struct cyasblkdev_blk_data *cyasblkdev_blk_alloc(void)
if (stat != CY_AS_ERROR_SUCCESS) {
#ifndef WESTBRIDGE_NDEBUG
cy_as_hal_print_message("%s: cannot register callback "
- "- reason code %d\n", __func__, stat) ;
+ "- reason code %d\n", __func__, stat);
#endif
goto out;
}
for (bus_num = 0; bus_num < 2; bus_num++) {
stat = cy_as_storage_query_bus(bd->dev_handle,
- bus_num, &bd->media_count[bus_num], 0, 0) ;
+ bus_num, &bd->media_count[bus_num], 0, 0);
if (stat == CY_AS_ERROR_SUCCESS) {
total_media_count = total_media_count +
bd->media_count[bus_num];
@@ -1407,7 +1407,7 @@ static struct cyasblkdev_blk_data *cyasblkdev_blk_alloc(void)
#ifndef WESTBRIDGE_NDEBUG
cy_as_hal_print_message("%s: cannot query %d, "
"reason code: %d\n",
- __func__, bus_num, stat) ;
+ __func__, bus_num, stat);
#endif
goto out;
}
@@ -1416,9 +1416,9 @@ static struct cyasblkdev_blk_data *cyasblkdev_blk_alloc(void)
if (total_media_count == 0) {
#ifndef WESTBRIDGE_NDEBUG
cy_as_hal_print_message(
- "%s: no storage media was found\n", __func__) ;
+ "%s: no storage media was found\n", __func__);
#endif
- goto out ;
+ goto out;
} else if (total_media_count >= 1) {
if (bd->user_disk_0 == NULL) {
@@ -1428,7 +1428,7 @@ static struct cyasblkdev_blk_data *cyasblkdev_blk_alloc(void)
if (bd->user_disk_0 == NULL) {
kfree(bd);
bd = ERR_PTR(-ENOMEM);
- return bd ;
+ return bd;
}
}
#ifndef WESTBRIDGE_NDEBUG
@@ -1448,7 +1448,7 @@ static struct cyasblkdev_blk_data *cyasblkdev_blk_alloc(void)
if (bd->user_disk_1 == NULL) {
kfree(bd);
bd = ERR_PTR(-ENOMEM);
- return bd ;
+ return bd;
}
}
#ifndef WESTBRIDGE_NDEBUG
@@ -1468,25 +1468,25 @@ static struct cyasblkdev_blk_data *cyasblkdev_blk_alloc(void)
#ifndef WESTBRIDGE_NDEBUG
cy_as_hal_print_message("%s: %d device(s) found\n",
- __func__, total_media_count) ;
+ __func__, total_media_count);
#endif
for (bus_num = 0; bus_num <= 1; bus_num++) {
/*claim storage for cpu */
stat = cy_as_storage_claim(bd->dev_handle,
- bus_num, 0, 0, 0) ;
+ bus_num, 0, 0, 0);
if (stat != CY_AS_ERROR_SUCCESS) {
cy_as_hal_print_message("%s: cannot claim "
"%d bus - reason code %d\n",
- __func__, bus_num, stat) ;
+ __func__, bus_num, stat);
goto out;
}
- dev_data.bus = bus_num ;
- dev_data.device = 0 ;
+ dev_data.bus = bus_num;
+ dev_data.device = 0;
stat = cy_as_storage_query_device(bd->dev_handle,
- &dev_data, 0, 0) ;
+ &dev_data, 0, 0);
if (stat == CY_AS_ERROR_SUCCESS) {
cyasblkdev_add_disks(bus_num, bd,
total_media_count, devidx);
@@ -1494,20 +1494,20 @@ static struct cyasblkdev_blk_data *cyasblkdev_blk_alloc(void)
#ifndef WESTBRIDGE_NDEBUG
cy_as_hal_print_message(
"%s: no device on bus %d\n",
- __func__, bus_num) ;
+ __func__, bus_num);
#endif
} else {
#ifndef WESTBRIDGE_NDEBUG
cy_as_hal_print_message(
"%s: cannot query %d device "
"- reason code %d\n",
- __func__, bus_num, stat) ;
+ __func__, bus_num, stat);
#endif
- goto out ;
+ goto out;
}
} /* end for (bus_num = 0; bus_num <= 1; bus_num++)*/
- return bd ;
+ return bd;
}
out:
#ifndef WESTBRIDGE_NDEBUG
@@ -1546,7 +1546,7 @@ static int cyasblkdev_blk_initialize(void)
#ifndef WESTBRIDGE_NDEBUG
cy_as_hal_print_message(
"%s cyasblkdev registered with major number: %d\n",
- __func__, major) ;
+ __func__, major);
#endif
bd = cyasblkdev_blk_alloc();
diff --git a/drivers/staging/westbridge/astoria/block/cyasblkdev_queue.c b/drivers/staging/westbridge/astoria/block/cyasblkdev_queue.c
index 5cc469ab89f..24e959eca41 100644
--- a/drivers/staging/westbridge/astoria/block/cyasblkdev_queue.c
+++ b/drivers/staging/westbridge/astoria/block/cyasblkdev_queue.c
@@ -98,7 +98,7 @@ static int cyasblkdev_prep_request(
if (req->cmd_type != REQ_TYPE_FS && !(req->cmd_flags & REQ_DISCARD)) {
#ifndef WESTBRIDGE_NDEBUG
cy_as_hal_print_message("%s:%x bad request received\n",
- __func__, current->pid) ;
+ __func__, current->pid);
#endif
blk_dump_rq_flags(req, "cyasblkdev bad request");
@@ -136,7 +136,7 @@ static int cyasblkdev_queue_thread(void *d)
#ifndef WESTBRIDGE_NDEBUG
cy_as_hal_print_message(
- "%s:%x started, bq:%p, q:%p\n", __func__, qth_pid, bq, q) ;
+ "%s:%x started, bq:%p, q:%p\n", __func__, qth_pid, bq, q);
#endif
do {
@@ -249,7 +249,7 @@ static int cyasblkdev_queue_thread(void *d)
complete_and_exit(&bq->thread_complete, 0);
#ifndef WESTBRIDGE_NDEBUG
- cy_as_hal_print_message("%s: is finished\n", __func__) ;
+ cy_as_hal_print_message("%s: is finished\n", __func__);
#endif
return 0;
diff --git a/drivers/staging/westbridge/astoria/block/cyasblkdev_queue.h b/drivers/staging/westbridge/astoria/block/cyasblkdev_queue.h
index 26f9f596506..51cba6ae671 100644
--- a/drivers/staging/westbridge/astoria/block/cyasblkdev_queue.h
+++ b/drivers/staging/westbridge/astoria/block/cyasblkdev_queue.h
@@ -55,7 +55,7 @@ extern void cyasblkdev_cleanup_queue(struct cyasblkdev_queue *);
extern void cyasblkdev_queue_suspend(struct cyasblkdev_queue *);
extern void cyasblkdev_queue_resume(struct cyasblkdev_queue *);
-extern cy_as_device_handle cyasdevice_getdevhandle(void) ;
+extern cy_as_device_handle cyasdevice_getdevhandle(void);
#define MOD_LOGS 1
void verbose_rq_flags(int flags);
diff --git a/drivers/staging/westbridge/astoria/device/cyandevice_export.h b/drivers/staging/westbridge/astoria/device/cyandevice_export.h
index fc9dee994f0..acb4e07e850 100644
--- a/drivers/staging/westbridge/astoria/device/cyandevice_export.h
+++ b/drivers/staging/westbridge/astoria/device/cyandevice_export.h
@@ -26,77 +26,77 @@
* The APIs to create a device handle and download firmware are not exported
* because they are expected to be used only by this kernel module.
*/
-EXPORT_SYMBOL(cy_as_misc_get_firmware_version) ;
-EXPORT_SYMBOL(cy_as_misc_read_m_c_u_register) ;
-EXPORT_SYMBOL(cy_as_misc_reset) ;
-EXPORT_SYMBOL(cy_as_misc_acquire_resource) ;
-EXPORT_SYMBOL(cy_as_misc_release_resource) ;
-EXPORT_SYMBOL(cy_as_misc_enter_standby) ;
-EXPORT_SYMBOL(cy_as_misc_leave_standby) ;
-EXPORT_SYMBOL(cy_as_misc_enter_suspend) ;
-EXPORT_SYMBOL(cy_as_misc_leave_suspend) ;
-EXPORT_SYMBOL(cy_as_misc_storage_changed) ;
-EXPORT_SYMBOL(cy_as_misc_heart_beat_control) ;
-EXPORT_SYMBOL(cy_as_misc_get_gpio_value) ;
-EXPORT_SYMBOL(cy_as_misc_set_gpio_value) ;
-EXPORT_SYMBOL(cy_as_misc_set_low_speed_sd_freq) ;
-EXPORT_SYMBOL(cy_as_misc_set_high_speed_sd_freq) ;
+EXPORT_SYMBOL(cy_as_misc_get_firmware_version);
+EXPORT_SYMBOL(cy_as_misc_read_m_c_u_register);
+EXPORT_SYMBOL(cy_as_misc_reset);
+EXPORT_SYMBOL(cy_as_misc_acquire_resource);
+EXPORT_SYMBOL(cy_as_misc_release_resource);
+EXPORT_SYMBOL(cy_as_misc_enter_standby);
+EXPORT_SYMBOL(cy_as_misc_leave_standby);
+EXPORT_SYMBOL(cy_as_misc_enter_suspend);
+EXPORT_SYMBOL(cy_as_misc_leave_suspend);
+EXPORT_SYMBOL(cy_as_misc_storage_changed);
+EXPORT_SYMBOL(cy_as_misc_heart_beat_control);
+EXPORT_SYMBOL(cy_as_misc_get_gpio_value);
+EXPORT_SYMBOL(cy_as_misc_set_gpio_value);
+EXPORT_SYMBOL(cy_as_misc_set_low_speed_sd_freq);
+EXPORT_SYMBOL(cy_as_misc_set_high_speed_sd_freq);
/*
* Export the USB APIs that can be used by the dependent kernel modules.
*/
-EXPORT_SYMBOL(cy_as_usb_set_end_point_config) ;
-EXPORT_SYMBOL(cy_as_usb_read_data_async) ;
-EXPORT_SYMBOL(cy_as_usb_write_data_async) ;
-EXPORT_SYMBOL(cy_as_usb_cancel_async) ;
-EXPORT_SYMBOL(cy_as_usb_set_stall) ;
-EXPORT_SYMBOL(cy_as_usb_clear_stall) ;
-EXPORT_SYMBOL(cy_as_usb_connect) ;
-EXPORT_SYMBOL(cy_as_usb_disconnect) ;
-EXPORT_SYMBOL(cy_as_usb_start) ;
-EXPORT_SYMBOL(cy_as_usb_stop) ;
-EXPORT_SYMBOL(cy_as_usb_set_enum_config) ;
-EXPORT_SYMBOL(cy_as_usb_get_enum_config) ;
-EXPORT_SYMBOL(cy_as_usb_set_physical_configuration) ;
-EXPORT_SYMBOL(cy_as_usb_register_callback) ;
-EXPORT_SYMBOL(cy_as_usb_commit_config) ;
-EXPORT_SYMBOL(cy_as_usb_set_descriptor) ;
-EXPORT_SYMBOL(cy_as_usb_clear_descriptors) ;
-EXPORT_SYMBOL(cy_as_usb_get_descriptor) ;
-EXPORT_SYMBOL(cy_as_usb_get_end_point_config) ;
-EXPORT_SYMBOL(cy_as_usb_read_data) ;
-EXPORT_SYMBOL(cy_as_usb_write_data) ;
-EXPORT_SYMBOL(cy_as_usb_get_stall) ;
-EXPORT_SYMBOL(cy_as_usb_set_nak) ;
-EXPORT_SYMBOL(cy_as_usb_clear_nak) ;
-EXPORT_SYMBOL(cy_as_usb_get_nak) ;
-EXPORT_SYMBOL(cy_as_usb_signal_remote_wakeup) ;
-EXPORT_SYMBOL(cy_as_usb_set_m_s_report_threshold) ;
-EXPORT_SYMBOL(cy_as_usb_select_m_s_partitions) ;
+EXPORT_SYMBOL(cy_as_usb_set_end_point_config);
+EXPORT_SYMBOL(cy_as_usb_read_data_async);
+EXPORT_SYMBOL(cy_as_usb_write_data_async);
+EXPORT_SYMBOL(cy_as_usb_cancel_async);
+EXPORT_SYMBOL(cy_as_usb_set_stall);
+EXPORT_SYMBOL(cy_as_usb_clear_stall);
+EXPORT_SYMBOL(cy_as_usb_connect);
+EXPORT_SYMBOL(cy_as_usb_disconnect);
+EXPORT_SYMBOL(cy_as_usb_start);
+EXPORT_SYMBOL(cy_as_usb_stop);
+EXPORT_SYMBOL(cy_as_usb_set_enum_config);
+EXPORT_SYMBOL(cy_as_usb_get_enum_config);
+EXPORT_SYMBOL(cy_as_usb_set_physical_configuration);
+EXPORT_SYMBOL(cy_as_usb_register_callback);
+EXPORT_SYMBOL(cy_as_usb_commit_config);
+EXPORT_SYMBOL(cy_as_usb_set_descriptor);
+EXPORT_SYMBOL(cy_as_usb_clear_descriptors);
+EXPORT_SYMBOL(cy_as_usb_get_descriptor);
+EXPORT_SYMBOL(cy_as_usb_get_end_point_config);
+EXPORT_SYMBOL(cy_as_usb_read_data);
+EXPORT_SYMBOL(cy_as_usb_write_data);
+EXPORT_SYMBOL(cy_as_usb_get_stall);
+EXPORT_SYMBOL(cy_as_usb_set_nak);
+EXPORT_SYMBOL(cy_as_usb_clear_nak);
+EXPORT_SYMBOL(cy_as_usb_get_nak);
+EXPORT_SYMBOL(cy_as_usb_signal_remote_wakeup);
+EXPORT_SYMBOL(cy_as_usb_set_m_s_report_threshold);
+EXPORT_SYMBOL(cy_as_usb_select_m_s_partitions);
/*
* Export all Storage APIs that can be used by dependent kernel modules.
*/
-EXPORT_SYMBOL(cy_as_storage_start) ;
-EXPORT_SYMBOL(cy_as_storage_stop) ;
-EXPORT_SYMBOL(cy_as_storage_register_callback) ;
-EXPORT_SYMBOL(cy_as_storage_query_bus) ;
-EXPORT_SYMBOL(cy_as_storage_query_media) ;
-EXPORT_SYMBOL(cy_as_storage_query_device) ;
-EXPORT_SYMBOL(cy_as_storage_query_unit) ;
-EXPORT_SYMBOL(cy_as_storage_device_control) ;
-EXPORT_SYMBOL(cy_as_storage_claim) ;
-EXPORT_SYMBOL(cy_as_storage_release) ;
-EXPORT_SYMBOL(cy_as_storage_read) ;
-EXPORT_SYMBOL(cy_as_storage_write) ;
-EXPORT_SYMBOL(cy_as_storage_read_async) ;
-EXPORT_SYMBOL(cy_as_storage_write_async) ;
-EXPORT_SYMBOL(cy_as_storage_cancel_async) ;
-EXPORT_SYMBOL(cy_as_storage_sd_register_read) ;
-EXPORT_SYMBOL(cy_as_storage_create_p_partition) ;
-EXPORT_SYMBOL(cy_as_storage_remove_p_partition) ;
-EXPORT_SYMBOL(cy_as_storage_get_transfer_amount) ;
-EXPORT_SYMBOL(cy_as_storage_erase) ;
+EXPORT_SYMBOL(cy_as_storage_start);
+EXPORT_SYMBOL(cy_as_storage_stop);
+EXPORT_SYMBOL(cy_as_storage_register_callback);
+EXPORT_SYMBOL(cy_as_storage_query_bus);
+EXPORT_SYMBOL(cy_as_storage_query_media);
+EXPORT_SYMBOL(cy_as_storage_query_device);
+EXPORT_SYMBOL(cy_as_storage_query_unit);
+EXPORT_SYMBOL(cy_as_storage_device_control);
+EXPORT_SYMBOL(cy_as_storage_claim);
+EXPORT_SYMBOL(cy_as_storage_release);
+EXPORT_SYMBOL(cy_as_storage_read);
+EXPORT_SYMBOL(cy_as_storage_write);
+EXPORT_SYMBOL(cy_as_storage_read_async);
+EXPORT_SYMBOL(cy_as_storage_write_async);
+EXPORT_SYMBOL(cy_as_storage_cancel_async);
+EXPORT_SYMBOL(cy_as_storage_sd_register_read);
+EXPORT_SYMBOL(cy_as_storage_create_p_partition);
+EXPORT_SYMBOL(cy_as_storage_remove_p_partition);
+EXPORT_SYMBOL(cy_as_storage_get_transfer_amount);
+EXPORT_SYMBOL(cy_as_storage_erase);
EXPORT_SYMBOL(cy_as_sdio_query_card);
EXPORT_SYMBOL(cy_as_sdio_init_function);
@@ -106,13 +106,13 @@ EXPORT_SYMBOL(cy_as_sdio_direct_write);
EXPORT_SYMBOL(cy_as_sdio_extended_read);
EXPORT_SYMBOL(cy_as_sdio_extended_write);
-EXPORT_SYMBOL(cy_as_hal_alloc) ;
-EXPORT_SYMBOL(cy_as_hal_free) ;
-EXPORT_SYMBOL(cy_as_hal_sleep) ;
-EXPORT_SYMBOL(cy_as_hal_create_sleep_channel) ;
-EXPORT_SYMBOL(cy_as_hal_destroy_sleep_channel) ;
-EXPORT_SYMBOL(cy_as_hal_sleep_on) ;
-EXPORT_SYMBOL(cy_as_hal_wake) ;
+EXPORT_SYMBOL(cy_as_hal_alloc);
+EXPORT_SYMBOL(cy_as_hal_free);
+EXPORT_SYMBOL(cy_as_hal_sleep);
+EXPORT_SYMBOL(cy_as_hal_create_sleep_channel);
+EXPORT_SYMBOL(cy_as_hal_destroy_sleep_channel);
+EXPORT_SYMBOL(cy_as_hal_sleep_on);
+EXPORT_SYMBOL(cy_as_hal_wake);
EXPORT_SYMBOL(cy_as_hal_mem_set);
EXPORT_SYMBOL(cy_as_mtp_storage_only_start);
@@ -125,8 +125,8 @@ EXPORT_SYMBOL(cy_as_mtp_cancel_get_object);
#ifdef __CY_ASTORIA_SCM_KERNEL_HAL__
/* Functions in the SCM kernel HAL implementation only. */
-EXPORT_SYMBOL(cy_as_hal_enable_scatter_list) ;
-EXPORT_SYMBOL(cy_as_hal_disable_scatter_list) ;
+EXPORT_SYMBOL(cy_as_hal_enable_scatter_list);
+EXPORT_SYMBOL(cy_as_hal_disable_scatter_list);
#endif
/*[]*/
diff --git a/drivers/staging/westbridge/astoria/device/cyasdevice.c b/drivers/staging/westbridge/astoria/device/cyasdevice.c
index cd0f7cbc9b1..9b5bc53c990 100644
--- a/drivers/staging/westbridge/astoria/device/cyasdevice.c
+++ b/drivers/staging/westbridge/astoria/device/cyasdevice.c
@@ -48,12 +48,12 @@ typedef struct cyasdevice {
cy_as_device_handle dev_handle;
/* Handle to the HAL */
cy_as_hal_device_tag hal_tag;
-} cyasdevice ;
+} cyasdevice;
/* global ptr to astoria device */
-static cyasdevice *cy_as_device_controller ;
+static cyasdevice *cy_as_device_controller;
int cy_as_device_init_done;
-const char *dev_handle_name = "cy_astoria_dev_handle" ;
+const char *dev_handle_name = "cy_astoria_dev_handle";
#ifdef CONFIG_MACH_OMAP3_WESTBRIDGE_AST_PNAND_HAL
extern void cy_as_hal_config_c_s_mux(void);
@@ -61,17 +61,17 @@ extern void cy_as_hal_config_c_s_mux(void);
static void cyasdevice_deinit(cyasdevice *cy_as_dev)
{
- cy_as_hal_print_message("<1>_cy_as_device deinitialize called\n") ;
+ cy_as_hal_print_message("<1>_cy_as_device deinitialize called\n");
if (!cy_as_dev) {
cy_as_hal_print_message("<1>_cy_as_device_deinit: "
- "device handle %x is invalid\n", (uint32_t)cy_as_dev) ;
- return ;
+ "device handle %x is invalid\n", (uint32_t)cy_as_dev);
+ return;
}
/* stop west_brige */
if (cy_as_dev->dev_handle) {
cy_as_hal_print_message("<1>_cy_as_device: "
- "cy_as_misc_destroy_device called\n") ;
+ "cy_as_misc_destroy_device called\n");
if (cy_as_misc_destroy_device(cy_as_dev->dev_handle) !=
CY_AS_ERROR_SUCCESS) {
cy_as_hal_print_message(
@@ -89,40 +89,40 @@ static void cyasdevice_deinit(cyasdevice *cy_as_dev)
#endif
}
- cy_as_hal_print_message("<1>_cy_as_device:HAL layer stopped\n") ;
+ cy_as_hal_print_message("<1>_cy_as_device:HAL layer stopped\n");
- kfree(cy_as_dev) ;
- cy_as_device_controller = NULL ;
- cy_as_hal_print_message("<1>_cy_as_device: deinitialized\n") ;
+ kfree(cy_as_dev);
+ cy_as_device_controller = NULL;
+ cy_as_hal_print_message("<1>_cy_as_device: deinitialized\n");
}
/*called from src/cyasmisc.c:MyMiscCallback() as a func
* pointer [dev_p->misc_event_cb] which was previously
* registered by CyAsLLRegisterRequestCallback(...,
- * MyMiscCallback) ; called from CyAsMiscConfigureDevice()
+ * MyMiscCallback); called from CyAsMiscConfigureDevice()
* which is in turn called from cyasdevice_initialize() in
* this src
*/
static void cy_misc_callback(cy_as_device_handle h,
cy_as_misc_event_type evtype, void *evdata)
{
- (void)h ;
- (void)evdata ;
+ (void)h;
+ (void)evdata;
switch (evtype) {
case cy_as_event_misc_initialized:
cy_as_hal_print_message("<1>_cy_as_device: "
- "initialization done callback triggered\n") ;
- cy_as_device_init_done = 1 ;
- break ;
+ "initialization done callback triggered\n");
+ cy_as_device_init_done = 1;
+ break;
case cy_as_event_misc_awake:
cy_as_hal_print_message("<1>_cy_as_device: "
- "cy_as_event_misc_awake event callback triggered\n") ;
- cy_as_device_init_done = 1 ;
- break ;
+ "cy_as_event_misc_awake event callback triggered\n");
+ cy_as_device_init_done = 1;
+ break;
default:
- break ;
+ break;
}
}
@@ -133,7 +133,7 @@ void hal_reset(cy_as_hal_device_tag tag)
cy_as_hal_print_message("<1> send soft hard rst: "
"MEM_RST_CTRL_REG_HARD...\n");
cy_as_hal_write_register(tag, CY_AS_MEM_RST_CTRL_REG,
- CY_AS_MEM_RST_CTRL_REG_HARD) ;
+ CY_AS_MEM_RST_CTRL_REG_HARD);
mdelay(60);
cy_as_hal_print_message("<1> after RST: si_rev_REG:%x, "
@@ -144,7 +144,7 @@ void hal_reset(cy_as_hal_device_tag tag)
/* set it to LBD */
cy_as_hal_write_register(tag, CY_AS_MEM_PNAND_CFG,
- PNAND_REG_CFG_INIT_VAL) ;
+ PNAND_REG_CFG_INIT_VAL);
}
EXPORT_SYMBOL(hal_reset);
@@ -175,13 +175,13 @@ static struct platform_driver west_bridge_driver = {
/* west bridge device driver main init */
static int cyasdevice_initialize(void)
{
- cyasdevice *cy_as_dev = 0 ;
- int ret = 0 ;
- int retval = 0 ;
- cy_as_device_config config ;
- cy_as_hal_sleep_channel channel ;
+ cyasdevice *cy_as_dev = 0;
+ int ret = 0;
+ int retval = 0;
+ cy_as_device_config config;
+ cy_as_hal_sleep_channel channel;
cy_as_get_firmware_version_data ver_data = {0};
- const char *str = "" ;
+ const char *str = "";
int spin_lim;
const struct firmware *fw_entry;
@@ -189,19 +189,19 @@ static int cyasdevice_initialize(void)
cy_as_misc_set_log_level(8);
- cy_as_hal_print_message("<1>_cy_as_device initialize called\n") ;
+ cy_as_hal_print_message("<1>_cy_as_device initialize called\n");
if (cy_as_device_controller != 0) {
cy_as_hal_print_message("<1>_cy_as_device: the device "
- "has already been initilaized. ignoring\n") ;
- return -EBUSY ;
+ "has already been initilaized. ignoring\n");
+ return -EBUSY;
}
/* cy_as_dev = CyAsHalAlloc (sizeof(cyasdevice), SLAB_KERNEL); */
cy_as_dev = cy_as_hal_alloc(sizeof(cyasdevice));
if (cy_as_dev == NULL) {
cy_as_hal_print_message("<1>_cy_as_device: "
- "memmory allocation failed\n") ;
+ "memmory allocation failed\n");
return -ENOMEM;
}
memset(cy_as_dev, 0, sizeof(cyasdevice));
@@ -216,7 +216,7 @@ static int cyasdevice_initialize(void)
&(cy_as_dev->hal_tag), cy_false)) {
cy_as_hal_print_message(
- "<1>_cy_as_device: start OMAP34xx HAL failed\n") ;
+ "<1>_cy_as_device: start OMAP34xx HAL failed\n");
goto done;
}
#endif
@@ -226,28 +226,28 @@ static int cyasdevice_initialize(void)
cy_as_dev->hal_tag) != CY_AS_ERROR_SUCCESS) {
cy_as_hal_print_message(
- "<1>_cy_as_device: create device failed\n") ;
- goto done ;
+ "<1>_cy_as_device: create device failed\n");
+ goto done;
}
memset(&config, 0, sizeof(config));
config.dmaintr = cy_true;
- ret = cy_as_misc_configure_device(cy_as_dev->dev_handle, &config) ;
+ ret = cy_as_misc_configure_device(cy_as_dev->dev_handle, &config);
if (ret != CY_AS_ERROR_SUCCESS) {
cy_as_hal_print_message(
"<1>_cy_as_device: configure device "
- "failed. reason code: %d\n", ret) ;
+ "failed. reason code: %d\n", ret);
goto done;
}
ret = cy_as_misc_register_callback(cy_as_dev->dev_handle,
- cy_misc_callback) ;
+ cy_misc_callback);
if (ret != CY_AS_ERROR_SUCCESS) {
cy_as_hal_print_message("<1>_cy_as_device: "
"cy_as_misc_register_callback failed. "
- "reason code: %d\n", ret) ;
+ "reason code: %d\n", ret);
goto done;
}
@@ -275,12 +275,12 @@ static int cyasdevice_initialize(void)
cy_as_dev->dev_handle,
fw_entry->data,
fw_entry->size ,
- 0, 0) ;
+ 0, 0);
}
if (ret != CY_AS_ERROR_SUCCESS) {
cy_as_hal_print_message("<1>_cy_as_device: cannot download "
- "firmware. reason code: %d\n", ret) ;
+ "firmware. reason code: %d\n", ret);
goto done;
}
@@ -289,10 +289,10 @@ static int cyasdevice_initialize(void)
* to complete is 5sec*/
spin_lim = 50;
- cy_as_hal_create_sleep_channel(&channel) ;
+ cy_as_hal_create_sleep_channel(&channel);
while (!cy_as_device_init_done) {
- cy_as_hal_sleep_on(&channel, 100) ;
+ cy_as_hal_sleep_on(&channel, 100);
if (spin_lim-- <= 0) {
cy_as_hal_print_message(
@@ -301,46 +301,46 @@ static int cyasdevice_initialize(void)
break;
}
}
- cy_as_hal_destroy_sleep_channel(&channel) ;
+ cy_as_hal_destroy_sleep_channel(&channel);
if (spin_lim > 0)
cy_as_hal_print_message(
- "cy_as_device: astoria firmware is loaded\n") ;
+ "cy_as_device: astoria firmware is loaded\n");
ret = cy_as_misc_get_firmware_version(cy_as_dev->dev_handle,
- &ver_data, 0, 0) ;
+ &ver_data, 0, 0);
if (ret != CY_AS_ERROR_SUCCESS) {
cy_as_hal_print_message("<1>_cy_as_device: cannot get firmware "
- "version. reason code: %d\n", ret) ;
+ "version. reason code: %d\n", ret);
goto done;
}
if ((ver_data.media_type & 0x01) && (ver_data.media_type & 0x06))
- str = "nand and SD/MMC." ;
+ str = "nand and SD/MMC.";
else if ((ver_data.media_type & 0x01) && (ver_data.media_type & 0x08))
- str = "nand and CEATA." ;
+ str = "nand and CEATA.";
else if (ver_data.media_type & 0x01)
- str = "nand." ;
+ str = "nand.";
else if (ver_data.media_type & 0x08)
- str = "CEATA." ;
+ str = "CEATA.";
else
- str = "SD/MMC." ;
+ str = "SD/MMC.";
cy_as_hal_print_message("<1> cy_as_device:_firmware version: %s "
"major=%d minor=%d build=%d,\n_media types supported:%s\n",
((ver_data.is_debug_mode) ? "debug" : "release"),
- ver_data.major, ver_data.minor, ver_data.build, str) ;
+ ver_data.major, ver_data.minor, ver_data.build, str);
/* done now */
- cy_as_device_controller = cy_as_dev ;
+ cy_as_device_controller = cy_as_dev;
- return 0 ;
+ return 0;
done:
if (cy_as_dev)
- cyasdevice_deinit(cy_as_dev) ;
+ cyasdevice_deinit(cy_as_dev);
- return -EINVAL ;
+ return -EINVAL;
}
cy_as_device_handle cyasdevice_getdevhandle(void)
@@ -350,21 +350,21 @@ cy_as_device_handle cyasdevice_getdevhandle(void)
cy_as_hal_config_c_s_mux();
#endif
- return cy_as_device_controller->dev_handle ;
+ return cy_as_device_controller->dev_handle;
}
return NULL;
}
-EXPORT_SYMBOL(cyasdevice_getdevhandle) ;
+EXPORT_SYMBOL(cyasdevice_getdevhandle);
cy_as_hal_device_tag cyasdevice_gethaltag(void)
{
if (cy_as_device_controller)
return (cy_as_hal_device_tag)
- cy_as_device_controller->hal_tag ;
+ cy_as_device_controller->hal_tag;
return NULL;
}
-EXPORT_SYMBOL(cyasdevice_gethaltag) ;
+EXPORT_SYMBOL(cyasdevice_gethaltag);
/*init Westbridge device driver **/
@@ -373,14 +373,14 @@ static int __init cyasdevice_init(void)
if (cyasdevice_initialize() != 0)
return ENODEV;
- return 0 ;
+ return 0;
}
static void __exit cyasdevice_cleanup(void)
{
- cyasdevice_deinit(cy_as_device_controller) ;
+ cyasdevice_deinit(cy_as_device_controller);
}
diff --git a/drivers/staging/westbridge/astoria/gadget/cyasgadget.h b/drivers/staging/westbridge/astoria/gadget/cyasgadget.h
index d7b72d2720b..e01cea7eeb7 100644
--- a/drivers/staging/westbridge/astoria/gadget/cyasgadget.h
+++ b/drivers/staging/westbridge/astoria/gadget/cyasgadget.h
@@ -84,7 +84,7 @@
extern int mpage_cleardirty(struct address_space *mapping, int num_pages);
extern int fat_get_block(struct inode *, sector_t , struct buffer_head *, int);
-extern cy_as_device_handle *cyasdevice_getdevhandle(void) ;
+extern cy_as_device_handle *cyasdevice_getdevhandle(void);
/* Driver data structures and utilities */
typedef struct cyasgadget_ep {
@@ -102,7 +102,7 @@ typedef struct cyasgadget_ep {
is_in:1,
is_iso:1;
cy_as_usb_end_point_config cyepconfig;
-} cyasgadget_ep ;
+} cyasgadget_ep;
typedef struct cyasgadget_req {
struct usb_request req;
@@ -112,7 +112,7 @@ typedef struct cyasgadget_req {
valid:1,
complete:1,
ep_stopped:1;
-} cyasgadget_req ;
+} cyasgadget_req;
typedef struct cyasgadget {
/* each device provides one gadget, several endpoints */
@@ -139,16 +139,16 @@ typedef struct cyasgadget {
/* Data member used to store the GetObjectComplete event data */
cy_as_mtp_get_object_complete_data tmtp_get_complete_data;
-} cyasgadget ;
+} cyasgadget;
static inline void set_halt(cyasgadget_ep *ep)
{
- return ;
+ return;
}
static inline void clear_halt(cyasgadget_ep *ep)
{
- return ;
+ return;
}
#define xprintk(dev, level, fmt, args...) \
@@ -182,12 +182,12 @@ static inline void clear_halt(cyasgadget_ep *ep)
static inline void start_out_naking(struct cyasgadget_ep *ep)
{
- return ;
+ return;
}
static inline void stop_out_naking(struct cyasgadget_ep *ep)
{
- return ;
+ return;
}
#endif /* _INCLUDED_CYANGADGET_H_ */
diff --git a/drivers/staging/westbridge/astoria/gadget/cyasgadget_ioctl.h b/drivers/staging/westbridge/astoria/gadget/cyasgadget_ioctl.h
index e67bfd36f62..21dd716f116 100644
--- a/drivers/staging/westbridge/astoria/gadget/cyasgadget_ioctl.h
+++ b/drivers/staging/westbridge/astoria/gadget/cyasgadget_ioctl.h
@@ -29,14 +29,14 @@
typedef struct cy_as_gadget_ioctl_send_object {
uint32_t status;
- uint32_t byte_count ;
- uint32_t transaction_id ;
-} cy_as_gadget_ioctl_send_object ;
+ uint32_t byte_count;
+ uint32_t transaction_id;
+} cy_as_gadget_ioctl_send_object;
typedef struct cy_as_gadget_ioctl_get_object {
uint32_t status;
- uint32_t byte_count ;
-} cy_as_gadget_ioctl_get_object ;
+ uint32_t byte_count;
+} cy_as_gadget_ioctl_get_object;
typedef struct cy_as_gadget_ioctl_tmtp_status {
@@ -46,7 +46,7 @@ typedef struct cy_as_gadget_ioctl_tmtp_status {
cy_as_gadget_ioctl_send_object tmtp_send_complete_data;
cy_as_gadget_ioctl_get_object tmtp_get_complete_data;
uint32_t t_usec;
-} cy_as_gadget_ioctl_tmtp_status ;
+} cy_as_gadget_ioctl_tmtp_status;
/*Init send object data*/
typedef struct cy_as_gadget_ioctl_i_s_o_j_d {
@@ -57,7 +57,7 @@ typedef struct cy_as_gadget_ioctl_i_s_o_j_d {
uint32_t num_bytes;
/* in case if more prcise timestamping is done in kernel mode */
uint32_t t_usec;
- uint32_t ret_val ;
+ uint32_t ret_val;
char *file_name;
uint32_t name_length;
@@ -70,12 +70,12 @@ typedef struct cy_as_gadget_ioctl_i_g_o_j_d {
uint16_t *blk_count_p;
uint32_t item_count;
uint32_t num_bytes;
- uint32_t tid ;
- uint32_t ret_val ;
+ uint32_t tid;
+ uint32_t ret_val;
char *file_name;
uint32_t name_length;
-} cy_as_gadget_ioctl_i_g_o_j_d ;
+} cy_as_gadget_ioctl_i_g_o_j_d;
typedef struct cy_as_gadget_ioctl_cancel {
uint32_t ret_val;
diff --git a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyanmisc.h b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyanmisc.h
index 34584b79870..0838648dc16 100644
--- a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyanmisc.h
+++ b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyanmisc.h
@@ -130,7 +130,7 @@ EXTERN cy_an_return_status_t
cy_an_misc_create_device(
cy_an_device_handle *handle_p,
cy_an_hal_device_tag tag
- ) ;
+ );
#define cy_an_misc_create_device(h, tag) \
cy_as_misc_create_device((cy_as_device_handle *)(h), \
(cy_as_hal_device_tag)(tag))
@@ -138,7 +138,7 @@ cy_an_misc_create_device(
EXTERN cy_an_return_status_t
cy_an_misc_destroy_device(
cy_an_device_handle handle
- ) ;
+ );
#define cy_an_misc_destroy_device(h) \
cy_as_misc_destroy_device((cy_as_device_handle)(h))
@@ -146,7 +146,7 @@ EXTERN cy_an_return_status_t
cy_an_misc_configure_device(
cy_an_device_handle handle,
cy_an_device_config *config_p
- ) ;
+ );
#define cy_an_misc_configure_device(h, cfg) \
cy_as_misc_configure_device((cy_as_device_handle)(h), \
(cy_as_device_config *)(cfg))
@@ -155,7 +155,7 @@ EXTERN cy_an_return_status_t
cy_an_misc_in_standby(
cy_an_device_handle handle,
cy_bool *standby
- ) ;
+ );
#define cy_an_misc_in_standby(h, standby) \
cy_as_misc_in_standby((cy_as_device_handle)(h), (standby))
@@ -165,7 +165,7 @@ cy_an_misc_download_firmware(
cy_an_device_handle handle,
const void *fw_p,
uint16_t size
- ) ;
+ );
#define cy_an_misc_download_firmware(handle, fw_p, size) \
cy_as_misc_download_firmware((cy_as_device_handle)\
@@ -179,7 +179,7 @@ cy_an_misc_download_firmware_e_x(
uint16_t size,
cy_an_function_callback cb,
uint32_t client
- ) ;
+ );
#define cy_an_misc_download_firmware_e_x(h, fw_p, size, cb, client) \
cy_as_misc_download_firmware((cy_as_device_handle)(h), \
@@ -207,7 +207,7 @@ cy_an_misc_get_firmware_version_e_x(
cy_an_get_firmware_version_data *data,
cy_an_function_callback cb,
uint32_t client
- ) ;
+ );
#define cy_an_misc_get_firmware_version_e_x\
(h, data, cb, client) \
cy_as_misc_get_firmware_version((cy_as_device_handle)(h), \
@@ -219,7 +219,7 @@ cy_an_misc_read_m_c_u_register(
cy_an_device_handle handle,
uint16_t address,
uint8_t *value
- ) ;
+ );
#define cy_an_misc_read_m_c_u_register(handle, address, value) \
cy_as_misc_read_m_c_u_register((cy_as_device_handle)(handle), \
@@ -233,7 +233,7 @@ cy_an_misc_read_m_c_u_register_e_x(
uint8_t *value,
cy_an_function_callback cb,
uint32_t client
- ) ;
+ );
#define cy_an_misc_read_m_c_u_register_e_x\
(h, addr, val, cb, client) \
@@ -247,7 +247,7 @@ cy_an_misc_write_m_c_u_register(
uint16_t address,
uint8_t mask,
uint8_t value
- ) ;
+ );
#define cy_an_misc_write_m_c_u_register\
(handle, address, mask, value) \
cy_as_misc_write_m_c_u_register((cy_as_device_handle)(handle), \
@@ -262,7 +262,7 @@ cy_an_misc_write_m_c_u_register_e_x(
uint8_t value,
cy_an_function_callback cb,
uint32_t client
- ) ;
+ );
#define cy_an_misc_write_m_c_u_register_e_x\
(h, addr, mask, val, cb, client) \
cy_as_misc_write_m_c_u_register((cy_as_device_handle)(h), \
@@ -274,7 +274,7 @@ cy_an_misc_reset(
cy_an_device_handle handle,
cy_an_reset_type type,
cy_bool flush
- ) ;
+ );
#define cy_an_misc_reset(handle, type, flush) \
cy_as_misc_reset((cy_as_device_handle)(handle), \
(type), (flush), 0, 0)
@@ -287,7 +287,7 @@ cy_an_misc_reset_e_x(
cy_bool flush,
cy_an_function_callback cb,
uint32_t client
- ) ;
+ );
#define cy_an_misc_reset_e_x(h, type, flush, cb, client) \
cy_as_misc_reset((cy_as_device_handle)(h), \
(cy_as_reset_type)(type), (flush), \
@@ -299,7 +299,7 @@ cy_an_misc_acquire_resource(
cy_an_device_handle handle,
cy_an_resource_type type,
cy_bool force
- ) ;
+ );
#define cy_an_misc_acquire_resource(h, type, force) \
cy_as_misc_acquire_resource_dep((cy_as_device_handle)(h), \
(cy_as_resource_type)(type), (force))
@@ -312,7 +312,7 @@ cy_an_misc_acquire_resource_e_x(
cy_bool force,
cy_an_function_callback cb,
uint32_t client
- ) ;
+ );
#define cy_an_misc_acquire_resource_e_x\
(h, type_p, force, cb, client) \
cy_as_misc_acquire_resource((cy_as_device_handle)(h), \
@@ -324,7 +324,7 @@ EXTERN cy_an_return_status_t
cy_an_misc_release_resource(
cy_an_device_handle handle,
cy_an_resource_type type
- ) ;
+ );
#define cy_an_misc_release_resource(h, type)\
cy_as_misc_release_resource((cy_as_device_handle)(h), \
(cy_as_resource_type)(type))
@@ -337,7 +337,7 @@ cy_an_misc_set_trace_level(
cy_an_media_type media,
uint32_t device,
uint32_t unit
- ) ;
+ );
#define cy_an_misc_set_trace_level\
(handle, level, media, device, unit) \
@@ -354,7 +354,7 @@ cy_an_misc_set_trace_level_e_x(
uint32_t unit,
cy_an_function_callback cb,
uint32_t client
- ) ;
+ );
#define cy_an_misc_set_trace_level_e_x\
(h, level, media, device, unit, cb, client) \
cy_as_misc_set_trace_level_dep((cy_as_device_handle)(h), \
@@ -366,7 +366,7 @@ EXTERN cy_an_return_status_t
cy_an_misc_enter_standby(
cy_an_device_handle handle,
cy_bool pin
- ) ;
+ );
#define cy_an_misc_enter_standby(handle, pin) \
cy_as_misc_enter_standby(\
(cy_as_device_handle)(handle), (pin), 0, 0)
@@ -378,7 +378,7 @@ cy_an_misc_enter_standby_e_x(
cy_bool pin,
cy_an_function_callback cb,
uint32_t client
- ) ;
+ );
#define cy_an_misc_enter_standby_e_x(h, pin, cb, client) \
cy_as_misc_enter_standby((cy_as_device_handle)(h), \
(pin), (cy_as_function_callback)(cb), (client))
@@ -388,7 +388,7 @@ EXTERN cy_an_return_status_t
cy_an_misc_leave_standby(
cy_an_device_handle handle,
cy_an_resource_type type
- ) ;
+ );
#define cy_an_misc_leave_standby(h, type) \
cy_as_misc_leave_standby((cy_as_device_handle)(h), \
(cy_as_resource_type)(type))
@@ -398,7 +398,7 @@ EXTERN cy_an_return_status_t
cy_an_misc_register_callback(
cy_an_device_handle handle,
cy_an_misc_event_callback callback
- ) ;
+ );
#define cy_an_misc_register_callback(h, cb) \
cy_as_misc_register_callback((cy_as_device_handle)(h), \
(cy_as_misc_event_callback)(cb))
@@ -407,7 +407,7 @@ cy_an_misc_register_callback(
EXTERN void
cy_an_misc_set_log_level(
uint8_t level
- ) ;
+ );
#define cy_an_misc_set_log_level(level) \
cy_as_misc_set_log_level(level)
@@ -415,7 +415,7 @@ cy_an_misc_set_log_level(
EXTERN cy_an_return_status_t
cy_an_misc_storage_changed(
cy_an_device_handle handle
- ) ;
+ );
#define cy_an_misc_storage_changed(handle) \
cy_as_misc_storage_changed((cy_as_device_handle)(handle), 0, 0)
@@ -425,7 +425,7 @@ cy_an_misc_storage_changed_e_x(
cy_an_device_handle handle,
cy_an_function_callback cb,
uint32_t client
- ) ;
+ );
#define cy_an_misc_storage_changed_e_x(h, cb, client) \
cy_as_misc_storage_changed((cy_as_device_handle)(h), \
(cy_as_function_callback)(cb), (client))
@@ -435,7 +435,7 @@ EXTERN cy_an_return_status_t
cy_an_misc_heart_beat_control(
cy_an_device_handle handle,
cy_bool enable
- ) ;
+ );
#define cy_an_misc_heart_beat_control(handle, enable) \
cy_as_misc_heart_beat_control((cy_as_device_handle)\
(handle), (enable), 0, 0)
@@ -447,7 +447,7 @@ cy_an_misc_heart_beat_control_e_x(
cy_bool enable,
cy_an_function_callback cb,
uint32_t client
- ) ;
+ );
#define cy_an_misc_heart_beat_control_e_x(h, enable, cb, client) \
cy_as_misc_heart_beat_control((cy_as_device_handle)(h), \
(enable), (cy_as_function_callback)(cb), (client))
@@ -458,7 +458,7 @@ cy_an_misc_get_gpio_value(
cy_an_device_handle handle,
cy_an_misc_gpio pin,
uint8_t *value
- ) ;
+ );
#define cy_an_misc_get_gpio_value(handle, pin, value) \
cy_as_misc_get_gpio_value((cy_as_device_handle)(handle), \
(cy_as_misc_gpio)(pin), (value), 0, 0)
@@ -471,7 +471,7 @@ cy_an_misc_get_gpio_value_e_x(
uint8_t *value,
cy_an_function_callback cb,
uint32_t client
- ) ;
+ );
#define cy_an_misc_get_gpio_value_e_x(h, pin, value, cb, client) \
cy_as_misc_get_gpio_value((cy_as_device_handle)(h), \
(cy_as_misc_gpio)(pin), (value), \
@@ -483,7 +483,7 @@ cy_an_misc_set_gpio_value(
cy_an_device_handle handle,
cy_an_misc_gpio pin,
uint8_t value
- ) ;
+ );
#define cy_an_misc_set_gpio_value(handle, pin, value) \
cy_as_misc_set_gpio_value((cy_as_device_handle)(handle), \
(cy_as_misc_gpio)(pin), (value), 0, 0)
@@ -496,7 +496,7 @@ cy_an_misc_set_gpio_value_e_x(
uint8_t value,
cy_an_function_callback cb,
uint32_t client
- ) ;
+ );
#define cy_an_misc_set_gpio_value_e_x\
(h, pin, value, cb, client) \
cy_as_misc_set_gpio_value((cy_as_device_handle)(h), \
@@ -509,7 +509,7 @@ cy_an_misc_enter_suspend(
cy_an_device_handle handle,
cy_bool usb_wakeup_en,
cy_bool gpio_wakeup_en
- ) ;
+ );
#define cy_an_misc_enter_suspend(handle, usb_wakeup_en, \
gpio_wakeup_en) \
cy_as_misc_enter_suspend((cy_as_device_handle)(handle), \
@@ -523,7 +523,7 @@ cy_an_misc_enter_suspend_e_x(
cy_bool gpio_wakeup_en,
cy_an_function_callback cb,
uint32_t client
- ) ;
+ );
#define cy_an_misc_enter_suspend_e_x(h, usb_en, gpio_en, cb, client)\
cy_as_misc_enter_suspend((cy_as_device_handle)(h), (usb_en), \
(gpio_en), (cy_as_function_callback)(cb), (client))
@@ -532,7 +532,7 @@ cy_an_misc_enter_suspend_e_x(
EXTERN cy_an_return_status_t
cy_an_misc_leave_suspend(
cy_an_device_handle handle
- ) ;
+ );
#define cy_an_misc_leave_suspend(handle) \
cy_as_misc_leave_suspend((cy_as_device_handle)(handle), 0, 0)
@@ -542,7 +542,7 @@ cy_an_misc_leave_suspend_e_x(
cy_an_device_handle handle,
cy_an_function_callback cb,
uint32_t client
- ) ;
+ );
#define cy_an_misc_leave_suspend_e_x(h, cb, client) \
cy_as_misc_leave_suspend((cy_as_device_handle)(h), \
@@ -553,7 +553,7 @@ EXTERN cy_an_return_status_t
cy_an_misc_set_low_speed_sd_freq(
cy_an_device_handle handle,
cy_an_low_speed_sd_freq setting
- ) ;
+ );
#define cy_an_misc_set_low_speed_sd_freq(h, setting) \
cy_as_misc_set_low_speed_sd_freq((cy_as_device_handle)(h), \
(cy_as_low_speed_sd_freq)(setting), 0, 0)
@@ -565,7 +565,7 @@ cy_an_misc_set_low_speed_sd_freq_e_x(
cy_an_low_speed_sd_freq setting,
cy_an_function_callback cb,
uint32_t client
- ) ;
+ );
#define cy_an_misc_set_low_speed_sd_freq_e_x\
(h, setting, cb, client) \
cy_as_misc_set_low_speed_sd_freq((cy_as_device_handle)(h), \
@@ -579,7 +579,7 @@ cy_an_misc_set_high_speed_sd_freq(
cy_an_high_speed_sd_freq setting,
cy_an_function_callback cb,
uint32_t client
- ) ;
+ );
#define cy_an_misc_set_high_speed_sd_freq(h, setting, cb, client) \
cy_as_misc_set_high_speed_sd_freq((cy_as_device_handle)(h), \
(cy_as_high_speed_sd_freq)(setting), \
diff --git a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyanstorage.h b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyanstorage.h
index 766f94a9c92..deb9af87fff 100644
--- a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyanstorage.h
+++ b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyanstorage.h
@@ -60,10 +60,10 @@ typedef cy_as_sd_card_reg_type \
cy_an_sd_card_reg_type;
typedef cy_as_storage_query_device_data_dep \
- cy_an_storage_query_device_data ;
+ cy_an_storage_query_device_data;
typedef cy_as_storage_query_unit_data_dep \
- cy_an_storage_query_unit_data ;
+ cy_an_storage_query_unit_data;
typedef cy_as_storage_sd_reg_read_data \
cy_an_storage_sd_reg_read_data;
@@ -80,7 +80,7 @@ typedef cy_as_storage_sd_reg_read_data \
EXTERN cy_an_return_status_t
cy_an_storage_start(
cy_an_device_handle handle
- ) ;
+ );
#define cy_an_storage_start(handle) \
cy_as_storage_start((cy_as_device_handle)(handle), 0, 0)
@@ -90,7 +90,7 @@ cy_an_storage_start_e_x(
cy_an_device_handle handle,
cy_an_function_callback cb,
uint32_t client
- ) ;
+ );
#define cy_an_storage_start_e_x(h, cb, client) \
cy_as_storage_start((cy_as_device_handle)(h), \
(cy_as_function_callback)(cb), (client))
@@ -99,7 +99,7 @@ cy_an_storage_start_e_x(
EXTERN cy_an_return_status_t
cy_an_storage_stop(
cy_an_device_handle handle
- ) ;
+ );
#define cy_an_storage_stop(handle) \
cy_as_storage_stop((cy_as_device_handle)(handle), 0, 0)
@@ -109,7 +109,7 @@ cy_an_storage_stop_e_x(
cy_an_device_handle handle,
cy_an_function_callback cb,
uint32_t client
- ) ;
+ );
#define cy_an_storage_stop_e_x(h, cb, client) \
cy_as_storage_stop((cy_as_device_handle)(h), \
(cy_as_function_callback)(cb), (client))
@@ -119,7 +119,7 @@ EXTERN cy_an_return_status_t
cy_an_storage_register_callback(
cy_an_device_handle handle,
cy_an_storage_event_callback callback
- ) ;
+ );
#define cy_an_storage_register_callback(h, cb) \
cy_as_storage_register_callback_dep((cy_as_device_handle)(h), \
(cy_as_storage_event_callback_dep)(cb))
@@ -129,7 +129,7 @@ EXTERN cy_an_return_status_t
cy_an_storage_claim(
cy_an_device_handle handle,
cy_an_media_type type
- ) ;
+ );
#define cy_an_storage_claim(h, type) \
cy_as_storage_claim_dep((cy_as_device_handle)(h), \
(cy_as_media_type)(type))
@@ -141,7 +141,7 @@ cy_an_storage_claim_e_x(
cy_an_media_type *type,
cy_an_function_callback cb,
uint32_t client
- ) ;
+ );
#define cy_an_storage_claim_e_x(h, type_p, cb, client) \
cy_as_storage_claim_dep_EX((cy_as_device_handle)(h), \
(cy_as_media_type *)(type_p), \
@@ -152,7 +152,7 @@ EXTERN cy_an_return_status_t
cy_an_storage_release(
cy_an_device_handle handle,
cy_an_media_type type
- ) ;
+ );
#define cy_an_storage_release(h, type) \
cy_as_storage_release_dep((cy_as_device_handle)(h), \
(cy_as_media_type)(type))
@@ -164,7 +164,7 @@ cy_an_storage_release_e_x(
cy_an_media_type *type,
cy_an_function_callback cb,
uint32_t client
- ) ;
+ );
#define cy_an_storage_release_e_x(h, type_p, cb, client) \
cy_as_storage_release_dep_EX((cy_as_device_handle)(h), \
(cy_as_media_type *)(type_p), \
@@ -176,7 +176,7 @@ cy_an_storage_query_media(
cy_an_device_handle handle,
cy_an_media_type type,
uint32_t *count
- ) ;
+ );
#define cy_an_storage_query_media(handle, type, count) \
cy_as_storage_query_media((cy_as_device_handle)(handle), \
(cy_as_media_type)(type), (count), 0, 0)
@@ -189,7 +189,7 @@ cy_an_storage_query_media_e_x(
uint32_t *count,
cy_an_function_callback cb,
uint32_t client
- ) ;
+ );
#define cy_an_storage_query_media_e_x(h, type, count, cb, client) \
cy_as_storage_query_media((cy_as_device_handle)(h), \
(cy_as_media_type)(type), (count), \
@@ -202,7 +202,7 @@ cy_an_storage_query_device(
cy_an_media_type type,
uint32_t device,
cy_an_device_desc *desc_p
- ) ;
+ );
#define cy_an_storage_query_device(h, type, device, desc_p) \
cy_as_storage_query_device_dep((cy_as_device_handle)(h), \
(cy_as_media_type)(type), (device), (cy_as_device_desc *)(desc_p))
@@ -214,7 +214,7 @@ cy_an_storage_query_device_e_x(
cy_an_storage_query_device_data *data,
cy_an_function_callback cb,
uint32_t client
- ) ;
+ );
#define cy_an_storage_query_device_e_x(h, data, cb, client) \
cy_as_storage_query_device_dep_EX((cy_as_device_handle)(h), \
(cy_as_storage_query_device_data_dep *)(data), \
@@ -228,7 +228,7 @@ cy_an_storage_query_unit(
uint32_t device,
uint32_t unit,
cy_an_unit_desc *desc_p
- ) ;
+ );
#define cy_an_storage_query_unit(h, type, device, unit, desc_p) \
cy_as_storage_query_unit_dep((cy_as_device_handle)(h), \
(cy_as_media_type)(type), (device), \
@@ -241,7 +241,7 @@ cy_an_storage_query_unit_e_x(
cy_an_storage_query_unit_data *data_p,
cy_an_function_callback cb,
uint32_t client
- ) ;
+ );
#define cy_an_storage_query_unit_e_x(h, data_p, cb, client) \
cy_as_storage_query_unit_dep_EX((cy_as_device_handle)(h), \
(cy_as_storage_query_unit_data_dep *)(data_p), \
@@ -253,7 +253,7 @@ cy_an_storage_device_control(
cy_an_device_handle handle,
cy_bool card_detect_en,
cy_bool write_prot_en
- ) ;
+ );
#define cy_an_storage_device_control(handle, \
card_detect_en, write_prot_en) \
cy_as_storage_device_control_dep((cy_as_device_handle)(handle), \
@@ -267,7 +267,7 @@ cy_an_storage_device_control_e_x(
cy_bool write_prot_en,
cy_an_function_callback cb,
uint32_t client
- ) ;
+ );
#define cy_an_storage_device_control_e_x(h, det_en, prot_en, cb, client) \
cy_as_storage_device_control_dep((cy_as_device_handle)(h), (det_en), \
(prot_en), (cy_as_function_callback)(cb), (client))
@@ -282,7 +282,7 @@ cy_an_storage_read(
uint32_t block,
void *data_p,
uint16_t num_blocks
- ) ;
+ );
#define cy_an_storage_read(h, type, device, unit, block, data_p, nblks) \
cy_as_storage_read_dep((cy_as_device_handle)(h), \
(cy_as_media_type)(type), (device), (unit), \
@@ -299,7 +299,7 @@ cy_an_storage_read_async(
void *data_p,
uint16_t num_blocks,
cy_an_storage_callback callback
- ) ;
+ );
#define cy_an_storage_read_async(h, type, device, unit, \
block, data_p, nblks, cb) \
cy_as_storage_read_async_dep((cy_as_device_handle)(h), \
@@ -316,7 +316,7 @@ cy_an_storage_write(
uint32_t block,
void *data_p,
uint16_t num_blocks
- ) ;
+ );
#define cy_an_storage_write(h, type, device, unit, \
block, data_p, nblks) \
cy_as_storage_write_dep((cy_as_device_handle)(h), \
@@ -334,7 +334,7 @@ cy_an_storage_write_async(
void *data_p,
uint16_t num_blocks,
cy_an_storage_callback callback
- ) ;
+ );
#define cy_an_storage_write_async(h, type, device, unit, \
block, data_p, nblks, cb) \
cy_as_storage_write_async_dep((cy_as_device_handle)(h), \
@@ -345,7 +345,7 @@ cy_an_storage_write_async(
EXTERN cy_an_return_status_t
cy_an_storage_cancel_async(
cy_an_device_handle handle
- ) ;
+ );
#define cy_an_storage_cancel_async(h) \
cy_as_storage_cancel_async((cy_as_device_handle)(h))
@@ -358,7 +358,7 @@ cy_an_storage_sd_register_read(
cy_an_sd_card_reg_type reg_type,
uint8_t read_len,
uint8_t *data_p
- ) ;
+ );
#define cy_an_storage_sd_register_read(h, type, device, \
reg_type, len, data_p) \
cy_as_storage_sd_register_read_dep((cy_as_device_handle)(h), \
@@ -375,7 +375,7 @@ cy_an_storage_sd_register_read_e_x(
cy_an_storage_sd_reg_read_data *data_p,
cy_an_function_callback cb,
uint32_t client
- ) ;
+ );
#define cy_an_storage_sd_register_read_e_x(h, type, device, \
reg_type, data_p, cb, client) \
cy_as_storage_sd_register_read_dep_EX((cy_as_device_handle)(h), \
@@ -392,7 +392,7 @@ cy_an_storage_create_p_partition(
uint32_t device,
uint32_t size,
cy_an_function_callback cb,
- uint32_t client) ;
+ uint32_t client);
#define cy_an_storage_create_p_partition(h, media, dev, \
size, cb, client) \
cy_as_storage_create_p_partition_dep((cy_as_device_handle)(h), \
@@ -406,7 +406,7 @@ cy_an_storage_remove_p_partition(
cy_an_media_type media,
uint32_t device,
cy_an_function_callback cb,
- uint32_t client) ;
+ uint32_t client);
#define cy_an_storage_remove_p_partition\
(h, media, dev, cb, client) \
cy_as_storage_remove_p_partition_dep((cy_as_device_handle)(h), \
diff --git a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyantypes.h b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyantypes.h
index d6028d64d24..48cd50f13c1 100644
--- a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyantypes.h
+++ b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyantypes.h
@@ -25,7 +25,7 @@
#define _INCLUDED_CYANTYPES_H_
#include "cyastypes.h"
-typedef cy_as_end_point_number_t cy_an_end_point_number_t ;
-typedef cy_as_return_status_t cy_an_return_status_t ;
-typedef cy_as_bus_number_t cy_an_bus_number_t ;
+typedef cy_as_end_point_number_t cy_an_end_point_number_t;
+typedef cy_as_return_status_t cy_an_return_status_t;
+typedef cy_as_bus_number_t cy_an_bus_number_t;
#endif
diff --git a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyanusb.h b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyanusb.h
index 0777fd457d4..1e4e7dbe31b 100644
--- a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyanusb.h
+++ b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyanusb.h
@@ -33,9 +33,9 @@
typedef cy_as_usb_inquiry_data_dep cy_an_usb_inquiry_data;
typedef cy_as_usb_unknown_command_data_dep \
- cy_an_usb_unknown_command_data ;
-typedef cy_as_usb_start_stop_data_dep cy_an_usb_start_stop_data ;
-typedef cy_as_m_s_c_progress_data cy_an_m_s_c_progress_data ;
+ cy_an_usb_unknown_command_data;
+typedef cy_as_usb_start_stop_data_dep cy_an_usb_start_stop_data;
+typedef cy_as_m_s_c_progress_data cy_an_m_s_c_progress_data;
#define cy_an_usb_nand_enum cy_as_usb_nand_enum
#define cy_an_usb_sd_enum cy_as_usb_sd_enum
@@ -50,28 +50,28 @@ typedef cy_as_usb_mass_storage_enum cy_an_usb_mass_storage_enum;
#define cy_an_usb_desc_h_s_configuration \
cy_as_usb_desc_h_s_configuration
#define cy_an_usb_desc_string cy_as_usb_desc_string
-typedef cy_as_usb_desc_type cy_an_usb_desc_type ;
+typedef cy_as_usb_desc_type cy_an_usb_desc_type;
#define cy_an_usb_in cy_as_usb_in
#define cy_an_usb_out cy_as_usb_out
#define cy_an_usb_in_out cy_as_usb_in_out
-typedef cy_as_usb_end_point_dir cy_an_usb_end_point_dir ;
+typedef cy_as_usb_end_point_dir cy_an_usb_end_point_dir;
#define cy_an_usb_control cy_as_usb_control
#define cy_an_usb_iso cy_as_usb_iso
#define cy_an_usb_bulk cy_as_usb_bulk
#define cy_an_usb_int cy_as_usb_int
-typedef cy_as_usb_end_point_type cy_an_usb_end_point_type ;
+typedef cy_as_usb_end_point_type cy_an_usb_end_point_type;
-typedef cy_as_usb_enum_control_dep cy_an_usb_enum_control ;
-typedef cy_as_usb_end_point_config cy_an_usb_end_point_config ;
+typedef cy_as_usb_enum_control_dep cy_an_usb_enum_control;
+typedef cy_as_usb_end_point_config cy_an_usb_end_point_config;
#define cy_an_usb_m_s_unit0 cy_as_usb_m_s_unit0
#define cy_an_usb_m_s_unit1 cy_as_usb_m_s_unit1
#define cy_an_usb_m_s_both cy_as_usb_m_s_both
-typedef cy_as_usb_m_s_type_t cy_an_usb_m_s_type_t ;
+typedef cy_as_usb_m_s_type_t cy_an_usb_m_s_type_t;
#define cy_an_event_usb_suspend cy_as_event_usb_suspend
#define cy_an_event_usb_resume cy_as_event_usb_resume
@@ -87,7 +87,7 @@ typedef cy_as_usb_m_s_type_t cy_an_usb_m_s_type_t ;
#define cy_an_event_usb_m_s_c_progress cy_as_event_usb_m_s_c_progress
typedef cy_as_usb_event cy_an_usb_event;
-typedef cy_as_usb_event_callback_dep cy_an_usb_event_callback ;
+typedef cy_as_usb_event_callback_dep cy_an_usb_event_callback;
typedef cy_as_usb_io_callback cy_an_usb_io_callback;
typedef cy_as_usb_function_callback cy_an_usb_function_callback;
@@ -98,7 +98,7 @@ typedef cy_as_usb_function_callback cy_an_usb_function_callback;
extern cy_an_return_status_t
cy_an_usb_start(
cy_an_device_handle handle
- ) ;
+ );
#define cy_an_usb_start(handle) \
cy_as_usb_start((cy_as_device_handle)(handle), 0, 0)
@@ -108,7 +108,7 @@ cy_an_usb_start_e_x(
cy_an_device_handle handle,
cy_an_function_callback cb,
uint32_t client
- ) ;
+ );
#define cy_an_usb_start_e_x(h, cb, client) \
cy_as_usb_start((cy_as_device_handle)(h), \
(cy_as_function_callback)(cb), (client))
@@ -117,7 +117,7 @@ cy_an_usb_start_e_x(
extern cy_an_return_status_t
cy_an_usb_stop(
cy_an_device_handle handle
- ) ;
+ );
#define cy_an_usb_stop(handle) \
cy_as_usb_stop((cy_as_device_handle)(handle), 0, 0)
@@ -127,7 +127,7 @@ cy_an_usb_stop_e_x(
cy_an_device_handle handle,
cy_an_function_callback cb,
uint32_t client
- ) ;
+ );
#define cy_an_usb_stop_e_x(h, cb, client) \
cy_as_usb_stop((cy_as_device_handle)(h), \
(cy_as_function_callback)(cb), (client))
@@ -137,7 +137,7 @@ EXTERN cy_an_return_status_t
cy_an_usb_register_callback(
cy_an_device_handle handle,
cy_an_usb_event_callback callback
- ) ;
+ );
#define cy_an_usb_register_callback(h, cb) \
cy_as_usb_register_callback_dep((cy_as_device_handle)(h), \
(cy_as_usb_event_callback_dep)(cb))
@@ -146,7 +146,7 @@ cy_an_usb_register_callback(
EXTERN cy_an_return_status_t
cy_an_usb_connect(
cy_an_device_handle handle
- ) ;
+ );
#define cy_an_usb_connect(handle) \
cy_as_usb_connect((cy_as_device_handle)(handle), 0, 0)
@@ -156,7 +156,7 @@ cy_an_usb_connect_e_x(
cy_an_device_handle handle,
cy_an_function_callback cb,
uint32_t client
- ) ;
+ );
#define cy_an_usb_connect_e_x(h, cb, client) \
cy_as_usb_connect((cy_as_device_handle)(h), \
(cy_as_function_callback)(cb), (client))
@@ -165,7 +165,7 @@ cy_an_usb_connect_e_x(
EXTERN cy_an_return_status_t
cy_an_usb_disconnect(
cy_an_device_handle handle
- ) ;
+ );
#define cy_an_usb_disconnect(handle) \
cy_as_usb_disconnect((cy_as_device_handle)(handle), 0, 0)
@@ -175,7 +175,7 @@ cy_an_usb_disconnect_e_x(
cy_an_device_handle handle,
cy_an_function_callback cb,
uint32_t client
- ) ;
+ );
#define cy_an_usb_disconnect_e_x(h, cb, client) \
cy_as_usb_disconnect((cy_as_device_handle)(h), \
(cy_as_function_callback)(cb), (client))
@@ -185,7 +185,7 @@ EXTERN cy_an_return_status_t
cy_an_usb_set_enum_config(
cy_an_device_handle handle,
cy_an_usb_enum_control *config_p
- ) ;
+ );
#define cy_an_usb_set_enum_config(handle, config_p) \
cy_as_usb_set_enum_config_dep((cy_as_device_handle)(handle), \
(cy_as_usb_enum_control_dep *)(config_p), 0, 0)
@@ -197,7 +197,7 @@ cy_an_usb_set_enum_config_e_x(
cy_an_usb_enum_control *config_p,
cy_an_function_callback cb,
uint32_t client
- ) ;
+ );
#define cy_an_usb_set_enum_config_e_x(h, config_p, cb, client) \
cy_as_usb_set_enum_config_dep((cy_as_device_handle)(h), \
(cy_as_usb_enum_control_dep *)(config_p), \
@@ -208,7 +208,7 @@ EXTERN cy_an_return_status_t
cy_an_usb_get_enum_config(
cy_an_device_handle handle,
cy_an_usb_enum_control *config_p
- ) ;
+ );
#define cy_an_usb_get_enum_config(handle, config_p) \
cy_as_usb_get_enum_config_dep((cy_as_device_handle)(handle), \
(cy_as_usb_enum_control_dep *)(config_p), 0, 0)
@@ -220,7 +220,7 @@ cy_an_usb_get_enum_config_e_x(
cy_an_usb_enum_control *config_p,
cy_an_function_callback cb,
uint32_t client
- ) ;
+ );
#define cy_an_usb_get_enum_config_e_x(h, config_p, cb, client) \
cy_as_usb_get_enum_config_dep((cy_as_device_handle)(h), \
(cy_as_usb_enum_control_dep *)(config_p), \
@@ -234,7 +234,7 @@ cy_an_usb_set_descriptor(
uint8_t index,
void *desc_p,
uint16_t length
- ) ;
+ );
#define cy_an_usb_set_descriptor(handle, type, index, desc_p, length) \
cy_as_usb_set_descriptor((cy_as_device_handle)(handle), \
(cy_as_usb_desc_type)(type), (index), (desc_p), (length), 0, 0)
@@ -249,7 +249,7 @@ cy_an_usb_set_descriptor_e_x(
uint16_t length,
cy_an_function_callback cb,
uint32_t client
- ) ;
+ );
#define cy_an_usb_set_descriptor_e_x\
(h, type, index, desc_p, length, cb, client) \
cy_as_usb_set_descriptor((cy_as_device_handle)(h), \
@@ -262,7 +262,7 @@ cy_an_usb_clear_descriptors(
cy_an_device_handle handle,
cy_an_function_callback cb,
uint32_t client
- ) ;
+ );
#define cy_an_usb_clear_descriptors(h, cb, client) \
cy_as_usb_clear_descriptors((cy_as_device_handle)(h), \
(cy_as_function_callback)(cb), (client))
@@ -275,12 +275,12 @@ cy_an_usb_get_descriptor(
uint8_t index,
void *desc_p,
uint32_t *length_p
- ) ;
+ );
#define cy_an_usb_get_descriptor(h, type, index, desc_p, length_p) \
cy_as_usb_get_descriptor_dep((cy_as_device_handle)(h), \
(cy_as_usb_desc_type)(type), (index), (desc_p), (length_p))
-typedef cy_as_get_descriptor_data cy_an_get_descriptor_data ;
+typedef cy_as_get_descriptor_data cy_an_get_descriptor_data;
/* Async version of get descriptor */
extern cy_an_return_status_t
@@ -291,7 +291,7 @@ cy_an_usb_get_descriptor_e_x(
cy_an_get_descriptor_data *data,
cy_an_function_callback cb,
uint32_t client
- ) ;
+ );
#define cy_an_usb_get_descriptor_e_x\
(h, type, index, data, cb, client) \
cy_as_usb_get_descriptor((cy_as_device_handle)(h), \
@@ -303,7 +303,7 @@ EXTERN cy_an_return_status_t
cy_an_usb_set_physical_configuration(
cy_an_device_handle handle,
uint8_t config
- ) ;
+ );
#define cy_an_usb_set_physical_configuration(h, config) \
cy_as_usb_set_physical_configuration\
((cy_as_device_handle)(h), (config))
@@ -313,7 +313,7 @@ cy_an_usb_set_end_point_config(
cy_an_device_handle handle,
cy_an_end_point_number_t ep,
cy_an_usb_end_point_config *config_p
- ) ;
+ );
#define cy_an_usb_set_end_point_config(h, ep, config_p) \
cy_as_usb_set_end_point_config((cy_as_device_handle)(h), \
(cy_as_end_point_number_t)(ep), \
@@ -324,7 +324,7 @@ cy_an_usb_get_end_point_config(
cy_an_device_handle handle,
cy_an_end_point_number_t ep,
cy_an_usb_end_point_config *config_p
- ) ;
+ );
#define cy_an_usb_get_end_point_config(h, ep, config_p) \
cy_as_usb_get_end_point_config((cy_as_device_handle)(h), \
(cy_as_end_point_number_t)(ep), \
@@ -334,7 +334,7 @@ cy_an_usb_get_end_point_config(
EXTERN cy_an_return_status_t
cy_an_usb_commit_config(
cy_an_device_handle handle
- ) ;
+ );
#define cy_an_usb_commit_config(handle) \
cy_as_usb_commit_config((cy_as_device_handle)(handle), 0, 0)
@@ -344,7 +344,7 @@ cy_an_usb_commit_config_e_x(
cy_an_device_handle handle,
cy_an_function_callback cb,
uint32_t client
- ) ;
+ );
#define cy_an_usb_commit_config_e_x(h, cb, client) \
cy_as_usb_commit_config((cy_as_device_handle)(h), \
(cy_as_function_callback)(cb), (client))
@@ -357,7 +357,7 @@ cy_an_usb_read_data(
uint32_t dsize,
uint32_t *dataread,
void *data
- ) ;
+ );
#define cy_an_usb_read_data(h, ep, pkt, dsize, dataread, data_p) \
cy_as_usb_read_data((cy_as_device_handle)(h), \
(cy_as_end_point_number_t)(ep), (pkt), (dsize), \
@@ -371,7 +371,7 @@ cy_an_usb_read_data_async(
uint32_t dsize,
void *data,
cy_an_usb_io_callback callback
- ) ;
+ );
#define cy_an_usb_read_data_async(h, ep, pkt, dsize, data_p, cb) \
cy_as_usb_read_data_async((cy_as_device_handle)(h), \
(cy_as_end_point_number_t)(ep), (pkt), (dsize), (data_p), \
@@ -383,7 +383,7 @@ cy_an_usb_write_data(
cy_an_end_point_number_t ep,
uint32_t dsize,
void *data
- ) ;
+ );
#define cy_an_usb_write_data(h, ep, dsize, data_p) \
cy_as_usb_write_data((cy_as_device_handle)(h), \
(cy_as_end_point_number_t)(ep), (dsize), (data_p))
@@ -396,7 +396,7 @@ cy_an_usb_write_data_async(
void *data,
cy_bool spacket,
cy_an_usb_io_callback callback
- ) ;
+ );
#define cy_an_usb_write_data_async(h, ep, dsize, data_p, spacket, cb) \
cy_as_usb_write_data_async((cy_as_device_handle)(h), \
(cy_as_end_point_number_t)(ep), (dsize), (data_p), (spacket), \
@@ -406,7 +406,7 @@ EXTERN cy_an_return_status_t
cy_an_usb_cancel_async(
cy_an_device_handle handle,
cy_an_end_point_number_t ep
- ) ;
+ );
#define cy_an_usb_cancel_async(h, ep) \
cy_as_usb_cancel_async((cy_as_device_handle)(h), \
(cy_as_end_point_number_t)(ep))
@@ -418,7 +418,7 @@ cy_an_usb_set_stall(
cy_an_end_point_number_t ep,
cy_an_usb_function_callback cb,
uint32_t client
-) ;
+);
#define cy_an_usb_set_stall(h, ep, cb, client) \
cy_as_usb_set_stall_dep((cy_as_device_handle)(h), \
(cy_as_end_point_number_t)(ep), \
@@ -431,7 +431,7 @@ cy_an_usb_set_stall_e_x(
cy_an_end_point_number_t ep,
cy_an_function_callback cb,
uint32_t client
-) ;
+);
#define cy_an_usb_set_stall_e_x(h, ep, cb, client) \
cy_as_usb_set_stall((cy_as_device_handle)(h), \
(cy_as_end_point_number_t)(ep), \
@@ -444,7 +444,7 @@ cy_an_usb_clear_stall(
cy_an_end_point_number_t ep,
cy_an_usb_function_callback cb,
uint32_t client
- ) ;
+ );
#define cy_an_usb_clear_stall(h, ep, cb, client) \
cy_as_usb_clear_stall_dep((cy_as_device_handle)(h), \
(cy_as_end_point_number_t)(ep), \
@@ -457,7 +457,7 @@ cy_an_usb_clear_stall_e_x(
cy_an_end_point_number_t ep,
cy_an_function_callback cb,
uint32_t client
- ) ;
+ );
#define cy_an_usb_clear_stall_e_x(h, ep, cb, client) \
cy_as_usb_clear_stall((cy_as_device_handle)(h), \
(cy_as_end_point_number_t)(ep), \
@@ -469,7 +469,7 @@ cy_an_usb_get_stall(
cy_an_device_handle handle,
cy_an_end_point_number_t ep,
cy_bool *stall_p
- ) ;
+ );
#define cy_an_usb_get_stall(handle, ep, stall_p) \
cy_as_usb_get_stall((cy_as_device_handle)(handle), \
(cy_as_end_point_number_t)(ep), (stall_p), 0, 0)
@@ -482,7 +482,7 @@ cy_an_usb_get_stall_e_x(
cy_bool *stall_p,
cy_an_function_callback cb,
uint32_t client
- ) ;
+ );
#define cy_an_usb_get_stall_e_x(h, ep, stall_p, cb, client) \
cy_as_usb_get_stall((cy_as_device_handle)(h), \
(cy_as_end_point_number_t)(ep), (stall_p), \
@@ -495,7 +495,7 @@ cy_an_usb_set_nak(
cy_an_end_point_number_t ep,
cy_an_usb_function_callback cb,
uint32_t client
-) ;
+);
#define cy_an_usb_set_nak(h, ep, cb, client) \
cy_as_usb_set_nak_dep((cy_as_device_handle)(h), \
@@ -509,7 +509,7 @@ cy_an_usb_set_nak_e_x(
cy_an_end_point_number_t ep,
cy_an_function_callback cb,
uint32_t client
-) ;
+);
#define cy_an_usb_set_nak_e_x(h, ep, cb, client) \
cy_as_usb_set_nak((cy_as_device_handle)(h), \
(cy_as_end_point_number_t)(ep), \
@@ -522,7 +522,7 @@ cy_an_usb_clear_nak(
cy_an_end_point_number_t ep,
cy_an_usb_function_callback cb,
uint32_t client
- ) ;
+ );
#define cy_an_usb_clear_nak(h, ep, cb, client) \
cy_as_usb_clear_nak_dep((cy_as_device_handle)(h), \
(cy_as_end_point_number_t)(ep), \
@@ -535,7 +535,7 @@ cy_an_usb_clear_nak_e_x(
cy_an_end_point_number_t ep,
cy_an_function_callback cb,
uint32_t client
- ) ;
+ );
#define cy_an_usb_clear_nak_e_x(h, ep, cb, client) \
cy_as_usb_clear_nak((cy_as_device_handle)(h), \
(cy_as_end_point_number_t)(ep), \
@@ -547,7 +547,7 @@ cy_an_usb_get_nak(
cy_an_device_handle handle,
cy_an_end_point_number_t ep,
cy_bool *nak_p
-) ;
+);
#define cy_an_usb_get_nak(handle, ep, nak_p) \
cy_as_usb_get_nak((cy_as_device_handle)(handle), \
(cy_as_end_point_number_t)(ep), (nak_p), 0, 0)
@@ -560,7 +560,7 @@ cy_an_usb_get_nak_e_x(
cy_bool *nak_p,
cy_an_function_callback cb,
uint32_t client
-) ;
+);
#define cy_an_usb_get_nak_e_x(h, ep, nak_p, cb, client) \
cy_as_usb_get_nak((cy_as_device_handle)(h), \
(cy_as_end_point_number_t)(ep), (nak_p), \
@@ -570,7 +570,7 @@ cy_an_usb_get_nak_e_x(
EXTERN cy_an_return_status_t
cy_an_usb_signal_remote_wakeup(
cy_an_device_handle handle
- ) ;
+ );
#define cy_an_usb_signal_remote_wakeup(handle) \
cy_as_usb_signal_remote_wakeup((cy_as_device_handle)(handle), 0, 0)
@@ -580,7 +580,7 @@ cy_an_usb_signal_remote_wakeup_e_x(
cy_an_device_handle handle,
cy_an_function_callback cb,
uint32_t client
- ) ;
+ );
#define cy_an_usb_signal_remote_wakeup_e_x(h, cb, client) \
cy_as_usb_signal_remote_wakeup((cy_as_device_handle)(h), \
(cy_as_function_callback)(cb), (client))
@@ -593,7 +593,7 @@ cy_an_usb_set_m_s_report_threshold(
uint32_t rd_sectors,
cy_an_function_callback cb,
uint32_t client
- ) ;
+ );
#define cy_an_usb_set_m_s_report_threshold\
(h, wr_cnt, rd_cnt, cb, client) \
cy_as_usb_set_m_s_report_threshold((cy_as_device_handle)(h), \
@@ -608,7 +608,7 @@ cy_an_usb_select_m_s_partitions(
cy_an_usb_m_s_type_t type,
cy_an_function_callback cb,
uint32_t client
- ) ;
+ );
#define cy_an_usb_select_m_s_partitions(h, media, dev, type, cb, client) \
cy_as_usb_select_m_s_partitions_dep((cy_as_device_handle)(h), \
(cy_as_media_type)(media), (dev), \
diff --git a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasdevice.h b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasdevice.h
index b17c985ed0a..0c0726b678a 100644
--- a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasdevice.h
+++ b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasdevice.h
@@ -147,7 +147,7 @@
* West Bridge Data Structures
****************************************/
-typedef struct cy_as_device cy_as_device ;
+typedef struct cy_as_device cy_as_device;
/* Summary
This type defines a callback function that will be called
@@ -173,7 +173,7 @@ typedef void (*cy_as_dma_callback)(
uint32_t size,
/* The error code for this DMA xfer */
cy_as_return_status_t error
- ) ;
+ );
/* Summary
This structure defines a DMA request that is queued
@@ -184,20 +184,20 @@ typedef void (*cy_as_dma_callback)(
*/
typedef struct cy_as_dma_queue_entry {
/* Pointer to memory buffer for this request */
- void *buf_p ;
+ void *buf_p;
/* Size of the memory buffer for DMA operation */
- uint32_t size ;
+ uint32_t size;
/* Offset into memory buffer for next DMA operation */
- uint32_t offset ;
+ uint32_t offset;
/* If TRUE and IN request */
- cy_bool packet ;
+ cy_bool packet;
/* If TRUE, this is a read request */
- cy_bool readreq ;
+ cy_bool readreq;
/* Callback function for when DMA is complete */
- cy_as_dma_callback cb ;
+ cy_as_dma_callback cb;
/* Pointer to next entry in queue */
- struct cy_as_dma_queue_entry *next_p ;
-} cy_as_dma_queue_entry ;
+ struct cy_as_dma_queue_entry *next_p;
+} cy_as_dma_queue_entry;
/* Summary
This structure defines the endpoint data for a given
@@ -208,21 +208,21 @@ typedef struct cy_as_dma_queue_entry {
*/
typedef struct cy_as_dma_end_point {
/* The endpoint number */
- cy_as_end_point_number_t ep ;
+ cy_as_end_point_number_t ep;
/* The state of this endpoint */
- uint8_t state ;
+ uint8_t state;
/* The maximum amount of data accepted in a packet by the hw */
- uint16_t maxhwdata ;
+ uint16_t maxhwdata;
/* The maximum amount of data accepted by the HAL layer */
- uint32_t maxhaldata ;
+ uint32_t maxhaldata;
/* The queue for DMA operations */
- cy_as_dma_queue_entry *queue_p ;
+ cy_as_dma_queue_entry *queue_p;
/* The last entry in the DMA queue */
- cy_as_dma_queue_entry *last_p ;
+ cy_as_dma_queue_entry *last_p;
/* This sleep channel is used to wait while the DMA queue
* drains for a given endpoint */
- cy_as_hal_sleep_channel channel ;
-} cy_as_dma_end_point ;
+ cy_as_hal_sleep_channel channel;
+} cy_as_dma_end_point;
#define cy_as_end_point_number_is_usb(n) \
((n) != 2 && (n) != 4 && (n) != 6 && (n) != 8)
@@ -274,16 +274,16 @@ typedef struct cy_as_dma_end_point {
typedef struct cy_as_ll_request_response {
/* The mbox[0] contents - see low level comm section of API doc */
- uint16_t box0 ;
+ uint16_t box0;
/* The amount of data stored in this request/response in bytes */
- uint16_t stored ;
+ uint16_t stored;
/* Length of this request in words */
- uint16_t length ;
+ uint16_t length;
/* Additional status information about the request */
- uint16_t flags ;
+ uint16_t flags;
/* Note: This is over indexed and contains the request/response data */
- uint16_t data[1] ;
-} cy_as_ll_request_response ;
+ uint16_t data[1];
+} cy_as_ll_request_response;
/*
* The callback function for responses
@@ -299,22 +299,22 @@ typedef void (*cy_as_response_callback)(
cy_as_ll_request_response *resp,
/* The status of the request */
cy_as_return_status_t status
- ) ;
+ );
typedef struct cy_as_ll_request_list_node {
/* The request to send */
- cy_as_ll_request_response *rqt ;
+ cy_as_ll_request_response *rqt;
/* The associated response for the request */
- cy_as_ll_request_response *resp ;
+ cy_as_ll_request_response *resp;
/* Length of the response */
- uint16_t length ;
+ uint16_t length;
/* The callback to call when done */
- cy_as_response_callback callback ;
+ cy_as_response_callback callback;
/* The state of the request */
- uint8_t state ;
+ uint8_t state;
/* The next request in the list */
- struct cy_as_ll_request_list_node *next ;
-} cy_as_ll_request_list_node ;
+ struct cy_as_ll_request_list_node *next;
+} cy_as_ll_request_list_node;
#define cy_as_request_get_node_state(node_p) \
((node_p)->state & CY_AS_REQUEST_LIST_STATE_MASK)
@@ -336,88 +336,88 @@ typedef enum cy_as_c_b_node_type {
CYAS_USB_IO_CB,
CYAS_STORAGE_IO_CB,
CYAS_FUNC_CB
-} cy_as_c_b_node_type ;
+} cy_as_c_b_node_type;
typedef struct cy_as_func_c_b_node {
- cy_as_c_b_node_type node_type ;
- cy_as_function_callback cb_p ;
- uint32_t client_data ;
- cy_as_funct_c_b_type data_type ;
- void *data ;
- struct cy_as_func_c_b_node *next_p ;
+ cy_as_c_b_node_type node_type;
+ cy_as_function_callback cb_p;
+ uint32_t client_data;
+ cy_as_funct_c_b_type data_type;
+ void *data;
+ struct cy_as_func_c_b_node *next_p;
} cy_as_func_c_b_node;
extern cy_as_func_c_b_node*
cy_as_create_func_c_b_node_data(cy_as_function_callback
- cb, uint32_t client, cy_as_funct_c_b_type type, void *data) ;
+ cb, uint32_t client, cy_as_funct_c_b_type type, void *data);
extern cy_as_func_c_b_node*
cy_as_create_func_c_b_node(cy_as_function_callback cb,
- uint32_t client) ;
+ uint32_t client);
extern void
-cy_as_destroy_func_c_b_node(cy_as_func_c_b_node *node) ;
+cy_as_destroy_func_c_b_node(cy_as_func_c_b_node *node);
typedef struct cy_as_mtp_func_c_b_node {
- cy_as_c_b_node_type type ;
- cy_as_mtp_function_callback cb_p ;
+ cy_as_c_b_node_type type;
+ cy_as_mtp_function_callback cb_p;
uint32_t client_data;
- struct cy_as_mtp_func_c_b_node *next_p ;
+ struct cy_as_mtp_func_c_b_node *next_p;
} cy_as_mtp_func_c_b_node;
extern cy_as_mtp_func_c_b_node*
cy_as_create_mtp_func_c_b_node(cy_as_mtp_function_callback cb,
- uint32_t client) ;
+ uint32_t client);
extern void
-cy_as_destroy_mtp_func_c_b_node(cy_as_mtp_func_c_b_node *node) ;
+cy_as_destroy_mtp_func_c_b_node(cy_as_mtp_func_c_b_node *node);
typedef struct cy_as_usb_func_c_b_node {
- cy_as_c_b_node_type type ;
- cy_as_usb_function_callback cb_p ;
+ cy_as_c_b_node_type type;
+ cy_as_usb_function_callback cb_p;
uint32_t client_data;
- struct cy_as_usb_func_c_b_node *next_p ;
+ struct cy_as_usb_func_c_b_node *next_p;
} cy_as_usb_func_c_b_node;
extern cy_as_usb_func_c_b_node*
cy_as_create_usb_func_c_b_node(cy_as_usb_function_callback cb,
- uint32_t client) ;
+ uint32_t client);
extern void
-cy_as_destroy_usb_func_c_b_node(cy_as_usb_func_c_b_node *node) ;
+cy_as_destroy_usb_func_c_b_node(cy_as_usb_func_c_b_node *node);
typedef struct cy_as_usb_io_c_b_node {
- cy_as_c_b_node_type type ;
- cy_as_usb_io_callback cb_p ;
- struct cy_as_usb_io_c_b_node *next_p ;
+ cy_as_c_b_node_type type;
+ cy_as_usb_io_callback cb_p;
+ struct cy_as_usb_io_c_b_node *next_p;
} cy_as_usb_io_c_b_node;
extern cy_as_usb_io_c_b_node*
-cy_as_create_usb_io_c_b_node(cy_as_usb_io_callback cb) ;
+cy_as_create_usb_io_c_b_node(cy_as_usb_io_callback cb);
extern void
-cy_as_destroy_usb_io_c_b_node(cy_as_usb_io_c_b_node *node) ;
+cy_as_destroy_usb_io_c_b_node(cy_as_usb_io_c_b_node *node);
typedef struct cy_as_storage_io_c_b_node {
- cy_as_c_b_node_type type ;
- cy_as_storage_callback cb_p ;
+ cy_as_c_b_node_type type;
+ cy_as_storage_callback cb_p;
/* The media for the currently outstanding async storage request */
- cy_as_media_type media ;
+ cy_as_media_type media;
/* The device index for the currently outstanding async storage
* request */
- uint32_t device_index ;
+ uint32_t device_index;
/* The unit index for the currently outstanding async storage
* request */
- uint32_t unit ;
+ uint32_t unit;
/* The block address for the currently outstanding async storage
* request */
- uint32_t block_addr ;
+ uint32_t block_addr;
/* The operation for the currently outstanding async storage
* request */
- cy_as_oper_type oper ;
- cy_as_ll_request_response *req_p ;
- cy_as_ll_request_response *reply_p ;
- struct cy_as_storage_io_c_b_node *next_p ;
+ cy_as_oper_type oper;
+ cy_as_ll_request_response *req_p;
+ cy_as_ll_request_response *reply_p;
+ struct cy_as_storage_io_c_b_node *next_p;
} cy_as_storage_io_c_b_node;
extern cy_as_storage_io_c_b_node*
@@ -425,39 +425,39 @@ cy_as_create_storage_io_c_b_node(cy_as_storage_callback cb,
cy_as_media_type media, uint32_t device_index,
uint32_t unit, uint32_t block_addr, cy_as_oper_type oper,
cy_as_ll_request_response *req_p,
- cy_as_ll_request_response *reply_p) ;
+ cy_as_ll_request_response *reply_p);
extern void
-cy_as_destroy_storage_io_c_b_node(cy_as_storage_io_c_b_node *node) ;
+cy_as_destroy_storage_io_c_b_node(cy_as_storage_io_c_b_node *node);
typedef struct cy_as_c_b_queue {
void *head_p;
void *tail_p;
- uint32_t count ;
- cy_as_c_b_node_type type ;
-} cy_as_c_b_queue ;
+ uint32_t count;
+ cy_as_c_b_node_type type;
+} cy_as_c_b_queue;
extern cy_as_c_b_queue *
-cy_as_create_c_b_queue(cy_as_c_b_node_type type) ;
+cy_as_create_c_b_queue(cy_as_c_b_node_type type);
extern void
-cy_as_destroy_c_b_queue(cy_as_c_b_queue *queue) ;
+cy_as_destroy_c_b_queue(cy_as_c_b_queue *queue);
/* Allocates a new CyAsCBNode */
extern void
-cy_as_insert_c_b_node(cy_as_c_b_queue *queue_p, void *cbnode) ;
+cy_as_insert_c_b_node(cy_as_c_b_queue *queue_p, void *cbnode);
/* Removes the first CyAsCBNode from the queue and frees it */
extern void
-cy_as_remove_c_b_node(cy_as_c_b_queue *queue_p) ;
+cy_as_remove_c_b_node(cy_as_c_b_queue *queue_p);
/* Remove the last CyAsCBNode from the queue and frees it */
extern void
-cy_as_remove_c_b_tail_node(cy_as_c_b_queue *queue_p) ;
+cy_as_remove_c_b_tail_node(cy_as_c_b_queue *queue_p);
/* Removes and frees all pending callbacks */
extern void
-cy_as_clear_c_b_queue(cy_as_c_b_queue *queue_p) ;
+cy_as_clear_c_b_queue(cy_as_c_b_queue *queue_p);
extern cy_as_return_status_t
cy_as_misc_send_request(cy_as_device *dev_p,
@@ -469,10 +469,10 @@ cy_as_misc_send_request(cy_as_device *dev_p,
uint16_t req_type,
cy_as_ll_request_response *req_p,
cy_as_ll_request_response *reply_p,
- cy_as_response_callback rcb) ;
+ cy_as_response_callback rcb);
extern void
-cy_as_misc_cancel_ex_requests(cy_as_device *dev_p) ;
+cy_as_misc_cancel_ex_requests(cy_as_device *dev_p);
/* Summary
Free all memory allocated by and zero all
@@ -480,7 +480,7 @@ cy_as_misc_cancel_ex_requests(cy_as_device *dev_p) ;
*/
extern void
cy_as_usb_cleanup(
- cy_as_device *dev_p) ;
+ cy_as_device *dev_p);
/* Summary
Free all memory allocated and zero all structures initialized
@@ -488,7 +488,7 @@ cy_as_usb_cleanup(
*/
extern void
cy_as_storage_cleanup(
- cy_as_device *dev_p) ;
+ cy_as_device *dev_p);
#endif
/* Summary
@@ -503,28 +503,28 @@ cy_as_storage_cleanup(
*/
typedef struct cy_as_context {
/* The context number for this context */
- uint8_t number ;
+ uint8_t number;
/* This sleep channel is used to sleep while waiting on a
* response from the west bridge device for a request. */
- cy_as_hal_sleep_channel channel ;
+ cy_as_hal_sleep_channel channel;
/* The buffer for received requests */
- cy_as_ll_request_response *req_p ;
+ cy_as_ll_request_response *req_p;
/* The length of the request being received */
- uint16_t request_length ;
+ uint16_t request_length;
/* The callback for the next request received */
- cy_as_response_callback request_callback ;
+ cy_as_response_callback request_callback;
/* A list of low level requests to go to the firmware */
- cy_as_ll_request_list_node *request_queue_p ;
+ cy_as_ll_request_list_node *request_queue_p;
/* The list node in the request queue */
- cy_as_ll_request_list_node *last_node_p ;
+ cy_as_ll_request_list_node *last_node_p;
/* Index upto which data is stored. */
- uint16_t queue_index ;
+ uint16_t queue_index;
/* Index to the next request in the queue. */
- uint16_t rqt_index ;
+ uint16_t rqt_index;
/* Queue of data stored */
- uint16_t data_queue[128] ;
+ uint16_t data_queue[128];
-} cy_as_context ;
+} cy_as_context;
#define cy_as_context_is_waiting(ctxt) \
((ctxt)->state & CY_AS_CTXT_STATE_WAITING_RESPONSE)
@@ -638,175 +638,175 @@ Macros to access the SDIO card properties
struct cy_as_device {
/* General stuff */
/* A signature to insure we have a valid handle */
- uint32_t sig ;
+ uint32_t sig;
/* The ID of the silicon */
- uint16_t silicon_id ;
+ uint16_t silicon_id;
/* Pointer to the next device */
- struct cy_as_device *next_p ;
+ struct cy_as_device *next_p;
/* This is the client specific tag for this device */
- cy_as_hal_device_tag tag ;
+ cy_as_hal_device_tag tag;
/* This contains various state information about the device */
- uint32_t state ;
+ uint32_t state;
/* Flag indicating whether INT# pin is used for DRQ */
- cy_bool use_int_drq ;
+ cy_bool use_int_drq;
/* DMA related */
/* The endpoint pointers associated with this device */
- cy_as_dma_end_point *endp[16] ;
+ cy_as_dma_end_point *endp[16];
/* List of queue entries that can be used for xfers */
- cy_as_dma_queue_entry *dma_freelist_p ;
+ cy_as_dma_queue_entry *dma_freelist_p;
/* Low level comm related */
/* The contexts available in this device */
- cy_as_context *context[CY_RQT_CONTEXT_COUNT] ;
+ cy_as_context *context[CY_RQT_CONTEXT_COUNT];
/* The low level error returned from sending an async request */
- cy_as_return_status_t ll_error ;
+ cy_as_return_status_t ll_error;
/* A request is currently being sent to West Bridge. */
- cy_bool ll_sending_rqt ;
+ cy_bool ll_sending_rqt;
/* The current mailbox request should be aborted. */
- cy_bool ll_abort_curr_rqt ;
+ cy_bool ll_abort_curr_rqt;
/* Indicates that the LL layer has queued mailbox data. */
- cy_bool ll_queued_data ;
+ cy_bool ll_queued_data;
/* MISC API related */
/* Misc callback */
- cy_as_misc_event_callback misc_event_cb ;
+ cy_as_misc_event_callback misc_event_cb;
/* Storage Related */
/* The reference count for the Storage API */
- uint32_t storage_count ;
+ uint32_t storage_count;
/* Callback for storage events */
- cy_as_storage_event_callback_dep storage_event_cb ;
+ cy_as_storage_event_callback_dep storage_event_cb;
/* V1.2+ callback for storage events */
- cy_as_storage_event_callback storage_event_cb_ms ;
+ cy_as_storage_event_callback storage_event_cb_ms;
/* The error for a sleeping storage operation */
- cy_as_return_status_t storage_error ;
+ cy_as_return_status_t storage_error;
/* Flag indicating that the storage stack is waiting for an operation */
- cy_bool storage_wait ;
+ cy_bool storage_wait;
/* Request used for storage read/writes. */
- cy_as_ll_request_response *storage_rw_req_p ;
+ cy_as_ll_request_response *storage_rw_req_p;
/* Response used for storage read/writes. */
- cy_as_ll_request_response *storage_rw_resp_p ;
+ cy_as_ll_request_response *storage_rw_resp_p;
/* The storage callback */
- cy_as_storage_callback_dep storage_cb ;
+ cy_as_storage_callback_dep storage_cb;
/* The V1.2+ storage callback */
- cy_as_storage_callback storage_cb_ms ;
+ cy_as_storage_callback storage_cb_ms;
/* The bus index for the currently outstanding async storage request */
- cy_as_bus_number_t storage_bus_index ;
+ cy_as_bus_number_t storage_bus_index;
/* The device index for the currently outstanding async storage
* request */
- uint32_t storage_device_index ;
+ uint32_t storage_device_index;
/* The unit index for the currently outstanding async storage request */
- uint32_t storage_unit ;
+ uint32_t storage_unit;
/* The block address for the currently outstanding async storage
* request */
- uint32_t storage_block_addr ;
+ uint32_t storage_block_addr;
/* The operation for the currently outstanding async storage request */
- cy_as_oper_type storage_oper ;
+ cy_as_oper_type storage_oper;
/* The endpoint used to read Storage data */
- cy_as_end_point_number_t storage_read_endpoint ;
+ cy_as_end_point_number_t storage_read_endpoint;
/* The endpoint used to write endpoint data */
- cy_as_end_point_number_t storage_write_endpoint ;
+ cy_as_end_point_number_t storage_write_endpoint;
cy_as_device_desc storage_device_info
- [CY_AS_MAX_BUSES][CY_AS_MAX_STORAGE_DEVICES] ;
+ [CY_AS_MAX_BUSES][CY_AS_MAX_STORAGE_DEVICES];
/* The information on each device on each bus */
/* USB Related */
/* This conatins the endpoint async state */
- uint16_t epasync ;
+ uint16_t epasync;
/* The reference count for the USB API */
- uint32_t usb_count ;
+ uint32_t usb_count;
/* The physical endpoint configuration */
- uint8_t usb_phy_config ;
+ uint8_t usb_phy_config;
/* The callbacks for async func calls */
- cy_as_c_b_queue *usb_func_cbs ;
+ cy_as_c_b_queue *usb_func_cbs;
/* Endpoint configuration information */
- cy_as_usb_end_point_config usb_config[16] ;
+ cy_as_usb_end_point_config usb_config[16];
/* The USB callback */
- cy_as_usb_event_callback_dep usb_event_cb ;
+ cy_as_usb_event_callback_dep usb_event_cb;
/* The V1.2+ USB callback */
- cy_as_usb_event_callback usb_event_cb_ms ;
+ cy_as_usb_event_callback usb_event_cb_ms;
/* The error for a sleeping usb operation */
- cy_as_return_status_t usb_error ;
+ cy_as_return_status_t usb_error;
/* The USB callback for a pending storage operation */
- cy_as_usb_io_callback usb_cb[16] ;
+ cy_as_usb_io_callback usb_cb[16];
/* The buffer pending from a USB operation */
- void *usb_pending_buffer ;
+ void *usb_pending_buffer;
/* The size of the buffer pending from a USB operation */
- uint32_t usb_pending_size ;
+ uint32_t usb_pending_size;
/* If true, send a short packet */
- cy_bool usb_spacket[16] ;
+ cy_bool usb_spacket[16];
/* The amount of data actually xferred */
- uint32_t usb_actual_cnt ;
+ uint32_t usb_actual_cnt;
/* EP1OUT and EP1IN config register contents */
- uint8_t usb_ep1cfg[2] ;
+ uint8_t usb_ep1cfg[2];
/* LEP config register contents */
- uint16_t usb_lepcfg[10] ;
+ uint16_t usb_lepcfg[10];
/* PEP config register contents */
- uint16_t usb_pepcfg[4] ;
+ uint16_t usb_pepcfg[4];
/* Buffer for EP0 and EP1 data sent via mailboxes */
- uint8_t *usb_ep_data ;
+ uint8_t *usb_ep_data;
/* Used to track how many ack requests are pending */
- uint32_t usb_delay_ack_count ;
+ uint32_t usb_delay_ack_count;
/* Maximum transfer size for USB endpoints. */
- uint32_t usb_max_tx_size ;
+ uint32_t usb_max_tx_size;
/* Request for sending EP0 data to West Bridge */
- cy_as_ll_request_response *usb_ep0_dma_req ;
+ cy_as_ll_request_response *usb_ep0_dma_req;
/* Response for EP0 data sent to West Bridge */
- cy_as_ll_request_response *usb_ep0_dma_resp ;
+ cy_as_ll_request_response *usb_ep0_dma_resp;
/* Request for sending EP1 data to West Bridge */
- cy_as_ll_request_response *usb_ep1_dma_req ;
+ cy_as_ll_request_response *usb_ep1_dma_req;
/* Response for EP1 data sent to West Bridge */
- cy_as_ll_request_response *usb_ep1_dma_resp ;
+ cy_as_ll_request_response *usb_ep1_dma_resp;
- cy_as_ll_request_response *usb_ep0_dma_req_save ;
- cy_as_ll_request_response *usb_ep0_dma_resp_save ;
+ cy_as_ll_request_response *usb_ep0_dma_req_save;
+ cy_as_ll_request_response *usb_ep0_dma_resp_save;
/* MTP Related */
/* The reference count for the MTP API */
- uint32_t mtp_count ;
+ uint32_t mtp_count;
/* The MTP event callback supplied by the client */
- cy_as_mtp_event_callback mtp_event_cb ;
+ cy_as_mtp_event_callback mtp_event_cb;
/* The current block table to be transfered */
- cy_as_mtp_block_table *tp_blk_tbl ;
+ cy_as_mtp_block_table *tp_blk_tbl;
- cy_as_c_b_queue *func_cbs_mtp ;
- cy_as_c_b_queue *func_cbs_usb ;
- cy_as_c_b_queue *func_cbs_stor ;
- cy_as_c_b_queue *func_cbs_misc ;
- cy_as_c_b_queue *func_cbs_res ;
+ cy_as_c_b_queue *func_cbs_mtp;
+ cy_as_c_b_queue *func_cbs_usb;
+ cy_as_c_b_queue *func_cbs_stor;
+ cy_as_c_b_queue *func_cbs_misc;
+ cy_as_c_b_queue *func_cbs_res;
/* The last USB event that was received */
- cy_as_usb_event usb_last_event ;
+ cy_as_usb_event usb_last_event;
/* Types of storage media supported by the firmware */
- uint8_t media_supported[CY_AS_MAX_BUSES] ;
+ uint8_t media_supported[CY_AS_MAX_BUSES];
/* SDIO card parameters*/
cy_as_sdio_device sdiocard[CY_AS_MAX_BUSES];
/* if true, MTP enabled Firmware. */
- cy_bool is_mtp_firmware ;
+ cy_bool is_mtp_firmware;
/* if true, mailbox message has come already */
- cy_bool is_mtp_data_pending ;
+ cy_bool is_mtp_data_pending;
/* True between the time an Init was called and
* the complete event is generated */
- cy_bool mtp_turbo_active ;
+ cy_bool mtp_turbo_active;
/* mbox reported EP 2 data len */
- uint16_t mtp_data_len ;
+ uint16_t mtp_data_len;
/* The error for mtp EP4 write operation */
- cy_as_return_status_t mtp_error ;
+ cy_as_return_status_t mtp_error;
/* mtp send/get operation callback */
- cy_as_function_callback mtp_cb ;
+ cy_as_function_callback mtp_cb;
/* mtp send/get operation client id */
- uint32_t mtp_client ;
+ uint32_t mtp_client;
/* mtp operation type. To be used in callback */
- cy_as_funct_c_b_type mtp_op ;
+ cy_as_funct_c_b_type mtp_op;
/* Firmware is running in P2S only mode. */
- cy_bool is_storage_only_mode ;
+ cy_bool is_storage_only_mode;
/* Interrupt mask value during device standby. */
- uint32_t stby_int_mask ;
-} ;
+ uint32_t stby_int_mask;
+};
#define cy_as_device_is_configured(dp) \
((dp)->state & CY_AS_DEVICE_STATE_CONFIGURED)
@@ -1020,7 +1020,7 @@ struct cy_as_device {
((dp)->silicon_id == CY_AS_MEM_CM_WB_CFG_ID_HDID_ANTIOCH_VALUE)
#ifdef CY_AS_LOG_SUPPORT
-extern void cy_as_log_debug_message(int value, const char *msg) ;
+extern void cy_as_log_debug_message(int value, const char *msg);
#else
#define cy_as_log_debug_message(value, msg)
#endif
@@ -1050,7 +1050,7 @@ extern void cy_as_log_debug_message(int value, const char *msg) ;
extern cy_as_device *
cy_as_device_find_from_tag(
cy_as_hal_device_tag tag
- ) ;
+ );
#include "cyas_cplus_end.h"
diff --git a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasdma.h b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasdma.h
index c97f9876fc4..6efb8b80ffb 100644
--- a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasdma.h
+++ b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasdma.h
@@ -91,7 +91,7 @@ typedef enum cy_as_dma_direction {
cy_as_direction_in_out = 2,
/* Do no change the endpoint type */
cy_as_direction_dont_change = 3
-} cy_as_dma_direction ;
+} cy_as_dma_direction;
/*********************************
* West Bridge Functions
@@ -120,7 +120,7 @@ extern cy_as_return_status_t
cy_as_dma_start(
/* The device to start */
cy_as_device *dev_p
- ) ;
+ );
/* Summary
Shutdown the DMA module
@@ -142,7 +142,7 @@ extern cy_as_return_status_t
cy_as_dma_stop(
/* The device to stop */
cy_as_device *dev_p
- ) ;
+ );
/* Summary
This function cancels all outstanding DMA requests on a given endpoint
@@ -172,7 +172,7 @@ cy_as_dma_cancel(
/* The endpoint to cancel */
cy_as_end_point_number_t ep,
cy_as_return_status_t err
- ) ;
+ );
/* Summary
This function enables a single endpoint for DMA operations
@@ -201,7 +201,7 @@ cy_as_dma_enable_end_point(
cy_bool enable,
/* The direction of the endpoint */
cy_as_dma_direction dir
-) ;
+);
/* Summary
This function queue a DMA request for a given endpoint
@@ -246,7 +246,7 @@ cy_as_dma_queue_request(
/* The callback to call when the DMA request is complete,
* either successfully or via an error */
cy_as_dma_callback cb
- ) ;
+ );
/* Summary
This function waits until all DMA requests on a given endpoint
@@ -280,7 +280,7 @@ cy_as_dma_drain_queue(
/* If CyTrue, call kickstart to start the DMA process,
if cy_false, west bridge will start the DMA process */
cy_bool kickstart
- ) ;
+ );
/* Summary
Sets the maximum amount of data West Bridge can accept in a single
@@ -306,7 +306,7 @@ cy_as_dma_set_max_dma_size(
cy_as_end_point_number_t ep,
/* The max size of this endpoint in bytes */
uint32_t size
- ) ;
+ );
/* Summary
This function starts the DMA process on a given channel.
@@ -326,7 +326,7 @@ cy_as_dma_kick_start(
cy_as_device *dev_p,
/* The endpoint to change */
cy_as_end_point_number_t ep
- ) ;
+ );
/* Summary
This function receives endpoint data from a request.
@@ -368,7 +368,7 @@ cy_as_dma_completed_callback(
uint32_t length,
/* Status of DMA operation. */
cy_as_return_status_t status
- ) ;
+ );
#include "cyas_cplus_end.h"
diff --git a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyashalcb.h b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyashalcb.h
index d48a7f4b147..4d1670ee047 100644
--- a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyashalcb.h
+++ b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyashalcb.h
@@ -37,7 +37,7 @@ typedef void (*cy_as_hal_dma_complete_callback)(
cy_as_hal_device_tag tag,
cy_as_end_point_number_t ep,
uint32_t cnt,
- cy_as_return_status_t ret) ;
+ cy_as_return_status_t ret);
typedef cy_as_hal_dma_complete_callback \
cy_an_hal_dma_complete_callback;
diff --git a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyashaldoc.h b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyashaldoc.h
index 2cfe4fb4cf6..28136ad7511 100644
--- a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyashaldoc.h
+++ b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyashaldoc.h
@@ -162,8 +162,8 @@
typedef struct cy_as_hal_sleep_channel {
/* This structure is filled in with OS specific information
to implementat a sleep channel */
- int m_channel ;
-} cy_as_hal_sleep_channel ;
+ int m_channel;
+} cy_as_hal_sleep_channel;
/* Summary
This function is called to write a register value
@@ -189,7 +189,7 @@ cy_as_hal_write_register(
uint16_t addr,
/* The value to write to the register */
uint16_t value
- ) ;
+ );
/* Summary
This function is called to read a register value
@@ -213,7 +213,7 @@ cy_as_hal_read_register(
cy_as_hal_device_tag tag,
/* The address we are writing to */
uint16_t addr
- ) ;
+ );
/* Summary
This function initiates a DMA write operation to write
@@ -247,7 +247,7 @@ cy_as_hal_dma_setup_write(
/* The maximum amount of data that the endpoint
* can accept as one packet */
uint16_t maxsize
- ) ;
+ );
/* Summary
This function initiates a DMA read operation from West Bridge
@@ -280,7 +280,7 @@ cy_as_hal_dma_setup_read(
/* The maximum amount of data that the endpoint
* can provide in one DMA operation */
uint16_t maxsize
- ) ;
+ );
/* Summary
This function cancels a pending DMA request
@@ -300,7 +300,7 @@ cy_as_hal_dma_cancel_request(
cy_as_hal_device_tag tag,
/* The endpoint we are reading from */
cy_as_end_point_number_t ep
- ) ;
+ );
/* Summary
This function registers a callback function to be called when
@@ -324,7 +324,7 @@ cy_as_hal_dma_register_callback(
cy_as_hal_device_tag tag,
/* The callback to call when a request has completed */
cy_as_hal_dma_complete_callback cb
- ) ;
+ );
/* Summary
This function returns the maximum size of a DMA request that can
@@ -348,7 +348,7 @@ cy_as_hal_dma_max_request_size(
cy_as_hal_device_tag tag,
/* The endpoint of interest */
cy_as_end_point_number_t ep
- ) ;
+ );
/* Summary
This function sets the WAKEUP pin to a specific state on the
@@ -370,7 +370,7 @@ cy_as_hal_set_wakeup_pin(
cy_as_hal_device_tag tag,
/* The desired state of the wakeup pin */
cy_bool state
- ) ;
+ );
/* Summary
Synchronise the West Bridge device clocks to re-establish device
@@ -392,7 +392,7 @@ EXTERN cy_bool
cy_as_hal_sync_device_clocks(
/* The tag to ID a specific West Bridge device */
cy_as_hal_device_tag tag,
- ) ;
+ );
/* Summary
Initialize West Bridge device registers that may have been
@@ -418,7 +418,7 @@ cy_as_hal_init_dev_registers(
cy_as_hal_device_tag tag,
/* Indicates whether this is a wake-up from standby. */
cy_bool is_standby_wakeup
- ) ;
+ );
/* Summary
This function reads a set of P-port accessible device registers and
@@ -447,7 +447,7 @@ EXTERN void
cy_as_hal_read_regs_before_standby(
/* The tag to ID a specific West Bridge device */
cy_as_hal_device_tag tag
- ) ;
+ );
/* Summary
This function restores the old values to a set of P-port
@@ -470,7 +470,7 @@ EXTERN void
cy_as_hal_restore_regs_after_standby(
/* The tag to ID a specific West Bridge device */
cy_as_hal_device_tag tag
- ) ;
+ );
/*
* The functions below this comment are part of the HAL layer,
@@ -497,7 +497,7 @@ EXTERN void *
cy_as_hal_alloc(
/* The size of the memory block to allocate */
uint32_t size
- ) ;
+ );
/* Summary
This function frees a previously allocated block of memory
@@ -515,7 +515,7 @@ EXTERN void
cy_as_hal_free(
/* Pointer to a memory block to free */
void *ptr
- ) ;
+ );
/* Summary
This function is a malloc equivalent that can be used from an
@@ -545,7 +545,7 @@ EXTERN void *
cy_as_hal_c_b_alloc(
/* The size of the memory block to allocate */
uint32_t size
- ) ;
+ );
/* Summary
This function frees the memory allocated through the CyAsHalCBAlloc
@@ -567,7 +567,7 @@ EXTERN void
cy_as_hal_c_b_free(
/* Pointer to the memory block to be freed */
void *ptr
- ) ;
+ );
/* Summary
This function sets a block of memory to a specific value
@@ -586,7 +586,7 @@ cy_as_mem_set(
uint8_t value,
/* The number of bytes to set */
uint32_t cnt
- ) ;
+ );
/* Summary
This function creates or initializes a sleep channel
@@ -609,7 +609,7 @@ EXTERN cy_bool
cy_as_hal_create_sleep_channel(
/* Pointer to the sleep channel to create/initialize */
cy_as_hal_sleep_channel *chan
- ) ;
+ );
/* Summary
This function destroys an existing sleep channel
@@ -631,7 +631,7 @@ EXTERN cy_bool
cy_as_hal_destroy_sleep_channel(
/* The sleep channel to destroy */
cy_as_hal_sleep_channel chan
- ) ;
+ );
/* Summary
This function causes the calling process or thread to sleep until
@@ -655,7 +655,7 @@ cy_as_hal_sleep_on(
cy_as_hal_sleep_channel chan,
/* The maximum time to sleep in milli-seconds */
uint32_t ms
- ) ;
+ );
/* Summary
This function casues the process or thread sleeping on the given
@@ -676,7 +676,7 @@ EXTERN cy_bool
cy_as_hal_wake(
/* The sleep channel to wake */
cy_as_hal_sleep_channel chan
- ) ;
+ );
/* Summary
This function disables interrupts, insuring that short bursts
@@ -701,7 +701,7 @@ cy_as_hal_wake(
* CyAsHalEnableInterrupts
*/
EXTERN uint32_t
-cy_as_hal_disable_interrupts() ;
+cy_as_hal_disable_interrupts();
/* Summary
This function re-enables interrupts after a critical section of
@@ -722,7 +722,7 @@ EXTERN void
cy_as_hal_enable_interrupts(
/* Value returned by the previous CyAsHalDisableInterrupts call. */
uint32_t value
- ) ;
+ );
/* Summary
This function sleeps for 150 ns.
@@ -734,7 +734,7 @@ cy_as_hal_enable_interrupts(
*/
EXTERN void
cy_as_hal_sleep150(
- ) ;
+ );
/* Summary
This function sleeps for the given number of milliseconds
@@ -745,7 +745,7 @@ cy_as_hal_sleep150(
EXTERN void
cy_as_hal_sleep(
uint32_t ms
- ) ;
+ );
/* Summary
This function asserts when the condition evaluates to zero
@@ -761,7 +761,7 @@ EXTERN void
cy_as_hal_assert(
/* The condition to evaluate */
cy_bool cond
- ) ;
+ );
/* Summary
This function prints a message from the API to a human readable device
@@ -779,7 +779,7 @@ cy_as_hal_print_message(
/* The message to print */
const char *fmt_p,
... /* Variable arguments */
- ) ;
+ );
/* Summary
This function reports whether the HAL implementation uses
@@ -795,6 +795,6 @@ cy_as_hal_print_message(
*/
EXTERN cy_bool
cy_as_hal_is_polling(
- void) ;
+ void);
#endif
diff --git a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasintr.h b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasintr.h
index e77aa6ae82b..3d7063ea309 100644
--- a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasintr.h
+++ b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasintr.h
@@ -58,7 +58,7 @@ cy_as_intr_start(
cy_as_device *dev_p,
/* If true, enable the DMA interrupt through the INT signal */
cy_bool dmaintr
- ) ;
+ );
/* Summary
Stop the interrupt manager module
@@ -81,7 +81,7 @@ cy_as_return_status_t
cy_as_intr_stop(
/* Device bein stopped */
cy_as_device *dev_p
- ) ;
+ );
/* Summary
@@ -97,7 +97,7 @@ cy_as_intr_stop(
void cy_as_intr_service_interrupt(
/* The USER supplied tag for this device */
cy_as_hal_device_tag tag
- ) ;
+ );
#include "cyas_cplus_end.h"
diff --git a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyaslep2pep.h b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyaslep2pep.h
index 40497655b7f..6626cc45474 100644
--- a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyaslep2pep.h
+++ b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyaslep2pep.h
@@ -25,12 +25,12 @@
#include "cyasdevice.h"
extern cy_as_return_status_t
-cy_as_usb_map_logical2_physical(cy_as_device *dev_p) ;
+cy_as_usb_map_logical2_physical(cy_as_device *dev_p);
extern cy_as_return_status_t
-cy_as_usb_setup_dma(cy_as_device *dev_p) ;
+cy_as_usb_setup_dma(cy_as_device *dev_p);
extern cy_as_return_status_t
-cy_as_usb_set_dma_sizes(cy_as_device *dev_p) ;
+cy_as_usb_set_dma_sizes(cy_as_device *dev_p);
#endif
diff --git a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyaslowlevel.h b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyaslowlevel.h
index 6d40aa6eed6..5c7972f91ef 100644
--- a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyaslowlevel.h
+++ b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyaslowlevel.h
@@ -168,7 +168,7 @@ typedef enum cy_as_remove_request_result_t {
cy_as_remove_request_sucessful,
cy_as_remove_request_in_transit,
cy_as_remove_request_not_found
-} cy_as_remove_request_result_t ;
+} cy_as_remove_request_result_t;
/* Summary
Start the low level communications module
@@ -178,12 +178,12 @@ typedef enum cy_as_remove_request_result_t {
cy_as_return_status_t
cy_as_ll_start(
cy_as_device *dev_p
- ) ;
+ );
cy_as_return_status_t
cy_as_ll_stop(
cy_as_device *dev_p
- ) ;
+ );
cy_as_ll_request_response *
@@ -193,31 +193,31 @@ cy_as_ll_create_request(
uint8_t context,
/* Length of the request in 16 bit words */
uint16_t length
- ) ;
+ );
void
cy_as_ll_init_request(
cy_as_ll_request_response *req_p,
uint16_t code,
uint16_t context,
- uint16_t length) ;
+ uint16_t length);
void
cy_as_ll_init_response(
cy_as_ll_request_response *req_p,
- uint16_t length) ;
+ uint16_t length);
void
cy_as_ll_destroy_request(
cy_as_device *dev_p,
- cy_as_ll_request_response *) ;
+ cy_as_ll_request_response *);
cy_as_ll_request_response *
cy_as_ll_create_response(
cy_as_device *dev_p,
/* Length of the request in 16 bit words */
uint16_t length
- ) ;
+ );
cy_as_remove_request_result_t
cy_as_ll_remove_request(
@@ -225,15 +225,15 @@ cy_as_ll_remove_request(
cy_as_context *ctxt_p,
cy_as_ll_request_response *req_p,
cy_bool force
- ) ;
+ );
void
cy_as_ll_remove_all_requests(cy_as_device *dev_p,
- cy_as_context *ctxt_p) ;
+ cy_as_context *ctxt_p);
void
cy_as_ll_destroy_response(
cy_as_device *dev_p,
- cy_as_ll_request_response *) ;
+ cy_as_ll_request_response *);
cy_as_return_status_t
cy_as_ll_send_request(
@@ -247,7 +247,7 @@ cy_as_ll_send_request(
cy_bool sync,
/* Callback to call when reply is received */
cy_as_response_callback cb
-) ;
+);
cy_as_return_status_t
cy_as_ll_send_request_wait_reply(
@@ -257,7 +257,7 @@ cy_as_ll_send_request_wait_reply(
cy_as_ll_request_response *req,
/* Storage for a reply, must be sure it is of sufficient size */
cy_as_ll_request_response *resp
-) ;
+);
/* Summary
This function registers a callback function to be called when a
@@ -273,7 +273,7 @@ cy_as_ll_register_request_callback(
cy_as_device *dev_p,
uint8_t context,
cy_as_response_callback cb
- ) ;
+ );
/* Summary
This function packs a set of bytes given by the data_p pointer
@@ -289,7 +289,7 @@ cy_as_ll_request_response__pack(
uint32_t length,
/* The data to pack */
void *data_p
- ) ;
+ );
/* Summary
This function unpacks a set of bytes from a request/reply
@@ -305,7 +305,7 @@ cy_as_ll_request_response__unpack(
uint32_t length,
/* The destination of the unpack operation */
void *data_p
- ) ;
+ );
/* Summary
This function sends a status response back to the West Bridge
@@ -320,7 +320,7 @@ cy_as_ll_send_status_response(
/* The success/failure code to send */
uint16_t code,
/* Flag to clear wait on storage context */
- uint8_t clear_storage) ;
+ uint8_t clear_storage);
/* Summary
This function sends a response back to the West Bridge device.
@@ -344,7 +344,7 @@ cy_as_ll_send_data_response(
uint16_t length,
/* The data for the response */
void *data
-) ;
+);
/* Summary
This function removes any requests of the given type
@@ -359,7 +359,7 @@ cy_as_ll_remove_ep_data_requests(
/* The West Bridge device */
cy_as_device *dev_p,
cy_as_end_point_number_t ep
- ) ;
+ );
#include "cyas_cplus_end.h"
diff --git a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasmedia.h b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasmedia.h
index e444079cf87..0e25ea94481 100644
--- a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasmedia.h
+++ b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasmedia.h
@@ -47,7 +47,7 @@ typedef enum cy_as_media_type {
cy_as_media_sdio = 0x04,
cy_as_media_max_media_value = 0x05
-} cy_as_media_type ;
+} cy_as_media_type;
#include "cyas_cplus_end.h"
diff --git a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasmisc.h b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasmisc.h
index 33655bd125c..b555c6c2452 100644
--- a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasmisc.h
+++ b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasmisc.h
@@ -66,7 +66,7 @@
* CyAsMiscCreateDevice
* CyAsMiscDestroyDevice
*/
-typedef void *cy_as_device_handle ;
+typedef void *cy_as_device_handle;
/* Summary
This data type gives the mode for the DACK# signal
@@ -74,7 +74,7 @@ typedef void *cy_as_device_handle ;
typedef enum cy_as_device_dack_mode {
cy_as_device_dack_ack, /* Operate in the ACK mode */
cy_as_device_dack_eob /* Operate in the EOB mode */
-} cy_as_device_dack_mode ;
+} cy_as_device_dack_mode;
/* Summary
This data structure gives the options for all hardware features.
@@ -89,21 +89,21 @@ typedef enum cy_as_device_dack_mode {
*/
typedef struct cy_as_device_config {
/* If TRUE, the P port is running in SRAM mode. */
- cy_bool srammode ;
+ cy_bool srammode;
/* If TRUE, the P port is synchronous, otherwise async */
- cy_bool sync ;
+ cy_bool sync;
/* If TRUE, DMA req will be delivered via the interrupt signal */
- cy_bool dmaintr ;
+ cy_bool dmaintr;
/* Mode for the DACK# signal */
- cy_as_device_dack_mode dackmode ;
+ cy_as_device_dack_mode dackmode;
/* If TRUE, the DRQ line is active high, otherwise active low */
- cy_bool drqpol ;
+ cy_bool drqpol;
/* If TRUE, the DACK line is active high, otherwise active low */
- cy_bool dackpol ;
+ cy_bool dackpol;
/* If TRUE, the clock is connected to a crystal, otherwise it is
connected to a clock */
- cy_bool crystal ;
-} cy_as_device_config ;
+ cy_bool crystal;
+} cy_as_device_config;
/* Summary
@@ -174,7 +174,7 @@ typedef enum cy_as_misc_signal_polarity {
cy_as_misc_active_high,
cy_as_misc_active_low
-} cy_as_misc_signal_polarity ;
+} cy_as_misc_signal_polarity;
@@ -303,7 +303,7 @@ typedef enum cy_as_funct_c_b_type {
CY_FUNCT_CB_MTP_STOP_STORAGE_ONLY,
CY_FUNCT_CB_NODATA = 0x40000000U,
CY_FUNCT_CB_DATA = 0x20000000U
-} cy_as_funct_c_b_type ;
+} cy_as_funct_c_b_type;
/* Summary
This type specifies the general West Bridge function callback.
@@ -321,7 +321,7 @@ typedef void (*cy_as_function_callback)(
cy_as_return_status_t status,
uint32_t client,
cy_as_funct_c_b_type type,
- void *data) ;
+ void *data);
/* Summary
This type specifies the general West Bridge event that has
@@ -354,7 +354,7 @@ typedef enum cy_as_misc_event_type {
/* This event is sent when the firmware image downloaded
cannot run on the active west bridge device. */
cy_as_event_misc_device_mismatch
-} cy_as_misc_event_type ;
+} cy_as_misc_event_type;
/* Summary
This type is the type of a callback function that is called when a
@@ -378,7 +378,7 @@ typedef void (*cy_as_misc_event_callback)(
cy_as_misc_event_type ev,
/* The data assocaited with the event being reported */
void *evdata
-) ;
+);
#ifndef __doxygen__
/* Summary
@@ -447,7 +447,7 @@ typedef enum cy_as_low_speed_sd_freq {
CY_AS_SD_DEFAULT_FREQ = 0,
/* 24 MHz */
CY_AS_SD_RATED_FREQ
-} cy_as_low_speed_sd_freq ;
+} cy_as_low_speed_sd_freq;
/* Summary
This enum lists the set of clock frequencies that are supported
@@ -465,7 +465,7 @@ typedef enum cy_as_low_speed_sd_freq {
typedef enum cy_as_high_speed_sd_freq {
CY_AS_HS_SD_FREQ_48, /* 48 MHz, default value */
CY_AS_HS_SD_FREQ_24 /* 24 MHz */
-} cy_as_high_speed_sd_freq ;
+} cy_as_high_speed_sd_freq;
/* Summary
Struct encapsulating all information returned by the
@@ -490,7 +490,7 @@ typedef struct cy_as_get_firmware_version_data {
uint8_t media_type;
/* Return value to indicate the release or debug mode of firmware */
cy_bool is_debug_mode;
-} cy_as_get_firmware_version_data ;
+} cy_as_get_firmware_version_data;
/*****************************
@@ -519,7 +519,7 @@ cy_as_misc_create_device(
cy_as_device_handle *handle_p,
/* The HAL specific tag for this device */
cy_as_hal_device_tag tag
- ) ;
+ );
/* Summary
This functions destroys a previously created West Bridge device.
@@ -543,7 +543,7 @@ EXTERN cy_as_return_status_t
cy_as_misc_destroy_device(
/* Handle to the device to destroy */
cy_as_device_handle handle
- ) ;
+ );
/* Summary
This function initializes the hardware for basic communication with
@@ -576,7 +576,7 @@ cy_as_misc_configure_device(
cy_as_device_handle handle,
/* Configuration information */
cy_as_device_config *config_p
- ) ;
+ );
/* Summary
This function returns non-zero if West Bridge is in standby and
@@ -599,7 +599,7 @@ cy_as_misc_in_standby(
cy_as_device_handle handle,
/* Return value for standby state */
cy_bool *standby
- ) ;
+ );
/* Summary
This function downloads the firmware to West Bridge device.
@@ -647,7 +647,7 @@ cy_as_misc_download_firmware(
cy_as_function_callback cb,
/* Client data to be passed to the callback. */
uint32_t client
- ) ;
+ );
/* Summary
@@ -683,7 +683,7 @@ cy_as_misc_get_firmware_version(
cy_as_function_callback cb,
/* Client data to be passed to the callback. */
uint32_t client
- ) ;
+ );
#if !defined(__doxygen__)
@@ -721,7 +721,7 @@ cy_as_misc_read_m_c_u_register(
cy_as_function_callback cb,
/* Client data to be passed to the callback. */
uint32_t client
- ) ;
+ );
/* Summary
This function writes to an MCU accessible register on the West Bridge.
@@ -762,7 +762,7 @@ cy_as_misc_write_m_c_u_register(
cy_as_function_callback cb,
/* Client data to be passed to the callback. */
uint32_t client
- ) ;
+ );
#endif
@@ -816,7 +816,7 @@ cy_as_misc_reset(
cy_as_function_callback cb,
/* Client data to be passed to the callback. */
uint32_t client
- ) ;
+ );
/* Summary
This function acquires a given resource.
@@ -864,7 +864,7 @@ cy_as_misc_acquire_resource(
cy_as_function_callback cb,
/* Client data to be passed to the callback. */
uint32_t client
- ) ;
+ );
/* Summary
This function releases a given resource.
@@ -898,7 +898,7 @@ cy_as_misc_release_resource(
cy_as_device_handle handle,
/* The resource to release */
cy_as_resource_type resource
- ) ;
+ );
#ifndef __doxygen__
/* Summary
@@ -955,7 +955,7 @@ cy_as_misc_set_trace_level(
cy_as_function_callback cb,
/* Client data to be passed to the callback. */
uint32_t client
- ) ;
+ );
#endif
/* Summary
@@ -1015,7 +1015,7 @@ cy_as_misc_enter_standby_e_x_u(
cy_as_function_callback cb,
/* Client data to be passed to the callback. */
uint32_t client
- ) ;
+ );
/* Summary
This function is provided for backwards compatibility.
@@ -1032,7 +1032,7 @@ cy_as_misc_enter_standby(cy_as_device_handle handle,
cy_bool pin,
cy_as_function_callback cb,
uint32_t client
- ) ;
+ );
/* Summary
This function brings West Bridge out of sleep mode.
@@ -1068,7 +1068,7 @@ cy_as_misc_leave_standby(
cy_as_device_handle handle,
/* The resource causing the wakeup */
cy_as_resource_type resource
- ) ;
+ );
/* Summary
This function registers a callback function to be called when an
@@ -1091,7 +1091,7 @@ cy_as_misc_register_callback(
cy_as_device_handle handle,
/* The function to call */
cy_as_misc_event_callback callback
- ) ;
+ );
/* Summary
This function sets the logging level for log messages.
@@ -1107,7 +1107,7 @@ EXTERN void
cy_as_misc_set_log_level(
/* Level to set, 0 is fewer messages, 255 is all */
uint8_t level
- ) ;
+ );
/* Summary
@@ -1143,7 +1143,7 @@ cy_as_misc_storage_changed(
cy_as_function_callback cb,
/* Client data to be passed to the callback. */
uint32_t client
- ) ;
+ );
/* Summary
This function instructs the West Bridge firmware to start/stop
@@ -1181,7 +1181,7 @@ cy_as_misc_heart_beat_control(
cy_as_function_callback cb,
/* Client data to be passed to the callback. */
uint32_t client
- ) ;
+ );
/* Summary
This function gets the current state of a GPIO pin on the
@@ -1227,7 +1227,7 @@ cy_as_misc_get_gpio_value(
cy_as_function_callback cb,
/* Client data to be passed to the callback. */
uint32_t client
- ) ;
+ );
/* Summary
This function updates the state of a GPIO pin on the West
@@ -1273,7 +1273,7 @@ cy_as_misc_set_gpio_value(
cy_as_function_callback cb,
/* Client data to be passed to the callback. */
uint32_t client
- ) ;
+ );
/* Summary
Set the West Bridge device in the low power suspend mode.
@@ -1328,7 +1328,7 @@ cy_as_misc_enter_suspend(
cy_as_function_callback cb,
/* Client data to be passed to the callback. */
uint32_t client
- ) ;
+ );
/* Summary
Wake up the West Bridge device from suspend mode.
@@ -1371,7 +1371,7 @@ cy_as_misc_leave_suspend(
cy_as_function_callback cb,
/* Client data to be passed to the callback. */
uint32_t client
- ) ;
+ );
/* Summary
Reserve first numzones zones of nand device for storing
@@ -1400,7 +1400,7 @@ cy_as_misc_reserve_l_n_a_boot_area(
cy_as_function_callback cb,
/* Client data to be passed to the callback. */
uint32_t client
- ) ;
+ );
/* Summary
Select the clock frequency to be used when talking to low
@@ -1448,7 +1448,7 @@ cy_as_misc_set_low_speed_sd_freq(
cy_as_function_callback cb,
/* Client data to be passed to the callback */
uint32_t client
- ) ;
+ );
/* Summary
Select the clock frequency to be used when talking to high speed
@@ -1493,7 +1493,7 @@ cy_as_misc_set_high_speed_sd_freq(
cy_as_function_callback cb,
/* Client data to be passed to the callback */
uint32_t client
- ) ;
+ );
/* Summary
Select the polarity of the SD_POW output driven by West Bridge.
@@ -1539,7 +1539,7 @@ cy_as_misc_set_sd_power_polarity(
cy_as_function_callback cb,
/* Client data to be passed to the callback. */
uint32_t client
- ) ;
+ );
/* For supporting deprecated functions */
#include "cyasmisc_dep.h"
diff --git a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasmtp.h b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasmtp.h
index 25af22e9a6b..05d34496977 100644
--- a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasmtp.h
+++ b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasmtp.h
@@ -132,9 +132,9 @@
*/
typedef struct cy_as_mtp_block_table {
- uint32_t start_blocks[CY_AS_MAX_BLOCK_TABLE_ENTRIES] ;
- uint16_t num_blocks[CY_AS_MAX_BLOCK_TABLE_ENTRIES] ;
-} cy_as_mtp_block_table ;
+ uint32_t start_blocks[CY_AS_MAX_BLOCK_TABLE_ENTRIES];
+ uint16_t num_blocks[CY_AS_MAX_BLOCK_TABLE_ENTRIES];
+} cy_as_mtp_block_table;
/* Summary
This type specifies the type of MTP event that has occurred.
@@ -178,7 +178,7 @@ typedef enum cy_as_mtp_event {
will result in an USB reset. this event has
no data */
cy_as_mtp_block_table_needed
-} cy_as_mtp_event ;
+} cy_as_mtp_event;
/* Summary
Data for the CyAsMTPSendObjectComplete event.
@@ -202,10 +202,10 @@ typedef enum cy_as_mtp_event {
*/
typedef struct cy_as_mtp_send_object_complete_data {
- cy_as_return_status_t status ;
- uint32_t byte_count ;
- uint32_t transaction_id ;
-} cy_as_mtp_send_object_complete_data ;
+ cy_as_return_status_t status;
+ uint32_t byte_count;
+ uint32_t transaction_id;
+} cy_as_mtp_send_object_complete_data;
/* Summary
Data for the CyAsMTPGetObjectComplete event.
@@ -220,9 +220,9 @@ typedef struct cy_as_mtp_send_object_complete_data {
*/
typedef struct cy_as_mtp_get_object_complete_data {
- cy_as_return_status_t status ;
- uint32_t byte_count ;
-} cy_as_mtp_get_object_complete_data ;
+ cy_as_return_status_t status;
+ uint32_t byte_count;
+} cy_as_mtp_get_object_complete_data;
/* Summary
MTP Event callback.
@@ -238,7 +238,7 @@ typedef void (*cy_as_mtp_event_callback)(
cy_as_device_handle handle,
cy_as_mtp_event evtype,
void *evdata
- ) ;
+ );
/* Summary
This is the callback function called after asynchronous API
@@ -257,7 +257,7 @@ typedef void (*cy_as_mtp_function_callback)(
cy_as_return_status_t status,
/* A client supplied 32 bit tag */
uint32_t client
-) ;
+);
/**************************************
* MTP Functions
@@ -310,7 +310,7 @@ cy_as_mtp_start(
cy_as_mtp_event_callback event_c_b,
cy_as_function_callback cb,
uint32_t client
- ) ;
+ );
/* Summary
@@ -345,7 +345,7 @@ cy_as_mtp_stop(
cy_as_device_handle handle,
cy_as_function_callback cb,
uint32_t client
- ) ;
+ );
/* Summary
This function sets up a Turbo SendObject operation.
@@ -397,7 +397,7 @@ cy_as_mtp_init_send_object(
uint32_t num_bytes,
cy_as_function_callback cb,
uint32_t client
- ) ;
+ );
/* Summary
This function cancels an ongoing MTP operation.
@@ -433,7 +433,7 @@ cy_as_mtp_cancel_send_object(
cy_as_device_handle handle,
cy_as_function_callback cb,
uint32_t client
- ) ;
+ );
/* Summary
This function sets up a turbo GetObject operation.
@@ -484,7 +484,7 @@ cy_as_mtp_init_get_object(
uint32_t transaction_id,
cy_as_function_callback cb,
uint32_t client
- ) ;
+ );
/* Summary
This function cancels an ongoing turbo GetObject
@@ -518,7 +518,7 @@ cy_as_mtp_cancel_get_object(
cy_as_device_handle handle,
cy_as_function_callback cb,
uint32_t client
- ) ;
+ );
/* Summary
This function is used to transfer a BlockTable as part of
@@ -560,7 +560,7 @@ cy_as_mtp_send_block_table(
cy_as_mtp_block_table *table,
cy_as_function_callback cb,
uint32_t client
- ) ;
+ );
/* Summary
This function is used to mark the start of a storage
diff --git a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasstorage.h b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasstorage.h
index 52d3d688a47..64f078cf202 100644
--- a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasstorage.h
+++ b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasstorage.h
@@ -300,7 +300,7 @@ typedef enum cy_as_storage_event {
* percieves an interrrupt from an SDIO card */
cy_as_sdio_interrupt
-} cy_as_storage_event ;
+} cy_as_storage_event;
/* Summary
This type gives the type of the operation in a storage
@@ -322,7 +322,7 @@ typedef enum cy_as_oper_type {
cy_as_op_read,
/* A data write operation */
cy_as_op_write
-} cy_as_oper_type ;
+} cy_as_oper_type;
/* Summary
This data structure describes a specific type of media
@@ -337,22 +337,22 @@ typedef enum cy_as_oper_type {
*/
typedef struct cy_as_device_desc {
/* Type of device */
- cy_as_media_type type ;
+ cy_as_media_type type;
/* Is the device removable */
- cy_bool removable ;
+ cy_bool removable;
/* Is the device writeable */
- cy_bool writeable ;
+ cy_bool writeable;
/* Basic block size for device */
- uint16_t block_size ;
+ uint16_t block_size;
/* Number of LUNs on the device */
- uint32_t number_units ;
+ uint32_t number_units;
/* Is the device password locked */
- cy_bool locked ;
+ cy_bool locked;
/* Size in bytes of an Erase Unit. Block erase operation
is only supported for SD storage, and the erase_unit_size
is invalid for all other kinds of storage. */
- uint32_t erase_unit_size ;
-} cy_as_device_desc ;
+ uint32_t erase_unit_size;
+} cy_as_device_desc;
/* Summary
This data structure describes a specific unit on a
@@ -368,14 +368,14 @@ typedef struct cy_as_device_desc {
*/
typedef struct cy_as_unit_desc {
/* Type of device */
- cy_as_media_type type ;
+ cy_as_media_type type;
/* Basic block size for device */
- uint16_t block_size ;
+ uint16_t block_size;
/* Physical start block for LUN */
- uint32_t start_block ;
+ uint32_t start_block;
/* Number of blocks in the LUN */
- uint32_t unit_size ;
-} cy_as_unit_desc ;
+ uint32_t unit_size;
+} cy_as_unit_desc;
/* Summary
This function type defines a callback to be called after an
@@ -404,7 +404,7 @@ typedef void (*cy_as_storage_callback)(
cy_as_oper_type op,
/* The error status */
cy_as_return_status_t status
- ) ;
+ );
/* Summary
This function type defines a callback to be called in the
@@ -436,7 +436,7 @@ typedef void (*cy_as_storage_event_callback)(
cy_as_storage_event evtype,
/* Event related data */
void *evdata
- ) ;
+ );
/* Summary
This function type defines a callback to be called after
@@ -468,7 +468,7 @@ typedef void (*cy_as_sdio_callback)(
cy_as_oper_type op,
/* The status of the operation */
cy_as_return_status_t status
- ) ;
+ );
/* Summary
Enumeration of SD/MMC card registers that can be read
@@ -486,7 +486,7 @@ typedef enum cy_as_sd_card_reg_type {
cy_as_sd_reg_OCR = 0,
cy_as_sd_reg_CID,
cy_as_sd_reg_CSD
-} cy_as_sd_card_reg_type ;
+} cy_as_sd_card_reg_type;
/* Summary
Struct encapsulating parameters and return values for a
@@ -501,12 +501,12 @@ typedef enum cy_as_sd_card_reg_type {
*/
typedef struct cy_as_storage_query_device_data {
/* The bus with the device to query */
- cy_as_bus_number_t bus ;
+ cy_as_bus_number_t bus;
/* The logical device number to query */
- uint32_t device ;
+ uint32_t device;
/* The return value for the device descriptor */
- cy_as_device_desc desc_p ;
-} cy_as_storage_query_device_data ;
+ cy_as_device_desc desc_p;
+} cy_as_storage_query_device_data;
/* Summary
@@ -522,14 +522,14 @@ typedef struct cy_as_storage_query_device_data {
*/
typedef struct cy_as_storage_query_unit_data {
/* The bus with the device to query */
- cy_as_bus_number_t bus ;
+ cy_as_bus_number_t bus;
/* The logical device number to query */
- uint32_t device ;
+ uint32_t device;
/* The unit to query on the device */
- uint32_t unit ;
+ uint32_t unit;
/* The return value for the unit descriptor */
- cy_as_unit_desc desc_p ;
-} cy_as_storage_query_unit_data ;
+ cy_as_unit_desc desc_p;
+} cy_as_storage_query_unit_data;
/* Summary
Struct encapsulating the input parameter and return
@@ -548,7 +548,7 @@ typedef struct cy_as_storage_sd_reg_read_data {
uint8_t *buf_p;
/* Length of data to be copied in bytes. */
uint8_t length;
-} cy_as_storage_sd_reg_read_data ;
+} cy_as_storage_sd_reg_read_data;
/* Summary
Controls which pins are used for card detection
@@ -564,7 +564,7 @@ typedef struct cy_as_storage_sd_reg_read_data {
typedef enum cy_as_storage_card_detect {
cy_as_storage_detect_GPIO,
cy_as_storage_detect_SDAT_3
-} cy_as_storage_card_detect ;
+} cy_as_storage_card_detect;
#ifndef __doxygen__
#define cy_as_storage_detect_GPIO_0 cy_as_storage_detect_GPIO
@@ -601,7 +601,7 @@ typedef struct cy_as_m_s_c_progress_data {
uint32_t wr_count;
/* Number of sectors read since the last event. */
uint32_t rd_count;
-} cy_as_m_s_c_progress_data ;
+} cy_as_m_s_c_progress_data;
/* Summary
Flag to set Direct Write operation to read back from the
@@ -849,7 +849,7 @@ cy_as_storage_start(
cy_as_function_callback cb,
/* Client data to be passed to the callback */
uint32_t client
- ) ;
+ );
/* Summary
This function stops the West Bridge storage module.
@@ -900,7 +900,7 @@ cy_as_storage_stop(
cy_as_function_callback cb,
/* Client data to be passed to the callback */
uint32_t client
- ) ;
+ );
/* Summary
This function is used to register a callback function
@@ -947,7 +947,7 @@ cy_as_storage_register_callback(
cy_as_device_handle handle,
/* The callback function to call for async storage events */
cy_as_storage_event_callback callback
- ) ;
+ );
/* Summary
This function claims a given media type.
@@ -1007,7 +1007,7 @@ cy_as_storage_claim(
cy_as_function_callback cb,
/* Client data to be passed to the callback */
uint32_t client
- ) ;
+ );
/* Summary
This function releases a given media type.
@@ -1060,7 +1060,7 @@ cy_as_storage_release(
cy_as_function_callback cb,
/* Client data to be passed to the callback */
uint32_t client
- ) ;
+ );
/* Summary
This function information about the number of devices present
@@ -1113,7 +1113,7 @@ cy_as_storage_query_bus(
cy_as_function_callback cb,
/* Client data to be passed to the callback */
uint32_t client
- ) ;
+ );
/* Summary
This function information about the number of devices
@@ -1167,7 +1167,7 @@ cy_as_storage_query_media(
cy_as_function_callback cb,
/* Client data to be passed to the callback */
uint32_t client
- ) ;
+ );
/* Summary
This function returns information about a given device
@@ -1224,7 +1224,7 @@ cy_as_storage_query_device(
cy_as_function_callback cb,
/* Client data to be passed to the callback */
uint32_t client
- ) ;
+ );
/* Summary
This function returns information about a given unit on a
@@ -1276,7 +1276,7 @@ cy_as_storage_query_unit(
cy_as_function_callback cb,
/* Client data to be passed to the callback */
uint32_t client
- ) ;
+ );
/* Summary
This function enables/disables the handling of SD/MMC card
@@ -1332,7 +1332,7 @@ cy_as_storage_device_control(
cy_as_function_callback cb,
/* Client data to be passed to the callback */
uint32_t client
- ) ;
+ );
/* Summary
This function reads one or more blocks of data from
@@ -1407,7 +1407,7 @@ cy_as_storage_read(
void *data_p,
/* The number of blocks to be read */
uint16_t num_blocks
- ) ;
+ );
/* Summary
This function asynchronously reads one or more blocks of data
@@ -1490,7 +1490,7 @@ cy_as_storage_read_async(
/* The function to call when the read is complete
or an error occurs */
cy_as_storage_callback callback
- ) ;
+ );
/* Summary
This function writes one or more blocks of data
@@ -1564,7 +1564,7 @@ cy_as_storage_write(
void *data_p,
/* The number of blocks to be written */
uint16_t num_blocks
- ) ;
+ );
/* Summary
This function asynchronously writes one or more blocks
@@ -1644,7 +1644,7 @@ cy_as_storage_write_async(
/* The function to call when the write is complete
or an error occurs */
cy_as_storage_callback callback
- ) ;
+ );
/* Summary
This function aborts any outstanding asynchronous operation
@@ -1681,7 +1681,7 @@ EXTERN cy_as_return_status_t
cy_as_storage_cancel_async(
/* Handle to the device with outstanding async request */
cy_as_device_handle handle
- ) ;
+ );
/* Summary
This function is used to read the content of SD registers
@@ -1732,7 +1732,7 @@ cy_as_storage_sd_register_read(
cy_as_function_callback cb,
/* Call context to send to the cb function. */
uint32_t client
- ) ;
+ );
/* Summary
Creates a partition starting at the given block and using the
@@ -1892,7 +1892,7 @@ cy_as_storage_get_transfer_amount(
cy_as_function_callback cb,
/* Client context to pass to the callback */
uint32_t client
- ) ;
+ );
/* Summary
Performs a Sector Erase on an attached SD Card
@@ -1949,7 +1949,7 @@ cy_as_storage_erase(
cy_as_function_callback cb,
/* Client context to pass to the callback */
uint32_t client
- ) ;
+ );
/* Summary
This function is used to read a Tuple from the SDIO CIS area.
diff --git a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasstorage_dep.h b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasstorage_dep.h
index 172fa85731b..566b244bd8c 100644
--- a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasstorage_dep.h
+++ b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasstorage_dep.h
@@ -43,7 +43,7 @@ typedef void (*cy_as_storage_callback_dep)(
cy_as_oper_type op,
/* The error status */
cy_as_return_status_t status
- ) ;
+ );
typedef void (*cy_as_storage_event_callback_dep)(
/* Handle to the device sending the event notification */
@@ -54,27 +54,27 @@ typedef void (*cy_as_storage_event_callback_dep)(
cy_as_storage_event evtype,
/* Event related data */
void *evdata
- ) ;
+ );
typedef struct cy_as_storage_query_device_data_dep {
/* The type of media to query */
- cy_as_media_type type ;
+ cy_as_media_type type;
/* The logical device number to query */
- uint32_t device ;
+ uint32_t device;
/* The return value for the device descriptor */
- cy_as_device_desc desc_p ;
-} cy_as_storage_query_device_data_dep ;
+ cy_as_device_desc desc_p;
+} cy_as_storage_query_device_data_dep;
typedef struct cy_as_storage_query_unit_data_dep {
/* The type of media to query */
- cy_as_media_type type ;
+ cy_as_media_type type;
/* The logical device number to query */
- uint32_t device ;
+ uint32_t device;
/* The unit to query on the device */
- uint32_t unit ;
+ uint32_t unit;
/* The return value for the unit descriptor */
- cy_as_unit_desc desc_p ;
-} cy_as_storage_query_unit_data_dep ;
+ cy_as_unit_desc desc_p;
+} cy_as_storage_query_unit_data_dep;
/************ FUNCTIONS *********************/
@@ -85,7 +85,7 @@ cy_as_storage_register_callback_dep(
cy_as_device_handle handle,
/* The callback function to call for async storage events */
cy_as_storage_event_callback_dep callback
- ) ;
+ );
EXTERN cy_as_return_status_t
cy_as_storage_claim_dep(cy_as_device_handle handle,
@@ -102,7 +102,7 @@ cy_as_storage_claim_dep_EX(
cy_as_function_callback cb,
/* Client data to be passed to the callback */
uint32_t client
- ) ;
+ );
EXTERN cy_as_return_status_t
cy_as_storage_release_dep(cy_as_device_handle handle,
@@ -119,7 +119,7 @@ cy_as_storage_release_dep_EX(
cy_as_function_callback cb,
/* Client data to be passed to the callback */
uint32_t client
- ) ;
+ );
EXTERN cy_as_return_status_t
cy_as_storage_query_device_dep(
@@ -139,7 +139,7 @@ cy_as_storage_query_device_dep_EX(
cy_as_function_callback cb,
/* Client data to be passed to the callback */
uint32_t client
- ) ;
+ );
EXTERN cy_as_return_status_t
cy_as_storage_query_unit_dep(
@@ -153,7 +153,7 @@ cy_as_storage_query_unit_dep(
uint32_t unit,
/* The return value for the unit descriptor */
cy_as_unit_desc *unit_p
- ) ;
+ );
EXTERN cy_as_return_status_t
cy_as_storage_query_unit_dep_EX(
@@ -165,7 +165,7 @@ cy_as_storage_query_unit_dep_EX(
cy_as_function_callback cb,
/* Client data to be passed to the callback */
uint32_t client
- ) ;
+ );
EXTERN cy_as_return_status_t
cy_as_storage_device_control_dep(
@@ -179,7 +179,7 @@ cy_as_storage_device_control_dep(
cy_as_function_callback cb,
/* Client data to be passed to the callback */
uint32_t client
- ) ;
+ );
EXTERN cy_as_return_status_t
@@ -198,7 +198,7 @@ cy_as_storage_read_dep(
void *data_p,
/* The number of blocks to be read */
uint16_t num_blocks
- ) ;
+ );
EXTERN cy_as_return_status_t
cy_as_storage_read_async_dep(
@@ -219,7 +219,7 @@ cy_as_storage_read_async_dep(
/* The function to call when the read is complete
or an error occurs */
cy_as_storage_callback_dep callback
- ) ;
+ );
EXTERN cy_as_return_status_t
cy_as_storage_write_dep(
/* Handle to the device of interest */
@@ -236,7 +236,7 @@ cy_as_storage_write_dep(
void *data_p,
/* The number of blocks to be written */
uint16_t num_blocks
- ) ;
+ );
EXTERN cy_as_return_status_t
cy_as_storage_write_async_dep(
@@ -257,7 +257,7 @@ cy_as_storage_write_async_dep(
/* The function to call when the write is complete
or an error occurs */
cy_as_storage_callback_dep callback
- ) ;
+ );
EXTERN cy_as_return_status_t
cy_as_storage_sd_register_read_dep(
@@ -285,7 +285,7 @@ cy_as_storage_sd_register_read_dep_EX(
cy_as_function_callback cb,
/* Call context to send to the cb function. */
uint32_t client
- ) ;
+ );
EXTERN cy_as_return_status_t
cy_as_storage_create_p_partition_dep(
@@ -294,7 +294,7 @@ cy_as_storage_create_p_partition_dep(
uint32_t device,
uint32_t size,
cy_as_function_callback cb,
- uint32_t client) ;
+ uint32_t client);
EXTERN cy_as_return_status_t
cy_as_storage_remove_p_partition_dep(
@@ -302,7 +302,7 @@ cy_as_storage_remove_p_partition_dep(
cy_as_media_type media,
uint32_t device,
cy_as_function_callback cb,
- uint32_t client) ;
+ uint32_t client);
#endif /*__doxygen*/
diff --git a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyastypes.h b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyastypes.h
index 2ccccf746a1..18043c1f38d 100644
--- a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyastypes.h
+++ b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyastypes.h
@@ -44,18 +44,18 @@ typedef void *LPVOID;
/* Summary
This type represents an endpoint number
*/
-typedef uint8_t cy_as_end_point_number_t ;
+typedef uint8_t cy_as_end_point_number_t;
/* Summary
This type is used to return status information from
an API call.
*/
-typedef uint16_t cy_as_return_status_t ;
+typedef uint16_t cy_as_return_status_t;
/* Summary
This type represents a bus number
*/
-typedef uint32_t cy_as_bus_number_t ;
+typedef uint32_t cy_as_bus_number_t;
/* Summary
All APIs provided with this release are marked extern
diff --git a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasusb.h b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasusb.h
index f066848cb7a..9049c8d9fe6 100644
--- a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasusb.h
+++ b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasusb.h
@@ -213,21 +213,21 @@
*/
typedef struct cy_as_usb_inquiry_data {
/* The bus for the event */
- cy_as_bus_number_t bus ;
+ cy_as_bus_number_t bus;
/* The device the event */
- uint32_t device ;
+ uint32_t device;
/* The EVPD bit from the SCSI INQUIRY request */
- uint8_t evpd ;
+ uint8_t evpd;
/* The codepage in the inquiry request */
- uint8_t codepage ;
+ uint8_t codepage;
/* This bool must be set to CyTrue indicate that the inquiry
data was changed */
- cy_bool updated ;
+ cy_bool updated;
/* The length of the data */
- uint16_t length ;
+ uint16_t length;
/* The inquiry data */
- void *data ;
-} cy_as_usb_inquiry_data ;
+ void *data;
+} cy_as_usb_inquiry_data;
/* Summary
@@ -260,23 +260,23 @@ typedef struct cy_as_usb_inquiry_data {
*/
typedef struct cy_as_usb_unknown_command_data {
/* The bus for the event */
- cy_as_bus_number_t bus ;
+ cy_as_bus_number_t bus;
/* The device for the event */
- uint32_t device ;
+ uint32_t device;
- uint16_t reqlen ;
+ uint16_t reqlen;
/* The request */
- void *request ;
+ void *request;
/* The returned status value for the command */
- uint8_t status ;
+ uint8_t status;
/* If status is failed, the sense key */
- uint8_t key ;
+ uint8_t key;
/* If status is failed, the additional sense code */
- uint8_t asc ;
+ uint8_t asc;
/* If status if failed, the additional sense code qualifier */
- uint8_t ascq ;
-} cy_as_usb_unknown_command_data ;
+ uint8_t ascq;
+} cy_as_usb_unknown_command_data;
/* Summary
@@ -293,14 +293,14 @@ typedef struct cy_as_usb_unknown_command_data {
*/
typedef struct cy_as_usb_start_stop_data {
/* The bus for the event */
- cy_as_bus_number_t bus ;
+ cy_as_bus_number_t bus;
/* The device for the event */
- uint32_t device ;
+ uint32_t device;
/* CyTrue means start request, CyFalse means stop request */
- cy_bool start ;
+ cy_bool start;
/* CyTrue means LoEj bit set, otherwise false */
- cy_bool loej ;
-} cy_as_usb_start_stop_data ;
+ cy_bool loej;
+} cy_as_usb_start_stop_data;
/* Summary
This data type is used to indicate which mass storage devices
@@ -317,7 +317,7 @@ typedef enum cy_as_usb_mass_storage_enum {
cy_as_usb_sd_enum = 0x02,
cy_as_usb_mmc_enum = 0x04,
cy_as_usb_ce_ata_enum = 0x08
-} cy_as_usb_mass_storage_enum ;
+} cy_as_usb_mass_storage_enum;
/* Summary
This data type specifies the type of descriptor to transfer
@@ -349,7 +349,7 @@ typedef enum cy_as_usb_desc_type {
* See USB 2.0 specification Chapter 9 */
cy_as_usb_desc_h_s_configuration = 4,
cy_as_usb_desc_string = 5
-} cy_as_usb_desc_type ;
+} cy_as_usb_desc_type;
/* Summary
This type specifies the direction of an endpoint
@@ -371,7 +371,7 @@ typedef enum cy_as_usb_end_point_dir {
cy_as_usb_out = 1,
/* The endpoint direction is IN/OUT (valid only for EP 0 & 1) */
cy_as_usb_in_out = 2
-} cy_as_usb_end_point_dir ;
+} cy_as_usb_end_point_dir;
/* Summary
This type specifies the type of an endpoint
@@ -390,7 +390,7 @@ typedef enum cy_as_usb_end_point_type {
cy_as_usb_iso,
cy_as_usb_bulk,
cy_as_usb_int
-} cy_as_usb_end_point_type ;
+} cy_as_usb_end_point_type;
/* Summary
This type is a structure used to indicate the top level
@@ -418,20 +418,20 @@ typedef struct cy_as_usb_enum_control {
* is false the P port controls enumeration. if the P port
* is controlling enumeration, traffic will be received via
* endpoint zero. */
- cy_bool antioch_enumeration ;
+ cy_bool antioch_enumeration;
/* This is the interface # to use for the mass storage
* interface, if mass storage is enumerated. if mass
* storage is not enumerated this value should be zero. */
- uint8_t mass_storage_interface ;
+ uint8_t mass_storage_interface;
/* This is the interface # to use for the MTP interface,
* if MTP is enumerated. if MTP is not enumerated
* this value should be zero. */
- uint8_t mtp_interface ;
+ uint8_t mtp_interface;
/* If true, Inquiry, START/STOP, and unknown mass storage
* requests cause a callback to occur for handling by the
* baseband processor. */
- cy_bool mass_storage_callbacks ;
-} cy_as_usb_enum_control ;
+ cy_bool mass_storage_callbacks;
+} cy_as_usb_enum_control;
/* Summary
@@ -448,16 +448,16 @@ typedef struct cy_as_usb_enum_control {
*/
typedef struct cy_as_usb_end_point_config {
/* If true, this endpoint is enabled */
- cy_bool enabled ;
+ cy_bool enabled;
/* The direction of this endpoint */
- cy_as_usb_end_point_dir dir ;
+ cy_as_usb_end_point_dir dir;
/* The type of endpoint */
- cy_as_usb_end_point_type type ;
+ cy_as_usb_end_point_type type;
/* The physical endpoint #, 1, 2, 3, 4 */
- cy_as_end_point_number_t physical ;
+ cy_as_end_point_number_t physical;
/* The size of the endpoint in bytes */
- uint16_t size ;
-} cy_as_usb_end_point_config ;
+ uint16_t size;
+} cy_as_usb_end_point_config;
/* Summary
List of partition enumeration combinations that can
@@ -484,7 +484,7 @@ typedef enum cy_as_usb_m_s_type_t {
cy_as_usb_m_s_unit1,
/* Enumerate both units */
cy_as_usb_m_s_both
-} cy_as_usb_m_s_type_t ;
+} cy_as_usb_m_s_type_t;
/* Summary
This type specifies the type of USB event that has occurred
@@ -574,7 +574,7 @@ typedef void (*cy_as_usb_event_callback)(
cy_as_usb_event ev,
/* The data assocaited with the event being reported */
void *evdata
-) ;
+);
/* Summary
@@ -602,7 +602,7 @@ typedef void (*cy_as_usb_io_callback)(
void *buffer,
/* The error status of the operation */
cy_as_return_status_t status
-) ;
+);
/* Summary
This type is the callback function called after asynchronous
@@ -621,7 +621,7 @@ typedef void (*cy_as_usb_function_callback)(
cy_as_return_status_t status,
/* A client supplied 32 bit tag */
uint32_t client
-) ;
+);
/********************************************
@@ -668,7 +668,7 @@ cy_as_usb_start(
cy_as_function_callback cb,
/* Client supplied data */
uint32_t client
- ) ;
+ );
/* Summary
This function stops the USB stack
@@ -713,7 +713,7 @@ cy_as_usb_stop(
cy_as_function_callback cb,
/* Client supplied data */
uint32_t client
- ) ;
+ );
/* Summary
This function registers a callback function to be called when an
@@ -732,7 +732,7 @@ cy_as_usb_register_callback(
cy_as_device_handle handle,
/* The function to call */
cy_as_usb_event_callback callback
- ) ;
+ );
/* Summary
@@ -772,7 +772,7 @@ cy_as_usb_connect(
cy_as_function_callback cb,
/* Client supplied data */
uint32_t client
- ) ;
+ );
/* Summary
This function disconnects the West Bridge device D+ and D-
@@ -811,7 +811,7 @@ cy_as_usb_disconnect(
cy_as_function_callback cb,
/* Client supplied data */
uint32_t client
- ) ;
+ );
/* Summary
This function configures the USB stack
@@ -848,7 +848,7 @@ cy_as_usb_set_enum_config(
cy_as_function_callback cb,
/* Client supplied data */
uint32_t client
- ) ;
+ );
/* Summary
This function retreives the current configuration of
@@ -884,7 +884,7 @@ cy_as_usb_get_enum_config(
cy_as_function_callback cb,
/* Client supplied data */
uint32_t client
- ) ;
+ );
/* Summary
This function sets the USB descriptor
@@ -942,7 +942,7 @@ cy_as_usb_set_descriptor(
cy_as_function_callback cb,
/* Client supplied data */
uint32_t client
- ) ;
+ );
/* Summary
This function clears all user descriptors stored
@@ -985,7 +985,7 @@ cy_as_usb_clear_descriptors(
cy_as_function_callback cb,
/* Client supplied data */
uint32_t client
- ) ;
+ );
/* Summary
This structure contains the descriptor buffer to be
filled by CyAsUsbGetDescriptor API.
@@ -1008,7 +1008,7 @@ typedef struct cy_as_get_descriptor_data {
* actually returned. */
uint32_t length;
-} cy_as_get_descriptor_data ;
+} cy_as_get_descriptor_data;
/* Summary
This function retreives a given descriptor from the
@@ -1059,7 +1059,7 @@ cy_as_usb_get_descriptor(
cy_as_function_callback cb,
/* Client supplied data */
uint32_t client
- ) ;
+ );
/* Summary
This function sets the configuration of the physical
@@ -1123,7 +1123,7 @@ cy_as_usb_set_physical_configuration(
cy_as_device_handle handle,
/* The physical endpoint configuration number */
uint8_t config
- ) ;
+ );
/* Summary
This function sets the hardware configuration for a given endpoint
@@ -1166,7 +1166,7 @@ cy_as_usb_set_end_point_config(
cy_as_end_point_number_t ep,
/* The configuration information for the endpoint */
cy_as_usb_end_point_config *config_p
- ) ;
+ );
/* Summary
This function retreives the hardware configuration for
@@ -1205,7 +1205,7 @@ cy_as_usb_get_end_point_config(
/* The return value containing the endpoint config
* information */
cy_as_usb_end_point_config *config_p
- ) ;
+ );
/* Summary
This function commits the configuration information that
@@ -1251,7 +1251,7 @@ cy_as_usb_commit_config(
cy_as_function_callback cb,
/* Client supplied data */
uint32_t client
- ) ;
+ );
/* Summary
This function reads data from a USB endpoint.
@@ -1294,7 +1294,7 @@ cy_as_usb_read_data(
uint32_t *dataread,
/* The buffer to hold the data read */
void *data
- ) ;
+ );
/* Summary
This function reads data from a USB endpoint
@@ -1337,7 +1337,7 @@ cy_as_usb_read_data_async(
void *data,
/* The callback function to call when the data is read */
cy_as_usb_io_callback callback
- ) ;
+ );
/* Summary
This function writes data to a USB endpoint
@@ -1377,7 +1377,7 @@ cy_as_usb_write_data(
uint32_t dsize,
/* The data buffer */
void *data
- ) ;
+ );
/* Summary
This function writes data to a USB endpoint
@@ -1421,7 +1421,7 @@ cy_as_usb_write_data_async(
cy_bool spacket,
/* The callback to call when the data is written */
cy_as_usb_io_callback callback
- ) ;
+ );
/* Summary
This function aborts an outstanding asynchronous
@@ -1453,7 +1453,7 @@ cy_as_usb_cancel_async(
cy_as_device_handle handle,
/* The endpoint of interest */
cy_as_end_point_number_t ep
- ) ;
+ );
/* Summary
This function sets a stall condition on a given endpoint
@@ -1495,7 +1495,7 @@ cy_as_usb_set_stall(
cy_as_function_callback cb,
/* Client supplied data */
uint32_t client
-) ;
+);
/* Summary
This function clears a stall condition on a given endpoint
@@ -1538,7 +1538,7 @@ cy_as_usb_clear_stall(
cy_as_function_callback cb,
/* Client supplied data */
uint32_t client
- ) ;
+ );
/* Summary
@@ -1580,7 +1580,7 @@ cy_as_usb_get_stall(
cy_as_function_callback cb,
/* Client supplied data */
uint32_t client
- ) ;
+ );
/* Summary
This function sets a NAK condition on a given endpoint
@@ -1622,7 +1622,7 @@ cy_as_usb_set_nak(
cy_as_function_callback cb,
/* Client supplied data */
uint32_t client
-) ;
+);
/* Summary
This function clears a NAK condition on a given endpoint
@@ -1664,7 +1664,7 @@ cy_as_usb_clear_nak(
cy_as_function_callback cb,
/* Client supplied data */
uint32_t client
- ) ;
+ );
/* Summary
This function returns the NAK status for a given endpoint
@@ -1703,7 +1703,7 @@ cy_as_usb_get_nak(
cy_as_function_callback cb,
/* Client supplied data */
uint32_t client
-) ;
+);
/* Summary
This function triggers a USB remote wakeup from the Processor
@@ -1736,7 +1736,7 @@ cy_as_usb_signal_remote_wakeup(
cy_as_function_callback cb,
/* Client supplied data */
uint32_t client
- ) ;
+ );
/* Summary
This function sets the threshold levels for mass storage progress
@@ -1784,7 +1784,7 @@ cy_as_usb_set_m_s_report_threshold(
cy_as_function_callback cb,
/* Client supplied data */
uint32_t client
- ) ;
+ );
/* Summary
Specify which of the partitions on a partitioned mass storage
@@ -1846,13 +1846,13 @@ cy_as_usb_select_m_s_partitions(
);
extern cy_as_media_type
-cy_as_storage_get_media_from_address(uint16_t v) ;
+cy_as_storage_get_media_from_address(uint16_t v);
extern cy_as_bus_number_t
-cy_as_storage_get_bus_from_address(uint16_t v) ;
+cy_as_storage_get_bus_from_address(uint16_t v);
extern uint32_t
-cy_as_storage_get_device_from_address(uint16_t v) ;
+cy_as_storage_get_device_from_address(uint16_t v);
/* For supporting deprecated functions */
#include "cyasusb_dep.h"
diff --git a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasusb_dep.h b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasusb_dep.h
index 0ee18e8ba1b..829eddee39b 100644
--- a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasusb_dep.h
+++ b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasusb_dep.h
@@ -37,66 +37,66 @@
typedef struct cy_as_usb_inquiry_data_dep {
/* The media for the event */
- cy_as_media_type media ;
+ cy_as_media_type media;
/* The EVPD bit from the SCSI INQUIRY request */
- uint8_t evpd ;
+ uint8_t evpd;
/* The codepage in the inquiry request */
- uint8_t codepage ;
+ uint8_t codepage;
/* This bool must be set to CyTrue indicate
* that the inquiry data was changed */
- cy_bool updated ;
+ cy_bool updated;
/* The length of the data */
- uint16_t length ;
+ uint16_t length;
/* The inquiry data */
- void *data ;
-} cy_as_usb_inquiry_data_dep ;
+ void *data;
+} cy_as_usb_inquiry_data_dep;
typedef struct cy_as_usb_unknown_command_data_dep {
/* The media for the event */
- cy_as_media_type media ;
+ cy_as_media_type media;
/* The length of the requst (should be 16 bytes) */
- uint16_t reqlen ;
+ uint16_t reqlen;
/* The request */
- void *request ;
+ void *request;
/* The returned status value for the command */
- uint8_t status ;
+ uint8_t status;
/* If status is failed, the sense key */
- uint8_t key ;
+ uint8_t key;
/* If status is failed, the additional sense code */
- uint8_t asc ;
+ uint8_t asc;
/* If status if failed, the additional sense code qualifier */
- uint8_t ascq ;
-} cy_as_usb_unknown_command_data_dep ;
+ uint8_t ascq;
+} cy_as_usb_unknown_command_data_dep;
typedef struct cy_as_usb_start_stop_data_dep {
/* The media type for the event */
- cy_as_media_type media ;
+ cy_as_media_type media;
/* CyTrue means start request, CyFalse means stop request */
- cy_bool start ;
+ cy_bool start;
/* CyTrue means LoEj bit set, otherwise false */
- cy_bool loej ;
-} cy_as_usb_start_stop_data_dep ;
+ cy_bool loej;
+} cy_as_usb_start_stop_data_dep;
typedef struct cy_as_usb_enum_control_dep {
/* The bits in this member determine which mass storage devices
are enumerated. see cy_as_usb_mass_storage_enum for more details. */
- uint8_t enum_mass_storage ;
+ uint8_t enum_mass_storage;
/* If true, West Bridge will control enumeration. If this is false the
pport controls enumeration. if the P port is controlling
enumeration, traffic will be received via endpoint zero. */
- cy_bool antioch_enumeration ;
+ cy_bool antioch_enumeration;
/* This is the interface # to use for the mass storage interface,
if mass storage is enumerated. if mass storage is not enumerated
this value should be zero. */
- uint8_t mass_storage_interface ;
+ uint8_t mass_storage_interface;
/* If true, Inquiry, START/STOP, and unknown mass storage
requests cause a callback to occur for handling by the
baseband processor. */
- cy_bool mass_storage_callbacks ;
-} cy_as_usb_enum_control_dep ;
+ cy_bool mass_storage_callbacks;
+} cy_as_usb_enum_control_dep;
typedef void (*cy_as_usb_event_callback_dep)(
@@ -106,7 +106,7 @@ typedef void (*cy_as_usb_event_callback_dep)(
cy_as_usb_event ev,
/* The data assocaited with the event being reported */
void *evdata
-) ;
+);
@@ -117,7 +117,7 @@ cy_as_usb_register_callback_dep(
cy_as_device_handle handle,
/* The function to call */
cy_as_usb_event_callback_dep callback
- ) ;
+ );
extern cy_as_return_status_t
@@ -130,7 +130,7 @@ cy_as_usb_set_enum_config_dep(
cy_as_function_callback cb,
/* Client supplied data */
uint32_t client
- ) ;
+ );
extern cy_as_return_status_t
@@ -143,7 +143,7 @@ cy_as_usb_get_enum_config_dep(
cy_as_function_callback cb,
/* Client supplied data */
uint32_t client
- ) ;
+ );
extern cy_as_return_status_t
cy_as_usb_get_descriptor_dep(
@@ -159,7 +159,7 @@ cy_as_usb_get_descriptor_dep(
points to a uint32_t that contains the length of the buffer. after
the call, this value contains the amount of data actually returned. */
uint32_t *length_p
- ) ;
+ );
extern cy_as_return_status_t
cy_as_usb_set_stall_dep(
@@ -171,7 +171,7 @@ cy_as_usb_set_stall_dep(
cy_as_usb_function_callback cb,
/* Client supplied data */
uint32_t client
-) ;
+);
EXTERN cy_as_return_status_t
cy_as_usb_clear_stall_dep(
@@ -183,7 +183,7 @@ cy_as_usb_clear_stall_dep(
cy_as_usb_function_callback cb,
/* Client supplied data */
uint32_t client
- ) ;
+ );
EXTERN cy_as_return_status_t
cy_as_usb_set_nak_dep(
@@ -195,7 +195,7 @@ cy_as_usb_set_nak_dep(
cy_as_usb_function_callback cb,
/* Client supplied data */
uint32_t client
-) ;
+);
EXTERN cy_as_return_status_t
cy_as_usb_clear_nak_dep(
@@ -207,7 +207,7 @@ cy_as_usb_clear_nak_dep(
cy_as_usb_function_callback cb,
/* Client supplied data */
uint32_t client
- ) ;
+ );
EXTERN cy_as_return_status_t
cy_as_usb_select_m_s_partitions_dep(
@@ -217,7 +217,7 @@ cy_as_usb_select_m_s_partitions_dep(
cy_as_usb_m_s_type_t type,
cy_as_function_callback cb,
uint32_t client
- ) ;
+ );
#endif /*__doxygen*/