当前位置: 首页>>代码示例>>C++>>正文


C++ OPLK_MEMSET函数代码示例

本文整理汇总了C++中OPLK_MEMSET函数的典型用法代码示例。如果您正苦于以下问题:C++ OPLK_MEMSET函数的具体用法?C++ OPLK_MEMSET怎么用?C++ OPLK_MEMSET使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了OPLK_MEMSET函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: timesynck_init

//------------------------------------------------------------------------------
tOplkError timesynck_init(void)
{
    tOplkError  ret;

    OPLK_MEMSET(&timesynckInstance_l, 0, sizeof(timesynckInstance_l));

    timesynckInstance_l.syncEventCycle = 1; // Default every cycle

    ret = timesynckcal_init();
    if (ret != kErrorOk)
        return ret;

#if defined(CONFIG_INCLUDE_SOC_TIME_FORWARD)
    timesynckInstance_l.pSharedMemory = timesynckcal_getSharedMemory();
    if (timesynckInstance_l.pSharedMemory == NULL)
        return kErrorNoResource;

    // Initialize shared memory
    OPLK_MEMSET(timesynckInstance_l.pSharedMemory, 0, sizeof(*timesynckInstance_l.pSharedMemory));

    // Initialize triple buffer
    timesynckInstance_l.pSharedMemory->kernelToUserSocTime.clean = 0;
    timesynckInstance_l.pSharedMemory->kernelToUserSocTime.read = 1;
    timesynckInstance_l.pSharedMemory->kernelToUserSocTime.write = 2;

    OPLK_DCACHE_FLUSH(timesynckInstance_l.pSharedMemory, sizeof(*timesynckInstance_l.pSharedMemory));
#endif

    return ret;
}
开发者ID:OpenAutomationTechnologies,项目名称:openPOWERLINK_V2,代码行数:31,代码来源:timesynck.c

示例2: ctrlucal_init

//------------------------------------------------------------------------------
tOplkError ctrlucal_init(void)
{
    tHostifReturn   hifRet;
    tHostifConfig   hifConfig;

    OPLK_MEMSET(&instance_l, 0, sizeof(instance_l));
    OPLK_MEMSET(&hifConfig, 0, sizeof(hifConfig));

    hifConfig.instanceNum = 0;
    hifConfig.pBase = (UINT8*)HOSTIF_BASE; //FIXME: Get it from somewhere else?
    hifConfig.version.revision = HOSTIF_VERSION_REVISION;
    hifConfig.version.minor = HOSTIF_VERSION_MINOR;
    hifConfig.version.major = HOSTIF_VERSION_MAJOR;

    hifRet = hostif_create(&hifConfig, &instance_l.hifInstance);
    if (hifRet != kHostifSuccessful)
    {
        DEBUG_LVL_ERROR_TRACE("Could not initialize host interface (0x%X)\n", hifRet);
        return kErrorNoResource;
    }

    //disable master IRQ
    instance_l.fIrqMasterEnable = FALSE;
    hifRet = hostif_irqMasterEnable(instance_l.hifInstance, instance_l.fIrqMasterEnable);
    if (hifRet != kHostifSuccessful)
    {
        DEBUG_LVL_ERROR_TRACE("Could not disable master IRQ (0x%X)\n", hifRet);
        return kErrorNoResource;
    }

    return kErrorOk;
}
开发者ID:OpenAutomationTechnologies,项目名称:openPOWERLINK_V2,代码行数:33,代码来源:ctrlucal-hostif.c

示例3: dllkfilter_setupFilters

//------------------------------------------------------------------------------
void dllkfilter_setupFilters(void)
{
    OPLK_MEMSET(dllkInstance_g.aFilter, 0, sizeof(dllkInstance_g.aFilter));
    setupAsndFilter(&dllkInstance_g.aFilter[DLLK_FILTER_ASND]);
    setupSocFilter(&dllkInstance_g.aFilter[DLLK_FILTER_SOC]);
    setupSoaFilter(&dllkInstance_g.aFilter[DLLK_FILTER_SOA]);
    setupSoaIdentReqFilter(&dllkInstance_g.aFilter[DLLK_FILTER_SOA_IDREQ],
                           dllkInstance_g.dllConfigParam.nodeId,
                           &dllkInstance_g.pTxBuffer[DLLK_TXFRAME_IDENTRES]);
    setupSoaStatusReqFilter(&dllkInstance_g.aFilter[DLLK_FILTER_SOA_STATREQ],
                            dllkInstance_g.dllConfigParam.nodeId,
                            &dllkInstance_g.pTxBuffer[DLLK_TXFRAME_STATUSRES]);
    setupSoaNmtReqFilter(&dllkInstance_g.aFilter[DLLK_FILTER_SOA_NMTREQ],
                         dllkInstance_g.dllConfigParam.nodeId,
                         &dllkInstance_g.pTxBuffer[DLLK_TXFRAME_NMTREQ]);
#if (CONFIG_DLL_PRES_CHAINING_CN != FALSE)
    setupSoaSyncReqFilter(&dllkInstance_g.aFilter[DLLK_FILTER_SOA_SYNCREQ],
                          dllkInstance_g.dllConfigParam.nodeId,
                          &dllkInstance_g.pTxBuffer[DLLK_TXFRAME_SYNCRES]);
#endif
    setupSoaUnspecReqFilter(&dllkInstance_g.aFilter[DLLK_FILTER_SOA_NONPLK],
                            dllkInstance_g.dllConfigParam.nodeId,
                            &dllkInstance_g.pTxBuffer[DLLK_TXFRAME_NONPLK]);
#if defined(CONFIG_INCLUDE_VETH)
    setupVethUnicast(&dllkInstance_g.aFilter[DLLK_FILTER_VETH_UNICAST],
                     edrv_getMacAddr(),
                     TRUE);
    setupVethBroadcast(&dllkInstance_g.aFilter[DLLK_FILTER_VETH_BROADCAST], TRUE);
#endif
}
开发者ID:Kalycito-open-automation,项目名称:openPOWERLINK_V2,代码行数:31,代码来源:dllkfilter.c

示例4: memmap_init

//------------------------------------------------------------------------------
tMemMapReturn memmap_init(void)
{
    ULONG       bytesReturned;
    tMemStruc   inMemStruc;
    tMemStruc*  pOutMemStruc = &memMapInstance_l.memStruc;

    OPLK_MEMSET(&inMemStruc, 0, sizeof(inMemStruc));

    memMapInstance_l.hFileHandle = ctrlucal_getFd();

    if (memMapInstance_l.hFileHandle == NULL)
        return kMemMapNoResource;

    if (!DeviceIoControl(memMapInstance_l.hFileHandle,
                         PLK_CMD_MAP_MEM,
                         &inMemStruc,
                         sizeof(tMemStruc),
                         pOutMemStruc,
                         sizeof(tMemStruc),
                         &bytesReturned,
                         NULL))
    {
        return kMemMapNoResource;
    }

    if ((bytesReturned == 0) || (pOutMemStruc->pUserAddr == NULL))
        return kMemMapNoResource;

    return kMemMapOk;
}
开发者ID:OpenAutomationTechnologies,项目名称:openPOWERLINK_V2,代码行数:31,代码来源:memmap-winioctl.c

示例5: getLinkStatus

//------------------------------------------------------------------------------
static BOOL getLinkStatus(const char* pIfName_p)
{
    BOOL            fRunning;
    struct ifreq    ethreq;
    int             fd;

    fd = socket(AF_INET, SOCK_DGRAM, 0);

    OPLK_MEMSET(&ethreq, 0, sizeof(ethreq));

    /* set the name of the interface we wish to check */
    strncpy(ethreq.ifr_name, pIfName_p, IFNAMSIZ);

    /* grab flags associated with this interface */
    ioctl(fd, SIOCGIFFLAGS, &ethreq);

    if (ethreq.ifr_flags & IFF_RUNNING)
    {
        fRunning = TRUE;
    }
    else
    {
        fRunning = FALSE;
    }

    close(fd);

    return fRunning;
}
开发者ID:OpenAutomationTechnologies,项目名称:openPOWERLINK_V2,代码行数:30,代码来源:edrv-pcap_linux.c

示例6: ledu_init

//------------------------------------------------------------------------------
tOplkError ledu_init(tLeduStateChangeCallback pfnCbStateChange_p)
{
    OPLK_MEMSET(&leduInstance_g, 0, sizeof(tLeduInstance));
    leduInstance_g.pfnCbStateChange = pfnCbStateChange_p;

    return kErrorOk;
}
开发者ID:Kalycito-open-automation,项目名称:openPOWERLINK_V2_old_25-06-2014,代码行数:8,代码来源:ledu.c

示例7: timesyncu_init

//------------------------------------------------------------------------------
tOplkError timesyncu_init(tSyncCb pfnSyncCb_p)
{
    tOplkError  ret;

    OPLK_MEMSET(&instance_l, 0, sizeof(tTimesyncuInstance));
#if defined(CONFIG_INCLUDE_SOC_TIME_FORWARD)
    instance_l.pSharedMemory = NULL;
#if defined(CONFIG_INCLUDE_NMT_MN)
    instance_l.fFirstSyncEventDone = FALSE;
#endif
#endif
    // Store the pointer function locally for synchronization callback
    instance_l.pfnSyncCb = pfnSyncCb_p;

    ret = timesyncucal_init(syncCb);
    if (ret != kErrorOk)
        return ret;

#if defined(CONFIG_INCLUDE_SOC_TIME_FORWARD)
    instance_l.pSharedMemory = timesyncucal_getSharedMemory();
    if (instance_l.pSharedMemory == NULL)
        return kErrorNoResource;
#endif

    return ret;
}
开发者ID:OpenAutomationTechnologies,项目名称:openPOWERLINK_V2,代码行数:27,代码来源:timesyncu.c

示例8: circbuf_createInstance

//------------------------------------------------------------------------------
tCircBufInstance* circbuf_createInstance(UINT8 id_p, BOOL fNew_p)
{
    tCircBufInstance*           pInstance;
    tCircBufArchInstance*       pArch;
    char                        semName[16];

    if ((pInstance = OPLK_MALLOC(sizeof(tCircBufInstance) +
                                 sizeof(tCircBufArchInstance))) == NULL)
    {
        DEBUG_LVL_ERROR_TRACE("%s() malloc failed!\n", __func__);
        return NULL;
    }
    OPLK_MEMSET(pInstance, 0, sizeof(tCircBufInstance) + sizeof(tCircBufArchInstance));
    pInstance->pCircBufArchInstance = (BYTE*)pInstance + sizeof(tCircBufInstance);
    pInstance->bufferId = id_p;

    pArch = (tCircBufArchInstance*)pInstance->pCircBufArchInstance;

    sprintf(semName, "/semCircbuf-%d", id_p);
     
    if (fNew_p)
    {
	sem_unlink(semName);
    }

    if ((pArch->lockSem = sem_open(semName, O_CREAT, S_IRWXG, 1)) == SEM_FAILED)
    {
        DEBUG_LVL_ERROR_TRACE("%s() open sem failed!\n", __func__);
        OPLK_FREE(pInstance);
        return NULL;
    }

    return pInstance;
}
开发者ID:Openwide-Ingenierie,项目名称:openpowerlink-rtnet,代码行数:35,代码来源:circbuf-posixshm-xeno.c

示例9: edrvcyclic_setMaxTxBufferListSize

//------------------------------------------------------------------------------
tOplkError edrvcyclic_setMaxTxBufferListSize(UINT maxListSize_p)
{
    tOplkError ret = kErrorOk;

    if (edrvcyclicInstance_l.maxTxBufferCount != maxListSize_p)
    {
        edrvcyclicInstance_l.maxTxBufferCount = maxListSize_p;
        if (edrvcyclicInstance_l.ppTxBufferList != NULL)
        {
            OPLK_FREE(edrvcyclicInstance_l.ppTxBufferList);
            edrvcyclicInstance_l.ppTxBufferList = NULL;
        }

        edrvcyclicInstance_l.ppTxBufferList = OPLK_MALLOC(sizeof(*edrvcyclicInstance_l.ppTxBufferList) * maxListSize_p * 2);
        if (edrvcyclicInstance_l.ppTxBufferList == NULL)
        {
            ret = kErrorEdrvNoFreeBufEntry;
        }

        edrvcyclicInstance_l.curTxBufferList = 0;

        OPLK_MEMSET(edrvcyclicInstance_l.ppTxBufferList, 0, sizeof(*edrvcyclicInstance_l.ppTxBufferList) * maxListSize_p * 2);
    }

    return ret;
}
开发者ID:Kalycito-open-automation,项目名称:openPOWERLINK_V2_old_25-06-2014,代码行数:27,代码来源:edrvcyclic.c

示例10: circbuf_createInstance

//------------------------------------------------------------------------------
tCircBufInstance* circbuf_createInstance(UINT8 id_p, BOOL fNew_p)
{
    tCircBufInstance*           pInstance;
    tCircBufArchInstance*       pArch;
    TCHAR                       mutexName[MAX_PATH];

    UNUSED_PARAMETER(fNew_p);

    if ((pInstance = OPLK_MALLOC(sizeof(tCircBufInstance) +
                                 sizeof(tCircBufArchInstance))) == NULL)
    {
        DEBUG_LVL_ERROR_TRACE("%s() malloc failed!\n", __func__);
        return NULL;
    }
    OPLK_MEMSET(pInstance, 0, sizeof(tCircBufInstance) + sizeof(tCircBufArchInstance));
    pInstance->pCircBufArchInstance = (BYTE*)pInstance + sizeof(tCircBufInstance);
    pInstance->bufferId = id_p;

    pArch = (tCircBufArchInstance*)pInstance->pCircBufArchInstance;

    sprintf(mutexName, "Local\\circbufMutex%d", id_p);
    if ((pArch->lockMutex = CreateMutex(NULL, FALSE, mutexName)) == NULL)
    {
        DEBUG_LVL_ERROR_TRACE("%s() creating mutex failed!\n", __func__);
        OPLK_FREE(pInstance);
        return NULL;
    }

    return pInstance;
}
开发者ID:Openwide-Ingenierie,项目名称:openpowerlink-rtnet,代码行数:31,代码来源:circbuf-win32.c

示例11: eventucal_init

//------------------------------------------------------------------------------
tOplkError eventucal_init(void)
{
    tOplkError          ret = kErrorOk;
    struct sched_param  schedParam;

    OPLK_MEMSET(&instance_l, 0, sizeof(tEventuCalInstance));

    instance_l.fd = ctrlucal_getFd();
    instance_l.fStopKernelThread = FALSE;
    instance_l.fStopProcessThread = FALSE;

    sem_unlink("/semUserEvent");    // Deinitialize any existing instance of the semaphore

    if ((instance_l.semUserData = sem_open("/semUserEvent", O_CREAT | O_RDWR, S_IRWXG, 0)) == SEM_FAILED)
        goto Exit;

    if (eventucal_initQueueCircbuf(kEventQueueUInt) != kErrorOk)
        goto Exit;

    if (eventucal_setSignalingCircbuf(kEventQueueUInt, signalUIntEvent) != kErrorOk)
        goto Exit;

    // Create thread for fetching new user data from kernel
    if (pthread_create(&instance_l.kernelEventThreadId, NULL, k2uEventFetchThread, NULL) != 0)
        goto Exit;

    schedParam.sched_priority = KERNEL_EVENT_FETCH_THREAD_PRIORITY;
    if (pthread_setschedparam(instance_l.kernelEventThreadId, SCHED_FIFO, &schedParam) != 0)
    {
        DEBUG_LVL_ERROR_TRACE("%s(): couldn't set K2U thread scheduling parameters! %d\n",
                              __func__,
                              schedParam.sched_priority);
    }

#if (defined(__GLIBC__) && (__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 12))
    pthread_setname_np(instance_l.kernelEventThreadId, "oplk-eventufetch");
#endif

    // Create thread for processing pending user data
    if (pthread_create(&instance_l.processEventThreadId, NULL, eventProcessThread, NULL) != 0)
        goto Exit;

    schedParam.sched_priority = EVENT_PROCESS_THREAD_PRIORITY;
    if (pthread_setschedparam(instance_l.processEventThreadId, SCHED_FIFO, &schedParam) != 0)
    {
        DEBUG_LVL_ERROR_TRACE("%s(): couldn't set event process thread scheduling parameters! %d\n",
                              __func__,
                              schedParam.sched_priority);
    }

#if (defined(__GLIBC__) && (__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 12))
    pthread_setname_np(instance_l.processEventThreadId, "oplk-eventuprocess");
#endif
    instance_l.fInitialized = TRUE;
    return kErrorOk;

Exit:
    eventucal_exit();
    return ret;
}
开发者ID:chutao,项目名称:openPOWERLINK_V2,代码行数:61,代码来源:eventucal-linuxpcie.c

示例12: getMacAdrs

//------------------------------------------------------------------------------
static void getMacAdrs(UINT8* pMac_p)
{
    struct ifreq    ifr;
    int             sock;

    sock = socket(AF_INET, SOCK_DGRAM, 0);
    if (sock < 0)
    {
        DEBUG_LVL_VETH_TRACE("%s: Cannot open udp socket for MAC reading: %s\n",
                             __func__,
                             strerror(errno));
        return;
    }

    OPLK_MEMSET(&ifr, 0, sizeof(struct ifreq));
    strncpy(ifr.ifr_name, "plk", IFNAMSIZ);

    if (ioctl(sock, SIOCGIFHWADDR, &ifr) < 0)
    {
        DEBUG_LVL_VETH_TRACE("Cannot get MAC address: '%s' (%d)\n", strerror(errno), errno);
    }

    DEBUG_LVL_VETH_TRACE("Get Mac addr %02x:%02x:%02x:%02x:%02x:%02x\n",
                         ifr.ifr_hwaddr.sa_data[0],
                         ifr.ifr_hwaddr.sa_data[1],
                         ifr.ifr_hwaddr.sa_data[2],
                         ifr.ifr_hwaddr.sa_data[3],
                         ifr.ifr_hwaddr.sa_data[4],
                         ifr.ifr_hwaddr.sa_data[5]);

    close(sock);

    OPLK_MEMCPY(pMac_p, &ifr.ifr_hwaddr.sa_data[0], ETH_ALEN);
}
开发者ID:OpenAutomationTechnologies,项目名称:openPOWERLINK_V2,代码行数:35,代码来源:veth-linuxuser.c

示例13: ctrlk_exit

//------------------------------------------------------------------------------
void ctrlk_exit(void)
{
    ctrlkcal_exit();

    // Reset the instance
    OPLK_MEMSET(&instance_l, 0, sizeof(instance_l));
}
开发者ID:Kalycito-open-automation,项目名称:openPOWERLINK_V2,代码行数:8,代码来源:ctrlk.c

示例14: eventu_postError

//------------------------------------------------------------------------------
tOplkError eventu_postError(tEventSource eventSource_p,
                            tOplkError error_p,
                            UINT argSize_p,
                            const void* pArg_p)
{
    tOplkError  ret;
    tEventError eventError;
    tEvent      event;

    // Check parameter validity
    ASSERT((argSize_p == 0) ||
           (pArg_p != NULL));

    // create argument
    eventError.eventSource = eventSource_p;
    eventError.oplkError = error_p;
    argSize_p = (UINT)min((size_t)argSize_p, sizeof(eventError.errorArg));
    OPLK_MEMCPY(&eventError.errorArg, pArg_p, argSize_p);

    // create event
    event.eventType = kEventTypeError;
    event.eventSink = kEventSinkApi;
    OPLK_MEMSET(&event.netTime, 0x00, sizeof(event.netTime));
    event.eventArgSize = offsetof(tEventError, errorArg) + argSize_p;
    event.eventArg.pEventArg = &eventError;

    ret = eventu_postEvent(&event);

    return ret;
}
开发者ID:Kalycito-open-automation,项目名称:openPOWERLINK_V2,代码行数:31,代码来源:eventu.c

示例15: cfmu_init

//------------------------------------------------------------------------------
tOplkError cfmu_init(tCfmCbEventCnProgress pfnCbEventCnProgress_p,
                     tCfmCbEventCnResult pfnCbEventCnResult_p)
{
    tOplkError      ret = kErrorOk;
    UINT            subindex;
    tVarParam       varParam;

    OPLK_MEMSET(&cfmInstance_g, 0, sizeof(tCfmInstance));

    cfmInstance_g.pfnCbEventCnProgress = pfnCbEventCnProgress_p;
    cfmInstance_g.pfnCbEventCnResult = pfnCbEventCnResult_p;

    // link domain with 4 zero-bytes to object 0x1F22 CFM_ConciseDcfList_ADOM
    varParam.pData = &cfmInstance_g.leDomainSizeNull;
    varParam.size = (tObdSize)sizeof(cfmInstance_g.leDomainSizeNull);
    varParam.index = 0x1F22;    // CFM_ConciseDcfList_ADOM
    for (subindex = 1; subindex <= NMT_MAX_NODE_ID; subindex++)
    {
        varParam.subindex = subindex;
        varParam.validFlag = kVarValidAll;
        ret = obd_defineVar(&varParam);
        if ((ret != kErrorOk) &&
            (ret != kErrorObdIndexNotExist) &&
            (ret != kErrorObdSubindexNotExist))
        {
            return ret;
        }
    }
    return kErrorOk;
}
开发者ID:Questio,项目名称:openPOWERLINK_V2,代码行数:31,代码来源:cfmu.c


注:本文中的OPLK_MEMSET函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。