1*852ba100SJustin Hibbits /* Copyright (c) 2008-2012 Freescale Semiconductor, Inc 20aeed3e9SJustin Hibbits * All rights reserved. 30aeed3e9SJustin Hibbits * 40aeed3e9SJustin Hibbits * Redistribution and use in source and binary forms, with or without 50aeed3e9SJustin Hibbits * modification, are permitted provided that the following conditions are met: 60aeed3e9SJustin Hibbits * * Redistributions of source code must retain the above copyright 70aeed3e9SJustin Hibbits * notice, this list of conditions and the following disclaimer. 80aeed3e9SJustin Hibbits * * Redistributions in binary form must reproduce the above copyright 90aeed3e9SJustin Hibbits * notice, this list of conditions and the following disclaimer in the 100aeed3e9SJustin Hibbits * documentation and/or other materials provided with the distribution. 110aeed3e9SJustin Hibbits * * Neither the name of Freescale Semiconductor nor the 120aeed3e9SJustin Hibbits * names of its contributors may be used to endorse or promote products 130aeed3e9SJustin Hibbits * derived from this software without specific prior written permission. 140aeed3e9SJustin Hibbits * 150aeed3e9SJustin Hibbits * 160aeed3e9SJustin Hibbits * ALTERNATIVELY, this software may be distributed under the terms of the 170aeed3e9SJustin Hibbits * GNU General Public License ("GPL") as published by the Free Software 180aeed3e9SJustin Hibbits * Foundation, either version 2 of that License or (at your option) any 190aeed3e9SJustin Hibbits * later version. 200aeed3e9SJustin Hibbits * 210aeed3e9SJustin Hibbits * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY 220aeed3e9SJustin Hibbits * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 230aeed3e9SJustin Hibbits * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 240aeed3e9SJustin Hibbits * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY 250aeed3e9SJustin Hibbits * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 260aeed3e9SJustin Hibbits * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 270aeed3e9SJustin Hibbits * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 280aeed3e9SJustin Hibbits * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 290aeed3e9SJustin Hibbits * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 300aeed3e9SJustin Hibbits * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 310aeed3e9SJustin Hibbits */ 320aeed3e9SJustin Hibbits 330aeed3e9SJustin Hibbits 34*852ba100SJustin Hibbits /**************************************************************************//** 350aeed3e9SJustin Hibbits @File sprint_ext.h 360aeed3e9SJustin Hibbits 370aeed3e9SJustin Hibbits @Description Debug routines (externals). 380aeed3e9SJustin Hibbits 390aeed3e9SJustin Hibbits *//***************************************************************************/ 400aeed3e9SJustin Hibbits 410aeed3e9SJustin Hibbits #ifndef __SPRINT_EXT_H 420aeed3e9SJustin Hibbits #define __SPRINT_EXT_H 430aeed3e9SJustin Hibbits 440aeed3e9SJustin Hibbits 450aeed3e9SJustin Hibbits #if defined(NCSW_LINUX) && defined(__KERNEL__) 460aeed3e9SJustin Hibbits #include <linux/kernel.h> 470aeed3e9SJustin Hibbits 480aeed3e9SJustin Hibbits #elif defined(NCSW_VXWORKS) 490aeed3e9SJustin Hibbits #include "private/stdioP.h" 500aeed3e9SJustin Hibbits 510aeed3e9SJustin Hibbits #elif defined(NCSW_FREEBSD) 520aeed3e9SJustin Hibbits #include <sys/param.h> 530aeed3e9SJustin Hibbits #include <sys/kernel.h> 540aeed3e9SJustin Hibbits #include <sys/libkern.h> 550aeed3e9SJustin Hibbits 560aeed3e9SJustin Hibbits #else 570aeed3e9SJustin Hibbits #include <stdio.h> 580aeed3e9SJustin Hibbits #endif /* defined(NCSW_LINUX) && defined(__KERNEL__) */ 590aeed3e9SJustin Hibbits 600aeed3e9SJustin Hibbits #include "std_ext.h" 610aeed3e9SJustin Hibbits 620aeed3e9SJustin Hibbits 630aeed3e9SJustin Hibbits /**************************************************************************//** 640aeed3e9SJustin Hibbits @Group etc_id Utility Library Application Programming Interface 650aeed3e9SJustin Hibbits 660aeed3e9SJustin Hibbits @Description External routines. 670aeed3e9SJustin Hibbits 680aeed3e9SJustin Hibbits @{ 690aeed3e9SJustin Hibbits *//***************************************************************************/ 700aeed3e9SJustin Hibbits 710aeed3e9SJustin Hibbits /**************************************************************************//** 720aeed3e9SJustin Hibbits @Group sprint_id Sprint 730aeed3e9SJustin Hibbits 740aeed3e9SJustin Hibbits @Description Sprint & Sscan module functions,definitions and enums. 750aeed3e9SJustin Hibbits 760aeed3e9SJustin Hibbits @{ 770aeed3e9SJustin Hibbits *//***************************************************************************/ 780aeed3e9SJustin Hibbits 790aeed3e9SJustin Hibbits /**************************************************************************//** 800aeed3e9SJustin Hibbits @Function Sprint 810aeed3e9SJustin Hibbits 820aeed3e9SJustin Hibbits @Description Format a string and place it in a buffer. 830aeed3e9SJustin Hibbits 840aeed3e9SJustin Hibbits @Param[in] buff - The buffer to place the result into. 850aeed3e9SJustin Hibbits @Param[in] str - The format string to use. 860aeed3e9SJustin Hibbits @Param[in] ... - Arguments for the format string. 870aeed3e9SJustin Hibbits 880aeed3e9SJustin Hibbits @Return Number of bytes formatted. 890aeed3e9SJustin Hibbits *//***************************************************************************/ 900aeed3e9SJustin Hibbits int Sprint(char *buff, const char *str, ...); 910aeed3e9SJustin Hibbits 920aeed3e9SJustin Hibbits /**************************************************************************//** 930aeed3e9SJustin Hibbits @Function Snprint 940aeed3e9SJustin Hibbits 950aeed3e9SJustin Hibbits @Description Format a string and place it in a buffer. 960aeed3e9SJustin Hibbits 970aeed3e9SJustin Hibbits @Param[in] buf - The buffer to place the result into. 980aeed3e9SJustin Hibbits @Param[in] size - The size of the buffer, including the trailing null space. 990aeed3e9SJustin Hibbits @Param[in] fmt - The format string to use. 1000aeed3e9SJustin Hibbits @Param[in] ... - Arguments for the format string. 1010aeed3e9SJustin Hibbits 1020aeed3e9SJustin Hibbits @Return Number of bytes formatted. 1030aeed3e9SJustin Hibbits *//***************************************************************************/ 1040aeed3e9SJustin Hibbits int Snprint(char * buf, uint32_t size, const char *fmt, ...); 1050aeed3e9SJustin Hibbits 1060aeed3e9SJustin Hibbits /**************************************************************************//** 1070aeed3e9SJustin Hibbits @Function Sscan 1080aeed3e9SJustin Hibbits 1090aeed3e9SJustin Hibbits @Description Unformat a buffer into a list of arguments. 1100aeed3e9SJustin Hibbits 1110aeed3e9SJustin Hibbits @Param[in] buf - input buffer. 1120aeed3e9SJustin Hibbits @Param[in] fmt - formatting of buffer. 1130aeed3e9SJustin Hibbits @Param[out] ... - resulting arguments. 1140aeed3e9SJustin Hibbits 1150aeed3e9SJustin Hibbits @Return Number of bytes unformatted. 1160aeed3e9SJustin Hibbits *//***************************************************************************/ 1170aeed3e9SJustin Hibbits int Sscan(const char * buf, const char * fmt, ...); 1180aeed3e9SJustin Hibbits 1190aeed3e9SJustin Hibbits /** @} */ /* end of sprint_id group */ 1200aeed3e9SJustin Hibbits /** @} */ /* end of etc_id group */ 1210aeed3e9SJustin Hibbits 1220aeed3e9SJustin Hibbits 1230aeed3e9SJustin Hibbits #endif /* __SPRINT_EXT_H */ 124