aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/sysmobts-calib/sysmobts-layer1.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2013-02-05 23:59:46 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2013-02-13 17:17:59 +0100
commit1897f03d4c854a0b74a92eb1f846ee1f0f81382b (patch)
tree1cff06dc86d257b0a58ecc94297800c1c0d436bf /contrib/sysmobts-calib/sysmobts-layer1.c
parent6ac2e684678a27f13966b7ae8d9937f43cb7adc9 (diff)
calib: Attempt to follow the PCH as well and print the SAPI..
AGCH is reported as part of the PCH because we are not searching for the BS-AG-BLKS-RES inside the SI3 and do not use MphConfigReq to change this setting.
Diffstat (limited to 'contrib/sysmobts-calib/sysmobts-layer1.c')
-rw-r--r--contrib/sysmobts-calib/sysmobts-layer1.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/contrib/sysmobts-calib/sysmobts-layer1.c b/contrib/sysmobts-calib/sysmobts-layer1.c
index 85aa940a..d1060d1d 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, uint32_t *fn, uint8_t *block)
+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;
@@ -715,6 +725,7 @@ int wait_for_data(uint8_t *data, size_t *size, uint32_t *fn, uint8_t *block)
*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;
}