struct msgb *gen_empty_tch_msg(struct gsm_lchan *lchan, uint32_t fn) { struct msgb *msg; GsmL1_Prim_t *l1p; GsmL1_PhDataReq_t *data_req; GsmL1_MsgUnitParam_t *msu_param; uint8_t *payload_type; uint8_t *l1_payload; int rc; msg = l1p_msgb_alloc(); if (!msg) return NULL; l1p = msgb_l1prim(msg); data_req = &l1p->u.phDataReq; msu_param = &data_req->msgUnitParam; payload_type = &msu_param->u8Buffer[0]; l1_payload = &msu_param->u8Buffer[1]; switch (lchan->tch_mode) { case GSM48_CMODE_SPEECH_AMR: if (lchan->type == GSM_LCHAN_TCH_H && dtx_dl_amr_enabled(lchan)) { /* we have to explicitly handle sending SID FIRST P2 for AMR HR in here */ *payload_type = GsmL1_TchPlType_Amr_SidFirstP2; rc = dtx_dl_amr_fsm_step(lchan, NULL, 0, fn, l1_payload, false, &(msu_param->u8Size), NULL); if (rc == 0) return msg; } *payload_type = GsmL1_TchPlType_Amr; break; case GSM48_CMODE_SPEECH_V1: if (lchan->type == GSM_LCHAN_TCH_F) *payload_type = GsmL1_TchPlType_Fr; else *payload_type = GsmL1_TchPlType_Hr; break; case GSM48_CMODE_SPEECH_EFR: *payload_type = GsmL1_TchPlType_Efr; break; default: msgb_free(msg); return NULL; } rc = repeat_last_sid(lchan, l1_payload, fn); if (!rc) { msgb_free(msg); return NULL; } msu_param->u8Size = rc; return msg; }
/* Chapter 12.1 */ int octphy_hw_get_pcb_info(struct octphy_hdl *fl1h) { struct msgb *msg = l1p_msgb_alloc(); tOCTVC1_HW_MSG_PCB_INFO_CMD *pic; pic = (tOCTVC1_HW_MSG_PCB_INFO_CMD *) msgb_put(msg, sizeof(*pic)); l1if_fill_msg_hdr(&pic->Header, msg, fl1h, cOCTVC1_MSG_TYPE_COMMAND, cOCTVC1_HW_MSG_PCB_INFO_CID); mOCTVC1_HW_MSG_PCB_INFO_CMD_SWAP(pic); return l1if_req_compl(fl1h, msg, get_pcb_info_compl_cb, NULL); }
/* Chapter 12.16 */ int octphy_hw_get_clock_sync_stats(struct octphy_hdl *fl1h) { struct msgb *msg = l1p_msgb_alloc(); tOCTVC1_HW_MSG_CLOCK_SYNC_MGR_STATS_CMD *csc; csc = (tOCTVC1_HW_MSG_CLOCK_SYNC_MGR_STATS_CMD *) msgb_put(msg, sizeof(*csc)); l1if_fill_msg_hdr(&csc->Header, msg, fl1h, cOCTVC1_MSG_TYPE_COMMAND, cOCTVC1_HW_MSG_CLOCK_SYNC_MGR_STATS_CID); mOCTVC1_HW_MSG_CLOCK_SYNC_MGR_STATS_CMD_SWAP(csc); return l1if_req_compl(fl1h, msg, get_clock_sync_stats_cb, NULL); }
/* Chapter 12.9 */ int octphy_hw_get_rf_port_info(struct octphy_hdl *fl1h, uint32_t index) { struct msgb *msg = l1p_msgb_alloc(); tOCTVC1_HW_MSG_RF_PORT_INFO_CMD *pic; pic = (tOCTVC1_HW_MSG_RF_PORT_INFO_CMD *) msgb_put(msg, sizeof(*pic)); l1if_fill_msg_hdr(&pic->Header, msg, fl1h, cOCTVC1_MSG_TYPE_COMMAND, cOCTVC1_HW_MSG_RF_PORT_INFO_CID); pic->ulPortIndex = index; mOCTVC1_HW_MSG_RF_PORT_INFO_CMD_SWAP(pic); return l1if_req_compl(fl1h, msg, rf_port_info_compl_cb, NULL); }
/* Chapter 12.10 */ int octphy_hw_get_rf_port_stats(struct octphy_hdl *fl1h, uint32_t index) { struct msgb *msg = l1p_msgb_alloc(); tOCTVC1_HW_MSG_RF_PORT_STATS_CMD *psc; psc = (tOCTVC1_HW_MSG_RF_PORT_STATS_CMD *) msgb_put(msg, sizeof(*psc)); l1if_fill_msg_hdr(&psc->Header, msg, fl1h, cOCTVC1_MSG_TYPE_COMMAND, cOCTVC1_HW_MSG_RF_PORT_STATS_CID); psc->ulPortIndex = index; psc->ulResetStatsFlag = cOCT_FALSE; mOCTVC1_HW_MSG_RF_PORT_STATS_CMD_SWAP(psc); return l1if_req_compl(fl1h, msg, rf_port_stats_compl_cb, NULL); }
static int ph_data_req(struct gsm_bts_trx *trx, struct msgb *msg, struct osmo_phsap_prim *l1sap, bool use_cache) { struct lc15l1_hdl *fl1 = trx_lc15l1_hdl(trx); struct msgb *l1msg = l1p_msgb_alloc(); struct gsm_lchan *lchan; uint32_t u32Fn; uint8_t u8Tn, subCh, u8BlockNbr = 0, sapi = 0; uint8_t chan_nr, link_id; int len; if (!msg) { LOGP(DL1C, LOGL_FATAL, "PH-DATA.req without msg. " "Please fix!\n"); abort(); } len = msgb_l2len(msg); chan_nr = l1sap->u.data.chan_nr; link_id = l1sap->u.data.link_id; u32Fn = l1sap->u.data.fn; u8Tn = L1SAP_CHAN2TS(chan_nr); subCh = 0x1f; lchan = get_lchan_by_chan_nr(trx, chan_nr); if (L1SAP_IS_LINK_SACCH(link_id)) { sapi = GsmL1_Sapi_Sacch; if (!L1SAP_IS_CHAN_TCHF(chan_nr)) subCh = l1sap_chan2ss(chan_nr); } else if (L1SAP_IS_CHAN_TCHF(chan_nr)) { if (ts_is_pdch(&trx->ts[u8Tn])) { if (L1SAP_IS_PTCCH(u32Fn)) { sapi = GsmL1_Sapi_Ptcch; u8BlockNbr = L1SAP_FN2PTCCHBLOCK(u32Fn); } else { sapi = GsmL1_Sapi_Pdtch; u8BlockNbr = L1SAP_FN2MACBLOCK(u32Fn); } } else { sapi = GsmL1_Sapi_FacchF; u8BlockNbr = (u32Fn % 13) >> 2; } } else if (L1SAP_IS_CHAN_TCHH(chan_nr)) {
/* Chapter 12.14 */ int octphy_hw_get_rf_ant_tx_config(struct octphy_hdl *fl1h, uint32_t port_idx, uint32_t ant_idx) { struct msgb *msg = l1p_msgb_alloc(); tOCTVC1_HW_MSG_RF_PORT_INFO_ANTENNA_TX_CONFIG_CMD *psc; psc = (tOCTVC1_HW_MSG_RF_PORT_INFO_ANTENNA_TX_CONFIG_CMD *) msgb_put(msg, sizeof(*psc)); l1if_fill_msg_hdr(&psc->Header, msg, fl1h, cOCTVC1_MSG_TYPE_COMMAND, cOCTVC1_HW_MSG_RF_PORT_INFO_ANTENNA_RX_CONFIG_CID); psc->ulPortIndex = port_idx; psc->ulAntennaIndex = ant_idx; mOCTVC1_HW_MSG_RF_PORT_INFO_ANTENNA_TX_CONFIG_CMD_SWAP(psc); return l1if_req_compl(fl1h, msg, rf_ant_tx_compl_cb, NULL); }