Accessing serial ports on Coldfire
Andrei Chichak
groups at chichak.ca
Fri Oct 2 03:39:00 UTC 2009
Holy cow, I know what I'm working on next. I just found the
documentation. WOW is this going to help with debugging.
Thanks a lot.
Andrei
On 2009-October-01, at 9:34 PM, Chris Johns wrote:
> Andrei Chichak wrote:
>> Okay, I don't seem to be understanding something very basic.
>> Do you mean checking the /dev directory on my embedded system?
>
> Yes.
>
>> If so, I've missed the big pink elephant in the room. How do I fire
>> up a shell? I thought that I fire up processes and send messages.
>
> The header file shell.h has the interface. You can fire up a shell
> with code like:
>
> void
> shell_start (void)
> {
> rtems_status_code sc;
> printf ("Starting shell....\n\n");
> sc = rtems_shell_init ("fstst", 60 * 1024, 150,
> "/dev/console", 0, 1, NULL);
> if (sc != RTEMS_SUCCESSFUL)
> printf ("error: starting shell: %s (%d)\n",
> rtems_status_text (sc), sc);
> }
>
> The shell is only to provide an 'ls' command to find the names of
> the device nodes for your BSP. You could write code to readdir the /
> dev directory and print the contents rather than use the shell.
>
> My Coldfire target is currently not running so I cannot provide what
> I have on the 5235 BSP.
>
> The UART driver normally creates a /dev device node in the IMFS file
> system so the code following can work in a standard manner:
>
> #include <termios.h>
> struct termios term;
> int uart = open ("/dev/uart1", O_RDWR);
> if (tcgetattr(uart, &term) < 0)
> printf ("error: cannot get terminal attributes: %s\n",
> strerror (errno));
> cfsetispeed (&term, B38400);
> cfsetospeed (&term, B38400);
> if (tcsetattr (uart, TCSADRAIN, &term) < 0)
> printf ("error: cannot set terminal attributes: %s\n",
> strerror (errno));
> close (uart);
>
> Regards
> Chris
>
---------------------
Andrei Chichak
Systems Developer
CBF Systems Inc.
4-038 NINT Innovation Centre
11421 Saskatchewan Drive
Edmonton, Alberta
Canada
T6G 2M9
Phone: 780-628-2072
Skype: andrei.chichak
More information about the users
mailing list