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

C++ set_port函数代码示例

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

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



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

示例1: seromap_setsleep

static void seromap_setsleep(uintptr_t *port, uint8_t mode, uint8_t wakeup)
{
	set_port(port[OMAP_UART_EFR], OMAP_EFR_ENHANCED, OMAP_EFR_ENHANCED);	// Set enhanced bit
	set_port(port[OMAP_UART_IER], OMAP_IER_SLEEP, mode);					// Set sleep mode
	set_port(port[OMAP_UART_EFR], OMAP_EFR_ENHANCED, 0);					// clear enhanced bit
	set_port(port[OMAP_UART_SCR], OMAP_SCR_WAKEUPEN, wakeup);				// Set wakeup interrupt
}
开发者ID:tyrantyr,项目名称:onda_qnx,代码行数:7,代码来源:power.c


示例2: seromap_enable

static void seromap_enable(DEV_OMAP *dev, int enable)
{
	uintptr_t		*port = dev->port;

	write_omap(port[OMAP_UART_LCR], 0x80);

	if (!enable) {
		atomic_set(&dev->pwm_flag, SEROMAP_PWM_PAGED);

		// If HW flow control is ON, assert the RTS line
		if (dev->tty.c_cflag & IHFLOW)
			set_port(port[OMAP_UART_MCR], OMAP_MCR_DTR|OMAP_MCR_RTS, 0);

		while (!(read_omap(port[OMAP_UART_LSR]) & OMAP_LSR_TSRE))
			;
		nanospin_ns(1000000);			// pause for 1ms
		write_omap(port[OMAP_UART_MDR1], 0x07);
		write_omap(port[OMAP_UART_DLL], 0xFF);
		write_omap(port[OMAP_UART_DLH], 0xFF);
	}
	else {
		write_omap(port[OMAP_UART_DLL], dev->brd);
		write_omap(port[OMAP_UART_DLH], (dev->brd >> 8) & 0xff);
		write_omap(port[OMAP_UART_MDR1], 0x00);

		// If HW flow control is ON, de-assert the RTS line
		if(dev->tty.c_cflag & IHFLOW)
			set_port(port[OMAP_UART_MCR], OMAP_MCR_DTR|OMAP_MCR_RTS, OMAP_MCR_DTR|OMAP_MCR_RTS);

		// Allow data transmission to resume
		atomic_clr(&dev->pwm_flag, SEROMAP_PWM_PAGED);
	}

	write_omap(port[OMAP_UART_LCR], dev->lcr);
}
开发者ID:tyrantyr,项目名称:onda_qnx,代码行数:35,代码来源:power.c


示例3: pulse_clock

void pulse_clock()
{
	set_port(TCK,0);
	set_port(TCK,1);
	_delay_us(1000);
	#ifdef DEBUG_MODE
//		LOG_DEBUG("M=%d I=%d",(out_word&TMS)?1:0,(out_word&TDI)?1:0);
	#endif
	set_port(TCK,0);
}
开发者ID:ben0109,项目名称:XSVF-Player,代码行数:10,代码来源:ports.c


示例4: delay

/* Wait at least the specified number of microsec. */
void delay(long microsec)
{
//	_delay_ms(microsec>>12);
	set_port(TCK,0);
	while (--microsec > 0) {
		set_port(TCK,1);
		_delay_us(1);
		set_port(TCK,0);
		_delay_us(1);
	}
}
开发者ID:ben0109,项目名称:XSVF-Player,代码行数:12,代码来源:ports.c


示例5: natt_float_ports

int
natt_float_ports(struct sockaddr *remote, struct sockaddr *local, uint16_t port)
{
	if (!set_port(remote, port)) {
		return -1;
	}

	if (!set_port(local, port)) {
		return -1;
	}

	return 0;
}
开发者ID:hmatyschok,项目名称:MeshBSD,代码行数:13,代码来源:nattraversal.c


示例6: main

int main(int argc,char* argv[])
{
	int port_fd;
	int len;
	char recv_buf[9];
	int i;

	if(argc!=3){
		printf("Usage: %s /dev/ttySn 0(send data)/1(receive data)\n",argv[0]);
		return -1;
	}

	port_fd=open_port(argv[1]);

	if(port_fd==-1){
		printf("Program Exit\n");
		return -1;
	}

	//设置串口通信参数
	struct port_info info;
	info.baud_rate=9600;
	info.data_bits=8;
 	info.flow_ctrl=2;
	info.port_fd=port_fd;
	info.stop_bit=1;
	info.parity=0;

	if(set_port(&info)==-1){
		printf("Program Exit\n");
		return -1;
	}
	
	if(strcmp(argv[2],"0")==0){
		for(i=0;i<10;i++){
			len=send_data(port_fd,"Test Data",9);

			if(len>0)
				printf("%d send data successfully\n",i);
			else 
				printf("send data failed\n");
			
			sleep(2);
		}
		close_port(port_fd);

	}else{
		while(1){
			len=recv_data(port_fd,recv_buf,9);

			if(len>0){
				for(i=0;i<len;i++)
					printf("receive data is %s\n",recv_buf);
			}else
				printf("cannot receive data\n");
			sleep(2);
		}
      }
	return 0;
}
开发者ID:1023xp,项目名称:training,代码行数:60,代码来源:p6.5.c


示例7: main

int main(void) {

    init();

    // set port to initial state depending on ACO
    set_port();

    // reset ACIF to not to trigger interrupt immediately after sei
#ifdef PROC_at90s4433
    ACSR = _BV(AINBG) | _BV(ACIE) | _BV(ACI);
#else
#ifdef PROC_at90s8515
    ACSR = _BV(ACIE) | _BV(ACI);
#else
    ACSR = _BV(ACBG) | _BV(ACIE) | _BV(ACI);
#endif
#endif
    
    // enable interrupts
    sei();

    do {
        in_loop = 1;
    } while(1); // do forever
}
开发者ID:BBBSnowball,项目名称:simulavr,代码行数:25,代码来源:anacomp_int.c


示例8: main

int main(){
	struct addrinfo hints;
	struct addrinfo *result;
	char port_no[8], server_address[30], buffer[MAX_BUFLEN];
	int status;
	int socket_fd; // socket file descriptor

	log_init(l, "../");
	set_port(port_no);
	set_server(server_address);
	
	//ensuring hints is empty and calling getaddrinfo()
	memset(&hints, 0, sizeof(struct addrinfo));	
	
	//filling in hints with required values
	
	hints.ai_family = AF_UNSPEC;
	hints.ai_socktype = SOCK_STREAM;
	
	if((status = getaddrinfo(server_address, port_no, &hints, &result ))!=0){
		log_error(errno, gai_strerror(status));
	}
	
	if((socket_fd = socket(result->ai_family, result->ai_socktype, result->ai_protocol)) == -1)	{
		log_error(errno, "Error creating socket to server.");
	}
	
	fprintf(l, "%d\n", result->ai_addrlen);
	if(connect(socket_fd, result->ai_addr, result->ai_addrlen)==-1){
		log_error(errno, "Error connecting!\n");
	}
	// sending sample data to buffer
	strcpy(buffer,"[email protected]");
	write(socket_fd, buffer, MAX_BUFLEN);
}
开发者ID:anishlr,项目名称:p2pChat,代码行数:35,代码来源:client.c


示例9: SetPGDDir

void SetPGDDir(uchar f)
{
#if	0
	int dirb = (1<<PGC) | (1<<PGM) | (1<<MCLR);
	if(f) dirb |= (1<<PGD);
	set_port(Ddrb ,dirb);
#else

//	PIC
	if(f) {
		dirPGD=0;	// out
	}else{
		dirPGD=1;	// in
	}

/*	int dirc = (1<<PGM) | (1<<MCLR);

	int dirb = (1<<PGC) ;
	if(f) dirb |= (1<<PGD);

	set_port(Ddrb ,dirb ^ 0xff);
	set_port(Ddrc ,dirc ^ 0xff);
 */

#endif
}
开发者ID:DharmaPatil,项目名称:PIC18F_BOOTLOADER,代码行数:26,代码来源:picwrt.c


示例10: omap_clock_enable

void
omap_clock_enable(DEV_OMAP* dev, clk_enable_t clk_cfg)
{
	int enable_rc = 0;
	int functional_rc = 0;

	/* Our idle state can be changed by the ISR so we must use a spinlock */
	InterruptLock(&dev->idle_spinlock);

	/* Only enable clocks if they aren't enabled already */
	if (dev->idle == 0) {
		goto done;
	}

	if (dev->clkctrl_base) {
		/* Enable the clock */
		out32(dev->clkctrl_base, OMAP_CLKCTRL_MODMODE_ENABLE);

		/* Wait for the module mode to have been written */
		enable_rc = poll_for_condition(dev->clkctrl_base, OMAP_CLKCTRL_MODMODE_MASK, OMAP_CLKCTRL_MODMODE_ENABLE);

		/* Wait for the module idle status to report "fully functional" */
		functional_rc = poll_for_condition(dev->clkctrl_base, OMAP_CLKCTRL_IDLEST_MASK, OMAP_CLKCTRL_IDLEST_FUNCTIONAL);
        
		/* Re-configure clock if specified otherwise simply skip it */
		if (clk_cfg != clk_enable_skip) {

			/* Set the idle mode to smart idle with wake up */
			set_port(dev->port[OMAP_UART_SYSC], OMAP_UART_SYSC_IDLEMODE_MASK, clk_cfg);	
        }

		/* Enable the CTS wakeup */
		write_omap(dev->port[OMAP_UART_WER], OMAP_UART_WER_CTS_ENABLE);

		/* Indicate clocks are enabled */
		dev->idle = 0;
	}

done:
#ifdef WINBT
	/* clear CTS debounce timer and OHW_PAGED flag */
	if (dev->tty.un.s.spare_tmr > 0) {
		dev->tty.un.s.spare_tmr = 0;
		if (dev->tty.flags & OHW_PAGED)
			atomic_clr (&dev->tty.flags, OHW_PAGED);
	}
#endif
	omap_uart_ctx_restore(dev);
	InterruptUnlock(&dev->idle_spinlock);

	/* Don't slog while interrupts are disabled - otherwise slogf() will re-enable interrupts */
	if (enable_rc) {
		slogf(_SLOG_SETCODE(_SLOGC_CHAR, 0), _SLOG_ERROR, "%s: Failed to set module mode to 'enabled'", __FUNCTION__);
	}

	if (functional_rc) {
		slogf(_SLOG_SETCODE(_SLOGC_CHAR, 0), _SLOG_ERROR, "%s: Module failed to report 'fully functional'", __FUNCTION__);
	}
}
开发者ID:nguyenvuhung,项目名称:SDP_QNX_BBB,代码行数:59,代码来源:clock_toggle.c


示例11: bufferOverflow

/**************************************************************************
 * to be called if memory full (out of buffers)
 *
 * It will write the code 253 to the trace.
 * It will morse code "MEM".
 * It will then turn on two LEDs (color=purple + led2) and then halt.
 **************************************************************************/
void bufferOverflow(void)
{
    TRACE(253);
    beeps("-- . --");
    pri_rgb_led_on(true, false, true);
    set_port(LED1);
    sleep_mode();
}
开发者ID:PolaricTracker,项目名称:firmware,代码行数:15,代码来源:main.c


示例12: clear_device

static void
clear_device(const uintptr_t *port) 
{
	write_omap(port[OMAP_UART_IER], 0);					// Disable all interrupts
	/* Clear FIFOs */
	set_port(port[OMAP_UART_FCR], OMAP_FCR_RXCLR | OMAP_FCR_TXCLR, OMAP_FCR_RXCLR | OMAP_FCR_TXCLR); 
	read_omap(port[OMAP_UART_LSR]);						// Clear Line Status Interrupt
	read_omap(port[OMAP_UART_MSR]);						// Clear Modem Interrupt
}
开发者ID:nguyenvuhung,项目名称:SDP_QNX_BBB,代码行数:9,代码来源:init.c


示例13: server_sock

/**
 * ソケット接続
 *
 * @return ソケット
 */
int
server_sock(void)
{
    struct sockaddr_in addr; /* ソケットアドレス情報構造体 */
    int retval = 0;          /* 戻り値 */
    int optval = 0;          /* オプション */
    int sock = -1;           /* ソケット */

    dbglog("start");

    /* 初期化 */
    (void)memset(&addr, 0, sizeof(struct sockaddr_in));
    addr.sin_family = AF_INET;
    addr.sin_addr.s_addr = htonl(INADDR_ANY);

    /* ポート番号またはサービス名を設定 */
    if (set_port(&addr, portno) < 0)
        return EX_NG;

    /* ソケット生成 */
    sock = socket(AF_INET, SOCK_STREAM, 0);
    if (sock < 0) {
        outlog("sock=%d", sock);
        return EX_NG;
    }

    /* ソケットオプション */
    optval = 1; /* 二値オプション有効 */
    retval = setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &optval,
                        (socklen_t)sizeof(int));
    if (retval < 0) {
        outlog("setsockopt=%d, sock=%d", retval, sock);
        goto error_handler;
    }

    /* ソケットにアドレスを指定 */
    retval = bind(sock, (struct sockaddr *)&addr, (socklen_t)sizeof(addr));
    if (retval < 0) {
        if (errno == EADDRINUSE)
            (void)fprintf(stderr, "Address already in use\n");
        outlog("bind=%d, sock=%d", retval, sock);
        goto error_handler;
    }

    /* アクセスバックログの指定 */
    retval = listen(sock, SOMAXCONN);
    if (retval < 0) {
        outlog("listen=%d, sock=%d", retval, sock);
        goto error_handler;
    }

    return sock;

error_handler:
    close_sock(&sock);
    return EX_NG;
}
开发者ID:sluchin,项目名称:calc,代码行数:62,代码来源:server.c


示例14: init_package_head

void init_package_head(ap_package_t *pkt, U8 data_type,U8 src_addr, U8 dst_addr, U8 port, U8 ttl, U8 type)
{
	memset(pkt, 0, sizeof(ap_package_t));	
	set_src_addr(pkt, src_addr);
	set_dst_addr(pkt, dst_addr);
	set_port(pkt, port);
    set_ttl(pkt, ttl);//赋值为7
    set_type(pkt, type);//type传入参数为0
    set_CoS(pkt,data_type);
}
开发者ID:sundajiang,项目名称:ap_net,代码行数:10,代码来源:net_package.c


示例15: serial_init

void serial_init(){	
	if((fd_serial = open_serialport(serialPort)) == -1){
		perror("Open port");
		return -1;
	}
	if( set_port(fd_serial,serialspeed,8,'N',1) == -1){
		perror("Set_Port");
		return -1;
	}
}
开发者ID:qiaoge,项目名称:Pi-Android-multiwii-4G-LTE-Quadrotor,代码行数:10,代码来源:starx_webcam.c


示例16: show_error

const bool SM_Net::create ( const std::string &new_url )
{
	if( ! check_url( new_url ) )
	{
		SM_Util::msg_err( "Error: could not identify URL." );
		show_error( "URL Check", "Could not identify URL." , false );
		return false;
	}
	int find_return = new_url.find( "http://" );

		/* http */
	if( find_return == 0 )
		sm_protocol = 0;
	else
	{
		find_return = new_url.find( "ftp://" );

			/* ftp */
		if( find_return == 0 )
			sm_protocol = 1;
		else
		{
			SM_Util::msg_err( "Error: network protocol not supported." );
			show_error( "URL Check", "Network protocol\nnot supported." , false );
			sm_protocol = 2;
			return false;
		}
	}
	if ( ! set_url( new_url ) )
	{
		SM_Util::msg_err( "Error: could not define url." );
		show_error( "URL Check", "Could not define url." , false );
		return false;
	}
	if ( ! set_port( new_url ) )
	{
		SM_Util::msg_err( "Error: could not define port." );
		show_error( "Port Check", "Could not define port." , false );
		return false;
	}
	if ( ! set_address( new_url ) )
	{
		SM_Util::msg_err( "Error: could not define address." );
		show_error( "Address Check", "Could not define address." , false );
		return false;
	}
	if ( ! set_fileName( new_url ) )
	{
		SM_Util::msg_err( "Error: could not define file name." );
		show_error( "URL File Check", "Could not define\nfile name." , false );
		return false;
	}
	return true;
}
开发者ID:repinel,项目名称:SimpleMan,代码行数:54,代码来源:sm_net.cpp


示例17: getset_init

void
getset_init (void)
{

    set_port (1);
    set_verbose (0);
    set_host (0);
    set_plog (0);
    set_pass_plugin (0);
    set_http_pass_plugin (0);
}
开发者ID:ejlb,项目名称:code,代码行数:11,代码来源:getset.c


示例18: to_ipv6_address

void condor_sockaddr::convert_to_ipv6() {
	// only ipv4 addressn can be converted
	if (!is_ipv4())
		return;
	in6_addr addr = to_ipv6_address();
	unsigned short port = get_port();
	clear();
	set_ipv6();
	set_port(port);
	v6.sin6_addr = addr;
}
开发者ID:cwmartin,项目名称:htcondor,代码行数:11,代码来源:condor_sockaddr.cpp


示例19: Dmsg3

/*       
 * Finish initialization of the pocket structure.
 */
void BSOCK::fin_init(JCR * jcr, int sockfd, const char *who, const char *host, int port,
            struct sockaddr *lclient_addr)
{
   Dmsg3(100, "who=%s host=%s port=%d\n", who, host, port);
   m_fd = sockfd;
   set_who(bstrdup(who));
   set_host(bstrdup(host));
   set_port(port);
   memcpy(&client_addr, lclient_addr, sizeof(client_addr));
   set_jcr(jcr);
}
开发者ID:halgandd,项目名称:bacula,代码行数:14,代码来源:bsock.c


示例20: gps_init

void gps_init(Stream *outstr)
{
    cond_init(&wait_gps); 
    monitor_pos = monitor_raw = false; 
    uint16_t baud; 
    GET_PARAM(GPS_BAUD, &baud);
    in = uart_rx_init(baud, FALSE);
    out = outstr;
    THREAD_START(nmeaListener, STACK_GPSLISTENER);
    make_output(GPSON); 
    set_port(GPSON);
}
开发者ID:PolaricTracker,项目名称:firmware,代码行数:12,代码来源:gps.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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