Added missing astyle corrections for usb/device/targets/*

pull/10166/head
Cruz Monrreal II 2019-03-19 17:10:32 -05:00
parent da208393c4
commit a1c047aba4
10 changed files with 132 additions and 127 deletions

View File

@ -96,7 +96,8 @@ static ctrl_xfer_t ctrl_xfer = CTRL_XFER_READY;
static uint32_t Data1 = 0x55555555;
static uint32_t frameNumber() {
static uint32_t frameNumber()
{
return ((USB0->FRMNUML | (USB0->FRMNUMH << 8)) & 0x07FF);
}
@ -466,8 +467,7 @@ bool USBPhyHw::endpoint_read_core(usb_ep_t endpoint, uint32_t max_packet)
bdt[idx].byte_count = max_packet;
if ((Data1 >> DESC_TO_PHY(endpoint)) & 1) {
bdt[idx].info = BD_OWN_MASK | BD_DTS_MASK | BD_DATA01_MASK;
}
else {
} else {
bdt[idx].info = BD_OWN_MASK | BD_DTS_MASK;
}
@ -632,8 +632,9 @@ void USBPhyHw::process()
// stall interrupt
if (istat & 1 << 7) {
if (USB0->ENDPOINT[0].ENDPT & USB_ENDPT_EPSTALL_MASK)
if (USB0->ENDPOINT[0].ENDPT & USB_ENDPT_EPSTALL_MASK) {
USB0->ENDPOINT[0].ENDPT &= ~USB_ENDPT_EPSTALL_MASK;
}
USB0->ISTAT = USB_ISTAT_STALL_MASK;
}
@ -660,9 +661,9 @@ void USBPhyHw::process()
} else {
// OUT packet
if (rx_en && (TOK_PID((EP_BDT_IDX(num, dir, ev_odd))) == OUT_TOKEN)) {
if (num == 0)
if (num == 0) {
events->ep0_out();
else {
} else {
epComplete |= EP(phy_ep);
events->out(PHY_TO_DESC(phy_ep));
}
@ -676,8 +677,7 @@ void USBPhyHw::process()
USB0->ADDR = addr & 0x7F;
set_addr = 0;
}
}
else {
} else {
epComplete |= EP(phy_ep);
events->in(PHY_TO_DESC(phy_ep));
}
@ -713,7 +713,8 @@ void USBPhyHw::process()
NVIC_EnableIRQ(USB0_IRQn);
}
void USBPhyHw::_usbisr(void) {
void USBPhyHw::_usbisr(void)
{
NVIC_DisableIRQ(USB0_IRQn);
instance->events->start_process();
}

View File

@ -502,11 +502,17 @@ bool USBPhyHw::endpoint_read(usb_ep_t endpoint, uint8_t *data, uint32_t size)
/* Set Transaction counter */
p_reg = get_pipetre_reg(pipe);
if (p_reg != NULL) *p_reg |= USB_TRCLR;
if (p_reg != NULL) {
*p_reg |= USB_TRCLR;
}
p_reg = get_pipetrn_reg(pipe);
if (p_reg != NULL) *p_reg = trncnt;
if (p_reg != NULL) {
*p_reg = trncnt;
}
p_reg = get_pipetre_reg(pipe);
if (p_reg != NULL) *p_reg |= USB_TRENB;
if (p_reg != NULL) {
*p_reg |= USB_TRENB;
}
p_reg = get_pipectr_reg(pipe);
/* Buffer Clear */
@ -701,14 +707,12 @@ void USBPhyHw::process()
}
events->ep0_out();
}
}
else if (((ists0 & USB_BEMP) == USB_BEMP) && ((ests & USB_BEMP0) == USB_BEMP0)) {
} else if (((ists0 & USB_BEMP) == USB_BEMP) && ((ests & USB_BEMP0) == USB_BEMP0)) {
/* ==== BEMP PIPE0 ==== */
USB_MX.BEMPSTS = (uint16_t)((~USB_BEMP0) & BEMPSTS_MASK);
events->ep0_in();
}
else if (((ists0 & USB_NRDY) == USB_NRDY) && ((nsts & USB_NRDY0) == USB_NRDY0)) {
} else if (((ists0 & USB_NRDY) == USB_NRDY) && ((nsts & USB_NRDY0) == USB_NRDY0)) {
/* ==== NRDY PIPE0 ==== */
USB_MX.NRDYSTS = (uint16_t)((~USB_NRDY0) & NRDYSTS_MASK);
/* Non processing. */
@ -783,8 +787,7 @@ void USBPhyHw::process()
}
}
}
}
else if ((ists0 & USB_BEMP) == USB_BEMP) {
} else if ((ists0 & USB_BEMP) == USB_BEMP) {
/* ==== BEMP PIPEx ==== */
USB_MX.BEMPSTS = (uint16_t)((~ests) & BEMPSTS_MASK);
@ -806,8 +809,7 @@ void USBPhyHw::process()
}
}
}
}
else if ((ists0 & USB_NRDY) == USB_NRDY) {
} else if ((ists0 & USB_NRDY) == USB_NRDY) {
/* ==== NRDY PIPEx ==== */
USB_MX.NRDYSTS = (uint16_t)((~nsts) & NRDYSTS_MASK);
@ -821,8 +823,7 @@ void USBPhyHw::process()
}
}
}
}
else {
} else {
/* Non processing. */
}
}

View File

@ -53,8 +53,7 @@ uint32_t HAL_PCDEx_GetTxFiFo(PCD_HandleTypeDef *hpcd, uint8_t fifo)
uint32_t len;
if (fifo == 0) {
len = hpcd->Instance->DIEPTXF0_HNPTXFSIZ >> 16;
}
else {
} else {
len = hpcd->Instance->DIEPTXF[fifo - 1] >> 16;
}
return len * 4;
@ -522,7 +521,9 @@ bool USBPhyHw::endpoint_write(usb_ep_t endpoint, uint8_t *data, uint32_t size)
ret = HAL_PCD_EP_Transmit(&hpcd, endpoint, data, size);
MBED_ASSERT(ret != HAL_BUSY);
// update the status
if (ret != HAL_OK) return false;
if (ret != HAL_OK) {
return false;
}
// fix me return is too simple
return true;
}
@ -541,7 +542,8 @@ void USBPhyHw::process()
NVIC_EnableIRQ(USBHAL_IRQn);
}
void USBPhyHw::_usbisr(void) {
void USBPhyHw::_usbisr(void)
{
NVIC_DisableIRQ(USBHAL_IRQn);
instance->events->start_process();
}

View File

@ -304,7 +304,8 @@ void USBPhyHw::process()
NVIC_EnableIRQ(USB_IRQn);
}
void USBPhyHw::_usbisr(void) {
void USBPhyHw::_usbisr(void)
{
NVIC_DisableIRQ(USB_IRQn);
instance->events->start_process();
}