示例#1
0
void WedgePlatform::initTransceiverMap(SwSwitch* sw) {
  const int MAX_WEDGE_MODULES = 16;

  // If we can't get access to the USB devices, don't bother to
  // create the QSFP objects;  this is likely to be a permanent
  // error.

  try {
    wedgeI2CBusLock_ = make_unique<WedgeI2CBusLock>();
  } catch (const LibusbError& ex) {
    LOG(ERROR) << "failed to initialize USB to I2C interface";
    return;
  }

  // Wedge port 0 is the CPU port, so the first port associated with
  // a QSFP+ is port 1.  We start the transceiver IDs with 0, though.

  for (int idx = 0; idx < MAX_WEDGE_MODULES; idx++) {
    std::unique_ptr<WedgeQsfp> qsfpImpl =
      make_unique<WedgeQsfp>(idx, wedgeI2CBusLock_.get());
    for (int channel = 0; channel < QsfpModule::CHANNEL_COUNT; ++channel) {
      qsfpImpl->setChannelPort(ChannelID(channel),
          PortID(idx * QsfpModule::CHANNEL_COUNT + channel + 1));
    }
    std::unique_ptr<QsfpModule> qsfp =
      make_unique<QsfpModule>(std::move(qsfpImpl));
    sw->addTransceiver(TransceiverID(idx), std::move(qsfp));
    LOG(INFO) << "making QSFP for " << idx;
    for (int channel = 0; channel < QsfpModule::CHANNEL_COUNT; ++channel) {
      sw->addTransceiverMapping(PortID(idx * QsfpModule::CHANNEL_COUNT +
          channel + 1), ChannelID(channel), TransceiverID(idx));
    }
  }
}
示例#2
0
文件: Vlan.cpp 项目: Gardenya/fboss
VlanFields VlanFields::fromFollyDynamic(const folly::dynamic& vlanJson) {
  VlanFields vlan(VlanID(vlanJson[kVlanId].asInt()),
      vlanJson[kVlanName].asString().toStdString());
  vlan.mtu = vlanJson[kVlanMtu].asInt();
  vlan.dhcpV4Relay = folly::IPAddressV4(
      vlanJson[kDhcpV4Relay].stringPiece());
  vlan.dhcpV6Relay = folly::IPAddressV6(
      vlanJson[kDhcpV6Relay].stringPiece());
  for (const auto& o: vlanJson[kDhcpV4RelayOverrides].items()) {
    vlan.dhcpRelayOverridesV4[MacAddress(o.first.asString().toStdString())] =
        folly::IPAddressV4(o.second.stringPiece());
  }
  for (const auto& o: vlanJson[kDhcpV6RelayOverrides].items()) {
    vlan.dhcpRelayOverridesV6[MacAddress(o.first.asString().toStdString())] =
        folly::IPAddressV6(o.second.stringPiece());
  }
  for (const auto& portInfo: vlanJson[kMemberPorts].items()) {
    vlan.ports.emplace(PortID(to<uint16_t>(portInfo.first.asString())),
          PortInfo::fromFollyDynamic(portInfo.second));
  }
  vlan.arpTable = ArpTable::fromFollyDynamic(vlanJson[kArpTable]);
  vlan.ndpTable = NdpTable::fromFollyDynamic(vlanJson[kNdpTable]);
  vlan.arpResponseTable = ArpResponseTable::fromFollyDynamic(
      vlanJson[kArpResponseTable]);
  vlan.ndpResponseTable = NdpResponseTable::fromFollyDynamic(
      vlanJson[kNdpResponseTable]);
  return vlan;
}
示例#3
0
PortID
Pass2NodeImpl::
mapToPortID(MUINT32 const nodeDataType)
{
    //hard-coded mapping
    switch(nodeDataType)
    {
        case PASS2_PRV_SRC:
        case PASS2_CAP_SRC:
            return IMGI;
            break;
        case PASS2_PRV_DST_0:
        case PASS2_CAP_DST_0:
            return WDMAO;
            break;
        case PASS2_PRV_DST_1:
        case PASS2_CAP_DST_1:
            return WROTO;
            break;
        case PASS2_PRV_DST_2:
            return IMG2O;
            break;
        case PASS2_PRV_DST_3:
            return VENC;
            break;
        case PASS2_CAP_DST_2:
            return IMG3O;
        default:
            MY_LOGE("wrong data type %d", nodeDataType);
            break;
    }
    return PortID();
}
示例#4
0
BcmRxPacket::BcmRxPacket(const opennsl_pkt_t* pkt)
  : unit_(pkt->unit) {
  // The BCM RX code always uses a single buffer.
  // As long as there is just a single buffer, we don't need to allocate
  // a separate array of opennsl_pkt_blk_t objects.
  CHECK_EQ(pkt->blk_count, 1);
  CHECK_EQ(pkt->pkt_data, &pkt->_pkt_data);

  // The BCM RX code always uses a single buffer.
  // Therefore we don't bother checking to see if we need to create a chain of
  // IOBufs rather than just one.
  CHECK_EQ(pkt->blk_count, 1);
  // The packet contains Ethernet FCS (frame check sequence) at the end before
  // interpacket gap, which we are not interested in.
  uint32_t length = std::max(pkt->pkt_len - 4, 0);
  buf_ = IOBuf::takeOwnership(
      pkt->pkt_data->data,             // void* buf
      length,
      freeRxBuf,                       // FreeFunction freeFn
      reinterpret_cast<void*>(unit_)); // void* userData

  // TODO(aeckert): fix sdk bug where the src_port is a signed 8-bit
  // int.  This causes issues when the logical port numbers exceed
  // 127. For now we work around the issue by casting to an 8-bit
  // unsigned port id, but we should fix this in the sdk.
  srcPort_ = PortID(static_cast<uint8_t>(pkt->src_port));
  srcVlan_ = VlanID(pkt->vlan);
  len_ = length;
}
示例#5
0
PortID DelegateService::unusedODPPort(const SpaceObjectReference& sor) {
    // We want to make this efficient in most cases, but need to make it
    // exhaustively search for available ports when we can't easily find a free
    // one. The approach is simple: choose a random port to start with and check
    // if it's free. From there, perform a linear search (which must wrap and
    // avoid reserved ports). This won't perform well in extreme cases where we
    // the port space is almost completely full...

    PortID starting_port_id = (rand() % (OBJECT_PORT_SYSTEM_MAX-OBJECT_PORT_SYSTEM_RESERVED_MAX)) + (OBJECT_PORT_SYSTEM_RESERVED_MAX+1);

    // If we don't have a PortMap yet, then its definitely not allocated
    PortMap* pm = getPortMap(sor);
    if (pm == NULL) return starting_port_id;

    // Loop until we hit the starting point again
    PortID port_id = starting_port_id;
    do {
        // This port may be allocated already
        PortMap::iterator it = pm->find(port_id);
        if (it == pm->end())
            return port_id;

        // Otherwise we need to move on, ensuring looping of Port IDs.
        port_id++;
        if (port_id > PortID(OBJECT_PORT_SYSTEM_MAX))
            port_id = OBJECT_PORT_SYSTEM_RESERVED_MAX+1;
    } while(port_id != starting_port_id);

    // If we get here, we're really out of ports
    SILOG(odp-delegate-service, error, "Exhausted ODP ports for " << sor);
    return PortID::null();
}
void UnresolvedNhopsProber::timeoutExpired() noexcept {
  std::lock_guard<std::mutex> g(lock_);
  auto state = sw_->getState();
  for (const auto& ridAndNhopsRefCounts : nhops2RouteCount_) {
    for (const auto& nhopAndRefCount : ridAndNhopsRefCounts.second) {
      const auto& nhop = nhopAndRefCount.first;
      auto intf = state->getInterfaces()->getInterfaceIf(nhop.intf());
      if (!intf) {
        continue; // interface got unconfigured
      }
      // Probe all nexthops for which either don't have a L2 entry
      // or the entry is not resolved (port == 0). Note that we do
      // not exclude pending entries here since in case of recursive
      // routes we might get packets with destination set to prefix
      // that needs to be resolved recursively. In ARP and NDP code
      // we do not do route lookup when deciding to send ARP/NDP requests.
      // So we would only try to ARP/NDP for the destination if it
      // is in one of the interface subnets (which it won't be else
      // we won't have needed recursive resolution). So ARP/NDP for
      // all unresolved next hops. We could also consider doing route
      // lookups in ARP/NDP code, but by probing all unresolved next
      // hops we effectively do the same thing, since the next hops
      // probed come from after the route was (recursively) resolved.
      auto vlan = state->getVlans()->getVlanIf(intf->getVlanID());
      CHECK(vlan); // must have vlan for configrued inteface
      if (nhop.addr().isV4()) {
        auto nhop4 = nhop.addr().asV4();
        auto arpEntry = vlan->getArpTable()->getEntryIf(nhop4);
        if (!arpEntry || arpEntry->getPort() == PortID(0)) {
          VLOG(3) <<" Sending probe for unresolved next hop: " << nhop4;
          ArpHandler::sendArpRequest(sw_, vlan, nhop4);
        }
      } else {
        auto nhop6 = nhop.addr().asV6();
        auto ndpEntry = vlan->getNdpTable()->getEntryIf(nhop6);
        if (!ndpEntry || ndpEntry->getPort() == PortID(0)) {
          VLOG(3) <<" Sending probe for unresolved next hop: " << nhop6;
          IPv6Handler::sendNeighborSolicitation(sw_, nhop6, vlan);
        }
      }
    }
  }
  scheduleTimeout(interval_);
}
示例#7
0
std::pair<std::shared_ptr<SwitchState>, BootType>
SimSwitch::init(HwSwitch::Callback* callback) {
  callback_ = callback;

  auto state = make_shared<SwitchState>();
  for (uint32_t idx = 1; idx <= numPorts_; ++idx) {
    auto name = folly::to<string>("Port", idx);
    state->registerPort(PortID(idx), name);
  }
  return std::make_pair(state, BootType::COLD_BOOT);
}
示例#8
0
文件: Port.cpp 项目: StoutSec/fboss
PortFields PortFields::fromFollyDynamic(const folly::dynamic& portJson) {
  PortFields port(PortID(portJson[kPortId].asInt()),
      portJson[kPortName].asString().toStdString());
  auto itr_state  = cfg::_PortState_NAMES_TO_VALUES.find(
      portJson[kPortState].asString().c_str());
  CHECK(itr_state != cfg::_PortState_NAMES_TO_VALUES.end());
  port.state = cfg::PortState(itr_state->second);
  port.ingressVlan = VlanID(portJson[kIngressVlan].asInt());
  auto itr_speed  = cfg::_PortSpeed_NAMES_TO_VALUES.find(
      portJson[kPortSpeed].asString().c_str());
  CHECK(itr_speed != cfg::_PortSpeed_NAMES_TO_VALUES.end());
  port.speed = cfg::PortSpeed(itr_speed->second);
  for (const auto& vlanInfo: portJson[kVlanMemberships].items()) {
    port.vlans.emplace(VlanID(to<uint32_t>(vlanInfo.first.asString())),
      VlanInfo::fromFollyDynamic(vlanInfo.second));
  }
  return port;
}
示例#9
0
BcmRxPacket::BcmRxPacket(const opennsl_pkt_t* pkt)
  : unit_(pkt->unit) {
  // The BCM RX code always uses a single buffer.
  // As long as there is just a single buffer, we don't need to allocate
  // a separate array of opennsl_pkt_blk_t objects.
  CHECK_EQ(pkt->blk_count, 1);
  CHECK_EQ(pkt->pkt_data, &pkt->_pkt_data);

  // The BCM RX code always uses a single buffer.
  // Therefore we don't bother checking to see if we need to create a chain of
  // IOBufs rather than just one.
  CHECK_EQ(pkt->blk_count, 1);
  buf_ = IOBuf::takeOwnership(
      pkt->pkt_data->data,             // void* buf
      pkt->pkt_len,                    // uint32_t capacity
      freeRxBuf,                       // FreeFunction freeFn
      reinterpret_cast<void*>(unit_)); // void* userData
  srcPort_ = PortID(pkt->src_port);
  srcVlan_ = VlanID(pkt->vlan);
  len_ = pkt->pkt_len;
}
示例#10
0
BcmRxPacket::BcmRxPacket(const opennsl_pkt_t* pkt)
  : unit_(pkt->unit) {
  // The BCM RX code always uses a single buffer.
  // As long as there is just a single buffer, we don't need to allocate
  // a separate array of opennsl_pkt_blk_t objects.
  CHECK_EQ(pkt->blk_count, 1);
  CHECK_EQ(pkt->pkt_data, &pkt->_pkt_data);

  // The packet contains Ethernet FCS (frame check sequence) at the end before
  // interpacket gap, which we are not interested in.
  uint32_t length = std::max(pkt->pkt_len - 4, 0);
  buf_ = IOBuf::takeOwnership(
      pkt->pkt_data->data,             // void* buf
      length,
      freeRxBuf,                       // FreeFunction freeFn
      reinterpret_cast<void*>(unit_)); // void* userData

  srcPort_ = PortID(pkt->src_port);
  srcVlan_ = VlanID(pkt->vlan);
  len_ = length;
}
示例#11
0
PortID
StereoNodeImpl::
mapToPortID(MUINT32 const nodeDataType)
{
    //hard-coded mapping
    switch(nodeDataType)
    {
        case STEREO_SRC:
            return IMGI;
            break;
        case STEREO_IMG:
            return IMG3O;
            break;
        case STEREO_FEO:
            return FEO;
            break;
        case STEREO_RGB:
            return WDMAO;
        default:
            break;
    }
    return PortID();
}
MBOOL
ImageTransform::
execute(
    ImgBufInfo const rSrcBufInfo, 
    ImgBufInfo const rDstBufInfo, 
    Rect const rROI, 
    MUINT32 const u4Rotation, 
    MUINT32 const u4Flip, 
    MUINT32 const u4TimeOutInMs
)
{
    FUNCTION_LOG_START;
    MtkCamUtils::CamProfile profile("execute", "ImageTransform");
    if (!lock(u4TimeOutInMs)) 
    {
        MY_LOGE("[execute] lock fail "); 
        return MFALSE; 
    }
    // (1). Create Instance 
#warning [TODO] sensor type ??? 
    ICdpPipe    *pCdpPipe = ICdpPipe::createInstance(eSWScenarioID_CAPTURE_NORMAL, eScenarioFmt_RAW); 
    CHECK_OBJECT(pCdpPipe); 
    //
    if (pCdpPipe != NULL) 
    {
        MY_LOGD("Pipe (Name, ID) = (%s, %d)", pCdpPipe->getPipeName(), pCdpPipe->getPipeId()); 
    }
    
    // (2). Query port property
    vector<PortProperty> rInPortProperty; 
    vector<PortProperty> rOutPortProperty;     
    if (pCdpPipe->queryPipeProperty(rInPortProperty,rOutPortProperty))
    {
        MY_LOGD("Port Property (IN, OUT): (%d, %d)", rInPortProperty.size(), rOutPortProperty.size()); 
        for (MUINT32 i = 0; i < rInPortProperty.size(); i++)
        {
            MY_LOGD("IN: (type, index, inout, fmt, rot, flip) = (%d, %d, %d, %d, %d, %d)", 
                         rInPortProperty.at(i).type, rInPortProperty.at(i).index, rInPortProperty.at(i).inout,  
                         rInPortProperty.at(i).u4SupportFmt, rInPortProperty.at(i).fgIsSupportRotate, rInPortProperty.at(i).fgIsSupportFlip); 
        }       
        for (MUINT32 i = 0; i < rOutPortProperty.size(); i++)
        {
            MY_LOGD("IN: (type, index, inout, fmt, rot, flip) = (%d, %d, %d, %d, %d, %d)", 
                         rOutPortProperty.at(i).type, rOutPortProperty.at(i).index, rOutPortProperty.at(i).inout,  
                         rOutPortProperty.at(i).u4SupportFmt, rOutPortProperty.at(i).fgIsSupportRotate, rOutPortProperty.at(i).fgIsSupportFlip); 
        } 
    }    

    // (3). init 
    pCdpPipe->init(); 

    // (4). setCallback
    pCdpPipe->setCallbacks(NULL, NULL, NULL); 

    // (5). Config pipe 
    // 
    MemoryInPortInfo rMemInPort(ImgInfo(rSrcBufInfo.eImgFmt, rSrcBufInfo.u4ImgWidth, rSrcBufInfo.u4ImgHeight), 
                                0, rSrcBufInfo.u4Stride, Rect(rROI.x, rROI.y, rROI.w, rROI.h)); 
    //   
    MemoryOutPortInfo rVdoPort(ImgInfo(rDstBufInfo.eImgFmt, rDstBufInfo.u4ImgWidth, rDstBufInfo.u4ImgHeight), 
                               rDstBufInfo.u4Stride, u4Rotation, u4Flip);   
    rVdoPort.index = 1;   
    //
    vector<PortInfo const*> vCdpInPorts;  
    vector<PortInfo const*> vCdpOutPorts; 
    //
    vCdpInPorts.push_back(&rMemInPort); 
    vCdpOutPorts.push_back(&rVdoPort); 
    //
    pCdpPipe->configPipe(vCdpInPorts, vCdpOutPorts); 

    // (6). Enqueue, In buf
    // 
    QBufInfo rInBuf; 
    rInBuf.vBufInfo.clear(); 
    BufInfo rBufInfo(rSrcBufInfo.u4BufSize, rSrcBufInfo.u4BufVA, rSrcBufInfo.u4BufPA, rSrcBufInfo.i4MemID);  
    rInBuf.vBufInfo.push_back(rBufInfo); 
    pCdpPipe->enqueBuf(PortID(EPortType_MemoryIn, 0, 0), rInBuf); 
    // 
    QBufInfo rOutBuf; 
    rOutBuf.vBufInfo.clear(); 
    rBufInfo.u4BufSize = rDstBufInfo.u4BufSize; 
    rBufInfo.u4BufVA = rDstBufInfo.u4BufVA; 
    rBufInfo.u4BufPA = rDstBufInfo.u4BufPA; 
    rBufInfo.i4MemID = rDstBufInfo.i4MemID; 
    //rBufInfo.eMemType = rDstBufInfo.eMemType;
    rOutBuf.vBufInfo.push_back(rBufInfo); 
    pCdpPipe->enqueBuf(PortID(EPortType_MemoryOut, 1, 1), rOutBuf); 
    // 
    profile.print(); 
    // (7). start
    pCdpPipe->start(); 

    // (8). Dequeue Vdo Out Buf 
    QTimeStampBufInfo rQVdoOutBuf; 
    pCdpPipe->dequeBuf(PortID(EPortType_MemoryOut, 1, 1), rQVdoOutBuf); 
    // (8.1) Dequeue In Buf 
    QTimeStampBufInfo rQInBUf; 
    pCdpPipe->dequeBuf(PortID(EPortType_MemoryIn, 0, 0), rQInBUf); 
 
    // (9). Stop 
    pCdpPipe->stop();
    // (10). uninit 
    pCdpPipe->uninit(); 
    // (11). destory instance 
    pCdpPipe->destroyInstance(); 
    unlock(); 
    profile.print(); 
    //
    return 0; 
}
示例#13
0
文件: Vlan.cpp 项目: Gardenya/fboss
void Vlan::addPort(PortID id, bool tagged) {
  writableFields()->ports.insert(make_pair(id, PortID(tagged)));
}
示例#14
0
PortID PortID::operator++ (int) {
    return PortID(mValue++);

}
MBOOL
ImageTransform::
execute(
    ImgBufInfo const rSrcBufInfo, 
    ImgBufInfo const rDstBufInfo, 
    Rect const rROI, 
    MUINT32 const u4Rotation, 
    MUINT32 const u4Flip, 
    MUINT32 const u4TimeOutInMs
)
{
#define CHECK_RET(x, str)                            \
    do{                                              \
        if ( !(ret) ){                               \
            MY_LOGE("fail at %s", str);              \
            if( bInit )                              \
            {                                        \
                pXdpPipe->uninit();                  \
            }                                        \
            if( pXdpPipe )                           \
            {                                        \
                pXdpPipe->destroyInstance();         \
            }                                        \
            unlock();                                \
            return MFALSE;                           \
        }                                            \
    }while(0)

    FUNCTION_LOG_START;
    MtkCamUtils::CamProfile profile("execute", "ImageTransform");
    if (!lock(u4TimeOutInMs)) 
    {
        MY_LOGE("[execute] lock fail "); 
        return MFALSE; 
    }
    MBOOL ret = MTRUE;
    MBOOL bInit = MFALSE;
    // (1). Create Instance 
#warning [TODO] sensor type ??? 
    IXdpPipe    *pXdpPipe = IXdpPipe::createInstance(eSWScenarioID_CAPTURE_NORMAL, eScenarioFmt_RAW); //eScenarioFmt_RAW is never used? 
    CHECK_OBJECT(pXdpPipe); 
    //
    if (pXdpPipe != NULL) 
    {
        MY_LOGD("Pipe (Name, ID) = (%s, %d)", pXdpPipe->getPipeName(), pXdpPipe->getPipeId()); 
    }
    
    // (2). Query port property
    //vector<PortProperty> rInPortProperty; 
    //vector<PortProperty> rOutPortProperty;     
    //if (pXdpPipe->queryPipeProperty(rInPortProperty,rOutPortProperty))
    //{
    //    MY_LOGD("Port Property (IN, OUT): (%d, %d)", rInPortProperty.size(), rOutPortProperty.size()); 
    //    for (MUINT32 i = 0; i < rInPortProperty.size(); i++)
    //    {
    //        MY_LOGD("IN: (type, index, inout, fmt, rot, flip) = (%d, %d, %d, %d, %d, %d)", 
    //                     rInPortProperty.at(i).type, rInPortProperty.at(i).index, rInPortProperty.at(i).inout,  
    //                     rInPortProperty.at(i).u4SupportFmt, rInPortProperty.at(i).fgIsSupportRotate, rInPortProperty.at(i).fgIsSupportFlip); 
    //    }       
    //    for (MUINT32 i = 0; i < rOutPortProperty.size(); i++)
    //    {
    //        MY_LOGD("IN: (type, index, inout, fmt, rot, flip) = (%d, %d, %d, %d, %d, %d)", 
    //                     rOutPortProperty.at(i).type, rOutPortProperty.at(i).index, rOutPortProperty.at(i).inout,  
    //                     rOutPortProperty.at(i).u4SupportFmt, rOutPortProperty.at(i).fgIsSupportRotate, rOutPortProperty.at(i).fgIsSupportFlip); 
    //    } 
    //}    

    // (3). init 
    ret = pXdpPipe->init(); 
    CHECK_RET(ret,"init");
    bInit = MTRUE;

    // (4). setCallback
    pXdpPipe->setCallbacks(NULL, NULL, NULL); 

    // (5). Config pipe 
    // 
    MemoryInPortInfo rMemInPort(ImgInfo(rSrcBufInfo.eImgFmt, rSrcBufInfo.u4ImgWidth, rSrcBufInfo.u4ImgHeight), 
                                0, rSrcBufInfo.u4Stride, Rect(rROI.x, rROI.y, rROI.w, rROI.h)); 
    //   
    MemoryOutPortInfo rVdoPort(ImgInfo(rDstBufInfo.eImgFmt, rDstBufInfo.u4ImgWidth, rDstBufInfo.u4ImgHeight), 
                               rDstBufInfo.u4Stride, u4Rotation, u4Flip);   
    rVdoPort.index = 1;   
    //
    vector<PortInfo const*> vXdpInPorts;  
    vector<PortInfo const*> vXdpOutPorts; 
    //
    vXdpInPorts.push_back(&rMemInPort); 
    vXdpOutPorts.push_back(&rVdoPort); 
    //
    ret = pXdpPipe->configPipe(vXdpInPorts, vXdpOutPorts); 
    CHECK_RET(ret,"config");

    // (6). Enqueue, In buf
    // 
    QBufInfo rInBuf; 
    rInBuf.vBufInfo.clear(); 
    BufInfo rBufInfo(rSrcBufInfo.u4BufSize, rSrcBufInfo.u4BufVA, rSrcBufInfo.u4BufPA, rSrcBufInfo.i4MemID);  
    rInBuf.vBufInfo.push_back(rBufInfo); 
    ret = pXdpPipe->enqueBuf(PortID(EPortType_MemoryIn, 0, 0), rInBuf); 
    // 
    QBufInfo rOutBuf; 
    rOutBuf.vBufInfo.clear(); 
    rBufInfo.u4BufSize = rDstBufInfo.u4BufSize; 
    rBufInfo.u4BufVA = rDstBufInfo.u4BufVA; 
    rBufInfo.u4BufPA = rDstBufInfo.u4BufPA; 
    rBufInfo.i4MemID = rDstBufInfo.i4MemID; 
    //rBufInfo.eMemType = rDstBufInfo.eMemType;
    rOutBuf.vBufInfo.push_back(rBufInfo); 
    ret = pXdpPipe->enqueBuf(PortID(EPortType_MemoryOut, 1, 1), rOutBuf); 
    CHECK_RET(ret,"enqueBuf");
    // 
    profile.print(); 
    // (7). start
    ret = pXdpPipe->start(); 
    CHECK_RET(ret,"start");

    // (8). Dequeue Vdo Out Buf 
    QTimeStampBufInfo rQVdoOutBuf; 
    ret = pXdpPipe->dequeBuf(PortID(EPortType_MemoryOut, 1, 1), rQVdoOutBuf); 
    CHECK_RET(ret,"dequeBuf");
    // (8.1) Dequeue In Buf 
    QTimeStampBufInfo rQInBUf; 
    ret = pXdpPipe->dequeBuf(PortID(EPortType_MemoryIn, 0, 0), rQInBUf); 
    CHECK_RET(ret,"dequeBuf");
 
    // (9). Stop 
    ret = pXdpPipe->stop();
    CHECK_RET(ret,"stop");
#undef CHECK_RET
    // (10). uninit 
    if( bInit )
    {
        ret = pXdpPipe->uninit(); 
        if( !ret )
        {
            if( pXdpPipe )
            {
                pXdpPipe->destroyInstance(); 
            }
            return MFALSE;
        }
    }
    // (11). destory instance 
    if( pXdpPipe )
    {
        pXdpPipe->destroyInstance(); 
    }

    ret = unlock(); 
    profile.print(); 
    //
    return ret; 
}
示例#16
0
MBOOL
StereoNodeImpl::
handleP2Done(QParams& rParams)
{
    CAM_TRACE_CALL();
    CAM_TRACE_FMT_BEGIN("deqP2:%d", muDeqFrameCnt);
    MBOOL ret = MFALSE;
    MBOOL isZoom = (rParams.mvCropRsInfo[0].mCropRect.p_integral.x != 0) ? MTRUE : MFALSE;
    Vector<Input>::const_iterator iterIn;
    Vector<Output>::const_iterator iterOut;
    Vector<ModuleInfo>::const_iterator iterMInfo;
    //
    MY_LOGD("cnt %d in(%d) out(%d) moduleData(%d) isZoom(%d)",
            muDeqFrameCnt,
            rParams.mvIn.size(),
            rParams.mvOut.size(),
            rParams.mvModuleData.size(),
            isZoom);
    //
    if( !mpIspSyncCtrlHw->unlockHw(IspSyncControlHw::HW_PASS2) )
    {
        MY_LOGE("isp sync unlock pass2 failed");
        goto lbExit;
    }
    //
    for( iterIn = rParams.mvIn.begin(); iterIn != rParams.mvIn.end(); iterIn++ )
    {
        PortID portId = iterIn->mPortID;
        portId.group = 0;
        MUINT32 nodeDataType = mapToNodeDataType( portId );
        MY_LOGD("In PortID(0x%08X), nodeData(%d)",portId, nodeDataType);
        handleReturnBuffer( nodeDataType, (MUINTPTR)iterIn->mBuffer);
    }
    //
    for( iterOut = rParams.mvOut.begin(); iterOut != rParams.mvOut.end(); iterOut++ )
    {
        PortID portId = iterOut->mPortID;
        portId.group = 0;
        MUINT32 nodeDataType = mapToNodeDataType( portId );
        MY_LOGD("Out PortID(0x%08X), nodeData(%d), bufInfo(0x%x), va/pa(0x%x/0x%x), ID(%d)",
                portId, nodeDataType, iterOut->mBuffer, iterOut->mBuffer->getBufVA(0), iterOut->mBuffer->getBufPA(0), iterOut->mBuffer->getFD());
        handlePostBuffer( nodeDataType, (MUINTPTR)iterOut->mBuffer, (MUINT32)isZoom );
    }
    for( iterMInfo = rParams.mvModuleData.begin(); iterMInfo != rParams.mvModuleData.end(); iterMInfo++ )
    {
        if ( iterMInfo->moduleTag == EFeatureModule_STA_FEO )
        {
            StaData* pModuleData = reinterpret_cast<StaData*>(iterMInfo->moduleStruct);
            PortID portId = PortID((EPortType)pModuleData->port_type, pModuleData->port_idx, pModuleData->port_inout);
            portId.group = 0;
            MUINT32 nodeDataType = mapToNodeDataType( portId );
            MY_LOGD("ModuleInfo PortID(0x%08X), nodeData(%d), bufInfo(0x%x), va/pa(0x%x/0x%x), ID(%d)",
                    portId, nodeDataType, &(pModuleData->bufInfo), pModuleData->bufInfo.virtAddr, pModuleData->bufInfo.phyAddr, pModuleData->bufInfo.memID);
            handlePostBuffer( nodeDataType, (MUINTPTR)&pModuleData->bufInfo, (MUINT32)isZoom );
        }
    }
    //
    {
        Mutex::Autolock lock(mLock);
        muDeqFrameCnt++;
        mCondDeque.broadcast();
    }
    //
    ret = MTRUE;
lbExit:
    CAM_TRACE_FMT_END();
    return ret;

}
示例#17
0
PortID WedgePlatform::fbossPortForQsfpChannel(int transceiver, int channel) {
  return PortID(transceiver * QsfpModule::CHANNEL_COUNT + channel + 1);
}