'개인/ㄴFROMA'에 해당되는 글 3건

  1. 2013.11.10 노트북에서 make upload permission denied
  2. 2013.06.28 UART Arrow Key Code
  3. 2013.06.20 FROMA UART Debug Code

UART Arrow Key Code

Posted in 개인/ㄴFROMA by

http://www.termsys.demon.co.uk/vtansi.htm

http://electronics.stackexchange.com/questions/8874/is-it-possible-to-send-characters-through-serial-to-go-up-a-line-on-the-console


Use VT100 escape codes to control the cursor.

Eg.

puts("\033[2J");   // clear screen
puts("\033[0;0H"); // set cursor to 0,0
puts("\033[10B");  // move cursor down 10 lines
puts("\033[5A");  // move cursor up 5 lines


FROMA UART Debug Code

Posted in 개인/ㄴFROMA by

FROMA 개발 시 디버깅 목적을 위한 코드

## ASM : 특정 문자열 출력 ##

UART_SEND:
  ldr   r1,=0x48020014  // UART3 LSR
  ldr   r2,[r1]
  and   r2,r2,#0x20
  cmp   r2,#0x00
  beq   UART_SEND
  ldr   r1,=0x48020000
  mov   r2,#0x61    //r3
  str   r2,[r1]


## C : 특정 문자열 출력 ##

while((((*(volatile unsigned int *)(0x48020014))&0x20)>>5)==0);
(*(volatile unsigned int *)(0x48020000)) = 0x61;


## C : 입력한 키 값을 +1하여 반환 ##

#define REG32(addr) (*(volatile unsigned int *)(addr))

unsigned int reg=0x00;

while(1){
  while(REG32(0x48020014)&0x01==0);
  reg = REG32(0x48020000);
  
  if(reg>0){
    while((REG32(0x48020014)&0x20)>>5)==0);
    REG32(0x48020000) = reg + 1;
}