The dbg directory contains the platform dependant code for the debug agent driver. There are three files located at this top level:
C__SRCS = dbgBsp.c ns16550Bsp.c
AS_SRCS =
OBJS = $(C__SRCS:.c=.o) $(AS_SRCS:.s=.o)
DRIVERS = \
$(DRV_DIST_BIN)/dbg/ns16550.o
BspProgTarget(dbgBsp.r, dbgBsp_init, $(OBJS), $(DRIVERS) $(BSP_LIBS))
DistProgram(dbgBsp.r, $(MYBSP_DIST_BIN)$(REL_DIR))
Depend($(C__SRCS) $(AS_SRCS))
Note that dbgBsp.r is linked with the ns16550.o object, which is located in the DRV component.
#include <bki/bki.h>
#include <bki/dbgBsp.h>
#include <drv/dbg/dbgUart.h>
extern void dbg_board_reset(int);
DbgBsp dbgBsp = { dbgUart_init,
dbgUart_ioctl,
dbgUart_mayGet,
dbgUart_getChar,
dbgUart_mayPut,
dbgUart_putChar,
dbgUart_ioRemap,
dbg_board_reset };
void
dbg_board_reset(int mode)
{
/* Code for your board reset */
}
void
dbgBsp_init(BootConf* conf)
{
conf->dbgBsp = dbgBsp;
}
Note that dbgBsp.c needs to be adapted for your board.
#include <drv/dbg/ns16550Bsp.h>
void
ns16550_init(int port)
{
/* Code for your board */
}
void
ns16550_outb(unsigned int reg, unsigned char val)
{
/* Code for your board */
}
unsigned char
ns16550_inb(unsigned int reg)
{
unsigned char c;
/* Code for your board */
return c;
}
unsigned short
ns16550_divisor(unsigned int baud)
{
unsigned short divisor;
/* Code for your board */
return divisor;
}
void
ns16550_ioremap(void* newbase)
{
/* Code for your board */
}
Note that the example above is for an ns16550 BSP. The file will be need to be adapted for your board.