This is the mail archive of the ecos-discuss@sourceware.org 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]

change baudrate problem


dear all,
 
here i send my code in which i want to cahnge  baudrate but not chnging.
my confusion is     err = cyg_io_lookup( "/dev/haldiag", &handle );
right now i am communication in debug port in sam7x board.
how to change com port?
 
my code 
 
#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 */
#include <cyg/io/serialio.h>
 
#define NTHREADS 1
#define STACKSIZE ( CYGNUM_HAL_STACK_SIZE_TYPICAL + 4096 )
 
 
static cyg_handle_t thread[NTHREADS];
 cyg_uint32 i;
    
static cyg_thread thread_obj[NTHREADS];
static char stack[NTHREADS][STACKSIZE];
 
static void simple_prog(CYG_ADDRESS data)
{
    cyg_io_handle_t handle;
    Cyg_ErrNo err;
    const char test_string[] = "hi sandip patel here how r u ?\n";
    cyg_uint32 len = strlen(test_string);
    err = cyg_io_lookup( "/dev/haldiag", &handle );

     cyg_serial_info_t si;
     i = sizeof(si);
     cyg_io_get_config( handle, CYG_IO_GET_CONFIG_SERIAL_INFO, &si, &i);
 

       si.baud = CYGNUM_SERIAL_BAUD_38400;
       si.stop = CYGNUM_SERIAL_STOP_1;
       si.parity = CYGNUM_SERIAL_PARITY_NONE;
       si.word_length = CYGNUM_SERIAL_WORD_LENGTH_8;
       si.flags = CYGNUM_SERIAL_FLOW_NONE;
     
 
     cyg_io_set_config(handle, CYG_IO_SET_CONFIG_SERIAL_INFO, &si, &i);
     cyg_thread_delay(10);
 
  do
{
   cyg_io_write( handle, test_string, &len ); 
cyg_thread_delay(10);
 
}while(1);


    printf("Starting serial example\n");
 
  
if (ENOERR == err) 
{
        printf("Found /dev/haldiag. Writing string....\n");
}
    printf("sandip patel");
 
}
 
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]);
}

Regards.,

Sandip L. Patel.

 




   

-------------------------------------------------------
Masibus Process Instruments (P) Ltd, Gandhinagar, India


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


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