changeset 2053:02a3678d7618

* src/common/tty.c (tty_write): * src/common/haldiag.c (haldiag_getc): Fixed pointer signness to avoid compiler warnings. * tests/*.c msglen should by an unsigned int to avoid compiler warnings.
author asl
date Wed, 03 Aug 2005 21:00:34 +0000
parents ec1655a2f96e
children 077661071a3a
files packages/io/serial/current/ChangeLog packages/io/serial/current/tests/ser_test_protocol.inl packages/io/serial/current/tests/serial1.c packages/io/serial/current/tests/serial2.c packages/io/serial/current/tests/serial4.c packages/io/serial/current/tests/tty1.c packages/io/serial/current/tests/tty2.c
diffstat 7 files changed, 33 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/packages/io/serial/current/ChangeLog
+++ b/packages/io/serial/current/ChangeLog
@@ -3,7 +3,9 @@ 2005-07-22  Andrew Lunn  <andrew.lunn@as
 	* src/common/tty.c (tty_write): 
 	* src/common/haldiag.c (haldiag_getc): Fixed pointer signness to
 	avoid compiler warnings.
-
+	* tests/*.c msglen should by an unsigned int to avoid compiler
+	warnings.
+	
 2005-07-21  Andrew Lunn  <andrew.lunn@ascom.ch>
 
 	* src/common/termiostty.c: Removed errbuf from priv. It was never
--- a/packages/io/serial/current/tests/ser_test_protocol.inl
+++ b/packages/io/serial/current/tests/ser_test_protocol.inl
@@ -144,12 +144,12 @@
 
 #define TEST_CRASH(__h, __code, __msg, args...)                         \
     CYG_MACRO_START                                                     \
-    int __len = 1;                                                      \
+    cyg_uint32 __len = 1;                                               \
     /* Try to flush remaining input */                                  \
     cyg_thread_delay(50);                                               \
     cyg_io_get_config(__h, CYG_IO_GET_CONFIG_SERIAL_INPUT_FLUSH,        \
                       0, &__len);                                       \
-    diag_printf("FAILCODE:<" TEST_CRASH_ID ":%04x:" __code, ## args);    \
+    diag_printf("FAILCODE:<" TEST_CRASH_ID ":%04x:" __code, ## args);   \
     diag_printf("!>\n");                                                \
     CYG_FAIL(__msg);                                                    \
     hang();                                                             \
@@ -189,7 +189,7 @@
 #endif
 cyg_uint8 in_buffer[IN_BUFFER_SIZE];
 
-cyg_int8 cmd_buffer[128];
+char cmd_buffer[128];
 
 //----------------------------------------------------------------------------
 // Some types specific to the testing protocol.
@@ -368,7 +368,7 @@ static void
 do_abort(void *handle)
 {
     cyg_io_handle_t io_handle = (cyg_io_handle_t)handle;
-    cyg_int32 len = 1;  // Need something here
+    cyg_uint32 len = 1;  // Need something here
     cyg_io_get_config(io_handle, CYG_IO_GET_CONFIG_SERIAL_ABORT, 0, &len);
     aborted = 1;
 }
@@ -505,9 +505,10 @@ change_config(cyg_io_handle_t handle, cy
     cyg_serial_info_t old_cfg, new_cfg;
     const char cmd[] = "@CONFIG:";
     char reply[2];
-    int msglen;
-    int res, len;
-    cyg_uint8 *p1;
+    cyg_uint32 msglen;
+    int res;
+    cyg_uint32 len;
+    char *p1;
 
     // Prepare the command.
     p1 = &cmd_buffer[0];
@@ -525,7 +526,7 @@ change_config(cyg_io_handle_t handle, cy
     *p1 = 0;                            // note: we may append to this later
 
     // Tell user what we're up to.
-    CYG_TEST_INFO(&cmd_buffer[1]);
+    CYG_TEST_INFO((char *)&cmd_buffer[1]);
 
     // Change to new config and then back to determine if the driver likes it.
     len = sizeof(old_cfg);
@@ -610,7 +611,7 @@ change_config(cyg_io_handle_t handle, cy
         int change_succeeded = 0;
         int using_old_config = 0;
         char in_buf[1];
-        int len;
+        cyg_uint32 len;
         int saw_host_sync;
 
         for (;;) {
@@ -637,7 +638,7 @@ change_config(cyg_io_handle_t handle, cy
                 } 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;
+                    cyg_uint32 ok_len = 2;
                     Tcyg_io_write(handle, ok_msg, &ok_len);
                     saw_host_sync = 1;
                 } else if ('D' == in_buf[0] && saw_host_sync) {
@@ -683,7 +684,8 @@ change_config(cyg_io_handle_t handle, cy
 int
 read_host_crc(cyg_io_handle_t handle)
 {
-    int crc, len;
+    int crc;
+    cyg_uint32 len;
     cyg_uint8 ch;
 
     crc = 0;
@@ -744,10 +746,10 @@ cyg_test_return_t
 test_binary(cyg_io_handle_t handle, int size, cyg_mode_t mode)
 {
     const char cmd[] = "@BINARY:";
-    int msglen;
+    cyg_uint32 msglen;
     cyg_uint32 xcrc;
     int icrc, host_crc;
-    cyg_uint8 *p1;
+    char *p1;
     cyg_int8 host_status = 'O';         // host is happy by default
 
     // Verify that the test can be run with available ressources.
@@ -777,7 +779,8 @@ test_binary(cyg_io_handle_t handle, int 
     case MODE_NO_ECHO:
     {
         // Break transfers into chunks no larger than the buffer size.
-        int tx_len, chunk_len, i;
+        int tx_len, i;
+        cyg_uint32 chunk_len;
         while (size > 0) {
             chunk_len = min(IN_BUFFER_SIZE, size);
             tx_len = chunk_len;
@@ -803,7 +806,8 @@ test_binary(cyg_io_handle_t handle, int 
     case MODE_EOP_ECHO:
     {
         // We have already checked that the in buffer is large enough.
-        int i, tx_len, chunk_len;
+        int i, tx_len;
+        cyg_uint32 chunk_len;
         chunk_len = tx_len = size;
         Tcyg_io_read(handle, &in_buffer[0], &chunk_len);
 
@@ -831,7 +835,7 @@ test_binary(cyg_io_handle_t handle, int 
     break;
     case MODE_DUPLEX_ECHO:
     {
-        int chunk_len;
+        cyg_uint32 chunk_len;
         int block_size = 64;
 
         // This is a simple implementation (maybe too simple).
@@ -953,7 +957,7 @@ test_ping(cyg_io_handle_t handle)
 {
     char msg[] = "@PING:" TEST_CRASH_ID "!";
     char msg2[] = "\n";
-    int msglen = strlen(msg);
+    cyg_uint32 msglen = strlen(msg);
     int res;
 
     msglen = strlen(msg);
@@ -985,8 +989,8 @@ void
 test_options(cyg_io_handle_t handle, int count, cyg_uint32* options)
 {
     const char cmd[] = "@OPT:";
-    int msglen;
-    cyg_uint8 *p1;
+    cyg_uint32 msglen;
+    char *p1;
 
     // Prepare and send the command.
     p1 = &cmd_buffer[0];
--- a/packages/io/serial/current/tests/serial1.c
+++ b/packages/io/serial/current/tests/serial1.c
@@ -76,7 +76,8 @@ void
 serial_api_test(int dummy)
 {
     cyg_io_handle_t handle;
-    int res, len;
+    int res;
+    cyg_uint32 len;
     unsigned char buffer[16];
 
     // Always return...
--- a/packages/io/serial/current/tests/serial2.c
+++ b/packages/io/serial/current/tests/serial2.c
@@ -74,7 +74,7 @@ serial_test( void )
 {
     char test_msg1[]="This is a test message!\n";
     char test_msg2[]="$O5468697320697320612074657374206d657373616765210d0a#12";
-    int msglen;
+    cyg_uint32 msglen;
     cyg_io_handle_t ser_handle;
 
     test_open_ser(&ser_handle);
--- a/packages/io/serial/current/tests/serial4.c
+++ b/packages/io/serial/current/tests/serial4.c
@@ -92,7 +92,7 @@ serial_test( void )
         int i;
         int count = sizeof(test_configs) / sizeof(cyg_ser_cfg_t);
         char msg[] = "This is a test\n";
-        int msglen = strlen(msg);
+        cyg_uint32 msglen = strlen(msg);
 
         for (i = 0; i < count; i++){
             if (ENOERR == change_config(ser_handle, &test_configs[i])) {
--- a/packages/io/serial/current/tests/tty1.c
+++ b/packages/io/serial/current/tests/tty1.c
@@ -75,7 +75,8 @@ cyg_handle_t thread_handle;
 void
 tty_api_test(cyg_io_handle_t* handle)
 {
-    int res, len;
+    int res;
+    cyg_uint32 len;
     unsigned char buffer[16];
 
     // Always return...
--- a/packages/io/serial/current/tests/tty2.c
+++ b/packages/io/serial/current/tests/tty2.c
@@ -75,7 +75,7 @@ tty_test( void )
 {
     char test_msg1[]="This is a test message!\n";
     char test_msg2[]="$O5468697320697320612074657374206d657373616765210d0a#12";
-    int msglen;
+    cyg_uint32 msglen;
     cyg_io_handle_t tty_handle;
 
     test_open_tty(&tty_handle);