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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [freertos-6.1.1/] [Demo/] [HCS12_CodeWarrior_banked/] [CODE/] [PE_Timer.C] - Blame information for rev 794

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

Line No. Rev Author Line
1 588 jeremybenn
/** ###################################################################
2
**     THIS BEAN MODULE IS GENERATED BY THE TOOL. DO NOT MODIFY IT.
3
**     Filename  : PE_Timer.C
4
**     Project   : RTOSDemo
5
**     Processor : MC9S12DP256BCPV
6
**     Beantype  : PE_Timer
7
**     Version   : Driver 01.00
8
**     Compiler  : Metrowerks HC12 C Compiler
9
**     Date/Time : 14/06/2005, 16:34
10
**     Abstract  :
11
**         This bean "PE_Timer" implements internal methods and definitions
12
**         used by beans working with timers.
13
**     Settings  :
14
**     Contents  :
15
**         No public methods
16
**
17
**     (c) Copyright UNIS, spol. s r.o. 1997-2002
18
**     UNIS, spol. s r.o.
19
**     Jundrovska 33
20
**     624 00 Brno
21
**     Czech Republic
22
**     http      : www.processorexpert.com
23
**     mail      : info@processorexpert.com
24
** ###################################################################*/
25
 
26
 
27
/* MODULE PE_Timer. */
28
 
29
#include "PE_Timer.h"
30
 
31
 
32
 
33
typedef unsigned long UINT32;
34
 
35
typedef union {
36
  UINT32 val;
37
  struct {
38
    unsigned short hi16,lo16;
39
  } s;
40
} OP_UINT32;
41
 
42
typedef struct {
43
  unsigned short dummy;
44
  UINT32 mid;
45
} M_UINT32;
46
 
47
typedef struct {
48
  UINT32 hi32, lo32;
49
} UINT64;
50
 
51
typedef union {
52
  UINT64 val;
53
  M_UINT32 m;
54
} OP_UINT64;
55
 
56
/*
57
** ===================================================================
58
**     Method      :  PE_Timer_LngMul (bean PE_Timer)
59
**
60
**     Description :
61
**         This method is internal. It is used by Processor Expert
62
**         only.
63
** ===================================================================
64
*/
65
void PE_Timer_LngMul(dword va1, dword va2, dlong *var)
66
{
67
  OP_UINT32 *va = (OP_UINT32*)&va1;
68
  OP_UINT32 *vb = (OP_UINT32*)&va2;
69
  OP_UINT64 *vr = (OP_UINT64*)var;
70
 
71
  vr->val.hi32 = 0UL;
72
  vr->val.lo32 = ((UINT32)va->s.lo16)*((UINT32)vb->s.lo16);
73
  {
74
    OP_UINT32 tmp;
75
 
76
    tmp.val = ((UINT32)va->s.lo16)*((UINT32)vb->s.hi16);
77
    vr->m.mid += (UINT32)tmp.s.lo16;
78
    vr->val.hi32 += (UINT32)tmp.s.hi16;
79
  }
80
  {
81
    OP_UINT32 tmp;
82
 
83
    tmp.val = ((UINT32)va->s.hi16)*((UINT32)vb->s.lo16);
84
    vr->m.mid += (UINT32)tmp.s.lo16;
85
    vr->val.hi32 += (UINT32)tmp.s.hi16;
86
  }
87
  vr->val.hi32 += ((UINT32)va->s.hi16)*((UINT32)vb->s.hi16);
88
}
89
 
90
/*
91
** ===================================================================
92
**     Method      :  PE_Timer_LngHi1 (bean PE_Timer)
93
**
94
**     Description :
95
**         This method is internal. It is used by Processor Expert
96
**         only.
97
** ===================================================================
98
*/
99
bool PE_Timer_LngHi1(dword High, dword Low, word *Out)
100
{
101
  if ((High == 0) && ((Low >> 24) == 0))
102
    if ((Low & 0x80) != 0) {
103
      if ((Low >> 8) < 0xFFFF) {
104
        *Out = ((unsigned int)(Low >> 8))+1;
105
        return FALSE;
106
      }
107
    }
108
    else {
109
      *Out = (unsigned int)(Low >> 8);
110
      return FALSE;
111
    }
112
  *Out = (unsigned int)(Low >> 8);
113
  return TRUE;
114
}
115
 
116
/*
117
** ===================================================================
118
**     Method      :  PE_Timer_LngHi2 (bean PE_Timer)
119
**
120
**     Description :
121
**         This method is internal. It is used by Processor Expert
122
**         only.
123
** ===================================================================
124
*/
125
bool PE_Timer_LngHi2(dword High, dword Low, word *Out)
126
{
127
  if (High == 0)
128
    if ((Low & 0x8000) != 0) {
129
      if ((Low >> 16) < 0xFFFF) {
130
        *Out = ((unsigned int)(Low >> 16))+1;
131
        return FALSE;
132
      }
133
    }
134
    else {
135
      *Out = (unsigned int)(Low >> 16);
136
      return FALSE;
137
    }
138
  *Out = (unsigned int)(Low >> 16);
139
  return TRUE;
140
}
141
 
142
/*
143
** ===================================================================
144
**     Method      :  PE_Timer_LngHi3 (bean PE_Timer)
145
**
146
**     Description :
147
**         This method is internal. It is used by Processor Expert
148
**         only.
149
** ===================================================================
150
*/
151
bool PE_Timer_LngHi3(dword High, dword Low, word *Out)
152
{
153
  if ((High >> 8) == 0)
154
    if ((Low & 0x800000) != 0) {
155
      if (((Low >> 24) | (High << 8)) < 0xFFFF) {
156
        *Out = ((unsigned int)((Low >> 24) | (High << 8)))+1;
157
        return FALSE;
158
      }
159
    }
160
    else {
161
      *Out = (unsigned int)((Low >> 24) | (High << 8));
162
      return FALSE;
163
    }
164
  *Out = (unsigned int)((Low >> 24) | (High << 8));
165
  return TRUE;
166
}
167
 
168
/*
169
** ===================================================================
170
**     Method      :  PE_Timer_LngHi4 (bean PE_Timer)
171
**
172
**     Description :
173
**         This method is internal. It is used by Processor Expert
174
**         only.
175
** ===================================================================
176
*/
177
bool PE_Timer_LngHi4(dword High, dword Low, word *Out)
178
{
179
  if ((High >> 16) == 0)
180
    if ((Low & 0x80000000) != 0) {
181
      if (High < 0xFFFF) {
182
        *Out = ((unsigned int)High)+1;
183
        return FALSE;
184
      }
185
    }
186
    else {
187
      *Out = (unsigned int)High;
188
      return FALSE;
189
    }
190
  *Out = (unsigned int)High;
191
  return TRUE;
192
}
193
 
194
 
195
 
196
/* END PE_Timer. */
197
 
198
/*
199
** ###################################################################
200
**
201
**     This file was created by UNIS Processor Expert 03.33 for
202
**     the Motorola HCS12 series of microcontrollers.
203
**
204
** ###################################################################
205
*/

powered by: WebSVN 2.1.0

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