Commit 0769c38d authored by David Cross's avatar David Cross Committed by Greg Kroah-Hartman

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: default avatarDavid Cross <david.cross@cypress.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 9ebed608
...@@ -32,13 +32,13 @@ static void ...@@ -32,13 +32,13 @@ static void
cy_as_dma_add_request_to_free_queue(cy_as_device *dev_p, cy_as_dma_add_request_to_free_queue(cy_as_device *dev_p,
cy_as_dma_queue_entry *req_p) cy_as_dma_queue_entry *req_p)
{ {
uint32_t imask ; uint32_t imask;
imask = cy_as_hal_disable_interrupts() ; imask = cy_as_hal_disable_interrupts();
req_p->next_p = dev_p->dma_freelist_p ; req_p->next_p = dev_p->dma_freelist_p;
dev_p->dma_freelist_p = req_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, ...@@ -47,17 +47,17 @@ cy_as_dma_add_request_to_free_queue(cy_as_device *dev_p,
static cy_as_dma_queue_entry * static cy_as_dma_queue_entry *
cy_as_dma_get_dma_queue_entry(cy_as_device *dev_p) cy_as_dma_get_dma_queue_entry(cy_as_device *dev_p)
{ {
cy_as_dma_queue_entry *req_p ; cy_as_dma_queue_entry *req_p;
uint32_t imask ; 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() ; imask = cy_as_hal_disable_interrupts();
req_p = dev_p->dma_freelist_p ; req_p = dev_p->dma_freelist_p;
dev_p->dma_freelist_p = req_p->next_p ; dev_p->dma_freelist_p = req_p->next_p;
cy_as_hal_enable_interrupts(imask) ; 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, ...@@ -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. */ /* In MTP mode, EP2 is allowed to have all max sizes. */
if ((!dev_p->is_mtp_firmware) || (ep != 0x02)) { if ((!dev_p->is_mtp_firmware) || (ep != 0x02)) {
if (size < 64 || size > 1024) 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 ; CY_AS_NUM_EP(dev_p, ep)->maxhwdata = (uint16_t)size;
return CY_AS_ERROR_SUCCESS ; return CY_AS_ERROR_SUCCESS;
} }
/* /*
...@@ -96,13 +96,13 @@ cy_as_dma_request_callback( ...@@ -96,13 +96,13 @@ cy_as_dma_request_callback(
cy_as_ll_request_response *resp_p, cy_as_ll_request_response *resp_p,
cy_as_return_status_t ret) cy_as_return_status_t ret)
{ {
uint16_t v ; uint16_t v;
uint16_t datacnt ; uint16_t datacnt;
cy_as_end_point_number_t ep ; 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 * extract the return code from the firmware
...@@ -110,17 +110,17 @@ cy_as_dma_request_callback( ...@@ -110,17 +110,17 @@ cy_as_dma_request_callback(
if (ret == CY_AS_ERROR_SUCCESS) { if (ret == CY_AS_ERROR_SUCCESS) {
if (cy_as_ll_request_response__get_code(resp_p) != if (cy_as_ll_request_response__get_code(resp_p) !=
CY_RESP_SUCCESS_FAILURE) CY_RESP_SUCCESS_FAILURE)
ret = CY_AS_ERROR_INVALID_RESPONSE ; ret = CY_AS_ERROR_INVALID_RESPONSE;
else 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 * extract the endpoint number and the transferred byte count
* from the request. * from the request.
*/ */
v = cy_as_ll_request_response__get_word(req_p, 0) ; v = cy_as_ll_request_response__get_word(req_p, 0);
ep = (cy_as_end_point_number_t)((v >> 13) & 0x01) ; ep = (cy_as_end_point_number_t)((v >> 13) & 0x01);
if (ret == CY_AS_ERROR_SUCCESS) { if (ret == CY_AS_ERROR_SUCCESS) {
/* /*
...@@ -129,12 +129,12 @@ cy_as_dma_request_callback( ...@@ -129,12 +129,12 @@ cy_as_dma_request_callback(
* transferred. there are no partial * transferred. there are no partial
* transfers. * transfers.
*/ */
datacnt = v & 0x3FF ; datacnt = v & 0x3FF;
} else { } else {
/* /*
* if the firmware returned an error, no data was transferred. * if the firmware returned an error, no data was transferred.
*/ */
datacnt = 0 ; datacnt = 0;
} }
/* /*
...@@ -142,11 +142,11 @@ cy_as_dma_request_callback( ...@@ -142,11 +142,11 @@ cy_as_dma_request_callback(
* next EP0 or EP1 request. * next EP0 or EP1 request.
*/ */
if (ep == 0) { if (ep == 0) {
dev_p->usb_ep0_dma_req = req_p ; dev_p->usb_ep0_dma_req = req_p;
dev_p->usb_ep0_dma_resp = resp_p ; dev_p->usb_ep0_dma_resp = resp_p;
} else { } else {
dev_p->usb_ep1_dma_req = req_p ; dev_p->usb_ep1_dma_req = req_p;
dev_p->usb_ep1_dma_resp = resp_p ; dev_p->usb_ep1_dma_resp = resp_p;
} }
/* /*
...@@ -159,7 +159,7 @@ cy_as_dma_request_callback( ...@@ -159,7 +159,7 @@ cy_as_dma_request_callback(
* function. * function.
*/ */
if (ret != CY_AS_ERROR_CANCELED) 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 ...@@ -171,35 +171,35 @@ static void
cy_as_dma_set_drq(cy_as_device *dev_p, cy_as_dma_set_drq(cy_as_device *dev_p,
cy_as_end_point_number_t ep, cy_bool state) cy_as_end_point_number_t ep, cy_bool state)
{ {
uint16_t mask ; uint16_t mask;
uint16_t v ; uint16_t v;
uint32_t intval ; uint32_t intval;
/* /*
* there are not DRQ register bits for EP0 and EP1 * there are not DRQ register bits for EP0 and EP1
*/ */
if (ep == 0 || ep == 1) if (ep == 0 || ep == 1)
return ; return;
/* /*
* disable interrupts while we do this to be sure the state of the * disable interrupts while we do this to be sure the state of the
* DRQ mask register is always well defined. * 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 * set the DRQ bit to the given state for the ep given
*/ */
mask = (1 << ep) ; mask = (1 << ep);
v = cy_as_hal_read_register(dev_p->tag, CY_AS_MEM_P0_DRQ_MASK) ; v = cy_as_hal_read_register(dev_p->tag, CY_AS_MEM_P0_DRQ_MASK);
if (state) if (state)
v |= mask ; v |= mask;
else else
v &= ~mask ; v &= ~mask;
cy_as_hal_write_register(dev_p->tag, CY_AS_MEM_P0_DRQ_MASK, v) ; cy_as_hal_write_register(dev_p->tag, CY_AS_MEM_P0_DRQ_MASK, v);
cy_as_hal_enable_interrupts(intval) ; cy_as_hal_enable_interrupts(intval);
} }
/* /*
...@@ -208,14 +208,14 @@ cy_as_dma_set_drq(cy_as_device *dev_p, ...@@ -208,14 +208,14 @@ cy_as_dma_set_drq(cy_as_device *dev_p,
static void static void
cy_as_dma_send_next_dma_request(cy_as_device *dev_p, cy_as_dma_end_point *ep_p) cy_as_dma_send_next_dma_request(cy_as_device *dev_p, cy_as_dma_end_point *ep_p)
{ {
uint32_t datacnt ; uint32_t datacnt;
void *buf_p ; void *buf_p;
cy_as_dma_queue_entry *dma_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 */ /* If the queue is empty, nothing to do */
dma_p = ep_p->queue_p ; dma_p = ep_p->queue_p;
if (dma_p == 0) { if (dma_p == 0) {
/* /*
* there are no pending DMA requests * 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) ...@@ -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 * will be triggered by this endpoint
* until someone is interested in the data. * until someone is interested in the data.
*/ */
cy_as_dma_set_drq(dev_p, ep_p->ep, cy_false) ; cy_as_dma_set_drq(dev_p, ep_p->ep, cy_false);
return ; 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 * get the number of words that still
* need to be xferred in this request. * need to be xferred in this request.
*/ */
datacnt = dma_p->size - dma_p->offset ; datacnt = dma_p->size - dma_p->offset;
cy_as_hal_assert(datacnt >= 0) ; cy_as_hal_assert(datacnt >= 0);
/* /*
* the HAL layer should never limit the size * 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) ...@@ -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. * in packets that are not correct in size.
*/ */
cy_as_hal_assert(ep_p->maxhaldata == CY_AS_DMA_MAX_SIZE_HW_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 * 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) ...@@ -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 (ep_p->maxhaldata == CY_AS_DMA_MAX_SIZE_HW_SIZE) {
if (datacnt > ep_p->maxhwdata) if (datacnt > ep_p->maxhwdata)
datacnt = ep_p->maxhwdata ; datacnt = ep_p->maxhwdata;
} else { } else {
if (datacnt > ep_p->maxhaldata) 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) ...@@ -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 * 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) { 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) ...@@ -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. * the data back into the DMA module.
*/ */
if (dma_p->readreq == cy_false) { if (dma_p->readreq == cy_false) {
uint16_t v ; uint16_t v;
uint16_t len ; uint16_t len;
cy_as_ll_request_response *resp_p ; cy_as_ll_request_response *resp_p;
cy_as_ll_request_response *req_p ; cy_as_ll_request_response *req_p;
cy_as_return_status_t ret ; cy_as_return_status_t ret;
len = (uint16_t)(datacnt / 2) ; len = (uint16_t)(datacnt / 2);
if (datacnt % 2) if (datacnt % 2)
len++ ; len++;
len++ ; len++;
if (ep_p->ep == 0) { if (ep_p->ep == 0) {
req_p = dev_p->usb_ep0_dma_req ; req_p = dev_p->usb_ep0_dma_req;
resp_p = dev_p->usb_ep0_dma_resp ; resp_p = dev_p->usb_ep0_dma_resp;
dev_p->usb_ep0_dma_req = 0 ; dev_p->usb_ep0_dma_req = 0;
dev_p->usb_ep0_dma_resp = 0 ; dev_p->usb_ep0_dma_resp = 0;
} else { } else {
req_p = dev_p->usb_ep1_dma_req ; req_p = dev_p->usb_ep1_dma_req;
resp_p = dev_p->usb_ep1_dma_resp ; resp_p = dev_p->usb_ep1_dma_resp;
dev_p->usb_ep1_dma_req = 0 ; dev_p->usb_ep1_dma_req = 0;
dev_p->usb_ep1_dma_resp = 0 ; dev_p->usb_ep1_dma_resp = 0;
} }
cy_as_hal_assert(req_p != 0) ; cy_as_hal_assert(req_p != 0);
cy_as_hal_assert(resp_p != 0) ; cy_as_hal_assert(resp_p != 0);
cy_as_hal_assert(len <= 64) ; cy_as_hal_assert(len <= 64);
cy_as_ll_init_request(req_p, CY_RQT_USB_EP_DATA, 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) 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) 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, 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, 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) if (ret == CY_AS_ERROR_SUCCESS)
cy_as_log_debug_message(5, cy_as_log_debug_message(5,
"+++ send EP 0/1 data via mailbox registers") ; "+++ send EP 0/1 data via mailbox registers");
else else
cy_as_log_debug_message(5, cy_as_log_debug_message(5,
"+++ error sending EP 0/1 data via mailbox " "+++ error sending EP 0/1 data via mailbox "
"registers - CY_AS_ERROR_TIMEOUT") ; "registers - CY_AS_ERROR_TIMEOUT");
if (ret != CY_AS_ERROR_SUCCESS) if (ret != CY_AS_ERROR_SUCCESS)
cy_as_dma_completed_callback(dev_p->tag, cy_as_dma_completed_callback(dev_p->tag,
ep_p->ep, 0, ret) ; ep_p->ep, 0, ret);
} }
} else { } else {
/* /*
...@@ -353,16 +353,16 @@ cy_as_dma_send_next_dma_request(cy_as_device *dev_p, cy_as_dma_end_point *ep_p) ...@@ -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)) if (cy_as_dma_end_point_is_direction_in(ep_p))
cy_as_hal_dma_setup_write(dev_p->tag, 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 else
cy_as_hal_dma_setup_read(dev_p->tag, 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 * the DRQ interrupt for this endpoint should be enabled
* so that the data transfer progresses at interrupt time. * 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 ...@@ -377,27 +377,27 @@ void
cy_as_dma_completed_callback(cy_as_hal_device_tag tag, 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) cy_as_end_point_number_t ep, uint32_t cnt, cy_as_return_status_t status)
{ {
uint32_t mask ; uint32_t mask;
cy_as_dma_queue_entry *req_p ; cy_as_dma_queue_entry *req_p;
cy_as_dma_end_point *ep_p ; cy_as_dma_end_point *ep_p;
cy_as_device *dev_p = cy_as_device_find_from_tag(tag) ; cy_as_device *dev_p = cy_as_device_find_from_tag(tag);
/* Make sure the HAL layer gave us good parameters */ /* Make sure the HAL layer gave us good parameters */
cy_as_hal_assert(dev_p != 0) ; cy_as_hal_assert(dev_p != 0);
cy_as_hal_assert(dev_p->sig == CY_AS_DEVICE_HANDLE_SIGNATURE) ; cy_as_hal_assert(dev_p->sig == CY_AS_DEVICE_HANDLE_SIGNATURE);
cy_as_hal_assert(ep < 16) ; cy_as_hal_assert(ep < 16);
/* Get the endpoint ptr */ /* Get the endpoint ptr */
ep_p = CY_AS_NUM_EP(dev_p, ep) ; ep_p = CY_AS_NUM_EP(dev_p, ep);
cy_as_hal_assert(ep_p->queue_p != 0) ; cy_as_hal_assert(ep_p->queue_p != 0);
/* Get a pointer to the current entry in the queue */ /* Get a pointer to the current entry in the queue */
mask = cy_as_hal_disable_interrupts() ; mask = cy_as_hal_disable_interrupts();
req_p = ep_p->queue_p ; req_p = ep_p->queue_p;
/* Update the offset to reflect the data actually received or sent */ /* 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, * if we are still sending/receiving the current packet,
...@@ -422,7 +422,7 @@ cy_as_dma_completed_callback(cy_as_hal_device_tag tag, ...@@ -422,7 +422,7 @@ cy_as_dma_completed_callback(cy_as_hal_device_tag tag,
((ep != CY_AS_MTP_READ_ENDPOINT) || ((ep != CY_AS_MTP_READ_ENDPOINT) ||
(cnt == dev_p->usb_max_tx_size))))) (cnt == dev_p->usb_max_tx_size)))))
|| ((ep == 1) && (status == CY_AS_ERROR_TIMEOUT))) { || ((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 * 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, ...@@ -433,9 +433,9 @@ cy_as_dma_completed_callback(cy_as_hal_device_tag tag,
if ((ep == CY_AS_MTP_WRITE_ENDPOINT) || ( if ((ep == CY_AS_MTP_WRITE_ENDPOINT) || (
(ep == CY_AS_MTP_READ_ENDPOINT) && (ep == CY_AS_MTP_READ_ENDPOINT) &&
(!cy_as_dma_end_point_is_direction_in(ep_p)))) (!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 else
cy_as_dma_send_next_dma_request(dev_p, ep_p) ; cy_as_dma_send_next_dma_request(dev_p, ep_p);
} else { } else {
/* /*
* we get here if ... * we get here if ...
...@@ -449,18 +449,18 @@ cy_as_dma_completed_callback(cy_as_hal_device_tag tag, ...@@ -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. * remove this entry from the DMA queue for this endpoint.
*/ */
cy_as_dma_end_point_clear_in_transit(ep_p) ; cy_as_dma_end_point_clear_in_transit(ep_p);
ep_p->queue_p = req_p->next_p ; ep_p->queue_p = req_p->next_p;
if (ep_p->last_p == req_p) { if (ep_p->last_p == req_p) {
/* /*
* we have removed the last packet from the DMA queue, * we have removed the last packet from the DMA queue,
* disable the interrupt associated with this interrupt. * disable the interrupt associated with this interrupt.
*/ */
ep_p->last_p = 0 ; ep_p->last_p = 0;
cy_as_hal_enable_interrupts(mask) ; cy_as_hal_enable_interrupts(mask);
cy_as_dma_set_drq(dev_p, ep, cy_false) ; cy_as_dma_set_drq(dev_p, ep, cy_false);
} else } else
cy_as_hal_enable_interrupts(mask) ; cy_as_hal_enable_interrupts(mask);
if (req_p->cb) { if (req_p->cb) {
/* /*
...@@ -472,32 +472,32 @@ cy_as_dma_completed_callback(cy_as_hal_device_tag tag, ...@@ -472,32 +472,32 @@ cy_as_dma_completed_callback(cy_as_hal_device_tag tag,
* cannot recursively call an API function that is * cannot recursively call an API function that is
* synchronous only from a callback. * 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->cb)(dev_p, ep, req_p->buf_p,
req_p->offset, status) ; req_p->offset, status);
cy_as_device_clear_in_callback(dev_p) ; cy_as_device_clear_in_callback(dev_p);
} }
/* /*
* we are done with this request, put it on the freelist to be * we are done with this request, put it on the freelist to be
* reused at a later time. * 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 (ep_p->queue_p == 0) {
/* /*
* if the endpoint is out of DMA entries, set the * if the endpoint is out of DMA entries, set the
* endpoint as stopped. * 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 DMA queue is empty, wake any task waiting on
* the QUEUE to drain. * the QUEUE to drain.
*/ */
if (cy_as_dma_end_point_is_sleeping(ep_p)) { if (cy_as_dma_end_point_is_sleeping(ep_p)) {
cy_as_dma_end_point_set_wake_state(ep_p) ; cy_as_dma_end_point_set_wake_state(ep_p);
cy_as_hal_wake(&ep_p->channel) ; cy_as_hal_wake(&ep_p->channel);
} }
} else { } else {
/* /*
...@@ -512,9 +512,9 @@ cy_as_dma_completed_callback(cy_as_hal_device_tag tag, ...@@ -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))) (!cy_as_device_is_p2s_dma_start_recvd(dev_p)))
|| ((ep == dev_p->storage_write_endpoint) && || ((ep == dev_p->storage_write_endpoint) &&
(!cy_as_device_is_p2s_dma_start_recvd(dev_p)))) (!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 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, ...@@ -529,17 +529,17 @@ cy_as_dma_completed_callback(cy_as_hal_device_tag tag,
cy_as_return_status_t 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_kick_start(cy_as_device *dev_p, cy_as_end_point_number_t ep)
{ {
cy_as_dma_end_point *ep_p ; cy_as_dma_end_point *ep_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);
ep_p = CY_AS_NUM_EP(dev_p, ep) ; ep_p = CY_AS_NUM_EP(dev_p, ep);
/* We are already running */ /* We are already running */
if (cy_as_dma_end_point_is_running(ep_p)) 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); 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) ...@@ -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 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_dma_stop_end_point(cy_as_device *dev_p, cy_as_end_point_number_t ep)
{ {
cy_as_return_status_t ret ; cy_as_return_status_t ret;
cy_as_dma_end_point *ep_p = CY_AS_NUM_EP(dev_p, ep) ; cy_as_dma_end_point *ep_p = CY_AS_NUM_EP(dev_p, ep);
/* /*
* cancel any pending DMA requests associated with this endpoint. this * cancel any pending DMA requests associated with this endpoint. this
* cancels any DMA requests at the HAL layer as well as dequeues any * cancels any DMA requests at the HAL layer as well as dequeues any
* request that is currently pending. * 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) if (ret != CY_AS_ERROR_SUCCESS)
return ret ; return ret;
/* /*
* destroy the sleep channel * destroy the sleep channel
*/ */
if (!cy_as_hal_destroy_sleep_channel(&ep_p->channel) if (!cy_as_hal_destroy_sleep_channel(&ep_p->channel)
&& ret == CY_AS_ERROR_SUCCESS) && 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 * 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 * set the data structure ptr to something sane since the
* previous pointer is now free. * 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) ...@@ -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 static cy_as_return_status_t
cy_as_dma_stop_internal(cy_as_device *dev_p) 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 ret = CY_AS_ERROR_SUCCESS;
cy_as_return_status_t lret ; cy_as_return_status_t lret;
cy_as_end_point_number_t i ; cy_as_end_point_number_t i;
/* /*
* stop all of the endpoints. this cancels all DMA requests, and * stop all of the endpoints. this cancels all DMA requests, and
* frees all resources associated with each endpoint. * frees all resources associated with each endpoint.
*/ */
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++) {
lret = cy_as_dma_stop_end_point(dev_p, i) ; lret = cy_as_dma_stop_end_point(dev_p, i);
if (lret != CY_AS_ERROR_SUCCESS && ret == CY_AS_ERROR_SUCCESS) 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) ...@@ -610,23 +610,23 @@ cy_as_dma_stop_internal(cy_as_device *dev_p)
* DMA requests. * DMA requests.
*/ */
while (dev_p->dma_freelist_p) { while (dev_p->dma_freelist_p) {
cy_as_dma_queue_entry *req_p ; cy_as_dma_queue_entry *req_p;
uint32_t imask = cy_as_hal_disable_interrupts() ; uint32_t imask = cy_as_hal_disable_interrupts();
req_p = dev_p->dma_freelist_p ; req_p = dev_p->dma_freelist_p;
dev_p->dma_freelist_p = req_p->next_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_ep0_dma_req);
cy_as_ll_destroy_request(dev_p, dev_p->usb_ep1_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_ep0_dma_resp);
cy_as_ll_destroy_response(dev_p, dev_p->usb_ep1_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) ...@@ -642,12 +642,12 @@ cy_as_dma_stop_internal(cy_as_device *dev_p)
cy_as_return_status_t cy_as_return_status_t
cy_as_dma_stop(cy_as_device *dev_p) 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) ; ret = cy_as_dma_stop_internal(dev_p);
cy_as_device_set_dma_stopped(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) ...@@ -658,23 +658,23 @@ cy_as_dma_stop(cy_as_device *dev_p)
cy_as_return_status_t cy_as_return_status_t
cy_as_dma_start(cy_as_device *dev_p) cy_as_dma_start(cy_as_device *dev_p)
{ {
cy_as_end_point_number_t i ; cy_as_end_point_number_t i;
uint16_t cnt ; uint16_t cnt;
if (cy_as_device_is_dma_running(dev_p)) 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 * 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_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) { if (entry_p == 0) {
cy_as_dma_stop_internal(dev_p) ; cy_as_dma_stop_internal(dev_p);
return CY_AS_ERROR_OUT_OF_MEMORY ; 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) ...@@ -682,52 +682,52 @@ cy_as_dma_start(cy_as_device *dev_p)
* and EP1 data to west bridge * and EP1 data to west bridge
*/ */
dev_p->usb_ep0_dma_req = cy_as_ll_create_request(dev_p, 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, 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) { if (dev_p->usb_ep0_dma_req == 0 || dev_p->usb_ep1_dma_req == 0) {
cy_as_dma_stop_internal(dev_p) ; cy_as_dma_stop_internal(dev_p);
return CY_AS_ERROR_OUT_OF_MEMORY ; 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_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_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) { if (dev_p->usb_ep0_dma_resp == 0 || dev_p->usb_ep1_dma_resp == 0) {
cy_as_dma_stop_internal(dev_p) ; cy_as_dma_stop_internal(dev_p);
return CY_AS_ERROR_OUT_OF_MEMORY ; 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 * set the dev_p->endp to all zeros to insure cleanup is possible if
* an error occurs during initialization. * 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 * now, iterate through each of the endpoints and initialize each
* one. * 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 *) 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) { if (dev_p->endp[i] == 0) {
cy_as_dma_stop_internal(dev_p) ; cy_as_dma_stop_internal(dev_p);
return CY_AS_ERROR_OUT_OF_MEMORY ; return CY_AS_ERROR_OUT_OF_MEMORY;
} }
cy_as_hal_mem_set(dev_p->endp[i], 0, 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]->ep = i;
dev_p->endp[i]->queue_p = 0 ; dev_p->endp[i]->queue_p = 0;
dev_p->endp[i]->last_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)) 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) ...@@ -735,14 +735,14 @@ cy_as_dma_start(cy_as_device *dev_p)
* HAL layer completes a DMA request * HAL layer completes a DMA request
*/ */
cy_as_hal_dma_register_callback(dev_p->tag, 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 * 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 ...@@ -755,53 +755,53 @@ cy_as_return_status_t
cy_as_dma_drain_queue(cy_as_device *dev_p, cy_as_dma_drain_queue(cy_as_device *dev_p,
cy_as_end_point_number_t ep, cy_bool kickstart) cy_as_end_point_number_t ep, cy_bool kickstart)
{ {
cy_as_dma_end_point *ep_p ; cy_as_dma_end_point *ep_p;
int loopcount = 1000 ; int loopcount = 1000;
uint32_t mask ; uint32_t mask;
/* /*
* make sure the endpoint is valid * make sure the endpoint is valid
*/ */
if (ep >= sizeof(dev_p->endp)/sizeof(dev_p->endp[0])) 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 */ /* 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 * if the endpoint is empty of traffic, we return
* with success immediately * with success immediately
*/ */
mask = cy_as_hal_disable_interrupts() ; mask = cy_as_hal_disable_interrupts();
if (ep_p->queue_p == 0) { if (ep_p->queue_p == 0) {
cy_as_hal_enable_interrupts(mask) ; cy_as_hal_enable_interrupts(mask);
return CY_AS_ERROR_SUCCESS ; return CY_AS_ERROR_SUCCESS;
} else { } else {
/* /*
* add 10 seconds to the time out value for each 64 KB segment * add 10 seconds to the time out value for each 64 KB segment
* of data to be transferred. * of data to be transferred.
*/ */
if (ep_p->queue_p->size > 0x10000) 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 we are already sleeping on this endpoint, it is an error */
if (cy_as_dma_end_point_is_sleeping(ep_p)) 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 * we disable the endpoint while the queue drains to
* prevent any additional requests from being queued while we are waiting * prevent any additional requests from being queued while we are waiting
*/ */
cy_as_dma_enable_end_point(dev_p, ep, 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) { if (kickstart) {
/* /*
* now, kick start the DMA if necessary * 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, ...@@ -810,8 +810,8 @@ cy_as_dma_drain_queue(cy_as_device *dev_p,
*/ */
if (ep_p->queue_p == 0) { if (ep_p->queue_p == 0) {
cy_as_dma_enable_end_point(dev_p, ep, cy_true, cy_as_dma_enable_end_point(dev_p, ep, cy_true,
cy_as_direction_dont_change) ; cy_as_direction_dont_change);
return CY_AS_ERROR_SUCCESS ; return CY_AS_ERROR_SUCCESS;
} }
while (loopcount-- > 0) { while (loopcount-- > 0) {
...@@ -819,11 +819,11 @@ cy_as_dma_drain_queue(cy_as_device *dev_p, ...@@ -819,11 +819,11 @@ cy_as_dma_drain_queue(cy_as_device *dev_p,
* sleep for 10 ms maximum (per loop) while * sleep for 10 ms maximum (per loop) while
* waiting for the transfer to complete. * waiting for the transfer to complete.
*/ */
cy_as_dma_end_point_set_sleep_state(ep_p) ; cy_as_dma_end_point_set_sleep_state(ep_p);
cy_as_hal_sleep_on(&ep_p->channel, 10) ; cy_as_hal_sleep_on(&ep_p->channel, 10);
/* If we timed out, the sleep bit will still be set */ /* 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 */ /* Check the queue to see if is drained */
if (ep_p->queue_p == 0) { if (ep_p->queue_p == 0) {
...@@ -831,12 +831,12 @@ cy_as_dma_drain_queue(cy_as_device *dev_p, ...@@ -831,12 +831,12 @@ cy_as_dma_drain_queue(cy_as_device *dev_p,
* clear the endpoint running and in transit flags * clear the endpoint running and in transit flags
* for the endpoint, now that its DMA queue is empty. * 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_clear_in_transit(ep_p);
cy_as_dma_end_point_set_stopped(ep_p) ; cy_as_dma_end_point_set_stopped(ep_p);
cy_as_dma_enable_end_point(dev_p, ep, 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;
} }
} }
...@@ -844,10 +844,10 @@ cy_as_dma_drain_queue(cy_as_device *dev_p, ...@@ -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 * the DMA operation that has timed out can be cancelled, so that later
* operations on this queue can proceed. * 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_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_TIMEOUT ; return CY_AS_ERROR_TIMEOUT;
} }
/* /*
...@@ -860,41 +860,41 @@ cy_as_dma_queue_request(cy_as_device *dev_p, ...@@ -860,41 +860,41 @@ cy_as_dma_queue_request(cy_as_device *dev_p,
cy_as_end_point_number_t ep, void *mem_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 size, cy_bool pkt, cy_bool readreq, cy_as_dma_callback cb)
{ {
uint32_t mask ; uint32_t mask;
cy_as_dma_queue_entry *entry_p ; cy_as_dma_queue_entry *entry_p;
cy_as_dma_end_point *ep_p ; cy_as_dma_end_point *ep_p;
/* /*
* make sure the endpoint is valid * make sure the endpoint is valid
*/ */
if (ep >= sizeof(dev_p->endp)/sizeof(dev_p->endp[0])) 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 */ /* 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)) 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->buf_p = mem_p;
entry_p->cb = cb ; entry_p->cb = cb;
entry_p->size = size ; entry_p->size = size;
entry_p->offset = 0 ; entry_p->offset = 0;
entry_p->packet = pkt ; entry_p->packet = pkt;
entry_p->readreq = readreq ; entry_p->readreq = readreq;
mask = cy_as_hal_disable_interrupts() ; mask = cy_as_hal_disable_interrupts();
entry_p->next_p = 0 ; entry_p->next_p = 0;
if (ep_p->last_p) if (ep_p->last_p)
ep_p->last_p->next_p = entry_p ; ep_p->last_p->next_p = entry_p;
ep_p->last_p = entry_p ; ep_p->last_p = entry_p;
if (ep_p->queue_p == 0) if (ep_p->queue_p == 0)
ep_p->queue_p = entry_p ; ep_p->queue_p = entry_p;
cy_as_hal_enable_interrupts(mask) ; 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 ...@@ -906,21 +906,21 @@ cy_as_return_status_t
cy_as_dma_enable_end_point(cy_as_device *dev_p, 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_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 * make sure the endpoint is valid
*/ */
if (ep >= sizeof(dev_p->endp)/sizeof(dev_p->endp[0])) 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 */ /* 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) 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) 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 * get the maximum size of data buffer the HAL
...@@ -935,17 +935,17 @@ cy_as_dma_enable_end_point(cy_as_device *dev_p, ...@@ -935,17 +935,17 @@ cy_as_dma_enable_end_point(cy_as_device *dev_p,
* endpoints. * endpoints.
*/ */
if (ep == 0 || ep == 1) if (ep == 0 || ep == 1)
ep_p->maxhaldata = 64 ; ep_p->maxhaldata = 64;
else else
ep_p->maxhaldata = cy_as_hal_dma_max_request_size( ep_p->maxhaldata = cy_as_hal_dma_max_request_size(
dev_p->tag, ep) ; dev_p->tag, ep);
if (enable) if (enable)
cy_as_dma_end_point_enable(ep_p) ; cy_as_dma_end_point_enable(ep_p);
else 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( ...@@ -958,81 +958,81 @@ cy_as_dma_cancel(
cy_as_end_point_number_t ep, cy_as_end_point_number_t ep,
cy_as_return_status_t err) cy_as_return_status_t err)
{ {
uint32_t mask ; uint32_t mask;
cy_as_dma_end_point *ep_p ; cy_as_dma_end_point *ep_p;
cy_as_dma_queue_entry *entry_p ; cy_as_dma_queue_entry *entry_p;
cy_bool epstate ; cy_bool epstate;
/* /*
* make sure the endpoint is valid * make sure the endpoint is valid
*/ */
if (ep >= sizeof(dev_p->endp)/sizeof(dev_p->endp[0])) 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 */ /* 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) { if (ep_p) {
/* Remember the state of the endpoint */ /* 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 * disable the endpoint so no more DMA packets can be
* queued. * queued.
*/ */
cy_as_dma_enable_end_point(dev_p, ep, 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 * don't allow any interrupts from this endpoint
* while we get the most current request off of * while we get the most current request off of
* the queue. * 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 * cancel any pending request queued in the HAL layer
*/ */
if (cy_as_dma_end_point_in_transit(ep_p)) 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 * shutdown the DMA for this endpoint so no
* more data is transferred * 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 * mark the endpoint as not in transit, because we are
* going to consume any queued requests * 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 * now, remove each entry in the queue and call the
* associated callback stating that the request was * associated callback stating that the request was
* canceled. * canceled.
*/ */
ep_p->last_p = 0 ; ep_p->last_p = 0;
while (ep_p->queue_p != 0) { while (ep_p->queue_p != 0) {
/* Disable interrupts to manipulate the queue */ /* Disable interrupts to manipulate the queue */
mask = cy_as_hal_disable_interrupts() ; mask = cy_as_hal_disable_interrupts();
/* Remove an entry from the queue */ /* Remove an entry from the queue */
entry_p = ep_p->queue_p ; entry_p = ep_p->queue_p;
ep_p->queue_p = entry_p->next_p ; ep_p->queue_p = entry_p->next_p;
/* Ok, the queue has been updated, we can /* Ok, the queue has been updated, we can
* turn interrupts back on */ * turn interrupts back on */
cy_as_hal_enable_interrupts(mask) ; cy_as_hal_enable_interrupts(mask);
/* Call the callback indicating we have /* Call the callback indicating we have
* canceled the DMA */ * canceled the DMA */
if (entry_p->cb) if (entry_p->cb)
entry_p->cb(dev_p, ep, 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) { if (ep == 0 || ep == 1) {
...@@ -1042,7 +1042,7 @@ cy_as_dma_cancel( ...@@ -1042,7 +1042,7 @@ cy_as_dma_cancel(
* requests as these are pending requests to send * requests as these are pending requests to send
* data to the west bridge device. * 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) { if (epstate) {
...@@ -1051,33 +1051,33 @@ cy_as_dma_cancel( ...@@ -1051,33 +1051,33 @@ cy_as_dma_cancel(
* re-enable the endpoint here. * re-enable the endpoint here.
*/ */
cy_as_dma_enable_end_point(dev_p, ep, 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_return_status_t
cy_as_dma_received_data(cy_as_device *dev_p, cy_as_dma_received_data(cy_as_device *dev_p,
cy_as_end_point_number_t ep, uint32_t dsize, void *data) cy_as_end_point_number_t ep, uint32_t dsize, void *data)
{ {
cy_as_dma_queue_entry *dma_p ; cy_as_dma_queue_entry *dma_p;
uint8_t *src_p, *dest_p ; uint8_t *src_p, *dest_p;
cy_as_dma_end_point *ep_p ; cy_as_dma_end_point *ep_p;
uint32_t xfersize ; uint32_t xfersize;
/* /*
* make sure the endpoint is valid * make sure the endpoint is valid
*/ */
if (ep != 0 && ep != 1) 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 */ /* 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);
dma_p = ep_p->queue_p ; dma_p = ep_p->queue_p;
if (dma_p == 0) 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, * 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, ...@@ -1086,22 +1086,22 @@ cy_as_dma_received_data(cy_as_device *dev_p,
* non-packet reads on the other endpoints. * non-packet reads on the other endpoints.
*/ */
if (dsize > dma_p->size - dma_p->offset) 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 * copy the data from the request packet to the DMA buffer
* for the endpoint * for the endpoint
*/ */
src_p = (uint8_t *)data ; src_p = (uint8_t *)data;
dest_p = ((uint8_t *)(dma_p->buf_p)) + dma_p->offset ; dest_p = ((uint8_t *)(dma_p->buf_p)) + dma_p->offset;
xfersize = dsize ; xfersize = dsize;
while (xfersize-- > 0) while (xfersize-- > 0)
*dest_p++ = *src_p++ ; *dest_p++ = *src_p++;
/* Signal the DMA module that we have /* Signal the DMA module that we have
* received data for this EP request */ * received data for this EP request */
cy_as_dma_completed_callback(dev_p->tag, 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;
} }
...@@ -24,80 +24,80 @@ ...@@ -24,80 +24,80 @@
#include "../../include/linux/westbridge/cyasregs.h" #include "../../include/linux/westbridge/cyasregs.h"
#include "../../include/linux/westbridge/cyaserr.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 void
cy_as_mcu_interrupt_handler(cy_as_device *dev_p) cy_as_mcu_interrupt_handler(cy_as_device *dev_p)
{ {
/* Read and clear the interrupt. */ /* 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 = cy_as_hal_read_register(dev_p->tag, CY_AS_MEM_P0_MCU_STAT);
v = v ; v = v;
} }
void void
cy_as_power_management_interrupt_handler(cy_as_device *dev_p) 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 = cy_as_hal_read_register(dev_p->tag, CY_AS_MEM_PWR_MAGT_STAT);
v = v ; v = v;
} }
void void
cy_as_pll_lock_loss_interrupt_handler(cy_as_device *dev_p) 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 = cy_as_hal_read_register(dev_p->tag, CY_AS_MEM_PLL_LOCK_LOSS_STAT);
v = v ; v = v;
} }
uint32_t cy_as_intr_start(cy_as_device *dev_p, cy_bool dmaintr) 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) 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 | v = CY_AS_MEM_P0_INT_MASK_REG_MMCUINT |
CY_AS_MEM_P0_INT_MASK_REG_MMBINT | 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) 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 */ /* 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 */ /* 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) 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) 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_hal_write_register(dev_p->tag, CY_AS_MEM_P0_INT_MASK_REG, 0);
cy_as_device_set_intr_stopped(dev_p) ; 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) void cy_as_intr_service_interrupt(cy_as_hal_device_tag tag)
{ {
uint16_t v ; uint16_t v;
cy_as_device *dev_p ; 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 * only power management interrupts can occur before the
...@@ -105,39 +105,39 @@ void cy_as_intr_service_interrupt(cy_as_hal_device_tag tag) ...@@ -105,39 +105,39 @@ void cy_as_intr_service_interrupt(cy_as_hal_device_tag tag)
* handle it here; otherwise output a warning message. * handle it here; otherwise output a warning message.
*/ */
if (dev_p == 0) { 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) { if (v == CY_AS_MEM_P0_INTR_REG_PMINT) {
/* Read the PWR_MAGT_STAT register /* Read the PWR_MAGT_STAT register
* to clear this interrupt. */ * to clear this interrupt. */
v = cy_as_hal_read_register(tag, v = cy_as_hal_read_register(tag,
CY_AS_MEM_PWR_MAGT_STAT) ; CY_AS_MEM_PWR_MAGT_STAT);
} else } else
cy_as_hal_print_message("stray antioch " cy_as_hal_print_message("stray antioch "
"interrupt detected" "interrupt detected"
", tag not associated " ", tag not associated "
"with any created device.") ; "with any created device.");
return ; return;
} }
/* Make sure we got a valid object from CyAsDeviceFindFromTag */ /* 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) 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) 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) 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 /* If the interrupt module is not running, no mailbox
* interrupts are expected from the west bridge. */ * interrupts are expected from the west bridge. */
if (cy_as_device_is_intr_running(dev_p) == 0) if (cy_as_device_is_intr_running(dev_p) == 0)
return ; return;
if (v & CY_AS_MEM_P0_INTR_REG_MBINT) 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);
} }
...@@ -40,7 +40,7 @@ typedef enum cy_as_physical_endpoint_state { ...@@ -40,7 +40,7 @@ typedef enum cy_as_physical_endpoint_state {
* LEP register indexes into actual EP numbers. * LEP register indexes into actual EP numbers.
*/ */
static cy_as_end_point_number_t end_point_map[] = { 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_1024 (1 << 3)
#define CY_AS_EPCFG_DBL (0x02) #define CY_AS_EPCFG_DBL (0x02)
...@@ -116,23 +116,23 @@ static uint8_t pep_register_values[12][4] = { ...@@ -116,23 +116,23 @@ static uint8_t pep_register_values[12][4] = {
CY_AS_EPCFG_DBL, CY_AS_EPCFG_DBL,
},/* Config 12 - PEP1 (4 * 1024), PEP2 (N/A), },/* Config 12 - PEP1 (4 * 1024), PEP2 (N/A),
* PEP3 (N/A), PEP4 (N/A) */ * PEP3 (N/A), PEP4 (N/A) */
} ; };
static cy_as_return_status_t static cy_as_return_status_t
find_endpoint_directions(cy_as_device *dev_p, find_endpoint_directions(cy_as_device *dev_p,
cy_as_physical_endpoint_state epstate[4]) cy_as_physical_endpoint_state epstate[4])
{ {
int i ; int i;
cy_as_physical_endpoint_state desired ; cy_as_physical_endpoint_state desired;
/* /*
* note, there is no error checking here becuase * note, there is no error checking here becuase
* ISO error checking happens when the API is called. * ISO error checking happens when the API is called.
*/ */
for (i = 0 ; i < 10 ; i++) { for (i = 0; i < 10; i++) {
int epno = end_point_map[i] ; int epno = end_point_map[i];
if (dev_p->usb_config[epno].enabled) { 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) { if (dev_p->usb_config[epno].type == cy_as_usb_iso) {
/* /*
* marking this as an ISO endpoint, removes the * marking this as an ISO endpoint, removes the
...@@ -140,14 +140,14 @@ find_endpoint_directions(cy_as_device *dev_p, ...@@ -140,14 +140,14 @@ find_endpoint_directions(cy_as_device *dev_p,
* mapping the remaining E_ps. * mapping the remaining E_ps.
*/ */
if (dev_p->usb_config[epno].dir == cy_as_usb_in) 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 else
desired = cy_as_e_p_iso_out ; desired = cy_as_e_p_iso_out;
} else { } else {
if (dev_p->usb_config[epno].dir == cy_as_usb_in) if (dev_p->usb_config[epno].dir == cy_as_usb_in)
desired = cy_as_e_p_in ; desired = cy_as_e_p_in;
else 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, ...@@ -157,9 +157,9 @@ find_endpoint_directions(cy_as_device *dev_p,
*/ */
if (epstate[pep - 1] != if (epstate[pep - 1] !=
cy_as_e_p_free && epstate[pep - 1] != desired) 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, ...@@ -167,91 +167,91 @@ find_endpoint_directions(cy_as_device *dev_p,
* create the EP1 config values directly. * create the EP1 config values directly.
* both EP1OUT and EP1IN are invalid by default. * both EP1OUT and EP1IN are invalid by default.
*/ */
dev_p->usb_ep1cfg[0] = 0 ; dev_p->usb_ep1cfg[0] = 0;
dev_p->usb_ep1cfg[1] = 0 ; dev_p->usb_ep1cfg[1] = 0;
if (dev_p->usb_config[1].enabled) { if (dev_p->usb_config[1].enabled) {
if ((dev_p->usb_config[1].dir == cy_as_usb_out) || if ((dev_p->usb_config[1].dir == cy_as_usb_out) ||
(dev_p->usb_config[1].dir == cy_as_usb_in_out)) { (dev_p->usb_config[1].dir == cy_as_usb_in_out)) {
/* Set the valid bit and type field. */ /* 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) 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 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) || if ((dev_p->usb_config[1].dir == cy_as_usb_in) ||
(dev_p->usb_config[1].dir == cy_as_usb_in_out)) { (dev_p->usb_config[1].dir == cy_as_usb_in_out)) {
/* Set the valid bit and type field. */ /* 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) 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 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 static void
create_register_settings(cy_as_device *dev_p, create_register_settings(cy_as_device *dev_p,
cy_as_physical_endpoint_state epstate[4]) cy_as_physical_endpoint_state epstate[4])
{ {
int i ; int i;
uint8_t v ; uint8_t v;
for (i = 0 ; i < 4 ; i++) { for (i = 0; i < 4; i++) {
if (i == 0) { if (i == 0) {
/* Start with the values that specify size */ /* Start with the values that specify size */
dev_p->usb_pepcfg[i] = dev_p->usb_pepcfg[i] =
pep_register_values pep_register_values
[dev_p->usb_phy_config - 1][0] ; [dev_p->usb_phy_config - 1][0];
} else if (i == 2) { } else if (i == 2) {
/* Start with the values that specify size */ /* Start with the values that specify size */
dev_p->usb_pepcfg[i] = dev_p->usb_pepcfg[i] =
pep_register_values pep_register_values
[dev_p->usb_phy_config - 1][1] ; [dev_p->usb_phy_config - 1][1];
} else } else
dev_p->usb_pepcfg[i] = 0 ; dev_p->usb_pepcfg[i] = 0;
/* Adjust direction if it is in */ /* Adjust direction if it is in */
if (epstate[i] == cy_as_e_p_iso_in || if (epstate[i] == cy_as_e_p_iso_in ||
epstate[i] == cy_as_e_p_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 */ /* Configure the logical EP registers */
for (i = 0 ; i < 10 ; i++) { for (i = 0; i < 10; i++) {
int val ; int val;
int epnum = end_point_map[i] ; 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) { if (dev_p->usb_config[epnum].enabled) {
v |= (1 << 7) ; /* Enabled */ v |= (1 << 7); /* Enabled */
val = dev_p->usb_config[epnum].physical - 1 ; val = dev_p->usb_config[epnum].physical - 1;
cy_as_hal_assert(val >= 0 && val <= 3) ; cy_as_hal_assert(val >= 0 && val <= 3);
v |= (val << 5) ; v |= (val << 5);
switch (dev_p->usb_config[epnum].type) { switch (dev_p->usb_config[epnum].type) {
case cy_as_usb_bulk: case cy_as_usb_bulk:
val = 2 ; val = 2;
break ; break;
case cy_as_usb_int: case cy_as_usb_int:
val = 3 ; val = 3;
break ; break;
case cy_as_usb_iso: case cy_as_usb_iso:
val = 1 ; val = 1;
break ; break;
default: default:
cy_as_hal_assert(cy_false) ; cy_as_hal_assert(cy_false);
break ; 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, ...@@ -259,100 +259,100 @@ create_register_settings(cy_as_device *dev_p,
cy_as_return_status_t 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)
{ {
cy_as_return_status_t ret ; cy_as_return_status_t ret;
/* Physical EPs 3 5 7 9 respectively in the array */ /* Physical EPs 3 5 7 9 respectively in the array */
cy_as_physical_endpoint_state epstate[4] = { 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 } ; cy_as_e_p_free, cy_as_e_p_free };
/* Find the direction for the endpoints */ /* 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) if (ret != CY_AS_ERROR_SUCCESS)
return ret ; return ret;
/* /*
* now create the register settings based on the given * now create the register settings based on the given
* assigned of logical E_ps to physical endpoints. * 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 static uint16_t
get_max_dma_size(cy_as_device *dev_p, cy_as_end_point_number_t ep) 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) { if (size == 0) {
switch (dev_p->usb_config[ep].type) { switch (dev_p->usb_config[ep].type) {
case cy_as_usb_control: case cy_as_usb_control:
size = 64 ; size = 64;
break ; break;
case cy_as_usb_bulk: case cy_as_usb_bulk:
size = cy_as_device_is_usb_high_speed(dev_p) ? size = cy_as_device_is_usb_high_speed(dev_p) ?
512 : 64 ; 512 : 64;
break ; break;
case cy_as_usb_int: case cy_as_usb_int:
size = cy_as_device_is_usb_high_speed(dev_p) ? size = cy_as_device_is_usb_high_speed(dev_p) ?
1024 : 64 ; 1024 : 64;
break ; break;
case cy_as_usb_iso: case cy_as_usb_iso:
size = cy_as_device_is_usb_high_speed(dev_p) ? size = cy_as_device_is_usb_high_speed(dev_p) ?
1024 : 1023 ; 1024 : 1023;
break ; break;
} }
} }
return size ; return size;
} }
cy_as_return_status_t 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)
{ {
cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ; cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
uint32_t i ; uint32_t i;
for (i = 0 ; i < 10 ; i++) { for (i = 0; i < 10; i++) {
cy_as_usb_end_point_config *config_p = 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) { if (config_p->enabled) {
ret = cy_as_dma_set_max_dma_size(dev_p, ret = cy_as_dma_set_max_dma_size(dev_p,
end_point_map[i], 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) if (ret != CY_AS_ERROR_SUCCESS)
break ; break;
} }
} }
return ret ; return ret;
} }
cy_as_return_status_t 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)
{ {
cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ; cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
uint32_t i ; uint32_t i;
for (i = 0 ; i < 10 ; i++) { for (i = 0; i < 10; i++) {
cy_as_usb_end_point_config *config_p = 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) { if (config_p->enabled) {
/* Map the endpoint direction to the DMA direction */ /* 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) 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, 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) if (ret != CY_AS_ERROR_SUCCESS)
break ; break;
} }
} }
return ret ; return ret;
} }
...@@ -27,11 +27,11 @@ ...@@ -27,11 +27,11 @@
#include "../../include/linux/westbridge/cyaserr.h" #include "../../include/linux/westbridge/cyaserr.h"
#include "../../include/linux/westbridge/cyasregs.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 */ /* Forward declaration */
static cy_as_return_status_t cy_as_send_one(cy_as_device *dev_p, 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 * 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] = { ...@@ -45,7 +45,7 @@ static uint16_t max_request_length[CY_RQT_CONTEXT_COUNT] = {
8, /* CY_RQT_STORAGE_RQT_CONTEXT - CY_RQT_MEDIA_CHANGED */ 8, /* CY_RQT_STORAGE_RQT_CONTEXT - CY_RQT_MEDIA_CHANGED */
128, /* CY_RQT_USB_RQT_CONTEXT - CY_RQT_USB_EVENT */ 128, /* CY_RQT_USB_RQT_CONTEXT - CY_RQT_USB_EVENT */
8 /* CY_RQT_TUR_RQT_CONTEXT - CY_RQT_TURBO_CMD_FROM_HOST */ 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 * 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] = { ...@@ -56,20 +56,20 @@ static uint16_t max_request_length[CY_RQT_CONTEXT_COUNT] = {
static void static void
cy_as_ll_remove_request_queue_head(cy_as_device *dev_p, cy_as_context *ctxt_p) cy_as_ll_remove_request_queue_head(cy_as_device *dev_p, cy_as_context *ctxt_p)
{ {
uint32_t mask, state ; uint32_t mask, state;
cy_as_ll_request_list_node *node_p ; cy_as_ll_request_list_node *node_p;
(void)dev_p ; (void)dev_p;
cy_as_hal_assert(ctxt_p->request_queue_p != 0) ; cy_as_hal_assert(ctxt_p->request_queue_p != 0);
mask = cy_as_hal_disable_interrupts() ; mask = cy_as_hal_disable_interrupts();
node_p = ctxt_p->request_queue_p ; node_p = ctxt_p->request_queue_p;
ctxt_p->request_queue_p = node_p->next ; ctxt_p->request_queue_p = node_p->next;
cy_as_hal_enable_interrupts(mask) ; cy_as_hal_enable_interrupts(mask);
node_p->callback = 0 ; node_p->callback = 0;
node_p->rqt = 0 ; node_p->rqt = 0;
node_p->resp = 0 ; node_p->resp = 0;
/* /*
* note that the caller allocates and destroys the request and * 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) ...@@ -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 * the caller to deal with these in any case. the caller can do
* this in the request/response callback function. * this in the request/response callback function.
*/ */
state = cy_as_hal_disable_interrupts() ; state = cy_as_hal_disable_interrupts();
cy_as_hal_c_b_free(node_p) ; cy_as_hal_c_b_free(node_p);
cy_as_hal_enable_interrupts(state) ; 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) ...@@ -93,36 +93,36 @@ cy_as_ll_remove_request_queue_head(cy_as_device *dev_p, cy_as_context *ctxt_p)
static void static void
cy_as_ll_send_next_request(cy_as_device *dev_p, cy_as_context *ctxt_p) 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 * ret == ret is equivalent to while (1) but eliminates compiler
* warnings for some compilers. * warnings for some compilers.
*/ */
while (ret == ret) { 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) if (node_p == 0)
break ; break;
if (cy_as_request_get_node_state(node_p) != if (cy_as_request_get_node_state(node_p) !=
CY_AS_REQUEST_LIST_STATE_QUEUED) CY_AS_REQUEST_LIST_STATE_QUEUED)
break ; break;
cy_as_request_set_node_state(node_p, cy_as_request_set_node_state(node_p,
CY_AS_REQUEST_LIST_STATE_WAITING) ; CY_AS_REQUEST_LIST_STATE_WAITING);
ret = cy_as_send_one(dev_p, node_p->rqt) ; ret = cy_as_send_one(dev_p, node_p->rqt);
if (ret == CY_AS_ERROR_SUCCESS) if (ret == CY_AS_ERROR_SUCCESS)
break ; break;
/* /*
* if an error occurs in sending the request, tell the requester * if an error occurs in sending the request, tell the requester
* about the error and remove the request from the queue. * about the error and remove the request from the queue.
*/ */
cy_as_request_set_node_state(node_p, 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->callback(dev_p, ctxt_p->number,
node_p->rqt, node_p->resp, ret) ; node_p->rqt, node_p->resp, ret);
cy_as_ll_remove_request_queue_head(dev_p, ctxt_p) ; cy_as_ll_remove_request_queue_head(dev_p, ctxt_p);
/* /*
* this falls through to the while loop to send the next request * this falls through to the while loop to send the next request
...@@ -139,80 +139,80 @@ cy_as_remove_request_result_t ...@@ -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_remove_request(cy_as_device *dev_p, cy_as_context *ctxt_p,
cy_as_ll_request_response *req_p, cy_bool force) cy_as_ll_request_response *req_p, cy_bool force)
{ {
uint32_t imask ; uint32_t imask;
cy_as_ll_request_list_node *node_p ; cy_as_ll_request_list_node *node_p;
cy_as_ll_request_list_node *tmp_p ; cy_as_ll_request_list_node *tmp_p;
uint32_t state ; uint32_t state;
imask = cy_as_hal_disable_interrupts() ; imask = cy_as_hal_disable_interrupts();
if (ctxt_p->request_queue_p != 0 && if (ctxt_p->request_queue_p != 0 &&
ctxt_p->request_queue_p->rqt == req_p) { 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) == if ((cy_as_request_get_node_state(node_p) ==
CY_AS_REQUEST_LIST_STATE_WAITING) && (!force)) { CY_AS_REQUEST_LIST_STATE_WAITING) && (!force)) {
cy_as_hal_enable_interrupts(imask) ; cy_as_hal_enable_interrupts(imask);
return cy_as_remove_request_in_transit ; return cy_as_remove_request_in_transit;
} }
ctxt_p->request_queue_p = node_p->next ; ctxt_p->request_queue_p = node_p->next;
} else { } else {
tmp_p = ctxt_p->request_queue_p ; tmp_p = ctxt_p->request_queue_p;
while (tmp_p != 0 && tmp_p->next != 0 && while (tmp_p != 0 && tmp_p->next != 0 &&
tmp_p->next->rqt != req_p) tmp_p->next->rqt != req_p)
tmp_p = tmp_p->next ; tmp_p = tmp_p->next;
if (tmp_p == 0 || tmp_p->next == 0) { if (tmp_p == 0 || tmp_p->next == 0) {
cy_as_hal_enable_interrupts(imask) ; cy_as_hal_enable_interrupts(imask);
return cy_as_remove_request_not_found ; return cy_as_remove_request_not_found;
} }
node_p = tmp_p->next ; node_p = tmp_p->next;
tmp_p->next = node_p->next ; tmp_p->next = node_p->next;
} }
if (node_p->callback) if (node_p->callback)
node_p->callback(dev_p, ctxt_p->number, node_p->rqt, 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() ; state = cy_as_hal_disable_interrupts();
cy_as_hal_c_b_free(node_p) ; cy_as_hal_c_b_free(node_p);
cy_as_hal_enable_interrupts(state) ; cy_as_hal_enable_interrupts(state);
cy_as_hal_enable_interrupts(imask) ; cy_as_hal_enable_interrupts(imask);
return cy_as_remove_request_sucessful ; return cy_as_remove_request_sucessful;
} }
void void
cy_as_ll_remove_all_requests(cy_as_device *dev_p, cy_as_context *ctxt_p) 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) { while (node) {
if (cy_as_request_get_node_state(ctxt_p->request_queue_p) != if (cy_as_request_get_node_state(ctxt_p->request_queue_p) !=
CY_AS_REQUEST_LIST_STATE_RECEIVED) CY_AS_REQUEST_LIST_STATE_RECEIVED)
cy_as_ll_remove_request(dev_p, ctxt_p, cy_as_ll_remove_request(dev_p, ctxt_p,
node->rqt, cy_true) ; node->rqt, cy_true);
node = node->next ; node = node->next;
} }
} }
static cy_bool static cy_bool
cy_as_ll_is_in_queue(cy_as_context *ctxt_p, cy_as_ll_request_response *req_p) cy_as_ll_is_in_queue(cy_as_context *ctxt_p, cy_as_ll_request_response *req_p)
{ {
uint32_t mask ; uint32_t mask;
cy_as_ll_request_list_node *node_p ; cy_as_ll_request_list_node *node_p;
mask = cy_as_hal_disable_interrupts() ; mask = cy_as_hal_disable_interrupts();
node_p = ctxt_p->request_queue_p ; node_p = ctxt_p->request_queue_p;
while (node_p) { while (node_p) {
if (node_p->rqt == req_p) { if (node_p->rqt == req_p) {
cy_as_hal_enable_interrupts(mask) ; cy_as_hal_enable_interrupts(mask);
return cy_true ; return cy_true;
} }
node_p = node_p->next ; node_p = node_p->next;
} }
cy_as_hal_enable_interrupts(mask) ; cy_as_hal_enable_interrupts(mask);
return cy_false ; 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) ...@@ -226,83 +226,83 @@ cy_as_ll_is_in_queue(cy_as_context *ctxt_p, cy_as_ll_request_response *req_p)
void void
cy_as_ll_queue_mailbox_data(cy_as_device *dev_p) cy_as_ll_queue_mailbox_data(cy_as_device *dev_p)
{ {
cy_as_context *ctxt_p ; cy_as_context *ctxt_p;
uint8_t context ; uint8_t context;
uint16_t data[4] ; uint16_t data[4];
int32_t i ; int32_t i;
/* Read the data from mailbox 0 to determine what to do with the data */ /* 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, 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) { if (context >= CY_RQT_CONTEXT_COUNT) {
cy_as_hal_print_message("mailbox request/response received " cy_as_hal_print_message("mailbox request/response received "
"with invalid context value (%d)\n", context) ; "with invalid context value (%d)\n", context);
return ; return;
} }
ctxt_p = dev_p->context[context] ; ctxt_p = dev_p->context[context];
/* /*
* if we have queued too much data, drop future data. * if we have queued too much data, drop future data.
*/ */
cy_as_hal_assert(ctxt_p->queue_index * sizeof(uint16_t) + 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++) for (i = 0; i < 4; i++)
ctxt_p->data_queue[ctxt_p->queue_index++] = data[i] ; ctxt_p->data_queue[ctxt_p->queue_index++] = data[i];
cy_as_hal_assert((ctxt_p->queue_index % 4) == 0) ; cy_as_hal_assert((ctxt_p->queue_index % 4) == 0);
dev_p->ll_queued_data = cy_true ; dev_p->ll_queued_data = cy_true;
} }
void void
cy_as_mail_box_process_data(cy_as_device *dev_p, uint16_t *data) cy_as_mail_box_process_data(cy_as_device *dev_p, uint16_t *data)
{ {
cy_as_context *ctxt_p ; cy_as_context *ctxt_p;
uint8_t context ; uint8_t context;
uint16_t *len_p ; uint16_t *len_p;
cy_as_ll_request_response *rec_p ; cy_as_ll_request_response *rec_p;
uint8_t st ; uint8_t st;
uint16_t src, dest ; uint16_t src, dest;
context = cy_as_mbox_get_context(data[0]) ; context = cy_as_mbox_get_context(data[0]);
if (context >= CY_RQT_CONTEXT_COUNT) { if (context >= CY_RQT_CONTEXT_COUNT) {
cy_as_hal_print_message("mailbox request/response received " cy_as_hal_print_message("mailbox request/response received "
"with invalid context value (%d)\n", context) ; "with invalid context value (%d)\n", context);
return ; return;
} }
ctxt_p = dev_p->context[context] ; ctxt_p = dev_p->context[context];
if (cy_as_mbox_is_request(data[0])) { if (cy_as_mbox_is_request(data[0])) {
cy_as_hal_assert(ctxt_p->req_p != 0) ; cy_as_hal_assert(ctxt_p->req_p != 0);
rec_p = ctxt_p->req_p ; rec_p = ctxt_p->req_p;
len_p = &ctxt_p->request_length ; len_p = &ctxt_p->request_length;
} else { } else {
if (ctxt_p->request_queue_p == 0 || if (ctxt_p->request_queue_p == 0 ||
cy_as_request_get_node_state(ctxt_p->request_queue_p) cy_as_request_get_node_state(ctxt_p->request_queue_p)
!= CY_AS_REQUEST_LIST_STATE_WAITING) { != CY_AS_REQUEST_LIST_STATE_WAITING) {
cy_as_hal_print_message("mailbox response received on " 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(" context: %d\n", context);
cy_as_hal_print_message(" contents: 0x%04x 0x%04x " cy_as_hal_print_message(" contents: 0x%04x 0x%04x "
"0x%04x 0x%04x\n", "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) if (ctxt_p->request_queue_p != 0)
cy_as_hal_print_message(" state: 0x%02x\n", cy_as_hal_print_message(" state: 0x%02x\n",
ctxt_p->request_queue_p->state) ; ctxt_p->request_queue_p->state);
return ; return;
} }
/* Make sure the request has an associated response */ /* 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 ; rec_p = ctxt_p->request_queue_p->resp;
len_p = &ctxt_p->request_queue_p->length ; len_p = &ctxt_p->request_queue_p->length;
} }
if (rec_p->stored == 0) { if (rec_p->stored == 0) {
...@@ -310,27 +310,27 @@ cy_as_mail_box_process_data(cy_as_device *dev_p, uint16_t *data) ...@@ -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 * this is the first cycle of the response
*/ */
cy_as_ll_request_response__set_code(rec_p, cy_as_ll_request_response__set_code(rec_p,
cy_as_mbox_get_code(data[0])) ; cy_as_mbox_get_code(data[0]));
cy_as_ll_request_response__set_context(rec_p, context) ; cy_as_ll_request_response__set_context(rec_p, context);
if (cy_as_mbox_is_last(data[0])) { if (cy_as_mbox_is_last(data[0])) {
/* This is a single cycle response */ /* This is a single cycle response */
*len_p = rec_p->length ; *len_p = rec_p->length;
st = 1 ; st = 1;
} else { } else {
/* Ensure that enough memory has been /* Ensure that enough memory has been
* reserved for the response. */ * 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) ? *len_p = (data[1] < rec_p->length) ?
data[1] : rec_p->length ; data[1] : rec_p->length;
st = 2 ; st = 2;
} }
} else } else
st = 1 ; st = 1;
/* Trasnfer the data from the mailboxes to the response */ /* Trasnfer the data from the mailboxes to the response */
while (rec_p->stored < *len_p && st < 4) 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])) { if (cy_as_mbox_is_last(data[0])) {
/* NB: The call-back that is made below can cause the /* 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) ...@@ -343,16 +343,16 @@ cy_as_mail_box_process_data(cy_as_device *dev_p, uint16_t *data)
*/ */
if ((ctxt_p->rqt_index > 0) && if ((ctxt_p->rqt_index > 0) &&
(ctxt_p->rqt_index <= ctxt_p->queue_index)) { (ctxt_p->rqt_index <= ctxt_p->queue_index)) {
dest = 0 ; dest = 0;
src = ctxt_p->rqt_index ; src = ctxt_p->rqt_index;
while (src < ctxt_p->queue_index) while (src < ctxt_p->queue_index)
ctxt_p->data_queue[dest++] = ctxt_p->data_queue[dest++] =
ctxt_p->data_queue[src++] ; ctxt_p->data_queue[src++];
ctxt_p->rqt_index = 0 ; ctxt_p->rqt_index = 0;
ctxt_p->queue_index = dest ; ctxt_p->queue_index = dest;
cy_as_hal_assert((ctxt_p->queue_index % 4) == 0) ; cy_as_hal_assert((ctxt_p->queue_index % 4) == 0);
} }
if (ctxt_p->request_queue_p != 0 && rec_p == 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) ...@@ -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. * callback and reset for the next response.
*/ */
cy_as_ll_request_response *resp_p = cy_as_ll_request_response *resp_p =
ctxt_p->request_queue_p->resp ; ctxt_p->request_queue_p->resp;
resp_p->length = ctxt_p->request_queue_p->length ; resp_p->length = ctxt_p->request_queue_p->length;
cy_as_request_set_node_state(ctxt_p->request_queue_p, 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->callback(dev_p, context,
ctxt_p->request_queue_p->rqt, 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_remove_request_queue_head(dev_p, ctxt_p);
cy_as_ll_send_next_request(dev_p, ctxt_p) ; cy_as_ll_send_next_request(dev_p, ctxt_p);
} else { } else {
/* Send the request to the appropriate /* Send the request to the appropriate
* module to handle */ * module to handle */
cy_as_ll_request_response *request_p = ctxt_p->req_p ; cy_as_ll_request_response *request_p = ctxt_p->req_p;
ctxt_p->req_p = 0 ; ctxt_p->req_p = 0;
if (ctxt_p->request_callback) { 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, ctxt_p->request_callback(dev_p, context,
request_p, 0, CY_AS_ERROR_SUCCESS) ; request_p, 0, CY_AS_ERROR_SUCCESS);
cy_as_device_clear_in_callback(dev_p) ; cy_as_device_clear_in_callback(dev_p);
} }
cy_as_ll_init_request(request_p, 0, cy_as_ll_init_request(request_p, 0,
context, request_p->length) ; context, request_p->length);
ctxt_p->req_p = request_p ; ctxt_p->req_p = request_p;
} }
} }
} }
...@@ -400,7 +400,7 @@ cy_as_mail_box_process_data(cy_as_device *dev_p, uint16_t *data) ...@@ -400,7 +400,7 @@ cy_as_mail_box_process_data(cy_as_device *dev_p, uint16_t *data)
void void
cy_as_mail_box_queued_data_handler(cy_as_device *dev_p) 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 * 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) ...@@ -408,20 +408,20 @@ cy_as_mail_box_queued_data_handler(cy_as_device *dev_p)
* continue processing the queued data. * continue processing the queued data.
*/ */
while (dev_p->ll_queued_data) { while (dev_p->ll_queued_data) {
dev_p->ll_queued_data = cy_false ; dev_p->ll_queued_data = cy_false;
for (i = 0 ; i < CY_RQT_CONTEXT_COUNT ; i++) { for (i = 0; i < CY_RQT_CONTEXT_COUNT; i++) {
uint16_t offset ; uint16_t offset;
cy_as_context *ctxt_p = dev_p->context[i] ; cy_as_context *ctxt_p = dev_p->context[i];
cy_as_hal_assert((ctxt_p->queue_index % 4) == 0) ; cy_as_hal_assert((ctxt_p->queue_index % 4) == 0);
offset = 0 ; offset = 0;
while (offset < ctxt_p->queue_index) { 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, cy_as_mail_box_process_data(dev_p,
ctxt_p->data_queue + offset) ; ctxt_p->data_queue + offset);
offset = ctxt_p->rqt_index ; 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) ...@@ -437,52 +437,52 @@ cy_as_mail_box_queued_data_handler(cy_as_device *dev_p)
void void
cy_as_mail_box_interrupt_handler(cy_as_device *dev_p) 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 * queue the mailbox data to preserve
* order for later processing. * 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 * 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_return_status_t
cy_as_ll_start(cy_as_device *dev_p) 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)) 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_sending_rqt = cy_false;
dev_p->ll_abort_curr_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 *) 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) 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]->number = (uint8_t)i;
dev_p->context[i]->request_callback = 0 ; dev_p->context[i]->request_callback = 0;
dev_p->context[i]->request_queue_p = 0 ; dev_p->context[i]->request_queue_p = 0;
dev_p->context[i]->last_node_p = 0 ; dev_p->context[i]->last_node_p = 0;
dev_p->context[i]->req_p = cy_as_ll_create_request(dev_p, dev_p->context[i]->req_p = cy_as_ll_create_request(dev_p,
0, (uint8_t)i, max_request_length[i]) ; 0, (uint8_t)i, max_request_length[i]);
dev_p->context[i]->queue_index = 0 ; dev_p->context[i]->queue_index = 0;
if (!cy_as_hal_create_sleep_channel if (!cy_as_hal_create_sleep_channel
(&dev_p->context[i]->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) ; cy_as_device_set_low_level_running(dev_p);
return CY_AS_ERROR_SUCCESS ; return CY_AS_ERROR_SUCCESS;
} }
/* /*
...@@ -492,27 +492,27 @@ cy_as_ll_start(cy_as_device *dev_p) ...@@ -492,27 +492,27 @@ cy_as_ll_start(cy_as_device *dev_p)
cy_as_return_status_t cy_as_return_status_t
cy_as_ll_stop(cy_as_device *dev_p) cy_as_ll_stop(cy_as_device *dev_p)
{ {
uint8_t i ; uint8_t i;
cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ; cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
cy_as_context *ctxt_p ; cy_as_context *ctxt_p;
uint32_t mask ; uint32_t mask;
for (i = 0 ; i < CY_RQT_CONTEXT_COUNT ; i++) { for (i = 0; i < CY_RQT_CONTEXT_COUNT; i++) {
ctxt_p = dev_p->context[i] ; ctxt_p = dev_p->context[i];
if (!cy_as_hal_destroy_sleep_channel(&ctxt_p->channel)) 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 * now, free any queued requests and assocaited responses
*/ */
while (ctxt_p->request_queue_p) { while (ctxt_p->request_queue_p) {
uint32_t state ; uint32_t state;
cy_as_ll_request_list_node *node_p = 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 */ /* Mark this pair as in a cancel operation */
cy_as_request_set_node_state(node_p, 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 */ /* Tell the caller that we are canceling this request */
/* NB: The callback is responsible for destroying the /* NB: The callback is responsible for destroying the
...@@ -520,27 +520,27 @@ cy_as_ll_stop(cy_as_device *dev_p) ...@@ -520,27 +520,27 @@ cy_as_ll_stop(cy_as_device *dev_p)
* contents of these two after calling the callback. * contents of these two after calling the callback.
*/ */
node_p->callback(dev_p, i, node_p->rqt, 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 */ /* Remove the pair from the queue */
mask = cy_as_hal_disable_interrupts() ; mask = cy_as_hal_disable_interrupts();
ctxt_p->request_queue_p = node_p->next ; ctxt_p->request_queue_p = node_p->next;
cy_as_hal_enable_interrupts(mask) ; cy_as_hal_enable_interrupts(mask);
/* Free the list node */ /* Free the list node */
state = cy_as_hal_disable_interrupts() ; state = cy_as_hal_disable_interrupts();
cy_as_hal_c_b_free(node_p) ; cy_as_hal_c_b_free(node_p);
cy_as_hal_enable_interrupts(state) ; cy_as_hal_enable_interrupts(state);
} }
cy_as_ll_destroy_request(dev_p, dev_p->context[i]->req_p) ; cy_as_ll_destroy_request(dev_p, dev_p->context[i]->req_p);
cy_as_hal_free(dev_p->context[i]) ; cy_as_hal_free(dev_p->context[i]);
dev_p->context[i] = 0 ; 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 void
...@@ -548,13 +548,13 @@ cy_as_ll_init_request(cy_as_ll_request_response *req_p, ...@@ -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 code, uint16_t context, uint16_t length)
{ {
uint16_t totallen = sizeof(cy_as_ll_request_response) + 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) ; cy_as_hal_mem_set(req_p, 0, totallen);
req_p->length = length ; req_p->length = length;
cy_as_ll_request_response__set_code(req_p, code) ; 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_context(req_p, context);
cy_as_ll_request_response__set_request(req_p) ; cy_as_ll_request_response__set_request(req_p);
} }
/* /*
...@@ -564,20 +564,20 @@ cy_as_ll_request_response * ...@@ -564,20 +564,20 @@ cy_as_ll_request_response *
cy_as_ll_create_request(cy_as_device *dev_p, uint16_t code, cy_as_ll_create_request(cy_as_device *dev_p, uint16_t code,
uint8_t context, uint16_t length) uint8_t context, uint16_t length)
{ {
cy_as_ll_request_response *req_p ; cy_as_ll_request_response *req_p;
uint32_t state ; uint32_t state;
uint16_t totallen = sizeof(cy_as_ll_request_response) + 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() ; state = cy_as_hal_disable_interrupts();
req_p = cy_as_hal_c_b_alloc(totallen) ; req_p = cy_as_hal_c_b_alloc(totallen);
cy_as_hal_enable_interrupts(state) ; cy_as_hal_enable_interrupts(state);
if (req_p) 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, ...@@ -586,13 +586,13 @@ cy_as_ll_create_request(cy_as_device *dev_p, uint16_t code,
void void
cy_as_ll_destroy_request(cy_as_device *dev_p, cy_as_ll_request_response *req_p) cy_as_ll_destroy_request(cy_as_device *dev_p, cy_as_ll_request_response *req_p)
{ {
uint32_t state ; uint32_t state;
(void)dev_p ; (void)dev_p;
(void)req_p ; (void)req_p;
state = cy_as_hal_disable_interrupts() ; state = cy_as_hal_disable_interrupts();
cy_as_hal_c_b_free(req_p) ; cy_as_hal_c_b_free(req_p);
cy_as_hal_enable_interrupts(state) ; cy_as_hal_enable_interrupts(state);
} }
...@@ -600,11 +600,11 @@ void ...@@ -600,11 +600,11 @@ void
cy_as_ll_init_response(cy_as_ll_request_response *req_p, uint16_t length) cy_as_ll_init_response(cy_as_ll_request_response *req_p, uint16_t length)
{ {
uint16_t totallen = sizeof(cy_as_ll_request_response) + 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) ; cy_as_hal_mem_set(req_p, 0, totallen);
req_p->length = length ; req_p->length = length;
cy_as_ll_request_response__set_response(req_p) ; 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) ...@@ -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_request_response *
cy_as_ll_create_response(cy_as_device *dev_p, uint16_t length) cy_as_ll_create_response(cy_as_device *dev_p, uint16_t length)
{ {
cy_as_ll_request_response *req_p ; cy_as_ll_request_response *req_p;
uint32_t state ; uint32_t state;
uint16_t totallen = sizeof(cy_as_ll_request_response) + 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() ; state = cy_as_hal_disable_interrupts();
req_p = cy_as_hal_c_b_alloc(totallen) ; req_p = cy_as_hal_c_b_alloc(totallen);
cy_as_hal_enable_interrupts(state) ; cy_as_hal_enable_interrupts(state);
if (req_p) 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) ...@@ -635,21 +635,21 @@ cy_as_ll_create_response(cy_as_device *dev_p, uint16_t length)
void void
cy_as_ll_destroy_response(cy_as_device *dev_p, cy_as_ll_request_response *req_p) cy_as_ll_destroy_response(cy_as_device *dev_p, cy_as_ll_request_response *req_p)
{ {
uint32_t state ; uint32_t state;
(void)dev_p ; (void)dev_p;
(void)req_p ; (void)req_p;
state = cy_as_hal_disable_interrupts() ; state = cy_as_hal_disable_interrupts();
cy_as_hal_c_b_free(req_p) ; cy_as_hal_c_b_free(req_p);
cy_as_hal_enable_interrupts(state) ; cy_as_hal_enable_interrupts(state);
} }
static uint16_t static uint16_t
cy_as_read_intr_status( cy_as_read_intr_status(
cy_as_device *dev_p) cy_as_device *dev_p)
{ {
uint32_t mask ; uint32_t mask;
cy_bool bloop = cy_true ; cy_bool bloop = cy_true;
uint16_t v = 0, last = 0xffff; uint16_t v = 0, last = 0xffff;
/* /*
...@@ -664,15 +664,15 @@ cy_as_read_intr_status( ...@@ -664,15 +664,15 @@ cy_as_read_intr_status(
* here and have the interrupt routine try to read this data * here and have the interrupt routine try to read this data
* as well. * as well.
*/ */
mask = cy_as_hal_disable_interrupts() ; mask = cy_as_hal_disable_interrupts();
/* /*
* see if there is data to be read. * 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) { if ((v & CY_AS_MEM_P0_INTR_REG_MBINT) == 0) {
cy_as_hal_enable_interrupts(mask) ; cy_as_hal_enable_interrupts(mask);
break ; break;
} }
/* /*
...@@ -680,30 +680,30 @@ cy_as_read_intr_status( ...@@ -680,30 +680,30 @@ cy_as_read_intr_status(
* this allows the firmware to move forward and * this allows the firmware to move forward and
* service the requst from the P port. * 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 * enable interrupts again to service mailbox
* interrupts appropriately * interrupts appropriately
*/ */
cy_as_hal_enable_interrupts(mask) ; cy_as_hal_enable_interrupts(mask);
} }
/* /*
* now, all data is received * now, all data is received
*/ */
last = cy_as_hal_read_register(dev_p->tag, 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) { while (bloop) {
v = cy_as_hal_read_register(dev_p->tag, 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) if (v == last)
break ; break;
last = v ; last = v;
} }
return v ; return v;
} }
/* /*
...@@ -716,50 +716,50 @@ cy_as_send_one( ...@@ -716,50 +716,50 @@ cy_as_send_one(
cy_as_device *dev_p, cy_as_device *dev_p,
cy_as_ll_request_response *req_p) cy_as_ll_request_response *req_p)
{ {
int i ; int i;
uint16_t mb0, v ; uint16_t mb0, v;
int32_t loopcount ; int32_t loopcount;
uint32_t int_stat ; uint32_t int_stat;
#ifdef _DEBUG #ifdef _DEBUG
if (cy_as_ll_request_response__is_request(req_p)) { if (cy_as_ll_request_response__is_request(req_p)) {
switch (cy_as_ll_request_response__get_context(req_p)) { switch (cy_as_ll_request_response__get_context(req_p)) {
case CY_RQT_GENERAL_RQT_CONTEXT: case CY_RQT_GENERAL_RQT_CONTEXT:
cy_as_hal_assert(req_p->length * 2 + 2 < cy_as_hal_assert(req_p->length * 2 + 2 <
CY_CTX_GEN_MAX_DATA_SIZE) ; CY_CTX_GEN_MAX_DATA_SIZE);
break ; break;
case CY_RQT_RESOURCE_RQT_CONTEXT: case CY_RQT_RESOURCE_RQT_CONTEXT:
cy_as_hal_assert(req_p->length * 2 + 2 < cy_as_hal_assert(req_p->length * 2 + 2 <
CY_CTX_RES_MAX_DATA_SIZE) ; CY_CTX_RES_MAX_DATA_SIZE);
break ; break;
case CY_RQT_STORAGE_RQT_CONTEXT: case CY_RQT_STORAGE_RQT_CONTEXT:
cy_as_hal_assert(req_p->length * 2 + 2 < cy_as_hal_assert(req_p->length * 2 + 2 <
CY_CTX_STR_MAX_DATA_SIZE) ; CY_CTX_STR_MAX_DATA_SIZE);
break ; break;
case CY_RQT_USB_RQT_CONTEXT: case CY_RQT_USB_RQT_CONTEXT:
cy_as_hal_assert(req_p->length * 2 + 2 < cy_as_hal_assert(req_p->length * 2 + 2 <
CY_CTX_USB_MAX_DATA_SIZE) ; CY_CTX_USB_MAX_DATA_SIZE);
break ; break;
} }
} }
#endif #endif
/* Write the request to the mail box registers */ /* Write the request to the mail box registers */
if (req_p->length > 3) { if (req_p->length > 3) {
uint16_t length = req_p->length ; uint16_t length = req_p->length;
int which = 0 ; int which = 0;
int st = 1 ; int st = 1;
dev_p->ll_sending_rqt = cy_true ; dev_p->ll_sending_rqt = cy_true;
while (which < length) { while (which < length) {
loopcount = cy_as_low_level_timeout_count ; loopcount = cy_as_low_level_timeout_count;
do { 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) { if (v) {
cy_as_hal_print_message( cy_as_hal_print_message(
...@@ -772,17 +772,17 @@ cy_as_send_one( ...@@ -772,17 +772,17 @@ cy_as_send_one(
cy_as_hal_read_register(dev_p->tag, cy_as_hal_read_register(dev_p->tag,
CY_AS_MEM_MCU_MAILBOX2), CY_AS_MEM_MCU_MAILBOX2),
cy_as_hal_read_register(dev_p->tag, cy_as_hal_read_register(dev_p->tag,
CY_AS_MEM_MCU_MAILBOX3)) ; CY_AS_MEM_MCU_MAILBOX3));
return CY_AS_ERROR_TIMEOUT ; return CY_AS_ERROR_TIMEOUT;
} }
if (dev_p->ll_abort_curr_rqt) { if (dev_p->ll_abort_curr_rqt) {
dev_p->ll_sending_rqt = cy_false ; dev_p->ll_sending_rqt = cy_false;
dev_p->ll_abort_curr_rqt = cy_false ; dev_p->ll_abort_curr_rqt = cy_false;
return CY_AS_ERROR_CANCELED ; 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. * check again whether the mailbox is free.
...@@ -792,18 +792,18 @@ cy_as_send_one( ...@@ -792,18 +792,18 @@ cy_as_send_one(
*/ */
v = cy_as_hal_read_register(dev_p->tag, v = cy_as_hal_read_register(dev_p->tag,
CY_AS_MEM_MCU_MB_STAT) & CY_AS_MEM_MCU_MB_STAT) &
CY_AS_MEM_P0_MCU_MBNOTRD ; CY_AS_MEM_P0_MCU_MBNOTRD;
if (v) { if (v) {
/* Go back to the original check since /* Go back to the original check since
* the mailbox is not free. */ * the mailbox is not free. */
cy_as_hal_enable_interrupts(int_stat) ; cy_as_hal_enable_interrupts(int_stat);
continue ; continue;
} }
if (which == 0) { if (which == 0) {
cy_as_hal_write_register(dev_p->tag, cy_as_hal_write_register(dev_p->tag,
CY_AS_MEM_MCU_MAILBOX1, length) ; CY_AS_MEM_MCU_MAILBOX1, length);
st = 2 ; st = 2;
} else { } else {
st = 1; st = 1;
} }
...@@ -812,29 +812,29 @@ cy_as_send_one( ...@@ -812,29 +812,29 @@ cy_as_send_one(
cy_as_hal_write_register(dev_p->tag, cy_as_hal_write_register(dev_p->tag,
cy_cast_int2U_int16 cy_cast_int2U_int16
(CY_AS_MEM_MCU_MAILBOX0 + st), (CY_AS_MEM_MCU_MAILBOX0 + st),
req_p->data[which++]) ; req_p->data[which++]);
st++ ; st++;
} }
mb0 = req_p->box0 ; mb0 = req_p->box0;
if (which == length) { if (which == length) {
dev_p->ll_sending_rqt = cy_false ; dev_p->ll_sending_rqt = cy_false;
mb0 |= CY_AS_REQUEST_RESPONSE_LAST_MASK ; mb0 |= CY_AS_REQUEST_RESPONSE_LAST_MASK;
} }
if (dev_p->ll_abort_curr_rqt) { if (dev_p->ll_abort_curr_rqt) {
dev_p->ll_sending_rqt = cy_false ; dev_p->ll_sending_rqt = cy_false;
dev_p->ll_abort_curr_rqt = cy_false ; dev_p->ll_abort_curr_rqt = cy_false;
cy_as_hal_enable_interrupts(int_stat) ; cy_as_hal_enable_interrupts(int_stat);
return CY_AS_ERROR_CANCELED ; return CY_AS_ERROR_CANCELED;
} }
cy_as_hal_write_register(dev_p->tag, 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 */ /* Wait for the MBOX interrupt to be high */
cy_as_hal_sleep150() ; cy_as_hal_sleep150();
cy_as_hal_enable_interrupts(int_stat) ; cy_as_hal_enable_interrupts(int_stat);
} }
} else { } else {
check_mailbox_availability: check_mailbox_availability:
...@@ -844,11 +844,11 @@ cy_as_send_one( ...@@ -844,11 +844,11 @@ cy_as_send_one(
* to accept requests at interrupt time and queue them for * to accept requests at interrupt time and queue them for
* future processing. * future processing.
*/ */
loopcount = cy_as_low_level_timeout_count ; loopcount = cy_as_low_level_timeout_count;
do { 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) { if (v) {
cy_as_hal_print_message( cy_as_hal_print_message(
...@@ -860,8 +860,8 @@ cy_as_send_one( ...@@ -860,8 +860,8 @@ cy_as_send_one(
cy_as_hal_read_register(dev_p->tag, cy_as_hal_read_register(dev_p->tag,
CY_AS_MEM_MCU_MAILBOX2), CY_AS_MEM_MCU_MAILBOX2),
cy_as_hal_read_register(dev_p->tag, cy_as_hal_read_register(dev_p->tag,
CY_AS_MEM_MCU_MAILBOX3)) ; CY_AS_MEM_MCU_MAILBOX3));
return CY_AS_ERROR_TIMEOUT ; return CY_AS_ERROR_TIMEOUT;
} }
int_stat = cy_as_hal_disable_interrupts(); int_stat = cy_as_hal_disable_interrupts();
...@@ -872,31 +872,31 @@ cy_as_send_one( ...@@ -872,31 +872,31 @@ cy_as_send_one(
* mailboxes since we last checked the status. * mailboxes since we last checked the status.
*/ */
v = cy_as_hal_read_register(dev_p->tag, CY_AS_MEM_MCU_MB_STAT) & 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) { if (v) {
/* Go back to the original check /* Go back to the original check
* since the mailbox is not free. */ * since the mailbox is not free. */
cy_as_hal_enable_interrupts(int_stat) ; cy_as_hal_enable_interrupts(int_stat);
goto check_mailbox_availability ; goto check_mailbox_availability;
} }
/* Write the data associated with the request /* Write the data associated with the request
* into the mbox registers 1 - 3 */ * into the mbox registers 1 - 3 */
v = 0 ; v = 0;
for (i = req_p->length - 1 ; i >= 0 ; i--) for (i = req_p->length - 1; i >= 0; i--)
cy_as_hal_write_register(dev_p->tag, cy_as_hal_write_register(dev_p->tag,
cy_cast_int2U_int16(CY_AS_MEM_MCU_MAILBOX1 + i), 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 */ /* Write the mbox register 0 to trigger the interrupt */
cy_as_hal_write_register(dev_p->tag, CY_AS_MEM_MCU_MAILBOX0, 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); 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( ...@@ -916,57 +916,57 @@ cy_as_ll_send_request(
cy_as_response_callback cb cy_as_response_callback cb
) )
{ {
cy_as_context *ctxt_p ; cy_as_context *ctxt_p;
uint16_t box0 = req->box0 ; uint16_t box0 = req->box0;
uint8_t context ; uint8_t context;
cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ; cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
cy_as_ll_request_list_node *node_p ; cy_as_ll_request_list_node *node_p;
uint32_t mask, state ; uint32_t mask, state;
cy_as_hal_assert(dev_p->sig == CY_AS_DEVICE_HANDLE_SIGNATURE); cy_as_hal_assert(dev_p->sig == CY_AS_DEVICE_HANDLE_SIGNATURE);
context = cy_as_mbox_get_context(box0) ; context = cy_as_mbox_get_context(box0);
cy_as_hal_assert(context < CY_RQT_CONTEXT_COUNT) ; cy_as_hal_assert(context < CY_RQT_CONTEXT_COUNT);
ctxt_p = dev_p->context[context] ; ctxt_p = dev_p->context[context];
/* Allocate the list node */ /* Allocate the list node */
state = cy_as_hal_disable_interrupts() ; state = cy_as_hal_disable_interrupts();
node_p = cy_as_hal_c_b_alloc(sizeof(cy_as_ll_request_list_node)) ; node_p = cy_as_hal_c_b_alloc(sizeof(cy_as_ll_request_list_node));
cy_as_hal_enable_interrupts(state) ; cy_as_hal_enable_interrupts(state);
if (node_p == 0) if (node_p == 0)
return CY_AS_ERROR_OUT_OF_MEMORY ; return CY_AS_ERROR_OUT_OF_MEMORY;
/* Initialize the list node */ /* Initialize the list node */
node_p->callback = cb ; node_p->callback = cb;
node_p->length = 0 ; node_p->length = 0;
node_p->next = 0 ; node_p->next = 0;
node_p->resp = resp ; node_p->resp = resp;
node_p->rqt = req ; node_p->rqt = req;
node_p->state = CY_AS_REQUEST_LIST_STATE_QUEUED ; node_p->state = CY_AS_REQUEST_LIST_STATE_QUEUED;
if (sync) if (sync)
cy_as_request_node_set_sync(node_p) ; cy_as_request_node_set_sync(node_p);
/* Put the request into the queue */ /* 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) { if (ctxt_p->request_queue_p == 0) {
/* Empty queue */ /* Empty queue */
ctxt_p->request_queue_p = node_p ; ctxt_p->request_queue_p = node_p;
ctxt_p->last_node_p = node_p ; ctxt_p->last_node_p = node_p;
} else { } else {
ctxt_p->last_node_p->next = node_p ; ctxt_p->last_node_p->next = node_p;
ctxt_p->last_node_p = node_p ; ctxt_p->last_node_p = node_p;
} }
cy_as_hal_enable_interrupts(mask) ; cy_as_hal_enable_interrupts(mask);
cy_as_ll_send_next_request(dev_p, ctxt_p) ; cy_as_ll_send_next_request(dev_p, ctxt_p);
if (!cy_as_device_is_in_callback(dev_p)) { if (!cy_as_device_is_in_callback(dev_p)) {
mask = cy_as_hal_disable_interrupts() ; mask = cy_as_hal_disable_interrupts();
cy_as_mail_box_queued_data_handler(dev_p) ; cy_as_mail_box_queued_data_handler(dev_p);
cy_as_hal_enable_interrupts(mask) ; cy_as_hal_enable_interrupts(mask);
} }
return ret ; return ret;
} }
static void static void
...@@ -977,22 +977,22 @@ cy_as_ll_send_callback( ...@@ -977,22 +977,22 @@ cy_as_ll_send_callback(
cy_as_ll_request_response *resp, cy_as_ll_request_response *resp,
cy_as_return_status_t ret) cy_as_return_status_t ret)
{ {
(void)rqt ; (void)rqt;
(void)resp ; (void)resp;
(void)ret ; (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 * storage the state to return to the caller
*/ */
dev_p->ll_error = ret ; dev_p->ll_error = ret;
/* /*
* now wake the caller * 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 cy_as_return_status_t
...@@ -1005,22 +1005,22 @@ cy_as_ll_send_request_wait_reply( ...@@ -1005,22 +1005,22 @@ cy_as_ll_send_request_wait_reply(
cy_as_ll_request_response *resp cy_as_ll_request_response *resp
) )
{ {
cy_as_return_status_t ret ; cy_as_return_status_t ret;
uint8_t context ; uint8_t context;
/* Larger 8 sec time-out to handle the init /* Larger 8 sec time-out to handle the init
* delay for slower storage devices in USB FS. */ * delay for slower storage devices in USB FS. */
uint32_t loopcount = 800 ; uint32_t loopcount = 800;
cy_as_context *ctxt_p ; cy_as_context *ctxt_p;
/* Get the context for the request */ /* Get the context for the request */
context = cy_as_ll_request_response__get_context(req) ; context = cy_as_ll_request_response__get_context(req);
cy_as_hal_assert(context < CY_RQT_CONTEXT_COUNT) ; cy_as_hal_assert(context < CY_RQT_CONTEXT_COUNT);
ctxt_p = dev_p->context[context] ; ctxt_p = dev_p->context[context];
ret = cy_as_ll_send_request(dev_p, req, resp, 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) if (ret != CY_AS_ERROR_SUCCESS)
return ret ; return ret;
while (loopcount-- > 0) { while (loopcount-- > 0) {
/* /*
...@@ -1029,7 +1029,7 @@ cy_as_ll_send_request_wait_reply( ...@@ -1029,7 +1029,7 @@ cy_as_ll_send_request_wait_reply(
* tries) before we timeout. note if the reply arrives, we will * tries) before we timeout. note if the reply arrives, we will
* not sleep the entire 10 ms, just til the reply arrives. * 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 * if the request has left the queue, it means the request has
...@@ -1037,13 +1037,13 @@ cy_as_ll_send_request_wait_reply( ...@@ -1037,13 +1037,13 @@ cy_as_ll_send_request_wait_reply(
* return to the caller and be sure the reply has been received. * return to the caller and be sure the reply has been received.
*/ */
if (!cy_as_ll_is_in_queue(ctxt_p, req)) 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. */ /* 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 cy_as_return_status_t
...@@ -1052,12 +1052,12 @@ cy_as_ll_register_request_callback( ...@@ -1052,12 +1052,12 @@ cy_as_ll_register_request_callback(
uint8_t context, uint8_t context,
cy_as_response_callback cb) cy_as_response_callback cb)
{ {
cy_as_context *ctxt_p ; cy_as_context *ctxt_p;
cy_as_hal_assert(context < CY_RQT_CONTEXT_COUNT) ; cy_as_hal_assert(context < CY_RQT_CONTEXT_COUNT);
ctxt_p = dev_p->context[context] ; ctxt_p = dev_p->context[context];
ctxt_p->request_callback = cb ; ctxt_p->request_callback = cb;
return CY_AS_ERROR_SUCCESS ; return CY_AS_ERROR_SUCCESS;
} }
void void
...@@ -1067,20 +1067,20 @@ cy_as_ll_request_response__pack( ...@@ -1067,20 +1067,20 @@ cy_as_ll_request_response__pack(
uint32_t length, uint32_t length,
void *data_p) void *data_p)
{ {
uint16_t dt ; uint16_t dt;
uint8_t *dp = (uint8_t *)data_p ; uint8_t *dp = (uint8_t *)data_p;
while (length > 1) { while (length > 1) {
dt = ((*dp++) << 8) ; dt = ((*dp++) << 8);
dt |= (*dp++) ; dt |= (*dp++);
cy_as_ll_request_response__set_word(req_p, offset, dt) ; cy_as_ll_request_response__set_word(req_p, offset, dt);
offset++ ; offset++;
length -= 2 ; length -= 2;
} }
if (length == 1) { if (length == 1) {
dt = (*dp << 8) ; dt = (*dp << 8);
cy_as_ll_request_response__set_word(req_p, offset, dt) ; cy_as_ll_request_response__set_word(req_p, offset, dt);
} }
} }
...@@ -1091,16 +1091,16 @@ cy_as_ll_request_response__unpack( ...@@ -1091,16 +1091,16 @@ cy_as_ll_request_response__unpack(
uint32_t length, uint32_t length,
void *data_p) void *data_p)
{ {
uint8_t *dp = (uint8_t *)data_p ; uint8_t *dp = (uint8_t *)data_p;
while (length-- > 0) { while (length-- > 0) {
uint16_t val = cy_as_ll_request_response__get_word uint16_t val = cy_as_ll_request_response__get_word
(req_p, offset++) ; (req_p, offset++);
*dp++ = (uint8_t)((val >> 8) & 0xff) ; *dp++ = (uint8_t)((val >> 8) & 0xff);
if (length) { if (length) {
length-- ; length--;
*dp++ = (uint8_t)(val & 0xff) ; *dp++ = (uint8_t)(val & 0xff);
} }
} }
} }
...@@ -1112,24 +1112,24 @@ cy_as_ll_send_status_response( ...@@ -1112,24 +1112,24 @@ cy_as_ll_send_status_response(
uint16_t code, uint16_t code,
uint8_t clear_storage) uint8_t clear_storage)
{ {
cy_as_return_status_t ret ; cy_as_return_status_t ret;
cy_as_ll_request_response resp ; cy_as_ll_request_response resp;
cy_as_ll_request_response *resp_p = &resp ; cy_as_ll_request_response *resp_p = &resp;
cy_as_hal_mem_set(resp_p, 0, sizeof(resp)) ; cy_as_hal_mem_set(resp_p, 0, sizeof(resp));
resp_p->length = 1 ; resp_p->length = 1;
cy_as_ll_request_response__set_response(resp_p) ; cy_as_ll_request_response__set_response(resp_p);
cy_as_ll_request_response__set_context(resp_p, context) ; cy_as_ll_request_response__set_context(resp_p, context);
if (clear_storage) 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_code(resp_p, CY_RESP_SUCCESS_FAILURE);
cy_as_ll_request_response__set_word(resp_p, 0, code) ; 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 extern cy_as_return_status_t
...@@ -1140,90 +1140,90 @@ cy_as_ll_send_data_response( ...@@ -1140,90 +1140,90 @@ cy_as_ll_send_data_response(
uint16_t length, uint16_t length,
void *data) void *data)
{ {
cy_as_ll_request_response *resp_p ; cy_as_ll_request_response *resp_p;
uint16_t wlen ; uint16_t wlen;
uint8_t respbuf[256] ; uint8_t respbuf[256];
if (length > 192) if (length > 192)
return CY_AS_ERROR_INVALID_SIZE ; return CY_AS_ERROR_INVALID_SIZE;
/* Word length for bytes */ /* Word length for bytes */
wlen = length / 2 ; wlen = length / 2;
/* If byte length odd, add one more */ /* If byte length odd, add one more */
if (length % 2) if (length % 2)
wlen++ ; wlen++;
/* One for the length of field */ /* One for the length of field */
wlen++ ; wlen++;
resp_p = (cy_as_ll_request_response *)respbuf ; resp_p = (cy_as_ll_request_response *)respbuf;
cy_as_hal_mem_set(resp_p, 0, sizeof(respbuf)) ; cy_as_hal_mem_set(resp_p, 0, sizeof(respbuf));
resp_p->length = wlen ; resp_p->length = wlen;
cy_as_ll_request_response__set_context(resp_p, context) ; 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_code(resp_p, code);
cy_as_ll_request_response__set_word(resp_p, 0, length) ; 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__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 static cy_bool
cy_as_ll_is_e_p_transfer_related_request(cy_as_ll_request_response *rqt_p, cy_as_ll_is_e_p_transfer_related_request(cy_as_ll_request_response *rqt_p,
cy_as_end_point_number_t ep) cy_as_end_point_number_t ep)
{ {
uint16_t v ; uint16_t v;
uint8_t type = cy_as_ll_request_response__get_code(rqt_p) ; uint8_t type = cy_as_ll_request_response__get_code(rqt_p);
if (cy_as_ll_request_response__get_context(rqt_p) != if (cy_as_ll_request_response__get_context(rqt_p) !=
CY_RQT_USB_RQT_CONTEXT) CY_RQT_USB_RQT_CONTEXT)
return cy_false ; return cy_false;
/* /*
* when cancelling outstanding EP0 data transfers, any pending * when cancelling outstanding EP0 data transfers, any pending
* setup ACK requests also need to be cancelled. * setup ACK requests also need to be cancelled.
*/ */
if ((ep == 0) && (type == CY_RQT_ACK_SETUP_PACKET)) if ((ep == 0) && (type == CY_RQT_ACK_SETUP_PACKET))
return cy_true ; return cy_true;
if (type != CY_RQT_USB_EP_DATA) 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) 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_return_status_t
cy_as_ll_remove_ep_data_requests(cy_as_device *dev_p, cy_as_ll_remove_ep_data_requests(cy_as_device *dev_p,
cy_as_end_point_number_t ep) cy_as_end_point_number_t ep)
{ {
cy_as_context *ctxt_p ; cy_as_context *ctxt_p;
cy_as_ll_request_list_node *node_p ; cy_as_ll_request_list_node *node_p;
uint32_t imask ; uint32_t imask;
/* /*
* first, remove any queued requests * 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) { if (ctxt_p) {
for (node_p = ctxt_p->request_queue_p; node_p; for (node_p = ctxt_p->request_queue_p; node_p;
node_p = node_p->next) { node_p = node_p->next) {
if (cy_as_ll_is_e_p_transfer_related_request if (cy_as_ll_is_e_p_transfer_related_request
(node_p->rqt, ep)) { (node_p->rqt, ep)) {
cy_as_ll_remove_request(dev_p, ctxt_p, cy_as_ll_remove_request(dev_p, ctxt_p,
node_p->rqt, cy_false) ; node_p->rqt, cy_false);
break ; break;
} }
} }
/* /*
* now, deal with any request that may be in transit * 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 && if (ctxt_p->request_queue_p != 0 &&
cy_as_ll_is_e_p_transfer_related_request 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, ...@@ -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_get_node_state(ctxt_p->request_queue_p) ==
CY_AS_REQUEST_LIST_STATE_WAITING) { CY_AS_REQUEST_LIST_STATE_WAITING) {
cy_as_hal_print_message("need to remove an in-transit " 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 * 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, ...@@ -1240,25 +1240,25 @@ cy_as_ll_remove_ep_data_requests(cy_as_device *dev_p,
* terminated this transfer. * terminated this transfer.
*/ */
if (dev_p->ll_sending_rqt) if (dev_p->ll_sending_rqt)
dev_p->ll_abort_curr_rqt = cy_true ; dev_p->ll_abort_curr_rqt = cy_true;
else { 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) if (node_p->callback)
node_p->callback(dev_p, ctxt_p->number, node_p->callback(dev_p, ctxt_p->number,
node_p->rqt, node_p->resp, node_p->rqt, node_p->resp,
CY_AS_ERROR_CANCELED) ; CY_AS_ERROR_CANCELED);
ctxt_p->request_queue_p = node_p->next ; ctxt_p->request_queue_p = node_p->next;
state = cy_as_hal_disable_interrupts() ; state = cy_as_hal_disable_interrupts();
cy_as_hal_c_b_free(node_p) ; cy_as_hal_c_b_free(node_p);
cy_as_hal_enable_interrupts(state) ; 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;
} }
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -30,24 +30,24 @@ cy_as_mtp_func_callback(cy_as_device *dev_p, ...@@ -30,24 +30,24 @@ cy_as_mtp_func_callback(cy_as_device *dev_p,
uint8_t context, uint8_t context,
cy_as_ll_request_response *rqt, cy_as_ll_request_response *rqt,
cy_as_ll_request_response *resp, cy_as_ll_request_response *resp,
cy_as_return_status_t stat) ; cy_as_return_status_t stat);
static cy_as_return_status_t static cy_as_return_status_t
is_mtp_active(cy_as_device *dev_p) is_mtp_active(cy_as_device *dev_p)
{ {
if (!cy_as_device_is_configured(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)) 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) 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)) 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 static void
...@@ -57,75 +57,75 @@ my_mtp_request_callback(cy_as_device *dev_p, ...@@ -57,75 +57,75 @@ my_mtp_request_callback(cy_as_device *dev_p,
cy_as_ll_request_response *resp_p, cy_as_ll_request_response *resp_p,
cy_as_return_status_t ret) cy_as_return_status_t ret)
{ {
uint16_t val, ev, status ; uint16_t val, ev, status;
uint16_t mtp_datalen = 0 ; uint16_t mtp_datalen = 0;
uint32_t bytecount_l, bytecount_h ; uint32_t bytecount_l, bytecount_h;
cy_as_mtp_send_object_complete_data send_obj_data ; cy_as_mtp_send_object_complete_data send_obj_data;
cy_as_mtp_get_object_complete_data get_obj_data ; cy_as_mtp_get_object_complete_data get_obj_data;
cy_as_dma_end_point *ep_p ; 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)resp_p;
(void)context ; (void)context;
(void)ret ; (void)ret;
switch (code) { switch (code) {
case CY_RQT_MTP_EVENT: 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 */ /* MSB indicates status of read/write */
status = (val >> 8) & 0xFF ; status = (val >> 8) & 0xFF;
/* event type */ /* event type */
ev = val & 0xFF ; ev = val & 0xFF;
switch (ev) { switch (ev) {
case 0: /* SendObject Complete */ case 0: /* SendObject Complete */
{ {
bytecount_l = bytecount_l =
cy_as_ll_request_response__get_word cy_as_ll_request_response__get_word
(req_p, 1) ; (req_p, 1);
bytecount_h = bytecount_h =
cy_as_ll_request_response__get_word cy_as_ll_request_response__get_word
(req_p, 2) ; (req_p, 2);
send_obj_data.byte_count = 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 */ /* use the byte count again */
bytecount_l = bytecount_l =
cy_as_ll_request_response__get_word cy_as_ll_request_response__get_word
(req_p, 3) ; (req_p, 3);
bytecount_h = bytecount_h =
cy_as_ll_request_response__get_word cy_as_ll_request_response__get_word
(req_p, 4) ; (req_p, 4);
send_obj_data.transaction_id = 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) if (dev_p->mtp_event_cb)
dev_p->mtp_event_cb( dev_p->mtp_event_cb(
(cy_as_device_handle) dev_p, (cy_as_device_handle) dev_p,
cy_as_mtp_send_object_complete, cy_as_mtp_send_object_complete,
&send_obj_data) ; &send_obj_data);
} }
break ; break;
case 1: /* GetObject Complete */ case 1: /* GetObject Complete */
{ {
bytecount_l = bytecount_l =
cy_as_ll_request_response__get_word cy_as_ll_request_response__get_word
(req_p, 1) ; (req_p, 1);
bytecount_h = bytecount_h =
cy_as_ll_request_response__get_word cy_as_ll_request_response__get_word
(req_p, 2) ; (req_p, 2);
get_obj_data.byte_count = 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) if (dev_p->mtp_event_cb)
dev_p->mtp_event_cb( dev_p->mtp_event_cb(
...@@ -133,7 +133,7 @@ my_mtp_request_callback(cy_as_device *dev_p, ...@@ -133,7 +133,7 @@ my_mtp_request_callback(cy_as_device *dev_p,
cy_as_mtp_get_object_complete, cy_as_mtp_get_object_complete,
&get_obj_data); &get_obj_data);
} }
break ; break;
case 2: /* BlockTable Needed */ case 2: /* BlockTable Needed */
{ {
...@@ -142,40 +142,40 @@ my_mtp_request_callback(cy_as_device *dev_p, ...@@ -142,40 +142,40 @@ my_mtp_request_callback(cy_as_device *dev_p,
(cy_as_device_handle) dev_p, (cy_as_device_handle) dev_p,
cy_as_mtp_block_table_needed, 0); cy_as_mtp_block_table_needed, 0);
} }
break ; break;
default: 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_as_ll_send_data_response(dev_p,
CY_RQT_TUR_RQT_CONTEXT, CY_RQT_TUR_RQT_CONTEXT,
CY_RESP_MTP_INVALID_EVENT, CY_RESP_MTP_INVALID_EVENT,
sizeof(ev), &ev) ; sizeof(ev), &ev);
break ; break;
} }
break ; break;
case CY_RQT_TURBO_CMD_FROM_HOST: case CY_RQT_TURBO_CMD_FROM_HOST:
{ {
mtp_datalen = 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 /* Get the endpoint pointer based on
* the endpoint number */ * 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 /* The event should arrive only after the DMA operation
* has been queued. */ * 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 /* Put the len in ep data information in
* dmaqueue and kick start the queue */ * 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) { if (mtp_datalen == 0) {
cy_as_dma_completed_callback(dev_p->tag, cy_as_dma_completed_callback(dev_p->tag,
CY_AS_MTP_READ_ENDPOINT, 0, CY_AS_MTP_READ_ENDPOINT, 0,
CY_AS_ERROR_SUCCESS) ; CY_AS_ERROR_SUCCESS);
} else { } else {
ep_p->maxhwdata = mtp_datalen ; ep_p->maxhwdata = mtp_datalen;
/* /*
* make sure that the DMA status for this * make sure that the DMA status for this
...@@ -187,14 +187,14 @@ my_mtp_request_callback(cy_as_device *dev_p, ...@@ -187,14 +187,14 @@ my_mtp_request_callback(cy_as_device *dev_p,
* status here and start the next packet * status here and start the next packet
* transfer. * 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 */ /* Kick start the queue if it is not running */
cy_as_dma_kick_start(dev_p, cy_as_dma_kick_start(dev_p,
CY_AS_MTP_READ_ENDPOINT); CY_AS_MTP_READ_ENDPOINT);
} }
} }
break ; break;
case CY_RQT_TURBO_START_WRITE_DMA: case CY_RQT_TURBO_START_WRITE_DMA:
{ {
...@@ -207,23 +207,23 @@ my_mtp_request_callback(cy_as_device *dev_p, ...@@ -207,23 +207,23 @@ my_mtp_request_callback(cy_as_device *dev_p,
*/ */
cy_as_ll_send_status_response(dev_p, cy_as_ll_send_status_response(dev_p,
CY_RQT_TUR_RQT_CONTEXT, 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) ; ep_p = CY_AS_NUM_EP(dev_p, CY_AS_MTP_WRITE_ENDPOINT);
cy_as_hal_assert(ep_p->queue_p != 0) ; cy_as_hal_assert(ep_p->queue_p != 0);
cy_as_dma_end_point_set_stopped(ep_p) ; cy_as_dma_end_point_set_stopped(ep_p);
cy_as_dma_kick_start(dev_p, CY_AS_MTP_WRITE_ENDPOINT) ; cy_as_dma_kick_start(dev_p, CY_AS_MTP_WRITE_ENDPOINT);
} }
break ; break;
default: default:
cy_as_hal_print_message("invalid request received " cy_as_hal_print_message("invalid request received "
"on TUR context\n") ; "on TUR context\n");
val = req_p->box0 ; val = req_p->box0;
cy_as_ll_send_data_response(dev_p, CY_RQT_TUR_RQT_CONTEXT, cy_as_ll_send_data_response(dev_p, CY_RQT_TUR_RQT_CONTEXT,
CY_RESP_INVALID_REQUEST, sizeof(val), &val) ; CY_RESP_INVALID_REQUEST, sizeof(val), &val);
break ; break;
} }
} }
...@@ -232,21 +232,21 @@ my_handle_response_no_data(cy_as_device *dev_p, ...@@ -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 *req_p,
cy_as_ll_request_response *reply_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) != if (cy_as_ll_request_response__get_code(reply_p) !=
CY_RESP_SUCCESS_FAILURE) { CY_RESP_SUCCESS_FAILURE) {
ret = CY_AS_ERROR_INVALID_RESPONSE ; ret = CY_AS_ERROR_INVALID_RESPONSE;
goto destroy ; 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: destroy:
cy_as_ll_destroy_request(dev_p, req_p) ; cy_as_ll_destroy_request(dev_p, req_p);
cy_as_ll_destroy_response(dev_p, reply_p) ; cy_as_ll_destroy_response(dev_p, reply_p);
return ret ; return ret;
} }
static cy_as_return_status_t static cy_as_return_status_t
...@@ -256,48 +256,48 @@ my_handle_response_mtp_start(cy_as_device *dev_p, ...@@ -256,48 +256,48 @@ my_handle_response_mtp_start(cy_as_device *dev_p,
cy_as_return_status_t ret) cy_as_return_status_t ret)
{ {
if (ret != CY_AS_ERROR_SUCCESS) if (ret != CY_AS_ERROR_SUCCESS)
goto destroy ; goto destroy;
if (cy_as_ll_request_response__get_code(reply_p) != if (cy_as_ll_request_response__get_code(reply_p) !=
CY_RESP_SUCCESS_FAILURE) { CY_RESP_SUCCESS_FAILURE) {
ret = CY_AS_ERROR_INVALID_RESPONSE ; ret = CY_AS_ERROR_INVALID_RESPONSE;
goto destroy ; 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) 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_as_dma_enable_end_point(dev_p, CY_AS_MTP_READ_ENDPOINT,
cy_true, cy_as_direction_out) ; 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].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].dir = cy_as_usb_out;
dev_p->usb_config[CY_AS_MTP_READ_ENDPOINT].type = cy_as_usb_bulk ; 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_as_dma_enable_end_point(dev_p, CY_AS_MTP_WRITE_ENDPOINT,
cy_true, cy_as_direction_in) ; 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].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].dir = cy_as_usb_in;
dev_p->usb_config[CY_AS_MTP_WRITE_ENDPOINT].type = cy_as_usb_bulk ; dev_p->usb_config[CY_AS_MTP_WRITE_ENDPOINT].type = cy_as_usb_bulk;
/* Packet size is 512 bytes */ /* 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.*/ /* 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: destroy:
cy_as_ll_destroy_request(dev_p, req_p) ; cy_as_ll_destroy_request(dev_p, req_p);
cy_as_ll_destroy_response(dev_p, reply_p) ; cy_as_ll_destroy_response(dev_p, reply_p);
if (ret != CY_AS_ERROR_SUCCESS) if (ret != CY_AS_ERROR_SUCCESS)
cy_as_ll_register_request_callback(dev_p, 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, ...@@ -308,99 +308,99 @@ cy_as_mtp_start(cy_as_device_handle handle,
uint32_t client uint32_t client
) )
{ {
cy_as_ll_request_response *req_p, *reply_p ; cy_as_ll_request_response *req_p, *reply_p;
cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ; cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
cy_as_device *dev_p ; 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)) 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)) 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)) 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)) 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)) 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)) 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) if (dev_p->storage_count == 0)
return CY_AS_ERROR_NOT_RUNNING ; return CY_AS_ERROR_NOT_RUNNING;
if (dev_p->usb_count == 0) 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) 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) { 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 * we register here becuase the start request may cause
* events to occur before the response to the start request. * events to occur before the response to the start request.
*/ */
cy_as_ll_register_request_callback(dev_p, 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 */ /* Create the request to send to the West Bridge device */
req_p = cy_as_ll_create_request(dev_p, 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) { if (req_p == 0) {
cy_as_device_clear_m_s_s_pending(dev_p) ; cy_as_device_clear_m_s_s_pending(dev_p);
return CY_AS_ERROR_OUT_OF_MEMORY ; return CY_AS_ERROR_OUT_OF_MEMORY;
} }
/* Reserve space for the reply, the reply data will /* Reserve space for the reply, the reply data will
* not exceed one word */ * 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) { if (reply_p == 0) {
cy_as_ll_destroy_request(dev_p, req_p) ; cy_as_ll_destroy_request(dev_p, req_p);
cy_as_device_clear_m_s_s_pending(dev_p) ; cy_as_device_clear_m_s_s_pending(dev_p);
return CY_AS_ERROR_OUT_OF_MEMORY ; return CY_AS_ERROR_OUT_OF_MEMORY;
} }
if (cb == 0) { if (cb == 0) {
ret = cy_as_ll_send_request_wait_reply(dev_p, ret = cy_as_ll_send_request_wait_reply(dev_p,
req_p, reply_p) ; req_p, reply_p);
if (ret != CY_AS_ERROR_SUCCESS) if (ret != CY_AS_ERROR_SUCCESS)
goto destroy ; goto destroy;
return my_handle_response_mtp_start(dev_p, req_p, return my_handle_response_mtp_start(dev_p, req_p,
reply_p, ret) ; reply_p, ret);
} else { } else {
ret = cy_as_misc_send_request(dev_p, cb, client, ret = cy_as_misc_send_request(dev_p, cb, client,
CY_FUNCT_CB_MTP_START, 0, dev_p->func_cbs_mtp, CY_FUNCT_CB_MTP_START, 0, dev_p->func_cbs_mtp,
CY_AS_REQUEST_RESPONSE_EX, req_p, reply_p, 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) if (ret != CY_AS_ERROR_SUCCESS)
goto destroy ; goto destroy;
return ret ; return ret;
} }
destroy: destroy:
cy_as_ll_destroy_request(dev_p, req_p) ; cy_as_ll_destroy_request(dev_p, req_p);
cy_as_ll_destroy_response(dev_p, reply_p) ; cy_as_ll_destroy_response(dev_p, reply_p);
} else { } else {
dev_p->mtp_count++ ; dev_p->mtp_count++;
if (cb) 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 static cy_as_return_status_t
...@@ -410,35 +410,35 @@ my_handle_response_mtp_stop(cy_as_device *dev_p, ...@@ -410,35 +410,35 @@ my_handle_response_mtp_stop(cy_as_device *dev_p,
cy_as_return_status_t ret) cy_as_return_status_t ret)
{ {
if (ret != CY_AS_ERROR_SUCCESS) if (ret != CY_AS_ERROR_SUCCESS)
goto destroy ; goto destroy;
if (cy_as_ll_request_response__get_code(reply_p) != if (cy_as_ll_request_response__get_code(reply_p) !=
CY_RESP_SUCCESS_FAILURE) { CY_RESP_SUCCESS_FAILURE) {
ret = CY_AS_ERROR_INVALID_RESPONSE ; ret = CY_AS_ERROR_INVALID_RESPONSE;
goto destroy ; 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) if (ret != CY_AS_ERROR_SUCCESS)
goto destroy ; goto destroy;
/* /*
* we sucessfully shutdown the stack, so decrement * we sucessfully shutdown the stack, so decrement
* to make the count zero. * to make the count zero.
*/ */
dev_p->mtp_count-- ; dev_p->mtp_count--;
destroy: destroy:
cy_as_ll_destroy_request(dev_p, req_p) ; cy_as_ll_destroy_request(dev_p, req_p);
cy_as_ll_destroy_response(dev_p, reply_p) ; cy_as_ll_destroy_response(dev_p, reply_p);
if (ret != CY_AS_ERROR_SUCCESS) if (ret != CY_AS_ERROR_SUCCESS)
cy_as_ll_register_request_callback(dev_p, 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 cy_as_return_status_t
...@@ -447,81 +447,81 @@ cy_as_mtp_stop(cy_as_device_handle handle, ...@@ -447,81 +447,81 @@ cy_as_mtp_stop(cy_as_device_handle handle,
uint32_t client uint32_t client
) )
{ {
cy_as_ll_request_response *req_p = 0, *reply_p = 0 ; cy_as_ll_request_response *req_p = 0, *reply_p = 0;
cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ; 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)) 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) if (ret != CY_AS_ERROR_SUCCESS)
return ret ; return ret;
if (cy_as_device_is_in_callback(dev_p)) 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)) 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) { if (dev_p->mtp_count == 1) {
/* Create the request to send to the West /* Create the request to send to the West
* Bridge device */ * Bridge device */
req_p = cy_as_ll_create_request(dev_p, CY_RQT_STOP_MTP, 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) { if (req_p == 0) {
ret = CY_AS_ERROR_OUT_OF_MEMORY ; ret = CY_AS_ERROR_OUT_OF_MEMORY;
goto destroy ; goto destroy;
} }
/* Reserve space for the reply, the reply data will /* Reserve space for the reply, the reply data will
* not exceed one word */ * 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) { if (reply_p == 0) {
ret = CY_AS_ERROR_OUT_OF_MEMORY ; ret = CY_AS_ERROR_OUT_OF_MEMORY;
goto destroy ; goto destroy;
} }
if (cb == 0) { if (cb == 0) {
ret = cy_as_ll_send_request_wait_reply(dev_p, ret = cy_as_ll_send_request_wait_reply(dev_p,
req_p, reply_p) ; req_p, reply_p);
if (ret != CY_AS_ERROR_SUCCESS) if (ret != CY_AS_ERROR_SUCCESS)
goto destroy ; goto destroy;
return my_handle_response_mtp_stop(dev_p, req_p, return my_handle_response_mtp_stop(dev_p, req_p,
reply_p, ret) ; reply_p, ret);
} else { } else {
ret = cy_as_misc_send_request(dev_p, cb, client, ret = cy_as_misc_send_request(dev_p, cb, client,
CY_FUNCT_CB_MTP_STOP, 0, dev_p->func_cbs_mtp, CY_FUNCT_CB_MTP_STOP, 0, dev_p->func_cbs_mtp,
CY_AS_REQUEST_RESPONSE_EX, req_p, reply_p, 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) if (ret != CY_AS_ERROR_SUCCESS)
goto destroy ; goto destroy;
return ret ; return ret;
} }
destroy: destroy:
cy_as_ll_destroy_request(dev_p, req_p) ; cy_as_ll_destroy_request(dev_p, req_p);
cy_as_ll_destroy_response(dev_p, reply_p) ; cy_as_ll_destroy_response(dev_p, reply_p);
} else if (dev_p->mtp_count > 1) { } else if (dev_p->mtp_count > 1) {
dev_p->mtp_count-- ; dev_p->mtp_count--;
if (cb) 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 static void
...@@ -532,24 +532,24 @@ mtp_write_callback( ...@@ -532,24 +532,24 @@ mtp_write_callback(
cy_as_ll_request_response *resp, cy_as_ll_request_response *resp,
cy_as_return_status_t ret) 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 (ret == CY_AS_ERROR_SUCCESS) {
if (cy_as_ll_request_response__get_code(resp) != if (cy_as_ll_request_response__get_code(resp) !=
CY_RESP_SUCCESS_FAILURE) CY_RESP_SUCCESS_FAILURE)
ret = CY_AS_ERROR_INVALID_RESPONSE ; ret = CY_AS_ERROR_INVALID_RESPONSE;
else 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) { if (ret != CY_AS_ERROR_SUCCESS) {
/* Firmware failed the request. Cancel the DMA transfer. */ /* Firmware failed the request. Cancel the DMA transfer. */
cy_as_dma_cancel(dev_p, 0x04, CY_AS_ERROR_CANCELED) ; cy_as_dma_cancel(dev_p, 0x04, CY_AS_ERROR_CANCELED);
cy_as_device_clear_storage_async_pending(dev_p) ; cy_as_device_clear_storage_async_pending(dev_p);
} }
cy_as_ll_destroy_response(dev_p, resp) ; cy_as_ll_destroy_response(dev_p, resp);
cy_as_ll_destroy_request(dev_p, rqt) ; cy_as_ll_destroy_request(dev_p, rqt);
} }
static void static void
...@@ -557,25 +557,25 @@ async_write_request_callback(cy_as_device *dev_p, ...@@ -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_end_point_number_t ep, void *buf_p, uint32_t size,
cy_as_return_status_t err) cy_as_return_status_t err)
{ {
cy_as_device_handle h ; cy_as_device_handle h;
cy_as_function_callback cb ; cy_as_function_callback cb;
(void)size ; (void)size;
(void)buf_p ; (void)buf_p;
(void)ep ; (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 ; cb = dev_p->mtp_cb;
dev_p->mtp_cb = 0 ; 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) 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 ...@@ -583,11 +583,11 @@ static void
sync_mtp_callback(cy_as_device *dev_p, cy_as_end_point_number_t ep, 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 *buf_p, uint32_t size, cy_as_return_status_t err)
{ {
(void)ep ; (void)ep;
(void)buf_p ; (void)buf_p;
(void)size ; (void)size;
dev_p->mtp_error = err ; dev_p->mtp_error = err;
} }
static cy_as_return_status_t static cy_as_return_status_t
...@@ -600,131 +600,131 @@ cy_as_mtp_operation(cy_as_device *dev_p, ...@@ -600,131 +600,131 @@ cy_as_mtp_operation(cy_as_device *dev_p,
uint8_t rqttype uint8_t rqttype
) )
{ {
cy_as_ll_request_response *req_p = 0, *reply_p = 0 ; cy_as_ll_request_response *req_p = 0, *reply_p = 0;
cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ; cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
uint32_t mask = 0 ; uint32_t mask = 0;
cy_as_funct_c_b_type mtp_cb_op = 0 ; cy_as_funct_c_b_type mtp_cb_op = 0;
uint16_t size = 2 ; uint16_t size = 2;
if (dev_p->mtp_count == 0) 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) { if (rqttype == CY_RQT_INIT_SEND_OBJECT) {
mtp_cb_op = CY_FUNCT_CB_MTP_INIT_SEND_OBJECT ; mtp_cb_op = CY_FUNCT_CB_MTP_INIT_SEND_OBJECT;
dev_p->mtp_turbo_active = cy_true ; dev_p->mtp_turbo_active = cy_true;
} else if (rqttype == CY_RQT_INIT_GET_OBJECT) { } else if (rqttype == CY_RQT_INIT_GET_OBJECT) {
mtp_cb_op = CY_FUNCT_CB_MTP_INIT_GET_OBJECT ; mtp_cb_op = CY_FUNCT_CB_MTP_INIT_GET_OBJECT;
dev_p->mtp_turbo_active = cy_true ; dev_p->mtp_turbo_active = cy_true;
} else } 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) if (ret != CY_AS_ERROR_SUCCESS)
return ret ; return ret;
if (CY_RQT_INIT_GET_OBJECT == rqttype) if (CY_RQT_INIT_GET_OBJECT == rqttype)
size = 4 ; size = 4;
/* Create the request to send to the West /* Create the request to send to the West
* Bridge device */ * Bridge device */
req_p = cy_as_ll_create_request(dev_p, rqttype, 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) { if (req_p == 0) {
ret = CY_AS_ERROR_OUT_OF_MEMORY ; ret = CY_AS_ERROR_OUT_OF_MEMORY;
goto destroy ; goto destroy;
} }
/* Reserve space for the reply, the reply data will /* Reserve space for the reply, the reply data will
* not exceed one word */ * 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) { if (reply_p == 0) {
ret = CY_AS_ERROR_OUT_OF_MEMORY ; ret = CY_AS_ERROR_OUT_OF_MEMORY;
goto destroy ; goto destroy;
} }
cy_as_ll_request_response__set_word(req_p, 0, 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, 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 it is GET_OBJECT, send transaction id as well*/
if (CY_RQT_INIT_GET_OBJECT == rqttype) { if (CY_RQT_INIT_GET_OBJECT == rqttype) {
cy_as_ll_request_response__set_word(req_p, 2, 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, 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) { if (cb == 0) {
/* Queue the DMA request for block table write */ /* Queue the DMA request for block table write */
ret = cy_as_dma_queue_request(dev_p, 4, blk_table, ret = cy_as_dma_queue_request(dev_p, 4, blk_table,
sizeof(cy_as_mtp_block_table), cy_false, 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, ret = cy_as_ll_send_request_wait_reply(dev_p,
req_p, reply_p) ; req_p, reply_p);
if (ret != CY_AS_ERROR_SUCCESS) { if (ret != CY_AS_ERROR_SUCCESS) {
cy_as_dma_cancel(dev_p, 4, CY_AS_ERROR_CANCELED) ; cy_as_dma_cancel(dev_p, 4, CY_AS_ERROR_CANCELED);
cy_as_device_clear_storage_async_pending(dev_p) ; 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) if (ret != CY_AS_ERROR_SUCCESS)
goto destroy ; goto destroy;
ret = dev_p->mtp_error ; ret = dev_p->mtp_error;
goto destroy ; goto destroy;
} else { } else {
#if 0 #if 0
ret = cy_as_misc_send_request(dev_p, cb, client, ret = cy_as_misc_send_request(dev_p, cb, client,
CY_FUNCT_CB_MTP_INIT_SEND_OBJECT, CY_FUNCT_CB_MTP_INIT_SEND_OBJECT,
0, dev_p->func_cbs_mtp, CY_AS_REQUEST_RESPONSE_EX, 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) if (ret != CY_AS_ERROR_SUCCESS)
goto destroy ; goto destroy;
#endif #endif
/* Protection from interrupt driven code */ /* Protection from interrupt driven code */
/* since we are using storage EP4 check if any /* since we are using storage EP4 check if any
* storage activity is pending */ * 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)) || if ((cy_as_device_is_storage_async_pending(dev_p)) ||
(dev_p->storage_wait)) { (dev_p->storage_wait)) {
cy_as_hal_enable_interrupts(mask) ; cy_as_hal_enable_interrupts(mask);
return CY_AS_ERROR_ASYNC_PENDING ; return CY_AS_ERROR_ASYNC_PENDING;
} }
cy_as_device_set_storage_async_pending(dev_p) ; cy_as_device_set_storage_async_pending(dev_p);
cy_as_hal_enable_interrupts(mask) ; cy_as_hal_enable_interrupts(mask);
dev_p->mtp_cb = cb ; dev_p->mtp_cb = cb;
dev_p->mtp_client = client ; dev_p->mtp_client = client;
dev_p->mtp_op = mtp_cb_op ; dev_p->mtp_op = mtp_cb_op;
ret = cy_as_ll_send_request(dev_p, req_p, reply_p, 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 (ret != CY_AS_ERROR_SUCCESS)
goto destroy ; goto destroy;
ret = cy_as_dma_queue_request(dev_p, 4, blk_table, ret = cy_as_dma_queue_request(dev_p, 4, blk_table,
sizeof(cy_as_mtp_block_table), cy_false, cy_false, sizeof(cy_as_mtp_block_table), cy_false, cy_false,
async_write_request_callback) ; async_write_request_callback);
if (ret != CY_AS_ERROR_SUCCESS) if (ret != CY_AS_ERROR_SUCCESS)
return ret ; return ret;
/* Kick start the queue if it is not running */ /* 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: destroy:
cy_as_ll_destroy_request(dev_p, req_p) ; cy_as_ll_destroy_request(dev_p, req_p);
cy_as_ll_destroy_response(dev_p, reply_p) ; cy_as_ll_destroy_response(dev_p, reply_p);
return ret ; return ret;
} }
cy_as_return_status_t cy_as_return_status_t
...@@ -735,13 +735,13 @@ cy_as_mtp_init_send_object(cy_as_device_handle handle, ...@@ -735,13 +735,13 @@ cy_as_mtp_init_send_object(cy_as_device_handle handle,
uint32_t client 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 (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE)) 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, 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, ...@@ -754,13 +754,13 @@ cy_as_mtp_init_get_object(cy_as_device_handle handle,
uint32_t client 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 (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE)) 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, 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, ...@@ -771,24 +771,24 @@ my_handle_response_cancel_send_object(cy_as_device *dev_p,
cy_as_return_status_t ret) cy_as_return_status_t ret)
{ {
if (ret != CY_AS_ERROR_SUCCESS) if (ret != CY_AS_ERROR_SUCCESS)
goto destroy ; goto destroy;
if (cy_as_ll_request_response__get_code(reply_p) != if (cy_as_ll_request_response__get_code(reply_p) !=
CY_RESP_SUCCESS_FAILURE) { CY_RESP_SUCCESS_FAILURE) {
ret = CY_AS_ERROR_INVALID_RESPONSE ; ret = CY_AS_ERROR_INVALID_RESPONSE;
goto destroy ; 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) if (ret != CY_AS_ERROR_SUCCESS)
goto destroy ; goto destroy;
destroy: destroy:
cy_as_ll_destroy_request(dev_p, req_p) ; cy_as_ll_destroy_request(dev_p, req_p);
cy_as_ll_destroy_response(dev_p, reply_p) ; cy_as_ll_destroy_response(dev_p, reply_p);
return ret ; return ret;
} }
cy_as_return_status_t cy_as_return_status_t
...@@ -797,58 +797,58 @@ cy_as_mtp_cancel_send_object(cy_as_device_handle handle, ...@@ -797,58 +797,58 @@ cy_as_mtp_cancel_send_object(cy_as_device_handle handle,
uint32_t client uint32_t client
) )
{ {
cy_as_ll_request_response *req_p = 0, *reply_p = 0 ; cy_as_ll_request_response *req_p = 0, *reply_p = 0;
cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ; cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
cy_as_device *dev_p ; 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)) 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) 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 */ /* Create the request to send to the West Bridge device */
req_p = cy_as_ll_create_request(dev_p, 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) { if (req_p == 0) {
ret = CY_AS_ERROR_OUT_OF_MEMORY ; ret = CY_AS_ERROR_OUT_OF_MEMORY;
goto destroy ; goto destroy;
} }
/* Reserve space for the reply, the reply data will /* Reserve space for the reply, the reply data will
* not exceed one word */ * 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) { if (reply_p == 0) {
ret = CY_AS_ERROR_OUT_OF_MEMORY ; ret = CY_AS_ERROR_OUT_OF_MEMORY;
goto destroy ; goto destroy;
} }
if (cb == 0) { if (cb == 0) {
ret = cy_as_ll_send_request_wait_reply(dev_p, ret = cy_as_ll_send_request_wait_reply(dev_p,
req_p, reply_p) ; req_p, reply_p);
if (ret != CY_AS_ERROR_SUCCESS) if (ret != CY_AS_ERROR_SUCCESS)
goto destroy ; goto destroy;
return my_handle_response_cancel_send_object(dev_p, return my_handle_response_cancel_send_object(dev_p,
req_p, reply_p, ret) ; req_p, reply_p, ret);
} else { } else {
ret = cy_as_misc_send_request(dev_p, cb, client, ret = cy_as_misc_send_request(dev_p, cb, client,
CY_FUNCT_CB_MTP_CANCEL_SEND_OBJECT, 0, CY_FUNCT_CB_MTP_CANCEL_SEND_OBJECT, 0,
dev_p->func_cbs_mtp, CY_AS_REQUEST_RESPONSE_EX, 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) if (ret != CY_AS_ERROR_SUCCESS)
goto destroy ; goto destroy;
return ret ; return ret;
} }
destroy: destroy:
cy_as_ll_destroy_request(dev_p, req_p) ; cy_as_ll_destroy_request(dev_p, req_p);
cy_as_ll_destroy_response(dev_p, reply_p) ; cy_as_ll_destroy_response(dev_p, reply_p);
return ret ; return ret;
} }
static cy_as_return_status_t static cy_as_return_status_t
...@@ -858,24 +858,24 @@ my_handle_response_cancel_get_object(cy_as_device *dev_p, ...@@ -858,24 +858,24 @@ my_handle_response_cancel_get_object(cy_as_device *dev_p,
cy_as_return_status_t ret) cy_as_return_status_t ret)
{ {
if (ret != CY_AS_ERROR_SUCCESS) if (ret != CY_AS_ERROR_SUCCESS)
goto destroy ; goto destroy;
if (cy_as_ll_request_response__get_code(reply_p) != if (cy_as_ll_request_response__get_code(reply_p) !=
CY_RESP_SUCCESS_FAILURE) { CY_RESP_SUCCESS_FAILURE) {
ret = CY_AS_ERROR_INVALID_RESPONSE ; ret = CY_AS_ERROR_INVALID_RESPONSE;
goto destroy ; 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) if (ret != CY_AS_ERROR_SUCCESS)
goto destroy ; goto destroy;
destroy: destroy:
cy_as_ll_destroy_request(dev_p, req_p) ; cy_as_ll_destroy_request(dev_p, req_p);
cy_as_ll_destroy_response(dev_p, reply_p) ; cy_as_ll_destroy_response(dev_p, reply_p);
return ret ; return ret;
} }
cy_as_return_status_t cy_as_return_status_t
...@@ -884,58 +884,58 @@ cy_as_mtp_cancel_get_object(cy_as_device_handle handle, ...@@ -884,58 +884,58 @@ cy_as_mtp_cancel_get_object(cy_as_device_handle handle,
uint32_t client uint32_t client
) )
{ {
cy_as_ll_request_response *req_p = 0, *reply_p = 0 ; cy_as_ll_request_response *req_p = 0, *reply_p = 0;
cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ; cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
cy_as_device *dev_p ; 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)) 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) 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 */ /* Create the request to send to the West Bridge device */
req_p = cy_as_ll_create_request(dev_p, CY_RQT_CANCEL_GET_OBJECT, 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) { if (req_p == 0) {
ret = CY_AS_ERROR_OUT_OF_MEMORY ; ret = CY_AS_ERROR_OUT_OF_MEMORY;
goto destroy ; goto destroy;
} }
/* Reserve space for the reply, the reply data will /* Reserve space for the reply, the reply data will
* not exceed one word */ * 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) { if (reply_p == 0) {
ret = CY_AS_ERROR_OUT_OF_MEMORY ; ret = CY_AS_ERROR_OUT_OF_MEMORY;
goto destroy ; goto destroy;
} }
if (cb == 0) { if (cb == 0) {
ret = cy_as_ll_send_request_wait_reply(dev_p, ret = cy_as_ll_send_request_wait_reply(dev_p,
req_p, reply_p) ; req_p, reply_p);
if (ret != CY_AS_ERROR_SUCCESS) if (ret != CY_AS_ERROR_SUCCESS)
goto destroy ; goto destroy;
return my_handle_response_cancel_get_object(dev_p, return my_handle_response_cancel_get_object(dev_p,
req_p, reply_p, ret) ; req_p, reply_p, ret);
} else { } else {
ret = cy_as_misc_send_request(dev_p, cb, client, ret = cy_as_misc_send_request(dev_p, cb, client,
CY_FUNCT_CB_MTP_CANCEL_GET_OBJECT, 0, CY_FUNCT_CB_MTP_CANCEL_GET_OBJECT, 0,
dev_p->func_cbs_mtp, CY_AS_REQUEST_RESPONSE_EX, 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) if (ret != CY_AS_ERROR_SUCCESS)
goto destroy ; goto destroy;
return ret ; return ret;
} }
destroy: destroy:
cy_as_ll_destroy_request(dev_p, req_p) ; cy_as_ll_destroy_request(dev_p, req_p);
cy_as_ll_destroy_response(dev_p, reply_p) ; cy_as_ll_destroy_response(dev_p, reply_p);
return ret ; return ret;
} }
cy_as_return_status_t cy_as_return_status_t
...@@ -944,13 +944,13 @@ cy_as_mtp_send_block_table(cy_as_device_handle handle, ...@@ -944,13 +944,13 @@ cy_as_mtp_send_block_table(cy_as_device_handle handle,
cy_as_function_callback cb, cy_as_function_callback cb,
uint32_t client) 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 (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE)) 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, 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 static void
...@@ -961,67 +961,67 @@ cy_as_mtp_func_callback(cy_as_device *dev_p, ...@@ -961,67 +961,67 @@ cy_as_mtp_func_callback(cy_as_device *dev_p,
cy_as_return_status_t stat) cy_as_return_status_t stat)
{ {
cy_as_func_c_b_node* node = (cy_as_func_c_b_node *) cy_as_func_c_b_node* node = (cy_as_func_c_b_node *)
dev_p->func_cbs_mtp->head_p ; dev_p->func_cbs_mtp->head_p;
cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ; cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
uint8_t code ; uint8_t code;
cy_bool delay_callback = cy_false ; 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->count != 0);
cy_as_hal_assert(dev_p->func_cbs_mtp->type == CYAS_FUNC_CB) ; cy_as_hal_assert(dev_p->func_cbs_mtp->type == CYAS_FUNC_CB);
(void)context ; (void)context;
/* The Handlers are responsible for Deleting the /* The Handlers are responsible for Deleting the
* rqt and resp when they are finished * 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) { switch (code) {
case CY_RQT_START_MTP: case CY_RQT_START_MTP:
ret = my_handle_response_mtp_start(dev_p, rqt, ret = my_handle_response_mtp_start(dev_p, rqt,
resp, stat) ; resp, stat);
break ; break;
case CY_RQT_STOP_MTP: case CY_RQT_STOP_MTP:
ret = my_handle_response_mtp_stop(dev_p, rqt, ret = my_handle_response_mtp_stop(dev_p, rqt,
resp, stat) ; resp, stat);
break ; break;
#if 0 #if 0
case CY_RQT_INIT_SEND_OBJECT: case CY_RQT_INIT_SEND_OBJECT:
ret = my_handle_response_init_send_object(dev_p, ret = my_handle_response_init_send_object(dev_p,
rqt, resp, stat, cy_true) ; rqt, resp, stat, cy_true);
delay_callback = cy_true ; delay_callback = cy_true;
break ; break;
#endif #endif
case CY_RQT_CANCEL_SEND_OBJECT: case CY_RQT_CANCEL_SEND_OBJECT:
ret = my_handle_response_cancel_send_object(dev_p, ret = my_handle_response_cancel_send_object(dev_p,
rqt, resp, stat) ; rqt, resp, stat);
break ; break;
#if 0 #if 0
case CY_RQT_INIT_GET_OBJECT: case CY_RQT_INIT_GET_OBJECT:
ret = my_handle_response_init_get_object(dev_p, ret = my_handle_response_init_get_object(dev_p,
rqt, resp, stat, cy_true) ; rqt, resp, stat, cy_true);
delay_callback = cy_true ; delay_callback = cy_true;
break ; break;
#endif #endif
case CY_RQT_CANCEL_GET_OBJECT: case CY_RQT_CANCEL_GET_OBJECT:
ret = my_handle_response_cancel_get_object(dev_p, ret = my_handle_response_cancel_get_object(dev_p,
rqt, resp, stat) ; rqt, resp, stat);
break ; break;
#if 0 #if 0
case CY_RQT_SEND_BLOCK_TABLE: case CY_RQT_SEND_BLOCK_TABLE:
ret = my_handle_response_send_block_table(dev_p, rqt, ret = my_handle_response_send_block_table(dev_p, rqt,
resp, stat, cy_true) ; resp, stat, cy_true);
delay_callback = cy_true ; delay_callback = cy_true;
break ; break;
#endif #endif
case CY_RQT_ENABLE_USB_PATH: 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) if (ret == CY_AS_ERROR_SUCCESS)
dev_p->is_storage_only_mode = cy_false ; dev_p->is_storage_only_mode = cy_false;
break ; break;
default: default:
ret = CY_AS_ERROR_INVALID_RESPONSE ; ret = CY_AS_ERROR_INVALID_RESPONSE;
cy_as_hal_assert(cy_false) ; cy_as_hal_assert(cy_false);
break ; break;
} }
/* /*
...@@ -1030,33 +1030,33 @@ cy_as_mtp_func_callback(cy_as_device *dev_p, ...@@ -1030,33 +1030,33 @@ cy_as_mtp_func_callback(cy_as_device *dev_p,
* based on the response from firmware. * based on the response from firmware.
*/ */
if (stat == CY_AS_ERROR_SUCCESS) if (stat == CY_AS_ERROR_SUCCESS)
stat = ret ; stat = ret;
if (!delay_callback) { if (!delay_callback) {
node->cb_p((cy_as_device_handle)dev_p, stat, node->client_data, node->cb_p((cy_as_device_handle)dev_p, stat, node->client_data,
node->data_type, node->data) ; node->data_type, node->data);
cy_as_remove_c_b_node(dev_p->func_cbs_mtp) ; cy_as_remove_c_b_node(dev_p->func_cbs_mtp);
} }
} }
cy_as_return_status_t cy_as_return_status_t
cy_as_mtp_storage_only_start(cy_as_device_handle handle) 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)) 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)) 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)) 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) 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 ; dev_p->is_storage_only_mode = cy_true;
return CY_AS_ERROR_SUCCESS ; return CY_AS_ERROR_SUCCESS;
} }
cy_as_return_status_t cy_as_return_status_t
...@@ -1064,65 +1064,65 @@ cy_as_mtp_storage_only_stop(cy_as_device_handle handle, ...@@ -1064,65 +1064,65 @@ cy_as_mtp_storage_only_stop(cy_as_device_handle handle,
cy_as_function_callback cb, cy_as_function_callback cb,
uint32_t client) uint32_t client)
{ {
cy_as_device *dev_p = (cy_as_device *)handle ; cy_as_device *dev_p = (cy_as_device *)handle;
cy_as_ll_request_response *req_p, *reply_p ; cy_as_ll_request_response *req_p, *reply_p;
cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS ; cy_as_return_status_t ret = CY_AS_ERROR_SUCCESS;
if (!dev_p || (dev_p->sig != CY_AS_DEVICE_HANDLE_SIGNATURE)) 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)) 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)) 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) 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) 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)) 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, 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) 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) { if (reply_p == 0) {
cy_as_ll_destroy_request(dev_p, req_p) ; cy_as_ll_destroy_request(dev_p, req_p);
return CY_AS_ERROR_OUT_OF_MEMORY ; return CY_AS_ERROR_OUT_OF_MEMORY;
} }
if (cb == 0) { if (cb == 0) {
ret = cy_as_ll_send_request_wait_reply(dev_p, ret = cy_as_ll_send_request_wait_reply(dev_p,
req_p, reply_p) ; req_p, reply_p);
if (ret != CY_AS_ERROR_SUCCESS) if (ret != CY_AS_ERROR_SUCCESS)
goto destroy ; goto destroy;
ret = my_handle_response_no_data(dev_p, req_p, ret = my_handle_response_no_data(dev_p, req_p,
reply_p) ; reply_p);
if (ret == CY_AS_ERROR_SUCCESS) if (ret == CY_AS_ERROR_SUCCESS)
dev_p->is_storage_only_mode = cy_false ; dev_p->is_storage_only_mode = cy_false;
return ret ; return ret;
} else { } else {
ret = cy_as_misc_send_request(dev_p, cb, client, ret = cy_as_misc_send_request(dev_p, cb, client,
CY_FUNCT_CB_MTP_STOP_STORAGE_ONLY, 0, CY_FUNCT_CB_MTP_STOP_STORAGE_ONLY, 0,
dev_p->func_cbs_mtp, CY_AS_REQUEST_RESPONSE_EX, 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) if (ret != CY_AS_ERROR_SUCCESS)
goto destroy ; goto destroy;
return ret ; return ret;
} }
destroy: destroy:
cy_as_ll_destroy_request(dev_p, req_p) ; cy_as_ll_destroy_request(dev_p, req_p);
cy_as_ll_destroy_response(dev_p, reply_p) ; cy_as_ll_destroy_response(dev_p, reply_p);
return ret ; return ret;
} }
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -135,7 +135,7 @@ typedef enum cy_as_hal_dma_type { ...@@ -135,7 +135,7 @@ typedef enum cy_as_hal_dma_type {
cy_as_hal_read, cy_as_hal_read,
cy_as_hal_write, cy_as_hal_write,
cy_as_hal_none 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 { ...@@ -146,9 +146,9 @@ typedef enum cy_as_hal_dma_type {
((struct scatterlist *) ((sg)->page_link & ~0x03)) ((struct scatterlist *) ((sg)->page_link & ~0x03))
*/ */
typedef struct cy_as_hal_endpoint_dma { typedef struct cy_as_hal_endpoint_dma {
cy_bool buffer_valid ; cy_bool buffer_valid;
uint8_t *data_p ; uint8_t *data_p;
uint32_t size ; uint32_t size;
/* /*
* sg_list_enabled - if true use, r/w DMA transfers use sg list, * sg_list_enabled - if true use, r/w DMA transfers use sg list,
* FALSE use pointer to a buffer * FALSE use pointer to a buffer
...@@ -162,14 +162,14 @@ typedef struct cy_as_hal_endpoint_dma { ...@@ -162,14 +162,14 @@ typedef struct cy_as_hal_endpoint_dma {
* req_length - total request length * req_length - total request length
*/ */
bool sg_list_enabled; bool sg_list_enabled;
struct scatterlist *sg_p ; struct scatterlist *sg_p;
uint16_t dma_xfer_sz; uint16_t dma_xfer_sz;
uint32_t seg_xfer_cnt; uint32_t seg_xfer_cnt;
uint16_t req_xfer_cnt; uint16_t req_xfer_cnt;
uint16_t req_length; uint16_t req_length;
cy_as_hal_dma_type type ; cy_as_hal_dma_type type;
cy_bool pending ; cy_bool pending;
} cy_as_hal_endpoint_dma ; } cy_as_hal_endpoint_dma;
/* /*
* The list of OMAP devices (should be one) * The list of OMAP devices (should be one)
...@@ -184,7 +184,7 @@ static cy_as_hal_dma_complete_callback callback; ...@@ -184,7 +184,7 @@ static cy_as_hal_dma_complete_callback callback;
/* /*
* Pending data size for the endpoints * 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 * Forward declaration
...@@ -193,7 +193,7 @@ static void cy_handle_d_r_q_interrupt(cy_as_omap_dev_kernel *dev_p); ...@@ -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 uint16_t intr_sequence_num;
static uint8_t intr__enable; static uint8_t intr__enable;
spinlock_t int_lock ; spinlock_t int_lock;
static u32 iomux_vma; static u32 iomux_vma;
static u32 csa_phy; static u32 csa_phy;
...@@ -201,7 +201,7 @@ static u32 csa_phy; ...@@ -201,7 +201,7 @@ static u32 csa_phy;
/* /*
* gpmc I/O registers VMA * gpmc I/O registers VMA
*/ */
static u32 gpmc_base ; static u32 gpmc_base;
/* /*
* gpmc data VMA associated with CS4 (ASTORIA CS on GPMC) * gpmc data VMA associated with CS4 (ASTORIA CS on GPMC)
...@@ -496,8 +496,8 @@ static irqreturn_t cy_astoria_int_handler(int irq, ...@@ -496,8 +496,8 @@ static irqreturn_t cy_astoria_int_handler(int irq,
void *dev_id, struct pt_regs *regs) void *dev_id, struct pt_regs *regs)
{ {
cy_as_omap_dev_kernel *dev_p; cy_as_omap_dev_kernel *dev_p;
uint16_t read_val = 0 ; uint16_t read_val = 0;
uint16_t mask_val = 0 ; uint16_t mask_val = 0;
/* /*
* debug stuff, counts number of loops per one intr trigger * debug stuff, counts number of loops per one intr trigger
...@@ -520,7 +520,7 @@ static irqreturn_t cy_astoria_int_handler(int irq, ...@@ -520,7 +520,7 @@ static irqreturn_t cy_astoria_int_handler(int irq,
/* /*
* this one just for debugging * this one just for debugging
*/ */
intr_sequence_num++ ; intr_sequence_num++;
/* /*
* astoria device handle * astoria device handle
...@@ -531,13 +531,13 @@ static irqreturn_t cy_astoria_int_handler(int irq, ...@@ -531,13 +531,13 @@ static irqreturn_t cy_astoria_int_handler(int irq,
* read Astoria intr register * read Astoria intr register
*/ */
read_val = cy_as_hal_read_register((cy_as_hal_device_tag)dev_p, 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 * save current mask value
*/ */
mask_val = cy_as_hal_read_register((cy_as_hal_device_tag)dev_p, 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", DBGPRN("<1>HAL__intr__enter:_seq:%d, P0_INTR_REG:%x\n",
intr_sequence_num, read_val); intr_sequence_num, read_val);
...@@ -546,7 +546,7 @@ static irqreturn_t cy_astoria_int_handler(int irq, ...@@ -546,7 +546,7 @@ static irqreturn_t cy_astoria_int_handler(int irq,
* Disable WB interrupt signal generation while we are in ISR * Disable WB interrupt signal generation while we are in ISR
*/ */
cy_as_hal_write_register((cy_as_hal_device_tag)dev_p, 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 * this is a DRQ Interrupt
...@@ -559,7 +559,7 @@ static irqreturn_t cy_astoria_int_handler(int irq, ...@@ -559,7 +559,7 @@ static irqreturn_t cy_astoria_int_handler(int irq,
*/ */
drq_loop_cnt++; 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 * spending to much time in ISR may impact
...@@ -577,7 +577,7 @@ static irqreturn_t cy_astoria_int_handler(int irq, ...@@ -577,7 +577,7 @@ static irqreturn_t cy_astoria_int_handler(int irq,
} }
if (read_val & sentinel) 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," DBGPRN("<1>_hal:_intr__exit seq:%d, mask=%4.4x,"
"int_pin:%d DRQ_jobs:%d\n", "int_pin:%d DRQ_jobs:%d\n",
...@@ -590,9 +590,9 @@ static irqreturn_t cy_astoria_int_handler(int irq, ...@@ -590,9 +590,9 @@ static irqreturn_t cy_astoria_int_handler(int irq,
* re-enable WB hw interrupts * re-enable WB hw interrupts
*/ */
cy_as_hal_write_register((cy_as_hal_device_tag)dev_p, 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) 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) ...@@ -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) 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 * TODO: Need to disable WB interrupt handlere 1st
*/ */
if (0 == dev_p) if (0 == dev_p)
return 1 ; return 1;
cy_as_hal_print_message("<1>_stopping OMAP34xx HAL layer object\n"); cy_as_hal_print_message("<1>_stopping OMAP34xx HAL layer object\n");
if (dev_p->m_sig != CY_AS_OMAP_KERNEL_HAL_SIG) { if (dev_p->m_sig != CY_AS_OMAP_KERNEL_HAL_SIG) {
cy_as_hal_print_message("<1>%s: %s: bad HAL tag\n", cy_as_hal_print_message("<1>%s: %s: bad HAL tag\n",
pgm, __func__) ; pgm, __func__);
return 1 ; return 1;
} }
/* /*
* disable interrupt * disable interrupt
*/ */
cy_as_hal_write_register((cy_as_hal_device_tag)dev_p, 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 0
if (dev_p->thread_flag == 0) { if (dev_p->thread_flag == 0) {
dev_p->thread_flag = 1 ; dev_p->thread_flag = 1;
wait_for_completion(&dev_p->thread_complete) ; wait_for_completion(&dev_p->thread_complete);
cy_as_hal_print_message("cyasomaphal:" cy_as_hal_print_message("cyasomaphal:"
"done cleaning thread\n"); "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 #endif
...@@ -864,9 +864,9 @@ int stop_o_m_a_p_kernel(const char *pgm, cy_as_hal_device_tag tag) ...@@ -864,9 +864,9 @@ int stop_o_m_a_p_kernel(const char *pgm, cy_as_hal_device_tag tag)
* Rearrange the list * Rearrange the list
*/ */
if (m_omap_list_p == dev_p) 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"); cy_as_hal_print_message(KERN_INFO"OMAP_kernel_hal stopped\n");
return 0; return 0;
...@@ -874,23 +874,23 @@ int stop_o_m_a_p_kernel(const char *pgm, cy_as_hal_device_tag tag) ...@@ -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) int omap_start_intr(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;
int ret = 0 ; int ret = 0;
const uint16_t mask = CY_AS_MEM_P0_INTR_REG_DRQINT | 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 * 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 * enable only MBox & DRQ interrupts for now
*/ */
cy_as_hal_write_register((cy_as_hal_device_tag)dev_p, 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) ...@@ -1175,7 +1175,7 @@ static void p_nand_lbd_read(u16 col_addr, u32 row_addr, u16 count, void *buff)
ptr32 = buff; ptr32 = buff;
do { do {
pfe_status = IORD32(GPMC_VMA(GPMC_PREFETCH_STATUS)) ; pfe_status = IORD32(GPMC_VMA(GPMC_PREFETCH_STATUS));
rd_cnt = pfe_status >> (24+2); rd_cnt = pfe_status >> (24+2);
while (rd_cnt--) while (rd_cnt--)
...@@ -1481,14 +1481,14 @@ void cy_as_hal_write_register( ...@@ -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 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 * READ ASTORIA REGISTER USING CASDO
*/ */
data = ast_p_nand_casdo_read((u8)addr); 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) ...@@ -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( static void cy_service_e_p_dma_read_request(
cy_as_omap_dev_kernel *dev_p, uint8_t ep) 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; uint16_t v, size;
void *dptr; void *dptr;
uint16_t col_addr = 0x0000; uint16_t col_addr = 0x0000;
...@@ -1628,7 +1628,7 @@ static void cy_service_e_p_dma_read_request( ...@@ -1628,7 +1628,7 @@ static void cy_service_e_p_dma_read_request(
/* /*
* clear DMAVALID bit indicating that the data has been read * 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].seg_xfer_cnt += size;
end_points[ep].req_xfer_cnt += size; end_points[ep].req_xfer_cnt += size;
...@@ -1646,12 +1646,12 @@ static void cy_service_e_p_dma_read_request( ...@@ -1646,12 +1646,12 @@ static void cy_service_e_p_dma_read_request(
* data we are going to xfer next * data we are going to xfer next
*/ */
v = end_points[ep].dma_xfer_sz/*HAL_DMA_PKT_SZ*/ | 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); cy_as_hal_write_register(tag, ep_dma_reg, v);
} else { } else {
end_points[ep].pending = cy_false ; end_points[ep].pending = cy_false;
end_points[ep].type = cy_as_hal_none ; end_points[ep].type = cy_as_hal_none;
end_points[ep].buffer_valid = cy_false ; end_points[ep].buffer_valid = cy_false;
/* /*
* notify the API that we are done with rq on this EP * 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( ...@@ -1679,13 +1679,13 @@ static void cy_service_e_p_dma_write_request(
uint32_t row_addr = CYAS_DEV_CALC_EP_ADDR(ep); uint32_t row_addr = CYAS_DEV_CALC_EP_ADDR(ep);
void *dptr; 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 * note: size here its the size of the dma transfer could be
* anything > 0 && < P_PORT packet size * anything > 0 && < P_PORT packet size
*/ */
size = end_points[ep].dma_xfer_sz ; size = end_points[ep].dma_xfer_sz;
dptr = end_points[ep].data_p ; dptr = end_points[ep].data_p;
/* /*
* perform the soft DMA transfer, soft in this case * perform the soft DMA transfer, soft in this case
...@@ -1708,8 +1708,8 @@ static void cy_service_e_p_dma_write_request( ...@@ -1708,8 +1708,8 @@ static void cy_service_e_p_dma_write_request(
* or used internally. * or used internally.
*/ */
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, size) ; cy_as_hal_write_register(tag, addr, size);
/* /*
* finally, tell the USB subsystem that the * finally, tell the USB subsystem that the
...@@ -1721,13 +1721,13 @@ static void cy_service_e_p_dma_write_request( ...@@ -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 * There is more data to go. Re-init the WestBridge DMA side
*/ */
v = end_points[ep].dma_xfer_sz | v = end_points[ep].dma_xfer_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, addr, v) ; cy_as_hal_write_register(tag, addr, v);
} else { } else {
end_points[ep].pending = cy_false ; end_points[ep].pending = cy_false;
end_points[ep].type = cy_as_hal_none ; end_points[ep].type = cy_as_hal_none;
end_points[ep].buffer_valid = cy_false ; end_points[ep].buffer_valid = cy_false;
/* /*
* notify the API that we are done with rq on this EP * 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( ...@@ -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) static void cy_handle_d_r_q_interrupt(cy_as_omap_dev_kernel *dev_p)
{ {
uint16_t v ; uint16_t v;
static uint8_t service_ep = 2 ; static uint8_t service_ep = 2;
/* /*
* We've got DRQ INT, read DRQ STATUS Register */ * We've got DRQ INT, read DRQ STATUS Register */
v = cy_as_hal_read_register((cy_as_hal_device_tag)dev_p, 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) { if (v == 0) {
#ifndef WESTBRIDGE_NDEBUG #ifndef WESTBRIDGE_NDEBUG
cy_as_hal_print_message("stray DRQ interrupt detected\n") ; cy_as_hal_print_message("stray DRQ interrupt detected\n");
#endif #endif
return; return;
} }
...@@ -1773,9 +1773,9 @@ static void cy_handle_d_r_q_interrupt(cy_as_omap_dev_kernel *dev_p) ...@@ -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) { while ((v & (1 << service_ep)) == 0) {
if (service_ep == 15) if (service_ep == 15)
service_ep = 2 ; service_ep = 2;
else else
service_ep++ ; service_ep++;
} }
if (end_points[service_ep].type == cy_as_hal_write) { 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) ...@@ -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 * handle DMA WRITE REQUEST: app_cpu will
* write data into astoria EP buffer * 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) { } else if (end_points[service_ep].type == cy_as_hal_read) {
/* /*
* handle DMA READ REQUEST: cpu will * handle DMA READ REQUEST: cpu will
* read EP buffer from Astoria * 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 #ifndef WESTBRIDGE_NDEBUG
else else
cy_as_hal_print_message("cyashalomap:interrupt," cy_as_hal_print_message("cyashalomap:interrupt,"
" w/o pending DMA job," " w/o pending DMA job,"
"-check DRQ_MASK logic\n") ; "-check DRQ_MASK logic\n");
#endif #endif
/* /*
...@@ -1804,9 +1804,9 @@ static void cy_handle_d_r_q_interrupt(cy_as_omap_dev_kernel *dev_p) ...@@ -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 (end_points[service_ep].type == cy_as_hal_none) {
if (service_ep == 15) if (service_ep == 15)
service_ep = 2 ; service_ep = 2;
else 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) ...@@ -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_hal_write_register(tag,
CY_AS_MEM_P0_EP2_DMA_REG + ep - 2, 0); 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; 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, ...@@ -1845,7 +1845,7 @@ void cy_as_hal_dma_setup_write(cy_as_hal_device_tag tag,
uint8_t ep, void *buf, uint8_t ep, void *buf,
uint32_t size, uint16_t maxsize) uint32_t size, uint16_t maxsize)
{ {
uint32_t addr = 0 ; uint32_t addr = 0;
uint16_t v = 0; uint16_t v = 0;
/* /*
...@@ -1853,15 +1853,15 @@ void cy_as_hal_dma_setup_write(cy_as_hal_device_tag tag, ...@@ -1853,15 +1853,15 @@ void cy_as_hal_dma_setup_write(cy_as_hal_device_tag tag,
* "maxsize" - is the P port fragment size * "maxsize" - is the P port fragment size
* No EP0 or EP1 traffic should get here * 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 * If this asserts, we have an ordering problem. Another DMA request
* is coming down before the previous one has completed. * is coming down before the previous one has completed.
*/ */
cy_as_hal_assert(end_points[ep].buffer_valid == cy_false) ; cy_as_hal_assert(end_points[ep].buffer_valid == cy_false);
end_points[ep].buffer_valid = cy_true ; end_points[ep].buffer_valid = cy_true;
end_points[ep].type = cy_as_hal_write ; end_points[ep].type = cy_as_hal_write;
end_points[ep].pending = cy_true; end_points[ep].pending = cy_true;
/* /*
...@@ -1899,7 +1899,7 @@ void cy_as_hal_dma_setup_write(cy_as_hal_device_tag tag, ...@@ -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].sg_p = buf;
end_points[ep].data_p = sg_virt(end_points[ep].sg_p); 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; end_points[ep].req_xfer_cnt = 0;
#ifdef DBGPRN_DMA_SETUP_WR #ifdef DBGPRN_DMA_SETUP_WR
...@@ -1940,11 +1940,11 @@ void cy_as_hal_dma_setup_write(cy_as_hal_device_tag tag, ...@@ -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 * 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) 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, ...@@ -1957,15 +1957,15 @@ void cy_as_hal_dma_setup_read(cy_as_hal_device_tag tag,
uint8_t ep, void *buf, uint8_t ep, void *buf,
uint32_t size, uint16_t maxsize) uint32_t size, uint16_t maxsize)
{ {
uint32_t addr ; uint32_t addr;
uint16_t v ; uint16_t v;
/* /*
* Note: "size" is the actual request size * Note: "size" is the actual request size
* "maxsize" - is the P port fragment size * "maxsize" - is the P port fragment size
* No EP0 or EP1 traffic should get here * 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. * 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, ...@@ -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); cy_as_hal_assert(end_points[ep].buffer_valid == cy_false);
end_points[ep].buffer_valid = cy_true ; end_points[ep].buffer_valid = cy_true;
end_points[ep].type = cy_as_hal_read ; end_points[ep].type = cy_as_hal_read;
end_points[ep].pending = cy_true; end_points[ep].pending = cy_true;
end_points[ep].req_xfer_cnt = 0; end_points[ep].req_xfer_cnt = 0;
end_points[ep].req_length = size; end_points[ep].req_length = size;
...@@ -1996,7 +1996,7 @@ void cy_as_hal_dma_setup_read(cy_as_hal_device_tag tag, ...@@ -1996,7 +1996,7 @@ void cy_as_hal_dma_setup_read(cy_as_hal_device_tag tag,
end_points[ep].dma_xfer_sz = size; 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) { if (end_points[ep].sg_list_enabled) {
/* /*
...@@ -2005,7 +2005,7 @@ void cy_as_hal_dma_setup_read(cy_as_hal_device_tag tag, ...@@ -2005,7 +2005,7 @@ void cy_as_hal_dma_setup_read(cy_as_hal_device_tag tag,
* buf - pointer to the SG list * buf - pointer to the SG list
* data_p - data pointer for the 1st DMA segment * 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].sg_p = buf;
end_points[ep].data_p = sg_virt(end_points[ep].sg_p); 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, ...@@ -2020,7 +2020,7 @@ void cy_as_hal_dma_setup_read(cy_as_hal_device_tag tag,
#endif #endif
v = (end_points[ep].dma_xfer_sz & 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_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); cy_as_hal_write_register(tag, addr, v);
} else { } else {
/* /*
...@@ -2045,7 +2045,7 @@ void cy_as_hal_dma_setup_read(cy_as_hal_device_tag tag, ...@@ -2045,7 +2045,7 @@ void cy_as_hal_dma_setup_read(cy_as_hal_device_tag tag,
if (is_storage_e_p(ep)) { if (is_storage_e_p(ep)) {
v = (end_points[ep].dma_xfer_sz & 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_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); 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, ...@@ -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", DBGPRN("<1>\n%s: WB API has registered a dma_complete callback:%x\n",
__func__, (uint32_t)cb); __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) ...@@ -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. * 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) 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("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) ...@@ -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 *cy_as_hal_alloc(uint32_t cnt)
{ {
void *ret_p ; void *ret_p;
ret_p = kmalloc(cnt, GFP_ATOMIC) ; ret_p = kmalloc(cnt, GFP_ATOMIC);
return ret_p ; return ret_p;
} }
/* /*
...@@ -2140,7 +2140,7 @@ void *cy_as_hal_alloc(uint32_t cnt) ...@@ -2140,7 +2140,7 @@ void *cy_as_hal_alloc(uint32_t cnt)
*/ */
void cy_as_hal_free(void *mem_p) 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) ...@@ -2150,10 +2150,10 @@ void cy_as_hal_free(void *mem_p)
*/ */
void *cy_as_hal_c_b_alloc(uint32_t cnt) void *cy_as_hal_c_b_alloc(uint32_t cnt)
{ {
void *ret_p ; void *ret_p;
ret_p = kmalloc(cnt, GFP_ATOMIC) ; ret_p = kmalloc(cnt, GFP_ATOMIC);
return ret_p ; return ret_p;
} }
/* /*
...@@ -2163,7 +2163,7 @@ void *cy_as_hal_c_b_alloc(uint32_t cnt) ...@@ -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) 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) ...@@ -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) cy_bool cy_as_hal_create_sleep_channel(cy_as_hal_sleep_channel *channel)
{ {
init_waitqueue_head(&channel->wq) ; init_waitqueue_head(&channel->wq);
return cy_true ; return cy_true;
} }
/* /*
...@@ -2187,7 +2187,7 @@ cy_bool cy_as_hal_create_sleep_channel(cy_as_hal_sleep_channel *channel) ...@@ -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) 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) ...@@ -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) 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)) ; wait_event_interruptible_timeout(channel->wq, 0, ((ms * HZ)/1000));
return cy_true ; return cy_true;
} }
/* /*
...@@ -2205,7 +2205,7 @@ cy_bool cy_as_hal_sleep_on(cy_as_hal_sleep_channel *channel, uint32_t ms) ...@@ -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) cy_bool cy_as_hal_wake(cy_as_hal_sleep_channel *channel)
{ {
wake_up_interruptible_all(&channel->wq); wake_up_interruptible_all(&channel->wq);
return cy_true ; return cy_true;
} }
uint32_t cy_as_hal_disable_interrupts() uint32_t cy_as_hal_disable_interrupts()
...@@ -2213,13 +2213,13 @@ uint32_t cy_as_hal_disable_interrupts() ...@@ -2213,13 +2213,13 @@ uint32_t cy_as_hal_disable_interrupts()
if (0 == intr__enable) if (0 == intr__enable)
; ;
intr__enable++ ; intr__enable++;
return 0 ; return 0;
} }
void cy_as_hal_enable_interrupts(uint32_t val) void cy_as_hal_enable_interrupts(uint32_t val)
{ {
intr__enable-- ; intr__enable--;
if (0 == intr__enable) if (0 == intr__enable)
; ;
} }
...@@ -2240,9 +2240,9 @@ void cy_as_hal_sleep(uint32_t ms) ...@@ -2240,9 +2240,9 @@ void cy_as_hal_sleep(uint32_t ms)
{ {
cy_as_hal_sleep_channel channel; cy_as_hal_sleep_channel channel;
cy_as_hal_create_sleep_channel(&channel) ; cy_as_hal_create_sleep_channel(&channel);
cy_as_hal_sleep_on(&channel, ms) ; cy_as_hal_sleep_on(&channel, ms);
cy_as_hal_destroy_sleep_channel(&channel) ; cy_as_hal_destroy_sleep_channel(&channel);
} }
cy_bool cy_as_hal_is_polling() 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) ...@@ -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, int start_o_m_a_p_kernel(const char *pgm,
cy_as_hal_device_tag *tag, cy_bool debug) 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; int i;
u16 data16[4]; u16 data16[4];
u8 pncfg_reg; u8 pncfg_reg;
...@@ -2302,11 +2302,11 @@ int start_o_m_a_p_kernel(const char *pgm, ...@@ -2302,11 +2302,11 @@ int start_o_m_a_p_kernel(const char *pgm,
/* /*
* Initialize the HAL level endpoint DMA data. * Initialize the HAL level endpoint DMA data.
*/ */
for (i = 0 ; i < sizeof(end_points)/sizeof(end_points[0]) ; i++) { for (i = 0; i < sizeof(end_points)/sizeof(end_points[0]); i++) {
end_points[i].data_p = 0 ; end_points[i].data_p = 0;
end_points[i].pending = cy_false ; end_points[i].pending = cy_false;
end_points[i].size = 0 ; end_points[i].size = 0;
end_points[i].type = cy_as_hal_none ; end_points[i].type = cy_as_hal_none;
end_points[i].sg_list_enabled = cy_false; end_points[i].sg_list_enabled = cy_false;
/* /*
...@@ -2321,11 +2321,11 @@ int start_o_m_a_p_kernel(const char *pgm, ...@@ -2321,11 +2321,11 @@ int start_o_m_a_p_kernel(const char *pgm,
* allocate memory for OMAP HAL * allocate memory for OMAP HAL
*/ */
dev_p = (cy_as_omap_dev_kernel *)cy_as_hal_alloc( 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) { if (dev_p == 0) {
cy_as_hal_print_message("out of memory allocating OMAP" cy_as_hal_print_message("out of memory allocating OMAP"
"device structure\n") ; "device structure\n");
return 0 ; return 0;
} }
dev_p->m_sig = CY_AS_OMAP_KERNEL_HAL_SIG; dev_p->m_sig = CY_AS_OMAP_KERNEL_HAL_SIG;
...@@ -2403,11 +2403,11 @@ int start_o_m_a_p_kernel(const char *pgm, ...@@ -2403,11 +2403,11 @@ int start_o_m_a_p_kernel(const char *pgm,
"after cfg_wr:%4.4x\n\n", "after cfg_wr:%4.4x\n\n",
data16[0], pncfg_reg, data16[1]); data16[0], pncfg_reg, data16[1]);
dev_p->thread_flag = 1 ; dev_p->thread_flag = 1;
spin_lock_init(&int_lock) ; spin_lock_init(&int_lock);
dev_p->m_next_p = m_omap_list_p ; dev_p->m_next_p = m_omap_list_p;
m_omap_list_p = dev_p ; m_omap_list_p = dev_p;
*tag = dev_p; *tag = dev_p;
cy_as_hal_configure_interrupts((void *)dev_p); cy_as_hal_configure_interrupts((void *)dev_p);
...@@ -2421,7 +2421,7 @@ int start_o_m_a_p_kernel(const char *pgm, ...@@ -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(4, true);
cy_as_hal_set_ep_dma_mode(8, true); cy_as_hal_set_ep_dma_mode(8, true);
return 1 ; return 1;
/* /*
* there's been a NAND bus access error or * there's been a NAND bus access error or
...@@ -2433,7 +2433,7 @@ int start_o_m_a_p_kernel(const char *pgm, ...@@ -2433,7 +2433,7 @@ int start_o_m_a_p_kernel(const char *pgm,
* so the device will not call omap_stop * so the device will not call omap_stop
*/ */
cy_as_hal_omap_hardware_deinit(dev_p); cy_as_hal_omap_hardware_deinit(dev_p);
cy_as_hal_free(dev_p) ; cy_as_hal_free(dev_p);
return 0; return 0;
} }
......
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
#if !defined(__doxygen__) #if !defined(__doxygen__)
typedef int cy_bool ; typedef int cy_bool;
#define cy_true (1) #define cy_true (1)
#define cy_false (0) #define cy_false (0)
#endif #endif
......
...@@ -38,8 +38,8 @@ ...@@ -38,8 +38,8 @@
*/ */
#include <linux/../../arch/arm/plat-omap/include/plat/gpmc.h> #include <linux/../../arch/arm/plat-omap/include/plat/gpmc.h>
typedef struct cy_as_hal_sleep_channel_t { typedef struct cy_as_hal_sleep_channel_t {
wait_queue_head_t wq ; wait_queue_head_t wq;
} cy_as_hal_sleep_channel ; } cy_as_hal_sleep_channel;
/* moved to staging location, eventual location /* moved to staging location, eventual location
* considered is here * considered is here
...@@ -61,7 +61,7 @@ typedef struct cy_as_hal_sleep_channel_t { ...@@ -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 * device in the system. In this case the tag is a void * which is
* really an OMAP device pointer * 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 */ /* This must be included after the CyAsHalDeviceTag type is defined */
...@@ -84,7 +84,7 @@ typedef void *cy_as_hal_device_tag ; ...@@ -84,7 +84,7 @@ typedef void *cy_as_hal_device_tag ;
*/ */
void void
cy_as_hal_write_register(cy_as_hal_device_tag tag, 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 * 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, ...@@ -93,7 +93,7 @@ cy_as_hal_write_register(cy_as_hal_device_tag tag,
* of the west bridge device. * of the west bridge device.
*/ */
uint16_t 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 * 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) ; ...@@ -103,7 +103,7 @@ cy_as_hal_read_register(cy_as_hal_device_tag tag, uint16_t addr) ;
*/ */
void void
cy_as_hal_dma_setup_write(cy_as_hal_device_tag tag, 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 * 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, ...@@ -113,13 +113,13 @@ cy_as_hal_dma_setup_write(cy_as_hal_device_tag tag,
*/ */
void void
cy_as_hal_dma_setup_read(cy_as_hal_device_tag tag, uint8_t ep, 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. * This function must be defined to cancel any pending DMA request.
*/ */
void 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 * 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) ; ...@@ -128,7 +128,7 @@ cy_as_hal_dma_cancel_request(cy_as_hal_device_tag tag, uint8_t ep) ;
*/ */
void void
cy_as_hal_dma_register_callback(cy_as_hal_device_tag tag, 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 * 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, ...@@ -138,7 +138,7 @@ cy_as_hal_dma_register_callback(cy_as_hal_device_tag tag,
*/ */
uint32_t uint32_t
cy_as_hal_dma_max_request_size(cy_as_hal_device_tag tag, 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 * 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, ...@@ -146,14 +146,14 @@ cy_as_hal_dma_max_request_size(cy_as_hal_device_tag tag,
* type. * type.
*/ */
cy_bool 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 * This function is called when the Antioch PLL loses lock, because
* of a problem in the supply voltage or the input clock. * of a problem in the supply voltage or the input clock.
*/ */
void 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) ; ...@@ -168,14 +168,14 @@ cy_as_hal_pll_lock_loss_handler(cy_as_hal_device_tag tag) ;
* is expected to work exactly like malloc(). * is expected to work exactly like malloc().
*/ */
void * 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 * This function is required by the API to free memory allocated with
* CyAsHalAlloc(). This function is expected to work exacly like free(). * CyAsHalAlloc(). This function is expected to work exacly like free().
*/ */
void 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 * This function is required by the API to allocate memory during a
...@@ -183,21 +183,21 @@ cy_as_hal_free(void *mem_p) ; ...@@ -183,21 +183,21 @@ cy_as_hal_free(void *mem_p) ;
* time. * time.
*/ */
void * 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 * This function is required by the API to free memory allocated with
* CyAsCBHalAlloc(). * CyAsCBHalAlloc().
*/ */
void 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 * This function is required to set a block of memory to a specific
* value. This function is expected to work exactly like memset() * value. This function is expected to work exactly like memset()
*/ */
void 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 * 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) ; ...@@ -205,7 +205,7 @@ cy_as_hal_mem_set(void *ptr, uint8_t value, uint32_t cnt) ;
* pointer in the argument. * pointer in the argument.
*/ */
cy_bool 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 * 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) ; ...@@ -215,16 +215,16 @@ cy_as_hal_create_sleep_channel(cy_as_hal_sleep_channel *channel) ;
cy_bool 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_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_bool
cy_as_hal_wake(cy_as_hal_sleep_channel *channel) ; cy_as_hal_wake(cy_as_hal_sleep_channel *channel);
uint32_t uint32_t
cy_as_hal_disable_interrupts(void) ; cy_as_hal_disable_interrupts(void);
void void
cy_as_hal_enable_interrupts(uint32_t); 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); ...@@ -283,7 +283,7 @@ void cy_as_hal_read_regs_before_standby(cy_as_hal_device_tag tag);
/* /*
CyAsMiscSetLogLevel(uint8_t level) CyAsMiscSetLogLevel(uint8_t level)
{ {
debug_level = level ; debug_level = level;
} }
#ifdef CY_AS_LOG_SUPPORT #ifdef CY_AS_LOG_SUPPORT
...@@ -292,7 +292,7 @@ void ...@@ -292,7 +292,7 @@ void
cy_as_log_debug_message(int level, const char *str) cy_as_log_debug_message(int level, const char *str)
{ {
if (level <= debug_level) 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); ...@@ -307,9 +307,9 @@ void cyashal_prn_buf(void *buf, uint16_t offset, int len);
* but are required to be called for this HAL. * but are required to be called for this HAL.
*/ */
int start_o_m_a_p_kernel(const char *pgm, int start_o_m_a_p_kernel(const char *pgm,
cy_as_hal_device_tag *tag, cy_bool debug) ; 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 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) ; 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); void cy_as_hal_set_ep_dma_mode(uint8_t ep, bool sg_xfer_enabled);
/* moved to staging location /* moved to staging location
......
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
*/ */
typedef struct cy_as_omap_dev_kernel { typedef struct cy_as_omap_dev_kernel {
/* This is the signature for this data structure */ /* This is the signature for this data structure */
unsigned int m_sig ; unsigned int m_sig;
/* Address base of Antioch Device */ /* Address base of Antioch Device */
void *m_addr_base; void *m_addr_base;
......
...@@ -155,7 +155,7 @@ struct cyasblkdev_blk_data { ...@@ -155,7 +155,7 @@ struct cyasblkdev_blk_data {
}; };
/* pointer to west bridge block data device superstructure */ /* 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); static DECLARE_MUTEX(open_lock);
...@@ -203,7 +203,7 @@ static struct cyasblkdev_blk_data *cyasblkdev_blk_get( ...@@ -203,7 +203,7 @@ static struct cyasblkdev_blk_data *cyasblkdev_blk_get(
bd->usage++; bd->usage++;
#ifndef NBDEBUG #ifndef NBDEBUG
cy_as_hal_print_message( cy_as_hal_print_message(
"cyasblkdev_blk_get: usage = %d\n", bd->usage) ; "cyasblkdev_blk_get: usage = %d\n", bd->usage);
#endif #endif
} }
up(&open_lock); up(&open_lock);
...@@ -232,7 +232,7 @@ static void cyasblkdev_blk_put( ...@@ -232,7 +232,7 @@ static void cyasblkdev_blk_put(
bd->usage); bd->usage);
#endif #endif
up(&open_lock); up(&open_lock);
return ; return;
} }
if (bd->usage == 0) { if (bd->usage == 0) {
...@@ -245,7 +245,7 @@ static void cyasblkdev_blk_put( ...@@ -245,7 +245,7 @@ static void cyasblkdev_blk_put(
cy_as_storage_release(bd->dev_handle, 0, 0, 0, 0)) { cy_as_storage_release(bd->dev_handle, 0, 0, 0, 0)) {
#ifndef WESTBRIDGE_NDEBUG #ifndef WESTBRIDGE_NDEBUG
cy_as_hal_print_message( cy_as_hal_print_message(
"cyasblkdev: cannot release bus 0\n") ; "cyasblkdev: cannot release bus 0\n");
#endif #endif
} }
...@@ -253,7 +253,7 @@ static void cyasblkdev_blk_put( ...@@ -253,7 +253,7 @@ static void cyasblkdev_blk_put(
cy_as_storage_release(bd->dev_handle, 1, 0, 0, 0)) { cy_as_storage_release(bd->dev_handle, 1, 0, 0, 0)) {
#ifndef WESTBRIDGE_NDEBUG #ifndef WESTBRIDGE_NDEBUG
cy_as_hal_print_message( cy_as_hal_print_message(
"cyasblkdev: cannot release bus 1\n") ; "cyasblkdev: cannot release bus 1\n");
#endif #endif
} }
...@@ -261,7 +261,7 @@ static void cyasblkdev_blk_put( ...@@ -261,7 +261,7 @@ static void cyasblkdev_blk_put(
cy_as_storage_stop(bd->dev_handle, 0, 0)) { cy_as_storage_stop(bd->dev_handle, 0, 0)) {
#ifndef WESTBRIDGE_NDEBUG #ifndef WESTBRIDGE_NDEBUG
cy_as_hal_print_message( cy_as_hal_print_message(
"cyasblkdev: cannot stop storage stack\n") ; "cyasblkdev: cannot stop storage stack\n");
#endif #endif
} }
...@@ -269,18 +269,18 @@ static void cyasblkdev_blk_put( ...@@ -269,18 +269,18 @@ static void cyasblkdev_blk_put(
/* If the SCM Kernel HAL is being used, disable the use /* If the SCM Kernel HAL is being used, disable the use
* of scatter/gather lists at the end of block driver usage. * 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 #endif
/*ptr to global struct cyasblkdev_blk_data */ /*ptr to global struct cyasblkdev_blk_data */
gl_bd = NULL ; gl_bd = NULL;
kfree(bd); kfree(bd);
} }
#ifndef WESTBRIDGE_NDEBUG #ifndef WESTBRIDGE_NDEBUG
cy_as_hal_print_message( cy_as_hal_print_message(
"cyasblkdev (blk_put): usage = %d\n", "cyasblkdev (blk_put): usage = %d\n",
bd->usage) ; bd->usage);
#endif #endif
up(&open_lock); up(&open_lock);
} }
...@@ -498,7 +498,7 @@ static void cyasblkdev_issuecallback( ...@@ -498,7 +498,7 @@ static void cyasblkdev_issuecallback(
#ifndef WESTBRIDGE_NDEBUG #ifndef WESTBRIDGE_NDEBUG
cy_as_hal_print_message( cy_as_hal_print_message(
"%s: async r/w: op:%d failed with error %d at address %d\n", "%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 #endif
} }
...@@ -507,7 +507,7 @@ static void cyasblkdev_issuecallback( ...@@ -507,7 +507,7 @@ static void cyasblkdev_issuecallback(
"%s calling blk_end_request from issue_callback " "%s calling blk_end_request from issue_callback "
"req=0x%x, status=0x%x, nr_sectors=0x%x\n", "req=0x%x, status=0x%x, nr_sectors=0x%x\n",
__func__, (unsigned int) gl_bd->queue.req, status, __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 #endif
/* note: blk_end_request w/o __ prefix should /* note: blk_end_request w/o __ prefix should
...@@ -560,7 +560,7 @@ static int cyasblkdev_blk_issue_rq( ...@@ -560,7 +560,7 @@ static int cyasblkdev_blk_issue_rq(
) )
{ {
struct cyasblkdev_blk_data *bd = bq->data; struct cyasblkdev_blk_data *bd = bq->data;
int index = 0 ; int index = 0;
int ret = CY_AS_ERROR_SUCCESS; int ret = CY_AS_ERROR_SUCCESS;
uint32_t req_sector = 0; uint32_t req_sector = 0;
uint32_t req_nr_sectors = 0; uint32_t req_nr_sectors = 0;
...@@ -648,7 +648,7 @@ static int cyasblkdev_blk_issue_rq( ...@@ -648,7 +648,7 @@ static int cyasblkdev_blk_issue_rq(
req_nr_sectors*512)) req_nr_sectors*512))
; ;
bq->req = NULL ; bq->req = NULL;
} }
} else { } else {
ret = cy_as_storage_write_async(bd->dev_handle, bus_num, 0, ret = cy_as_storage_write_async(bd->dev_handle, bus_num, 0,
...@@ -669,7 +669,7 @@ static int cyasblkdev_blk_issue_rq( ...@@ -669,7 +669,7 @@ static int cyasblkdev_blk_issue_rq(
req_nr_sectors*512)) 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) ...@@ -741,7 +741,7 @@ uint32_t cyasblkdev_get_vfat_offset(int bus_num, int unit_no)
*/ */
#ifndef WESTBRIDGE_NDEBUG #ifndef WESTBRIDGE_NDEBUG
cy_as_hal_print_message( cy_as_hal_print_message(
"%s scanning media for vfat partition...\n", __func__) ; "%s scanning media for vfat partition...\n", __func__);
#endif #endif
for (sect_no = 0; sect_no < SECTORS_TO_SCAN; sect_no++) { 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) ...@@ -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, static int cyasblkdev_add_disks(int bus_num,
struct cyasblkdev_blk_data *bd, struct cyasblkdev_blk_data *bd,
...@@ -818,7 +818,7 @@ static int cyasblkdev_add_disks(int bus_num, ...@@ -818,7 +818,7 @@ static int cyasblkdev_add_disks(int bus_num,
int ret = 0; int ret = 0;
uint64_t disk_cap; uint64_t disk_cap;
int lcl_unit_no; 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 #ifndef WESTBRIDGE_NDEBUG
cy_as_hal_print_message("%s:query device: " cy_as_hal_print_message("%s:query device: "
...@@ -843,29 +843,29 @@ static int cyasblkdev_add_disks(int bus_num, ...@@ -843,29 +843,29 @@ static int cyasblkdev_add_disks(int bus_num,
"%s: device is locked\n", __func__); "%s: device is locked\n", __func__);
#endif #endif
ret = cy_as_storage_release( 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) { if (ret != CY_AS_ERROR_SUCCESS) {
#ifndef WESTBRIDGE_NDEBUG #ifndef WESTBRIDGE_NDEBUG
cy_as_hal_print_message("%s cannot release" cy_as_hal_print_message("%s cannot release"
" storage\n", __func__) ; " storage\n", __func__);
#endif #endif
goto out; goto out;
} }
goto out; goto out;
} }
unit_data.device = 0 ; unit_data.device = 0;
unit_data.unit = 0 ; unit_data.unit = 0;
unit_data.bus = bus_num; unit_data.bus = bus_num;
ret = cy_as_storage_query_unit(bd->dev_handle, ret = cy_as_storage_query_unit(bd->dev_handle,
&unit_data, 0, 0) ; &unit_data, 0, 0);
if (ret != CY_AS_ERROR_SUCCESS) { if (ret != CY_AS_ERROR_SUCCESS) {
#ifndef WESTBRIDGE_NDEBUG #ifndef WESTBRIDGE_NDEBUG
cy_as_hal_print_message("%s: cannot query " cy_as_hal_print_message("%s: cannot query "
"%d device unit - reason code %d\n", "%d device unit - reason code %d\n",
__func__, bus_num, ret) ; __func__, bus_num, ret);
#endif #endif
goto out ; goto out;
} }
if (private_partition_bus == bus_num) { if (private_partition_bus == bus_num) {
...@@ -906,15 +906,15 @@ static int cyasblkdev_add_disks(int bus_num, ...@@ -906,15 +906,15 @@ static int cyasblkdev_add_disks(int bus_num,
bd->dev_handle, bus_num, 0, bd->dev_handle, bus_num, 0,
private_partition_size, 0, 0); private_partition_size, 0, 0);
if (ret == CY_AS_ERROR_SUCCESS) { if (ret == CY_AS_ERROR_SUCCESS) {
unit_data.bus = bus_num ; unit_data.bus = bus_num;
unit_data.device = 0 ; unit_data.device = 0;
unit_data.unit = 1 ; unit_data.unit = 1;
} else { } else {
#ifndef WESTBRIDGE_NDEBUG #ifndef WESTBRIDGE_NDEBUG
cy_as_hal_print_message( cy_as_hal_print_message(
"%s: cy_as_storage_create_p_partition " "%s: cy_as_storage_create_p_partition "
"after removal unexpectedly failed " "after removal unexpectedly failed "
"with error %d\n", __func__, ret) ; "with error %d\n", __func__, ret);
#endif #endif
/* need to requery bus /* need to requery bus
...@@ -922,22 +922,22 @@ static int cyasblkdev_add_disks(int bus_num, ...@@ -922,22 +922,22 @@ static int cyasblkdev_add_disks(int bus_num,
* successful and create * successful and create
* failed we have changed * failed we have changed
* the disk properties */ * the disk properties */
unit_data.bus = bus_num ; unit_data.bus = bus_num;
unit_data.device = 0 ; unit_data.device = 0;
unit_data.unit = 0 ; unit_data.unit = 0;
} }
ret = cy_as_storage_query_unit( ret = cy_as_storage_query_unit(
bd->dev_handle, bd->dev_handle,
&unit_data, 0, 0) ; &unit_data, 0, 0);
if (ret != CY_AS_ERROR_SUCCESS) { if (ret != CY_AS_ERROR_SUCCESS) {
#ifndef WESTBRIDGE_NDEBUG #ifndef WESTBRIDGE_NDEBUG
cy_as_hal_print_message( cy_as_hal_print_message(
"%s: cannot query %d " "%s: cannot query %d "
"device unit - reason code %d\n", "device unit - reason code %d\n",
__func__, bus_num, ret) ; __func__, bus_num, ret);
#endif #endif
goto out ; goto out;
} else { } else {
disk_cap = (uint64_t) disk_cap = (uint64_t)
(unit_data.desc_p.unit_size); (unit_data.desc_p.unit_size);
...@@ -952,27 +952,27 @@ static int cyasblkdev_add_disks(int bus_num, ...@@ -952,27 +952,27 @@ static int cyasblkdev_add_disks(int bus_num,
__func__, ret); __func__, ret);
#endif #endif
unit_data.bus = bus_num ; unit_data.bus = bus_num;
unit_data.device = 0 ; unit_data.device = 0;
unit_data.unit = 1 ; unit_data.unit = 1;
ret = cy_as_storage_query_unit( 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) { if (ret != CY_AS_ERROR_SUCCESS) {
#ifndef WESTBRIDGE_NDEBUG #ifndef WESTBRIDGE_NDEBUG
cy_as_hal_print_message( cy_as_hal_print_message(
"%s: cannot query %d " "%s: cannot query %d "
"device unit - reason " "device unit - reason "
"code %d\n", __func__, "code %d\n", __func__,
bus_num, ret) ; bus_num, ret);
#endif #endif
goto out ; goto out;
} }
disk_cap = (uint64_t) disk_cap = (uint64_t)
(unit_data.desc_p.unit_size); (unit_data.desc_p.unit_size);
lcl_unit_no = lcl_unit_no =
unit_data.unit ; unit_data.unit;
} }
} else { } else {
#ifndef WESTBRIDGE_NDEBUG #ifndef WESTBRIDGE_NDEBUG
...@@ -983,25 +983,25 @@ static int cyasblkdev_add_disks(int bus_num, ...@@ -983,25 +983,25 @@ static int cyasblkdev_add_disks(int bus_num,
/*partition already existed, /*partition already existed,
* need to query second unit*/ * need to query second unit*/
unit_data.bus = bus_num ; unit_data.bus = bus_num;
unit_data.device = 0 ; unit_data.device = 0;
unit_data.unit = 1 ; unit_data.unit = 1;
ret = cy_as_storage_query_unit( 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) { if (ret != CY_AS_ERROR_SUCCESS) {
#ifndef WESTBRIDGE_NDEBUG #ifndef WESTBRIDGE_NDEBUG
cy_as_hal_print_message( cy_as_hal_print_message(
"%s: cannot query %d " "%s: cannot query %d "
"device unit " "device unit "
"- reason code %d\n", "- reason code %d\n",
__func__, bus_num, ret) ; __func__, bus_num, ret);
#endif #endif
goto out ; goto out;
} else { } else {
disk_cap = (uint64_t) disk_cap = (uint64_t)
(unit_data.desc_p.unit_size); (unit_data.desc_p.unit_size);
lcl_unit_no = unit_data.unit ; lcl_unit_no = unit_data.unit;
} }
} }
} else { } else {
...@@ -1067,7 +1067,7 @@ static int cyasblkdev_add_disks(int bus_num, ...@@ -1067,7 +1067,7 @@ static int cyasblkdev_add_disks(int bus_num,
/* this will create a /* this will create a
* queue kernel thread */ * queue kernel thread */
cyasblkdev_init_queue( cyasblkdev_init_queue(
&bd->queue, &bd->lock) ; &bd->queue, &bd->lock);
bd->queue.prep_fn = cyasblkdev_blk_prep_rq; bd->queue.prep_fn = cyasblkdev_blk_prep_rq;
bd->queue.issue_fn = cyasblkdev_blk_issue_rq; bd->queue.issue_fn = cyasblkdev_blk_issue_rq;
...@@ -1261,7 +1261,7 @@ static int cyasblkdev_add_disks(int bus_num, ...@@ -1261,7 +1261,7 @@ static int cyasblkdev_add_disks(int bus_num,
if (bd->system_disk == NULL) { if (bd->system_disk == NULL) {
kfree(bd); kfree(bd);
bd = ERR_PTR(-ENOMEM); bd = ERR_PTR(-ENOMEM);
return bd ; return bd;
} }
disk_cap = (uint64_t) disk_cap = (uint64_t)
(private_partition_size); (private_partition_size);
...@@ -1294,7 +1294,7 @@ static int cyasblkdev_add_disks(int bus_num, ...@@ -1294,7 +1294,7 @@ static int cyasblkdev_add_disks(int bus_num,
else { else {
cy_as_hal_print_message( cy_as_hal_print_message(
"%s: system disk already allocated %d\n", "%s: system disk already allocated %d\n",
__func__, bus_num) ; __func__, bus_num);
} }
#endif #endif
} }
...@@ -1305,8 +1305,8 @@ static int cyasblkdev_add_disks(int bus_num, ...@@ -1305,8 +1305,8 @@ static int cyasblkdev_add_disks(int bus_num,
static struct cyasblkdev_blk_data *cyasblkdev_blk_alloc(void) static struct cyasblkdev_blk_data *cyasblkdev_blk_alloc(void)
{ {
struct cyasblkdev_blk_data *bd; struct cyasblkdev_blk_data *bd;
int ret = 0 ; int ret = 0;
cy_as_return_status_t stat = -1 ; cy_as_return_status_t stat = -1;
int bus_num = 0; int bus_num = 0;
int total_media_count = 0; int total_media_count = 0;
int devidx = 0; int devidx = 0;
...@@ -1322,7 +1322,7 @@ static struct cyasblkdev_blk_data *cyasblkdev_blk_alloc(void) ...@@ -1322,7 +1322,7 @@ static struct cyasblkdev_blk_data *cyasblkdev_blk_alloc(void)
bd = kzalloc(sizeof(struct cyasblkdev_blk_data), GFP_KERNEL); bd = kzalloc(sizeof(struct cyasblkdev_blk_data), GFP_KERNEL);
if (bd) { if (bd) {
gl_bd = bd ; gl_bd = bd;
spin_lock_init(&bd->lock); spin_lock_init(&bd->lock);
bd->usage = 1; bd->usage = 1;
...@@ -1331,14 +1331,14 @@ static struct cyasblkdev_blk_data *cyasblkdev_blk_alloc(void) ...@@ -1331,14 +1331,14 @@ static struct cyasblkdev_blk_data *cyasblkdev_blk_alloc(void)
bd->blkops = &cyasblkdev_bdops; bd->blkops = &cyasblkdev_bdops;
/* Get the device handle */ /* Get the device handle */
bd->dev_handle = cyasdevice_getdevhandle() ; bd->dev_handle = cyasdevice_getdevhandle();
if (0 == bd->dev_handle) { if (0 == bd->dev_handle) {
#ifndef WESTBRIDGE_NDEBUG #ifndef WESTBRIDGE_NDEBUG
cy_as_hal_print_message( cy_as_hal_print_message(
"%s: get device failed\n", __func__) ; "%s: get device failed\n", __func__);
#endif #endif
ret = ENODEV ; ret = ENODEV;
goto out ; goto out;
} }
#ifndef WESTBRIDGE_NDEBUG #ifndef WESTBRIDGE_NDEBUG
...@@ -1350,7 +1350,7 @@ static struct cyasblkdev_blk_data *cyasblkdev_blk_alloc(void) ...@@ -1350,7 +1350,7 @@ static struct cyasblkdev_blk_data *cyasblkdev_blk_alloc(void)
* device we are interested in. */ * device we are interested in. */
/* Error code to use if the conditions are not satisfied. */ /* 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); stat = cy_as_misc_release_resource(bd->dev_handle, cy_as_bus_0);
if ((stat != CY_AS_ERROR_SUCCESS) && if ((stat != CY_AS_ERROR_SUCCESS) &&
...@@ -1358,7 +1358,7 @@ static struct cyasblkdev_blk_data *cyasblkdev_blk_alloc(void) ...@@ -1358,7 +1358,7 @@ static struct cyasblkdev_blk_data *cyasblkdev_blk_alloc(void)
#ifndef WESTBRIDGE_NDEBUG #ifndef WESTBRIDGE_NDEBUG
cy_as_hal_print_message("%s: cannot release " cy_as_hal_print_message("%s: cannot release "
"resource bus 0 - reason code %d\n", "resource bus 0 - reason code %d\n",
__func__, stat) ; __func__, stat);
#endif #endif
} }
...@@ -1368,16 +1368,16 @@ static struct cyasblkdev_blk_data *cyasblkdev_blk_alloc(void) ...@@ -1368,16 +1368,16 @@ static struct cyasblkdev_blk_data *cyasblkdev_blk_alloc(void)
#ifndef WESTBRIDGE_NDEBUG #ifndef WESTBRIDGE_NDEBUG
cy_as_hal_print_message("%s: cannot release " cy_as_hal_print_message("%s: cannot release "
"resource bus 0 - reason code %d\n", "resource bus 0 - reason code %d\n",
__func__, stat) ; __func__, stat);
#endif #endif
} }
/* start storage stack*/ /* 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) { if (stat != CY_AS_ERROR_SUCCESS) {
#ifndef WESTBRIDGE_NDEBUG #ifndef WESTBRIDGE_NDEBUG
cy_as_hal_print_message("%s: cannot start storage " cy_as_hal_print_message("%s: cannot start storage "
"stack - reason code %d\n", __func__, stat) ; "stack - reason code %d\n", __func__, stat);
#endif #endif
goto out; goto out;
} }
...@@ -1392,14 +1392,14 @@ static struct cyasblkdev_blk_data *cyasblkdev_blk_alloc(void) ...@@ -1392,14 +1392,14 @@ static struct cyasblkdev_blk_data *cyasblkdev_blk_alloc(void)
if (stat != CY_AS_ERROR_SUCCESS) { if (stat != CY_AS_ERROR_SUCCESS) {
#ifndef WESTBRIDGE_NDEBUG #ifndef WESTBRIDGE_NDEBUG
cy_as_hal_print_message("%s: cannot register callback " cy_as_hal_print_message("%s: cannot register callback "
"- reason code %d\n", __func__, stat) ; "- reason code %d\n", __func__, stat);
#endif #endif
goto out; goto out;
} }
for (bus_num = 0; bus_num < 2; bus_num++) { for (bus_num = 0; bus_num < 2; bus_num++) {
stat = cy_as_storage_query_bus(bd->dev_handle, 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) { if (stat == CY_AS_ERROR_SUCCESS) {
total_media_count = total_media_count + total_media_count = total_media_count +
bd->media_count[bus_num]; bd->media_count[bus_num];
...@@ -1407,7 +1407,7 @@ static struct cyasblkdev_blk_data *cyasblkdev_blk_alloc(void) ...@@ -1407,7 +1407,7 @@ static struct cyasblkdev_blk_data *cyasblkdev_blk_alloc(void)
#ifndef WESTBRIDGE_NDEBUG #ifndef WESTBRIDGE_NDEBUG
cy_as_hal_print_message("%s: cannot query %d, " cy_as_hal_print_message("%s: cannot query %d, "
"reason code: %d\n", "reason code: %d\n",
__func__, bus_num, stat) ; __func__, bus_num, stat);
#endif #endif
goto out; goto out;
} }
...@@ -1416,9 +1416,9 @@ static struct cyasblkdev_blk_data *cyasblkdev_blk_alloc(void) ...@@ -1416,9 +1416,9 @@ static struct cyasblkdev_blk_data *cyasblkdev_blk_alloc(void)
if (total_media_count == 0) { if (total_media_count == 0) {
#ifndef WESTBRIDGE_NDEBUG #ifndef WESTBRIDGE_NDEBUG
cy_as_hal_print_message( cy_as_hal_print_message(
"%s: no storage media was found\n", __func__) ; "%s: no storage media was found\n", __func__);
#endif #endif
goto out ; goto out;
} else if (total_media_count >= 1) { } else if (total_media_count >= 1) {
if (bd->user_disk_0 == NULL) { if (bd->user_disk_0 == NULL) {
...@@ -1428,7 +1428,7 @@ static struct cyasblkdev_blk_data *cyasblkdev_blk_alloc(void) ...@@ -1428,7 +1428,7 @@ static struct cyasblkdev_blk_data *cyasblkdev_blk_alloc(void)
if (bd->user_disk_0 == NULL) { if (bd->user_disk_0 == NULL) {
kfree(bd); kfree(bd);
bd = ERR_PTR(-ENOMEM); bd = ERR_PTR(-ENOMEM);
return bd ; return bd;
} }
} }
#ifndef WESTBRIDGE_NDEBUG #ifndef WESTBRIDGE_NDEBUG
...@@ -1448,7 +1448,7 @@ static struct cyasblkdev_blk_data *cyasblkdev_blk_alloc(void) ...@@ -1448,7 +1448,7 @@ static struct cyasblkdev_blk_data *cyasblkdev_blk_alloc(void)
if (bd->user_disk_1 == NULL) { if (bd->user_disk_1 == NULL) {
kfree(bd); kfree(bd);
bd = ERR_PTR(-ENOMEM); bd = ERR_PTR(-ENOMEM);
return bd ; return bd;
} }
} }
#ifndef WESTBRIDGE_NDEBUG #ifndef WESTBRIDGE_NDEBUG
...@@ -1468,25 +1468,25 @@ static struct cyasblkdev_blk_data *cyasblkdev_blk_alloc(void) ...@@ -1468,25 +1468,25 @@ static struct cyasblkdev_blk_data *cyasblkdev_blk_alloc(void)
#ifndef WESTBRIDGE_NDEBUG #ifndef WESTBRIDGE_NDEBUG
cy_as_hal_print_message("%s: %d device(s) found\n", cy_as_hal_print_message("%s: %d device(s) found\n",
__func__, total_media_count) ; __func__, total_media_count);
#endif #endif
for (bus_num = 0; bus_num <= 1; bus_num++) { for (bus_num = 0; bus_num <= 1; bus_num++) {
/*claim storage for cpu */ /*claim storage for cpu */
stat = cy_as_storage_claim(bd->dev_handle, stat = cy_as_storage_claim(bd->dev_handle,
bus_num, 0, 0, 0) ; bus_num, 0, 0, 0);
if (stat != CY_AS_ERROR_SUCCESS) { if (stat != CY_AS_ERROR_SUCCESS) {
cy_as_hal_print_message("%s: cannot claim " cy_as_hal_print_message("%s: cannot claim "
"%d bus - reason code %d\n", "%d bus - reason code %d\n",
__func__, bus_num, stat) ; __func__, bus_num, stat);
goto out; goto out;
} }
dev_data.bus = bus_num ; dev_data.bus = bus_num;
dev_data.device = 0 ; dev_data.device = 0;
stat = cy_as_storage_query_device(bd->dev_handle, stat = cy_as_storage_query_device(bd->dev_handle,
&dev_data, 0, 0) ; &dev_data, 0, 0);
if (stat == CY_AS_ERROR_SUCCESS) { if (stat == CY_AS_ERROR_SUCCESS) {
cyasblkdev_add_disks(bus_num, bd, cyasblkdev_add_disks(bus_num, bd,
total_media_count, devidx); total_media_count, devidx);
...@@ -1494,20 +1494,20 @@ static struct cyasblkdev_blk_data *cyasblkdev_blk_alloc(void) ...@@ -1494,20 +1494,20 @@ static struct cyasblkdev_blk_data *cyasblkdev_blk_alloc(void)
#ifndef WESTBRIDGE_NDEBUG #ifndef WESTBRIDGE_NDEBUG
cy_as_hal_print_message( cy_as_hal_print_message(
"%s: no device on bus %d\n", "%s: no device on bus %d\n",
__func__, bus_num) ; __func__, bus_num);
#endif #endif
} else { } else {
#ifndef WESTBRIDGE_NDEBUG #ifndef WESTBRIDGE_NDEBUG
cy_as_hal_print_message( cy_as_hal_print_message(
"%s: cannot query %d device " "%s: cannot query %d device "
"- reason code %d\n", "- reason code %d\n",
__func__, bus_num, stat) ; __func__, bus_num, stat);
#endif #endif
goto out ; goto out;
} }
} /* end for (bus_num = 0; bus_num <= 1; bus_num++)*/ } /* end for (bus_num = 0; bus_num <= 1; bus_num++)*/
return bd ; return bd;
} }
out: out:
#ifndef WESTBRIDGE_NDEBUG #ifndef WESTBRIDGE_NDEBUG
...@@ -1546,7 +1546,7 @@ static int cyasblkdev_blk_initialize(void) ...@@ -1546,7 +1546,7 @@ static int cyasblkdev_blk_initialize(void)
#ifndef WESTBRIDGE_NDEBUG #ifndef WESTBRIDGE_NDEBUG
cy_as_hal_print_message( cy_as_hal_print_message(
"%s cyasblkdev registered with major number: %d\n", "%s cyasblkdev registered with major number: %d\n",
__func__, major) ; __func__, major);
#endif #endif
bd = cyasblkdev_blk_alloc(); bd = cyasblkdev_blk_alloc();
......
...@@ -98,7 +98,7 @@ static int cyasblkdev_prep_request( ...@@ -98,7 +98,7 @@ static int cyasblkdev_prep_request(
if (req->cmd_type != REQ_TYPE_FS && !(req->cmd_flags & REQ_DISCARD)) { if (req->cmd_type != REQ_TYPE_FS && !(req->cmd_flags & REQ_DISCARD)) {
#ifndef WESTBRIDGE_NDEBUG #ifndef WESTBRIDGE_NDEBUG
cy_as_hal_print_message("%s:%x bad request received\n", cy_as_hal_print_message("%s:%x bad request received\n",
__func__, current->pid) ; __func__, current->pid);
#endif #endif
blk_dump_rq_flags(req, "cyasblkdev bad request"); blk_dump_rq_flags(req, "cyasblkdev bad request");
...@@ -136,7 +136,7 @@ static int cyasblkdev_queue_thread(void *d) ...@@ -136,7 +136,7 @@ static int cyasblkdev_queue_thread(void *d)
#ifndef WESTBRIDGE_NDEBUG #ifndef WESTBRIDGE_NDEBUG
cy_as_hal_print_message( 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 #endif
do { do {
...@@ -249,7 +249,7 @@ static int cyasblkdev_queue_thread(void *d) ...@@ -249,7 +249,7 @@ static int cyasblkdev_queue_thread(void *d)
complete_and_exit(&bq->thread_complete, 0); complete_and_exit(&bq->thread_complete, 0);
#ifndef WESTBRIDGE_NDEBUG #ifndef WESTBRIDGE_NDEBUG
cy_as_hal_print_message("%s: is finished\n", __func__) ; cy_as_hal_print_message("%s: is finished\n", __func__);
#endif #endif
return 0; return 0;
......
...@@ -55,7 +55,7 @@ extern void cyasblkdev_cleanup_queue(struct cyasblkdev_queue *); ...@@ -55,7 +55,7 @@ extern void cyasblkdev_cleanup_queue(struct cyasblkdev_queue *);
extern void cyasblkdev_queue_suspend(struct cyasblkdev_queue *); extern void cyasblkdev_queue_suspend(struct cyasblkdev_queue *);
extern void cyasblkdev_queue_resume(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 #define MOD_LOGS 1
void verbose_rq_flags(int flags); void verbose_rq_flags(int flags);
......
...@@ -26,77 +26,77 @@ ...@@ -26,77 +26,77 @@
* The APIs to create a device handle and download firmware are not exported * 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. * 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_get_firmware_version);
EXPORT_SYMBOL(cy_as_misc_read_m_c_u_register) ; EXPORT_SYMBOL(cy_as_misc_read_m_c_u_register);
EXPORT_SYMBOL(cy_as_misc_reset) ; EXPORT_SYMBOL(cy_as_misc_reset);
EXPORT_SYMBOL(cy_as_misc_acquire_resource) ; EXPORT_SYMBOL(cy_as_misc_acquire_resource);
EXPORT_SYMBOL(cy_as_misc_release_resource) ; EXPORT_SYMBOL(cy_as_misc_release_resource);
EXPORT_SYMBOL(cy_as_misc_enter_standby) ; EXPORT_SYMBOL(cy_as_misc_enter_standby);
EXPORT_SYMBOL(cy_as_misc_leave_standby) ; EXPORT_SYMBOL(cy_as_misc_leave_standby);
EXPORT_SYMBOL(cy_as_misc_enter_suspend) ; EXPORT_SYMBOL(cy_as_misc_enter_suspend);
EXPORT_SYMBOL(cy_as_misc_leave_suspend) ; EXPORT_SYMBOL(cy_as_misc_leave_suspend);
EXPORT_SYMBOL(cy_as_misc_storage_changed) ; EXPORT_SYMBOL(cy_as_misc_storage_changed);
EXPORT_SYMBOL(cy_as_misc_heart_beat_control) ; EXPORT_SYMBOL(cy_as_misc_heart_beat_control);
EXPORT_SYMBOL(cy_as_misc_get_gpio_value) ; EXPORT_SYMBOL(cy_as_misc_get_gpio_value);
EXPORT_SYMBOL(cy_as_misc_set_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_low_speed_sd_freq);
EXPORT_SYMBOL(cy_as_misc_set_high_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 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_set_end_point_config);
EXPORT_SYMBOL(cy_as_usb_read_data_async) ; EXPORT_SYMBOL(cy_as_usb_read_data_async);
EXPORT_SYMBOL(cy_as_usb_write_data_async) ; EXPORT_SYMBOL(cy_as_usb_write_data_async);
EXPORT_SYMBOL(cy_as_usb_cancel_async) ; EXPORT_SYMBOL(cy_as_usb_cancel_async);
EXPORT_SYMBOL(cy_as_usb_set_stall) ; EXPORT_SYMBOL(cy_as_usb_set_stall);
EXPORT_SYMBOL(cy_as_usb_clear_stall) ; EXPORT_SYMBOL(cy_as_usb_clear_stall);
EXPORT_SYMBOL(cy_as_usb_connect) ; EXPORT_SYMBOL(cy_as_usb_connect);
EXPORT_SYMBOL(cy_as_usb_disconnect) ; EXPORT_SYMBOL(cy_as_usb_disconnect);
EXPORT_SYMBOL(cy_as_usb_start) ; EXPORT_SYMBOL(cy_as_usb_start);
EXPORT_SYMBOL(cy_as_usb_stop) ; EXPORT_SYMBOL(cy_as_usb_stop);
EXPORT_SYMBOL(cy_as_usb_set_enum_config) ; EXPORT_SYMBOL(cy_as_usb_set_enum_config);
EXPORT_SYMBOL(cy_as_usb_get_enum_config) ; EXPORT_SYMBOL(cy_as_usb_get_enum_config);
EXPORT_SYMBOL(cy_as_usb_set_physical_configuration) ; EXPORT_SYMBOL(cy_as_usb_set_physical_configuration);
EXPORT_SYMBOL(cy_as_usb_register_callback) ; EXPORT_SYMBOL(cy_as_usb_register_callback);
EXPORT_SYMBOL(cy_as_usb_commit_config) ; EXPORT_SYMBOL(cy_as_usb_commit_config);
EXPORT_SYMBOL(cy_as_usb_set_descriptor) ; EXPORT_SYMBOL(cy_as_usb_set_descriptor);
EXPORT_SYMBOL(cy_as_usb_clear_descriptors) ; EXPORT_SYMBOL(cy_as_usb_clear_descriptors);
EXPORT_SYMBOL(cy_as_usb_get_descriptor) ; EXPORT_SYMBOL(cy_as_usb_get_descriptor);
EXPORT_SYMBOL(cy_as_usb_get_end_point_config) ; EXPORT_SYMBOL(cy_as_usb_get_end_point_config);
EXPORT_SYMBOL(cy_as_usb_read_data) ; EXPORT_SYMBOL(cy_as_usb_read_data);
EXPORT_SYMBOL(cy_as_usb_write_data) ; EXPORT_SYMBOL(cy_as_usb_write_data);
EXPORT_SYMBOL(cy_as_usb_get_stall) ; EXPORT_SYMBOL(cy_as_usb_get_stall);
EXPORT_SYMBOL(cy_as_usb_set_nak) ; EXPORT_SYMBOL(cy_as_usb_set_nak);
EXPORT_SYMBOL(cy_as_usb_clear_nak) ; EXPORT_SYMBOL(cy_as_usb_clear_nak);
EXPORT_SYMBOL(cy_as_usb_get_nak) ; EXPORT_SYMBOL(cy_as_usb_get_nak);
EXPORT_SYMBOL(cy_as_usb_signal_remote_wakeup) ; EXPORT_SYMBOL(cy_as_usb_signal_remote_wakeup);
EXPORT_SYMBOL(cy_as_usb_set_m_s_report_threshold) ; EXPORT_SYMBOL(cy_as_usb_set_m_s_report_threshold);
EXPORT_SYMBOL(cy_as_usb_select_m_s_partitions) ; EXPORT_SYMBOL(cy_as_usb_select_m_s_partitions);
/* /*
* Export all Storage APIs that can be used by dependent kernel modules. * Export all Storage APIs that can be used by dependent kernel modules.
*/ */
EXPORT_SYMBOL(cy_as_storage_start) ; EXPORT_SYMBOL(cy_as_storage_start);
EXPORT_SYMBOL(cy_as_storage_stop) ; EXPORT_SYMBOL(cy_as_storage_stop);
EXPORT_SYMBOL(cy_as_storage_register_callback) ; EXPORT_SYMBOL(cy_as_storage_register_callback);
EXPORT_SYMBOL(cy_as_storage_query_bus) ; EXPORT_SYMBOL(cy_as_storage_query_bus);
EXPORT_SYMBOL(cy_as_storage_query_media) ; EXPORT_SYMBOL(cy_as_storage_query_media);
EXPORT_SYMBOL(cy_as_storage_query_device) ; EXPORT_SYMBOL(cy_as_storage_query_device);
EXPORT_SYMBOL(cy_as_storage_query_unit) ; EXPORT_SYMBOL(cy_as_storage_query_unit);
EXPORT_SYMBOL(cy_as_storage_device_control) ; EXPORT_SYMBOL(cy_as_storage_device_control);
EXPORT_SYMBOL(cy_as_storage_claim) ; EXPORT_SYMBOL(cy_as_storage_claim);
EXPORT_SYMBOL(cy_as_storage_release) ; EXPORT_SYMBOL(cy_as_storage_release);
EXPORT_SYMBOL(cy_as_storage_read) ; EXPORT_SYMBOL(cy_as_storage_read);
EXPORT_SYMBOL(cy_as_storage_write) ; EXPORT_SYMBOL(cy_as_storage_write);
EXPORT_SYMBOL(cy_as_storage_read_async) ; EXPORT_SYMBOL(cy_as_storage_read_async);
EXPORT_SYMBOL(cy_as_storage_write_async) ; EXPORT_SYMBOL(cy_as_storage_write_async);
EXPORT_SYMBOL(cy_as_storage_cancel_async) ; EXPORT_SYMBOL(cy_as_storage_cancel_async);
EXPORT_SYMBOL(cy_as_storage_sd_register_read) ; EXPORT_SYMBOL(cy_as_storage_sd_register_read);
EXPORT_SYMBOL(cy_as_storage_create_p_partition) ; EXPORT_SYMBOL(cy_as_storage_create_p_partition);
EXPORT_SYMBOL(cy_as_storage_remove_p_partition) ; EXPORT_SYMBOL(cy_as_storage_remove_p_partition);
EXPORT_SYMBOL(cy_as_storage_get_transfer_amount) ; EXPORT_SYMBOL(cy_as_storage_get_transfer_amount);
EXPORT_SYMBOL(cy_as_storage_erase) ; EXPORT_SYMBOL(cy_as_storage_erase);
EXPORT_SYMBOL(cy_as_sdio_query_card); EXPORT_SYMBOL(cy_as_sdio_query_card);
EXPORT_SYMBOL(cy_as_sdio_init_function); EXPORT_SYMBOL(cy_as_sdio_init_function);
...@@ -106,13 +106,13 @@ EXPORT_SYMBOL(cy_as_sdio_direct_write); ...@@ -106,13 +106,13 @@ EXPORT_SYMBOL(cy_as_sdio_direct_write);
EXPORT_SYMBOL(cy_as_sdio_extended_read); EXPORT_SYMBOL(cy_as_sdio_extended_read);
EXPORT_SYMBOL(cy_as_sdio_extended_write); EXPORT_SYMBOL(cy_as_sdio_extended_write);
EXPORT_SYMBOL(cy_as_hal_alloc) ; EXPORT_SYMBOL(cy_as_hal_alloc);
EXPORT_SYMBOL(cy_as_hal_free) ; EXPORT_SYMBOL(cy_as_hal_free);
EXPORT_SYMBOL(cy_as_hal_sleep) ; EXPORT_SYMBOL(cy_as_hal_sleep);
EXPORT_SYMBOL(cy_as_hal_create_sleep_channel) ; EXPORT_SYMBOL(cy_as_hal_create_sleep_channel);
EXPORT_SYMBOL(cy_as_hal_destroy_sleep_channel) ; EXPORT_SYMBOL(cy_as_hal_destroy_sleep_channel);
EXPORT_SYMBOL(cy_as_hal_sleep_on) ; EXPORT_SYMBOL(cy_as_hal_sleep_on);
EXPORT_SYMBOL(cy_as_hal_wake) ; EXPORT_SYMBOL(cy_as_hal_wake);
EXPORT_SYMBOL(cy_as_hal_mem_set); EXPORT_SYMBOL(cy_as_hal_mem_set);
EXPORT_SYMBOL(cy_as_mtp_storage_only_start); EXPORT_SYMBOL(cy_as_mtp_storage_only_start);
...@@ -125,8 +125,8 @@ EXPORT_SYMBOL(cy_as_mtp_cancel_get_object); ...@@ -125,8 +125,8 @@ EXPORT_SYMBOL(cy_as_mtp_cancel_get_object);
#ifdef __CY_ASTORIA_SCM_KERNEL_HAL__ #ifdef __CY_ASTORIA_SCM_KERNEL_HAL__
/* Functions in the SCM kernel HAL implementation only. */ /* Functions in the SCM kernel HAL implementation only. */
EXPORT_SYMBOL(cy_as_hal_enable_scatter_list) ; EXPORT_SYMBOL(cy_as_hal_enable_scatter_list);
EXPORT_SYMBOL(cy_as_hal_disable_scatter_list) ; EXPORT_SYMBOL(cy_as_hal_disable_scatter_list);
#endif #endif
/*[]*/ /*[]*/
...@@ -48,12 +48,12 @@ typedef struct cyasdevice { ...@@ -48,12 +48,12 @@ typedef struct cyasdevice {
cy_as_device_handle dev_handle; cy_as_device_handle dev_handle;
/* Handle to the HAL */ /* Handle to the HAL */
cy_as_hal_device_tag hal_tag; cy_as_hal_device_tag hal_tag;
} cyasdevice ; } cyasdevice;
/* global ptr to astoria device */ /* global ptr to astoria device */
static cyasdevice *cy_as_device_controller ; static cyasdevice *cy_as_device_controller;
int cy_as_device_init_done; 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 #ifdef CONFIG_MACH_OMAP3_WESTBRIDGE_AST_PNAND_HAL
extern void cy_as_hal_config_c_s_mux(void); extern void cy_as_hal_config_c_s_mux(void);
...@@ -61,17 +61,17 @@ 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) 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) { if (!cy_as_dev) {
cy_as_hal_print_message("<1>_cy_as_device_deinit: " cy_as_hal_print_message("<1>_cy_as_device_deinit: "
"device handle %x is invalid\n", (uint32_t)cy_as_dev) ; "device handle %x is invalid\n", (uint32_t)cy_as_dev);
return ; return;
} }
/* stop west_brige */ /* stop west_brige */
if (cy_as_dev->dev_handle) { if (cy_as_dev->dev_handle) {
cy_as_hal_print_message("<1>_cy_as_device: " 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) != if (cy_as_misc_destroy_device(cy_as_dev->dev_handle) !=
CY_AS_ERROR_SUCCESS) { CY_AS_ERROR_SUCCESS) {
cy_as_hal_print_message( cy_as_hal_print_message(
...@@ -89,40 +89,40 @@ static void cyasdevice_deinit(cyasdevice *cy_as_dev) ...@@ -89,40 +89,40 @@ static void cyasdevice_deinit(cyasdevice *cy_as_dev)
#endif #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) ; kfree(cy_as_dev);
cy_as_device_controller = NULL ; cy_as_device_controller = NULL;
cy_as_hal_print_message("<1>_cy_as_device: deinitialized\n") ; cy_as_hal_print_message("<1>_cy_as_device: deinitialized\n");
} }
/*called from src/cyasmisc.c:MyMiscCallback() as a func /*called from src/cyasmisc.c:MyMiscCallback() as a func
* pointer [dev_p->misc_event_cb] which was previously * pointer [dev_p->misc_event_cb] which was previously
* registered by CyAsLLRegisterRequestCallback(..., * registered by CyAsLLRegisterRequestCallback(...,
* MyMiscCallback) ; called from CyAsMiscConfigureDevice() * MyMiscCallback); called from CyAsMiscConfigureDevice()
* which is in turn called from cyasdevice_initialize() in * which is in turn called from cyasdevice_initialize() in
* this src * this src
*/ */
static void cy_misc_callback(cy_as_device_handle h, static void cy_misc_callback(cy_as_device_handle h,
cy_as_misc_event_type evtype, void *evdata) cy_as_misc_event_type evtype, void *evdata)
{ {
(void)h ; (void)h;
(void)evdata ; (void)evdata;
switch (evtype) { switch (evtype) {
case cy_as_event_misc_initialized: case cy_as_event_misc_initialized:
cy_as_hal_print_message("<1>_cy_as_device: " cy_as_hal_print_message("<1>_cy_as_device: "
"initialization done callback triggered\n") ; "initialization done callback triggered\n");
cy_as_device_init_done = 1 ; cy_as_device_init_done = 1;
break ; break;
case cy_as_event_misc_awake: case cy_as_event_misc_awake:
cy_as_hal_print_message("<1>_cy_as_device: " cy_as_hal_print_message("<1>_cy_as_device: "
"cy_as_event_misc_awake event callback triggered\n") ; "cy_as_event_misc_awake event callback triggered\n");
cy_as_device_init_done = 1 ; cy_as_device_init_done = 1;
break ; break;
default: default:
break ; break;
} }
} }
...@@ -133,7 +133,7 @@ void hal_reset(cy_as_hal_device_tag tag) ...@@ -133,7 +133,7 @@ void hal_reset(cy_as_hal_device_tag tag)
cy_as_hal_print_message("<1> send soft hard rst: " cy_as_hal_print_message("<1> send soft hard rst: "
"MEM_RST_CTRL_REG_HARD...\n"); "MEM_RST_CTRL_REG_HARD...\n");
cy_as_hal_write_register(tag, CY_AS_MEM_RST_CTRL_REG, 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); mdelay(60);
cy_as_hal_print_message("<1> after RST: si_rev_REG:%x, " 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) ...@@ -144,7 +144,7 @@ void hal_reset(cy_as_hal_device_tag tag)
/* set it to LBD */ /* set it to LBD */
cy_as_hal_write_register(tag, CY_AS_MEM_PNAND_CFG, 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); EXPORT_SYMBOL(hal_reset);
...@@ -175,13 +175,13 @@ static struct platform_driver west_bridge_driver = { ...@@ -175,13 +175,13 @@ static struct platform_driver west_bridge_driver = {
/* west bridge device driver main init */ /* west bridge device driver main init */
static int cyasdevice_initialize(void) static int cyasdevice_initialize(void)
{ {
cyasdevice *cy_as_dev = 0 ; cyasdevice *cy_as_dev = 0;
int ret = 0 ; int ret = 0;
int retval = 0 ; int retval = 0;
cy_as_device_config config ; cy_as_device_config config;
cy_as_hal_sleep_channel channel ; cy_as_hal_sleep_channel channel;
cy_as_get_firmware_version_data ver_data = {0}; cy_as_get_firmware_version_data ver_data = {0};
const char *str = "" ; const char *str = "";
int spin_lim; int spin_lim;
const struct firmware *fw_entry; const struct firmware *fw_entry;
...@@ -189,19 +189,19 @@ static int cyasdevice_initialize(void) ...@@ -189,19 +189,19 @@ static int cyasdevice_initialize(void)
cy_as_misc_set_log_level(8); 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) { if (cy_as_device_controller != 0) {
cy_as_hal_print_message("<1>_cy_as_device: the device " cy_as_hal_print_message("<1>_cy_as_device: the device "
"has already been initilaized. ignoring\n") ; "has already been initilaized. ignoring\n");
return -EBUSY ; return -EBUSY;
} }
/* cy_as_dev = CyAsHalAlloc (sizeof(cyasdevice), SLAB_KERNEL); */ /* cy_as_dev = CyAsHalAlloc (sizeof(cyasdevice), SLAB_KERNEL); */
cy_as_dev = cy_as_hal_alloc(sizeof(cyasdevice)); cy_as_dev = cy_as_hal_alloc(sizeof(cyasdevice));
if (cy_as_dev == NULL) { if (cy_as_dev == NULL) {
cy_as_hal_print_message("<1>_cy_as_device: " cy_as_hal_print_message("<1>_cy_as_device: "
"memmory allocation failed\n") ; "memmory allocation failed\n");
return -ENOMEM; return -ENOMEM;
} }
memset(cy_as_dev, 0, sizeof(cyasdevice)); memset(cy_as_dev, 0, sizeof(cyasdevice));
...@@ -216,7 +216,7 @@ static int cyasdevice_initialize(void) ...@@ -216,7 +216,7 @@ static int cyasdevice_initialize(void)
&(cy_as_dev->hal_tag), cy_false)) { &(cy_as_dev->hal_tag), cy_false)) {
cy_as_hal_print_message( 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; goto done;
} }
#endif #endif
...@@ -226,28 +226,28 @@ static int cyasdevice_initialize(void) ...@@ -226,28 +226,28 @@ static int cyasdevice_initialize(void)
cy_as_dev->hal_tag) != CY_AS_ERROR_SUCCESS) { cy_as_dev->hal_tag) != CY_AS_ERROR_SUCCESS) {
cy_as_hal_print_message( cy_as_hal_print_message(
"<1>_cy_as_device: create device failed\n") ; "<1>_cy_as_device: create device failed\n");
goto done ; goto done;
} }
memset(&config, 0, sizeof(config)); memset(&config, 0, sizeof(config));
config.dmaintr = cy_true; 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) { if (ret != CY_AS_ERROR_SUCCESS) {
cy_as_hal_print_message( cy_as_hal_print_message(
"<1>_cy_as_device: configure device " "<1>_cy_as_device: configure device "
"failed. reason code: %d\n", ret) ; "failed. reason code: %d\n", ret);
goto done; goto done;
} }
ret = cy_as_misc_register_callback(cy_as_dev->dev_handle, ret = cy_as_misc_register_callback(cy_as_dev->dev_handle,
cy_misc_callback) ; cy_misc_callback);
if (ret != CY_AS_ERROR_SUCCESS) { if (ret != CY_AS_ERROR_SUCCESS) {
cy_as_hal_print_message("<1>_cy_as_device: " cy_as_hal_print_message("<1>_cy_as_device: "
"cy_as_misc_register_callback failed. " "cy_as_misc_register_callback failed. "
"reason code: %d\n", ret) ; "reason code: %d\n", ret);
goto done; goto done;
} }
...@@ -275,12 +275,12 @@ static int cyasdevice_initialize(void) ...@@ -275,12 +275,12 @@ static int cyasdevice_initialize(void)
cy_as_dev->dev_handle, cy_as_dev->dev_handle,
fw_entry->data, fw_entry->data,
fw_entry->size , fw_entry->size ,
0, 0) ; 0, 0);
} }
if (ret != CY_AS_ERROR_SUCCESS) { if (ret != CY_AS_ERROR_SUCCESS) {
cy_as_hal_print_message("<1>_cy_as_device: cannot download " 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; goto done;
} }
...@@ -289,10 +289,10 @@ static int cyasdevice_initialize(void) ...@@ -289,10 +289,10 @@ static int cyasdevice_initialize(void)
* to complete is 5sec*/ * to complete is 5sec*/
spin_lim = 50; spin_lim = 50;
cy_as_hal_create_sleep_channel(&channel) ; cy_as_hal_create_sleep_channel(&channel);
while (!cy_as_device_init_done) { while (!cy_as_device_init_done) {
cy_as_hal_sleep_on(&channel, 100) ; cy_as_hal_sleep_on(&channel, 100);
if (spin_lim-- <= 0) { if (spin_lim-- <= 0) {
cy_as_hal_print_message( cy_as_hal_print_message(
...@@ -301,46 +301,46 @@ static int cyasdevice_initialize(void) ...@@ -301,46 +301,46 @@ static int cyasdevice_initialize(void)
break; break;
} }
} }
cy_as_hal_destroy_sleep_channel(&channel) ; cy_as_hal_destroy_sleep_channel(&channel);
if (spin_lim > 0) if (spin_lim > 0)
cy_as_hal_print_message( 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, 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) { if (ret != CY_AS_ERROR_SUCCESS) {
cy_as_hal_print_message("<1>_cy_as_device: cannot get firmware " 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; goto done;
} }
if ((ver_data.media_type & 0x01) && (ver_data.media_type & 0x06)) 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)) 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) else if (ver_data.media_type & 0x01)
str = "nand." ; str = "nand.";
else if (ver_data.media_type & 0x08) else if (ver_data.media_type & 0x08)
str = "CEATA." ; str = "CEATA.";
else else
str = "SD/MMC." ; str = "SD/MMC.";
cy_as_hal_print_message("<1> cy_as_device:_firmware version: %s " cy_as_hal_print_message("<1> cy_as_device:_firmware version: %s "
"major=%d minor=%d build=%d,\n_media types supported:%s\n", "major=%d minor=%d build=%d,\n_media types supported:%s\n",
((ver_data.is_debug_mode) ? "debug" : "release"), ((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 */ /* done now */
cy_as_device_controller = cy_as_dev ; cy_as_device_controller = cy_as_dev;
return 0 ; return 0;
done: done:
if (cy_as_dev) 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) cy_as_device_handle cyasdevice_getdevhandle(void)
...@@ -350,21 +350,21 @@ 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(); cy_as_hal_config_c_s_mux();
#endif #endif
return cy_as_device_controller->dev_handle ; return cy_as_device_controller->dev_handle;
} }
return NULL; return NULL;
} }
EXPORT_SYMBOL(cyasdevice_getdevhandle) ; EXPORT_SYMBOL(cyasdevice_getdevhandle);
cy_as_hal_device_tag cyasdevice_gethaltag(void) cy_as_hal_device_tag cyasdevice_gethaltag(void)
{ {
if (cy_as_device_controller) if (cy_as_device_controller)
return (cy_as_hal_device_tag) return (cy_as_hal_device_tag)
cy_as_device_controller->hal_tag ; cy_as_device_controller->hal_tag;
return NULL; return NULL;
} }
EXPORT_SYMBOL(cyasdevice_gethaltag) ; EXPORT_SYMBOL(cyasdevice_gethaltag);
/*init Westbridge device driver **/ /*init Westbridge device driver **/
...@@ -373,14 +373,14 @@ static int __init cyasdevice_init(void) ...@@ -373,14 +373,14 @@ static int __init cyasdevice_init(void)
if (cyasdevice_initialize() != 0) if (cyasdevice_initialize() != 0)
return ENODEV; return ENODEV;
return 0 ; return 0;
} }
static void __exit cyasdevice_cleanup(void) static void __exit cyasdevice_cleanup(void)
{ {
cyasdevice_deinit(cy_as_device_controller) ; cyasdevice_deinit(cy_as_device_controller);
} }
......
...@@ -84,7 +84,7 @@ ...@@ -84,7 +84,7 @@
extern int mpage_cleardirty(struct address_space *mapping, int num_pages); 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 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 */ /* Driver data structures and utilities */
typedef struct cyasgadget_ep { typedef struct cyasgadget_ep {
...@@ -102,7 +102,7 @@ typedef struct cyasgadget_ep { ...@@ -102,7 +102,7 @@ typedef struct cyasgadget_ep {
is_in:1, is_in:1,
is_iso:1; is_iso:1;
cy_as_usb_end_point_config cyepconfig; cy_as_usb_end_point_config cyepconfig;
} cyasgadget_ep ; } cyasgadget_ep;
typedef struct cyasgadget_req { typedef struct cyasgadget_req {
struct usb_request req; struct usb_request req;
...@@ -112,7 +112,7 @@ typedef struct cyasgadget_req { ...@@ -112,7 +112,7 @@ typedef struct cyasgadget_req {
valid:1, valid:1,
complete:1, complete:1,
ep_stopped:1; ep_stopped:1;
} cyasgadget_req ; } cyasgadget_req;
typedef struct cyasgadget { typedef struct cyasgadget {
/* each device provides one gadget, several endpoints */ /* each device provides one gadget, several endpoints */
...@@ -139,16 +139,16 @@ typedef struct cyasgadget { ...@@ -139,16 +139,16 @@ typedef struct cyasgadget {
/* Data member used to store the GetObjectComplete event data */ /* Data member used to store the GetObjectComplete event data */
cy_as_mtp_get_object_complete_data tmtp_get_complete_data; cy_as_mtp_get_object_complete_data tmtp_get_complete_data;
} cyasgadget ; } cyasgadget;
static inline void set_halt(cyasgadget_ep *ep) static inline void set_halt(cyasgadget_ep *ep)
{ {
return ; return;
} }
static inline void clear_halt(cyasgadget_ep *ep) static inline void clear_halt(cyasgadget_ep *ep)
{ {
return ; return;
} }
#define xprintk(dev, level, fmt, args...) \ #define xprintk(dev, level, fmt, args...) \
...@@ -182,12 +182,12 @@ static inline void clear_halt(cyasgadget_ep *ep) ...@@ -182,12 +182,12 @@ static inline void clear_halt(cyasgadget_ep *ep)
static inline void start_out_naking(struct 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) static inline void stop_out_naking(struct cyasgadget_ep *ep)
{ {
return ; return;
} }
#endif /* _INCLUDED_CYANGADGET_H_ */ #endif /* _INCLUDED_CYANGADGET_H_ */
...@@ -29,14 +29,14 @@ ...@@ -29,14 +29,14 @@
typedef struct cy_as_gadget_ioctl_send_object { typedef struct cy_as_gadget_ioctl_send_object {
uint32_t status; uint32_t status;
uint32_t byte_count ; uint32_t byte_count;
uint32_t transaction_id ; uint32_t transaction_id;
} cy_as_gadget_ioctl_send_object ; } cy_as_gadget_ioctl_send_object;
typedef struct cy_as_gadget_ioctl_get_object { typedef struct cy_as_gadget_ioctl_get_object {
uint32_t status; uint32_t status;
uint32_t byte_count ; uint32_t byte_count;
} cy_as_gadget_ioctl_get_object ; } cy_as_gadget_ioctl_get_object;
typedef struct cy_as_gadget_ioctl_tmtp_status { typedef struct cy_as_gadget_ioctl_tmtp_status {
...@@ -46,7 +46,7 @@ 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_send_object tmtp_send_complete_data;
cy_as_gadget_ioctl_get_object tmtp_get_complete_data; cy_as_gadget_ioctl_get_object tmtp_get_complete_data;
uint32_t t_usec; uint32_t t_usec;
} cy_as_gadget_ioctl_tmtp_status ; } cy_as_gadget_ioctl_tmtp_status;
/*Init send object data*/ /*Init send object data*/
typedef struct cy_as_gadget_ioctl_i_s_o_j_d { 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 { ...@@ -57,7 +57,7 @@ typedef struct cy_as_gadget_ioctl_i_s_o_j_d {
uint32_t num_bytes; uint32_t num_bytes;
/* in case if more prcise timestamping is done in kernel mode */ /* in case if more prcise timestamping is done in kernel mode */
uint32_t t_usec; uint32_t t_usec;
uint32_t ret_val ; uint32_t ret_val;
char *file_name; char *file_name;
uint32_t name_length; uint32_t name_length;
...@@ -70,12 +70,12 @@ typedef struct cy_as_gadget_ioctl_i_g_o_j_d { ...@@ -70,12 +70,12 @@ typedef struct cy_as_gadget_ioctl_i_g_o_j_d {
uint16_t *blk_count_p; uint16_t *blk_count_p;
uint32_t item_count; uint32_t item_count;
uint32_t num_bytes; uint32_t num_bytes;
uint32_t tid ; uint32_t tid;
uint32_t ret_val ; uint32_t ret_val;
char *file_name; char *file_name;
uint32_t name_length; 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 { typedef struct cy_as_gadget_ioctl_cancel {
uint32_t ret_val; uint32_t ret_val;
......
...@@ -130,7 +130,7 @@ EXTERN cy_an_return_status_t ...@@ -130,7 +130,7 @@ EXTERN cy_an_return_status_t
cy_an_misc_create_device( cy_an_misc_create_device(
cy_an_device_handle *handle_p, cy_an_device_handle *handle_p,
cy_an_hal_device_tag tag cy_an_hal_device_tag tag
) ; );
#define cy_an_misc_create_device(h, tag) \ #define cy_an_misc_create_device(h, tag) \
cy_as_misc_create_device((cy_as_device_handle *)(h), \ cy_as_misc_create_device((cy_as_device_handle *)(h), \
(cy_as_hal_device_tag)(tag)) (cy_as_hal_device_tag)(tag))
...@@ -138,7 +138,7 @@ cy_an_misc_create_device( ...@@ -138,7 +138,7 @@ cy_an_misc_create_device(
EXTERN cy_an_return_status_t EXTERN cy_an_return_status_t
cy_an_misc_destroy_device( cy_an_misc_destroy_device(
cy_an_device_handle handle cy_an_device_handle handle
) ; );
#define cy_an_misc_destroy_device(h) \ #define cy_an_misc_destroy_device(h) \
cy_as_misc_destroy_device((cy_as_device_handle)(h)) cy_as_misc_destroy_device((cy_as_device_handle)(h))
...@@ -146,7 +146,7 @@ EXTERN cy_an_return_status_t ...@@ -146,7 +146,7 @@ EXTERN cy_an_return_status_t
cy_an_misc_configure_device( cy_an_misc_configure_device(
cy_an_device_handle handle, cy_an_device_handle handle,
cy_an_device_config *config_p cy_an_device_config *config_p
) ; );
#define cy_an_misc_configure_device(h, cfg) \ #define cy_an_misc_configure_device(h, cfg) \
cy_as_misc_configure_device((cy_as_device_handle)(h), \ cy_as_misc_configure_device((cy_as_device_handle)(h), \
(cy_as_device_config *)(cfg)) (cy_as_device_config *)(cfg))
...@@ -155,7 +155,7 @@ EXTERN cy_an_return_status_t ...@@ -155,7 +155,7 @@ EXTERN cy_an_return_status_t
cy_an_misc_in_standby( cy_an_misc_in_standby(
cy_an_device_handle handle, cy_an_device_handle handle,
cy_bool *standby cy_bool *standby
) ; );
#define cy_an_misc_in_standby(h, standby) \ #define cy_an_misc_in_standby(h, standby) \
cy_as_misc_in_standby((cy_as_device_handle)(h), (standby)) cy_as_misc_in_standby((cy_as_device_handle)(h), (standby))
...@@ -165,7 +165,7 @@ cy_an_misc_download_firmware( ...@@ -165,7 +165,7 @@ cy_an_misc_download_firmware(
cy_an_device_handle handle, cy_an_device_handle handle,
const void *fw_p, const void *fw_p,
uint16_t size uint16_t size
) ; );
#define cy_an_misc_download_firmware(handle, fw_p, size) \ #define cy_an_misc_download_firmware(handle, fw_p, size) \
cy_as_misc_download_firmware((cy_as_device_handle)\ cy_as_misc_download_firmware((cy_as_device_handle)\
...@@ -179,7 +179,7 @@ cy_an_misc_download_firmware_e_x( ...@@ -179,7 +179,7 @@ cy_an_misc_download_firmware_e_x(
uint16_t size, uint16_t size,
cy_an_function_callback cb, cy_an_function_callback cb,
uint32_t client uint32_t client
) ; );
#define cy_an_misc_download_firmware_e_x(h, fw_p, size, cb, 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), \ cy_as_misc_download_firmware((cy_as_device_handle)(h), \
...@@ -207,7 +207,7 @@ cy_an_misc_get_firmware_version_e_x( ...@@ -207,7 +207,7 @@ cy_an_misc_get_firmware_version_e_x(
cy_an_get_firmware_version_data *data, cy_an_get_firmware_version_data *data,
cy_an_function_callback cb, cy_an_function_callback cb,
uint32_t client uint32_t client
) ; );
#define cy_an_misc_get_firmware_version_e_x\ #define cy_an_misc_get_firmware_version_e_x\
(h, data, cb, client) \ (h, data, cb, client) \
cy_as_misc_get_firmware_version((cy_as_device_handle)(h), \ cy_as_misc_get_firmware_version((cy_as_device_handle)(h), \
...@@ -219,7 +219,7 @@ cy_an_misc_read_m_c_u_register( ...@@ -219,7 +219,7 @@ cy_an_misc_read_m_c_u_register(
cy_an_device_handle handle, cy_an_device_handle handle,
uint16_t address, uint16_t address,
uint8_t *value uint8_t *value
) ; );
#define cy_an_misc_read_m_c_u_register(handle, address, 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), \ 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( ...@@ -233,7 +233,7 @@ cy_an_misc_read_m_c_u_register_e_x(
uint8_t *value, uint8_t *value,
cy_an_function_callback cb, cy_an_function_callback cb,
uint32_t client uint32_t client
) ; );
#define cy_an_misc_read_m_c_u_register_e_x\ #define cy_an_misc_read_m_c_u_register_e_x\
(h, addr, val, cb, client) \ (h, addr, val, cb, client) \
...@@ -247,7 +247,7 @@ cy_an_misc_write_m_c_u_register( ...@@ -247,7 +247,7 @@ cy_an_misc_write_m_c_u_register(
uint16_t address, uint16_t address,
uint8_t mask, uint8_t mask,
uint8_t value uint8_t value
) ; );
#define cy_an_misc_write_m_c_u_register\ #define cy_an_misc_write_m_c_u_register\
(handle, address, mask, value) \ (handle, address, mask, value) \
cy_as_misc_write_m_c_u_register((cy_as_device_handle)(handle), \ 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( ...@@ -262,7 +262,7 @@ cy_an_misc_write_m_c_u_register_e_x(
uint8_t value, uint8_t value,
cy_an_function_callback cb, cy_an_function_callback cb,
uint32_t client uint32_t client
) ; );
#define cy_an_misc_write_m_c_u_register_e_x\ #define cy_an_misc_write_m_c_u_register_e_x\
(h, addr, mask, val, cb, client) \ (h, addr, mask, val, cb, client) \
cy_as_misc_write_m_c_u_register((cy_as_device_handle)(h), \ cy_as_misc_write_m_c_u_register((cy_as_device_handle)(h), \
...@@ -274,7 +274,7 @@ cy_an_misc_reset( ...@@ -274,7 +274,7 @@ cy_an_misc_reset(
cy_an_device_handle handle, cy_an_device_handle handle,
cy_an_reset_type type, cy_an_reset_type type,
cy_bool flush cy_bool flush
) ; );
#define cy_an_misc_reset(handle, type, flush) \ #define cy_an_misc_reset(handle, type, flush) \
cy_as_misc_reset((cy_as_device_handle)(handle), \ cy_as_misc_reset((cy_as_device_handle)(handle), \
(type), (flush), 0, 0) (type), (flush), 0, 0)
...@@ -287,7 +287,7 @@ cy_an_misc_reset_e_x( ...@@ -287,7 +287,7 @@ cy_an_misc_reset_e_x(
cy_bool flush, cy_bool flush,
cy_an_function_callback cb, cy_an_function_callback cb,
uint32_t client uint32_t client
) ; );
#define cy_an_misc_reset_e_x(h, type, flush, cb, client) \ #define cy_an_misc_reset_e_x(h, type, flush, cb, client) \
cy_as_misc_reset((cy_as_device_handle)(h), \ cy_as_misc_reset((cy_as_device_handle)(h), \
(cy_as_reset_type)(type), (flush), \ (cy_as_reset_type)(type), (flush), \
...@@ -299,7 +299,7 @@ cy_an_misc_acquire_resource( ...@@ -299,7 +299,7 @@ cy_an_misc_acquire_resource(
cy_an_device_handle handle, cy_an_device_handle handle,
cy_an_resource_type type, cy_an_resource_type type,
cy_bool force cy_bool force
) ; );
#define cy_an_misc_acquire_resource(h, type, force) \ #define cy_an_misc_acquire_resource(h, type, force) \
cy_as_misc_acquire_resource_dep((cy_as_device_handle)(h), \ cy_as_misc_acquire_resource_dep((cy_as_device_handle)(h), \
(cy_as_resource_type)(type), (force)) (cy_as_resource_type)(type), (force))
...@@ -312,7 +312,7 @@ cy_an_misc_acquire_resource_e_x( ...@@ -312,7 +312,7 @@ cy_an_misc_acquire_resource_e_x(
cy_bool force, cy_bool force,
cy_an_function_callback cb, cy_an_function_callback cb,
uint32_t client uint32_t client
) ; );
#define cy_an_misc_acquire_resource_e_x\ #define cy_an_misc_acquire_resource_e_x\
(h, type_p, force, cb, client) \ (h, type_p, force, cb, client) \
cy_as_misc_acquire_resource((cy_as_device_handle)(h), \ cy_as_misc_acquire_resource((cy_as_device_handle)(h), \
...@@ -324,7 +324,7 @@ EXTERN cy_an_return_status_t ...@@ -324,7 +324,7 @@ EXTERN cy_an_return_status_t
cy_an_misc_release_resource( cy_an_misc_release_resource(
cy_an_device_handle handle, cy_an_device_handle handle,
cy_an_resource_type type cy_an_resource_type type
) ; );
#define cy_an_misc_release_resource(h, type)\ #define cy_an_misc_release_resource(h, type)\
cy_as_misc_release_resource((cy_as_device_handle)(h), \ cy_as_misc_release_resource((cy_as_device_handle)(h), \
(cy_as_resource_type)(type)) (cy_as_resource_type)(type))
...@@ -337,7 +337,7 @@ cy_an_misc_set_trace_level( ...@@ -337,7 +337,7 @@ cy_an_misc_set_trace_level(
cy_an_media_type media, cy_an_media_type media,
uint32_t device, uint32_t device,
uint32_t unit uint32_t unit
) ; );
#define cy_an_misc_set_trace_level\ #define cy_an_misc_set_trace_level\
(handle, level, media, device, unit) \ (handle, level, media, device, unit) \
...@@ -354,7 +354,7 @@ cy_an_misc_set_trace_level_e_x( ...@@ -354,7 +354,7 @@ cy_an_misc_set_trace_level_e_x(
uint32_t unit, uint32_t unit,
cy_an_function_callback cb, cy_an_function_callback cb,
uint32_t client uint32_t client
) ; );
#define cy_an_misc_set_trace_level_e_x\ #define cy_an_misc_set_trace_level_e_x\
(h, level, media, device, unit, cb, client) \ (h, level, media, device, unit, cb, client) \
cy_as_misc_set_trace_level_dep((cy_as_device_handle)(h), \ cy_as_misc_set_trace_level_dep((cy_as_device_handle)(h), \
...@@ -366,7 +366,7 @@ EXTERN cy_an_return_status_t ...@@ -366,7 +366,7 @@ EXTERN cy_an_return_status_t
cy_an_misc_enter_standby( cy_an_misc_enter_standby(
cy_an_device_handle handle, cy_an_device_handle handle,
cy_bool pin cy_bool pin
) ; );
#define cy_an_misc_enter_standby(handle, pin) \ #define cy_an_misc_enter_standby(handle, pin) \
cy_as_misc_enter_standby(\ cy_as_misc_enter_standby(\
(cy_as_device_handle)(handle), (pin), 0, 0) (cy_as_device_handle)(handle), (pin), 0, 0)
...@@ -378,7 +378,7 @@ cy_an_misc_enter_standby_e_x( ...@@ -378,7 +378,7 @@ cy_an_misc_enter_standby_e_x(
cy_bool pin, cy_bool pin,
cy_an_function_callback cb, cy_an_function_callback cb,
uint32_t client uint32_t client
) ; );
#define cy_an_misc_enter_standby_e_x(h, pin, cb, client) \ #define cy_an_misc_enter_standby_e_x(h, pin, cb, client) \
cy_as_misc_enter_standby((cy_as_device_handle)(h), \ cy_as_misc_enter_standby((cy_as_device_handle)(h), \
(pin), (cy_as_function_callback)(cb), (client)) (pin), (cy_as_function_callback)(cb), (client))
...@@ -388,7 +388,7 @@ EXTERN cy_an_return_status_t ...@@ -388,7 +388,7 @@ EXTERN cy_an_return_status_t
cy_an_misc_leave_standby( cy_an_misc_leave_standby(
cy_an_device_handle handle, cy_an_device_handle handle,
cy_an_resource_type type cy_an_resource_type type
) ; );
#define cy_an_misc_leave_standby(h, type) \ #define cy_an_misc_leave_standby(h, type) \
cy_as_misc_leave_standby((cy_as_device_handle)(h), \ cy_as_misc_leave_standby((cy_as_device_handle)(h), \
(cy_as_resource_type)(type)) (cy_as_resource_type)(type))
...@@ -398,7 +398,7 @@ EXTERN cy_an_return_status_t ...@@ -398,7 +398,7 @@ EXTERN cy_an_return_status_t
cy_an_misc_register_callback( cy_an_misc_register_callback(
cy_an_device_handle handle, cy_an_device_handle handle,
cy_an_misc_event_callback callback cy_an_misc_event_callback callback
) ; );
#define cy_an_misc_register_callback(h, cb) \ #define cy_an_misc_register_callback(h, cb) \
cy_as_misc_register_callback((cy_as_device_handle)(h), \ cy_as_misc_register_callback((cy_as_device_handle)(h), \
(cy_as_misc_event_callback)(cb)) (cy_as_misc_event_callback)(cb))
...@@ -407,7 +407,7 @@ cy_an_misc_register_callback( ...@@ -407,7 +407,7 @@ cy_an_misc_register_callback(
EXTERN void EXTERN void
cy_an_misc_set_log_level( cy_an_misc_set_log_level(
uint8_t level uint8_t level
) ; );
#define cy_an_misc_set_log_level(level) \ #define cy_an_misc_set_log_level(level) \
cy_as_misc_set_log_level(level) cy_as_misc_set_log_level(level)
...@@ -415,7 +415,7 @@ cy_an_misc_set_log_level( ...@@ -415,7 +415,7 @@ cy_an_misc_set_log_level(
EXTERN cy_an_return_status_t EXTERN cy_an_return_status_t
cy_an_misc_storage_changed( cy_an_misc_storage_changed(
cy_an_device_handle handle cy_an_device_handle handle
) ; );
#define cy_an_misc_storage_changed(handle) \ #define cy_an_misc_storage_changed(handle) \
cy_as_misc_storage_changed((cy_as_device_handle)(handle), 0, 0) cy_as_misc_storage_changed((cy_as_device_handle)(handle), 0, 0)
...@@ -425,7 +425,7 @@ cy_an_misc_storage_changed_e_x( ...@@ -425,7 +425,7 @@ cy_an_misc_storage_changed_e_x(
cy_an_device_handle handle, cy_an_device_handle handle,
cy_an_function_callback cb, cy_an_function_callback cb,
uint32_t client uint32_t client
) ; );
#define cy_an_misc_storage_changed_e_x(h, cb, client) \ #define cy_an_misc_storage_changed_e_x(h, cb, client) \
cy_as_misc_storage_changed((cy_as_device_handle)(h), \ cy_as_misc_storage_changed((cy_as_device_handle)(h), \
(cy_as_function_callback)(cb), (client)) (cy_as_function_callback)(cb), (client))
...@@ -435,7 +435,7 @@ EXTERN cy_an_return_status_t ...@@ -435,7 +435,7 @@ EXTERN cy_an_return_status_t
cy_an_misc_heart_beat_control( cy_an_misc_heart_beat_control(
cy_an_device_handle handle, cy_an_device_handle handle,
cy_bool enable cy_bool enable
) ; );
#define cy_an_misc_heart_beat_control(handle, enable) \ #define cy_an_misc_heart_beat_control(handle, enable) \
cy_as_misc_heart_beat_control((cy_as_device_handle)\ cy_as_misc_heart_beat_control((cy_as_device_handle)\
(handle), (enable), 0, 0) (handle), (enable), 0, 0)
...@@ -447,7 +447,7 @@ cy_an_misc_heart_beat_control_e_x( ...@@ -447,7 +447,7 @@ cy_an_misc_heart_beat_control_e_x(
cy_bool enable, cy_bool enable,
cy_an_function_callback cb, cy_an_function_callback cb,
uint32_t client uint32_t client
) ; );
#define cy_an_misc_heart_beat_control_e_x(h, enable, cb, 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), \ cy_as_misc_heart_beat_control((cy_as_device_handle)(h), \
(enable), (cy_as_function_callback)(cb), (client)) (enable), (cy_as_function_callback)(cb), (client))
...@@ -458,7 +458,7 @@ cy_an_misc_get_gpio_value( ...@@ -458,7 +458,7 @@ cy_an_misc_get_gpio_value(
cy_an_device_handle handle, cy_an_device_handle handle,
cy_an_misc_gpio pin, cy_an_misc_gpio pin,
uint8_t *value uint8_t *value
) ; );
#define cy_an_misc_get_gpio_value(handle, pin, 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_get_gpio_value((cy_as_device_handle)(handle), \
(cy_as_misc_gpio)(pin), (value), 0, 0) (cy_as_misc_gpio)(pin), (value), 0, 0)
...@@ -471,7 +471,7 @@ cy_an_misc_get_gpio_value_e_x( ...@@ -471,7 +471,7 @@ cy_an_misc_get_gpio_value_e_x(
uint8_t *value, uint8_t *value,
cy_an_function_callback cb, cy_an_function_callback cb,
uint32_t client uint32_t client
) ; );
#define cy_an_misc_get_gpio_value_e_x(h, pin, value, cb, 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_get_gpio_value((cy_as_device_handle)(h), \
(cy_as_misc_gpio)(pin), (value), \ (cy_as_misc_gpio)(pin), (value), \
...@@ -483,7 +483,7 @@ cy_an_misc_set_gpio_value( ...@@ -483,7 +483,7 @@ cy_an_misc_set_gpio_value(
cy_an_device_handle handle, cy_an_device_handle handle,
cy_an_misc_gpio pin, cy_an_misc_gpio pin,
uint8_t value uint8_t value
) ; );
#define cy_an_misc_set_gpio_value(handle, pin, 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_set_gpio_value((cy_as_device_handle)(handle), \
(cy_as_misc_gpio)(pin), (value), 0, 0) (cy_as_misc_gpio)(pin), (value), 0, 0)
...@@ -496,7 +496,7 @@ cy_an_misc_set_gpio_value_e_x( ...@@ -496,7 +496,7 @@ cy_an_misc_set_gpio_value_e_x(
uint8_t value, uint8_t value,
cy_an_function_callback cb, cy_an_function_callback cb,
uint32_t client uint32_t client
) ; );
#define cy_an_misc_set_gpio_value_e_x\ #define cy_an_misc_set_gpio_value_e_x\
(h, pin, value, cb, client) \ (h, pin, value, cb, client) \
cy_as_misc_set_gpio_value((cy_as_device_handle)(h), \ cy_as_misc_set_gpio_value((cy_as_device_handle)(h), \
...@@ -509,7 +509,7 @@ cy_an_misc_enter_suspend( ...@@ -509,7 +509,7 @@ cy_an_misc_enter_suspend(
cy_an_device_handle handle, cy_an_device_handle handle,
cy_bool usb_wakeup_en, cy_bool usb_wakeup_en,
cy_bool gpio_wakeup_en cy_bool gpio_wakeup_en
) ; );
#define cy_an_misc_enter_suspend(handle, usb_wakeup_en, \ #define cy_an_misc_enter_suspend(handle, usb_wakeup_en, \
gpio_wakeup_en) \ gpio_wakeup_en) \
cy_as_misc_enter_suspend((cy_as_device_handle)(handle), \ cy_as_misc_enter_suspend((cy_as_device_handle)(handle), \
...@@ -523,7 +523,7 @@ cy_an_misc_enter_suspend_e_x( ...@@ -523,7 +523,7 @@ cy_an_misc_enter_suspend_e_x(
cy_bool gpio_wakeup_en, cy_bool gpio_wakeup_en,
cy_an_function_callback cb, cy_an_function_callback cb,
uint32_t client uint32_t client
) ; );
#define cy_an_misc_enter_suspend_e_x(h, usb_en, gpio_en, cb, 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), \ cy_as_misc_enter_suspend((cy_as_device_handle)(h), (usb_en), \
(gpio_en), (cy_as_function_callback)(cb), (client)) (gpio_en), (cy_as_function_callback)(cb), (client))
...@@ -532,7 +532,7 @@ cy_an_misc_enter_suspend_e_x( ...@@ -532,7 +532,7 @@ cy_an_misc_enter_suspend_e_x(
EXTERN cy_an_return_status_t EXTERN cy_an_return_status_t
cy_an_misc_leave_suspend( cy_an_misc_leave_suspend(
cy_an_device_handle handle cy_an_device_handle handle
) ; );
#define cy_an_misc_leave_suspend(handle) \ #define cy_an_misc_leave_suspend(handle) \
cy_as_misc_leave_suspend((cy_as_device_handle)(handle), 0, 0) cy_as_misc_leave_suspend((cy_as_device_handle)(handle), 0, 0)
...@@ -542,7 +542,7 @@ cy_an_misc_leave_suspend_e_x( ...@@ -542,7 +542,7 @@ cy_an_misc_leave_suspend_e_x(
cy_an_device_handle handle, cy_an_device_handle handle,
cy_an_function_callback cb, cy_an_function_callback cb,
uint32_t client uint32_t client
) ; );
#define cy_an_misc_leave_suspend_e_x(h, cb, client) \ #define cy_an_misc_leave_suspend_e_x(h, cb, client) \
cy_as_misc_leave_suspend((cy_as_device_handle)(h), \ cy_as_misc_leave_suspend((cy_as_device_handle)(h), \
...@@ -553,7 +553,7 @@ EXTERN cy_an_return_status_t ...@@ -553,7 +553,7 @@ EXTERN cy_an_return_status_t
cy_an_misc_set_low_speed_sd_freq( cy_an_misc_set_low_speed_sd_freq(
cy_an_device_handle handle, cy_an_device_handle handle,
cy_an_low_speed_sd_freq setting cy_an_low_speed_sd_freq setting
) ; );
#define cy_an_misc_set_low_speed_sd_freq(h, 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_misc_set_low_speed_sd_freq((cy_as_device_handle)(h), \
(cy_as_low_speed_sd_freq)(setting), 0, 0) (cy_as_low_speed_sd_freq)(setting), 0, 0)
...@@ -565,7 +565,7 @@ cy_an_misc_set_low_speed_sd_freq_e_x( ...@@ -565,7 +565,7 @@ cy_an_misc_set_low_speed_sd_freq_e_x(
cy_an_low_speed_sd_freq setting, cy_an_low_speed_sd_freq setting,
cy_an_function_callback cb, cy_an_function_callback cb,
uint32_t client uint32_t client
) ; );
#define cy_an_misc_set_low_speed_sd_freq_e_x\ #define cy_an_misc_set_low_speed_sd_freq_e_x\
(h, setting, cb, client) \ (h, setting, cb, client) \
cy_as_misc_set_low_speed_sd_freq((cy_as_device_handle)(h), \ 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( ...@@ -579,7 +579,7 @@ cy_an_misc_set_high_speed_sd_freq(
cy_an_high_speed_sd_freq setting, cy_an_high_speed_sd_freq setting,
cy_an_function_callback cb, cy_an_function_callback cb,
uint32_t client uint32_t client
) ; );
#define cy_an_misc_set_high_speed_sd_freq(h, setting, cb, 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_misc_set_high_speed_sd_freq((cy_as_device_handle)(h), \
(cy_as_high_speed_sd_freq)(setting), \ (cy_as_high_speed_sd_freq)(setting), \
......
...@@ -60,10 +60,10 @@ typedef cy_as_sd_card_reg_type \ ...@@ -60,10 +60,10 @@ typedef cy_as_sd_card_reg_type \
cy_an_sd_card_reg_type; cy_an_sd_card_reg_type;
typedef cy_as_storage_query_device_data_dep \ 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 \ 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 \ typedef cy_as_storage_sd_reg_read_data \
cy_an_storage_sd_reg_read_data; cy_an_storage_sd_reg_read_data;
...@@ -80,7 +80,7 @@ typedef cy_as_storage_sd_reg_read_data \ ...@@ -80,7 +80,7 @@ typedef cy_as_storage_sd_reg_read_data \
EXTERN cy_an_return_status_t EXTERN cy_an_return_status_t
cy_an_storage_start( cy_an_storage_start(
cy_an_device_handle handle cy_an_device_handle handle
) ; );
#define cy_an_storage_start(handle) \ #define cy_an_storage_start(handle) \
cy_as_storage_start((cy_as_device_handle)(handle), 0, 0) cy_as_storage_start((cy_as_device_handle)(handle), 0, 0)
...@@ -90,7 +90,7 @@ cy_an_storage_start_e_x( ...@@ -90,7 +90,7 @@ cy_an_storage_start_e_x(
cy_an_device_handle handle, cy_an_device_handle handle,
cy_an_function_callback cb, cy_an_function_callback cb,
uint32_t client uint32_t client
) ; );
#define cy_an_storage_start_e_x(h, cb, client) \ #define cy_an_storage_start_e_x(h, cb, client) \
cy_as_storage_start((cy_as_device_handle)(h), \ cy_as_storage_start((cy_as_device_handle)(h), \
(cy_as_function_callback)(cb), (client)) (cy_as_function_callback)(cb), (client))
...@@ -99,7 +99,7 @@ cy_an_storage_start_e_x( ...@@ -99,7 +99,7 @@ cy_an_storage_start_e_x(
EXTERN cy_an_return_status_t EXTERN cy_an_return_status_t
cy_an_storage_stop( cy_an_storage_stop(
cy_an_device_handle handle cy_an_device_handle handle
) ; );
#define cy_an_storage_stop(handle) \ #define cy_an_storage_stop(handle) \
cy_as_storage_stop((cy_as_device_handle)(handle), 0, 0) cy_as_storage_stop((cy_as_device_handle)(handle), 0, 0)
...@@ -109,7 +109,7 @@ cy_an_storage_stop_e_x( ...@@ -109,7 +109,7 @@ cy_an_storage_stop_e_x(
cy_an_device_handle handle, cy_an_device_handle handle,
cy_an_function_callback cb, cy_an_function_callback cb,
uint32_t client uint32_t client
) ; );
#define cy_an_storage_stop_e_x(h, cb, client) \ #define cy_an_storage_stop_e_x(h, cb, client) \
cy_as_storage_stop((cy_as_device_handle)(h), \ cy_as_storage_stop((cy_as_device_handle)(h), \
(cy_as_function_callback)(cb), (client)) (cy_as_function_callback)(cb), (client))
...@@ -119,7 +119,7 @@ EXTERN cy_an_return_status_t ...@@ -119,7 +119,7 @@ EXTERN cy_an_return_status_t
cy_an_storage_register_callback( cy_an_storage_register_callback(
cy_an_device_handle handle, cy_an_device_handle handle,
cy_an_storage_event_callback callback cy_an_storage_event_callback callback
) ; );
#define cy_an_storage_register_callback(h, cb) \ #define cy_an_storage_register_callback(h, cb) \
cy_as_storage_register_callback_dep((cy_as_device_handle)(h), \ cy_as_storage_register_callback_dep((cy_as_device_handle)(h), \
(cy_as_storage_event_callback_dep)(cb)) (cy_as_storage_event_callback_dep)(cb))
...@@ -129,7 +129,7 @@ EXTERN cy_an_return_status_t ...@@ -129,7 +129,7 @@ EXTERN cy_an_return_status_t
cy_an_storage_claim( cy_an_storage_claim(
cy_an_device_handle handle, cy_an_device_handle handle,
cy_an_media_type type cy_an_media_type type
) ; );
#define cy_an_storage_claim(h, type) \ #define cy_an_storage_claim(h, type) \
cy_as_storage_claim_dep((cy_as_device_handle)(h), \ cy_as_storage_claim_dep((cy_as_device_handle)(h), \
(cy_as_media_type)(type)) (cy_as_media_type)(type))
...@@ -141,7 +141,7 @@ cy_an_storage_claim_e_x( ...@@ -141,7 +141,7 @@ cy_an_storage_claim_e_x(
cy_an_media_type *type, cy_an_media_type *type,
cy_an_function_callback cb, cy_an_function_callback cb,
uint32_t client uint32_t client
) ; );
#define cy_an_storage_claim_e_x(h, type_p, cb, 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_storage_claim_dep_EX((cy_as_device_handle)(h), \
(cy_as_media_type *)(type_p), \ (cy_as_media_type *)(type_p), \
...@@ -152,7 +152,7 @@ EXTERN cy_an_return_status_t ...@@ -152,7 +152,7 @@ EXTERN cy_an_return_status_t
cy_an_storage_release( cy_an_storage_release(
cy_an_device_handle handle, cy_an_device_handle handle,
cy_an_media_type type cy_an_media_type type
) ; );
#define cy_an_storage_release(h, type) \ #define cy_an_storage_release(h, type) \
cy_as_storage_release_dep((cy_as_device_handle)(h), \ cy_as_storage_release_dep((cy_as_device_handle)(h), \
(cy_as_media_type)(type)) (cy_as_media_type)(type))
...@@ -164,7 +164,7 @@ cy_an_storage_release_e_x( ...@@ -164,7 +164,7 @@ cy_an_storage_release_e_x(
cy_an_media_type *type, cy_an_media_type *type,
cy_an_function_callback cb, cy_an_function_callback cb,
uint32_t client uint32_t client
) ; );
#define cy_an_storage_release_e_x(h, type_p, cb, 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_storage_release_dep_EX((cy_as_device_handle)(h), \
(cy_as_media_type *)(type_p), \ (cy_as_media_type *)(type_p), \
...@@ -176,7 +176,7 @@ cy_an_storage_query_media( ...@@ -176,7 +176,7 @@ cy_an_storage_query_media(
cy_an_device_handle handle, cy_an_device_handle handle,
cy_an_media_type type, cy_an_media_type type,
uint32_t *count uint32_t *count
) ; );
#define cy_an_storage_query_media(handle, type, count) \ #define cy_an_storage_query_media(handle, type, count) \
cy_as_storage_query_media((cy_as_device_handle)(handle), \ cy_as_storage_query_media((cy_as_device_handle)(handle), \
(cy_as_media_type)(type), (count), 0, 0) (cy_as_media_type)(type), (count), 0, 0)
...@@ -189,7 +189,7 @@ cy_an_storage_query_media_e_x( ...@@ -189,7 +189,7 @@ cy_an_storage_query_media_e_x(
uint32_t *count, uint32_t *count,
cy_an_function_callback cb, cy_an_function_callback cb,
uint32_t client uint32_t client
) ; );
#define cy_an_storage_query_media_e_x(h, type, count, cb, 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_storage_query_media((cy_as_device_handle)(h), \
(cy_as_media_type)(type), (count), \ (cy_as_media_type)(type), (count), \
...@@ -202,7 +202,7 @@ cy_an_storage_query_device( ...@@ -202,7 +202,7 @@ cy_an_storage_query_device(
cy_an_media_type type, cy_an_media_type type,
uint32_t device, uint32_t device,
cy_an_device_desc *desc_p cy_an_device_desc *desc_p
) ; );
#define cy_an_storage_query_device(h, type, device, 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_storage_query_device_dep((cy_as_device_handle)(h), \
(cy_as_media_type)(type), (device), (cy_as_device_desc *)(desc_p)) (cy_as_media_type)(type), (device), (cy_as_device_desc *)(desc_p))
...@@ -214,7 +214,7 @@ cy_an_storage_query_device_e_x( ...@@ -214,7 +214,7 @@ cy_an_storage_query_device_e_x(
cy_an_storage_query_device_data *data, cy_an_storage_query_device_data *data,
cy_an_function_callback cb, cy_an_function_callback cb,
uint32_t client uint32_t client
) ; );
#define cy_an_storage_query_device_e_x(h, data, cb, 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_dep_EX((cy_as_device_handle)(h), \
(cy_as_storage_query_device_data_dep *)(data), \ (cy_as_storage_query_device_data_dep *)(data), \
...@@ -228,7 +228,7 @@ cy_an_storage_query_unit( ...@@ -228,7 +228,7 @@ cy_an_storage_query_unit(
uint32_t device, uint32_t device,
uint32_t unit, uint32_t unit,
cy_an_unit_desc *desc_p cy_an_unit_desc *desc_p
) ; );
#define cy_an_storage_query_unit(h, type, device, unit, 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_storage_query_unit_dep((cy_as_device_handle)(h), \
(cy_as_media_type)(type), (device), \ (cy_as_media_type)(type), (device), \
...@@ -241,7 +241,7 @@ cy_an_storage_query_unit_e_x( ...@@ -241,7 +241,7 @@ cy_an_storage_query_unit_e_x(
cy_an_storage_query_unit_data *data_p, cy_an_storage_query_unit_data *data_p,
cy_an_function_callback cb, cy_an_function_callback cb,
uint32_t client uint32_t client
) ; );
#define cy_an_storage_query_unit_e_x(h, data_p, cb, 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_dep_EX((cy_as_device_handle)(h), \
(cy_as_storage_query_unit_data_dep *)(data_p), \ (cy_as_storage_query_unit_data_dep *)(data_p), \
...@@ -253,7 +253,7 @@ cy_an_storage_device_control( ...@@ -253,7 +253,7 @@ cy_an_storage_device_control(
cy_an_device_handle handle, cy_an_device_handle handle,
cy_bool card_detect_en, cy_bool card_detect_en,
cy_bool write_prot_en cy_bool write_prot_en
) ; );
#define cy_an_storage_device_control(handle, \ #define cy_an_storage_device_control(handle, \
card_detect_en, write_prot_en) \ card_detect_en, write_prot_en) \
cy_as_storage_device_control_dep((cy_as_device_handle)(handle), \ cy_as_storage_device_control_dep((cy_as_device_handle)(handle), \
...@@ -267,7 +267,7 @@ cy_an_storage_device_control_e_x( ...@@ -267,7 +267,7 @@ cy_an_storage_device_control_e_x(
cy_bool write_prot_en, cy_bool write_prot_en,
cy_an_function_callback cb, cy_an_function_callback cb,
uint32_t client uint32_t client
) ; );
#define cy_an_storage_device_control_e_x(h, det_en, prot_en, cb, 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), \ cy_as_storage_device_control_dep((cy_as_device_handle)(h), (det_en), \
(prot_en), (cy_as_function_callback)(cb), (client)) (prot_en), (cy_as_function_callback)(cb), (client))
...@@ -282,7 +282,7 @@ cy_an_storage_read( ...@@ -282,7 +282,7 @@ cy_an_storage_read(
uint32_t block, uint32_t block,
void *data_p, void *data_p,
uint16_t num_blocks uint16_t num_blocks
) ; );
#define cy_an_storage_read(h, type, device, unit, block, data_p, nblks) \ #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_storage_read_dep((cy_as_device_handle)(h), \
(cy_as_media_type)(type), (device), (unit), \ (cy_as_media_type)(type), (device), (unit), \
...@@ -299,7 +299,7 @@ cy_an_storage_read_async( ...@@ -299,7 +299,7 @@ cy_an_storage_read_async(
void *data_p, void *data_p,
uint16_t num_blocks, uint16_t num_blocks,
cy_an_storage_callback callback cy_an_storage_callback callback
) ; );
#define cy_an_storage_read_async(h, type, device, unit, \ #define cy_an_storage_read_async(h, type, device, unit, \
block, data_p, nblks, cb) \ block, data_p, nblks, cb) \
cy_as_storage_read_async_dep((cy_as_device_handle)(h), \ cy_as_storage_read_async_dep((cy_as_device_handle)(h), \
...@@ -316,7 +316,7 @@ cy_an_storage_write( ...@@ -316,7 +316,7 @@ cy_an_storage_write(
uint32_t block, uint32_t block,
void *data_p, void *data_p,
uint16_t num_blocks uint16_t num_blocks
) ; );
#define cy_an_storage_write(h, type, device, unit, \ #define cy_an_storage_write(h, type, device, unit, \
block, data_p, nblks) \ block, data_p, nblks) \
cy_as_storage_write_dep((cy_as_device_handle)(h), \ cy_as_storage_write_dep((cy_as_device_handle)(h), \
...@@ -334,7 +334,7 @@ cy_an_storage_write_async( ...@@ -334,7 +334,7 @@ cy_an_storage_write_async(
void *data_p, void *data_p,
uint16_t num_blocks, uint16_t num_blocks,
cy_an_storage_callback callback cy_an_storage_callback callback
) ; );
#define cy_an_storage_write_async(h, type, device, unit, \ #define cy_an_storage_write_async(h, type, device, unit, \
block, data_p, nblks, cb) \ block, data_p, nblks, cb) \
cy_as_storage_write_async_dep((cy_as_device_handle)(h), \ cy_as_storage_write_async_dep((cy_as_device_handle)(h), \
...@@ -345,7 +345,7 @@ cy_an_storage_write_async( ...@@ -345,7 +345,7 @@ cy_an_storage_write_async(
EXTERN cy_an_return_status_t EXTERN cy_an_return_status_t
cy_an_storage_cancel_async( cy_an_storage_cancel_async(
cy_an_device_handle handle cy_an_device_handle handle
) ; );
#define cy_an_storage_cancel_async(h) \ #define cy_an_storage_cancel_async(h) \
cy_as_storage_cancel_async((cy_as_device_handle)(h)) cy_as_storage_cancel_async((cy_as_device_handle)(h))
...@@ -358,7 +358,7 @@ cy_an_storage_sd_register_read( ...@@ -358,7 +358,7 @@ cy_an_storage_sd_register_read(
cy_an_sd_card_reg_type reg_type, cy_an_sd_card_reg_type reg_type,
uint8_t read_len, uint8_t read_len,
uint8_t *data_p uint8_t *data_p
) ; );
#define cy_an_storage_sd_register_read(h, type, device, \ #define cy_an_storage_sd_register_read(h, type, device, \
reg_type, len, data_p) \ reg_type, len, data_p) \
cy_as_storage_sd_register_read_dep((cy_as_device_handle)(h), \ cy_as_storage_sd_register_read_dep((cy_as_device_handle)(h), \
...@@ -375,7 +375,7 @@ cy_an_storage_sd_register_read_e_x( ...@@ -375,7 +375,7 @@ cy_an_storage_sd_register_read_e_x(
cy_an_storage_sd_reg_read_data *data_p, cy_an_storage_sd_reg_read_data *data_p,
cy_an_function_callback cb, cy_an_function_callback cb,
uint32_t client uint32_t client
) ; );
#define cy_an_storage_sd_register_read_e_x(h, type, device, \ #define cy_an_storage_sd_register_read_e_x(h, type, device, \
reg_type, data_p, cb, client) \ reg_type, data_p, cb, client) \
cy_as_storage_sd_register_read_dep_EX((cy_as_device_handle)(h), \ cy_as_storage_sd_register_read_dep_EX((cy_as_device_handle)(h), \
...@@ -392,7 +392,7 @@ cy_an_storage_create_p_partition( ...@@ -392,7 +392,7 @@ cy_an_storage_create_p_partition(
uint32_t device, uint32_t device,
uint32_t size, uint32_t size,
cy_an_function_callback cb, cy_an_function_callback cb,
uint32_t client) ; uint32_t client);
#define cy_an_storage_create_p_partition(h, media, dev, \ #define cy_an_storage_create_p_partition(h, media, dev, \
size, cb, client) \ size, cb, client) \
cy_as_storage_create_p_partition_dep((cy_as_device_handle)(h), \ cy_as_storage_create_p_partition_dep((cy_as_device_handle)(h), \
...@@ -406,7 +406,7 @@ cy_an_storage_remove_p_partition( ...@@ -406,7 +406,7 @@ cy_an_storage_remove_p_partition(
cy_an_media_type media, cy_an_media_type media,
uint32_t device, uint32_t device,
cy_an_function_callback cb, cy_an_function_callback cb,
uint32_t client) ; uint32_t client);
#define cy_an_storage_remove_p_partition\ #define cy_an_storage_remove_p_partition\
(h, media, dev, cb, client) \ (h, media, dev, cb, client) \
cy_as_storage_remove_p_partition_dep((cy_as_device_handle)(h), \ cy_as_storage_remove_p_partition_dep((cy_as_device_handle)(h), \
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#define _INCLUDED_CYANTYPES_H_ #define _INCLUDED_CYANTYPES_H_
#include "cyastypes.h" #include "cyastypes.h"
typedef cy_as_end_point_number_t cy_an_end_point_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_return_status_t cy_an_return_status_t;
typedef cy_as_bus_number_t cy_an_bus_number_t ; typedef cy_as_bus_number_t cy_an_bus_number_t;
#endif #endif
...@@ -33,9 +33,9 @@ ...@@ -33,9 +33,9 @@
typedef cy_as_usb_inquiry_data_dep cy_an_usb_inquiry_data; typedef cy_as_usb_inquiry_data_dep cy_an_usb_inquiry_data;
typedef cy_as_usb_unknown_command_data_dep \ typedef cy_as_usb_unknown_command_data_dep \
cy_an_usb_unknown_command_data ; cy_an_usb_unknown_command_data;
typedef cy_as_usb_start_stop_data_dep cy_an_usb_start_stop_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 ; 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_nand_enum cy_as_usb_nand_enum
#define cy_an_usb_sd_enum cy_as_usb_sd_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; ...@@ -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 \ #define cy_an_usb_desc_h_s_configuration \
cy_as_usb_desc_h_s_configuration cy_as_usb_desc_h_s_configuration
#define cy_an_usb_desc_string cy_as_usb_desc_string #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_in cy_as_usb_in
#define cy_an_usb_out cy_as_usb_out #define cy_an_usb_out cy_as_usb_out
#define cy_an_usb_in_out cy_as_usb_in_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_control cy_as_usb_control
#define cy_an_usb_iso cy_as_usb_iso #define cy_an_usb_iso cy_as_usb_iso
#define cy_an_usb_bulk cy_as_usb_bulk #define cy_an_usb_bulk cy_as_usb_bulk
#define cy_an_usb_int cy_as_usb_int #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_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_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_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_unit1 cy_as_usb_m_s_unit1
#define cy_an_usb_m_s_both cy_as_usb_m_s_both #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_suspend cy_as_event_usb_suspend
#define cy_an_event_usb_resume cy_as_event_usb_resume #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 ; ...@@ -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 #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 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_io_callback cy_an_usb_io_callback;
typedef cy_as_usb_function_callback cy_an_usb_function_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; ...@@ -98,7 +98,7 @@ typedef cy_as_usb_function_callback cy_an_usb_function_callback;
extern cy_an_return_status_t extern cy_an_return_status_t
cy_an_usb_start( cy_an_usb_start(
cy_an_device_handle handle cy_an_device_handle handle
) ; );
#define cy_an_usb_start(handle) \ #define cy_an_usb_start(handle) \
cy_as_usb_start((cy_as_device_handle)(handle), 0, 0) cy_as_usb_start((cy_as_device_handle)(handle), 0, 0)
...@@ -108,7 +108,7 @@ cy_an_usb_start_e_x( ...@@ -108,7 +108,7 @@ cy_an_usb_start_e_x(
cy_an_device_handle handle, cy_an_device_handle handle,
cy_an_function_callback cb, cy_an_function_callback cb,
uint32_t client uint32_t client
) ; );
#define cy_an_usb_start_e_x(h, cb, client) \ #define cy_an_usb_start_e_x(h, cb, client) \
cy_as_usb_start((cy_as_device_handle)(h), \ cy_as_usb_start((cy_as_device_handle)(h), \
(cy_as_function_callback)(cb), (client)) (cy_as_function_callback)(cb), (client))
...@@ -117,7 +117,7 @@ cy_an_usb_start_e_x( ...@@ -117,7 +117,7 @@ cy_an_usb_start_e_x(
extern cy_an_return_status_t extern cy_an_return_status_t
cy_an_usb_stop( cy_an_usb_stop(
cy_an_device_handle handle cy_an_device_handle handle
) ; );
#define cy_an_usb_stop(handle) \ #define cy_an_usb_stop(handle) \
cy_as_usb_stop((cy_as_device_handle)(handle), 0, 0) cy_as_usb_stop((cy_as_device_handle)(handle), 0, 0)
...@@ -127,7 +127,7 @@ cy_an_usb_stop_e_x( ...@@ -127,7 +127,7 @@ cy_an_usb_stop_e_x(
cy_an_device_handle handle, cy_an_device_handle handle,
cy_an_function_callback cb, cy_an_function_callback cb,
uint32_t client uint32_t client
) ; );
#define cy_an_usb_stop_e_x(h, cb, client) \ #define cy_an_usb_stop_e_x(h, cb, client) \
cy_as_usb_stop((cy_as_device_handle)(h), \ cy_as_usb_stop((cy_as_device_handle)(h), \
(cy_as_function_callback)(cb), (client)) (cy_as_function_callback)(cb), (client))
...@@ -137,7 +137,7 @@ EXTERN cy_an_return_status_t ...@@ -137,7 +137,7 @@ EXTERN cy_an_return_status_t
cy_an_usb_register_callback( cy_an_usb_register_callback(
cy_an_device_handle handle, cy_an_device_handle handle,
cy_an_usb_event_callback callback cy_an_usb_event_callback callback
) ; );
#define cy_an_usb_register_callback(h, cb) \ #define cy_an_usb_register_callback(h, cb) \
cy_as_usb_register_callback_dep((cy_as_device_handle)(h), \ cy_as_usb_register_callback_dep((cy_as_device_handle)(h), \
(cy_as_usb_event_callback_dep)(cb)) (cy_as_usb_event_callback_dep)(cb))
...@@ -146,7 +146,7 @@ cy_an_usb_register_callback( ...@@ -146,7 +146,7 @@ cy_an_usb_register_callback(
EXTERN cy_an_return_status_t EXTERN cy_an_return_status_t
cy_an_usb_connect( cy_an_usb_connect(
cy_an_device_handle handle cy_an_device_handle handle
) ; );
#define cy_an_usb_connect(handle) \ #define cy_an_usb_connect(handle) \
cy_as_usb_connect((cy_as_device_handle)(handle), 0, 0) cy_as_usb_connect((cy_as_device_handle)(handle), 0, 0)
...@@ -156,7 +156,7 @@ cy_an_usb_connect_e_x( ...@@ -156,7 +156,7 @@ cy_an_usb_connect_e_x(
cy_an_device_handle handle, cy_an_device_handle handle,
cy_an_function_callback cb, cy_an_function_callback cb,
uint32_t client uint32_t client
) ; );
#define cy_an_usb_connect_e_x(h, cb, client) \ #define cy_an_usb_connect_e_x(h, cb, client) \
cy_as_usb_connect((cy_as_device_handle)(h), \ cy_as_usb_connect((cy_as_device_handle)(h), \
(cy_as_function_callback)(cb), (client)) (cy_as_function_callback)(cb), (client))
...@@ -165,7 +165,7 @@ cy_an_usb_connect_e_x( ...@@ -165,7 +165,7 @@ cy_an_usb_connect_e_x(
EXTERN cy_an_return_status_t EXTERN cy_an_return_status_t
cy_an_usb_disconnect( cy_an_usb_disconnect(
cy_an_device_handle handle cy_an_device_handle handle
) ; );
#define cy_an_usb_disconnect(handle) \ #define cy_an_usb_disconnect(handle) \
cy_as_usb_disconnect((cy_as_device_handle)(handle), 0, 0) cy_as_usb_disconnect((cy_as_device_handle)(handle), 0, 0)
...@@ -175,7 +175,7 @@ cy_an_usb_disconnect_e_x( ...@@ -175,7 +175,7 @@ cy_an_usb_disconnect_e_x(
cy_an_device_handle handle, cy_an_device_handle handle,
cy_an_function_callback cb, cy_an_function_callback cb,
uint32_t client uint32_t client
) ; );
#define cy_an_usb_disconnect_e_x(h, cb, client) \ #define cy_an_usb_disconnect_e_x(h, cb, client) \
cy_as_usb_disconnect((cy_as_device_handle)(h), \ cy_as_usb_disconnect((cy_as_device_handle)(h), \
(cy_as_function_callback)(cb), (client)) (cy_as_function_callback)(cb), (client))
...@@ -185,7 +185,7 @@ EXTERN cy_an_return_status_t ...@@ -185,7 +185,7 @@ EXTERN cy_an_return_status_t
cy_an_usb_set_enum_config( cy_an_usb_set_enum_config(
cy_an_device_handle handle, cy_an_device_handle handle,
cy_an_usb_enum_control *config_p cy_an_usb_enum_control *config_p
) ; );
#define cy_an_usb_set_enum_config(handle, 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_set_enum_config_dep((cy_as_device_handle)(handle), \
(cy_as_usb_enum_control_dep *)(config_p), 0, 0) (cy_as_usb_enum_control_dep *)(config_p), 0, 0)
...@@ -197,7 +197,7 @@ cy_an_usb_set_enum_config_e_x( ...@@ -197,7 +197,7 @@ cy_an_usb_set_enum_config_e_x(
cy_an_usb_enum_control *config_p, cy_an_usb_enum_control *config_p,
cy_an_function_callback cb, cy_an_function_callback cb,
uint32_t client uint32_t client
) ; );
#define cy_an_usb_set_enum_config_e_x(h, config_p, cb, 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_set_enum_config_dep((cy_as_device_handle)(h), \
(cy_as_usb_enum_control_dep *)(config_p), \ (cy_as_usb_enum_control_dep *)(config_p), \
...@@ -208,7 +208,7 @@ EXTERN cy_an_return_status_t ...@@ -208,7 +208,7 @@ EXTERN cy_an_return_status_t
cy_an_usb_get_enum_config( cy_an_usb_get_enum_config(
cy_an_device_handle handle, cy_an_device_handle handle,
cy_an_usb_enum_control *config_p cy_an_usb_enum_control *config_p
) ; );
#define cy_an_usb_get_enum_config(handle, 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_get_enum_config_dep((cy_as_device_handle)(handle), \
(cy_as_usb_enum_control_dep *)(config_p), 0, 0) (cy_as_usb_enum_control_dep *)(config_p), 0, 0)
...@@ -220,7 +220,7 @@ cy_an_usb_get_enum_config_e_x( ...@@ -220,7 +220,7 @@ cy_an_usb_get_enum_config_e_x(
cy_an_usb_enum_control *config_p, cy_an_usb_enum_control *config_p,
cy_an_function_callback cb, cy_an_function_callback cb,
uint32_t client uint32_t client
) ; );
#define cy_an_usb_get_enum_config_e_x(h, config_p, cb, 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_get_enum_config_dep((cy_as_device_handle)(h), \
(cy_as_usb_enum_control_dep *)(config_p), \ (cy_as_usb_enum_control_dep *)(config_p), \
...@@ -234,7 +234,7 @@ cy_an_usb_set_descriptor( ...@@ -234,7 +234,7 @@ cy_an_usb_set_descriptor(
uint8_t index, uint8_t index,
void *desc_p, void *desc_p,
uint16_t length uint16_t length
) ; );
#define cy_an_usb_set_descriptor(handle, type, index, desc_p, 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_set_descriptor((cy_as_device_handle)(handle), \
(cy_as_usb_desc_type)(type), (index), (desc_p), (length), 0, 0) (cy_as_usb_desc_type)(type), (index), (desc_p), (length), 0, 0)
...@@ -249,7 +249,7 @@ cy_an_usb_set_descriptor_e_x( ...@@ -249,7 +249,7 @@ cy_an_usb_set_descriptor_e_x(
uint16_t length, uint16_t length,
cy_an_function_callback cb, cy_an_function_callback cb,
uint32_t client uint32_t client
) ; );
#define cy_an_usb_set_descriptor_e_x\ #define cy_an_usb_set_descriptor_e_x\
(h, type, index, desc_p, length, cb, client) \ (h, type, index, desc_p, length, cb, client) \
cy_as_usb_set_descriptor((cy_as_device_handle)(h), \ cy_as_usb_set_descriptor((cy_as_device_handle)(h), \
...@@ -262,7 +262,7 @@ cy_an_usb_clear_descriptors( ...@@ -262,7 +262,7 @@ cy_an_usb_clear_descriptors(
cy_an_device_handle handle, cy_an_device_handle handle,
cy_an_function_callback cb, cy_an_function_callback cb,
uint32_t client uint32_t client
) ; );
#define cy_an_usb_clear_descriptors(h, cb, client) \ #define cy_an_usb_clear_descriptors(h, cb, client) \
cy_as_usb_clear_descriptors((cy_as_device_handle)(h), \ cy_as_usb_clear_descriptors((cy_as_device_handle)(h), \
(cy_as_function_callback)(cb), (client)) (cy_as_function_callback)(cb), (client))
...@@ -275,12 +275,12 @@ cy_an_usb_get_descriptor( ...@@ -275,12 +275,12 @@ cy_an_usb_get_descriptor(
uint8_t index, uint8_t index,
void *desc_p, void *desc_p,
uint32_t *length_p uint32_t *length_p
) ; );
#define cy_an_usb_get_descriptor(h, type, index, desc_p, 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_get_descriptor_dep((cy_as_device_handle)(h), \
(cy_as_usb_desc_type)(type), (index), (desc_p), (length_p)) (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 */ /* Async version of get descriptor */
extern cy_an_return_status_t extern cy_an_return_status_t
...@@ -291,7 +291,7 @@ cy_an_usb_get_descriptor_e_x( ...@@ -291,7 +291,7 @@ cy_an_usb_get_descriptor_e_x(
cy_an_get_descriptor_data *data, cy_an_get_descriptor_data *data,
cy_an_function_callback cb, cy_an_function_callback cb,
uint32_t client uint32_t client
) ; );
#define cy_an_usb_get_descriptor_e_x\ #define cy_an_usb_get_descriptor_e_x\
(h, type, index, data, cb, client) \ (h, type, index, data, cb, client) \
cy_as_usb_get_descriptor((cy_as_device_handle)(h), \ cy_as_usb_get_descriptor((cy_as_device_handle)(h), \
...@@ -303,7 +303,7 @@ EXTERN cy_an_return_status_t ...@@ -303,7 +303,7 @@ EXTERN cy_an_return_status_t
cy_an_usb_set_physical_configuration( cy_an_usb_set_physical_configuration(
cy_an_device_handle handle, cy_an_device_handle handle,
uint8_t config uint8_t config
) ; );
#define cy_an_usb_set_physical_configuration(h, config) \ #define cy_an_usb_set_physical_configuration(h, config) \
cy_as_usb_set_physical_configuration\ cy_as_usb_set_physical_configuration\
((cy_as_device_handle)(h), (config)) ((cy_as_device_handle)(h), (config))
...@@ -313,7 +313,7 @@ cy_an_usb_set_end_point_config( ...@@ -313,7 +313,7 @@ cy_an_usb_set_end_point_config(
cy_an_device_handle handle, cy_an_device_handle handle,
cy_an_end_point_number_t ep, cy_an_end_point_number_t ep,
cy_an_usb_end_point_config *config_p cy_an_usb_end_point_config *config_p
) ; );
#define cy_an_usb_set_end_point_config(h, ep, 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_usb_set_end_point_config((cy_as_device_handle)(h), \
(cy_as_end_point_number_t)(ep), \ (cy_as_end_point_number_t)(ep), \
...@@ -324,7 +324,7 @@ cy_an_usb_get_end_point_config( ...@@ -324,7 +324,7 @@ cy_an_usb_get_end_point_config(
cy_an_device_handle handle, cy_an_device_handle handle,
cy_an_end_point_number_t ep, cy_an_end_point_number_t ep,
cy_an_usb_end_point_config *config_p cy_an_usb_end_point_config *config_p
) ; );
#define cy_an_usb_get_end_point_config(h, ep, 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_usb_get_end_point_config((cy_as_device_handle)(h), \
(cy_as_end_point_number_t)(ep), \ (cy_as_end_point_number_t)(ep), \
...@@ -334,7 +334,7 @@ cy_an_usb_get_end_point_config( ...@@ -334,7 +334,7 @@ cy_an_usb_get_end_point_config(
EXTERN cy_an_return_status_t EXTERN cy_an_return_status_t
cy_an_usb_commit_config( cy_an_usb_commit_config(
cy_an_device_handle handle cy_an_device_handle handle
) ; );
#define cy_an_usb_commit_config(handle) \ #define cy_an_usb_commit_config(handle) \
cy_as_usb_commit_config((cy_as_device_handle)(handle), 0, 0) cy_as_usb_commit_config((cy_as_device_handle)(handle), 0, 0)
...@@ -344,7 +344,7 @@ cy_an_usb_commit_config_e_x( ...@@ -344,7 +344,7 @@ cy_an_usb_commit_config_e_x(
cy_an_device_handle handle, cy_an_device_handle handle,
cy_an_function_callback cb, cy_an_function_callback cb,
uint32_t client uint32_t client
) ; );
#define cy_an_usb_commit_config_e_x(h, cb, client) \ #define cy_an_usb_commit_config_e_x(h, cb, client) \
cy_as_usb_commit_config((cy_as_device_handle)(h), \ cy_as_usb_commit_config((cy_as_device_handle)(h), \
(cy_as_function_callback)(cb), (client)) (cy_as_function_callback)(cb), (client))
...@@ -357,7 +357,7 @@ cy_an_usb_read_data( ...@@ -357,7 +357,7 @@ cy_an_usb_read_data(
uint32_t dsize, uint32_t dsize,
uint32_t *dataread, uint32_t *dataread,
void *data void *data
) ; );
#define cy_an_usb_read_data(h, ep, pkt, dsize, dataread, data_p) \ #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_usb_read_data((cy_as_device_handle)(h), \
(cy_as_end_point_number_t)(ep), (pkt), (dsize), \ (cy_as_end_point_number_t)(ep), (pkt), (dsize), \
...@@ -371,7 +371,7 @@ cy_an_usb_read_data_async( ...@@ -371,7 +371,7 @@ cy_an_usb_read_data_async(
uint32_t dsize, uint32_t dsize,
void *data, void *data,
cy_an_usb_io_callback callback cy_an_usb_io_callback callback
) ; );
#define cy_an_usb_read_data_async(h, ep, pkt, dsize, data_p, cb) \ #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_usb_read_data_async((cy_as_device_handle)(h), \
(cy_as_end_point_number_t)(ep), (pkt), (dsize), (data_p), \ (cy_as_end_point_number_t)(ep), (pkt), (dsize), (data_p), \
...@@ -383,7 +383,7 @@ cy_an_usb_write_data( ...@@ -383,7 +383,7 @@ cy_an_usb_write_data(
cy_an_end_point_number_t ep, cy_an_end_point_number_t ep,
uint32_t dsize, uint32_t dsize,
void *data void *data
) ; );
#define cy_an_usb_write_data(h, ep, dsize, data_p) \ #define cy_an_usb_write_data(h, ep, dsize, data_p) \
cy_as_usb_write_data((cy_as_device_handle)(h), \ cy_as_usb_write_data((cy_as_device_handle)(h), \
(cy_as_end_point_number_t)(ep), (dsize), (data_p)) (cy_as_end_point_number_t)(ep), (dsize), (data_p))
...@@ -396,7 +396,7 @@ cy_an_usb_write_data_async( ...@@ -396,7 +396,7 @@ cy_an_usb_write_data_async(
void *data, void *data,
cy_bool spacket, cy_bool spacket,
cy_an_usb_io_callback callback cy_an_usb_io_callback callback
) ; );
#define cy_an_usb_write_data_async(h, ep, dsize, data_p, spacket, cb) \ #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_usb_write_data_async((cy_as_device_handle)(h), \
(cy_as_end_point_number_t)(ep), (dsize), (data_p), (spacket), \ (cy_as_end_point_number_t)(ep), (dsize), (data_p), (spacket), \
...@@ -406,7 +406,7 @@ EXTERN cy_an_return_status_t ...@@ -406,7 +406,7 @@ EXTERN cy_an_return_status_t
cy_an_usb_cancel_async( cy_an_usb_cancel_async(
cy_an_device_handle handle, cy_an_device_handle handle,
cy_an_end_point_number_t ep cy_an_end_point_number_t ep
) ; );
#define cy_an_usb_cancel_async(h, ep) \ #define cy_an_usb_cancel_async(h, ep) \
cy_as_usb_cancel_async((cy_as_device_handle)(h), \ cy_as_usb_cancel_async((cy_as_device_handle)(h), \
(cy_as_end_point_number_t)(ep)) (cy_as_end_point_number_t)(ep))
...@@ -418,7 +418,7 @@ cy_an_usb_set_stall( ...@@ -418,7 +418,7 @@ cy_an_usb_set_stall(
cy_an_end_point_number_t ep, cy_an_end_point_number_t ep,
cy_an_usb_function_callback cb, cy_an_usb_function_callback cb,
uint32_t client uint32_t client
) ; );
#define cy_an_usb_set_stall(h, ep, cb, client) \ #define cy_an_usb_set_stall(h, ep, cb, client) \
cy_as_usb_set_stall_dep((cy_as_device_handle)(h), \ cy_as_usb_set_stall_dep((cy_as_device_handle)(h), \
(cy_as_end_point_number_t)(ep), \ (cy_as_end_point_number_t)(ep), \
...@@ -431,7 +431,7 @@ cy_an_usb_set_stall_e_x( ...@@ -431,7 +431,7 @@ cy_an_usb_set_stall_e_x(
cy_an_end_point_number_t ep, cy_an_end_point_number_t ep,
cy_an_function_callback cb, cy_an_function_callback cb,
uint32_t client uint32_t client
) ; );
#define cy_an_usb_set_stall_e_x(h, ep, cb, 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_usb_set_stall((cy_as_device_handle)(h), \
(cy_as_end_point_number_t)(ep), \ (cy_as_end_point_number_t)(ep), \
...@@ -444,7 +444,7 @@ cy_an_usb_clear_stall( ...@@ -444,7 +444,7 @@ cy_an_usb_clear_stall(
cy_an_end_point_number_t ep, cy_an_end_point_number_t ep,
cy_an_usb_function_callback cb, cy_an_usb_function_callback cb,
uint32_t client uint32_t client
) ; );
#define cy_an_usb_clear_stall(h, ep, cb, client) \ #define cy_an_usb_clear_stall(h, ep, cb, client) \
cy_as_usb_clear_stall_dep((cy_as_device_handle)(h), \ cy_as_usb_clear_stall_dep((cy_as_device_handle)(h), \
(cy_as_end_point_number_t)(ep), \ (cy_as_end_point_number_t)(ep), \
...@@ -457,7 +457,7 @@ cy_an_usb_clear_stall_e_x( ...@@ -457,7 +457,7 @@ cy_an_usb_clear_stall_e_x(
cy_an_end_point_number_t ep, cy_an_end_point_number_t ep,
cy_an_function_callback cb, cy_an_function_callback cb,
uint32_t client uint32_t client
) ; );
#define cy_an_usb_clear_stall_e_x(h, ep, cb, 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_usb_clear_stall((cy_as_device_handle)(h), \
(cy_as_end_point_number_t)(ep), \ (cy_as_end_point_number_t)(ep), \
...@@ -469,7 +469,7 @@ cy_an_usb_get_stall( ...@@ -469,7 +469,7 @@ cy_an_usb_get_stall(
cy_an_device_handle handle, cy_an_device_handle handle,
cy_an_end_point_number_t ep, cy_an_end_point_number_t ep,
cy_bool *stall_p cy_bool *stall_p
) ; );
#define cy_an_usb_get_stall(handle, ep, stall_p) \ #define cy_an_usb_get_stall(handle, ep, stall_p) \
cy_as_usb_get_stall((cy_as_device_handle)(handle), \ cy_as_usb_get_stall((cy_as_device_handle)(handle), \
(cy_as_end_point_number_t)(ep), (stall_p), 0, 0) (cy_as_end_point_number_t)(ep), (stall_p), 0, 0)
...@@ -482,7 +482,7 @@ cy_an_usb_get_stall_e_x( ...@@ -482,7 +482,7 @@ cy_an_usb_get_stall_e_x(
cy_bool *stall_p, cy_bool *stall_p,
cy_an_function_callback cb, cy_an_function_callback cb,
uint32_t client uint32_t client
) ; );
#define cy_an_usb_get_stall_e_x(h, ep, stall_p, cb, 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_usb_get_stall((cy_as_device_handle)(h), \
(cy_as_end_point_number_t)(ep), (stall_p), \ (cy_as_end_point_number_t)(ep), (stall_p), \
...@@ -495,7 +495,7 @@ cy_an_usb_set_nak( ...@@ -495,7 +495,7 @@ cy_an_usb_set_nak(
cy_an_end_point_number_t ep, cy_an_end_point_number_t ep,
cy_an_usb_function_callback cb, cy_an_usb_function_callback cb,
uint32_t client uint32_t client
) ; );
#define cy_an_usb_set_nak(h, ep, cb, client) \ #define cy_an_usb_set_nak(h, ep, cb, client) \
cy_as_usb_set_nak_dep((cy_as_device_handle)(h), \ cy_as_usb_set_nak_dep((cy_as_device_handle)(h), \
...@@ -509,7 +509,7 @@ cy_an_usb_set_nak_e_x( ...@@ -509,7 +509,7 @@ cy_an_usb_set_nak_e_x(
cy_an_end_point_number_t ep, cy_an_end_point_number_t ep,
cy_an_function_callback cb, cy_an_function_callback cb,
uint32_t client uint32_t client
) ; );
#define cy_an_usb_set_nak_e_x(h, ep, cb, 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_usb_set_nak((cy_as_device_handle)(h), \
(cy_as_end_point_number_t)(ep), \ (cy_as_end_point_number_t)(ep), \
...@@ -522,7 +522,7 @@ cy_an_usb_clear_nak( ...@@ -522,7 +522,7 @@ cy_an_usb_clear_nak(
cy_an_end_point_number_t ep, cy_an_end_point_number_t ep,
cy_an_usb_function_callback cb, cy_an_usb_function_callback cb,
uint32_t client uint32_t client
) ; );
#define cy_an_usb_clear_nak(h, ep, cb, client) \ #define cy_an_usb_clear_nak(h, ep, cb, client) \
cy_as_usb_clear_nak_dep((cy_as_device_handle)(h), \ cy_as_usb_clear_nak_dep((cy_as_device_handle)(h), \
(cy_as_end_point_number_t)(ep), \ (cy_as_end_point_number_t)(ep), \
...@@ -535,7 +535,7 @@ cy_an_usb_clear_nak_e_x( ...@@ -535,7 +535,7 @@ cy_an_usb_clear_nak_e_x(
cy_an_end_point_number_t ep, cy_an_end_point_number_t ep,
cy_an_function_callback cb, cy_an_function_callback cb,
uint32_t client uint32_t client
) ; );
#define cy_an_usb_clear_nak_e_x(h, ep, cb, 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_usb_clear_nak((cy_as_device_handle)(h), \
(cy_as_end_point_number_t)(ep), \ (cy_as_end_point_number_t)(ep), \
...@@ -547,7 +547,7 @@ cy_an_usb_get_nak( ...@@ -547,7 +547,7 @@ cy_an_usb_get_nak(
cy_an_device_handle handle, cy_an_device_handle handle,
cy_an_end_point_number_t ep, cy_an_end_point_number_t ep,
cy_bool *nak_p cy_bool *nak_p
) ; );
#define cy_an_usb_get_nak(handle, ep, nak_p) \ #define cy_an_usb_get_nak(handle, ep, nak_p) \
cy_as_usb_get_nak((cy_as_device_handle)(handle), \ cy_as_usb_get_nak((cy_as_device_handle)(handle), \
(cy_as_end_point_number_t)(ep), (nak_p), 0, 0) (cy_as_end_point_number_t)(ep), (nak_p), 0, 0)
...@@ -560,7 +560,7 @@ cy_an_usb_get_nak_e_x( ...@@ -560,7 +560,7 @@ cy_an_usb_get_nak_e_x(
cy_bool *nak_p, cy_bool *nak_p,
cy_an_function_callback cb, cy_an_function_callback cb,
uint32_t client uint32_t client
) ; );
#define cy_an_usb_get_nak_e_x(h, ep, nak_p, cb, 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_usb_get_nak((cy_as_device_handle)(h), \
(cy_as_end_point_number_t)(ep), (nak_p), \ (cy_as_end_point_number_t)(ep), (nak_p), \
...@@ -570,7 +570,7 @@ cy_an_usb_get_nak_e_x( ...@@ -570,7 +570,7 @@ cy_an_usb_get_nak_e_x(
EXTERN cy_an_return_status_t EXTERN cy_an_return_status_t
cy_an_usb_signal_remote_wakeup( cy_an_usb_signal_remote_wakeup(
cy_an_device_handle handle cy_an_device_handle handle
) ; );
#define cy_an_usb_signal_remote_wakeup(handle) \ #define cy_an_usb_signal_remote_wakeup(handle) \
cy_as_usb_signal_remote_wakeup((cy_as_device_handle)(handle), 0, 0) 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( ...@@ -580,7 +580,7 @@ cy_an_usb_signal_remote_wakeup_e_x(
cy_an_device_handle handle, cy_an_device_handle handle,
cy_an_function_callback cb, cy_an_function_callback cb,
uint32_t client uint32_t client
) ; );
#define cy_an_usb_signal_remote_wakeup_e_x(h, cb, 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_usb_signal_remote_wakeup((cy_as_device_handle)(h), \
(cy_as_function_callback)(cb), (client)) (cy_as_function_callback)(cb), (client))
...@@ -593,7 +593,7 @@ cy_an_usb_set_m_s_report_threshold( ...@@ -593,7 +593,7 @@ cy_an_usb_set_m_s_report_threshold(
uint32_t rd_sectors, uint32_t rd_sectors,
cy_an_function_callback cb, cy_an_function_callback cb,
uint32_t client uint32_t client
) ; );
#define cy_an_usb_set_m_s_report_threshold\ #define cy_an_usb_set_m_s_report_threshold\
(h, wr_cnt, rd_cnt, cb, client) \ (h, wr_cnt, rd_cnt, cb, client) \
cy_as_usb_set_m_s_report_threshold((cy_as_device_handle)(h), \ cy_as_usb_set_m_s_report_threshold((cy_as_device_handle)(h), \
...@@ -608,7 +608,7 @@ cy_an_usb_select_m_s_partitions( ...@@ -608,7 +608,7 @@ cy_an_usb_select_m_s_partitions(
cy_an_usb_m_s_type_t type, cy_an_usb_m_s_type_t type,
cy_an_function_callback cb, cy_an_function_callback cb,
uint32_t client uint32_t client
) ; );
#define cy_an_usb_select_m_s_partitions(h, media, dev, type, cb, 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_usb_select_m_s_partitions_dep((cy_as_device_handle)(h), \
(cy_as_media_type)(media), (dev), \ (cy_as_media_type)(media), (dev), \
......
...@@ -147,7 +147,7 @@ ...@@ -147,7 +147,7 @@
* West Bridge Data Structures * West Bridge Data Structures
****************************************/ ****************************************/
typedef struct cy_as_device cy_as_device ; typedef struct cy_as_device cy_as_device;
/* Summary /* Summary
This type defines a callback function that will be called This type defines a callback function that will be called
...@@ -173,7 +173,7 @@ typedef void (*cy_as_dma_callback)( ...@@ -173,7 +173,7 @@ typedef void (*cy_as_dma_callback)(
uint32_t size, uint32_t size,
/* The error code for this DMA xfer */ /* The error code for this DMA xfer */
cy_as_return_status_t error cy_as_return_status_t error
) ; );
/* Summary /* Summary
This structure defines a DMA request that is queued This structure defines a DMA request that is queued
...@@ -184,20 +184,20 @@ typedef void (*cy_as_dma_callback)( ...@@ -184,20 +184,20 @@ typedef void (*cy_as_dma_callback)(
*/ */
typedef struct cy_as_dma_queue_entry { typedef struct cy_as_dma_queue_entry {
/* Pointer to memory buffer for this request */ /* Pointer to memory buffer for this request */
void *buf_p ; void *buf_p;
/* Size of the memory buffer for DMA operation */ /* Size of the memory buffer for DMA operation */
uint32_t size ; uint32_t size;
/* Offset into memory buffer for next DMA operation */ /* Offset into memory buffer for next DMA operation */
uint32_t offset ; uint32_t offset;
/* If TRUE and IN request */ /* If TRUE and IN request */
cy_bool packet ; cy_bool packet;
/* If TRUE, this is a read request */ /* If TRUE, this is a read request */
cy_bool readreq ; cy_bool readreq;
/* Callback function for when DMA is complete */ /* Callback function for when DMA is complete */
cy_as_dma_callback cb ; cy_as_dma_callback cb;
/* Pointer to next entry in queue */ /* Pointer to next entry in queue */
struct cy_as_dma_queue_entry *next_p ; struct cy_as_dma_queue_entry *next_p;
} cy_as_dma_queue_entry ; } cy_as_dma_queue_entry;
/* Summary /* Summary
This structure defines the endpoint data for a given This structure defines the endpoint data for a given
...@@ -208,21 +208,21 @@ typedef struct cy_as_dma_queue_entry { ...@@ -208,21 +208,21 @@ typedef struct cy_as_dma_queue_entry {
*/ */
typedef struct cy_as_dma_end_point { typedef struct cy_as_dma_end_point {
/* The endpoint number */ /* The endpoint number */
cy_as_end_point_number_t ep ; cy_as_end_point_number_t ep;
/* The state of this endpoint */ /* The state of this endpoint */
uint8_t state ; uint8_t state;
/* The maximum amount of data accepted in a packet by the hw */ /* 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 */ /* The maximum amount of data accepted by the HAL layer */
uint32_t maxhaldata ; uint32_t maxhaldata;
/* The queue for DMA operations */ /* 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 */ /* 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 /* This sleep channel is used to wait while the DMA queue
* drains for a given endpoint */ * drains for a given endpoint */
cy_as_hal_sleep_channel channel ; cy_as_hal_sleep_channel channel;
} cy_as_dma_end_point ; } cy_as_dma_end_point;
#define cy_as_end_point_number_is_usb(n) \ #define cy_as_end_point_number_is_usb(n) \
((n) != 2 && (n) != 4 && (n) != 6 && (n) != 8) ((n) != 2 && (n) != 4 && (n) != 6 && (n) != 8)
...@@ -274,16 +274,16 @@ typedef struct cy_as_dma_end_point { ...@@ -274,16 +274,16 @@ typedef struct cy_as_dma_end_point {
typedef struct cy_as_ll_request_response { typedef struct cy_as_ll_request_response {
/* The mbox[0] contents - see low level comm section of API doc */ /* 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 */ /* The amount of data stored in this request/response in bytes */
uint16_t stored ; uint16_t stored;
/* Length of this request in words */ /* Length of this request in words */
uint16_t length ; uint16_t length;
/* Additional status information about the request */ /* Additional status information about the request */
uint16_t flags ; uint16_t flags;
/* Note: This is over indexed and contains the request/response data */ /* Note: This is over indexed and contains the request/response data */
uint16_t data[1] ; uint16_t data[1];
} cy_as_ll_request_response ; } cy_as_ll_request_response;
/* /*
* The callback function for responses * The callback function for responses
...@@ -299,22 +299,22 @@ typedef void (*cy_as_response_callback)( ...@@ -299,22 +299,22 @@ typedef void (*cy_as_response_callback)(
cy_as_ll_request_response *resp, cy_as_ll_request_response *resp,
/* The status of the request */ /* The status of the request */
cy_as_return_status_t status cy_as_return_status_t status
) ; );
typedef struct cy_as_ll_request_list_node { typedef struct cy_as_ll_request_list_node {
/* The request to send */ /* The request to send */
cy_as_ll_request_response *rqt ; cy_as_ll_request_response *rqt;
/* The associated response for the request */ /* The associated response for the request */
cy_as_ll_request_response *resp ; cy_as_ll_request_response *resp;
/* Length of the response */ /* Length of the response */
uint16_t length ; uint16_t length;
/* The callback to call when done */ /* The callback to call when done */
cy_as_response_callback callback ; cy_as_response_callback callback;
/* The state of the request */ /* The state of the request */
uint8_t state ; uint8_t state;
/* The next request in the list */ /* The next request in the list */
struct cy_as_ll_request_list_node *next ; struct cy_as_ll_request_list_node *next;
} cy_as_ll_request_list_node ; } cy_as_ll_request_list_node;
#define cy_as_request_get_node_state(node_p) \ #define cy_as_request_get_node_state(node_p) \
((node_p)->state & CY_AS_REQUEST_LIST_STATE_MASK) ((node_p)->state & CY_AS_REQUEST_LIST_STATE_MASK)
...@@ -336,88 +336,88 @@ typedef enum cy_as_c_b_node_type { ...@@ -336,88 +336,88 @@ typedef enum cy_as_c_b_node_type {
CYAS_USB_IO_CB, CYAS_USB_IO_CB,
CYAS_STORAGE_IO_CB, CYAS_STORAGE_IO_CB,
CYAS_FUNC_CB CYAS_FUNC_CB
} cy_as_c_b_node_type ; } cy_as_c_b_node_type;
typedef struct cy_as_func_c_b_node { typedef struct cy_as_func_c_b_node {
cy_as_c_b_node_type node_type ; cy_as_c_b_node_type node_type;
cy_as_function_callback cb_p ; cy_as_function_callback cb_p;
uint32_t client_data ; uint32_t client_data;
cy_as_funct_c_b_type data_type ; cy_as_funct_c_b_type data_type;
void *data ; void *data;
struct cy_as_func_c_b_node *next_p ; struct cy_as_func_c_b_node *next_p;
} cy_as_func_c_b_node; } cy_as_func_c_b_node;
extern 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 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* extern cy_as_func_c_b_node*
cy_as_create_func_c_b_node(cy_as_function_callback cb, cy_as_create_func_c_b_node(cy_as_function_callback cb,
uint32_t client) ; uint32_t client);
extern void 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 { typedef struct cy_as_mtp_func_c_b_node {
cy_as_c_b_node_type type ; cy_as_c_b_node_type type;
cy_as_mtp_function_callback cb_p ; cy_as_mtp_function_callback cb_p;
uint32_t client_data; 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; } cy_as_mtp_func_c_b_node;
extern 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, cy_as_create_mtp_func_c_b_node(cy_as_mtp_function_callback cb,
uint32_t client) ; uint32_t client);
extern void 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 { typedef struct cy_as_usb_func_c_b_node {
cy_as_c_b_node_type type ; cy_as_c_b_node_type type;
cy_as_usb_function_callback cb_p ; cy_as_usb_function_callback cb_p;
uint32_t client_data; 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; } cy_as_usb_func_c_b_node;
extern 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, cy_as_create_usb_func_c_b_node(cy_as_usb_function_callback cb,
uint32_t client) ; uint32_t client);
extern void 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 { typedef struct cy_as_usb_io_c_b_node {
cy_as_c_b_node_type type ; cy_as_c_b_node_type type;
cy_as_usb_io_callback cb_p ; cy_as_usb_io_callback cb_p;
struct cy_as_usb_io_c_b_node *next_p ; struct cy_as_usb_io_c_b_node *next_p;
} cy_as_usb_io_c_b_node; } cy_as_usb_io_c_b_node;
extern 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 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 { typedef struct cy_as_storage_io_c_b_node {
cy_as_c_b_node_type type ; cy_as_c_b_node_type type;
cy_as_storage_callback cb_p ; cy_as_storage_callback cb_p;
/* The media for the currently outstanding async storage request */ /* 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 /* The device index for the currently outstanding async storage
* request */ * request */
uint32_t device_index ; uint32_t device_index;
/* The unit index for the currently outstanding async storage /* The unit index for the currently outstanding async storage
* request */ * request */
uint32_t unit ; uint32_t unit;
/* The block address for the currently outstanding async storage /* The block address for the currently outstanding async storage
* request */ * request */
uint32_t block_addr ; uint32_t block_addr;
/* The operation for the currently outstanding async storage /* The operation for the currently outstanding async storage
* request */ * request */
cy_as_oper_type oper ; cy_as_oper_type oper;
cy_as_ll_request_response *req_p ; cy_as_ll_request_response *req_p;
cy_as_ll_request_response *reply_p ; cy_as_ll_request_response *reply_p;
struct cy_as_storage_io_c_b_node *next_p ; struct cy_as_storage_io_c_b_node *next_p;
} cy_as_storage_io_c_b_node; } cy_as_storage_io_c_b_node;
extern 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, ...@@ -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, cy_as_media_type media, uint32_t device_index,
uint32_t unit, uint32_t block_addr, cy_as_oper_type oper, uint32_t unit, uint32_t block_addr, cy_as_oper_type oper,
cy_as_ll_request_response *req_p, cy_as_ll_request_response *req_p,
cy_as_ll_request_response *reply_p) ; cy_as_ll_request_response *reply_p);
extern void 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 { typedef struct cy_as_c_b_queue {
void *head_p; void *head_p;
void *tail_p; void *tail_p;
uint32_t count ; uint32_t count;
cy_as_c_b_node_type type ; cy_as_c_b_node_type type;
} cy_as_c_b_queue ; } cy_as_c_b_queue;
extern 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 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 */ /* Allocates a new CyAsCBNode */
extern void 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 */ /* Removes the first CyAsCBNode from the queue and frees it */
extern void 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 */ /* Remove the last CyAsCBNode from the queue and frees it */
extern void 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 */ /* Removes and frees all pending callbacks */
extern void 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 extern cy_as_return_status_t
cy_as_misc_send_request(cy_as_device *dev_p, cy_as_misc_send_request(cy_as_device *dev_p,
...@@ -469,10 +469,10 @@ 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, uint16_t req_type,
cy_as_ll_request_response *req_p, cy_as_ll_request_response *req_p,
cy_as_ll_request_response *reply_p, cy_as_ll_request_response *reply_p,
cy_as_response_callback rcb) ; cy_as_response_callback rcb);
extern void 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 /* Summary
Free all memory allocated by and zero all Free all memory allocated by and zero all
...@@ -480,7 +480,7 @@ cy_as_misc_cancel_ex_requests(cy_as_device *dev_p) ; ...@@ -480,7 +480,7 @@ cy_as_misc_cancel_ex_requests(cy_as_device *dev_p) ;
*/ */
extern void extern void
cy_as_usb_cleanup( cy_as_usb_cleanup(
cy_as_device *dev_p) ; cy_as_device *dev_p);
/* Summary /* Summary
Free all memory allocated and zero all structures initialized Free all memory allocated and zero all structures initialized
...@@ -488,7 +488,7 @@ cy_as_usb_cleanup( ...@@ -488,7 +488,7 @@ cy_as_usb_cleanup(
*/ */
extern void extern void
cy_as_storage_cleanup( cy_as_storage_cleanup(
cy_as_device *dev_p) ; cy_as_device *dev_p);
#endif #endif
/* Summary /* Summary
...@@ -503,28 +503,28 @@ cy_as_storage_cleanup( ...@@ -503,28 +503,28 @@ cy_as_storage_cleanup(
*/ */
typedef struct cy_as_context { typedef struct cy_as_context {
/* The context number for this context */ /* The context number for this context */
uint8_t number ; uint8_t number;
/* This sleep channel is used to sleep while waiting on a /* This sleep channel is used to sleep while waiting on a
* response from the west bridge device for a request. */ * 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 */ /* 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 */ /* The length of the request being received */
uint16_t request_length ; uint16_t request_length;
/* The callback for the next request received */ /* 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 */ /* 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 */ /* 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. */ /* Index upto which data is stored. */
uint16_t queue_index ; uint16_t queue_index;
/* Index to the next request in the queue. */ /* Index to the next request in the queue. */
uint16_t rqt_index ; uint16_t rqt_index;
/* Queue of data stored */ /* 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) \ #define cy_as_context_is_waiting(ctxt) \
((ctxt)->state & CY_AS_CTXT_STATE_WAITING_RESPONSE) ((ctxt)->state & CY_AS_CTXT_STATE_WAITING_RESPONSE)
...@@ -638,175 +638,175 @@ Macros to access the SDIO card properties ...@@ -638,175 +638,175 @@ Macros to access the SDIO card properties
struct cy_as_device { struct cy_as_device {
/* General stuff */ /* General stuff */
/* A signature to insure we have a valid handle */ /* A signature to insure we have a valid handle */
uint32_t sig ; uint32_t sig;
/* The ID of the silicon */ /* The ID of the silicon */
uint16_t silicon_id ; uint16_t silicon_id;
/* Pointer to the next device */ /* 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 */ /* 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 */ /* This contains various state information about the device */
uint32_t state ; uint32_t state;
/* Flag indicating whether INT# pin is used for DRQ */ /* Flag indicating whether INT# pin is used for DRQ */
cy_bool use_int_drq ; cy_bool use_int_drq;
/* DMA related */ /* DMA related */
/* The endpoint pointers associated with this device */ /* 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 */ /* 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 */ /* Low level comm related */
/* The contexts available in this device */ /* 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 */ /* 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. */ /* 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. */ /* 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. */ /* Indicates that the LL layer has queued mailbox data. */
cy_bool ll_queued_data ; cy_bool ll_queued_data;
/* MISC API related */ /* MISC API related */
/* Misc callback */ /* Misc callback */
cy_as_misc_event_callback misc_event_cb ; cy_as_misc_event_callback misc_event_cb;
/* Storage Related */ /* Storage Related */
/* The reference count for the Storage API */ /* The reference count for the Storage API */
uint32_t storage_count ; uint32_t storage_count;
/* Callback for storage events */ /* 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 */ /* 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 */ /* 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 */ /* 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. */ /* 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. */ /* 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 */ /* The storage callback */
cy_as_storage_callback_dep storage_cb ; cy_as_storage_callback_dep storage_cb;
/* The V1.2+ storage callback */ /* 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 */ /* 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 /* The device index for the currently outstanding async storage
* request */ * request */
uint32_t storage_device_index ; uint32_t storage_device_index;
/* The unit index for the currently outstanding async storage request */ /* 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 /* The block address for the currently outstanding async storage
* request */ * request */
uint32_t storage_block_addr ; uint32_t storage_block_addr;
/* The operation for the currently outstanding async storage request */ /* 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 */ /* 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 */ /* 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_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 */ /* The information on each device on each bus */
/* USB Related */ /* USB Related */
/* This conatins the endpoint async state */ /* This conatins the endpoint async state */
uint16_t epasync ; uint16_t epasync;
/* The reference count for the USB API */ /* The reference count for the USB API */
uint32_t usb_count ; uint32_t usb_count;
/* The physical endpoint configuration */ /* The physical endpoint configuration */
uint8_t usb_phy_config ; uint8_t usb_phy_config;
/* The callbacks for async func calls */ /* 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 */ /* Endpoint configuration information */
cy_as_usb_end_point_config usb_config[16] ; cy_as_usb_end_point_config usb_config[16];
/* The USB callback */ /* 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 */ /* 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 */ /* 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 */ /* 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 */ /* 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 */ /* 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 */ /* If true, send a short packet */
cy_bool usb_spacket[16] ; cy_bool usb_spacket[16];
/* The amount of data actually xferred */ /* The amount of data actually xferred */
uint32_t usb_actual_cnt ; uint32_t usb_actual_cnt;
/* EP1OUT and EP1IN config register contents */ /* EP1OUT and EP1IN config register contents */
uint8_t usb_ep1cfg[2] ; uint8_t usb_ep1cfg[2];
/* LEP config register contents */ /* LEP config register contents */
uint16_t usb_lepcfg[10] ; uint16_t usb_lepcfg[10];
/* PEP config register contents */ /* PEP config register contents */
uint16_t usb_pepcfg[4] ; uint16_t usb_pepcfg[4];
/* Buffer for EP0 and EP1 data sent via mailboxes */ /* 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 */ /* 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. */ /* 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 */ /* 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 */ /* 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 */ /* 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 */ /* 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_req_save;
cy_as_ll_request_response *usb_ep0_dma_resp_save ; cy_as_ll_request_response *usb_ep0_dma_resp_save;
/* MTP Related */ /* MTP Related */
/* The reference count for the MTP API */ /* The reference count for the MTP API */
uint32_t mtp_count ; uint32_t mtp_count;
/* The MTP event callback supplied by the client */ /* 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 */ /* 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_mtp;
cy_as_c_b_queue *func_cbs_usb ; cy_as_c_b_queue *func_cbs_usb;
cy_as_c_b_queue *func_cbs_stor ; cy_as_c_b_queue *func_cbs_stor;
cy_as_c_b_queue *func_cbs_misc ; cy_as_c_b_queue *func_cbs_misc;
cy_as_c_b_queue *func_cbs_res ; cy_as_c_b_queue *func_cbs_res;
/* The last USB event that was received */ /* 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 */ /* 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*/ /* SDIO card parameters*/
cy_as_sdio_device sdiocard[CY_AS_MAX_BUSES]; cy_as_sdio_device sdiocard[CY_AS_MAX_BUSES];
/* if true, MTP enabled Firmware. */ /* if true, MTP enabled Firmware. */
cy_bool is_mtp_firmware ; cy_bool is_mtp_firmware;
/* if true, mailbox message has come already */ /* 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 /* True between the time an Init was called and
* the complete event is generated */ * the complete event is generated */
cy_bool mtp_turbo_active ; cy_bool mtp_turbo_active;
/* mbox reported EP 2 data len */ /* mbox reported EP 2 data len */
uint16_t mtp_data_len ; uint16_t mtp_data_len;
/* The error for mtp EP4 write operation */ /* 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 */ /* mtp send/get operation callback */
cy_as_function_callback mtp_cb ; cy_as_function_callback mtp_cb;
/* mtp send/get operation client id */ /* mtp send/get operation client id */
uint32_t mtp_client ; uint32_t mtp_client;
/* mtp operation type. To be used in callback */ /* 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. */ /* 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. */ /* Interrupt mask value during device standby. */
uint32_t stby_int_mask ; uint32_t stby_int_mask;
} ; };
#define cy_as_device_is_configured(dp) \ #define cy_as_device_is_configured(dp) \
((dp)->state & CY_AS_DEVICE_STATE_CONFIGURED) ((dp)->state & CY_AS_DEVICE_STATE_CONFIGURED)
...@@ -1020,7 +1020,7 @@ struct cy_as_device { ...@@ -1020,7 +1020,7 @@ struct cy_as_device {
((dp)->silicon_id == CY_AS_MEM_CM_WB_CFG_ID_HDID_ANTIOCH_VALUE) ((dp)->silicon_id == CY_AS_MEM_CM_WB_CFG_ID_HDID_ANTIOCH_VALUE)
#ifdef CY_AS_LOG_SUPPORT #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 #else
#define cy_as_log_debug_message(value, msg) #define cy_as_log_debug_message(value, msg)
#endif #endif
...@@ -1050,7 +1050,7 @@ extern void cy_as_log_debug_message(int value, const char *msg) ; ...@@ -1050,7 +1050,7 @@ extern void cy_as_log_debug_message(int value, const char *msg) ;
extern cy_as_device * extern cy_as_device *
cy_as_device_find_from_tag( cy_as_device_find_from_tag(
cy_as_hal_device_tag tag cy_as_hal_device_tag tag
) ; );
#include "cyas_cplus_end.h" #include "cyas_cplus_end.h"
......
...@@ -91,7 +91,7 @@ typedef enum cy_as_dma_direction { ...@@ -91,7 +91,7 @@ typedef enum cy_as_dma_direction {
cy_as_direction_in_out = 2, cy_as_direction_in_out = 2,
/* Do no change the endpoint type */ /* Do no change the endpoint type */
cy_as_direction_dont_change = 3 cy_as_direction_dont_change = 3
} cy_as_dma_direction ; } cy_as_dma_direction;
/********************************* /*********************************
* West Bridge Functions * West Bridge Functions
...@@ -120,7 +120,7 @@ extern cy_as_return_status_t ...@@ -120,7 +120,7 @@ extern cy_as_return_status_t
cy_as_dma_start( cy_as_dma_start(
/* The device to start */ /* The device to start */
cy_as_device *dev_p cy_as_device *dev_p
) ; );
/* Summary /* Summary
Shutdown the DMA module Shutdown the DMA module
...@@ -142,7 +142,7 @@ extern cy_as_return_status_t ...@@ -142,7 +142,7 @@ extern cy_as_return_status_t
cy_as_dma_stop( cy_as_dma_stop(
/* The device to stop */ /* The device to stop */
cy_as_device *dev_p cy_as_device *dev_p
) ; );
/* Summary /* Summary
This function cancels all outstanding DMA requests on a given endpoint This function cancels all outstanding DMA requests on a given endpoint
...@@ -172,7 +172,7 @@ cy_as_dma_cancel( ...@@ -172,7 +172,7 @@ cy_as_dma_cancel(
/* The endpoint to cancel */ /* The endpoint to cancel */
cy_as_end_point_number_t ep, cy_as_end_point_number_t ep,
cy_as_return_status_t err cy_as_return_status_t err
) ; );
/* Summary /* Summary
This function enables a single endpoint for DMA operations This function enables a single endpoint for DMA operations
...@@ -201,7 +201,7 @@ cy_as_dma_enable_end_point( ...@@ -201,7 +201,7 @@ cy_as_dma_enable_end_point(
cy_bool enable, cy_bool enable,
/* The direction of the endpoint */ /* The direction of the endpoint */
cy_as_dma_direction dir cy_as_dma_direction dir
) ; );
/* Summary /* Summary
This function queue a DMA request for a given endpoint This function queue a DMA request for a given endpoint
...@@ -246,7 +246,7 @@ cy_as_dma_queue_request( ...@@ -246,7 +246,7 @@ cy_as_dma_queue_request(
/* The callback to call when the DMA request is complete, /* The callback to call when the DMA request is complete,
* either successfully or via an error */ * either successfully or via an error */
cy_as_dma_callback cb cy_as_dma_callback cb
) ; );
/* Summary /* Summary
This function waits until all DMA requests on a given endpoint This function waits until all DMA requests on a given endpoint
...@@ -280,7 +280,7 @@ cy_as_dma_drain_queue( ...@@ -280,7 +280,7 @@ cy_as_dma_drain_queue(
/* If CyTrue, call kickstart to start the DMA process, /* If CyTrue, call kickstart to start the DMA process,
if cy_false, west bridge will start the DMA process */ if cy_false, west bridge will start the DMA process */
cy_bool kickstart cy_bool kickstart
) ; );
/* Summary /* Summary
Sets the maximum amount of data West Bridge can accept in a single Sets the maximum amount of data West Bridge can accept in a single
...@@ -306,7 +306,7 @@ cy_as_dma_set_max_dma_size( ...@@ -306,7 +306,7 @@ cy_as_dma_set_max_dma_size(
cy_as_end_point_number_t ep, cy_as_end_point_number_t ep,
/* The max size of this endpoint in bytes */ /* The max size of this endpoint in bytes */
uint32_t size uint32_t size
) ; );
/* Summary /* Summary
This function starts the DMA process on a given channel. This function starts the DMA process on a given channel.
...@@ -326,7 +326,7 @@ cy_as_dma_kick_start( ...@@ -326,7 +326,7 @@ cy_as_dma_kick_start(
cy_as_device *dev_p, cy_as_device *dev_p,
/* The endpoint to change */ /* The endpoint to change */
cy_as_end_point_number_t ep cy_as_end_point_number_t ep
) ; );
/* Summary /* Summary
This function receives endpoint data from a request. This function receives endpoint data from a request.
...@@ -368,7 +368,7 @@ cy_as_dma_completed_callback( ...@@ -368,7 +368,7 @@ cy_as_dma_completed_callback(
uint32_t length, uint32_t length,
/* Status of DMA operation. */ /* Status of DMA operation. */
cy_as_return_status_t status cy_as_return_status_t status
) ; );
#include "cyas_cplus_end.h" #include "cyas_cplus_end.h"
......
...@@ -37,7 +37,7 @@ typedef void (*cy_as_hal_dma_complete_callback)( ...@@ -37,7 +37,7 @@ typedef void (*cy_as_hal_dma_complete_callback)(
cy_as_hal_device_tag tag, cy_as_hal_device_tag tag,
cy_as_end_point_number_t ep, cy_as_end_point_number_t ep,
uint32_t cnt, uint32_t cnt,
cy_as_return_status_t ret) ; cy_as_return_status_t ret);
typedef cy_as_hal_dma_complete_callback \ typedef cy_as_hal_dma_complete_callback \
cy_an_hal_dma_complete_callback; cy_an_hal_dma_complete_callback;
......
...@@ -162,8 +162,8 @@ ...@@ -162,8 +162,8 @@
typedef struct cy_as_hal_sleep_channel { typedef struct cy_as_hal_sleep_channel {
/* This structure is filled in with OS specific information /* This structure is filled in with OS specific information
to implementat a sleep channel */ to implementat a sleep channel */
int m_channel ; int m_channel;
} cy_as_hal_sleep_channel ; } cy_as_hal_sleep_channel;
/* Summary /* Summary
This function is called to write a register value This function is called to write a register value
...@@ -189,7 +189,7 @@ cy_as_hal_write_register( ...@@ -189,7 +189,7 @@ cy_as_hal_write_register(
uint16_t addr, uint16_t addr,
/* The value to write to the register */ /* The value to write to the register */
uint16_t value uint16_t value
) ; );
/* Summary /* Summary
This function is called to read a register value This function is called to read a register value
...@@ -213,7 +213,7 @@ cy_as_hal_read_register( ...@@ -213,7 +213,7 @@ cy_as_hal_read_register(
cy_as_hal_device_tag tag, cy_as_hal_device_tag tag,
/* The address we are writing to */ /* The address we are writing to */
uint16_t addr uint16_t addr
) ; );
/* Summary /* Summary
This function initiates a DMA write operation to write This function initiates a DMA write operation to write
...@@ -247,7 +247,7 @@ cy_as_hal_dma_setup_write( ...@@ -247,7 +247,7 @@ cy_as_hal_dma_setup_write(
/* The maximum amount of data that the endpoint /* The maximum amount of data that the endpoint
* can accept as one packet */ * can accept as one packet */
uint16_t maxsize uint16_t maxsize
) ; );
/* Summary /* Summary
This function initiates a DMA read operation from West Bridge This function initiates a DMA read operation from West Bridge
...@@ -280,7 +280,7 @@ cy_as_hal_dma_setup_read( ...@@ -280,7 +280,7 @@ cy_as_hal_dma_setup_read(
/* The maximum amount of data that the endpoint /* The maximum amount of data that the endpoint
* can provide in one DMA operation */ * can provide in one DMA operation */
uint16_t maxsize uint16_t maxsize
) ; );
/* Summary /* Summary
This function cancels a pending DMA request This function cancels a pending DMA request
...@@ -300,7 +300,7 @@ cy_as_hal_dma_cancel_request( ...@@ -300,7 +300,7 @@ cy_as_hal_dma_cancel_request(
cy_as_hal_device_tag tag, cy_as_hal_device_tag tag,
/* The endpoint we are reading from */ /* The endpoint we are reading from */
cy_as_end_point_number_t ep cy_as_end_point_number_t ep
) ; );
/* Summary /* Summary
This function registers a callback function to be called when This function registers a callback function to be called when
...@@ -324,7 +324,7 @@ cy_as_hal_dma_register_callback( ...@@ -324,7 +324,7 @@ cy_as_hal_dma_register_callback(
cy_as_hal_device_tag tag, cy_as_hal_device_tag tag,
/* The callback to call when a request has completed */ /* The callback to call when a request has completed */
cy_as_hal_dma_complete_callback cb cy_as_hal_dma_complete_callback cb
) ; );
/* Summary /* Summary
This function returns the maximum size of a DMA request that can This function returns the maximum size of a DMA request that can
...@@ -348,7 +348,7 @@ cy_as_hal_dma_max_request_size( ...@@ -348,7 +348,7 @@ cy_as_hal_dma_max_request_size(
cy_as_hal_device_tag tag, cy_as_hal_device_tag tag,
/* The endpoint of interest */ /* The endpoint of interest */
cy_as_end_point_number_t ep cy_as_end_point_number_t ep
) ; );
/* Summary /* Summary
This function sets the WAKEUP pin to a specific state on the This function sets the WAKEUP pin to a specific state on the
...@@ -370,7 +370,7 @@ cy_as_hal_set_wakeup_pin( ...@@ -370,7 +370,7 @@ cy_as_hal_set_wakeup_pin(
cy_as_hal_device_tag tag, cy_as_hal_device_tag tag,
/* The desired state of the wakeup pin */ /* The desired state of the wakeup pin */
cy_bool state cy_bool state
) ; );
/* Summary /* Summary
Synchronise the West Bridge device clocks to re-establish device Synchronise the West Bridge device clocks to re-establish device
...@@ -392,7 +392,7 @@ EXTERN cy_bool ...@@ -392,7 +392,7 @@ EXTERN cy_bool
cy_as_hal_sync_device_clocks( cy_as_hal_sync_device_clocks(
/* The tag to ID a specific West Bridge device */ /* The tag to ID a specific West Bridge device */
cy_as_hal_device_tag tag, cy_as_hal_device_tag tag,
) ; );
/* Summary /* Summary
Initialize West Bridge device registers that may have been Initialize West Bridge device registers that may have been
...@@ -418,7 +418,7 @@ cy_as_hal_init_dev_registers( ...@@ -418,7 +418,7 @@ cy_as_hal_init_dev_registers(
cy_as_hal_device_tag tag, cy_as_hal_device_tag tag,
/* Indicates whether this is a wake-up from standby. */ /* Indicates whether this is a wake-up from standby. */
cy_bool is_standby_wakeup cy_bool is_standby_wakeup
) ; );
/* Summary /* Summary
This function reads a set of P-port accessible device registers and This function reads a set of P-port accessible device registers and
...@@ -447,7 +447,7 @@ EXTERN void ...@@ -447,7 +447,7 @@ EXTERN void
cy_as_hal_read_regs_before_standby( cy_as_hal_read_regs_before_standby(
/* The tag to ID a specific West Bridge device */ /* The tag to ID a specific West Bridge device */
cy_as_hal_device_tag tag cy_as_hal_device_tag tag
) ; );
/* Summary /* Summary
This function restores the old values to a set of P-port This function restores the old values to a set of P-port
...@@ -470,7 +470,7 @@ EXTERN void ...@@ -470,7 +470,7 @@ EXTERN void
cy_as_hal_restore_regs_after_standby( cy_as_hal_restore_regs_after_standby(
/* The tag to ID a specific West Bridge device */ /* The tag to ID a specific West Bridge device */
cy_as_hal_device_tag tag cy_as_hal_device_tag tag
) ; );
/* /*
* The functions below this comment are part of the HAL layer, * The functions below this comment are part of the HAL layer,
...@@ -497,7 +497,7 @@ EXTERN void * ...@@ -497,7 +497,7 @@ EXTERN void *
cy_as_hal_alloc( cy_as_hal_alloc(
/* The size of the memory block to allocate */ /* The size of the memory block to allocate */
uint32_t size uint32_t size
) ; );
/* Summary /* Summary
This function frees a previously allocated block of memory This function frees a previously allocated block of memory
...@@ -515,7 +515,7 @@ EXTERN void ...@@ -515,7 +515,7 @@ EXTERN void
cy_as_hal_free( cy_as_hal_free(
/* Pointer to a memory block to free */ /* Pointer to a memory block to free */
void *ptr void *ptr
) ; );
/* Summary /* Summary
This function is a malloc equivalent that can be used from an This function is a malloc equivalent that can be used from an
...@@ -545,7 +545,7 @@ EXTERN void * ...@@ -545,7 +545,7 @@ EXTERN void *
cy_as_hal_c_b_alloc( cy_as_hal_c_b_alloc(
/* The size of the memory block to allocate */ /* The size of the memory block to allocate */
uint32_t size uint32_t size
) ; );
/* Summary /* Summary
This function frees the memory allocated through the CyAsHalCBAlloc This function frees the memory allocated through the CyAsHalCBAlloc
...@@ -567,7 +567,7 @@ EXTERN void ...@@ -567,7 +567,7 @@ EXTERN void
cy_as_hal_c_b_free( cy_as_hal_c_b_free(
/* Pointer to the memory block to be freed */ /* Pointer to the memory block to be freed */
void *ptr void *ptr
) ; );
/* Summary /* Summary
This function sets a block of memory to a specific value This function sets a block of memory to a specific value
...@@ -586,7 +586,7 @@ cy_as_mem_set( ...@@ -586,7 +586,7 @@ cy_as_mem_set(
uint8_t value, uint8_t value,
/* The number of bytes to set */ /* The number of bytes to set */
uint32_t cnt uint32_t cnt
) ; );
/* Summary /* Summary
This function creates or initializes a sleep channel This function creates or initializes a sleep channel
...@@ -609,7 +609,7 @@ EXTERN cy_bool ...@@ -609,7 +609,7 @@ EXTERN cy_bool
cy_as_hal_create_sleep_channel( cy_as_hal_create_sleep_channel(
/* Pointer to the sleep channel to create/initialize */ /* Pointer to the sleep channel to create/initialize */
cy_as_hal_sleep_channel *chan cy_as_hal_sleep_channel *chan
) ; );
/* Summary /* Summary
This function destroys an existing sleep channel This function destroys an existing sleep channel
...@@ -631,7 +631,7 @@ EXTERN cy_bool ...@@ -631,7 +631,7 @@ EXTERN cy_bool
cy_as_hal_destroy_sleep_channel( cy_as_hal_destroy_sleep_channel(
/* The sleep channel to destroy */ /* The sleep channel to destroy */
cy_as_hal_sleep_channel chan cy_as_hal_sleep_channel chan
) ; );
/* Summary /* Summary
This function causes the calling process or thread to sleep until This function causes the calling process or thread to sleep until
...@@ -655,7 +655,7 @@ cy_as_hal_sleep_on( ...@@ -655,7 +655,7 @@ cy_as_hal_sleep_on(
cy_as_hal_sleep_channel chan, cy_as_hal_sleep_channel chan,
/* The maximum time to sleep in milli-seconds */ /* The maximum time to sleep in milli-seconds */
uint32_t ms uint32_t ms
) ; );
/* Summary /* Summary
This function casues the process or thread sleeping on the given This function casues the process or thread sleeping on the given
...@@ -676,7 +676,7 @@ EXTERN cy_bool ...@@ -676,7 +676,7 @@ EXTERN cy_bool
cy_as_hal_wake( cy_as_hal_wake(
/* The sleep channel to wake */ /* The sleep channel to wake */
cy_as_hal_sleep_channel chan cy_as_hal_sleep_channel chan
) ; );
/* Summary /* Summary
This function disables interrupts, insuring that short bursts This function disables interrupts, insuring that short bursts
...@@ -701,7 +701,7 @@ cy_as_hal_wake( ...@@ -701,7 +701,7 @@ cy_as_hal_wake(
* CyAsHalEnableInterrupts * CyAsHalEnableInterrupts
*/ */
EXTERN uint32_t EXTERN uint32_t
cy_as_hal_disable_interrupts() ; cy_as_hal_disable_interrupts();
/* Summary /* Summary
This function re-enables interrupts after a critical section of This function re-enables interrupts after a critical section of
...@@ -722,7 +722,7 @@ EXTERN void ...@@ -722,7 +722,7 @@ EXTERN void
cy_as_hal_enable_interrupts( cy_as_hal_enable_interrupts(
/* Value returned by the previous CyAsHalDisableInterrupts call. */ /* Value returned by the previous CyAsHalDisableInterrupts call. */
uint32_t value uint32_t value
) ; );
/* Summary /* Summary
This function sleeps for 150 ns. This function sleeps for 150 ns.
...@@ -734,7 +734,7 @@ cy_as_hal_enable_interrupts( ...@@ -734,7 +734,7 @@ cy_as_hal_enable_interrupts(
*/ */
EXTERN void EXTERN void
cy_as_hal_sleep150( cy_as_hal_sleep150(
) ; );
/* Summary /* Summary
This function sleeps for the given number of milliseconds This function sleeps for the given number of milliseconds
...@@ -745,7 +745,7 @@ cy_as_hal_sleep150( ...@@ -745,7 +745,7 @@ cy_as_hal_sleep150(
EXTERN void EXTERN void
cy_as_hal_sleep( cy_as_hal_sleep(
uint32_t ms uint32_t ms
) ; );
/* Summary /* Summary
This function asserts when the condition evaluates to zero This function asserts when the condition evaluates to zero
...@@ -761,7 +761,7 @@ EXTERN void ...@@ -761,7 +761,7 @@ EXTERN void
cy_as_hal_assert( cy_as_hal_assert(
/* The condition to evaluate */ /* The condition to evaluate */
cy_bool cond cy_bool cond
) ; );
/* Summary /* Summary
This function prints a message from the API to a human readable device This function prints a message from the API to a human readable device
...@@ -779,7 +779,7 @@ cy_as_hal_print_message( ...@@ -779,7 +779,7 @@ cy_as_hal_print_message(
/* The message to print */ /* The message to print */
const char *fmt_p, const char *fmt_p,
... /* Variable arguments */ ... /* Variable arguments */
) ; );
/* Summary /* Summary
This function reports whether the HAL implementation uses This function reports whether the HAL implementation uses
...@@ -795,6 +795,6 @@ cy_as_hal_print_message( ...@@ -795,6 +795,6 @@ cy_as_hal_print_message(
*/ */
EXTERN cy_bool EXTERN cy_bool
cy_as_hal_is_polling( cy_as_hal_is_polling(
void) ; void);
#endif #endif
...@@ -58,7 +58,7 @@ cy_as_intr_start( ...@@ -58,7 +58,7 @@ cy_as_intr_start(
cy_as_device *dev_p, cy_as_device *dev_p,
/* If true, enable the DMA interrupt through the INT signal */ /* If true, enable the DMA interrupt through the INT signal */
cy_bool dmaintr cy_bool dmaintr
) ; );
/* Summary /* Summary
Stop the interrupt manager module Stop the interrupt manager module
...@@ -81,7 +81,7 @@ cy_as_return_status_t ...@@ -81,7 +81,7 @@ cy_as_return_status_t
cy_as_intr_stop( cy_as_intr_stop(
/* Device bein stopped */ /* Device bein stopped */
cy_as_device *dev_p cy_as_device *dev_p
) ; );
/* Summary /* Summary
...@@ -97,7 +97,7 @@ cy_as_intr_stop( ...@@ -97,7 +97,7 @@ cy_as_intr_stop(
void cy_as_intr_service_interrupt( void cy_as_intr_service_interrupt(
/* The USER supplied tag for this device */ /* The USER supplied tag for this device */
cy_as_hal_device_tag tag cy_as_hal_device_tag tag
) ; );
#include "cyas_cplus_end.h" #include "cyas_cplus_end.h"
......
...@@ -25,12 +25,12 @@ ...@@ -25,12 +25,12 @@
#include "cyasdevice.h" #include "cyasdevice.h"
extern cy_as_return_status_t 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 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 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 #endif
...@@ -168,7 +168,7 @@ typedef enum cy_as_remove_request_result_t { ...@@ -168,7 +168,7 @@ typedef enum cy_as_remove_request_result_t {
cy_as_remove_request_sucessful, cy_as_remove_request_sucessful,
cy_as_remove_request_in_transit, cy_as_remove_request_in_transit,
cy_as_remove_request_not_found cy_as_remove_request_not_found
} cy_as_remove_request_result_t ; } cy_as_remove_request_result_t;
/* Summary /* Summary
Start the low level communications module Start the low level communications module
...@@ -178,12 +178,12 @@ typedef enum cy_as_remove_request_result_t { ...@@ -178,12 +178,12 @@ typedef enum cy_as_remove_request_result_t {
cy_as_return_status_t cy_as_return_status_t
cy_as_ll_start( cy_as_ll_start(
cy_as_device *dev_p cy_as_device *dev_p
) ; );
cy_as_return_status_t cy_as_return_status_t
cy_as_ll_stop( cy_as_ll_stop(
cy_as_device *dev_p cy_as_device *dev_p
) ; );
cy_as_ll_request_response * cy_as_ll_request_response *
...@@ -193,31 +193,31 @@ cy_as_ll_create_request( ...@@ -193,31 +193,31 @@ cy_as_ll_create_request(
uint8_t context, uint8_t context,
/* Length of the request in 16 bit words */ /* Length of the request in 16 bit words */
uint16_t length uint16_t length
) ; );
void void
cy_as_ll_init_request( cy_as_ll_init_request(
cy_as_ll_request_response *req_p, cy_as_ll_request_response *req_p,
uint16_t code, uint16_t code,
uint16_t context, uint16_t context,
uint16_t length) ; uint16_t length);
void void
cy_as_ll_init_response( cy_as_ll_init_response(
cy_as_ll_request_response *req_p, cy_as_ll_request_response *req_p,
uint16_t length) ; uint16_t length);
void void
cy_as_ll_destroy_request( cy_as_ll_destroy_request(
cy_as_device *dev_p, cy_as_device *dev_p,
cy_as_ll_request_response *) ; cy_as_ll_request_response *);
cy_as_ll_request_response * cy_as_ll_request_response *
cy_as_ll_create_response( cy_as_ll_create_response(
cy_as_device *dev_p, cy_as_device *dev_p,
/* Length of the request in 16 bit words */ /* Length of the request in 16 bit words */
uint16_t length uint16_t length
) ; );
cy_as_remove_request_result_t cy_as_remove_request_result_t
cy_as_ll_remove_request( cy_as_ll_remove_request(
...@@ -225,15 +225,15 @@ cy_as_ll_remove_request( ...@@ -225,15 +225,15 @@ cy_as_ll_remove_request(
cy_as_context *ctxt_p, cy_as_context *ctxt_p,
cy_as_ll_request_response *req_p, cy_as_ll_request_response *req_p,
cy_bool force cy_bool force
) ; );
void void
cy_as_ll_remove_all_requests(cy_as_device *dev_p, cy_as_ll_remove_all_requests(cy_as_device *dev_p,
cy_as_context *ctxt_p) ; cy_as_context *ctxt_p);
void void
cy_as_ll_destroy_response( cy_as_ll_destroy_response(
cy_as_device *dev_p, cy_as_device *dev_p,
cy_as_ll_request_response *) ; cy_as_ll_request_response *);
cy_as_return_status_t cy_as_return_status_t
cy_as_ll_send_request( cy_as_ll_send_request(
...@@ -247,7 +247,7 @@ cy_as_ll_send_request( ...@@ -247,7 +247,7 @@ cy_as_ll_send_request(
cy_bool sync, cy_bool sync,
/* Callback to call when reply is received */ /* Callback to call when reply is received */
cy_as_response_callback cb cy_as_response_callback cb
) ; );
cy_as_return_status_t cy_as_return_status_t
cy_as_ll_send_request_wait_reply( cy_as_ll_send_request_wait_reply(
...@@ -257,7 +257,7 @@ cy_as_ll_send_request_wait_reply( ...@@ -257,7 +257,7 @@ cy_as_ll_send_request_wait_reply(
cy_as_ll_request_response *req, cy_as_ll_request_response *req,
/* Storage for a reply, must be sure it is of sufficient size */ /* Storage for a reply, must be sure it is of sufficient size */
cy_as_ll_request_response *resp cy_as_ll_request_response *resp
) ; );
/* Summary /* Summary
This function registers a callback function to be called when a This function registers a callback function to be called when a
...@@ -273,7 +273,7 @@ cy_as_ll_register_request_callback( ...@@ -273,7 +273,7 @@ cy_as_ll_register_request_callback(
cy_as_device *dev_p, cy_as_device *dev_p,
uint8_t context, uint8_t context,
cy_as_response_callback cb cy_as_response_callback cb
) ; );
/* Summary /* Summary
This function packs a set of bytes given by the data_p pointer This function packs a set of bytes given by the data_p pointer
...@@ -289,7 +289,7 @@ cy_as_ll_request_response__pack( ...@@ -289,7 +289,7 @@ cy_as_ll_request_response__pack(
uint32_t length, uint32_t length,
/* The data to pack */ /* The data to pack */
void *data_p void *data_p
) ; );
/* Summary /* Summary
This function unpacks a set of bytes from a request/reply This function unpacks a set of bytes from a request/reply
...@@ -305,7 +305,7 @@ cy_as_ll_request_response__unpack( ...@@ -305,7 +305,7 @@ cy_as_ll_request_response__unpack(
uint32_t length, uint32_t length,
/* The destination of the unpack operation */ /* The destination of the unpack operation */
void *data_p void *data_p
) ; );
/* Summary /* Summary
This function sends a status response back to the West Bridge This function sends a status response back to the West Bridge
...@@ -320,7 +320,7 @@ cy_as_ll_send_status_response( ...@@ -320,7 +320,7 @@ cy_as_ll_send_status_response(
/* The success/failure code to send */ /* The success/failure code to send */
uint16_t code, uint16_t code,
/* Flag to clear wait on storage context */ /* Flag to clear wait on storage context */
uint8_t clear_storage) ; uint8_t clear_storage);
/* Summary /* Summary
This function sends a response back to the West Bridge device. This function sends a response back to the West Bridge device.
...@@ -344,7 +344,7 @@ cy_as_ll_send_data_response( ...@@ -344,7 +344,7 @@ cy_as_ll_send_data_response(
uint16_t length, uint16_t length,
/* The data for the response */ /* The data for the response */
void *data void *data
) ; );
/* Summary /* Summary
This function removes any requests of the given type This function removes any requests of the given type
...@@ -359,7 +359,7 @@ cy_as_ll_remove_ep_data_requests( ...@@ -359,7 +359,7 @@ cy_as_ll_remove_ep_data_requests(
/* The West Bridge device */ /* The West Bridge device */
cy_as_device *dev_p, cy_as_device *dev_p,
cy_as_end_point_number_t ep cy_as_end_point_number_t ep
) ; );
#include "cyas_cplus_end.h" #include "cyas_cplus_end.h"
......
...@@ -47,7 +47,7 @@ typedef enum cy_as_media_type { ...@@ -47,7 +47,7 @@ typedef enum cy_as_media_type {
cy_as_media_sdio = 0x04, cy_as_media_sdio = 0x04,
cy_as_media_max_media_value = 0x05 cy_as_media_max_media_value = 0x05
} cy_as_media_type ; } cy_as_media_type;
#include "cyas_cplus_end.h" #include "cyas_cplus_end.h"
......
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
* CyAsMiscCreateDevice * CyAsMiscCreateDevice
* CyAsMiscDestroyDevice * CyAsMiscDestroyDevice
*/ */
typedef void *cy_as_device_handle ; typedef void *cy_as_device_handle;
/* Summary /* Summary
This data type gives the mode for the DACK# signal This data type gives the mode for the DACK# signal
...@@ -74,7 +74,7 @@ typedef void *cy_as_device_handle ; ...@@ -74,7 +74,7 @@ typedef void *cy_as_device_handle ;
typedef enum cy_as_device_dack_mode { typedef enum cy_as_device_dack_mode {
cy_as_device_dack_ack, /* Operate in the ACK 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_eob /* Operate in the EOB mode */
} cy_as_device_dack_mode ; } cy_as_device_dack_mode;
/* Summary /* Summary
This data structure gives the options for all hardware features. This data structure gives the options for all hardware features.
...@@ -89,21 +89,21 @@ typedef enum cy_as_device_dack_mode { ...@@ -89,21 +89,21 @@ typedef enum cy_as_device_dack_mode {
*/ */
typedef struct cy_as_device_config { typedef struct cy_as_device_config {
/* If TRUE, the P port is running in SRAM mode. */ /* 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 */ /* 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 */ /* If TRUE, DMA req will be delivered via the interrupt signal */
cy_bool dmaintr ; cy_bool dmaintr;
/* Mode for the DACK# signal */ /* 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 */ /* 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 */ /* 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 /* If TRUE, the clock is connected to a crystal, otherwise it is
connected to a clock */ connected to a clock */
cy_bool crystal ; cy_bool crystal;
} cy_as_device_config ; } cy_as_device_config;
/* Summary /* Summary
...@@ -174,7 +174,7 @@ typedef enum cy_as_misc_signal_polarity { ...@@ -174,7 +174,7 @@ typedef enum cy_as_misc_signal_polarity {
cy_as_misc_active_high, cy_as_misc_active_high,
cy_as_misc_active_low 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 { ...@@ -303,7 +303,7 @@ typedef enum cy_as_funct_c_b_type {
CY_FUNCT_CB_MTP_STOP_STORAGE_ONLY, CY_FUNCT_CB_MTP_STOP_STORAGE_ONLY,
CY_FUNCT_CB_NODATA = 0x40000000U, CY_FUNCT_CB_NODATA = 0x40000000U,
CY_FUNCT_CB_DATA = 0x20000000U CY_FUNCT_CB_DATA = 0x20000000U
} cy_as_funct_c_b_type ; } cy_as_funct_c_b_type;
/* Summary /* Summary
This type specifies the general West Bridge function callback. This type specifies the general West Bridge function callback.
...@@ -321,7 +321,7 @@ typedef void (*cy_as_function_callback)( ...@@ -321,7 +321,7 @@ typedef void (*cy_as_function_callback)(
cy_as_return_status_t status, cy_as_return_status_t status,
uint32_t client, uint32_t client,
cy_as_funct_c_b_type type, cy_as_funct_c_b_type type,
void *data) ; void *data);
/* Summary /* Summary
This type specifies the general West Bridge event that has This type specifies the general West Bridge event that has
...@@ -354,7 +354,7 @@ typedef enum cy_as_misc_event_type { ...@@ -354,7 +354,7 @@ typedef enum cy_as_misc_event_type {
/* This event is sent when the firmware image downloaded /* This event is sent when the firmware image downloaded
cannot run on the active west bridge device. */ cannot run on the active west bridge device. */
cy_as_event_misc_device_mismatch cy_as_event_misc_device_mismatch
} cy_as_misc_event_type ; } cy_as_misc_event_type;
/* Summary /* Summary
This type is the type of a callback function that is called when a 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)( ...@@ -378,7 +378,7 @@ typedef void (*cy_as_misc_event_callback)(
cy_as_misc_event_type ev, cy_as_misc_event_type ev,
/* The data assocaited with the event being reported */ /* The data assocaited with the event being reported */
void *evdata void *evdata
) ; );
#ifndef __doxygen__ #ifndef __doxygen__
/* Summary /* Summary
...@@ -447,7 +447,7 @@ typedef enum cy_as_low_speed_sd_freq { ...@@ -447,7 +447,7 @@ typedef enum cy_as_low_speed_sd_freq {
CY_AS_SD_DEFAULT_FREQ = 0, CY_AS_SD_DEFAULT_FREQ = 0,
/* 24 MHz */ /* 24 MHz */
CY_AS_SD_RATED_FREQ CY_AS_SD_RATED_FREQ
} cy_as_low_speed_sd_freq ; } cy_as_low_speed_sd_freq;
/* Summary /* Summary
This enum lists the set of clock frequencies that are supported This enum lists the set of clock frequencies that are supported
...@@ -465,7 +465,7 @@ typedef enum cy_as_low_speed_sd_freq { ...@@ -465,7 +465,7 @@ typedef enum cy_as_low_speed_sd_freq {
typedef enum cy_as_high_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_48, /* 48 MHz, default value */
CY_AS_HS_SD_FREQ_24 /* 24 MHz */ CY_AS_HS_SD_FREQ_24 /* 24 MHz */
} cy_as_high_speed_sd_freq ; } cy_as_high_speed_sd_freq;
/* Summary /* Summary
Struct encapsulating all information returned by the Struct encapsulating all information returned by the
...@@ -490,7 +490,7 @@ typedef struct cy_as_get_firmware_version_data { ...@@ -490,7 +490,7 @@ typedef struct cy_as_get_firmware_version_data {
uint8_t media_type; uint8_t media_type;
/* Return value to indicate the release or debug mode of firmware */ /* Return value to indicate the release or debug mode of firmware */
cy_bool is_debug_mode; 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( ...@@ -519,7 +519,7 @@ cy_as_misc_create_device(
cy_as_device_handle *handle_p, cy_as_device_handle *handle_p,
/* The HAL specific tag for this device */ /* The HAL specific tag for this device */
cy_as_hal_device_tag tag cy_as_hal_device_tag tag
) ; );
/* Summary /* Summary
This functions destroys a previously created West Bridge device. This functions destroys a previously created West Bridge device.
...@@ -543,7 +543,7 @@ EXTERN cy_as_return_status_t ...@@ -543,7 +543,7 @@ EXTERN cy_as_return_status_t
cy_as_misc_destroy_device( cy_as_misc_destroy_device(
/* Handle to the device to destroy */ /* Handle to the device to destroy */
cy_as_device_handle handle cy_as_device_handle handle
) ; );
/* Summary /* Summary
This function initializes the hardware for basic communication with This function initializes the hardware for basic communication with
...@@ -576,7 +576,7 @@ cy_as_misc_configure_device( ...@@ -576,7 +576,7 @@ cy_as_misc_configure_device(
cy_as_device_handle handle, cy_as_device_handle handle,
/* Configuration information */ /* Configuration information */
cy_as_device_config *config_p cy_as_device_config *config_p
) ; );
/* Summary /* Summary
This function returns non-zero if West Bridge is in standby and This function returns non-zero if West Bridge is in standby and
...@@ -599,7 +599,7 @@ cy_as_misc_in_standby( ...@@ -599,7 +599,7 @@ cy_as_misc_in_standby(
cy_as_device_handle handle, cy_as_device_handle handle,
/* Return value for standby state */ /* Return value for standby state */
cy_bool *standby cy_bool *standby
) ; );
/* Summary /* Summary
This function downloads the firmware to West Bridge device. This function downloads the firmware to West Bridge device.
...@@ -647,7 +647,7 @@ cy_as_misc_download_firmware( ...@@ -647,7 +647,7 @@ cy_as_misc_download_firmware(
cy_as_function_callback cb, cy_as_function_callback cb,
/* Client data to be passed to the callback. */ /* Client data to be passed to the callback. */
uint32_t client uint32_t client
) ; );
/* Summary /* Summary
...@@ -683,7 +683,7 @@ cy_as_misc_get_firmware_version( ...@@ -683,7 +683,7 @@ cy_as_misc_get_firmware_version(
cy_as_function_callback cb, cy_as_function_callback cb,
/* Client data to be passed to the callback. */ /* Client data to be passed to the callback. */
uint32_t client uint32_t client
) ; );
#if !defined(__doxygen__) #if !defined(__doxygen__)
...@@ -721,7 +721,7 @@ cy_as_misc_read_m_c_u_register( ...@@ -721,7 +721,7 @@ cy_as_misc_read_m_c_u_register(
cy_as_function_callback cb, cy_as_function_callback cb,
/* Client data to be passed to the callback. */ /* Client data to be passed to the callback. */
uint32_t client uint32_t client
) ; );
/* Summary /* Summary
This function writes to an MCU accessible register on the West Bridge. This function writes to an MCU accessible register on the West Bridge.
...@@ -762,7 +762,7 @@ cy_as_misc_write_m_c_u_register( ...@@ -762,7 +762,7 @@ cy_as_misc_write_m_c_u_register(
cy_as_function_callback cb, cy_as_function_callback cb,
/* Client data to be passed to the callback. */ /* Client data to be passed to the callback. */
uint32_t client uint32_t client
) ; );
#endif #endif
...@@ -816,7 +816,7 @@ cy_as_misc_reset( ...@@ -816,7 +816,7 @@ cy_as_misc_reset(
cy_as_function_callback cb, cy_as_function_callback cb,
/* Client data to be passed to the callback. */ /* Client data to be passed to the callback. */
uint32_t client uint32_t client
) ; );
/* Summary /* Summary
This function acquires a given resource. This function acquires a given resource.
...@@ -864,7 +864,7 @@ cy_as_misc_acquire_resource( ...@@ -864,7 +864,7 @@ cy_as_misc_acquire_resource(
cy_as_function_callback cb, cy_as_function_callback cb,
/* Client data to be passed to the callback. */ /* Client data to be passed to the callback. */
uint32_t client uint32_t client
) ; );
/* Summary /* Summary
This function releases a given resource. This function releases a given resource.
...@@ -898,7 +898,7 @@ cy_as_misc_release_resource( ...@@ -898,7 +898,7 @@ cy_as_misc_release_resource(
cy_as_device_handle handle, cy_as_device_handle handle,
/* The resource to release */ /* The resource to release */
cy_as_resource_type resource cy_as_resource_type resource
) ; );
#ifndef __doxygen__ #ifndef __doxygen__
/* Summary /* Summary
...@@ -955,7 +955,7 @@ cy_as_misc_set_trace_level( ...@@ -955,7 +955,7 @@ cy_as_misc_set_trace_level(
cy_as_function_callback cb, cy_as_function_callback cb,
/* Client data to be passed to the callback. */ /* Client data to be passed to the callback. */
uint32_t client uint32_t client
) ; );
#endif #endif
/* Summary /* Summary
...@@ -1015,7 +1015,7 @@ cy_as_misc_enter_standby_e_x_u( ...@@ -1015,7 +1015,7 @@ cy_as_misc_enter_standby_e_x_u(
cy_as_function_callback cb, cy_as_function_callback cb,
/* Client data to be passed to the callback. */ /* Client data to be passed to the callback. */
uint32_t client uint32_t client
) ; );
/* Summary /* Summary
This function is provided for backwards compatibility. This function is provided for backwards compatibility.
...@@ -1032,7 +1032,7 @@ cy_as_misc_enter_standby(cy_as_device_handle handle, ...@@ -1032,7 +1032,7 @@ cy_as_misc_enter_standby(cy_as_device_handle handle,
cy_bool pin, cy_bool pin,
cy_as_function_callback cb, cy_as_function_callback cb,
uint32_t client uint32_t client
) ; );
/* Summary /* Summary
This function brings West Bridge out of sleep mode. This function brings West Bridge out of sleep mode.
...@@ -1068,7 +1068,7 @@ cy_as_misc_leave_standby( ...@@ -1068,7 +1068,7 @@ cy_as_misc_leave_standby(
cy_as_device_handle handle, cy_as_device_handle handle,
/* The resource causing the wakeup */ /* The resource causing the wakeup */
cy_as_resource_type resource cy_as_resource_type resource
) ; );
/* Summary /* Summary
This function registers a callback function to be called when an This function registers a callback function to be called when an
...@@ -1091,7 +1091,7 @@ cy_as_misc_register_callback( ...@@ -1091,7 +1091,7 @@ cy_as_misc_register_callback(
cy_as_device_handle handle, cy_as_device_handle handle,
/* The function to call */ /* The function to call */
cy_as_misc_event_callback callback cy_as_misc_event_callback callback
) ; );
/* Summary /* Summary
This function sets the logging level for log messages. This function sets the logging level for log messages.
...@@ -1107,7 +1107,7 @@ EXTERN void ...@@ -1107,7 +1107,7 @@ EXTERN void
cy_as_misc_set_log_level( cy_as_misc_set_log_level(
/* Level to set, 0 is fewer messages, 255 is all */ /* Level to set, 0 is fewer messages, 255 is all */
uint8_t level uint8_t level
) ; );
/* Summary /* Summary
...@@ -1143,7 +1143,7 @@ cy_as_misc_storage_changed( ...@@ -1143,7 +1143,7 @@ cy_as_misc_storage_changed(
cy_as_function_callback cb, cy_as_function_callback cb,
/* Client data to be passed to the callback. */ /* Client data to be passed to the callback. */
uint32_t client uint32_t client
) ; );
/* Summary /* Summary
This function instructs the West Bridge firmware to start/stop This function instructs the West Bridge firmware to start/stop
...@@ -1181,7 +1181,7 @@ cy_as_misc_heart_beat_control( ...@@ -1181,7 +1181,7 @@ cy_as_misc_heart_beat_control(
cy_as_function_callback cb, cy_as_function_callback cb,
/* Client data to be passed to the callback. */ /* Client data to be passed to the callback. */
uint32_t client uint32_t client
) ; );
/* Summary /* Summary
This function gets the current state of a GPIO pin on the This function gets the current state of a GPIO pin on the
...@@ -1227,7 +1227,7 @@ cy_as_misc_get_gpio_value( ...@@ -1227,7 +1227,7 @@ cy_as_misc_get_gpio_value(
cy_as_function_callback cb, cy_as_function_callback cb,
/* Client data to be passed to the callback. */ /* Client data to be passed to the callback. */
uint32_t client uint32_t client
) ; );
/* Summary /* Summary
This function updates the state of a GPIO pin on the West This function updates the state of a GPIO pin on the West
...@@ -1273,7 +1273,7 @@ cy_as_misc_set_gpio_value( ...@@ -1273,7 +1273,7 @@ cy_as_misc_set_gpio_value(
cy_as_function_callback cb, cy_as_function_callback cb,
/* Client data to be passed to the callback. */ /* Client data to be passed to the callback. */
uint32_t client uint32_t client
) ; );
/* Summary /* Summary
Set the West Bridge device in the low power suspend mode. Set the West Bridge device in the low power suspend mode.
...@@ -1328,7 +1328,7 @@ cy_as_misc_enter_suspend( ...@@ -1328,7 +1328,7 @@ cy_as_misc_enter_suspend(
cy_as_function_callback cb, cy_as_function_callback cb,
/* Client data to be passed to the callback. */ /* Client data to be passed to the callback. */
uint32_t client uint32_t client
) ; );
/* Summary /* Summary
Wake up the West Bridge device from suspend mode. Wake up the West Bridge device from suspend mode.
...@@ -1371,7 +1371,7 @@ cy_as_misc_leave_suspend( ...@@ -1371,7 +1371,7 @@ cy_as_misc_leave_suspend(
cy_as_function_callback cb, cy_as_function_callback cb,
/* Client data to be passed to the callback. */ /* Client data to be passed to the callback. */
uint32_t client uint32_t client
) ; );
/* Summary /* Summary
Reserve first numzones zones of nand device for storing Reserve first numzones zones of nand device for storing
...@@ -1400,7 +1400,7 @@ cy_as_misc_reserve_l_n_a_boot_area( ...@@ -1400,7 +1400,7 @@ cy_as_misc_reserve_l_n_a_boot_area(
cy_as_function_callback cb, cy_as_function_callback cb,
/* Client data to be passed to the callback. */ /* Client data to be passed to the callback. */
uint32_t client uint32_t client
) ; );
/* Summary /* Summary
Select the clock frequency to be used when talking to low Select the clock frequency to be used when talking to low
...@@ -1448,7 +1448,7 @@ cy_as_misc_set_low_speed_sd_freq( ...@@ -1448,7 +1448,7 @@ cy_as_misc_set_low_speed_sd_freq(
cy_as_function_callback cb, cy_as_function_callback cb,
/* Client data to be passed to the callback */ /* Client data to be passed to the callback */
uint32_t client uint32_t client
) ; );
/* Summary /* Summary
Select the clock frequency to be used when talking to high speed Select the clock frequency to be used when talking to high speed
...@@ -1493,7 +1493,7 @@ cy_as_misc_set_high_speed_sd_freq( ...@@ -1493,7 +1493,7 @@ cy_as_misc_set_high_speed_sd_freq(
cy_as_function_callback cb, cy_as_function_callback cb,
/* Client data to be passed to the callback */ /* Client data to be passed to the callback */
uint32_t client uint32_t client
) ; );
/* Summary /* Summary
Select the polarity of the SD_POW output driven by West Bridge. Select the polarity of the SD_POW output driven by West Bridge.
...@@ -1539,7 +1539,7 @@ cy_as_misc_set_sd_power_polarity( ...@@ -1539,7 +1539,7 @@ cy_as_misc_set_sd_power_polarity(
cy_as_function_callback cb, cy_as_function_callback cb,
/* Client data to be passed to the callback. */ /* Client data to be passed to the callback. */
uint32_t client uint32_t client
) ; );
/* For supporting deprecated functions */ /* For supporting deprecated functions */
#include "cyasmisc_dep.h" #include "cyasmisc_dep.h"
......
...@@ -132,9 +132,9 @@ ...@@ -132,9 +132,9 @@
*/ */
typedef struct cy_as_mtp_block_table { typedef struct cy_as_mtp_block_table {
uint32_t start_blocks[CY_AS_MAX_BLOCK_TABLE_ENTRIES] ; uint32_t start_blocks[CY_AS_MAX_BLOCK_TABLE_ENTRIES];
uint16_t num_blocks[CY_AS_MAX_BLOCK_TABLE_ENTRIES] ; uint16_t num_blocks[CY_AS_MAX_BLOCK_TABLE_ENTRIES];
} cy_as_mtp_block_table ; } cy_as_mtp_block_table;
/* Summary /* Summary
This type specifies the type of MTP event that has occurred. This type specifies the type of MTP event that has occurred.
...@@ -178,7 +178,7 @@ typedef enum cy_as_mtp_event { ...@@ -178,7 +178,7 @@ typedef enum cy_as_mtp_event {
will result in an USB reset. this event has will result in an USB reset. this event has
no data */ no data */
cy_as_mtp_block_table_needed cy_as_mtp_block_table_needed
} cy_as_mtp_event ; } cy_as_mtp_event;
/* Summary /* Summary
Data for the CyAsMTPSendObjectComplete event. Data for the CyAsMTPSendObjectComplete event.
...@@ -202,10 +202,10 @@ typedef enum cy_as_mtp_event { ...@@ -202,10 +202,10 @@ typedef enum cy_as_mtp_event {
*/ */
typedef struct cy_as_mtp_send_object_complete_data { typedef struct cy_as_mtp_send_object_complete_data {
cy_as_return_status_t status ; cy_as_return_status_t status;
uint32_t byte_count ; uint32_t byte_count;
uint32_t transaction_id ; uint32_t transaction_id;
} cy_as_mtp_send_object_complete_data ; } cy_as_mtp_send_object_complete_data;
/* Summary /* Summary
Data for the CyAsMTPGetObjectComplete event. Data for the CyAsMTPGetObjectComplete event.
...@@ -220,9 +220,9 @@ typedef struct cy_as_mtp_send_object_complete_data { ...@@ -220,9 +220,9 @@ typedef struct cy_as_mtp_send_object_complete_data {
*/ */
typedef struct cy_as_mtp_get_object_complete_data { typedef struct cy_as_mtp_get_object_complete_data {
cy_as_return_status_t status ; cy_as_return_status_t status;
uint32_t byte_count ; uint32_t byte_count;
} cy_as_mtp_get_object_complete_data ; } cy_as_mtp_get_object_complete_data;
/* Summary /* Summary
MTP Event callback. MTP Event callback.
...@@ -238,7 +238,7 @@ typedef void (*cy_as_mtp_event_callback)( ...@@ -238,7 +238,7 @@ typedef void (*cy_as_mtp_event_callback)(
cy_as_device_handle handle, cy_as_device_handle handle,
cy_as_mtp_event evtype, cy_as_mtp_event evtype,
void *evdata void *evdata
) ; );
/* Summary /* Summary
This is the callback function called after asynchronous API This is the callback function called after asynchronous API
...@@ -257,7 +257,7 @@ typedef void (*cy_as_mtp_function_callback)( ...@@ -257,7 +257,7 @@ typedef void (*cy_as_mtp_function_callback)(
cy_as_return_status_t status, cy_as_return_status_t status,
/* A client supplied 32 bit tag */ /* A client supplied 32 bit tag */
uint32_t client uint32_t client
) ; );
/************************************** /**************************************
* MTP Functions * MTP Functions
...@@ -310,7 +310,7 @@ cy_as_mtp_start( ...@@ -310,7 +310,7 @@ cy_as_mtp_start(
cy_as_mtp_event_callback event_c_b, cy_as_mtp_event_callback event_c_b,
cy_as_function_callback cb, cy_as_function_callback cb,
uint32_t client uint32_t client
) ; );
/* Summary /* Summary
...@@ -345,7 +345,7 @@ cy_as_mtp_stop( ...@@ -345,7 +345,7 @@ cy_as_mtp_stop(
cy_as_device_handle handle, cy_as_device_handle handle,
cy_as_function_callback cb, cy_as_function_callback cb,
uint32_t client uint32_t client
) ; );
/* Summary /* Summary
This function sets up a Turbo SendObject operation. This function sets up a Turbo SendObject operation.
...@@ -397,7 +397,7 @@ cy_as_mtp_init_send_object( ...@@ -397,7 +397,7 @@ cy_as_mtp_init_send_object(
uint32_t num_bytes, uint32_t num_bytes,
cy_as_function_callback cb, cy_as_function_callback cb,
uint32_t client uint32_t client
) ; );
/* Summary /* Summary
This function cancels an ongoing MTP operation. This function cancels an ongoing MTP operation.
...@@ -433,7 +433,7 @@ cy_as_mtp_cancel_send_object( ...@@ -433,7 +433,7 @@ cy_as_mtp_cancel_send_object(
cy_as_device_handle handle, cy_as_device_handle handle,
cy_as_function_callback cb, cy_as_function_callback cb,
uint32_t client uint32_t client
) ; );
/* Summary /* Summary
This function sets up a turbo GetObject operation. This function sets up a turbo GetObject operation.
...@@ -484,7 +484,7 @@ cy_as_mtp_init_get_object( ...@@ -484,7 +484,7 @@ cy_as_mtp_init_get_object(
uint32_t transaction_id, uint32_t transaction_id,
cy_as_function_callback cb, cy_as_function_callback cb,
uint32_t client uint32_t client
) ; );
/* Summary /* Summary
This function cancels an ongoing turbo GetObject This function cancels an ongoing turbo GetObject
...@@ -518,7 +518,7 @@ cy_as_mtp_cancel_get_object( ...@@ -518,7 +518,7 @@ cy_as_mtp_cancel_get_object(
cy_as_device_handle handle, cy_as_device_handle handle,
cy_as_function_callback cb, cy_as_function_callback cb,
uint32_t client uint32_t client
) ; );
/* Summary /* Summary
This function is used to transfer a BlockTable as part of This function is used to transfer a BlockTable as part of
...@@ -560,7 +560,7 @@ cy_as_mtp_send_block_table( ...@@ -560,7 +560,7 @@ cy_as_mtp_send_block_table(
cy_as_mtp_block_table *table, cy_as_mtp_block_table *table,
cy_as_function_callback cb, cy_as_function_callback cb,
uint32_t client uint32_t client
) ; );
/* Summary /* Summary
This function is used to mark the start of a storage This function is used to mark the start of a storage
......
...@@ -300,7 +300,7 @@ typedef enum cy_as_storage_event { ...@@ -300,7 +300,7 @@ typedef enum cy_as_storage_event {
* percieves an interrrupt from an SDIO card */ * percieves an interrrupt from an SDIO card */
cy_as_sdio_interrupt cy_as_sdio_interrupt
} cy_as_storage_event ; } cy_as_storage_event;
/* Summary /* Summary
This type gives the type of the operation in a storage This type gives the type of the operation in a storage
...@@ -322,7 +322,7 @@ typedef enum cy_as_oper_type { ...@@ -322,7 +322,7 @@ typedef enum cy_as_oper_type {
cy_as_op_read, cy_as_op_read,
/* A data write operation */ /* A data write operation */
cy_as_op_write cy_as_op_write
} cy_as_oper_type ; } cy_as_oper_type;
/* Summary /* Summary
This data structure describes a specific type of media This data structure describes a specific type of media
...@@ -337,22 +337,22 @@ typedef enum cy_as_oper_type { ...@@ -337,22 +337,22 @@ typedef enum cy_as_oper_type {
*/ */
typedef struct cy_as_device_desc { typedef struct cy_as_device_desc {
/* Type of device */ /* Type of device */
cy_as_media_type type ; cy_as_media_type type;
/* Is the device removable */ /* Is the device removable */
cy_bool removable ; cy_bool removable;
/* Is the device writeable */ /* Is the device writeable */
cy_bool writeable ; cy_bool writeable;
/* Basic block size for device */ /* Basic block size for device */
uint16_t block_size ; uint16_t block_size;
/* Number of LUNs on the device */ /* Number of LUNs on the device */
uint32_t number_units ; uint32_t number_units;
/* Is the device password locked */ /* Is the device password locked */
cy_bool locked ; cy_bool locked;
/* Size in bytes of an Erase Unit. Block erase operation /* Size in bytes of an Erase Unit. Block erase operation
is only supported for SD storage, and the erase_unit_size is only supported for SD storage, and the erase_unit_size
is invalid for all other kinds of storage. */ is invalid for all other kinds of storage. */
uint32_t erase_unit_size ; uint32_t erase_unit_size;
} cy_as_device_desc ; } cy_as_device_desc;
/* Summary /* Summary
This data structure describes a specific unit on a This data structure describes a specific unit on a
...@@ -368,14 +368,14 @@ typedef struct cy_as_device_desc { ...@@ -368,14 +368,14 @@ typedef struct cy_as_device_desc {
*/ */
typedef struct cy_as_unit_desc { typedef struct cy_as_unit_desc {
/* Type of device */ /* Type of device */
cy_as_media_type type ; cy_as_media_type type;
/* Basic block size for device */ /* Basic block size for device */
uint16_t block_size ; uint16_t block_size;
/* Physical start block for LUN */ /* Physical start block for LUN */
uint32_t start_block ; uint32_t start_block;
/* Number of blocks in the LUN */ /* Number of blocks in the LUN */
uint32_t unit_size ; uint32_t unit_size;
} cy_as_unit_desc ; } cy_as_unit_desc;
/* Summary /* Summary
This function type defines a callback to be called after an This function type defines a callback to be called after an
...@@ -404,7 +404,7 @@ typedef void (*cy_as_storage_callback)( ...@@ -404,7 +404,7 @@ typedef void (*cy_as_storage_callback)(
cy_as_oper_type op, cy_as_oper_type op,
/* The error status */ /* The error status */
cy_as_return_status_t status cy_as_return_status_t status
) ; );
/* Summary /* Summary
This function type defines a callback to be called in the This function type defines a callback to be called in the
...@@ -436,7 +436,7 @@ typedef void (*cy_as_storage_event_callback)( ...@@ -436,7 +436,7 @@ typedef void (*cy_as_storage_event_callback)(
cy_as_storage_event evtype, cy_as_storage_event evtype,
/* Event related data */ /* Event related data */
void *evdata void *evdata
) ; );
/* Summary /* Summary
This function type defines a callback to be called after This function type defines a callback to be called after
...@@ -468,7 +468,7 @@ typedef void (*cy_as_sdio_callback)( ...@@ -468,7 +468,7 @@ typedef void (*cy_as_sdio_callback)(
cy_as_oper_type op, cy_as_oper_type op,
/* The status of the operation */ /* The status of the operation */
cy_as_return_status_t status cy_as_return_status_t status
) ; );
/* Summary /* Summary
Enumeration of SD/MMC card registers that can be read Enumeration of SD/MMC card registers that can be read
...@@ -486,7 +486,7 @@ typedef enum cy_as_sd_card_reg_type { ...@@ -486,7 +486,7 @@ typedef enum cy_as_sd_card_reg_type {
cy_as_sd_reg_OCR = 0, cy_as_sd_reg_OCR = 0,
cy_as_sd_reg_CID, cy_as_sd_reg_CID,
cy_as_sd_reg_CSD cy_as_sd_reg_CSD
} cy_as_sd_card_reg_type ; } cy_as_sd_card_reg_type;
/* Summary /* Summary
Struct encapsulating parameters and return values for a Struct encapsulating parameters and return values for a
...@@ -501,12 +501,12 @@ typedef enum cy_as_sd_card_reg_type { ...@@ -501,12 +501,12 @@ typedef enum cy_as_sd_card_reg_type {
*/ */
typedef struct cy_as_storage_query_device_data { typedef struct cy_as_storage_query_device_data {
/* The bus with the device to query */ /* 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 */ /* The logical device number to query */
uint32_t device ; uint32_t device;
/* The return value for the device descriptor */ /* The return value for the device descriptor */
cy_as_device_desc desc_p ; cy_as_device_desc desc_p;
} cy_as_storage_query_device_data ; } cy_as_storage_query_device_data;
/* Summary /* Summary
...@@ -522,14 +522,14 @@ typedef struct cy_as_storage_query_device_data { ...@@ -522,14 +522,14 @@ typedef struct cy_as_storage_query_device_data {
*/ */
typedef struct cy_as_storage_query_unit_data { typedef struct cy_as_storage_query_unit_data {
/* The bus with the device to query */ /* 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 */ /* The logical device number to query */
uint32_t device ; uint32_t device;
/* The unit to query on the device */ /* The unit to query on the device */
uint32_t unit ; uint32_t unit;
/* The return value for the unit descriptor */ /* The return value for the unit descriptor */
cy_as_unit_desc desc_p ; cy_as_unit_desc desc_p;
} cy_as_storage_query_unit_data ; } cy_as_storage_query_unit_data;
/* Summary /* Summary
Struct encapsulating the input parameter and return Struct encapsulating the input parameter and return
...@@ -548,7 +548,7 @@ typedef struct cy_as_storage_sd_reg_read_data { ...@@ -548,7 +548,7 @@ typedef struct cy_as_storage_sd_reg_read_data {
uint8_t *buf_p; uint8_t *buf_p;
/* Length of data to be copied in bytes. */ /* Length of data to be copied in bytes. */
uint8_t length; uint8_t length;
} cy_as_storage_sd_reg_read_data ; } cy_as_storage_sd_reg_read_data;
/* Summary /* Summary
Controls which pins are used for card detection Controls which pins are used for card detection
...@@ -564,7 +564,7 @@ typedef struct cy_as_storage_sd_reg_read_data { ...@@ -564,7 +564,7 @@ typedef struct cy_as_storage_sd_reg_read_data {
typedef enum cy_as_storage_card_detect { typedef enum cy_as_storage_card_detect {
cy_as_storage_detect_GPIO, cy_as_storage_detect_GPIO,
cy_as_storage_detect_SDAT_3 cy_as_storage_detect_SDAT_3
} cy_as_storage_card_detect ; } cy_as_storage_card_detect;
#ifndef __doxygen__ #ifndef __doxygen__
#define cy_as_storage_detect_GPIO_0 cy_as_storage_detect_GPIO #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 { ...@@ -601,7 +601,7 @@ typedef struct cy_as_m_s_c_progress_data {
uint32_t wr_count; uint32_t wr_count;
/* Number of sectors read since the last event. */ /* Number of sectors read since the last event. */
uint32_t rd_count; uint32_t rd_count;
} cy_as_m_s_c_progress_data ; } cy_as_m_s_c_progress_data;
/* Summary /* Summary
Flag to set Direct Write operation to read back from the Flag to set Direct Write operation to read back from the
...@@ -849,7 +849,7 @@ cy_as_storage_start( ...@@ -849,7 +849,7 @@ cy_as_storage_start(
cy_as_function_callback cb, cy_as_function_callback cb,
/* Client data to be passed to the callback */ /* Client data to be passed to the callback */
uint32_t client uint32_t client
) ; );
/* Summary /* Summary
This function stops the West Bridge storage module. This function stops the West Bridge storage module.
...@@ -900,7 +900,7 @@ cy_as_storage_stop( ...@@ -900,7 +900,7 @@ cy_as_storage_stop(
cy_as_function_callback cb, cy_as_function_callback cb,
/* Client data to be passed to the callback */ /* Client data to be passed to the callback */
uint32_t client uint32_t client
) ; );
/* Summary /* Summary
This function is used to register a callback function This function is used to register a callback function
...@@ -947,7 +947,7 @@ cy_as_storage_register_callback( ...@@ -947,7 +947,7 @@ cy_as_storage_register_callback(
cy_as_device_handle handle, cy_as_device_handle handle,
/* The callback function to call for async storage events */ /* The callback function to call for async storage events */
cy_as_storage_event_callback callback cy_as_storage_event_callback callback
) ; );
/* Summary /* Summary
This function claims a given media type. This function claims a given media type.
...@@ -1007,7 +1007,7 @@ cy_as_storage_claim( ...@@ -1007,7 +1007,7 @@ cy_as_storage_claim(
cy_as_function_callback cb, cy_as_function_callback cb,
/* Client data to be passed to the callback */ /* Client data to be passed to the callback */
uint32_t client uint32_t client
) ; );
/* Summary /* Summary
This function releases a given media type. This function releases a given media type.
...@@ -1060,7 +1060,7 @@ cy_as_storage_release( ...@@ -1060,7 +1060,7 @@ cy_as_storage_release(
cy_as_function_callback cb, cy_as_function_callback cb,
/* Client data to be passed to the callback */ /* Client data to be passed to the callback */
uint32_t client uint32_t client
) ; );
/* Summary /* Summary
This function information about the number of devices present This function information about the number of devices present
...@@ -1113,7 +1113,7 @@ cy_as_storage_query_bus( ...@@ -1113,7 +1113,7 @@ cy_as_storage_query_bus(
cy_as_function_callback cb, cy_as_function_callback cb,
/* Client data to be passed to the callback */ /* Client data to be passed to the callback */
uint32_t client uint32_t client
) ; );
/* Summary /* Summary
This function information about the number of devices This function information about the number of devices
...@@ -1167,7 +1167,7 @@ cy_as_storage_query_media( ...@@ -1167,7 +1167,7 @@ cy_as_storage_query_media(
cy_as_function_callback cb, cy_as_function_callback cb,
/* Client data to be passed to the callback */ /* Client data to be passed to the callback */
uint32_t client uint32_t client
) ; );
/* Summary /* Summary
This function returns information about a given device This function returns information about a given device
...@@ -1224,7 +1224,7 @@ cy_as_storage_query_device( ...@@ -1224,7 +1224,7 @@ cy_as_storage_query_device(
cy_as_function_callback cb, cy_as_function_callback cb,
/* Client data to be passed to the callback */ /* Client data to be passed to the callback */
uint32_t client uint32_t client
) ; );
/* Summary /* Summary
This function returns information about a given unit on a This function returns information about a given unit on a
...@@ -1276,7 +1276,7 @@ cy_as_storage_query_unit( ...@@ -1276,7 +1276,7 @@ cy_as_storage_query_unit(
cy_as_function_callback cb, cy_as_function_callback cb,
/* Client data to be passed to the callback */ /* Client data to be passed to the callback */
uint32_t client uint32_t client
) ; );
/* Summary /* Summary
This function enables/disables the handling of SD/MMC card This function enables/disables the handling of SD/MMC card
...@@ -1332,7 +1332,7 @@ cy_as_storage_device_control( ...@@ -1332,7 +1332,7 @@ cy_as_storage_device_control(
cy_as_function_callback cb, cy_as_function_callback cb,
/* Client data to be passed to the callback */ /* Client data to be passed to the callback */
uint32_t client uint32_t client
) ; );
/* Summary /* Summary
This function reads one or more blocks of data from This function reads one or more blocks of data from
...@@ -1407,7 +1407,7 @@ cy_as_storage_read( ...@@ -1407,7 +1407,7 @@ cy_as_storage_read(
void *data_p, void *data_p,
/* The number of blocks to be read */ /* The number of blocks to be read */
uint16_t num_blocks uint16_t num_blocks
) ; );
/* Summary /* Summary
This function asynchronously reads one or more blocks of data This function asynchronously reads one or more blocks of data
...@@ -1490,7 +1490,7 @@ cy_as_storage_read_async( ...@@ -1490,7 +1490,7 @@ cy_as_storage_read_async(
/* The function to call when the read is complete /* The function to call when the read is complete
or an error occurs */ or an error occurs */
cy_as_storage_callback callback cy_as_storage_callback callback
) ; );
/* Summary /* Summary
This function writes one or more blocks of data This function writes one or more blocks of data
...@@ -1564,7 +1564,7 @@ cy_as_storage_write( ...@@ -1564,7 +1564,7 @@ cy_as_storage_write(
void *data_p, void *data_p,
/* The number of blocks to be written */ /* The number of blocks to be written */
uint16_t num_blocks uint16_t num_blocks
) ; );
/* Summary /* Summary
This function asynchronously writes one or more blocks This function asynchronously writes one or more blocks
...@@ -1644,7 +1644,7 @@ cy_as_storage_write_async( ...@@ -1644,7 +1644,7 @@ cy_as_storage_write_async(
/* The function to call when the write is complete /* The function to call when the write is complete
or an error occurs */ or an error occurs */
cy_as_storage_callback callback cy_as_storage_callback callback
) ; );
/* Summary /* Summary
This function aborts any outstanding asynchronous operation This function aborts any outstanding asynchronous operation
...@@ -1681,7 +1681,7 @@ EXTERN cy_as_return_status_t ...@@ -1681,7 +1681,7 @@ EXTERN cy_as_return_status_t
cy_as_storage_cancel_async( cy_as_storage_cancel_async(
/* Handle to the device with outstanding async request */ /* Handle to the device with outstanding async request */
cy_as_device_handle handle cy_as_device_handle handle
) ; );
/* Summary /* Summary
This function is used to read the content of SD registers This function is used to read the content of SD registers
...@@ -1732,7 +1732,7 @@ cy_as_storage_sd_register_read( ...@@ -1732,7 +1732,7 @@ cy_as_storage_sd_register_read(
cy_as_function_callback cb, cy_as_function_callback cb,
/* Call context to send to the cb function. */ /* Call context to send to the cb function. */
uint32_t client uint32_t client
) ; );
/* Summary /* Summary
Creates a partition starting at the given block and using the Creates a partition starting at the given block and using the
...@@ -1892,7 +1892,7 @@ cy_as_storage_get_transfer_amount( ...@@ -1892,7 +1892,7 @@ cy_as_storage_get_transfer_amount(
cy_as_function_callback cb, cy_as_function_callback cb,
/* Client context to pass to the callback */ /* Client context to pass to the callback */
uint32_t client uint32_t client
) ; );
/* Summary /* Summary
Performs a Sector Erase on an attached SD Card Performs a Sector Erase on an attached SD Card
...@@ -1949,7 +1949,7 @@ cy_as_storage_erase( ...@@ -1949,7 +1949,7 @@ cy_as_storage_erase(
cy_as_function_callback cb, cy_as_function_callback cb,
/* Client context to pass to the callback */ /* Client context to pass to the callback */
uint32_t client uint32_t client
) ; );
/* Summary /* Summary
This function is used to read a Tuple from the SDIO CIS area. This function is used to read a Tuple from the SDIO CIS area.
......
...@@ -43,7 +43,7 @@ typedef void (*cy_as_storage_callback_dep)( ...@@ -43,7 +43,7 @@ typedef void (*cy_as_storage_callback_dep)(
cy_as_oper_type op, cy_as_oper_type op,
/* The error status */ /* The error status */
cy_as_return_status_t status cy_as_return_status_t status
) ; );
typedef void (*cy_as_storage_event_callback_dep)( typedef void (*cy_as_storage_event_callback_dep)(
/* Handle to the device sending the event notification */ /* Handle to the device sending the event notification */
...@@ -54,27 +54,27 @@ typedef void (*cy_as_storage_event_callback_dep)( ...@@ -54,27 +54,27 @@ typedef void (*cy_as_storage_event_callback_dep)(
cy_as_storage_event evtype, cy_as_storage_event evtype,
/* Event related data */ /* Event related data */
void *evdata void *evdata
) ; );
typedef struct cy_as_storage_query_device_data_dep { typedef struct cy_as_storage_query_device_data_dep {
/* The type of media to query */ /* The type of media to query */
cy_as_media_type type ; cy_as_media_type type;
/* The logical device number to query */ /* The logical device number to query */
uint32_t device ; uint32_t device;
/* The return value for the device descriptor */ /* The return value for the device descriptor */
cy_as_device_desc desc_p ; cy_as_device_desc desc_p;
} cy_as_storage_query_device_data_dep ; } cy_as_storage_query_device_data_dep;
typedef struct cy_as_storage_query_unit_data_dep { typedef struct cy_as_storage_query_unit_data_dep {
/* The type of media to query */ /* The type of media to query */
cy_as_media_type type ; cy_as_media_type type;
/* The logical device number to query */ /* The logical device number to query */
uint32_t device ; uint32_t device;
/* The unit to query on the device */ /* The unit to query on the device */
uint32_t unit ; uint32_t unit;
/* The return value for the unit descriptor */ /* The return value for the unit descriptor */
cy_as_unit_desc desc_p ; cy_as_unit_desc desc_p;
} cy_as_storage_query_unit_data_dep ; } cy_as_storage_query_unit_data_dep;
/************ FUNCTIONS *********************/ /************ FUNCTIONS *********************/
...@@ -85,7 +85,7 @@ cy_as_storage_register_callback_dep( ...@@ -85,7 +85,7 @@ cy_as_storage_register_callback_dep(
cy_as_device_handle handle, cy_as_device_handle handle,
/* The callback function to call for async storage events */ /* The callback function to call for async storage events */
cy_as_storage_event_callback_dep callback cy_as_storage_event_callback_dep callback
) ; );
EXTERN cy_as_return_status_t EXTERN cy_as_return_status_t
cy_as_storage_claim_dep(cy_as_device_handle handle, cy_as_storage_claim_dep(cy_as_device_handle handle,
...@@ -102,7 +102,7 @@ cy_as_storage_claim_dep_EX( ...@@ -102,7 +102,7 @@ cy_as_storage_claim_dep_EX(
cy_as_function_callback cb, cy_as_function_callback cb,
/* Client data to be passed to the callback */ /* Client data to be passed to the callback */
uint32_t client uint32_t client
) ; );
EXTERN cy_as_return_status_t EXTERN cy_as_return_status_t
cy_as_storage_release_dep(cy_as_device_handle handle, cy_as_storage_release_dep(cy_as_device_handle handle,
...@@ -119,7 +119,7 @@ cy_as_storage_release_dep_EX( ...@@ -119,7 +119,7 @@ cy_as_storage_release_dep_EX(
cy_as_function_callback cb, cy_as_function_callback cb,
/* Client data to be passed to the callback */ /* Client data to be passed to the callback */
uint32_t client uint32_t client
) ; );
EXTERN cy_as_return_status_t EXTERN cy_as_return_status_t
cy_as_storage_query_device_dep( cy_as_storage_query_device_dep(
...@@ -139,7 +139,7 @@ cy_as_storage_query_device_dep_EX( ...@@ -139,7 +139,7 @@ cy_as_storage_query_device_dep_EX(
cy_as_function_callback cb, cy_as_function_callback cb,
/* Client data to be passed to the callback */ /* Client data to be passed to the callback */
uint32_t client uint32_t client
) ; );
EXTERN cy_as_return_status_t EXTERN cy_as_return_status_t
cy_as_storage_query_unit_dep( cy_as_storage_query_unit_dep(
...@@ -153,7 +153,7 @@ cy_as_storage_query_unit_dep( ...@@ -153,7 +153,7 @@ cy_as_storage_query_unit_dep(
uint32_t unit, uint32_t unit,
/* The return value for the unit descriptor */ /* The return value for the unit descriptor */
cy_as_unit_desc *unit_p cy_as_unit_desc *unit_p
) ; );
EXTERN cy_as_return_status_t EXTERN cy_as_return_status_t
cy_as_storage_query_unit_dep_EX( cy_as_storage_query_unit_dep_EX(
...@@ -165,7 +165,7 @@ cy_as_storage_query_unit_dep_EX( ...@@ -165,7 +165,7 @@ cy_as_storage_query_unit_dep_EX(
cy_as_function_callback cb, cy_as_function_callback cb,
/* Client data to be passed to the callback */ /* Client data to be passed to the callback */
uint32_t client uint32_t client
) ; );
EXTERN cy_as_return_status_t EXTERN cy_as_return_status_t
cy_as_storage_device_control_dep( cy_as_storage_device_control_dep(
...@@ -179,7 +179,7 @@ cy_as_storage_device_control_dep( ...@@ -179,7 +179,7 @@ cy_as_storage_device_control_dep(
cy_as_function_callback cb, cy_as_function_callback cb,
/* Client data to be passed to the callback */ /* Client data to be passed to the callback */
uint32_t client uint32_t client
) ; );
EXTERN cy_as_return_status_t EXTERN cy_as_return_status_t
...@@ -198,7 +198,7 @@ cy_as_storage_read_dep( ...@@ -198,7 +198,7 @@ cy_as_storage_read_dep(
void *data_p, void *data_p,
/* The number of blocks to be read */ /* The number of blocks to be read */
uint16_t num_blocks uint16_t num_blocks
) ; );
EXTERN cy_as_return_status_t EXTERN cy_as_return_status_t
cy_as_storage_read_async_dep( cy_as_storage_read_async_dep(
...@@ -219,7 +219,7 @@ 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 /* The function to call when the read is complete
or an error occurs */ or an error occurs */
cy_as_storage_callback_dep callback cy_as_storage_callback_dep callback
) ; );
EXTERN cy_as_return_status_t EXTERN cy_as_return_status_t
cy_as_storage_write_dep( cy_as_storage_write_dep(
/* Handle to the device of interest */ /* Handle to the device of interest */
...@@ -236,7 +236,7 @@ cy_as_storage_write_dep( ...@@ -236,7 +236,7 @@ cy_as_storage_write_dep(
void *data_p, void *data_p,
/* The number of blocks to be written */ /* The number of blocks to be written */
uint16_t num_blocks uint16_t num_blocks
) ; );
EXTERN cy_as_return_status_t EXTERN cy_as_return_status_t
cy_as_storage_write_async_dep( cy_as_storage_write_async_dep(
...@@ -257,7 +257,7 @@ 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 /* The function to call when the write is complete
or an error occurs */ or an error occurs */
cy_as_storage_callback_dep callback cy_as_storage_callback_dep callback
) ; );
EXTERN cy_as_return_status_t EXTERN cy_as_return_status_t
cy_as_storage_sd_register_read_dep( cy_as_storage_sd_register_read_dep(
...@@ -285,7 +285,7 @@ cy_as_storage_sd_register_read_dep_EX( ...@@ -285,7 +285,7 @@ cy_as_storage_sd_register_read_dep_EX(
cy_as_function_callback cb, cy_as_function_callback cb,
/* Call context to send to the cb function. */ /* Call context to send to the cb function. */
uint32_t client uint32_t client
) ; );
EXTERN cy_as_return_status_t EXTERN cy_as_return_status_t
cy_as_storage_create_p_partition_dep( cy_as_storage_create_p_partition_dep(
...@@ -294,7 +294,7 @@ cy_as_storage_create_p_partition_dep( ...@@ -294,7 +294,7 @@ cy_as_storage_create_p_partition_dep(
uint32_t device, uint32_t device,
uint32_t size, uint32_t size,
cy_as_function_callback cb, cy_as_function_callback cb,
uint32_t client) ; uint32_t client);
EXTERN cy_as_return_status_t EXTERN cy_as_return_status_t
cy_as_storage_remove_p_partition_dep( cy_as_storage_remove_p_partition_dep(
...@@ -302,7 +302,7 @@ cy_as_storage_remove_p_partition_dep( ...@@ -302,7 +302,7 @@ cy_as_storage_remove_p_partition_dep(
cy_as_media_type media, cy_as_media_type media,
uint32_t device, uint32_t device,
cy_as_function_callback cb, cy_as_function_callback cb,
uint32_t client) ; uint32_t client);
#endif /*__doxygen*/ #endif /*__doxygen*/
......
...@@ -44,18 +44,18 @@ typedef void *LPVOID; ...@@ -44,18 +44,18 @@ typedef void *LPVOID;
/* Summary /* Summary
This type represents an endpoint number 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 /* Summary
This type is used to return status information from This type is used to return status information from
an API call. an API call.
*/ */
typedef uint16_t cy_as_return_status_t ; typedef uint16_t cy_as_return_status_t;
/* Summary /* Summary
This type represents a bus number This type represents a bus number
*/ */
typedef uint32_t cy_as_bus_number_t ; typedef uint32_t cy_as_bus_number_t;
/* Summary /* Summary
All APIs provided with this release are marked extern All APIs provided with this release are marked extern
......
...@@ -213,21 +213,21 @@ ...@@ -213,21 +213,21 @@
*/ */
typedef struct cy_as_usb_inquiry_data { typedef struct cy_as_usb_inquiry_data {
/* The bus for the event */ /* The bus for the event */
cy_as_bus_number_t bus ; cy_as_bus_number_t bus;
/* The device the event */ /* The device the event */
uint32_t device ; uint32_t device;
/* The EVPD bit from the SCSI INQUIRY request */ /* The EVPD bit from the SCSI INQUIRY request */
uint8_t evpd ; uint8_t evpd;
/* The codepage in the inquiry request */ /* The codepage in the inquiry request */
uint8_t codepage ; uint8_t codepage;
/* This bool must be set to CyTrue indicate that the inquiry /* This bool must be set to CyTrue indicate that the inquiry
data was changed */ data was changed */
cy_bool updated ; cy_bool updated;
/* The length of the data */ /* The length of the data */
uint16_t length ; uint16_t length;
/* The inquiry data */ /* The inquiry data */
void *data ; void *data;
} cy_as_usb_inquiry_data ; } cy_as_usb_inquiry_data;
/* Summary /* Summary
...@@ -260,23 +260,23 @@ typedef struct cy_as_usb_inquiry_data { ...@@ -260,23 +260,23 @@ typedef struct cy_as_usb_inquiry_data {
*/ */
typedef struct cy_as_usb_unknown_command_data { typedef struct cy_as_usb_unknown_command_data {
/* The bus for the event */ /* The bus for the event */
cy_as_bus_number_t bus ; cy_as_bus_number_t bus;
/* The device for the event */ /* The device for the event */
uint32_t device ; uint32_t device;
uint16_t reqlen ; uint16_t reqlen;
/* The request */ /* The request */
void *request ; void *request;
/* The returned status value for the command */ /* The returned status value for the command */
uint8_t status ; uint8_t status;
/* If status is failed, the sense key */ /* If status is failed, the sense key */
uint8_t key ; uint8_t key;
/* If status is failed, the additional sense code */ /* If status is failed, the additional sense code */
uint8_t asc ; uint8_t asc;
/* If status if failed, the additional sense code qualifier */ /* If status if failed, the additional sense code qualifier */
uint8_t ascq ; uint8_t ascq;
} cy_as_usb_unknown_command_data ; } cy_as_usb_unknown_command_data;
/* Summary /* Summary
...@@ -293,14 +293,14 @@ typedef struct cy_as_usb_unknown_command_data { ...@@ -293,14 +293,14 @@ typedef struct cy_as_usb_unknown_command_data {
*/ */
typedef struct cy_as_usb_start_stop_data { typedef struct cy_as_usb_start_stop_data {
/* The bus for the event */ /* The bus for the event */
cy_as_bus_number_t bus ; cy_as_bus_number_t bus;
/* The device for the event */ /* The device for the event */
uint32_t device ; uint32_t device;
/* CyTrue means start request, CyFalse means stop request */ /* CyTrue means start request, CyFalse means stop request */
cy_bool start ; cy_bool start;
/* CyTrue means LoEj bit set, otherwise false */ /* CyTrue means LoEj bit set, otherwise false */
cy_bool loej ; cy_bool loej;
} cy_as_usb_start_stop_data ; } cy_as_usb_start_stop_data;
/* Summary /* Summary
This data type is used to indicate which mass storage devices This data type is used to indicate which mass storage devices
...@@ -317,7 +317,7 @@ typedef enum cy_as_usb_mass_storage_enum { ...@@ -317,7 +317,7 @@ typedef enum cy_as_usb_mass_storage_enum {
cy_as_usb_sd_enum = 0x02, cy_as_usb_sd_enum = 0x02,
cy_as_usb_mmc_enum = 0x04, cy_as_usb_mmc_enum = 0x04,
cy_as_usb_ce_ata_enum = 0x08 cy_as_usb_ce_ata_enum = 0x08
} cy_as_usb_mass_storage_enum ; } cy_as_usb_mass_storage_enum;
/* Summary /* Summary
This data type specifies the type of descriptor to transfer This data type specifies the type of descriptor to transfer
...@@ -349,7 +349,7 @@ typedef enum cy_as_usb_desc_type { ...@@ -349,7 +349,7 @@ typedef enum cy_as_usb_desc_type {
* See USB 2.0 specification Chapter 9 */ * See USB 2.0 specification Chapter 9 */
cy_as_usb_desc_h_s_configuration = 4, cy_as_usb_desc_h_s_configuration = 4,
cy_as_usb_desc_string = 5 cy_as_usb_desc_string = 5
} cy_as_usb_desc_type ; } cy_as_usb_desc_type;
/* Summary /* Summary
This type specifies the direction of an endpoint This type specifies the direction of an endpoint
...@@ -371,7 +371,7 @@ typedef enum cy_as_usb_end_point_dir { ...@@ -371,7 +371,7 @@ typedef enum cy_as_usb_end_point_dir {
cy_as_usb_out = 1, cy_as_usb_out = 1,
/* The endpoint direction is IN/OUT (valid only for EP 0 & 1) */ /* The endpoint direction is IN/OUT (valid only for EP 0 & 1) */
cy_as_usb_in_out = 2 cy_as_usb_in_out = 2
} cy_as_usb_end_point_dir ; } cy_as_usb_end_point_dir;
/* Summary /* Summary
This type specifies the type of an endpoint This type specifies the type of an endpoint
...@@ -390,7 +390,7 @@ typedef enum cy_as_usb_end_point_type { ...@@ -390,7 +390,7 @@ typedef enum cy_as_usb_end_point_type {
cy_as_usb_iso, cy_as_usb_iso,
cy_as_usb_bulk, cy_as_usb_bulk,
cy_as_usb_int cy_as_usb_int
} cy_as_usb_end_point_type ; } cy_as_usb_end_point_type;
/* Summary /* Summary
This type is a structure used to indicate the top level This type is a structure used to indicate the top level
...@@ -418,20 +418,20 @@ typedef struct cy_as_usb_enum_control { ...@@ -418,20 +418,20 @@ typedef struct cy_as_usb_enum_control {
* is false the P port controls enumeration. if the P port * is false the P port controls enumeration. if the P port
* is controlling enumeration, traffic will be received via * is controlling enumeration, traffic will be received via
* endpoint zero. */ * endpoint zero. */
cy_bool antioch_enumeration ; cy_bool antioch_enumeration;
/* This is the interface # to use for the mass storage /* This is the interface # to use for the mass storage
* interface, if mass storage is enumerated. if mass * interface, if mass storage is enumerated. if mass
* storage is not enumerated this value should be zero. */ * 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, /* This is the interface # to use for the MTP interface,
* if MTP is enumerated. if MTP is not enumerated * if MTP is enumerated. if MTP is not enumerated
* this value should be zero. */ * this value should be zero. */
uint8_t mtp_interface ; uint8_t mtp_interface;
/* If true, Inquiry, START/STOP, and unknown mass storage /* If true, Inquiry, START/STOP, and unknown mass storage
* requests cause a callback to occur for handling by the * requests cause a callback to occur for handling by the
* baseband processor. */ * baseband processor. */
cy_bool mass_storage_callbacks ; cy_bool mass_storage_callbacks;
} cy_as_usb_enum_control ; } cy_as_usb_enum_control;
/* Summary /* Summary
...@@ -448,16 +448,16 @@ typedef struct cy_as_usb_enum_control { ...@@ -448,16 +448,16 @@ typedef struct cy_as_usb_enum_control {
*/ */
typedef struct cy_as_usb_end_point_config { typedef struct cy_as_usb_end_point_config {
/* If true, this endpoint is enabled */ /* If true, this endpoint is enabled */
cy_bool enabled ; cy_bool enabled;
/* The direction of this endpoint */ /* The direction of this endpoint */
cy_as_usb_end_point_dir dir ; cy_as_usb_end_point_dir dir;
/* The type of endpoint */ /* 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 */ /* 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 */ /* The size of the endpoint in bytes */
uint16_t size ; uint16_t size;
} cy_as_usb_end_point_config ; } cy_as_usb_end_point_config;
/* Summary /* Summary
List of partition enumeration combinations that can List of partition enumeration combinations that can
...@@ -484,7 +484,7 @@ typedef enum cy_as_usb_m_s_type_t { ...@@ -484,7 +484,7 @@ typedef enum cy_as_usb_m_s_type_t {
cy_as_usb_m_s_unit1, cy_as_usb_m_s_unit1,
/* Enumerate both units */ /* Enumerate both units */
cy_as_usb_m_s_both cy_as_usb_m_s_both
} cy_as_usb_m_s_type_t ; } cy_as_usb_m_s_type_t;
/* Summary /* Summary
This type specifies the type of USB event that has occurred This type specifies the type of USB event that has occurred
...@@ -574,7 +574,7 @@ typedef void (*cy_as_usb_event_callback)( ...@@ -574,7 +574,7 @@ typedef void (*cy_as_usb_event_callback)(
cy_as_usb_event ev, cy_as_usb_event ev,
/* The data assocaited with the event being reported */ /* The data assocaited with the event being reported */
void *evdata void *evdata
) ; );
/* Summary /* Summary
...@@ -602,7 +602,7 @@ typedef void (*cy_as_usb_io_callback)( ...@@ -602,7 +602,7 @@ typedef void (*cy_as_usb_io_callback)(
void *buffer, void *buffer,
/* The error status of the operation */ /* The error status of the operation */
cy_as_return_status_t status cy_as_return_status_t status
) ; );
/* Summary /* Summary
This type is the callback function called after asynchronous This type is the callback function called after asynchronous
...@@ -621,7 +621,7 @@ typedef void (*cy_as_usb_function_callback)( ...@@ -621,7 +621,7 @@ typedef void (*cy_as_usb_function_callback)(
cy_as_return_status_t status, cy_as_return_status_t status,
/* A client supplied 32 bit tag */ /* A client supplied 32 bit tag */
uint32_t client uint32_t client
) ; );
/******************************************** /********************************************
...@@ -668,7 +668,7 @@ cy_as_usb_start( ...@@ -668,7 +668,7 @@ cy_as_usb_start(
cy_as_function_callback cb, cy_as_function_callback cb,
/* Client supplied data */ /* Client supplied data */
uint32_t client uint32_t client
) ; );
/* Summary /* Summary
This function stops the USB stack This function stops the USB stack
...@@ -713,7 +713,7 @@ cy_as_usb_stop( ...@@ -713,7 +713,7 @@ cy_as_usb_stop(
cy_as_function_callback cb, cy_as_function_callback cb,
/* Client supplied data */ /* Client supplied data */
uint32_t client uint32_t client
) ; );
/* Summary /* Summary
This function registers a callback function to be called when an This function registers a callback function to be called when an
...@@ -732,7 +732,7 @@ cy_as_usb_register_callback( ...@@ -732,7 +732,7 @@ cy_as_usb_register_callback(
cy_as_device_handle handle, cy_as_device_handle handle,
/* The function to call */ /* The function to call */
cy_as_usb_event_callback callback cy_as_usb_event_callback callback
) ; );
/* Summary /* Summary
...@@ -772,7 +772,7 @@ cy_as_usb_connect( ...@@ -772,7 +772,7 @@ cy_as_usb_connect(
cy_as_function_callback cb, cy_as_function_callback cb,
/* Client supplied data */ /* Client supplied data */
uint32_t client uint32_t client
) ; );
/* Summary /* Summary
This function disconnects the West Bridge device D+ and D- This function disconnects the West Bridge device D+ and D-
...@@ -811,7 +811,7 @@ cy_as_usb_disconnect( ...@@ -811,7 +811,7 @@ cy_as_usb_disconnect(
cy_as_function_callback cb, cy_as_function_callback cb,
/* Client supplied data */ /* Client supplied data */
uint32_t client uint32_t client
) ; );
/* Summary /* Summary
This function configures the USB stack This function configures the USB stack
...@@ -848,7 +848,7 @@ cy_as_usb_set_enum_config( ...@@ -848,7 +848,7 @@ cy_as_usb_set_enum_config(
cy_as_function_callback cb, cy_as_function_callback cb,
/* Client supplied data */ /* Client supplied data */
uint32_t client uint32_t client
) ; );
/* Summary /* Summary
This function retreives the current configuration of This function retreives the current configuration of
...@@ -884,7 +884,7 @@ cy_as_usb_get_enum_config( ...@@ -884,7 +884,7 @@ cy_as_usb_get_enum_config(
cy_as_function_callback cb, cy_as_function_callback cb,
/* Client supplied data */ /* Client supplied data */
uint32_t client uint32_t client
) ; );
/* Summary /* Summary
This function sets the USB descriptor This function sets the USB descriptor
...@@ -942,7 +942,7 @@ cy_as_usb_set_descriptor( ...@@ -942,7 +942,7 @@ cy_as_usb_set_descriptor(
cy_as_function_callback cb, cy_as_function_callback cb,
/* Client supplied data */ /* Client supplied data */
uint32_t client uint32_t client
) ; );
/* Summary /* Summary
This function clears all user descriptors stored This function clears all user descriptors stored
...@@ -985,7 +985,7 @@ cy_as_usb_clear_descriptors( ...@@ -985,7 +985,7 @@ cy_as_usb_clear_descriptors(
cy_as_function_callback cb, cy_as_function_callback cb,
/* Client supplied data */ /* Client supplied data */
uint32_t client uint32_t client
) ; );
/* Summary /* Summary
This structure contains the descriptor buffer to be This structure contains the descriptor buffer to be
filled by CyAsUsbGetDescriptor API. filled by CyAsUsbGetDescriptor API.
...@@ -1008,7 +1008,7 @@ typedef struct cy_as_get_descriptor_data { ...@@ -1008,7 +1008,7 @@ typedef struct cy_as_get_descriptor_data {
* actually returned. */ * actually returned. */
uint32_t length; uint32_t length;
} cy_as_get_descriptor_data ; } cy_as_get_descriptor_data;
/* Summary /* Summary
This function retreives a given descriptor from the This function retreives a given descriptor from the
...@@ -1059,7 +1059,7 @@ cy_as_usb_get_descriptor( ...@@ -1059,7 +1059,7 @@ cy_as_usb_get_descriptor(
cy_as_function_callback cb, cy_as_function_callback cb,
/* Client supplied data */ /* Client supplied data */
uint32_t client uint32_t client
) ; );
/* Summary /* Summary
This function sets the configuration of the physical This function sets the configuration of the physical
...@@ -1123,7 +1123,7 @@ cy_as_usb_set_physical_configuration( ...@@ -1123,7 +1123,7 @@ cy_as_usb_set_physical_configuration(
cy_as_device_handle handle, cy_as_device_handle handle,
/* The physical endpoint configuration number */ /* The physical endpoint configuration number */
uint8_t config uint8_t config
) ; );
/* Summary /* Summary
This function sets the hardware configuration for a given endpoint This function sets the hardware configuration for a given endpoint
...@@ -1166,7 +1166,7 @@ cy_as_usb_set_end_point_config( ...@@ -1166,7 +1166,7 @@ cy_as_usb_set_end_point_config(
cy_as_end_point_number_t ep, cy_as_end_point_number_t ep,
/* The configuration information for the endpoint */ /* The configuration information for the endpoint */
cy_as_usb_end_point_config *config_p cy_as_usb_end_point_config *config_p
) ; );
/* Summary /* Summary
This function retreives the hardware configuration for This function retreives the hardware configuration for
...@@ -1205,7 +1205,7 @@ cy_as_usb_get_end_point_config( ...@@ -1205,7 +1205,7 @@ cy_as_usb_get_end_point_config(
/* The return value containing the endpoint config /* The return value containing the endpoint config
* information */ * information */
cy_as_usb_end_point_config *config_p cy_as_usb_end_point_config *config_p
) ; );
/* Summary /* Summary
This function commits the configuration information that This function commits the configuration information that
...@@ -1251,7 +1251,7 @@ cy_as_usb_commit_config( ...@@ -1251,7 +1251,7 @@ cy_as_usb_commit_config(
cy_as_function_callback cb, cy_as_function_callback cb,
/* Client supplied data */ /* Client supplied data */
uint32_t client uint32_t client
) ; );
/* Summary /* Summary
This function reads data from a USB endpoint. This function reads data from a USB endpoint.
...@@ -1294,7 +1294,7 @@ cy_as_usb_read_data( ...@@ -1294,7 +1294,7 @@ cy_as_usb_read_data(
uint32_t *dataread, uint32_t *dataread,
/* The buffer to hold the data read */ /* The buffer to hold the data read */
void *data void *data
) ; );
/* Summary /* Summary
This function reads data from a USB endpoint This function reads data from a USB endpoint
...@@ -1337,7 +1337,7 @@ cy_as_usb_read_data_async( ...@@ -1337,7 +1337,7 @@ cy_as_usb_read_data_async(
void *data, void *data,
/* The callback function to call when the data is read */ /* The callback function to call when the data is read */
cy_as_usb_io_callback callback cy_as_usb_io_callback callback
) ; );
/* Summary /* Summary
This function writes data to a USB endpoint This function writes data to a USB endpoint
...@@ -1377,7 +1377,7 @@ cy_as_usb_write_data( ...@@ -1377,7 +1377,7 @@ cy_as_usb_write_data(
uint32_t dsize, uint32_t dsize,
/* The data buffer */ /* The data buffer */
void *data void *data
) ; );
/* Summary /* Summary
This function writes data to a USB endpoint This function writes data to a USB endpoint
...@@ -1421,7 +1421,7 @@ cy_as_usb_write_data_async( ...@@ -1421,7 +1421,7 @@ cy_as_usb_write_data_async(
cy_bool spacket, cy_bool spacket,
/* The callback to call when the data is written */ /* The callback to call when the data is written */
cy_as_usb_io_callback callback cy_as_usb_io_callback callback
) ; );
/* Summary /* Summary
This function aborts an outstanding asynchronous This function aborts an outstanding asynchronous
...@@ -1453,7 +1453,7 @@ cy_as_usb_cancel_async( ...@@ -1453,7 +1453,7 @@ cy_as_usb_cancel_async(
cy_as_device_handle handle, cy_as_device_handle handle,
/* The endpoint of interest */ /* The endpoint of interest */
cy_as_end_point_number_t ep cy_as_end_point_number_t ep
) ; );
/* Summary /* Summary
This function sets a stall condition on a given endpoint This function sets a stall condition on a given endpoint
...@@ -1495,7 +1495,7 @@ cy_as_usb_set_stall( ...@@ -1495,7 +1495,7 @@ cy_as_usb_set_stall(
cy_as_function_callback cb, cy_as_function_callback cb,
/* Client supplied data */ /* Client supplied data */
uint32_t client uint32_t client
) ; );
/* Summary /* Summary
This function clears a stall condition on a given endpoint This function clears a stall condition on a given endpoint
...@@ -1538,7 +1538,7 @@ cy_as_usb_clear_stall( ...@@ -1538,7 +1538,7 @@ cy_as_usb_clear_stall(
cy_as_function_callback cb, cy_as_function_callback cb,
/* Client supplied data */ /* Client supplied data */
uint32_t client uint32_t client
) ; );
/* Summary /* Summary
...@@ -1580,7 +1580,7 @@ cy_as_usb_get_stall( ...@@ -1580,7 +1580,7 @@ cy_as_usb_get_stall(
cy_as_function_callback cb, cy_as_function_callback cb,
/* Client supplied data */ /* Client supplied data */
uint32_t client uint32_t client
) ; );
/* Summary /* Summary
This function sets a NAK condition on a given endpoint This function sets a NAK condition on a given endpoint
...@@ -1622,7 +1622,7 @@ cy_as_usb_set_nak( ...@@ -1622,7 +1622,7 @@ cy_as_usb_set_nak(
cy_as_function_callback cb, cy_as_function_callback cb,
/* Client supplied data */ /* Client supplied data */
uint32_t client uint32_t client
) ; );
/* Summary /* Summary
This function clears a NAK condition on a given endpoint This function clears a NAK condition on a given endpoint
...@@ -1664,7 +1664,7 @@ cy_as_usb_clear_nak( ...@@ -1664,7 +1664,7 @@ cy_as_usb_clear_nak(
cy_as_function_callback cb, cy_as_function_callback cb,
/* Client supplied data */ /* Client supplied data */
uint32_t client uint32_t client
) ; );
/* Summary /* Summary
This function returns the NAK status for a given endpoint This function returns the NAK status for a given endpoint
...@@ -1703,7 +1703,7 @@ cy_as_usb_get_nak( ...@@ -1703,7 +1703,7 @@ cy_as_usb_get_nak(
cy_as_function_callback cb, cy_as_function_callback cb,
/* Client supplied data */ /* Client supplied data */
uint32_t client uint32_t client
) ; );
/* Summary /* Summary
This function triggers a USB remote wakeup from the Processor This function triggers a USB remote wakeup from the Processor
...@@ -1736,7 +1736,7 @@ cy_as_usb_signal_remote_wakeup( ...@@ -1736,7 +1736,7 @@ cy_as_usb_signal_remote_wakeup(
cy_as_function_callback cb, cy_as_function_callback cb,
/* Client supplied data */ /* Client supplied data */
uint32_t client uint32_t client
) ; );
/* Summary /* Summary
This function sets the threshold levels for mass storage progress This function sets the threshold levels for mass storage progress
...@@ -1784,7 +1784,7 @@ cy_as_usb_set_m_s_report_threshold( ...@@ -1784,7 +1784,7 @@ cy_as_usb_set_m_s_report_threshold(
cy_as_function_callback cb, cy_as_function_callback cb,
/* Client supplied data */ /* Client supplied data */
uint32_t client uint32_t client
) ; );
/* Summary /* Summary
Specify which of the partitions on a partitioned mass storage Specify which of the partitions on a partitioned mass storage
...@@ -1846,13 +1846,13 @@ cy_as_usb_select_m_s_partitions( ...@@ -1846,13 +1846,13 @@ cy_as_usb_select_m_s_partitions(
); );
extern cy_as_media_type 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 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 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 */ /* For supporting deprecated functions */
#include "cyasusb_dep.h" #include "cyasusb_dep.h"
......
...@@ -37,66 +37,66 @@ ...@@ -37,66 +37,66 @@
typedef struct cy_as_usb_inquiry_data_dep { typedef struct cy_as_usb_inquiry_data_dep {
/* The media for the event */ /* The media for the event */
cy_as_media_type media ; cy_as_media_type media;
/* The EVPD bit from the SCSI INQUIRY request */ /* The EVPD bit from the SCSI INQUIRY request */
uint8_t evpd ; uint8_t evpd;
/* The codepage in the inquiry request */ /* The codepage in the inquiry request */
uint8_t codepage ; uint8_t codepage;
/* This bool must be set to CyTrue indicate /* This bool must be set to CyTrue indicate
* that the inquiry data was changed */ * that the inquiry data was changed */
cy_bool updated ; cy_bool updated;
/* The length of the data */ /* The length of the data */
uint16_t length ; uint16_t length;
/* The inquiry data */ /* The inquiry data */
void *data ; void *data;
} cy_as_usb_inquiry_data_dep ; } cy_as_usb_inquiry_data_dep;
typedef struct cy_as_usb_unknown_command_data_dep { typedef struct cy_as_usb_unknown_command_data_dep {
/* The media for the event */ /* The media for the event */
cy_as_media_type media ; cy_as_media_type media;
/* The length of the requst (should be 16 bytes) */ /* The length of the requst (should be 16 bytes) */
uint16_t reqlen ; uint16_t reqlen;
/* The request */ /* The request */
void *request ; void *request;
/* The returned status value for the command */ /* The returned status value for the command */
uint8_t status ; uint8_t status;
/* If status is failed, the sense key */ /* If status is failed, the sense key */
uint8_t key ; uint8_t key;
/* If status is failed, the additional sense code */ /* If status is failed, the additional sense code */
uint8_t asc ; uint8_t asc;
/* If status if failed, the additional sense code qualifier */ /* If status if failed, the additional sense code qualifier */
uint8_t ascq ; uint8_t ascq;
} cy_as_usb_unknown_command_data_dep ; } cy_as_usb_unknown_command_data_dep;
typedef struct cy_as_usb_start_stop_data_dep { typedef struct cy_as_usb_start_stop_data_dep {
/* The media type for the event */ /* The media type for the event */
cy_as_media_type media ; cy_as_media_type media;
/* CyTrue means start request, CyFalse means stop request */ /* CyTrue means start request, CyFalse means stop request */
cy_bool start ; cy_bool start;
/* CyTrue means LoEj bit set, otherwise false */ /* CyTrue means LoEj bit set, otherwise false */
cy_bool loej ; cy_bool loej;
} cy_as_usb_start_stop_data_dep ; } cy_as_usb_start_stop_data_dep;
typedef struct cy_as_usb_enum_control_dep { typedef struct cy_as_usb_enum_control_dep {
/* The bits in this member determine which mass storage devices /* The bits in this member determine which mass storage devices
are enumerated. see cy_as_usb_mass_storage_enum for more details. */ 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 /* If true, West Bridge will control enumeration. If this is false the
pport controls enumeration. if the P port is controlling pport controls enumeration. if the P port is controlling
enumeration, traffic will be received via endpoint zero. */ 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, /* This is the interface # to use for the mass storage interface,
if mass storage is enumerated. if mass storage is not enumerated if mass storage is enumerated. if mass storage is not enumerated
this value should be zero. */ this value should be zero. */
uint8_t mass_storage_interface ; uint8_t mass_storage_interface;
/* If true, Inquiry, START/STOP, and unknown mass storage /* If true, Inquiry, START/STOP, and unknown mass storage
requests cause a callback to occur for handling by the requests cause a callback to occur for handling by the
baseband processor. */ baseband processor. */
cy_bool mass_storage_callbacks ; cy_bool mass_storage_callbacks;
} cy_as_usb_enum_control_dep ; } cy_as_usb_enum_control_dep;
typedef void (*cy_as_usb_event_callback_dep)( typedef void (*cy_as_usb_event_callback_dep)(
...@@ -106,7 +106,7 @@ 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, cy_as_usb_event ev,
/* The data assocaited with the event being reported */ /* The data assocaited with the event being reported */
void *evdata void *evdata
) ; );
...@@ -117,7 +117,7 @@ cy_as_usb_register_callback_dep( ...@@ -117,7 +117,7 @@ cy_as_usb_register_callback_dep(
cy_as_device_handle handle, cy_as_device_handle handle,
/* The function to call */ /* The function to call */
cy_as_usb_event_callback_dep callback cy_as_usb_event_callback_dep callback
) ; );
extern cy_as_return_status_t extern cy_as_return_status_t
...@@ -130,7 +130,7 @@ cy_as_usb_set_enum_config_dep( ...@@ -130,7 +130,7 @@ cy_as_usb_set_enum_config_dep(
cy_as_function_callback cb, cy_as_function_callback cb,
/* Client supplied data */ /* Client supplied data */
uint32_t client uint32_t client
) ; );
extern cy_as_return_status_t extern cy_as_return_status_t
...@@ -143,7 +143,7 @@ cy_as_usb_get_enum_config_dep( ...@@ -143,7 +143,7 @@ cy_as_usb_get_enum_config_dep(
cy_as_function_callback cb, cy_as_function_callback cb,
/* Client supplied data */ /* Client supplied data */
uint32_t client uint32_t client
) ; );
extern cy_as_return_status_t extern cy_as_return_status_t
cy_as_usb_get_descriptor_dep( cy_as_usb_get_descriptor_dep(
...@@ -159,7 +159,7 @@ 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 points to a uint32_t that contains the length of the buffer. after
the call, this value contains the amount of data actually returned. */ the call, this value contains the amount of data actually returned. */
uint32_t *length_p uint32_t *length_p
) ; );
extern cy_as_return_status_t extern cy_as_return_status_t
cy_as_usb_set_stall_dep( cy_as_usb_set_stall_dep(
...@@ -171,7 +171,7 @@ cy_as_usb_set_stall_dep( ...@@ -171,7 +171,7 @@ cy_as_usb_set_stall_dep(
cy_as_usb_function_callback cb, cy_as_usb_function_callback cb,
/* Client supplied data */ /* Client supplied data */
uint32_t client uint32_t client
) ; );
EXTERN cy_as_return_status_t EXTERN cy_as_return_status_t
cy_as_usb_clear_stall_dep( cy_as_usb_clear_stall_dep(
...@@ -183,7 +183,7 @@ cy_as_usb_clear_stall_dep( ...@@ -183,7 +183,7 @@ cy_as_usb_clear_stall_dep(
cy_as_usb_function_callback cb, cy_as_usb_function_callback cb,
/* Client supplied data */ /* Client supplied data */
uint32_t client uint32_t client
) ; );
EXTERN cy_as_return_status_t EXTERN cy_as_return_status_t
cy_as_usb_set_nak_dep( cy_as_usb_set_nak_dep(
...@@ -195,7 +195,7 @@ cy_as_usb_set_nak_dep( ...@@ -195,7 +195,7 @@ cy_as_usb_set_nak_dep(
cy_as_usb_function_callback cb, cy_as_usb_function_callback cb,
/* Client supplied data */ /* Client supplied data */
uint32_t client uint32_t client
) ; );
EXTERN cy_as_return_status_t EXTERN cy_as_return_status_t
cy_as_usb_clear_nak_dep( cy_as_usb_clear_nak_dep(
...@@ -207,7 +207,7 @@ cy_as_usb_clear_nak_dep( ...@@ -207,7 +207,7 @@ cy_as_usb_clear_nak_dep(
cy_as_usb_function_callback cb, cy_as_usb_function_callback cb,
/* Client supplied data */ /* Client supplied data */
uint32_t client uint32_t client
) ; );
EXTERN cy_as_return_status_t EXTERN cy_as_return_status_t
cy_as_usb_select_m_s_partitions_dep( cy_as_usb_select_m_s_partitions_dep(
...@@ -217,7 +217,7 @@ 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_usb_m_s_type_t type,
cy_as_function_callback cb, cy_as_function_callback cb,
uint32_t client uint32_t client
) ; );
#endif /*__doxygen*/ #endif /*__doxygen*/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment