This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
problem on second serial e7t
- From: Katerina Malatara <a98-4175 at students dot ee dot upatras dot gr>
- To: ecos-discuss at sources dot redhat dot com
- Date: Tue, 14 May 2002 16:13:14 +0300
- Subject: [ECOS] problem on second serial e7t
Hi,
I have written this code and i notice something strange.
/* INCLUDES */
#include <stdio.h> /* printf */
#include <string.h> /* strlen */
#include <cyg/kernel/kapi.h> /* All the kernel specific stuff */
#include <cyg/io/io.h> /* I/O functions */
#include <cyg/hal/hal_arch.h> /* CYGNUM_HAL_STACK_SIZE_TYPICAL */
/* DEFINES */
#define NTHREADS 1
#define STACKSIZE ( CYGNUM_HAL_STACK_SIZE_TYPICAL + 4096 )
/* STATICS */
static cyg_handle_t thread[NTHREADS];
static cyg_thread thread_obj[NTHREADS];
static char stack[NTHREADS][STACKSIZE];
/* FUNCTIONS */
static void simple_prog(CYG_ADDRESS data)
{
cyg_io_handle_t handle1, handle2;
Cyg_ErrNo err1, err2, err3;
char buffer[100];
cyg_uint32 len = strlen(buffer);
char line[] = "It is working!!!!\n";
cyg_uint32 len1 = strlen(line);
FILE *ptr1;
FILE *ptr2;
printf("Starting serial example\n");
err1 = cyg_io_lookup( "/dev/ser0", &handle1 ); // user port
err2 = cyg_io_lookup( "/dev/ser1", &handle2 ); // debug port
if (err1==ENOERR)
printf("Found /dev/ser0.\n");
if (ENOERR == err2)
printf("Found /dev/ser1.\n");
ptr1 = fopen("/dev/ser0","r");
printf("Send the data...\n");
fscanf(ptr1,"%s",&buffer);
printf("The buffer has: %s\n",buffer);
cyg_io_write(handle1,line,&len1);
err3 = cyg_io_write(handle1,buffer,&len);
if (ENOERR == err3)
printf("the write function is working!!!\n");
fclose(ptr1);
}
void cyg_user_start(void)
{
cyg_thread_create(4, simple_prog, (cyg_addrword_t) 0, "serial",
(void *)stack[0], STACKSIZE, &thread[0],
&thread_obj[0]);
cyg_thread_resume(thread[0]);
}
i have connect ttyS1 with minicom. I write in minicom "katerina" the buffer
has the string katerina but then it is not printing in minicom like the
string in char line[] = "It is working!!!!\n"
the output of gdb
Starting serial example
Found /dev/ser0.
Found /dev/ser1.
Send the data...
The buffer has: katerina
the write function is working!!!
the output of minicom
katerina
It is working!!!!
if someone has any suggetions i will be very happy
Thanks for your help
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss