C-Netz: Add code documentation...

This commit is contained in:
Andreas Eversberg 2016-12-01 17:59:08 +01:00
parent e34d74aa23
commit 27c6e3d860
3 changed files with 32 additions and 1 deletions

View File

@ -75,6 +75,30 @@
* read also in the C-Netz specs.
*/
/*
* Notes on switching from OgK to SpK
*
* Upon transmission of TRANS_VAG and TRANS_VAK, the SpK channel is allocated,
* set to busy, scheduled to switch to SpK mode after two frames. The trans-
* action is relinked from OgK to SpK.
*
* In case of a combined OgK+SpK, the channel stays the same, but will change.
*
* See below for detailled processing.
*/
/*
* Notes on database (subscriber)
*
* If a subscriber registers (transaction is created), an instance of the
* subscriber database is created. A timer is running for each instance, so
* the subscriber is paged to check availability of the phone. If the paging
* fails, a retry counter is decreased until the subscriber is removed from
* database.
*
* See database.c for more information.
*/
/*
* Notes on the combined channel hack:
*
@ -899,7 +923,7 @@ wbn:
} else {
PDEBUG(DCNETZ, DEBUG_INFO, "Assigning phone to traffic channel %d\n", spk->sender.kanal);
/* sync RX time to current OgK time */
spk->fsk_demod.bit_time = cnetz->fsk_demod.bit_time;
fsk_copy_sync(&spk->fsk_demod, &cnetz->fsk_demod);
}
/* set channel */
telegramm.frequenz_nr = spk->sender.kanal;

View File

@ -456,6 +456,12 @@ void fsk_correct_sync(fsk_fm_demod_t *fsk, double offset)
fsk->bit_time = fmod(fsk->bit_time - offset + BITS_PER_SUPERFRAME, BITS_PER_SUPERFRAME);
}
/* copy sync from one instance to another (used to sync RX of SpK to OgK */
void fsk_copy_sync(fsk_fm_demod_t *fsk_to, fsk_fm_demod_t *fsk_from)
{
fsk_to->bit_time = fsk_from->bit_time;
}
void fsk_demod_reset(fsk_fm_demod_t *fsk)
{
fsk->sync = FSK_SYNC_NONE;

View File

@ -53,5 +53,6 @@ typedef struct fsk_fm_demod {
int fsk_fm_init(fsk_fm_demod_t *fsk, cnetz_t *cnetz, int samplerate, double bitrate);
void fsk_fm_demod(fsk_fm_demod_t *fsk, int16_t *samples, int length);
void fsk_correct_sync(fsk_fm_demod_t *fsk, double offset);
void fsk_copy_sync(fsk_fm_demod_t *fsk_to, fsk_fm_demod_t *fsk_from);
void fsk_demod_reset(fsk_fm_demod_t *fsk);