fixed comments
This commit is contained in:
@@ -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__));
|
||||||
|
|
||||||
|
|||||||
29
sys/BaS.c
29
sys/BaS.c
@@ -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();
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -338,6 +338,10 @@ void irq7_handler(void)
|
|||||||
#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)
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user