Make #include guard naming consistent
[fw/openocd] / src / helper / binarybuffer.h
index c2d643b13e44e8a9b9d6a2a54bc3081a5b1e7201..dd0d275abd1ad5e210a8b5871f14191836df1f32 100644 (file)
  *   GNU General Public License for more details.                          *
  *                                                                         *
  *   You should have received a copy of the GNU General Public License     *
- *   along with this program; if not, write to the                         *
- *   Free Software Foundation, Inc.,                                       *
- *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.           *
+ *   along with this program.  If not, see <http://www.gnu.org/licenses/>. *
  ***************************************************************************/
 
-#ifndef BINARYBUFFER_H
-#define BINARYBUFFER_H
+#ifndef OPENOCD_HELPER_BINARYBUFFER_H
+#define OPENOCD_HELPER_BINARYBUFFER_H
 
 #include "list.h"
 
  * @param num The number of bits from @c value to copy (1-32).
  * @param value Up to 32 bits that will be copied to _buffer.
  */
-static inline void buf_set_u32(void *_buffer,
+static inline void buf_set_u32(uint8_t *_buffer,
        unsigned first, unsigned num, uint32_t value)
 {
-       uint8_t *buffer = (uint8_t *)_buffer;
+       uint8_t *buffer = _buffer;
 
        if ((num == 32) && (first == 0)) {
                buffer[3] = (value >> 24) & 0xff;
@@ -68,10 +66,10 @@ static inline void buf_set_u32(void *_buffer,
  * @param num The number of bits from @c value to copy (1-64).
  * @param value Up to 64 bits that will be copied to _buffer.
  */
-static inline void buf_set_u64(void *_buffer,
+static inline void buf_set_u64(uint8_t *_buffer,
        unsigned first, unsigned num, uint64_t value)
 {
-       uint8_t *buffer = (uint8_t *)_buffer;
+       uint8_t *buffer = _buffer;
 
        if ((num == 32) && (first == 0)) {
                buffer[3] = (value >> 24) & 0xff;
@@ -106,10 +104,10 @@ static inline void buf_set_u64(void *_buffer,
  * @param num The number of bits from @c _buffer to read (1-32).
  * @returns Up to 32-bits that were read from @c _buffer.
  */
-static inline uint32_t buf_get_u32(const void *_buffer,
+static inline uint32_t buf_get_u32(const uint8_t *_buffer,
        unsigned first, unsigned num)
 {
-       uint8_t *buffer = (uint8_t *)_buffer;
+       const uint8_t *buffer = _buffer;
 
        if ((num == 32) && (first == 0)) {
                return (((uint32_t)buffer[3]) << 24) |
@@ -135,10 +133,10 @@ static inline uint32_t buf_get_u32(const void *_buffer,
  * @param num The number of bits from @c _buffer to read (1-64).
  * @returns Up to 64-bits that were read from @c _buffer.
  */
-static inline uint64_t buf_get_u64(const void *_buffer,
+static inline uint64_t buf_get_u64(const uint8_t *_buffer,
        unsigned first, unsigned num)
 {
-       uint8_t *buffer = (uint8_t *)_buffer;
+       const uint8_t *buffer = _buffer;
 
        if ((num == 32) && (first == 0)) {
                return 0 + ((((uint32_t)buffer[3]) << 24) |   /* Note - zero plus is to avoid a checkpatch bug */
@@ -238,5 +236,6 @@ void bit_copy_discard(struct bit_copy_queue *q);
  * used in ti-icdi driver and gdb server */
 int unhexify(char *bin, const char *hex, int count);
 int hexify(char *hex, const char *bin, int count, int out_maxlen);
+void buffer_shr(void *_buf, unsigned buf_len, unsigned count);
 
-#endif /* BINARYBUFFER_H */
+#endif /* OPENOCD_HELPER_BINARYBUFFER_H */