Skip to content

Commit 45301ea

Browse files
committed
Run astyle on all FPGA files
Run astyle to correct formatting.
1 parent 11bd966 commit 45301ea

File tree

8 files changed

+75
-78
lines changed

8 files changed

+75
-78
lines changed

components/testing/COMPONENT_FPGA_CI_TEST_SHIELD/I2CTester.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,30 +35,30 @@ uint8_t I2CTester::num_stops()
3535
uint16_t I2CTester::num_acks()
3636
{
3737
uint16_t num_acks = 0;
38-
read(TESTER_I2C_ACKS, (uint8_t*)&num_acks, sizeof(num_acks));
38+
read(TESTER_I2C_ACKS, (uint8_t *)&num_acks, sizeof(num_acks));
3939
return num_acks;
4040
}
4141

4242
uint16_t I2CTester::num_nacks()
4343
{
4444
uint16_t num_nacks = 0;
45-
read(TESTER_I2C_NACKS, (uint8_t*)&num_nacks, sizeof(num_nacks));
45+
read(TESTER_I2C_NACKS, (uint8_t *)&num_nacks, sizeof(num_nacks));
4646
return num_nacks;
4747
}
4848

4949
uint16_t I2CTester::transfer_count()
5050
{
5151
uint16_t transfers = 0;
5252
MBED_ASSERT(sizeof(transfers) == TESTER_I2C_TRANSFERS_SIZE);
53-
read(TESTER_I2C_TRANSFERS, (uint8_t*)&transfers, sizeof(transfers));
53+
read(TESTER_I2C_TRANSFERS, (uint8_t *)&transfers, sizeof(transfers));
5454
return transfers;
5555
}
5656

5757
uint32_t I2CTester::get_receive_checksum()
5858
{
5959
uint32_t to_slave_checksum = 0;
6060
MBED_ASSERT(sizeof(to_slave_checksum) == TESTER_I2C_TO_SLAVE_CHECKSUM_SIZE);
61-
read(TESTER_I2C_TO_SLAVE_CHECKSUM, (uint8_t*)&to_slave_checksum, sizeof(to_slave_checksum));
61+
read(TESTER_I2C_TO_SLAVE_CHECKSUM, (uint8_t *)&to_slave_checksum, sizeof(to_slave_checksum));
6262
return to_slave_checksum;
6363
}
6464

@@ -79,13 +79,13 @@ uint8_t I2CTester::num_dev_addr_matches()
7979
void I2CTester::set_device_address(uint16_t addr)
8080
{
8181
uint16_t data = addr;
82-
write(TESTER_I2C_DEVICE_ADDRESS, (uint8_t*)&data, sizeof(data));
82+
write(TESTER_I2C_DEVICE_ADDRESS, (uint8_t *)&data, sizeof(data));
8383
}
8484

8585
uint16_t I2CTester::get_device_address()
8686
{
8787
uint16_t addr = 0;
88-
read(TESTER_I2C_DEVICE_ADDRESS, (uint8_t*)&addr, sizeof(addr));
88+
read(TESTER_I2C_DEVICE_ADDRESS, (uint8_t *)&addr, sizeof(addr));
8989
return addr;
9090
}
9191

@@ -133,12 +133,12 @@ uint8_t I2CTester::get_next_from_slave()
133133
uint16_t I2CTester::num_writes()
134134
{
135135
uint16_t num_writes = 0;
136-
read(TESTER_I2C_NUM_WRITES, (uint8_t*)&num_writes, sizeof(num_writes));
136+
read(TESTER_I2C_NUM_WRITES, (uint8_t *)&num_writes, sizeof(num_writes));
137137
return num_writes;
138138
}
139139
uint16_t I2CTester::num_reads()
140140
{
141141
uint16_t num_reads = 0;
142-
read(TESTER_I2C_NUM_READS, (uint8_t*)&num_reads, sizeof(num_reads));
142+
read(TESTER_I2C_NUM_READS, (uint8_t *)&num_reads, sizeof(num_reads));
143143
return num_reads;
144144
}

components/testing/COMPONENT_FPGA_CI_TEST_SHIELD/MbedTester.cpp

Lines changed: 41 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -46,27 +46,31 @@ template<size_t width>
4646
class MbedTesterBitMap {
4747
public:
4848

49-
MbedTesterBitMap() {
49+
MbedTesterBitMap()
50+
{
5051
for (size_t i = 0; i < _count; i++) {
5152
_bitmap[i] = 0;
5253
}
5354
}
5455

55-
bool get(size_t index) {
56+
bool get(size_t index)
57+
{
5658
if (index >= width) {
5759
return false;
5860
}
5961
return _bitmap[index / 32] & (1 << (index % 32)) ? true : false;
6062
}
6163

62-
void set(size_t index) {
64+
void set(size_t index)
65+
{
6366
if (index >= width) {
6467
return;
6568
}
6669
_bitmap[index / 32] |= 1 << (index % 32);
6770
}
6871

69-
void clear(size_t index) {
72+
void clear(size_t index)
73+
{
7074
if (index >= width) {
7175
return;
7276
}
@@ -142,7 +146,8 @@ class MbedTesterBlockDevice : public BlockDevice {
142146
public:
143147

144148
MbedTesterBlockDevice(mbed::DigitalInOut &mosi, mbed::DigitalInOut &miso, mbed::DigitalInOut &clk, mbed::DigitalInOut &cs, uint32_t frequency)
145-
: _mosi(mosi), _miso(miso), _clk(clk), _cs(cs), _wait_ns(1000000000 / frequency / 2), _init(false) {
149+
: _mosi(mosi), _miso(miso), _clk(clk), _cs(cs), _wait_ns(1000000000 / frequency / 2), _init(false)
150+
{
146151

147152
// Set initial values
148153
_cs.write(1);
@@ -397,7 +402,8 @@ class MbedTesterBlockDevice : public BlockDevice {
397402
return true;
398403
}
399404

400-
void _write(const char *tx_buffer, int tx_length, char *rx_buffer, int rx_length) {
405+
void _write(const char *tx_buffer, int tx_length, char *rx_buffer, int rx_length)
406+
{
401407
int transfers = 0;
402408
if (tx_length > transfers) {
403409
transfers = tx_length;
@@ -426,7 +432,8 @@ class MbedTesterBlockDevice : public BlockDevice {
426432
}
427433
}
428434

429-
void _assert_cs(bool asserted) {
435+
void _assert_cs(bool asserted)
436+
{
430437
_clk = 0;
431438
wait_ns(_wait_ns);
432439
_cs = asserted ? 0 : 1;
@@ -649,8 +656,8 @@ bool MbedTester::firmware_dump(mbed::FileHandle *dest, mbed::Callback<void(uint8
649656

650657
// Mapping intentionally different from control channel to prevent
651658
// unintentional activation (clk and mosi flipped)
652-
MbedTesterBlockDevice flash(*_clk, *_miso , *_mosi, *_aux, FLASH_SPI_FREQ_HZ);
653-
sys_pin_mode_spi_serial_flash(_clk_index , _miso_index, _mosi_index, _aux_index);
659+
MbedTesterBlockDevice flash(*_clk, *_miso, *_mosi, *_aux, FLASH_SPI_FREQ_HZ);
660+
sys_pin_mode_spi_serial_flash(_clk_index, _miso_index, _mosi_index, _aux_index);
654661

655662
progress(0);
656663

@@ -709,8 +716,8 @@ bool MbedTester::firmware_dump(mbed::FileHandle *dest, mbed::Callback<void(uint8
709716

710717
const uint8_t percent_done = (offset * 100) / firmware_size;
711718
if (percent_done != prev_percent_done) {
712-
progress(percent_done);
713-
prev_percent_done = percent_done;
719+
progress(percent_done);
720+
prev_percent_done = percent_done;
714721
}
715722
}
716723

@@ -730,8 +737,8 @@ bool MbedTester::firmware_dump_all(mbed::FileHandle *dest, mbed::Callback<void(u
730737

731738
// Mapping intentionally different from control channel to prevent
732739
// unintentional activation (clk and mosi flipped)
733-
MbedTesterBlockDevice flash(*_clk, *_miso , *_mosi, *_aux, FLASH_SPI_FREQ_HZ);
734-
sys_pin_mode_spi_serial_flash(_clk_index , _miso_index, _mosi_index, _aux_index);
740+
MbedTesterBlockDevice flash(*_clk, *_miso, *_mosi, *_aux, FLASH_SPI_FREQ_HZ);
741+
sys_pin_mode_spi_serial_flash(_clk_index, _miso_index, _mosi_index, _aux_index);
735742

736743
progress(0);
737744

@@ -762,8 +769,8 @@ bool MbedTester::firmware_dump_all(mbed::FileHandle *dest, mbed::Callback<void(u
762769

763770
const uint8_t percent_done = (pos * 100) / total_size;
764771
if (percent_done != prev_percent_done) {
765-
progress(percent_done);
766-
prev_percent_done = percent_done;
772+
progress(percent_done);
773+
prev_percent_done = percent_done;
767774
}
768775
}
769776

@@ -783,8 +790,8 @@ bool MbedTester::firmware_update(mbed::FileHandle *src, mbed::Callback<void(uint
783790

784791
// Mapping intentionally different from control channel to prevent
785792
// unintentional activation (clk and mosi flipped)
786-
MbedTesterBlockDevice flash(*_clk, *_miso , *_mosi, *_aux, FLASH_SPI_FREQ_HZ);
787-
sys_pin_mode_spi_serial_flash(_clk_index , _miso_index, _mosi_index, _aux_index);
793+
MbedTesterBlockDevice flash(*_clk, *_miso, *_mosi, *_aux, FLASH_SPI_FREQ_HZ);
794+
sys_pin_mode_spi_serial_flash(_clk_index, _miso_index, _mosi_index, _aux_index);
788795

789796
progress(0);
790797

@@ -1258,7 +1265,7 @@ int MbedTester::io_expander_i2c_read(uint8_t i2c_index, uint8_t dev_addr, uint8_
12581265
*scl_val = 0;
12591266
wait_ns(2500);
12601267
} else {
1261-
if (j == (length-1)) {//NACK to signal end of read
1268+
if (j == (length - 1)) { //NACK to signal end of read
12621269
*sda_val = 1;
12631270
wait_ns(1000);
12641271
*scl_val = 1;
@@ -1458,8 +1465,8 @@ uint8_t MbedTester::io_expander_read_bb(PinName pin, IOExpanderReg reg_type)
14581465
sda = I2CSda2;
14591466
scl = I2CScl2;
14601467
} else {
1461-
sda = (SystemPin)-1;
1462-
scl = (SystemPin)-1;
1468+
sda = (SystemPin) - 1;
1469+
scl = (SystemPin) - 1;
14631470
error("Invalid pin index, index should be in the range of 0-127");
14641471
}
14651472

@@ -1567,7 +1574,7 @@ int MbedTester::io_expander_i2c_read_bb(SystemPin sda, SystemPin scl, uint8_t de
15671574
}
15681575
sys_pin_write(scl, 0, true);
15691576
} else {
1570-
if (j == (length-1)) {//NACK to signal end of read
1577+
if (j == (length - 1)) { //NACK to signal end of read
15711578
sys_pin_write(sda, 0, false);
15721579
sys_pin_write(scl, 0, false);
15731580
sys_pin_write(scl, 0, true);
@@ -1666,8 +1673,7 @@ void MbedTester::set_mux_enable(bool val)
16661673
{
16671674
if (val == true) {
16681675
sys_pin_write(AnalogMuxEnable, 1, true);
1669-
}
1670-
else if (val == false) {
1676+
} else if (val == false) {
16711677
sys_pin_write(AnalogMuxEnable, 0, true);
16721678
}
16731679
wait_us(10);
@@ -1678,8 +1684,7 @@ void MbedTester::set_pwm_enable(bool val)
16781684
uint8_t data;
16791685
if (val == true) {
16801686
data = 1;
1681-
}
1682-
else if (val == false) {
1687+
} else if (val == false) {
16831688
data = 0;
16841689
}
16851690
write(TESTER_SYS_IO_PWM_ENABLE, &data, sizeof(data));
@@ -1691,8 +1696,7 @@ bool MbedTester::get_pwm_enable()
16911696
read(TESTER_SYS_IO_PWM_ENABLE, &val, sizeof(val));
16921697
if (val == 1) {
16931698
return true;
1694-
}
1695-
else if (val == 0) {
1699+
} else if (val == 0) {
16961700
return false;
16971701
} else {
16981702
error("Corrupt pwm enable value");
@@ -1705,15 +1709,15 @@ void MbedTester::set_pwm_period_and_cycles_high(uint32_t period, uint32_t cycles
17051709
set_pwm_enable(false);
17061710
uint32_t p = period - 1;//period in cycles
17071711
uint32_t d = cycles_high;//number of cycles pwm out is high
1708-
write(TESTER_SYS_IO_PWM_PERIOD, (uint8_t*)&p, sizeof(p));
1709-
write(TESTER_SYS_IO_PWM_CYCLES_HIGH, (uint8_t*)&d, sizeof(d));
1712+
write(TESTER_SYS_IO_PWM_PERIOD, (uint8_t *)&p, sizeof(p));
1713+
write(TESTER_SYS_IO_PWM_CYCLES_HIGH, (uint8_t *)&d, sizeof(d));
17101714
set_pwm_enable(true);
17111715
}
17121716

17131717
uint32_t MbedTester::get_pwm_period()
17141718
{
17151719
uint32_t period = 0;
1716-
read(TESTER_SYS_IO_PWM_PERIOD, (uint8_t*)&period, sizeof(period));
1720+
read(TESTER_SYS_IO_PWM_PERIOD, (uint8_t *)&period, sizeof(period));
17171721
return period + 1;//clk cycles
17181722
}
17191723

@@ -1730,7 +1734,7 @@ uint16_t MbedTester::get_analogmuxin_measurement()
17301734
//take snapshot of conversion value to make safe for reading
17311735
set_snapshot();
17321736
uint16_t an_mux_analogin_measurement = 0;
1733-
read(TESTER_SYS_AN_MUX_ANALOGIN_MEASUREMENT, (uint8_t*)&an_mux_analogin_measurement, sizeof(an_mux_analogin_measurement));
1737+
read(TESTER_SYS_AN_MUX_ANALOGIN_MEASUREMENT, (uint8_t *)&an_mux_analogin_measurement, sizeof(an_mux_analogin_measurement));
17341738
return an_mux_analogin_measurement;
17351739
}
17361740

@@ -1743,7 +1747,7 @@ uint16_t MbedTester::get_anin_measurement(int index)
17431747
//take snapshot of conversion value to make safe for reading
17441748
set_snapshot();
17451749
uint16_t anin_measurement = 0;
1746-
read((TESTER_SYS_ANIN0_MEASUREMENT + (index * 10)), (uint8_t*)&anin_measurement, sizeof(anin_measurement));//10 because sizeof measurement + sizeof measurements_sum = 10
1750+
read((TESTER_SYS_ANIN0_MEASUREMENT + (index * 10)), (uint8_t *)&anin_measurement, sizeof(anin_measurement)); //10 because sizeof measurement + sizeof measurements_sum = 10
17471751
return anin_measurement;
17481752
}
17491753

@@ -1755,9 +1759,9 @@ void MbedTester::get_anin_sum_samples_cycles(int index, uint64_t *sum, uint32_t
17551759
}
17561760
//take snapshot of the sum/samples/cycles so that all 3 values are correct in relation to each other
17571761
set_snapshot();
1758-
read((TESTER_SYS_ANIN0_MEASUREMENTS_SUM + (index * 10)), (uint8_t*)sum, sizeof(*sum));//10 because sizeof measurement + sizeof measurements_sum = 10
1759-
read(TESTER_SYS_NUM_POWER_SAMPLES, (uint8_t*)samples, sizeof(*samples));
1760-
read(TESTER_SYS_NUM_POWER_CYCLES, (uint8_t*)cycles, sizeof(*cycles));
1762+
read((TESTER_SYS_ANIN0_MEASUREMENTS_SUM + (index * 10)), (uint8_t *)sum, sizeof(*sum)); //10 because sizeof measurement + sizeof measurements_sum = 10
1763+
read(TESTER_SYS_NUM_POWER_SAMPLES, (uint8_t *)samples, sizeof(*samples));
1764+
read(TESTER_SYS_NUM_POWER_CYCLES, (uint8_t *)cycles, sizeof(*cycles));
17611765
}
17621766

17631767
void MbedTester::set_snapshot()
@@ -1772,8 +1776,7 @@ void MbedTester::set_sample_adc(bool val)
17721776
uint8_t data;
17731777
if (val == true) {
17741778
data = 1;
1775-
}
1776-
else if (val == false) {
1779+
} else if (val == false) {
17771780
data = 0;
17781781
}
17791782
write(TESTER_SYS_SAMPLE_ADC, &data, sizeof(data));
@@ -2198,7 +2201,7 @@ bool MbedTester::_find_control_indexes(PhysicalIndex &clk_out, PhysicalIndex &mo
21982201
}
21992202
}
22002203

2201-
for (size_t i = 0; i < max_controls; i++) {
2204+
for (size_t i = 0; i < max_controls; i++) {
22022205
uint8_t clk_index = i * 2 + 0;
22032206
uint8_t mosi_index = i * 2 + 1;
22042207
if (!allowed.get(clk_index) || !allowed.get(mosi_index)) {

components/testing/COMPONENT_FPGA_CI_TEST_SHIELD/SPIMasterTester.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,15 @@ void SPIMasterTester::set_hd_tx_rx_cnt(uint16_t tx_cnt, uint16_t rx_cnt)
5656
uint32_t SPIMasterTester::get_cs_to_first_clk_edge_ns()
5757
{
5858
uint32_t delay_ns;
59-
read(TESTER_SPI_MASTER_CS_TO_FIRST_SCLK_CNT, (uint8_t*)&delay_ns, TESTER_SPI_MASTER_CS_TO_FIRST_SCLK_CNT_SIZE);
59+
read(TESTER_SPI_MASTER_CS_TO_FIRST_SCLK_CNT, (uint8_t *)&delay_ns, TESTER_SPI_MASTER_CS_TO_FIRST_SCLK_CNT_SIZE);
6060

6161
return (delay_ns * 10);
6262
}
6363

6464
uint32_t SPIMasterTester::get_last_clk_edge_to_cs_ns()
6565
{
6666
uint32_t delay_ns;
67-
read(TESTER_SPI_MASTER_LAST_SCLK_TO_CS_CNT, (uint8_t*)&delay_ns, TESTER_SPI_MASTER_LAST_SCLK_TO_CS_CNT_SIZE);
67+
read(TESTER_SPI_MASTER_LAST_SCLK_TO_CS_CNT, (uint8_t *)&delay_ns, TESTER_SPI_MASTER_LAST_SCLK_TO_CS_CNT_SIZE);
6868

6969
return (delay_ns * 10);
7070
}

components/testing/COMPONENT_FPGA_CI_TEST_SHIELD/SPISlaveTester.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,30 +55,30 @@ void SPISlaveTester::set_hd_tx_rx_cnt(uint16_t tx_cnt, uint16_t rx_cnt)
5555

5656
void SPISlaveTester::set_spi_master_freq(uint16_t clk_div)
5757
{
58-
write(TESTER_SPI_SLAVE_CLK_DIV, (uint8_t*)&clk_div, TESTER_SPI_SLAVE_CLK_DIV_SIZE);
58+
write(TESTER_SPI_SLAVE_CLK_DIV, (uint8_t *)&clk_div, TESTER_SPI_SLAVE_CLK_DIV_SIZE);
5959
}
6060

6161
void SPISlaveTester::set_num_of_symbols(uint16_t num_of_sym)
6262
{
63-
write(TESTER_SPI_SLAVE_NUM_OF_SYMBOLS, (uint8_t*)&num_of_sym, TESTER_SPI_SLAVE_NUM_OF_SYMBOLS_SIZE);
63+
write(TESTER_SPI_SLAVE_NUM_OF_SYMBOLS, (uint8_t *)&num_of_sym, TESTER_SPI_SLAVE_NUM_OF_SYMBOLS_SIZE);
6464
}
6565

6666
void SPISlaveTester::set_start_delay_us(uint8_t start_delay_us)
6767
{
68-
write(TESTER_SPI_SLAVE_START_DELAY_US, (uint8_t*)&start_delay_us, TESTER_SPI_SLAVE_START_DELAY_US_SIZE);
68+
write(TESTER_SPI_SLAVE_START_DELAY_US, (uint8_t *)&start_delay_us, TESTER_SPI_SLAVE_START_DELAY_US_SIZE);
6969
}
7070

7171
void SPISlaveTester::set_sym_delay_ns(uint16_t sym_delay_ns)
7272
{
7373
const uint16_t sym_delay_ticks = (sym_delay_ns + 9) / 10; // round up
74-
write(TESTER_SPI_SLAVE_SYM_DELAY_TICKS, (uint8_t*)&sym_delay_ticks, TESTER_SPI_SLAVE_SYM_DELAY_TICKS_SIZE);
74+
write(TESTER_SPI_SLAVE_SYM_DELAY_TICKS, (uint8_t *)&sym_delay_ticks, TESTER_SPI_SLAVE_SYM_DELAY_TICKS_SIZE);
7575
}
7676

7777
void SPISlaveTester::start_transfer()
7878
{
7979
uint32_t spi_ctrl = 0;
80-
read(TESTER_SPI_SLAVE_CTRL, (uint8_t*)&spi_ctrl, TESTER_SPI_SLAVE_CTRL_SIZE);
80+
read(TESTER_SPI_SLAVE_CTRL, (uint8_t *)&spi_ctrl, TESTER_SPI_SLAVE_CTRL_SIZE);
8181
spi_ctrl &= ~(((1 << TESTER_SPI_SLAVE_START_REQUEST_SIZE) - 1) << TESTER_SPI_SLAVE_START_REQUEST_OFFSET);
8282
spi_ctrl |= (1 << TESTER_SPI_SLAVE_START_REQUEST_OFFSET);
83-
write(TESTER_SPI_SLAVE_CTRL, (uint8_t*)&spi_ctrl, TESTER_SPI_SLAVE_CTRL_SIZE);
83+
write(TESTER_SPI_SLAVE_CTRL, (uint8_t *)&spi_ctrl, TESTER_SPI_SLAVE_CTRL_SIZE);
8484
}

0 commit comments

Comments
 (0)