cc_sram_mgr.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /* Copyright (C) 2012-2019 ARM Limited (or its affiliates). */
  3. #ifndef __CC_SRAM_MGR_H__
  4. #define __CC_SRAM_MGR_H__
  5. #ifndef CC_CC_SRAM_SIZE
  6. #define CC_CC_SRAM_SIZE 4096
  7. #endif
  8. struct cc_drvdata;
  9. #define NULL_SRAM_ADDR ((u32)-1)
  10. /**
  11. * cc_sram_mgr_init() - Initializes SRAM pool.
  12. * The first X bytes of SRAM are reserved for ROM usage, hence, pool
  13. * starts right after X bytes.
  14. *
  15. * @drvdata: Associated device driver context
  16. *
  17. * Return:
  18. * Zero for success, negative value otherwise.
  19. */
  20. int cc_sram_mgr_init(struct cc_drvdata *drvdata);
  21. /**
  22. * cc_sram_alloc() - Allocate buffer from SRAM pool.
  23. *
  24. * @drvdata: Associated device driver context
  25. * @size: The requested bytes to allocate
  26. *
  27. * Return:
  28. * Address offset in SRAM or NULL_SRAM_ADDR for failure.
  29. */
  30. u32 cc_sram_alloc(struct cc_drvdata *drvdata, u32 size);
  31. /**
  32. * cc_set_sram_desc() - Create const descriptors sequence to
  33. * set values in given array into SRAM.
  34. * Note: each const value can't exceed word size.
  35. *
  36. * @src: A pointer to array of words to set as consts.
  37. * @dst: The target SRAM buffer to set into
  38. * @nelement: The number of words in "src" array
  39. * @seq: A pointer to the given IN/OUT descriptor sequence
  40. * @seq_len: A pointer to the given IN/OUT sequence length
  41. */
  42. void cc_set_sram_desc(const u32 *src, u32 dst, unsigned int nelement,
  43. struct cc_hw_desc *seq, unsigned int *seq_len);
  44. #endif /*__CC_SRAM_MGR_H__*/