示例#1
0
/**
* Read state of discretes.
*
* @param InstancePtr is a pointer to an XGpio instance to be worked on.
*
* @return Current copy of the discretes register.
*
* @note
*
* None
*
*****************************************************************************/
u32
XGpio_DiscreteRead(XGpio * InstancePtr)
{
	u32 temp;
	XASSERT_NONVOID(InstancePtr != NULL);
	XASSERT_NONVOID(InstancePtr->IsReady == XCOMPONENT_IS_READY);
	temp = XGpio_mReadReg(InstancePtr->BaseAddress, XGPIO_DATA_OFFSET);
	return (XGpio_mReadReg(InstancePtr->BaseAddress, XGPIO_DATA_OFFSET));
}
示例#2
0
文件: xgpio.c 项目: Abagnale/tlm
/**
* Read state of discretes for the specified GPIO channnel.
*
* @param InstancePtr is a pointer to an XGpio instance to be worked on.
* @param Channel contains the channel of the GPIO (1 or 2) to operate on.
*
* @return Current copy of the discretes register.
*
* @note
*
* The hardware must be built for dual channels if this function is used
* with any channel other than 1.  If it is not, this function will assert.
*
*****************************************************************************/
Xuint32 XGpio_DiscreteRead(XGpio *InstancePtr, unsigned Channel)
{
    XASSERT_NONVOID(InstancePtr != XNULL);
    XASSERT_NONVOID(InstancePtr->IsReady == XCOMPONENT_IS_READY);
    XASSERT_NONVOID((Channel == 1)  ||
                    ((Channel == 2) &&
                     (InstancePtr->IsDual == XTRUE)));

    return XGpio_mReadReg(InstancePtr->BaseAddress,
                          ((Channel - 1) * XGPIO_CHAN_OFFSET) +
                          XGPIO_DATA_OFFSET);
}