view target-utils/libtiffs/init.c @ 884:353daaa6014d

gsm-fw/gpf/conf/gsmcomp.c: increased max partition in the voice-only config The code we got from TCS211 had the maximum prim pool partition size set to 900 bytes in the voice-only config (no FAX_AND_DATA, no GPRS) and to 1600 bytes in every other config. As it turns out, this "minimized" config breaks when the AT command interface is used with %CPI enabled, as the responsible code in ATI does an ACI_MALLOC of 1012 bytes. TI may have considered this case to be unsupported usage (perhaps they didn't care about the combination of a voice-only PS with AT command control), but we do want this use case to work without crashing. Solution: I made the largest prim pool the same as it is with FAX_AND_DATA: 3 partitions of 1600 bytes.
author Space Falcon <falcon@ivan.Harhan.ORG>
date Sat, 27 Jun 2015 07:31:30 +0000
parents 2900fe603f8a
children
line wrap: on
line source

#include "types.h"
#include "struct.h"
#include "globals.h"
#include "macros.h"

static const u8 ffs_sector_signature[6] = {'F', 'f', 's', '#', 0x10, 0x02};
static const u8 blank_flash_line[16] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
					0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
					0xFF, 0xFF, 0xFF, 0xFF};

static
find_indexblk()
{
	u32 sector_addr;
	u8 *sector_ptr;
	int i;

	printf("Looking for MPFFS active index block\n");
	sector_addr = mpffs_base_addr;
	for (i = 0; i < mpffs_nsectors; i++) {
		sector_ptr = (u8 *) sector_addr;
		if (!bcmp(sector_ptr, ffs_sector_signature, 6) &&
		    sector_ptr[8] == 0xAB) {
			printf("Found at %08X\n", sector_addr);
			mpffs_active_index = (struct inode *) sector_ptr;
			return(0);
		}
		sector_addr += mpffs_sector_size;
	}
	printf("Error: Not found in any of the %d candidate sectors\n",
		mpffs_nsectors);
	return(-1);
}

static
find_rootino()
{
	int ino;
	struct inode *irec;

	printf("Looking for the root inode\n");
	for (ino = 1; ; ino++) {
		if (ino >= mpffs_sector_size >> 4) {
		    printf("Error: Hit end of sector, no root inode found\n");
			return(-1);
		}
		irec = mpffs_active_index + ino;
		if (!bcmp((u8 *) irec, blank_flash_line, 16)) {
			printf("Error: Hit blank flash, no root inode found\n");
			return(-1);
		}
		if (irec->type == OBJTYPE_DIR && *inode_to_dataptr(irec) == '/')
			break;
	}
	printf("Found at inode #%x\n", ino);
	mpffs_root_ino = ino;
	return(0);
}

mpffs_init()
{
	int stat;

	if (mpffs_init_done)
		return(0);
	stat = find_indexblk();
	if (stat < 0)
		return(stat);
	stat = find_rootino();
	if (stat < 0)
		return(stat);
	mpffs_init_done = 1;
	return(0);
}