logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

cs-protocol.h (3003B)


  1. /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
  2. /*
  3. * cmt-speech interface definitions
  4. *
  5. * Copyright (C) 2008,2009,2010 Nokia Corporation. All rights reserved.
  6. *
  7. * Contact: Kai Vehmanen <kai.vehmanen@nokia.com>
  8. * Original author: Peter Ujfalusi <peter.ujfalusi@nokia.com>
  9. */
  10. #ifndef _CS_PROTOCOL_H
  11. #define _CS_PROTOCOL_H
  12. #include <linux/types.h>
  13. #include <linux/ioctl.h>
  14. /* chardev parameters */
  15. #define CS_DEV_FILE_NAME "/dev/cmt_speech"
  16. /* user-space API versioning */
  17. #define CS_IF_VERSION 2
  18. /* APE kernel <-> user space messages */
  19. #define CS_CMD_SHIFT 28
  20. #define CS_DOMAIN_SHIFT 24
  21. #define CS_CMD_MASK 0xff000000
  22. #define CS_PARAM_MASK 0xffffff
  23. #define CS_CMD(id, dom) \
  24. (((id) << CS_CMD_SHIFT) | ((dom) << CS_DOMAIN_SHIFT))
  25. #define CS_ERROR CS_CMD(1, 0)
  26. #define CS_RX_DATA_RECEIVED CS_CMD(2, 0)
  27. #define CS_TX_DATA_READY CS_CMD(3, 0)
  28. #define CS_TX_DATA_SENT CS_CMD(4, 0)
  29. /* params to CS_ERROR indication */
  30. #define CS_ERR_PEER_RESET 0
  31. /* ioctl interface */
  32. /* parameters to CS_CONFIG_BUFS ioctl */
  33. #define CS_FEAT_TSTAMP_RX_CTRL (1 << 0)
  34. #define CS_FEAT_ROLLING_RX_COUNTER (2 << 0)
  35. /* parameters to CS_GET_STATE ioctl */
  36. #define CS_STATE_CLOSED 0
  37. #define CS_STATE_OPENED 1 /* resource allocated */
  38. #define CS_STATE_CONFIGURED 2 /* data path active */
  39. /* maximum number of TX/RX buffers */
  40. #define CS_MAX_BUFFERS_SHIFT 4
  41. #define CS_MAX_BUFFERS (1 << CS_MAX_BUFFERS_SHIFT)
  42. /* Parameters for setting up the data buffers */
  43. struct cs_buffer_config {
  44. __u32 rx_bufs; /* number of RX buffer slots */
  45. __u32 tx_bufs; /* number of TX buffer slots */
  46. __u32 buf_size; /* bytes */
  47. __u32 flags; /* see CS_FEAT_* */
  48. __u32 reserved[4];
  49. };
  50. /*
  51. * struct for monotonic timestamp taken when the
  52. * last control command was received
  53. */
  54. struct cs_timestamp {
  55. __u32 tv_sec; /* seconds */
  56. __u32 tv_nsec; /* nanoseconds */
  57. };
  58. /*
  59. * Struct describing the layout and contents of the driver mmap area.
  60. * This information is meant as read-only information for the application.
  61. */
  62. struct cs_mmap_config_block {
  63. __u32 reserved1;
  64. __u32 buf_size; /* 0=disabled, otherwise the transfer size */
  65. __u32 rx_bufs; /* # of RX buffers */
  66. __u32 tx_bufs; /* # of TX buffers */
  67. __u32 reserved2;
  68. /* array of offsets within the mmap area for each RX and TX buffer */
  69. __u32 rx_offsets[CS_MAX_BUFFERS];
  70. __u32 tx_offsets[CS_MAX_BUFFERS];
  71. __u32 rx_ptr;
  72. __u32 rx_ptr_boundary;
  73. __u32 reserved3[2];
  74. /* enabled with CS_FEAT_TSTAMP_RX_CTRL */
  75. struct cs_timestamp tstamp_rx_ctrl;
  76. };
  77. #define CS_IO_MAGIC 'C'
  78. #define CS_IOW(num, dtype) _IOW(CS_IO_MAGIC, num, dtype)
  79. #define CS_IOR(num, dtype) _IOR(CS_IO_MAGIC, num, dtype)
  80. #define CS_IOWR(num, dtype) _IOWR(CS_IO_MAGIC, num, dtype)
  81. #define CS_IO(num) _IO(CS_IO_MAGIC, num)
  82. #define CS_GET_STATE CS_IOR(21, unsigned int)
  83. #define CS_SET_WAKELINE CS_IOW(23, unsigned int)
  84. #define CS_GET_IF_VERSION CS_IOR(30, unsigned int)
  85. #define CS_CONFIG_BUFS CS_IOW(31, struct cs_buffer_config)
  86. #endif /* _CS_PROTOCOL_H */