sync.h

来自「S3C24A0的完整BSP包,对开发此芯片的开发者很有用.」· C头文件 代码 · 共 80 行

H
80
字号
//
// Copyright (c) Microsoft Corporation.  All rights reserved.
//
//
// Use of this source code is subject to the terms of the Microsoft end-user
// license agreement (EULA) under which you licensed this SOFTWARE PRODUCT.
// If you did not accept the terms of the EULA, you are not authorized to use
// this source code. For a copy of the EULA, please see the LICENSE.RTF on your
// install media.
//
typedef enum {
    SyncInsertHead,
    SyncInsertTail,
    SyncRemoveHead,
    SyncRemoveTail,
    SyncRemove
} SynchronizeCmd;

typedef struct {
    PLIST_ENTRY Head;
    PLIST_ENTRY Entry;
    SynchronizeCmd Command;
} SynchronizeList;

extern BOOLEAN SynchronizedListFunc(IN PVOID Context);

#define NDISSynchronizedInsertHeadList(head, entry, interrupt)                                      \
{                                                                                                   \
    SynchronizeList ListData;                                                                       \
                                                                                                    \
    ListData.Head = (head);                                                                         \
    ListData.Entry = (entry);                                                                       \
    ListData.Command = SyncInsertHead;                                                              \
    (void)NdisMSynchronizeWithInterrupt((interrupt), SynchronizedListFunc, &ListData);    \
}

#define NDISSynchronizedInsertTailList(head, entry, interrupt)                                       \
{                                                                                                   \
    SynchronizeList ListData;                                                                       \
                                                                                                    \
    ListData.Head = (head);                                                                         \
    ListData.Entry = (entry);                                                                       \
    ListData.Command = SyncInsertTail;                                                              \
    (void)NdisMSynchronizeWithInterrupt((interrupt), SynchronizedListFunc, &ListData);    \
}

#define NDISSynchronizedRemoveEntryList(entry, interrupt)                                           \
{                                                                                                   \
    SynchronizeList ListData;                                                                       \
                                                                                                    \
    ListData.Entry = (entry);                                                                       \
    ListData.Command = SyncRemove;                                                                  \
    (void)NdisMSynchronizeWithInterrupt((interrupt), SynchronizedListFunc, &ListData);    \
}

static PLIST_ENTRY __inline NDISSynchronizedRemoveHeadList(PLIST_ENTRY Head,
                                                           PNDIS_MINIPORT_INTERRUPT Interrupt)
{
    SynchronizeList ListData;                                                                       \

    ListData.Head = Head;
    ListData.Command = SyncRemoveHead;
    (void)NdisMSynchronizeWithInterrupt(Interrupt, SynchronizedListFunc, &ListData);    

    return ListData.Entry;
}

static PLIST_ENTRY __inline NDISSynchronizedRemoveTailList(PLIST_ENTRY Head,
                                                           PNDIS_MINIPORT_INTERRUPT Interrupt)
{
    SynchronizeList ListData;                                                                       \

    ListData.Head = Head;
    ListData.Command = SyncRemoveTail;
    (void)NdisMSynchronizeWithInterrupt(Interrupt, SynchronizedListFunc, &ListData);    

    return ListData.Entry;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?