Updated tool and style fixes.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@12817 27425a3e-05d8-49a3-a47f-9c15f0e5edd8
This commit is contained in:
Giovanni Di Sirio 2019-05-26 08:53:44 +00:00
parent b2310dc96f
commit 0e03236831
15 changed files with 138 additions and 41 deletions

View File

@ -74,12 +74,12 @@
* @brief Driver state machine possible states.
*/
typedef enum {
I2C_UNINIT = 0, /**< Not initialized. */
I2C_STOP = 1, /**< Stopped. */
I2C_READY = 2, /**< Ready. */
I2C_ACTIVE_TX = 3, /**< Transmitting. */
I2C_ACTIVE_RX = 4, /**< Receiving. */
I2C_LOCKED = 5 /**> Bus or driver locked. */
I2C_UNINIT = 0, /**< @brief Not initialized. */
I2C_STOP = 1, /**< @brief Stopped. */
I2C_READY = 2, /**< @brief Ready. */
I2C_ACTIVE_TX = 3, /**< @brief Transmitting. */
I2C_ACTIVE_RX = 4, /**< @brief Receiving. */
I2C_LOCKED = 5 /**< @brief Bus locked. */
} i2cstate_t;
#include "hal_i2c_lld.h"

View File

@ -117,7 +117,7 @@ typedef struct {
* @brief Current configuration data.
*/
const MMCConfig *config;
/***
/**
* @brief Addresses use blocks instead of bytes.
*/
bool block_addresses;

View File

@ -743,7 +743,7 @@ void i2c_lld_start(I2CDriver *i2cp) {
i2cp->txdmamode |= STM32_DMA_CR_CHSEL(I2C2_TX_DMA_CHANNEL) |
STM32_DMA_CR_PL(STM32_I2C_I2C2_DMA_PRIORITY);
}
#endif /*STM32_I2C_USE_DMA == TRUE */
#endif /* STM32_I2C_USE_DMA == TRUE */
#if defined(STM32_I2C2_GLOBAL_NUMBER) || defined(__DOXYGEN__)
nvicEnableVector(STM32_I2C2_GLOBAL_NUMBER, STM32_I2C_I2C2_IRQ_PRIORITY);
@ -779,7 +779,7 @@ void i2c_lld_start(I2CDriver *i2cp) {
i2cp->txdmamode |= STM32_DMA_CR_CHSEL(I2C3_TX_DMA_CHANNEL) |
STM32_DMA_CR_PL(STM32_I2C_I2C3_DMA_PRIORITY);
}
#endif /*STM32_I2C_USE_DMA == TRUE */
#endif /* STM32_I2C_USE_DMA == TRUE */
#if defined(STM32_I2C3_GLOBAL_NUMBER) || defined(__DOXYGEN__)
nvicEnableVector(STM32_I2C3_GLOBAL_NUMBER, STM32_I2C_I2C3_IRQ_PRIORITY);
@ -815,7 +815,7 @@ void i2c_lld_start(I2CDriver *i2cp) {
i2cp->txdmamode |= STM32_DMA_CR_CHSEL(I2C4_TX_DMA_CHANNEL) |
STM32_DMA_CR_PL(STM32_I2C_I2C4_DMA_PRIORITY);
}
#endif /*STM32_I2C_USE_DMA == TRUE */
#endif /* STM32_I2C_USE_DMA == TRUE */
#if defined(STM32_I2C4_GLOBAL_NUMBER) || defined(__DOXYGEN__)
nvicEnableVector(STM32_I2C4_GLOBAL_NUMBER, STM32_I2C_I2C4_IRQ_PRIORITY);

View File

@ -866,7 +866,7 @@ void i2c_lld_start(I2CDriver *i2cp) {
dmaSetRequestSource(i2cp->rx.dma, STM32_DMAMUX1_I2C2_RX);
dmaSetRequestSource(i2cp->tx.dma, STM32_DMAMUX1_I2C2_TX);
}
#endif /*STM32_I2C_USE_DMA == TRUE */
#endif /* STM32_I2C_USE_DMA == TRUE */
}
#endif /* STM32_I2C_USE_I2C2 */
@ -893,7 +893,7 @@ void i2c_lld_start(I2CDriver *i2cp) {
dmaSetRequestSource(i2cp->rx.dma, STM32_DMAMUX1_I2C3_RX);
dmaSetRequestSource(i2cp->tx.dma, STM32_DMAMUX1_I2C3_TX);
}
#endif /*STM32_I2C_USE_DMA == TRUE */
#endif /* STM32_I2C_USE_DMA == TRUE */
}
#endif /* STM32_I2C_USE_I2C3 */
@ -920,7 +920,7 @@ void i2c_lld_start(I2CDriver *i2cp) {
bdmaSetRequestSource(i2cp->rx.bdma, STM32_DMAMUX2_I2C4_RX);
bdmaSetRequestSource(i2cp->tx.bdma, STM32_DMAMUX2_I2C4_TX);
}
#endif /*STM32_I2C_USE_DMA == TRUE */
#endif /* STM32_I2C_USE_DMA == TRUE */
}
#endif /* STM32_I2C_USE_I2C4 */
}

View File

@ -512,7 +512,7 @@ static void otg_isoc_out_failed_handler(USBDriver *usbp) {
/*otgp->oe[ep].DOEPCTL |= (DOEPCTL_EPDIS | DOEPCTL_SNAK);
while (otgp->oe[ep].DOEPCTL & DOEPCTL_EPENA)
;*/
/* Prepare transfer for next frame */
/* Prepare transfer for next frame.*/
_usb_isr_invoke_out_cb(usbp, ep);
}
}

View File

@ -110,7 +110,7 @@ static bool sdc_lld_prepare_read_bytes(SDCDriver *sdcp,
/* Transaction starts just after DTEN bit setting.*/
sdcp->sdio->DCTRL = SDIO_DCTRL_DTDIR |
SDIO_DCTRL_DTMODE | /* multibyte data transfer */
SDIO_DCTRL_DTMODE | /* Multibyte data transfer.*/
SDIO_DCTRL_DMAEN |
SDIO_DCTRL_DTEN;
@ -228,10 +228,6 @@ static bool sdc_lld_wait_transaction_end(SDCDriver *sdcp, uint32_t n,
sdcp->sdio->ICR = STM32_SDIO_ICR_ALL_FLAGS;
sdcp->sdio->DCTRL = 0;
osalSysUnlock();
/* Wait until interrupt flags to be cleared.*/
/*while (((DMA2->LISR) >> (sdcp->dma->ishift)) & STM32_DMA_ISR_TCIF)
dmaStreamClearInterrupt(sdcp->dma);*/
#else
/* Waits for transfer completion at DMA level, then the stream is
disabled and cleared.*/

View File

@ -150,7 +150,7 @@ static bool sdc_lld_prepare_read_bytes(SDCDriver *sdcp,
/* Transaction starts just after DTEN bit setting.*/
sdcp->sdmmc->DCTRL = SDMMC_DCTRL_DTDIR |
SDMMC_DCTRL_DTMODE | /* multibyte data transfer */
SDMMC_DCTRL_DTMODE | /* Multibyte data transfer.*/
SDMMC_DCTRL_DMAEN |
SDMMC_DCTRL_DTEN;

View File

@ -82,7 +82,7 @@ static size_t iq_read(input_queue_t *iqp, uint8_t *bp, size_t n) {
memcpy((void *)bp, (void *)iqp->q_buffer, s2);
iqp->q_rdptr = iqp->q_buffer + s2;
}
else { /* n == s1 */
else {
memcpy((void *)bp, (void *)iqp->q_rdptr, n);
iqp->q_rdptr = iqp->q_buffer;
}
@ -130,7 +130,7 @@ static size_t oq_write(output_queue_t *oqp, const uint8_t *bp, size_t n) {
memcpy((void *)oqp->q_buffer, (const void *)bp, s2);
oqp->q_wrptr = oqp->q_buffer + s2;
}
else { /* n == s1 */
else {
memcpy((void *)oqp->q_wrptr, (const void *)bp, n);
oqp->q_wrptr = oqp->q_buffer;
}

View File

@ -258,7 +258,7 @@ void rtcConvertStructTmToDateTime(const struct tm *timp,
timespec->day = (uint32_t)timp->tm_mday;
timespec->dayofweek = (uint32_t)timp->tm_wday + 1U;
if (-1 == timp->tm_isdst) {
timespec->dstflag = 0U; /* set zero if dst is unknown */
timespec->dstflag = 0U; /* Set zero if dst is unknown.*/
}
else {
timespec->dstflag = (uint32_t)timp->tm_isdst;
@ -293,7 +293,7 @@ uint32_t rtcConvertDateTimeToFAT(const RTCDateTime *timespec) {
day = timespec->day;
month = timespec->month;
/* handle DST flag */
/* Handle DST flag.*/
if (1U == timespec->dstflag) {
hour += 1U;
if (hour == 24U) {

View File

@ -129,7 +129,7 @@ static size_t pipe_write(pipe_t *pp, const uint8_t *bp, size_t n) {
memcpy((void *)pp->buffer, (const void *)bp, s2);
pp->wrptr = pp->buffer + s2;
}
else { /* n == s1 */
else {
memcpy((void *)pp->wrptr, (const void *)bp, n);
pp->wrptr = pp->buffer;
}
@ -180,7 +180,7 @@ static size_t pipe_read(pipe_t *pp, uint8_t *bp, size_t n) {
memcpy((void *)bp, (void *)pp->buffer, s2);
pp->rdptr = pp->buffer + s2;
}
else { /* n == s1 */
else {
memcpy((void *)bp, (void *)pp->rdptr, n);
pp->rdptr = pp->buffer;
}

View File

@ -423,7 +423,7 @@ static inline void chVTDoTickI(void) {
fn = vtp->func;
vtp->func = NULL;
/* if the list becomes empty then the timer is stopped.*/
/* If the list becomes empty then the timer is stopped.*/
if (ch.vtlist.next == (virtual_timer_t *)&ch.vtlist) {
port_timer_stop_alarm();
}
@ -439,7 +439,7 @@ static inline void chVTDoTickI(void) {
while (vtp->delta <= nowdelta);
}
/* if the list is empty, nothing else to do.*/
/* If the list is empty, nothing else to do.*/
if (ch.vtlist.next == (virtual_timer_t *)&ch.vtlist) {
return;
}

View File

@ -605,6 +605,6 @@ void chSchDoReschedule(void) {
/* Swap operation as tail call.*/
chSysSwitch(currp, otp);
}
#endif /*!defined(CH_SCH_DO_RESCHEDULE_HOOKED) */
#endif /* !defined(CH_SCH_DO_RESCHEDULE_HOOKED) */
/** @} */

View File

@ -24,8 +24,6 @@ $filename = basename($filename);
my $cr = "\r";
my $lf = "\n";
my $tab = "\t";
my $c_comment = "";
my $state = "start";
sub style {
my $desc = shift;
@ -40,10 +38,57 @@ sub error {
}
my $emptycnt = 0;
my $c_comment_complete = 0;
my $c_comment = "";
my $state = "start";
foreach my $line (@c_source) {
$lineno += 1;
#****************************************************************************
# Processing comments after decoding.
if ($c_comment_complete != 0) {
# print($c_comment . "\n");
#******************************************************************************
# Special case of lint comment.
if ("$c_comment" =~ /^\s*\/\*lint/) {
}
else {
#******************************************************************************
# Check on glued doxygen back-comment start.
if ("$c_comment" =~ /^\s*\/\*\*<[^\s]/) {
style "detected glued doxygen back-comment start";
}
#******************************************************************************
# Check on glued doxygen comment start.
if ("$c_comment" =~ /^\s*\/\*\*[^\s<]/) {
style "detected glued doxygen comment start";
}
#******************************************************************************
# Check on glued comment start.
if ("$c_comment" =~ /^\s*\/\*[^\s\*=]/) {
style "detected glued comment start";
}
#******************************************************************************
# Check on lower case letter at comment beginning.
if ("$c_comment" =~ /^\s*\/\*\s*[a-z]/) {
style "detected lower case comment start";
}
#******************************************************************************
# Check on loose comment stop.
# if ("$line" =~ /\s\*\//) {
# style "detected loose comment stop";
# }
}
$c_comment_complete = 0;
}
#****************************************************************************
# Check on EOL.
if (not ($line =~ /$cr$lf$/)) {
@ -91,17 +136,25 @@ foreach my $line (@c_source) {
# State machine handling.
if ($state eq "start") {
#******************************************************************************
# Standard separator.
#******************************************************************************
# Comment start matching.
if ("$line" =~ /^\s*\/\*/) {
if ("$line" =~ /\/\*/) {
#******************************************************************************
# Single or multi line comments.
if ("$line" =~ /\*\//) {
# Special case of single line comments.
$line =~ /^\s*(\/\*.*\*\/)/;
$line =~ /(\/\*.*\*\/)/;
$c_comment = $1;
$c_comment_complete = 1;
}
else {
# Start of multi-line comment.
$line =~ /(\/\*.*)/;
$c_comment = $1 . " ";
$c_comment = $1;
$state = "incomment";
}
}
@ -171,7 +224,7 @@ foreach my $line (@c_source) {
# Check on (some) operators.
# Before: <<= << >>= >> <= >= == != += -= *= /= %= &= |= ^=
if ($line =~ /(\(\S<<=?|\S>>=?|[^\s<]<=|[^\s>]>=|\S[=!+\-*\/%&|^]=)/) {
style "detected glued assignment/comparison operator (1)";
style "detected glued operator (1)";
}
# After: =
elsif ($line =~ /=[^\s=]/) {
@ -209,16 +262,27 @@ foreach my $line (@c_source) {
#******************************************************************************
# Scanning for comment end.
elsif ($state eq "incomment") {
if ("$line" =~ /\*\/\s*$/) {
# End of mult-line comment.
# Left trimming.
$line =~ s/^\s+//;
if ("$line" =~ /^\s*\*\/\s*$/) {
# Just end of comment line.
$c_comment .= "*/";
$c_comment_complete = 1;
# print("$c_comment");
$state = "start";
}
elsif ("$line" =~ /\*\/\s*$/) {
# Text followed by end of comment.
$line =~ /(.*\*\/)/;
$c_comment .= $1;
$c_comment .= " " . $1;
$c_comment_complete = 1;
# print("$c_comment");
$state = "start";
}
else {
# Add the whole line.
$c_comment .= $line . " ";
# Add the whole line, remove first * and following spaces if any.
$line =~ s/^\*?\s*//;
$c_comment .= " " . $line;
# print("$c_comment");
}
}

View File

@ -19,3 +19,36 @@ a && b
a || b
a ^^ b
foo(); /* Function call.*/
foo(); /* Multiple lines
right comment.*/
/** @} */
/*lint .*/
/* Good comment.*/
/** @Good comment.*/
/**< @Good comment.*/
/*
This is a good comment.
*/
/*
* Good comment.
*/
/* Multiple lines
comment 1.*/
/*
* Multiple lines
* comment 2.
*/
/*===========================================================================*/

View File

@ -58,4 +58,8 @@ a ||b
a^^b
a^^ b
a ^^b
/** Comment.*/
/**Comment.*/
/*Comment*/
/* comment*/
/* Comment. */