2018-01-22 09:27:00 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
2019-04-18 13:38:53 +00:00
|
|
|
/* Copyright (C) 2012-2019 ARM Limited (or its affiliates). */
|
2018-01-22 09:27:00 +00:00
|
|
|
|
|
|
|
#ifndef __CC_SRAM_MGR_H__
|
|
|
|
#define __CC_SRAM_MGR_H__
|
|
|
|
|
|
|
|
#ifndef CC_CC_SRAM_SIZE
|
|
|
|
#define CC_CC_SRAM_SIZE 4096
|
|
|
|
#endif
|
|
|
|
|
|
|
|
struct cc_drvdata;
|
|
|
|
|
2020-02-11 18:19:07 +00:00
|
|
|
#define NULL_SRAM_ADDR ((u32)-1)
|
2018-01-22 09:27:00 +00:00
|
|
|
|
2020-02-11 18:19:22 +00:00
|
|
|
/**
|
|
|
|
* cc_sram_mgr_init() - Initializes SRAM pool.
|
2018-01-22 09:27:00 +00:00
|
|
|
* The first X bytes of SRAM are reserved for ROM usage, hence, pool
|
|
|
|
* starts right after X bytes.
|
|
|
|
*
|
2020-02-11 18:19:22 +00:00
|
|
|
* @drvdata: Associated device driver context
|
2018-01-22 09:27:00 +00:00
|
|
|
*
|
2020-02-11 18:19:22 +00:00
|
|
|
* Return:
|
|
|
|
* Zero for success, negative value otherwise.
|
2018-01-22 09:27:00 +00:00
|
|
|
*/
|
|
|
|
int cc_sram_mgr_init(struct cc_drvdata *drvdata);
|
|
|
|
|
2020-02-11 18:19:22 +00:00
|
|
|
/**
|
|
|
|
* cc_sram_alloc() - Allocate buffer from SRAM pool.
|
|
|
|
*
|
|
|
|
* @drvdata: Associated device driver context
|
|
|
|
* @size: The requested bytes to allocate
|
2018-01-22 09:27:00 +00:00
|
|
|
*
|
2020-02-11 18:19:22 +00:00
|
|
|
* Return:
|
|
|
|
* Address offset in SRAM or NULL_SRAM_ADDR for failure.
|
2018-01-22 09:27:00 +00:00
|
|
|
*/
|
2020-02-11 18:19:07 +00:00
|
|
|
u32 cc_sram_alloc(struct cc_drvdata *drvdata, u32 size);
|
2018-01-22 09:27:00 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* cc_set_sram_desc() - Create const descriptors sequence to
|
|
|
|
* set values in given array into SRAM.
|
|
|
|
* Note: each const value can't exceed word size.
|
|
|
|
*
|
|
|
|
* @src: A pointer to array of words to set as consts.
|
|
|
|
* @dst: The target SRAM buffer to set into
|
2020-02-11 18:19:22 +00:00
|
|
|
* @nelement: The number of words in "src" array
|
2018-01-22 09:27:00 +00:00
|
|
|
* @seq: A pointer to the given IN/OUT descriptor sequence
|
|
|
|
* @seq_len: A pointer to the given IN/OUT sequence length
|
|
|
|
*/
|
2020-02-11 18:19:07 +00:00
|
|
|
void cc_set_sram_desc(const u32 *src, u32 dst, unsigned int nelement,
|
|
|
|
struct cc_hw_desc *seq, unsigned int *seq_len);
|
2018-01-22 09:27:00 +00:00
|
|
|
|
|
|
|
#endif /*__CC_SRAM_MGR_H__*/
|