comparison nuc-fw/bsp/inth.c @ 93:45911ad957fd

nuc-fw: beginning to integrate TI's BSP code
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Sat, 31 Aug 2013 23:43:23 +0000
parents
children
comparison
equal deleted inserted replaced
92:f459043fae0c 93:45911ad957fd
1 /*******************************************************************************
2 TEXAS INSTRUMENTS INCORPORATED PROPRIETARY INFORMATION
3
4 Property of Texas Instruments -- For Unrestricted Internal Use Only
5 Unauthorized reproduction and/or distribution is strictly prohibited. This
6 product is protected under copyright law and trade secret law as an
7 unpublished work. Created 1987, (C) Copyright 1997 Texas Instruments. All
8 rights reserved.
9
10
11 Filename : inth.c
12
13 Description : inth.c saturn interupt handler
14
15 Project : drivers
16
17 Author : pmonteil@tif.ti.com Patrice Monteil.
18
19 Version number : 1.8
20
21 Date and time : 01/30/01 10:22:26
22
23 Previous delta : 12/19/00 14:39:21
24
25 SCCS file : /db/gsm_asp/db_ht96/dsp_0/gsw/rel_0/mcu_l1/release_gprs/RELEASE_GPRS/drivers1/common/SCCS/s.inth.c
26
27 Sccs Id (SID) : '@(#) inth.c 1.8 01/30/01 10:22:26 '
28
29
30 *****************************************************************************/
31
32 #include "../include/config.h"
33 #include "../include/sys_types.h"
34
35 #include "mem.h"
36 #include "inth.h"
37
38
39
40
41 /*---------------------------------------------------------------/
42 /* INTH_Ack() */
43 /*--------------------------------------------------------------*/
44 /* Parameters : num of it */
45 /* Return : none */
46 /* Functionality :Acknowledge an interrupt and return the origin*/
47 /* of the interrupt (binary format) */
48 /*--------------------------------------------------------------*/
49
50 SYS_UWORD16 INTH_Ack (int intARM)
51 {
52 if (intARM == INTH_IRQ)
53 return((* (volatile SYS_UWORD16 *) INTH_B_IRQ_REG) & INTH_SRC_NUM);
54 else
55 return((* (volatile SYS_UWORD16 *) INTH_B_FIQ_REG) & INTH_SRC_NUM);
56 }
57
58 /*---------------------------------------------------------------/
59 /* INTH_GetPending() */
60 /*--------------------------------------------------------------*/
61 /* Parameters : none */
62 /* Return : none */
63 /* Functionality : Return the pending interrupts */
64 /*--------------------------------------------------------------*/
65
66 #if ((CHIPSET == 4) || (CHIPSET == 5) || (CHIPSET == 6) || (CHIPSET == 7) || (CHIPSET == 8) || (CHIPSET == 9) || (CHIPSET == 10) || (CHIPSET == 11) || (CHIPSET == 12))
67 unsigned long INTH_GetPending (void)
68 {
69 return((unsigned long)((* (volatile SYS_UWORD16 *) INTH_IT_REG1) |
70 ((* (volatile SYS_UWORD16 *) INTH_IT_REG2) << 16)));
71 }
72 #else
73 unsigned short INTH_GetPending (void)
74 {
75 return(* (volatile SYS_UWORD16 *) INTH_IT_REG);
76 }
77 #endif
78
79 /*---------------------------------------------------------------/
80 /* INTH_InitLevel() */
81 /*--------------------------------------------------------------*/
82 /* Parameters : num it,FIQ/IRQ,priority level,edge/level. */
83 /* Return : none */
84 /* Functionality : Initialize an interrupt */
85 /* - put it on IRQ or FIQ */
86 /* - set its priority level */
87 /* */
88 /*--------------------------------------------------------------*/
89
90 void INTH_InitLevel (int inputInt, int FIQ_nIRQ, int priority, int edge)
91 {
92 volatile SYS_UWORD16 *inthLevelReg = (SYS_UWORD16 *) INTH_EXT_REG;
93
94 inthLevelReg = inthLevelReg + inputInt;
95
96 #if ((CHIPSET == 4) || (CHIPSET == 5) || (CHIPSET == 6) || (CHIPSET == 7) || (CHIPSET == 8) || (CHIPSET == 9) || (CHIPSET == 10) || (CHIPSET == 11) || (CHIPSET == 12))
97 *inthLevelReg = (FIQ_nIRQ | (edge << 1) | (priority << 2));
98 #else
99 *inthLevelReg = (FIQ_nIRQ | (priority << 1) | (edge << 5));
100 #endif
101 }
102
103 /*---------------------------------------------------------------/
104 /* INTH_ResetIT() */
105 /*--------------------------------------------------------------*/
106 /* Parameters : none */
107 /* Return : none */
108 /* Functionality : reset the inth it register */
109 /*--------------------------------------------------------------*/
110
111 #if ((CHIPSET == 4) || (CHIPSET == 5) || (CHIPSET == 6) || (CHIPSET == 7) || (CHIPSET == 8) || (CHIPSET == 9) || (CHIPSET == 10) || (CHIPSET == 11) || (CHIPSET == 12))
112 unsigned long INTH_ResetIT (void)
113 {
114 * (volatile SYS_UWORD16 *) INTH_IT_REG1 &= 0x0000;
115 * (volatile SYS_UWORD16 *) INTH_IT_REG2 &= 0x0000;
116 return((unsigned long)((* (volatile SYS_UWORD16 *) INTH_IT_REG1) |
117 ((* (volatile SYS_UWORD16 *) INTH_IT_REG2) << 16)));
118 }
119 #else
120 unsigned short INTH_ResetIT (void)
121 {
122 * (volatile SYS_UWORD16 *) INTH_IT_REG &= 0x0000;
123 return(* (volatile SYS_UWORD16 *) INTH_IT_REG);
124 }
125 #endif