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

C++ LOG_INFO函数代码示例

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

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



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

示例1: soc_i2c_probe

/*
 * Function: soc_i2c_probe
 * Purpose: Probe I2C devices on bus, report devices found.
 *          This routine will walk through our internal I2C device driver
 *          tables, attempt to find the device on the I2C bus, and if
 *          successful, register a device driver for that device.
 *
 *          This allows for the device to be used in an API context as
 *          when the devices are found, the device driver table is filled
 *          with the correct entries for that device (r/w function, etc).
 *
 * Parameters:
 *	unit - StrataSwitch device number or I2C bus number
 *
 * Return:
 *	count of found devices or SOC_E_***
 */
int
soc_i2c_probe(int unit)
{
    _soc_i2c_probe_info_t i2c_probe_info;
    int			devid;
    int                 rv;
    int			mux_devid;
    uint8               mux_data;

    /* Make sure that we're already attached, or go get attached */
    if (!soc_i2c_is_attached(unit)) {
	return soc_i2c_attach(unit, 0, 0);
    }

    /* Check for supported I2c devices */
    if (NUM_I2C_DEVICES > MAX_I2C_DEVICES) {
        LOG_INFO(BSL_LS_SOC_I2C,
                 (BSL_META_U(unit,
                             "ERROR: %d exceeds supported I2C devices\n"),
                  NUM_I2C_DEVICES ));
        return SOC_E_INTERNAL;
    }

    i2c_probe_info.i2cbus = I2CBUS(unit);

    LOG_INFO(BSL_LS_SOC_I2C,
             (BSL_META_U(unit,
                         "unit %d i2c: probing %d I2C devices.\n"),
              unit, NUM_I2C_DEVICES));

    /* Attempt to contact known slave devices, hookup driver and
     * run device init function if the device exists, otherwise
     * simply acknowledge the device can be found.
     */

    i2c_probe_info.i2c_nvram_skip =
        soc_property_get(unit, spn_I2C_NVRAM_SKIP, 0);
    i2c_probe_info.i2c_hclk_skip =
        soc_property_get(unit, spn_I2C_HCLK_SKIP, 0);
    i2c_probe_info.i2c_poe_power =
        soc_property_get(unit, spn_I2C_POE_POWER, 0);

    i2c_probe_info.devid_found = 0; /* Installed I2C device types */
    i2c_probe_info.devices_found = 0; /* Number of installed I2C devices */

    /* Initialize device table with none found. */
    for (devid = 0; devid < NUM_I2C_DEVICES; devid++) {
        /* I2C device not present */
        i2c_probe_info.i2cbus->devs[devid] = NULL;
        i2c_probe_info.i2c_muxed_devid_count[devid] = 0;
        i2c_probe_info.i2c_mux_stack[devid] = -1;
    }
    i2c_probe_info.i2c_mux_stack_depth = 0;

    /* First, disable all visible MUX's. */
    for (mux_devid = 0; mux_devid < NUM_I2C_DEVICES; mux_devid++) {
        if (i2c_devices[mux_devid].driver != &_soc_i2c_pca9548_driver) {
            /* Only the MUX's are interesting here. */
            continue;
        }
        i2c_probe_info.devid = mux_devid;
        rv = _soc_i2c_probe_device(unit, FALSE, &i2c_probe_info);
        if (SOC_E_EXISTS == rv) {
            mux_data = 0; /* Shut down ALL channels */
            if ((rv = i2c_devices[mux_devid].driver->write(unit, mux_devid,
                                             0, &mux_data, 1)) < 0) {
                LOG_INFO(BSL_LS_SOC_I2C,
                         (BSL_META_U(unit,
                                     "unit %d i2c: Could not disable channels on %s\n"),
                          unit, i2c_devices[mux_devid].devname));
                return rv;
            } else {
                /* MUX disabled */
                rv = SOC_E_NONE;
            }
        } else if ((SOC_E_NOT_FOUND == rv) || (SOC_E_INIT == rv)) {
            /* No error */
            rv = SOC_E_NONE;
        } else if (SOC_FAILURE(rv)) {
            /* Access error */
            return rv;
        }
    }
//.........这里部分代码省略.........
开发者ID:ariavie,项目名称:bcm,代码行数:101,代码来源:devs.c


示例2: LOG_INFO

void UpdaterPrivate::LaunchUI() {
    LOG_INFO(Frontend, "Launching update UI...");
    LaunchWithArguments(run_arguments);
}
开发者ID:Dragios,项目名称:Citra,代码行数:4,代码来源:updater.cpp


示例3: node_id_

View::View(node_id_t node_id, std::string cf) 
  : node_id_(node_id), master_id_(0), period_(500) {

  LOG_INFO("loading config file %s ...", cf.c_str());
	
	YAML::Node config;

  if (cf.empty()) {
    // default only one node
	  config = YAML::LoadFile("config/localhost-1.yaml");
    node_id_ = 0;
  } else {
	  config = YAML::LoadFile(cf);
  }
  if (config == NULL) {
    printf("cannot open config file: %s.", cf.c_str());
  }

	YAML::Node nodes = config["host"];
  YAML::Node lease = config["lease"];

  for (std::size_t i = 0; i < nodes.size(); i++) {

		YAML::Node node = nodes[i];

		std::string name = node["name"].as<std::string>();
		std::string addr = node["addr"].as<std::string>();
    uint32_t port = node["port"].as<int>();
    // set a node in view
    host_info_t host_info = host_info_t(name, addr, port);
    host_nodes_.push_back(host_info);
  }
    
  size_ = host_nodes_.size();

  if (lease) {
    master_id_ = lease["master_id"].as<int>();
    period_ = lease["period"].as<int>();
  } else {
    LOG_INFO("No lease Node Found, using default master_id/0 period/500");
  }
  
  #if MODE_TYPE == 1
  YAML::Node rs = config["rs"];
  if (rs) {
    rs_x_ = rs["x"].as<int>();
    rs_n_ = rs["n"].as<int>();
    rs_qr_ = rs["qr"].as<int>();
    rs_qw_ = rs["qw"].as<int>();
    rs_f_ = rs["f"].as<int>();
  } else {
    LOG_INFO("No RS Node Found!!, using Default function to compute");
    rs_n_ = size_;
    if (rs_n_ == 1) {
      rs_x_ = 1;
    } else {
      if (rs_n_ % 2 == 0) {
        rs_x_ = 2;
      } else {
        rs_x_ = 3;
      } 
    }
    rs_qr_ = (rs_n_ + rs_x_) / 2;
    rs_qw_ = rs_qr_;
    rs_f_ = rs_n_ - rs_qr_;
  }  
  #endif


  if (node_id_ >= size_) {
    std::cout << "Node_Id " << node_id_ << " > host_nodes_.size " << size_ << "Invalid!" << std::endl;
    std::cout << "Set Node_Id = 0" << std::endl;
    node_id_ = 0;
  }
  LOG_INFO("config file loaded");
 
}
开发者ID:tempbottle,项目名称:PurePaxos,代码行数:77,代码来源:view.cpp


示例4: LOG_WARNING

void ReplicatedMergeTreePartCheckThread::checkPart(const String & part_name)
{
    LOG_WARNING(log, "Checking part " << part_name);
    ProfileEvents::increment(ProfileEvents::ReplicatedPartChecks);

    /// If the part is still in the PreCommitted -> Committed transition, it is not lost
    /// and there is no need to go searching for it on other replicas. To definitely find the needed part
    /// if it exists (or a part containing it) we first search among the PreCommitted parts.
    auto part = storage.data.getPartIfExists(part_name, {MergeTreeDataPartState::PreCommitted});
    if (!part)
        part = storage.data.getActiveContainingPart(part_name);

    /// We do not have this or a covering part.
    if (!part)
    {
        searchForMissingPart(part_name);
    }
    /// We have this part, and it's active. We will check whether we need this part and whether it has the right data.
    else if (part->name == part_name)
    {
        auto zookeeper = storage.getZooKeeper();
        auto table_lock = storage.lockStructure(false, __PRETTY_FUNCTION__);

        /// If the part is in ZooKeeper, check its data with its checksums, and them with ZooKeeper.
        if (zookeeper->exists(storage.replica_path + "/parts/" + part_name))
        {
            LOG_WARNING(log, "Checking data of part " << part_name << ".");

            try
            {
                auto zk_checksums = MinimalisticDataPartChecksums::deserializeFrom(
                    zookeeper->get(storage.replica_path + "/parts/" + part_name + "/checksums"));
                zk_checksums.checkEqual(part->checksums, true);

                auto zk_columns = NamesAndTypesList::parse(
                    zookeeper->get(storage.replica_path + "/parts/" + part_name + "/columns"));
                if (part->columns != zk_columns)
                    throw Exception("Columns of local part " + part_name + " are different from ZooKeeper");

                checkDataPart(
                    storage.data.getFullPath() + part_name,
                    storage.data.index_granularity,
                    true,
                    storage.data.primary_key_data_types,
                    [this] { return need_stop.load(); });

                if (need_stop)
                {
                    LOG_INFO(log, "Checking part was cancelled.");
                    return;
                }

                LOG_INFO(log, "Part " << part_name << " looks good.");
            }
            catch (const Exception & e)
            {
                /// TODO Better to check error code.

                tryLogCurrentException(log, __PRETTY_FUNCTION__);

                LOG_ERROR(log, "Part " << part_name << " looks broken. Removing it and queueing a fetch.");
                ProfileEvents::increment(ProfileEvents::ReplicatedPartChecksFailed);

                storage.removePartAndEnqueueFetch(part_name);

                /// Delete part locally.
                storage.data.forgetPartAndMoveToDetached(part, "broken_");
            }
        }
        else if (part->modification_time + MAX_AGE_OF_LOCAL_PART_THAT_WASNT_ADDED_TO_ZOOKEEPER < time(nullptr))
        {
            /// If the part is not in ZooKeeper, delete it locally.
            /// Probably, someone just wrote down the part, and has not yet added to ZK.
            /// Therefore, delete only if the part is old (not very reliable).
            ProfileEvents::increment(ProfileEvents::ReplicatedPartChecksFailed);

            LOG_ERROR(log, "Unexpected part " << part_name << " in filesystem. Removing.");
            storage.data.forgetPartAndMoveToDetached(part, "unexpected_");
        }
        else
        {
            /// TODO You need to make sure that the part is still checked after a while.
            /// Otherwise, it's possible that the part was not added to ZK,
            ///  but remained in the filesystem and in a number of active parts.
            /// And then for a long time (before restarting), the data on the replicas will be different.

            LOG_TRACE(log, "Young part " << part_name
                << " with age " << (time(nullptr) - part->modification_time)
                << " seconds hasn't been added to ZooKeeper yet. It's ok.");
        }
    }
    else
    {
        /// If we have a covering part, ignore all the problems with this part.
        /// In the worst case, errors will still appear `old_parts_lifetime` seconds in error log until the part is removed as the old one.
        LOG_WARNING(log, "We have part " << part->name << " covering part " << part_name);
    }
}
开发者ID:kellylg,项目名称:ClickHouse,代码行数:98,代码来源:ReplicatedMergeTreePartCheckThread.cpp


示例5: FaceData

	bool WaveformObjImporter::convertToPropellerModel(String filename, ModelStream &stream)
	{
		struct Float3
		{
			float v[3];
		};

		struct FaceData
		{
			FaceData() {}
			FaceData(unsigned vertexIndex, unsigned texCoordIndex, unsigned normalIndex)
				: vertexIndex(vertexIndex)
				, texCoordIndex(texCoordIndex)
				, normalIndex(normalIndex)
			{ }

			unsigned vertexIndex;
			unsigned texCoordIndex;
			unsigned normalIndex;
		};

		struct Face
		{
			FaceData v[3];
		};

		LOG_INFO("importing file from .obj!");

		std::ifstream file(filename); //HACK: Editor is windows only, not using wrappers

		if (!file.is_open())
			return false;

		std::vector<Float3> objVertices;
		std::vector<Float3> objTexCoords;
		std::vector<Float3> objNormals;
		std::vector<Face> objFaces;

		String line;
		while (std::getline(file, line))
		{
			if (line.substr(0, 1) == "#")
				continue; // comment

			if (line.substr(0, 2) == "v ")
			{
				std::vector<String> parts;
				engine::util::explode(&parts, line, ' ');

				Float3 f3;


				f3.v[0] = boost::lexical_cast<float>(parts[1]);
				f3.v[1] = boost::lexical_cast<float>(parts[2]);
				f3.v[2] = boost::lexical_cast<float>(parts[3]);

				objVertices.push_back(f3);
				continue;
			}

			if (line.substr(0, 3) == "vn ")
			{
				std::vector<String> parts;
				engine::util::explode(&parts, line, ' ');

				Float3 f3;

				f3.v[0] = boost::lexical_cast<float>(parts[1]);
				f3.v[1] = boost::lexical_cast<float>(parts[2]);
				f3.v[2] = boost::lexical_cast<float>(parts[3]);

				objNormals.push_back(f3);
				continue;
			}

			if (line.substr(0, 3) == "vt ")
			{
				std::vector<String> parts;
				engine::util::explode(&parts, line, ' ');

				Float3 f3;

				f3.v[0] = boost::lexical_cast<float>(parts[1]);
				f3.v[1] = boost::lexical_cast<float>(parts[2]);
				f3.v[2] = boost::lexical_cast<float>(parts[3]);

				objTexCoords.push_back(f3);
				continue;
			}

			if (line.substr(0, 2) == "f ")
			{
				std::vector<String> parts;
				engine::util::explode(&parts, line, ' ');

				String faceStrings[3];

				faceStrings[0] = parts[1];
				faceStrings[1] = parts[2];
				faceStrings[2] = parts[3];
//.........这里部分代码省略.........
开发者ID:LauriM,项目名称:PropellerEngine,代码行数:101,代码来源:WaveformObjImporter.cpp


示例6: fprintf

int CCB::deactivate(const char *msisdn)
{
    fprintf(stdout, "Deactivate... svc_url: %s, msisdn: %s\n", _svc_url.c_str(), msisdn);
    LOG_INFO("CCB::deactivate: svc_url: %s, msisdn: %s", _svc_url.c_str(), msisdn);
    return 0;
}
开发者ID:zand3rs,项目名称:fun2,代码行数:6,代码来源:ccb.cpp


示例7: socend_receive

bcm_rx_t
socend_receive(int unit, bcm_pkt_t *pkt, void *cookie)
{
#define OK_REASON ((uint32)(-1))
    
    /*
     * Was: 
     *      (DMAS1_OP_IPSW | DMAS1_OP_IPINF | DMAS1_OP_IPMC |       \
     *       DMAS1_OP_TTL | BCM_PMUX_PR_DEFIP | BCM_PMUX_PR_COSMK | \
     *       DMAS1_OP_BCA)
     */

    int pkt_rv = BCM_RX_NOT_HANDLED;
    int rv;
    int enqueue = TRUE;

    if (pkt->rx_reason  & ~OK_REASON) {
        return BCM_RX_NOT_HANDLED;
    }

    /* Check VLAN for match; Check dest MAC for match; check for bcast */

    if (snoop_ip_rx != NULL) {
        pkt_rv = snoop_ip_rx(unit, pkt, &enqueue);
    }

    if (pkt_rv == BCM_RX_NOT_HANDLED && enqueue) {
        if (SOC_IS_ESW(unit)) {
            rv = netJobAdd((FUNCPTR)socend_receive_netjob,
                       (int)cookie,
                       (int)pkt->pkt_data[0].data,
                       (int)pkt->pkt_len,
                       4,
                       5);
            pkt_rv = ((rv == OK) ? BCM_RX_HANDLED_OWNED : BCM_RX_NOT_HANDLED);
        } else {
            char *packet;

            socend_packet_alloc(unit, SOC_END_PK_SZ, 0, (void *)&packet);
            if (NULL == packet){
                LOG_INFO(BSL_LS_SYS_END,
                         (BSL_META_U(unit,
                                     "failed to allocate buffer with socend_packet_alloc\n")));
                return BCM_RX_NOT_HANDLED;
            } 
            sal_memset(packet, 0x0, SOC_END_PK_SZ);
            sal_memcpy(packet, (unsigned char *)pkt->pkt_data[0].data, 
                         pkt->pkt_len);
            rv = netJobAdd((FUNCPTR)socend_receive_netjob,
                       (int)cookie,
                       (int)packet,
                       (int)pkt->pkt_len,
                       4,
                       5);
            LOG_INFO(BSL_LS_SYS_END,
                     (BSL_META_U(unit,
                                 "netJobAdd rv=0x%x OK=%x\n"), rv, OK));
            pkt_rv = BCM_RX_HANDLED;
        }
    }

    return pkt_rv;
}
开发者ID:ariavie,项目名称:bcm,代码行数:63,代码来源:socend.c


示例8: socend_mempool_alloc

static	STATUS
socend_mempool_alloc(socend_t *se, int pksize, int clblks, int cl, int mblks)
/*
 * Function: 	socend_mempool_alloc
 * Purpose:	Initialize END memory pools for the specified SOC.
 * Parameters:	u - unit number to initialize.
 *		pksize - Packet size to use, MUST BE MTU size or greater.
 *		clblks - number of cluster block headers this unit
 *		cl - number of actual cluster buffers this unit.
 *		mblks - number of mblks this unit.
 *
 * Returns:	OK or error if failed.
 * Notes:	If already initialized, nothing is done.
 */
{
    seu_t	*seu = &socend_seu[se->se_unit];

    LOG_INFO(BSL_LS_SYS_END,
             (BSL_META("socend_mempool_alloc: Unit %d %sinitialized\n"),
              se->se_unit, seu->seu_init ? "" : "not "));
    /*
     * If already done, skip the allocation and just assign the required
     * values.
     */
    if (!seu->seu_init) {
	seu->seu_init = TRUE;
	seu->seu_netpool_id = (NET_POOL_ID)sal_alloc(sizeof(NET_POOL),
						     "net_pool");

	/* First Initialize the CL configuration */

	seu->seu_blks.mBlkNum = mblks;
	seu->seu_blks.clBlkNum= clblks;
	seu->seu_blks.memSize = (mblks * (M_BLK_SZ + sizeof(long)))
	    + (clblks * (CL_BLK_SZ + sizeof(long)));
	seu->seu_blks.memArea = sal_alloc(seu->seu_blks.memSize, "socend cl");

	/* Now initialize the actual cluster buffers that contain packets */

	seu->seu_cluster.clNum = cl;
	seu->seu_cluster.clSize = pksize;
	seu->seu_cluster.memSize = cl*(pksize + sizeof(long)) + sizeof(long);
       
        if (SOC_IS_ESW(se->se_unit)) {
           seu->seu_cluster.memArea = sal_dma_alloc(seu->seu_cluster.memSize,
						 "socend_mempool");
        } else {
           seu->seu_cluster.memArea = memalign(4096, 
                                           seu->seu_cluster.memSize);
        }
	/* Now set up the pool and GO! */

	if (!seu->seu_blks.memArea || !seu->seu_cluster.memArea ||
	    !seu->seu_netpool_id ||
	    (OK != netPoolInit(seu->seu_netpool_id, &seu->seu_blks,
			       &seu->seu_cluster, 1, NULL))){
	    LOG_CLI((BSL_META("socend_mempool_init: Failed for unit %d\n"), se->se_unit));
	    if (seu->seu_blks.memArea) {
		sal_free(seu->seu_blks.memArea);
	    }
	    if (seu->seu_cluster.memArea) {
		sal_dma_free(seu->seu_cluster.memArea);
	    }
	    if (seu->seu_netpool_id) {
		free(seu->seu_netpool_id);
	    }
	    bzero((void *)seu, sizeof(*seu));
	    return(ERROR);
	}
	seu->seu_clpool_id = netClPoolIdGet(seu->seu_netpool_id, pksize,
					    FALSE);
    }

    se->se_eo.pNetPool	= seu->seu_netpool_id;

    return(OK);
}
开发者ID:ariavie,项目名称:bcm,代码行数:77,代码来源:socend.c


示例9: poll_for_data

uint8_t *session_get_outgoing(session_t *session, size_t *length, size_t max_length)
{
  packet_t *packet      = NULL;
  uint8_t  *result      = NULL;
  uint8_t  *data        = NULL;
  size_t    data_length = -1;

  /* Suck in any data we can from the driver. */
  poll_for_data(session);

  /* Don't transmit too quickly without receiving anything. */
  if(!can_i_transmit_yet(session))
    return NULL;

  /* It's pretty ugly, but I don't see any other way, since ping requires
   * special packets we have to handle it separately. */
  if(session->is_ping)
  {
    /* Read data without consuming it (ie, leave it in the buffer till it's ACKed) */
    data = buffer_read_remaining_bytes(session->outgoing_buffer, &data_length, max_length - packet_get_ping_size(), FALSE);
    packet = packet_create_ping(session->id, (char*)data);
    safe_free(data);

    LOG_INFO("In PING, sending a PING packet (%zd bytes of data...)", data_length);
  }
  else
  {
    switch(session->state)
    {
      case SESSION_STATE_NEW:
        LOG_INFO("In SESSION_STATE_NEW, sending a SYN packet (SEQ = 0x%04x)...", session->my_seq);

        packet = packet_create_syn(session->id, session->my_seq, (options_t)0);

        if(session->is_command)
          packet_syn_set_is_command(packet);

        if(session->name)
          packet_syn_set_name(packet, session->name);

        break;

      case SESSION_STATE_ESTABLISHED:
        /* Read data without consuming it (ie, leave it in the buffer till it's ACKed) */
        data = buffer_read_remaining_bytes(session->outgoing_buffer, &data_length, max_length - packet_get_msg_size(session->options), FALSE);
        LOG_INFO("In SESSION_STATE_ESTABLISHED, sending a MSG packet (SEQ = 0x%04x, ACK = 0x%04x, %zd bytes of data...)", session->my_seq, session->their_seq, data_length);

        if(data_length == 0 && session->is_shutdown)
          packet = packet_create_fin(session->id, "Stream closed");
        else
          packet = packet_create_msg_normal(session->id, session->my_seq, session->their_seq, data, data_length);

        safe_free(data);

        break;

      default:
        LOG_FATAL("Wound up in an unknown state: 0x%x", session->state);
        exit(1);
    }
  }

  if(packet)
  {
  /* Print packet data if we're supposed to. */
    if(packet_trace)
    {
      printf("OUTGOING: ");
      packet_print(packet, session->options);
    }

    update_counter(session);
    result = packet_to_bytes(packet, length, session->options);
    packet_destroy(packet);
  }

  return result;
}
开发者ID:EricSB,项目名称:dnscat2,代码行数:78,代码来源:session.c


示例10: socend_mcast_add

STATUS
socend_mcast_add(_END_OBJ_PAR *p, char *a)
/*
 * Function: 	socend_mcast_add
 * Purpose:	SENS interface to add a multicast address for the interface.
 * Parameters:	p - pointer to VxWorks end_obj structure for device
 *		a - pointer to address to add
 * Returns:	OK/ERROR
 */
{
    struct end_object 	*eo = (struct end_object *)p;
    socend_t 		*se = (socend_t *)eo->devObject.pDevice;
    int ret;
    pbmp_t pbmp, ubmp;
    bcm_mcast_addr_t mcaddr;
    char mac_str[MACADDR_STR_LEN];
    int unit = se->se_unit;

    if (LOG_CHECK(BSL_LS_SYS_END | BSL_INFO)) {
	format_macaddr(mac_str, (uint8 *)a);
	LOG_INFO(BSL_LS_SYS_END,
                 (BSL_META_U(unit,
                             "socend_mcast_add: %s%d %s\n"),
                  eo->devObject.name, eo->devObject.unit, mac_str));
    }
    /*soc_ioctl(ADD_MULTICAST)*/
    if (ENETRESET == etherMultiAdd(&eo->multiList, a)) {
	BCM_PBMP_CLEAR(pbmp);
	BCM_PBMP_PORT_ADD(pbmp, CMIC_PORT(unit));
#if 0   
	BCM_PBMP_PORT_ADD(pbmp, eo->devObject.unit);
#endif
	BCM_PBMP_ASSIGN(ubmp, pbmp);
	bcm_mcast_addr_t_init(&mcaddr, (uint8 *)a, se->se_vlan);
	mcaddr.cos_dst = 0;
	BCM_PBMP_ASSIGN(mcaddr.pbmp, pbmp);
	BCM_PBMP_ASSIGN(mcaddr.ubmp, ubmp);
	ret = bcm_mcast_addr_add(se->se_unit, &mcaddr);
	if (ret >= BCM_E_NONE) {
#if 0	
	    ret = bcm_amux_register(se->se_unit, a, se->se_vlan,
				    socend_receive, (void *)se);
#endif
	    if (ret < 0) {
		LOG_CLI((BSL_META_U(unit,
                                    "socend_mcast_add: %s%d bcm_amux_register failed: %s\n"),
                         eo->devObject.name, eo->devObject.unit,
                         bcm_errmsg(ret)));
		 bcm_mcast_addr_remove(se->se_unit,
				       (uint8 *)a, se->se_vlan);
	    }
	    return (OK);
	} else {
	    LOG_CLI((BSL_META_U(unit,
                                "bcm_mcast_addr_add failed ERROR : %s\n"),
                     bcm_errmsg(ret)));
	    LOG_INFO(BSL_LS_SYS_END,
                     (BSL_META_U(unit,
                                 "socend_mcast_add: Unit %d Device %s%d "
                                 "Software RESET\n"),
                      se->se_unit, eo->devObject.name, eo->devObject.unit));
	    return (ERROR);
	}
    }
    return(ERROR);
}
开发者ID:ariavie,项目名称:bcm,代码行数:66,代码来源:socend.c


示例11: session_data_incoming

NBBOOL session_data_incoming(session_t *session, uint8_t *data, size_t length)
{
  /* Parse the packet to get the session id */
  packet_t *packet = packet_parse(data, length, session->options);

  /* Set to TRUE if data was properly ACKed and we should send more right away. */
  NBBOOL send_right_away = FALSE;

  /* Suck in any data we can from the driver. */
  poll_for_data(session);

  /* Print packet data if we're supposed to. */
  if(packet_trace)
  {
    printf("INCOMING: ");
    packet_print(packet, session->options);
  }

  if(session->is_ping)
  {
    /* This only returns if the receive is bad. */
    driver_data_received(session->driver, (uint8_t*)packet->body.ping.data, strlen(packet->body.ping.data));
  }
  else
  {
    switch(session->state)
    {
      case SESSION_STATE_NEW:
        if(packet->packet_type == PACKET_TYPE_SYN)
        {
          LOG_INFO("In SESSION_STATE_NEW, received SYN (ISN = 0x%04x)", packet->body.syn.seq);
          session->their_seq = packet->body.syn.seq;
          session->options   = (options_t) packet->body.syn.options;
          session->state = SESSION_STATE_ESTABLISHED;

          /* Since we established a valid session, we can send stuff right away. */
          session->last_transmit = 0;
          session->missed_transmissions = 0;
          send_right_away = TRUE;
        }
        else if(packet->packet_type == PACKET_TYPE_MSG)
        {
          LOG_WARNING("In SESSION_STATE_NEW, received unexpected MSG (ignoring)");
        }
        else if(packet->packet_type == PACKET_TYPE_FIN)
        {
          /* TODO: I shouldn't exit here. */
          LOG_FATAL("In SESSION_STATE_NEW, received FIN: %s", packet->body.fin.reason);

          exit(0);
        }
        else
        {
          /* TODO: I shouldn't exit here. */
          LOG_FATAL("Unknown packet type: 0x%02x", packet->packet_type);
          exit(1);
        }

        break;
      case SESSION_STATE_ESTABLISHED:
        if(packet->packet_type == PACKET_TYPE_SYN)
        {
          LOG_WARNING("In SESSION_STATE_ESTABLISHED, recieved SYN (ignoring)");
        }
        else if(packet->packet_type == PACKET_TYPE_MSG)
        {
          LOG_INFO("In SESSION_STATE_ESTABLISHED, received a MSG");

          /* Validate the SEQ */
          if(packet->body.msg.options.normal.seq == session->their_seq)
          {
            /* Verify the ACK is sane */
            uint16_t bytes_acked = packet->body.msg.options.normal.ack - session->my_seq;

            /* If there's still bytes waiting in the buffer.. */
            if(bytes_acked <= buffer_get_remaining_bytes(session->outgoing_buffer))
            {
              /* Since we got a valid response back, the connection isn't dying. */
              session->missed_transmissions = 0;

              /* Reset the retransmit counter since we got some valid data. */
              if(bytes_acked > 0)
              {
                /* Only reset the counter if we want to re-transmit
                 * right away. */
                if(transmit_instantly_on_data)
                {
                  session->last_transmit = 0;
                  session->missed_transmissions = 0;
                  send_right_away = TRUE;
                }
              }

              /* Increment their sequence number */
              session->their_seq = (session->their_seq + packet->body.msg.data_length) & 0xFFFF;

              /* Remove the acknowledged data from the buffer */
              buffer_consume(session->outgoing_buffer, bytes_acked);

              /* Increment my sequence number */
//.........这里部分代码省略.........
开发者ID:EricSB,项目名称:dnscat2,代码行数:101,代码来源:session.c


示例12: sizeof

	bool CCPU::init()
	{
		FeatureDetector::cpu_x86 cpuFeature;

		cpuFeature.detect_host();

		m_feature.vendor = cpuFeature.Vendor_Intel ? CPUVendor::Intel : cpuFeature.Vendor_AMD ? CPUVendor::AMD : CPUVendor::Unknown;

		m_feature.vendorName = CharacterSet::FromUTF8(cpuFeature.get_vendor_string());

		{
			int32 cpui[4] = {};
			cpuFeature.cpuid(cpui, 0x80000000);
			const int32 nExIDs = cpui[0];
			Array<int32> extData;

			for (int32 i = 0x80000000; i <= nExIDs; ++i)
			{
				cpuFeature.cpuid(cpui, i);

				extData.insert(extData.end(), std::begin(cpui), std::end(cpui));
			}

			char brand[0x40] = {};

			if (static_cast<uint32>(nExIDs) >= 0x80000004)
			{
				::memcpy(brand, &extData[8], sizeof(cpui));
				::memcpy(brand + 16, &extData[12], sizeof(cpui));
				::memcpy(brand + 32, &extData[16], sizeof(cpui));
			}

			m_feature.name = CharacterSet::FromUTF8(brand);
		}

		LOG_INFO(L"ℹ️ CPU vendor: {0}"_fmt(m_feature.vendorName));
		LOG_INFO(L"ℹ️ CPU name: {0}"_fmt(m_feature.name));

		m_feature.SSE		= cpuFeature.HW_SSE;
		m_feature.SSE2		= cpuFeature.HW_SSE2;
		m_feature.SSE3		= cpuFeature.HW_SSE3;
		m_feature.SSSE3		= cpuFeature.HW_SSSE3;
		m_feature.SSE41		= cpuFeature.HW_SSE41;
		m_feature.SSE42		= cpuFeature.HW_SSE42;
		m_feature.SSE4a		= cpuFeature.HW_SSE4a;
		m_feature.AES		= cpuFeature.HW_AES;
		m_feature.SHA		= cpuFeature.HW_SHA;
		m_feature.AVX		= cpuFeature.HW_AVX && cpuFeature.OS_AVX;
		m_feature.XOP		= cpuFeature.HW_XOP;
		m_feature.FMA4		= cpuFeature.HW_FMA4;
		m_feature.FMA3		= cpuFeature.HW_FMA3;
		m_feature.AVX2		= cpuFeature.HW_AVX2 && cpuFeature.OS_AVX;
		m_feature.AVX512_F	= cpuFeature.HW_AVX512_F && cpuFeature.OS_AVX512;

		Array<String> features;

		if (m_feature.SSE)
		{
			features.emplace_back(L"SSE");
		}

		if (m_feature.SSE2)
		{
			features.emplace_back(L"SSE2");
		}

		if (m_feature.SSE3)
		{
			features.emplace_back(L"SSE3");
		}

		if (m_feature.SSSE3)
		{
			features.emplace_back(L"SSSE3");
		}

		if (m_feature.SSE41)
		{
			features.emplace_back(L"SSE4.1");
		}

		if (m_feature.SSE42)
		{
			features.emplace_back(L"SSE4.2");
		}

		if (m_feature.SSE4a)
		{
			features.emplace_back(L"SSE4a");
		}

		if (m_feature.AES)
		{
			features.emplace_back(L"AES-NI");
		}

		if (m_feature.SHA)
		{
			features.emplace_back(L"SHA");
		}
//.........这里部分代码省略.........
开发者ID:Fuyutsubaki,项目名称:OpenSiv3D,代码行数:101,代码来源:CCPU.cpp


示例13: xtensa_poll

static int xtensa_poll(struct target *target)
{
	struct xtensa_common *xtensa = target_to_xtensa(target);
	struct reg *reg;
	uint32_t dosr;
	int res;

	/* OCD guide 2.9.2 points out no reliable way to detect core reset.

	   So, even though this ENABLE_OCD is nearly always a No-Op, we send it
	   on every poll just in case the target has reset and gone back to Running state
	   (in which case this moves it to OCD Run State. */
	res = xtensa_tap_queue(target, TAP_INS_ENABLE_OCD, NULL, NULL);
	if(res != ERROR_OK) {
		LOG_ERROR("Failed to queue EnableOCD instruction.");
		return ERROR_FAIL;
	}

	res = xtensa_tap_exec(target, TAP_INS_READ_DOSR, 0, &dosr);
	if(res != ERROR_OK) {
		LOG_ERROR("Failed to read DOSR. Not Xtensa OCD?");
		return ERROR_FAIL;
	}

	if(dosr & (DOSR_IN_OCD_MODE)) {
		if (target->state != TARGET_HALTED)
		{
			if (target->state != TARGET_UNKNOWN && (dosr & DOSR_EXCEPTION) == 0)
			{
				LOG_WARNING("%s: DOSR has set InOCDMode without the Exception flag. Unexpected. DOSR=0x%02x",
					__func__,
					dosr);
			}
			int state = target->state;

			xtensa->state = XT_OCD_HALT;
			target->state = TARGET_HALTED;
			register_cache_invalidate(xtensa->core_cache);
			xtensa_save_context(target);

			if (state == TARGET_DEBUG_RUNNING)
			{
				target_call_event_callbacks(target, TARGET_EVENT_DEBUG_HALTED);
			}
			else
			{
				//target->debug_reason is checked in gdb_last_signal() that is invoked as a result of calling target_call_event_callbacks() below.
				//Unless we specify it, GDB will get confused and report the stop to the user on its internal breakpoints.
				uint32_t dbgcause = buf_get_u32(xtensa->core_cache->reg_list[XT_REG_IDX_DEBUGCAUSE].value, 0, 32);
				if (dbgcause & 0x20)	//Debug interrupt
					target->debug_reason = DBG_REASON_DBGRQ;
				else if (dbgcause & 0x01) //ICOUNT match
					target->debug_reason = DBG_REASON_SINGLESTEP;
				else
					target->debug_reason = DBG_REASON_BREAKPOINT;
				
				target_call_event_callbacks(target, TARGET_EVENT_HALTED);
			}

			LOG_DEBUG("target->state: %s", target_state_name(target));
			reg = &xtensa->core_cache->reg_list[XT_REG_IDX_PC];
			LOG_INFO("halted: PC: 0x%" PRIx32, buf_get_u32(reg->value, 0, 32));
			reg = &xtensa->core_cache->reg_list[XT_REG_IDX_DEBUGCAUSE];
			LOG_INFO("debug cause: 0x%" PRIx32, buf_get_u32(reg->value, 0, 32));
		}
		else
		{
			if (s_FeedWatchdogDuringStops)
				xtensa_feed_esp8266_watchdog(target);
		}
	} else if(target->state != TARGET_RUNNING && target->state != TARGET_DEBUG_RUNNING){
		xtensa->state = XT_OCD_RUN;
		target->state = TARGET_RUNNING;
	}
	return ERROR_OK;
}
开发者ID:deadbok,项目名称:esp8266-openocd,代码行数:76,代码来源:xtensa.c


示例14: _fradio_init

/*==============================================================================
                                LOCAL FUNCTIONS
==============================================================================*/
static int8_t _fradio_init(void)
{
    uint32_t	env_s_ip;
    uint32_t	env_s_port;
    uint32_t	env_c_ip;
    uint32_t 	env_c_port;
    linkaddr_t 	un_addr;

    env_s_ip = inet_addr(FRADIO_S_IP);
    env_c_ip = inet_addr(FRADIO_C_IP);
    if (!env_s_ip || !env_c_ip) {
        LOG_ERR("%s\n\r","FRADIO_S_IP or FRADIO_C_IP not found");
        exit(1);
    }
    LOG_INFO("serv ip is: %s\n", FRADIO_S_IP);
    LOG_INFO("cli ip is: %s\n", FRADIO_C_IP);

#if CLIENT & !SERVER
    env_s_port = atoi(FRADIO_OUTPORT_CLIENT);
    env_c_port = atoi(FRADIO_INPORT_CLIENT);
#elif SERVER & !CLIENT
    env_s_port = atoi(FRADIO_OUTPORT_SERVER);
    env_c_port = atoi(FRADIO_INPORT_SERVER);
#endif
    if (!env_s_port || !env_c_port) {
        LOG_ERR("%s\n\r","OUTPORT or INPORT not found");
        exit(1);
    }
    LOG_INFO("serv port is: %d\n", env_s_port);
    LOG_INFO("cli port is: %d\n", env_c_port);

//	LOG_INFO("initial ll addr = %02X:%02X:%02X:%02X:%02X:%02X\n",uip_lladdr.addr[0],uip_lladdr.addr[1],uip_lladdr.addr[2],uip_lladdr.addr[3],uip_lladdr.addr[4],uip_lladdr.addr[5]);
    sockfd=socket(AF_INET,SOCK_DGRAM,0);

    memset(&servaddr,0,sizeof(servaddr));
    servaddr.sin_family = AF_INET;
    servaddr.sin_addr.s_addr=env_s_ip;
    servaddr.sin_port=htons(env_s_port);
    if (bind(sockfd,(struct sockaddr *)&servaddr,sizeof(servaddr)) < 0) {
        LOG_ERR("fail to create a socket: error %d\n",errno);
        exit(1);
    }
    memset(&cliaddr,0,sizeof(cliaddr));
    cliaddr.sin_family = AF_INET;
    cliaddr.sin_addr.s_addr=env_c_ip;
    cliaddr.sin_port=htons(env_c_port);
    int flags = fcntl(sockfd, F_GETFL, 0);
    if (flags < 0) {
        LOG_ERR("%s\n\r","fcntl error");
        exit(1);
    }
    flags = (flags|O_NONBLOCK);
    fcntl(sockfd, F_SETFL, flags);
    LOG_INFO("%s\n\r","fake_radio driver was initialized");
    memcpy((void *)&un_addr.u8,  &mac_address, 8);
    memcpy(&uip_lladdr.addr, &un_addr.u8, 8);
    linkaddr_set_node_addr(&un_addr);
    LOG_INFO("MAC address %x:%x:%x:%x:%x:%x:%x:%x\n",	\
             un_addr.u8[0],un_addr.u8[1],\
             un_addr.u8[2],un_addr.u8[3],\
             un_addr.u8[4],un_addr.u8[5],\
             un_addr.u8[6],un_addr.u8[7]);
    /* Start the packet receive process */
    etimer_set(&tmr, 10, _fradio_handler);
    printf("set %p for %p callback\n\r",&tmr, &_fradio_handler);
    return 0;
} /* _fradio_init() */
开发者ID:miri64,项目名称:emb6,代码行数:70,代码来源:fake_radio.c


示例15: socend_load

struct end_object *
socend_load(char *is, void* ap)
/*
 * Function: 	socend_load
 * Purpose:	Provides SENS load routine for SOC device.
 * Parameters:	is - initialization string.
 * Returns:	Pointer to VxWorks end_obj structure or NULL
 */
{
    struct end_object	*eo;
    socend_t		*se;		/* Sock End Structure */
    seu_t		*seu;
    char		dev_name[sizeof(eo->devObject.name)];
    char		mac[6];		/* MAC address parsing */
    int			net_unit;
    char	        mac_str[MACADDR_STR_LEN];
    int 		i, column_count, rt;

    if (NULL == is) {
	LOG_CLI((BSL_META("socend_load: unexpected NULL pointer for device name\n")));
	return(NULL);
    } else if ('\0' == *is) {		/* Copy in our device name */
	strcpy(is, "sc");
	return(NULL);
    }
    LOG_INFO(BSL_LS_SYS_END,
             (BSL_META("socend_load: %s\n"), is));

    /*
     * Setup END structure
     *
     * NOTE NOTE NOTE: 	This call MUST use calloc or malloc, since the object
     * 		   	is freed by VxWorks using free();
     */

    if (NULL == (se = malloc(sizeof(*se)))) {
      LOG_CLI((BSL_META("socend_load: failed to allocate memory for %s\n"), is));
      return(NULL);
    }

    bzero((void *)se, sizeof(*se));
    eo = &se->se_eo;

    net_unit = atoi(is);
    is = index(is, ':') + 1;

    /* Parse init string, format is "net_unit:bcm_unit:MAC_ADDR:vlan" */

    se->se_unit = atoi(is);
    seu = &socend_seu[se->se_unit];
    is = index(is, ':') + 1;		/* Onto net unit # */

    if ((se->se_unit >= BCM_MAX_NUM_UNITS) || !*is) {
	LOG_CLI((BSL_META("socend_load: Invalid soc device: %d\n"), se->se_unit));
	free(se);
	return(NULL);
    }

    /* Check if optional VLAN/MAC address */

    se->se_vlan = VLAN_ID_INVALID;
    if (is) {
	column_count = 0;
	i = 0;
	while (*is && i < MACADDR_STR_LEN - 1 && column_count <= 5) {
	    mac_str[i++] = *is;
	    if (*is++ == ':') {
		column_count++;
	    }
	}
	mac_str[i] = '\0';
	if (column_count == 6) {
	    mac_str[i-1] = '\0';
	}
	if (5 <= column_count) {
	    rt = parse_macaddr(mac_str, se->se_mac);
	} else {
	    rt = -1;
	}
	if (rt) {
	    LOG_CLI((BSL_META("socend_load: Invalid MAC address specified: %s\n"),
                     mac_str));
	    free(se);
	    return(NULL);
	}
	if (column_count == 6) {
	    se->se_vlan = atoi(is);
	}
    } else {
	ENET_COPY_MACADDR(mac_zero, se->se_mac);
    }

    if (se->se_vlan == VLAN_ID_INVALID) {
	bcm_vlan_t	vid;
	bcm_vlan_default_get(se->se_unit, &vid);
	se->se_vlan = vid;
    }

    if (ERROR == END_OBJ_INIT(eo, (DEV_OBJ *)se, "sc", net_unit,
			      &socend_netfuncs, SOC_END_STRING)) {
//.........这里部分代码省略.........
开发者ID:ariavie,项目名称:bcm,代码行数:101,代码来源:socend.c


示例16: socend_ioctl

STATUS
socend_ioctl(_END_OBJ_PAR *p, int cmd, caddr_t data)
/*
 * Function: 	socend_ioctl
 * Purpose:	SENS IOCTL function for SOC devices.
 * Parameters:	p - pointer to VxWorks end_obj structure for device
 *		cmd - command to execute
 *		data - data or address of data for CMD.
 * Returns:	Status
 */
{
    struct end_object 	*eo = (struct end_object *)p;
    socend_t 		*se = (socend_t *)eo->devObject.pDevice;
    STATUS 		error = OK;
    int unit = se->se_unit;

    LOG_INFO(BSL_LS_SYS_END,
             (BSL_META_U(unit,
                         "socend_ioctl: unit %d\n"), se->se_unit));

    switch((unsigned int)cmd) {
    case EIOCSFLAGS:
	LOG_INFO(BSL_LS_SYS_END,
                 (BSL_META_U(unit,
                             "socend_ioctl: %s%d: EIOCSFLAGS(0x%x)\n"),
                  eo->devObject.name, eo->devObject.unit, (unsigned int)data));
	if ((long)data < 0) {	/* Clearing flags? */
	    END_FLAGS_CLR(eo, -(long)data);
	} else {
	    END_FLAGS_SET(eo, (long)data);
	}
	break;
    case EIOCGFLAGS:
	LOG_INFO(BSL_LS_SYS_END,
                 (BSL_META_U(unit,
                             "socend_ioctl: %s%d: EIOCGFLAGS\n"),
                  eo->devObject.name, eo->devObject.unit));
	if (NULL == data) {
	    error = EINVAL;
	} else {
	    *(int *)data = eo->flags;
	}
	break;
    case EIOCSADDR:		/* Set interface address */
	LOG_INFO(BSL_LS_SYS_END,
                 (BSL_META_U(unit,
                             "socend_ioctl: %s%d: EIOCSADDR\n"),
                  eo->devObject.name, eo->devObject.unit));
	if (NULL == data) {
	    error = EINVAL;
	} else {
	    bcm_l2_addr_t	l2addr;
	    int                 my_modid;
	    if (ENET_CMP_MACADDR(se->se_mac, mac_zero)) {
		LOG_INFO(BSL_LS_SYS_END,
                         (BSL_META_U(unit,
                                     "socend_ioctl: Deleting old mac address\n")));
		(void)bcm_l2_addr_delete(se->se_unit, se->se_mac, se->se_vlan);
	    }
	    ENET_COPY_MACADDR(data, se->se_mac);
	    LOG_INFO(BSL_LS_SYS_END,
                     (BSL_META_U(unit,
                                 "socend_ioctl: Setting new mac address\n")));
	    bcm_l2_addr_t_init(&l2addr, se->se_mac, se->se_vlan);
	    l2addr.port = CMIC_PORT(unit);
	    l2addr.flags = BCM_L2_STATIC;
	    bcm_stk_my_modid_get(se->se_unit, &my_modid);
	    l2addr.modid = my_modid;
	    if (0 > bcm_l2_addr_add(se->se_unit, &l2addr)) {
		LOG_CLI((BSL_META_U(unit,
                                    "socend_ioctl: mac_configure_address failed: "
                                    "Network Device %s%d\n"),
                         eo->devObject.name, eo->devObject.unit));
		ENET_COPY_MACADDR(mac_zero, se->se_mac);
		error = EIO;
		break;
	    }
	    END_MIB_INIT(eo, M2_ifType_ethernet_csmacd, (uint8 *)data, 6,
			 ETHERMTU, SOC_END_SPEED);
	}
	break;
    case EIOCGADDR:		/* Get Interface address */
	LOG_INFO(BSL_LS_SYS_END,
                 (BSL_META_U(unit,
                             "socend_ioctl: %s%d: EIOCGADDR\n"),
                  eo->devObject.name, eo->devObject.unit));
	if (NULL == data) {
	    error = EINVAL;
	} else {
	    bcopy((char *)eo->mib2Tbl.ifPhysAddress.phyAddress,
		  (char *)data, eo->mib2Tbl.ifPhysAddress.addrLength);
	}
	break;
    case EIOCGFBUF:		/* Get min 1st buf for chain */
	LOG_INFO(BSL_LS_SYS_END,
                 (BSL_META_U(unit,
                             "socend_ioctl: %s%d: EIOCGFBUF\n"),
                  eo->devObject.name, eo->devObject.unit));
	if (data == NULL) {
	    error = EINVAL;
//.........这里部分代码省略.........
开发者ID:ariavie,项目名称:bcm,代码行数:101,代码来源:socend.c



鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ LOG_INVALID函数代码示例发布时间:2022-05-30
下一篇:
C++ LOG_INF函数代码示例发布时间: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