- initial import

git-svn-id: http://moon:8086/svn/mips@1 a8ebac50-d88d-4704-bea3-6648445a41b3
This commit is contained in:
2014-07-20 15:01:37 +00:00
commit 26291bca3d
1549 changed files with 3997969 additions and 0 deletions
+71
View File
@@ -0,0 +1,71 @@
#include <stdlib.h>
#include <stdio.h>
#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;
}