From: Hugo Villeneuve Date: Thu, 13 Feb 2014 05:38:22 +0000 (-0500) Subject: Fix C99 standard types uintN_t X-Git-Tag: v2.0.1~9 X-Git-Url: http://gitweb.hugovil.com/?a=commitdiff_plain;h=e417485aaf141647fcb32f45e38bbc5163abb2b4;p=emu8051.git Fix C99 standard types uintN_t --- diff --git a/src/common/hexfile.c b/src/common/hexfile.c index b32e671..c9c7de3 100644 --- a/src/common/hexfile.c +++ b/src/common/hexfile.c @@ -34,11 +34,11 @@ void 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"); } diff --git a/src/common/memory.c b/src/common/memory.c index a75f51d..bb0742b 100644 --- a/src/common/memory.c +++ b/src/common/memory.c @@ -21,7 +21,7 @@ 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]; @@ -93,7 +93,7 @@ mem_convert_bit_address(uint8_t bit_address, uint8_t *byte_address, } } -u_int8_t * +uint8_t * mem_getbuf(enum mem_id_t id, unsigned long address) { return &mem_infos[id].buf[address]; @@ -106,7 +106,7 @@ 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) { if (address >= (unsigned long) mem_infos[id].max_size) { log_err("Error writing to memory ID: %d\n" @@ -154,20 +154,20 @@ 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) { /* 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) { @@ -215,14 +215,14 @@ mem_read_bit(uint8_t bit_address) 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) + diff --git a/src/common/memory.h b/src/common/memory.h index 60395a0..2a15cc9 100644 --- a/src/common/memory.h +++ b/src/common/memory.h @@ -10,7 +10,7 @@ #ifndef MEMORY_H #define MEMORY_H 1 -#include +#include #define PGM_MEM_MAX_SIZE 65536 /* @@ -44,14 +44,14 @@ void 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); @@ -63,12 +63,12 @@ void 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 @@ -80,10 +80,10 @@ mem_read_indirect(unsigned int address); 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 diff --git a/src/common/psw.c b/src/common/psw.c index cee09f5..36ab5e2 100644 --- a/src/common/psw.c +++ b/src/common/psw.c @@ -20,7 +20,7 @@ psw_read_bit(int bit) 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 */ diff --git a/src/common/sfr.c b/src/common/sfr.c index 5c78a80..7adc2cd 100644 --- a/src/common/sfr.c +++ b/src/common/sfr.c @@ -37,7 +37,7 @@ regwin_write_pc(int param, int val) { (void) param; /* Remove compiler warning about unused variable. */ - cpu8051.pc = (u_int16_t) val; + cpu8051.pc = (uint16_t) val; } static unsigned int @@ -51,11 +51,11 @@ static void 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; @@ -72,7 +72,7 @@ regwin_read_bank(int dummy) 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. */ @@ -96,7 +96,7 @@ static void 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. */ @@ -279,11 +279,11 @@ static void 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); } } diff --git a/src/gtk/memwin.c b/src/gtk/memwin.c index bced9e6..2ea618a 100644 --- a/src/gtk/memwin.c +++ b/src/gtk/memwin.c @@ -12,6 +12,7 @@ #endif #include +#include #include #include /* For isprint */ #include /* For crc32 routine */ @@ -42,7 +43,7 @@ enum { struct memwin_infos_t { GtkWidget *memlist; int data_rows; - u_int32_t *crc; + uint32_t *crc; int crc_init; }; @@ -83,7 +84,7 @@ memwin_cell_edited(GtkCellRendererText *cell, gchar *path_string, gpointer memory_id_ptr; GtkTreeIter iter; int address; - u_int8_t old; + uint8_t old; int new; char *str; @@ -223,7 +224,7 @@ compute_data_rows(int memory_id) 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; } @@ -286,8 +287,8 @@ static int 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); @@ -351,7 +352,7 @@ memwin_refresh(enum mem_id_t memory_id) 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); diff --git a/src/gtk/pswwin.c b/src/gtk/pswwin.c index 9dd6816..e678abf 100644 --- a/src/gtk/pswwin.c +++ b/src/gtk/pswwin.c @@ -12,6 +12,7 @@ #endif #include +#include #include "common.h" #include "reg8051.h" @@ -83,7 +84,7 @@ pswwin_cell_edited(GtkCellRendererText *cell, gchar *path_string, guint column; gpointer columnptr; GtkTreeIter iter; - u_int8_t old; + uint8_t old; int new; char str[10]; int bit_index;