es705-uart-common.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * es705-uart-common.h -- Audience eS705 UART interface
  3. *
  4. * Copyright 2013 Audience, Inc.
  5. *
  6. * Author: Matt Lupfer <mlupfer@cardinalpeak.com>
  7. *
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License version 2 as
  11. * published by the Free Software Foundation.
  12. */
  13. #ifndef _ES705_UART_COMMON_H
  14. #define _ES705_UART_COMMON_H
  15. #define UART_TTY_DEVICE_NODE "/dev/ttyHS3"
  16. #define UART_TTY_BAUD_RATE_BOOTLOADER 460800
  17. #define UART_TTY_BAUD_RATE_FW_DOWNLOAD 1000000
  18. #define UART_TTY_BAUD_RATE_FIRMWARE 3000000
  19. #define UART_TTY_STOP_BITS 2
  20. #define UART_TTY_WRITE_SZ 512
  21. #define ES705_SBL_SYNC_CMD 0x00
  22. #define ES705_SBL_SYNC_ACK ES705_SBL_SYNC_CMD
  23. #define ES705_SBL_BOOT_CMD 0x01
  24. #define ES705_SBL_BOOT_ACK ES705_SBL_BOOT_CMD
  25. #define ES705_SBL_FW_ACK 0x02
  26. enum {
  27. UART_CLOSE,
  28. UART_OPEN,
  29. };
  30. int es705_uart_read(struct es705_priv *es705, void *buf, int len);
  31. int es705_uart_write(struct es705_priv *es705, const void *buf, int len);
  32. int es705_uart_write_then_read(struct es705_priv *es705, const void *buf,
  33. int len, u32 *rspn, int match);
  34. int es705_uart_cmd(struct es705_priv *es705, u32 cmd, int sr, u32 *resp);
  35. int es705_configure_tty(struct tty_struct *tty, u32 bps, int stop);
  36. void es705_set_tty_baud_rate(int index);
  37. int es705_uart_open(struct es705_priv *es705);
  38. int es705_uart_close(struct es705_priv *es705);
  39. int es705_uart_wait(struct es705_priv *es705);
  40. extern struct es_stream_device uart_streamdev;
  41. #endif