1 |
kusanagi |
1.1 |
/**************************************************************************** |
2 |
|
|
/* F i l e D a t a |
3 |
|
|
/* |
4 |
|
|
/* Module : FileManager |
5 |
|
|
/* C.I. No. : |
6 |
|
|
/* $Revision: 1.1.1.1 $ |
7 |
|
|
/* $Date: 2003/08/04 09:40:21 $ |
8 |
|
|
/* Belonging to : |
9 |
|
|
/* : |
10 |
|
|
/* $RCSfile: FD_MMSUDriver_int.c,v $ |
11 |
|
|
/* Program Type : |
12 |
|
|
/* Sub-modules : |
13 |
|
|
/* |
14 |
|
|
/**************************************************************************** |
15 |
|
|
/* S W D e v e l o p m e n t E n v i r o n m e n t |
16 |
|
|
/* |
17 |
|
|
/* Host system : |
18 |
|
|
/* SW Compiler : |
19 |
|
|
/* $Author: sebastiani $ |
20 |
|
|
/* : |
21 |
|
|
/**************************************************************************** |
22 |
|
|
/* U p d a t i n g |
23 |
|
|
/* |
24 |
|
|
/* $Log: FD_MMSUDriver_int.c,v $ |
25 |
|
|
/* Revision 1.1.1.1 2003/08/04 09:40:21 sebastiani |
26 |
|
|
/* Imported sources laben rel. 19.06.2003 integrated with pam2 |
27 |
|
|
/* |
28 |
|
|
/* Revision 1.4 2002/05/09 08:16:34 zulia |
29 |
|
|
/* * acceptance release |
30 |
|
|
/* |
31 |
|
|
/* |
32 |
|
|
/*****************************************************************************/ |
33 |
|
|
|
34 |
|
|
|
35 |
|
|
|
36 |
|
|
/*============================= Include File ================================*/ |
37 |
|
|
|
38 |
|
|
#include <src/FileManager/MMSUDriver/FD_MMSUDriver_op.h> |
39 |
|
|
#include <src/FileManager/MMSUDriver/FD_MMSUDriver_int.h> |
40 |
|
|
|
41 |
|
|
/*============================== Local Variables ============================*/ |
42 |
|
|
|
43 |
|
|
|
44 |
|
|
/*****************************************************************************/ |
45 |
|
|
|
46 |
|
|
/*======== M M S U D r i v e r I N T E R N A L F U N C T I O N S ========*/ |
47 |
|
|
|
48 |
|
|
/*****************************************************************************/ |
49 |
|
|
/* @Function: FD_ifDrammaWrWPBUSReg */ |
50 |
|
|
/* @Purpose : */ |
51 |
|
|
/* The function writes through the DMA Write Controller, a data word */ |
52 |
|
|
/* 32 bit long into the DRAMMA registers Data Byte 1 (LSB), Data Byte 2, */ |
53 |
|
|
/* Data Byte 3,Data Byte 4 (MSB). */ |
54 |
|
|
/* The data present into the DRAMMA Register Data 1..4 are written in the */ |
55 |
|
|
/* specific memory board, programming the Board Address register with the */ |
56 |
|
|
/* address of the selected board. */ |
57 |
|
|
/* */ |
58 |
|
|
/* @@ */ |
59 |
|
|
/* @Parameter Name @Mode @Description */ |
60 |
|
|
/* BoardId IN Board address (0 to MAX_BOARD_ADDR) */ |
61 |
|
|
/* pDramma IN Pointer to Dramma register table */ |
62 |
|
|
/* Reg IN Dramma register indentifier (index) */ |
63 |
|
|
/* (FD_DRAMMA_REG type) */ |
64 |
|
|
/* Value IN Value to write into the Dramma register */ |
65 |
|
|
/* @@ */ |
66 |
|
|
/*****************************************************************************/ |
67 |
|
|
|
68 |
|
|
void FD_ifDrammaWrWPBUSReg (void* pDramma, |
69 |
|
|
unsigned int BoardId, |
70 |
|
|
unsigned int Reg, |
71 |
|
|
unsigned int Value) |
72 |
|
|
{ |
73 |
|
|
unsigned int tmpValue; |
74 |
|
|
unsigned int mask; |
75 |
|
|
FD_DRAMMA_REG* pD; |
76 |
|
|
|
77 |
|
|
pD =(FD_DRAMMA_REG* )pDramma; |
78 |
|
|
mask =pD->WPBUSreg[Reg]; |
79 |
|
|
tmpValue =Value & ~mask; |
80 |
|
|
tmpValue |=mask; |
81 |
|
|
/* Write data (4 bytes) into the DRAMMA Register Data on the WPBUS */ |
82 |
|
|
/* Write Data 1 LSB */ |
83 |
|
|
*FD_WPBUS_WCMD1 =(unsigned char)(tmpValue & 0xff); |
84 |
|
|
*FD_WPBUS_WCMD2 =(unsigned char)((tmpValue>>8)&0xff); |
85 |
|
|
*FD_WPBUS_WCMD3 =(unsigned char)((tmpValue>>16)&0xff); |
86 |
|
|
/* Write Data 4 MSB */ |
87 |
|
|
*FD_WPBUS_WCMD4 =(unsigned char)((tmpValue>>24)&0xff); |
88 |
|
|
/* Write board address into the DRAMMA Board Address Register on the WPBUS */ |
89 |
|
|
*FD_WPBUS_CBID =(unsigned char)(BoardId & FD_BOARD_ADDR_MASK); |
90 |
|
|
|
91 |
|
|
} |
92 |
|
|
|
93 |
|
|
|
94 |
|
|
|
95 |
|
|
/*****************************************************************************/ |
96 |
|
|
/* @Function: FD_ifDrammaRdRPBUSReg */ |
97 |
|
|
/* @Purpose : */ |
98 |
|
|
/* The function reads through the DMA Read Controller, a data word 32 bit */ |
99 |
|
|
/* long from the DRAMMA registers Data Byte 1 (LSB), Data Byte 2, */ |
100 |
|
|
/* Data Byte 3,Data Byte 4 (MSB). */ |
101 |
|
|
/* Before read the data word needs to program the Dramma Register Adrress */ |
102 |
|
|
/* with the address of the specific board and the address of the Dramma */ |
103 |
|
|
/* register. */ |
104 |
|
|
/* */ |
105 |
|
|
/* @@ */ |
106 |
|
|
/* @Parameter Name @Mode @Description */ |
107 |
|
|
/* BoardId IN Board address (0 to MAX_BOARD_ADDR) */ |
108 |
|
|
/* pDramma IN Pointer to Dramma register table */ |
109 |
|
|
/* Reg IN Dramma register indentifier (index) */ |
110 |
|
|
/* (FD_DRAMMA_REG type) */ |
111 |
|
|
/* Value OUT Value read from the Dramma register */ |
112 |
|
|
/* @@ */ |
113 |
|
|
/*****************************************************************************/ |
114 |
|
|
|
115 |
|
|
void FD_ifDrammaRdRPBUSReg (void* pDramma, |
116 |
|
|
unsigned int BoardId, |
117 |
|
|
unsigned int Reg, |
118 |
|
|
unsigned int* Value) |
119 |
|
|
{ |
120 |
|
|
unsigned int tmpValue; |
121 |
|
|
unsigned int mask; |
122 |
|
|
FD_DRAMMA_REG* pD; |
123 |
|
|
|
124 |
|
|
pD =(FD_DRAMMA_REG* )pDramma; |
125 |
|
|
/* Dramma register is the Most Significant Nibble */ |
126 |
|
|
mask =(pD->RPBUSreg[Reg] << 4); |
127 |
|
|
/* Board ID is the Least Significant Nibble */ |
128 |
|
|
mask |=BoardId; |
129 |
|
|
/* Write board and register into the Dramma Register Address */ |
130 |
|
|
*FD_RPBUS_CBID =(unsigned char)mask; |
131 |
|
|
/* Read data (4 bytes) into the DRAMMA Register Data on the RPBUS */ |
132 |
|
|
tmpValue =0; |
133 |
|
|
/* Read data 4 MSB */ |
134 |
|
|
tmpValue =*FD_RPBUS_RCMD4; |
135 |
|
|
tmpValue <<=8; |
136 |
|
|
tmpValue |=*FD_RPBUS_RCMD3; |
137 |
|
|
tmpValue <<=8; |
138 |
|
|
tmpValue |=*FD_RPBUS_RCMD2; |
139 |
|
|
tmpValue <<=8; |
140 |
|
|
/* Read data 1 LSB */ |
141 |
|
|
tmpValue |=*FD_RPBUS_RCMD1; |
142 |
|
|
*Value =tmpValue; |
143 |
|
|
} |
144 |
|
|
|
145 |
|
|
|
146 |
|
|
|