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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [freertos-6.1.1/] [Demo/] [HCS12_CodeWarrior_small/] [CODE/] [Byte1.C] - Blame information for rev 588

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  : Byte1.C
4
**     Project   : RTOSDemo
5
**     Processor : MC9S12C32CFU
6
**     Beantype  : ByteIO
7
**     Version   : Bean 02.019, Driver 01.03, CPU db: 2.87.276
8
**     Compiler  : Metrowerks HC12 C Compiler
9
**     Date/Time : 10/05/2005, 11:49
10
**     Abstract  :
11
**         This bean "ByteIO" implements an one-byte input/output.
12
**         It uses one 8-bit port.
13
**         Note: This bean is set to work in Output direction only.
14
**         Methods of this bean are mostly implemented as a macros
15
**         (if supported by target langauage and compiler).
16
**     Settings  :
17
**         Port name                   : B
18
**
19
**         Initial direction           : Output (direction cannot be changed)
20
**         Initial output value        : 0 = 000H
21
**         Initial pull option         : off
22
**
23
**         8-bit data register         : PORTB     [1]
24
**         8-bit control register      : DDRB      [3]
25
**
26
**             ----------------------------------------------------
27
**                   Bit     |   Pin   |   Name
28
**             ----------------------------------------------------
29
**                    0      |    16   |   PB0_ADDR0_DATA0
30
**                    1      |    17   |   PB1_ADDR1_DATA1
31
**                    2      |    18   |   PB2_ADDR2_DATA2
32
**                    3      |    19   |   PB3_ADDR3_DATA3
33
**                    4      |    20   |   PB4_ADDR4_DATA4
34
**                    5      |    21   |   PB5_ADDR5_DATA5
35
**                    6      |    22   |   PB6_ADDR6_DATA6
36
**                    7      |    23   |   PB7_ADDR7_DATA7
37
**             ----------------------------------------------------
38
**     Contents  :
39
**         PutBit - void Byte1_PutBit(byte Bit,bool Val);
40
**         NegBit - void Byte1_NegBit(byte Bit);
41
**
42
**     (c) Copyright UNIS, spol. s r.o. 1997-2002
43
**     UNIS, spol. s r.o.
44
**     Jundrovska 33
45
**     624 00 Brno
46
**     Czech Republic
47
**     http      : www.processorexpert.com
48
**     mail      : info@processorexpert.com
49
** ###################################################################*/
50
 
51
 
52
/* MODULE Byte1. */
53
 
54
#include "Byte1.h"
55
/*Including shared modules, which are used for all project*/
56
#include "PE_Types.h"
57
#include "PE_Error.h"
58
#include "PE_Const.h"
59
#include "IO_Map.h"
60
 
61
#include "Cpu.h"
62
 
63
/* Definition of DATA and CODE segments for this bean. User can specify where
64
   these segments will be located on "Build options" tab of the selected CPU bean. */
65
#pragma DATA_SEG Byte1_DATA            /* Data section for this module. */
66
#pragma CODE_SEG Byte1_CODE            /* Code section for this module. */
67
 
68
/*
69
** ===================================================================
70
**     Method      :  Byte1_GetMsk (bean ByteIO)
71
**
72
**     Description :
73
**         This method is internal. It is used by Processor Expert
74
**         only.
75
** ===================================================================
76
*/
77
byte Byte1_Table[8]={ 1, 2, 4, 8, 16, 32, 64, 128 }; /* Table of mask constants */
78
 
79
byte Byte1_GetMsk(byte Value)
80
{
81
  return((Value<8)?Byte1_Table[Value]:0); /* Return appropriate bit mask */
82
}
83
 
84
/*
85
** ===================================================================
86
**     Method      :  Byte1_PutBit (bean ByteIO)
87
**
88
**     Description :
89
**         This method writes the new value to the specified bit
90
**         of the output value.
91
**     Parameters  :
92
**         NAME       - DESCRIPTION
93
**         Bitnum     - Number of the bit (0 to 7)
94
**         Val        - New value of the bit (FALSE or TRUE)
95
**                      FALSE = "0" or "Low", TRUE = "1" or "High"
96
**     Returns     : Nothing
97
** ===================================================================
98
*/
99
void Byte1_PutBit(byte BitNum, byte Value)
100
{
101
  byte Mask=Byte1_GetMsk(BitNum);      /* Temporary variable - bit mask */
102
 
103
  if (Mask)                            /* Is bit mask correct? */
104
    if (Value) {                       /* Is it one to be written? */
105
      PORTB |= Mask;                   /* Set appropriate bit on port */
106
    }
107
    else {                             /* Is it zero to be written? */
108
      PORTB &= ~Mask;                  /* Clear appropriate bit on port */
109
    }
110
}
111
 
112
/*
113
** ===================================================================
114
**     Method      :  Byte1_NegBit (bean ByteIO)
115
**
116
**     Description :
117
**         This method negates (invertes) the specified bit of the
118
**         output value.
119
**     Parameters  :
120
**         NAME       - DESCRIPTION
121
**         Bit        - Number of the bit to invert (0 to 7)
122
**     Returns     : Nothing
123
** ===================================================================
124
*/
125
void Byte1_NegBit(byte BitNum)
126
{
127
  byte Mask=Byte1_GetMsk(BitNum);      /* Temporary variable - bit mask */
128
 
129
  if (Mask) {                          /* Is bit mask correct? */
130
    PORTB ^= Mask;                     /* Negate appropriate bit on port */
131
  }
132
}
133
 
134
 
135
/* END Byte1. */
136
 
137
/*
138
** ###################################################################
139
**
140
**     This file was created by UNIS Processor Expert 03.33 for
141
**     the Motorola HCS12 series of microcontrollers.
142
**
143
** ###################################################################
144
*/

powered by: WebSVN 2.1.0

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