OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [freertos-6.1.1/] [Demo/] [uIP_Demo_IAR_ARM7/] [SrcIAR/] [dbgu.c] - Blame information for rev 598

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 583 jeremybenn
//*----------------------------------------------------------------------------
2
//*         ATMEL Microcontroller Software Support  -  ROUSSET  -
3
//*----------------------------------------------------------------------------
4
//* The software is delivered "AS IS" without warranty or condition of any
5
//* kind, either express, implied or statutory. This includes without
6
//* limitation any warranty or condition with respect to merchantability or
7
//* fitness for any particular purpose, or against the infringements of
8
//* intellectual property rights of others.
9
//*----------------------------------------------------------------------------
10
//* File Name           : dbgu.c
11
//* Object              : DBGU routines written in C
12
//* Creation            : JG   16/Aug/2004
13
//*----------------------------------------------------------------------------
14
 
15
// Include Standard files
16
#include "Board.h"
17
 
18
//*--------------------------1--------------------------------------------------
19
//* \fn    AT91F_DBGU_Printk
20
//* \brief This function is used to send a string through the DBGU channel (Very low level debugging)
21
//*----------------------------------------------------------------------------
22
void AT91F_DBGU_Printk( char *buffer)
23
{
24
    AT91PS_DBGU pDbgu = AT91C_BASE_DBGU ;
25
    unsigned int temp;
26
 
27
    while(*buffer != '\0')
28
    {
29
        temp=0;
30
 
31
        while (temp==0)
32
        {
33
          if ( (pDbgu->DBGU_CSR & 0x0200) == 0)
34
            temp=0;
35
          else
36
            temp=1;
37
        }
38
 
39
        pDbgu->DBGU_THR = *buffer;
40
        buffer++;
41
    }
42
}
43
 
44
 
45
void Init_DBGU_CLK(void)
46
{
47
  AT91F_PMC_EnablePeriphClock(AT91C_BASE_PMC, ((unsigned int) 1 << AT91C_ID_SYS));
48
}
49
 
50
void Init_DBGU_BGR(unsigned short baud)
51
{
52
  AT91PS_DBGU pDbgu = AT91C_BASE_DBGU ;
53
 
54
  pDbgu->DBGU_BRGR = (unsigned short)baud;
55
}
56
 
57
void DBGU_TX_Enable(void)
58
{
59
  AT91PS_DBGU pDbgu = AT91C_BASE_DBGU ;
60
 
61
  pDbgu->DBGU_CR = 0x00000040;
62
}
63
 
64
void DBGU_RX_Enable(void)
65
{
66
  AT91PS_DBGU pDbgu = AT91C_BASE_DBGU ;
67
 
68
  pDbgu->DBGU_CR = 0x00000010;
69
}
70
 
71
void DBGU_RX_TX_RST_DIS(void)
72
{
73
  AT91PS_DBGU pDbgu = AT91C_BASE_DBGU ;
74
  pDbgu->DBGU_CR = 0x000000AC;
75
}
76
 
77
void DBGU_Parity_Cfg(unsigned int par)
78
{
79
  AT91PS_DBGU pDbgu = AT91C_BASE_DBGU ;
80
 
81
  pDbgu->DBGU_MR = par << 9;
82
}
83
 
84
 
85
void Init_DBGU(void)
86
{
87
  AT91F_DBGU_CfgPIO();
88
  DBGU_RX_TX_RST_DIS();
89
  Init_DBGU_BGR(26);  //26 <=> 115kBd
90
  DBGU_Parity_Cfg(4);
91
  DBGU_TX_Enable();
92
  DBGU_RX_Enable();
93
}
94
 
95
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.