view src/gpf2/osl/os_pro_ir.c @ 636:57e67ca2e1cb

pcmdata.c: default +CGMI to "FreeCalypso" and +CGMM to model The present change has no effect whatsoever on Falconia-made and Openmoko-made devices on which /pcm/CGMI and /pcm/CGMM files have been programmed in FFS with sensible ID strings by the respective factories, but what should AT+CGMI and AT+CGMM queries return when the device is a Huawei GTM900 or Tango modem that has been converted to FreeCalypso with a firmware change? Before the present change they would return compiled-in defaults of "<manufacturer>" and "<model>", respectively; with the present change the firmware will self-identify as "FreeCalypso GTM900-FC" or "FreeCalypso Tango" on the two respective targets. This firmware identification will become important if someone incorporates an FC-converted GTM900 or Tango modem into a ZeroPhone-style smartphone where some high-level software like ofono will be talking to the modem and will need to properly identify this modem as FreeCalypso, as opposed to some other AT command modem flavor with different quirks. In technical terms, the compiled-in default for the AT+CGMI query (which will always be overridden by the /pcm/CGMI file in FFS if one is present) is now "FreeCalypso" in all configs on all targets; the compiled-in default for the AT+CGMM query (likewise always overridden by /pcm/CGMM if present) is "GTM900-FC" if CONFIG_TARGET_GTM900 or "Tango" if CONFIG_TARGET_TANGO or the original default of "<model>" otherwise.
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 19 Jan 2020 20:14:58 +0000
parents dfa8771e84b1
children
line wrap: on
line source

/*
 * This C module is a reconstruction based on the disassembly of
 * os_pro.obj in frame_na7_db_ir.lib from the Leonardo package.
 */

/* set of included headers from COFF symtab: */
#include <stdio.h>
#include <string.h>
#include "nucleus.h"
#include "typedefs.h"
#include "os.h"
#include "gdi.h"
#include "os_types.h"
#include "os_glob.h"

extern VOID *TCD_Current_Thread;
extern T_OS_TASK_TABLE_ENTRY TaskTable[];
extern unsigned os_time_to_tick_multiplier;

#define	OS_NU_TASK_MAGIC	0xdeafbeef

VOID
os_TaskEntry(UNSIGNED TaskHandle, VOID *argv)
{
	TaskTable[TaskHandle].TaskEntry(TaskHandle, 0);
}

GLOBAL LONG
os_SuspendTask(OS_HANDLE Caller, ULONG Time)
{
	UNSIGNED SuspendTicks;

	SuspendTicks = TIME_TO_SYSTEM_TICKS(Time);
	if (!SuspendTicks)
		SuspendTicks = 1;
	NU_Sleep(SuspendTicks);
	return (OS_OK);
}

GLOBAL LONG
os_ResumeTask(OS_HANDLE task_handle)
{
	if (NU_Resume_Task(&TaskTable[task_handle].TaskCB.TCB) == NU_SUCCESS)
		return(OS_OK);
	else
		return(OS_ERROR);
}

GLOBAL LONG
os_Relinquish(void)
{
	NU_Relinquish();
	return(OS_OK);
}

GLOBAL OS_HANDLE
os_MyHandle(void)
{
	OS_NU_TASK *os_nu_task = (OS_NU_TASK *) TCD_Current_Thread;

	if (os_nu_task && os_nu_task->magic_nr == OS_NU_TASK_MAGIC)
		return(os_nu_task->handle);
	else
		return(OS_NOTASK);
}

GLOBAL LONG
os_GetTaskName(OS_HANDLE Caller, OS_HANDLE TaskHandle, char *Name)
{
	if (TaskHandle) {
		if (TaskHandle > MaxTasks || !TaskTable[TaskHandle].Name[0])
			return(OS_ERROR);
		strcpy(Name, TaskTable[TaskHandle].Name);
	} else if (TCD_Current_Thread) {
		NU_TASK *curtask = TCD_Current_Thread;
		strcpy(Name, curtask->tc_name);
	} else
		strcpy(Name, "ROOT");
	return(OS_OK);
}

GLOBAL LONG
os_DeferTask(OS_HANDLE task_handle, OS_TIME time)
{
	if (NU_Suspend_Task(&TaskTable[task_handle].TaskCB.TCB) == NU_SUCCESS)
		return(OS_OK);
	else
		return(OS_ERROR);
}

GLOBAL LONG
os_CheckTaskStack(OS_HANDLE Handle)
{
#ifdef __GNUC__
	register void *sp asm("sp");
#endif

	if (*TaskTable[Handle].Stack != GUARD_PATTERN)
		return(OS_ERROR);
#ifdef __GNUC__
	if (TCD_Current_Thread) {
		NU_TASK *curtask = TCD_Current_Thread;
		if (sp < curtask->tc_stack_start)
			return(OS_ERROR);
	}
#endif
	return(OS_OK);
}