summaryrefslogtreecommitdiff
path: root/sound/soc/codecs/abe/abe_ext.c
blob: 8142d8542ef5e8e980a9e34376d69f7cd7a74979 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
/*
 * ==========================================================================
 *               Texas Instruments OMAP(TM) Platform Firmware
 * (c) Copyright 2009, Texas Instruments Incorporated.  All Rights Reserved.
 *
 *  Use of this firmware is controlled by the terms and conditions found
 *  in the license agreement under which this firmware has been supplied.
 * ==========================================================================
 */

#include "abe_main.h"

/*
 *  ABE_DEFAULT_IRQ_PINGPONG_PLAYER
 *
 *
 *  Operations :
 *      generates data for the cache-flush buffer MODE 16+16
 *
 *  Return value :
 *      None.
 */
void abe_default_irq_pingpong_player(void)
{
	/* ping-pong access to MM_DL at 48kHz Mono with 20ms packet sizes */
	#define N_SAMPLES_MAX ((int)(1024))

	static abe_int32 idx;
	abe_uint32 i, dst, n_samples;
	abe_int32 temp [N_SAMPLES_MAX], audio_sample;
	const abe_int32 audio_pattern [8] = {0, 11585, 16384, 11585, 0, -11586, -16384, -11586 };
	//const abe_int32 audio_pattern [8] = {16383,16383,16383,16383,-16384,-16384,-16384,-16384};

	/* read the address of the Pong buffer */
	abe_read_next_ping_pong_buffer (MM_DL_PORT, &dst, &n_samples);

	/* generate a test pattern */
	for (i = 0; i < n_samples; i++) {
		idx = (idx +1) & 7;	/* circular addressing */
		audio_sample = audio_pattern [idx];
		temp [i] = ((audio_sample << 16) + audio_sample);
	}

	/* copy the pattern (flush it) to DMEM pointer update
	 * not necessary here because the buffer size do not
	 * change from one ping to the other pong
	 */
	abe_block_copy(COPY_FROM_HOST_TO_ABE, ABE_DMEM, dst, (abe_uint32 *)&(temp[0]), n_samples * 4);
	abe_set_ping_pong_buffer(MM_DL_PORT, n_samples * 4);
}

/*
 * ABE_DEFAULT_IRQ_PINGPONG_PLAYER_32BITS
 *
 * Operations:
 * generates data for the cache-flush buffer  MODE 32 BITS
 * Return value:
 * None.
 */
void abe_default_irq_pingpong_player_32bits(void)
{
/* ping-pong access to MM_DL at 48kHz Mono with 20ms packet sizes */
#define N_SAMPLES_MAX ((int)(1024))
	static abe_int32 idx;
	abe_uint32 i, dst, n_samples;
	abe_int32 temp[N_SAMPLES_MAX], audio_sample;
	const abe_int32 audio_pattern[8] = {0, 11585, 16384, 11585, 0, -11586, -16384, -11586 };
	//const abe_int32 audio_pattern[8] = {16383,16383,16383,16383,-16384,-16384,-16384,-16384};

	/* read the address of the Pong buffer */
	abe_read_next_ping_pong_buffer(MM_DL_PORT, &dst, &n_samples);

	/* generate a test pattern */
	for (i = 0; i < n_samples; i++) {
		/* circular addressing */
		idx = (idx +1) & 7;
		audio_sample = audio_pattern[idx];
		temp[i*2 +0] = (audio_sample << 16);
		temp[i*2 +1] = (audio_sample << 16);
	}

	/* copy the pattern (flush it) to DMEM pointer update
	 * not necessary here because the buffer size do not
	 * change from one ping to the other pong
	 */
	abe_block_copy(COPY_FROM_HOST_TO_ABE, ABE_DMEM, dst,
			(abe_uint32 *)&(temp[0]), n_samples * 4 *2);

	abe_set_ping_pong_buffer(MM_DL_PORT, n_samples * 4 *2);
}
/*
 * ABE_DEFAULT_IRQ_APS_ADAPTATION
 *
 * Operations :
 * updates the APS filter and gain
 *
 * Return value :
 * None.
 */
void abe_default_irq_aps_adaptation(void)
{
}

/*
 *  ABE_READ_SYS_CLOCK
 *
 *  Parameter  :
 *      pointer to the system clock
 *
 *  Operations :
 *      returns the current time indication for the LOG
 *
 *  Return value :
 *      None.
 */
void abe_read_sys_clock(abe_micros_t *time)
{
	static abe_micros_t clock;

	*time = clock;
	clock ++;
}

/*
 *  ABE_APS_TUNING
 *
 *  Parameter  :
 *
 *
 *  Operations :
 *
 *
 *  Return value :
 *
 */
void abe_aps_tuning(void)
{
}

/**
* @fn abe_lock_executione()
*
*  Operations : set a spin-lock and wait in case of collision
*
*
* @see	ABE_API.h
*/
void abe_lock_execution(void)
{
}

/**
* @fn abe_unlock_executione()
*
*  Operations : reset a spin-lock (end of subroutine)
*
*
* @see	ABE_API.h
*/
void abe_unlock_execution(void)
{
}