Esempio n. 1
0
/**
*
* Initialize a specific XSysAce instance. The configuration information for
* the given device ID is found and the driver instance data is initialized
* appropriately.
*
* @param InstancePtr is a pointer to the XSysAce instance to be worked on.
* @param DeviceId is the unique id of the device controlled by this XSysAce
*        instance.
*
* @return
*
* XST_SUCCESS if successful, or XST_DEVICE_NOT_FOUND if the device was not
* found in the configuration table in xsysace_g.c.
*
* @note
*
* We do not want to reset the configuration controller here since this could
* cause a reconfiguration of the JTAG target chain, depending on how the
* CFGMODEPIN of the device is wired.
*
******************************************************************************/
XStatus XSysAce_Initialize(XSysAce *InstancePtr, u16 DeviceId)
{
    XSysAce_Config *ConfigPtr;

    XASSERT_NONVOID(InstancePtr != NULL);

    InstancePtr->IsReady = 0;

    /*
     * Lookup configuration data in the device configuration table.
     * Use this configuration info down below when initializing this component.
     */
    ConfigPtr = XSysAce_LookupConfig(DeviceId);

    if (ConfigPtr == (XSysAce_Config *)NULL)
    {
        return XST_DEVICE_NOT_FOUND;
    }

    /*
     * Set some default values for the instance data
     */
    InstancePtr->BaseAddress = ConfigPtr->BaseAddress;
    InstancePtr->EventHandler = StubEventHandler;
    InstancePtr->NumRequested = 0;
    InstancePtr->NumRemaining = 0;
    InstancePtr->BufferPtr = NULL;

    /*
     * Put the device into 16-bit mode or 8-bit mode depending on compile-time
     * parameter
     */
#if (XPAR_XSYSACE_MEM_WIDTH == 16)
    XSysAce_RegWrite16(InstancePtr->BaseAddress + XSA_BMR_OFFSET,
                       XSA_BMR_16BIT_MASK);
#else
    XSysAce_RegWrite16(InstancePtr->BaseAddress + XSA_BMR_OFFSET, 0);
#endif

    /*
     * Disable interrupts. Interrupts must be enabled by the user using
     * XSysAce_EnableInterrupt(). Put the interrupt request line in reset and
     * clear the interrupt enable bits.
     */
    XSysAce_mOrControlReg(InstancePtr->BaseAddress, XSA_CR_RESETIRQ_MASK);
    XSysAce_mAndControlReg(InstancePtr->BaseAddress, ~(XSA_CR_DATARDYIRQ_MASK |
                           XSA_CR_ERRORIRQ_MASK | XSA_CR_CFGDONEIRQ_MASK));

    /*
     * Indicate the instance is now ready to use, initialized without error
     */
    InstancePtr->IsReady = XCOMPONENT_IS_READY;

    return XST_SUCCESS;
}
Esempio n. 2
0
/**
*
* Initialize a specific XSysAce instance. The configuration information for
* the given device ID is found and the driver instance data is initialized
* appropriately.
*
* @param InstancePtr is a pointer to the XSysAce instance to be worked on.
* @param DeviceId is the unique id of the device controlled by this XSysAce
*        instance.
*
* @return
*
* XST_SUCCESS if successful, or XST_DEVICE_NOT_FOUND if the device was not
* found in the configuration table in xsysace_g.c.
*
* @note
*
* We do not want to reset the configuration controller here since this could
* cause a reconfiguration of the JTAG target chain, depending on how the
* CFGMODEPIN of the device is wired.
*
******************************************************************************/
XStatus XSysAce_Initialize(XSysAce *InstancePtr, Xuint16 DeviceId)
{
    XSysAce_Config *ConfigPtr;

    XASSERT_NONVOID(InstancePtr != XNULL);

    InstancePtr->IsReady = 0;

    /*
     * Lookup configuration data in the device configuration table.
     * Use this configuration info down below when initializing this component.
     */
    ConfigPtr = XSysAce_LookupConfig(DeviceId);

    if (ConfigPtr == (XSysAce_Config *)XNULL)
    {
        return XST_DEVICE_NOT_FOUND;
    }

    return XSysAce_CfgInitialize(InstancePtr, ConfigPtr, ConfigPtr->BaseAddress);
}