First coarse run to fix coding style in locm3.
Added --terse and --mailback options to the make stylecheck target. It also does continue even if it enounters a possible error. We decided on two exceptions from the linux kernel coding standard: - Empty wait while loops may end with ; on the same line. - All blocks after while, if, for have to be in brackets even if they only contain one statement. Otherwise it is easy to introduce an error. Checkpatch needs to be adapted to reflect those changes.
This commit is contained in:
@@ -61,11 +61,9 @@ void ssp_disable(ssp_num_t ssp_num)
|
||||
{
|
||||
u32 ssp_port;
|
||||
|
||||
if(ssp_num == SSP0_NUM)
|
||||
{
|
||||
if (ssp_num == SSP0_NUM) {
|
||||
ssp_port = SSP0;
|
||||
}else
|
||||
{
|
||||
} else {
|
||||
ssp_port = SSP1;
|
||||
}
|
||||
/* Disable SSP */
|
||||
@@ -88,16 +86,15 @@ void ssp_init(ssp_num_t ssp_num,
|
||||
u32 ssp_port;
|
||||
u32 clock;
|
||||
|
||||
if(ssp_num == SSP0_NUM)
|
||||
{
|
||||
if (ssp_num == SSP0_NUM) {
|
||||
ssp_port = SSP0;
|
||||
}else
|
||||
{
|
||||
} else {
|
||||
ssp_port = SSP1;
|
||||
}
|
||||
|
||||
/* use PLL1 as clock source for SSP1 */
|
||||
CGU_BASE_SSP1_CLK = (CGU_SRC_PLL1<<CGU_BASE_CLK_SEL_SHIFT) | (1<<CGU_AUTOBLOCK_CLOCK_BIT);
|
||||
CGU_BASE_SSP1_CLK = (CGU_SRC_PLL1<<CGU_BASE_CLK_SEL_SHIFT) |
|
||||
(1<<CGU_AUTOBLOCK_CLOCK_BIT);
|
||||
|
||||
/* Disable SSP before to configure it */
|
||||
SSP_CR1(ssp_port) = 0x0;
|
||||
@@ -105,7 +102,8 @@ void ssp_init(ssp_num_t ssp_num,
|
||||
/* Configure SSP */
|
||||
clock = serial_clock_rate;
|
||||
SSP_CPSR(ssp_port) = clk_prescale;
|
||||
SSP_CR0(ssp_port) = (data_size | frame_format | cpol_cpha_format | (clock<<8) );
|
||||
SSP_CR0(ssp_port) =
|
||||
(data_size | frame_format | cpol_cpha_format | (clock<<8));
|
||||
|
||||
/* Enable SSP */
|
||||
SSP_CR1(ssp_port) = (SSP_ENABLE | mode | master_slave | slave_option);
|
||||
@@ -118,15 +116,14 @@ u16 ssp_read(ssp_num_t ssp_num)
|
||||
{
|
||||
u32 ssp_port;
|
||||
|
||||
if(ssp_num == SSP0_NUM)
|
||||
{
|
||||
if (ssp_num == SSP0_NUM) {
|
||||
ssp_port = SSP0;
|
||||
}else
|
||||
{
|
||||
} else {
|
||||
ssp_port = SSP1;
|
||||
}
|
||||
|
||||
/* Wait Until Data Received (Rx FIFO not Empty) */
|
||||
while( (SSP_SR(ssp_port) & SSP_SR_RNE) == 0);
|
||||
while ((SSP_SR(ssp_port) & SSP_SR_RNE) == 0);
|
||||
|
||||
return SSP_DR(ssp_port);
|
||||
}
|
||||
@@ -134,16 +131,14 @@ u16 ssp_read(ssp_num_t ssp_num)
|
||||
void ssp_wait_until_not_busy(ssp_num_t ssp_num)
|
||||
{
|
||||
u32 ssp_port;
|
||||
|
||||
if(ssp_num == SSP0_NUM)
|
||||
{
|
||||
|
||||
if (ssp_num == SSP0_NUM) {
|
||||
ssp_port = SSP0;
|
||||
}else
|
||||
{
|
||||
} else {
|
||||
ssp_port = SSP1;
|
||||
}
|
||||
|
||||
while( (SSP_SR(ssp_port) & SSP_SR_BSY) );
|
||||
while ((SSP_SR(ssp_port) & SSP_SR_BSY));
|
||||
}
|
||||
|
||||
/* This Function Wait Data TX Ready, and Write Data to SSP */
|
||||
@@ -151,19 +146,17 @@ void ssp_write(ssp_num_t ssp_num, u16 data)
|
||||
{
|
||||
u32 ssp_port;
|
||||
|
||||
if(ssp_num == SSP0_NUM)
|
||||
{
|
||||
if (ssp_num == SSP0_NUM) {
|
||||
ssp_port = SSP0;
|
||||
}else
|
||||
{
|
||||
} else {
|
||||
ssp_port = SSP1;
|
||||
}
|
||||
|
||||
/* Wait Until FIFO not full */
|
||||
while( (SSP_SR(ssp_port) & SSP_SR_TNF) == 0);
|
||||
while ((SSP_SR(ssp_port) & SSP_SR_TNF) == 0);
|
||||
|
||||
SSP_DR(ssp_port) = data;
|
||||
|
||||
|
||||
/* Wait for not busy, since we're controlling CS# of
|
||||
* devices manually and need to wait for the data to
|
||||
* be sent. It may also be important to wait here
|
||||
|
||||
Reference in New Issue
Block a user