ascii.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /**
  2. * \file ascii.h
  3. *
  4. * \brief This file contains the prototypes of the functions present in
  5. * utils/ascii.c
  6. */
  7. /*
  8. * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
  9. */
  10. /*
  11. * Redistribution and use in source and binary forms, with or without
  12. * modification, are permitted provided that the following conditions
  13. * are met:
  14. *
  15. * Redistributions of source code must retain the above copyright
  16. * notice, this list of conditions and the following disclaimer.
  17. *
  18. * Redistributions in binary form must reproduce the above copyright
  19. * notice, this list of conditions and the following disclaimer in the
  20. * documentation and/or other materials provided with the
  21. * distribution.
  22. *
  23. * Neither the name of Texas Instruments Incorporated nor the names of
  24. * its contributors may be used to endorse or promote products derived
  25. * from this software without specific prior written permission.
  26. *
  27. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  28. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  29. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  30. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  31. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  32. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  33. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  34. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  35. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  36. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  37. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  38. *
  39. */
  40. #ifndef _ASCII_H_
  41. #define _ASCII_H_
  42. #ifdef __cplusplus
  43. extern "C" {
  44. #endif
  45. enum {
  46. BASE_DECIMAL = 10,
  47. BASE_HEXADECIMAL = 16,
  48. };
  49. extern unsigned char ASCIIToDigit(unsigned char byte, unsigned int base);
  50. extern unsigned char DigitToASCII(unsigned char byte, unsigned int base);
  51. extern unsigned int StrToEthrAddr(unsigned char *strInput,
  52. unsigned char *ethAddr);
  53. extern unsigned int EthrAddrToStr(unsigned char *ethrAddrInput,
  54. unsigned char *strOutput);
  55. extern unsigned int TimeToStr(unsigned int timeInput, unsigned char *strOutput);
  56. extern unsigned int DateToStr(unsigned int dateInput, unsigned char *strOutput);
  57. #ifdef __cplusplus
  58. }
  59. #endif
  60. #endif