Path: blob/main/sys/contrib/ncsw/inc/etc/sprint_ext.h
48375 views
/* Copyright (c) 2008-2012 Freescale Semiconductor, Inc1* All rights reserved.2*3* Redistribution and use in source and binary forms, with or without4* modification, are permitted provided that the following conditions are met:5* * Redistributions of source code must retain the above copyright6* notice, this list of conditions and the following disclaimer.7* * Redistributions in binary form must reproduce the above copyright8* notice, this list of conditions and the following disclaimer in the9* documentation and/or other materials provided with the distribution.10* * Neither the name of Freescale Semiconductor nor the11* names of its contributors may be used to endorse or promote products12* derived from this software without specific prior written permission.13*14*15* ALTERNATIVELY, this software may be distributed under the terms of the16* GNU General Public License ("GPL") as published by the Free Software17* Foundation, either version 2 of that License or (at your option) any18* later version.19*20* THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY21* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED22* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE23* DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY24* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES25* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;26* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND27* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT28* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS29* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.30*/313233/**************************************************************************//**34@File sprint_ext.h3536@Description Debug routines (externals).3738*//***************************************************************************/3940#ifndef __SPRINT_EXT_H41#define __SPRINT_EXT_H424344#if defined(NCSW_LINUX) && defined(__KERNEL__)45#include <linux/kernel.h>4647#elif defined(NCSW_VXWORKS)48#include "private/stdioP.h"4950#elif defined(NCSW_FREEBSD)51#include <sys/param.h>52#include <sys/kernel.h>53#include <sys/libkern.h>5455#else56#include <stdio.h>57#endif /* defined(NCSW_LINUX) && defined(__KERNEL__) */5859#include "std_ext.h"606162/**************************************************************************//**63@Group etc_id Utility Library Application Programming Interface6465@Description External routines.6667@{68*//***************************************************************************/6970/**************************************************************************//**71@Group sprint_id Sprint7273@Description Sprint & Sscan module functions,definitions and enums.7475@{76*//***************************************************************************/7778/**************************************************************************//**79@Function Sprint8081@Description Format a string and place it in a buffer.8283@Param[in] buff - The buffer to place the result into.84@Param[in] str - The format string to use.85@Param[in] ... - Arguments for the format string.8687@Return Number of bytes formatted.88*//***************************************************************************/89int Sprint(char *buff, const char *str, ...);9091/**************************************************************************//**92@Function Snprint9394@Description Format a string and place it in a buffer.9596@Param[in] buf - The buffer to place the result into.97@Param[in] size - The size of the buffer, including the trailing null space.98@Param[in] fmt - The format string to use.99@Param[in] ... - Arguments for the format string.100101@Return Number of bytes formatted.102*//***************************************************************************/103int Snprint(char * buf, uint32_t size, const char *fmt, ...);104105/**************************************************************************//**106@Function Sscan107108@Description Unformat a buffer into a list of arguments.109110@Param[in] buf - input buffer.111@Param[in] fmt - formatting of buffer.112@Param[out] ... - resulting arguments.113114@Return Number of bytes unformatted.115*//***************************************************************************/116int Sscan(const char * buf, const char * fmt, ...);117118/** @} */ /* end of sprint_id group */119/** @} */ /* end of etc_id group */120121122#endif /* __SPRINT_EXT_H */123124125