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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [utils/] [amd-udi/] [mondfe/] [move.c] - Blame information for rev 1774

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

Line No. Rev Author Line
1 578 markom
static char _[] = "@(#)move.c   5.20 93/07/30 16:38:55, Srini, AMD.";
2
/******************************************************************************
3
 * Copyright 1991 Advanced Micro Devices, Inc.
4
 *
5
 * This software is the property of Advanced Micro Devices, Inc  (AMD)  which
6
 * specifically  grants the user the right to modify, use and distribute this
7
 * software provided this notice is not removed or altered.  All other rights
8
 * are reserved by AMD.
9
 *
10
 * AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
11
 * SOFTWARE.  IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
12
 * DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
13
 * USE OF THIS SOFTWARE.
14
 *
15
 * So that all may benefit from your experience, please report  any  problems
16
 * or  suggestions about this software to the 29K Technical Support Center at
17
 * 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131  in  the  UK,  or
18
 * 0031-11-1129 in Japan, toll free.  The direct dial number is 512-462-4118.
19
 *
20
 * Advanced Micro Devices, Inc.
21
 * 29K Support Products
22
 * Mail Stop 573
23
 * 5900 E. Ben White Blvd.
24
 * Austin, TX 78741
25
 * 800-292-9263
26
 *****************************************************************************
27
 *      Engineer: Srini Subramanian.
28
 *****************************************************************************
29
 **       This code provides "move" routines to copy blocks of memory.
30
 **       Data may be moved as words (32 bit), half-words (16 bit),
31
 **       bytes (8 bit), float (32 bit floating point) or double
32
 **       (64 bit floating point).
33
 **
34
 **       Registers moves are not permitted.
35
 *****************************************************************************
36
 */
37
 
38
#include <stdio.h>
39
#include <ctype.h>
40
#include <memory.h>
41
#include "main.h"
42
#include "memspcs.h"
43
#include "miniint.h"
44
#include "macros.h"
45
#include "error.h"
46
 
47
 
48
#ifdef MSDOS
49
#include <stdlib.h>
50
#include <string.h>
51
#else
52
#include <string.h>
53
 
54
#endif
55
 
56
 
57
int   get_addr_29k PARAMS((char *, struct addr_29k_t *));
58
int   addr_29k_ok PARAMS((struct addr_29k_t *));
59
 
60
int   get_word PARAMS((char *, INT32 *));
61
 
62
int   set_data PARAMS((BYTE *, BYTE *, int));
63
 
64
/*
65
** The function below is used in moving data.  This function is
66
** called in the main command loop parser of the monitor.  The
67
** parameters passed to this function are:
68
**
69
** token - This is an array of pointers to strings.  Each string
70
**         referenced by this array is a "token" of the user's
71
**         input, translated to lower case.
72
**
73
** token_count - This is the number of items in the token array.
74
**
75
** This function reduces the tokens to three parameters:
76
** the start address and the end address of the move and the
77
** target address of the move.
78
**
79
*/
80
 
81
 
82
INT32
83
move_cmd(token, token_count)
84
   char   *token[];
85
   int     token_count;
86
   {
87
   int    result;
88
   INT32  byte_count;
89
   struct addr_29k_t addr_29k_start;
90
   struct addr_29k_t addr_29k_end;
91
   struct addr_29k_t addr_29k_dest;
92
   struct addr_29k_t temp_addr_29k;
93
 
94
   INT32        retval;
95
   INT32        direction;
96
 
97
   if ((strcmp(token[0], "m") != 0) ||
98
       (token_count != 4))
99
      return (EMSYNTAX);
100
 
101
   /*
102
   ** Get addresses
103
   */
104
 
105
   result = get_addr_29k(token[1], &addr_29k_start);
106
   if (result != 0)
107
      return (result);
108
   result = addr_29k_ok(&addr_29k_start);
109
   if (result != 0)
110
      return (result);
111
 
112
   result = get_addr_29k(token[2], &addr_29k_end);
113
   if (result != 0)
114
      return (result);
115
   result = addr_29k_ok(&addr_29k_end);
116
   if (result != 0)
117
      return (result);
118
 
119
   result = get_addr_29k(token[3], &addr_29k_dest);
120
   if (result != 0)
121
      return (result);
122
   result = addr_29k_ok(&addr_29k_dest);
123
   if (result != 0)
124
      return (result);
125
 
126
   /* End address must be not be less than start address */
127
   if (addr_29k_start.address > addr_29k_end.address)
128
      return (EMSYNTAX);
129
 
130
   byte_count = (addr_29k_end.address - addr_29k_start.address) + 1;
131
 
132
   /* Dest range must be in valid memory */
133
   temp_addr_29k.memory_space = addr_29k_dest.memory_space;
134
   /* For memory to register, divide byte count by 4 */
135
   if ((ISMEM(addr_29k_start.memory_space)) &&
136
       (ISREG(addr_29k_dest.memory_space)))
137
      temp_addr_29k.address = addr_29k_dest.address + (byte_count / 4);
138
   else
139
   /* For register to memory, multiply byte count by 4 */
140
   if ((ISREG(addr_29k_start.memory_space)) &&
141
       (ISMEM(addr_29k_dest.memory_space)))
142
      temp_addr_29k.address = addr_29k_dest.address + (byte_count * 4);
143
   else
144
      temp_addr_29k.address = addr_29k_dest.address + byte_count;
145
   result = addr_29k_ok(&temp_addr_29k);
146
   if (result != 0)
147
      return (EMCOPY);
148
 
149
   /* Registers are four bytes */
150
   if (ISREG(addr_29k_start.memory_space))
151
      byte_count = (byte_count * 4);
152
 
153
   /* Do copy */
154
 
155
   direction = TRUE; /* SRINI front to back or back to front */
156
   if ((retval = Mini_copy (addr_29k_start.memory_space,
157
                            addr_29k_start.address,
158
                            addr_29k_dest.memory_space,
159
                            addr_29k_dest.address,
160
                            byte_count,
161
                            (INT16) 1, /* size */
162
                            direction)) != SUCCESS) {
163
        return(FAILURE);
164
   } else
165
      return(SUCCESS);
166
 
167
   }  /* end move_cmd() */
168
 
169
 
170
 

powered by: WebSVN 2.1.0

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