From dce24ff7c739c0766d10144ccd27784bebec755d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Fr=C3=B6schle?= Date: Tue, 16 Dec 2014 20:33:51 +0000 Subject: [PATCH] fixed comments --- include/xhdi_sd.h | 2 +- sys/BaS.c | 29 +++++++++++++++++++++++------ sys/interrupts.c | 22 +++++++++++++--------- xhdi/xhdi_interface.c | 2 +- 4 files changed, 38 insertions(+), 17 deletions(-) diff --git a/include/xhdi_sd.h b/include/xhdi_sd.h index abd988d..e855ea6 100644 --- a/include/xhdi_sd.h +++ b/include/xhdi_sd.h @@ -85,7 +85,7 @@ typedef struct _BPB /* a riddle: how do you typedef a function pointer to a function that returns its own type? ;) */ typedef void* (*xhdi_call_fun)(int xhdi_fun, ...); -extern unsigned long xhdi_call(uint16_t *stack); +extern uint32_t xhdi_call(uint16_t *stack); extern xhdi_call_fun xhdi_sd_install(xhdi_call_fun old_vector) __attribute__((__interrupt__)); diff --git a/sys/BaS.c b/sys/BaS.c index 90f3c1f..0f87ff3 100644 --- a/sys/BaS.c +++ b/sys/BaS.c @@ -57,6 +57,7 @@ #else #define dbg(format, arg...) do { ; } while (0) #endif +#define err(format, arg...) do { xprintf("ERROR: %s(): " format, __FUNCTION__, ##arg); } while (0) /* imported routines */ extern int vec_init(); @@ -79,7 +80,9 @@ extern uint8_t _EMUTOS_SIZE[]; static inline bool pic_txready(void) { if (MCF_PSC3_PSCSR & MCF_PSC_PSCSR_TXRDY) + { return true; + } return false; } @@ -90,26 +93,36 @@ static inline bool pic_txready(void) static inline bool pic_rxready(void) { if (MCF_PSC3_PSCSR & MCF_PSC_PSCSR_RXRDY) + { return true; + } return false; } void write_pic_byte(uint8_t value) { - /* Wait until the transmitter is ready or 1000us are passed */ + /* + * Wait until the transmitter is ready or 1000us are passed + */ waitfor(1000, pic_txready); - /* Transmit the byte */ + /* + * Transmit the byte + */ *(volatile uint8_t*)(&MCF_PSC3_PSCTB_8BIT) = value; // Really 8-bit } uint8_t read_pic_byte(void) { - /* Wait until a byte has been received or 1000us are passed */ + /* + * Wait until a byte has been received or 1000us are passed + */ waitfor(1000, pic_rxready); - /* Return the received byte */ + /* + * Return the received byte + */ return * (volatile uint8_t *) (&MCF_PSC3_PSCTB_8BIT); // Really 8-bit } @@ -119,13 +132,17 @@ void pic_init(void) xprintf("initialize the PIC: "); - /* Send the PIC initialization string */ + /* + * Send the PIC initialization string + */ write_pic_byte('A'); write_pic_byte('C'); write_pic_byte('P'); write_pic_byte('F'); - /* Read the 3-char answer string. Should be "OK!". */ + /* + * Read the 3-char answer string. Should be "OK!". + */ answer[0] = read_pic_byte(); answer[1] = read_pic_byte(); answer[2] = read_pic_byte(); diff --git a/sys/interrupts.c b/sys/interrupts.c index 5616c8a..be0480e 100644 --- a/sys/interrupts.c +++ b/sys/interrupts.c @@ -182,7 +182,7 @@ int pic_interrupt_handler(void *arg1, void *arg2) uint8_t *rtc_data = (uint8_t *) 0xffff8963; int index = 0; - xprintf("PIC interrupt: requesting RTC data\r\n"); + err("PIC interrupt: requesting RTC data\r\n"); MCF_PSC3_PSCTB_8BIT = 0x82; // header byte to PIC do @@ -305,7 +305,7 @@ bool irq6_handler(uint32_t sf1, uint32_t sf2) if (FALCON_MFP_IPRA || FALCON_MFP_IPRB) { - blink_led(); + blink_led(); } return handled; @@ -328,23 +328,27 @@ void irq7_handler(void) dbg("IRQ7!\r\n"); if ((handle = pci_get_interrupt_cause()) > 0) { - newvalue = pci_call_interrupt_chain(handle, value); - if (newvalue == value) - { - dbg("interrupt not handled!\r\n"); - } + newvalue = pci_call_interrupt_chain(handle, value); + if (newvalue == value) + { + dbg("interrupt not handled!\r\n"); + } } } #endif /* MACHINE_M548X */ #if defined(MACHINE_FIREBEE) +/* + * Firebee/Falcon Videl registers + * TODO: should go into an include file + */ #define vbasehi (* (volatile uint8_t *) 0xffff8201) #define vbasemid (* (volatile uint8_t *) 0xffff8203) #define vbaselow (* (volatile uint8_t *) 0xffff820d) #define vwrap (* (volatile uint16_t *) 0xffff8210) -#define vde (* (volatile uint16_t *) 0xffff82aa) -#define vdb (* (volatile uint16_t *) 0xffff82a8) +#define vde (* (volatile uint16_t *) 0xffff82aa) +#define vdb (* (volatile uint16_t *) 0xffff82a8) /* * this is the higlevel interrupt service routine for gpt0 timer interrupts. diff --git a/xhdi/xhdi_interface.c b/xhdi/xhdi_interface.c index 10c8362..3b41f8e 100644 --- a/xhdi/xhdi_interface.c +++ b/xhdi/xhdi_interface.c @@ -27,7 +27,7 @@ #include "bas_printf.h" -unsigned long xhdi_call(uint16_t *stack) +uint32_t xhdi_call(uint16_t *stack) { uint16_t opcode = *stack;