aboutsummaryrefslogtreecommitdiff
path: root/ports/powerpc
diff options
context:
space:
mode:
authorDamien George2020-02-27 15:36:53 +1100
committerDamien George2020-02-28 10:33:03 +1100
commit69661f3343bedf86e514337cff63d96cc42f8859 (patch)
treeaf5dfb380ffdb75dda84828f63cf9d840d992f0f /ports/powerpc
parent3f39d18c2b884d32f0443e2e8114ff9d7a14d718 (diff)
all: Reformat C and Python source code with tools/codeformat.py.
This is run with uncrustify 0.70.1, and black 19.10b0.
Diffstat (limited to 'ports/powerpc')
-rw-r--r--ports/powerpc/frozentest.py8
-rw-r--r--ports/powerpc/main.c13
-rw-r--r--ports/powerpc/mpconfigport.h2
-rw-r--r--ports/powerpc/mphalport.h2
-rw-r--r--ports/powerpc/uart_lpc_serial.c8
-rw-r--r--ports/powerpc/uart_potato.c8
6 files changed, 27 insertions, 14 deletions
diff --git a/ports/powerpc/frozentest.py b/ports/powerpc/frozentest.py
index 0f99b7429..78cdd60bf 100644
--- a/ports/powerpc/frozentest.py
+++ b/ports/powerpc/frozentest.py
@@ -1,7 +1,7 @@
-print('uPy')
-print('a long string that is not interned')
-print('a string that has unicode αβγ chars')
-print(b'bytes 1234\x01')
+print("uPy")
+print("a long string that is not interned")
+print("a string that has unicode αβγ chars")
+print(b"bytes 1234\x01")
print(123456789)
for i in range(4):
print(i)
diff --git a/ports/powerpc/main.c b/ports/powerpc/main.c
index 9b164ac18..421f9be71 100644
--- a/ports/powerpc/main.c
+++ b/ports/powerpc/main.c
@@ -50,7 +50,8 @@ void __stack_chk_fail(void) {
void __assert_fail(const char *__assertion, const char *__file,
unsigned int __line, const char *__function) {
printf("Assert at %s:%d:%s() \"%s\" failed\n", __file, __line, __function, __assertion);
- for (;;) ;
+ for (;;) {;
+ }
}
static char *stack_top;
@@ -62,7 +63,7 @@ extern void uart_init_ppc(int qemu);
int main(int argc, char **argv) {
int stack_dummy;
- stack_top = (char*)&stack_dummy;
+ stack_top = (char *)&stack_dummy;
// microwatt has argc/r3 = 0 whereas QEMU has r3 set in head.S
uart_init_ppc(argc);
@@ -124,11 +125,15 @@ mp_obj_t mp_builtin_open(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs)
MP_DEFINE_CONST_FUN_OBJ_KW(mp_builtin_open_obj, 1, mp_builtin_open);
void nlr_jump_fail(void *val) {
- while (1);
+ while (1) {
+ ;
+ }
}
void NORETURN __fatal_error(const char *msg) {
- while (1);
+ while (1) {
+ ;
+ }
}
#ifndef NDEBUG
diff --git a/ports/powerpc/mpconfigport.h b/ports/powerpc/mpconfigport.h
index 93ef699ad..1800b8c7c 100644
--- a/ports/powerpc/mpconfigport.h
+++ b/ports/powerpc/mpconfigport.h
@@ -93,7 +93,7 @@
// type definitions for the specific machine
-#define MICROPY_MAKE_POINTER_CALLABLE(p) ((void*)((mp_uint_t)(p) | 1))
+#define MICROPY_MAKE_POINTER_CALLABLE(p) ((void *)((mp_uint_t)(p) | 1))
// This port is 64-bit
#define UINT_FMT "%lu"
diff --git a/ports/powerpc/mphalport.h b/ports/powerpc/mphalport.h
index c6bf94007..bb7fa34ca 100644
--- a/ports/powerpc/mphalport.h
+++ b/ports/powerpc/mphalport.h
@@ -25,7 +25,7 @@
*/
#define mftb() ({unsigned long rval; \
- __asm__ volatile("mftb %0" : "=r" (rval)); rval;})
+ __asm__ volatile ("mftb %0" : "=r" (rval)); rval;})
#define TBFREQ 512000000
diff --git a/ports/powerpc/uart_lpc_serial.c b/ports/powerpc/uart_lpc_serial.c
index 51a55cb1e..c15fc049b 100644
--- a/ports/powerpc/uart_lpc_serial.c
+++ b/ports/powerpc/uart_lpc_serial.c
@@ -101,11 +101,15 @@ void lpc_uart_init(void) {
}
char lpc_uart_read(void) {
- while (lpc_uart_rx_empty()) ;
+ while (lpc_uart_rx_empty()) {
+ ;
+ }
return lpc_uart_reg_read(REG_THR);
}
void lpc_uart_write(char c) {
- while (lpc_uart_tx_full());
+ while (lpc_uart_tx_full()) {
+ ;
+ }
lpc_uart_reg_write(REG_RBR, c);
}
diff --git a/ports/powerpc/uart_potato.c b/ports/powerpc/uart_potato.c
index 18f89d463..4a487f303 100644
--- a/ports/powerpc/uart_potato.c
+++ b/ports/powerpc/uart_potato.c
@@ -105,7 +105,9 @@ void potato_uart_init(void) {
char potato_uart_read(void) {
uint64_t val;
- while (potato_uart_rx_empty());
+ while (potato_uart_rx_empty()) {
+ ;
+ }
val = potato_uart_reg_read(POTATO_CONSOLE_RX);
return (char)(val & 0x000000ff);
@@ -116,6 +118,8 @@ void potato_uart_write(char c) {
val = c;
- while (potato_uart_tx_full());
+ while (potato_uart_tx_full()) {
+ ;
+ }
potato_uart_reg_write(POTATO_CONSOLE_TX, val);
}