TMXR: Clarify comments on API description and variable names
This is all around the tmxr_set_get_modem_bits() API. This change is non operational, but this clarification would avoid the mistake made when someone uses or thinks about changing that API in the future.
This commit is contained in:
parent
e3572e1a9f
commit
07d37f6d9e
1 changed files with 11 additions and 11 deletions
22
sim_tmxr.c
22
sim_tmxr.c
|
@ -1654,9 +1654,9 @@ return SCPE_OK;
|
||||||
bits_to_clear TMXR_MDM_DTR and/or TMXR_MDM_RTS as desired
|
bits_to_clear TMXR_MDM_DTR and/or TMXR_MDM_RTS as desired
|
||||||
|
|
||||||
Output:
|
Output:
|
||||||
incoming_bits if non NULL, returns the current stat of DCD,
|
status_bits if non NULL, returns all of the current signal
|
||||||
RNG, CTS and DSR along with the current state
|
state bits (incoming: DCD, RNG, CTS, DSR) along
|
||||||
of DTR and RTS
|
with the specifically settable bits (DTR, RTS)
|
||||||
|
|
||||||
Implementation note:
|
Implementation note:
|
||||||
|
|
||||||
|
@ -1665,7 +1665,7 @@ return SCPE_OK;
|
||||||
to a network socket (or could be) then the network session state is
|
to a network socket (or could be) then the network session state is
|
||||||
set, cleared and/or returned.
|
set, cleared and/or returned.
|
||||||
*/
|
*/
|
||||||
t_stat tmxr_set_get_modem_bits (TMLN *lp, int32 bits_to_set, int32 bits_to_clear, int32 *incoming_bits)
|
t_stat tmxr_set_get_modem_bits (TMLN *lp, int32 bits_to_set, int32 bits_to_clear, int32 *status_bits)
|
||||||
{
|
{
|
||||||
int32 before_modem_bits, incoming_state;
|
int32 before_modem_bits, incoming_state;
|
||||||
DEVICE *dptr;
|
DEVICE *dptr;
|
||||||
|
@ -1745,10 +1745,10 @@ if ((lp->modembits != before_modem_bits) && (sim_deb && lp->mp && dptr)) {
|
||||||
sim_debug_bits (TMXR_DBG_MDM, dptr, tmxr_modem_bits, before_modem_bits, lp->modembits, FALSE);
|
sim_debug_bits (TMXR_DBG_MDM, dptr, tmxr_modem_bits, before_modem_bits, lp->modembits, FALSE);
|
||||||
sim_debug (TMXR_DBG_MDM, dptr, " - Line %d - %p\n", (int)(lp-lp->mp->ldsc), lp->txb);
|
sim_debug (TMXR_DBG_MDM, dptr, " - Line %d - %p\n", (int)(lp-lp->mp->ldsc), lp->txb);
|
||||||
}
|
}
|
||||||
if (incoming_bits)
|
if (status_bits)
|
||||||
*incoming_bits = (lp->modembits & (TMXR_MDM_INCOMING | TMXR_MDM_DTR | TMXR_MDM_RTS));
|
*status_bits = (lp->modembits & (TMXR_MDM_INCOMING | TMXR_MDM_OUTGOING));
|
||||||
if (lp->mp && lp->modem_control) { /* This API ONLY works on modem_control enabled multiplexer lines */
|
if (lp->mp && lp->modem_control) { /* This API ONLY works on modem_control enabled multiplexer lines */
|
||||||
if ((bits_to_set | bits_to_clear) || incoming_bits) {/* Anything to do? */
|
if ((bits_to_set | bits_to_clear) || status_bits) {/* Anything to do? */
|
||||||
if (lp->loopback) {
|
if (lp->loopback) {
|
||||||
if ((lp->modembits ^ before_modem_bits) & TMXR_MDM_DTR) { /* DTR changed? */
|
if ((lp->modembits ^ before_modem_bits) & TMXR_MDM_DTR) { /* DTR changed? */
|
||||||
lp->ser_connect_pending = (lp->modembits & TMXR_MDM_DTR);
|
lp->ser_connect_pending = (lp->modembits & TMXR_MDM_DTR);
|
||||||
|
@ -1757,9 +1757,9 @@ if (lp->mp && lp->modem_control) { /* This API ONLY works on mo
|
||||||
return SCPE_OK;
|
return SCPE_OK;
|
||||||
}
|
}
|
||||||
if (lp->serport) {
|
if (lp->serport) {
|
||||||
t_stat r = sim_control_serial (lp->serport, bits_to_set, bits_to_clear, incoming_bits);
|
t_stat r = sim_control_serial (lp->serport, bits_to_set, bits_to_clear, status_bits);
|
||||||
if (incoming_bits && (r == SCPE_OK))
|
if (status_bits && (r == SCPE_OK))
|
||||||
lp->modembits = (lp->modembits & ~TMXR_MDM_INCOMING) | *incoming_bits;
|
lp->modembits = (lp->modembits & ~TMXR_MDM_INCOMING) | *status_bits;
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
if ((lp->sock) || (lp->connecting)) {
|
if ((lp->sock) || (lp->connecting)) {
|
||||||
|
@ -1792,7 +1792,7 @@ if ((lp->sock) || (lp->connecting)) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((lp->serport) && (!lp->loopback))
|
if ((lp->serport) && (!lp->loopback))
|
||||||
sim_control_serial (lp->serport, 0, 0, incoming_bits);
|
sim_control_serial (lp->serport, 0, 0, status_bits);
|
||||||
return SCPE_INCOMP;
|
return SCPE_INCOMP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue