changeset 22:53104bbd5f99 ecos-sw-1999-07-09

Merge from eCos master repository on 1999-07-09-05:47:06-BST
author jlarmour
date Fri, 09 Jul 1999 07:15:07 +0000
parents 629833dcbe40
children 8883a9947b66
files packages/hal/common/current/ChangeLog packages/hal/common/current/tests/intr.c packages/infra/current/include/cyg_ass.h packages/io/serial/current/ChangeLog packages/io/serial/current/tests/ser_test_protocol.inl packages/kernel/current/ChangeLog packages/kernel/current/tests/stress_threads.c
diffstat 7 files changed, 99 insertions(+), 98 deletions(-) [+]
line wrap: on
line diff
--- a/packages/hal/common/current/ChangeLog
+++ b/packages/hal/common/current/ChangeLog
@@ -1,3 +1,7 @@
+1999-07-05  Jesper Skov  <jskov@cygnus.co.uk>
+
+	* tests/intr.c: Don't use kernel's RTC definitions.
+
 1999-07-02  Jesper Skov  <jskov@cygnus.co.uk>
         PR20157
 	* tests/cache.c: Print stride values, preventing timeout on slow
--- a/packages/hal/common/current/tests/intr.c
+++ b/packages/hal/common/current/tests/intr.c
@@ -71,7 +71,7 @@ cyg_uint32 isr( cyg_uint32 vector, CYG_A
     CYG_TEST_CHECK( CYGNUM_HAL_INTERRUPT_RTC == vector ,
                     "Bad vector passed to ISR");
 
-    HAL_CLOCK_RESET( vector, CYGNUM_KERNEL_COUNTERS_RTC_PERIOD );
+    HAL_CLOCK_RESET( vector, CYGNUM_HAL_RTC_PERIOD );
 
     HAL_INTERRUPT_ACKNOWLEDGE( vector );
     
@@ -88,7 +88,7 @@ void intr_main( void )
 
     HAL_INTERRUPT_ATTACH( CYGNUM_HAL_INTERRUPT_RTC, isr, ISR_DATA, 0 );
 
-    HAL_CLOCK_INITIALIZE( CYGNUM_KERNEL_COUNTERS_RTC_PERIOD );
+    HAL_CLOCK_INITIALIZE( CYGNUM_HAL_RTC_PERIOD );
 
     HAL_INTERRUPT_UNMASK( CYGNUM_HAL_INTERRUPT_RTC );
 
--- a/packages/infra/current/include/cyg_ass.h
+++ b/packages/infra/current/include/cyg_ass.h
@@ -583,6 +583,11 @@ externC void cyg_assert_failure_invoke_c
                 void (*)(const char* /* callback data */ ),
                 void (*)(void) );
 
+// This function is intended to be called from inside gdb instead of
+// cyg_assert_fail(),, without the need to specify a filename or
+// anything else.
+externC void cyg_assert_quickfail(void);
+
 #endif // CYG_DECLARE_HOST_ASSERTION_SUPPORT
     
 // -------------------------------------------------------------------------
--- a/packages/io/serial/current/ChangeLog
+++ b/packages/io/serial/current/ChangeLog
@@ -1,3 +1,7 @@
+1999-07-08  Jesper Skov  <jskov@cygnus.co.uk>
+
+	* tests/ser_test_protocol.inl (change_config): Changed implementation.
+
 1999-06-20  Gary Thomas  <gthomas@cygnus.co.uk>
 
 	* include/pkgconf/io_serial.h: Some clean up (removed commented
--- a/packages/io/serial/current/tests/ser_test_protocol.inl
+++ b/packages/io/serial/current/tests/ser_test_protocol.inl
@@ -415,12 +415,17 @@ hang(void)
 // On ER, return error.
 //
 // On OK, change to the new configuration. Resynchronize with the host:
-//  Write 'T'-chars to the host.
-//   The host will echo anything it reads until it sees a 'O' character.
-//  Continue until four 'T'-chars has been read back.
-//  Then send a single 'O'-character. This will signal success to the host.
+//  Target waits for host to send S(ync) 
+//     [host will delay at least .1 secs after changing baud rate so the 
+//      line has time to settle.]
 //
-// If the synchronization has not succeeded within 100 ticks
+//  When receiving S(ync), target replies OK to the host which then
+//  acknowledges with D(one).
+//
+//  Host can also send R(esync) which means it didn't receieve the OK. If
+//  so the target resends its S(ync) message.
+//
+// If the synchronization has not succeeded within 1 second
 // (configurable in the protocol), both host and target will revert to
 // the previous configuration and attempt to synchronize again. If
 // this fails, this call will hang and the host will consider the test
@@ -490,7 +495,7 @@ change_config(cyg_io_handle_t handle, cy
     // with the host.
     res = cyg_io_set_config(handle, CYG_IO_SET_CONFIG_SERIAL_INFO, 
                             &old_cfg, &len);
-    cyg_thread_delay(10);  // Some chips don't like changes to happen to fast...
+    cyg_thread_delay(10); // Some chips don't like changes to happen to fast...
     if (ENOERR != res) {
         diag_printf("change_config: set_config failed/1 (%d)\n", res);
         hang();
@@ -516,10 +521,12 @@ change_config(cyg_io_handle_t handle, cy
         return res;
     }
 
-    // Now test the new configuration: Loop until we read what we
-    // write.  This may hang (as seen from the host), but only when we
-    // get totally lost, in which case there's not much else to do
-    // really. In this case the host will consider the test a FAIL.
+    // Now change config and wait for host to send us a S(ync)
+    // character.  
+    // Loop until protocol exchange completed. This may hang (as seen
+    // from the host), but only when we get totally lost, in which
+    // case there's not much else to do really. In this case the host
+    // will consider the test a FAIL.
     len = sizeof(new_cfg);
     res = cyg_io_set_config(handle, CYG_IO_SET_CONFIG_SERIAL_INFO, 
                             &new_cfg, &len);
@@ -529,104 +536,76 @@ change_config(cyg_io_handle_t handle, cy
         hang();
     }
 
-    // Note: Only sends a single char - a string wuld be safer, but if
-    // there's not a 1-1 relationship between outgoing and incoming
-    // chars, the reader needs to be smarter. Compensate by
-    // requirering the char to be read 4 times in succession.
-    for (;;) {
+    {
         int change_succeeded = 0;
         int using_old_config = 0;
-        int matches = 0;
         char in_buf[1];
         int len;
-        char out_buf[1];
+        int saw_host_sync;
 
-        out_buf[0] = 'a';
+        for (;;) {
+            aborted = 0;                    // global abort flag
 
-        aborted = 0;                    // global abort flag
-        // FIXME: Timeout time needs to be configurable, and needs to
-        // be sent to the host before getting here. That would allow
-        // changing the timeout by just rebuilding the test - without
-        // changing the host software.
-        r_stamp = timeout(100, do_abort, handle);
-        while (!aborted) {
-            len = 1;
-            res = cyg_io_write(handle, out_buf, &len);
-            if (ENOERR != res && -EINTR != res) {
-                // We may have to reset the driver here if the fail
-                // was due to a framing or parity error.
-                break;
-            }
-        
-            len = 1;
-            res = cyg_io_read(handle, in_buf, &len);
-            if (ENOERR != res && -EINTR != res) {
-                // We may have to reset the driver here if the fail
-                // was due to a framing or parity error.
-                break;
-            }
-        
-            // Check for match.
-            if (out_buf[0] == in_buf[0]) {
-                matches++;
-                // We want 4 in succession before we accept it.
-                if (4 == matches) {
+            // FIXME: Timeout time needs to be configurable, and needs to
+            // be sent to the host before getting here. That would allow
+            // changing the timeout by just rebuilding the test - without
+            // changing the host software.
+            saw_host_sync = 0;
+            r_stamp = timeout(100, do_abort, handle);
+            while(!aborted) {
+                len = 1;
+                in_buf[0] = 0;
+                res = cyg_io_read(handle, in_buf, &len);
+                if (ENOERR != res && -EINTR != res) {
+                    // We may have to reset the driver here if the fail
+                    // was due to a framing or parity error.
+                    break;
+                }
+
+                if ('R' == in_buf[0]) {
+                    // Resync - host didn't see our message. Try again.
+                    saw_host_sync = 0;
+                } else if ('S' == in_buf[0] && !saw_host_sync) {
+                    // In sync - reply to host if we haven't already
+                    char ok_msg[2] = "OK";
+                    int ok_len = 2;
+                    Tcyg_io_write(handle, ok_msg, &ok_len);
+                    saw_host_sync = 1;
+                } else if ('D' == in_buf[0] && saw_host_sync) {
+                    // Done - exchange completed.
                     change_succeeded = 1;
                     break;
                 }
-            } else
-                matches = 0;
-        }
-        untimeout(r_stamp);
-        
-        // Did we succeed?
-        if (change_succeeded) {
-            // Yup! Send 'O' to host so it knows we're OK.
-            const char ok_str[1] = "O";
-            len = 1;
-            res = cyg_io_write(handle, ok_str, &len);
-            if (res != ENOERR) {
-                diag_printf("write failed - DEVIO error: %d\n", res);
-                hang();
             }
-
-            // Now wait for the 'O' to be echoed so we know both lines
-            // have been emptied.
-            r_stamp = timeout(100, do_abort, handle);
-            do {
-                len = 1;
-                res = cyg_io_read(handle, in_buf, &len);
-                CYG_ASSERT(ENOERR == res, "Failed when waiting for 'O'");
-            } while ('O' != in_buf[0]);
             untimeout(r_stamp);
 
-            // If we had to revert to the old configuration, return error.
-            if (using_old_config)
-                return -EIO;
-            else
-                return ENOERR;
-        }
+            if (change_succeeded) {
+                // If we had to revert to the old configuration, return error.
+                if (using_old_config)
+                    return -EIO;
+                else
+                    return ENOERR;
+            }
 
-        // We didn't. Due to an IO error?
-        if (ENOERR != res && -EINTR != res) {
-            // We may have to reset the driver if the fail was due to
-            // a framing or parity error.
+            // We didn't synchronize with the host. Due to an IO error?
+            if (ENOERR != res && -EINTR != res) {
+                // We may have to reset the driver if the fail was due to
+                // a framing or parity error.
+            }
+
+            // Revert to the old configuration and try again.
+            len = sizeof(old_cfg);
+            res = cyg_io_set_config(handle, CYG_IO_SET_CONFIG_SERIAL_INFO, 
+                                    &old_cfg, &len);
+            cyg_thread_delay(10);  // Some chips don't like changes to happen to fast...
+            if (res != ENOERR) {
+                diag_printf("change_config: set_config failed/3 (%d)\n", res);
+                hang();
+            }
+            using_old_config = 1;
         }
 
-        // Revert to the old configuration and try again.
-        len = sizeof(old_cfg);
-        res = cyg_io_set_config(handle, CYG_IO_SET_CONFIG_SERIAL_INFO, 
-                                &old_cfg, &len);
-        cyg_thread_delay(10);  // Some chips don't like changes to happen to fast...
-        if (res != ENOERR) {
-            diag_printf("change_config: set_config failed/3 (%d)\n", res);
-            hang();
-        }
-        out_buf[0] = 't';               // change the char so a developer can
-                                        // see this has happened by the chars
-                                        // being written.
-        using_old_config = 1;
-    }        
+    }
 }
 
 
--- a/packages/kernel/current/ChangeLog
+++ b/packages/kernel/current/ChangeLog
@@ -1,3 +1,9 @@
+1999-07-08  Jesper Skov  <jskov@cygnus.co.uk>
+        PR 20244
+	* tests/stress_threads.c: Changed cyg_user_start() to main()
+	ensuring a bigger stack (it calls sprintf).
+	Increased STACK_SIZE by 2kB for printf calls.
+
 1999-06-30  Jesper Skov  <jskov@cygnus.co.uk>
 
 	* tests/dhrystone.c: Also NA-quit if CYGPKG_INFRA_DEBUG or
--- a/packages/kernel/current/tests/stress_threads.c
+++ b/packages/kernel/current/tests/stress_threads.c
@@ -79,7 +79,9 @@
 #define DEATH_TIME_LIMIT 20
 /* #undef DEATH_TIME_LIMIT */
 
-#define STACK_SIZE (CYGNUM_HAL_STACK_SIZE_TYPICAL)
+// STACK_SIZE is typical +2kB for printf family calls which use big
+// auto variables.
+#define STACK_SIZE (2*1024 + CYGNUM_HAL_STACK_SIZE_TYPICAL)
 #define STACK_SIZE2 (8*1024 + CYGNUM_HAL_STACK_SIZE_TYPICAL)
 
 /* Allocate priorities in this order. This ensures that handlers
@@ -185,8 +187,9 @@ cyg_alarm_t report_alarm_func, death_ala
 cyg_handle_t report_alarmH, counterH, system_clockH;
 cyg_alarm report_alarm;
 
-/* we install our own startup routine which sets up threads */
-void cyg_user_start(void)
+/* main launches all the threads of the test */
+int
+main(void)
 {
   int i;