uart.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /* sd2snes - SD card based universal cartridge for the SNES
  2. Copyright (C) 2009-2010 Maximilian Rehkopf <otakon@gmx.net>
  3. This file was adapted from sd2iec, written by Ingo Korb.
  4. Original copyright header follows:
  5. */
  6. /* sd2iec - SD/MMC to Commodore serial bus interface/controller
  7. Copyright (C) 2007-2009 Ingo Korb <ingo@akana.de>
  8. Inspiration and low-level SD/MMC access based on code from MMC2IEC
  9. by Lars Pontoppidan et al., see sdcard.c|h and config.h.
  10. FAT filesystem access based on code from ChaN and Jim Brain, see ff.c|h.
  11. This program is free software; you can redistribute it and/or modify
  12. it under the terms of the GNU General Public License as published by
  13. the Free Software Foundation; version 2 of the License only.
  14. This program is distributed in the hope that it will be useful,
  15. but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. GNU General Public License for more details.
  18. You should have received a copy of the GNU General Public License
  19. along with this program; if not, write to the Free Software
  20. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  21. uart.h: Definitions for the UART access routines
  22. */
  23. #ifndef UART_H
  24. #define UART_H
  25. #ifdef CONFIG_UART_DEBUG
  26. #include <avr/pgmspace.h>
  27. void uart_init(void);
  28. unsigned char uart_getc(void);
  29. void uart_putc(char c);
  30. void uart_puthex(uint8_t num);
  31. void uart_puthexlong(uint32_t num);
  32. void uart_puthexshort(uint16_t num);
  33. void uart_trace(void *ptr, uint16_t start, uint16_t len);
  34. void uart_flush(void);
  35. void uart_puts_P(prog_char *text);
  36. void uart_putcrlf(void);
  37. #include <stdio.h>
  38. #define dprintf(str,...) printf_P(PSTR(str), ##__VA_ARGS__)
  39. #else
  40. #define uart_init() do {} while(0)
  41. #define uart_getc() 0
  42. #define uart_putc(x) do {} while(0)
  43. #define uart_puthex(x) do {} while(0)
  44. #define uart_flush() do {} while(0)
  45. #define uart_puts_P(x) do {} while(0)
  46. #define uart_putcrlf() do {} while(0)
  47. #define uart_trace(a,b,c) do {} while(0)
  48. #endif
  49. #endif