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


C++ Transaction::busError方法代码示例

本文整理汇总了C++中Transaction::busError方法的典型用法代码示例。如果您正苦于以下问题:C++ Transaction::busError方法的具体用法?C++ Transaction::busError怎么用?C++ Transaction::busError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Transaction的用法示例。


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

示例1:

//-----------------------------------------------------------------------------
fapi::ReturnCode 
Bus::operation(Transaction& trans)
{
    fapi::ReturnCode rc;
    Slave*           slave= 0;

    do
    {
        for( slave = iv_primarySlaves; slave; slave = slave->iv_next )
        {
            if( (trans.iv_address >= slave->iv_base) && (trans.iv_address < (slave->iv_base + slave->iv_size) ) )
            {
              break; // found a primary slave
            }
        }

        if( slave == 0 )
        { // primary slaves did not hold the transaction address. Try using the secondary slaves.
          for( slave = iv_secondarySlaves; slave; slave = slave->iv_next )
          {
              if( (trans.iv_address >= slave->iv_base) && (trans.iv_address < (slave->iv_base + slave->iv_size) ) )
              {
                break; // found a secondary slave
              }
          }
        }

        break;
    }while(1);

    do
    {
        if( slave == 0 ) // neither primary nor secondary slaves held the address
        {
          trans.busError(ME_NOT_MAPPED_ON_BUS);
          FAPI_ERR("No bus slave claimed address 0x%08x\n", trans.iv_address);
          FAPI_SET_HWP_ERROR(rc, RC_POREVE_PORE_NOT_MAPPED_ON_BUS);
          break;
        }

        if( (trans.iv_mode & slave->iv_permissions) == 0 ){
            FAPI_ERR("Access denied for address 0x%08x, "
                     "mode = %d, slave permissions = %d\n",
                     trans.iv_address, trans.iv_mode, slave->iv_permissions);
            trans.busError(ME_BUS_SLAVE_PERMISSION_DENIED);
            FAPI_SET_HWP_ERROR(rc, RC_POREVE_BUS_SLAVE_PERMISSION_DENIED);
            break;
        }

        trans.iv_offset = trans.iv_address - slave->iv_base;
        rc = slave->operation( trans );
        break;
    }while(1);

    return rc;
}
开发者ID:AmesianX,项目名称:hostboot,代码行数:57,代码来源:bus.C

示例2: read

//-----------------------------------------------------------------------------
fapi::ReturnCode
OciSlave::operation(Transaction& io_transaction)
{
    fapi::ReturnCode rc;
    ModelError       me;

    if( io_transaction.iv_mode & ACCESS_MODE_READ )
    {
        rc = read( io_transaction.iv_address, io_transaction.iv_data );
    }
    else
    {
        rc = write( io_transaction.iv_address, io_transaction.iv_data );
    }

    if( rc.ok() )
    {
        me = ME_SUCCESS;
    }
    else
    {
        me = ME_FAILURE;
    }

    io_transaction.busError( me );

    return rc;
}
开发者ID:AmesianX,项目名称:hostboot,代码行数:29,代码来源:bus.C


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