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

📄 gppmisc.c

📁 这是单板上DPRAM的驱动程序
💻 C
字号:
#include <psos.h>
#include "board.h"
#include "bspcomm.h"
/*#include "bspspec.h"*/  /*deleted by echo 2004/09/07*/
/*#include "gppmisc.h"*/ /*deleted by echo 2004/09/07*/

static void GppMiscInit(void *pDataBuf, GppMiscCfgStruct *cfg )
{
    GppMiscCfgStruct*   pCfg =(GppMiscCfgStruct *)(pDataBuf);
    memmove(pCfg,cfg,sizeof(*cfg));
}

static int GppMiscCntrl(void *pDataBuf, int cmd, void *pParam, int maxlen)
{
    int i,len;  /*modified by echo 2004/09/06 original:int i,ret,index,len;*/
    GppMiscCfgStruct*  pCfg =(GppMiscCfgStruct *)(pDataBuf);
    switch(cmd)
    {
        case SDC_REINIT:
            GppMiscInit(pDataBuf,pCfg);
            break;

        case SDC_GET_ALARMS:
            i=0; len=maxlen/4;
            if( GET_PB_BIT(16)==1){
                if(i>=len)return SDE_SHORTER_BUF;
                ((ULONG*)pParam)[i++]=SDA_CLK_LOST;
                 SET_PD_BIT(7,0);
                 SET_PD_BIT(7,1);
                }
            return i;
        default: 
            return SDE_UNKNOW_CMD;

    }/* end of switch(cmd) */
    return SDE_OK;
}
/*modified by echo 2004/09/06 original:char *GppMiscBspInit(int DEV, char *FreeMemPtr, GppMiscCfgStruct *cfg)*/
UCHAR *GppMiscBspInit(int DEV, UCHAR *FreeMemPtr, GppMiscCfgStruct *cfg)
{
    InstallSD(DEV,NULL,NULL,GppMiscCntrl,FreeMemPtr);
    GppMiscInit(FreeMemPtr, cfg); 
    FreeMemPtr += sizeof(GppMiscCfgStruct);
    memcpy(FreeMemPtr,"*gppMisc",8);
    FreeMemPtr += 8;
    return FreeMemPtr;
}

⌨️ 快捷键说明

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