Пример #1
0
/*
 *  ======== SERVICES_Init ========
 *  Purpose:
 *      Initializes SERVICES modules.
 */
bool SERVICES_Init(void)
{
	bool fInit = true;
	bool fCFG, fDBG, fMEM;
	bool fREG, fSYNC, fCLK, fNTFY;

	GT_init();
	GT_create(&SERVICES_debugMask, "OS");	/* OS for OSal */

	/* Perform required initialization of SERVICES modules. */
	fMEM = MEM_Init();
	fSYNC = SYNC_Init();
	fREG = REG_Init();
	fCFG = CFG_Init();
	fDBG = DBG_Init();
	fCLK  = CLK_Init();
	fNTFY = NTFY_Init();

	fInit = fCFG && fDBG && fMEM && fREG && fSYNC && fCLK;

	if (!fInit) {
		if (fNTFY)
			NTFY_Exit();

		if (fSYNC)
			SYNC_Exit();

		if (fCLK)
			CLK_Exit();

		if (fREG)
			REG_Exit();

		if (fDBG)
			DBG_Exit();

		if (fCFG)
			CFG_Exit();

		if (fMEM)
			MEM_Exit();

	}

	return fInit;
}
Пример #2
0
int main()
{
u32 R;
uint16_t a, b;
  Set_System();
  TMet_Init();
  DBG_Init();
  rs485_init();
  while(1)
  {
    TMet_Delay(100);
    for (a = 0; a < 3; a++)
      for (b = 0; b < 3; b++)
      {
        If_PrintCylCell(a + b * 3, cl[a + b * 3]);
      }
    If_PrintOilTemp(ot);
    If_PrintOilPressure(op);
    If_PrintMetal(mt);
  };
}
Пример #3
0
int main(void)
{
    Init_Sys();
    ROM_IntMasterEnable();
    DBG_Init();
    
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
    
    // LEDs
    ROM_GPIOPinTypeGPIOOutput(RED_GPIO_BASE, RED_GPIO_PIN);
    GPIOPinWrite(RED_GPIO_BASE, RED_GPIO_PIN, 0);
    ROM_GPIOPinTypeGPIOOutput(GREEN_GPIO_BASE, GREEN_GPIO_PIN);
    GPIOPinWrite(GREEN_GPIO_BASE, GREEN_GPIO_PIN, 0);
    ROM_GPIOPinTypeGPIOOutput(BLUE_GPIO_BASE, BLUE_GPIO_PIN);
    GPIOPinWrite(BLUE_GPIO_BASE, BLUE_GPIO_PIN, 0);
    
    
//     dbg_putstr("\033[2JInitializing...\r\n");
    dbg_putstr("\033[2JInitializing C app...\r\n");
    dbg_putstr("Ready:\r\n");
    
    static uint16_t heartbeat_ctr = 0;
    while(1)
    {
        char cmdbfr[64];
        if(dbg_getline_nb(cmdbfr, 64) > 0)
        {
            GPIOPinWrite(RED_GPIO_BASE, RED_GPIO_PIN, RED_GPIO_PIN);
            dbg_printf("\r\nEntered: %s\r\n", cmdbfr);
        }
        
        if(rx_led_ctr > 0)
        {
            --rx_led_ctr;
            GPIOPinWrite(BLUE_GPIO_BASE, BLUE_GPIO_PIN, BLUE_GPIO_PIN);
        }
        else
        {
            GPIOPinWrite(BLUE_GPIO_BASE, BLUE_GPIO_PIN, 0);
        }
        
        // Blink heartbeat LED
        if(heartbeat_ctr > 0)
        {
            --heartbeat_ctr;
        }
        else
        {
            if(GPIOPinRead(GREEN_GPIO_BASE, GREEN_GPIO_PIN))
            {
                GPIOPinWrite(GREEN_GPIO_BASE, GREEN_GPIO_PIN, 0);
                heartbeat_ctr = 200;
            }
            else
            {
                GPIOPinWrite(GREEN_GPIO_BASE, GREEN_GPIO_PIN, GREEN_GPIO_PIN);
                heartbeat_ctr = 1;
            }
        }
        
        ROM_SysCtlDelay(ROM_SysCtlClockGet()/(1000*3));
    }
}
Пример #4
0
/*
 *  ======== SERVICES_Init ========
 *  Purpose:
 *      Initializes SERVICES modules.
 */
bool SERVICES_Init(void)
{
	bool fInit = true;
	bool fCFG, fCSL, fDBG, fDPC, fKFILE, fLST, fMEM;
	bool fREG, fSYNC, fCLK, fNTFY;

	DBC_Require(cRefs >= 0);

	if (cRefs == 0) {

		GT_init();
		GT_create(&SERVICES_debugMask, "OS");	/* OS for OSal */

		GT_0trace(SERVICES_debugMask, GT_ENTER,
			 "SERVICES_Init: entered\n");

		/* Perform required initialization of SERVICES modules. */
		fMEM = MEM_Init();
		fREG = REG_Init();
		fCFG = CFG_Init();
		fCSL = CSL_Init();
		fDBG = DBG_Init();
		fDPC = DPC_Init();
		fKFILE = KFILE_Init();
		fLST = LST_Init();
		fSYNC = SYNC_Init();
		fCLK  = CLK_Init();
		fNTFY = NTFY_Init();

		fInit = fCFG && fCSL && fDBG && fDPC && fKFILE &&
			fLST && fMEM && fREG && fSYNC && fCLK;

		if (!fInit) {
			if (fNTFY)
				NTFY_Exit();

			if (fSYNC)
				SYNC_Exit();

			if (fCLK)
				CLK_Exit();

			if (fREG)
				REG_Exit();

			if (fLST)
				LST_Exit();

			if (fKFILE)
				KFILE_Exit();

			if (fDPC)
				DPC_Exit();

			if (fDBG)
				DBG_Exit();

			if (fCSL)
				CSL_Exit();

			if (fCFG)
				CFG_Exit();

			if (fMEM)
				MEM_Exit();

		}
	}

	if (fInit)
		cRefs++;

	GT_1trace(SERVICES_debugMask, GT_5CLASS, "SERVICES_Init: cRefs 0x%x\n",
		 cRefs);

	DBC_Ensure((fInit && (cRefs > 0)) || (!fInit && (cRefs >= 0)));

	return fInit;
}