Linux Audio

Check our new training course

Linux debugging, profiling, tracing and performance analysis training

Apr 14-17, 2025
Register
Loading...
v6.2
 1/* SPDX-License-Identifier: GPL-2.0 */
 2/* Copyright (C) 2012-2019 ARM Limited (or its affiliates). */
 3
 4#ifndef __CC_SRAM_MGR_H__
 5#define __CC_SRAM_MGR_H__
 6
 7#ifndef CC_CC_SRAM_SIZE
 8#define CC_CC_SRAM_SIZE 4096
 9#endif
10
11struct cc_drvdata;
12
13#define NULL_SRAM_ADDR ((u32)-1)
14
15/**
16 * cc_sram_mgr_init() - Initializes SRAM pool.
 
 
 
 
 
 
 
 
17 * The first X bytes of SRAM are reserved for ROM usage, hence, pool
18 * starts right after X bytes.
19 *
20 * @drvdata: Associated device driver context
21 *
22 * Return:
23 * Zero for success, negative value otherwise.
24 */
25int cc_sram_mgr_init(struct cc_drvdata *drvdata);
26
27/**
28 * cc_sram_alloc() - Allocate buffer from SRAM pool.
29 *
30 * @drvdata: Associated device driver context
31 * @size: The requested bytes to allocate
 
 
 
 
 
 
 
32 *
33 * Return:
34 * Address offset in SRAM or NULL_SRAM_ADDR for failure.
35 */
36u32 cc_sram_alloc(struct cc_drvdata *drvdata, u32 size);
37
38/**
39 * cc_set_sram_desc() - Create const descriptors sequence to
40 *	set values in given array into SRAM.
41 * Note: each const value can't exceed word size.
42 *
43 * @src:	  A pointer to array of words to set as consts.
44 * @dst:	  The target SRAM buffer to set into
45 * @nelement:	  The number of words in "src" array
46 * @seq:	  A pointer to the given IN/OUT descriptor sequence
47 * @seq_len:	  A pointer to the given IN/OUT sequence length
48 */
49void cc_set_sram_desc(const u32 *src, u32 dst, unsigned int nelement,
50		      struct cc_hw_desc *seq, unsigned int *seq_len);
 
51
52#endif /*__CC_SRAM_MGR_H__*/
v5.4
 1/* SPDX-License-Identifier: GPL-2.0 */
 2/* Copyright (C) 2012-2019 ARM Limited (or its affiliates). */
 3
 4#ifndef __CC_SRAM_MGR_H__
 5#define __CC_SRAM_MGR_H__
 6
 7#ifndef CC_CC_SRAM_SIZE
 8#define CC_CC_SRAM_SIZE 4096
 9#endif
10
11struct cc_drvdata;
12
 
 
13/**
14 * Address (offset) within CC internal SRAM
15 */
16
17typedef u64 cc_sram_addr_t;
18
19#define NULL_SRAM_ADDR ((cc_sram_addr_t)-1)
20
21/*!
22 * Initializes SRAM pool.
23 * The first X bytes of SRAM are reserved for ROM usage, hence, pool
24 * starts right after X bytes.
25 *
26 * \param drvdata
27 *
28 * \return int Zero for success, negative value otherwise.
 
29 */
30int cc_sram_mgr_init(struct cc_drvdata *drvdata);
31
32/*!
33 * Uninits SRAM pool.
34 *
35 * \param drvdata
36 */
37void cc_sram_mgr_fini(struct cc_drvdata *drvdata);
38
39/*!
40 * Allocated buffer from SRAM pool.
41 * Note: Caller is responsible to free the LAST allocated buffer.
42 * This function does not taking care of any fragmentation may occur
43 * by the order of calls to alloc/free.
44 *
45 * \param drvdata
46 * \param size The requested bytes to allocate
47 */
48cc_sram_addr_t cc_sram_alloc(struct cc_drvdata *drvdata, u32 size);
49
50/**
51 * cc_set_sram_desc() - Create const descriptors sequence to
52 *	set values in given array into SRAM.
53 * Note: each const value can't exceed word size.
54 *
55 * @src:	  A pointer to array of words to set as consts.
56 * @dst:	  The target SRAM buffer to set into
57 * @nelements:	  The number of words in "src" array
58 * @seq:	  A pointer to the given IN/OUT descriptor sequence
59 * @seq_len:	  A pointer to the given IN/OUT sequence length
60 */
61void cc_set_sram_desc(const u32 *src, cc_sram_addr_t dst,
62		      unsigned int nelement, struct cc_hw_desc *seq,
63		      unsigned int *seq_len);
64
65#endif /*__CC_SRAM_MGR_H__*/