diff --git a/src/barcode.c b/src/barcode.c index 415b2a0..6977c41 100644 --- a/src/barcode.c +++ b/src/barcode.c @@ -10,15 +10,15 @@ #include "libsys.h" #include "irq.h" -UINT32 buffer[16384]; +uint32_t buffer[16384]; #define T_SAMPLE 5000 #define TIMEOUT 1000 typedef struct _bar_t { - UINT32 T; - UINT32 black; + uint32_t T; + uint32_t black; } bar_t; enum @@ -30,13 +30,13 @@ enum typedef struct _sbar_cand_t { - UINT32 T; - UINT32 is_primitive; + uint32_t T; + uint32_t is_primitive; } bar_cand_t; bar_t bars[1024]; -void bsort(float *pData, UINT32 len) +void bsort(float *pData, uint32_t len) { float t; int i, j; @@ -57,14 +57,14 @@ void bsort(float *pData, UINT32 len) typedef struct _smedian_t { - UINT32 N; - UINT32 is_dirty; + uint32_t N; + uint32_t is_dirty; float *pBuf, *pSorted; - UINT32 w; + uint32_t w; float median; } median_t; -void Median_init(median_t *pObj, UINT32 N, float init_val) +void Median_init(median_t *pObj, uint32_t N, float init_val) { int i; pObj->pBuf = (float*)malloc(N*sizeof(float)); @@ -124,9 +124,9 @@ float Median_get(median_t *pObj) } // ------------------------------------------------------------- -UINT32 detect_module(UINT32 T, UINT32 T0) +uint32_t detect_module(uint32_t T, uint32_t T0) { - UINT32 m, best_M; + uint32_t m, best_M; float err, kc, best_err; best_err = 4.f; @@ -149,16 +149,16 @@ UINT32 detect_module(UINT32 T, UINT32 T0) void handler7(void) { - UINT32 volatile *pTim_ctrl = (UINT32*)SYS_ITIM_CTRL; - UINT32 volatile *pTim_stat = (UINT32*)SYS_ITIM_STAT; - UINT32 volatile *pPS20_stat = (UINT32*)SYS_PS2_0_STAT; - UINT32 volatile *pPS21_stat = (UINT32*)SYS_PS2_1_STAT; - static UINT32 state, bar_count; - static UINT32 timeout_count, timeout_reload; - static UINT32 white, pin_last, skip, start; - static UINT32 module_cnt_w, module_cnt_b, Tmod0_w, Tmod0_b, M, T0; + uint32_t volatile *pTim_ctrl = (uint32_t*)SYS_ITIM_CTRL; + uint32_t volatile *pTim_stat = (uint32_t*)SYS_ITIM_STAT; + uint32_t volatile *pPS20_stat = (uint32_t*)SYS_PS2_0_STAT; + uint32_t volatile *pPS21_stat = (uint32_t*)SYS_PS2_1_STAT; + static uint32_t state, bar_count; + static uint32_t timeout_count, timeout_reload; + static uint32_t white, pin_last, skip, start; + static uint32_t module_cnt_w, module_cnt_b, Tmod0_w, Tmod0_b, M, T0; float ratio, error, kc; - UINT32 i; + uint32_t i; static median_t med_b, med_w; static bar_cand_t bc_b, bc_w; static median_t speed_b, speed_w; @@ -274,7 +274,7 @@ void handler7(void) // printf("M=%d, R=%2.2f, E=%+2.2f [%04d]", M, ratio, error, T0); // if (M == 1) - Median_value_add(&med_b, (UINT32)(T0*kc)); + Median_value_add(&med_b, (uint32_t)(T0*kc)); Median_value_add(&speed_b, (float)bars[i].T/(M*Tmod0_b)); printf("%06d %2.6f ", bars[i].T, Median_get(&speed_b)); @@ -303,7 +303,7 @@ void handler7(void) // printf(" M=%d, R=%2.2f, E=%+2.2f [%04d]", M, ratio, error, T0); // if (M == 1) - Median_value_add(&med_w, (UINT32)(T0*kc)); + Median_value_add(&med_w, (uint32_t)(T0*kc)); Median_value_add(&speed_w, (float)bars[i].T/(M*Tmod0_w)); printf("%06d %2.6f ", bars[i].T, Median_get(&speed_w)); @@ -335,13 +335,13 @@ int main(void) { int i; - UINT32 volatile *pTim_ctrl = (UINT32*)SYS_ITIM_CTRL; - UINT32 volatile *pTim_stat = (UINT32*)SYS_ITIM_STAT; - UINT32 volatile *pTim0_cnt = (UINT32*)SYS_ITIM0_CNT; - UINT32 volatile *pTim0_cmp = (UINT32*)SYS_ITIM0_CMP; + uint32_t volatile *pTim_ctrl = (uint32_t*)SYS_ITIM_CTRL; + uint32_t volatile *pTim_stat = (uint32_t*)SYS_ITIM_STAT; + uint32_t volatile *pTim0_cnt = (uint32_t*)SYS_ITIM0_CNT; + uint32_t volatile *pTim0_cmp = (uint32_t*)SYS_ITIM0_CMP; *pTim0_cnt = 0; - *pTim0_cmp = (UINT32)T_SAMPLE; + *pTim0_cmp = (uint32_t)T_SAMPLE; *pTim_stat = 1; *pTim_ctrl = 3; diff --git a/src/barcode.new.c b/src/barcode.new.c index cfe65c6..a2a41c3 100644 --- a/src/barcode.new.c +++ b/src/barcode.new.c @@ -10,15 +10,15 @@ #include "libsys.h" #include "irq.h" -UINT32 buffer[16384]; +uint32_t buffer[16384]; #define T_SAMPLE 5000 #define TIMEOUT 1000 typedef struct _bar_t { - UINT32 T; - UINT32 black; + uint32_t T; + uint32_t black; } bar_t; enum @@ -30,7 +30,7 @@ enum bar_t bars[1024]; -void bsort(float *pData, UINT32 len) +void bsort(float *pData, uint32_t len) { float t; int i, j; @@ -51,14 +51,14 @@ void bsort(float *pData, UINT32 len) typedef struct _smedian_t { - UINT32 N; - UINT32 is_dirty; + uint32_t N; + uint32_t is_dirty; float *pBuf, *pSorted; - UINT32 w; + uint32_t w; float median; } median_t; -void Median_init(median_t *pObj, UINT32 N, float init_val) +void Median_init(median_t *pObj, uint32_t N, float init_val) { int i; pObj->pBuf = (float*)malloc(N*sizeof(float)); @@ -118,9 +118,9 @@ float Median_get(median_t *pObj) } // ------------------------------------------------------------- -UINT32 detect_module(UINT32 T, UINT32 *pBC) +uint32_t detect_module(uint32_t T, uint32_t *pBC) { - UINT32 m, best_M; + uint32_t m, best_M; float err, kc, best_err; best_err = 4.f; @@ -143,18 +143,18 @@ UINT32 detect_module(UINT32 T, UINT32 *pBC) void handler7(void) { - UINT32 volatile *pTim_ctrl = (UINT32*)SYS_ITIM_CTRL; - UINT32 volatile *pTim_stat = (UINT32*)SYS_ITIM_STAT; - UINT32 volatile *pPS20_stat = (UINT32*)SYS_PS2_0_STAT; - UINT32 volatile *pPS21_stat = (UINT32*)SYS_PS2_1_STAT; - static UINT32 state, bar_count; - static UINT32 timeout_count, timeout_reload; - static UINT32 white, pin_last, skip, start; - static UINT32 module_cnt_w, module_cnt_b, Tmod0_w, Tmod0_b, M, T0; + uint32_t volatile *pTim_ctrl = (uint32_t*)SYS_ITIM_CTRL; + uint32_t volatile *pTim_stat = (uint32_t*)SYS_ITIM_STAT; + uint32_t volatile *pPS20_stat = (uint32_t*)SYS_PS2_0_STAT; + uint32_t volatile *pPS21_stat = (uint32_t*)SYS_PS2_1_STAT; + static uint32_t state, bar_count; + static uint32_t timeout_count, timeout_reload; + static uint32_t white, pin_last, skip, start; + static uint32_t module_cnt_w, module_cnt_b, Tmod0_w, Tmod0_b, M, T0; float ratio, error, kc; - UINT32 i, j; + uint32_t i, j; static median_t med_b, med_w; - static UINT32 bc_b[4], bc_w[4]; + static uint32_t bc_b[4], bc_w[4]; if (*pTim_stat & 1) { @@ -254,7 +254,7 @@ void handler7(void) Median_value_add(&med_b, kc); printf("M=%d, R=%2.2f, E=%+2.2f [%04d]", M, kc, error, bc_b[M-1]); kc = Median_get(&med_b); - bc_b[M-1] = (UINT32)(kc*bc_b[M-1]); + bc_b[M-1] = (uint32_t)(kc*bc_b[M-1]); } // printf("%d", M); @@ -269,7 +269,7 @@ void handler7(void) Median_value_add(&med_w, kc); printf(" M=%d, R=%2.2f, E=%+2.2f [%04d]", M, kc, error, bc_w[M-1]); kc = Median_get(&med_w); - bc_w[M-1] = (UINT32)(kc*bc_w[M-1]); + bc_w[M-1] = (uint32_t)(kc*bc_w[M-1]); } // printf("%d", M); @@ -299,13 +299,13 @@ int main(void) { int i; - UINT32 volatile *pTim_ctrl = (UINT32*)SYS_ITIM_CTRL; - UINT32 volatile *pTim_stat = (UINT32*)SYS_ITIM_STAT; - UINT32 volatile *pTim0_cnt = (UINT32*)SYS_ITIM0_CNT; - UINT32 volatile *pTim0_cmp = (UINT32*)SYS_ITIM0_CMP; + uint32_t volatile *pTim_ctrl = (uint32_t*)SYS_ITIM_CTRL; + uint32_t volatile *pTim_stat = (uint32_t*)SYS_ITIM_STAT; + uint32_t volatile *pTim0_cnt = (uint32_t*)SYS_ITIM0_CNT; + uint32_t volatile *pTim0_cmp = (uint32_t*)SYS_ITIM0_CMP; *pTim0_cnt = 0; - *pTim0_cmp = (UINT32)T_SAMPLE; + *pTim0_cmp = (uint32_t)T_SAMPLE; *pTim_stat = 1; *pTim_ctrl = 3; diff --git a/src/blittertest.c b/src/blittertest.c index eea1bab..9f07344 100644 --- a/src/blittertest.c +++ b/src/blittertest.c @@ -16,23 +16,23 @@ gpio_if_t gpio_if; box_t box; gfx_t gfx; -UINT32 color_cycle[12] = {0x000000FF, 0x00808080, 0x0000FFFF, 0x00808080, 0x0000FF00, 0x00808080, 0x00FFFF00, 0x00808080, 0x00FF0000, 0x00808080, 0x00FF00FF, 0x00808080}; +uint32_t color_cycle[12] = {0x000000FF, 0x00808080, 0x0000FFFF, 0x00808080, 0x0000FF00, 0x00808080, 0x00FFFF00, 0x00808080, 0x00FF0000, 0x00808080, 0x00FF00FF, 0x00808080}; -volatile UINT32 _g_blitter_rdy; -volatile UINT32 _g_blit_count; +volatile uint32_t _g_blitter_rdy; +volatile uint32_t _g_blit_count; void ISR_blitter_FIN(void) { - UINT32 volatile *pVGA_src0 = (UINT32*)SYS_VGA_BLIT_SRC0_ADDR; - UINT32 volatile *pVGA_dst = (UINT32*)SYS_VGA_BLIT_DST_ADDR; - UINT32 volatile *pVGA_dimx_src0 = (UINT32*)SYS_VGA_BLIT_SRC0_DIMX; - UINT32 volatile *pVGA_dimx_dst = (UINT32*)SYS_VGA_BLIT_DST_DIMX; - UINT32 volatile *pVGA_nx = (UINT32*)SYS_VGA_BLIT_NX; - UINT32 volatile *pVGA_ny = (UINT32*)SYS_VGA_BLIT_NY; - UINT32 volatile *pVGA_ctrl = (UINT32*)SYS_VGA_CTRL; - UINT32 volatile *pVGA_moffs_0 = (UINT32*)SYS_VGA_FB_FRONT; - UINT32 volatile *pVGA_const_color = (UINT32*)SYS_VGA_BLIT_COLOR; - UINT32 volatile *pGPIO = (UINT32*)SYS_GPIO_0_DATA; - static UINT32 color; + uint32_t volatile *pVGA_src0 = (uint32_t*)SYS_VGA_BLIT_SRC0_ADDR; + uint32_t volatile *pVGA_dst = (uint32_t*)SYS_VGA_BLIT_DST_ADDR; + uint32_t volatile *pVGA_dimx_src0 = (uint32_t*)SYS_VGA_BLIT_SRC0_DIMX; + uint32_t volatile *pVGA_dimx_dst = (uint32_t*)SYS_VGA_BLIT_DST_DIMX; + uint32_t volatile *pVGA_nx = (uint32_t*)SYS_VGA_BLIT_NX; + uint32_t volatile *pVGA_ny = (uint32_t*)SYS_VGA_BLIT_NY; + uint32_t volatile *pVGA_ctrl = (uint32_t*)SYS_VGA_CTRL; + uint32_t volatile *pVGA_moffs_0 = (uint32_t*)SYS_VGA_FB_FRONT; + uint32_t volatile *pVGA_const_color = (uint32_t*)SYS_VGA_BLIT_COLOR; + uint32_t volatile *pGPIO = (uint32_t*)SYS_GPIO_0_DATA; + static uint32_t color; // Ack if(_g_blit_count) @@ -59,17 +59,17 @@ void ISR_blitter_FIN(void) void ISR_blitter_EMPTY(void) { - UINT32 volatile *pVGA_src0 = (UINT32*)SYS_VGA_BLIT_SRC0_ADDR; - UINT32 volatile *pVGA_dst = (UINT32*)SYS_VGA_BLIT_DST_ADDR; - UINT32 volatile *pVGA_dimx_src0 = (UINT32*)SYS_VGA_BLIT_SRC0_DIMX; - UINT32 volatile *pVGA_dimx_dst = (UINT32*)SYS_VGA_BLIT_DST_DIMX; - UINT32 volatile *pVGA_nx = (UINT32*)SYS_VGA_BLIT_NX; - UINT32 volatile *pVGA_ny = (UINT32*)SYS_VGA_BLIT_NY; - UINT32 volatile *pVGA_ctrl = (UINT32*)SYS_VGA_CTRL; - UINT32 volatile *pVGA_moffs_0 = (UINT32*)SYS_VGA_FB_FRONT; - UINT32 volatile *pVGA_const_color = (UINT32*)SYS_VGA_BLIT_COLOR; - UINT32 volatile *pGPIO = (UINT32*)SYS_GPIO_0_DATA; - static UINT32 color; + uint32_t volatile *pVGA_src0 = (uint32_t*)SYS_VGA_BLIT_SRC0_ADDR; + uint32_t volatile *pVGA_dst = (uint32_t*)SYS_VGA_BLIT_DST_ADDR; + uint32_t volatile *pVGA_dimx_src0 = (uint32_t*)SYS_VGA_BLIT_SRC0_DIMX; + uint32_t volatile *pVGA_dimx_dst = (uint32_t*)SYS_VGA_BLIT_DST_DIMX; + uint32_t volatile *pVGA_nx = (uint32_t*)SYS_VGA_BLIT_NX; + uint32_t volatile *pVGA_ny = (uint32_t*)SYS_VGA_BLIT_NY; + uint32_t volatile *pVGA_ctrl = (uint32_t*)SYS_VGA_CTRL; + uint32_t volatile *pVGA_moffs_0 = (uint32_t*)SYS_VGA_FB_FRONT; + uint32_t volatile *pVGA_const_color = (uint32_t*)SYS_VGA_BLIT_COLOR; + uint32_t volatile *pGPIO = (uint32_t*)SYS_GPIO_0_DATA; + static uint32_t color; // Ack if(_g_blit_count) @@ -95,22 +95,22 @@ void ISR_blitter_EMPTY(void) } void BlitWaitStillActive(void); -void BlitConstColor(UINT32 fb_addr, UINT32 dim_x, UINT32 pos_x, UINT32 pos_y, UINT32 size_x, UINT32 size_y, UINT32 color); -void Blit(UINT32 fb_addr, UINT32 dim_x, UINT32 pos_x_src, UINT32 pos_y_src, UINT32 pos_x_dst, UINT32 pos_y_dst, UINT32 size_x, UINT32 size_y); +void BlitConstColor(uint32_t fb_addr, uint32_t dim_x, uint32_t pos_x, uint32_t pos_y, uint32_t size_x, uint32_t size_y, uint32_t color); +void Blit(uint32_t fb_addr, uint32_t dim_x, uint32_t pos_x_src, uint32_t pos_y_src, uint32_t pos_x_dst, uint32_t pos_y_dst, uint32_t size_x, uint32_t size_y); // ------------------------------------------------------------- -void LoadPic(UINT64 *pScreen, UINT32 screen_nx, UINT32 screen_ny, UINT32 *pImage, UINT32 image_nx, UINT32 image_ny, UINT32 image_scale_x, UINT32 image_scale_y) +void LoadPic(uint64_t *pScreen, uint32_t screen_nx, uint32_t screen_ny, uint32_t *pImage, uint32_t image_nx, uint32_t image_ny, uint32_t image_scale_x, uint32_t image_scale_y) { - UINT32 off_x, off_y; - UINT32 i, j, black; - UINT32 *pScr, *pImg; + uint32_t off_x, off_y; + uint32_t i, j, black; + uint32_t *pScr, *pImg; off_x = (screen_nx-(image_scale_x*image_nx))/2; off_y = (screen_ny-(image_scale_y*image_ny))/2; black = 0; - pScr = (UINT32*)pScreen; + pScr = (uint32_t*)pScreen; for (i=0; i < screen_nx*screen_ny; i += 8) { __gfx_block_set_8(pScr, 0); @@ -120,7 +120,7 @@ void LoadPic(UINT64 *pScreen, UINT32 screen_nx, UINT32 screen_ny, UINT32 *pImage if (!pImage) return; - pScr = ((UINT32*)pScreen) + screen_nx*off_y + off_x; + pScr = ((uint32_t*)pScreen) + screen_nx*off_y + off_x; pImg = pImage; for (i=0; i < image_ny*image_nx; i += 8) @@ -131,19 +131,19 @@ void LoadPic(UINT64 *pScreen, UINT32 screen_nx, UINT32 screen_ny, UINT32 *pImage } /* - UINT32 off_x, off_y; - UINT32 i; - UINT32 *pScr; + uint32_t off_x, off_y; + uint32_t i; + uint32_t *pScr; off_x = (screen_nx-(image_scale_x*image_nx))/2; off_y = (screen_ny-(image_scale_y*image_ny))/2; - memset(pScreen, 0, screen_nx*screen_ny*sizeof(UINT32)); - pScr = ((UINT32*)pScreen) + screen_nx*off_y + off_x; + memset(pScreen, 0, screen_nx*screen_ny*sizeof(uint32_t)); + pScr = ((uint32_t*)pScreen) + screen_nx*off_y + off_x; for (i=0; i < image_ny; i++) { - memcpy(pScr, &pImage[i*image_nx], image_nx*sizeof(UINT32)); + memcpy(pScr, &pImage[i*image_nx], image_nx*sizeof(uint32_t)); pScr += screen_nx; } */ @@ -152,37 +152,37 @@ void LoadPic(UINT64 *pScreen, UINT32 screen_nx, UINT32 screen_ny, UINT32 *pImage int main (void) { int result, i, j, cnt, size, num_runs; - UINT32 volatile *pUART_baud = (UINT32*)SYS_UART_BAUD; - UINT32 volatile *pUART_stat = (UINT32*)SYS_UART_STAT; - UINT32 volatile *pGPIO = (UINT32*)SYS_GPIO_0_DATA; - UINT32 volatile *pReg_usec = (UINT32*)SYS_TIMER_USEC; - UINT32 volatile *pReg_sec = (UINT32*)SYS_TIMER_SEC; - UINT32 volatile *pSSRAM = (UINT32*)SYS_SSRAM_IO; - UINT32 volatile *pTim_ctrl = (UINT32*)SYS_ITIM_CTRL; - UINT32 volatile *pTim_stat = (UINT32*)SYS_ITIM_STAT; - UINT32 volatile *pTim0_cnt = (UINT32*)SYS_ITIM0_CNT; - UINT32 volatile *pTim0_cmp = (UINT32*)SYS_ITIM0_CMP; - UINT32 volatile *pTim1_cnt = (UINT32*)SYS_ITIM1_CNT; - UINT32 volatile *pTim1_cmp = (UINT32*)SYS_ITIM1_CMP; - UINT32 volatile *pVGA_cgcol = (UINT32*)SYS_VGA_CGCOL; - UINT32 volatile *pFlashPicture = (UINT32*)(SYS_FLASH_MEM + 0x00600000); + uint32_t volatile *pUART_baud = (uint32_t*)SYS_UART_BAUD; + uint32_t volatile *pUART_stat = (uint32_t*)SYS_UART_STAT; + uint32_t volatile *pGPIO = (uint32_t*)SYS_GPIO_0_DATA; + uint32_t volatile *pReg_usec = (uint32_t*)SYS_TIMER_USEC; + uint32_t volatile *pReg_sec = (uint32_t*)SYS_TIMER_SEC; + uint32_t volatile *pSSRAM = (uint32_t*)SYS_SSRAM_IO; + uint32_t volatile *pTim_ctrl = (uint32_t*)SYS_ITIM_CTRL; + uint32_t volatile *pTim_stat = (uint32_t*)SYS_ITIM_STAT; + uint32_t volatile *pTim0_cnt = (uint32_t*)SYS_ITIM0_CNT; + uint32_t volatile *pTim0_cmp = (uint32_t*)SYS_ITIM0_CMP; + uint32_t volatile *pTim1_cnt = (uint32_t*)SYS_ITIM1_CNT; + uint32_t volatile *pTim1_cmp = (uint32_t*)SYS_ITIM1_CMP; + uint32_t volatile *pVGA_cgcol = (uint32_t*)SYS_VGA_CGCOL; + uint32_t volatile *pFlashPicture = (uint32_t*)(SYS_FLASH_MEM + 0x00600000); - UINT32 volatile *pVGA_src0 = (UINT32*)SYS_VGA_BLIT_SRC0_ADDR; - UINT32 volatile *pVGA_dst = (UINT32*)SYS_VGA_BLIT_DST_ADDR; - UINT32 volatile *pVGA_dimx_src0 = (UINT32*)SYS_VGA_BLIT_SRC0_DIMX; - UINT32 volatile *pVGA_dimx_dst = (UINT32*)SYS_VGA_BLIT_DST_DIMX; - UINT32 volatile *pVGA_nx = (UINT32*)SYS_VGA_BLIT_NX; - UINT32 volatile *pVGA_ny = (UINT32*)SYS_VGA_BLIT_NY; - UINT32 volatile *pVGA_ctrl = (UINT32*)SYS_VGA_CTRL; - UINT32 volatile *pVGA_moffs_0 = (UINT32*)SYS_VGA_FB_FRONT; - UINT32 volatile *pVGA_const_color = (UINT32*)SYS_VGA_BLIT_COLOR; + uint32_t volatile *pVGA_src0 = (uint32_t*)SYS_VGA_BLIT_SRC0_ADDR; + uint32_t volatile *pVGA_dst = (uint32_t*)SYS_VGA_BLIT_DST_ADDR; + uint32_t volatile *pVGA_dimx_src0 = (uint32_t*)SYS_VGA_BLIT_SRC0_DIMX; + uint32_t volatile *pVGA_dimx_dst = (uint32_t*)SYS_VGA_BLIT_DST_DIMX; + uint32_t volatile *pVGA_nx = (uint32_t*)SYS_VGA_BLIT_NX; + uint32_t volatile *pVGA_ny = (uint32_t*)SYS_VGA_BLIT_NY; + uint32_t volatile *pVGA_ctrl = (uint32_t*)SYS_VGA_CTRL; + uint32_t volatile *pVGA_moffs_0 = (uint32_t*)SYS_VGA_FB_FRONT; + uint32_t volatile *pVGA_const_color = (uint32_t*)SYS_VGA_BLIT_COLOR; - UINT32 screen_res_x, screen_res_y, screen_fps; - UINT32 pos, posx, posy, xoff, yoff, color; - UINT64 *pBuf64_0, *pBuf64_1; + uint32_t screen_res_x, screen_res_y, screen_fps; + uint32_t pos, posx, posy, xoff, yoff, color; + uint64_t *pBuf64_0, *pBuf64_1; time_t curr_date; struct tm *pDate, date; - UINT32 start, end; + uint32_t start, end; char sel[80]; struct timeval time_sec; @@ -233,7 +233,7 @@ int main (void) *pVGA_nx = box.w; *pVGA_ny = box.h; *pVGA_ctrl |= SYS_VGA_BIT_BLIT_OP_CONSTCOL; - *pVGA_dst = (UINT32)*pVGA_moffs_0 + 4*(5 + 800*5);// + 4*((UINT32)rand()%800 + 800*((UINT32)rand()%600)); + *pVGA_dst = (uint32_t)*pVGA_moffs_0 + 4*(5 + 800*5);// + 4*((uint32_t)rand()%800 + 800*((uint32_t)rand()%600)); color = 0; start = clock(); @@ -317,28 +317,28 @@ int main (void) xoff = 100; yoff = 0; GFX_box_draw_direct(&gfx, &box, xoff+i, yoff+i, color); - BlitConstColor((UINT32)*pVGA_moffs_0, 800, xoff+100+i, yoff+i, box.w, box.h, color); - BlitConstColor((UINT32)*pVGA_moffs_0, 800, xoff+201+i, yoff+i, box.w, box.h, color); - Blit((UINT32)*pVGA_moffs_0, 800, xoff+i, yoff+i, xoff+300+i, yoff+i, box.w, box.h); - Blit((UINT32)*pVGA_moffs_0, 800, xoff+i, yoff+i, xoff+401+i, yoff+i, box.w, box.h); + BlitConstColor((uint32_t)*pVGA_moffs_0, 800, xoff+100+i, yoff+i, box.w, box.h, color); + BlitConstColor((uint32_t)*pVGA_moffs_0, 800, xoff+201+i, yoff+i, box.w, box.h, color); + Blit((uint32_t)*pVGA_moffs_0, 800, xoff+i, yoff+i, xoff+300+i, yoff+i, box.w, box.h); + Blit((uint32_t)*pVGA_moffs_0, 800, xoff+i, yoff+i, xoff+401+i, yoff+i, box.w, box.h); box_create(&box, 63-2*i, 63-2*i); xoff = 100; yoff = 100; GFX_box_draw_direct(&gfx, &box, xoff+i, yoff+i, color); - BlitConstColor((UINT32)*pVGA_moffs_0, 800, xoff+100+i, yoff+i, box.w, box.h, color); - BlitConstColor((UINT32)*pVGA_moffs_0, 800, xoff+201+i, yoff+i, box.w, box.h, color); - Blit((UINT32)*pVGA_moffs_0, 800, xoff+i, yoff+i, xoff+300+i, yoff+i, box.w, box.h); - Blit((UINT32)*pVGA_moffs_0, 800, xoff+i, yoff+i, xoff+401+i, yoff+i, box.w, box.h); + BlitConstColor((uint32_t)*pVGA_moffs_0, 800, xoff+100+i, yoff+i, box.w, box.h, color); + BlitConstColor((uint32_t)*pVGA_moffs_0, 800, xoff+201+i, yoff+i, box.w, box.h, color); + Blit((uint32_t)*pVGA_moffs_0, 800, xoff+i, yoff+i, xoff+300+i, yoff+i, box.w, box.h); + Blit((uint32_t)*pVGA_moffs_0, 800, xoff+i, yoff+i, xoff+401+i, yoff+i, box.w, box.h); xoff = 100; yoff = 200; box_create(&box, 65-2*i, 65-2*i); GFX_box_draw_direct(&gfx, &box, xoff+i, yoff+i, color); - BlitConstColor((UINT32)*pVGA_moffs_0, 800, xoff+100+i, yoff+i, box.w, box.h, color); - BlitConstColor((UINT32)*pVGA_moffs_0, 800, xoff+201+i, yoff+i, box.w, box.h, color); - Blit((UINT32)*pVGA_moffs_0, 800, xoff+i, yoff+i, xoff+300+i, yoff+i, box.w, box.h); - Blit((UINT32)*pVGA_moffs_0, 800, xoff+i, yoff+i, xoff+401+i, yoff+i, box.w, box.h); + BlitConstColor((uint32_t)*pVGA_moffs_0, 800, xoff+100+i, yoff+i, box.w, box.h, color); + BlitConstColor((uint32_t)*pVGA_moffs_0, 800, xoff+201+i, yoff+i, box.w, box.h, color); + Blit((uint32_t)*pVGA_moffs_0, 800, xoff+i, yoff+i, xoff+300+i, yoff+i, box.w, box.h); + Blit((uint32_t)*pVGA_moffs_0, 800, xoff+i, yoff+i, xoff+401+i, yoff+i, box.w, box.h); } GFX_frame(&gfx, GFX_FRAME_SYNC); @@ -351,8 +351,8 @@ int main (void) color = color_cycle[i%12]; GFX_box_draw_direct(&gfx, &box, xoff+i, yoff, color); } - Blit((UINT32)*pVGA_moffs_0, 800, xoff, yoff, xoff, yoff+65, 64, 64); - Blit((UINT32)*pVGA_moffs_0, 800, xoff, yoff, xoff+1, yoff+65+65, 64, 64); + Blit((uint32_t)*pVGA_moffs_0, 800, xoff, yoff, xoff, yoff+65, 64, 64); + Blit((uint32_t)*pVGA_moffs_0, 800, xoff, yoff, xoff+1, yoff+65+65, 64, 64); xoff = 81; yoff = 300; @@ -362,8 +362,8 @@ int main (void) color = color_cycle[i%12]; GFX_box_draw_direct(&gfx, &box, xoff+i, yoff, color); } - Blit((UINT32)*pVGA_moffs_0, 800, xoff, yoff, xoff, yoff+65, 64, 64); - Blit((UINT32)*pVGA_moffs_0, 800, xoff, yoff, xoff+1, yoff+65+65, 64, 64); + Blit((uint32_t)*pVGA_moffs_0, 800, xoff, yoff, xoff, yoff+65, 64, 64); + Blit((uint32_t)*pVGA_moffs_0, 800, xoff, yoff, xoff+1, yoff+65+65, 64, 64); xoff = 160; yoff = 300; @@ -373,8 +373,8 @@ int main (void) color = color_cycle[i%12]; GFX_box_draw_direct(&gfx, &box, xoff+i, yoff, color); } - Blit((UINT32)*pVGA_moffs_0, 800, xoff, yoff, xoff, yoff+64, 63, 63); - Blit((UINT32)*pVGA_moffs_0, 800, xoff, yoff, xoff+1, yoff+64+64, 63, 63); + Blit((uint32_t)*pVGA_moffs_0, 800, xoff, yoff, xoff, yoff+64, 63, 63); + Blit((uint32_t)*pVGA_moffs_0, 800, xoff, yoff, xoff+1, yoff+64+64, 63, 63); xoff = 241; yoff = 300; @@ -384,8 +384,8 @@ int main (void) color = color_cycle[i%12]; GFX_box_draw_direct(&gfx, &box, xoff+i, yoff, color); } - Blit((UINT32)*pVGA_moffs_0, 800, xoff, yoff, xoff, yoff+64, 63, 63); - Blit((UINT32)*pVGA_moffs_0, 800, xoff, yoff, xoff+1, yoff+64+64, 63, 63); + Blit((uint32_t)*pVGA_moffs_0, 800, xoff, yoff, xoff, yoff+64, 63, 63); + Blit((uint32_t)*pVGA_moffs_0, 800, xoff, yoff, xoff+1, yoff+64+64, 63, 63); xoff = 320; yoff = 300; @@ -395,8 +395,8 @@ int main (void) color = color_cycle[i%12]; GFX_box_draw_direct(&gfx, &box, xoff+i, yoff, color); } - Blit((UINT32)*pVGA_moffs_0, 800, xoff, yoff, xoff, yoff+66, 65, 65); - Blit((UINT32)*pVGA_moffs_0, 800, xoff, yoff, xoff+1, yoff+66+66, 65, 65); + Blit((uint32_t)*pVGA_moffs_0, 800, xoff, yoff, xoff, yoff+66, 65, 65); + Blit((uint32_t)*pVGA_moffs_0, 800, xoff, yoff, xoff+1, yoff+66+66, 65, 65); xoff = 401; yoff = 300; @@ -406,21 +406,21 @@ int main (void) color = color_cycle[i%12]; GFX_box_draw_direct(&gfx, &box, xoff+i, yoff, color); } - Blit((UINT32)*pVGA_moffs_0, 800, xoff, yoff, xoff, yoff+66, 65, 65); - Blit((UINT32)*pVGA_moffs_0, 800, xoff, yoff, xoff+1, yoff+66+66, 65, 65); + Blit((uint32_t)*pVGA_moffs_0, 800, xoff, yoff, xoff, yoff+66, 65, 65); + Blit((uint32_t)*pVGA_moffs_0, 800, xoff, yoff, xoff+1, yoff+66+66, 65, 65); xoff = 10; yoff = 500; box_create(&box, 64, 1); - BlitConstColor((UINT32)*pVGA_moffs_0, 800, xoff, yoff, box.w, box.h, 0xFFFFFFFF); - BlitConstColor((UINT32)*pVGA_moffs_0, 800, xoff+1, yoff+2, box.w, box.h, 0xFFFFFFFF); + BlitConstColor((uint32_t)*pVGA_moffs_0, 800, xoff, yoff, box.w, box.h, 0xFFFFFFFF); + BlitConstColor((uint32_t)*pVGA_moffs_0, 800, xoff+1, yoff+2, box.w, box.h, 0xFFFFFFFF); xoff = 80; yoff = 500; box_create(&box, 1, 64); - BlitConstColor((UINT32)*pVGA_moffs_0, 800, xoff, yoff, box.w, box.h, 0xFFFFFFFF); - BlitConstColor((UINT32)*pVGA_moffs_0, 800, xoff+10, yoff, box.w, box.h, 0xFFFFFFFF); - BlitConstColor((UINT32)*pVGA_moffs_0, 800, xoff+21, yoff, box.w, box.h, 0xFFFFFFFF); + BlitConstColor((uint32_t)*pVGA_moffs_0, 800, xoff, yoff, box.w, box.h, 0xFFFFFFFF); + BlitConstColor((uint32_t)*pVGA_moffs_0, 800, xoff+10, yoff, box.w, box.h, 0xFFFFFFFF); + BlitConstColor((uint32_t)*pVGA_moffs_0, 800, xoff+21, yoff, box.w, box.h, 0xFFFFFFFF); size++; if (size > 256) @@ -429,18 +429,18 @@ int main (void) } } -void BlitConstColor(UINT32 fb_addr, UINT32 dim_x, UINT32 pos_x, UINT32 pos_y, UINT32 size_x, UINT32 size_y, UINT32 color) +void BlitConstColor(uint32_t fb_addr, uint32_t dim_x, uint32_t pos_x, uint32_t pos_y, uint32_t size_x, uint32_t size_y, uint32_t color) { - UINT32 volatile *pVGA_src0 = (UINT32*)SYS_VGA_BLIT_SRC0_ADDR; - UINT32 volatile *pVGA_dst = (UINT32*)SYS_VGA_BLIT_DST_ADDR; - UINT32 volatile *pVGA_dimx_src0 = (UINT32*)SYS_VGA_BLIT_SRC0_DIMX; - UINT32 volatile *pVGA_dimx_dst = (UINT32*)SYS_VGA_BLIT_DST_DIMX; - UINT32 volatile *pVGA_nx = (UINT32*)SYS_VGA_BLIT_NX; - UINT32 volatile *pVGA_ny = (UINT32*)SYS_VGA_BLIT_NY; - UINT32 volatile *pVGA_ctrl = (UINT32*)SYS_VGA_CTRL; - UINT32 volatile *pVGA_moffs_0 = (UINT32*)SYS_VGA_FB_FRONT; - UINT32 volatile *pVGA_const_color = (UINT32*)SYS_VGA_BLIT_COLOR; + uint32_t volatile *pVGA_src0 = (uint32_t*)SYS_VGA_BLIT_SRC0_ADDR; + uint32_t volatile *pVGA_dst = (uint32_t*)SYS_VGA_BLIT_DST_ADDR; + uint32_t volatile *pVGA_dimx_src0 = (uint32_t*)SYS_VGA_BLIT_SRC0_DIMX; + uint32_t volatile *pVGA_dimx_dst = (uint32_t*)SYS_VGA_BLIT_DST_DIMX; + uint32_t volatile *pVGA_nx = (uint32_t*)SYS_VGA_BLIT_NX; + uint32_t volatile *pVGA_ny = (uint32_t*)SYS_VGA_BLIT_NY; + uint32_t volatile *pVGA_ctrl = (uint32_t*)SYS_VGA_CTRL; + uint32_t volatile *pVGA_moffs_0 = (uint32_t*)SYS_VGA_FB_FRONT; + uint32_t volatile *pVGA_const_color = (uint32_t*)SYS_VGA_BLIT_COLOR; // fprintf(stdout, "BlitConstColor to (%d,%d), size (%d,%d) ...", pos_x, pos_y, size_x, size_y); @@ -457,18 +457,18 @@ void BlitConstColor(UINT32 fb_addr, UINT32 dim_x, UINT32 pos_x, UINT32 pos_y, UI // fprintf(stdout, "done\n"); } -void Blit(UINT32 fb_addr, UINT32 dim_x, UINT32 pos_x_src, UINT32 pos_y_src, UINT32 pos_x_dst, UINT32 pos_y_dst, UINT32 size_x, UINT32 size_y) +void Blit(uint32_t fb_addr, uint32_t dim_x, uint32_t pos_x_src, uint32_t pos_y_src, uint32_t pos_x_dst, uint32_t pos_y_dst, uint32_t size_x, uint32_t size_y) { - UINT32 volatile *pVGA_src0 = (UINT32*)SYS_VGA_BLIT_SRC0_ADDR; - UINT32 volatile *pVGA_dst = (UINT32*)SYS_VGA_BLIT_DST_ADDR; - UINT32 volatile *pVGA_dimx_src0 = (UINT32*)SYS_VGA_BLIT_SRC0_DIMX; - UINT32 volatile *pVGA_dimx_dst = (UINT32*)SYS_VGA_BLIT_DST_DIMX; - UINT32 volatile *pVGA_nx = (UINT32*)SYS_VGA_BLIT_NX; - UINT32 volatile *pVGA_ny = (UINT32*)SYS_VGA_BLIT_NY; - UINT32 volatile *pVGA_ctrl = (UINT32*)SYS_VGA_CTRL; - UINT32 volatile *pVGA_moffs_0 = (UINT32*)SYS_VGA_FB_FRONT; - UINT32 volatile *pVGA_const_color = (UINT32*)SYS_VGA_BLIT_COLOR; + uint32_t volatile *pVGA_src0 = (uint32_t*)SYS_VGA_BLIT_SRC0_ADDR; + uint32_t volatile *pVGA_dst = (uint32_t*)SYS_VGA_BLIT_DST_ADDR; + uint32_t volatile *pVGA_dimx_src0 = (uint32_t*)SYS_VGA_BLIT_SRC0_DIMX; + uint32_t volatile *pVGA_dimx_dst = (uint32_t*)SYS_VGA_BLIT_DST_DIMX; + uint32_t volatile *pVGA_nx = (uint32_t*)SYS_VGA_BLIT_NX; + uint32_t volatile *pVGA_ny = (uint32_t*)SYS_VGA_BLIT_NY; + uint32_t volatile *pVGA_ctrl = (uint32_t*)SYS_VGA_CTRL; + uint32_t volatile *pVGA_moffs_0 = (uint32_t*)SYS_VGA_FB_FRONT; + uint32_t volatile *pVGA_const_color = (uint32_t*)SYS_VGA_BLIT_COLOR; // fprintf(stdout, "Blit from (%d,%d) to (%d,%d), size (%d,%d) ...", pos_x_src, pos_y_src, pos_x_dst, pos_y_dst, size_x, size_y); @@ -490,7 +490,7 @@ void Blit(UINT32 fb_addr, UINT32 dim_x, UINT32 pos_x_src, UINT32 pos_y_src, UINT void BlitWaitStillActive(void) { - UINT32 volatile *pVGA_ctrl = (UINT32*)SYS_VGA_CTRL; + uint32_t volatile *pVGA_ctrl = (uint32_t*)SYS_VGA_CTRL; while (*pVGA_ctrl & SYS_VGA_BIT_BLIT_ACTIVE); } \ No newline at end of file diff --git a/src/blittertest_tb.c b/src/blittertest_tb.c index ed9504a..77115c8 100644 --- a/src/blittertest_tb.c +++ b/src/blittertest_tb.c @@ -16,47 +16,47 @@ gpio_if_t gpio_if; box_t box; gfx_t gfx; -UINT32 color_cycle[12] = {0x000000FF, 0x00808080, 0x0000FFFF, 0x00808080, 0x0000FF00, 0x00808080, 0x00FFFF00, 0x00808080, 0x00FF0000, 0x00808080, 0x00FF00FF, 0x00808080}; +uint32_t color_cycle[12] = {0x000000FF, 0x00808080, 0x0000FFFF, 0x00808080, 0x0000FF00, 0x00808080, 0x00FFFF00, 0x00808080, 0x00FF0000, 0x00808080, 0x00FF00FF, 0x00808080}; -void BlitConstColor(UINT32 fb_addr, UINT32 dim_x, UINT32 pos_x, UINT32 pos_y, UINT32 size_x, UINT32 size_y, UINT32 color); -void Blit(UINT32 fb_addr, UINT32 dim_x, UINT32 pos_x_src, UINT32 pos_y_src, UINT32 pos_x_dst, UINT32 pos_y_dst, UINT32 size_x, UINT32 size_y); +void BlitConstColor(uint32_t fb_addr, uint32_t dim_x, uint32_t pos_x, uint32_t pos_y, uint32_t size_x, uint32_t size_y, uint32_t color); +void Blit(uint32_t fb_addr, uint32_t dim_x, uint32_t pos_x_src, uint32_t pos_y_src, uint32_t pos_x_dst, uint32_t pos_y_dst, uint32_t size_x, uint32_t size_y); int main (void) { int result, i, j, cnt, size; - UINT32 volatile *pUART_baud = (UINT32*)SYS_UART_BAUD; - UINT32 volatile *pUART_stat = (UINT32*)SYS_UART_STAT; - UINT32 volatile *pGPIO = (UINT32*)SYS_GPIO_0_DATA; - UINT32 volatile *pReg_usec = (UINT32*)SYS_TIMER_USEC; - UINT32 volatile *pReg_sec = (UINT32*)SYS_TIMER_SEC; - UINT32 volatile *pSSRAM = (UINT32*)SYS_SSRAM_IO; - UINT32 volatile *pTim_ctrl = (UINT32*)SYS_ITIM_CTRL; - UINT32 volatile *pTim_stat = (UINT32*)SYS_ITIM_STAT; - UINT32 volatile *pTim0_cnt = (UINT32*)SYS_ITIM0_CNT; - UINT32 volatile *pTim0_cmp = (UINT32*)SYS_ITIM0_CMP; - UINT32 volatile *pTim1_cnt = (UINT32*)SYS_ITIM1_CNT; - UINT32 volatile *pTim1_cmp = (UINT32*)SYS_ITIM1_CMP; - UINT32 volatile *pVGA_cgcol = (UINT32*)SYS_VGA_CGCOL; - UINT32 volatile *pFlashPicture = (UINT32*)(SYS_FLASH_MEM + 0x00600000); + uint32_t volatile *pUART_baud = (uint32_t*)SYS_UART_BAUD; + uint32_t volatile *pUART_stat = (uint32_t*)SYS_UART_STAT; + uint32_t volatile *pGPIO = (uint32_t*)SYS_GPIO_0_DATA; + uint32_t volatile *pReg_usec = (uint32_t*)SYS_TIMER_USEC; + uint32_t volatile *pReg_sec = (uint32_t*)SYS_TIMER_SEC; + uint32_t volatile *pSSRAM = (uint32_t*)SYS_SSRAM_IO; + uint32_t volatile *pTim_ctrl = (uint32_t*)SYS_ITIM_CTRL; + uint32_t volatile *pTim_stat = (uint32_t*)SYS_ITIM_STAT; + uint32_t volatile *pTim0_cnt = (uint32_t*)SYS_ITIM0_CNT; + uint32_t volatile *pTim0_cmp = (uint32_t*)SYS_ITIM0_CMP; + uint32_t volatile *pTim1_cnt = (uint32_t*)SYS_ITIM1_CNT; + uint32_t volatile *pTim1_cmp = (uint32_t*)SYS_ITIM1_CMP; + uint32_t volatile *pVGA_cgcol = (uint32_t*)SYS_VGA_CGCOL; + uint32_t volatile *pFlashPicture = (uint32_t*)(SYS_FLASH_MEM + 0x00600000); - UINT32 volatile *pVGA_src0 = (UINT32*)SYS_VGA_BLIT_SRC0; - UINT32 volatile *pVGA_dst = (UINT32*)SYS_VGA_BLIT_DST; - UINT32 volatile *pVGA_dimx_src0 = (UINT32*)SYS_VGA_BLIT_SRC0_DIMX; - UINT32 volatile *pVGA_dimx_dst = (UINT32*)SYS_VGA_BLIT_DST_DIMX; - UINT32 volatile *pVGA_nx = (UINT32*)SYS_VGA_BLIT_NX; - UINT32 volatile *pVGA_ny = (UINT32*)SYS_VGA_BLIT_NY; - UINT32 volatile *pVGA_ctrl = (UINT32*)SYS_VGA_CTRL; - UINT32 volatile *pVGA_moffs_0 = (UINT32*)SYS_VGA_FB_FRONT; - UINT32 volatile *pVGA_moffs_1 = (UINT32*)SYS_VGA_FB_BACK; - UINT32 volatile *pVGA_const_color = (UINT32*)SYS_VGA_BLIT_DST_LAST; + uint32_t volatile *pVGA_src0 = (uint32_t*)SYS_VGA_BLIT_SRC0; + uint32_t volatile *pVGA_dst = (uint32_t*)SYS_VGA_BLIT_DST; + uint32_t volatile *pVGA_dimx_src0 = (uint32_t*)SYS_VGA_BLIT_SRC0_DIMX; + uint32_t volatile *pVGA_dimx_dst = (uint32_t*)SYS_VGA_BLIT_DST_DIMX; + uint32_t volatile *pVGA_nx = (uint32_t*)SYS_VGA_BLIT_NX; + uint32_t volatile *pVGA_ny = (uint32_t*)SYS_VGA_BLIT_NY; + uint32_t volatile *pVGA_ctrl = (uint32_t*)SYS_VGA_CTRL; + uint32_t volatile *pVGA_moffs_0 = (uint32_t*)SYS_VGA_FB_FRONT; + uint32_t volatile *pVGA_moffs_1 = (uint32_t*)SYS_VGA_FB_BACK; + uint32_t volatile *pVGA_const_color = (uint32_t*)SYS_VGA_BLIT_DST_LAST; - UINT32 screen_res_x, screen_res_y, screen_fps; - UINT32 pos, posx, posy, xoff, yoff, color; - UINT64 *pBuf64_0, *pBuf64_1; + uint32_t screen_res_x, screen_res_y, screen_fps; + uint32_t pos, posx, posy, xoff, yoff, color; + uint64_t *pBuf64_0, *pBuf64_1; time_t curr_date; struct tm *pDate, date; - UINT32 start, end; + uint32_t start, end; char sel[80]; struct timeval time_sec; @@ -66,9 +66,9 @@ int main (void) *pVGA_ctrl &= ~SYS_VGA_BIT_BLIT_FIN_INTEN; *pVGA_cgcol = 0x00FFFFFF; - pBuf64_0 = (UINT64*)malloc(800*600*4); - *pVGA_moffs_0 = (UINT32)pBuf64_0; - *pVGA_moffs_1 = (UINT32)pBuf64_0; + pBuf64_0 = (uint64_t*)malloc(800*600*4); + *pVGA_moffs_0 = (uint32_t)pBuf64_0; + *pVGA_moffs_1 = (uint32_t)pBuf64_0; *pVGA_ctrl |= SYS_VGA_BIT_MSTEN; // GFX_init(&gfx); @@ -77,12 +77,12 @@ int main (void) box_create(&box, 128, 128); - *pVGA_dimx_src0 = (UINT32)4*800; - *pVGA_dimx_dst = (UINT32)4*800; - *pVGA_nx = (UINT32)box.w; - *pVGA_ny = (UINT32)box.h; + *pVGA_dimx_src0 = (uint32_t)4*800; + *pVGA_dimx_dst = (uint32_t)4*800; + *pVGA_nx = (uint32_t)box.w; + *pVGA_ny = (uint32_t)box.h; *pVGA_ctrl |= SYS_VGA_BIT_BLIT_OP_CONSTCOL; - *pVGA_dst = (UINT32)*pVGA_moffs_0 + 4*(5 + 800*5);// + 4*((UINT32)rand()%800 + 800*((UINT32)rand()%600)); + *pVGA_dst = (uint32_t)*pVGA_moffs_0 + 4*(5 + 800*5);// + 4*((uint32_t)rand()%800 + 800*((uint32_t)rand()%600)); *pGPIO = 1; color = 0; @@ -118,18 +118,18 @@ int main (void) } } -void BlitConstColor(UINT32 fb_addr, UINT32 dim_x, UINT32 pos_x, UINT32 pos_y, UINT32 size_x, UINT32 size_y, UINT32 color) +void BlitConstColor(uint32_t fb_addr, uint32_t dim_x, uint32_t pos_x, uint32_t pos_y, uint32_t size_x, uint32_t size_y, uint32_t color) { - UINT32 volatile *pVGA_src0 = (UINT32*)SYS_VGA_BLIT_SRC0; - UINT32 volatile *pVGA_dst = (UINT32*)SYS_VGA_BLIT_DST; - UINT32 volatile *pVGA_dimx_src0 = (UINT32*)SYS_VGA_BLIT_SRC0_DIMX; - UINT32 volatile *pVGA_dimx_dst = (UINT32*)SYS_VGA_BLIT_DST_DIMX; - UINT32 volatile *pVGA_nx = (UINT32*)SYS_VGA_BLIT_NX; - UINT32 volatile *pVGA_ny = (UINT32*)SYS_VGA_BLIT_NY; - UINT32 volatile *pVGA_ctrl = (UINT32*)SYS_VGA_CTRL; - UINT32 volatile *pVGA_moffs_0 = (UINT32*)SYS_VGA_FB_FRONT; - UINT32 volatile *pVGA_const_color = (UINT32*)SYS_VGA_BLIT_DST_LAST; + uint32_t volatile *pVGA_src0 = (uint32_t*)SYS_VGA_BLIT_SRC0; + uint32_t volatile *pVGA_dst = (uint32_t*)SYS_VGA_BLIT_DST; + uint32_t volatile *pVGA_dimx_src0 = (uint32_t*)SYS_VGA_BLIT_SRC0_DIMX; + uint32_t volatile *pVGA_dimx_dst = (uint32_t*)SYS_VGA_BLIT_DST_DIMX; + uint32_t volatile *pVGA_nx = (uint32_t*)SYS_VGA_BLIT_NX; + uint32_t volatile *pVGA_ny = (uint32_t*)SYS_VGA_BLIT_NY; + uint32_t volatile *pVGA_ctrl = (uint32_t*)SYS_VGA_CTRL; + uint32_t volatile *pVGA_moffs_0 = (uint32_t*)SYS_VGA_FB_FRONT; + uint32_t volatile *pVGA_const_color = (uint32_t*)SYS_VGA_BLIT_DST_LAST; // fprintf(stdout, "BlitConstColor to (%d,%d), size (%d,%d) ...", pos_x, pos_y, size_x, size_y); @@ -146,18 +146,18 @@ void BlitConstColor(UINT32 fb_addr, UINT32 dim_x, UINT32 pos_x, UINT32 pos_y, UI // fprintf(stdout, "done\n"); } -void Blit(UINT32 fb_addr, UINT32 dim_x, UINT32 pos_x_src, UINT32 pos_y_src, UINT32 pos_x_dst, UINT32 pos_y_dst, UINT32 size_x, UINT32 size_y) +void Blit(uint32_t fb_addr, uint32_t dim_x, uint32_t pos_x_src, uint32_t pos_y_src, uint32_t pos_x_dst, uint32_t pos_y_dst, uint32_t size_x, uint32_t size_y) { - UINT32 volatile *pVGA_src0 = (UINT32*)SYS_VGA_BLIT_SRC0; - UINT32 volatile *pVGA_dst = (UINT32*)SYS_VGA_BLIT_DST; - UINT32 volatile *pVGA_dimx_src0 = (UINT32*)SYS_VGA_BLIT_SRC0_DIMX; - UINT32 volatile *pVGA_dimx_dst = (UINT32*)SYS_VGA_BLIT_DST_DIMX; - UINT32 volatile *pVGA_nx = (UINT32*)SYS_VGA_BLIT_NX; - UINT32 volatile *pVGA_ny = (UINT32*)SYS_VGA_BLIT_NY; - UINT32 volatile *pVGA_ctrl = (UINT32*)SYS_VGA_CTRL; - UINT32 volatile *pVGA_moffs_0 = (UINT32*)SYS_VGA_FB_FRONT; - UINT32 volatile *pVGA_const_color = (UINT32*)SYS_VGA_BLIT_DST_LAST; + uint32_t volatile *pVGA_src0 = (uint32_t*)SYS_VGA_BLIT_SRC0; + uint32_t volatile *pVGA_dst = (uint32_t*)SYS_VGA_BLIT_DST; + uint32_t volatile *pVGA_dimx_src0 = (uint32_t*)SYS_VGA_BLIT_SRC0_DIMX; + uint32_t volatile *pVGA_dimx_dst = (uint32_t*)SYS_VGA_BLIT_DST_DIMX; + uint32_t volatile *pVGA_nx = (uint32_t*)SYS_VGA_BLIT_NX; + uint32_t volatile *pVGA_ny = (uint32_t*)SYS_VGA_BLIT_NY; + uint32_t volatile *pVGA_ctrl = (uint32_t*)SYS_VGA_CTRL; + uint32_t volatile *pVGA_moffs_0 = (uint32_t*)SYS_VGA_FB_FRONT; + uint32_t volatile *pVGA_const_color = (uint32_t*)SYS_VGA_BLIT_DST_LAST; // fprintf(stdout, "Blit from (%d,%d) to (%d,%d), size (%d,%d) ...", pos_x_src, pos_y_src, pos_x_dst, pos_y_dst, size_x, size_y); diff --git a/src/bootloader/test.c b/src/bootloader/test.c index da8b5ca..af9b4da 100644 --- a/src/bootloader/test.c +++ b/src/bootloader/test.c @@ -1,5 +1,7 @@ #include "libsys_boot.h" +extern uint32_t stack_ptr; + void handler3(void) { volatile uint32_t *pUART0_stat = (uint32_t*)SYS_UART_STAT; @@ -37,7 +39,7 @@ void main() *pGPIO = led; if(led == 0) { - memdump((uint8_t*)pRAM, 0, 16, 256); + memdump((uint8_t*)(0x7FFFEFF0-4096-256), 0, 16, 256); } led = (led+1) % 64; diff --git a/src/emac.c b/src/emac.c index 536b8df..f6fa04e 100644 --- a/src/emac.c +++ b/src/emac.c @@ -10,8 +10,8 @@ void EMAC_TX_commit(void) { - volatile UINT32 *pEmac_ctrl = (UINT32*)SYS_EMAC_TX_CTRL; - volatile UINT32 *pEmac_size = (UINT32*)SYS_EMAC_TX_SIZE; + volatile uint32_t *pEmac_ctrl = (uint32_t*)SYS_EMAC_TX_CTRL; + volatile uint32_t *pEmac_size = (uint32_t*)SYS_EMAC_TX_SIZE; *pEmac_ctrl |= EMAC_TX_CTRL_PKT_COMMIT; @@ -20,8 +20,8 @@ void EMAC_TX_commit(void) void EMAC_TX_alloc(uint32_t size) { - volatile UINT32 *pEmac_ctrl = (UINT32*)SYS_EMAC_TX_CTRL; - volatile UINT32 *pEmac_size = (UINT32*)SYS_EMAC_TX_SIZE; + volatile uint32_t *pEmac_ctrl = (uint32_t*)SYS_EMAC_TX_CTRL; + volatile uint32_t *pEmac_size = (uint32_t*)SYS_EMAC_TX_SIZE; while(*pEmac_ctrl & EMAC_TX_STAT_PKT_ALLOC_BSY); @@ -35,8 +35,8 @@ void EMAC_TX_alloc(uint32_t size) uint32_t EMAC_TX_is_avail(void) { - volatile UINT32 *pEmac_ctrl = (UINT32*)SYS_EMAC_TX_CTRL; - volatile UINT32 *pEmac_size = (UINT32*)SYS_EMAC_TX_SIZE; + volatile uint32_t *pEmac_ctrl = (uint32_t*)SYS_EMAC_TX_CTRL; + volatile uint32_t *pEmac_size = (uint32_t*)SYS_EMAC_TX_SIZE; while(*pEmac_ctrl & EMAC_TX_STAT_PKT_ALLOC_BSY); @@ -47,8 +47,8 @@ uint32_t EMAC_TX_is_avail(void) uint32_t EMAC_TX_is_idle(void) { - volatile UINT32 *pEmac_ctrl = (UINT32*)SYS_EMAC_TX_CTRL; - volatile UINT32 *pEmac_size = (UINT32*)SYS_EMAC_TX_SIZE; + volatile uint32_t *pEmac_ctrl = (uint32_t*)SYS_EMAC_TX_CTRL; + volatile uint32_t *pEmac_size = (uint32_t*)SYS_EMAC_TX_SIZE; return (*pEmac_ctrl & EMAC_TX_STAT_PKT_DONE) == EMAC_TX_STAT_PKT_DONE; @@ -57,8 +57,8 @@ uint32_t EMAC_TX_is_idle(void) void EMAC_TX_reset(void) { - volatile UINT32 *pEmac_ctrl = (UINT32*)SYS_EMAC_TX_CTRL; - volatile UINT32 *pEmac_size = (UINT32*)SYS_EMAC_TX_SIZE; + volatile uint32_t *pEmac_ctrl = (uint32_t*)SYS_EMAC_TX_CTRL; + volatile uint32_t *pEmac_size = (uint32_t*)SYS_EMAC_TX_SIZE; *pEmac_ctrl = EMAC_TX_CTRL_RESET | EMAC_TX_CTRL_FCS_APPEND; @@ -69,8 +69,8 @@ void EMAC_TX_reset(void) uint32_t EMAC_RX_is_avail(void) { - volatile UINT32 *pEmac_ctrl = (UINT32*)SYS_EMAC_RX_CTRL; - volatile UINT32 *pEmac_size = (UINT32*)SYS_EMAC_RX_SIZE; + volatile uint32_t *pEmac_ctrl = (uint32_t*)SYS_EMAC_RX_CTRL; + volatile uint32_t *pEmac_size = (uint32_t*)SYS_EMAC_RX_SIZE; return (*pEmac_ctrl & EMAC_RX_STAT_PKT_AVAIL) == EMAC_RX_STAT_PKT_AVAIL; @@ -79,8 +79,8 @@ uint32_t EMAC_RX_is_avail(void) void EMAC_RX_request(void) { - volatile UINT32 *pEmac_ctrl = (UINT32*)SYS_EMAC_RX_CTRL; - volatile UINT32 *pEmac_size = (UINT32*)SYS_EMAC_RX_SIZE; + volatile uint32_t *pEmac_ctrl = (uint32_t*)SYS_EMAC_RX_CTRL; + volatile uint32_t *pEmac_size = (uint32_t*)SYS_EMAC_RX_SIZE; *pEmac_ctrl = (*pEmac_ctrl & ~EMAC_RX_CTRL_PKT_FREE) | EMAC_RX_CTRL_PKT_REQ; @@ -89,8 +89,8 @@ void EMAC_RX_request(void) uint32_t EMAC_RX_is_valid(void) { - volatile UINT32 *pEmac_ctrl = (UINT32*)SYS_EMAC_RX_CTRL; - volatile UINT32 *pEmac_size = (UINT32*)SYS_EMAC_RX_SIZE; + volatile uint32_t *pEmac_ctrl = (uint32_t*)SYS_EMAC_RX_CTRL; + volatile uint32_t *pEmac_size = (uint32_t*)SYS_EMAC_RX_SIZE; return (*pEmac_ctrl & EMAC_RX_STAT_PKT_VALID) == EMAC_RX_STAT_PKT_VALID; @@ -99,8 +99,8 @@ uint32_t EMAC_RX_is_valid(void) void EMAC_RX_free(void) { - volatile UINT32 *pEmac_ctrl = (UINT32*)SYS_EMAC_RX_CTRL; - volatile UINT32 *pEmac_size = (UINT32*)SYS_EMAC_RX_SIZE; + volatile uint32_t *pEmac_ctrl = (uint32_t*)SYS_EMAC_RX_CTRL; + volatile uint32_t *pEmac_size = (uint32_t*)SYS_EMAC_RX_SIZE; *pEmac_ctrl = (*pEmac_ctrl & ~EMAC_RX_CTRL_PKT_REQ) | EMAC_RX_CTRL_PKT_FREE; @@ -109,8 +109,8 @@ void EMAC_RX_free(void) void EMAC_RX_reset(void) { - volatile UINT32 *pEmac_ctrl = (UINT32*)SYS_EMAC_RX_CTRL; - volatile UINT32 *pEmac_size = (UINT32*)SYS_EMAC_RX_SIZE; + volatile uint32_t *pEmac_ctrl = (uint32_t*)SYS_EMAC_RX_CTRL; + volatile uint32_t *pEmac_size = (uint32_t*)SYS_EMAC_RX_SIZE; *pEmac_ctrl = EMAC_RX_CTRL_RESET | EMAC_RX_CTRL_FCS_CHECK; @@ -121,8 +121,8 @@ void EMAC_RX_reset(void) uint32_t EMAC_RX_get_size(void) { - volatile UINT32 *pEmac_ctrl = (UINT32*)SYS_EMAC_RX_CTRL; - volatile UINT32 *pEmac_size = (UINT32*)SYS_EMAC_RX_SIZE; + volatile uint32_t *pEmac_ctrl = (uint32_t*)SYS_EMAC_RX_CTRL; + volatile uint32_t *pEmac_size = (uint32_t*)SYS_EMAC_RX_SIZE; return *pEmac_size; diff --git a/src/fft.c b/src/fft.c index ae8029d..2dafc2d 100644 --- a/src/fft.c +++ b/src/fft.c @@ -3,7 +3,7 @@ /* Fast-Fourier-Transformation /* Author: Jens Ahrensfeld /* Datum : 24.06.1999 -/* letzte Änderung: 09.06.2000 +/* letzte �nderung: 09.06.2000 /***************************************************************************/ #include #include @@ -18,7 +18,7 @@ /* Konstruktor FFT-Objekt */ /* */ /***************************************************************************/ -void FFTinit(fft_t *pFFT, UINT32 N) +void FFTinit(fft_t *pFFT, uint32_t N) { pFFT->m_numPoints = 0; pFFT->m_numStages = 0; @@ -32,8 +32,8 @@ void FFTinit(fft_t *pFFT, UINT32 N) exit(1); } - pFFT->m_numStages = (UINT32) (1e-06 + log((fft_float_t)N)/log(2.0)); - pFFT->m_numPoints = (UINT32 )N; + pFFT->m_numStages = (uint32_t) (1e-06 + log((fft_float_t)N)/log(2.0)); + pFFT->m_numPoints = (uint32_t )N; pFFT->pTwfRe = (fft_float_t*)malloc(pFFT->m_numPoints * sizeof(fft_float_t) /2); pFFT->pTwfIm = (fft_float_t*)malloc(pFFT->m_numPoints * sizeof(fft_float_t) /2); @@ -76,11 +76,11 @@ void FFTfree(fft_t *pFFT) /***************************************************************************/ void fft_inplace(fft_t *pFFT, fft_float_t *in_re, fft_float_t *in_im) { -register UINT32 stageCnt, k, kk, twf, numNodesPerStage, nodeCnt, opsPerNode, opCnt, i, i2, j; +register uint32_t stageCnt, k, kk, twf, numNodesPerStage, nodeCnt, opsPerNode, opCnt, i, i2, j; fft_float_t tempr, tempi, s, c; #ifdef FFTMsg -UINT32 numMul, numAdd; +uint32_t numMul, numAdd; printf ("\nStart %d-Point FFT.\n\n",pFFT->m_numPoints); #endif @@ -162,7 +162,7 @@ printf ("Total number of complex multiplications = %u\n",numMul); /***************************************************************************/ void ifft_inplace(fft_t *pFFT, fft_float_t *in_re, fft_float_t *in_im) { -register UINT32 stageCnt, k, kk, twf, numNodesPerStage, nodeCnt, opsPerNode, opCnt, i, i2, j; +register uint32_t stageCnt, k, kk, twf, numNodesPerStage, nodeCnt, opsPerNode, opCnt, i, i2, j; fft_float_t tempr, tempi, s, c; #ifdef FFTMsg @@ -235,11 +235,11 @@ printf ("\n%d-Point IFFT is completed.\n",pFFT->m_numPoints); /***************************************************************************/ void ffts_inplace(fft_t *pFFT, fft_float_t *in_re, fft_float_t *in_im) { -register UINT32 stageCnt, k, kk, twf, numNodesPerStage, nodeCnt, opsPerNode, opCnt, i, i2, j; +register uint32_t stageCnt, k, kk, twf, numNodesPerStage, nodeCnt, opsPerNode, opCnt, i, i2, j; fft_float_t tempr, tempi, s, c; #ifdef FFTMsg -UINT32 numMul, numAdd; +uint32_t numMul, numAdd; printf ("\nStart %d-Point FFT.\n\n",pFFT->m_numPoints); #endif @@ -319,9 +319,9 @@ printf ("Total number of complex multiplications = %u\n",numMul); /* TWIDDLE-FAKTOR-TABLE */ /* Erstellt Twiddle-Faktor-Tabelle von WN^0 bis WN^N/2 */ /***************************************************************************/ -void FFTCalcTwiddleTable (fft_float_t *pRealData, fft_float_t *pImagData, UINT32 numPoints) +void FFTCalcTwiddleTable (fft_float_t *pRealData, fft_float_t *pImagData, uint32_t numPoints) { -UINT32 i, size; +uint32_t i, size; fft_float_t arg1; size = numPoints/2; @@ -344,9 +344,9 @@ fft_float_t arg1; /* MODULUS */ /* Berechnet den Betrag einer komplexen Zahl */ /***************************************************************************/ -void Modulus(fft_float_t *pRealData, fft_float_t *pImagData, UINT32 N) +void Modulus(fft_float_t *pRealData, fft_float_t *pImagData, uint32_t N) { -UINT32 i; +uint32_t i; fft_float_t temp; for (i = 0; i < N; i++) { @@ -359,9 +359,9 @@ fft_float_t temp; /* Hanning */ /* Legt das Hanningfenster auf die Abtastwerte im Zeitbereich der Groesse N */ /***************************************************************************/ -void Hanning(fft_float_t *pRealData, fft_float_t *pImagData, UINT32 N, UINT32 maximum) +void Hanning(fft_float_t *pRealData, fft_float_t *pImagData, uint32_t N, uint32_t maximum) { - UINT32 n; + uint32_t n; fft_float_t arg; for (n=0; n < N; n++) @@ -374,9 +374,9 @@ void Hanning(fft_float_t *pRealData, fft_float_t *pImagData, UINT32 N, UINT32 ma /***************************************************************************/ /* HANNING_K */ -/* Gibt einen Faktor k in Abhängigkeit von n bezogen auf N zurück. */ +/* Gibt einen Faktor k in Abh�ngigkeit von n bezogen auf N zur�ck. */ /***************************************************************************/ -fft_float_t hanning_k(UINT32 n, UINT32 N) +fft_float_t hanning_k(uint32_t n, uint32_t N) { fft_float_t arg; arg = (fft_float_t)(2 * PI / (fft_float_t)N); @@ -386,9 +386,9 @@ return ((1-(fft_float_t)cos(arg*(fft_float_t)n))/2); /***************************************************************************/ /* GAUSS_K */ -/* Gibt einen Faktor k in Abhängigkeit von n bezogen auf N zurück. */ +/* Gibt einen Faktor k in Abh�ngigkeit von n bezogen auf N zur�ck. */ /***************************************************************************/ -fft_float_t gauss_k(UINT32 n, UINT32 m, UINT32 s) +fft_float_t gauss_k(uint32_t n, uint32_t m, uint32_t s) { fft_float_t arg; arg = (fft_float_t)((n-m)*(n-m)/(2*s*s)); @@ -400,9 +400,9 @@ return (fft_float_t)(exp(-arg)); /* Normalize) */ /* */ /***************************************************************************/ -void Scale(fft_float_t *pRealData, fft_float_t *pImagData, fft_float_t scaleFactor, UINT32 N) +void Scale(fft_float_t *pRealData, fft_float_t *pImagData, fft_float_t scaleFactor, uint32_t N) { - UINT32 k; + uint32_t k; // Scaling Data for (k=0; k < N; k++) @@ -416,17 +416,17 @@ void Scale(fft_float_t *pRealData, fft_float_t *pImagData, fft_float_t scaleFact /* BiPower() /* checks if N is power of 2 /***************************************************************************/ -UINT32 IsPowerOfTwo(UINT32 N) +uint32_t IsPowerOfTwo(uint32_t N) { - UINT32 i, iterations; - iterations = sizeof(UINT32)*8; + uint32_t i, iterations; + iterations = sizeof(uint32_t)*8; if (N == 0) return FFT_ERROR; for (i=0; i pXfft = NULL; pFFT->pYfft = NULL; @@ -486,7 +486,7 @@ void FFT2Dfree(fft2_t *pFFT) void fft2d_inplace(fft2_t *pFFT, fft_float_t **ppReal, fft_float_t **ppImag) { fft_float_t *pTempr, *pTempi; - UINT32 i, row; + uint32_t i, row; pTempr = (fft_float_t*)malloc(pFFT->m_Ny*sizeof(fft_float_t)); @@ -524,7 +524,7 @@ void fft2d_inplace(fft2_t *pFFT, fft_float_t **ppReal, fft_float_t **ppImag) void ifft2d_inplace(fft2_t *pFFT, fft_float_t **ppReal, fft_float_t **ppImag) { fft_float_t *pTempr, *pTempi; - UINT32 i, row; + uint32_t i, row; pTempr = (fft_float_t*)malloc(pFFT->m_Ny*sizeof(fft_float_t)); @@ -559,11 +559,11 @@ void ifft2d_inplace(fft2_t *pFFT, fft_float_t **ppReal, fft_float_t **ppImag) /* DFT() /* DISKRETE FOURIER-TRANSFORMATION S(f) -> s(t) */ /***************************************************************************/ -void DFT(fft_float_t *pDataR, fft_float_t *pDataI, UINT32 N) +void DFT(fft_float_t *pDataR, fft_float_t *pDataI, uint32_t N) { fft_float_t *a, *b; fft_float_t phi, c, s; - UINT32 i, j; + uint32_t i, j; a = (fft_float_t*)malloc(N * sizeof(fft_float_t)); b = (fft_float_t*)malloc(N * sizeof(fft_float_t)); @@ -595,11 +595,11 @@ void DFT(fft_float_t *pDataR, fft_float_t *pDataI, UINT32 N) /* IDFT() /* INVERSE DISKRETE FOURIER-TRANSFORMATION S(f) -> s(t) */ /***************************************************************************/ -void IDFT(fft_float_t *pDataR, fft_float_t *pDataI, UINT32 N) +void IDFT(fft_float_t *pDataR, fft_float_t *pDataI, uint32_t N) { fft_float_t *a, *b; fft_float_t phi, c, s; - UINT32 i, j; + uint32_t i, j; a = (fft_float_t*)malloc(N * sizeof(fft_float_t)); b = (fft_float_t*)malloc(N * sizeof(fft_float_t)); diff --git a/src/fft.h b/src/fft.h index 5f18fae..f56f6c6 100644 --- a/src/fft.h +++ b/src/fft.h @@ -3,54 +3,58 @@ /* Fast-Fourier-Transformation /* Author: Jens Ahrensfeld */ /* Datum : 24.06.1999 */ -/* letzte Änderung: 09.06.2000 */ +/* letzte �nderung: 09.06.2000 */ /***************************************************************************/ -/* Tabellen und Funktionen für die FFT */ +/* Tabellen und Funktionen f�r die FFT */ /***************************************************************************/ #ifndef FFT_H #define FFT_H #define PI 3.1415926535897932384626433832795 -#define fft_float_t FLOAT32 +#ifndef float32_t +#define float32_t float +#endif + +#define fft_float_t float32_t #define FFT_ERROR 0x80000000 typedef struct _sfft_t { - UINT32 m_numPoints, m_numStages; + uint32_t m_numPoints, m_numStages; fft_float_t *pTwfRe, *pTwfIm; } fft_t; typedef struct _sfft2_t { fft_t *pXfft, *pYfft; - UINT32 m_Nx, m_Ny; + uint32_t m_Nx, m_Ny; } fft2_t; /* DFT functions */ -extern void DFT(fft_float_t *pDataR, fft_float_t *pDataI, UINT32 N); -extern void IDFT(fft_float_t *pDataR, fft_float_t *pDataI, UINT32 N); +extern void DFT(fft_float_t *pDataR, fft_float_t *pDataI, uint32_t N); +extern void IDFT(fft_float_t *pDataR, fft_float_t *pDataI, uint32_t N); /* FFT functions */ -extern void FFTinit(fft_t *pFFT, UINT32 N); +extern void FFTinit(fft_t *pFFT, uint32_t N); extern void FFTfree(fft_t *pFFT); extern void fft_inplace(fft_t *pFFT, fft_float_t*, fft_float_t*); extern void ifft_inplace(fft_t *pFFT, fft_float_t*, fft_float_t*); extern void ffts_inplace(fft_t *pFFT, fft_float_t *in_re, fft_float_t *in_im); -extern void FFTCalcTwiddleTable (fft_float_t *pRealData, fft_float_t *pImagData, UINT32 numPoints); +extern void FFTCalcTwiddleTable (fft_float_t *pRealData, fft_float_t *pImagData, uint32_t numPoints); /* 2D FFT functions */ -extern void FFT2Dinit(fft2_t *pFFT, UINT32 Nx, UINT32 Ny); +extern void FFT2Dinit(fft2_t *pFFT, uint32_t Nx, uint32_t Ny); extern void FFT2Dfree(fft2_t *pFFT); extern void fft2d_inplace(fft2_t *pFFT, fft_float_t **ppReal, fft_float_t **ppImag); extern void ifft2d_inplace(fft2_t *pFFT, fft_float_t **ppReal, fft_float_t **ppImag); /* Helper functions */ -extern void Scale(fft_float_t *pRealData, fft_float_t *pImagData , fft_float_t scaleFactor, UINT32 N); -extern void Modulus(fft_float_t *pRealData, fft_float_t *pImagData, UINT32 N); -extern void Hanning (fft_float_t *pRealData, fft_float_t *pImagData, UINT32 N, UINT32 maximum); -extern fft_float_t hanning_k (UINT32, UINT32); -extern fft_float_t gauss_k(UINT32, UINT32, UINT32); -extern UINT32 IsPowerOfTwo(UINT32 N); +extern void Scale(fft_float_t *pRealData, fft_float_t *pImagData , fft_float_t scaleFactor, uint32_t N); +extern void Modulus(fft_float_t *pRealData, fft_float_t *pImagData, uint32_t N); +extern void Hanning (fft_float_t *pRealData, fft_float_t *pImagData, uint32_t N, uint32_t maximum); +extern fft_float_t hanning_k (uint32_t, uint32_t); +extern fft_float_t gauss_k(uint32_t, uint32_t, uint32_t); +extern uint32_t IsPowerOfTwo(uint32_t N); #endif /* FFT_H */ diff --git a/src/fifo.h b/src/fifo.h index 1653629..4cb9436 100644 --- a/src/fifo.h +++ b/src/fifo.h @@ -12,21 +12,21 @@ // --------------------------------------------------------- typedef struct _sfifo_t { - UINT32 size; - UINT8 *pBuf; - UINT8 * volatile pPtr_wr, * volatile pPtr_rd; + uint32_t size; + uint8_t *pBuf; + uint8_t * volatile pPtr_wr, * volatile pPtr_rd; } fifo_t; // --------------------------------------------------------- // Functions // --------------------------------------------------------- -UINT32 fifo_alloc(fifo_t *pObj, UINT32 size); -UINT32 fifo_free(fifo_t *pObj); -UINT32 fifo_flush(fifo_t *pObj); -UINT32 fifo_is_full(fifo_t *pObj); -UINT32 fifo_is_empty(fifo_t *pObj); -UINT32 fifo_read(fifo_t *pObj, UINT8 *pData, UINT32 size, UINT32 timeout, UINT32 do_block); -UINT32 fifo_write(fifo_t *pObj, UINT8 *pData, UINT32 size, UINT32 timeout, UINT32 do_block); +uint32_t fifo_alloc(fifo_t *pObj, uint32_t size); +uint32_t fifo_free(fifo_t *pObj); +uint32_t fifo_flush(fifo_t *pObj); +uint32_t fifo_is_full(fifo_t *pObj); +uint32_t fifo_is_empty(fifo_t *pObj); +uint32_t fifo_read(fifo_t *pObj, uint8_t *pData, uint32_t size, uint32_t timeout, uint32_t do_block); +uint32_t fifo_write(fifo_t *pObj, uint8_t *pData, uint32_t size, uint32_t timeout, uint32_t do_block); #endif // FIFO_H diff --git a/src/gunzip.c b/src/gunzip.c index 066c88e..fc1bef6 100644 --- a/src/gunzip.c +++ b/src/gunzip.c @@ -19,8 +19,8 @@ volatile int file_len; void handler3(void) { - volatile UINT32 *pUART_stat = (UINT32*)SYS_UART0_STAT; - volatile UINT32 *pUART_data = (UINT32*)SYS_UART0_DATA; + volatile uint32_t *pUART_stat = (uint32_t*)SYS_UART0_STAT; + volatile uint32_t *pUART_data = (uint32_t*)SYS_UART0_DATA; while(0x200 & *pUART_stat) { @@ -45,7 +45,7 @@ int READBYTE(z_stream *zs) { #define MAX_BUFOUT 16*1024*1024 int main(int argc, char **argv) { - volatile UINT32 *pUART_stat = (UINT32*)SYS_UART0_STAT; + volatile uint32_t *pUART_stat = (uint32_t*)SYS_UART0_STAT; unsigned char outData[MAX_BUFOUT]; FILE *infp; int i, gpflags, tmp[4]; diff --git a/src/hpi.c b/src/hpi.c index 8a4c703..7a1cad4 100644 --- a/src/hpi.c +++ b/src/hpi.c @@ -6,9 +6,9 @@ #include "gpio.h" #include "hpi.h" -static volatile UINT32 _g_int_active; -static volatile UINT32 _g_mbx_return; -static volatile UINT32 _g_mbx_in_flag; +static volatile uint32_t _g_int_active; +static volatile uint32_t _g_mbx_return; +static volatile uint32_t _g_mbx_in_flag; extern gpio_if_t _g_gpio; @@ -48,9 +48,9 @@ static usb_t _g_usb[USB_MAX_NUM_PORTS]; // --------------------------------------------------------- void cy67k3_isr(void) { - INT32 i; - UINT16 sie_msg, hpi_status; - UINT32 port, siemsg_handled, int_handled; + int32_t i; + uint16_t sie_msg, hpi_status; + uint32_t port, siemsg_handled, int_handled; _g_int_active = 1; hpi_status = cy67k3_read_HPI_STATUS(); @@ -318,69 +318,69 @@ void cy67k3_reset(void) } -UINT16 cy67k3_read_HPI_DATA(void) +uint16_t cy67k3_read_HPI_DATA(void) { - volatile UINT32 *pHpi = (UINT32*)SYS_USB_DATA; + volatile uint32_t *pHpi = (uint32_t*)SYS_USB_DATA; - return (UINT16)*pHpi; + return (uint16_t)*pHpi; } -UINT16 cy67k3_read_HPI_MAILBOX(void) +uint16_t cy67k3_read_HPI_MAILBOX(void) { - volatile UINT32 *pHpi = (UINT32*)SYS_USB_MBX; + volatile uint32_t *pHpi = (uint32_t*)SYS_USB_MBX; - return (UINT16)*pHpi; + return (uint16_t)*pHpi; } -UINT16 cy67k3_read_HPI_ADDRESS(void) +uint16_t cy67k3_read_HPI_ADDRESS(void) { - volatile UINT32 *pHpi = (UINT32*)SYS_USB_ADDR; + volatile uint32_t *pHpi = (uint32_t*)SYS_USB_ADDR; - return (UINT16)*pHpi; + return (uint16_t)*pHpi; } -UINT16 cy67k3_read_HPI_STATUS(void) +uint16_t cy67k3_read_HPI_STATUS(void) { - volatile UINT32 *pHpi = (UINT32*)SYS_USB_STATUS; + volatile uint32_t *pHpi = (uint32_t*)SYS_USB_STATUS; - return (UINT16)*pHpi; + return (uint16_t)*pHpi; } -void cy67k3_write_HPI_DATA(UINT16 data) +void cy67k3_write_HPI_DATA(uint16_t data) { - volatile UINT32 *pHpi = (UINT32*)SYS_USB_DATA; + volatile uint32_t *pHpi = (uint32_t*)SYS_USB_DATA; - *pHpi = (UINT32)data; + *pHpi = (uint32_t)data; } -void cy67k3_write_HPI_MAILBOX(UINT16 data) +void cy67k3_write_HPI_MAILBOX(uint16_t data) { - volatile UINT32 *pHpi = (UINT32*)SYS_USB_MBX; + volatile uint32_t *pHpi = (uint32_t*)SYS_USB_MBX; - *pHpi = (UINT32)data; + *pHpi = (uint32_t)data; } -void cy67k3_write_HPI_ADDRESS(UINT16 data) +void cy67k3_write_HPI_ADDRESS(uint16_t data) { - volatile UINT32 *pHpi = (UINT32*)SYS_USB_ADDR; + volatile uint32_t *pHpi = (uint32_t*)SYS_USB_ADDR; - *pHpi = (UINT32)data; + *pHpi = (uint32_t)data; } -void cy67k3_write_HPI_STATUS(UINT16 data) +void cy67k3_write_HPI_STATUS(uint16_t data) { - volatile UINT32 *pHpi = (UINT32*)SYS_USB_STATUS; + volatile uint32_t *pHpi = (uint32_t*)SYS_USB_STATUS; - *pHpi = (UINT32)data; + *pHpi = (uint32_t)data; } // --------------------------------------------------------- // HPI API // --------------------------------------------------------- -UINT32 hpi_init(void) +uint32_t hpi_init(void) { int i; - UINT16 reg; + uint16_t reg; // ToDo: Enable HPI interrupt _g_int_active = 0; @@ -424,16 +424,16 @@ UINT32 hpi_init(void) return HPI_NOERROR; } -void hpi_mbx_write(UINT16 msgcode) +void hpi_mbx_write(uint16_t msgcode) { _g_mbx_in_flag = 0; cy67k3_write_HPI_MAILBOX(msgcode); } -UINT32 hpi_mbx_read(void) +uint32_t hpi_mbx_read(void) { - UINT32 err; - UINT16 cy_return; + uint32_t err; + uint16_t cy_return; if (_g_int_active) { @@ -464,7 +464,7 @@ UINT32 hpi_mbx_read(void) return err; } -UINT32 hpi_check_addr(UINT16 addr) +uint32_t hpi_check_addr(uint16_t addr) { if ((addr >= 0x0000) && (addr < 0x4000)) return 0; @@ -479,9 +479,9 @@ UINT32 hpi_check_addr(UINT16 addr) return HPI_ERR_INVPARAM; } -UINT32 hpi_read_reg(UINT16 addr) +uint32_t hpi_read_reg(uint16_t addr) { - UINT32 result; + uint32_t result; result = hpi_check_addr(addr); if (IS_ERROR(result)) @@ -491,9 +491,9 @@ UINT32 hpi_read_reg(UINT16 addr) return cy67k3_read_HPI_DATA(); } -UINT32 hpi_write_reg(UINT16 addr, UINT16 data) +uint32_t hpi_write_reg(uint16_t addr, uint16_t data) { - UINT32 result; + uint32_t result; result = hpi_check_addr(addr); if (IS_ERROR(result)) @@ -503,7 +503,7 @@ UINT32 hpi_write_reg(UINT16 addr, UINT16 data) cy67k3_write_HPI_DATA(data); } -UINT32 hpi_write_ram(UINT16 addr, UINT16 *pData, UINT32 len) +uint32_t hpi_write_ram(uint16_t addr, uint16_t *pData, uint32_t len) { int i, num_words; @@ -525,7 +525,7 @@ UINT32 hpi_write_ram(UINT16 addr, UINT16 *pData, UINT32 len) return len; } -UINT32 hpi_read_ram(UINT16 addr, UINT16 *pData, UINT32 len) +uint32_t hpi_read_ram(uint16_t addr, uint16_t *pData, uint32_t len) { int i, num_words; @@ -547,14 +547,14 @@ UINT32 hpi_read_ram(UINT16 addr, UINT16 *pData, UINT32 len) return len; } -UINT32 hpi_comm_reset(void) +uint32_t hpi_comm_reset(void) { hpi_mbx_write(COMM_RESET); return hpi_mbx_read(); } -UINT32 hpi_comm_jump2code(UINT16 addr) +uint32_t hpi_comm_jump2code(uint16_t addr) { cy67k3_write_HPI_ADDRESS(addr); hpi_mbx_write(COMM_JUMP2CODE); @@ -562,7 +562,7 @@ UINT32 hpi_comm_jump2code(UINT16 addr) return hpi_mbx_read(); } -UINT32 hpi_comm_callcode(UINT16 addr) +uint32_t hpi_comm_callcode(uint16_t addr) { hpi_write_reg(COMM_CODE_ADDR, addr); @@ -571,7 +571,7 @@ UINT32 hpi_comm_callcode(UINT16 addr) return hpi_mbx_read(); } -UINT32 hpi_comm_write_ctrl_reg(UINT16 addr, UINT16 data, UINT16 logic) +uint32_t hpi_comm_write_ctrl_reg(uint16_t addr, uint16_t data, uint16_t logic) { hpi_write_reg(COMM_CTRL_REG_ADDR, addr); @@ -583,9 +583,9 @@ UINT32 hpi_comm_write_ctrl_reg(UINT16 addr, UINT16 data, UINT16 logic) return hpi_mbx_read(); } -UINT32 hpi_comm_read_ctrl_reg(UINT16 addr) +uint32_t hpi_comm_read_ctrl_reg(uint16_t addr) { - UINT32 result; + uint32_t result; hpi_write_reg(COMM_CTRL_REG_ADDR, addr); @@ -596,17 +596,17 @@ UINT32 hpi_comm_read_ctrl_reg(UINT16 addr) return result; cy67k3_write_HPI_ADDRESS(COMM_CTRL_REG_DATA); - return (UINT32)cy67k3_read_HPI_DATA(); + return (uint32_t)cy67k3_read_HPI_DATA(); } -UINT32 hpi_comm_write_xmem(UINT16 addr, UINT8 *pData, UINT16 len) +uint32_t hpi_comm_write_xmem(uint16_t addr, uint8_t *pData, uint16_t len) { return HPI_ERR_NOTIMPL; } -UINT32 hpi_comm_read_xmem(UINT16 addr, UINT8 *pData, UINT16 len) +uint32_t hpi_comm_read_xmem(uint16_t addr, uint8_t *pData, uint16_t len) { return HPI_ERR_NOTIMPL; @@ -614,15 +614,15 @@ UINT32 hpi_comm_read_xmem(UINT16 addr, UINT8 *pData, UINT16 len) typedef struct _sreg_param_t { - UINT32 id; - UINT16 val; + uint32_t id; + uint16_t val; } reg_param_t; -UINT32 hpi_comm_exec_int(UINT16 intnum, UINT32 nargs, ...) +uint32_t hpi_comm_exec_int(uint16_t intnum, uint32_t nargs, ...) { int i; - UINT32 result; + uint32_t result; va_list args; reg_param_t reg_param[MAX_NUM_REGS]; @@ -636,14 +636,14 @@ UINT32 hpi_comm_exec_int(UINT16 intnum, UINT32 nargs, ...) for (i=0; i < nargs; i++) { - reg_param[i].id = va_arg(args, UINT32); + reg_param[i].id = va_arg(args, uint32_t); if (reg_param[i].id > MAX_NUM_REGS) { fprintf(stderr, "hpi_comm_exec_int(): Invalid register R%d!\n", reg_param[i].id); return HPI_ERR_INVPARAM; } - reg_param[i].val = (UINT16)va_arg(args, UINT32); + reg_param[i].val = (uint16_t)va_arg(args, uint32_t); } va_end(args); @@ -660,12 +660,12 @@ UINT32 hpi_comm_exec_int(UINT16 intnum, UINT32 nargs, ...) if (IS_ERROR(result)) return result; - return (UINT32)hpi_read_reg(COMM_R0); + return (uint32_t)hpi_read_reg(COMM_R0); } -UINT32 usb_init(void) +uint32_t usb_init(void) { - INT32 i; + int32_t i; for (i=0; i < USB_MAX_NUM_PORTS; i++) { @@ -674,9 +674,9 @@ UINT32 usb_init(void) return 0; } -UINT32 usb_callback_register(UINT32 port, UINT32 type, fp_t pFunc, void *pArg) +uint32_t usb_callback_register(uint32_t port, uint32_t type, fp_t pFunc, void *pArg) { - UINT32 result; + uint32_t result; if (port >= USB_MAX_NUM_PORTS) return -1; @@ -761,7 +761,7 @@ UINT32 usb_callback_register(UINT32 port, UINT32 type, fp_t pFunc, void *pArg) return result; } -UINT32 usb_irp_register(usb_irp_t *pIRP, UINT32 port, UINT32 ept, UINT32 size, UINT32 is_out) +uint32_t usb_irp_register(usb_irp_t *pIRP, uint32_t port, uint32_t ept, uint32_t size, uint32_t is_out) { if (!pIRP) @@ -792,9 +792,9 @@ UINT32 usb_irp_register(usb_irp_t *pIRP, UINT32 port, UINT32 ept, UINT32 size, U return 0; } -UINT32 usb_irp_enqueue(usb_irp_t *pIRP) +uint32_t usb_irp_enqueue(usb_irp_t *pIRP) { - UINT32 result; + uint32_t result; if (!pIRP) { @@ -806,7 +806,7 @@ UINT32 usb_irp_enqueue(usb_irp_t *pIRP) if (pIRP->is_out) { - hpi_write_ram(pIRP->cy_irp_addr, (UINT16*)&pIRP->cy_req, sizeof(cy_req_t)); + hpi_write_ram(pIRP->cy_irp_addr, (uint16_t*)&pIRP->cy_req, sizeof(cy_req_t)); if (pIRP->port == 0) result = hpi_comm_exec_int(SUSB1_RECEIVE_INT, 2, R1, pIRP->ept, R8, pIRP->cy_irp_addr); @@ -816,7 +816,7 @@ UINT32 usb_irp_enqueue(usb_irp_t *pIRP) if (pIRP->is_in) { pIRP->tx_in_progress = 1; - hpi_write_ram(pIRP->cy_irp_addr, (UINT16*)&pIRP->cy_req, sizeof(cy_req_t)); + hpi_write_ram(pIRP->cy_irp_addr, (uint16_t*)&pIRP->cy_req, sizeof(cy_req_t)); if (pIRP->port == 0) result = hpi_comm_exec_int(SUSB1_SEND_INT, 2, R1, pIRP->ept, R8, pIRP->cy_irp_addr); @@ -831,15 +831,15 @@ UINT32 usb_irp_enqueue(usb_irp_t *pIRP) } -UINT32 fifo_alloc(fifo_t *pObj, UINT32 size) +uint32_t fifo_alloc(fifo_t *pObj, uint32_t size) { - pObj->pBuf = (UINT8*)malloc(size); + pObj->pBuf = (uint8_t*)malloc(size); if (!pObj->pBuf) { // printf ("fifo_alloc(): Error allocating memory!\n"); return -1; } -// printf ("fifo_alloc(): pBuf at %8.8X\n", (UINT32)pObj->pBuf); +// printf ("fifo_alloc(): pBuf at %8.8X\n", (uint32_t)pObj->pBuf); pObj->size = size; pObj->pPtr_wr = pObj->pBuf; pObj->pPtr_rd = pObj->pBuf; @@ -847,7 +847,7 @@ UINT32 fifo_alloc(fifo_t *pObj, UINT32 size) return 0; } -UINT32 fifo_free(fifo_t *pObj) +uint32_t fifo_free(fifo_t *pObj) { if (pObj->pBuf) free(pObj->pBuf); @@ -855,7 +855,7 @@ UINT32 fifo_free(fifo_t *pObj) return 0; } -UINT32 fifo_flush(fifo_t *pObj) +uint32_t fifo_flush(fifo_t *pObj) { pObj->pPtr_wr = pObj->pBuf; pObj->pPtr_rd = pObj->pBuf; @@ -863,14 +863,14 @@ UINT32 fifo_flush(fifo_t *pObj) return 0; } -UINT32 fifo_is_empty(fifo_t *pObj) +uint32_t fifo_is_empty(fifo_t *pObj) { return (pObj->pPtr_wr == pObj->pPtr_rd); } -UINT32 fifo_is_full(fifo_t *pObj) +uint32_t fifo_is_full(fifo_t *pObj) { - UINT8 *pNext, *pEnd; + uint8_t *pNext, *pEnd; pEnd = pObj->pBuf + pObj->size; pNext = pObj->pPtr_wr + 1; @@ -880,11 +880,11 @@ UINT32 fifo_is_full(fifo_t *pObj) return (pNext == pObj->pPtr_rd); } -UINT32 fifo_read(fifo_t *pObj, UINT8 *pData, UINT32 size, UINT32 timeout, UINT32 do_block) +uint32_t fifo_read(fifo_t *pObj, uint8_t *pData, uint32_t size, uint32_t timeout, uint32_t do_block) { - UINT32 i; - UINT32 wait_4ever, timeout_cnt, cnt; - UINT8 *pEnd; + uint32_t i; + uint32_t wait_4ever, timeout_cnt, cnt; + uint8_t *pEnd; pEnd = pObj->pBuf + pObj->size; wait_4ever = (timeout == 0); @@ -927,10 +927,10 @@ UINT32 fifo_read(fifo_t *pObj, UINT8 *pData, UINT32 size, UINT32 timeout, UINT32 return cnt; } -UINT32 fifo_write(fifo_t *pObj, UINT8 *pData, UINT32 size, UINT32 timeout, UINT32 do_block) +uint32_t fifo_write(fifo_t *pObj, uint8_t *pData, uint32_t size, uint32_t timeout, uint32_t do_block) { - UINT32 wait_4ever, timeout_cnt, cnt; - UINT8 *pEnd; + uint32_t wait_4ever, timeout_cnt, cnt; + uint8_t *pEnd; pEnd = pObj->pBuf + pObj->size; wait_4ever = (timeout == 0); diff --git a/src/hpi.h b/src/hpi.h index 453bb6a..619bc0d 100644 --- a/src/hpi.h +++ b/src/hpi.h @@ -39,28 +39,28 @@ typedef void (*fp_t)(void*); // Receive buffer on EP typedef struct _scy_req_t { - UINT16 next; - UINT16 addr; - UINT16 size; - UINT16 callback; + uint16_t next; + uint16_t addr; + uint16_t size; + uint16_t callback; } cy_req_t; typedef struct _sfifo_t { - UINT32 size; - UINT8 *pBuf; - UINT8 * volatile pPtr_wr, * volatile pPtr_rd; + uint32_t size; + uint8_t *pBuf; + uint8_t * volatile pPtr_wr, * volatile pPtr_rd; } fifo_t; typedef struct _susb_irp_t { - UINT16 tsize; - UINT32 is_in, is_out; - UINT32 port, ept; - UINT16 cy_irp_addr; + uint16_t tsize; + uint32_t is_in, is_out; + uint32_t port, ept; + uint16_t cy_irp_addr; fifo_t fifo; - UINT32 tx_in_progress; + uint32_t tx_in_progress; cy_req_t cy_req; } usb_irp_t; @@ -339,46 +339,46 @@ typedef struct _susb_irp_t // HPI low-level routines void cy67k3_isr(void); void cy67k3_reset(void); -UINT16 cy67k3_read_HPI_DATA(void); -UINT16 cy67k3_read_HPI_MAILBOX(void); -UINT16 cy67k3_read_HPI_ADDRESS(void); -UINT16 cy67k3_read_HPI_STATUS(void); -void cy67k3_write_HPI_DATA(UINT16 data); -void cy67k3_write_HPI_MAILBOX(UINT16 data); -void cy67k3_write_HPI_ADDRESS(UINT16 data); -void cy67k3_write_HPI_STATUS(UINT16 data); +uint16_t cy67k3_read_HPI_DATA(void); +uint16_t cy67k3_read_HPI_MAILBOX(void); +uint16_t cy67k3_read_HPI_ADDRESS(void); +uint16_t cy67k3_read_HPI_STATUS(void); +void cy67k3_write_HPI_DATA(uint16_t data); +void cy67k3_write_HPI_MAILBOX(uint16_t data); +void cy67k3_write_HPI_ADDRESS(uint16_t data); +void cy67k3_write_HPI_STATUS(uint16_t data); // HPI API -UINT32 hpi_init(void); -void hpi_mbx_write(UINT16 msgcode); -UINT32 hpi_mbx_read(void); -UINT32 hpi_read_reg(UINT16 addr); -UINT32 hpi_write_reg(UINT16 addr, UINT16 data); -UINT32 hpi_write_ram(UINT16 addr, UINT16 *pData, UINT32 num_words); -UINT32 hpi_read_ram(UINT16 addr, UINT16 *pData, UINT32 num_words); -UINT32 hpi_comm_reset(void); -UINT32 hpi_comm_jump2code(UINT16 addr); -UINT32 hpi_comm_callcode(UINT16 addr); -UINT32 hpi_comm_write_ctrl_reg(UINT16 addr, UINT16 data, UINT16 logic); -UINT32 hpi_comm_read_ctrl_reg(UINT16 addr); -UINT32 hpi_comm_write_xmem(UINT16 addr, UINT8 *pData, UINT16 len); -UINT32 hpi_comm_read_xmem(UINT16 addr, UINT8 *pData, UINT16 len); -UINT32 hpi_comm_exec_int(UINT16 intnum, UINT32 nargs, ...); +uint32_t hpi_init(void); +void hpi_mbx_write(uint16_t msgcode); +uint32_t hpi_mbx_read(void); +uint32_t hpi_read_reg(uint16_t addr); +uint32_t hpi_write_reg(uint16_t addr, uint16_t data); +uint32_t hpi_write_ram(uint16_t addr, uint16_t *pData, uint32_t num_words); +uint32_t hpi_read_ram(uint16_t addr, uint16_t *pData, uint32_t num_words); +uint32_t hpi_comm_reset(void); +uint32_t hpi_comm_jump2code(uint16_t addr); +uint32_t hpi_comm_callcode(uint16_t addr); +uint32_t hpi_comm_write_ctrl_reg(uint16_t addr, uint16_t data, uint16_t logic); +uint32_t hpi_comm_read_ctrl_reg(uint16_t addr); +uint32_t hpi_comm_write_xmem(uint16_t addr, uint8_t *pData, uint16_t len); +uint32_t hpi_comm_read_xmem(uint16_t addr, uint8_t *pData, uint16_t len); +uint32_t hpi_comm_exec_int(uint16_t intnum, uint32_t nargs, ...); // USB API -UINT32 usb_init(void); -UINT32 usb_irp_register(usb_irp_t *pIRP, UINT32 port, UINT32 ept, UINT32 size, UINT32 is_out); -UINT32 usb_irp_enqueue(usb_irp_t *pIRP); -UINT32 usb_callback_register(UINT32 port, UINT32 type, fp_t pFunc, void *pArg); +uint32_t usb_init(void); +uint32_t usb_irp_register(usb_irp_t *pIRP, uint32_t port, uint32_t ept, uint32_t size, uint32_t is_out); +uint32_t usb_irp_enqueue(usb_irp_t *pIRP); +uint32_t usb_callback_register(uint32_t port, uint32_t type, fp_t pFunc, void *pArg); #define FIFO_BLOCK 1 #define FIFO_NONBLOCK 0 -UINT32 fifo_alloc(fifo_t *pObj, UINT32 size); -UINT32 fifo_free(fifo_t *pObj); -UINT32 fifo_flush(fifo_t *pObj); -UINT32 fifo_is_full(fifo_t *pObj); -UINT32 fifo_is_empty(fifo_t *pObj); -UINT32 fifo_read(fifo_t *pObj, UINT8 *pData, UINT32 size, UINT32 timeout, UINT32 do_block); -UINT32 fifo_write(fifo_t *pObj, UINT8 *pData, UINT32 size, UINT32 timeout, UINT32 do_block); +uint32_t fifo_alloc(fifo_t *pObj, uint32_t size); +uint32_t fifo_free(fifo_t *pObj); +uint32_t fifo_flush(fifo_t *pObj); +uint32_t fifo_is_full(fifo_t *pObj); +uint32_t fifo_is_empty(fifo_t *pObj); +uint32_t fifo_read(fifo_t *pObj, uint8_t *pData, uint32_t size, uint32_t timeout, uint32_t do_block); +uint32_t fifo_write(fifo_t *pObj, uint8_t *pData, uint32_t size, uint32_t timeout, uint32_t do_block); #endif // HPI_H diff --git a/src/jman/engine.c b/src/jman/engine.c index bd9226c..b285a60 100644 --- a/src/jman/engine.c +++ b/src/jman/engine.c @@ -55,28 +55,28 @@ ri_var_t* V_CONSTANTWIDTH = NULL; typedef struct _sjmalloc_t { - UINT32 size; + uint32_t size; void* pMem; struct _sjmalloc_t *pPrev; struct _sjmalloc_t *pNext; } jmalloc_t; linkedlist_t *pMallocs = NULL; -UINT32 nmallocs = 0; +uint32_t nmallocs = 0; // Renderer functions -void* jmalloc(UINT32 size) +void* jmalloc(uint32_t size) { void *pMem; pMem = malloc(size); -// pMallocs = LinkedList_add(pMallocs, (UINT32)pMem, (void*)&size, sizeof(void*)); +// pMallocs = LinkedList_add(pMallocs, (uint32_t)pMem, (void*)&size, sizeof(void*)); nmallocs++; return pMem; } void jfree(void *pMem) { -// pMallocs = LinkedList_del(LinkedList_find_by_id(pMallocs, (UINT32)pMem)); +// pMallocs = LinkedList_del(LinkedList_find_by_id(pMallocs, (uint32_t)pMem)); nmallocs--; free(pMem); } @@ -84,11 +84,11 @@ void jfree(void *pMem) void jstats() { linkedlist_t *pList; - UINT32 n= 0, size = 0; + uint32_t n= 0, size = 0; pList = LinkedList_find_first(pMallocs); while(pList) { - size += (UINT32)pList->size; + size += (uint32_t)pList->size; pList = pList->pNext; n++; } @@ -174,12 +174,12 @@ void Engine_free(engine_t *pObj) } -void Engine_context_set(engine_t *pObj, UINT32 context, UINT32 level) +void Engine_context_set(engine_t *pObj, uint32_t context, uint32_t level) { pObj->pContext[level] = context; } -UINT32 Engine_context_get(engine_t *pObj, UINT32 level) +uint32_t Engine_context_get(engine_t *pObj, uint32_t level) { if (!pObj->pContext) return ENGINE_CONTEXT_INVALID; @@ -207,7 +207,7 @@ void Engine_Render(engine_t *pObj) object_t *pMesh; object_t *pObject; RtFloat kf, fi; - UINT32 im_width, im_height, x, y, i, j; + uint32_t im_width, im_height, x, y, i, j; image_t im; rgba_t *pCs; double tictoc; @@ -215,8 +215,8 @@ void Engine_Render(engine_t *pObj) Tic(&tictoc); kf = (RtFloat)pG->pOpt->format.xres/(pG->pOpt->format.yres*pG->pOpt->format.ar_f); - im_width = (UINT32)pG->pOpt->format.xres; - im_height = (UINT32)(kf*pG->pOpt->format.yres + 0.5); + im_width = (uint32_t)pG->pOpt->format.xres; + im_height = (uint32_t)(kf*pG->pOpt->format.yres + 0.5); if (pG->pOpt->display.mode == RI_RGBA) ImageInit(&im, im_width, im_height, 4); @@ -359,7 +359,7 @@ void Engine_DeleteScene(engine_t *pObj) // -------------------------------------------------------------- void Engine_SceneInfo(engine_t *pObj) { - UINT32 num_verts = 0, num_objects = 0; + uint32_t num_verts = 0, num_objects = 0; linkedlist_t *pObjList; polygon_t *pPoly; object_t *pObject; diff --git a/src/jman/engine.h b/src/jman/engine.h index 223195d..ace790f 100644 --- a/src/jman/engine.h +++ b/src/jman/engine.h @@ -31,7 +31,7 @@ extern ri_var_t* V_ST; extern ri_var_t* V_WIDTH; extern ri_var_t* V_CONSTANTWIDTH; -typedef UINT32 context_t; +typedef uint32_t context_t; typedef struct _sengine_t { @@ -50,8 +50,8 @@ typedef struct _sengine_t // JayMan functions void Engine_init(engine_t *pObj, RtToken name); void Engine_free(engine_t *pObj); -void Engine_context_set(engine_t *pObj, UINT32 context, UINT32 level); -UINT32 Engine_context_get(engine_t *pObj, UINT32 level); +void Engine_context_set(engine_t *pObj, uint32_t context, uint32_t level); +uint32_t Engine_context_get(engine_t *pObj, uint32_t level); void Engine_context_push(engine_t *pObj); void Engine_context_pop(engine_t *pObj); @@ -59,7 +59,7 @@ void Engine_Render(engine_t *pObj); void Engine_DeleteScene(engine_t *pObj); void Engine_SceneInfo(engine_t *pObj); -void* jmalloc(UINT32 size); +void* jmalloc(uint32_t size); void jfree(void *pMem); void jstats(void); diff --git a/src/jman/graph_state.c b/src/jman/graph_state.c index f0605eb..a11976a 100644 --- a/src/jman/graph_state.c +++ b/src/jman/graph_state.c @@ -14,7 +14,7 @@ static char RI_DEFAULT_FILNAME[] = "ri.pic"; // Graphics state functions void GS_init(graph_state_t *pObj) { - UINT32 i; + uint32_t i; pObj->pAttr_stack = Stack_push(NULL, &pObj->pAttr, sizeof(attr_t)); pObj->pOpt_stack = Stack_push(NULL, &pObj->pOpt, sizeof(opt_t)); @@ -95,7 +95,7 @@ void GS_xform_pop(graph_state_t *pObj) GS_xform_set(pObj, pObj->curr_xform); } -void GS_xform_set(graph_state_t *pObj, UINT32 id) +void GS_xform_set(graph_state_t *pObj, uint32_t id) { pObj->curr_xform = id; pObj->pXform_curr = &pObj->pXform->space[id]; diff --git a/src/jman/graph_state.h b/src/jman/graph_state.h index 648838f..25833cf 100644 --- a/src/jman/graph_state.h +++ b/src/jman/graph_state.h @@ -22,7 +22,7 @@ typedef struct _sprojection_t { RtToken type; RtFloat fov; - UINT32 flags; + uint32_t flags; } projection_t; @@ -64,9 +64,9 @@ typedef struct _sxform_t typedef struct _sgraph_state_t { - UINT32 frame; - UINT32 context; - UINT32 curr_xform; + uint32_t frame; + uint32_t context; + uint32_t curr_xform; opt_t *pOpt; attr_t *pAttr; xform_t *pXform; @@ -90,7 +90,7 @@ void GS_attr_push(graph_state_t *pObj); void GS_attr_pop(graph_state_t *pObj); void GS_xform_push(graph_state_t *pObj); void GS_xform_pop(graph_state_t *pObj); -void GS_xform_set(graph_state_t *pObj, UINT32 id); +void GS_xform_set(graph_state_t *pObj, uint32_t id); #endif // GRAPH_STATE_H diff --git a/src/jman/grid.c b/src/jman/grid.c index fae68ef..532724c 100644 --- a/src/jman/grid.c +++ b/src/jman/grid.c @@ -1,3 +1,4 @@ +#include #include #include #include @@ -10,9 +11,9 @@ #include "graph_state.h" #include "object.h" -void Grid_create(grid_t *pObj, UINT32 npu, UINT32 npv) +void Grid_create(grid_t *pObj, uint32_t npu, uint32_t npv) { - UINT32 i, j, k, nu, nv; + uint32_t i, j, k, nu, nv; ri_var_t *pVar; nu = npu + 1; @@ -105,7 +106,7 @@ void Grid_CopyVarByName(grid_t *pObj, RtToken pDstName, RtToken pSrcName) void Grid_InitUV(grid_t *pObj) { - UINT32 i, j, k, nu, nv; + uint32_t i, j, k, nu, nv; RtFloat *pU, *pV, u, v, du, dv; ri_var_t *pVar; @@ -146,7 +147,7 @@ void Grid_InitUV(grid_t *pObj) void Grid_assign_derivs(grid_t *pObj) { - UINT32 i, j, k, nu, nv; + uint32_t i, j, k, nu, nv; RtPoint *pPoint, *pDPDU, *pDPDV, dpd2; RtFloat du, dv, ik; ri_var_t *pVar; @@ -202,7 +203,7 @@ void Grid_assign_derivs(grid_t *pObj) void Grid_calc_normal(grid_t *pObj, RtToken name) { - UINT32 i; + uint32_t i; RtFloat *a, *b; RtPoint *pPoint, *pDPDU, *pDPDV, *pN; @@ -224,7 +225,7 @@ void Grid_calc_normal(grid_t *pObj, RtToken name) void Grid_displace(grid_t *pObj) { - UINT32 i, j, k; + uint32_t i, j, k; RtPoint *pP, *pDPDU, *pDPDV, *pN; RtColor *pCs, *pCi; RtFloat *pU, *pV, fd, kn, kd; @@ -351,7 +352,7 @@ RtFloat* Specular(linkedlist_t *pLightList, RtPoint N, RtPoint P, RtPoint I, RtF void Grid_shade(grid_t *pObj, RtMatrix *pXform, linkedlist_t *pLights) { - UINT32 i, j, k; + uint32_t i, j, k; RtPoint *pP, *pDPDU, *pDPDV, *pN, *pI; RtColor *pCs, *pCi; RtFloat *pU, *pV, fd, kn, vt, p[4], d[4], *pCl_diff, *pCl_spec; @@ -391,7 +392,7 @@ void Grid_shade(grid_t *pObj, RtMatrix *pXform, linkedlist_t *pLights) void Grid_shadeConstant(grid_t *pObj) { - UINT32 i; + uint32_t i; RtColor *pCs, *pCi; pCs = (RtColor*)VarGetByName(&pObj->vars, "Cs"); diff --git a/src/jman/grid.h b/src/jman/grid.h index 8543c59..48b35e4 100644 --- a/src/jman/grid.h +++ b/src/jman/grid.h @@ -3,18 +3,18 @@ typedef struct _spoint_state_t { - UINT32 active; - UINT32 shaded; - UINT32 visible; - UINT32 has_face; - UINT32 has_normal; + uint32_t active; + uint32_t shaded; + uint32_t visible; + uint32_t has_face; + uint32_t has_normal; } point_state_t; -typedef UINT32 pixelpos_t[2]; +typedef uint32_t pixelpos_t[2]; typedef struct _sgrid_t { - UINT32 nu, nv, npoints; + uint32_t nu, nv, npoints; var_list_t vars; pixelpos_t *pPointPos; point_state_t *pPointState; @@ -23,7 +23,7 @@ typedef struct _sgrid_t void Grid_init(void); void Grid_free(grid_t *pObj); -void Grid_create(grid_t *pObj, UINT32 nu, UINT32 nv); +void Grid_create(grid_t *pObj, uint32_t nu, uint32_t nv); void Grid_assign_params(grid_t *pObj); void Grid_assign_derivs(grid_t *pObj); void Grid_calc_Ng(grid_t *pObj); diff --git a/src/jman/imageio.c b/src/jman/imageio.c index a601976..aea9e54 100644 --- a/src/jman/imageio.c +++ b/src/jman/imageio.c @@ -39,16 +39,16 @@ void ImageInit(image_t *pObj, int im_width, int im_height, int num_ch) pObj->im_width = im_width; pObj->num_ch = num_ch; pObj->num_pixel = im_height*im_width; - volatile UINT32 *pVGA_ctrl = (UINT32*)SYS_VGA_CTRL; - volatile UINT32 *pVGA_front = (UINT32*)SYS_VGA_FB_FRONT; - volatile UINT32 *pVGA_back = (UINT32*)SYS_VGA_FB_BACK; + volatile uint32_t *pVGA_ctrl = (uint32_t*)SYS_VGA_CTRL; + volatile uint32_t *pVGA_front = (uint32_t*)SYS_VGA_FB_FRONT; + volatile uint32_t *pVGA_back = (uint32_t*)SYS_VGA_FB_BACK; - pObj->pColor_data = (UINT64*)jmalloc(pObj->num_pixel*sizeof(UINT32)); - memset(pObj->pColor_data, 0, pObj->num_pixel*sizeof(UINT32)); - printf("pPixelBuf : %8.8X\n", (UINT32)pObj->pColor_data); + pObj->pColor_data = (uint64_t*)jmalloc(pObj->num_pixel*sizeof(uint32_t)); + memset(pObj->pColor_data, 0, pObj->num_pixel*sizeof(uint32_t)); + printf("pPixelBuf : %8.8X\n", (uint32_t)pObj->pColor_data); - *pVGA_front = (UINT32)pObj->pColor_data; - *pVGA_back = (UINT32)pObj->pColor_data; + *pVGA_front = (uint32_t)pObj->pColor_data; + *pVGA_back = (uint32_t)pObj->pColor_data; *pVGA_ctrl |= SYS_VGA_BIT_MSTEN; } @@ -99,29 +99,29 @@ int ImageSaveTiff(image_t *pObj, char *filename) } -void ImageSetPixel(image_t *pObj, UINT32 u, UINT32 v, rgba_t color) +void ImageSetPixel(image_t *pObj, uint32_t u, uint32_t v, rgba_t color) { - UINT32 offset; - UINT32 *pRGB; - UINT32 *pRGBA; + uint32_t offset; + uint32_t *pRGB; + uint32_t *pRGBA; - pRGB = (UINT32*)pObj->pColor_data; - pRGBA = (UINT32*)pObj->pColor_data; + pRGB = (uint32_t*)pObj->pColor_data; + pRGBA = (uint32_t*)pObj->pColor_data; if (pObj->num_ch == 4) { if ((u < pObj->im_width) && (v < pObj->im_height)) { - offset = (UINT32)(pObj->im_width*v); - pRGBA[u+offset] = ((UINT32)(255*color[0]) & 0xFF) | (((UINT32)(255*color[1]) & 0xFF) << 8) | (((UINT32)(255*color[2]) & 0xFF) << 16); + offset = (uint32_t)(pObj->im_width*v); + pRGBA[u+offset] = ((uint32_t)(255*color[0]) & 0xFF) | (((uint32_t)(255*color[1]) & 0xFF) << 8) | (((uint32_t)(255*color[2]) & 0xFF) << 16); } } else { if ((u < pObj->im_width) && (v < pObj->im_height)) { - offset = (UINT32)(pObj->im_width*v); - pRGB[u+offset] = ((UINT32)(255*color[0]) & 0xFF) | (((UINT32)(255*color[1]) & 0xFF) << 8) | (((UINT32)(255*color[2]) & 0xFF) << 16); + offset = (uint32_t)(pObj->im_width*v); + pRGB[u+offset] = ((uint32_t)(255*color[0]) & 0xFF) | (((uint32_t)(255*color[1]) & 0xFF) << 8) | (((uint32_t)(255*color[2]) & 0xFF) << 16); } } diff --git a/src/jman/imageio.h b/src/jman/imageio.h index 489d760..831fd5e 100644 --- a/src/jman/imageio.h +++ b/src/jman/imageio.h @@ -15,8 +15,8 @@ // ------------------------------------------------------------ typedef struct _image_t { - UINT32 im_width, im_height, num_pixel, num_ch; - UINT64 *pColor_data; + uint32_t im_width, im_height, num_pixel, num_ch; + uint64_t *pColor_data; } image_t; @@ -27,7 +27,7 @@ void ImageFree(image_t *pObj); void ImageCopy(image_t *pSrc, image_t *pDst); int ImageLoadTiff(image_t *pObj, char *filename); int ImageSaveTiff(image_t *pObj, char *filename); -void ImageSetPixel(image_t *pObj, UINT32 u, UINT32 v, rgba_t color); +void ImageSetPixel(image_t *pObj, uint32_t u, uint32_t v, rgba_t color); // ------------------------------------------------------------ #endif // IMAGEIO_H diff --git a/src/jman/linklist.c b/src/jman/linklist.c index 318ce6e..936d37f 100644 --- a/src/jman/linklist.c +++ b/src/jman/linklist.c @@ -15,9 +15,9 @@ linkedlist_t* LinkedList_free(linkedlist_t *pObj) return pCurr; } -linkedlist_t* LinkedList_append(linkedlist_t *pObj, UINT32 num, UINT32 size) +linkedlist_t* LinkedList_append(linkedlist_t *pObj, uint32_t num, uint32_t size) { - UINT32 i; + uint32_t i; linkedlist_t *pCurr, *pLast; char *pData = NULL; @@ -60,7 +60,7 @@ linkedlist_t* LinkedList_append(linkedlist_t *pObj, UINT32 num, UINT32 size) } /* -linkedlist_t* LinkedList_append(linkedlist_t *pObj, UINT32 id, UINT32 size) +linkedlist_t* LinkedList_append(linkedlist_t *pObj, uint32_t id, uint32_t size) { linkedlist_t *pCurr; @@ -90,7 +90,7 @@ linkedlist_t* LinkedList_append(linkedlist_t *pObj, UINT32 id, UINT32 size) } */ -linkedlist_t* LinkedList_add(linkedlist_t *pObj, UINT32 num, void *pData, UINT32 size) +linkedlist_t* LinkedList_add(linkedlist_t *pObj, uint32_t num, void *pData, uint32_t size) { linkedlist_t *pCurr; @@ -100,7 +100,7 @@ linkedlist_t* LinkedList_add(linkedlist_t *pObj, UINT32 num, void *pData, UINT32 } -linkedlist_t* LinkedList_put(linkedlist_t *pObj, void *pData, UINT32 size) +linkedlist_t* LinkedList_put(linkedlist_t *pObj, void *pData, uint32_t size) { linkedlist_t *pCurr; @@ -162,7 +162,7 @@ linkedlist_t* LinkedList_del(linkedlist_t *pObj) return pCurr; } -linkedlist_t* LinkedList_ins(linkedlist_t *pObj, UINT32 num, void *pData, UINT32 size) +linkedlist_t* LinkedList_ins(linkedlist_t *pObj, uint32_t num, void *pData, uint32_t size) { linkedlist_t *pCurr, *pNext; @@ -212,7 +212,7 @@ linkedlist_t* LinkedList_find_last(linkedlist_t *pObj) return pCurr; } /* -linkedlist_t* LinkedList_find_by_id(linkedlist_t *pObj, UINT32 id) +linkedlist_t* LinkedList_find_by_id(linkedlist_t *pObj, uint32_t id) { linkedlist_t *pCurr; diff --git a/src/jman/linklist.h b/src/jman/linklist.h index fa67022..010076f 100644 --- a/src/jman/linklist.h +++ b/src/jman/linklist.h @@ -7,8 +7,8 @@ typedef struct _slinkedlist_t { - UINT32 id; - UINT32 size; + uint32_t id; + uint32_t size; void *pData; struct _slinkedlist_t *pNext; struct _slinkedlist_t *pPrev; @@ -16,10 +16,10 @@ typedef struct _slinkedlist_t } linkedlist_t; linkedlist_t* LinkedList_free(linkedlist_t *pObj); -linkedlist_t* LinkedList_append(linkedlist_t *pObj, UINT32 num, UINT32 size); -linkedlist_t* LinkedList_add(linkedlist_t *pObj, UINT32 num, void *pData, UINT32 size); -linkedlist_t* LinkedList_put(linkedlist_t *pObj, void *pData, UINT32 size); -linkedlist_t* LinkedList_ins(linkedlist_t *pObj, UINT32 num, void *pData, UINT32 size); +linkedlist_t* LinkedList_append(linkedlist_t *pObj, uint32_t num, uint32_t size); +linkedlist_t* LinkedList_add(linkedlist_t *pObj, uint32_t num, void *pData, uint32_t size); +linkedlist_t* LinkedList_put(linkedlist_t *pObj, void *pData, uint32_t size); +linkedlist_t* LinkedList_ins(linkedlist_t *pObj, uint32_t num, void *pData, uint32_t size); void* LinkedList_get(linkedlist_t *pObj); linkedlist_t* LinkedList_del(linkedlist_t *pObj); linkedlist_t* LinkedList_find_first(linkedlist_t *pObj); diff --git a/src/jman/matrix.c b/src/jman/matrix.c index a19b2b1..fde0781 100644 --- a/src/jman/matrix.c +++ b/src/jman/matrix.c @@ -54,9 +54,9 @@ // Ausgabe einer nxn-Matrix -void PrintMatrix (RtMatrix M, UINT32 d) +void PrintMatrix (RtMatrix M, uint32_t d) { - UINT32 i,j; + uint32_t i,j; printf("\n"); for (i=0;i zwischen zwei Vektoren u, v; // = u[1]*v[1] + u[2]*v[2] + ... + u[n]*v[n] -RtFloat ScalarProduct (RtFloat *u, RtFloat *v, UINT32 d) +RtFloat ScalarProduct (RtFloat *u, RtFloat *v, uint32_t d) { - UINT32 i; + uint32_t i; RtFloat s=0.0; for (i=0;i/(|u|*|v|), wobei <.,.> das Skalarprodukt // zwischen zwei Vektoren und |.| der Betrag eines Vektors sind. -RtFloat AngleBetweenVectors (RtFloat *u, RtFloat *v, UINT32 d) +RtFloat AngleBetweenVectors (RtFloat *u, RtFloat *v, uint32_t d) { RtFloat p; p = (RtFloat)acos(ScalarProduct(u,v,d)/(Norm(u,d)*Norm(v,d))); @@ -111,7 +111,7 @@ RtFloat AngleBetweenVectors (RtFloat *u, RtFloat *v, UINT32 d) // Liefert die Einheitsmatrix in Id zurueck. void IdentityMatrix (RtMatrix *Id) { - UINT32 i,j; + uint32_t i,j; for (i=0;i<4;++i) for (j=0;j<4;++j) (*Id)[i][j] = (RtFloat)(i==j); @@ -121,7 +121,7 @@ void IdentityMatrix (RtMatrix *Id) // Das Ergebnis der Multiplikation von M und N steht in der Matrix MN. void MultiplyMatrices (RtMatrix M, RtMatrix N, RtMatrix *MN) { - INT32 i,j; + int32_t i,j; for (i=0; i<4; i++) { for (j=0; j<4; j++) @@ -138,7 +138,7 @@ void MultiplyMatrices (RtMatrix M, RtMatrix N, RtMatrix *MN) // Multiplikation einer 4x4-Matrix M und eines Spaltenvektors u void MultiplyMatrixVector (RtMatrix M, RtFloat *u, RtFloat *Mu) { - INT32 i; + int32_t i; for (i=0; i<4; i++) { @@ -152,7 +152,7 @@ void MultiplyMatrixVector (RtMatrix M, RtFloat *u, RtFloat *Mu) void MultiplyMatrixVector2 (RtMatrix M, RtFloat *u, RtFloat *Mu) { - INT32 i; + int32_t i; RtFloat res[3]; for (i=0; i < 3; i++) @@ -168,7 +168,7 @@ void MultiplyMatrixVector2 (RtMatrix M, RtFloat *u, RtFloat *Mu) // Multiplikation eines Zeilenvektors u und einer 4x4-Matrix M void MultiplyVectorMatrix (RtFloat *u, RtMatrix M, RtFloat *uM) { - INT32 i; + int32_t i; for (i=0;i<4;++i) { @@ -183,7 +183,7 @@ void MultiplyVectorMatrix (RtFloat *u, RtMatrix M, RtFloat *uM) // Transponieren einer 4x4-Matrix M; Mt: transponierte Matrix M void TransposeMatrix (RtMatrix M, RtMatrix *Mt) { - INT32 i; + int32_t i; for (i=0; i<4; i++) { (*Mt)[i][0] = M[0][i]; @@ -208,7 +208,7 @@ void NewTranslationMatrix (RtFloat *tval, RtMatrix *T) // Berechnung der Rotationsmatrix R aus M (Verfahren s. oben) void RotationMatrix (RtMatrix M, RtMatrix *R) { - UINT32 i; + uint32_t i; for (i=0; i<4; i++) { (*R)[i][0] = M[i][0]; @@ -241,7 +241,7 @@ void InverseRotationMatrix (RtMatrix R, RtMatrix *Ri) // (Verfahren s. oben) void InverseTranslationMatrix (RtMatrix T, RtMatrix *Ti) { - UINT32 i; + uint32_t i; //printf("T = "); PrintMatrix(T); IdentityMatrix (Ti); for (i=0;i<3;++i) diff --git a/src/jman/object.c b/src/jman/object.c index 45916f0..8e53826 100644 --- a/src/jman/object.c +++ b/src/jman/object.c @@ -34,9 +34,9 @@ void Interpolate_linear_u(RtPoint P0, RtPoint P1, RtPoint* pP, RtFloat u) } -void Interpolate_linear(RtPoint P0, RtPoint P1, RtPoint *pP, UINT32 N) +void Interpolate_linear(RtPoint P0, RtPoint P1, RtPoint *pP, uint32_t N) { - UINT32 i; + uint32_t i; RtFloat dx, dy, dz, fx, fy, fz; fx = P0[0]; @@ -55,13 +55,13 @@ void Interpolate_linear(RtPoint P0, RtPoint P1, RtPoint *pP, UINT32 N) } -RtInt Interpolate_cubic(RtPoint *pCP, UINT32 ncp, RtPoint *pIP, UINT32 nip, RtFloat umin, RtFloat umax, RtPointer Basis, RtInt step, RtInt dimcp) +RtInt Interpolate_cubic(RtPoint *pCP, uint32_t ncp, RtPoint *pIP, uint32_t nip, RtFloat umin, RtFloat umax, RtPointer Basis, RtInt step, RtInt dimcp) { - UINT32 i, j, jj, k, d, n, np; + uint32_t i, j, jj, k, d, n, np; RtFloat Bi[3][4], p[4], ut, u, du; RtFloat *B = (RtFloat*)Basis; - INT32 ii; + int32_t ii; np = (ncp-4)/step + 1; @@ -102,7 +102,7 @@ RtInt Interpolate_cubic(RtPoint *pCP, UINT32 ncp, RtPoint *pIP, UINT32 nip, RtFl } // -------------------------------------------------------------- -void Polygon_init(object_t *pObj, UINT32 id, UINT32 nvertices) +void Polygon_init(object_t *pObj, uint32_t id, uint32_t nvertices) { polygon_t *pObject; ri_var_t *pVar; @@ -142,7 +142,7 @@ void Polygon_dice(object_t *pObj, RtInt npu, RtInt npv) } // -------------------------------------------------------------- -void Curve_init(object_t *pObj, UINT32 id, RtToken degree, RtInt nverts, RtToken wrap) +void Curve_init(object_t *pObj, uint32_t id, RtToken degree, RtInt nverts, RtToken wrap) { curve_t *pObject; @@ -180,7 +180,7 @@ void Curve_bound_update(object_t *pObj) } // -------------------------------------------------------------- -void Patch_init(object_t *pObj, UINT32 id, RtToken type) +void Patch_init(object_t *pObj, uint32_t id, RtToken type) { patch_t *pObject; @@ -300,7 +300,7 @@ void Patch_dice(object_t *pObj, RtInt npu, RtInt npv) void Patch_bound_update(object_t *pObj) { - UINT32 i, j, npoints; + uint32_t i, j, npoints; patch_t *pObject; RtPoint *pPoints; @@ -328,7 +328,7 @@ void Patch_bound_update(object_t *pObj) } // -------------------------------------------------------------- -void Patchmesh_init(object_t *pObj, UINT32 id, RtToken type, RtInt nu, RtToken uwrap, RtInt nv, RtToken vwrap, RtPointer pVerts) +void Patchmesh_init(object_t *pObj, uint32_t id, RtToken type, RtInt nu, RtToken uwrap, RtInt nv, RtToken vwrap, RtPointer pVerts) { patchmesh_t *pObject; ri_var_t *pVar; @@ -365,7 +365,7 @@ void Patchmesh_free(object_t *pObj) void Patchmesh_get_patch(object_t *pObj, object_t *pDst, RtInt ip) { - UINT32 i, j, k, npu, npv; + uint32_t i, j, k, npu, npv; RtInt x1, y1; patch_t *pPatch; ri_var_t *pVar; @@ -460,7 +460,7 @@ RtInt Patchmesh_get_npatches(object_t *pObj, RtInt *nupatches, RtInt *nvpatches) void Patchmesh_bound_update(object_t *pObj) { - UINT32 i, j, m, n, N; + uint32_t i, j, m, n, N; patchmesh_t *pObject; RtPoint *pPoints; object_t *pMesh; @@ -505,7 +505,7 @@ void Patchmesh_bound_update(object_t *pObj) } // -------------------------------------------------------------- -void Sphere_init(object_t *pObj, UINT32 id, RtFloat radius, RtFloat zmin, RtFloat zmax, RtFloat thetamax) +void Sphere_init(object_t *pObj, uint32_t id, RtFloat radius, RtFloat zmin, RtFloat zmax, RtFloat thetamax) { sphere_t *pObject; @@ -634,7 +634,7 @@ void Sphere_free(object_t *pObj) } // -------------------------------------------------------------- -void Light_init(object_t *pObj, UINT32 id) +void Light_init(object_t *pObj, uint32_t id) { light_t *pObject; diff --git a/src/jman/object.h b/src/jman/object.h index f75cafb..5de6950 100644 --- a/src/jman/object.h +++ b/src/jman/object.h @@ -18,36 +18,36 @@ extern RtToken OBJECT_TYPE_CURVE; // -------------------------------------------------------------- typedef struct _sstat_t { - UINT32 num_polygons; - UINT32 num_patches; - UINT32 num_patchmeshes; - UINT32 num_lights; - UINT32 num_spheres; - UINT32 num_curves; + uint32_t num_polygons; + uint32_t num_patches; + uint32_t num_patchmeshes; + uint32_t num_lights; + uint32_t num_spheres; + uint32_t num_curves; } stat_t; typedef struct _sscene_t { stat_t stat; - UINT32 num_objs; + uint32_t num_objs; linkedlist_t *pObjs; } scene_t; typedef struct _spolygon_t { - UINT32 id; - UINT32 num_verts; + uint32_t id; + uint32_t num_verts; } polygon_t; typedef struct _scurve_t { - UINT32 id; + uint32_t id; RtToken type; RtToken wrap; - UINT32 nverts; + uint32_t nverts; RtFloat width[2]; RtPointer pVerts; @@ -55,14 +55,14 @@ typedef struct _scurve_t typedef struct _spatch_t { - UINT32 id; + uint32_t id; RtToken type; } patch_t; typedef struct _spatchmesh_t { - UINT32 id; + uint32_t id; RtInt nu, nv; RtToken type; RtToken uwrap, vwrap; @@ -71,14 +71,14 @@ typedef struct _spatchmesh_t typedef struct _slight_t { - UINT32 id; + uint32_t id; RtBoolean onoff; } light_t; typedef struct _ssphere_t { - UINT32 id, is_full_sweep; + uint32_t id, is_full_sweep; RtFloat radius, zmin, zmax; RtFloat phi_min, phi_max, theta_max; @@ -95,8 +95,8 @@ typedef struct _sobj_stat_t typedef struct _sobject_t { - UINT32 id; - UINT32 main_context; + uint32_t id; + uint32_t main_context; RtToken type; void *pObjData; RtMatrix *pXform; @@ -108,32 +108,32 @@ typedef struct _sobject_t } object_t; -void Polygon_init(object_t *pObj, UINT32 id, UINT32 nvertices); +void Polygon_init(object_t *pObj, uint32_t id, uint32_t nvertices); void Polygon_free(object_t *pObj); void Polygon_dice(object_t *pObj, RtInt npu, RtInt npv); void Polygon_bound_update(object_t *pObj); -void Curve_init(object_t *pObj, UINT32 id, RtToken degree, RtInt nverts, RtToken wrap); +void Curve_init(object_t *pObj, uint32_t id, RtToken degree, RtInt nverts, RtToken wrap); void Curve_free(object_t *pObj); void Curve_bound_update(object_t *pObj); -void Patch_init(object_t *pObj, UINT32 id, RtToken type); +void Patch_init(object_t *pObj, uint32_t id, RtToken type); void Patch_free(object_t *pObj); void Patch_dice(object_t *pObj, RtInt npu, RtInt npv); void Patch_bound_update(object_t *pObj); -void Patchmesh_init(object_t *pObj, UINT32 id, RtToken type, RtInt nu, RtToken uwrap, RtInt nv, RtToken vwrap, RtPointer pVerts); +void Patchmesh_init(object_t *pObj, uint32_t id, RtToken type, RtInt nu, RtToken uwrap, RtInt nv, RtToken vwrap, RtPointer pVerts); void Patchmesh_free(object_t *pObj); void Patchmesh_get_patch(object_t *pObj, object_t *pDst, RtInt ip); RtInt Patchmesh_get_npatches(object_t *pObj, RtInt *nupatches, RtInt *nvpatches); void Patchmesh_bound_update(object_t *pObj); -void Sphere_init(object_t *pObj, UINT32 id, RtFloat radius, RtFloat zmin, RtFloat zmax, RtFloat thetamax); +void Sphere_init(object_t *pObj, uint32_t id, RtFloat radius, RtFloat zmin, RtFloat zmax, RtFloat thetamax); void Sphere_free(object_t *pObj); void Sphere_dice(object_t *pObj, RtInt npu, RtInt npv); void Sphere_bound_update(object_t *pObj); -void Light_init(object_t *pObj, UINT32 id); +void Light_init(object_t *pObj, uint32_t id); void Light_free(object_t *pObj); void Scene_Add(scene_t *pObj, object_t *pObject); diff --git a/src/jman/render.c b/src/jman/render.c index 5d797b2..7c1bc69 100644 --- a/src/jman/render.c +++ b/src/jman/render.c @@ -24,15 +24,15 @@ int sgn(int x) { return (x>0)-(x<0); } -typedef UINT32 point2D_t[2]; +typedef uint32_t point2D_t[2]; typedef struct _spoint2Dz_t { - UINT32 x, y; + uint32_t x, y; double z; } point2Dz_t; -UINT32 Bresenham(image_t *pIm, color_t cs, UINT32 *P0, UINT32 *P1, point2D_t *pPixels) +uint32_t Bresenham(image_t *pIm, color_t cs, uint32_t *P0, uint32_t *P1, point2D_t *pPixels) #define JMIN(a,b) ((a)<(b)?(a):(b)) #define JMAX(a,b) ((a)>(b)?(a):(b)) @@ -42,7 +42,7 @@ UINT32 Bresenham(image_t *pIm, color_t cs, UINT32 *P0, UINT32 *P1, point2D_t *pP /*-------------------------------------------------------------- - * Bresenham-Algorithmus: Linien auf Rastergeräten zeichnen + * Bresenham-Algorithmus: Linien auf Rasterger�ten zeichnen * * Eingabeparameter: * P0 = Koordinaten des Startpunkts @@ -54,7 +54,7 @@ UINT32 Bresenham(image_t *pIm, color_t cs, UINT32 *P0, UINT32 *P1, point2D_t *pP *--------------------------------------------------------------- */ { - UINT32 count; + uint32_t count; int x, y, t, dx, dy, incx, incy, pdx, pdy, ddx, ddy, es, el, err; @@ -86,7 +86,7 @@ UINT32 Bresenham(image_t *pIm, color_t cs, UINT32 *P0, UINT32 *P1, point2D_t *pP if(dx<0) dx = -dx; if(dy<0) dy = -dy; -/* feststellen, welche Entfernung größer ist */ +/* feststellen, welche Entfernung gr��er ist */ if (dx>dy) { /* x ist schnelle Richtung */ @@ -141,7 +141,7 @@ UINT32 Bresenham(image_t *pIm, color_t cs, UINT32 *P0, UINT32 *P1, point2D_t *pP void RenderWire_polygon(render_t *pObj, object_t *pObject) { RtMatrix world2cam; - UINT32 i, j, cnt; + uint32_t i, j, cnt; rgba_t cs = {0}, cs_first; polygon_t *pPoly; RtPoint *pVerts; @@ -149,7 +149,7 @@ void RenderWire_polygon(render_t *pObj, object_t *pObject) point2D_t *pPxl; RtFloat d[4], uv[2], p[4], dn; - UINT32 b[2], b_first[2], b_prev[2]; + uint32_t b[2], b_first[2], b_prev[2]; pPxl = (point2D_t*)malloc((pObj->pImage->im_height+pObj->pImage->im_width)*sizeof(point2D_t)); @@ -187,8 +187,8 @@ void RenderWire_polygon(render_t *pObj, object_t *pObject) dn = (RtFloat)(1.0/d[2]); uv[0] = pObj->ku*d[0]*dn; uv[1] = pObj->kv*d[1]*dn; - b[0] = (UINT32)(pObj->pImage->im_width*(uv[0]+0.5)); - b[1] = (UINT32)(pObj->pImage->im_height*(uv[1]+0.5)); + b[0] = (uint32_t)(pObj->pImage->im_width*(uv[0]+0.5)); + b[1] = (uint32_t)(pObj->pImage->im_height*(uv[1]+0.5)); if (i > 0) { cnt = Bresenham(pObj->pImage, cs, b_prev, b, pPxl); @@ -216,14 +216,14 @@ void RenderWire_polygon(render_t *pObj, object_t *pObject) void RenderGridPoints(render_t *pObj, object_t *pObject) { - UINT32 i; + uint32_t i; RtMatrix world2cam; rgba_t cs = {1,1,1,1}; RtPoint *pPoint; RtColor *pColor; RtFloat d[4], uv[2], p[4], dn; - UINT32 b[2]; + uint32_t b[2]; MultiplyMatrices(pObj->pG->pXform->space[camera_space], *pObject->pXform, &world2cam); i=0; @@ -244,16 +244,16 @@ void RenderGridPoints(render_t *pObj, object_t *pObject) dn = (RtFloat)(1.0/d[2]); uv[0] = pObj->ku*d[0]*dn; uv[1] = pObj->kv*d[1]*dn; - b[0] = (UINT32)(pObj->pImage->im_width*(uv[0]+0.5)); - b[1] = (UINT32)(pObj->pImage->im_height*(uv[1]+0.5)); + b[0] = (uint32_t)(pObj->pImage->im_width*(uv[0]+0.5)); + b[1] = (uint32_t)(pObj->pImage->im_height*(uv[1]+0.5)); ImageSetPixel(pObj->pImage, b[0], b[1], cs); } } typedef struct _sedge_t { - INT32 xa, xb, ya, yb; - INT32 xmin, xmax, ymin, ymax; + int32_t xa, xb, ya, yb; + int32_t xmin, xmax, ymin, ymax; RtFloat mi, b; double za, zb, dz; } edge_t; @@ -264,9 +264,9 @@ typedef struct _sactive_edge_t } active_edge_t; -void edge_sort(edge_t *pEdges, edge_t **ppEdges, UINT32 nedges) +void edge_sort(edge_t *pEdges, edge_t **ppEdges, uint32_t nedges) { - UINT32 swapped, i; + uint32_t swapped, i; void *pTmp; for (i=0; i < nedges; i++) @@ -291,8 +291,8 @@ void edge_sort(edge_t *pEdges, edge_t **ppEdges, UINT32 nedges) void RenderGridPatchesFilled(render_t *pObj, object_t *pObject) { - UINT32 i, j, x, y, cnt, ii, jj, win, swapped, offset; - INT32 ymin, ymax, xmin, xmax, ys, xs, tmp; + uint32_t i, j, x, y, cnt, ii, jj, win, swapped, offset; + int32_t ymin, ymax, xmin, xmax, ys, xs, tmp; RtMatrix world2cam; rgba_t cs = {1,1,1,1}; @@ -398,8 +398,8 @@ void RenderGridPatchesFilled(render_t *pObj, object_t *pObject) dn = (RtFloat)1/z; uv[0] = pObj->ku*(*ppVert[j])[0]*dn; uv[1] = pObj->kv*(*ppVert[j])[1]*dn; - pPxl[j].x = (UINT32)(pObj->pImage->im_width*(uv[0]+0.5)); - pPxl[j].y = (UINT32)(pObj->pImage->im_height*(uv[1]+0.5)); + pPxl[j].x = (uint32_t)(pObj->pImage->im_width*(uv[0]+0.5)); + pPxl[j].y = (uint32_t)(pObj->pImage->im_height*(uv[1]+0.5)); pPxl[j].z = z; } @@ -598,7 +598,7 @@ void RenderGridPatchesFilled(render_t *pObj, object_t *pObject) void RenderGridPatches(render_t *pObj, object_t *pObject) { - UINT32 i, j, x, y, cnt, offset; + uint32_t i, j, x, y, cnt, offset; RtMatrix world2cam; rgba_t cs = {1,1,1,1}; RtPoint *pPoint, *ppVert[4], *pPx; @@ -609,7 +609,7 @@ void RenderGridPatches(render_t *pObj, object_t *pObject) edge_t edges[4]; RtFloat d[4], uv[2], p[4], dn; - UINT32 b[2], b_first[2], b_prev[2]; + uint32_t b[2], b_first[2], b_prev[2]; double z, z_first, z_prev, dz, zn; double tictoc; @@ -704,8 +704,8 @@ void RenderGridPatches(render_t *pObj, object_t *pObject) dn = (RtFloat)1/z; uv[0] = pObj->ku*(*ppVert[j])[0]*dn; uv[1] = pObj->kv*(*ppVert[j])[1]*dn; - b[0] = (UINT32)(pObj->pImage->im_width*(uv[0]+0.5)); - b[1] = (UINT32)(pObj->pImage->im_height*(uv[1]+0.5)); + b[0] = (uint32_t)(pObj->pImage->im_width*(uv[0]+0.5)); + b[1] = (uint32_t)(pObj->pImage->im_height*(uv[1]+0.5)); if (j > 0) { cnt = Bresenham(pObj->pImage, cs, b_prev, b, pPxl); @@ -751,7 +751,7 @@ void Render_calc_pixel_coverage(render_t *pObj, object_t *pObject, RtFloat *nx, RtMatrix world2cam; RtFloat xmin, xmax, ymin, ymax; RtFloat d[4], uv[2], p[4], dn; - UINT32 i; + uint32_t i; RtPoint pVerts[8]; @@ -809,7 +809,7 @@ void Render_calc_pixel_coverage(render_t *pObj, object_t *pObject, RtFloat *nx, void RenderBound(render_t *pObj, object_t *pObject) { RtMatrix world2cam; - UINT32 i; + uint32_t i; rgba_t cs = {0}; polygon_t *pPoly; RtPoint *pVerts; @@ -922,15 +922,15 @@ void RenderBound(render_t *pObj, object_t *pObject) void Render_patchmesh(render_t *pObj, object_t *pObject) { - UINT32 i, j, m, n, M, N; + uint32_t i, j, m, n, M, N; object_t patch; RtFloat nx, ny; Patchmesh_bound_update(pObject); Render_calc_pixel_coverage(pObj, pObject, &nx, &ny); - M = (UINT32)(nx/pObject->pAttr->shadingrate); - N = (UINT32)(ny/pObject->pAttr->shadingrate); + M = (uint32_t)(nx/pObject->pAttr->shadingrate); + N = (uint32_t)(ny/pObject->pAttr->shadingrate); Patchmesh_get_npatches(pObject, &m, &n); @@ -955,7 +955,7 @@ void Render_patchmesh(render_t *pObj, object_t *pObject) void Render_sphere(render_t *pObj, object_t *pObject) { - UINT32 i, j, M, N; + uint32_t i, j, M, N; RtFloat nx, ny, ngx, ngy; Sphere_bound_update(pObject); @@ -963,8 +963,8 @@ void Render_sphere(render_t *pObj, object_t *pObject) ngx = nx / 16; ngy = ny / 16; - M = (UINT32)(PI*ny/pObject->pAttr->shadingrate); - N = (UINT32)(1.42*nx/pObject->pAttr->shadingrate); + M = (uint32_t)(PI*ny/pObject->pAttr->shadingrate); + N = (uint32_t)(1.42*nx/pObject->pAttr->shadingrate); Sphere_dice(pObject, M, N); #ifdef RENDER_POINTS @@ -978,15 +978,15 @@ void Render_sphere(render_t *pObj, object_t *pObject) void Render_patch(render_t *pObj, object_t *pObject) { - UINT32 i, j, M, N; + uint32_t i, j, M, N; object_t patch, *pObject2; RtFloat nx, ny; Patch_bound_update(pObject); Render_calc_pixel_coverage(pObj, pObject, &nx, &ny); - M = (UINT32)(nx/pObject->pAttr->shadingrate); - N = (UINT32)(ny/pObject->pAttr->shadingrate); + M = (uint32_t)(nx/pObject->pAttr->shadingrate); + N = (uint32_t)(ny/pObject->pAttr->shadingrate); Patch_dice(pObject, M, N); #ifdef RENDER_POINTS diff --git a/src/jman/ri.c b/src/jman/ri.c index 9a17581..4bc3a48 100644 --- a/src/jman/ri.c +++ b/src/jman/ri.c @@ -112,7 +112,7 @@ RtVoid RiEnd (void) // -------------------------------------------------------------- RtVoid RiFrameBegin (RtInt number) { - UINT32 i; + uint32_t i; if (Engine_context_get(&engine, ENGINE_CONTEXT_LEVEL_MAIN) == ENGINE_CONTEXT_INVALID) { @@ -291,7 +291,7 @@ RtVoid RiTransformEnd (void) // -------------------------------------------------------------- RtToken RiDeclare (char *name, char *declaration) { - UINT32 i, len; + uint32_t i, len; RtToken pVar; char *pClass; @@ -436,7 +436,7 @@ RtVoid RiSkew (RtFloat angle, RtFloat dx1, RtFloat dy1, RtFloat dz1, // -------------------------------------------------------------- RtVoid RiTransform (RtMatrix transform) { - UINT32 i, j; + uint32_t i, j; GS_xform_push(pG); @@ -636,7 +636,7 @@ RtVoid RiSides (RtInt nsides) /* Geometric Primitives (and a couple gprim-specific attributes) */ RtVoid RiPointsPolygons (RtInt npolys, RtInt *nverts, RtInt *verts, ...) { - UINT32 j, v, n, k; + uint32_t j, v, n, k; object_t *pObj; RtToken token; RtPoint *pPoint, *pVert; @@ -652,7 +652,7 @@ RtVoid RiPointsPolygons (RtInt npolys, RtInt *nverts, RtInt *verts, ...) } pObj = (object_t*)jmalloc(npolys*sizeof(object_t)); - for (n=0; n < (UINT32)npolys; n++) + for (n=0; n < (uint32_t)npolys; n++) { Polygon_init(&pObj[n], ++pW->stat.num_polygons, nverts[n]); } @@ -664,7 +664,7 @@ RtVoid RiPointsPolygons (RtInt npolys, RtInt *nverts, RtInt *verts, ...) pPoint = (RtPoint*)va_arg(args, RtPointer); v = 0; - for (n=0; n < (UINT32)npolys; n++) + for (n=0; n < (uint32_t)npolys; n++) { pVar = VarListFindByName(&engine.varList, token); if (!pVar) @@ -675,7 +675,7 @@ RtVoid RiPointsPolygons (RtInt npolys, RtInt *nverts, RtInt *verts, ...) pVar = VarListAdd(&pObj[n].vars, pVar); pVert = (RtPoint*)VarSet(pVar, NULL, nverts[n]); - for (j=0; j < (UINT32)nverts[n]; j++) + for (j=0; j < (uint32_t)nverts[n]; j++) { k = verts[v++]; pVert[j][0] = pPoint[k][0]; @@ -685,7 +685,7 @@ RtVoid RiPointsPolygons (RtInt npolys, RtInt *nverts, RtInt *verts, ...) } } }; - for (n=0; n < (UINT32)npolys; n++) + for (n=0; n < (uint32_t)npolys; n++) { Object_set_xform(&pObj[n], pG->pXform_curr); Object_set_attr(&pObj[n], pG->pAttr); @@ -759,7 +759,7 @@ RtVoid RiBasis (RtBasis ubasis, RtInt ustep, RtBasis vbasis, RtInt vstep) RtVoid RiCurves (RtToken degree, RtInt ncurves, RtInt nverts[], RtToken wrap, ...) { - UINT32 n; + uint32_t n; object_t *pObj; RtToken token; RtPointer arg; diff --git a/src/jman/ribgen.c b/src/jman/ribgen.c index d49e4a0..80838f4 100644 --- a/src/jman/ribgen.c +++ b/src/jman/ribgen.c @@ -15,7 +15,7 @@ // -------------------------------------------------------------- void RibgenPrintVars(engine_t *pObj, ri_var_t *pVar, RtPointer arg) { - UINT32 i, j; + uint32_t i, j; RtPoint *pPoint; RtColor *pColor; RtFloat *pFloat; @@ -137,7 +137,7 @@ void Ribgen_TransformEnd(engine_t *pObj) // -------------------------------------------------------------- void Ribgen_ConcatTransform(engine_t *pObj, RtMatrix transform) { - UINT32 i, j; + uint32_t i, j; if (!pObj->pFile) return; @@ -189,7 +189,7 @@ void Ribgen_Scale(engine_t *pObj, RtFloat dx, RtFloat dy, RtFloat dz) // -------------------------------------------------------------- void Ribgen_Transform(engine_t *pObj, RtMatrix transform) { - UINT32 i, j; + uint32_t i, j; if (!pObj->pFile) return; @@ -346,7 +346,7 @@ void Ribgen_Illuminate (engine_t *pObj, RtInt id, RtBoolean onoff) // -------------------------------------------------------------- void Ribgen_PointsPolygons(engine_t *pObj, RtInt npolys, RtInt *nverts, RtInt *verts, va_list args) { - UINT32 j, v, n, num_verts = 0; + uint32_t j, v, n, num_verts = 0; RtToken token; RtPoint *pPoint; @@ -362,17 +362,17 @@ void Ribgen_PointsPolygons(engine_t *pObj, RtInt npolys, RtInt *nverts, RtInt *v pPoint = (RtPoint*)va_arg(args, RtPointer); fprintf(pObj->pFile, " ["); - for (n=0; n < (UINT32)npolys; n++) + for (n=0; n < (uint32_t)npolys; n++) fprintf(pObj->pFile, " %d", nverts[n]); fprintf(pObj->pFile, " ] ["); v = 0; - for (n=0; n < (UINT32)npolys; n++) + for (n=0; n < (uint32_t)npolys; n++) { - for (j=0; j < (UINT32)nverts[n]; j++) + for (j=0; j < (uint32_t)nverts[n]; j++) { - if ((UINT32)verts[v] > num_verts) + if ((uint32_t)verts[v] > num_verts) num_verts = verts[v]; fprintf(pObj->pFile, " %d", verts[v]); @@ -464,7 +464,7 @@ void Ribgen_Basis (engine_t *pObj, RtBasis ubasis, RtInt ustep, RtBasis vbasis, // -------------------------------------------------------------- void Ribgen_Curves(engine_t *pObj, object_t *pObject, RtToken type, RtInt ncurves, RtInt nverts[], RtToken wrap, va_list args) { - UINT32 i, n, num_verts = 0; + uint32_t i, n, num_verts = 0; RtToken token; RtPointer arg; ri_var_t *pVar; @@ -493,7 +493,7 @@ void Ribgen_Curves(engine_t *pObj, object_t *pObject, RtToken type, RtInt ncurve // -------------------------------------------------------------- void Ribgen_Patch(engine_t *pObj, object_t *pObject, RtToken type, va_list args) { - UINT32 i, npoints; + uint32_t i, npoints; RtToken token; RtPointer arg; ri_var_t *pVar; @@ -519,7 +519,7 @@ void Ribgen_Patch(engine_t *pObj, object_t *pObject, RtToken type, va_list args) // -------------------------------------------------------------- void Ribgen_Patchmesh(engine_t *pObj, object_t *pObject, RtToken type, RtInt nu, RtToken uwrap, RtInt nv, RtToken vwrap, va_list args) { - UINT32 i; + uint32_t i; RtToken token; RtPointer arg; ri_var_t *pVar; @@ -558,7 +558,7 @@ void Ribgen_Sphere(engine_t *pObj, object_t *pObject, RtFloat radius, RtFloat zm } // -------------------------------------------------------------- -void Ribgen_LightSource(engine_t *pObj, object_t *pObject, char *name, UINT32 id, va_list args) +void Ribgen_LightSource(engine_t *pObj, object_t *pObject, char *name, uint32_t id, va_list args) { RtToken token; RtPointer arg; diff --git a/src/jman/ribgen.h b/src/jman/ribgen.h index d06c5b4..27dac5a 100644 --- a/src/jman/ribgen.h +++ b/src/jman/ribgen.h @@ -35,7 +35,7 @@ void Ribgen_Curves(engine_t *pObj, object_t *pObject, RtToken type, RtInt ncurve void Ribgen_Patch(engine_t *pObj, object_t *pObject, RtToken type, va_list args); void Ribgen_Patchmesh(engine_t *pObj, object_t *pObject, RtToken type, RtInt nu, RtToken uwrap, RtInt nv, RtToken vwrap, va_list args); void Ribgen_Sphere(engine_t *pObj, object_t *pObject, RtFloat radius, RtFloat zmin, RtFloat zmax, RtFloat thetamax, va_list args); -void Ribgen_LightSource(engine_t *pObj, object_t *pObject, char *name, UINT32 id, va_list args); +void Ribgen_LightSource(engine_t *pObj, object_t *pObject, char *name, uint32_t id, va_list args); void Ribgen_Surface(engine_t *pObj, char *name, va_list args); void Ribgen_Displacement(engine_t *pObj, char *name, va_list args); diff --git a/src/jman/stack.c b/src/jman/stack.c index dc185ea..e0ae6b6 100644 --- a/src/jman/stack.c +++ b/src/jman/stack.c @@ -42,7 +42,7 @@ stack_t* Stack_free(stack_t *pObj) return pObj; } -stack_t* Stack_push(stack_t *pObj, void **ppData, UINT32 size) +stack_t* Stack_push(stack_t *pObj, void **ppData, uint32_t size) { stack_t *pCurr; diff --git a/src/jman/stack.h b/src/jman/stack.h index 1fc8732..98e3176 100644 --- a/src/jman/stack.h +++ b/src/jman/stack.h @@ -5,7 +5,7 @@ typedef struct _sstack_t { - UINT32 size; + uint32_t size; void *pData; struct _sstack_t *pNext; struct _sstack_t *pPrev; @@ -14,7 +14,7 @@ typedef struct _sstack_t stack_t* Stack_free_top(stack_t *pObj); stack_t* Stack_free(stack_t *pObj); -stack_t* Stack_push(stack_t *pObj, void **ppData, UINT32 size); +stack_t* Stack_push(stack_t *pObj, void **ppData, uint32_t size); stack_t* Stack_pop(stack_t *pObj, void **ppData); #endif // STACK_H diff --git a/src/jman/types.h b/src/jman/types.h index ed76f90..3a85ff2 100644 --- a/src/jman/types.h +++ b/src/jman/types.h @@ -5,31 +5,11 @@ #ifndef TYPES_H #define TYPES_H -#ifndef UINT32 -#define UINT32 unsigned int -#endif - -#ifndef UINT16 -#define UINT16 unsigned short -#endif - -#ifndef UINT8 -#define UINT8 unsigned char -#endif - -#ifndef INT32 -#define INT32 signed int -#endif - -#ifndef INT16 -#define INT16 signed short -#endif - -#ifndef INT8 -#define INT8 signed char -#endif +#include +#ifndef ERROR_BASE #define ERROR_BASE 0x80000000 +#endif #ifndef IS_ERROR #define IS_ERROR(e) ((e & ERROR_BASE) == ERROR_BASE) #endif diff --git a/src/jman/vars.c b/src/jman/vars.c index 7e57baf..21ecffa 100644 --- a/src/jman/vars.c +++ b/src/jman/vars.c @@ -47,7 +47,7 @@ void VarListFree(var_list_t *pObj) } // finds variable by its name -ri_var_t* VarListFindByName(var_list_t *pObj, UINT8 *name) +ri_var_t* VarListFindByName(var_list_t *pObj, uint8_t *name) { linkedlist_t *pFirst, *pVarList; ri_var_t *pVar; @@ -105,12 +105,12 @@ void VarListPrint(var_list_t *pObj) // Declare empty variable and add it to list of variables -ri_var_t* VarListDeclare(var_list_t *pObj, UINT8 *name, UINT8 *cls, UINT8 *type) +ri_var_t* VarListDeclare(var_list_t *pObj, uint8_t *name, uint8_t *cls, uint8_t *type) { RtToken *pToken; RtInt *pSize; - UINT32 *pEtypes; - UINT32 *pEclasses; + uint32_t *pEtypes; + uint32_t *pEclasses; ri_var_t var; @@ -183,7 +183,7 @@ ri_var_t* VarListAdd(var_list_t *pObj, ri_var_t *pVar) } -void VarListDelByName(var_list_t *pObj, UINT8 *name) +void VarListDelByName(var_list_t *pObj, uint8_t *name) { VarListDel(pObj, VarListFindByName(pObj, name)); } @@ -214,7 +214,7 @@ void VarListDel(var_list_t *pObj, ri_var_t *pVar) } // Allocs empty variable -RtPointer VarAlloc(ri_var_t *pObj, UINT32 nvalues) +RtPointer VarAlloc(ri_var_t *pObj, uint32_t nvalues) { if (!nvalues) return NULL; @@ -235,7 +235,7 @@ RtPointer VarAlloc(ri_var_t *pObj, UINT32 nvalues) } // Allocs empty variable and copy data into it -RtPointer VarSet(ri_var_t *pObj, RtPointer pValue, UINT32 nvalues) +RtPointer VarSet(ri_var_t *pObj, RtPointer pValue, uint32_t nvalues) { RtPointer pData; diff --git a/src/jman/vars.h b/src/jman/vars.h index af3c46c..b5c24cc 100644 --- a/src/jman/vars.h +++ b/src/jman/vars.h @@ -1,19 +1,17 @@ #ifndef VARS_H #define VARS_H -#include -#include -#include +#include typedef struct _sri_var_t { - UINT32 etype; - UINT32 ecls; + uint32_t etype; + uint32_t ecls; RtToken name; RtToken type; RtToken cls; RtPointer pValue; - UINT32 value_size, nvalues; + uint32_t value_size, nvalues; } ri_var_t; @@ -28,14 +26,14 @@ enum _vVarClass {VC_VERTEX, VC_UNIFORM, VC_VARYING, VC_CONSTANT}; void VarListInit(var_list_t *pObj); void VarListFree(var_list_t *pObj); -ri_var_t* VarListFindByName(var_list_t *pObj, UINT8 *name); -ri_var_t* VarListDeclare(var_list_t *pObj, UINT8 *name, UINT8 *cls, UINT8 *type); +ri_var_t* VarListFindByName(var_list_t *pObj, uint8_t *name); +ri_var_t* VarListDeclare(var_list_t *pObj, uint8_t *name, uint8_t *cls, uint8_t *type); ri_var_t* VarListAdd(var_list_t *pObj, ri_var_t *pVar); -void VarListDelByName(var_list_t *pObj, UINT8 *name); +void VarListDelByName(var_list_t *pObj, uint8_t *name); void VarListDel(var_list_t *pObj, ri_var_t *pVar); -ri_var_t* VarListDeleteByName(var_list_t *pObj, UINT8 *name); -RtPointer VarAlloc(ri_var_t *pObj, UINT32 nvalues); -RtPointer VarSet(ri_var_t *pObj, RtPointer pValue, UINT32 nvalues); +ri_var_t* VarListDeleteByName(var_list_t *pObj, uint8_t *name); +RtPointer VarAlloc(ri_var_t *pObj, uint32_t nvalues); +RtPointer VarSet(ri_var_t *pObj, RtPointer pValue, uint32_t nvalues); RtPointer VarGet(ri_var_t *pObj); void VarListPrint(var_list_t *pObj); diff --git a/src/libsys/gpio.c b/src/libsys/gpio.c index 7fe801b..4da4f3c 100644 --- a/src/libsys/gpio.c +++ b/src/libsys/gpio.c @@ -2,24 +2,24 @@ #include "gpio.h" // --------------------------------------------------------- -UINT32 gpio_init(gpio_if_t *pGPIO, UINT32 base_addr) +uint32_t gpio_init(gpio_if_t *pGPIO, uint32_t base_addr) { - pGPIO->pBase = (UINT32*)base_addr; + pGPIO->pBase = (uint32_t*)base_addr; return 0; } -UINT32 gpio_clean(gpio_if_t *pGPIO) +uint32_t gpio_clean(gpio_if_t *pGPIO) { return 0; } -UINT32 gpio_write(gpio_if_t *pGPIO, UINT32 mask, UINT32 shift, UINT32 offset, UINT32 value) +uint32_t gpio_write(gpio_if_t *pGPIO, uint32_t mask, uint32_t shift, uint32_t offset, uint32_t value) { *(pGPIO->pBase + offset) = (*(pGPIO->pBase + offset) & ~(mask << shift)) | ((value & mask) << shift); return 0; } -UINT32 gpio_read(gpio_if_t *pGPIO, UINT32 mask, UINT32 shift, UINT32 offset, UINT32 *pValue) +uint32_t gpio_read(gpio_if_t *pGPIO, uint32_t mask, uint32_t shift, uint32_t offset, uint32_t *pValue) { *pValue = (*(pGPIO->pBase + offset) & (mask << shift)) >> shift; return 0; diff --git a/src/libsys/gpio.h b/src/libsys/gpio.h index 4f4947e..39575e7 100644 --- a/src/libsys/gpio.h +++ b/src/libsys/gpio.h @@ -9,7 +9,7 @@ // --------------------------------------------------------- typedef struct _sgpio_if_t { - volatile UINT32 *pBase; + volatile uint32_t *pBase; } gpio_if_t; @@ -32,10 +32,10 @@ typedef struct _sgpio_if_t gpio_read(gpio, mask, shift, GPIO_DIR_OFFSET, ret) -UINT32 gpio_init(gpio_if_t *pGPIO, UINT32 base_addr); -UINT32 gpio_clean(gpio_if_t *pGPIO); +uint32_t gpio_init(gpio_if_t *pGPIO, uint32_t base_addr); +uint32_t gpio_clean(gpio_if_t *pGPIO); -UINT32 gpio_write(gpio_if_t *pGPIO, UINT32 mask, UINT32 shift, UINT32 offset, UINT32 value); -UINT32 gpio_read(gpio_if_t *pGPIO, UINT32 mask, UINT32 shift, UINT32 offset, UINT32 *pValue); +uint32_t gpio_write(gpio_if_t *pGPIO, uint32_t mask, uint32_t shift, uint32_t offset, uint32_t value); +uint32_t gpio_read(gpio_if_t *pGPIO, uint32_t mask, uint32_t shift, uint32_t offset, uint32_t *pValue); #endif // GPIO_H diff --git a/src/libsys/libsys.c b/src/libsys/libsys.c index 5edfe0b..de2ad87 100644 --- a/src/libsys/libsys.c +++ b/src/libsys/libsys.c @@ -11,16 +11,16 @@ // --------------------------------------------------------------------------------- // Forward declarations // --------------------------------------------------------------------------------- -void flush(UINT32 port); -UINT32 GetPort(int file); +void flush(uint32_t port); +uint32_t GetPort(int file); // --------------------------------------------------------------------------------- // Types // --------------------------------------------------------------------------------- void libsys_init(void) { - UINT32 volatile *pVGA_ctrl = (UINT32*)SYS_VGA_CTRL; - UINT32 volatile *pITIM_ctrl = (UINT32*)SYS_ITIM_CTRL; + uint32_t volatile *pVGA_ctrl = (uint32_t*)SYS_VGA_CTRL; + uint32_t volatile *pITIM_ctrl = (uint32_t*)SYS_ITIM_CTRL; Screen_clr(); @@ -62,7 +62,7 @@ enum }; -UINT32 GetPort(int file) +uint32_t GetPort(int file) { if (file == 0) // STDIN return PORT_IN_UART_0; @@ -90,34 +90,34 @@ enum typedef struct _suart_if_t { - volatile UINT32 *pCTRL; - volatile UINT32 *pDATA; - volatile UINT32 *pBAUD; + volatile uint32_t *pCTRL; + volatile uint32_t *pDATA; + volatile uint32_t *pBAUD; } uart_if_t; typedef struct _sps2_if_t { - volatile UINT32 *pCTRL; - volatile UINT32 *pDATA; + volatile uint32_t *pCTRL; + volatile uint32_t *pDATA; } ps2_if_t; typedef struct _svga_if_t { - volatile UINT32 *pCTRL; - volatile UINT32 *pDATA; - volatile UINT32 *pCSRX; - volatile UINT32 *pCSRY; + volatile uint32_t *pCTRL; + volatile uint32_t *pDATA; + volatile uint32_t *pCSRX; + volatile uint32_t *pCSRY; } vga_if_t; typedef struct _scon_if_in_t { - UINT32 type; + uint32_t type; void *pIF; } con_if_in_t; typedef struct _scon_if_out_t { - UINT32 type; + uint32_t type; void *pIF; } con_if_out_t; @@ -126,15 +126,15 @@ typedef struct _scon_if_out_t // --------------------------------------------------------------------------------- static uart_if_t uart_if[2] = { - {(UINT32*)SYS_UART0_STAT, (UINT32*)SYS_UART0_DATA, (UINT32*)SYS_UART0_BAUD}, - {(UINT32*)SYS_UART1_STAT, (UINT32*)SYS_UART1_DATA, (UINT32*)SYS_UART1_BAUD} + {(uint32_t*)SYS_UART0_STAT, (uint32_t*)SYS_UART0_DATA, (uint32_t*)SYS_UART0_BAUD}, + {(uint32_t*)SYS_UART1_STAT, (uint32_t*)SYS_UART1_DATA, (uint32_t*)SYS_UART1_BAUD} }; extern ps2_if_t ps2_if[]; static vga_if_t vga_if = { - (UINT32*)SYS_VGA_CTRL, (UINT32*)SYS_VGA_ASCII, (UINT32*)SYS_VGA_POSX, (UINT32*)SYS_VGA_POSY + (uint32_t*)SYS_VGA_CTRL, (uint32_t*)SYS_VGA_ASCII, (uint32_t*)SYS_VGA_POSX, (uint32_t*)SYS_VGA_POSY }; static con_if_in_t con_if_in[4] = @@ -156,9 +156,9 @@ static con_if_out_t con_if_out[4] = // --------------------------------------------------------------------------------- // MIPS specific // --------------------------------------------------------------------------------- -UINT32 CP0_SR_read(void) +uint32_t CP0_SR_read(void) { - UINT32 result; + uint32_t result; __asm__ ( @@ -169,7 +169,7 @@ UINT32 CP0_SR_read(void) return result; } -void CP0_SR_write(UINT32 val) +void CP0_SR_write(uint32_t val) { __asm__ ( @@ -179,9 +179,9 @@ void CP0_SR_write(UINT32 val) ); } -UINT32 CP0_CR_read(void) +uint32_t CP0_CR_read(void) { - UINT32 result; + uint32_t result; __asm__ ( @@ -192,7 +192,7 @@ UINT32 CP0_CR_read(void) return result; } -void CP0_CR_write(UINT32 val) +void CP0_CR_write(uint32_t val) { __asm__ ( @@ -202,9 +202,9 @@ void CP0_CR_write(UINT32 val) ); } -UINT32 CP0_TR_read(void) +uint32_t CP0_TR_read(void) { - UINT32 result; + uint32_t result; __asm__ ( @@ -215,7 +215,7 @@ UINT32 CP0_TR_read(void) return result; } -void CP0_TR_write(UINT32 val) +void CP0_TR_write(uint32_t val) { __asm__ ( @@ -225,9 +225,9 @@ void CP0_TR_write(UINT32 val) ); } -UINT32 CP0_PRID_read(void) +uint32_t CP0_PRID_read(void) { - UINT32 result; + uint32_t result; __asm__ ( @@ -238,7 +238,7 @@ UINT32 CP0_PRID_read(void) return result; } -void CP0_TR_write_ptr(UINT32* pPtr) +void CP0_TR_write_ptr(uint32_t* pPtr) { __asm__ ( @@ -248,7 +248,7 @@ void CP0_TR_write_ptr(UINT32* pPtr) ); } -void CP0_TR_read_ptr(UINT32* pPtr) +void CP0_TR_read_ptr(uint32_t* pPtr) { __asm__ ( @@ -266,7 +266,7 @@ void ICACHE_invalidate_all(void) ); } -void ICACHE_invalidate_at(UINT32* pPtr) +void ICACHE_invalidate_at(uint32_t* pPtr) { __asm__ ( @@ -285,7 +285,7 @@ void DCACHE_invalidate_all(void) ); } -void DCACHE_invalidate_at(UINT32* pPtr) +void DCACHE_invalidate_at(uint32_t* pPtr) { __asm__ ( @@ -302,10 +302,10 @@ void DCACHE_invalidate_at(UINT32* pPtr) //keymap for the AT keyboard SG layout typedef struct { - UINT8 scancode; - UINT8 unshifted; - UINT8 shifted; - UINT8 altered; + uint8_t scancode; + uint8_t unshifted; + uint8_t shifted; + uint8_t altered; } libsys_key_entry_t; #define SHIFTED (1<<0) @@ -318,7 +318,7 @@ static const libsys_key_entry_t __keymap_german[] = {0x32, 'b', 'B', 'b'}, {0x21, 'c', 'C', 'c'}, {0x23, 'd', 'D', 'd'}, - {0x24, 'e', 'E', '€'}, + {0x24, 'e', 'E', '�'}, {0x2b, 'f', 'F', 'f'}, {0x34, 'g', 'G', 'g'}, {0x33, 'h', 'H', 'h'}, @@ -326,7 +326,7 @@ static const libsys_key_entry_t __keymap_german[] = {0x3b, 'j', 'J', 'j'}, {0x42, 'k', 'K', 'k'}, {0x4b, 'l', 'L', 'l'}, - {0x3a, 'm', 'M', 'µ'}, + {0x3a, 'm', 'M', '�'}, {0x31, 'n', 'N', 'n'}, {0x44, 'o', 'O', 'o'}, {0x4d, 'p', 'P', 'p'}, @@ -342,7 +342,7 @@ static const libsys_key_entry_t __keymap_german[] = {0x35, 'z', 'Z', 'z'}, {0x16, '1', '!', '1'}, {0x1e, '2', '"', '2'}, - {0x26, '3', '§', '3'}, + {0x26, '3', '�', '3'}, {0x25, '4', '$', '4'}, {0x2e, '5', '%', '5'}, {0x36, '6', '&', '6'}, @@ -350,18 +350,18 @@ static const libsys_key_entry_t __keymap_german[] = {0x3e, '8', '(', '['}, {0x46, '9', ')', ']'}, {0x45, '0', '=', '}'}, - {0x4e, 'ß', '?', '\\'}, + {0x4e, '�', '?', '\\'}, {0x29, ' ', ' ', ' '}, {0x41, ',', ';', ','}, {0x49, '.', ':', '.'}, {0x4a, '-', '_', '-'}, - {0x52, 'ä', 'Ä', 'ä'}, - {0x4c, 'ö', 'Ö', 'ö'}, - {0x54, 'ü', 'Ü', 'ü'}, + {0x52, '�', '�', '�'}, + {0x4c, '�', '�', '�'}, + {0x54, '�', '�', '�'}, {0x5a, '\n', '\n', '\n'}, //RETURN {0x5b, '+', '*', '~'}, {0x5d, '#', '\'', '#'}, - {0x0e, '^', '°', '^'}, + {0x0e, '^', '�', '^'}, {0x61, '<', '>', '|'}, {0x66, '\b', '\b', '\b'}, {0} //sentinel @@ -414,7 +414,7 @@ static char __findkey(char scancode, int mode) #define ARROW_LEFT (SPECIALKEY|EXTENDED|0x6b) #define ARROW_RIGHT (SPECIALKEY|EXTENDED|0x74) -UINT32 PS2_readchar(ps2_if_t *pIF) +uint32_t PS2_readchar(ps2_if_t *pIF) { if (!pIF) return -1; @@ -425,15 +425,15 @@ UINT32 PS2_readchar(ps2_if_t *pIF) } -UINT32 con_readchar(ps2_if_t *pIF) +uint32_t con_readchar(ps2_if_t *pIF) { - UINT8 c; + uint8_t c; static char mode = 0; static char nextrelease = 0; static char extended = 0; int flags = 0; int char_valid = 0; - UINT8 key; + uint8_t key; key = PS2_readchar(pIF); @@ -520,12 +520,12 @@ void UART_writechar(uart_if_t *pIF, char c) while((SYS_UART_BIT_TX_HALFFULL & *pIF->pCTRL) != 0); - *pIF->pDATA = (UINT32)c; + *pIF->pDATA = (uint32_t)c; } void cg_writechar(vga_if_t *pIF, char c) { - UINT32 code; + uint32_t code; if (!pIF) return; @@ -533,27 +533,27 @@ void cg_writechar(vga_if_t *pIF, char c) // Output translation switch(c) { - case 'Ä': + case '�': code = 196; break; - case 'ä': + case '�': code = 228; break; - case 'Ö': + case '�': code = 214; break; - case 'ö': + case '�': code = 246; break; - case 'Ü': + case '�': code = 220; break; - case 'ü': + case '�': code = 252; break; @@ -561,24 +561,24 @@ void cg_writechar(vga_if_t *pIF, char c) code = 230; break; - case '§': + case '�': code = 167; break; - case 'ß': + case '�': code = 223; break; - case '°': + case '�': code = 176; break; - case 'µ': + case '�': code = 181; break; default: - code = (UINT32)c; + code = (uint32_t)c; break; } @@ -586,7 +586,7 @@ void cg_writechar(vga_if_t *pIF, char c) *pIF->pDATA = code; } -void cg_set_csr_x(vga_if_t *pIF, UINT32 coord) +void cg_set_csr_x(vga_if_t *pIF, uint32_t coord) { if (!pIF) return; @@ -596,7 +596,7 @@ void cg_set_csr_x(vga_if_t *pIF, UINT32 coord) *pIF->pCSRX = coord; } -void cg_set_csr_y(vga_if_t *pIF, UINT32 coord) +void cg_set_csr_y(vga_if_t *pIF, uint32_t coord) { if (!pIF) return; @@ -643,39 +643,39 @@ void Screen_line_clr(void) cg_clr_line(&vga_if); } -void Screen_csr_set_x(UINT32 coord) +void Screen_csr_set_x(uint32_t coord) { cg_set_csr_x(&vga_if, coord); } -void Screen_csr_set_y(UINT32 coord) +void Screen_csr_set_y(uint32_t coord) { cg_set_csr_y(&vga_if, coord); } -UINT32 Screen_get_resx(void) +uint32_t Screen_get_resx(void) { - UINT32 volatile *pVGA_res = (UINT32*)SYS_VGA_RES; + uint32_t volatile *pVGA_res = (uint32_t*)SYS_VGA_RES; return (0xFFF & (*pVGA_res >> 0)); } -UINT32 Screen_get_resy(void) +uint32_t Screen_get_resy(void) { - UINT32 volatile *pVGA_res = (UINT32*)SYS_VGA_RES; + uint32_t volatile *pVGA_res = (uint32_t*)SYS_VGA_RES; return (0xFFF & (*pVGA_res >> 12)); } -UINT32 Screen_get_fps(void) +uint32_t Screen_get_fps(void) { - UINT32 volatile *pVGA_res = (UINT32*)SYS_VGA_RES; + uint32_t volatile *pVGA_res = (uint32_t*)SYS_VGA_RES; return (0xFF & (*pVGA_res >> 24)); } // --------------------------------------------------------------------------------- -void flush(UINT32 port) +void flush(uint32_t port) { int c; con_if_in_t *pIF; @@ -701,7 +701,7 @@ void flush(UINT32 port) } while(c > 0); } -char readchar(UINT32 port) +char readchar(uint32_t port) { int c; con_if_in_t *pIF; @@ -729,7 +729,7 @@ char readchar(UINT32 port) return (char)c; } -void writechar(UINT32 port, char c) +void writechar(uint32_t port, char c) { con_if_out_t *pIF; @@ -750,7 +750,7 @@ void writechar(UINT32 port, char c) } } -void _putchar(UINT32 port, char c) +void _putchar(uint32_t port, char c) { con_if_out_t *pIF; @@ -951,7 +951,7 @@ int close(int file) int read(int file, char *ptr, int len) { - UINT32 port; + uint32_t port; int i; char c; @@ -984,7 +984,7 @@ int read(int file, char *ptr, int len) int write(int file, char *ptr, int len) { - UINT32 port; + uint32_t port; int i = 0; // sputs("write ("); print_word(file); sputs(")\n"); @@ -1087,12 +1087,12 @@ void print_word(int word) // _Return: none // // --------------------------------------------------------------------------- -void PrintBuffer8(UINT8 *pBuf, int nbpr, int len) +void PrintBuffer8(uint8_t *pBuf, int nbpr, int len) { memdump(pBuf, 1, nbpr, len); } -void memdump(UINT8 *pBuf, int print_offset_only, int num_bytes_per_row, int len) +void memdump(uint8_t *pBuf, int print_offset_only, int num_bytes_per_row, int len) { int i, j, cnt_hex, cnt_asc, base; unsigned char c; diff --git a/src/libsys/libsys.h b/src/libsys/libsys.h index 4fe9714..f017ecf 100644 --- a/src/libsys/libsys.h +++ b/src/libsys/libsys.h @@ -1,30 +1,11 @@ #ifndef LIBSYS_H #define LIBSYS_H +#include + // --------------------------------------------------------- // Types // --------------------------------------------------------- -#define INT8 signed char -#define INT16 signed short -#define INT32 signed int -#define INT64 signed long long -#define UINT8 unsigned char -#define UINT16 unsigned short -#define UINT32 unsigned int -#define UINT64 unsigned long long -#define INT INT32 -#define UINT UINT32 -#define FLOAT32 float -#define FLOAT64 double - -#define int8_t signed char -#define int16_t signed short -#define int32_t signed int -#define int64_t signed long long -#define uint8_t unsigned char -#define uint16_t unsigned short -#define uint32_t unsigned int -#define uint64_t unsigned long long #define NO_ERROR LSYS_SUCCESS #define ERROR LSYS_ERR_BASE @@ -278,7 +259,7 @@ void ICACHE_invalidate_all(void) ); } -void ICACHE_invalidate_at(UINT32* pPtr) +void ICACHE_invalidate_at(uint32_t* pPtr) { __asm__ ( @@ -297,7 +278,7 @@ void DCACHE_invalidate_all(void) ); } -void DCACHE_invalidate_at(UINT32* pPtr) +void DCACHE_invalidate_at(uint32_t* pPtr) { __asm__ ( @@ -311,7 +292,7 @@ void DCACHE_invalidate_at(UINT32* pPtr) #define CP0_read(idx) \ ({ \ - UINT32 result; \ + uint32_t result; \ __asm__ __volatile__ \ ( \ "mfc0\t%0,$"#idx"\n" \ @@ -351,34 +332,34 @@ void DCACHE_invalidate_at(UINT32* pPtr) ); \ }) -UINT32 CP0_SR_read(void); -void CP0_SR_write(UINT32 val); -UINT32 CP0_CR_read(void); -void CP0_CR_write(UINT32 val); -UINT32 CP0_PRID_read(void); -UINT32 CP0_TR_read(void); -void CP0_TR_write(UINT32 val); -void CP0_TR_write_ptr(UINT32* pPtr); -void CP0_TR_read_ptr(UINT32* pPtr); +uint32_t CP0_SR_read(void); +void CP0_SR_write(uint32_t val); +uint32_t CP0_CR_read(void); +void CP0_CR_write(uint32_t val); +uint32_t CP0_PRID_read(void); +uint32_t CP0_TR_read(void); +void CP0_TR_write(uint32_t val); +void CP0_TR_write_ptr(uint32_t* pPtr); +void CP0_TR_read_ptr(uint32_t* pPtr); void ICACHE_invalidate_all(void); -void ICACHE_invalidate_at(UINT32* pPtr); +void ICACHE_invalidate_at(uint32_t* pPtr); void DCACHE_invalidate_all(void); -void DCACHE_invalidate_at(UINT32* pPtr); +void DCACHE_invalidate_at(uint32_t* pPtr); #define CALC_BAUD(b) \ - ((UINT32)((float)CPU_FREQ_HZ/(16*b) + 0.5f) - 1); + ((uint32_t)((float)CPU_FREQ_HZ/(16*b) + 0.5f) - 1); #define UART0_setbaud(b) \ - *((UINT32*)SYS_UART0_BAUD) = CALC_BAUD(b); + *((uint32_t*)SYS_UART0_BAUD) = CALC_BAUD(b); #define UART1_setbaud(b) \ - *((UINT32*)SYS_UART1_BAUD) = CALC_BAUD(b); + *((uint32_t*)SYS_UART1_BAUD) = CALC_BAUD(b); #define UART2_setbaud(b) \ - *((UINT32*)SYS_UART2_BAUD) = CALC_BAUD(b); + *((uint32_t*)SYS_UART2_BAUD) = CALC_BAUD(b); -char readchar(UINT32 port); -void writechar(UINT32 port, char c); +char readchar(uint32_t port); +void writechar(uint32_t port, char c); int write(int file, char *ptr, int len); int sputs(char const *pStr); void print_byte(char byte); @@ -389,16 +370,16 @@ void usleep(unsigned us); char _getchar(void); -void PrintBuffer8(UINT8 *pBuf, int nbpr, int len); -void memdump(UINT8 *pBuf, int print_offset_only, int num_bytes_per_row, int len); +void PrintBuffer8(uint8_t *pBuf, int nbpr, int len); +void memdump(uint8_t *pBuf, int print_offset_only, int num_bytes_per_row, int len); void Screen_clr(void); void Screen_line_clr(void); -void Screen_csr_set_x(UINT32 coord); -void Screen_csr_set_y(UINT32 coord); -UINT32 Screen_get_resx(void); -UINT32 Screen_get_resy(void); -UINT32 Screen_get_fps(void); +void Screen_csr_set_x(uint32_t coord); +void Screen_csr_set_y(uint32_t coord); +uint32_t Screen_get_resx(void); +uint32_t Screen_get_resy(void); +uint32_t Screen_get_fps(void); diff --git a/src/libsys/mips_dbg.c b/src/libsys/mips_dbg.c index f298726..100c212 100644 --- a/src/libsys/mips_dbg.c +++ b/src/libsys/mips_dbg.c @@ -37,8 +37,8 @@ static char *g_state_names[STATE_NUM_ENTRIES] = {"Init", "Run", "Single step", " typedef struct _sbp_t { - UINT32 *pAddr; - UINT32 instr; + uint32_t *pAddr; + uint32_t instr; } bp_t; static EXCEPTION_CONTEXT xcp_last; @@ -48,17 +48,17 @@ static bp_t mgmt_bp_ru[2]; static int g_is_ss; static int g_bp_count; -int IsBreak(UINT32 instr) +int IsBreak(uint32_t instr) { return ((instr & 0xFC00003F) == 0x0000000D); } -UINT32 BreakGetType(UINT32 instr) +uint32_t BreakGetType(uint32_t instr) { return (instr >> 6) & BP_MASK_TYPE; } -char* reg_changed(UINT32 reg1, UINT32 reg2) +char* reg_changed(uint32_t reg1, uint32_t reg2) { static char chg_str[2] = {0}; @@ -69,80 +69,80 @@ char* reg_changed(UINT32 reg1, UINT32 reg2) return chg_str; } - -void set_mgmt_break(UINT32 *pAddr_break) -{ - mgmt_bp_ss[0].pAddr = NULL; - mgmt_bp_ss[0].pAddr = 0; - - // Don't overwrite user breaks - if (IsBreak(*pAddr_break) && (BreakGetType(*pAddr_break) == BP_USER_BASE)) - { -// sputs("Instruction at address ");print_word((long)pAddr_break);sputs(" is user break\n"); - } - else - { - // Save original instruction - mgmt_bp_ss[0].pAddr = pAddr_break; - mgmt_bp_ss[0].instr = *(mgmt_bp_ss[0].pAddr); - // Replace instruction with managment breakpoint - *(mgmt_bp_ss[0].pAddr) = BP_MGMT_SS(1); - ICACHE_invalidate_at(mgmt_bp_ss[0].pAddr); - } -} - -void singlestep(struct xcptcontext * xcp, UINT32 *pAddr_curr, UINT32 is_branch_shadow) -{ - - int junk; - UINT32 branch_addr, reg, result, bp_type; - UINT32 *pInstr, *pAddr_prev, *pAddr_next; - - pAddr_prev = pAddr_curr - 1; - pAddr_next = pAddr_curr + 1; - - set_mgmt_break(pAddr_next); - - mgmt_bp_ss[1].pAddr = NULL; - mgmt_bp_ss[1].pAddr = 0; - - // We have two possible management breaks, if previous instruction was branch or jump - if (is_branch_shadow) - { - result = tdisasm(g_buf, (long)pAddr_prev, *pAddr_prev, 0, &junk, &branch_addr, ®); - // Is jump target stored in register - if (result == 3) - { - branch_addr = xcp->regs[reg&0x1F]; - } - - // Don't overwrite user breaks - if (IsBreak(branch_addr) && (BreakGetType(branch_addr) == BP_USER_BASE)) - { -// sputs("Instruction at branch address ");print_word((long)branch_addr);sputs(" is user break\n"); - } - else - { - // Save original instruction - mgmt_bp_ss[1].pAddr = (UINT32*)branch_addr; - mgmt_bp_ss[1].instr = *(mgmt_bp_ss[1].pAddr); - // Replace instruction with managment breakpoint - *(mgmt_bp_ss[1].pAddr) = BP_MGMT_SS(2); - ICACHE_invalidate_at(mgmt_bp_ss[1].pAddr); - } - } -} - + +void set_mgmt_break(uint32_t *pAddr_break) +{ + mgmt_bp_ss[0].pAddr = NULL; + mgmt_bp_ss[0].pAddr = 0; + + // Don't overwrite user breaks + if (IsBreak(*pAddr_break) && (BreakGetType(*pAddr_break) == BP_USER_BASE)) + { +// sputs("Instruction at address ");print_word((long)pAddr_break);sputs(" is user break\n"); + } + else + { + // Save original instruction + mgmt_bp_ss[0].pAddr = pAddr_break; + mgmt_bp_ss[0].instr = *(mgmt_bp_ss[0].pAddr); + // Replace instruction with managment breakpoint + *(mgmt_bp_ss[0].pAddr) = BP_MGMT_SS(1); + ICACHE_invalidate_at(mgmt_bp_ss[0].pAddr); + } +} + +void singlestep(struct xcptcontext * xcp, uint32_t *pAddr_curr, uint32_t is_branch_shadow) +{ + + int junk; + uint32_t branch_addr, reg, result, bp_type; + uint32_t *pInstr, *pAddr_prev, *pAddr_next; + + pAddr_prev = pAddr_curr - 1; + pAddr_next = pAddr_curr + 1; + + set_mgmt_break(pAddr_next); + + mgmt_bp_ss[1].pAddr = NULL; + mgmt_bp_ss[1].pAddr = 0; + + // We have two possible management breaks, if previous instruction was branch or jump + if (is_branch_shadow) + { + result = tdisasm(g_buf, (long)pAddr_prev, *pAddr_prev, 0, &junk, &branch_addr, ®); + // Is jump target stored in register + if (result == 3) + { + branch_addr = xcp->regs[reg&0x1F]; + } + + // Don't overwrite user breaks + if (IsBreak(branch_addr) && (BreakGetType(branch_addr) == BP_USER_BASE)) + { +// sputs("Instruction at branch address ");print_word((long)branch_addr);sputs(" is user break\n"); + } + else + { + // Save original instruction + mgmt_bp_ss[1].pAddr = (uint32_t*)branch_addr; + mgmt_bp_ss[1].instr = *(mgmt_bp_ss[1].pAddr); + // Replace instruction with managment breakpoint + *(mgmt_bp_ss[1].pAddr) = BP_MGMT_SS(2); + ICACHE_invalidate_at(mgmt_bp_ss[1].pAddr); + } + } +} + void dbg_handler(struct xcptcontext * xcp) { - UINT32 bp_addr, bp_index = 0, branch_addr, reg, result, bp_type; + uint32_t bp_addr, bp_index = 0, branch_addr, reg, result, bp_type; int junk, i, leave_isr, is_branch_shadow, is_user_bp; - UINT32 *pInstr, *pAddr_curr, *pAddr_prev, *pAddr_next; + uint32_t *pInstr, *pAddr_curr, *pAddr_prev, *pAddr_next; instr_info_t info; - + is_user_bp = 0; - pAddr_curr = (UINT32*)xcp->epc; + pAddr_curr = (uint32_t*)xcp->epc; is_branch_shadow = ((xcp->cr & 0x80000000) == 0x80000000); if (is_branch_shadow) pAddr_curr++; @@ -209,92 +209,92 @@ void dbg_handler(struct xcptcontext * xcp) } } - sputs("\n"); - PRINT_REG_CHG(" Status : ", xcp->sr, reg_changed(xcp->sr, xcp_last.sr)); - PRINT_REG_CHG(" Cause : ", xcp->cr, reg_changed(xcp->cr, xcp_last.cr)); - PRINT_REG_CHG(" EPC : ", xcp->epc, reg_changed(xcp->epc, xcp_last.epc)); - PRINT_REG_CHG("BadAddr : ", xcp->baddr, reg_changed(xcp->baddr, xcp_last.baddr)); - sputs("\n"); - PRINT_REG_CHG(" MDLO : ", xcp->mdlo, reg_changed(xcp->mdlo, xcp_last.mdlo)); - PRINT_REG_CHG(" MDHI : ", xcp->mdhi, reg_changed(xcp->mdhi, xcp_last.mdhi)); - - sputs("\n"); - - sputs("Registers:\n"); - PRINT_REG_CHG(" 0 (ze) : ", xcp->regs[0], reg_changed(xcp->regs[0], xcp_last.regs[0])); - PRINT_REG_CHG(" 1 (at) : ", xcp->regs[1], reg_changed(xcp->regs[1], xcp_last.regs[1])); - PRINT_REG_CHG(" 2 (v0) : ", xcp->regs[2], reg_changed(xcp->regs[2], xcp_last.regs[2])); - PRINT_REG_CHG(" 3 (v1) : ", xcp->regs[3], reg_changed(xcp->regs[3], xcp_last.regs[3])); - sputs("\n"); - PRINT_REG_CHG(" 4 (a0) : ", xcp->regs[4], reg_changed(xcp->regs[4], xcp_last.regs[4])); - PRINT_REG_CHG(" 5 (a1) : ", xcp->regs[5], reg_changed(xcp->regs[5], xcp_last.regs[5])); - PRINT_REG_CHG(" 6 (a2) : ", xcp->regs[6], reg_changed(xcp->regs[6], xcp_last.regs[6])); - PRINT_REG_CHG(" 7 (a3) : ", xcp->regs[7], reg_changed(xcp->regs[7], xcp_last.regs[7])); - sputs("\n"); - PRINT_REG_CHG(" 8 (t0) : ", xcp->regs[8], reg_changed(xcp->regs[8], xcp_last.regs[8])); - PRINT_REG_CHG(" 9 (t1) : ", xcp->regs[9], reg_changed(xcp->regs[9], xcp_last.regs[9])); - PRINT_REG_CHG("10 (t2) : ", xcp->regs[10], reg_changed(xcp->regs[10], xcp_last.regs[10])); - PRINT_REG_CHG("11 (t3) : ", xcp->regs[11], reg_changed(xcp->regs[11], xcp_last.regs[11])); - sputs("\n"); - PRINT_REG_CHG("12 (t4) : ", xcp->regs[12], reg_changed(xcp->regs[12], xcp_last.regs[12])); - PRINT_REG_CHG("13 (t5) : ", xcp->regs[13], reg_changed(xcp->regs[13], xcp_last.regs[13])); - PRINT_REG_CHG("14 (t6) : ", xcp->regs[14], reg_changed(xcp->regs[14], xcp_last.regs[14])); - PRINT_REG_CHG("15 (t7) : ", xcp->regs[15], reg_changed(xcp->regs[15], xcp_last.regs[15])); - sputs("\n"); - PRINT_REG_CHG("16 (s0) : ", xcp->regs[16], reg_changed(xcp->regs[16], xcp_last.regs[16])); - PRINT_REG_CHG("17 (s1) : ", xcp->regs[17], reg_changed(xcp->regs[17], xcp_last.regs[17])); - PRINT_REG_CHG("18 (s2) : ", xcp->regs[18], reg_changed(xcp->regs[18], xcp_last.regs[18])); - PRINT_REG_CHG("19 (s3) : ", xcp->regs[19], reg_changed(xcp->regs[19], xcp_last.regs[19])); - sputs("\n"); - PRINT_REG_CHG("20 (s4) : ", xcp->regs[20], reg_changed(xcp->regs[20], xcp_last.regs[20])); - PRINT_REG_CHG("21 (s5) : ", xcp->regs[21], reg_changed(xcp->regs[21], xcp_last.regs[21])); - PRINT_REG_CHG("22 (s6) : ", xcp->regs[22], reg_changed(xcp->regs[22], xcp_last.regs[22])); - PRINT_REG_CHG("23 (s7) : ", xcp->regs[23], reg_changed(xcp->regs[23], xcp_last.regs[23])); - sputs("\n"); - PRINT_REG_CHG("24 (s8) : ", xcp->regs[24], reg_changed(xcp->regs[24], xcp_last.regs[24])); - PRINT_REG_CHG("25 (s9) : ", xcp->regs[25], reg_changed(xcp->regs[25], xcp_last.regs[25])); - PRINT_REG_CHG("26 (k0) : ", xcp->regs[26], reg_changed(xcp->regs[26], xcp_last.regs[26])); - PRINT_REG_CHG("27 (k1) : ", xcp->regs[27], reg_changed(xcp->regs[27], xcp_last.regs[27])); - sputs("\n"); - PRINT_REG_CHG("28 (gp) : ", xcp->regs[28], reg_changed(xcp->regs[28], xcp_last.regs[28])); - PRINT_REG_CHG("29 (sp) : ", xcp->regs[29], reg_changed(xcp->regs[29], xcp_last.regs[29])); - PRINT_REG_CHG("30 (fp) : ", xcp->regs[30], reg_changed(xcp->regs[30], xcp_last.regs[30])); - PRINT_REG_CHG("31 (ra) : ", xcp->regs[31], reg_changed(xcp->regs[31], xcp_last.regs[31])); - sputs("\n"); - sputs("\n"); - -// sputs(g_state_names[g_state]);sputs("\n"); -// sputs("\n"); - + sputs("\n"); + PRINT_REG_CHG(" Status : ", xcp->sr, reg_changed(xcp->sr, xcp_last.sr)); + PRINT_REG_CHG(" Cause : ", xcp->cr, reg_changed(xcp->cr, xcp_last.cr)); + PRINT_REG_CHG(" EPC : ", xcp->epc, reg_changed(xcp->epc, xcp_last.epc)); + PRINT_REG_CHG("BadAddr : ", xcp->baddr, reg_changed(xcp->baddr, xcp_last.baddr)); + sputs("\n"); + PRINT_REG_CHG(" MDLO : ", xcp->mdlo, reg_changed(xcp->mdlo, xcp_last.mdlo)); + PRINT_REG_CHG(" MDHI : ", xcp->mdhi, reg_changed(xcp->mdhi, xcp_last.mdhi)); + + sputs("\n"); + + sputs("Registers:\n"); + PRINT_REG_CHG(" 0 (ze) : ", xcp->regs[0], reg_changed(xcp->regs[0], xcp_last.regs[0])); + PRINT_REG_CHG(" 1 (at) : ", xcp->regs[1], reg_changed(xcp->regs[1], xcp_last.regs[1])); + PRINT_REG_CHG(" 2 (v0) : ", xcp->regs[2], reg_changed(xcp->regs[2], xcp_last.regs[2])); + PRINT_REG_CHG(" 3 (v1) : ", xcp->regs[3], reg_changed(xcp->regs[3], xcp_last.regs[3])); + sputs("\n"); + PRINT_REG_CHG(" 4 (a0) : ", xcp->regs[4], reg_changed(xcp->regs[4], xcp_last.regs[4])); + PRINT_REG_CHG(" 5 (a1) : ", xcp->regs[5], reg_changed(xcp->regs[5], xcp_last.regs[5])); + PRINT_REG_CHG(" 6 (a2) : ", xcp->regs[6], reg_changed(xcp->regs[6], xcp_last.regs[6])); + PRINT_REG_CHG(" 7 (a3) : ", xcp->regs[7], reg_changed(xcp->regs[7], xcp_last.regs[7])); + sputs("\n"); + PRINT_REG_CHG(" 8 (t0) : ", xcp->regs[8], reg_changed(xcp->regs[8], xcp_last.regs[8])); + PRINT_REG_CHG(" 9 (t1) : ", xcp->regs[9], reg_changed(xcp->regs[9], xcp_last.regs[9])); + PRINT_REG_CHG("10 (t2) : ", xcp->regs[10], reg_changed(xcp->regs[10], xcp_last.regs[10])); + PRINT_REG_CHG("11 (t3) : ", xcp->regs[11], reg_changed(xcp->regs[11], xcp_last.regs[11])); + sputs("\n"); + PRINT_REG_CHG("12 (t4) : ", xcp->regs[12], reg_changed(xcp->regs[12], xcp_last.regs[12])); + PRINT_REG_CHG("13 (t5) : ", xcp->regs[13], reg_changed(xcp->regs[13], xcp_last.regs[13])); + PRINT_REG_CHG("14 (t6) : ", xcp->regs[14], reg_changed(xcp->regs[14], xcp_last.regs[14])); + PRINT_REG_CHG("15 (t7) : ", xcp->regs[15], reg_changed(xcp->regs[15], xcp_last.regs[15])); + sputs("\n"); + PRINT_REG_CHG("16 (s0) : ", xcp->regs[16], reg_changed(xcp->regs[16], xcp_last.regs[16])); + PRINT_REG_CHG("17 (s1) : ", xcp->regs[17], reg_changed(xcp->regs[17], xcp_last.regs[17])); + PRINT_REG_CHG("18 (s2) : ", xcp->regs[18], reg_changed(xcp->regs[18], xcp_last.regs[18])); + PRINT_REG_CHG("19 (s3) : ", xcp->regs[19], reg_changed(xcp->regs[19], xcp_last.regs[19])); + sputs("\n"); + PRINT_REG_CHG("20 (s4) : ", xcp->regs[20], reg_changed(xcp->regs[20], xcp_last.regs[20])); + PRINT_REG_CHG("21 (s5) : ", xcp->regs[21], reg_changed(xcp->regs[21], xcp_last.regs[21])); + PRINT_REG_CHG("22 (s6) : ", xcp->regs[22], reg_changed(xcp->regs[22], xcp_last.regs[22])); + PRINT_REG_CHG("23 (s7) : ", xcp->regs[23], reg_changed(xcp->regs[23], xcp_last.regs[23])); + sputs("\n"); + PRINT_REG_CHG("24 (s8) : ", xcp->regs[24], reg_changed(xcp->regs[24], xcp_last.regs[24])); + PRINT_REG_CHG("25 (s9) : ", xcp->regs[25], reg_changed(xcp->regs[25], xcp_last.regs[25])); + PRINT_REG_CHG("26 (k0) : ", xcp->regs[26], reg_changed(xcp->regs[26], xcp_last.regs[26])); + PRINT_REG_CHG("27 (k1) : ", xcp->regs[27], reg_changed(xcp->regs[27], xcp_last.regs[27])); + sputs("\n"); + PRINT_REG_CHG("28 (gp) : ", xcp->regs[28], reg_changed(xcp->regs[28], xcp_last.regs[28])); + PRINT_REG_CHG("29 (sp) : ", xcp->regs[29], reg_changed(xcp->regs[29], xcp_last.regs[29])); + PRINT_REG_CHG("30 (fp) : ", xcp->regs[30], reg_changed(xcp->regs[30], xcp_last.regs[30])); + PRINT_REG_CHG("31 (ra) : ", xcp->regs[31], reg_changed(xcp->regs[31], xcp_last.regs[31])); + sputs("\n"); + sputs("\n"); + +// sputs(g_state_names[g_state]);sputs("\n"); +// sputs("\n"); + pInstr = pAddr_prev; // Disassemble instructions for (i=0; i < 3; i++) { print_word((long)pInstr); - if (pInstr != pAddr_curr) - { + if (pInstr != pAddr_curr) + { if (IsBreak(*pInstr) && (BreakGetType(*pInstr) == BP_USER_BASE)) { tdisasm(g_buf, (long)user_bp[BP_GET_ID(*pInstr)].pAddr, user_bp[BP_GET_ID(*pInstr)].instr, 0, &junk, &junk, &junk); sputs(": b("); print_byte((char)BP_GET_ID(*pInstr)); sputs(") "); - } - else - { - tdisasm(g_buf, (long)pInstr, *pInstr, 0, &junk, &junk, &junk); - sputs(": "); - } + } + else + { + tdisasm(g_buf, (long)pInstr, *pInstr, 0, &junk, &junk, &junk); + sputs(": "); + } } else { tdisasm(g_buf, (long)pInstr, *pInstr, 0, &junk, &junk, &junk); if (is_user_bp) - { - sputs(": b("); print_byte((char)bp_index); sputs(")-> "); - } + { + sputs(": b("); print_byte((char)bp_index); sputs(")-> "); + } else - { - sputs(": -> "); - } + { + sputs(": -> "); + } } sputs(g_buf); sputs("\n"); @@ -323,7 +323,7 @@ void dbg_handler(struct xcptcontext * xcp) branch_addr = xcp->regs[reg&0x1F]; } // Save original instruction - mgmt_bp_ru[1].pAddr = (UINT32*)branch_addr; + mgmt_bp_ru[1].pAddr = (uint32_t*)branch_addr; mgmt_bp_ru[1].instr = *(mgmt_bp_ru[1].pAddr); // Replace instruction with managment breakpoint *(mgmt_bp_ru[1].pAddr) = BP_MGMT_RU(bp_index); @@ -354,8 +354,8 @@ void dbg_handler(struct xcptcontext * xcp) printf("Enter breakpoint: "); scanf("%x", &bp_addr); printf("Insert breakpoint at %.8X\n", bp_addr); - - user_bp[g_bp_count].pAddr = (UINT32*)bp_addr; + + user_bp[g_bp_count].pAddr = (uint32_t*)bp_addr; user_bp[g_bp_count].instr = *(user_bp[g_bp_count].pAddr); *(user_bp[g_bp_count].pAddr) = BP_USER(g_bp_count); @@ -384,82 +384,82 @@ void dbg_handler(struct xcptcontext * xcp) xcp->epc += 4; // Skip ordinary program breaks } } - - singlestep(xcp, pAddr_curr, is_branch_shadow); + + singlestep(xcp, pAddr_curr, is_branch_shadow); + break; + + case 'e': + g_state = STATE_STEP_SINGLE; + g_is_ss = 1; + leave_isr = 1; + + if (is_user_bp) + break; + + if (IsBreak(*pAddr_curr)) + { + if (BreakGetType(*pAddr_curr) == BP_USER_BASE) + { + break; + } + else + { + xcp->epc += 4; // Skip ordinary program breaks + } + } + + pInstr = pAddr_curr; + + do + { + result = instr_info(*pInstr, &info); + if (result == INSTR_TYPE_JUMP) + { + if (info.rs == 0x1F) + break; + } + else if (result == INSTR_TYPE_LOAD) + { + if (info.rs == 0x1F) + break; + } + pInstr++; + } while(1); + +// sputs("Return found at "); print_word((long)pInstr);sputs("\n"); + set_mgmt_break(pInstr); break; - case 'e': - g_state = STATE_STEP_SINGLE; - g_is_ss = 1; - leave_isr = 1; - - if (is_user_bp) - break; - - if (IsBreak(*pAddr_curr)) - { - if (BreakGetType(*pAddr_curr) == BP_USER_BASE) - { - break; - } - else - { - xcp->epc += 4; // Skip ordinary program breaks - } - } - - pInstr = pAddr_curr; - - do - { - result = instr_info(*pInstr, &info); - if (result == INSTR_TYPE_JUMP) - { - if (info.rs == 0x1F) - break; - } - else if (result == INSTR_TYPE_LOAD) - { - if (info.rs == 0x1F) - break; - } - pInstr++; - } while(1); - -// sputs("Return found at "); print_word((long)pInstr);sputs("\n"); - set_mgmt_break(pInstr); - break; - case 'p': g_state = STATE_STEP_PROC; g_is_ss = 1; leave_isr = 1; - - if (is_user_bp) - break; - - if (IsBreak(*pAddr_curr)) - { - if (BreakGetType(*pAddr_curr) == BP_USER_BASE) - { - break; - } - else - { - xcp->epc += 4; // Skip ordinary program breaks - } - } - - result = instr_info(*pAddr_curr, &info); - if ((result == INSTR_TYPE_JUMP) && (info.flags & INSTR_FLAGS_JUMP_LINK)) - { - singlestep(xcp, pAddr_next, 0); -// sputs("Skip sub-routine\n"); - } - else - { - singlestep(xcp, pAddr_curr, is_branch_shadow); - } + + if (is_user_bp) + break; + + if (IsBreak(*pAddr_curr)) + { + if (BreakGetType(*pAddr_curr) == BP_USER_BASE) + { + break; + } + else + { + xcp->epc += 4; // Skip ordinary program breaks + } + } + + result = instr_info(*pAddr_curr, &info); + if ((result == INSTR_TYPE_JUMP) && (info.flags & INSTR_FLAGS_JUMP_LINK)) + { + singlestep(xcp, pAddr_next, 0); +// sputs("Skip sub-routine\n"); + } + else + { + singlestep(xcp, pAddr_curr, is_branch_shadow); + } break; default: @@ -467,7 +467,7 @@ void dbg_handler(struct xcptcontext * xcp) } } while (!leave_isr); - memcpy(&xcp_last, xcp, sizeof(EXCEPTION_CONTEXT)); + memcpy(&xcp_last, xcp, sizeof(EXCEPTION_CONTEXT)); } void debug_int(struct xcptcontext * xcp) diff --git a/src/libsys/mips_gfx.c b/src/libsys/mips_gfx.c index 3cf2740..f0b9cc6 100644 --- a/src/libsys/mips_gfx.c +++ b/src/libsys/mips_gfx.c @@ -12,7 +12,7 @@ static vga_hw_t *g_pRegs; // ------------------------------------------------------------- // Functions // ------------------------------------------------------------- -void __gfx_block_set_8(UINT32* pDst, UINT32 value) +void __gfx_block_set_8(uint32_t* pDst, uint32_t value) { __asm__ volatile ( @@ -29,7 +29,7 @@ void __gfx_block_set_8(UINT32* pDst, UINT32 value) ); } -void __gfx_block_copy_8(UINT32* pDst, UINT32* pSrc) +void __gfx_block_copy_8(uint32_t* pDst, uint32_t* pSrc) { __asm__ volatile ( @@ -59,7 +59,7 @@ void __gfx_block_copy_8(UINT32* pDst, UINT32* pSrc) ); } -void _GFX_copy32(UINT32* pDst, UINT32* pSrc, UINT32 ndwords) +void _GFX_copy32(uint32_t* pDst, uint32_t* pSrc, uint32_t ndwords) { while (ndwords > 3) { @@ -75,7 +75,7 @@ void _GFX_copy32(UINT32* pDst, UINT32* pSrc, UINT32 ndwords) } } -void _GFX_memset32(UINT32* pDst, UINT32 value, UINT32 ndwords) +void _GFX_memset32(uint32_t* pDst, uint32_t value, uint32_t ndwords) { while (ndwords > 3) { @@ -90,10 +90,10 @@ void _GFX_memset32(UINT32* pDst, UINT32 value, UINT32 ndwords) } } -void _GFX_copy32_hw(UINT32* pDst, UINT32* pSrc, UINT32 ndwords, UINT32 wait_finish) +void _GFX_copy32_hw(uint32_t* pDst, uint32_t* pSrc, uint32_t ndwords, uint32_t wait_finish) { - g_pRegs->pVGA_src0 = (UINT32)pSrc; - g_pRegs->pVGA_dst = (UINT32)pDst; + g_pRegs->pVGA_src0 = (uint32_t)pSrc; + g_pRegs->pVGA_dst = (uint32_t)pDst; g_pRegs->pVGA_src0_dimx = 0; g_pRegs->pVGA_dst_dimx = 0; g_pRegs->pVGA_nx = ndwords; @@ -111,9 +111,9 @@ void _GFX_copy32_hw(UINT32* pDst, UINT32* pSrc, UINT32 ndwords, UINT32 wait_fini } -void _GFX_memset32_hw(UINT32* pDst, UINT32 value, UINT32 ndwords, UINT32 wait_finish) +void _GFX_memset32_hw(uint32_t* pDst, uint32_t value, uint32_t ndwords, uint32_t wait_finish) { - g_pRegs->pVGA_dst = (UINT32)pDst; + g_pRegs->pVGA_dst = (uint32_t)pDst; g_pRegs->pVGA_src0_dimx = 0; g_pRegs->pVGA_dst_dimx = 0; g_pRegs->pVGA_nx = ndwords; @@ -131,10 +131,10 @@ void _GFX_memset32_hw(UINT32* pDst, UINT32 value, UINT32 ndwords, UINT32 wait_fi } -void _GFX_BLIT_const(UINT32* pDst, UINT32 xdim_dst, UINT32 xmin, UINT32 ymin, UINT32 xmax, UINT32 ymax, UINT32 value) +void _GFX_BLIT_const(uint32_t* pDst, uint32_t xdim_dst, uint32_t xmin, uint32_t ymin, uint32_t xmax, uint32_t ymax, uint32_t value) { - UINT32 xmax8, x, y; - UINT32 *pStart, *pEnd; + uint32_t xmax8, x, y; + uint32_t *pStart, *pEnd; xmax8 = xmax - ((xmax-xmin)%8); for (y=ymin; y < ymax; y += xdim_dst) @@ -154,13 +154,13 @@ void _GFX_BLIT_const(UINT32* pDst, UINT32 xdim_dst, UINT32 xmin, UINT32 ymin, UI } } -void _GFX_BLIT_const_hw(UINT32* pDst, UINT32 xdim_dst, UINT32 xmin, UINT32 ymin, UINT32 xmax, UINT32 ymax, UINT32 value, UINT32 wait_finish) +void _GFX_BLIT_const_hw(uint32_t* pDst, uint32_t xdim_dst, uint32_t xmin, uint32_t ymin, uint32_t xmax, uint32_t ymax, uint32_t value, uint32_t wait_finish) { - UINT32 *pStart, *pEnd; + uint32_t *pStart, *pEnd; - pStart = (UINT32*)&pDst[xmin + ymin*xdim_dst]; + pStart = (uint32_t*)&pDst[xmin + ymin*xdim_dst]; - g_pRegs->pVGA_dst = (UINT32)pStart; + g_pRegs->pVGA_dst = (uint32_t)pStart; g_pRegs->pVGA_dst_dimx = xdim_dst; g_pRegs->pVGA_nx = xmax - xmin + 1; g_pRegs->pVGA_ny = ymax - ymin + 1; @@ -185,14 +185,14 @@ void GFX_DirtyRectSetClean(gfx_t *pObj, buf_t *pBuf) pBuf->is_dirty = 0; } -void GFX_DirtyRectInit(gfx_t *pObj, buf_t *pBuf, UINT32 w, UINT32 h) +void GFX_DirtyRectInit(gfx_t *pObj, buf_t *pBuf, uint32_t w, uint32_t h) { pBuf->w = w; pBuf->h = h; GFX_DirtyRectSetClean(pObj, pBuf); } -void GFX_DirtyRectUpdate(gfx_t *pObj, buf_t *pBuf, UINT32 xmin, UINT32 xmax, UINT32 ymin, UINT32 ymax) +void GFX_DirtyRectUpdate(gfx_t *pObj, buf_t *pBuf, uint32_t xmin, uint32_t xmax, uint32_t ymin, uint32_t ymax) { if (xmin < pBuf->dirty.xmin) @@ -231,9 +231,9 @@ void GFX_DirtyRectUpdate(gfx_t *pObj, buf_t *pBuf, UINT32 xmin, UINT32 xmax, UIN void GFX_DirtyRectCopy(gfx_t *pObj, buf_t *pBuf) { - UINT32 xmin, xmax, xmax8, ymin, ymax, x, y; - UINT32 *pDst, *pDst_end; - UINT32 *pSrc, *pSrc_end; + uint32_t xmin, xmax, xmax8, ymin, ymax, x, y; + uint32_t *pDst, *pDst_end; + uint32_t *pSrc, *pSrc_end; xmin = pBuf->dirty.xmin; xmax = pBuf->dirty.xmax; @@ -245,15 +245,15 @@ void GFX_DirtyRectCopy(gfx_t *pObj, buf_t *pBuf) ymax *= pBuf->w; #ifdef USE_HW_BLITTER - pSrc = (UINT32*)&pBuf->pLast->pFB[xmin + ymin]; - pDst = (UINT32*)&pBuf->pFB[xmin + ymin]; + pSrc = (uint32_t*)&pBuf->pLast->pFB[xmin + ymin]; + pDst = (uint32_t*)&pBuf->pFB[xmin + ymin]; - g_pRegs->pVGA_src0 = (UINT32)pSrc; - g_pRegs->pVGA_dst = (UINT32)pDst; - g_pRegs->pVGA_src0_dimx = (UINT32)pBuf->w; - g_pRegs->pVGA_dst_dimx = (UINT32)pBuf->w; - g_pRegs->pVGA_nx = (UINT32)(pBuf->dirty.xmax-pBuf->dirty.xmin); - g_pRegs->pVGA_ny = (UINT32)(pBuf->dirty.ymax-pBuf->dirty.ymin); + g_pRegs->pVGA_src0 = (uint32_t)pSrc; + g_pRegs->pVGA_dst = (uint32_t)pDst; + g_pRegs->pVGA_src0_dimx = (uint32_t)pBuf->w; + g_pRegs->pVGA_dst_dimx = (uint32_t)pBuf->w; + g_pRegs->pVGA_nx = (uint32_t)(pBuf->dirty.xmax-pBuf->dirty.xmin); + g_pRegs->pVGA_ny = (uint32_t)(pBuf->dirty.ymax-pBuf->dirty.ymin); g_pRegs->pVGA_ctrl &= ~SYS_VGA_BIT_BLIT_OP_CONSTCOL; while (g_pRegs->pVGA_ctrl & SYS_VGA_BIT_BLIT_BSY); @@ -289,7 +289,7 @@ void GFX_init(gfx_t *pObj) { int i; buf_t *pBuf; - UINT32 w, h, fps; + uint32_t w, h, fps; g_pRegs = (vga_hw_t*)SYS_VGA_CTRL; @@ -305,19 +305,19 @@ void GFX_init(gfx_t *pObj) pObj->h = h; // Init background buffer - pObj->pBG = (UINT32*)calloc(w * h, sizeof(buf_t)); + pObj->pBG = (uint32_t*)calloc(w * h, sizeof(buf_t)); // Init framebuffers pObj->pBuf = (buf_t*)calloc(1, sizeof(buf_t)); pBuf = pObj->pBuf; - pBuf->pFB = (UINT32*)calloc((w+8) * h, sizeof(UINT32)); // w+8 because of dirty rectangle 8 byte min. x-size + pBuf->pFB = (uint32_t*)calloc((w+8) * h, sizeof(uint32_t)); // w+8 because of dirty rectangle 8 byte min. x-size for (i=1; i < GFX_NUM_FRAME_BUFFERS; i++) { pBuf->pNext = (buf_t*)calloc(1, sizeof(buf_t)); pBuf->pNext->pLast = pBuf; pBuf = pBuf->pNext; - pBuf->pFB = (UINT32*)calloc((w+8) * h, sizeof(UINT32)); // w+8 because of dirty rectangle 8 byte min. x-size + pBuf->pFB = (uint32_t*)calloc((w+8) * h, sizeof(uint32_t)); // w+8 because of dirty rectangle 8 byte min. x-size } pObj->pBuf->pLast = pBuf; pBuf->pNext = pObj->pBuf; @@ -331,19 +331,19 @@ void GFX_init(gfx_t *pObj) pBuf = pBuf->pNext; } - g_pRegs->pVGA_front = (UINT32)pObj->pBuf->pLast->pFB; - g_pRegs->pVGA_back = (UINT32)pObj->pBuf->pLast->pFB; + g_pRegs->pVGA_front = (uint32_t)pObj->pBuf->pLast->pFB; + g_pRegs->pVGA_back = (uint32_t)pObj->pBuf->pLast->pFB; g_pRegs->pVGA_ctrl |= SYS_VGA_BIT_MSTEN; } -void GFX_set_background(gfx_t *pObj, UINT32 *pImage, UINT32 image_nx, UINT32 image_ny, UINT32 image_scale_x, UINT32 image_scale_y) +void GFX_set_background(gfx_t *pObj, uint32_t *pImage, uint32_t image_nx, uint32_t image_ny, uint32_t image_scale_x, uint32_t image_scale_y) { - UINT32 off_x, off_y; - UINT32 i, j; - UINT32 *pDst, *pSrc; + uint32_t off_x, off_y; + uint32_t i, j; + uint32_t *pDst, *pSrc; buf_t *pBuf; if (!pImage) @@ -354,15 +354,15 @@ void GFX_set_background(gfx_t *pObj, UINT32 *pImage, UINT32 image_nx, UINT32 ima #ifdef USE_HW_BLITTER - pDst = ((UINT32*)pObj->pBG) + pObj->w*off_y + off_x; + pDst = ((uint32_t*)pObj->pBG) + pObj->w*off_y + off_x; pSrc = pImage; - g_pRegs->pVGA_src0 = (UINT32)pSrc; - g_pRegs->pVGA_dst = (UINT32)pDst; - g_pRegs->pVGA_src0_dimx = (UINT32)0; - g_pRegs->pVGA_dst_dimx = (UINT32)0; - g_pRegs->pVGA_nx = (UINT32)image_ny*image_nx; - g_pRegs->pVGA_ny = (UINT32)1; + g_pRegs->pVGA_src0 = (uint32_t)pSrc; + g_pRegs->pVGA_dst = (uint32_t)pDst; + g_pRegs->pVGA_src0_dimx = (uint32_t)0; + g_pRegs->pVGA_dst_dimx = (uint32_t)0; + g_pRegs->pVGA_nx = (uint32_t)image_ny*image_nx; + g_pRegs->pVGA_ny = (uint32_t)1; g_pRegs->pVGA_ctrl &= ~SYS_VGA_BIT_BLIT_OP_CONSTCOL; while (g_pRegs->pVGA_ctrl & SYS_VGA_BIT_BLIT_BSY); @@ -374,12 +374,12 @@ void GFX_set_background(gfx_t *pObj, UINT32 *pImage, UINT32 image_nx, UINT32 ima pDst = pBuf->pFB; pSrc = pObj->pBG; - g_pRegs->pVGA_src0 = (UINT32)pSrc; - g_pRegs->pVGA_dst = (UINT32)pDst; - g_pRegs->pVGA_src0_dimx = (UINT32)0; - g_pRegs->pVGA_dst_dimx = (UINT32)0; - g_pRegs->pVGA_nx = (UINT32)image_ny*image_nx; - g_pRegs->pVGA_ny = (UINT32)1; + g_pRegs->pVGA_src0 = (uint32_t)pSrc; + g_pRegs->pVGA_dst = (uint32_t)pDst; + g_pRegs->pVGA_src0_dimx = (uint32_t)0; + g_pRegs->pVGA_dst_dimx = (uint32_t)0; + g_pRegs->pVGA_nx = (uint32_t)image_ny*image_nx; + g_pRegs->pVGA_ny = (uint32_t)1; g_pRegs->pVGA_ctrl &= ~SYS_VGA_BIT_BLIT_OP_CONSTCOL; while (g_pRegs->pVGA_ctrl & SYS_VGA_BIT_BLIT_BSY); @@ -390,7 +390,7 @@ void GFX_set_background(gfx_t *pObj, UINT32 *pImage, UINT32 image_nx, UINT32 ima #else - pDst = ((UINT32*)pObj->pBG) + pObj->w*off_y + off_x; + pDst = ((uint32_t*)pObj->pBG) + pObj->w*off_y + off_x; pSrc = pImage; for (i=0; i < image_ny*image_nx; i += 8) @@ -423,13 +423,13 @@ void GFX_set_background(gfx_t *pObj, UINT32 *pImage, UINT32 image_nx, UINT32 ima } -void GFX_frame(gfx_t *pObj, UINT32 sync_mode) +void GFX_frame(gfx_t *pObj, uint32_t sync_mode) { // Wait until back buffer becomes front if (sync_mode == GFX_FRAME_SYNC) { - while(g_pRegs->pVGA_front == (UINT32)pObj->pBuf->pFB); + while(g_pRegs->pVGA_front == (uint32_t)pObj->pBuf->pFB); } GFX_copy_front2back(pObj); @@ -445,7 +445,7 @@ void GFX_frame(gfx_t *pObj, UINT32 sync_mode) void GFX_show(gfx_t *pObj) { - g_pRegs->pVGA_back = (UINT32)pObj->pBuf->pFB; + g_pRegs->pVGA_back = (uint32_t)pObj->pBuf->pFB; pObj->pBuf = pObj->pBuf->pNext; } @@ -469,22 +469,22 @@ void GFX_copy_front2back(gfx_t *pObj) } } -void GFX_get_FB_front(gfx_t *pObj, UINT32 **ppFB) +void GFX_get_FB_front(gfx_t *pObj, uint32_t **ppFB) { *ppFB = pObj->pBuf->pLast->pFB; } -void box_create(box_t *pObj, UINT32 w, UINT32 h) +void box_create(box_t *pObj, uint32_t w, uint32_t h) { pObj->w = w; pObj->h = h; } -void GFX_restore(gfx_t *pObj, box_t *pBox, UINT32 posx, UINT32 posy) +void GFX_restore(gfx_t *pObj, box_t *pBox, uint32_t posx, uint32_t posy) { - UINT32 xmin, xmax, xmax8, ymin, ymax, x, y, nx, ny; - UINT32 *pDst, *pDst_end; - UINT32 *pSrc, *pSrc_end; + uint32_t xmin, xmax, xmax8, ymin, ymax, x, y, nx, ny; + uint32_t *pDst, *pDst_end; + uint32_t *pSrc, *pSrc_end; buf_t *pBuf; if (pBox) @@ -529,15 +529,15 @@ void GFX_restore(gfx_t *pObj, box_t *pBox, UINT32 posx, UINT32 posy) ymax *= pObj->w; #ifdef USE_HW_BLITTER - pSrc = (UINT32*)&pObj->pBG[xmin + ymin]; - pDst = (UINT32*)&pBuf->pFB[xmin + ymin]; + pSrc = (uint32_t*)&pObj->pBG[xmin + ymin]; + pDst = (uint32_t*)&pBuf->pFB[xmin + ymin]; - g_pRegs->pVGA_src0 = (UINT32)pSrc; - g_pRegs->pVGA_dst = (UINT32)pDst; - g_pRegs->pVGA_src0_dimx = (UINT32)pObj->w; - g_pRegs->pVGA_dst_dimx = (UINT32)pObj->w; - g_pRegs->pVGA_nx = (UINT32)nx; - g_pRegs->pVGA_ny = (UINT32)ny; + g_pRegs->pVGA_src0 = (uint32_t)pSrc; + g_pRegs->pVGA_dst = (uint32_t)pDst; + g_pRegs->pVGA_src0_dimx = (uint32_t)pObj->w; + g_pRegs->pVGA_dst_dimx = (uint32_t)pObj->w; + g_pRegs->pVGA_nx = (uint32_t)nx; + g_pRegs->pVGA_ny = (uint32_t)ny; g_pRegs->pVGA_ctrl &= ~SYS_VGA_BIT_BLIT_OP_CONSTCOL; while (g_pRegs->pVGA_ctrl & SYS_VGA_BIT_BLIT_BSY); @@ -569,10 +569,10 @@ void GFX_restore(gfx_t *pObj, box_t *pBox, UINT32 posx, UINT32 posy) } -void GFX_box_draw_direct(gfx_t *pObj, box_t *pBox, UINT32 posx, UINT32 posy, UINT32 color) +void GFX_box_draw_direct(gfx_t *pObj, box_t *pBox, uint32_t posx, uint32_t posy, uint32_t color) { - UINT32 xmin, xmax, xmax8, ymin, ymax, x, y; - UINT32 *pFB, *pFB_end; + uint32_t xmin, xmax, xmax8, ymin, ymax, x, y; + uint32_t *pFB, *pFB_end; buf_t *pBuf; pBuf = pObj->pBuf->pLast; @@ -609,10 +609,10 @@ void GFX_box_draw_direct(gfx_t *pObj, box_t *pBox, UINT32 posx, UINT32 posy, UIN } -void GFX_box_draw(gfx_t *pObj, box_t *pBox, UINT32 posx, UINT32 posy, UINT32 color) +void GFX_box_draw(gfx_t *pObj, box_t *pBox, uint32_t posx, uint32_t posy, uint32_t color) { - UINT32 xmin, xmax, xmax8, ymin, ymax, x, y, nx, ny; - UINT32 *pFB, *pFB_end; + uint32_t xmin, xmax, xmax8, ymin, ymax, x, y, nx, ny; + uint32_t *pFB, *pFB_end; buf_t *pBuf; xmin = posx; @@ -646,12 +646,12 @@ void GFX_box_draw(gfx_t *pObj, box_t *pBox, UINT32 posx, UINT32 posy, UINT32 col #ifdef USE_HW_BLITTER - pFB = (UINT32*)&pBuf->pFB[xmin + ymin]; + pFB = (uint32_t*)&pBuf->pFB[xmin + ymin]; - g_pRegs->pVGA_dst = (UINT32)pFB; - g_pRegs->pVGA_dst_dimx = (UINT32)pObj->w; - g_pRegs->pVGA_nx = (UINT32)nx; - g_pRegs->pVGA_ny = (UINT32)ny; + g_pRegs->pVGA_dst = (uint32_t)pFB; + g_pRegs->pVGA_dst_dimx = (uint32_t)pObj->w; + g_pRegs->pVGA_nx = (uint32_t)nx; + g_pRegs->pVGA_ny = (uint32_t)ny; g_pRegs->pVGA_color = color; while (g_pRegs->pVGA_ctrl & SYS_VGA_BIT_BLIT_BSY); @@ -681,10 +681,10 @@ void GFX_box_draw(gfx_t *pObj, box_t *pBox, UINT32 posx, UINT32 posy, UINT32 col #endif } -void GFX_box_draw_bg(gfx_t *pObj, box_t *pBox, UINT32 posx, UINT32 posy, UINT32 color) +void GFX_box_draw_bg(gfx_t *pObj, box_t *pBox, uint32_t posx, uint32_t posy, uint32_t color) { - UINT32 xmin, xmax, xmax8, ymin, ymax, x, y, nx, ny; - UINT32 *pFB, *pFB_end; + uint32_t xmin, xmax, xmax8, ymin, ymax, x, y, nx, ny; + uint32_t *pFB, *pFB_end; xmin = posx; xmax = pBox->w + posx - 0; @@ -705,12 +705,12 @@ void GFX_box_draw_bg(gfx_t *pObj, box_t *pBox, UINT32 posx, UINT32 posy, UINT32 #ifdef USE_HW_BLITTER - pFB = (UINT32*)&pObj->pBG[xmin + ymin]; + pFB = (uint32_t*)&pObj->pBG[xmin + ymin]; - g_pRegs->pVGA_dst = (UINT32)pFB; - g_pRegs->pVGA_dst_dimx = (UINT32)pObj->w; - g_pRegs->pVGA_nx = (UINT32)nx; - g_pRegs->pVGA_ny = (UINT32)ny; + g_pRegs->pVGA_dst = (uint32_t)pFB; + g_pRegs->pVGA_dst_dimx = (uint32_t)pObj->w; + g_pRegs->pVGA_nx = (uint32_t)nx; + g_pRegs->pVGA_ny = (uint32_t)ny; g_pRegs->pVGA_color = color; while (g_pRegs->pVGA_ctrl & SYS_VGA_BIT_BLIT_BSY); @@ -739,15 +739,15 @@ void GFX_box_draw_bg(gfx_t *pObj, box_t *pBox, UINT32 posx, UINT32 posy, UINT32 } -void GFX_box_blit_bg(gfx_t *pObj, box_t *pBox, UINT32 pos_x_src, UINT32 pos_y_src, UINT32 pos_x_dst, UINT32 pos_y_dst) +void GFX_box_blit_bg(gfx_t *pObj, box_t *pBox, uint32_t pos_x_src, uint32_t pos_y_src, uint32_t pos_x_dst, uint32_t pos_y_dst) { - UINT32 x_src, y_src, xmax8_src; - UINT32 x_dst, y_dst, xmax8_dst; - UINT32 xmin_src, xmax_src, ymin_src, ymax_src; - UINT32 xmin_dst, xmax_dst, ymin_dst, ymax_dst; - UINT32 *pDst, *pDst_end; - UINT32 *pSrc, *pSrc_end; + uint32_t x_src, y_src, xmax8_src; + uint32_t x_dst, y_dst, xmax8_dst; + uint32_t xmin_src, xmax_src, ymin_src, ymax_src; + uint32_t xmin_dst, xmax_dst, ymin_dst, ymax_dst; + uint32_t *pDst, *pDst_end; + uint32_t *pSrc, *pSrc_end; buf_t *pBuf; pBuf = pObj->pBuf->pNext; @@ -781,12 +781,12 @@ void GFX_box_blit_bg(gfx_t *pObj, box_t *pBox, UINT32 pos_x_src, UINT32 pos_y_sr pBuf = pObj->pBuf; #ifdef USE_HW_BLITTER - pSrc = (UINT32*)&pObj->pBG[xmin_src + ymin_src*pObj->w]; - pDst = (UINT32*)&pBuf->pFB[xmin_dst + ymin_dst*pObj->w]; + pSrc = (uint32_t*)&pObj->pBG[xmin_src + ymin_src*pObj->w]; + pDst = (uint32_t*)&pBuf->pFB[xmin_dst + ymin_dst*pObj->w]; - g_pRegs->pVGA_src0 = (UINT32)pSrc; + g_pRegs->pVGA_src0 = (uint32_t)pSrc; g_pRegs->pVGA_src0_dimx = pObj->w; - g_pRegs->pVGA_dst = (UINT32)pDst; + g_pRegs->pVGA_dst = (uint32_t)pDst; g_pRegs->pVGA_dst_dimx = pObj->w; g_pRegs->pVGA_nx = pBox->w; g_pRegs->pVGA_ny = pBox->h; diff --git a/src/libsys/mips_gfx.h b/src/libsys/mips_gfx.h index 2b0d6b7..ec19ea4 100644 --- a/src/libsys/mips_gfx.h +++ b/src/libsys/mips_gfx.h @@ -12,58 +12,58 @@ // ------------------------------------------------------------- typedef struct _sbox_t { - UINT32 w, h; + uint32_t w, h; } box_t; typedef struct _srect_t { - UINT32 xmin, xmax; - UINT32 ymin, ymax; + uint32_t xmin, xmax; + uint32_t ymin, ymax; } rect_t; typedef struct _svga_hw_t { - UINT32 volatile pVGA_ctrl; // 0xA0030000 // R/W - UINT32 volatile pVGA_ascii; // 0xA0030004 // R/W - UINT32 volatile pVGA_posx; // 0xA0030008 // R/W - UINT32 volatile pVGA_posy; // 0xA003000C // R/W - UINT32 volatile pVGA_cgcol; // 0xA0030010 // R/W - UINT32 volatile pVGA_res; // 0xA0030014 // RO - UINT32 volatile pVGA_front; // 0xA0030018 // R/W - UINT32 volatile pVGA_back; // 0xA003001C // R/W - UINT32 volatile pVGA_src0; // 0xA0030020 // R/W - UINT32 volatile pVGA_src0_dimx; // 0xA0030024 // R/W - UINT32 volatile pVGA_gap0; // 0xA0030028 // R/W - UINT32 volatile pVGA_gap1; // 0xA003002C // R/W - UINT32 volatile pVGA_src1; // 0xA0030030 // R/W - UINT32 volatile pVGA_src1_dimx; // 0xA0030034 // R/W - UINT32 volatile pVGA_gap2; // 0xA0030038 // R/W - UINT32 volatile pVGA_gap3; // 0xA003003C // R/W - UINT32 volatile pVGA_dst; // 0xA0030040 // R/W - UINT32 volatile pVGA_dst_dimx; // 0xA0030044 // R/W - UINT32 volatile pVGA_gap4; // 0xA0030048 // R/W - UINT32 volatile pVGA_gap5; // 0xA003004C // R/W - UINT32 volatile pVGA_nx; // 0xA0030050 // R/W - UINT32 volatile pVGA_ny; // 0xA0030054 // R/W - UINT32 volatile pVGA_color; // 0xA0030058 // R/W + uint32_t volatile pVGA_ctrl; // 0xA0030000 // R/W + uint32_t volatile pVGA_ascii; // 0xA0030004 // R/W + uint32_t volatile pVGA_posx; // 0xA0030008 // R/W + uint32_t volatile pVGA_posy; // 0xA003000C // R/W + uint32_t volatile pVGA_cgcol; // 0xA0030010 // R/W + uint32_t volatile pVGA_res; // 0xA0030014 // RO + uint32_t volatile pVGA_front; // 0xA0030018 // R/W + uint32_t volatile pVGA_back; // 0xA003001C // R/W + uint32_t volatile pVGA_src0; // 0xA0030020 // R/W + uint32_t volatile pVGA_src0_dimx; // 0xA0030024 // R/W + uint32_t volatile pVGA_gap0; // 0xA0030028 // R/W + uint32_t volatile pVGA_gap1; // 0xA003002C // R/W + uint32_t volatile pVGA_src1; // 0xA0030030 // R/W + uint32_t volatile pVGA_src1_dimx; // 0xA0030034 // R/W + uint32_t volatile pVGA_gap2; // 0xA0030038 // R/W + uint32_t volatile pVGA_gap3; // 0xA003003C // R/W + uint32_t volatile pVGA_dst; // 0xA0030040 // R/W + uint32_t volatile pVGA_dst_dimx; // 0xA0030044 // R/W + uint32_t volatile pVGA_gap4; // 0xA0030048 // R/W + uint32_t volatile pVGA_gap5; // 0xA003004C // R/W + uint32_t volatile pVGA_nx; // 0xA0030050 // R/W + uint32_t volatile pVGA_ny; // 0xA0030054 // R/W + uint32_t volatile pVGA_color; // 0xA0030058 // R/W } vga_hw_t; typedef struct _sbuf_t { - UINT32 *pFB; + uint32_t *pFB; struct _sbuf_t *pNext; struct _sbuf_t *pLast; - UINT32 is_dirty; + uint32_t is_dirty; rect_t dirty; - UINT32 w, h; + uint32_t w, h; } buf_t; typedef struct _sgfx_t { - UINT32 w, h; + uint32_t w, h; buf_t *pBuf; - UINT32 *pBG; + uint32_t *pBG; rect_t restore; } gfx_t; @@ -71,23 +71,23 @@ typedef struct _sgfx_t // ------------------------------------------------------------- // Functions // ------------------------------------------------------------- -void __gfx_block_set_8(UINT32* pDst, UINT32 value); -void __gfx_block_copy_8(UINT32* pDst, UINT32* pSrc); -void _GFX_copy32(UINT32* pDst, UINT32* pSrc, UINT32 ndwords); -void _GFX_copy32_hw(UINT32* pDst, UINT32* pSrc, UINT32 ndwords, UINT32 wait_finish); -void _GFX_memset32(UINT32* pDst, UINT32 value, UINT32 ndwords); -void _GFX_memset32_hw(UINT32* pDst, UINT32 value, UINT32 ndwords, UINT32 wait_finish); -void _GFX_BLIT_const(UINT32* pDst, UINT32 xdim_dst, UINT32 xmin, UINT32 ymin, UINT32 xmax, UINT32 ymax, UINT32 value); -void _GFX_BLIT_const_hw(UINT32* pDst, UINT32 xdim_dst, UINT32 xmin, UINT32 ymin, UINT32 xmax, UINT32 ymax, UINT32 value, UINT32 wait_finish); +void __gfx_block_set_8(uint32_t* pDst, uint32_t value); +void __gfx_block_copy_8(uint32_t* pDst, uint32_t* pSrc); +void _GFX_copy32(uint32_t* pDst, uint32_t* pSrc, uint32_t ndwords); +void _GFX_copy32_hw(uint32_t* pDst, uint32_t* pSrc, uint32_t ndwords, uint32_t wait_finish); +void _GFX_memset32(uint32_t* pDst, uint32_t value, uint32_t ndwords); +void _GFX_memset32_hw(uint32_t* pDst, uint32_t value, uint32_t ndwords, uint32_t wait_finish); +void _GFX_BLIT_const(uint32_t* pDst, uint32_t xdim_dst, uint32_t xmin, uint32_t ymin, uint32_t xmax, uint32_t ymax, uint32_t value); +void _GFX_BLIT_const_hw(uint32_t* pDst, uint32_t xdim_dst, uint32_t xmin, uint32_t ymin, uint32_t xmax, uint32_t ymax, uint32_t value, uint32_t wait_finish); void GFX_init(gfx_t *pObj); -void GFX_frame(gfx_t *pObj, UINT32 sync_mode); +void GFX_frame(gfx_t *pObj, uint32_t sync_mode); void GFX_show(gfx_t *pObj); void GFX_copy_front2back(gfx_t *pObj); -void GFX_get_FB_front(gfx_t *pObj, UINT32 **ppFB); -void box_create(box_t *pObj, UINT32 w, UINT32 h); -void GFX_restore(gfx_t *pObj, box_t *pBox, UINT32 posx, UINT32 posy); -void GFX_box_draw(gfx_t *pObj, box_t *pBox, UINT32 posx, UINT32 posy, UINT32 color); -void GFX_box_draw_bg(gfx_t *pObj, box_t *pBox, UINT32 posx, UINT32 posy, UINT32 color); -void GFX_box_blit_bg(gfx_t *pObj, box_t *pBox, UINT32 pos_x_src, UINT32 pos_y_src, UINT32 pos_x_dst, UINT32 pos_y_dst); +void GFX_get_FB_front(gfx_t *pObj, uint32_t **ppFB); +void box_create(box_t *pObj, uint32_t w, uint32_t h); +void GFX_restore(gfx_t *pObj, box_t *pBox, uint32_t posx, uint32_t posy); +void GFX_box_draw(gfx_t *pObj, box_t *pBox, uint32_t posx, uint32_t posy, uint32_t color); +void GFX_box_draw_bg(gfx_t *pObj, box_t *pBox, uint32_t posx, uint32_t posy, uint32_t color); +void GFX_box_blit_bg(gfx_t *pObj, box_t *pBox, uint32_t pos_x_src, uint32_t pos_y_src, uint32_t pos_x_dst, uint32_t pos_y_dst); #endif // GFX_H diff --git a/src/libsys/mips_ps2.c b/src/libsys/mips_ps2.c index fb7bb09..df342bc 100644 --- a/src/libsys/mips_ps2.c +++ b/src/libsys/mips_ps2.c @@ -6,16 +6,16 @@ ps2_if_t ps2_if[2] = { - {ps2_type_unknown, (UINT32*)SYS_PS2_0_STAT, (UINT32*)SYS_PS2_0_DATA}, - {ps2_type_unknown, (UINT32*)SYS_PS2_1_STAT, (UINT32*)SYS_PS2_1_DATA} + {ps2_type_unknown, (uint32_t*)SYS_PS2_0_STAT, (uint32_t*)SYS_PS2_0_DATA}, + {ps2_type_unknown, (uint32_t*)SYS_PS2_1_STAT, (uint32_t*)SYS_PS2_1_DATA} }; -UINT32 PS2_get_num_if(void) +uint32_t PS2_get_num_if(void) { return (sizeof(ps2_if)/sizeof(ps2_if_t)); } -ps2_if_t *PS2_get_if(UINT32 port) +ps2_if_t *PS2_get_if(uint32_t port) { if (port < PS2_get_num_if()) return &ps2_if[port]; @@ -23,7 +23,7 @@ ps2_if_t *PS2_get_if(UINT32 port) return NULL; } -void PS2_byte_write(UINT32 port, UINT8 byte) +void PS2_byte_write(uint32_t port, uint8_t byte) { ps2_if_t *pIF; @@ -31,10 +31,10 @@ void PS2_byte_write(UINT32 port, UINT8 byte) while(!(*pIF->pCTRL & SYS_PS2_BIT_TX_EMPTY)); - *pIF->pDATA = (UINT32)byte; + *pIF->pDATA = (uint32_t)byte; } -UINT32 PS2_byte_read(UINT32 port, UINT32 timeout_ms) +uint32_t PS2_byte_read(uint32_t port, uint32_t timeout_ms) { ps2_if_t *pIF; @@ -48,12 +48,12 @@ UINT32 PS2_byte_read(UINT32 port, UINT32 timeout_ms) sleep(1); } - return (UINT32)*pIF->pDATA; + return (uint32_t)*pIF->pDATA; } -UINT32 PS2_cmd(UINT32 port, UINT8 cmd, UINT32 ack_timeout_ms) +uint32_t PS2_cmd(uint32_t port, uint8_t cmd, uint32_t ack_timeout_ms) { - UINT32 result; + uint32_t result; PS2_byte_write(port, cmd); result = PS2_byte_read(port, ack_timeout_ms); @@ -65,21 +65,21 @@ UINT32 PS2_cmd(UINT32 port, UINT8 cmd, UINT32 ack_timeout_ms) return 0; } -void PS2_flush(UINT32 port) +void PS2_flush(uint32_t port) { while (!IS_ERROR(PS2_byte_read(port, 10))); } -UINT32 PS2_init(UINT32 port) +uint32_t PS2_init(uint32_t port) { int i; ps2_if_t *pIF; - UINT8 id[2]; + uint8_t id[2]; pIF = &ps2_if[port]; pIF->type = ps2_type_unknown; - UINT32 result; + uint32_t result; // Disable RX-interrupt *pIF->pCTRL &= ~SYS_PS2_BIT_RX_INTEN; diff --git a/src/libsys/mips_ps2.h b/src/libsys/mips_ps2.h index f65ffd2..d6e5b2a 100644 --- a/src/libsys/mips_ps2.h +++ b/src/libsys/mips_ps2.h @@ -15,9 +15,9 @@ enum typedef struct _sps2_if_t { - UINT32 type; - volatile UINT32 *pCTRL; - volatile UINT32 *pDATA; + uint32_t type; + volatile uint32_t *pCTRL; + volatile uint32_t *pDATA; } ps2_if_t; // -------------------------------------------------- @@ -32,12 +32,12 @@ typedef struct _sps2_if_t // -------------------------------------------------- // Functions // -------------------------------------------------- -UINT32 PS2_get_num_if(void); -ps2_if_t *PS2_get_if(UINT32 port); -UINT32 PS2_init(UINT32 port); -void PS2_byte_write(UINT32 port, UINT8 byte); -UINT32 PS2_byte_read(UINT32 port, UINT32 timeout_ms); -UINT32 PS2_cmd(UINT32 port, UINT8 cmd, UINT32 ack_timeout_ms); -void PS2_flush(UINT32 port); +uint32_t PS2_get_num_if(void); +ps2_if_t *PS2_get_if(uint32_t port); +uint32_t PS2_init(uint32_t port); +void PS2_byte_write(uint32_t port, uint8_t byte); +uint32_t PS2_byte_read(uint32_t port, uint32_t timeout_ms); +uint32_t PS2_cmd(uint32_t port, uint8_t cmd, uint32_t ack_timeout_ms); +void PS2_flush(uint32_t port); #endif // PS2_H diff --git a/src/life.c b/src/life.c index cf407e0..5c07a2d 100644 --- a/src/life.c +++ b/src/life.c @@ -30,7 +30,7 @@ #define MATRIX( row, col ) (*(matrix + (NX*col) + row )) #define FUTURE( row, col ) (*(future + (NX*col) + row )) -UINT32 *g_gx_buff; +uint32_t *g_gx_buff; int clock_lfsr32() { @@ -48,16 +48,16 @@ int random1023() { typedef struct _scolor_t { - UINT8 r, g, b, a; + uint8_t r, g, b, a; } __attribute__ ((__packed__)) color_t; -void DrawPixel(UINT32 x, UINT32 y, color_t *pColor) +void DrawPixel(uint32_t x, uint32_t y, color_t *pColor) { int i, j; for (i=0; i < SCALE_Y; i++) for (j=0; j < SCALE_X; j++) - g_gx_buff[(OFFSET_X+SCALE_X*x+j) + SCREEN_X*(OFFSET_Y+SCALE_Y*y+i)] = *((UINT32*)pColor); + g_gx_buff[(OFFSET_X+SCALE_X*x+j) + SCREEN_X*(OFFSET_Y+SCALE_Y*y+i)] = *((uint32_t*)pColor); } @@ -66,7 +66,7 @@ void displayBoard1( int* matrix ) { int x, y; int mask, accu; - UINT32 color; + uint32_t color; for( x=0; x < NX; x++ ) { @@ -74,7 +74,7 @@ void displayBoard1( int* matrix ) accu = 0x00; for( y=0; y < NY; y++ ) { - color = (UINT32)-(MATRIX(x,y) & 0x1); + color = (uint32_t)-(MATRIX(x,y) & 0x1); DrawPixel(x, y, (color_t*)&color); // if (MATRIX( x, y ) != OCCUPIED) // { @@ -188,19 +188,19 @@ void nextGeneration( int* matrix, int* future ) { void gx_init(void) { - volatile UINT32 *pVGA_ctrl = (UINT32*)SYS_VGA_CTRL; - volatile UINT32 *pVGA_front = (UINT32*)SYS_VGA_FB_FRONT; - volatile UINT32 *pVGA_back = (UINT32*)SYS_VGA_FB_BACK; + volatile uint32_t *pVGA_ctrl = (uint32_t*)SYS_VGA_CTRL; + volatile uint32_t *pVGA_front = (uint32_t*)SYS_VGA_FB_FRONT; + volatile uint32_t *pVGA_back = (uint32_t*)SYS_VGA_FB_BACK; sleep(500); - g_gx_buff = (UINT32*)malloc(SCREEN_X*SCREEN_Y*sizeof(UINT32)); - memset(g_gx_buff, 0, SCREEN_X*SCREEN_Y*sizeof(UINT32)); - printf("g_gx_buff : %8.8X\n", (UINT32)g_gx_buff); + g_gx_buff = (uint32_t*)malloc(SCREEN_X*SCREEN_Y*sizeof(uint32_t)); + memset(g_gx_buff, 0, SCREEN_X*SCREEN_Y*sizeof(uint32_t)); + printf("g_gx_buff : %8.8X\n", (uint32_t)g_gx_buff); *pVGA_ctrl |= SYS_VGA_BIT_MSTEN; - *pVGA_front = (UINT32)g_gx_buff; - *pVGA_back = (UINT32)g_gx_buff; + *pVGA_front = (uint32_t)g_gx_buff; + *pVGA_back = (uint32_t)g_gx_buff; } @@ -210,7 +210,7 @@ int main( int argc, char* argv[] ) { int* matrix; int* future; - volatile UINT32 *pBtn = (UINT32*)SYS_GPIO_0_DATA; + volatile uint32_t *pBtn = (uint32_t*)SYS_GPIO_0_DATA; // lcdEnableDisplay( 1 ); // lcdSetColor( 1 ); diff --git a/src/lwl.c b/src/lwl.c index ae1d5f4..bc1c183 100644 --- a/src/lwl.c +++ b/src/lwl.c @@ -1,8 +1,8 @@ #include "libsys.h" -int non_aligned_load(UINT32* pMem) +int non_aligned_load(uint32_t* pMem) { - UINT32 result; + uint32_t result; __asm__ ( "li $t0, 0x01234567\n" diff --git a/src/r3.c b/src/r3.c index adba0bc..36f2d83 100644 --- a/src/r3.c +++ b/src/r3.c @@ -16,7 +16,7 @@ * ./r3 | xv - */ #include "libsys.h" -UINT32 *pP; +uint32_t *pP; xsize = 800; ysize = 600; @@ -300,7 +300,7 @@ trace_ray(orig_x, orig_y, orig_z, closest_i_saved = closest_i_saved<4? closest_i_saved+1 : 7, */ /* - tvinga gråskalor: closest_i_saved = 7, + tvinga gr�skalor: closest_i_saved = 7, */ closest_i_saved = closest_i_saved<22? 7 : ( @@ -441,23 +441,23 @@ do_line(y) main() { #ifdef JMIPS_VGA - volatile UINT32 *pVGA_ctrl = (UINT32*)SYS_VGA_CTRL; - volatile UINT32 *pVGA_front = (UINT32*)SYS_VGA_FB_FRONT; - volatile UINT32 *pVGA_back = (UINT32*)SYS_VGA_FB_BACK; - UINT64 *pPixelBuf; + volatile uint32_t *pVGA_ctrl = (uint32_t*)SYS_VGA_CTRL; + volatile uint32_t *pVGA_front = (uint32_t*)SYS_VGA_FB_FRONT; + volatile uint32_t *pVGA_back = (uint32_t*)SYS_VGA_FB_BACK; + uint64_t *pPixelBuf; xsize = Screen_get_resx(); ysize = Screen_get_resy(); - pPixelBuf = (UINT64*)malloc(xsize*ysize*sizeof(UINT32)); - pP = (UINT32*)pPixelBuf; - printf("pPixelBuf : %8.8X\n", (UINT32)pPixelBuf); + pPixelBuf = (uint64_t*)malloc(xsize*ysize*sizeof(uint32_t)); + pP = (uint32_t*)pPixelBuf; + printf("pPixelBuf : %8.8X\n", (uint32_t)pPixelBuf); - *pVGA_front = (UINT32)pPixelBuf; - *pVGA_back = (UINT32)pPixelBuf; + *pVGA_front = (uint32_t)pPixelBuf; + *pVGA_back = (uint32_t)pPixelBuf; *pVGA_ctrl |= SYS_VGA_BIT_MSTEN; - memset(pPixelBuf, 0, xsize*ysize*sizeof(UINT32)); + memset(pPixelBuf, 0, xsize*ysize*sizeof(uint32_t)); #else /* Output PPM file header ... */ diff --git a/src/rmd160_test.c b/src/rmd160_test.c index 0e20382..36314fb 100644 --- a/src/rmd160_test.c +++ b/src/rmd160_test.c @@ -58,7 +58,7 @@ int main (void) { int result, i, j, cnt; byte *hashcode; - UINT32 start, stop; + uint32_t start, stop; for (i=0; i < MSG_SIZE/8; i++) msg[i] = 0x55; diff --git a/src/test_exception.c b/src/test_exception.c index c8c64d6..c88902a 100644 --- a/src/test_exception.c +++ b/src/test_exception.c @@ -13,7 +13,7 @@ void _exc_break(void) ); } -void _exc_syscall(UINT32 code, UINT32 arg) +void _exc_syscall(uint32_t code, uint32_t arg) { __asm ( @@ -195,7 +195,7 @@ int main(void) while(1) { - printf("Welche exception möchten Sie testen?\n"); + printf("Welche exception m�chten Sie testen?\n"); printf(" 1 : Reserved instruction\n"); printf(" 2 : Privileged address (BadVAddr = 0x80000000)\n"); printf(" 3 : Arithmetic overflow\n"); @@ -229,9 +229,9 @@ int main(void) break; case 4: - _exc_syscall(4, (UINT32)((char*)"Hallo Syscall (")); + _exc_syscall(4, (uint32_t)((char*)"Hallo Syscall (")); _exc_syscall(1, 12345678); - _exc_syscall(4, (UINT32)((char*)")\n")); + _exc_syscall(4, (uint32_t)((char*)")\n")); break; case 5: diff --git a/src/test_fft.c b/src/test_fft.c index 67892d8..a607957 100644 --- a/src/test_fft.c +++ b/src/test_fft.c @@ -11,19 +11,19 @@ #define FFT_MAX_LEN 1024 -FLOAT32 fft_buf_real[FFT_MAX_LEN]; -FLOAT32 fft_buf_imag[FFT_MAX_LEN]; +float32_t fft_buf_real[FFT_MAX_LEN]; +float32_t fft_buf_imag[FFT_MAX_LEN]; int main() { - UINT32 i, start, end; + uint32_t i, start, end; fft_t fft; FFTinit(&fft, 1024); - memset (fft_buf_real, 0, FFT_MAX_LEN*sizeof(FLOAT32)); - memset (fft_buf_imag, 0, FFT_MAX_LEN*sizeof(FLOAT32)); + memset (fft_buf_real, 0, FFT_MAX_LEN*sizeof(float32_t)); + memset (fft_buf_imag, 0, FFT_MAX_LEN*sizeof(float32_t)); start = clock(); diff --git a/src/test_hpi.c b/src/test_hpi.c index a8c99c6..ff350b6 100644 --- a/src/test_hpi.c +++ b/src/test_hpi.c @@ -2,24 +2,26 @@ #include #include #include -#include "libsys.h" + +#include +#include + #include "cfiflash.h" -#include "gpio.h" #include "hpi.h" -static volatile UINT32 _g_uart_msg; -static volatile UINT32 _g_rst; -static volatile UINT32 _g_sus; -static volatile UINT32 _g_cfg; +static volatile uint32_t _g_uart_msg; +static volatile uint32_t _g_rst; +static volatile uint32_t _g_sus; +static volatile uint32_t _g_cfg; gpio_if_t _g_gpio; #define CMD_SYNC_EB 0xC24755AA #define CMD_SYNC_EL 0x47C2AA55 #define TRANSFER_SIZE 64 -UINT32 conv32(UINT32 data) +uint32_t conv32(uint32_t data) { - UINT32 result; + uint32_t result; result = (0xFF00FF00 & (data << 8)) | (0x00FF00FF & (data >> 8)); @@ -27,12 +29,12 @@ UINT32 conv32(UINT32 data) return result; } -UINT16 conv16(UINT16 data) +uint16_t conv16(uint16_t data) { return (0xFF00 & (data << 8)) | (0x00FF & (data >> 8)); } -UINT16 makeBuffer16(UINT16 *pDst, UINT8 *pSrc, UINT32 size) +uint16_t makeBuffer16(uint16_t *pDst, uint8_t *pSrc, uint32_t size) { int i; @@ -41,7 +43,7 @@ UINT16 makeBuffer16(UINT16 *pDst, UINT8 *pSrc, UINT32 size) for (i=0; i < size/2; i++) { - pDst[i] = conv16(*((UINT16*)pSrc)); + pDst[i] = conv16(*((uint16_t*)pSrc)); pSrc+=2; } return size; @@ -50,8 +52,8 @@ UINT16 makeBuffer16(UINT16 *pDst, UINT8 *pSrc, UINT32 size) void uart_handler(void) { - volatile UINT32 *pUART_stat = (UINT32*)SYS_UART_STAT; - volatile UINT32 *pUART_data = (UINT32*)SYS_UART_DATA; + volatile uint32_t *pUART_stat = (uint32_t*)SYS_UART_STAT; + volatile uint32_t *pUART_data = (uint32_t*)SYS_UART_DATA; while((SYS_PS2_BIT_RX_AVAIL & *pUART_stat)) { @@ -60,10 +62,10 @@ void uart_handler(void) } -void PrintDevRegs(UINT devid) +void PrintDevRegs(uint32_t devid) { int i; - UINT32 reg_base1, reg_base2, reg_addr; + uint32_t reg_base1, reg_base2, reg_addr; if ((devid < 1) || (devid > 2)) return; @@ -117,68 +119,68 @@ void PrintDevRegs(UINT devid) typedef struct _sdev_descr_t { - UINT8 size; // length - UINT8 type; // desc type - UINT16 usb_spec; // USB spec - UINT8 devclass; // device class - UINT8 subclass; // sub class - UINT8 protocol; // protocol - UINT8 max_packet_size; // max packet size for endpoint 0 - UINT16 vendor_id; // Vendor ID - UINT16 product_id; // Product ID - UINT16 device_id; // device release number - UINT8 man_str_index; // index of manufacture string - UINT8 prod_str_index; // index of product string - UINT8 sn_str_index; // index of serial number string - UINT8 nconfs; // number of configurations + uint8_t size; // length + uint8_t type; // desc type + uint16_t usb_spec; // USB spec + uint8_t devclass; // device class + uint8_t subclass; // sub class + uint8_t protocol; // protocol + uint8_t max_packet_size; // max packet size for endpoint 0 + uint16_t vendor_id; // Vendor ID + uint16_t product_id; // Product ID + uint16_t device_id; // device release number + uint8_t man_str_index; // index of manufacture string + uint8_t prod_str_index; // index of product string + uint8_t sn_str_index; // index of serial number string + uint8_t nconfs; // number of configurations } __attribute__ ((__packed__)) dev_descr_t; typedef struct _sep_descr_t { - UINT8 size; // length of this config - UINT8 type; // type (endpoint) - UINT8 type_num; // type/number (Host use WriteFile) - UINT8 bulk; // Bulk - UINT16 pkt_size; // packet size - UINT8 interval; // interval + uint8_t size; // length of this config + uint8_t type; // type (endpoint) + uint8_t type_num; // type/number (Host use WriteFile) + uint8_t bulk; // Bulk + uint16_t pkt_size; // packet size + uint8_t interval; // interval } __attribute__ ((__packed__)) ep_descr_t; typedef struct _sconf_descr_t { - UINT8 size; // length of this config - UINT8 type; // desc type - UINT16 total_size; // Total configuration desc length including this config and following descriptions - UINT8 nifaces; // Number of interface descriptions following this - UINT8 conf_id; // config number - UINT8 conf_str_index; // index of string describing config - UINT8 attr; // attributes (e.g. bus powered) - UINT8 current; // 2mA x (max. 250 => 500mA) + uint8_t size; // length of this config + uint8_t type; // desc type + uint16_t total_size; // Total configuration desc length including this config and following descriptions + uint8_t nifaces; // Number of interface descriptions following this + uint8_t conf_id; // config number + uint8_t conf_str_index; // index of string describing config + uint8_t attr; // attributes (e.g. bus powered) + uint8_t current; // 2mA x (max. 250 => 500mA) } __attribute__ ((__packed__)) conf_descr_t; typedef struct _siface_descr_t { - UINT8 size; // length of this config - UINT8 type; // desc type - UINT8 base; // base number - UINT8 alt; // alt - UINT8 neps; // number of endpoint description following this - UINT8 iface_class; // interface class (vendor) - UINT8 subclass; // subclass - UINT8 iface_proto; // interface proto (vendor) - UINT8 iface_str_index; + uint8_t size; // length of this config + uint8_t type; // desc type + uint8_t base; // base number + uint8_t alt; // alt + uint8_t neps; // number of endpoint description following this + uint8_t iface_class; // interface class (vendor) + uint8_t subclass; // subclass + uint8_t iface_proto; // interface proto (vendor) + uint8_t iface_str_index; } __attribute__ ((__packed__)) iface_descr_t; typedef struct _sotg_descr_t { - UINT8 size; // length of this config - UINT8 type; // type (OTG) - UINT8 hnp_srp; // HNP|SRP support + uint8_t size; // length of this config + uint8_t type; // type (OTG) + uint8_t hnp_srp; // HNP|SRP support } __attribute__ ((__packed__)) otg_descr_t; typedef struct _sstr_descr_hdr_t { - UINT8 size; // length of this config - UINT8 type; // type + uint8_t size; // length of this config + uint8_t type; // type } __attribute__ ((__packed__)) str_descr_hdr_t; typedef struct _scfg_inst_t @@ -188,7 +190,7 @@ typedef struct _scfg_inst_t } cfg_inst_t; -UINT32 dev_write(UINT16 *pDevDescrString, UINT16 VID, UINT16 PID) +uint32_t dev_write(uint16_t *pDevDescrString, uint16_t VID, uint16_t PID) { dev_descr_t d; @@ -207,17 +209,17 @@ UINT32 dev_write(UINT16 *pDevDescrString, UINT16 VID, UINT16 PID) d.sn_str_index = 0x03; // index of serial number string d.nconfs = 0x01; // number of configurations - return makeBuffer16(pDevDescrString, (UINT8*)&d, sizeof(dev_descr_t)); + return makeBuffer16(pDevDescrString, (uint8_t*)&d, sizeof(dev_descr_t)); } -UINT32 conf_write(UINT16 *pConfDescr, UINT32 neps, ep_descr_t *pEP) +uint32_t conf_write(uint16_t *pConfDescr, uint32_t neps, ep_descr_t *pEP) { - UINT32 i, pos, size; + uint32_t i, pos, size; ep_descr_t ep; conf_descr_t cfg; iface_descr_t iface; otg_descr_t otg_descr; - UINT8 *pStr8 = (UINT8*)pConfDescr; + uint8_t *pStr8 = (uint8_t*)pConfDescr; // Fill config description cfg.size = sizeof(conf_descr_t); @@ -281,13 +283,13 @@ UINT32 conf_write(UINT16 *pConfDescr, UINT32 neps, ep_descr_t *pEP) } -UINT32 str_write(UINT16 *pStrDescr, UINT8 *pStr0, UINT8 *pStr1, UINT8 *pStr2) +uint32_t str_write(uint16_t *pStrDescr, uint8_t *pStr0, uint8_t *pStr1, uint8_t *pStr2) { int i; - UINT32 pos, size, strsize; + uint32_t pos, size, strsize; str_descr_hdr_t *pStrHdr; - UINT8 *pStr8 = (UINT8*)pStrDescr; - UINT16 *pStr16; + uint8_t *pStr8 = (uint8_t*)pStrDescr; + uint16_t *pStr16; pos = 0; size = sizeof(str_descr_hdr_t); @@ -310,10 +312,10 @@ UINT32 str_write(UINT16 *pStrDescr, UINT8 *pStr0, UINT8 *pStr1, UINT8 *pStr2) pos += size; size = 2*strsize; - pStr16 = (UINT16*)&pStr8[pos]; + pStr16 = (uint16_t*)&pStr8[pos]; for (i=0; i < strsize; i++) - pStr16[i] = conv16((UINT16)pStr0[i]); + pStr16[i] = conv16((uint16_t)pStr0[i]); // String 1 pos += size; @@ -326,10 +328,10 @@ UINT32 str_write(UINT16 *pStrDescr, UINT8 *pStr0, UINT8 *pStr1, UINT8 *pStr2) pos += size; size = 2*strsize; - pStr16 = (UINT16*)&pStr8[pos]; + pStr16 = (uint16_t*)&pStr8[pos]; for (i=0; i < strsize; i++) - pStr16[i] = conv16((UINT16)pStr1[i]); + pStr16[i] = conv16((uint16_t)pStr1[i]); // String 2 pos += size; @@ -342,10 +344,10 @@ UINT32 str_write(UINT16 *pStrDescr, UINT8 *pStr0, UINT8 *pStr1, UINT8 *pStr2) pos += size; size = 2*strsize; - pStr16 = (UINT16*)&pStr8[pos]; + pStr16 = (uint16_t*)&pStr8[pos]; for (i=0; i < strsize; i++) - pStr16[i] = conv16((UINT16)pStr2[i]); + pStr16[i] = conv16((uint16_t)pStr2[i]); pos += size; @@ -354,11 +356,11 @@ UINT32 str_write(UINT16 *pStrDescr, UINT8 *pStr0, UINT8 *pStr1, UINT8 *pStr2) void ep0_func(void *pArg) { - UINT32 result; - UINT16 buf[USB_MAX_IMG_SIZE/2], ep_cntres, ep_status, ep_count, tsize; + uint32_t result; + uint16_t buf[USB_MAX_IMG_SIZE/2], ep_cntres, ep_status, ep_count, tsize; usb_irp_t *pIRP = (usb_irp_t*)pArg; -// printf("Callback with pArg = %8.8X\n", (UINT32)pArg); +// printf("Callback with pArg = %8.8X\n", (uint32_t)pArg); ep_status = hpi_read_reg (SUSB2_REG_EP_STATUS0); ep_cntres = hpi_read_reg (SUSB2_REG_EP_CNTRES0); ep_count = hpi_read_reg (SUSB2_REG_EP_COUNT0); @@ -371,11 +373,11 @@ void ep0_func(void *pArg) void ep1_func(void *pArg) { - UINT32 result; - UINT16 buf[USB_MAX_IMG_SIZE/2], ep_cntres, ep_status, ep_count, tsize; + uint32_t result; + uint16_t buf[USB_MAX_IMG_SIZE/2], ep_cntres, ep_status, ep_count, tsize; usb_irp_t *pIRP = (usb_irp_t*)pArg; -// printf("Callback with pArg = %8.8X\n", (UINT32)pArg); +// printf("Callback with pArg = %8.8X\n", (uint32_t)pArg); ep_status = hpi_read_reg (SUSB2_REG_EP_STATUS1); ep_cntres = hpi_read_reg (SUSB2_REG_EP_CNTRES1); ep_count = hpi_read_reg (SUSB2_REG_EP_COUNT1); @@ -383,16 +385,16 @@ void ep1_func(void *pArg) tsize = pIRP->tsize; if (ep_status & 0x0020) { - printf("Length exception result %4.4X with count = %d\n", ep_status, (INT16)ep_cntres); + printf("Length exception result %4.4X with count = %d\n", ep_status, (int16_t)ep_cntres); if (ep_status & 0x0400) - tsize = (UINT16)((INT16)tsize - (INT16)ep_cntres); + tsize = (uint16_t)((int16_t)tsize - (int16_t)ep_cntres); if (ep_status & 0x0800) - tsize = (UINT16)((INT16)tsize - (INT16)ep_cntres); + tsize = (uint16_t)((int16_t)tsize - (int16_t)ep_cntres); } usb_irp_enqueue(pIRP); result = hpi_read_ram(pIRP->cy_req.addr, buf, tsize); - fifo_write(&pIRP->fifo, (UINT8*)buf, result, 0, FIFO_BLOCK); + fifo_write(&pIRP->fifo, (uint8_t*)buf, result, 0, FIFO_BLOCK); // printf("Read %d bytes\n", result); @@ -400,11 +402,11 @@ void ep1_func(void *pArg) void ep2_func(void *pArg) { - UINT32 result; - UINT16 buf[USB_MAX_IMG_SIZE/2], ep_cntres, ep_status, ep_count, tsize; + uint32_t result; + uint16_t buf[USB_MAX_IMG_SIZE/2], ep_cntres, ep_status, ep_count, tsize; usb_irp_t *pIRP = (usb_irp_t*)pArg; -// printf("Callback with pArg = %8.8X\n", (UINT32)pArg); +// printf("Callback with pArg = %8.8X\n", (uint32_t)pArg); ep_status = hpi_read_reg (SUSB2_REG_EP_STATUS2); ep_cntres = hpi_read_reg (SUSB2_REG_EP_CNTRES2); ep_count = hpi_read_reg (SUSB2_REG_EP_COUNT2); @@ -412,20 +414,20 @@ void ep2_func(void *pArg) tsize = pIRP->tsize; if (ep_status & 0x0020) { - printf("Length exception result %4.4X with count = %d\n", ep_status, (INT16)ep_cntres); + printf("Length exception result %4.4X with count = %d\n", ep_status, (int16_t)ep_cntres); if (ep_status & 0x0400) - tsize = (UINT16)((INT16)tsize - (INT16)ep_cntres); + tsize = (uint16_t)((int16_t)tsize - (int16_t)ep_cntres); if (ep_status & 0x0800) - tsize = (UINT16)((INT16)tsize - (INT16)ep_cntres); + tsize = (uint16_t)((int16_t)tsize - (int16_t)ep_cntres); } pIRP->tx_in_progress = 0; - result = fifo_read(&pIRP->fifo, (UINT8*)buf, pIRP->tsize, 0, FIFO_NONBLOCK); + result = fifo_read(&pIRP->fifo, (uint8_t*)buf, pIRP->tsize, 0, FIFO_NONBLOCK); if (!result) return; pIRP->cy_req.size = result; - hpi_write_ram(pIRP->cy_req.addr, (UINT16*)buf, result); + hpi_write_ram(pIRP->cy_req.addr, (uint16_t*)buf, result); usb_irp_enqueue(pIRP); @@ -436,7 +438,7 @@ void ep2_func(void *pArg) void rst_func(void *pArg) { -// printf("Callback with pArg = %8.8X\n", (UINT32)pArg); +// printf("Callback with pArg = %8.8X\n", (uint32_t)pArg); sputs("SUSB_RST_MSG\n"); /// hpi_comm_reset(); @@ -447,7 +449,7 @@ void rst_func(void *pArg) void sof_func(void *pArg) { -// printf("Callback with pArg = %8.8X\n", (UINT32)pArg); +// printf("Callback with pArg = %8.8X\n", (uint32_t)pArg); sputs("SUSB_SOF_MSG\n"); } @@ -458,7 +460,7 @@ void cfg_func(void *pArg) usb_irp_t *pIRP_rx = (usb_irp_t*)pCFG->pIRP_rx; usb_irp_t *pIRP_tx = (usb_irp_t*)pCFG->pIRP_tx; -// printf("Callback with pArg = %8.8X\n", (UINT32)pArg); +// printf("Callback with pArg = %8.8X\n", (uint32_t)pArg); sputs("SUSB_CFG_MSG\n"); _g_cfg = 1; usb_irp_enqueue(pIRP_rx); @@ -471,7 +473,7 @@ void cfg_func(void *pArg) void sus_func(void *pArg) { -// printf("Callback with pArg = %8.8X\n", (UINT32)pArg); +// printf("Callback with pArg = %8.8X\n", (uint32_t)pArg); sputs("SUSB_SUS_MSG\n"); _g_sus = 1; @@ -480,24 +482,24 @@ void sus_func(void *pArg) void id_func(void *pArg) { -// printf("Callback with pArg = %8.8X\n", (UINT32)pArg); +// printf("Callback with pArg = %8.8X\n", (uint32_t)pArg); sputs("SUSB_ID_MSG\n"); } void vbus_func(void *pArg) { -// printf("Callback with pArg = %8.8X\n", (UINT32)pArg); +// printf("Callback with pArg = %8.8X\n", (uint32_t)pArg); sputs("SUSB_VBUS_MSG\n"); } -UINT32 usb_init_descr(void) +uint32_t usb_init_descr(void) { - UINT32 size; + uint32_t size; - UINT16 buffer16[0x100]; - UINT16 addr; + uint16_t buffer16[0x100]; + uint16_t addr; ep_descr_t ep_descr[2] = {{sizeof(ep_descr_t), 5, 1, 2, TRANSFER_SIZE, 0}, {sizeof(ep_descr_t), 5, 0x82, 2, TRANSFER_SIZE, 0}}; // Set device descriptor @@ -526,10 +528,10 @@ UINT32 usb_init_descr(void) return 0; } -UINT32 usb_force_reconnect(UINT32 port) +uint32_t usb_force_reconnect(uint32_t port) { - UINT32 result; - UINT16 addr; + uint32_t result; + uint16_t addr; if (port >= USB_MAX_NUM_PORTS) return -1; @@ -555,19 +557,19 @@ UINT32 usb_force_reconnect(UINT32 port) return result; } -UINT32 usb_recv(usb_irp_t *pObj, UINT8 *pData, UINT32 len, UINT32 timeout) +uint32_t usb_recv(usb_irp_t *pObj, uint8_t *pData, uint32_t len, uint32_t timeout) { - UINT32 result; + uint32_t result; result = fifo_read(&pObj->fifo, pData, len, timeout, FIFO_BLOCK); return result; } -UINT32 usb_send(usb_irp_t *pObj, UINT8 *pData, UINT32 len, UINT32 timeout) +uint32_t usb_send(usb_irp_t *pObj, uint8_t *pData, uint32_t len, uint32_t timeout) { - UINT32 result; - UINT8 buf[USB_MAX_IMG_SIZE]; + uint32_t result; + uint8_t buf[USB_MAX_IMG_SIZE]; // Fill-up FIFO result = fifo_write(&pObj->fifo, pData, len, 0, FIFO_NONBLOCK); @@ -577,8 +579,8 @@ UINT32 usb_send(usb_irp_t *pObj, UINT8 *pData, UINT32 len, UINT32 timeout) // Trigger TX if (!pObj->tx_in_progress) { - pObj->cy_req.size = fifo_read(&pObj->fifo, (UINT8*)buf, pObj->tsize, 0, FIFO_NONBLOCK); - hpi_write_ram(pObj->cy_req.addr, (UINT16*)buf, pObj->cy_req.size); + pObj->cy_req.size = fifo_read(&pObj->fifo, (uint8_t*)buf, pObj->tsize, 0, FIFO_NONBLOCK); + hpi_write_ram(pObj->cy_req.addr, (uint16_t*)buf, pObj->cy_req.size); usb_irp_enqueue(pObj); } @@ -595,23 +597,23 @@ UINT32 usb_send(usb_irp_t *pObj, UINT8 *pData, UINT32 len, UINT32 timeout) int main(void) { int i; - UINT32 result, sync, cmd, len, buf_count, led_count, remain, tx_cnt, flash_offset; - UINT8 buffer8[2048]; - UINT16 buffer16[0x2000]; - UINT16 addr; - volatile UINT32 *pUART0_stat = (UINT32*)SYS_UART0_STAT; - UINT32 start, end; - UINT32 *pFlash32; - UINT8 *pFlash8; - UINT32 buffer32[16], *pBuf; - UINT64 *pBuf64; + uint32_t result, sync, cmd, len, buf_count, led_count, remain, tx_cnt, flash_offset; + uint8_t buffer8[2048]; + uint16_t buffer16[0x2000]; + uint16_t addr; + volatile uint32_t *pUART0_stat = (uint32_t*)SYS_UART0_STAT; + uint32_t start, end; + uint32_t *pFlash32; + uint8_t *pFlash8; + uint32_t buffer32[16], *pBuf; + uint64_t *pBuf64; usb_irp_t irp_rx, irp_tx; fifo_t fifo_rx, fifo_tx; cfg_inst_t cfg_inst; flash_t flash; - volatile UINT32 *pVGA_ctrl = (UINT32*)SYS_VGA_CTRL; - volatile UINT32 *pVGA_front = (UINT32*)SYS_VGA_FB_FRONT; - volatile UINT32 *pVGA_back = (UINT32*)SYS_VGA_FB_BACK; + volatile uint32_t *pVGA_ctrl = (uint32_t*)SYS_VGA_CTRL; + volatile uint32_t *pVGA_front = (uint32_t*)SYS_VGA_FB_FRONT; + volatile uint32_t *pVGA_back = (uint32_t*)SYS_VGA_FB_BACK; _g_rst = 0; _g_sus = 0; @@ -739,11 +741,11 @@ int main(void) led_count = 0; buf_count = 0; - pBuf64 = (UINT64*)malloc(FLASH_IMAGE_SIZE); - pBuf = (UINT32*)pBuf64; + pBuf64 = (uint64_t*)malloc(FLASH_IMAGE_SIZE); + pBuf = (uint32_t*)pBuf64; - *pVGA_front = (UINT32)pBuf64; - *pVGA_back = (UINT32)pBuf64; + *pVGA_front = (uint32_t)pBuf64; + *pVGA_back = (uint32_t)pBuf64; *pVGA_ctrl |= SYS_VGA_BIT_MSTEN; if (IS_ERROR(flash_find(&flash, SYS_FLASH_IO))) @@ -755,8 +757,8 @@ int main(void) // Get flash offset by value of DIP-switch flash_offset = flash_get_offset_by_blocknum(&flash, flash.info.nblocks-FLASH_IMAGE_SIZE/flash.info.blocksize); printf("flash_offset : %08X\n", flash_offset); - pFlash32 = (UINT32*)(SYS_FLASH_IO + flash_offset); - pFlash8 = (UINT8*)pFlash32; + pFlash32 = (uint32_t*)(SYS_FLASH_IO + flash_offset); + pFlash8 = (uint8_t*)pFlash32; while(1) { @@ -777,7 +779,7 @@ int main(void) default: break; } - result = usb_recv(&irp_rx, (UINT8*)&sync, 4, 100); + result = usb_recv(&irp_rx, (uint8_t*)&sync, 4, 100); if (!result) continue; @@ -785,11 +787,11 @@ int main(void) { printf("Sync found (0x%04X)\n", sync); - result = usb_recv(&irp_rx, (UINT8*)&cmd, 4, 1000); + result = usb_recv(&irp_rx, (uint8_t*)&cmd, 4, 1000); if (!result) continue; - result = usb_recv(&irp_rx, (UINT8*)&len, 4, 1000); + result = usb_recv(&irp_rx, (uint8_t*)&len, 4, 1000); if (!result) continue; @@ -841,7 +843,7 @@ int main(void) if (remain < len) len = remain; - result = usb_send(&irp_tx, (UINT8*)&pFlash8[tx_cnt], len, 1000); + result = usb_send(&irp_tx, (uint8_t*)&pFlash8[tx_cnt], len, 1000); if (!result) break; tx_cnt += result; @@ -853,7 +855,7 @@ int main(void) case 0x00000004: *pVGA_ctrl &= ~SYS_VGA_BIT_MSTEN; - result = usb_recv(&irp_rx, (UINT8*)pBuf, len, 1000); + result = usb_recv(&irp_rx, (uint8_t*)pBuf, len, 1000); if (result) { printf("Read %d bytes\n", result); @@ -876,7 +878,7 @@ int main(void) printf("done\n"); printf("Flash write..."); - result = flash_program(&flash, flash_offset, (UINT8*)pBuf, len); + result = flash_program(&flash, flash_offset, (uint8_t*)pBuf, len); if (IS_ERROR(result)) { printf("failed (%08X)\n", result); @@ -885,7 +887,7 @@ int main(void) printf("done\n"); printf("Flash verify..."); - result = flash_verify(&flash, flash_offset, (UINT8*)pBuf, len); + result = flash_verify(&flash, flash_offset, (uint8_t*)pBuf, len); if (IS_ERROR(result)) { printf("failed (%08X)\n", result); @@ -908,7 +910,7 @@ int main(void) return 0; } -// pMem = (UINT8*)0x40000000; +// pMem = (uint8_t*)0x40000000; // result = fifo_write(&fifo_tx, pMem, 640, 0, FIFO_NONBLOCK); // pMem += result; // usb_irp_enqueue(&irp_tx); diff --git a/src/test_irq.c b/src/test_irq.c index 305fa8e..30aa5d1 100644 --- a/src/test_irq.c +++ b/src/test_irq.c @@ -14,13 +14,13 @@ char buffer[16384]; char * volatile pPtr_r; char * volatile pPtr_w; -static volatile INT32 mouse_x; -static volatile INT32 mouse_y; +static volatile int32_t mouse_x; +static volatile int32_t mouse_y; static box_t box; static gfx_t gfx; static volatile int _g_posx, _g_posy; static volatile g_btn_l, g_btn_r; -static volatile UINT32 g_color; +static volatile uint32_t g_color; // ------------------------------------------------------------- void handler0(void) @@ -42,10 +42,10 @@ void handler2(void) void handler3(void) { - volatile UINT32 *pUART0_stat = (UINT32*)SYS_UART0_STAT; - volatile UINT32 *pUART0_data = (UINT32*)SYS_UART0_DATA; - volatile UINT32 *pUART1_stat = (UINT32*)SYS_UART1_STAT; - volatile UINT32 *pUART1_data = (UINT32*)SYS_UART1_DATA; + volatile uint32_t *pUART0_stat = (uint32_t*)SYS_UART0_STAT; + volatile uint32_t *pUART0_data = (uint32_t*)SYS_UART0_DATA; + volatile uint32_t *pUART1_stat = (uint32_t*)SYS_UART1_STAT; + volatile uint32_t *pUART1_data = (uint32_t*)SYS_UART1_DATA; while(0x200 & *pUART0_stat) { @@ -72,7 +72,7 @@ void handler4(void) void handler5(void) { - UINT32 volatile *pVGA_ctrl = (UINT32*)SYS_VGA_CTRL; + uint32_t volatile *pVGA_ctrl = (uint32_t*)SYS_VGA_CTRL; // Ack *pVGA_ctrl |= SYS_VGA_BIT_BUFCHG_FLAG; @@ -83,10 +83,10 @@ void handler6(void) { int p, i; ps2_if_t *pIF; - UINT8 mouse_rsp[3]; - UINT32 timeout_count, key; + uint8_t mouse_rsp[3]; + uint32_t timeout_count, key; - INT32 dx, dy; + int32_t dx, dy; for (p=0; p < PS2_get_num_if(); p++) { @@ -123,7 +123,7 @@ void handler6(void) { break; } - mouse_rsp[i] = (UINT8)*pIF->pDATA; + mouse_rsp[i] = (uint8_t)*pIF->pDATA; } if (!timeout_count) { @@ -148,7 +148,7 @@ void handler6(void) { if (g_btn_r == 0) { - g_color = (UINT32)rand(); + g_color = (uint32_t)rand(); } g_btn_r = 1; } @@ -183,17 +183,17 @@ int main(void) { int i; - volatile UINT32 *pUART0_stat = (UINT32*)SYS_UART0_STAT; - volatile UINT32 *pUART1_stat = (UINT32*)SYS_UART1_STAT; - volatile UINT32 *pUART0_baud = (UINT32*)SYS_UART0_BAUD; - volatile UINT32 *pUART1_baud = (UINT32*)SYS_UART1_BAUD; - UINT32 volatile *pVGA_ctrl = (UINT32*)SYS_VGA_CTRL; - UINT32 volatile *pVGA_moffs_0 = (UINT32*)SYS_VGA_FB_FRONT; - UINT32 volatile *pVGA_moffs_1 = (UINT32*)SYS_VGA_FB_BACK; - UINT32 volatile *pVGA_cgcol = (UINT32*)SYS_VGA_CGCOL; - UINT32 volatile *pFlashPicture = (UINT32*)(SYS_FLASH_MEM + 0x00600000); - UINT32 framecount; - UINT32 start, end; + volatile uint32_t *pUART0_stat = (uint32_t*)SYS_UART0_STAT; + volatile uint32_t *pUART1_stat = (uint32_t*)SYS_UART1_STAT; + volatile uint32_t *pUART0_baud = (uint32_t*)SYS_UART0_BAUD; + volatile uint32_t *pUART1_baud = (uint32_t*)SYS_UART1_BAUD; + uint32_t volatile *pVGA_ctrl = (uint32_t*)SYS_VGA_CTRL; + uint32_t volatile *pVGA_moffs_0 = (uint32_t*)SYS_VGA_FB_FRONT; + uint32_t volatile *pVGA_moffs_1 = (uint32_t*)SYS_VGA_FB_BACK; + uint32_t volatile *pVGA_cgcol = (uint32_t*)SYS_VGA_CGCOL; + uint32_t volatile *pFlashPicture = (uint32_t*)(SYS_FLASH_MEM + 0x00600000); + uint32_t framecount; + uint32_t start, end; char string[65]; interrupt_register(0, (void*)handler0); @@ -300,13 +300,13 @@ int main(void) GFX_frame(&gfx, GFX_FRAME_SYNC); framecount--; - while ((_g_posx != (UINT32)mouse_x) || (_g_posy != (UINT32)mouse_y) || g_btn_r || g_btn_l) + while ((_g_posx != (uint32_t)mouse_x) || (_g_posy != (uint32_t)mouse_y) || g_btn_r || g_btn_l) { GFX_restore(&gfx, &box, _g_posx, _g_posy); - _g_posx = (UINT32)mouse_x; - _g_posy = (UINT32)mouse_y; + _g_posx = (uint32_t)mouse_x; + _g_posy = (uint32_t)mouse_y; if (g_btn_l && !g_btn_r) { diff --git a/src/test_vga.c b/src/test_vga.c index cf6118b..be7a010 100644 --- a/src/test_vga.c +++ b/src/test_vga.c @@ -11,18 +11,18 @@ #include "mips_gfx.h" #include "mips_ps2.h" -static volatile INT32 mouse_x; -static volatile INT32 mouse_y; +static volatile int32_t mouse_x; +static volatile int32_t mouse_y; static box_t box_even, box_odd, line_h_even, line_v_even, line_h_odd, line_v_odd, cross_v, cross_h; static gfx_t gfx; static volatile int _g_posx, _g_posy; static volatile g_btn_l, g_btn_r; -static volatile UINT32 g_color; +static volatile uint32_t g_color; // ------------------------------------------------------------- void handler5(void) { - UINT32 volatile *pVGA_ctrl = (UINT32*)SYS_VGA_CTRL; + uint32_t volatile *pVGA_ctrl = (uint32_t*)SYS_VGA_CTRL; // Ack *pVGA_ctrl |= SYS_VGA_BIT_BUFCHG_FLAG; @@ -33,10 +33,10 @@ void handler6(void) { int p, i; ps2_if_t *pIF; - UINT8 mouse_rsp[3]; - UINT32 timeout_count, key; + uint8_t mouse_rsp[3]; + uint32_t timeout_count, key; - INT32 dx, dy; + int32_t dx, dy; for (p=0; p < PS2_get_num_if(); p++) { @@ -73,7 +73,7 @@ void handler6(void) { break; } - mouse_rsp[i] = (UINT8)*pIF->pDATA; + mouse_rsp[i] = (uint8_t)*pIF->pDATA; } if (!timeout_count) { @@ -121,18 +121,18 @@ int main(void) { int i; - UINT32 volatile *pVGA_ctrl = (UINT32*)SYS_VGA_CTRL; - UINT32 volatile *pVGA_moffs_0 = (UINT32*)SYS_VGA_FB_FRONT; - UINT32 volatile *pVGA_moffs_1 = (UINT32*)SYS_VGA_FB_BACK; - UINT32 volatile *pVGA_cgcol = (UINT32*)SYS_VGA_CGCOL; - UINT32 *pFlashPicture = (UINT32*)(SYS_FLASH_MEM + 0x00600000); - UINT32 framecount; - UINT32 start, end; - UINT32 *pPic; - UINT32 rmb_posx, rmb_posy, rmb_clicked; + uint32_t volatile *pVGA_ctrl = (uint32_t*)SYS_VGA_CTRL; + uint32_t volatile *pVGA_moffs_0 = (uint32_t*)SYS_VGA_FB_FRONT; + uint32_t volatile *pVGA_moffs_1 = (uint32_t*)SYS_VGA_FB_BACK; + uint32_t volatile *pVGA_cgcol = (uint32_t*)SYS_VGA_CGCOL; + uint32_t *pFlashPicture = (uint32_t*)(SYS_FLASH_MEM + 0x00600000); + uint32_t framecount; + uint32_t start, end; + uint32_t *pPic; + uint32_t rmb_posx, rmb_posy, rmb_clicked; - pPic = (UINT32*)malloc(800*600*sizeof(UINT32)); - memcpy(pPic, pFlashPicture, 800*600*sizeof(UINT32)); + pPic = (uint32_t*)malloc(800*600*sizeof(uint32_t)); + memcpy(pPic, pFlashPicture, 800*600*sizeof(uint32_t)); interrupt_register(5, (void*)handler5); interrupt_register(6, (void*)handler6); @@ -181,11 +181,11 @@ int main(void) GFX_frame(&gfx, GFX_FRAME_SYNC); framecount--; - while ((_g_posx != (UINT32)mouse_x) || (_g_posy != (UINT32)mouse_y) || g_btn_r || g_btn_l) + while ((_g_posx != (uint32_t)mouse_x) || (_g_posy != (uint32_t)mouse_y) || g_btn_r || g_btn_l) { - _g_posx = (UINT32)mouse_x; - _g_posy = (UINT32)mouse_y; + _g_posx = (uint32_t)mouse_x; + _g_posy = (uint32_t)mouse_y; GFX_restore(&gfx, NULL, _g_posx, _g_posy); @@ -210,7 +210,7 @@ int main(void) if (g_btn_r) { if (!rmb_clicked) - g_color = (UINT32)rand(); + g_color = (uint32_t)rand(); rmb_clicked = 1; rmb_posx = _g_posx; diff --git a/src/testbench.c b/src/testbench.c index 0c402e3..4a1cf24 100644 --- a/src/testbench.c +++ b/src/testbench.c @@ -25,26 +25,26 @@ extern int paranoia(int argc, char **argv); gpio_if_t gpio_if; -UINT32* pf(void) +uint32_t* pf(void) { - static UINT32 p; + static uint32_t p; return &p; } // ------------------------------------------------------------- -void LoadPic(UINT64 *pScreen, UINT32 screen_nx, UINT32 screen_ny, UINT32 *pImage, UINT32 image_nx, UINT32 image_ny, UINT32 image_scale_x, UINT32 image_scale_y) +void LoadPic(uint64_t *pScreen, uint32_t screen_nx, uint32_t screen_ny, uint32_t *pImage, uint32_t image_nx, uint32_t image_ny, uint32_t image_scale_x, uint32_t image_scale_y) { - UINT32 off_x, off_y; - UINT32 i, j, black; - UINT32 *pScr, *pImg; + uint32_t off_x, off_y; + uint32_t i, j, black; + uint32_t *pScr, *pImg; off_x = (screen_nx-(image_scale_x*image_nx))/2; off_y = (screen_ny-(image_scale_y*image_ny))/2; black = 0; - pScr = (UINT32*)pScreen; + pScr = (uint32_t*)pScreen; for (i=0; i < screen_nx*screen_ny; i += 8) { __gfx_block_set_8(pScr, 0); @@ -54,7 +54,7 @@ void LoadPic(UINT64 *pScreen, UINT32 screen_nx, UINT32 screen_ny, UINT32 *pImage if (!pImage) return; - pScr = ((UINT32*)pScreen) + screen_nx*off_y + off_x; + pScr = ((uint32_t*)pScreen) + screen_nx*off_y + off_x; pImg = pImage; for (i=0; i < image_ny*image_nx; i += 8) @@ -65,19 +65,19 @@ void LoadPic(UINT64 *pScreen, UINT32 screen_nx, UINT32 screen_ny, UINT32 *pImage } /* - UINT32 off_x, off_y; - UINT32 i; - UINT32 *pScr; + uint32_t off_x, off_y; + uint32_t i; + uint32_t *pScr; off_x = (screen_nx-(image_scale_x*image_nx))/2; off_y = (screen_ny-(image_scale_y*image_ny))/2; - memset(pScreen, 0, screen_nx*screen_ny*sizeof(UINT32)); - pScr = ((UINT32*)pScreen) + screen_nx*off_y + off_x; + memset(pScreen, 0, screen_nx*screen_ny*sizeof(uint32_t)); + pScr = ((uint32_t*)pScreen) + screen_nx*off_y + off_x; for (i=0; i < image_ny; i++) { - memcpy(pScr, &pImage[i*image_nx], image_nx*sizeof(UINT32)); + memcpy(pScr, &pImage[i*image_nx], image_nx*sizeof(uint32_t)); pScr += screen_nx; } */ @@ -85,10 +85,10 @@ void LoadPic(UINT64 *pScreen, UINT32 screen_nx, UINT32 screen_ny, UINT32 *pImage int IsEndianBig(void) { - UINT8 *pBuf; - UINT32 word; + uint8_t *pBuf; + uint32_t word; word = 0x12345678; - pBuf = (UINT8*)&word; + pBuf = (uint8_t*)&word; if (((*pBuf+0) == 0x12) && (*(pBuf+1) == 0x34) && (*(pBuf+2) == 0x56) && (*(pBuf+3) == 0x78)) { return 1; @@ -102,8 +102,8 @@ int IsEndianBig(void) void handler3(void) { - volatile UINT32 *pUART_stat = (UINT32*)SYS_UART_STAT; - volatile UINT32 *pUART_data = (UINT32*)SYS_UART_DATA; + volatile uint32_t *pUART_stat = (uint32_t*)SYS_UART_STAT; + volatile uint32_t *pUART_data = (uint32_t*)SYS_UART_DATA; if((0x10 & *pUART_stat)) { @@ -119,9 +119,9 @@ int posx, posy; void handler7(void) { - UINT32 volatile *pTim_stat = (UINT32*)SYS_ITIM_STAT; - UINT32 volatile *pTim_ctrl = (UINT32*)SYS_ITIM_CTRL; - UINT32 volatile *pTim0_cmp = (UINT32*)SYS_ITIM0_CMP; + uint32_t volatile *pTim_stat = (uint32_t*)SYS_ITIM_STAT; + uint32_t volatile *pTim_ctrl = (uint32_t*)SYS_ITIM_CTRL; + uint32_t volatile *pTim0_cmp = (uint32_t*)SYS_ITIM0_CMP; time_t curr_date; struct tm *pDate; @@ -133,12 +133,12 @@ void handler7(void) GFX_restore(&gfx, &box, posx, posy); GFX_show(&gfx); - posx = (UINT32)rand()%800; - posy = (UINT32)rand()%600; + posx = (uint32_t)rand()%800; + posy = (uint32_t)rand()%600; GFX_frame(&gfx, GFX_FRAME_NOSYNC); - GFX_box_draw(&gfx, &box, posx, posy, (UINT32)rand()); + GFX_box_draw(&gfx, &box, posx, posy, (uint32_t)rand()); GFX_show(&gfx); - *pTim0_cmp = (UINT32)(rand() & 0x000FFFFF); + *pTim0_cmp = (uint32_t)(rand() & 0x000FFFFF); *pTim_ctrl |= 1; } @@ -215,10 +215,10 @@ void PrintCPUinfo(void) } -UINT32 uncached_cachemiss_bug(void) +uint32_t uncached_cachemiss_bug(void) { - UINT32 result; - UINT32 pMem[2]; + uint32_t result; + uint32_t pMem[2]; pMem[0] = 0x12345678; pMem[1] = 0xFFFFFFFF; @@ -246,10 +246,10 @@ UINT32 uncached_cachemiss_bug(void) return result; } -UINT32 non_aligned_load() +uint32_t non_aligned_load() { - UINT32 result; - UINT32 pMem[3]; + uint32_t result; + uint32_t pMem[3]; __asm__ ( @@ -492,11 +492,11 @@ int Test12_MulDiv() int Test13_COP0_Load_Store(void) { int i,size; - UINT32 *pSrc32, *pDst32; + uint32_t *pSrc32, *pDst32; size = 0x2000; - pSrc32 = (UINT32*)0xBFC00000; - pDst32 = (UINT32*)calloc(size,sizeof(UINT32)); + pSrc32 = (uint32_t*)0xBFC00000; + pDst32 = (uint32_t*)calloc(size,sizeof(uint32_t)); for (i=0; i < size/4; i++) { CP0_TR_read_ptr(&pSrc32[i]); @@ -517,11 +517,11 @@ int Test13_COP0_Load_Store(void) int Test14_DCACHE_invalidate(void) { int i,size; - UINT32 *pSrc32, *pDst32; + uint32_t *pSrc32, *pDst32; size = 0x2000; - pSrc32 = (UINT32*)0xBFC00000; - pDst32 = (UINT32*)calloc(size,sizeof(UINT32)); + pSrc32 = (uint32_t*)0xBFC00000; + pDst32 = (uint32_t*)calloc(size,sizeof(uint32_t)); for (i=0; i < size/4; i++) { pDst32[i] = pSrc32[i]; @@ -539,7 +539,7 @@ int Test14_DCACHE_invalidate(void) if (i) return TEST14_ERROR; - pDst32 = (UINT32*)calloc(size,sizeof(UINT32)); + pDst32 = (uint32_t*)calloc(size,sizeof(uint32_t)); for (i=0; i < size/4; i++) { pDst32[i] = pSrc32[i]; @@ -566,9 +566,9 @@ int Test15_pi_calc() int i, j, k; int carry = 0; int arr[PI_MAXARR+1]; - UINT32 int_part, result; - UINT16 pi_res[200] = {0}; - UINT16 pi_ref[200] = + uint32_t int_part, result; + uint16_t pi_res[200] = {0}; + uint16_t pi_ref[200] = { 3141,5926,5358,9793,2384,6264,3383,2795, 288,4197,1693,9937,5105,8209,7494,4592,3078,1640,6286,2089,9862,8034,8253,4211, 7067,9821,4808,6513,2823, 664,7093,8446, 955, 582,2317,2535,9408,1284,8111,7450,2841, 270,1938,5211, 555,9644,6229,4895, @@ -597,12 +597,12 @@ int Test15_pi_calc() } result = carry + sum/PI_SCALE; int_part = PI_SCALE * (result / PI_SCALE); - pi_res[k] = (UINT16)(result - int_part); + pi_res[k] = (uint16_t)(result - int_part); carry = sum % PI_SCALE; k++; } - for (k=0; k < sizeof(pi_ref)/sizeof(UINT16); k++) + for (k=0; k < sizeof(pi_ref)/sizeof(uint16_t); k++) { printf("%d", pi_res[k]); } @@ -621,27 +621,27 @@ int Test15_pi_calc() int Test16_MemTest(void) { int result, i, j, cnt, size; - UINT8 *ram8 = NULL; - UINT16 *ram16 = NULL; - UINT32 *ram32 = NULL; - UINT32 volatile *pFlashIO = (UINT32*)SYS_FLASH_IO; - UINT32 volatile *pFlashMem = (UINT32*)SYS_FLASH_MEM; - UINT32 volatile *pROM = (UINT32*)0xBFC00000; - UINT32 volatile *pVGA_src0 = (UINT32*)SYS_VGA_BLIT_SRC0_ADDR; - UINT32 volatile *pVGA_dst = (UINT32*)SYS_VGA_BLIT_DST_ADDR; - UINT32 volatile *pVGA_dimx_src0 = (UINT32*)SYS_VGA_BLIT_SRC0_DIMX; - UINT32 volatile *pVGA_dimx_dst = (UINT32*)SYS_VGA_BLIT_DST_DIMX; - UINT32 volatile *pVGA_nx = (UINT32*)SYS_VGA_BLIT_NX; - UINT32 volatile *pVGA_ny = (UINT32*)SYS_VGA_BLIT_NY; - UINT32 volatile *pVGA_ctrl = (UINT32*)SYS_VGA_CTRL; - UINT32 volatile *pVGA_moffs_0 = (UINT32*)SYS_VGA_FB_FRONT; - UINT32 volatile *pVGA_moffs_1 = (UINT32*)SYS_VGA_FB_BACK; - UINT32 volatile *pVGA_const_color = (UINT32*)SYS_VGA_BLIT_COLOR; + uint8_t *ram8 = NULL; + uint16_t *ram16 = NULL; + uint32_t *ram32 = NULL; + uint32_t volatile *pFlashIO = (uint32_t*)SYS_FLASH_IO; + uint32_t volatile *pFlashMem = (uint32_t*)SYS_FLASH_MEM; + uint32_t volatile *pROM = (uint32_t*)0xBFC00000; + uint32_t volatile *pVGA_src0 = (uint32_t*)SYS_VGA_BLIT_SRC0_ADDR; + uint32_t volatile *pVGA_dst = (uint32_t*)SYS_VGA_BLIT_DST_ADDR; + uint32_t volatile *pVGA_dimx_src0 = (uint32_t*)SYS_VGA_BLIT_SRC0_DIMX; + uint32_t volatile *pVGA_dimx_dst = (uint32_t*)SYS_VGA_BLIT_DST_DIMX; + uint32_t volatile *pVGA_nx = (uint32_t*)SYS_VGA_BLIT_NX; + uint32_t volatile *pVGA_ny = (uint32_t*)SYS_VGA_BLIT_NY; + uint32_t volatile *pVGA_ctrl = (uint32_t*)SYS_VGA_CTRL; + uint32_t volatile *pVGA_moffs_0 = (uint32_t*)SYS_VGA_FB_FRONT; + uint32_t volatile *pVGA_moffs_1 = (uint32_t*)SYS_VGA_FB_BACK; + uint32_t volatile *pVGA_const_color = (uint32_t*)SYS_VGA_BLIT_COLOR; - UINT32 *pSrc32, *pDst32; - UINT32 start, end; - UINT32 color_cycle[12] = {0x000000FF, 0x00808080, 0x0000FFFF, 0x00808080, 0x0000FF00, 0x00808080, 0x00FFFF00, 0x00808080, 0x00FF0000, 0x00808080, 0x00FF00FF, 0x00808080}; + uint32_t *pSrc32, *pDst32; + uint32_t start, end; + uint32_t color_cycle[12] = {0x000000FF, 0x00808080, 0x0000FFFF, 0x00808080, 0x0000FF00, 0x00808080, 0x00FFFF00, 0x00808080, 0x00FF0000, 0x00808080, 0x00FF00FF, 0x00808080}; // ---------------------------------------------------------- // Memtest BEGIN @@ -651,18 +651,18 @@ int Test16_MemTest(void) start = clock(); for (j=0; j < TEST_SIZE/SMALL_TEST_SIZE; j++) for (i=0; i < SMALL_TEST_SIZE/4; i++) - pSSRAM[i] = (UINT32)i; + pSSRAM[i] = (uint32_t)i; end = clock(); printf("done (%.2f MByte/s)\n", (double)TEST_SIZE/(1000*(end-start))); - PrintBuffer8((UINT8*)pSSRAM, 16, 256); + PrintBuffer8((uint8_t*)pSSRAM, 16, 256); printf("Verify (32-Bit access)..."); start = clock(); for (j=0; j < TEST_SIZE/SMALL_TEST_SIZE; j++) for (i=SMALL_TEST_SIZE/4-1; i >= 0; i--) - if (pSSRAM[i] != (UINT32)i) + if (pSSRAM[i] != (uint32_t)i) break; end = clock(); @@ -673,20 +673,20 @@ int Test16_MemTest(void) printf("passed (%.2f MByte/s)\n", (double)TEST_SIZE/(1000*(end-start))); */ // ---------------------------------------------------------- - pSrc32 = (UINT32*)calloc(TEST_SIZE/4,sizeof(UINT32)); - pDst32 = (UINT32*)calloc(TEST_SIZE/4,sizeof(UINT32)); + pSrc32 = (uint32_t*)calloc(TEST_SIZE/4,sizeof(uint32_t)); + pDst32 = (uint32_t*)calloc(TEST_SIZE/4,sizeof(uint32_t)); // Memtest BEGIN printf("Dump first 16 bytes of flash blocks\n"); for (i=0; i < FLASH_SIZE; i += 0x40000) - memdump((UINT8*)(pFlashIO+i/4), 0, 16, 16); + memdump((uint8_t*)(pFlashIO+i/4), 0, 16, 16); printf("\n"); printf("SDRAM Memory Test\n"); printf("Test size %d kByte\n\n", TEST_SIZE/1024); - ram8 = (UINT8*)pDst32; + ram8 = (uint8_t*)pDst32; printf("Zeroize SDRAM (memset)..."); start = clock(); memset(ram8, 0, TEST_SIZE); @@ -696,34 +696,34 @@ int Test16_MemTest(void) printf("Zeroize SDRAM (8-Bit access)..."); start = clock(); for (i=0; i < TEST_SIZE; i++) - ram8[i] = (UINT8)0; + ram8[i] = (uint8_t)0; end = clock(); printf("done (%.2f MByte/s)\n", (double)TEST_SIZE/(1024*1024*(double)(end-start)/CLOCKS_PER_SEC)); - ram16 = (UINT16*)pDst32; + ram16 = (uint16_t*)pDst32; printf("Zeroize SDRAM (16-Bit access)..."); start = clock(); for (i=0; i < TEST_SIZE/2; i++) - ram16[i] = (UINT16)0; + ram16[i] = (uint16_t)0; end = clock(); printf("done (%.2f MByte/s)\n", (double)TEST_SIZE/(1024*1024*(double)(end-start)/CLOCKS_PER_SEC)); - ram32 = (UINT32*)pDst32; + ram32 = (uint32_t*)pDst32; printf("Zeroize SDRAM (32-Bit access)..."); start = clock(); for (i=0; i < TEST_SIZE/4; i++) - ram32[i] = (UINT32)0; + ram32[i] = (uint32_t)0; end = clock(); printf("done (%.2f MByte/s)\n", (double)TEST_SIZE/(1024*1024*(double)(end-start)/CLOCKS_PER_SEC)); - ram8 = (UINT8*)pDst32; + ram8 = (uint8_t*)pDst32; printf("Write SDRAM (8-Bit access)..."); start = clock(); for (i=0; i < TEST_SIZE; i++) - ram8[i] = (UINT8)i; + ram8[i] = (uint8_t)i; end = clock(); printf("done (%.2f MByte/s)\n", (double)TEST_SIZE/(1024*1024*(double)(end-start)/CLOCKS_PER_SEC)); @@ -731,7 +731,7 @@ int Test16_MemTest(void) printf("Verify SDRAM (8-Bit access)..."); start = clock(); for (i=TEST_SIZE-1; i >= 0; i--) - if (ram8[i] != (UINT8)i) + if (ram8[i] != (uint8_t)i) break; end = clock(); @@ -744,11 +744,11 @@ int Test16_MemTest(void) else printf("passed (%.2f MByte/s)\n", (double)TEST_SIZE/(1024*1024*(double)(end-start)/CLOCKS_PER_SEC)); - ram16 = (UINT16*)pDst32; + ram16 = (uint16_t*)pDst32; printf("Write SDRAM (16-Bit access)..."); start = clock(); for (i=0; i < TEST_SIZE/2; i++) - ram16[i] = (UINT16)i; + ram16[i] = (uint16_t)i; end = clock(); printf("done (%.2f MByte/s)\n", (double)TEST_SIZE/(1024*1024*(double)(end-start)/CLOCKS_PER_SEC)); @@ -756,7 +756,7 @@ int Test16_MemTest(void) printf("Verify SDRAM (16-Bit access)..."); start = clock(); for (i=TEST_SIZE/2-1; i >= 0; i--) - if (ram16[i] != (UINT16)i) + if (ram16[i] != (uint16_t)i) break; end = clock(); @@ -770,12 +770,12 @@ int Test16_MemTest(void) printf("passed (%.2f MByte/s)\n", (double)TEST_SIZE/(1024*1024*(double)(end-start)/CLOCKS_PER_SEC)); - ram32 = (UINT32*)pDst32; + ram32 = (uint32_t*)pDst32; printf("Write SDRAM (32-Bit access)..."); start = clock(); for (i=0; i < TEST_SIZE/4; i++) { - ram32[i] = (UINT32)i; + ram32[i] = (uint32_t)i; } end = clock(); @@ -785,7 +785,7 @@ int Test16_MemTest(void) start = clock(); for (i=TEST_SIZE/4-1; i >= 0; i--) { - if (ram32[i] != (UINT32)i) + if (ram32[i] != (uint32_t)i) break; } @@ -802,11 +802,11 @@ int Test16_MemTest(void) printf("\n"); printf("Small data test (size = %d kByte)\n", SMALL_TEST_SIZE/1024); printf("Write SDRAM (32-Bit access)..."); - ram32 = (UINT32*)pDst32; + ram32 = (uint32_t*)pDst32; start = clock(); for (j=0; j < TEST_SIZE/SMALL_TEST_SIZE; j++) for (i=0; i < SMALL_TEST_SIZE/4; i++) - ram32[i] = (UINT32)i; + ram32[i] = (uint32_t)i; end = clock(); printf("done (%.2f MByte/s)\n", (double)TEST_SIZE/(1024*1024*(double)(end-start)/CLOCKS_PER_SEC)); @@ -817,7 +817,7 @@ int Test16_MemTest(void) start = clock(); for (j=0; j < TEST_SIZE/SMALL_TEST_SIZE; j++) for (i=SMALL_TEST_SIZE/4-1; i >= 0; i--) - if (ram32[i] != (UINT32)i) + if (ram32[i] != (uint32_t)i) break; end = clock(); @@ -856,7 +856,7 @@ int Test16_MemTest(void) printf("Memcpy() Flash(IO) => SDRAM \n"); printf("Copying %d kBytes...", FLASH_SIZE/(1024)); start = clock(); - memcpy(pDst32, (UINT32*)pFlashIO, FLASH_SIZE); + memcpy(pDst32, (uint32_t*)pFlashIO, FLASH_SIZE); end = clock(); printf("done (%.2f MByte/s)\n", (double)TEST_SIZE/(1024*1024*(double)(end-start)/CLOCKS_PER_SEC)); printf("\n"); @@ -864,14 +864,14 @@ int Test16_MemTest(void) printf("Memcpy() Flash(MEM) => SDRAM \n"); printf("Copying %d kBytes...", FLASH_SIZE/(1024)); start = clock(); - memcpy(pDst32, (UINT32*)pFlashMem, FLASH_SIZE); + memcpy(pDst32, (uint32_t*)pFlashMem, FLASH_SIZE); end = clock(); printf("done (%.2f MByte/s)\n", (double)TEST_SIZE/(1024*1024*(double)(end-start)/CLOCKS_PER_SEC)); printf("\n"); #if 1 - *pVGA_moffs_0 = (UINT32)pSrc32; - *pVGA_moffs_1 = (UINT32)pSrc32; + *pVGA_moffs_0 = (uint32_t)pSrc32; + *pVGA_moffs_1 = (uint32_t)pSrc32; *pVGA_ctrl &= ~SYS_VGA_BIT_BLIT_FIN_INTEN; *pVGA_ctrl &= ~SYS_VGA_BIT_BLIT_EMPTY_INTEN; @@ -879,12 +879,12 @@ int Test16_MemTest(void) { *pVGA_ctrl &= ~(SYS_VGA_BIT_BLIT_OP_CONSTCOL | SYS_VGA_BIT_MSTEN); fprintf(stderr, "Blitter copy %d bytes (scan disabled)...", TEST_SIZE/4); - *pVGA_src0 = (UINT32)pSrc32; - *pVGA_dst = (UINT32)pDst32; - *pVGA_dimx_src0 = (UINT32)0; - *pVGA_dimx_dst = (UINT32)0; - *pVGA_nx = (UINT32)TEST_SIZE/4; - *pVGA_ny = (UINT32)1; + *pVGA_src0 = (uint32_t)pSrc32; + *pVGA_dst = (uint32_t)pDst32; + *pVGA_dimx_src0 = (uint32_t)0; + *pVGA_dimx_dst = (uint32_t)0; + *pVGA_nx = (uint32_t)TEST_SIZE/4; + *pVGA_ny = (uint32_t)1; start = clock(); for (i=0; i < 10; i++) @@ -898,12 +898,12 @@ int Test16_MemTest(void) *pVGA_ctrl |= SYS_VGA_BIT_BLIT_OP_CONSTCOL; fprintf(stderr, "Blitter memset %d bytes (scan disabled)...", TEST_SIZE/4); - *pVGA_src0 = (UINT32)pSrc32; - *pVGA_dst = (UINT32)pDst32; - *pVGA_dimx_src0 = (UINT32)0; - *pVGA_dimx_dst = (UINT32)0; - *pVGA_nx = (UINT32)TEST_SIZE/4; - *pVGA_ny = (UINT32)1; + *pVGA_src0 = (uint32_t)pSrc32; + *pVGA_dst = (uint32_t)pDst32; + *pVGA_dimx_src0 = (uint32_t)0; + *pVGA_dimx_dst = (uint32_t)0; + *pVGA_nx = (uint32_t)TEST_SIZE/4; + *pVGA_ny = (uint32_t)1; start = clock(); for (i=0; i < 10; i++) @@ -920,12 +920,12 @@ int Test16_MemTest(void) *pVGA_ctrl |= SYS_VGA_BIT_MSTEN; *pVGA_ctrl &= ~SYS_VGA_BIT_BLIT_OP_CONSTCOL; sleep(500); - *pVGA_src0 = (UINT32)pSrc32; - *pVGA_dst = (UINT32)pDst32; - *pVGA_dimx_src0 = (UINT32)0; - *pVGA_dimx_dst = (UINT32)0; - *pVGA_nx = (UINT32)TEST_SIZE/4; - *pVGA_ny = (UINT32)1; + *pVGA_src0 = (uint32_t)pSrc32; + *pVGA_dst = (uint32_t)pDst32; + *pVGA_dimx_src0 = (uint32_t)0; + *pVGA_dimx_dst = (uint32_t)0; + *pVGA_nx = (uint32_t)TEST_SIZE/4; + *pVGA_ny = (uint32_t)1; start = clock(); for (i=0; i < 10; i++) @@ -939,12 +939,12 @@ int Test16_MemTest(void) *pVGA_ctrl |= SYS_VGA_BIT_BLIT_OP_CONSTCOL; fprintf(stderr, "Blitter memset %d bytes (scan enabled)...", TEST_SIZE/4); - *pVGA_src0 = (UINT32)pSrc32; - *pVGA_dst = (UINT32)pDst32; - *pVGA_dimx_src0 = (UINT32)0; - *pVGA_dimx_dst = (UINT32)0; - *pVGA_nx = (UINT32)TEST_SIZE/4; - *pVGA_ny = (UINT32)1; + *pVGA_src0 = (uint32_t)pSrc32; + *pVGA_dst = (uint32_t)pDst32; + *pVGA_dimx_src0 = (uint32_t)0; + *pVGA_dimx_dst = (uint32_t)0; + *pVGA_nx = (uint32_t)TEST_SIZE/4; + *pVGA_ny = (uint32_t)1; start = clock(); for (i=0; i < 10; i++) @@ -966,7 +966,7 @@ int Test16_MemTest(void) #endif size = 0x2000; - memcpy(pDst32, (UINT32*)pROM, size); + memcpy(pDst32, (uint32_t*)pROM, size); printf("Verify boot ROM..."); for (i=size/4-1; i >= 0; i--) if (pDst32[i] != pROM[i]) @@ -997,16 +997,16 @@ int Test16_MemTest(void) if (i != FLASH_SIZE/4) { printf("failed\n"); - memdump((UINT8*)&pFlashIO[i], 0, 16, 256); - memdump((UINT8*)&pFlashMem[i], 0, 16, 256); + memdump((uint8_t*)&pFlashIO[i], 0, 16, 256); + memdump((uint8_t*)&pFlashMem[i], 0, 16, 256); } else { printf("passed\n"); } -// memdump((UINT8*)pSrc32, 0, 16, size); -// memdump((UINT8*)0x40000000, 0, 16, 1024); +// memdump((uint8_t*)pSrc32, 0, 16, size); +// memdump((uint8_t*)0x40000000, 0, 16, 1024); // Memtest END // ---------------------------------------------------------- @@ -1020,42 +1020,42 @@ int Test16_MemTest(void) int main (void) { int result, i, j, cnt, size; - UINT32 volatile *pUART_baud = (UINT32*)SYS_UART_BAUD; - UINT32 volatile *pUART_stat = (UINT32*)SYS_UART_STAT; - UINT32 volatile *pGPIO = (UINT32*)SYS_GPIO_0_DATA; - UINT32 volatile *pReg_usec = (UINT32*)SYS_TIMER_USEC; - UINT32 volatile *pReg_sec = (UINT32*)SYS_TIMER_SEC; - UINT32 volatile *pSSRAM = (UINT32*)SYS_SSRAM_IO; - UINT32 volatile *pTim_ctrl = (UINT32*)SYS_ITIM_CTRL; - UINT32 volatile *pTim_stat = (UINT32*)SYS_ITIM_STAT; - UINT32 volatile *pTim0_cnt = (UINT32*)SYS_ITIM0_CNT; - UINT32 volatile *pTim0_cmp = (UINT32*)SYS_ITIM0_CMP; - UINT32 volatile *pTim1_cnt = (UINT32*)SYS_ITIM1_CNT; - UINT32 volatile *pTim1_cmp = (UINT32*)SYS_ITIM1_CMP; - UINT32 volatile *pVGA_cgcol = (UINT32*)SYS_VGA_CGCOL; - UINT32 *pFlashPicture = (UINT32*)(SYS_FLASH_MEM + 0x00600000); + uint32_t volatile *pUART_baud = (uint32_t*)SYS_UART_BAUD; + uint32_t volatile *pUART_stat = (uint32_t*)SYS_UART_STAT; + uint32_t volatile *pGPIO = (uint32_t*)SYS_GPIO_0_DATA; + uint32_t volatile *pReg_usec = (uint32_t*)SYS_TIMER_USEC; + uint32_t volatile *pReg_sec = (uint32_t*)SYS_TIMER_SEC; + uint32_t volatile *pSSRAM = (uint32_t*)SYS_SSRAM_IO; + uint32_t volatile *pTim_ctrl = (uint32_t*)SYS_ITIM_CTRL; + uint32_t volatile *pTim_stat = (uint32_t*)SYS_ITIM_STAT; + uint32_t volatile *pTim0_cnt = (uint32_t*)SYS_ITIM0_CNT; + uint32_t volatile *pTim0_cmp = (uint32_t*)SYS_ITIM0_CMP; + uint32_t volatile *pTim1_cnt = (uint32_t*)SYS_ITIM1_CNT; + uint32_t volatile *pTim1_cmp = (uint32_t*)SYS_ITIM1_CMP; + uint32_t volatile *pVGA_cgcol = (uint32_t*)SYS_VGA_CGCOL; + uint32_t *pFlashPicture = (uint32_t*)(SYS_FLASH_MEM + 0x00600000); - UINT32 volatile *pVGA_src0 = (UINT32*)SYS_VGA_BLIT_SRC0_ADDR; - UINT32 volatile *pVGA_dst = (UINT32*)SYS_VGA_BLIT_DST_ADDR; - UINT32 volatile *pVGA_dimx_src0 = (UINT32*)SYS_VGA_BLIT_SRC0_DIMX; - UINT32 volatile *pVGA_dimx_dst = (UINT32*)SYS_VGA_BLIT_DST_DIMX; - UINT32 volatile *pVGA_nx = (UINT32*)SYS_VGA_BLIT_NX; - UINT32 volatile *pVGA_ny = (UINT32*)SYS_VGA_BLIT_NY; - UINT32 volatile *pVGA_ctrl = (UINT32*)SYS_VGA_CTRL; - UINT32 volatile *pVGA_moffs_0 = (UINT32*)SYS_VGA_FB_FRONT; - UINT32 volatile *pVGA_const_color = (UINT32*)SYS_VGA_BLIT_COLOR; - UINT32 screen_res_x, screen_res_y, screen_fps; - UINT64 *pBuf64_0, *pBuf64_1; + uint32_t volatile *pVGA_src0 = (uint32_t*)SYS_VGA_BLIT_SRC0_ADDR; + uint32_t volatile *pVGA_dst = (uint32_t*)SYS_VGA_BLIT_DST_ADDR; + uint32_t volatile *pVGA_dimx_src0 = (uint32_t*)SYS_VGA_BLIT_SRC0_DIMX; + uint32_t volatile *pVGA_dimx_dst = (uint32_t*)SYS_VGA_BLIT_DST_DIMX; + uint32_t volatile *pVGA_nx = (uint32_t*)SYS_VGA_BLIT_NX; + uint32_t volatile *pVGA_ny = (uint32_t*)SYS_VGA_BLIT_NY; + uint32_t volatile *pVGA_ctrl = (uint32_t*)SYS_VGA_CTRL; + uint32_t volatile *pVGA_moffs_0 = (uint32_t*)SYS_VGA_FB_FRONT; + uint32_t volatile *pVGA_const_color = (uint32_t*)SYS_VGA_BLIT_COLOR; + uint32_t screen_res_x, screen_res_y, screen_fps; + uint64_t *pBuf64_0, *pBuf64_1; time_t curr_date; struct tm *pDate, date; - UINT32 start, end; + uint32_t start, end; char sel[80]; struct timeval time_sec; - UINT32 *pPic; + uint32_t *pPic; - pPic = (UINT32*)malloc(800*600*sizeof(UINT32)); - memcpy(pPic, pFlashPicture, 800*600*sizeof(UINT32)); + pPic = (uint32_t*)malloc(800*600*sizeof(uint32_t)); + memcpy(pPic, pFlashPicture, 800*600*sizeof(uint32_t)); g_cnt = 1; Screen_clr(); @@ -1141,9 +1141,9 @@ int main (void) Test16_MemTest(); - printf("pf = %08X\n", (UINT32)pf()); + printf("pf = %08X\n", (uint32_t)pf()); *pf() = 0x1234; - printf("*pf = %08X\n", (UINT32)*pf()); + printf("*pf = %08X\n", (uint32_t)*pf()); box_create(&box, 32, 32); GFX_init(&gfx); @@ -1151,7 +1151,7 @@ int main (void) start = clock(); for (i=0; i < 10000; i++) { - GFX_box_draw_direct(&gfx, &box, (UINT32)rand()%800, (UINT32)rand()%600, (UINT32)rand()); + GFX_box_draw_direct(&gfx, &box, (uint32_t)rand()%800, (uint32_t)rand()%600, (uint32_t)rand()); } end = clock(); diff --git a/src/ucb.c b/src/ucb.c index 8471c03..05a9f3c 100644 --- a/src/ucb.c +++ b/src/ucb.c @@ -1,9 +1,9 @@ #include "libsys.h" #include "gpio.h" -int uncached_cachemiss_bug(UINT32* pMem) +int uncached_cachemiss_bug(uint32_t* pMem) { - UINT32 result; + uint32_t result; pMem[0] = 0x12345678; pMem[1] = 0xFFFFFFFF; @@ -34,7 +34,7 @@ int uncached_cachemiss_bug(UINT32* pMem) int main() { - UINT32 volatile *pLed = (UINT32*)SYS_GPIO_0_BASE; + uint32_t volatile *pLed = (uint32_t*)SYS_GPIO_0_BASE; int buf[256], res; res = uncached_cachemiss_bug(buf);