relocate_io.c
来自「Coldfire MCF5282 DBug bootloader」· C语言 代码 · 共 58 行
C
58 行
/*
* File: relocate_io.c
* Purpose: Common routines for relocatable input/output routines
*
* Notes:
*
*/
#include "src/include/dbug.h"
#include "proj/common/relocate_io.h"
/*
* Compiler specific code relocation section
*/
#ifdef __DCC__
#pragma section CODE ".code_relocation"
#pragma section CONST ".code_relocation"
#endif
/********************************************************************/
#ifdef __MWERKS__
__relocate_code__
#endif
char
relocate_getchar (void)
{
/* Wait until character has been received */
while (!(MCF5282_UART0_USR & MCF5282_UART_USR_RXRDY))
;
return MCF5282_UART0_URB;
}
/********************************************************************/
#ifdef __MWERKS__
__relocate_code__
#endif
void
relocate_putchar (char ch)
{
/* Wait until space is available in the FIFO */
while (!(MCF5282_UART0_USR & MCF5282_UART_USR_TXRDY))
;
/* Send the character */
MCF5282_UART0_UTB = (uint8)ch;
}
/********************************************************************/
#ifdef __MWERKS__
__relocate_code__
#endif
int
relocate_getchar_present (void)
{
return (MCF5282_UART0_USR & MCF5282_UART_USR_RXRDY);
}
/********************************************************************/
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?