📄 example_aux.c.inc
字号:
/**
* \file $Id: example_aux.c.inc,v 1.1 2005/11/29 14:17:51 jasper Exp $
*
* \brief Auxiliary print- and timing-functions, used in the examples
*
* \note Copyright (c) 2005 Micronas GmbH \n
* All rights reserved
*
* \author Jasper Schrader
*/
/*
* $(c) 2005 Micronas GmbH. All rights reserved.
*
* This software and related documentation (the 'Software') are intellectual
* property owned by Micronas and are copyright of Micronas, unless specifically
* noted otherwise.
*
* Any use of the Software is permitted only pursuant to the terms of the
* license agreement, if any, which accompanies, is included with or applicable
* to the Software ('License Agreement') or upon express written consent of
* Micronas. Any copying, reproduction or redistribution of the Software in
* whole or in part by any means not in accordance with the License Agreement
* or as agreed in writing by Micronas is expressly prohibited.
*
* THE SOFTWARE IS WARRANTED, IF AT ALL, ONLY ACCORDING TO THE TERMS OF THE
* LICENSE AGREEMENT. EXCEPT AS WARRANTED IN THE LICENSE AGREEMENT THE SOFTWARE
* IS DELIVERED 'AS IS' AND MICRONAS HEREBY DISCLAIMS ALL WARRANTIES AND
* CONDITIONS WITH REGARD TO THE SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
* AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIT
* ENJOYMENT, TITLE AND NON-INFRINGEMENT OF ANY THIRD PARTY INTELLECTUAL
* PROPERTY OR OTHER RIGHTS WHICH MAY RESULT FROM THE USE OR THE INABILITY
* TO USE THE SOFTWARE.
*
* IN NO EVENT SHALL MICRONAS BE LIABLE FOR INDIRECT, INCIDENTAL, CONSEQUENTIAL,
* PUNITIVE, SPECIAL OR OTHER DAMAGES WHATSOEVER INCLUDING WITHOUT LIMITATION,
* DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS
* INFORMATION, AND THE LIKE, ARISING OUT OF OR RELATING TO THE USE OF OR THE
* INABILITY TO USE THE SOFTWARE, EVEN IF MICRONAS HAS BEEN ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES, EXCEPT PERSONAL INJURY OR DEATH RESULTING FROM
* MICRONAS' NEGLIGENCE. $
*
*/
/*-----------------------------------------------------------------------------
INCLUDES
-----------------------------------------------------------------------------*/
#include <stdio.h> /* For logging text output */
#include <stdarg.h> /* For logging text output */
#include <stdlib.h> /* For exit function */
#include "bsp_host.h" /* For waitmillisec function */
/*-----------------------------------------------------------------------------
FUNCTIONS
-----------------------------------------------------------------------------*/
void XPRINTF( const char* format, ... )
{
char textline[1024];
va_list arglist;
va_start( arglist, format );
vsprintf( textline, format, arglist );
va_end( arglist );
fprintf( stderr, textline );
}
void XWAITKEYPRESSED( const char* msg )
{
XPRINTF( msg );
getchar();
}
void XEND( void )
{
XWAITKEYPRESSED( "Press enter to quit.\n" );
exit(0);
}
void XERROR( const char* msg )
{
XPRINTF( msg );
XEND();
}
void XWAITMSECS( u32_t s )
{
u32_t start = 0; \
u32_t delta = 0; \
start = DRXBSP_HST_Clock(); \
do{
delta = DRXBSP_HST_Clock() - start;
}while ( delta < s );
}
/*============================================================================*/
/* END OF FILE */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -