IAP: First steps towards true multiport state

iap_reset_state() and iap_getc() are now passed the logical IAP port
(0 is dock/only connector, 1 is headphone connector)

Change-Id: I97421146a8cab032b90c9b4eb55b50aa00d73312
This commit is contained in:
Solomon Peachy 2025-08-14 20:56:13 -04:00
parent e2f2ee88c8
commit 0456ec5630
13 changed files with 32 additions and 20 deletions

View file

@ -306,14 +306,14 @@ void iap_reset_auth(struct auth_t* auth)
auth->next_section = 0;
}
void iap_reset_state(int port)
void iap_reset_state(IF_IAP_MP_NONVOID(int port))
{
if (!iap_running)
return;
/* 0 is dock, 1 is headphone. This is for
when we eventually maintain independent state */
(void)port;
IF_IAP_MP((void)port);
iap_reset_device(&device);
iap_bitrate_set(global_settings.serial_bitrate);
@ -593,7 +593,7 @@ void iap_send_pkt(const unsigned char * data, const int len)
iap_send_tx();
}
bool iap_getc(const unsigned char x)
bool iap_getc(IF_IAP_MP(int port,) const unsigned char x)
{
struct state_t *s = &frame_state;
static long pkt_timeout;
@ -606,7 +606,7 @@ bool iap_getc(const unsigned char x)
/* Packet timeouts only make sense while not waiting for the
* sync byte */
s->state = ST_SYNC;
return iap_getc(x);
return iap_getc(IF_IAP_MP(port,) x);
}
@ -633,7 +633,7 @@ bool iap_getc(const unsigned char x)
s->state = ST_LEN;
} else {
s->state = ST_SYNC;
return iap_getc(x);
return iap_getc(IF_IAP_MP(port,) x);
}
break;
case ST_LEN: