Apply pointer formatting
This commit is contained in:
@ -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
|
||||
@ -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 */
|
||||
@ -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 */
|
||||
@ -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);
|
||||
@ -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
|
||||
@ -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);
|
||||
@ -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++) {
|
||||
@ -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++) {
|
||||
@ -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++) {
|
||||
@ -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);
|
||||
@ -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]);
|
||||
|
@ -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);
|
||||
@ -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]) {
|
||||
@ -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 */
|
||||
@ -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 */
|
||||
@ -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;
|
||||
@ -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;
|
||||
|
@ -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:
|
||||
|
@ -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) {
|
||||
|
Reference in New Issue
Block a user