nexus-am/apps/litenes/include/common.h

35 lines
1.0 KiB
C

#ifndef COMMON_H
#define COMMON_H
#include <am.h>
#include <amdev.h>
#include <klib.h>
#include <klib-macros.h>
typedef uint8_t byte;
typedef uint16_t word;
typedef uint32_t dword;
// Binary Operations
bool common_bit_set(long long value, byte position);
// Byte Bit Operations
void common_set_bitb(byte *variable, byte position);
void common_unset_bitb(byte *variable, byte position);
void common_toggle_bitb(byte *variable, byte position);
void common_modify_bitb(byte *variable, byte position, bool set);
// Word Bit Operations
void common_set_bitw(word *variable, byte position);
void common_unset_bitw(word *variable, byte position);
void common_toggle_bitw(word *variable, byte position);
void common_modify_bitw(word *variable, byte position, bool set);
// Double Word Bit Operations
void common_set_bitd(dword *variable, byte position);
void common_unset_bitd(dword *variable, byte position);
void common_toggle_bitd(dword *variable, byte position);
void common_modify_bitd(dword *variable, byte position, bool set);
#endif