Exemplo n.º 1
0
int do_display (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
	int i;

	/* Clear display */
	display_set(DISPLAY_CLEAR | DISPLAY_HOME);

	if (argc < 2)
		return (0);

	for (i = 1; i < argc; i++) {
		char *p = argv[i];

		if (i > 1) { /* Insert a space between strings */
			display_putc(' ');
		}

		while ((*p)) {
#ifdef DEBUG_DISP
			putc(*p);
#endif
			display_putc(*p++);
		}
	}

#ifdef DEBUG_DISP
	putc('\n');
#endif

	return (0);
}
Exemplo n.º 2
0
//
// Update keyboard status and issue events on it if necessary.
// This function doesn't block, but is normally only called when
// there is known to be some data waiting to be read from the keyboard.
//
BOOL GsCheckKeyboardEvent(void)
{
	MWKEY		ch;		// latest character
	MWKEYMOD	modifiers;	// latest modifiers 
	MWSCANCODE	scancode;	// latest modifiers 
	int		keystatus;	// latest keyboard status 

	// Read the latest keyboard status: 
display_puts("key read\n");
	keystatus = GdReadKeyboard(&ch, &modifiers, &scancode);
	if(keystatus < 0) {
		if(keystatus == -2)	// special case for ESC pressed
			GsTerminate();
		display_puts("Kbd error\n");
		return FALSE;
	} else if(keystatus) { // Deliver events as appropriate: 
		byte2hex(modifiers,s);
		display_puts("kbd '");
		display_putc(ch);
		display_puts("',");
		display_puts(s);
		display_puts("\n");
		return TRUE;
	}
	return FALSE;
}
Exemplo n.º 3
0
int start(int argc, char *argv[])
{
  struct kmem_queue *plist;
  int i,num;
  char strbuf[16];

  plist = malloc(sizeof(struct kmem_queue)*PLIST_SIZE);
  if(plist==0) {
    display_puts("error=malloc\n");
    return 1;
  }

  num = syscall_que_list(0,PLIST_SIZE,plist);

  display_puts("ID   IN   OUT  NAME ST WAIT\n");
  for(i=0;i<num;i++) {
    word2hex(plist[i].id,strbuf);
    display_puts(strbuf);
    display_putc(' ');

    word2hex(plist[i].in,strbuf);
    display_puts(strbuf);
    display_putc(' ');

    word2hex(plist[i].out,strbuf);
    display_puts(strbuf);
    display_putc(' ');

    word2hex(plist[i].name,strbuf);
    display_puts(strbuf);
    display_putc(' ');

    byte2hex(plist[i].status,strbuf);
    display_puts(strbuf);
    display_putc(' ');

    word2hex(plist[i].numwait,strbuf);
    display_puts(strbuf);
    display_putc('\n');

  }

  mfree(plist);

  return 0;
}
Exemplo n.º 4
0
void debug_putc(char c)
{
  display_putc(gci_nodes[GCI_DISPLAY_NUM].device_area, cpos++, c, 0xfff, 0x000);
}
Exemplo n.º 5
0
void puts(char *str)
{
  for(;*str != 0;++str)
    display_putc(*str);
}
Exemplo n.º 6
0
int cmd_type(int ac, char **av)
{
  int rc;
  int handle=0;
  block_t buf_blk=0;
  block_t blk;
  int readbyte;
  unsigned long pos;

//display_puts("cdfs_open\n");
  handle = cdfs_open(av[0]);
  if(handle<0) {
    dsp_open_error(handle);
    goto EXITCMD;
  }

//display_puts("block_init\n");
  blk = block_init(BLOCK_SHM_ID);
  if(blk==0) {
    display_puts("error:block_open\n");
    goto EXITCMD;
  }

//display_puts("block_alloc\n");
  buf_blk = block_alloc(blk);
  if(buf_blk==0) {
    display_puts("rc=");
    sint2dec(handle,s);
    display_puts(s);
    goto EXITCMD;
  }

  char *buf=block_addr(blk,buf_blk);

//display_puts("cdfs_read\n");
  pos=0;
  readbyte=cdfs_read(handle,pos,BLOCK_SHM_ID,buf_blk,BLOCK_SIZE);
  if(readbyte<0) {
    display_puts("rc=");
    sint2dec(readbyte,s);
    display_puts(s);
    goto EXITCMD;
  }


//  display_puts("\n");
//syscall_wait(10);
  //dump(buf);

  int i;
  for(i=0;i<readbyte;i++) {
    display_putc(*buf);
//syscall_wait(10);
    buf++;
  }

//display_puts("\n");
//display_puts("-------\n");
//display_puts("len=");
//sint2dec(readbyte,s);
//display_puts(s);
//display_puts("\n");
//syscall_wait(50);


EXITCMD:

  if(handle>0) {
//display_puts("cdfs_close\n");
    rc = cdfs_close(handle);
    if(rc<0) {
      display_puts("rc=");
      sint2dec(rc,s);
      display_puts(s);
    }
  }

  if(buf_blk) {
    block_free(blk,buf_blk);
  }

  return 0;
}