XINU
platinit.c
Go to the documentation of this file.
1 /* platinit.c - platinit */
2 
3 #include <xinu.h>
4 
5 /*------------------------------------------------------------------------
6  * counterinit - Initialize the ARM performance counters
7  *------------------------------------------------------------------------
8  */
9 void counterinit()
10 {
11  /* Program the performance-counter control-register: */
12  /* Enable all counters: */
13  asm volatile ("MCR p15, 0, %0, c9, c12, 0\t\n" :: "r"
14  (0x00000011));
15 
16  /* Program the count enable set control-register: */
17  /* Enable all counters: */
18  asm volatile ("MCR p15, 0, %0, c9, c12, 1\t\n" :: "r"
19  (0x80000003));
20 
21  /* Program the overflow flag status-register: */
22  /* Clear overflows: */
23  asm volatile ("MCR p15, 0, %0, c9, c12, 3\t\n" :: "r"
24  (0x80000003));
25 }
26 
27 /*------------------------------------------------------------------------
28  * platinit - platform specific initialization for BeagleBone Black
29  *------------------------------------------------------------------------
30  */
31 void platinit(void)
32 {
33 
34  struct uart_csreg *uptr; /* Address of UART's CSRs */
35  struct watchdog_csreg *wdtptr; /* Watchdog registers */
36 
37  /* Disable the watchdog timer */
38 
39  wdtptr = (struct watchdog_csreg *)WDTADDR;
40  wdtptr->wspr = 0x0000aaaa;
41  while(wdtptr->wwps & 0x00000010);
42  wdtptr->wspr = 0x00005555;
43  while(wdtptr->wwps & 0x00000010);
44 
45  /* Initialize the Interrupt Controller */
46 
47  initintc();
48 
49  /* Initialize the Performance Counters */
50 
51  counterinit();
52 
53  /* Pad control for CONSOLE */
54 
59 
60  /* Reset the UART device */
61 
62  uptr = (struct uart_csreg *)devtab[CONSOLE].dvcsr;
63  uptr->sysc |= UART_SYSC_SOFTRESET;
64  while((uptr->syss & UART_SYSS_RESETDONE) == 0);
65 }
volatile uint32 wspr
開始/終了レジスタ
#define UART0_PADRX_ADDR
Definition: uart.h:126
volatile uint32 wwps
ポストBitレジスタの書き込み
void counterinit()
Definition: platinit.c:9
#define UART0_PADTX_ADDR
Definition: uart.h:127
全てのシステムヘッダファイルをインクルードする。
int32 initintc(void)
Definition: evec.c:18
#define CONSOLE
Definition: conf.h:28
void platinit(void)
Definition: platinit.c:31
#define AM335X_PADCTL_TX
出力限定モード
struct dentry devtab[]
Definition: conf.c:11
#define UART0_PADRX_MODE
Definition: uart.h:128
#define am335x_padctl(addr, val)
引数で指定されたアドレスに値を代入する。
Watchdog CSREG(制御/状態)レジスタ操作用の構造体
#define UART0_PADTX_MODE
Definition: uart.h:129
volatile uint32 syss
Definition: uart.h:28
#define AM335X_PADCTL_RXTX
入力モードもしくは出力モード
#define WDTADDR
Watchdogタイマに割り当てられたアドレス
#define UART_SYSS_RESETDONE
Definition: uart.h:119
volatile uint32 sysc
Definition: uart.h:27
#define UART_SYSC_SOFTRESET
Definition: uart.h:115