fskmodem_int.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*
  2. * Asterisk -- An open source telephony toolkit.
  3. *
  4. * Copyright (C) 1999 - 2005, Digium, Inc.
  5. *
  6. * Mark Spencer <markster@digium.com>
  7. *
  8. * See http://www.asterisk.org for more information about
  9. * the Asterisk project. Please do not directly contact
  10. * any of the maintainers of this project for assistance;
  11. * the project provides a web site, mailing lists and IRC
  12. * channels for your use.
  13. *
  14. * This program is free software, distributed under the terms of
  15. * the GNU General Public License Version 2. See the LICENSE file
  16. * at the top of the source tree.
  17. */
  18. /*! \file
  19. * \brief FSK Modem Support
  20. * \note Includes code and algorithms from the Zapata library.
  21. */
  22. #ifndef _ASTERISK_FSKMODEM_H
  23. #define _ASTERISK_FSKMODEM_H
  24. #define PARITY_NONE 0
  25. #define PARITY_EVEN 1
  26. #define PARITY_ODD 2
  27. #define NCOLA 0x4000
  28. /* new filter structure */
  29. struct filter_struct {
  30. int icoefs[8];
  31. int ip;
  32. int ixv[8];
  33. int iyv[8];
  34. };
  35. typedef struct {
  36. int nbit; /*!< Number of Data Bits (5,7,8) */
  37. int parity; /*!< Parity 0=none 1=even 2=odd */
  38. int instop; /*!< Number of Stop Bits */
  39. int hdlc; /*!< Modo Packet */
  40. int xi0;
  41. int xi1;
  42. int xi2;
  43. int ispb;
  44. int icont;
  45. int bw; /*!< Band Selector*/
  46. int f_mark_idx; /*!< Mark Frequency Index (f_M-500)/5 */
  47. int f_space_idx; /*!< Space Frequency Index (f_S-500)/5 */
  48. int state;
  49. int pllispb; /*!<Pll autosense */
  50. int pllids;
  51. int pllispb2;
  52. struct filter_struct mark_filter;
  53. struct filter_struct space_filter;
  54. struct filter_struct demod_filter;
  55. } fsk_data;
  56. /* \brief Retrieve a serial byte into outbyte.
  57. Buffer is a pointer into a series of
  58. shorts and len records the number of bytes in the buffer. len will be
  59. overwritten with the number of bytes left that were not consumed.
  60. \return return value is as follows:
  61. \arg 0: Still looking for something...
  62. \arg 1: An output byte was received and stored in outbyte
  63. \arg -1: An error occured in the transmission
  64. This must be called with at least 80 bytes of buffer. */
  65. int fsk_serial(fsk_data *fskd, short *buffer, int *len, int *outbyte);
  66. int fskmodem_init(fsk_data *fskd);
  67. #endif /* _ASTERISK_FSKMODEM_H */