int2asciihex(int val, char *str, int width)
{
if (width == 1)
- sprintf(str , "%.1X", (u_int8_t) val);
+ sprintf(str , "%.1X", (uint8_t) val);
else if (width == 2)
- sprintf(str , "%.2X", (u_int8_t) val);
+ sprintf(str , "%.2X", (uint8_t) val);
else if (width == 4)
- sprintf(str , "%.4X", (u_int16_t) val);
+ sprintf(str , "%.4X", (uint16_t) val);
else
sprintf(str , "Err");
}
struct mem_infos_t {
int size;
int max_size;
- u_int8_t *buf;
+ uint8_t *buf;
};
struct mem_infos_t mem_infos[MEM_ID_COUNT];
}
}
-u_int8_t *
+uint8_t *
mem_getbuf(enum mem_id_t id, unsigned long address)
{
return &mem_infos[id].buf[address];
}
void
-mem_write8(enum mem_id_t id, unsigned long address, u_int8_t value)
+mem_write8(enum mem_id_t id, unsigned long address, uint8_t value)
{
if (address >= (unsigned long) mem_infos[id].max_size) {
log_err("Error writing to memory ID: %d\n"
}
void
-mem_sfr_write8(unsigned long address, u_int8_t value)
+mem_sfr_write8(unsigned long address, uint8_t value)
{
/* SFR registers are from addresses $80 to $FF. */
mem_write8(INT_MEM_ID, address, value);
}
void
-mem_sfr_write_dptr(u_int16_t value)
+mem_sfr_write_dptr(uint16_t value)
{
mem_write8(INT_MEM_ID, _DPTRHIGH_, value >> 8);
mem_write8(INT_MEM_ID, _DPTRLOW_, (uint8_t) value);
}
-u_int8_t
+uint8_t
mem_read8(enum mem_id_t id, unsigned long address)
{
if (address >= (unsigned long) mem_infos[id].max_size) {
return bit_value;
}
-u_int8_t
+uint8_t
mem_sfr_read8(unsigned long address)
{
/* SFR registers are from addresses $80 to $FF. */
return mem_read8(INT_MEM_ID, address);
}
-u_int16_t
+uint16_t
mem_sfr_read_dptr(void)
{
return (mem_read8(INT_MEM_ID, _DPTRHIGH_) << 8) +
#ifndef MEMORY_H
#define MEMORY_H 1
-#include <sys/types.h>
+#include <stdint.h>
#define PGM_MEM_MAX_SIZE 65536
/*
mem_convert_bit_address(uint8_t bit_address, uint8_t *byte_address,
uint8_t *bit_number);
-u_int8_t *
+uint8_t *
mem_getbuf(enum mem_id_t id, unsigned long address);
void
mem_clear(enum mem_id_t id);
void
-mem_write8(enum mem_id_t id, unsigned long address, u_int8_t value);
+mem_write8(enum mem_id_t id, unsigned long address, uint8_t value);
void
mem_write_direct(unsigned int address, unsigned char value);
mem_write_bit(uint8_t bit_address, uint8_t value);
void
-mem_sfr_write8(unsigned long address, u_int8_t value);
+mem_sfr_write8(unsigned long address, uint8_t value);
void
-mem_sfr_write_dptr(u_int16_t value);
+mem_sfr_write_dptr(uint16_t value);
-u_int8_t
+uint8_t
mem_read8(enum mem_id_t id, unsigned long address);
unsigned char
unsigned char
mem_read_bit(uint8_t bit_address);
-u_int8_t
+uint8_t
mem_sfr_read8(unsigned long address);
-u_int16_t
+uint16_t
mem_sfr_read_dptr(void);
void
void
psw_write_bit(int bit, int val)
{
- u_int8_t psw = mem_read8(INT_MEM_ID, _PSW_);
+ uint8_t psw = mem_read8(INT_MEM_ID, _PSW_);
if (val)
psw |= (1 << bit); /* Set */
{
(void) param; /* Remove compiler warning about unused variable. */
- cpu8051.pc = (u_int16_t) val;
+ cpu8051.pc = (uint16_t) val;
}
static unsigned int
regwin_write_timer(int timer_low_addr, int val)
{
mem_sfr_write8(timer_low_addr + 2,
- (u_int8_t) ((val & 0x0000FFFF) >> 8));
- mem_sfr_write8(timer_low_addr, (u_int8_t) val);
+ (uint8_t) ((val & 0x0000FFFF) >> 8));
+ mem_sfr_write8(timer_low_addr, (uint8_t) val);
}
-static u_int8_t
+static uint8_t
regwin_read_bank_offset(void)
{
return mem_sfr_read8(_PSW_) & 0x18;
static void
regwin_write_bank(int param, int bank_number)
{
- u_int8_t psw = mem_sfr_read8(_PSW_);
+ uint8_t psw = mem_sfr_read8(_PSW_);
(void) param; /* Remove compiler warning about unused variable. */
regwin_write_rx(int offset, int val)
{
mem_write8(INT_MEM_ID, regwin_read_bank_offset() + offset,
- (u_int8_t) val);
+ (uint8_t) val);
}
/* This array defines how to read value for each register. */
regwin_write_generic(int addr, int val, int width)
{
if (width == 2) {
- mem_sfr_write8(addr, (u_int8_t) val);
+ mem_sfr_write8(addr, (uint8_t) val);
} else if (width == 4) {
/* Address is low address. */
- mem_sfr_write8(addr + 1, (u_int8_t) ((val & 0x0000FFFF) >> 8));
- mem_sfr_write8(addr, (u_int8_t) val);
+ mem_sfr_write8(addr + 1, (uint8_t) ((val & 0x0000FFFF) >> 8));
+ mem_sfr_write8(addr, (uint8_t) val);
}
}
#endif
#include <stdio.h>
+#include <stdint.h>
#include <stdbool.h>
#include <ctype.h> /* For isprint */
#include <zlib.h> /* For crc32 routine */
struct memwin_infos_t {
GtkWidget *memlist;
int data_rows;
- u_int32_t *crc;
+ uint32_t *crc;
int crc_init;
};
gpointer memory_id_ptr;
GtkTreeIter iter;
int address;
- u_int8_t old;
+ uint8_t old;
int new;
char *str;
if (memwin_infos->crc)
free(memwin_infos->crc);
- memwin_infos->crc = malloc(memwin_infos->data_rows * sizeof(u_int32_t));
+ memwin_infos->crc = malloc(memwin_infos->data_rows * sizeof(uint32_t));
memwin_infos->crc_init = false;
}
memwin_row_changed(enum mem_id_t memory_id, int row, unsigned int address)
{
int row_changed;
- u_int32_t crc_new = 0;
- u_int8_t *buf8;
+ uint32_t crc_new = 0;
+ uint8_t *buf8;
buf8 = mem_getbuf(memory_id, address);
crc_new = crc32(0L, Z_NULL, 0);
gtk_list_store_set(store, &iter, COL_ADDRESS, str, -1);
for (col = 0; col < cfg->bytes_per_row; col++) {
- u_int8_t data;
+ uint8_t data;
data = mem_read8(memory_id, address + col);
#endif
#include <stdio.h>
+#include <stdint.h>
#include "common.h"
#include "reg8051.h"
guint column;
gpointer columnptr;
GtkTreeIter iter;
- u_int8_t old;
+ uint8_t old;
int new;
char str[10];
int bit_index;