fixed comments

This commit is contained in:
Markus Fröschle
2014-12-16 20:33:51 +00:00
parent 764e089806
commit dce24ff7c7
4 changed files with 38 additions and 17 deletions

View File

@@ -85,7 +85,7 @@ typedef struct _BPB
/* a riddle: how do you typedef a function pointer to a function that returns its own type? ;) */ /* 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, ...); 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__)); extern xhdi_call_fun xhdi_sd_install(xhdi_call_fun old_vector) __attribute__((__interrupt__));

View File

@@ -57,6 +57,7 @@
#else #else
#define dbg(format, arg...) do { ; } while (0) #define dbg(format, arg...) do { ; } while (0)
#endif #endif
#define err(format, arg...) do { xprintf("ERROR: %s(): " format, __FUNCTION__, ##arg); } while (0)
/* imported routines */ /* imported routines */
extern int vec_init(); extern int vec_init();
@@ -79,7 +80,9 @@ extern uint8_t _EMUTOS_SIZE[];
static inline bool pic_txready(void) static inline bool pic_txready(void)
{ {
if (MCF_PSC3_PSCSR & MCF_PSC_PSCSR_TXRDY) if (MCF_PSC3_PSCSR & MCF_PSC_PSCSR_TXRDY)
{
return true; return true;
}
return false; return false;
} }
@@ -90,26 +93,36 @@ static inline bool pic_txready(void)
static inline bool pic_rxready(void) static inline bool pic_rxready(void)
{ {
if (MCF_PSC3_PSCSR & MCF_PSC_PSCSR_RXRDY) if (MCF_PSC3_PSCSR & MCF_PSC_PSCSR_RXRDY)
{
return true; return true;
}
return false; return false;
} }
void write_pic_byte(uint8_t value) 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); waitfor(1000, pic_txready);
/* Transmit the byte */ /*
* Transmit the byte
*/
*(volatile uint8_t*)(&MCF_PSC3_PSCTB_8BIT) = value; // Really 8-bit *(volatile uint8_t*)(&MCF_PSC3_PSCTB_8BIT) = value; // Really 8-bit
} }
uint8_t read_pic_byte(void) 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); waitfor(1000, pic_rxready);
/* Return the received byte */ /*
* Return the received byte
*/
return * (volatile uint8_t *) (&MCF_PSC3_PSCTB_8BIT); // Really 8-bit return * (volatile uint8_t *) (&MCF_PSC3_PSCTB_8BIT); // Really 8-bit
} }
@@ -119,13 +132,17 @@ void pic_init(void)
xprintf("initialize the PIC: "); xprintf("initialize the PIC: ");
/* Send the PIC initialization string */ /*
* Send the PIC initialization string
*/
write_pic_byte('A'); write_pic_byte('A');
write_pic_byte('C'); write_pic_byte('C');
write_pic_byte('P'); write_pic_byte('P');
write_pic_byte('F'); 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[0] = read_pic_byte();
answer[1] = read_pic_byte(); answer[1] = read_pic_byte();
answer[2] = read_pic_byte(); answer[2] = read_pic_byte();

View File

@@ -182,7 +182,7 @@ int pic_interrupt_handler(void *arg1, void *arg2)
uint8_t *rtc_data = (uint8_t *) 0xffff8963; uint8_t *rtc_data = (uint8_t *) 0xffff8963;
int index = 0; 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 MCF_PSC3_PSCTB_8BIT = 0x82; // header byte to PIC
do do
@@ -305,7 +305,7 @@ bool irq6_handler(uint32_t sf1, uint32_t sf2)
if (FALCON_MFP_IPRA || FALCON_MFP_IPRB) if (FALCON_MFP_IPRA || FALCON_MFP_IPRB)
{ {
blink_led(); blink_led();
} }
return handled; return handled;
@@ -328,23 +328,27 @@ void irq7_handler(void)
dbg("IRQ7!\r\n"); dbg("IRQ7!\r\n");
if ((handle = pci_get_interrupt_cause()) > 0) if ((handle = pci_get_interrupt_cause()) > 0)
{ {
newvalue = pci_call_interrupt_chain(handle, value); newvalue = pci_call_interrupt_chain(handle, value);
if (newvalue == value) if (newvalue == value)
{ {
dbg("interrupt not handled!\r\n"); dbg("interrupt not handled!\r\n");
} }
} }
} }
#endif /* MACHINE_M548X */ #endif /* MACHINE_M548X */
#if defined(MACHINE_FIREBEE) #if defined(MACHINE_FIREBEE)
/*
* Firebee/Falcon Videl registers
* TODO: should go into an include file
*/
#define vbasehi (* (volatile uint8_t *) 0xffff8201) #define vbasehi (* (volatile uint8_t *) 0xffff8201)
#define vbasemid (* (volatile uint8_t *) 0xffff8203) #define vbasemid (* (volatile uint8_t *) 0xffff8203)
#define vbaselow (* (volatile uint8_t *) 0xffff820d) #define vbaselow (* (volatile uint8_t *) 0xffff820d)
#define vwrap (* (volatile uint16_t *) 0xffff8210) #define vwrap (* (volatile uint16_t *) 0xffff8210)
#define vde (* (volatile uint16_t *) 0xffff82aa) #define vde (* (volatile uint16_t *) 0xffff82aa)
#define vdb (* (volatile uint16_t *) 0xffff82a8) #define vdb (* (volatile uint16_t *) 0xffff82a8)
/* /*
* this is the higlevel interrupt service routine for gpt0 timer interrupts. * this is the higlevel interrupt service routine for gpt0 timer interrupts.

View File

@@ -27,7 +27,7 @@
#include "bas_printf.h" #include "bas_printf.h"
unsigned long xhdi_call(uint16_t *stack) uint32_t xhdi_call(uint16_t *stack)
{ {
uint16_t opcode = *stack; uint16_t opcode = *stack;