📄 example.c
字号:
/*
* File: example.c
* Purpose: Template for <project>.c which contains the board-specific
* routines that are required by dBUG
*
* Notes:
*
*/
#include "src/include/dbug.h"
#ifdef DBUG_NETWORK
/* put network specific includes/defines here */
#endif
/********************************************************************/
/*
* Global BSP variables referenced by dBUG
*/
const char BRD_STR[] = "EXAMPLE";
const int BRD_VER_MAJOR = 1;
const char BRD_VER_MINOR = 'a';
const char COPYRIGHT2[] = "";
/********************************************************************/
void
board_init (void)
{
extern REGISTERS context;
/*
* Good for detecting NULL dereferences
*/
*(ADDRESS *)(0) = 0;
/*
* Set dBUG user stack to top of SDRAM
*/
context.a7 = (SDRAM_ADDRESS + SDRAM_SIZE);
}
/********************************************************************/
void
board_init2 (void)
{
/* More board-specific initialization here */
}
/********************************************************************/
void
board_init3 (void)
{
/* More board-specific initialization here */
}
/********************************************************************/
char
board_getchar (void)
{
return CHARACTER_INPUT;
}
/********************************************************************/
void
board_putchar (char ch)
{
CHARACTER_OUTPUT(ch);
}
/********************************************************************/
int
board_getchar_present (void)
{
return TEST_FOR_CHAR_INPUT;
}
/********************************************************************/
void
board_putchar_flush (void)
{
FLUSH_CHARACTER_OUTPUT;
}
/********************************************************************/
int
board_dlio_init (void)
{
#ifdef DBUG_NETWORK
/*
* Download initialization routine
*/
#endif
return TRUE;
}
/********************************************************************/
void
board_dlio_done (void)
{
#ifdef DBUG_NETWORK
/*
* Download complete, clean up
*/
#endif
}
/********************************************************************/
int
board_dlio_getchar (void)
{
/* Download character input routine */
int ch;
switch (uif_dlio)
{
#ifdef DBUG_NETWORK
case UIF_DLIO_NETWORK:
ch = tftp_in_char();
break;
#endif
case UIF_DLIO_CONSOLE:
default:
ch = board_getchar();
break;
}
return ch;
}
/********************************************************************/
int
board_dlio_vda (ADDRESS addr)
{
/* Determines if the given address is valid for downloads */
if (((addr >= USER_SPACE) &&
(addr < SDRAM_SIZE))
|| ((addr >= EXT_SRAM_ADDRESS) &&
(addr < (EXT_SRAM_ADDRESS + EXT_SRAM_SIZE)))
|| ((addr >= SRAM_ADDRESS) &&
(addr < (SRAM_ADDRESS + SRAM_SIZE))))
return 1;
else
return 0;
}
/********************************************************************/
#ifdef DBUG_NETWORK
int
board_dlio_filetype (char *filename, char *ext)
{
(void)filename;
(void)ext;
return UIF_DLIO_UNKNOWN;
}
#endif
/********************************************************************/
void
board_reset (void)
{
/*
* Initiate software reset
*/
}
/********************************************************************/
void
board_irq_enable (void)
{
/*
* Enable Interrupts
*/
}
/********************************************************************/
void
board_irq_disable (void)
{
/*
* Disable Interrupts
*/
}
/********************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -