Skip to content

Commit

Permalink
Apply pointer formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead authored and hliebscher committed Mar 31, 2021
1 parent ce92f8e commit 0a4b13d
Show file tree
Hide file tree
Showing 102 changed files with 364 additions and 364 deletions.
8 changes: 4 additions & 4 deletions Marlin/src/HAL/AVR/HAL_SPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ void spiBegin() {
}

/** SPI read data */
void spiRead(uint8_t* buf, uint16_t nbyte) {
void spiRead(uint8_t *buf, uint16_t nbyte) {
if (nbyte-- == 0) return;
SPDR = 0xFF;
for (uint16_t i = 0; i < nbyte; i++) {
Expand All @@ -107,7 +107,7 @@ void spiBegin() {
}

/** SPI send block */
void spiSendBlock(uint8_t token, const uint8_t* buf) {
void spiSendBlock(uint8_t token, const uint8_t *buf) {
SPDR = token;
for (uint16_t i = 0; i < 512; i += 2) {
while (!TEST(SPSR, SPIF)) { /* Intentionally left empty */ }
Expand Down Expand Up @@ -215,7 +215,7 @@ void spiBegin() {
}

// Soft SPI read data
void spiRead(uint8_t* buf, uint16_t nbyte) {
void spiRead(uint8_t *buf, uint16_t nbyte) {
for (uint16_t i = 0; i < nbyte; i++)
buf[i] = spiRec();
}
Expand All @@ -242,7 +242,7 @@ void spiBegin() {
}

// Soft SPI send block
void spiSendBlock(uint8_t token, const uint8_t* buf) {
void spiSendBlock(uint8_t token, const uint8_t *buf) {
spiSend(token);
for (uint16_t i = 0; i < 512; i++)
spiSend(buf[i]);
Expand Down
30 changes: 15 additions & 15 deletions Marlin/src/HAL/DUE/HAL_SPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@
#pragma GCC optimize (3)

typedef uint8_t (*pfnSpiTransfer)(uint8_t b);
typedef void (*pfnSpiRxBlock)(uint8_t* buf, uint32_t nbyte);
typedef void (*pfnSpiTxBlock)(const uint8_t* buf, uint32_t nbyte);
typedef void (*pfnSpiRxBlock)(uint8_t *buf, uint32_t nbyte);
typedef void (*pfnSpiTxBlock)(const uint8_t *buf, uint32_t nbyte);

/* ---------------- Macros to be able to access definitions from asm */
#define _PORT(IO) DIO ## IO ## _WPORT
Expand Down Expand Up @@ -270,7 +270,7 @@
static pfnSpiTransfer spiTransferTx = (pfnSpiTransfer)spiTransferX;

// Block transfers run at ~8 .. ~10Mhz - Tx version (Rx data discarded)
static void spiTxBlock0(const uint8_t* ptr, uint32_t todo) {
static void spiTxBlock0(const uint8_t *ptr, uint32_t todo) {
uint32_t MOSI_PORT_PLUS30 = ((uint32_t) PORT(SD_MOSI_PIN)) + 0x30; /* SODR of port */
uint32_t MOSI_MASK = PIN_MASK(SD_MOSI_PIN);
uint32_t SCK_PORT_PLUS30 = ((uint32_t) PORT(SD_SCK_PIN)) + 0x30; /* SODR of port */
Expand Down Expand Up @@ -349,7 +349,7 @@
);
}

static void spiRxBlock0(uint8_t* ptr, uint32_t todo) {
static void spiRxBlock0(uint8_t *ptr, uint32_t todo) {
uint32_t bin = 0;
uint32_t work = 0;
uint32_t BITBAND_MISO_PORT = BITBAND_ADDRESS( ((uint32_t)PORT(SD_MISO_PIN))+0x3C, PIN_SHIFT(SD_MISO_PIN)); /* PDSR of port in bitband area */
Expand Down Expand Up @@ -425,13 +425,13 @@
);
}

static void spiTxBlockX(const uint8_t* buf, uint32_t todo) {
static void spiTxBlockX(const uint8_t *buf, uint32_t todo) {
do {
(void)spiTransferTx(*buf++);
} while (--todo);
}

static void spiRxBlockX(uint8_t* buf, uint32_t todo) {
static void spiRxBlockX(uint8_t *buf, uint32_t todo) {
do {
*buf++ = spiTransferRx(0xFF);
} while (--todo);
Expand Down Expand Up @@ -463,7 +463,7 @@
return b;
}

void spiRead(uint8_t* buf, uint16_t nbyte) {
void spiRead(uint8_t *buf, uint16_t nbyte) {
if (nbyte) {
_SS_WRITE(LOW);
WRITE(SD_MOSI_PIN, HIGH); // Output 1s 1
Expand All @@ -478,7 +478,7 @@
_SS_WRITE(HIGH);
}

void spiSendBlock(uint8_t token, const uint8_t* buf) {
void spiSendBlock(uint8_t token, const uint8_t *buf) {
_SS_WRITE(LOW);
(void)spiTransferTx(token);
spiTxBlock(buf, 512);
Expand Down Expand Up @@ -645,7 +645,7 @@
}

// Read from SPI into buffer
void spiRead(uint8_t* buf, uint16_t nbyte) {
void spiRead(uint8_t *buf, uint16_t nbyte) {
if (!nbyte) return;
--nbyte;
for (int i = 0; i < nbyte; i++) {
Expand All @@ -668,7 +668,7 @@
//DELAY_US(1U);
}

void spiSend(const uint8_t* buf, size_t nbyte) {
void spiSend(const uint8_t *buf, size_t nbyte) {
if (!nbyte) return;
--nbyte;
for (size_t i = 0; i < nbyte; i++) {
Expand All @@ -689,7 +689,7 @@
FLUSH_RX();
}

void spiSend(uint32_t chan, const uint8_t* buf, size_t nbyte) {
void spiSend(uint32_t chan, const uint8_t *buf, size_t nbyte) {
if (!nbyte) return;
--nbyte;
for (size_t i = 0; i < nbyte; i++) {
Expand All @@ -702,7 +702,7 @@
}

// Write from buffer to SPI
void spiSendBlock(uint8_t token, const uint8_t* buf) {
void spiSendBlock(uint8_t token, const uint8_t *buf) {
SPI0->SPI_TDR = (uint32_t)token | SPI_PCS(SPI_CHAN);
WHILE_TX(0);
//WHILE_RX(0);
Expand Down Expand Up @@ -801,19 +801,19 @@

uint8_t spiRec() { return (uint8_t)spiTransfer(0xFF); }

void spiRead(uint8_t* buf, uint16_t nbyte) {
void spiRead(uint8_t *buf, uint16_t nbyte) {
for (int i = 0; i < nbyte; i++)
buf[i] = spiTransfer(0xFF);
}

void spiSend(uint8_t data) { spiTransfer(data); }

void spiSend(const uint8_t* buf, size_t nbyte) {
void spiSend(const uint8_t *buf, size_t nbyte) {
for (uint16_t i = 0; i < nbyte; i++)
spiTransfer(buf[i]);
}

void spiSendBlock(uint8_t token, const uint8_t* buf) {
void spiSendBlock(uint8_t token, const uint8_t *buf) {
spiTransfer(token);
for (uint16_t i = 0; i < 512; i++)
spiTransfer(buf[i]);
Expand Down
14 changes: 7 additions & 7 deletions Marlin/src/HAL/DUE/eeprom_flash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ static void ee_Dump(const int page, const void* data) {

#ifdef EE_EMU_DEBUG

const uint8_t* c = (const uint8_t*) data;
const uint8_t *c = (const uint8_t*) data;
char buffer[80];

sprintf_P(buffer, PSTR("Page: %d (0x%04x)\n"), page, page);
Expand Down Expand Up @@ -293,8 +293,8 @@ static bool ee_PageWrite(uint16_t page, const void* data) {
ee_Dump(-page, data);

// Calculate count of changed bits
uint32_t* p1 = (uint32_t*)addrflash;
uint32_t* p2 = (uint32_t*)data;
uint32_t *p1 = (uint32_t*)addrflash;
uint32_t *p2 = (uint32_t*)data;
int count = 0;
for (i =0; i<PageSize >> 2; i++) {
if (p1[i] != p2[i]) {
Expand Down Expand Up @@ -470,7 +470,7 @@ static uint8_t ee_Read(uint32_t address, bool excludeRAMBuffer=false) {
for (int page = curPage - 1; page >= 0; --page) {

// Get a pointer to the flash page
uint8_t* pflash = (uint8_t*)getFlashStorage(page + curGroup * PagesPerGroup);
uint8_t *pflash = (uint8_t*)getFlashStorage(page + curGroup * PagesPerGroup);

uint16_t i = 0;
while (i <= (PageSize - 4)) { /* (PageSize - 4) because otherwise, there is not enough room for data and headers */
Expand Down Expand Up @@ -550,7 +550,7 @@ static uint32_t ee_GetAddrRange(uint32_t address, bool excludeRAMBuffer=false) {
for (int page = curPage - 1; page >= 0; --page) {

// Get a pointer to the flash page
uint8_t* pflash = (uint8_t*)getFlashStorage(page + curGroup * PagesPerGroup);
uint8_t *pflash = (uint8_t*)getFlashStorage(page + curGroup * PagesPerGroup);

uint16_t i = 0;
while (i <= (PageSize - 4)) { /* (PageSize - 4) because otherwise, there is not enough room for data and headers */
Expand Down Expand Up @@ -589,7 +589,7 @@ static uint32_t ee_GetAddrRange(uint32_t address, bool excludeRAMBuffer=false) {
}

static bool ee_IsPageClean(int page) {
uint32_t* pflash = (uint32_t*) getFlashStorage(page);
uint32_t *pflash = (uint32_t*) getFlashStorage(page);
for (uint16_t i = 0; i < (PageSize >> 2); ++i)
if (*pflash++ != 0xFFFFFFFF) return false;
return true;
Expand All @@ -599,7 +599,7 @@ static bool ee_Flush(uint32_t overrideAddress = 0xFFFFFFFF, uint8_t overrideData

// Check if RAM buffer has something to be written
bool isEmpty = true;
uint32_t* p = (uint32_t*) &buffer[0];
uint32_t *p = (uint32_t*) &buffer[0];
for (uint16_t j = 0; j < (PageSize >> 2); j++) {
if (*p++ != 0xFFFFFFFF) {
isEmpty = false;
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/HAL/DUE/usb/udi_cdc.h
Original file line number Diff line number Diff line change
Expand Up @@ -675,11 +675,11 @@ iram_size_t udi_cdc_multi_write_buf(uint8_t port, const void* buf, iram_size_t s
* - \code // Waits and gets a value on CDC line
int udi_cdc_getc(void);
// Reads a RAM buffer on CDC line
iram_size_t udi_cdc_read_buf(int* buf, iram_size_t size);
iram_size_t udi_cdc_read_buf(int *buf, iram_size_t size);
// Puts a byte on CDC line
int udi_cdc_putc(int value);
// Writes a RAM buffer on CDC line
iram_size_t udi_cdc_write_buf(const int* buf, iram_size_t size); \endcode
iram_size_t udi_cdc_write_buf(const int *buf, iram_size_t size); \endcode
*
* \section udi_cdc_use_cases Advanced use cases
* For more advanced use of the UDI CDC module, see the following use cases:
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/HAL/DUE/usb/usb_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ bool usb_task_extra_string(void) {
** Handle device requests that the ASF stack doesn't
*/
bool usb_task_other_requests(void) {
uint8_t* ptr = 0;
uint8_t *ptr = 0;
uint16_t size = 0;

if (Udd_setup_type() == USB_REQ_TYPE_VENDOR) {
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/HAL/ESP32/HAL_SPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ uint8_t spiRec() {
return returnByte;
}

void spiRead(uint8_t* buf, uint16_t nbyte) {
void spiRead(uint8_t *buf, uint16_t nbyte) {
SPI.beginTransaction(spiConfig);
SPI.transferBytes(0, buf, nbyte);
SPI.endTransaction();
Expand All @@ -97,7 +97,7 @@ void spiSend(uint8_t b) {
SPI.endTransaction();
}

void spiSendBlock(uint8_t token, const uint8_t* buf) {
void spiSendBlock(uint8_t token, const uint8_t *buf) {
SPI.beginTransaction(spiConfig);
SPI.transfer(token);
SPI.writeBytes(const_cast<uint8_t*>(buf), 512);
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/HAL/ESP32/WebSocketSerial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ size_t WebSocketSerial::write(const uint8_t c) {
return ret;
}

size_t WebSocketSerial::write(const uint8_t* buffer, size_t size) {
size_t WebSocketSerial::write(const uint8_t *buffer, size_t size) {
size_t written = 0;
for (size_t i = 0; i < size; i++)
written += write(buffer[i]);
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/HAL/ESP32/WebSocketSerial.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class RingBuffer {
ring_buffer_pos_t read(uint8_t *buffer);
void flush();
ring_buffer_pos_t write(const uint8_t c);
ring_buffer_pos_t write(const uint8_t* buffer, ring_buffer_pos_t size);
ring_buffer_pos_t write(const uint8_t *buffer, ring_buffer_pos_t size);
};

class WebSocketSerial: public Stream {
Expand All @@ -70,7 +70,7 @@ class WebSocketSerial: public Stream {
int read();
void flush();
size_t write(const uint8_t c);
size_t write(const uint8_t* buffer, size_t size);
size_t write(const uint8_t *buffer, size_t size);

#if ENABLED(SERIAL_STATS_DROPPED_RX)
FORCE_INLINE uint32_t dropped() { return 0; }
Expand Down
10 changes: 5 additions & 5 deletions Marlin/src/HAL/LPC1768/HAL_SPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,12 @@

void spiSend(uint8_t b) { (void)spiTransfer(b); }

void spiSend(const uint8_t* buf, size_t nbyte) {
void spiSend(const uint8_t *buf, size_t nbyte) {
for (uint16_t i = 0; i < nbyte; i++)
(void)spiTransfer(buf[i]);
}

void spiSendBlock(uint8_t token, const uint8_t* buf) {
void spiSendBlock(uint8_t token, const uint8_t *buf) {
(void)spiTransfer(token);
for (uint16_t i = 0; i < 512; i++)
(void)spiTransfer(buf[i]);
Expand Down Expand Up @@ -135,13 +135,13 @@

void spiSend(uint8_t b) { doio(b); }

void spiSend(const uint8_t* buf, size_t nbyte) {
void spiSend(const uint8_t *buf, size_t nbyte) {
for (uint16_t i = 0; i < nbyte; i++) doio(buf[i]);
}

void spiSend(uint32_t chan, byte b) {}

void spiSend(uint32_t chan, const uint8_t* buf, size_t nbyte) {}
void spiSend(uint32_t chan, const uint8_t *buf, size_t nbyte) {}

// Read single byte from SPI
uint8_t spiRec() { return doio(0xFF); }
Expand All @@ -156,7 +156,7 @@
uint8_t spiTransfer(uint8_t b) { return doio(b); }

// Write from buffer to SPI
void spiSendBlock(uint8_t token, const uint8_t* buf) {
void spiSendBlock(uint8_t token, const uint8_t *buf) {
(void)spiTransfer(token);
for (uint16_t i = 0; i < 512; i++)
(void)spiTransfer(buf[i]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
void spiBegin();
void spiInit(uint8_t spiRate);
void spiSend(uint8_t b);
void spiSend(const uint8_t* buf, size_t n);
void spiSend(const uint8_t *buf, size_t n);

static uint8_t rs_last_state = 255;

Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/HAL/SAMD51/HAL_SPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
* @param nbyte Number of bytes to receive.
* @return Nothing
*/
void spiRead(uint8_t* buf, uint16_t nbyte) {
void spiRead(uint8_t *buf, uint16_t nbyte) {
if (nbyte == 0) return;
memset(buf, 0xFF, nbyte);
sdSPI.beginTransaction(spiConfig);
Expand Down Expand Up @@ -132,7 +132,7 @@
*
* @details Uses DMA
*/
void spiSendBlock(uint8_t token, const uint8_t* buf) {
void spiSendBlock(uint8_t token, const uint8_t *buf) {
sdSPI.beginTransaction(spiConfig);
sdSPI.transfer(token);
sdSPI.transfer((uint8_t*)buf, nullptr, 512);
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/HAL/STM32/HAL_SPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ static SPISettings spiConfig;
*
* @details Uses DMA
*/
void spiRead(uint8_t* buf, uint16_t nbyte) {
void spiRead(uint8_t *buf, uint16_t nbyte) {
if (nbyte == 0) return;
memset(buf, 0xFF, nbyte);
SPI.transfer(buf, nbyte);
Expand All @@ -218,7 +218,7 @@ static SPISettings spiConfig;
*
* @details Use DMA
*/
void spiSendBlock(uint8_t token, const uint8_t* buf) {
void spiSendBlock(uint8_t token, const uint8_t *buf) {
uint8_t rxBuf[512];
SPI.transfer(token);
SPI.transfer((uint8_t*)buf, &rxBuf, 512);
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/HAL/STM32/MarlinSerial.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ struct MarlinSerial : public HardwareSerial {
void begin(unsigned long baud, uint8_t config);
inline void begin(unsigned long baud) { begin(baud, SERIAL_8N1); }

void _rx_complete_irq(serial_t* obj);
void _rx_complete_irq(serial_t *obj);

protected:
usart_rx_callback_t _rx_callback;
Expand Down
Loading

0 comments on commit 0a4b13d

Please sign in to comment.