* [ECOS] problem on second serial e7t
@ 2002-05-14 6:10 Katerina Malatara
2002-05-14 6:31 ` [ECOS] about cygmem_memalloc_heaps variable peter_ku
2002-05-14 23:44 ` [ECOS] problem on second serial e7t Jesper Skov
0 siblings, 2 replies; 4+ messages in thread
From: Katerina Malatara @ 2002-05-14 6:10 UTC (permalink / raw)
To: ecos-discuss
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* [ECOS] about cygmem_memalloc_heaps variable
2002-05-14 6:10 [ECOS] problem on second serial e7t Katerina Malatara
@ 2002-05-14 6:31 ` peter_ku
2002-05-15 10:01 ` Jonathan Larmour
2002-05-14 23:44 ` [ECOS] problem on second serial e7t Jesper Skov
1 sibling, 1 reply; 4+ messages in thread
From: peter_ku @ 2002-05-14 6:31 UTC (permalink / raw)
To: ecos-discuss
Hi
My hw-target is E7T, when I trace the code
in malloc.cxx
# define POOL (*cygmem_memalloc_heaps[0])
void *
malloc( size_t size )
{
.....
data_ptr = POOL.try_alloc( size );
.....
}
in heap.hxx
extern Cyg_Mempool_dlmalloc *cygmem_memalloc_heaps[ 2 ];
I can't see where to declare the cygmem_memalloc_heaps variable.
Any one can help me?
Thanks a lot!!
Best Regards,
Peter
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [ECOS] problem on second serial e7t
2002-05-14 6:10 [ECOS] problem on second serial e7t Katerina Malatara
2002-05-14 6:31 ` [ECOS] about cygmem_memalloc_heaps variable peter_ku
@ 2002-05-14 23:44 ` Jesper Skov
1 sibling, 0 replies; 4+ messages in thread
From: Jesper Skov @ 2002-05-14 23:44 UTC (permalink / raw)
To: Katerina Malatara; +Cc: eCos Discuss
On Tue, 2002-05-14 at 15:13, Katerina Malatara wrote:
> char line[] = "It is working!!!!\n";
[snip]
> printf("The buffer has: %s\n",buffer);
> cyg_io_write(handle1,line,&len1);
> err3 = cyg_io_write(handle1,buffer,&len);
Look for the missing newline.
Jesper
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [ECOS] about cygmem_memalloc_heaps variable
2002-05-14 6:31 ` [ECOS] about cygmem_memalloc_heaps variable peter_ku
@ 2002-05-15 10:01 ` Jonathan Larmour
0 siblings, 0 replies; 4+ messages in thread
From: Jonathan Larmour @ 2002-05-15 10:01 UTC (permalink / raw)
To: peter_ku; +Cc: ecos-discuss
peter_ku wrote:
>
> Hi
>
> My hw-target is E7T, when I trace the code
>
> in malloc.cxx
> # define POOL (*cygmem_memalloc_heaps[0])
>
> void *
> malloc( size_t size )
> {
> .....
> data_ptr = POOL.try_alloc( size );
> .....
> }
>
> in heap.hxx
> extern Cyg_Mempool_dlmalloc *cygmem_memalloc_heaps[ 2 ];
>
> I can't see where to declare the cygmem_memalloc_heaps variable.
It comes from a file that is automatically generated by a script called
heapgen.tcl. The file will be in your install tree as
include/pkgconf/heaps.hxx. It goes hand in hand with a file called
heaps.cxx that is similarly generated and compiled in the build tree.
Jifl
--
Red Hat, Rustat House, Clifton Road, Cambridge, UK. Tel: +44 (1223) 271062
--[ "You can complain because roses have thorns, or you ]--
--[ can rejoice because thorns have roses." -Lincoln ]-- Opinions==mine
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2002-05-15 17:01 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-14 6:10 [ECOS] problem on second serial e7t Katerina Malatara
2002-05-14 6:31 ` [ECOS] about cygmem_memalloc_heaps variable peter_ku
2002-05-15 10:01 ` Jonathan Larmour
2002-05-14 23:44 ` [ECOS] problem on second serial e7t Jesper Skov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).