Example #1
0
//*****************************************************************************
//** Main Function
//*****************************************************************************
void main(void)
{
	OS_STATUS OSStatus;
	
#if defined(GK6105S)
	*(volatile U32*)(0x81c2080) = 0x00000001;
#endif

    SystemInit();
    
    GM_Printf("\033[2J"); /* clear screen */
    GM_Printf("-------------------------------------------------\n");
    GM_Printf(" GK6105S KERNEL/UCOS Test Application\n");
    GM_Printf(" (C) Guoke Microelectronics 2012 - 2014\n");
    
#if defined(MY_UCOS)
    RTOS_Initialize(NULL);
    OSTaskCreate((void (*)(void *))KernelTest, 0, MainTaskStack, MainTaskPriority);
#else
    OSSysInit();
  	OSInit();
  	// OSStatus = OSAddTask((void (*)(void *))IdleTask, IdlePriority, IdleStack, IdleStackSize);
    OSStatus = OSAddTask((void (*)(void *))KernelTest, MainTaskPriority, MainTaskStack, MainTaskStackSize);
#endif
  	OSStart();
}
Example #2
0
int main(
    int argc,
    char *argv[])
{
    BACNET_ADDRESS src = { 0 }; /* address where message came from */
    uint16_t pdu_len = 0;
    unsigned timeout = 100;     /* milliseconds */

    (void) argc;
    (void) argv;
    Device_Set_Object_Instance_Number(126);
    Init_Service_Handlers();
    RTOS_Initialize();
    /* init the physical layer */
#ifdef BACDL_MSTP
    dlmstp_set_my_address(0x05);
#endif
    datalink_init(NULL);
    Send_I_Am(&Handler_Transmit_Buffer[0]);
    /* loop forever */
    for (;;) {
        /* input */

        /* returns 0 bytes on timeout */
        pdu_len = datalink_receive(&src, &Rx_Buf[0], MAX_MPDU, timeout);
        /* process */
        if (pdu_len) {
            npdu_handler(&src, &Rx_Buf[0], pdu_len);
        }
        /* output */



        /* blink LEDs, Turn on or off outputs, etc */
    }
}