コード例 #1
0
//------------------------------------------------------------------------------
int main(void)
{
    tOplkError  ret = kErrorOk;
    const UINT8 aMacAddr[] = {MAC_ADDR};
    UINT8       nodeid;

    // Initialize helper modules
    gpio_init();
    lcd_init();

    // get node ID from input
    nodeid = gpio_getNodeid();

    // initialize instance
    memset(&instance_l, 0, sizeof(instance_l));

    instance_l.cycleLen     = CYCLE_LEN;
    instance_l.nodeId       = (nodeid != 0) ? nodeid : NODEID;
    instance_l.fShutdown    = FALSE;
    instance_l.fGsOff       = FALSE;

    // set mac address (last byte is set to node ID)
    memcpy(instance_l.aMacAddr, aMacAddr, sizeof(aMacAddr));
    instance_l.aMacAddr[5]  = instance_l.nodeId;

    initEvents(&eventCbPowerlink);
    arp_init((UINT8)instance_l.nodeId);

    PRINTF("----------------------------------------------------\n");
    PRINTF("openPOWERLINK embedded CN DEMO application\n");
    PRINTF("using openPOWERLINK Stack: %s\n", PLK_DEFINED_STRING_VERSION);
    PRINTF("----------------------------------------------------\n");

    PRINTF("NODEID=0x%02X\n", instance_l.nodeId);
    lcd_printNodeId(instance_l.nodeId);

    if ((ret = initPowerlink(&instance_l)) != kErrorOk)
        goto Exit;

    if ((ret = initApp()) != kErrorOk)
        goto Exit;

    if ((ret = oplk_setNonPlkForward(TRUE)) != kErrorOk)
        goto Exit;

    loopMain(&instance_l);

Exit:
    arp_exit();
    shutdownPowerlink(&instance_l);
    shutdownApp();

    // Shutdown helper modules
    lcd_exit();
    gpio_exit();

    return 0;
}
コード例 #2
0
ファイル: qtft_fb.c プロジェクト: dujiepeng/module
static int qtft_fb_remove(struct platform_device *dev)
{
	struct fb_info *info = platform_get_drvdata(dev);

	func_in();
	if (info)
	{
		lcd_exit();
		unregister_framebuffer(info);
		fb_dealloc_cmap(&info->cmap);
		framebuffer_release(info);
		rvfree(videomemory, videomemorysize);
	}
	func_out();
	return 0;
}
コード例 #3
0
//------------------------------------------------------------------------------
int main(void)
{
    tOplkError      ret = kErrorOk;
    const UINT8     aMacAddr[] = {MAC_ADDR};
    UINT8           nodeid;
#if (CONFIG_CDC_ON_SD != FALSE)
    tCdcBuffInfo    cdcBuffInfo;
#endif

    // Initialize helper modules
    gpio_init();
    lcd_init();

    // get node ID from input
    nodeid = gpio_getNodeid();

    // initialize instance
    memset(&instance_l, 0, sizeof(instance_l));

    instance_l.cycleLen         = CYCLE_LEN;
    instance_l.nodeId           = (nodeid != 0) ? nodeid : NODEID;
    instance_l.fShutdown        = FALSE;
    instance_l.fGsOff           = FALSE;
#if (CONFIG_CDC_ON_SD != FALSE)
    if (sdcard_getCdcOnSd(pszCdcFilename_g, &cdcBuffInfo) != 0)
    {
        goto Exit;
    }
    instance_l.pCdcBuffer       = (unsigned char*)cdcBuffInfo.pCdcBuffer;
    instance_l.cdcBufferSize    = cdcBuffInfo.cdcSize;
#else
    instance_l.pCdcBuffer       = (unsigned char*)aCdcBuffer;
    instance_l.cdcBufferSize    = sizeof(aCdcBuffer);
#endif
    // set mac address (last byte is set to node ID)
    memcpy(instance_l.aMacAddr, aMacAddr, sizeof(aMacAddr));
    instance_l.aMacAddr[5] = instance_l.nodeId;

    initEvents(&instance_l.fGsOff, &eventCbPowerlink);
    arp_init((UINT8)instance_l.nodeId);

    PRINTF("----------------------------------------------------\n");
    PRINTF("openPOWERLINK console MN DEMO application\n");
    PRINTF("using openPOWERLINK Stack: %s\n", PLK_DEFINED_STRING_VERSION);
    PRINTF("----------------------------------------------------\n");

    PRINTF("NODEID=0x%02X\n", instance_l.nodeId);
    lcd_printNodeId(instance_l.nodeId);

    if ((ret = initPowerlink(&instance_l)) != kErrorOk)
        goto Exit;

    if ((ret = initApp()) != kErrorOk)
        goto Exit;

    if ((ret = oplk_setNonPlkForward(TRUE)) != kErrorOk)
        goto Exit;

    loopMain(&instance_l);

Exit:
#if (CONFIG_CDC_ON_SD != FALSE)
    sdcard_freeCdcBuffer(&cdcBuffInfo);
#endif
    arp_exit();
    shutdownPowerlink(&instance_l);
    shutdownApp();

    // Shutdown helper modules
    lcd_exit();
    gpio_exit();

    return 0;
}