/* * char_rom_axi_lite_test.c * * Created on: 2012/06/17 * Author: Masaaki */
#include "xbasic_types.h"
#include "xio.h"
#include "mb_interface.h"
#include "xparameters.h"
#include "stdio.h"
int main()
{
unsigned char c;
unsigned char hex_char[20];
unsigned int addr, cr_data;
int j;
for(;;){
xil_printf("Please input Character ROM Address ");
for(j=0; j<19; j++){
c = getc(stdin);
if (c == '\r'){
hex_char[j] = c;
break;
}else
hex_char[j] = c; // 文字列に代入
}
addr = 0;
for(j=0; j<19; j+=2){ // 文字の解析
if (hex_char[j] == '\r')
break;
else{
addr = addr << 4; // 4ビット左シフト
if (hex_char[j]>=0x30 && hex_char[j]<=0x39) // 数字
addr += hex_char[j] - 0x30;
else if (hex_char[j]>=0x41 && hex_char[j]<=0x46) // A ~ F
addr += hex_char[j] - 0x41 + 10;
else if (hex_char[j]>=0x61 && hex_char[j]<=0x66) // a ~ f
addr += hex_char[j] - 0x61 + 10;
}
}
xil_printf("\n");
cr_data = *(volatile unsigned int *)(XPAR_CHAR_ROM_AXI_LITE_0_S_AXI_RNG00_BASEADDR+addr);
xil_printf("Character ROM Data = %x\n", cr_data);
}
}
日 | 月 | 火 | 水 | 木 | 金 | 土 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 | - | - | - | - |