redboot set_comm_baud_rate question

Jonathan Larmour jifl@eCosCentric.com
Wed Feb 11 01:25:00 GMT 2004


Jani Monoses wrote:
> Hi
> I just want to make sure is the code below intended to be a retry
> of setting of the baudrate if the first attempt fails or a conditional
> setting of it if it's already at the requested value in which case it
> should have been a GETBAUD operation instead of the first SETBAUD.

Definitely looks like a buglet to me. Fixed as per below.

Jifl


Index: ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/redboot/current/ChangeLog,v
retrieving revision 1.177
diff -u -5 -p -r1.177 ChangeLog
--- ChangeLog	4 Feb 2004 15:44:15 -0000	1.177
+++ ChangeLog	11 Feb 2004 01:25:07 -0000
@@ -1,5 +1,10 @@
+2004-02-11  Jonathan Larmour  <jifl@eCosCentric.com>
+
+	* src/main.c (set_comm_baud_rate): Get current rate with GETBAUD
+	not SETBAUD!
+
  2004-02-04  Gary Thomas  <gary@mlbassoc.com>

  	* cdl/redboot.cdl: Do not build with "common" interrupt stack
  	support.  This can cause problems when running programs (via
  	the "go" command) as interrupts will corrupt RedBoot's stack.
Index: src/main.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/redboot/current/src/main.c,v
retrieving revision 1.52
diff -u -5 -p -r1.52 main.c
--- src/main.c	18 Jan 2004 17:42:47 -0000	1.52
+++ src/main.c	11 Feb 2004 01:25:07 -0000
@@ -624,11 +624,11 @@ do_reset(int argc, char *argv[])
  static int
  set_comm_baud_rate(hal_virtual_comm_table_t *chan, int rate)
  {
      int current_rate;

-    current_rate = CYGACC_COMM_IF_CONTROL(*chan, __COMMCTL_SETBAUD, rate);
+    current_rate = CYGACC_COMM_IF_CONTROL(*chan, __COMMCTL_GETBAUD);
      if (rate != current_rate)
          return CYGACC_COMM_IF_CONTROL(*chan, __COMMCTL_SETBAUD, rate);

      return 0;
  }

-- 
eCosCentric    http://www.eCosCentric.com/    The eCos and RedBoot experts
Visit us at Embedded World 2004, Nürnberg, Germany, 17-19 Feb, Stand 12-449
--["No sense being pessimistic, it wouldn't work anyway"]-- Opinions==mine



More information about the Ecos-devel mailing list