Skip to content
Permalink
Browse files

Updated tool and style fixes.

git-svn-id: http://svn.osdn.net/svnroot/chibios/trunk@12817 839915b6-73f9-46d8-aad0-56b2323169cb
  • Loading branch information...
gdisirio authored and nfbot committed May 26, 2019
1 parent f03517e commit 94bc57c2b3605300a50a4174dc767b540c61aed9
@@ -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"
@@ -117,7 +117,7 @@ typedef struct {
* @brief Current configuration data.
*/
const MMCConfig *config;
/***
/**
* @brief Addresses use blocks instead of bytes.
*/
bool block_addresses;
@@ -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);
@@ -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 */
}
@@ -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);
}
}
@@ -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.*/
@@ -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;

@@ -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;
}
@@ -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) {
@@ -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;
}
@@ -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;
}
@@ -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) */

/** @} */
@@ -24,8 +24,6 @@
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 @@ sub error {
# 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 @@ sub error {
# 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 @@ sub error {
#******************************************************************************
# 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");
}
}
@@ -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.
*/

/*===========================================================================*/

@@ -58,4 +58,8 @@ a ||b
a^^b
a^^ b
a ^^b

/** Comment.*/
/**Comment.*/
/*Comment*/
/* comment*/
/* Comment. */

0 comments on commit 94bc57c

Please sign in to comment.
You can’t perform that action at this time.