MityDSP Documentation Index

tcDspSerial

Introduction

The tcDspSerial class may be used to provide access to a serial UART device. Each instance of DspSerial provides access to a single UART, and installs an ISR at the specified interrupt level to handle receive and transmit empty interrupts.

When created, the constructor requires a valid base address for the UART, the interrupt level used, and baud rate, start/stop bit, and parity information for the interface. The baud rate, start/stop bits, and parity may be changed at a later time by calling the tcDspSerial::set_serial_mode method.

There is no limit to the number of instances of tcDspSerial that may be created, however only one per physical UART is allowed.

See also:
MityDSP::tcDspSerial Class Reference

Example

This is a simple example of tcDspSerial creation and usage:

 {
     int          bytes, rv;
     unsigned int my_base_addr = 0xE000001C;
     unsigned int my_vector = 6;
     char         input[32], output[32];
     tcDspSerial  *my_port;

     // create a serial interface
     my_port = new tcDspSerial((void *)my_base_addr, my_vector,
                               UART_38400, UART_LCR_CHR8,
                               UART_LCR_1_STOP, UART_LCR_NOPARITY);
     // start using the port
     my_port->enable(true);

     // send something...
     sprintf(output, "Testing..1..2..3..");
     bytes = strlen(output);
     rv = my_port->put((void *)output, bytes);
     if (rv != bytes)
     {
         printf("Failed, only sent %1d of %1d bytes\n", rv, bytes);
     }

     // receive something...
     bytes = sizeof(input);
     rv = my_port->get((void *)input, bytes);
     printf("Received %1d bytes of data\n", rv);

     ...
  } 

  
Generated on Fri Sep 23 16:33:45 2011 for MityDSP Core by  Doxygen Version 1.6.1
Copyright © 2009, Critical Link LLC, All rights reserved.