Cypress DCT-1D Podręcznik Użytkownika Strona 22

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 82
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 21
22
CHAPTER 1. THE SYST EM
Listing 1.5: Program showing contents of a special purpose register.
# i n c l u d e < s y s / t y p e s . h>
# i n c l u d e < s y s / s t a t . h>
# i n c l u d e <asm / i o . h>
# i n c l u d e <asm / s p r _ d e f s . h>
# i n c l u d e <asm / b o a r d . h>
i n t main ( i n t a rg c , char a r g v [ ] )
{
unsigned lo n g v al , a d d r ;
i f ( a r g c == 2) {
a d d r = s t r t o u l ( ar g v [ 1 ] , 0 , 0 ) ;
/ Read SPR /
asm ( "l.mfspr%0 ,%1,0" : "=r" ( v a l ) : "r" ( a d d r ) ) ;
p r i n t f ( "\nSPR%04lx:%08lx\n" , ad d r , v a l ) ;
} e l s e re t u r n 1;
re t u r n 0 ;
}
Listing 1.6: Makefile to compile the program s howing an SPR (Listing 1.5).
CC = or32u c l i b c g c c
STRIP = or3 2u c l i b c s t r i p
PRGS = m f s pr
a l l : $ (PRGS)
mfs p r : mf s p r . o
$ (CC) r d m f s pr . o o $@
$ ( STRIP ) g $@
Finally the program can be downloaded with tftp. Change directory (cd) to a
writable portion of the filesystem, like for instance /var/tmp. Then start the tftp
client
> tftp IP_address_of_your_tftp_server
Retrieve the program:
> get mfspr
See section 4.3.2 for more information on how to start the TFTP server.
Przeglądanie stron 21
1 2 ... 17 18 19 20 21 22 23 24 25 26 27 ... 81 82

Komentarze do niniejszej Instrukcji

Brak uwag