Exemplo n.º 1
0
uint8_t setup(void)
{
	keyInit();
	lcdInit();

	spiMasterInit();
	uint8_t rinit = rInit();

	// IO

	SET(DDR, F_TRIG);
	SET(DDR, F_QUENCH);

	CLR(PORT, F_TRIG);
	CLR(PORT, F_QUENCH);

	SET(DDR, LED);
	CLR(PORT, LED);
// timers
	initTicker();


	// interrupt
	PORTD |= (1<<PD2)|(1<<PD3);
	// INT0 and INT1 active LOW
	EIMSK |= (1<<INT0) | (1<<INT1);

	sei();

	return rinit;
}
Exemplo n.º 2
0
/*
 * @internal
 *
 * Allocates and initializes a key
 * @returns 0 if allocation did not work, the key otherwise
 */
static Key * elektraKeyMalloc ()
{
	Key * key = (Key *)elektraMalloc (sizeof (Key));
	if (!key) return 0;
	keyInit (key);

	return key;
}
Exemplo n.º 3
0
void
compInit(void)
{
	int	gclevel;

	gclevel = compDoGc     ? StoCtl_GcLevel_Automatic :
		  compDoGcFile ? StoCtl_GcLevel_Demand    :
		                 StoCtl_GcLevel_Never;
	/* If and when to GG. */
	stoCtl(StoCtl_GcLevel, gclevel);
	if (compDoGcVerbose)
		/* Put GC messages on osStdout. */
		stoCtl(StoCtl_GcFile, osStdout);
	else
		stoCtl(StoCtl_GcFile, (FILE *) NULL);
	/* Do not initialize pieces. */
	stoCtl(StoCtl_Wash, false);

	obInit();
	dbInit();
	comsgOpen();
	compInfoAudit();
 
	osSetBreakHandler(compSignalHandler);
	osSetFaultHandler(compSignalHandler);
	osSetLimitHandler(compSignalHandler);
	osSetDangerHandler(compSignalHandler);

	exitSetHandler	 (compExitHandler);
	fileSetHandler	 (compFileError);
	stoSetHandler	 (compStoreError);
	sxiSetHandler	 (compSExprError);
 
	pathInit();
	if (compRootDir) {
		fileAddLibraryDirectory(fileSubdir(compRootDir, "lib"));
		fileAddLibraryDirectory(fileSubdir(fileSubdir(compRootDir, "share"),
						   "lib"));
		fileAddIncludeDirectory(fileSubdir(compRootDir, "include"));
		ccSetRoot(compRootDir);
	}
	fileAddLibraryDirectory(osCurDirName());

	compCfgInit(compRootDir);
	arInit(compLibraryFiles, compLibraryKeys);
 
	sxiInit();
	keyInit();
	ssymInit();
	stabInitGlobal();
	tfInit();
	fmttsInit();
	foamInit();
	optInit();
	tinferInit();
}
Exemplo n.º 4
0
/*
 * Usage: showexports libName type-expression
 * Example: showexports libaldor.al 'List(Integer)'
 */
int
main(int argc, char *argv[])
{
	osInit();
	sxiInit();
	keyInit();
	ssymInit();
	dbInit();
	stabInitGlobal();
	tfInit();
	foamInit();
	optInit();
	tinferInit();
	pathInit();

	sposInit();
	ablogInit();
	comsgInit();

	macexInitFile();
	comsgInit();
	scobindInitFile();
	stabInitFile();

	fileAddLibraryDirectory(".");

	String archive = argv[1];
	String expression = argv[2];

	scmdHandleLibrary("LIB", archive);

	AbSyn ab = shexpParse(expression);
	Stab stab = stabFile();
	Syme syme = stabGetArchive(symInternConst("LIB"));
	AbSyn arAbSyn = abNewId(sposNone, symInternConst("LIB"));

	stabImportTForm(stab, tiGetTForm(stab, arAbSyn));
	abPutUse(ab, AB_Use_Value);
	scopeBind(stab, ab);
	typeInfer(stab, ab);
	TForm tf = tiGetTForm(stab, ab);

	SymeList list = tfStabGetDomImports(stab, tf);

	for (; list != listNil(Syme); list = cdr(list)) {
		Syme syme = car(list);
		aprintf("%s %d %d %s\n", symeString(syme),
			symeDefnNum(syme), symeConstNum(syme), tfPretty(symeType(syme)));
	}

	scobindFiniFile();
	stabFiniFile();
	comsgFini();
	macexFiniFile();

}
Exemplo n.º 5
0
Arquivo: testlib.c Projeto: pdo/aldor
void
init()
{
	osInit();
	sxiInit();
	keyInit();
	ssymInit();
	dbInit();
	stabInitGlobal();
	tfInit();
	foamInit();
	optInit();
	tinferInit();

	sposInit();
	ablogInit();
	comsgInit();
}
Exemplo n.º 6
0
/*----------------------------------------------------------------------------*/
void sys_init(void)
{
#ifdef UART_ENABLE
    uartInit();
    printf("power up \r\n");
 #endif

#if RTC_ENABLE
    if (init_rtc())
    {
        work_mode = SYS_RTC;
    }
#else 
	{
		u8 rtc_reg;
	    rtc_reg=read_rtc_reg();
		//printf("RTC reg:%02bx\n",rtc_reg);	
		if (rtc_reg & BIT(6))   ///<RTC是否完全掉电
	    {
#if (MEMORY_STYLE == USE_RTCRAM)
			reset_rtc_ram();
#endif
			rtc_reg &= ~(BIT(6)); 				 //清零PDGLG
    			write_rtc_reg(rtc_reg);
	    }
	}
#endif

    P0IE_init();
    keyInit();
    timer1Init();
    timer3Init();
#ifdef USE_USB_SD_DECODE_FUNC	    
#ifndef NO_SD_DECODE_FUNC
    sd_speed_init(1,100);
    init_port_sd();
#endif
#endif
#if SDMMC_CMD_MODE
	sd_chk_ctl(SET_SD_H_CHK);
#endif
    DACCON0 |= 0x05;	//打开DSP
    EA = 1;
}
Exemplo n.º 7
0
/**
 * Key Object Cleaner.
 *
 * Will reset all internal data.
 *
 * After this call you will receive a fresh
 * key.
 *
 * The reference counter will stay unmodified.
 *
 * @note that you might also clear() all aliases
 * with this operation.
 *
 * @code
int f (Key *k)
{
	keyClear (k);
	// you have a fresh key k here
	keySetString (k, "value");
	// the caller will get an empty key k with an value
}
 * @endcode
 *
 * @retval returns 0 on success
 * @retval -1 on null pointer
 *
 * @param key the key object to work with
 * @ingroup key
 */
int keyClear (Key * key)
{
	if (!key)
	{
		return -1;
	}

	size_t ref = 0;

	ref = key->ksReference;
	if (key->key) elektraFree (key->key);
	if (key->data.v) elektraFree (key->data.v);
	if (key->meta) ksDel (key->meta);

	keyInit (key);


	/* Set reference properties */
	key->ksReference = ref;

	return 0;
}
Exemplo n.º 8
0
//Load firm into FCRAM
void loadFirm(void){
    //Read FIRM from SD card and write to FCRAM
    fopen("/rei/firmware.bin", "rb");
    firmSize = fsize()/2;
    if(PDN_MPCORE_CFG == 1) fseek(firmSize);
    fread(firmLocation, 1, firmSize);
    fclose();
    decryptFirm(firmLocation, firmSize);
    
    //Initial setup
    firm = firmLocation;
    section = firm->section;
    keyInit(firmLocation + section[2].offset);
    
    //Set MPU for emu/thread code region
    getMPU(firmLocation, firmSize, &mpuOffset);
    memcpy((u8*)mpuOffset, mpu, sizeof(mpu));
    
    //Inject custom loader
    fopen("/rei/loader.cxi", "rb");
    u8 *arm11SysMods = (u8 *)firm + section[0].offset;
    Size ldrInFirmSize;
    Size ldrFileSize = fsize();
    getLoader(arm11SysMods, &ldrInFirmSize, &ldrOffset);
    memcpy(section[0].address, arm11SysMods, ldrOffset);
    fread(section[0].address + ldrOffset, 1, ldrFileSize);
    memcpy(section[0].address + ldrOffset + ldrFileSize, arm11SysMods + ldrOffset + ldrInFirmSize, section[0].size - (ldrOffset + ldrInFirmSize));
    fclose();
    
    //Dont boot emu if AGB game was just played, or if START was held.
    getEmunandSect(&emuOffset, &emuHeader);
    if((HID & 0xFFF) == (1 << 3) || CFG_BOOTENV == 0x7 || !(emuOffset | emuHeader))
        loadSys();
    else
        loadEmu();
}
Exemplo n.º 9
0
void initsystem()
{
	auto int status;
	
	brdInit();
	
	glInit();
	glBlankScreen();
	glBackLight(1);
	keyInit();
	keyConfig (  0,'0',0, 1, 1,  1, 1 );
	keyConfig (  1,'1',0, 1, 1,  1, 1 );
	keyConfig (  2,'2',0, 1, 1,  1, 1 );
	keyConfig (  3,'3',0, 1, 1,  1, 1 );
	keyConfig (  4,'4',0, 1, 1,  1, 1 );
	keyConfig (  5,'5',0, 1, 1,  1, 1 );
	keyConfig (  6,'6',0, 1, 1,  1, 1 );
	
	glXFontInit(&fi6x8, 6, 8, 32, 127, Font6x8);
	
	glBlankScreen();
	glBackLight(1);
	TextWindowFrame(&wholewindow, &fi6x8, 0, 0, 122, 32);
}
Exemplo n.º 10
0
NSS_STATUS _nss_registry_getspnam_r (const char *name, struct spwd * pw,
                                     char *buffer, size_t buflen, int *errnop)
{
    int i;
    char *tmpbuf=NULL;
    Key *tmpkey;

    *errnop = ENOENT;

    /* Open registry connection */
    registryOpen();
    if(_nss_registry_finduserbyname(name) == NSS_STATUS_NOTFOUND) return NSS_STATUS_NOTFOUND;
    /* Yay! the users exists, lets continue */
    pw->sp_namp = (char *)_nss_registry_copy_to_buffer(&buffer,&buflen,name);
    if(! pw->sp_namp)
        goto out_nomem;

    tmpbuf = _nss_registry_get_string(REGISTRYUSER, pw->sp_namp,"shadowPassword");
    if(!_nss_registry_isempty(tmpbuf))
    {
        pw->sp_pwdp =  (char *)_nss_registry_copy_to_buffer(&buffer,&buflen,tmpbuf);
        free(tmpbuf);
    } else
    {
        /* If password is empty, set it to an empty string..If it's still empty, fail */
        pw->sp_pwdp =  (char *)_nss_registry_copy_to_buffer(&buffer,&buflen,"");
    }

    if(!pw->sp_pwdp)
        goto out_nomem;
    /*tmpbuf = _nss_registry_get_string(REGISTRYUSER, pw->sp_namp,"passwdLastChange");*/
    /* It's expected to be returned in this format
     * OK. It's a long and evil way to do this, but I don't have much choice.
     * returns last time password was changed, whether it was comment or
     * actual password */
    tmpbuf = (char *)malloc(255);
    sprintf(tmpbuf, "system/users/%s/shadowPassword",pw->sp_namp);
    tmpkey = (Key *)malloc(sizeof(Key));
    keyInit(tmpkey);
    keySetName(tmpkey, tmpbuf);
    registryStatKey(tmpkey);
    pw->sp_lstchg = keyGetMTime(tmpkey) / (60 * 60 * 24);
    keyClose(tmpkey);
    free(tmpkey);
    free(tmpbuf);

    tmpbuf = _nss_registry_get_string(REGISTRYUSER, pw->sp_namp,"passwdChangeBefore");
    pw->sp_min = _nss_registry_strtol(tmpbuf,FALLBACK,&i);
    if (i)
    {
        _nss_registry_log(LOG_ERR,"User %s has invalid passwdChangeBefore (%s). "
                          " Reverted to %d. Fix you registry entries.",
                          pw->sp_namp, tmpbuf||"NULL",
                          pw->sp_min);
    }
    if (tmpbuf != NULL)
        free(tmpbuf);

    tmpbuf = _nss_registry_get_string(REGISTRYUSER, pw->sp_namp,"passwdChangeAfter");
    pw->sp_max = _nss_registry_strtol(tmpbuf,FALLBACK,&i);
    if (i)
    {
        _nss_registry_log(LOG_ERR,"User %s has invalid passwdChangeAfter (%s). "
                          " Reverted to %d. Fix you registry entries.",
                          pw->sp_namp, tmpbuf||"NULL",
                          pw->sp_max);
    }
    if (tmpbuf != NULL)
        free(tmpbuf);

    tmpbuf = _nss_registry_get_string(REGISTRYUSER, pw->sp_namp,"passwdWarnBefore");
    pw->sp_warn = _nss_registry_strtol(tmpbuf,FALLBACK,&i);
    if (i)
    {
        _nss_registry_log(LOG_ERR,"User %s has invalid passwdWarnBefore (%s). "
                          " Reverted to %d. Fix you registry entries.",
                          pw->sp_namp, tmpbuf||"NULL",
                          pw->sp_warn);
    }
    if (tmpbuf != NULL)
        free(tmpbuf);

    tmpbuf = _nss_registry_get_string(REGISTRYUSER, pw->sp_namp,"passwdDisableAfter");
    pw->sp_inact = _nss_registry_strtol(tmpbuf,FALLBACK,&i);
    /* Don't warn in this case since it seems quite normal to not have that set..
     * At least on my system */
    if(tmpbuf != NULL)
        free(tmpbuf);

    tmpbuf = _nss_registry_get_string(REGISTRYUSER, pw->sp_namp,"passwdDisabledSince");
    pw->sp_expire = _nss_registry_strtol(tmpbuf,FALLBACK,&i);
    /* Don't warn in this case since it seems quite normal to not have that set..
     * At least on my system */
    if(tmpbuf != NULL)
        free(tmpbuf);

    tmpbuf = _nss_registry_get_string(REGISTRYUSER, pw->sp_namp,"passwdReserved");
    pw->sp_flag = _nss_registry_strtol(tmpbuf,FALLBACK,&i);
    /* Don't warn in this case since it seems quite normal to not have that set..
     * At least on my system */
    if(tmpbuf != NULL)
        free(tmpbuf);

    /* Woo! this means it was successfull. Go on! tell everyone :) */

    *errnop = 0;
    registryClose();
    return NSS_STATUS_SUCCESS;


    /* Taken from nss-mysql */
out_nomem:
    /* if we're here, that means that the buffer is too small, so
     * we return ERANGE
     */
    *errnop = ERANGE;
    registryClose();
    return NSS_STATUS_TRYAGAIN;

}
Exemplo n.º 11
0
/*----------------------------------------------------------------------------*/
void sys_init(void)
{
#ifdef UART_ENABLE
    uartInit();
    printf("power up \r\n");
 #endif

#if RTC_ENABLE
    if (init_rtc())
    {
        work_mode = SYS_RTC;
    }
#else 
	{
		u8 rtc_reg;
	    rtc_reg=read_rtc_reg();
		//printf("RTC reg:%02bx\n",rtc_reg);	
		if (rtc_reg & BIT(6))   ///<RTC是否完全掉电
	    {
#if (MEMORY_STYLE == USE_RTCRAM)
			reset_rtc_ram();
#endif
			rtc_reg &= ~(BIT(6)); 				 //清零PDGLG
    			write_rtc_reg(rtc_reg);
	    }
	}
#endif
    set_brightness_all_on();	

    P0IE_init();
    keyInit();
    timer1Init();
    timer3Init();
#ifdef USE_USB_SD_DECODE_FUNC	    
#ifndef NO_SD_DECODE_FUNC
    sd_speed_init(1,100);
    init_port_sd();
#endif
#endif
#if SDMMC_CMD_MODE
	sd_chk_ctl(SET_SD_H_CHK);
#endif
#ifdef USE_POWER_KEY
      sys_power_up();	
#endif	
    DACCON0 |= 0x05;	//打开DSP
    EA = 1;
#ifdef USE_POWER_KEY
      sys_power_up();	
#endif	
    work_mode = read_info(MEM_SYSMODE);

#ifdef CUSTOMED_POWER_ON_AT_RADIO_MODE
	work_mode  = SYS_FMREV;
#endif

    if (work_mode  == SYS_MP3DECODE_USB){

#ifdef REMOVE_USE_MODE
	work_mode  = SYS_FMREV;
	Disp_Con(DISP_TUNER);			
	return;
#endif

	Disp_Con(DISP_SCAN_DISK);

    }
    else if ((work_mode  == SYS_FMREV)
#ifdef AM_RADIO_FUNC		
	||(work_mode == SYS_AMREV)
#endif			
){

#ifdef AM_RADIO_FUNC		
		if(work_mode == SYS_AMREV){
			cur_sw_fm_band = MW_MODE;
		}
		else
#endif		
		{
			cur_sw_fm_band = FM_MODE;
		}
		Disp_Con(DISP_TUNER);			
    }
    else if (work_mode  == SYS_MCU_CD){

    		Disp_Con(DISP_SCAN_TOC);
    }	
    else if (work_mode  == SYS_AUX){
    		Disp_Con(DISP_AUX);
    }	
#if defined(USE_BLUE_TOOTH_FUNC)			
	
    else if (work_mode  == SYS_BLUE_TOOTH){
    		Disp_Con(DISP_BT);
    }	
#endif
	CD_PWR_GPIO_CTRL_INIT();
    	CD_PWR_GPIO_OFF();

	//TUNER_PWR_GPIO_CTRL_INIT();		
    	//TUNER_PWR_GPIO_OFF();

	AUX_GPIO_CTRL_INIT();
	AUX_PWR_GPIO_OFF();		

	BT_GPIO_CTRL_INIT();
	BT_PWR_GPIO_OFF();	
}
Exemplo n.º 12
0
void main()
{

	int channel;
	My_Socket_Type socket;
	My_InOuts_Type InOuts;
	char DispStrIn[100];
	long IOoutcnt,InCnt;
	// initializing
	InOuts.rtime	= REFRESH_RATE;
	brdInit();
	digOutConfig(0);
	glInit();
	glBlankScreen();
	glSetContrast(24);
	glBackLight(1);
	glXFontInit ( &fi10x12,10,12,0x20,0x7E,Terminal9 );
	glXFontInit ( &fi14x16,14,16,0x20,0x7E,Terminal12 );
	keyInit();
	IOoutcnt = InCnt = 0;
	xmemBtn = btnInit(20);
	for(channel=0;channel<DIGITAL_OUTPUTS;channel++)	// setting digital outputs to low state
		InOuts.dout[channel] = LOW_HIGH[0];
	memset(socket.buff,0x00,BUFF_SIZE);
	socket.nextstate 	= 0;

	sock_init();
	http_init();
	tcp_reserveport(80);

	while(1)
	{
		costate //TCP_HANDLES
		{
			My_Handler(&socket);
			http_handler();
		}

		costate //IO_Ctrl
		{
			waitfor(socket.nextstate == 2 && DelayMs(InOuts.rtime));
			My_IO_Ctrl(&InOuts);

		}

		costate //TCP_RX
		{	// THIS IS WHERE WE RECEIVE INFORMATION FROM THE XML SOCKET
			waitfor(socket.rxbytes || DelayMs(15000) );
			if (socket.rxbytes)
			{
				sprintf(DispStrIn,"Msg From Host\n%s",socket.buff);
				btnMsgBox(0,120,320,120,&fi14x16,DispStrIn,1,0);
					//printf("%sRcvd: %s\n",RED,socket.buff);
				socket.rxbytes = 0;
				My_XML_Parser(socket.buff,&InOuts);
			}
			else
			{
				btnClearRegion(0,120,320,120);
			}
		}

		costate //TCP_TX
		{	// THIS IS WHERE WE SEND INFORMATION TO THE XML SOCKET
			waitfor(socket.nextstate == 2 && DelayMs(InOuts.rtime));
			My_Load_Buffer(0,&socket,&InOuts);		// FILLING SOCKET BUFFER WITH ANALOG INPUTS DATA
			socket.nextstate = 3;						// SET STATEMACHINE TO THE SEND STATE
//			printf("%sSent: %s\n",RED,socket.buff);
			yield;

			My_Load_Buffer(1,&socket,&InOuts);		// FILLING SOCKET BUFFER WITH DIGITAL INPUTS
			socket.nextstate = 3;						// SET STATEMACHINE TO THE SEND STATE
//			printf("%sSent: %s\n",RED,socket.buff);
			yield;

			My_Load_Buffer(2,&socket,&InOuts);		// FILLING SOCKET BUFFER WITH DIGITAL OUTPUT STATUS
			socket.nextstate = 3;						// SET STATEMACHINE TO THE SEND STATE
//			printf("%sSent: %s",RED,socket.buff);
//			printf("\n\n");


		}
	}
}
Exemplo n.º 13
0
/*
 * Usage: showexports libName type-expression
 * Example: showexports libaldor.al 'List(Integer)'
 */
int
main(int argc, char *argv[])
{
	osInit();
	sxiInit();
	keyInit();
	ssymInit();
	dbInit();
	stabInitGlobal();
	tfInit();
	foamInit();
	optInit();
	tinferInit();
	pathInit();

	sposInit();
	ablogInit();
	comsgInit();

	macexInitFile();
	comsgInit();
	scobindInitFile();
	stabInitFile();

	fileAddLibraryDirectory(".");

	String archive = argv[1];
	String expression = argv[2];

	scmdHandleLibrary("LIB", archive);

	AbSyn ab = shexpParse(expression);
	Stab stab = stabFile();
	Syme syme = stabGetArchive(symInternConst("LIB"));
	AbSyn arAbSyn = abNewId(sposNone, symInternConst("LIB"));
	AbSyn boolean = abNewId(sposNone, symInternConst("Boolean"));

	stabImportTForm(stab, tiGetTForm(stab, arAbSyn));
	stabImportTForm(stab, tiGetTForm(stab, boolean));
	abPutUse(ab, AB_Use_Value);
	scopeBind(stab, ab);
	typeInfer(stab, ab);
	TForm tf = tiGetTForm(stab, ab);
	aprintf("Type: %s Cat: %d\n", tfPretty(tf), tfSatCat(tf));
	if (tfSatDom(tf)) {
		SymeList list = tfGetCatExports(tf);
		aprintf("Category\n");
		for (; list != listNil(Syme); list = cdr(list)) {
			Syme syme = car(list);
			aprintf("%5s %3d %s %pAbSynList\n", symeString(syme), symeHasDefault(syme),
				tfPretty(symeType(syme)), symeCondition(syme));
		}
	}
	else {
		aprintf(">>> Exports\n");
		SymeList list = tfStabGetDomImports(stab, tf);

		for (; list != listNil(Syme); list = cdr(list)) {
			Syme syme = car(list);
			aprintf("%s %d %d %s\n", symeString(syme),
				symeDefnNum(syme), symeConstNum(syme), tfPretty(symeType(syme)));
		}

		TQualList tqList;
		aprintf(">>> Cascades\n");
		tqList = tfGetDomCascades(tf);

		for (; tqList != listNil(TQual); tqList = cdr(tqList)) {
			TQual tq = car(tqList);
			aprintf("--> %s\n", tfPretty(tqBase(tq)));
		}
	}

	scobindFiniFile();
	stabFiniFile();
	comsgFini();
	macexFiniFile();

}
Exemplo n.º 14
0
main ()
{
	static int enable,stopUpdate,updatecomplete;
	auto int loop,keyPress;
	static byte init,input;
	static CoData BarGraph;
	
		//Set all the Channels Structures to a default state
		// Enabled, 0 to 10Vdc range.
	for (loop = 0 ; loop < 8 ; loop++)
	{
		AnaSetting[loop].In = loop;
		AnaSetting[loop].GainMode = 1;
		AnaSetting[loop].Enable = 1;
	}
	
	updatecomplete = 0;
	stopUpdate = 1;
	brdInit();			// Initialize the Controller
	glInit();			// Initialize the LCD
	keyInit();			// Initialize the Keypad
	keypadDef();		// Setup the Keypad Default Values
	LastContrast = 24;  // Setup the Inital Contrast Setting
	// Turn on the Backlight
	glBackLight(1);
	// Set the Contrast
	glSetContrast(LastContrast);
	// Setup the Fonts used in this sample
	glXFontInit(&fi6x8,   6,  8,  32, 255, Font6x8);
	glXFontInit(&fi8x10,  8,  10, 32, 127, Font8x10);
	glXFontInit(&fi10x16, 10, 16, 32, 127, Font10x16);
	glXFontInit(&fi17x35, 17,35,0x20,0xFF, Font17x35);
	// Setup the Menus 
	glMenuInit( &MenuStart, &fi10x16, DOUBLE_LINE, SHADOW,startMenu,
	 				" START MENU ", -1 );
	glMenuInit( &MenuSysSetup, &fi10x16, DOUBLE_LINE, SHADOW,systemSetup,
					" SYSTEM SETUP ", -1 );
	glMenuInit( &MenuAnaSetup, &fi10x16, DOUBLE_LINE, SHADOW,analogSetup,
					" ANALOG SETUP ", 5 );
	glMenuInit( &MenuAdjContrast, &fi10x16, DOUBLE_LINE, SHADOW,adjContrast,
					" CONSTRAST ADJUST ", -1 );
	glMenuInit( &MenuRangeSel, &fi10x16, DOUBLE_LINE, SHADOW,rangeSelect,
					" RANGE SELECT ", 5 );
	glMenuInit( &MenuAnaSet2, &fi10x16, DOUBLE_LINE, SHADOW,analogSet2,
					" ANALOG SETUP2 ", -1 );
	input = 0;
	init = 1;
	for (;;)
	{
			// Check for any keypresses
		keyProcess();

		// This costate displays the Initial screen, and Starts the
		// Bargraphing demo
		costate
		{
			waitfor (init);
			waitfor ( bgMainScreen () );
			init = 0;
			input = 0;
			waitfor ( bgBarSet(&fi8x10) );
			stopUpdate = 0;
			CoBegin( &BarGraph );
		}

		// This costate checks for the 'S' key to be pressed
		//	(key just below the label 'CONFIG DEMO')
																				
		costate
		{
			waitfor ( ( keyPress = keyGet() )== 'S' );
			stopUpdate = 1;
			waitfor (updatecomplete);
			CoReset( &BarGraph );
			waitfor ( bgMenuStart() );
			init = 1;
		}
		
		// This costate displays the Bargraphs
		costate BarGraph  
		{
			waitfor(!stopUpdate);
			waitfor(IntervalMs(350));
			updatecomplete = 0;
			glBuffLock();
			input = 0;
			while (input <= 7)
			{
				if ( AnaSetting[input].Enable )
				{
					waitfor ( bgBarGraph ( &AnaSetting[ input ],
								 &fi8x10 ) );
				}
				input++;
				waitfor (DelayMs(1));
			}
			glBuffUnlock();
			updatecomplete = 1;	
			CoBegin( &BarGraph );
		}
	}
}