mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-07 03:57:07 +03:00
made vucp static
This commit is contained in:
@@ -93,6 +93,9 @@ static void (*pseudo_idle_chain)(uint32_t now);
|
|||||||
#define CONFIG_AMP_GPIO_LEVEL 1
|
#define CONFIG_AMP_GPIO_LEVEL 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define VUCP24 (0xCC)
|
||||||
|
#define VUCP24I (0x32)
|
||||||
|
|
||||||
extern struct outputstate output;
|
extern struct outputstate output;
|
||||||
extern struct buffer *streambuf;
|
extern struct buffer *streambuf;
|
||||||
extern struct buffer *outputbuf;
|
extern struct buffer *outputbuf;
|
||||||
@@ -115,6 +118,7 @@ static struct {
|
|||||||
bool enabled;
|
bool enabled;
|
||||||
u8_t *buf;
|
u8_t *buf;
|
||||||
size_t count;
|
size_t count;
|
||||||
|
u8_t vucp;
|
||||||
} spdif;
|
} spdif;
|
||||||
static size_t dma_buf_frames;
|
static size_t dma_buf_frames;
|
||||||
static TaskHandle_t output_i2s_task;
|
static TaskHandle_t output_i2s_task;
|
||||||
@@ -130,7 +134,7 @@ static int _i2s_write_frames(frames_t out_frames, bool silence, s32_t gainL, s32
|
|||||||
static void output_thread_i2s(void *arg);
|
static void output_thread_i2s(void *arg);
|
||||||
static void i2s_stats(uint32_t now);
|
static void i2s_stats(uint32_t now);
|
||||||
|
|
||||||
static void spdif_convert(ISAMPLE_T *src, size_t frames, u32_t *dst, size_t *count);
|
static void spdif_convert(ISAMPLE_T *src, size_t frames, u32_t *dst, size_t *count, u8_t *vucp);
|
||||||
static void (*jack_handler_chain)(bool inserted);
|
static void (*jack_handler_chain)(bool inserted);
|
||||||
|
|
||||||
#define I2C_PORT 0
|
#define I2C_PORT 0
|
||||||
@@ -542,6 +546,7 @@ static void output_thread_i2s(void *arg) {
|
|||||||
i2s_stop(CONFIG_I2S_NUM);
|
i2s_stop(CONFIG_I2S_NUM);
|
||||||
adac->power(ADAC_STANDBY);
|
adac->power(ADAC_STANDBY);
|
||||||
spdif.count = 0;
|
spdif.count = 0;
|
||||||
|
spdif.vucp = VUCP24;
|
||||||
}
|
}
|
||||||
usleep(100000);
|
usleep(100000);
|
||||||
continue;
|
continue;
|
||||||
@@ -617,7 +622,7 @@ static void output_thread_i2s(void *arg) {
|
|||||||
// need IRAM for speed but can't allocate a FRAME_BLOCK * 16, so process by smaller chunks
|
// need IRAM for speed but can't allocate a FRAME_BLOCK * 16, so process by smaller chunks
|
||||||
while (count < oframes) {
|
while (count < oframes) {
|
||||||
size_t chunk = min(SPDIF_BLOCK, oframes - count);
|
size_t chunk = min(SPDIF_BLOCK, oframes - count);
|
||||||
spdif_convert((ISAMPLE_T*) obuf + count * 2, chunk, (u32_t*) spdif.buf, &spdif.count);
|
spdif_convert((ISAMPLE_T*) obuf + count * 2, chunk, (u32_t*) spdif.buf, &spdif.count, &spdif.vucp);
|
||||||
i2s_write(CONFIG_I2S_NUM, spdif.buf, chunk * 16, &obytes, portMAX_DELAY);
|
i2s_write(CONFIG_I2S_NUM, spdif.buf, chunk * 16, &obytes, portMAX_DELAY);
|
||||||
bytes += obytes / (16 / BYTES_PER_FRAME);
|
bytes += obytes / (16 / BYTES_PER_FRAME);
|
||||||
count += chunk;
|
count += chunk;
|
||||||
@@ -687,11 +692,6 @@ static void i2s_stats(uint32_t now) {
|
|||||||
#define PREAMBLE_M (0xE2) //11100010
|
#define PREAMBLE_M (0xE2) //11100010
|
||||||
#define PREAMBLE_W (0xE4) //11100100
|
#define PREAMBLE_W (0xE4) //11100100
|
||||||
|
|
||||||
#define VUCP24 (0xCC)
|
|
||||||
#define VUCP24I (0x32)
|
|
||||||
|
|
||||||
u8_t vucp = VUCP24;
|
|
||||||
|
|
||||||
static const u16_t spdif_bmclookup[256] = {
|
static const u16_t spdif_bmclookup[256] = {
|
||||||
0xcccc, 0xb333, 0xd333, 0xaccc, 0xcb33, 0xb4cc, 0xd4cc, 0xab33,
|
0xcccc, 0xb333, 0xd333, 0xaccc, 0xcb33, 0xb4cc, 0xd4cc, 0xab33,
|
||||||
0xcd33, 0xb2cc, 0xd2cc, 0xad33, 0xcacc, 0xb533, 0xd533, 0xaacc,
|
0xcd33, 0xb2cc, 0xd2cc, 0xad33, 0xcacc, 0xb533, 0xd533, 0xaacc,
|
||||||
@@ -740,10 +740,12 @@ static const u16_t spdif_bmclookup[256] = {
|
|||||||
The I2S interface must output first the B/M/W preamble which means that second
|
The I2S interface must output first the B/M/W preamble which means that second
|
||||||
32 bits words must be first and so must be marked right channel.
|
32 bits words must be first and so must be marked right channel.
|
||||||
*/
|
*/
|
||||||
static void IRAM_ATTR spdif_convert(ISAMPLE_T *src, size_t frames, u32_t *dst, size_t *count) {
|
static void IRAM_ATTR spdif_convert(ISAMPLE_T *src, size_t frames, u32_t *dst, size_t *count, u8_t *vucp) {
|
||||||
register u16_t hi, lo, aux;
|
register u16_t hi, lo;
|
||||||
register u8_t vu;
|
#if BYTES_PER_FRAME == 8
|
||||||
vu = vucp;
|
register u16_t aux;
|
||||||
|
#endif
|
||||||
|
register u8_t vu = *vucp;
|
||||||
size_t cnt = *count;
|
size_t cnt = *count;
|
||||||
|
|
||||||
while (frames--) {
|
while (frames--) {
|
||||||
@@ -801,7 +803,7 @@ static void IRAM_ATTR spdif_convert(ISAMPLE_T *src, size_t frames, u32_t *dst, s
|
|||||||
}
|
}
|
||||||
|
|
||||||
*count = cnt;
|
*count = cnt;
|
||||||
vucp = vu;
|
*vucp = vu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user