- remove unused objcopy from configure.in
[openocd.git] / src / helper / binarybuffer.c
index acc8237eb08323fcdfab29fbb3623b0a2a061025..12a711f829fb557965a11c342c452c7a6ff230cd 100644 (file)
 
 #include "binarybuffer.h"
 
-int buf_set_u32(u8* buffer, unsigned int first, unsigned int num, u32 value);
-u32 buf_get_u32(u8* buffer, unsigned int first, unsigned int num);
-u32 flip_u32(u32 value, unsigned int num);
-
 const unsigned char bit_reverse_table256[] = 
 {
   0x00, 0x80, 0x40, 0xC0, 0x20, 0xA0, 0x60, 0xE0, 0x10, 0x90, 0x50, 0xD0, 0x30, 0xB0, 0x70, 0xF0, 
@@ -53,43 +49,6 @@ const unsigned char bit_reverse_table256[] =
   0x0F, 0x8F, 0x4F, 0xCF, 0x2F, 0xAF, 0x6F, 0xEF, 0x1F, 0x9F, 0x5F, 0xDF, 0x3F, 0xBF, 0x7F, 0xFF
 };
 
-int buf_set_u32(u8* buffer, unsigned int first, unsigned int num, u32 value)
-{
-       unsigned int i;
-       
-       if (!buffer)
-               return ERROR_INVALID_ARGUMENTS;
-
-       for (i=first; i<first+num; i++)
-       {
-               if (((value >> (i-first))&1) == 1)
-                       buffer[i/8] |= 1 << (i%8);
-               else
-                       buffer[i/8] &= ~(1 << (i%8));
-       }
-       
-       return ERROR_OK;
-}
-
-u32 buf_get_u32(u8* buffer, unsigned int first, unsigned int num)
-{
-       u32 result = 0;
-       unsigned int i;
-       
-       if (!buffer)
-       {
-               ERROR("buffer not initialized");
-               return 0;
-       }
-
-       for (i=first; i<first+num; i++)
-       {
-               if (((buffer[i/8]>>(i%8))&1) == 1)
-                       result |= 1 << (i-first);
-       }
-       
-       return result;
-}
 
 u8* buf_cpy(u8 *from, u8 *to, int size)
 {
@@ -229,7 +188,7 @@ int ceil_f_to_u32(float x)
        return y;
 }
 
-char* buf_to_str(u8 *buf, int buf_len, int radix)
+char* buf_to_str(const u8 *buf, int buf_len, int radix)
 {
        const char *DIGITS = "0123456789abcdef";
        float factor;
@@ -279,7 +238,7 @@ char* buf_to_str(u8 *buf, int buf_len, int radix)
        return str;
 }
 
-int str_to_buf(char* str, int str_len, u8 *buf, int buf_len, int radix)
+int str_to_buf(const char *str, int str_len, u8 *buf, int buf_len, int radix)
 {
        char *charbuf;
        u32 tmp;
@@ -354,7 +313,12 @@ int str_to_buf(char* str, int str_len, u8 *buf, int buf_len, int radix)
        }
        
        for (j = 0; j < CEIL(buf_len, 8); j++)
-               buf[j] = b256_buf[j];
+       {
+               if (j < b256_len)
+                       buf[j] = b256_buf[j];
+               else
+                       buf[j] = 0;
+       }
 
        /* mask out bits that don't belong to the buffer */
        if (buf_len % 8)
@@ -366,7 +330,7 @@ int str_to_buf(char* str, int str_len, u8 *buf, int buf_len, int radix)
        return i;
 }
 
-int buf_to_u32_handler(u8 *in_buf, void *priv)
+int buf_to_u32_handler(u8 *in_buf, void *priv, struct scan_field_s *field)
 {
        u32 *dest = priv;
        

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)