This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: e7t write problem


I don't have problems with this.

I open tty_0 on the top of the serial_0.
I also use explicit parameters to set:

  if ((ENOERR == cyg_io_lookup("/dev/ser0",&ser0_handle)) && (ENOERR ==
cyg_io_lookup("/dev/tty0",&tty0_handle)))
  {
	// configure serial port
    serial_0.baud = CYGNUM_SERIAL_BAUD_38400;
    serial_0.stop = CYGNUM_SERIAL_STOP_1;
    serial_0.parity = CYGNUM_SERIAL_PARITY_NONE;
    serial_0.word_length = CYGNUM_SERIAL_WORD_LENGTH_8;
	serial_len = sizeof(serial_0);

cyg_io_set_config(ser0_handle,CYG_IO_SET_CONFIG_SERIAL_INFO,(void*)(&serial_
0),&serial_len);

	// configure the console
	tty_0.tty_out_flags = CYG_TTY_OUT_FLAGS_DEFAULT;
	tty_0.tty_in_flags = CYG_TTY_IN_FLAGS_DEFAULT;
	serial_len = sizeof(tty_0);

cyg_io_set_config(tty0_handle,CYG_IO_GET_CONFIG_TTY_INFO,(void*)(&tty_0),&se
rial_len);


The print function looks like:
void VPprintf(const char *fmt, ...)
{
	va_list ap;

	int len;
    static char serial_buffer[100];

	va_start (ap,fmt);
     vsprintf(serial_buffer, fmt, ap);
	va_end (ap);
	len = strlen(serial_buffer);
    cyg_io_write( tty0_handle, serial_buffer, &len );
}

Regsrds,
Benny

> -----Original Message-----
> From: ecos-discuss-owner@sources.redhat.com
> [mailto:ecos-discuss-owner@sources.redhat.com]On Behalf Of Vinayak P
> Risbud
> Sent: Monday, July 01, 2002 8:41 AM
> To: Ecos-Discuss
> Subject: [ECOS] e7t write problem
>
>
>    Hi,
>
>         I am working on ARM e7t board.
>         My problem is,  I am not able write my data
>         on other serial port (i.e other than com port)
>
>         My code is like this :
>
>         int len, msglen;
>         char msg[] = "This is a test \n";
>
>            err = cyg_io_lookup("/dev/ser0", &handle);
>           if (err == ENOERR){
>                diag_printf("We got the handle \n");
>                diag_printf(" Handle %d \n", handle);
>           }
>          else{
>        diag_printf("opening port failed \n");
>        return;
>       }
>       len = sizeof(serial_info);
>       err = cyg_io_get_config(handle,  CYG_IO_GET_CONFIG_SERIAL_INFO,
> &serial_info, &len);
>       if (err != ENOERR)
>       {
>        diag_printf(" cant get serial config \n");
>        return;
>       }
>   diag_printf("Baud: %d, stop: %d, parity: %d \n", serial_info.baud,
> serial_info.stop,
> serial_info.parity);
>
>  len = sizeof(serial_info);
>  err = cyg_io_set_config(handle, CYG_IO_SET_CONFIG_SERIAL_INFO,
> &serial_info,
> &len);
>  diag_printf("set config error %d \n", err);
>  msglen = strlen(msg);
>  err = cyg_io_write(handle, msg, &msglen);
>  diag_printf(" write error %d \n", err);
>  if (err != ENOERR)
>  {
>   diag_printf(" cant write data %d \n", err);
>   return;
>  }
>
> The output is
>
>     We got the handle
>     Handle 135472
>    Baud: 18, stop: 1, parity: 0
>    set config error 0
>    write error 0
> --------------------------------
>
>    I have connected the e7t other port to PC's COM2 on a straight RS232
> cable.
>    minicom on COM2 does not show any bytes receved
>
>     Any one helps me in fixing this problem ?
>
>     thanks and regards
>             Vinayak
>
>
> --
> Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
> and search the list archive: http://sources.redhat.com/ml/ecos-discuss
>


-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]