#include #include #include "libsys.h" void _dcache_rw (void) { __asm __volatile__ ( ".set noreorder\n" " 1:\t li $t0, 0x40010000\n" " li $t1, 0x00000000\n" " li $t2, 0xA0000000\n" " 2:\t lw $v0, 0($t0)\n" " addiu $t0, 4\n" " sw $t1, 0($t0)\n" " lw $v1, 0($t0)\n" " sw $v0, 0($t2)\n" " nop\n" " nop\n" " nop\n" " sw $t1, 0($t0)\n" " lw $v1, 4($t0)\n" " nop\n" " nop\n" " nop\n" " sh $t1, 0($t0)\n" " lw $v1, 4($t0)\n" " nop\n" " nop\n" " nop\n" " sb $t1, 0($t0)\n" " lw $v1, 4($t0)\n" " bne $t0, 0x40110000, 2b\n" " addiu $t1, 1\n" " j 1b\n" " nop\n" ".set reorder\n" ); } int main(void) { int buf[256]; volatile int *pLED = (int*)sys_led_port; volatile char *pLED8 = (char*)sys_led_port; volatile char *pGPIO = (char*)sys_gpio1; char buf8[4]; int i; *(pLED8+0) = 0x12; *(pLED8+1) = 0x34; *(pLED8+2) = 0x56; *(pLED8+3) = 0x78; buf8[0] = *(pLED8+0); buf8[1] = *(pLED8+1); buf8[2] = *(pLED8+2); buf8[3] = *(pLED8+3); *(pGPIO+0) = buf8[0]; *(pGPIO+1) = buf8[1]; *(pGPIO+2) = buf8[2]; *(pGPIO+3) = buf8[3]; *pLED = *((int*)pGPIO); _dcache_rw(); return 0; }