aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/sysmobts-calib/sysmobts-layer1.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2013-02-13 17:19:19 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2013-02-13 17:19:19 +0100
commitdc9148d0351878a79d689a9c6f60aff21b9d5b81 (patch)
tree1cff06dc86d257b0a58ecc94297800c1c0d436bf /contrib/sysmobts-calib/sysmobts-layer1.c
parent18708dd3b60fa27e6a7121b686f11ee8c8069a4b (diff)
parent1897f03d4c854a0b74a92eb1f846ee1f0f81382b (diff)
Merge branch 'zecke/calib-pch-agch-follow'
Introduce bcch_ccch to scan the PCH on top of the BCCH. The AGCH is included in the PCH. CBCH/NCH are not included at this point.
Diffstat (limited to 'contrib/sysmobts-calib/sysmobts-layer1.c')
-rw-r--r--contrib/sysmobts-calib/sysmobts-layer1.c29
1 files changed, 21 insertions, 8 deletions
diff --git a/contrib/sysmobts-calib/sysmobts-layer1.c b/contrib/sysmobts-calib/sysmobts-layer1.c
index 18b946f..d1060d1 100644
--- a/contrib/sysmobts-calib/sysmobts-layer1.c
+++ b/contrib/sysmobts-calib/sysmobts-layer1.c
@@ -1,6 +1,6 @@
/* Layer1 handling for the DSP/FPGA */
/*
- * (C) 2012 Holger Hans Peter Freyther
+ * (C) 2012-2013 Holger Hans Peter Freyther
*
* All Rights Reserved
*
@@ -481,16 +481,16 @@ int follow_sch(int band, int arfcn, int clock, int ref, HANDLE *layer1)
return 0;
}
-int follow_bcch(HANDLE layer1)
+static int follow_sapi(HANDLE layer1, const GsmL1_Sapi_t sapi)
{
int rc;
GsmL1_Prim_t prim;
- /* 1.) Activate BCCH... */
+ /* 1.) Activate BCCH or such... */
memset(&prim, 0, sizeof(prim));
prim.u.mphActivateReq.hLayer1 = layer1;
prim.u.mphActivateReq.u8Tn = 0;
- prim.u.mphActivateReq.sapi = GsmL1_Sapi_Bcch;
+ prim.u.mphActivateReq.sapi = sapi;
prim.u.mphActivateReq.dir = GsmL1_Dir_RxDownlink;
rc = send_recv_sig_prim(GsmL1_PrimId_MphActivateReq, &prim);
@@ -511,23 +511,33 @@ int follow_bcch(HANDLE layer1)
return rc;
}
- if (prim.u.phConnectInd.sapi != GsmL1_Sapi_Bcch) {
+ if (prim.u.phConnectInd.sapi != sapi) {
printf("Got a connect indication for the wrong type: %d\n",
prim.u.phConnectInd.sapi);
return -6;
}
/* 3.) Wait for PhDataInd... */
- printf("Waiting for BCCH data.\n");
+ printf("Waiting for data.\n");
rc = wait_for_indication(GsmL1_PrimId_PhDataInd, &prim);
if (rc != 0) {
- printf("Didn't get BCCH data.\n");
+ printf("Didn't get data.\n");
return rc;
}
return 0;
}
+int follow_bcch(HANDLE layer1)
+{
+ return follow_sapi(layer1, GsmL1_Sapi_Bcch);
+}
+
+int follow_pch(HANDLE layer1)
+{
+ return follow_sapi(layer1, GsmL1_Sapi_Pch);
+}
+
int find_bsic(void)
{
int rc, i;
@@ -701,7 +711,7 @@ int wait_for_sync(HANDLE layer1, int cor, int calib, int source)
return 0;
}
-int wait_for_data(uint8_t *data, size_t *size)
+int wait_for_data(uint8_t *data, size_t *size, uint32_t *fn, uint8_t *block, GsmL1_Sapi_t *sap)
{
GsmL1_Prim_t prim;
int rc;
@@ -713,6 +723,9 @@ int wait_for_data(uint8_t *data, size_t *size)
return 1;
*size = prim.u.phDataInd.msgUnitParam.u8Size;
+ *fn = prim.u.phDataInd.u32Fn;
+ *block = prim.u.phDataInd.u8BlockNbr;
+ *sap = prim.u.phDataInd.sapi;
memcpy(data, prim.u.phDataInd.msgUnitParam.u8Buffer, *size);
return 0;
}