cobalt-omnitek.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. * Omnitek Scatter-Gather DMA Controller
  3. *
  4. * Copyright 2012-2015 Cisco Systems, Inc. and/or its affiliates.
  5. * All rights reserved.
  6. *
  7. * This program is free software; you may redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; version 2 of the License.
  10. *
  11. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  12. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  13. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  14. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  15. * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  16. * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  17. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  18. * SOFTWARE.
  19. */
  20. #ifndef COBALT_OMNITEK_H
  21. #define COBALT_OMNITEK_H
  22. #include <linux/scatterlist.h>
  23. #include "cobalt-driver.h"
  24. struct sg_dma_descriptor {
  25. u32 pci_l;
  26. u32 pci_h;
  27. u32 local;
  28. u32 reserved0;
  29. u32 next_l;
  30. u32 next_h;
  31. u32 bytes;
  32. u32 reserved1;
  33. };
  34. int omni_sg_dma_init(struct cobalt *cobalt);
  35. void omni_sg_dma_abort_channel(struct cobalt_stream *s);
  36. void omni_sg_dma_start(struct cobalt_stream *s, struct sg_dma_desc_info *desc);
  37. bool is_dma_done(struct cobalt_stream *s);
  38. int descriptor_list_create(struct cobalt *cobalt,
  39. struct scatterlist *scatter_list, bool to_pci, unsigned sglen,
  40. unsigned size, unsigned width, unsigned stride,
  41. struct sg_dma_desc_info *desc);
  42. void descriptor_list_chain(struct sg_dma_desc_info *this,
  43. struct sg_dma_desc_info *next);
  44. void descriptor_list_loopback(struct sg_dma_desc_info *desc);
  45. void descriptor_list_end_of_chain(struct sg_dma_desc_info *desc);
  46. void *descriptor_list_allocate(struct sg_dma_desc_info *desc, size_t bytes);
  47. void descriptor_list_free(struct sg_dma_desc_info *desc);
  48. void descriptor_list_interrupt_enable(struct sg_dma_desc_info *desc);
  49. void descriptor_list_interrupt_disable(struct sg_dma_desc_info *desc);
  50. #endif