OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [rtos/] [freertos-6.1.1/] [Demo/] [ColdFire_MCF52259_CodeWarrior/] [cpu/] [mcf5225x.c] - Blame information for rev 578

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 jeremybenn
/*
2
 * File:                mcf52xx.c
3
 * Purpose:             Source to select CF derivative
4
 *
5
 * Notes:
6
 *
7
 * License:     All software covered by license agreement in -
8
 *              docs/Freescale_Software_License.pdf
9
 */
10
/********************************************************************/
11
 
12
#include "common.h"
13
 
14
/********************************************************************/
15
/*
16
 * Pause for the specified number of micro-seconds.
17
 * Uses DTIM3 as a timer
18
 */
19
void
20
cpu_pause(int usecs)
21
{
22
    /* Enable the DMA Timer 3 */
23
    MCF_DTIM3_DTRR = (vuint32)(usecs - 1);
24
    MCF_DTIM3_DTER = MCF_DTIM_DTER_REF;
25
    MCF_DTIM3_DTMR = 0
26
        | MCF_DTIM_DTMR_PS(SYSTEM_CLOCK)
27
        | MCF_DTIM_DTMR_FRR
28
        | MCF_DTIM_DTMR_CLK_DIV1
29
        | MCF_DTIM_DTMR_RST;
30
 
31
    while ((MCF_DTIM3_DTER & MCF_DTIM_DTER_REF) == 0)
32
    {};
33
 
34
    /* Disable the timer */
35
    MCF_DTIM3_DTMR = 0;
36
}
37
 
38
/********************************************************************/
39
void
40
board_handle_interrupt (int vector)
41
{
42
    switch (vector)
43
    {
44
        case 65: /* Eport Interrupt 1 */
45
            printf("SW2\n");
46
            MCF_EPORT_EPFR = MCF_EPORT_EPFR_EPF1;
47
            break;
48
        case 69: /* Eport Interrupt 5 */
49
            printf("SW1\n");
50
            MCF_EPORT_EPFR = MCF_EPORT_EPFR_EPF5;
51
            break;
52
        case 71: /* Eport Interrupt 7 */
53
            printf("ABORT\n");
54
            MCF_EPORT_EPFR = MCF_EPORT_EPFR_EPF7;
55
            break;
56
        case 66: /* Eport Interrupt 2 */
57
        case 67: /* Eport Interrupt 3 */
58
        case 68: /* Eport Interrupt 4 */
59
        case 70: /* Eport Interrupt 6 */
60
        default:
61
            MCF_EPORT_EPFR = (uint8)(0x01 << (vector - 64));
62
            printf("Edge Port Interrupt #%d\n",vector - 64);
63
            break;
64
    }
65
}
66
/********************************************************************/
67
 
68
/********************************************************************/
69
void
70
cpu_handle_interrupt (int vector)
71
{
72
    if (vector < 64 || vector > 192)
73
        return;
74
 
75
    if (vector >= 64 && vector <= 71)
76
        board_handle_interrupt(vector);
77
    else
78
        printf("User Defined Vector #%d\n",vector);
79
}
80
/********************************************************************/
81
 

powered by: WebSVN 2.1.0

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