/drivers/staging/tidspbridge/include/dspbridge/chnl.h

https://bitbucket.org/wisechild/galaxy-nexus · C++ Header · 109 lines · 10 code · 7 blank · 92 comment · 0 complexity · 7b4517c93303a598df07eba1062e34ac MD5 · raw file

  1. /*
  2. * chnl.h
  3. *
  4. * DSP-BIOS Bridge driver support functions for TI OMAP processors.
  5. *
  6. * DSP API channel interface: multiplexes data streams through the single
  7. * physical link managed by a Bridge driver.
  8. *
  9. * See DSP API chnl.h for more details.
  10. *
  11. * Copyright (C) 2005-2006 Texas Instruments, Inc.
  12. *
  13. * This package is free software; you can redistribute it and/or modify
  14. * it under the terms of the GNU General Public License version 2 as
  15. * published by the Free Software Foundation.
  16. *
  17. * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  18. * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  19. * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  20. */
  21. #ifndef CHNL_
  22. #define CHNL_
  23. #include <dspbridge/chnlpriv.h>
  24. /*
  25. * ======== chnl_create ========
  26. * Purpose:
  27. * Create a channel manager object, responsible for opening new channels
  28. * and closing old ones for a given board.
  29. * Parameters:
  30. * channel_mgr: Location to store a channel manager object on output.
  31. * hdev_obj: Handle to a device object.
  32. * mgr_attrts: Channel manager attributes.
  33. * mgr_attrts->max_channels: Max channels
  34. * mgr_attrts->birq: Channel's I/O IRQ number.
  35. * mgr_attrts->irq_shared: TRUE if the IRQ is shareable.
  36. * mgr_attrts->word_size: DSP Word size in equivalent PC bytes..
  37. * Returns:
  38. * 0: Success;
  39. * -EFAULT: hdev_obj is invalid.
  40. * -EINVAL: max_channels is 0.
  41. * Invalid DSP word size (must be > 0).
  42. * Invalid base address for DSP communications.
  43. * -ENOMEM: Insufficient memory for requested resources.
  44. * -EIO: Unable to plug channel ISR for configured IRQ.
  45. * -ECHRNG: This manager cannot handle this many channels.
  46. * -EEXIST: Channel manager already exists for this device.
  47. * Requires:
  48. * chnl_init(void) called.
  49. * channel_mgr != NULL.
  50. * mgr_attrts != NULL.
  51. * Ensures:
  52. * 0: Subsequent calls to chnl_create() for the same
  53. * board without an intervening call to
  54. * chnl_destroy() will fail.
  55. */
  56. extern int chnl_create(struct chnl_mgr **channel_mgr,
  57. struct dev_object *hdev_obj,
  58. const struct chnl_mgrattrs *mgr_attrts);
  59. /*
  60. * ======== chnl_destroy ========
  61. * Purpose:
  62. * Close all open channels, and destroy the channel manager.
  63. * Parameters:
  64. * hchnl_mgr: Channel manager object.
  65. * Returns:
  66. * 0: Success.
  67. * -EFAULT: hchnl_mgr was invalid.
  68. * Requires:
  69. * chnl_init(void) called.
  70. * Ensures:
  71. * 0: Cancels I/O on each open channel.
  72. * Closes each open channel.
  73. * chnl_create may subsequently be called for the
  74. * same board.
  75. */
  76. extern int chnl_destroy(struct chnl_mgr *hchnl_mgr);
  77. /*
  78. * ======== chnl_exit ========
  79. * Purpose:
  80. * Discontinue usage of the CHNL module.
  81. * Parameters:
  82. * Returns:
  83. * Requires:
  84. * chnl_init(void) previously called.
  85. * Ensures:
  86. * Resources, if any acquired in chnl_init(void), are freed when the last
  87. * client of CHNL calls chnl_exit(void).
  88. */
  89. extern void chnl_exit(void);
  90. /*
  91. * ======== chnl_init ========
  92. * Purpose:
  93. * Initialize the CHNL module's private state.
  94. * Parameters:
  95. * Returns:
  96. * TRUE if initialized; FALSE if error occurred.
  97. * Requires:
  98. * Ensures:
  99. * A requirement for each of the other public CHNL functions.
  100. */
  101. extern bool chnl_init(void);
  102. #endif /* CHNL_ */