added yours sincerely for files where I feel that I've made non-trivial contributions.
[openocd.git] / src / helper / binarybuffer.c
index ddfcced04e9686e5524fb2b2f53cedbd77bf4564..a3b1cbd59f07e6dce34f4fa0f5283c8decbfd7c3 100644 (file)
@@ -2,6 +2,9 @@
  *   Copyright (C) 2004, 2005 by Dominic Rath                              *
  *   Dominic.Rath@gmx.de                                                   *
  *                                                                         *
+ *   Copyright (C) 2007,2008 Ã˜yvind Harboe                                      *
+ *   oyvind.harboe@zylin.com                                               *
+ *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
  *   it under the terms of the GNU General Public License as published by  *
  *   the Free Software Foundation; either version 2 of the License, or     *
 
 #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 +52,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 +191,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 +241,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;

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)