view ater/read_ts.c @ 37:26c9535df39e

rm abis subdir: moved to e1-fake-trau repository The present code repository is meant to contain code for talking to a TRAU DUT, hence the name ice1-trau-tester. The different and separate function of talking to an E1 BTS (Abis instead of Ater, and in the opposite role) was never in scope for this project, but that code got added here in a haste when the InSite BTS arrived while the TRAU bring-up was still blocked. Now that we have our Nokia TCSM2 system working and are doing TRAU experiments, let's keep the code clean.
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 29 Aug 2024 19:02:02 +0000
parents 61862af2247f
children
line wrap: on
line source

/*
 * The function in this module gets called from Osmocom select loop
 * whenever the data socket to osmo-e1d is ready for reading.
 */

#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

#include <osmocom/core/select.h>
#include <osmocom/isdn/i460_mux.h>

#include "globals.h"

uint8_t readbuf[160];
FILE *record_file;

int ts_fd_cb(struct osmo_fd *ofd, unsigned int what)
{
	int rc;

	rc = read(ts_fd, readbuf, 160);
	if (rc != 160) {
		fprintf(stderr,
			"error: read from ts returned %d instead of 160\n",
			rc);
		exit(1);
	}
	if (record_file)
		fwrite(readbuf, 1, 160, record_file);
	osmo_i460_demux_in(&i460_ts, readbuf, 160);
	transmit_e1_ts();
	return 0;
}