Exemplo n.º 1
0
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;
}
Exemplo n.º 2
0
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;
}
Exemplo n.º 3
0
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;
}
Exemplo n.º 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;
}
Exemplo n.º 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;
}
Exemplo n.º 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;
}