FreeCalypso > hg > freecalypso-sw
changeset 170:4b53bd08f345
gsm-fw/riviera/rvt/rvt_task.c: formatting (readability) cleanup
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Wed, 20 Nov 2013 04:05:18 +0000 |
parents | e01e3a60c858 |
children | 4d8e4c58df71 |
files | gsm-fw/riviera/rvt/rvt_task.c |
diffstat | 1 files changed, 150 insertions(+), 151 deletions(-) [+] |
line wrap: on
line diff
--- a/gsm-fw/riviera/rvt/rvt_task.c Wed Nov 20 02:58:35 2013 +0000 +++ b/gsm-fw/riviera/rvt/rvt_task.c Wed Nov 20 04:05:18 2013 +0000 @@ -45,25 +45,25 @@ #define RVT_WAIT_FOR_DATA (2) -/********************************************************************************/ -/* */ -/* Function Name: rvt_task_core */ -/* */ -/* Purpose: Core of Trace task. */ -/* */ -/* Input Parameters: */ -/* None. */ -/* */ -/* Output Parameters: */ -/* None. */ -/* */ -/* Global Parameters: */ -/* None. */ -/* */ -/* Note: */ -/* None. */ -/* */ -/********************************************************************************/ +/******************************************************************************/ +/* */ +/* Function Name: rvt_task_core */ +/* */ +/* Purpose: Core of Trace task. */ +/* */ +/* Input Parameters: */ +/* None. */ +/* */ +/* Output Parameters: */ +/* None. */ +/* */ +/* Global Parameters: */ +/* None. */ +/* */ +/* Note: */ +/* None. */ +/* */ +/******************************************************************************/ T_RVM_RETURN rvt_task_core (void) { UINT16 event = 0; @@ -391,30 +391,30 @@ } // End of if (event & (RVF_TIMER_0_EVT_MASK)) } - #endif + #endif } -/********************************************************************************/ -/* */ -/* Function Name: rvt_RX_process */ -/* */ -/* Purpose: This function is called when characters are received */ -/* on the serial port on receive HISR. */ -/* */ -/* Input Parameters: */ -/* None. */ -/* */ -/* Output Parameters: */ -/* None. */ -/* */ -/* Global Parameters: */ -/* None. */ -/* */ -/* Note: */ -/* None. */ -/* */ -/********************************************************************************/ +/******************************************************************************/ +/* */ +/* Function Name: rvt_RX_process */ +/* */ +/* Purpose: This function is called when characters are received */ +/* on the serial port on receive HISR. */ +/* */ +/* Input Parameters: */ +/* None. */ +/* */ +/* Output Parameters: */ +/* None. */ +/* */ +/* Global Parameters: */ +/* None. */ +/* */ +/* Note: */ +/* None. */ +/* */ +/******************************************************************************/ void rvt_RX_process (void) { UINT32 bytesRead; @@ -427,134 +427,133 @@ freecalypso_lldbg_intinfo(); */ - #ifdef FRAMING_PROTOCOL - BOOL eof = 0; - static UINT8 rcv_state = RVT_WAIT_FOR_HEADER; - static UINT32 total_bytesRead = 0; - static RVT_CALLBACK_FUNC rx_callback_func = NULL; + #ifdef FRAMING_PROTOCOL + BOOL eof = 0; + static UINT8 rcv_state = RVT_WAIT_FOR_HEADER; + static UINT32 total_bytesRead = 0; + static RVT_CALLBACK_FUNC rx_callback_func = NULL; - // Get all bytes from the UART RX FIFO - for (; - ; - ) + // Get all bytes from the UART RX FIFO + for (; ; ) + { + // Read and destuff the UART RX FIFO and fill inBuffer with received + // bytes + bytesRead = SER_tr_ReadNBytes (SER_LAYER_1, + (char *) (inBuffer + total_bytesRead), + sizeof (inBuffer) - total_bytesRead, + &eof); + + // Check for the header. Hence, get the sendee + if ((rcv_state == RVT_WAIT_FOR_HEADER) && \ + (bytesRead) && \ + !(total_bytesRead)) + { + if ((inBuffer[0] == RVT_RV_HEADER) || \ + (inBuffer[0] == RVT_L1_HEADER) || \ + (inBuffer[0] == RVT_L23_HEADER) || \ + (inBuffer[0] == RVT_TM_HEADER) || \ + (inBuffer[0] == RVT_RNET_HEADER) || \ + (inBuffer[0] == RVT_PROF_HEADER) || \ + (inBuffer[0] == RVT_GTTBACK_HEADER) || \ + (inBuffer[0] == RVT_OTHER_HEADER)) { - // Read and destuff the UART RX FIFO and fill inBuffer with received - // bytes - bytesRead = SER_tr_ReadNBytes (SER_LAYER_1, - (char *) (inBuffer + total_bytesRead), - sizeof (inBuffer) - total_bytesRead, - &eof); + UINT8 idtab = 0; - // Check for the header. Hence, get the sendee - if ((rcv_state == RVT_WAIT_FOR_HEADER) && \ - (bytesRead) && \ - !(total_bytesRead)) + // Search for the ID in the table + for (idtab = 0; + rvt_user_db[idtab].user_id != RVT_INVALID_HEADER; + idtab++) + { + if (rvt_user_db[idtab].user_id == inBuffer[0]) { - if ((inBuffer[0] == RVT_RV_HEADER) || \ - (inBuffer[0] == RVT_L1_HEADER) || \ - (inBuffer[0] == RVT_L23_HEADER) || \ - (inBuffer[0] == RVT_TM_HEADER) || \ - (inBuffer[0] == RVT_RNET_HEADER) || \ - (inBuffer[0] == RVT_PROF_HEADER) || \ - (inBuffer[0] == RVT_GTTBACK_HEADER) || \ - (inBuffer[0] == RVT_OTHER_HEADER)) - { - UINT8 idtab = 0; - - // Search for the ID in the table - for (idtab = 0; - rvt_user_db[idtab].user_id != RVT_INVALID_HEADER; - idtab++) - { - if (rvt_user_db[idtab].user_id == inBuffer[0]) - { - rx_callback_func = rvt_user_db[idtab].rx_callback_func; - break; - } - } - rcv_state = RVT_WAIT_FOR_DATA; - } + rx_callback_func = + rvt_user_db[idtab].rx_callback_func; + break; } + } + rcv_state = RVT_WAIT_FOR_DATA; + } + } - // Update the total number of bytes read, regarding the current frame - total_bytesRead += bytesRead; + // Update the total number of bytes read, + // regarding the current frame + total_bytesRead += bytesRead; - // Call the corresponding callback function when a complete message is - // received (eof odd) - if (eof & 0x01) - { - // Invoke the callback function - if (rx_callback_func != NULL) - { - rx_callback_func ((T_RVT_BUFFER) (inBuffer + 1), - total_bytesRead - 1); - rx_callback_func = NULL; - } + // Call the corresponding callback function when a complete message + // is received (eof odd) + if (eof & 0x01) + { + // Invoke the callback function + if (rx_callback_func != NULL) + { + rx_callback_func ((T_RVT_BUFFER) (inBuffer + 1), + total_bytesRead - 1); + rx_callback_func = NULL; + } - // Wait for the next frame to come - rcv_state = RVT_WAIT_FOR_HEADER; - total_bytesRead = 0; - } + // Wait for the next frame to come + rcv_state = RVT_WAIT_FOR_HEADER; + total_bytesRead = 0; + } - // inBuffer may be full due to some synchro lost problems - else if (total_bytesRead == sizeof (inBuffer)) - { - // If still waiting for the header, discard received characters and - // reset static variables for the next frame to come - if (rcv_state == RVT_WAIT_FOR_HEADER) - { - total_bytesRead = 0; - break; - } + // inBuffer may be full due to some synchro lost problems + else if (total_bytesRead == sizeof (inBuffer)) + { + // If still waiting for the header, discard received characters + // and reset static variables for the next frame to come + if (rcv_state == RVT_WAIT_FOR_HEADER) + { + total_bytesRead = 0; + break; + } - // Just discard characters received as payload - total_bytesRead = sizeof (inBuffer[0]); - } + // Just discard characters received as payload + total_bytesRead = sizeof (inBuffer[0]); + } - // Proceed with the next concatenated frame whether more bytes left - if (eof > 1) - { - continue; - } - break; - } - #else + // Proceed with the next concatenated frame whether more bytes left + if (eof > 1) + { + continue; + } + break; + } + #else - // Read the UART RX FIFO and fill inBuffer with received bytes - bytesRead = SER_tr_ReadNChars (SER_LAYER_1, - (char *) inBuffer, - sizeof (inBuffer)); + // Read the UART RX FIFO and fill inBuffer with received bytes + bytesRead = SER_tr_ReadNChars (SER_LAYER_1, + (char *) inBuffer, + sizeof (inBuffer)); - // Invoke the Testmode callback function : this is the only one able, - // for the moment, to send an external command !! WARNING : This - // should be the same name than the one already registered in - // create_RVtasks.c. - tm_receive ((T_RVT_BUFFER) inBuffer, - bytesRead); - #endif + // Invoke the Testmode callback function : this is the only one able, + // for the moment, to send an external command !! WARNING : This + // should be the same name than the one already registered in + // create_RVtasks.c. + tm_receive ((T_RVT_BUFFER) inBuffer, bytesRead); + #endif } -/********************************************************************************/ -/* */ -/* Function Name: rvt_activate_RX_HISR */ -/* */ -/* Purpose: This function is called when an RX interrupt occurs. */ -/* */ -/* Input Parameters: */ -/* None. */ -/* */ -/* Output Parameters: */ -/* None. */ -/* */ -/* Global Parameters: */ -/* None. */ -/* */ -/* Note: */ -/* None. */ -/* */ -/********************************************************************************/ +/******************************************************************************/ +/* */ +/* Function Name: rvt_activate_RX_HISR */ +/* */ +/* Purpose: This function is called when an RX interrupt occurs. */ +/* */ +/* Input Parameters: */ +/* None. */ +/* */ +/* Output Parameters: */ +/* None. */ +/* */ +/* Global Parameters: */ +/* None. */ +/* */ +/* Note: */ +/* None. */ +/* */ +/******************************************************************************/ void rvt_activate_RX_HISR (void) { NU_Activate_HISR (&TI_rcv_HISR);