Ejemplo n.º 1
0
ssize_t
trace_write (const char* buf, size_t nbyte)
{
	  // Since the single character debug channel is quite slow, try to
	  // optimise and send a null terminated string, if possible.
	  if (buf[nbyte] == '\0')
	    {
	      // send string
	      call_host (SEMIHOSTING_SYS_WRITE0, (void*) buf);
	    }
	  else
	    {
	      // If not, use a local buffer to speed things up
	      char tmp[TRACE_BUFFER_SIZE];
	      size_t togo = nbyte;
	      while (togo > 0)
	        {
	          unsigned int n = ((togo < sizeof(tmp)) ? togo : sizeof(tmp));
	          unsigned int i = 0;
	          for (; i < n; ++i, ++buf)
	            {
	              tmp[i] = *buf;
	            }
	          tmp[i] = '\0';

	          call_host (SEMIHOSTING_SYS_WRITE0, (void*) tmp);

	          togo -= n;
	        }
	    }

	  // All bytes written
	  return (ssize_t) nbyte;
}
Ejemplo n.º 2
0
Archivo: gnotfix.c Proyecto: kahrs/cda
void
startup(char *machine, int Rflag, char **argv, char **end)
{
	if(machine)
		connectto(machine);
	if(!Rflag)
		call_host(machine, argv, end);
}