aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2016-12-01 17:59:08 +0100
committerAndreas Eversberg <jolly@eversberg.eu>2016-12-01 17:59:08 +0100
commit27c6e3d860aed41f6ed44997b1410b229f2bd53f (patch)
tree52152364fb0c6904be095613f1661e26f3d93a4d /src
parente34d74aa232a4b7b656a2c36eda952d597bdadfd (diff)
C-Netz: Add code documentation...
Diffstat (limited to 'src')
-rw-r--r--src/cnetz/cnetz.c26
-rw-r--r--src/cnetz/fsk_fm_demod.c6
-rw-r--r--src/cnetz/fsk_fm_demod.h1
3 files changed, 32 insertions, 1 deletions
diff --git a/src/cnetz/cnetz.c b/src/cnetz/cnetz.c
index 7519241..b177f65 100644
--- a/src/cnetz/cnetz.c
+++ b/src/cnetz/cnetz.c
@@ -76,6 +76,30 @@
*/
/*
+ * 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:
*
* For combined SpK+OgK hack, the channel is used as SpK as last choise. This
@@ -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;
diff --git a/src/cnetz/fsk_fm_demod.c b/src/cnetz/fsk_fm_demod.c
index a7247f0..f4008f4 100644
--- a/src/cnetz/fsk_fm_demod.c
+++ b/src/cnetz/fsk_fm_demod.c
@@ -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;
diff --git a/src/cnetz/fsk_fm_demod.h b/src/cnetz/fsk_fm_demod.h
index 0c51e70..b1889bd 100644
--- a/src/cnetz/fsk_fm_demod.h
+++ b/src/cnetz/fsk_fm_demod.h
@@ -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);