Beispiel #1
0
/*-----------------------------------------------------------------------------
  Write character to the Serial Port
 *----------------------------------------------------------------------------*/
int sendchar (int c) 
{
    if (c == '\n')  {
        SER_PutChar ('\r');
    }
    SER_PutChar (c);
    return (c);
}
int fputc (int ch, FILE *f) {
  /* Debug output to serial port. */
  if (ch == '\n')  {
    SER_PutChar (0x0D);
  }
  SER_PutChar (ch & 0xFF);
  return (ch);
}
/*-----------------------------------------------------------------------------
  Write character to the Serial Port
 *----------------------------------------------------------------------------*/
int sendchar (int ch) {

  if (ch == '\n')  {
    SER_PutChar ('\r');
  }
  SER_PutChar (ch);

  return (ch);
}
size_t __write(int handle, const unsigned char *buf, size_t size) {
  size_t nChars = 0;

  if (buf == 0) {
    /*
     * This means that we should flush internal buffers.  Since we
     * don't we just return.  (Remember, "handle" == -1 means that all
     * handles should be flushed.)
     */
    return 0;
  }

  /* This template only writes to "standard out" and "standard err",
   * for all other file handles it returns failure. */
  if (handle != _LLIO_STDOUT && handle != _LLIO_STDERR) {
    return _LLIO_ERROR;
  }

  for (/* Empty */; size != 0; --size) {
    SER_PutChar(*buf++);
    ++nChars;
  }

  return nChars;
}
Beispiel #5
0
int _write (int fd, char * ptr, int len) 
{
  int i;

  for (i = 0; i < len; i++) SER_PutChar (*ptr++);
  return (i);
}
Beispiel #6
0
//For debugging.
void SER_PutString(CHAR* pszString)
{
    while(*pszString)
    {
        SER_PutChar(*pszString);
        pszString ++;
    }
}
int _read (int file, char * ptr, int len) {
  char c;
  int  i;

  for (i = 0; i < len; i++) {
    c = SER_GetChar();
    if (c == '\r') break;
    *ptr++ = c;
    SER_PutChar(c);
  }
  return (len - i);
}
Beispiel #8
0
void _ttywrch(int c) {
  SER_PutChar(c);
}
Beispiel #9
0
int fputc(int c, FILE *f) {
  return (SER_PutChar(c));
}
Beispiel #10
0
int fgetc(FILE *f) {
  return (SER_PutChar(SER_GetChar()));
}
Beispiel #11
0
int fputc(int c, FILE *f) {
  if (c == '\n')  {
    SER_PutChar('\r');
  }
  return (SER_PutChar(c));
}
Beispiel #12
0
void _ttywrch(int c) {
  //sendchar(c);
  SER_PutChar(c);
}
Beispiel #13
0
int fputc(int c, FILE *f) {
  //return (sendchar(c));
  return (SER_PutChar(c));
}