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

📄 syswindml.c

📁 VxWorks的bootloader实现
💻 C
📖 第 1 页 / 共 2 页
字号:
                if (pciConfigInWord (busno, devno, funcno, PCI_CFG_VENDOR_ID, &data) != OK)                    return(pDev);                vendorID = data;                if (pciConfigInWord (busno, devno, funcno, PCI_CFG_DEVICE_ID, &data)  != OK)                    return(pDev);                deviceID = data;            } else                {                if (pciFindDevice (vendorID, deviceID, instance,                                    &busno, &devno, &funcno) != OK)                    return(pDev);            }            pDev = (WINDML_DEVICE *)KHEAP_ALLOC(sizeof(WINDML_DEVICE));            bzero ((char *)pDev,sizeof(WINDML_DEVICE));            if (pDev == NULL)                return(pDev);            pDev->vendorID = vendorID;            pDev->deviceID = deviceID;            pDev->instance = instance;            pciConfigInLong (busno, devno, funcno, PCI_CFG_BASE_ADDRESS_0, &bar);            pDev->pPhysBaseAdrs0 = (void *) bar;            pciConfigInLong (busno, devno, funcno, PCI_CFG_BASE_ADDRESS_1, &bar);            pDev->pPhysBaseAdrs1 = (void *) bar;            pciConfigInLong (busno, devno, funcno, PCI_CFG_BASE_ADDRESS_2, &bar);            pDev->pPhysBaseAdrs2 = (void *) bar;            pciConfigInLong (busno, devno, funcno, PCI_CFG_BASE_ADDRESS_3, &bar);            pDev->pPhysBaseAdrs3 = (void *) bar;            pciConfigInLong (busno, devno, funcno, PCI_CFG_BASE_ADDRESS_4, &bar);            pDev->pPhysBaseAdrs4 = (void *) bar;            pciConfigInLong (busno, devno, funcno, PCI_CFG_BASE_ADDRESS_5, &bar);            pDev->pPhysBaseAdrs5 = (void *) bar;            pDev->devType = devType;            pDev->busType = BUS_TYPE_PCI;            pciConfigInByte (busno, devno, funcno, PCI_CFG_DEV_INT_PIN, &intLine);            if (intLine == 0)                {                free(pDev);                pDev = NULL;                return(pDev);                }            pDev->intLevel = intLine;            pDev->intVector = (void *)(INT_VEC_GET(intLine));            break;            }#endif /* INCLUDE_PCI */        default:                break;        }    return(pDev);}/********************************************************************************* sysWindMLDevCtrl - special control of the device mode** This routine provides special control features for the device.  This* function is essentially a catch all to provide control of the device* where the functionality is provided within a PCI configuration header or* by board specific registers which may be shared by other functions implemented* on the target board.** The <function> argument defines the type of function that is to be* performed and the <pArg> parameter provides the details relating to the* function. ** The values for <function> and the interpretation of the <pArg> parameters* are:**\is*\i WINDML_ACCESS_MODE_SET*       Sets the device's access mode as to whether it is to respond to I/O*       cycles of memory mapped cycles or both.  The accessibility is*       provided by the <pArg> parameter which is bit mapped containing the*       flags WINDML_MEM_ENABLE (enable memory mapped access) and*       WINDML_IO_ENABLE (enable I/O access).*\i WINDML_LCD_MODE_SET*       Sets the control mode for an LCD that is controllable by an on board*       register rather than a graphics device register. The mode information*       is passed through <pArg>. The flags available are WINDML_LCD_ON*       WINDML_LCD_OFF, WINDML_BACKLIGHT_ON, WINDML_BACKLIGHT_OFF.*\i WINDML_BUSWIDTH_SET*       Some boards allow the LCD bus width to be changed dynamically via*       an FPGA or other configurable logic. This can be done in a board*       specific manner. The actual bus width will be passed through <pArg>.*\i WINDML_PCI_MEMBASE_GET*       Obtain the base address of CPU memory as seen by PCI devices.  *\ie** RETURNS: OK when control operation was success; otherwise ERROR*/STATUS sysWindMLDevCtrl     (    WINDML_DEVICE * pDev,        /* Device to control */    int             function,    /* Type of operation to perform */    int *           pArg         /* Control mode */    )    {    STATUS status = ERROR;    if (pDev == NULL)        {        return (status);        }    switch (function)        {        /* Conrol the PCI access mode, the command byte */#ifdef INCLUDE_PCI        case WINDML_ACCESS_MODE_SET:            {            int busno, devno, funcno;            if (pciFindDevice (pDev->vendorID,                                pDev->deviceID,                                pDev->instance,                                &busno, &devno, &funcno) != OK)                return (ERROR);            status = pciConfigOutWord (busno, devno, funcno,                                       PCI_CFG_COMMAND, *pArg);            break;            }        /* Obtain the CPU memory base address as seen by PCI device */        case WINDML_PCI_MEMBASE_GET:            /* PCI memory base is same as CPU, so set to 0 */            *pArg = 0;            break;#endif /* INCLUDE_PCI */                default:            break;        }    return (status);    }/********************************************************************************* sysWindMLDevRelease - release a device configuration** This routine will release any resources that were allocated when a  * device was configured using the <sysWindMLDevGet()> function.  This * function will free the memory that was allocated for the WINDML_DEVICE * data structure if it was dynamically allocated.  If the data structure* was not dynamically allocated, this function will usually be simply a* stub.** RETURNS: OK when operation was success; otherwise ERROR*/STATUS sysWindMLDevRelease     (    WINDML_DEVICE * pDev         /* Device to release */    )    {    if (pDev != NULL)        {        KHEAP_FREE ((char *) pDev);        }    return (OK);    }/********************************************************************************* sysWindMLIntConnect - Connect the device interrupt.** This routine connects a routine to the interrupt.** RETURNS: OK or ERROR*/STATUS sysWindMLIntConnect    (    WINDML_DEVICE * pDev,        /* Graphics device to control */    VOIDFUNCPTR     routine,     /* routine to be called */    int             parameter    /* parameter to be passed */    )    {    STATUS status = ERROR;    if (pDev != NULL && pDev->intVector != NULL && routine != NULL)        {        if (pDev->busType == BUS_TYPE_PCI)            {#ifdef INCLUDE_PCI            status = pciIntConnect (pDev->intVector, routine, parameter);#endif /* INCLUDE_PCI */            }        else            status = intConnect (pDev->intVector, routine, parameter);        }    return (status);    }/********************************************************************************* sysWindMLIntEnable - Enable interrupts.** This routine enables the interrupt.** RETURNS: OK or ERROR*/STATUS sysWindMLIntEnable    (    WINDML_DEVICE * pDev         /* Device to control */    )    {    STATUS status = ERROR;    if (pDev != NULL && pDev->intLevel != 0)        {        status = sysIntEnablePIC (pDev->intLevel);        }    return (status);    }/********************************************************************************* sysWindMLIntDisable - Disable interrupts.** This routine disables the interrupt.** RETURNS: OK or ERROR*/STATUS sysWindMLIntDisable    (    WINDML_DEVICE * pDev         /* Device to control */    )    {    STATUS status = ERROR;    if (pDev != NULL && pDev->intLevel != 0)        {#ifdef SANDPOINT_BSP        status = sysIntDisable(pDev->intLevel);#else        status = sysIntDisablePIC (pDev->intLevel);#endif /* SANDPOINT_BSP */        }    return (status);    }/********************************************************************************* sysWindMLHwInit - Perform any necessary hardware initialization in sysHwInit()** RETURNS: OK or ERROR*/STATUS sysWindMLHwInit    (    void    )    {    return(OK);    }

⌨️ 快捷键说明

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