⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 system.h

📁 CE下 NET2778 NDIS Drivers, 在每个平台上都可以使用
💻 H
字号:
/******************************************************************************

Copyright (C) 2003, 2004, NetChip Technology, Inc. (http://www.netchip.com)

THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, 
EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED 
WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.

SYSTEM.H

NetChip NET2272 PCI-RDK 'System' file

'System' is a collection of system level functions. Most of these functions
are specific to the NetChip RDK implementation, and can be discarded or 
re-implemented for your platform.

NetChip's System file includes:
 - DMA support
 - Interrupt support
 - History support (very useful for debugging!)
 - Memory allocation (with leak detection)
 - Various helper routines

******************************************************************************/

///////////////////////////////////////////////////////////////////////////////
#ifndef SYSTEM_H
#define SYSTEM_H

///////////////////////////////////////////////////////////////////////////////
// Min/Max macros
#ifndef min
#define min(a, b)  (((a) < (b)) ? (a) : (b))
#define max(a, b)  (((a) > (b)) ? (a) : (b))
#endif

///////////////////////////////////////////////////////////////////////////////
// Standard library functions
//  -Porting: Redefine these macros as appropriate for your platform
#define MALLOC(Size) NcMalloc(Size)
#define FREE(pBuf) NcFree(&(pBuf))
#define SLEEP(x) NcSleep(x)

///////////////////////////////////////////////////////////////////////////////
// 
///////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////
// Requests that can be made to the interrupt controller connected to 
// the NetChip IRQ pin:
//  - Enable, disable, current enable status
typedef enum _INTERRUPTCONTROL
{
    NCSYS_INTERRUPT_DISABLE,
    NCSYS_INTERRUPT_ENABLE,
    NCSYS_INTERRUPT_STATUS,
} INTERRUPTCONTROL;

///////////////////////////////////////////////////////////////////////////////
typedef struct _NC_APPLICATION_OBJECT
{   // Application Object
    //  - Porting: Your main() function can use this object to initialize your firmware 
    //    application. When main() starts, it calls your application's One Time Initialization
    //    function. 
    //  - Application objects are created and owned by the application, not the API.
    //  - For NetChip RDK's, application objects allow multiple device applications to
    //    work seemlessly under a single 'umbrella' application, such as NetChip's DevMON.
    //  - DevMON uses application objects to switch between different firmware
    //    applications such as "Loopback", "Transfer", "Mass Storage", etc.
    //  - Tip: Most devices run a single application. It therefore may be convenient to
    //    eliminate this structure and restructure main() to call your application's 
    //    One Time Initialization function directly.
    //  - Tip: After initialization, main() may need to enable the interrupt subsystem.
    //  - Tip: Closing down: When main() ends, it should call the API Clean Up handler.
    //    The clean up handler calls Endpoint Event handlers to close each endpoint,
    //    including Endpoint Zero. These handlers can free client buffers, etc. The
    //    call to close Endpoint Zero indicates the application is closing down.

    // Client application's Device Object (Required)
    PNC_DEVICE_OBJECT DeviceObject;

    // Client application's one-time initialization function (Required):
    NCSTATUS(*OneTimeInit)(PNC_DEVICE_OBJECT DeviceObject);

} NC_APPLICATION_OBJECT, *PNC_APPLICATION_OBJECT;

///////////////////////////////////////////////////////////////////////////////
// Base addresses of other PCI-RDK chips and components
extern PBYTE Plx9054ConfigAddress;
extern PBYTE EpldBaseAddress;

///////////////////////////////////////////////////////////////////////////////
// Public prototypes
///////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////
void *
NcMalloc(
    size_t Size
    );

///////////////////////////////////////////////////////////////////////////////
void
NcFree(
    void **pBuf
    );

///////////////////////////////////////////////////////////////////////////////
void 
NcSleep(
    UINT dwMilliseconds
    );

///////////////////////////////////////////////////////////////////////////////
INTERRUPTCONTROL
System_InterruptController(
    INTERRUPTCONTROL InterruptRequest
    );

///////////////////////////////////////////////////////////////////////////////
BOOL
System_InitializeSystem(
    PVOID pvContext
    );

///////////////////////////////////////////////////////////////////////////////
void
System_ResetNetchip(
    void
    );

///////////////////////////////////////////////////////////////////////////////
#endif // SYSTEM_H

///////////////////////////////////////////////////////////////////////////////
//  End of file
///////////////////////////////////////////////////////////////////////////////

⌨️ 快捷键说明

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