• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ GET_BITFIELD函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: i_get_sw

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


示例17: boot_HstMonitor

// =============================================================================
// boot_HstMonitor
// -----------------------------------------------------------------------------
/// Main host monitor function. Read the command passed to the platform through
/// the Host port and call the host command handler if appropriate.
/// It read the H2P register to execute commands
/// until the Exit command is received (BOOT_HST_MONITOR_END_CMD).
// =============================================================================
PROTECTED BOOT_MONITOR_OP_STATUS_T boot_HstMonitor(VOID)
{

    BOOT_HST_CMD_T hostCommand = 0;

    // Clear the "enter the monitor" host command

    // if a host command present
    if((hostCommand = GET_BITFIELD(hwp_debugHost->h2p_status,
                                   DEBUG_HOST_H2P_STATUS)) != 0)
    {
        // We received a command: we are not waiting anymore but actually acting
        // as a monitor.
        hwp_debugHost->p2h_status   = BOOT_HST_STATUS_NONE;

        switch (hostCommand)
        {
            case BOOT_HST_MONITOR_START_CMD:
                // That command used to be used to enter into the monitor.
                // We now use a boot mode for that, so this command is
                // just used to send the BOOT_HST_MONITOR_START event
                // to acknowledge to the host (eg Remote PC's coolwatcher)
                // that we actually are in the monitor.
                mon_Event(BOOT_HST_MONITOR_START);
                hwp_debugHost->h2p_status = DEBUG_HOST_H2P_STATUS_RST;
                break;

            case BOOT_HST_MONITOR_X_CMD:
                // Execute a command placed in the execution structure.
                // H2P_Status is cleared in the basic handler
                boot_HstCmdBasicHandler();
                break;

            case BOOT_HST_MONITOR_END_CMD:
                // We are required to leave the monitor.
                mon_Event(BOOT_HST_MONITOR_END);
                hwp_debugHost->h2p_status = DEBUG_HOST_H2P_STATUS_RST;
                return BOOT_MONITOR_OP_STATUS_EXIT;

            default:
                // unsupported command
                mon_Event(BOOT_HST_UNSUPPORTED_CMD);
                hwp_debugHost->h2p_status = DEBUG_HOST_H2P_STATUS_RST;
                break;
        }

        // We received a command, possibly unknown, but different from 
        // BOOT_HST_MONITOR_END_CMD;
        return BOOT_MONITOR_OP_STATUS_CONTINUE;
    }
    else
    {
        // No command received.
        return BOOT_MONITOR_OP_STATUS_NONE;
    }
}
开发者ID:hnhkj,项目名称:RDA,代码行数:64,代码来源:boot_host.c


示例18: write_data

/************************************************
*  函数名称:write_data
*  功能说明:LCD写数据函数
*  参数说明:d为数据,为一个BYTE的数据
*  函数返回:无
*  修改时间:2014-1-14    已经测试
*************************************************/
void  write_data(unsigned char  d)
{
  dcx=1;
  sdi=(GET_BITFIELD(d))->bit7;scl=0;scl=1;
  sdi=(GET_BITFIELD(d))->bit6;scl=0;scl=1;
  sdi=(GET_BITFIELD(d))->bit5;scl=0;scl=1;
  sdi=(GET_BITFIELD(d))->bit4;scl=0;scl=1;
  sdi=(GET_BITFIELD(d))->bit3;scl=0;scl=1;
  sdi=(GET_BITFIELD(d))->bit2;scl=0;scl=1;
  sdi=(GET_BITFIELD(d))->bit1;scl=0;scl=1;
  sdi=(GET_BITFIELD(d))->bit0;scl=0;scl=1;
}
开发者ID:LLChocolate,项目名称:test2-k26,代码行数:19,代码来源:LCD.c


示例19: write_command

/************************************************
*  函数名称:write_command
*  功能说明:LCD写指令函数
*  参数说明:c为指令
*  函数返回:无
*  修改时间:2014-1-14    已经测试
*************************************************/
void  write_command(unsigned char  c)
{
  dcx=0;
  sdi=(GET_BITFIELD(c))->bit7;scl=0;scl=1;
  sdi=(GET_BITFIELD(c))->bit6;scl=0;scl=1;
  sdi=(GET_BITFIELD(c))->bit5;scl=0;scl=1;
  sdi=(GET_BITFIELD(c))->bit4;scl=0;scl=1;
  sdi=(GET_BITFIELD(c))->bit3;scl=0;scl=1;
  sdi=(GET_BITFIELD(c))->bit2;scl=0;scl=1;
  sdi=(GET_BITFIELD(c))->bit1;scl=0;scl=1;
  sdi=(GET_BITFIELD(c))->bit0;scl=0;scl=1;
}
开发者ID:LLChocolate,项目名称:test2-k26,代码行数:19,代码来源:LCD.c


示例20: hal_IfcTransferStart

// =============================================================================
// hal_IfcTransferStart
// -----------------------------------------------------------------------------
/// Start an IFC transfer
/// 
/// This is a non blocking function that starts the transfer
/// and returns the hand. 
/// 
/// @param requestId Describe the direction of the tranfer (rx or
/// tx) and the module to or from which data are to be moved.
/// @param memStartAddr. Start address of the buffer where data 
/// to be sent are located or where to put the data read, according
/// to the request defined by the previous parameter
/// @param xferSize Number of bytes to transfer. The maximum size 
/// is 2^20 - 1 bytes.
/// @param ifcMode Mode of the transfer (Autodisable or not, 8 or 32 bits)
/// @return Channel got or HAL_UNKNOWN_CHANNEL.
// =============================================================================
PROTECTED UINT8 hal_IfcTransferStart(HAL_IFC_REQUEST_ID_T requestId, UINT8* memStartAddr, UINT32 xferSize, HAL_IFC_MODE_T ifcMode)
{
    // Check buffer alignment depending on the mode
    if (ifcMode != HAL_IFC_SIZE_8_MODE_MANUAL && ifcMode != HAL_IFC_SIZE_8_MODE_AUTO)
    {
        // Then ifcMode == HAL_IFC_SIZE_32, check word alignment
        HAL_ASSERT(((UINT32)memStartAddr%4) == 0,
            "HAL IFC: 32 bits transfer misaligned [email protected]%08X", memStartAddr);
    }
    else
    {
        // ifcMode == HAL_IFC_SIZE_8, nothing to check
    }

    HAL_ASSERT(xferSize < (1<<SYS_IFC_TC_LEN),
        "HAL IFC: Transfer size too large: %d", xferSize);

    UINT32 status = hal_SysEnterCriticalSection();
    UINT8 channel;
    UINT8 i;
    
    // Check the requested id is not currently already used.
    for (i = 0; i < SYS_IFC_STD_CHAN_NB ; i++)
    {
        if (GET_BITFIELD(hwp_sysIfc->std_ch[i].control, SYS_IFC_REQ_SRC) == requestId)
        {
            // This channel is or was used for the requestId request.
            // Check it is still in use.
            HAL_ASSERT((hwp_sysIfc->std_ch[i].status & SYS_IFC_ENABLE) == 0,
                    "HAL: Attempt to use the IFC to deal with a %d"
                    " request still active on channel %d", requestId, i);
        }
    }

    channel = SYS_IFC_CH_TO_USE(hwp_sysIfc->get_ch) ;

    if (channel >= SYS_IFC_STD_CHAN_NB)
    {
        hal_SysExitCriticalSection(status);
        return HAL_UNKNOWN_CHANNEL;
    }

    g_halModuleIfcChannelOwner[channel]     = requestId;
    hwp_sysIfc->std_ch[channel].start_addr  =  (UINT32) memStartAddr;
    hwp_sysIfc->std_ch[channel].tc          =  xferSize;
    hwp_sysIfc->std_ch[channel].control     = (SYS_IFC_REQ_SRC(requestId) 
                                            | ifcMode
#if (CHIP_HAS_ASYNC_TCU)
                                            | SYS_IFC_CH_RD_HW_EXCH
#endif
                                            | SYS_IFC_ENABLE);
    
    hal_SysExitCriticalSection(status);
    return channel;
}
开发者ID:BarryChen,项目名称:RDA,代码行数:73,代码来源:hal_sys_ifc.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GET_BITS函数代码示例发布时间:2022-05-30
下一篇:
C++ GET_BIT函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap