This is the mail archive of the ecos-devel@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: [ECOS] cyg_io_read


Hi Baljeet,
I do this...
Good work!

//
// ----- 
CPSUARTGetChar -----------------------------------------------------
//
BYTE CPSUARTGetChar(BYTE uartID, BYTE *charD)
{
 BYTE rc = CPSRC_OK;

 //
 // Controllo uart valida e pronta
 //
 rc = _CTSUARTCheckUartReady(uartID);
 if (rc == CPSRC_UART_NOTREADY)
 {
  //
  // Aprire la uart
  //
  rc = _CTSUARTOpenUart(uartID);
 }

 //
 // Porta pronta, controlliamo i dati!
 //
 if (rc == CPSRC_OK)
 {
  if (cyg_io_select(ctsUartHandle[uartID], CYG_FREAD, uartInfo) == false)
   return (CPSRC_UART_NOTREADY);
  else
  {
   cyg_uint32 dataToRead = 1;
   if (cyg_io_read(ctsUartHandle[uartID], &charD[0], &dataToRead))
    return (CPSRC_UART_NOTREADY);
  }
 }

 return (rc);
}

Ossequi,  (Best Regards/Obrigado)
Marco SICHERI
CTS electronics  - R&D Department
phone: +39 0125 235637, +39 0125 235630
e-mail: m.sicheri@ctsgroup.it
http://www.ctsgroup.it


----- Original Message ----- 
From: "baljeet singh" <baljeet45@yahoo.com>
To: <ecos-discuss@sources.redhat.com>
Sent: Tuesday, March 15, 2005 4:36 AM
Subject: [ECOS] cyg_io_read


> All,
> one of the parameters in the cyg_io_read(..) is
> the number of bytes to read. Process blocks till
> specified number of bytes have been read. If the
> specified number of bytes is not received, the
> process stays blocked.
> Question: Is there a way to block the process for
> a specified amount of time such that the prcoess
> should return on either receiving the specified
> number of bytes or when the specified delay times
> out?
> Baljeet
>
>
>
> __________________________________
> Do you Yahoo!?
> Yahoo! Small Business - Try our new resources site!
> http://smallbusiness.yahoo.com/resources/
>
> -- 
> 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]