1 |
/**************************************************************************** |
2 |
/* F i l e D a t a |
3 |
/* |
4 |
/* Module : SRAMManager |
5 |
/* C.I. No. : |
6 |
/* $Revision: 1.1.1.1 $ |
7 |
/* $Date: 2003/08/04 09:40:21 $ |
8 |
/* Belonging to : |
9 |
/* : |
10 |
/* $RCSfile: SM_SRAMPageManager_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: SM_SRAMPageManager_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 2003/06/09 10:18:33 aurora |
29 |
/* copy data via PCMCIA with Interrupt preemption enabled |
30 |
/* |
31 |
/* Revision 1.3 2002/05/09 08:16:35 zulia |
32 |
/* * acceptance release |
33 |
/* |
34 |
/* |
35 |
/*****************************************************************************/ |
36 |
|
37 |
|
38 |
/*============================= Include File ================================*/ |
39 |
|
40 |
#include <src/SRAMManager/SRAMPageManager/SM_SRAMPageManager_int.h> |
41 |
#include <src/SRAMManager/SRAMDriver/SD_SRAMDriver_p.h> |
42 |
|
43 |
/*****************************************************************************/ |
44 |
/*=== S R A M P a g e M a n a g e r I N T E R N A L F U N C T I O N S ===*/ |
45 |
/*****************************************************************************/ |
46 |
|
47 |
/*****************************************************************************/ |
48 |
/* @Function: SM_ifCopyFromSRAM */ |
49 |
/* @Purpose : */ |
50 |
/* The function copy Size bytes from the SRAM to the microprocessor memory */ |
51 |
/* */ |
52 |
/* @@ */ |
53 |
/* @Parameter Name @Mode @Description */ |
54 |
/* SRAMStartAddr IN Source address in SRAM */ |
55 |
/* RAMStartAddr IN Destination address in RAM */ |
56 |
/* Size IN Size of data to copy */ |
57 |
/* @@ */ |
58 |
/*****************************************************************************/ |
59 |
|
60 |
void SM_ifCopyFromSRAM(UINT32 SRAMStartAddr, void* RAMStartAddr, UINT32 Size) |
61 |
{ |
62 |
BYTE* target; |
63 |
|
64 |
/* Init the source hbus I/O SRAM address */ |
65 |
SD_piSetSRAMRWAddress(SRAMStartAddr); |
66 |
/* Init the destination RAM address*/ |
67 |
target = RAMStartAddr; |
68 |
/* Copy the packet */ |
69 |
while(Size--) |
70 |
{ |
71 |
*target = (BYTE)SD_piReadSRAM(); |
72 |
target++; |
73 |
} |
74 |
} |
75 |
|
76 |
/*****************************************************************************/ |
77 |
/* @Function: SM_ifCopyToSRAM */ |
78 |
/* @Purpose : */ |
79 |
/* The function copy Size bytes from the microprocessor memory to the SRAM */ |
80 |
/* */ |
81 |
/* @@ */ |
82 |
/* @Parameter Name @Mode @Description */ |
83 |
/* SRAMStartAddr IN Destination address in SRAM */ |
84 |
/* RAMStartAddr IN Source address in RAM */ |
85 |
/* Size IN Size of data to copy */ |
86 |
/* @@ */ |
87 |
/*****************************************************************************/ |
88 |
|
89 |
void SM_ifCopyToSRAM(UINT32 SRAMStartAddr, void* RAMStartAddr, UINT32 Size) |
90 |
{ |
91 |
BYTE* source; |
92 |
unsigned int intLevel; |
93 |
|
94 |
/* Init the source RAM address*/ |
95 |
source = RAMStartAddr; |
96 |
/* Copy the packet */ |
97 |
while(Size--) |
98 |
{ |
99 |
OS_piInterDisable(&intLevel); |
100 |
/* write the address to write and data */ |
101 |
SD_piSetSRAMRWAddress(SRAMStartAddr++); |
102 |
SD_piWriteSRAM(*source); |
103 |
source++; |
104 |
OS_piInterEnable(intLevel); |
105 |
} |
106 |
} |