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


C++ GET_BITFIELD函数代码示例

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


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

示例1: boot_IspiGetData

// =============================================================================
// boot_IspiGetData
// -----------------------------------------------------------------------------
/// Get one datum.
///
/// This functions gets one element of 32 bits from the ISPI Rx Fifo.
/// If the Fifo was empty at the time #boot_IspiGetData() is called, 0
/// is returned and \c recData is untainted. Otherwise one datum is get
/// from the Fifo and 1 is returned
///
/// @param  recData Pointer to store the received datum.
/// @return Returns the number of received data (1 or 0, if the Fifo is empty).
// =============================================================================
PUBLIC UINT32 boot_IspiGetData(UINT32* recData)
{
    UINT32 nbAvailable;

    // Enter critical section.
    UINT32 status = hwp_sysIrq->SC;

    nbAvailable = GET_BITFIELD(hwp_spi3->status, SPI_RX_LEVEL);
    
    if (nbAvailable > 0)
    {
        *recData = hwp_spi3->rxtx_buffer;
        
        // Exit critical section.
        hwp_sysIrq->SC = status;
        return 1;
    }
    else
    {
        // Exit critical section.
        hwp_sysIrq->SC = status;
        return 0;
    }

}
开发者ID:BarryChen,项目名称:RDA,代码行数:38,代码来源:boot_ispi.c

示例2: b_get

static PyObject *
b_get(void *ptr, Py_ssize_t size)
{
    signed char val = *(signed char *)ptr;
    GET_BITFIELD(val, size);
    return PyInt_FromLong(val);
}
开发者ID:nanwu,项目名称:pyston,代码行数:7,代码来源:cfield.c

示例3: boot_IspiRxFifoLevel

// =============================================================================
// boot_IspiRxFifoLevel
// -----------------------------------------------------------------------------
/// Get data quantity in the Spi Rx FIFO.
///
/// @return The number of 32 bits data items in the Rx FIFO.
// =============================================================================
PUBLIC UINT8 boot_IspiRxFifoLevel(VOID)
{
    UINT8 rxLevel;
    // Get level 
    rxLevel = GET_BITFIELD(hwp_spi3->status, SPI_RX_LEVEL);
    return rxLevel;
}
开发者ID:BarryChen,项目名称:RDA,代码行数:14,代码来源:boot_ispi.c

示例4: boot_UartMonitorGet

// =============================================================================
// boot_UartMonitorGet
// -----------------------------------------------------------------------------
/// Read some bytes and actualizes the checksum.
/// @param data Array where read bytes will be stored
/// @param size Number of bytes to receive.
/// @param checksum Pointer to the value to XOR the read byte to calculate 
/// the checksum.
// =============================================================================
PROTECTED BOOT_UM_ERR_T boot_UartMonitorGet(UINT8* data, UINT32 size, UINT8* checksum)
{
    UINT32 i;
    UINT32 offset = 0;
    UINT32 startTime;
    BOOL    onTime = TRUE;
    
    for (i=0; i<size; i++)
    {
        startTime = hwp_timer->HWTimer_CurVal;
        if (startTime > 0x80000000)
        {
            offset = 0x80000000;
        }
        
        while ((GET_BITFIELD(hwp_uart->status, UART_RX_FIFO_LEVEL) == 0)
               && (onTime = ((hwp_timer->HWTimer_CurVal+offset) < (startTime + offset + BOOT_UART_MONITOR_RX_TIME_OUT))));
        if (!onTime)
        {
            return BOOT_UM_ERR_RX_FAILED;
        }
        
        data[i] = hwp_uart->rxtx_buffer;
        *checksum ^= data[i];
    }
    return BOOT_UM_ERR_NO;
}
开发者ID:jprothwell,项目名称:sc-fix,代码行数:36,代码来源:boot_uart_monitor.c

示例5: B_get

static PyObject *
B_get(void *ptr, Py_ssize_t size)
{
    unsigned char val = *(unsigned char *)ptr;
    GET_BITFIELD(val, size);
    return PyLong_FromLong(val);
}
开发者ID:pombredanne,项目名称:cpython,代码行数:7,代码来源:cfield.c

示例6: boot_UartMonitorSend

// =============================================================================
// boot_UartMonitorSend
// -----------------------------------------------------------------------------
/// Basic sending function.  Done on polling, check
/// TX fifo availability and wait for room if needed.
///
/// @param data Data to send
/// @param length Number of byte to send.
/// @param checksum Pointer to the UINT8 holding the CRC of the frame 
/// this transmitting is as part of.
/// @return #BOOT_UM_ERR_NO or #BOOT_UM_ERR_RESOURCE_TIMEOUT;
// =============================================================================
PROTECTED BOOT_UM_ERR_T boot_UartMonitorSend(UINT8* data, UINT32 length, UINT8* checksum)
{
    UINT32 i;
    UINT32 offset = 0;
    UINT32 startTime;
    BOOL    onTime = TRUE;
    for (i=0 ; i<length ; i++)
    {
        startTime = hwp_timer->HWTimer_CurVal;
        if (startTime > 0x80000000)
        {
            offset = 0x80000000;
        }
        
        // Place in the TX Fifo ?
        while ((GET_BITFIELD(hwp_uart->status, UART_TX_FIFO_SPACE) == 0)
               && (onTime = (hwp_timer->HWTimer_CurVal+offset < startTime + offset + BOOT_UART_MONITOR_TX_TIME_OUT)));
        
        if (!onTime)
        {
            return BOOT_UM_ERR_TX_FAILED;
        }
        
        hwp_uart->rxtx_buffer = data[i];
        *checksum ^= data[i];
    }
    return BOOT_UM_ERR_NO;
}
开发者ID:jprothwell,项目名称:sc-fix,代码行数:40,代码来源:boot_uart_monitor.c

示例7: boot_IspiSendData

// =============================================================================
// boot_IspiSendData
// -----------------------------------------------------------------------------
/// Send one data. 
/// This functions sends one data frame.
/// The number returned is the number of data frames actually sent. 
///
/// @param csId The CS to use to send the data. This cs must be activated before
/// sending data.
/// @param data Frame of data to send.
/// @param read \c TRUE if the response of the device to this sent data is
/// expected to be read later and thus will be put in the read Fifo.
/// @return 1 if the data was sent, 0 otherwise.
// =============================================================================
PUBLIC UINT32 boot_IspiSendData(BOOT_ISPI_CS_T csId, UINT32 data, BOOL read)
{
    UINT32 freeRoom;
    
    // Clear data upper bit to only keep the data frame.
    UINT32 reg = data & ~(SPI_CS_MASK | SPI_READ_ENA_MASK);
    
    // Add CS and read mode bit
    reg |= SPI_CS(csId) | (read?SPI_READ_ENA:0);

    // Enter critical section.
    UINT32 status = hwp_sysIrq->SC;

    // Check FIFO availability.
    freeRoom = GET_BITFIELD(hwp_spi3->status, SPI_TX_SPACE);

    if (freeRoom > 0)
    {
        // Write data.
        hwp_spi3->rxtx_buffer = reg;
        
        // Exit critical section.
        hwp_sysIrq->SC = status;
        return 1;
    }
    else
    {
        // Exit critical section.
        hwp_sysIrq->SC = status;
        return 0;
    }
    
}
开发者ID:BarryChen,项目名称:RDA,代码行数:47,代码来源:boot_ispi.c

示例8: Q_get

static PyObject *
Q_get(void *ptr, Py_ssize_t size)
{
    unsigned PY_LONG_LONG val;
    memcpy(&val, ptr, sizeof(val));
    GET_BITFIELD(val, size);
    return PyLong_FromUnsignedLongLong(val);
}
开发者ID:pombredanne,项目名称:cpython,代码行数:8,代码来源:cfield.c

示例9: i_get

static PyObject *
i_get(void *ptr, Py_ssize_t size)
{
    int val;
    memcpy(&val, ptr, sizeof(val));
    GET_BITFIELD(val, size);
    return PyInt_FromLong(val);
}
开发者ID:nanwu,项目名称:pyston,代码行数:8,代码来源:cfield.c

示例10: H_get

static PyObject *
H_get(void *ptr, Py_ssize_t size)
{
    unsigned short val;
    memcpy(&val, ptr, sizeof(val));
    GET_BITFIELD(val, size);
    return PyLong_FromLong(val);
}
开发者ID:pombredanne,项目名称:cpython,代码行数:8,代码来源:cfield.c

示例11: l_get

static PyObject *
l_get(void *ptr, Py_ssize_t size)
{
    long val;
    memcpy(&val, ptr, sizeof(val));
    GET_BITFIELD(val, size);
    return PyLong_FromLong(val);
}
开发者ID:pombredanne,项目名称:cpython,代码行数:8,代码来源:cfield.c

示例12: q_get_sw

static PyObject *
q_get_sw(void *ptr, Py_ssize_t size)
{
    PY_LONG_LONG val;
    memcpy(&val, ptr, sizeof(val));
    val = SWAP_8(val);
    GET_BITFIELD(val, size);
    return PyLong_FromLongLong(val);
}
开发者ID:pombredanne,项目名称:cpython,代码行数:9,代码来源:cfield.c

示例13: l_get_sw

static PyObject *
l_get_sw(void *ptr, Py_ssize_t size)
{
    long val;
    memcpy(&val, ptr, sizeof(val));
    val = SWAP_LONG(val);
    GET_BITFIELD(val, size);
    return PyInt_FromLong(val);
}
开发者ID:nanwu,项目名称:pyston,代码行数:9,代码来源:cfield.c

示例14: boot_IspiTxFifoAvail

// =============================================================================
// boot_IspiTxFifoAvail
// -----------------------------------------------------------------------------
/// Get available data spaces in the Spi Tx FIFO.
/// This function returns the available space in the Tx FIFO, as a number
/// of 32 bits data that can be filled into it.
///
/// @return The size of the available space in the Tx FIFO. (In Fifo elements.)
// =============================================================================
PUBLIC UINT8 boot_IspiTxFifoAvail(VOID)
{
    UINT8 freeRoom;
    
    // Get avail level.
    freeRoom = GET_BITFIELD(hwp_spi3->status, SPI_TX_SPACE);

    return freeRoom;
}
开发者ID:BarryChen,项目名称:RDA,代码行数:18,代码来源:boot_ispi.c

示例15: L_get_sw

static PyObject *
L_get_sw(void *ptr, Py_ssize_t size)
{
    unsigned long val;
    memcpy(&val, ptr, sizeof(val));
    val = SWAP_LONG(val);
    GET_BITFIELD(val, size);
    return PyLong_FromUnsignedLong(val);
}
开发者ID:pombredanne,项目名称:cpython,代码行数:9,代码来源:cfield.c


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