Update .clang-format and apply
Update .clang-format for LLVM 14.0, available on Ubuntu 22.04. There is still plenty that clang-format sucks at or does wrong, so either add some more blocks to disable it, or just put up with it. Signed-off-by: Tim Crawford <tcrawford@system76.com>
This commit is contained in:
committed by
Jeremy Soller
parent
c3267fc4ad
commit
e032c5f0f2
@ -15,6 +15,7 @@ volatile uint8_t __xdata __at(0x103D) ECINDAR2;
|
||||
volatile uint8_t __xdata __at(0x103E) ECINDAR3;
|
||||
volatile uint8_t __xdata __at(0x103F) ECINDDR;
|
||||
|
||||
// clang-format off
|
||||
#define SPI_DEVICE (0x70)
|
||||
#define SPI_FOLLOW_MODE (0x0F)
|
||||
#define SPI_CHIP_SELECT (0xFD)
|
||||
@ -29,6 +30,7 @@ volatile uint8_t __xdata __at(0x103F) ECINDDR;
|
||||
#define SPI_ERASE_SECTOR_COMMAND (0xD7)
|
||||
|
||||
#define SPI_STATUS_WIP (0x01)
|
||||
// clang-format on
|
||||
|
||||
void flash_enter_follow_mode(void);
|
||||
void flash_exit_follow_mode(void);
|
||||
@ -46,11 +48,11 @@ void flash_write_enable(void);
|
||||
* NOTE: __critical to ensure interrupts are disabled. This does mean that interrupt
|
||||
* such as the timer will be block until flash acccess is complete
|
||||
*/
|
||||
void flash_entry(uint32_t addr, uint8_t * data, uint32_t length, uint8_t command) __reentrant __critical {
|
||||
// clang-format off
|
||||
void flash_entry(uint32_t addr, uint8_t *data, uint32_t length, uint8_t command) __reentrant __critical {
|
||||
// clang-format on
|
||||
// Only allow access from 64KB to 128KB.
|
||||
if ((addr < 0x10000)
|
||||
|| (length > 0x10000)
|
||||
|| ((addr + length) > 0x20000))
|
||||
if ((addr < 0x10000) || (length > 0x10000) || ((addr + length) > 0x20000))
|
||||
return;
|
||||
|
||||
if (command == FLASH_COMMAND_READ) {
|
||||
@ -91,8 +93,7 @@ void flash_entry(uint32_t addr, uint8_t * data, uint32_t length, uint8_t command
|
||||
|
||||
// Deselect
|
||||
ECINDAR1 = SPI_CHIP_DESELECT;
|
||||
ECINDDR = 0x00;
|
||||
|
||||
ECINDDR = 0x00;
|
||||
|
||||
// Wait WIP to be cleared
|
||||
flash_wait();
|
||||
@ -115,7 +116,7 @@ void flash_entry(uint32_t addr, uint8_t * data, uint32_t length, uint8_t command
|
||||
|
||||
// Deselect
|
||||
ECINDAR1 = SPI_CHIP_DESELECT;
|
||||
ECINDDR = 0x00;
|
||||
ECINDDR = 0x00;
|
||||
|
||||
// Wait WIP to be cleared
|
||||
flash_wait();
|
||||
@ -156,8 +157,8 @@ void flash_wait(void) {
|
||||
|
||||
// Deselect
|
||||
ECINDAR1 = SPI_CHIP_DESELECT;
|
||||
ECINDDR = 0x00;
|
||||
} while(status & SPI_STATUS_WIP);
|
||||
ECINDDR = 0x00;
|
||||
} while (status & SPI_STATUS_WIP);
|
||||
}
|
||||
|
||||
void flash_write_enable(void) {
|
||||
@ -169,5 +170,5 @@ void flash_write_enable(void) {
|
||||
|
||||
// Deselect
|
||||
ECINDAR1 = SPI_CHIP_DESELECT;
|
||||
ECINDDR = 0x00;
|
||||
ECINDDR = 0x00;
|
||||
}
|
||||
|
Reference in New Issue
Block a user