当前位置: 首页>>代码示例>>C++>>正文


C++ xASSERT函数代码示例

本文整理汇总了C++中xASSERT函数的典型用法代码示例。如果您正苦于以下问题:C++ xASSERT函数的具体用法?C++ xASSERT怎么用?C++ xASSERT使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了xASSERT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: PDMACurrentDestAddrGet

//*****************************************************************************
//
//! \brief Get the PDMA Current Destination Address of a channel.
//!
//! \param ulChannelID is the channel ID that have been disabled.
//! \param ulIntFlags is the interrupt type of PDMA.
//! The channel ID can be:
//! - PDMA_CHANNEL_0
//! - PDMA_CHANNEL_1
//! - others refrence \ref NUC1xx_PDMA_Channel_IDs
//! .
//!
//! \return None.
//
//*****************************************************************************
unsigned long 
PDMACurrentDestAddrGet(unsigned long ulChannelID)
{
    //
    // Check the arguments.
    //
    xASSERT(xDMAChannelIDValid(ulChannelID));

    return xHWREG(g_psDMAChannelAddress[ulChannelID] + PDMA_CDAR);
}
开发者ID:qhz,项目名称:cox,代码行数:25,代码来源:xdma.c

示例2: GPIODirModeGet

//*****************************************************************************
//
//! Gets the direction and mode of a pin.
//!
//! \param ulPort is the base address of the GPIO port.
//! \param ulBit is the pin number.
//!
//! This function gets the direction and control mode for a specified pin on
//! the selected GPIO port.  The pin can be configured as either an input or
//! output under software control, or it can be under hardware control.  The
//! type of control and direction are returned as an enumerated data type.
//!
//! \return Returns one of the enumerated data types described for
//! GPIODirModeSet().
//
//*****************************************************************************
unsigned long
GPIODirModeGet(unsigned long ulPort, unsigned long ulBit)
{
    //
    // Check the arguments.
    //
    xASSERT(GPIOBaseValid(ulPort));
    xASSERT(ulBit < 16);

    //
    // Return the pin direction and mode.
    //
    if(ulBit < 8)
    {
        return((xHWREG(ulPort + GPIO_CRL) &
                (0xF << (ulBit * 4))) >> (ulBit * 4));
    }
    else
    {
        return((xHWREG(ulPort + GPIO_CRH) &
开发者ID:Azz1,项目名称:RPI_EPI,代码行数:36,代码来源:xgpio.c

示例3: SPLC780Write

//*****************************************************************************
//
//! \brief Write data or command to the SPLC780D.
//!
//! \param ucRS determines if the IR or DR to select.
//!
//! The parameter of ucRS can be:
//! - \ref SPLC780_RS_COMMAND - select the IR.
//! - \ref SPLC780_RS_DATA - select the DR.
//!
//! \return None.
//
//*****************************************************************************
void 
SPLC780Write(unsigned char ucRS, unsigned char ucInstruction)
{
    //
    // Check Arguments.
    //
    xASSERT((ucRS == SPLC780_RS_COMMAND) || (ucRS == SPLC780_RS_DATA));

    SPLC780Write4Bit((ucInstruction & 0xf0) | ucRS);
    SPLC780Write4Bit(((ucInstruction << 4) & 0xf0) | ucRS);
}
开发者ID:AlexGora,项目名称:cox,代码行数:24,代码来源:splc780d.c

示例4: AT45DB161_Init

//*****************************************************************************
//
//! \brief Initialize AT45DB161 and SPI
//!
//! \param ulSpiClock specifies the SPI Clock Rate
//!
//! This function initialize the mcu SPI as master and specified SPI port.
//! After SPI and port was configured, the mcu send a AT45DB161_CMD_SRRD command
//! to get the page size of AT45DB161 to get prepareed for the followed read and
//! write operations.
//!
//! \return None.
//
//*****************************************************************************
void AT45DB161_Init(unsigned long ulSpiClock)
{
    unsigned char tmp;
    xASSERT((ulSpiClock > 0) && (ulSpiClock < AT45DB161_MAX_CLK));
    xSysCtlPeripheralEnable(xGPIOSPinToPeripheralId(AT45DB161_SCK));
    xSysCtlPeripheralEnable(xGPIOSPinToPeripheralId(AT45DB161_CS_PIN));
    xSysCtlPeripheralEnable(xGPIOSPinToPeripheralId(AT45DB161_MISO));
    xSysCtlPeripheralEnable(xGPIOSPinToPeripheralId(AT45DB161_MOSI));
    xSysCtlPeripheralEnable2(AT45DB161_SPI_PORT);
    xSysCtlPeripheralEnable(SYSCTL_PERIPH_AFIO);
    xGPIOSPinDirModeSet(AT45DB161_CS_PIN, xGPIO_DIR_MODE_OUT);
#if (AT45DB161_WRITE_PROTECT < 1)
    xGPIOSPinDirModeSet(FLASH_PIN_WRITE_PROTECT, xGPIO_DIR_MODE_OUT);
    xGPIOSPinWrite(FLASH_PIN_WRITE_PROTECT, 0);
#endif
    //
    // PD1 as SPI2.CLK
    //
    xSPinTypeSPI(SPI_CLK, AT45DB161_SCK);
    //
    // PD2 as SPI2.MISO
    // MISO20 => SPI0MISO
    //
    xSPinTypeSPI(SPI_MISO, AT45DB161_MISO);
    //
    // PD3 as SPI2.MOSI
    // MOSI20 => SPI0MISO
    //
    xSPinTypeSPI(SPI_MOSI, AT45DB161_MOSI);

    //xSysCtlPeripheralEnable(SYSCTL_PERIPH_AFIO);
    //
    //! Set SPI mode.
    //
    xSPIConfigSet(AT45DB161_SPI_PORT, ulSpiClock, SPI_MODE_MASTER |
                  SPI_MSB_FIRST |
                  SPI_2LINE_FULL |
                  SPI_DATA_WIDTH8 |
                  SPI_FORMAT_MODE_4);
    SPISSModeConfig(AT45DB161_SPI_PORT, SPI_CR1_SSM);
    SPISSIConfig(AT45DB161_SPI_PORT, SPI_CR1_SSI);
    SPIEnble(AT45DB161_SPI_PORT);
    AT45DB161_CS = 1;
    xSPISingleDataReadWrite(AT45DB161_SPI_PORT, 0xFF);
    xSysCtlDelay(100000);
    AT45DB161_CS = 0;
    //
    //! Read AT45DB161 state register to get the page size.
    //
    xSPISingleDataReadWrite(AT45DB161_SPI_PORT, AT45DB161_CMD_SRRD);
    tmp = xSPISingleDataReadWrite(AT45DB161_SPI_PORT, 0xFF);
    if(tmp & AT45DB161_PGSZ) AT45DB161_PageSize = 512;
    AT45DB161_CS = 1;
}
开发者ID:AlexGora,项目名称:cox,代码行数:68,代码来源:AT45DB161.c

示例5: IWDGTimerInit

//*****************************************************************************
//
//! \brief Configurate The Independent WatchDog's Timer Interval.
//!
//! \param ulConfig is the Timer Interval Selection.
//!
//! This function is to Configurate The Independent WatchDog's Timer Interval.
//!
//! \return None.
//
//*****************************************************************************
void
IWDGTimerInit(unsigned long ulConfig)
{
    //
    // Check the arguments.
    //
    xASSERT((ulConfig <= IWDG_RLR_RL_M));

    xHWREG(IWDG_KR) = IWDG_KR_PROTECT_DIS;
    xHWREG(IWDG_RLR) = ulConfig;
}
开发者ID:sangwook236,项目名称:general-development-and-testing,代码行数:22,代码来源:xwdt.c

示例6: WDTimerWindowValueSet

//*****************************************************************************
//
//! \brief Set The WatchDog Timer(WDT)'s Window Value.
//!
//! \param ulConfig is the Timer Window Value Selection.
//!
//! This function is to set The WatchDog Timer(WDT)'s Wondow Value.
//!
//! \return None.
//
//*****************************************************************************
void
WDTimerWindowValueSet(unsigned long ulConfig)
{
    //
    // Check the arguments.
    //
    xASSERT((ulConfig <= WWDG_CFR_W_M));

    xHWREG(WWDG_CFR) &= ~WWDG_CFR_W_M;
    xHWREG(WWDG_CFR) |= ulConfig;
}
开发者ID:sangwook236,项目名称:general-development-and-testing,代码行数:22,代码来源:xwdt.c

示例7: ACMPIntEnable

//*****************************************************************************
//
//! \brief Enable the comparator interrupt.
//!
//! \param ulBase is the base address of the comparator module.
//! \param ulComp is the index(0 - 1) of the comparator.
//!
//! This function enables generation of an interrupt from the specified
//! comparator.  Only comparators whose interrupts are enabled can be reflected
//! to the processor.
//!
//! \note In KL25Z Series, the ulComp must be 0.
//!
//! \return None.
//
//*****************************************************************************
void
ACMPIntEnable(unsigned long ulBase, unsigned long ulCompID)    
{
    unsigned long ulCRAddr;
    
    xASSERT(ulBase == ACMP_BASE);
    xASSERT((ulCompID >= 0) && (ulCompID < 2));

    //
    // Get the corresponding CR register address
    //
    ulCRAddr = ulBase + CMP0_SCR + (4 * ulCompID);

    //
    // Enable the comparator interrupt
    //
    xHWREGB(ulCRAddr) |= CMP0_SCR_IEF;
    xHWREGB(ulCRAddr) |= CMP0_SCR_IER;

}
开发者ID:0xc0170,项目名称:cox,代码行数:36,代码来源:xacmp.c

示例8: ST7735DrawVerticalLine

//*****************************************************************************
//
//! \brief Draws a vertical line.
//!
//! \param ulX is the X coordinate of the line.
//! \param ulStartY is the Y coordinate of the start of the line.
//! \param ulEndY is the Y coordinate of the end of the line.
//! \param ulColor is the color of the line.
//!
//! This function draws a vertical line on the display.  The coordinates of the
//! line are assumed to be within the extents of the display.
//!
//! \return None.
//
//*****************************************************************************
void
ST7735DrawVerticalLine(unsigned short usX, unsigned short usStartY,
                        unsigned short usEndY, unsigned long ulColor)
{
    xASSERT((usStartY <= usEndY) && (usEndY <= LCD_VERTICAL_MAX) && (usStartY >= 0));
    
    while(usStartY++ <= usEndY)
    {
        ST7735DrawOnePixel(usX, usStartY, ulColor);
    }
}
开发者ID:AlexGora,项目名称:cox,代码行数:26,代码来源:st7735.c

示例9: xADCIntCallbackInit

//*****************************************************************************
//
//! \brief Init the ADC  Interrupt Callback function.
//!
//! \param ulBase is the base address of the ADC.
//! \param pfnCallback is the callback function.
//!
//! When there is any ADC intrrupt occrus, Interrupt Handler will 
//! call the callback function. 
//! 
//! param of pfnCallback
//! - pvCBData not used, always 0.
//! - ulEvent is the interrupt event..
//! - ulMsgParam not used, always 0.
//! - pvMsgData not used, always 0.
//! .
//!
//! \return None.
//
//*****************************************************************************
void 
xADCIntCallbackInit(unsigned long ulBase, 
                    xtEventCallback pfnCallback)
{
    //
    // Check the arguments.
    //
    xASSERT(ulBase == xADC0_BASE);

    g_pfnADCHandlerCallbacks[0] = pfnCallback;
}
开发者ID:0xc0170,项目名称:cox,代码行数:31,代码来源:xadc.c

示例10: ST7735DrawHorizontalLine

//*****************************************************************************
//
//! \brief Draws a horizontal line.
//!
//! \param usStartX is the X coordinate of the start of the line.
//! \param usEndX is the X coordinate of the end of the line.
//! \param usY is the Y coordinate of the line.
//! \param usColor is the color of the line.
//!
//! This function draws a horizontal line on the display.  The coordinates of
//! the line are assumed to be within the extents of the display.
//!
//! \return None.
//
//*****************************************************************************
void
ST7735DrawHorizontalLine(unsigned short usStartX, unsigned short usEndX,
                          unsigned short usY, unsigned long ulColor)
{
    xASSERT((usStartX <= usEndX) && (usEndX <= LCD_HORIZONTAL_MAX) && (usStartX >= 0));
    
    while(usStartX++ <= usEndX)
    {
        ST7735DrawOnePixel(usStartX, usY, ulColor);
    }
}
开发者ID:AlexGora,项目名称:cox,代码行数:26,代码来源:st7735.c

示例11: DMAChannelIntFlagClear

//*****************************************************************************
//
//! \brief Clear the DMA interrupt flag of a channel.
//!
//! \param ulChannelID is the channel ID that have been disabled.
//! \param ulIntFlags is the interrupt type of DMA.
//! The channel ID can be:
//! - DMA1_CHANNEL_1
//! - DMA1_CHANNEL_2
//! - others refrence \ref STM32F1xx_DMA_Channel_IDs
//! .
//! The interrupt type can be:
//! - DMA_INT_TC
//! - DMA_INT_ERROR
//! - refrence \ref STM32F1xx_DMA_INT_Type
//! .
//!
//! \return the Status of The DMA interrupt.
//
//*****************************************************************************
void 
DMAChannelIntFlagClear(unsigned long ulChannelID, unsigned long ulIntFlags)
{
    //
    // Check the arguments.
    //
    xASSERT(xDMAChannelIDValid(ulChannelID));
    xASSERT(((ulIntFlags & DMA_INT_TC) == DMA_INT_TC) || 
            ((ulIntFlags & DMA_INT_HT) == DMA_INT_HT) ||
            ((ulIntFlags & DMA_INT_ERROR) == DMA_INT_ERROR));

    if((ulChannelID) < 7)
    {
        xHWREG(DMA1_BASE + DMA_IFCR) |= (ulIntFlags << ulChannelID*4);
    }
    else
    {
        xHWREG(DMA2_BASE + DMA_IFCR) |= (ulIntFlags << (ulChannelID-1024)*4);
    }
}
开发者ID:Limius,项目名称:cox,代码行数:40,代码来源:xdma.c

示例12: PDMAChannelIsBusy

//*****************************************************************************
//
//! \brief Get the PDMA of a channel busy or not.
//!
//! \param ulChannelID is the channel ID that have been disabled.
//! The channel ID can be:
//! - PDMA_CHANNEL_0
//! - PDMA_CHANNEL_1
//! - others refrence \ref NUC1xx_PDMA_Channel_IDs
//! .
//!
//! \return returns xtrue if PDMA channel is busy or returns xfalse.
//
//*****************************************************************************
xtBoolean 
PDMAChannelIsBusy(unsigned long ulChannelID)
{
    //
    // Check the arguments.
    //
    xASSERT(xDMAChannelIDValid(ulChannelID));

    return ((xHWREG(g_psDMAChannelAddress[ulChannelID] + PDMA_CSR) 
            | PDMA_CSR_TEN) ? xtrue : xfalse);
}
开发者ID:Karplyak,项目名称:cox,代码行数:25,代码来源:dma.c

示例13: GPIODirModeSet

//*****************************************************************************
//
//! \brief Sets the direction and pad configuration of the specified pin.
//!
//! \param ulPort is the base address of the GPIO port
//! \param ulBit is the bit number of a port.
//! \param ulPinType is the pin direction and/or pad configuration.
//! \param ulPinSpeed is input or output speed of specified pin.
//!
//! This function will set the specified pin(Only 1 pin) on the selected GPIO
//! port as either an input or output under software control, or it will set
//! the pin to be under hardware control.
//!
//! The parameter \e ulPinType is an enumerated data type that can be one of
//! the following values:
//!
//! - \b GPIO_TYPE_IN_ANALOG
//! - \b GPIO_TYPE_IN_FLOATING
//! - \b GPIO_TYPE_IN_WPU_WPD
//! - \b GPIO_TYPE_OUT_STD
//! - \b GPIO_TYPE_OUT_OD
//! - \b GPIO_TYPE_AFOUT_STD
//! - \b GPIO_TYPE_AFOUT_OD
//!
//! The parameter \e ulPinSpeed is an enumerated data type that can be one of
//! the following values:
//!
//! - \b GPIO_IN_SPEED_FIXED
//! - \b GPIO_OUT_SPEED_10M
//! - \b GPIO_OUT_SPEED_2M
//! - \b GPIO_OUT_SPEED_50M
//!
//!
//! \return None.
//
//*****************************************************************************
void
GPIODirModeSet(unsigned long ulPort, unsigned long ulBit,
               unsigned long ulPinType, unsigned long ulPinSpeed)
{
    //
    // Check the arguments.
    //
    xASSERT(GPIOBaseValid(ulPort));
    xASSERT(ulBit < 16);
    xASSERT((ulPinType == GPIO_TYPE_IN_ANALOG) ||
            (ulPinType == GPIO_TYPE_IN_FLOATING) ||
            (ulPinType == GPIO_TYPE_IN_WPU_WPD) ||
            (ulPinType == GPIO_TYPE_OUT_STD) ||
            (ulPinType == GPIO_TYPE_OUT_OD) ||
            (ulPinType == GPIO_TYPE_AFOUT_STD) ||
            (ulPinType == GPIO_TYPE_AFOUT_OD));

    xASSERT((ulPinSpeed == GPIO_IN_SPEED_FIXED) ||
            (ulPinSpeed == GPIO_OUT_SPEED_10M) ||
            (ulPinSpeed == GPIO_OUT_SPEED_2M) ||
            (ulPinSpeed == GPIO_OUT_SPEED_50M));
    //
    // Set the pin direction and mode.
    //
    if(ulBit < 8)
    {
        xHWREG(ulPort + GPIO_CRL) &=
            (~((GPIO_CRL_MODE0_M | GPIO_CRL_CNF0_M) << (ulBit * 4)));

        xHWREG(ulPort + GPIO_CRL) = (xHWREG(ulPort + GPIO_CRL) |               \
                                     (((ulPinSpeed | ulPinType)) << (ulBit * 4)));
    }
    else
    {
        xHWREG(ulPort + GPIO_CRH) &=
            (~((GPIO_CRH_MODE8_M | GPIO_CRH_CNF8_M) << ((ulBit -8) * 4)));

        xHWREG(ulPort + GPIO_CRH) = (xHWREG(ulPort + GPIO_CRH) |               \
                                     (((ulPinSpeed | ulPinType)) << ((ulBit -8) * 4)));
    }
}
开发者ID:Azz1,项目名称:RPI_EPI,代码行数:77,代码来源:xgpio.c

示例14: xACMPConfigure

//*****************************************************************************
//
//! \brief Select the ACMP- input source of the comparator.
//!
//! \param ulBase is the base address of the comparator module.
//! \param ulComp is the index(0 - 1) of the comparator to configure.
//! \param ulSource is the source of Comp- input. 
//! Refrence \ref NUC1xx_ACMP_Analog_Src_negative.
//!
//! This function configures the Comp- input source of a comparator.  
//!
//! \return None.
//
//*****************************************************************************
void
xACMPConfigure(unsigned long ulBase, unsigned long ulComp,
                   unsigned long ulSource)
{
    unsigned long ulCRAddr;
    
    xASSERT(ulBase == ACMP_BASE);
    xASSERT((ulComp >= 0) && (ulComp < 2));
    xASSERT((ulSource == ACMP_ASRCN_PIN) || (ulSource == ACMP_ASRCN_REF));

    //
    // Get the corresponding CR register address
    //
    ulCRAddr = ulBase + ACMP_CR0 + (4 * ulComp);

    //
    // Set the comp- input source
    //
    xHWREG(ulCRAddr) &= ~ACMP_CR_CN;
    xHWREG(ulCRAddr) |= ulSource;
}
开发者ID:Karplyak,项目名称:cox,代码行数:35,代码来源:acmp.c

示例15: HD44780Read

//*****************************************************************************
//
//! \brief Read the state or data from the HD44780.
//!
//! \param ucRS determines if the IR or DR to select.
//!
//! The parameter of ucRS can be:
//! - HD44780_RS_COMMAND - select the IR.
//! - HD44780_RS_DATA - select the DR.
//!
//! \return None.
//
//*****************************************************************************
unsigned char 
HD44780Read(unsigned char ucRS)
{
    unsigned char ucData = 0;

    //
    // Check Arguments.
    //
    xASSERT((ucRS == HD44780_RS_COMMAND) || (ucRS == HD44780_RS_DATA));

    return ucData;
}
开发者ID:AlexGora,项目名称:cox,代码行数:25,代码来源:hd44780.c


注:本文中的xASSERT函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。