FreeCalypso > hg > freecalypso-tools
changeset 16:cc204f908f32
fc-getpirimei and fc-pirhackinit removed: functionality is now in fc-fsio
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 03 Oct 2016 07:24:41 +0000 |
parents | 5cc0791a6eb6 |
children | 4644799cb515 |
files | rvinterf/etmsync/Makefile rvinterf/etmsync/pirhackinit.c rvinterf/etmsync/pirimeimain.c |
diffstat | 3 files changed, 1 insertions(+), 179 deletions(-) [+] |
line wrap: on
line diff
--- a/rvinterf/etmsync/Makefile Mon Oct 03 07:18:09 2016 +0000 +++ b/rvinterf/etmsync/Makefile Mon Oct 03 07:24:41 2016 +0000 @@ -1,6 +1,6 @@ CC= gcc CFLAGS= -O2 -I../include -PROGS= fc-dspapidump fc-fsio fc-getpirimei fc-olddump fc-pirhackinit +PROGS= fc-dspapidump fc-fsio fc-olddump INSTBIN=/usr/local/bin DSPDUMP_OBJS= connect.o dspapidump.o interf.o launchrvif.o memops.o \ @@ -13,12 +13,6 @@ OLDDUMP_OBJS= connect.o interf.o launchrvif.o memops.o olddump.o simplemain.o -PIRIMEI_OBJS= cl_des.o connect.o interf.o launchrvif.o memops.o pirimei.o \ - pirimeimain.o simplemain.o - -PIRHACK_OBJS= cl_des.o connect.o fileio.o fserr.o interf.o launchrvif.o \ - memops.o pirhackinit.o pirimei.o rfcap.o simplemain.o stddirs.o - all: ${PROGS} fc-dspapidump: ${DSPDUMP_OBJS} @@ -30,12 +24,6 @@ fc-olddump: ${OLDDUMP_OBJS} ${CC} ${CFLAGS} -o $@ ${OLDDUMP_OBJS} -fc-getpirimei: ${PIRIMEI_OBJS} - ${CC} ${CFLAGS} -o $@ ${PIRIMEI_OBJS} - -fc-pirhackinit: ${PIRHACK_OBJS} - ${CC} ${CFLAGS} -o $@ ${PIRHACK_OBJS} - install: ${PROGS} mkdir -p ${INSTBIN} install -c ${PROGS} ${INSTBIN}
--- a/rvinterf/etmsync/pirhackinit.c Mon Oct 03 07:18:09 2016 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,160 +0,0 @@ -/* - * This fc-pirhackinit utility is highly specific to the TCS211-on-Pirelli - * exercise. DO NOT run it against Pirelli's stock firmware, nor is it needed - * when using our full-source FreeCalypso firmware. - */ - -#include <sys/types.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <strings.h> -#include "etm.h" -#include "ffs.h" -#include "tmffs2.h" -#include "localtypes.h" -#include "exitcodes.h" - -extern u_char pirelli_imeisv[8]; - -write_pcm_imei() -{ - static char destfile[] = "/pcm/IMEI"; - u_char swapped[8]; - int i, d1, d2; - - printf("Writing %s\n", destfile); - for (i = 0; i < 8; i++) { - d1 = pirelli_imeisv[i] >> 4; - d2 = pirelli_imeisv[i] & 0xF; - swapped[i] = (d2 << 4) | d1; - } - return do_short_fwrite(destfile, swapped, 8); -} - -read_mem_region(memaddr, databuf, total_bytes) - u32 memaddr; - u_char *databuf; -{ - int chunk, remain, rc; - - for (remain = total_bytes; remain; remain -= chunk) { - chunk = remain; - if (chunk > MAX_MEMREAD_BYTES) - chunk = MAX_MEMREAD_BYTES; - rc = do_memory_read(memaddr, databuf, chunk); - if (rc) - return(rc); - memaddr += chunk; - databuf += chunk; - } - return(0); -} - -write_buf_to_file(pathname, data, datalen) - char *pathname; - u_char *data; -{ - int tfd, rc, chunk, remain; - - if (datalen <= max_short_file_write(pathname)) - return do_short_fwrite(pathname, data, datalen); - /* do it the long way */ - rc = fd_open(pathname, FFS_O_WRONLY | FFS_O_CREATE | FFS_O_TRUNC, &tfd); - if (rc) - return(rc); - for (remain = datalen; remain; remain -= chunk) { - chunk = remain; - if (chunk > 240) - chunk = 240; - rc = fd_write(tfd, data, chunk); - if (rc) { - fd_close(tfd); - return(rc); - } - data += chunk; - } - return fd_close(tfd); -} - -copy_calib_record(memaddr, pathname, size) - u32 memaddr; - char *pathname; - int size; -{ - u_char *buf; - int rc; - - buf = malloc(size); - if (!buf) { - perror("malloc"); - exit(ERROR_UNIX); - } - rc = read_mem_region(memaddr, buf, size); - if (rc) { - free(buf); - return(rc); - } - rc = write_buf_to_file(pathname, buf, size); - free(buf); - return(rc); -} - -static struct calmap { - u32 offset; - int size; - char *ti_equiv; -} pirelli_cal_map[] = { - {0x06E5, 36, "/sys/adccal"}, - {0x072B, 512, "/gsm/rf/tx/ramps.900"}, - {0x092C, 128, "/gsm/rf/tx/levels.900"}, - {0x09AD, 128, "/gsm/rf/tx/calchan.900"}, - {0x0A2E, 512, "/gsm/rf/tx/ramps.1800"}, - {0x0C2F, 128, "/gsm/rf/tx/levels.1800"}, - {0x0CB0, 128, "/gsm/rf/tx/calchan.1800"}, - {0x0D31, 512, "/gsm/rf/tx/ramps.1900"}, - {0x0F32, 128, "/gsm/rf/tx/levels.1900"}, - {0x0FB3, 128, "/gsm/rf/tx/calchan.1900"}, - {0x10AF, 40, "/gsm/rf/rx/calchan.900"}, - {0x10D8, 8, "/gsm/rf/rx/agcparams.900"}, - {0x10E1, 40, "/gsm/rf/rx/calchan.1800"}, - {0x110A, 8, "/gsm/rf/rx/agcparams.1800"}, - {0x1113, 40, "/gsm/rf/rx/calchan.1900"}, - {0x113C, 8, "/gsm/rf/rx/agcparams.1900"}, - {0, 0, 0} -}; - -copy_calib_data() -{ - struct calmap *tp; - int rc; - - printf("Copying calibration records to FFS\n"); - for (tp = pirelli_cal_map; tp->size; tp++) { - rc = copy_calib_record(0x027F0000 + tp->offset, tp->ti_equiv, - tp->size); - if (rc) - return(rc); - } - return(0); -} - -single_op_main() -{ - int rc; - - rc = get_pirelli_imei(); - if (rc) - return(rc); - printf("Creating TCS211 file system directories\n"); - rc = create_std_dirs(); - if (rc) - return(rc); - rc = write_pcm_imei(); - if (rc) - return(rc); - rc = copy_calib_data(); - if (rc) - return(rc); - return set_rfcap("tri900"); -}