fixed minor inconsistencies between headers and source files and between asm and C sources

This commit is contained in:
Markus Fröschle
2013-12-17 14:16:29 +00:00
parent 0c01f71931
commit dd5e02cec9
6 changed files with 24 additions and 45 deletions

View File

@@ -25,12 +25,12 @@
#include <stddef.h> #include <stddef.h>
extern int strncmp(const char *s1, const char *s2, int max); extern int strncmp(const char *s1, const char *s2, size_t max);
extern char *strcpy(char *dst, const char *src); extern char *strcpy(char *dst, const char *src);
char *strncpy(char *dst, const char *src, int max); char *strncpy(char *dst, const char *src, size_t max);
extern size_t strlen(const char *str); extern size_t strlen(const char *str);
extern char *strcat(char *dst, const char *src); extern char *strcat(char *dst, const char *src);
extern char *strncat(char *dst, const char *src, int max); extern char *strncat(char *dst, const char *src, size_t max);
extern int atoi(const char *c); extern int atoi(const char *c);
extern void *memcpy(void *dst, const void *src, size_t n); extern void *memcpy(void *dst, const void *src, size_t n);
extern void *memset(void *s, int c, size_t n); extern void *memset(void *s, int c, size_t n);

View File

@@ -28,12 +28,11 @@
#define _WAIT_H_ #define _WAIT_H_
#include <bas_types.h> #include <bas_types.h>
#if MACHINE_FIREBEE #if MACHINE_FIREBEE
#include "firebee.h" #include "firebee.h"
#elif MACHINE_M5484LITE #elif MACHINE_M5484LITE
#include "m5484l.h" #include "m5484l.h"
#else
//#error unknown machine
#endif /* MACHINE_FIREBEE */ #endif /* MACHINE_FIREBEE */
#include "MCF5475.h" #include "MCF5475.h"
@@ -60,7 +59,7 @@ extern __inline__ void wait(uint32_t us)
extern __inline__ bool waitfor(uint32_t us, checker_func condition) extern __inline__ bool waitfor(uint32_t us, checker_func condition)
{ {
int32_t target = MCF_SLT_SCNT(0) - (us * (SYSCLK / 1000)); int32_t target = MCF_SLT_SCNT(0) - (us * (SYSCLK / 1000));
uint32_t res; bool res;
do do
{ {

View File

@@ -55,7 +55,7 @@ void *memset(void *s, int c, size_t n)
} }
int strncmp(const char *s1, const char *s2, int max) int strncmp(const char *s1, const char *s2, size_t max)
{ {
int i; int i;
int cmp; int cmp;
@@ -76,13 +76,14 @@ char *strcpy(char *dst, const char *src)
return ptr; return ptr;
} }
char *strncpy(char *dst, const char *src, int max) char *strncpy(char *dst, const char *src, size_t max)
{ {
char *ptr = dst; char *ptr = dst;
while ((*dst++ = *src++) != '\0' && max-- >= 0); while ((*dst++ = *src++) != '\0' && max-- >= 0);
return ptr; return ptr;
} }
int atoi(const char *c) int atoi(const char *c)
{ {
int value = 0; int value = 0;
@@ -113,9 +114,9 @@ char *strcat(char *dst, const char *src)
return ret; return ret;
} }
char *strncat(char *dst, const char *src, int max) char *strncat(char *dst, const char *src, size_t max)
{ {
int i; size_t i;
char *ret = dst; char *ret = dst;
dst = &dst[strlen(dst)]; dst = &dst[strlen(dst)];

View File

@@ -69,7 +69,6 @@
#define MCF_PSC3_PSCTB_8BIT __MBAR+0x890C #define MCF_PSC3_PSCTB_8BIT __MBAR+0x890C
.global _vec_init .global _vec_init
.global _asm_set_ipl
// interrupt sources // interrupt sources
.equ INT_SOURCE_EPORT_EPF1,1 // edge port flag 1 .equ INT_SOURCE_EPORT_EPF1,1 // edge port flag 1
@@ -1165,29 +1164,3 @@ video_chg_end:
lea 7 * 4(sp),a7 lea 7 * 4(sp),a7
rte rte
#endif /* MACHINE_FIREBEE */ #endif /* MACHINE_FIREBEE */
asm_set_ipl:
_asm_set_ipl:
link a6,#-8 // some space for locals
movem.l d6-d7,(sp) // save register
move.w sr,d7 // current sr
move.l d7,d0 // prepare return value
andi.l #0x0700,d0 // maks out ipl bits
lsr.l #8,d0 // IPL
move.l 8(a6),d6 // get argument
andi.l #0x07,d6 // least significant three bits
lsl.l #8,d6 // shift to make mask
andi.l #0x0000f8ff,d7 // zero out current ipl
or.l d6,d7 // place new ipl in sr
move.w d7,sr
movem.l (sp),d6-d7 // restore registers
lea 8(sp),sp // clear local variables
unlk a6
rts

View File

@@ -203,7 +203,7 @@ void init_gpio(void)
MCF_PAD_PAR_TIMER_PAR_TIN2(MCF_PAD_PAR_TIMER_PAR_TIN2_IRQ2) | MCF_PAD_PAR_TIMER_PAR_TIN2(MCF_PAD_PAR_TIMER_PAR_TIN2_IRQ2) |
MCF_PAD_PAR_TIMER_PAR_TOUT2; MCF_PAD_PAR_TIMER_PAR_TOUT2;
// MCF_PAD_PAR_TIMER = 0b00101101; /* TIN3..2=#IRQ3..2;TOUT3..2=NORMAL */ // MCF_PAD_PAR_TIMER = 0b00101101; TIN3..2=#IRQ3..2;TOUT3..2=NORMAL
// ALLE OUTPUTS NORMAL LOW // ALLE OUTPUTS NORMAL LOW
@@ -277,7 +277,9 @@ void init_serial(void)
MCF_PSC3_PSCCR = 0x05; MCF_PSC3_PSCCR = 0x05;
#endif /* MACHINE_FIREBEE */ #endif /* MACHINE_FIREBEE */
//MCF_INTC_ICR32 = 0x3F; //MAXIMALE PRIORITY/**********/ #ifdef _NOT_USED_
MCF_INTC_ICR32 = 0x3F; //MAXIMALE PRIORITY/**********/
#endif /* _NOT_USED_ */
xprintf("\r\nserial interfaces initialization: finished\r\n"); xprintf("\r\nserial interfaces initialization: finished\r\n");
} }
@@ -709,7 +711,10 @@ void dvi_on(void) {
if (MCF_I2C_I2SR & MCF_I2C_I2SR_RXAK) /* next try if no acknowledge */ if (MCF_I2C_I2SR & MCF_I2C_I2SR_RXAK) /* next try if no acknowledge */
continue; continue;
MCF_I2C_I2CR &= 0xef; //~MCF_I2C_I2CR_MTX; /* switch to receive mode */ #ifdef _NOT_USED_
MCH_I2C_I2CR &= ~MCF_I2C_I2CR_MTX; /* FIXME: not clear where this came from ... */
#endif /* _NOT_USED_ */
MCF_I2C_I2CR &= 0xef; /* ... this actually disables the I2C module... */
dummyByte = MCF_I2C_I2DR; /* dummy read */ dummyByte = MCF_I2C_I2DR; /* dummy read */
wait_i2c_transfer_finished(); wait_i2c_transfer_finished();
@@ -969,7 +974,6 @@ void initialize_hardware(void)
init_serial(); init_serial();
xprintf("\n\n"); xprintf("\n\n");
//#ifdef _NOT_USED_
xprintf("%s BASIS system (BaS) v %d.%d (%s, %s)\r\n\r\n", xprintf("%s BASIS system (BaS) v %d.%d (%s, %s)\r\n\r\n",
#if MACHINE_FIREBEE #if MACHINE_FIREBEE
"Firebee" "Firebee"
@@ -979,7 +983,6 @@ void initialize_hardware(void)
"unknown platform" "unknown platform"
#endif #endif
, MAJOR_VERSION, MINOR_VERSION, __DATE__, __TIME__); , MAJOR_VERSION, MINOR_VERSION, __DATE__, __TIME__);
//#endif /* _NOT_USED_ */
/* /*
* Determine cause(s) of Reset * Determine cause(s) of Reset
@@ -1059,8 +1062,11 @@ void initialize_hardware(void)
* install (preliminary) exception vectors * install (preliminary) exception vectors
*/ */
setup_vectors(); setup_vectors();
#ifdef _NOT_USED_
/* make sure the handlers are called */ /* make sure the handlers are called */
// __asm__ __volatile__("dc.w 0xafff"); /* should trigger a line-A exception */ __asm__ __volatile__("dc.w 0xafff"); /* should trigger a line-A exception */
#endif /* _NOT_USED_ */
/* /*

View File

@@ -126,7 +126,7 @@ static int usb_mouse_irq(struct usb_device *dev)
char wheel = 0, buttons, old_buttons; char wheel = 0, buttons, old_buttons;
mse_printf("USB MOUSE len:%d %02X %02X %02X %02X %02X %02X\r\n", dev->irq_act_len, new[0], new[1], new[2], new[3], new[4], new[5]); mse_printf("USB MOUSE len:%d %02X %02X %02X %02X %02X %02X\r\n", dev->irq_act_len, new[0], new[1], new[2], new[3], new[4], new[5]);
#ifdef CONFIG_USB_INTERRUPT_POLLING #ifdef CONFIG_USB_INTERRUPT_POLLING
level = asm_set_ipl(7); /* mask interrupts */ level = set_ipl(7); /* mask interrupts */
#endif #endif
if((dev->irq_act_len >= 6) && (new[0] == 1)) /* report-ID */ if((dev->irq_act_len >= 6) && (new[0] == 1)) /* report-ID */
{ {
@@ -178,7 +178,7 @@ static int usb_mouse_irq(struct usb_device *dev)
//if(mousevec != NULL) //if(mousevec != NULL)
//call_mousevec(new, mousevec); //call_mousevec(new, mousevec);
#ifdef CONFIG_USB_INTERRUPT_POLLING #ifdef CONFIG_USB_INTERRUPT_POLLING
asm_set_ipl(level); set_ipl(level);
#endif #endif
old[0] = new[0]; old[0] = new[0];
old[1] = new[1]; old[1] = new[1];