mirror of
https://github.com/hathach/tinyusb.git
synced 2025-04-10 03:44:22 +00:00
Add blackout time.
This commit is contained in:
parent
0a1d6cf4d0
commit
d83a210788
@ -2614,25 +2614,39 @@ static uint16_t audiod_tx_packet_size(const uint16_t* norminal_size, uint16_t da
|
|||||||
// Flow control need a FIFO size of at least 4*Navg
|
// Flow control need a FIFO size of at least 4*Navg
|
||||||
if(norminal_size[1] && norminal_size[1] <= fifo_depth * 4)
|
if(norminal_size[1] && norminal_size[1] <= fifo_depth * 4)
|
||||||
{
|
{
|
||||||
|
// Use blackout to prioritize normal size packet
|
||||||
|
static int ctrl_blackout = 0;
|
||||||
uint16_t packet_size;
|
uint16_t packet_size;
|
||||||
uint16_t slot_size = norminal_size[2] - norminal_size[1];
|
uint16_t slot_size = norminal_size[2] - norminal_size[1];
|
||||||
if (data_count < fifo_depth / 2 - slot_size)
|
if (data_count < norminal_size[0])
|
||||||
{
|
{
|
||||||
if (data_count < norminal_size[0])
|
|
||||||
{
|
|
||||||
// If you get here frequently, then your I2S clock deviation is too big !
|
// If you get here frequently, then your I2S clock deviation is too big !
|
||||||
packet_size = 0;
|
packet_size = 0;
|
||||||
} else
|
} else
|
||||||
{
|
if (data_count < fifo_depth / 2 - slot_size && !ctrl_blackout)
|
||||||
packet_size = norminal_size[0];
|
{
|
||||||
}
|
packet_size = norminal_size[0];
|
||||||
}
|
ctrl_blackout = 10;
|
||||||
else if (data_count > fifo_depth / 2 + slot_size)
|
} else
|
||||||
|
if (data_count > fifo_depth / 2 + slot_size && !ctrl_blackout)
|
||||||
{
|
{
|
||||||
packet_size = norminal_size[2];
|
packet_size = norminal_size[2];
|
||||||
|
if(norminal_size[0] == norminal_size[1])
|
||||||
|
{
|
||||||
|
// nav = INT(nav) + 1
|
||||||
|
ctrl_blackout = 2;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
// nav = INT(nav)
|
||||||
|
ctrl_blackout = 10;
|
||||||
|
}
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
packet_size = norminal_size[1];
|
packet_size = norminal_size[1];
|
||||||
|
if (ctrl_blackout)
|
||||||
|
{
|
||||||
|
ctrl_blackout--;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Normally this cap is not necessary
|
// Normally this cap is not necessary
|
||||||
return tu_min16(packet_size, max_depth);
|
return tu_min16(packet_size, max_depth);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user