예제 #1
0
파일: gdb_if.c 프로젝트: JohnOH/blackmagic
unsigned char gdb_if_getchar_to(int timeout)
{
	platform_timeout_set(timeout);

	if (!(out_ptr < count_out)) do {
		/* Detach if port closed */
		if (!cdcacm_get_dtr())
			return 0x04;

		gdb_if_update_buf();
	} while (!platform_timeout_is_expired() && !(out_ptr < count_out));

	if(out_ptr < count_out)
		return gdb_if_getchar();

	return -1;
}
예제 #2
0
파일: gdb_if.c 프로젝트: emlid/blackmagic
unsigned char gdb_if_getchar_to(int timeout)
{
	fd_set fds;
	struct timeval tv;

	if(gdb_if_conn == -1) return -1;

	tv.tv_sec = timeout / 1000;
	tv.tv_usec = (timeout % 1000) * 1000;

	FD_ZERO(&fds);
	FD_SET(gdb_if_conn, &fds);

	if(select(gdb_if_conn+1, &fds, NULL, NULL, &tv) > 0)
		return gdb_if_getchar();

	return -1;
}
예제 #3
0
파일: gdb_if.c 프로젝트: ChuckM/blackmagic
unsigned char gdb_if_getchar_to(int timeout)
{
	platform_timeout t;
	platform_timeout_set(&t, timeout);

	if(head_out == tail_out) do {
		/* Detach if port closed */
		if(!cdcacm_get_dtr())
			return 0x04;

		while(cdcacm_get_config() != 1);
	} while(!platform_timeout_is_expired(&t) && head_out == tail_out);

	if(head_out != tail_out)
		return gdb_if_getchar();

	return -1;
}
예제 #4
0
unsigned char gdb_if_getchar_to(int timeout)
{
	timeout_counter = timeout/100;

	if(!(out_ptr < count_out)) do {
		/* Detach if port closed */
		if(!cdcacm_get_dtr())
			return 0x04;

		count_out = usbd_ep_read_packet(usbdev, CDCACM_GDB_ENDPOINT,
					buffer_out, CDCACM_PACKET_SIZE);
		out_ptr = 0;
	} while(timeout_counter && !(out_ptr < count_out));

	if(out_ptr < count_out)
		return gdb_if_getchar();

	return -1;
}
예제 #5
0
unsigned char gdb_if_getchar_to(int timeout)
{
	fd_set fds;
# if defined(__CYGWIN__)
        TIMEVAL tv;
#else
	struct timeval tv;
#endif

	if(gdb_if_conn == -1) return -1;

	tv.tv_sec = timeout / 1000;
	tv.tv_usec = (timeout % 1000) * 1000;

	FD_ZERO(&fds);
	FD_SET(gdb_if_conn, &fds);

	if(select(gdb_if_conn+1, &fds, NULL, NULL, &tv) > 0)
		return gdb_if_getchar();

	return -1;
}
예제 #6
0
unsigned char gdb_if_getchar_to(int timeout)
{
	timeout_counter = timeout/100;

	if(!(out_ptr < count_out)) do {
		/* Detach if port closed */
		if(!cdcacm_get_dtr())
			return 0x04;

		while(cdcacm_get_config() != 1);
                if (count_new) {
                    memcpy(buffer_out, double_buffer_out,count_new);
		    count_out = count_new;
                    count_new = 0;
                    out_ptr = 0;
                    usbd_ep_nak_set(usbdev, CDCACM_GDB_ENDPOINT, 0);
                }
	} while(timeout_counter && !(out_ptr < count_out));

	if(out_ptr < count_out)
		return gdb_if_getchar();

	return -1;
}