fskmodem_float.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. typedef struct {
  29. float spb; /*!< Samples / Bit */
  30. int nbit; /*!< Number of Data Bits (5,7,8) */
  31. float nstop; /*!< Number of Stop Bits 1,1.5,2 */
  32. int parity; /*!< Parity 0=none 1=even 2=odd */
  33. int hdlc; /*!< Modo Packet */
  34. float x0;
  35. float x1;
  36. float x2;
  37. float cont;
  38. int bw; /*!< Bandwidth */
  39. double fmxv[8],fmyv[8]; /*!< filter stuff for M filter */
  40. int fmp; /*!< pointer for M filter */
  41. double fsxv[8],fsyv[8]; /*!< filter stuff for S filter */
  42. int fsp; /*!< pointer for S filter */
  43. double flxv[8],flyv[8]; /*!< filter stuff for L filter */
  44. int flp; /*!< pointer for L filter */
  45. int f_mark_idx; /*!< Mark frequency index (f_M-500)/5 */
  46. int f_space_idx; /*!< Space frequency index (f_S-500)/5 */
  47. int state;
  48. int pcola; /*!< Pointer to data queues */
  49. float cola_in[NCOLA]; /*!< Queue of input samples */
  50. float cola_filter[NCOLA]; /*!< Queue of samples after filters */
  51. float cola_demod[NCOLA]; /*!< Queue of demodulated samples */
  52. } fsk_data;
  53. /* \brief Retrieve a serial byte into outbyte.
  54. Buffer is a pointer into a series of
  55. shorts and len records the number of bytes in the buffer. len will be
  56. overwritten with the number of bytes left that were not consumed.
  57. \return return value is as follows:
  58. \arg 0: Still looking for something...
  59. \arg 1: An output byte was received and stored in outbyte
  60. \arg -1: An error occured in the transmission
  61. He must be called with at least 80 bytes of buffer. */
  62. int fsk_serial(fsk_data *fskd, short *buffer, int *len, int *outbyte);
  63. #endif /* _ASTERISK_FSKMODEM_H */