FreeBSD kernel pms device code
dmmisc.c
Go to the documentation of this file.
1/*******************************************************************************
2**
3*Copyright (c) 2014 PMC-Sierra, Inc. All rights reserved.
4*
5*Redistribution and use in source and binary forms, with or without modification, are permitted provided
6*that the following conditions are met:
7*1. Redistributions of source code must retain the above copyright notice, this list of conditions and the
8*following disclaimer.
9*2. Redistributions in binary form must reproduce the above copyright notice,
10*this list of conditions and the following disclaimer in the documentation and/or other materials provided
11*with the distribution.
12*
13*THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
14*WARRANTIES,INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
15*FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
16*FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
17*NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
18*BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
19*LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
20*SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
21
22********************************************************************************/
23#include <sys/cdefs.h>
24__FBSDID("$FreeBSD$");
25#include <dev/pms/config.h>
26
30
34
35#ifdef FDS_DM
39
43
44osGLOBAL void
45*dm_memset(void *s, int c, bit32 n)
46{
47 bit32 i;
48
49 char *dst = (char *)s;
50 for (i=0; i < n; i++)
51 {
52 dst[i] = (char) c;
53 }
54 return (void *)(&dst[i-n]);
55}
56
57osGLOBAL void
58*dm_memcpy(void *dst, void *src, bit32 count)
59{
60 bit32 x;
61 unsigned char *dst1 = (unsigned char *)dst;
62 unsigned char *src1 = (unsigned char *)src;
63
64 for (x=0; x < count; x++)
65 dst1[x] = src1[x];
66
67 return dst;
68
69}
70
72osGLOBAL void
73dmhexdump(const char *ptitle, bit8 *pbuf, int len)
74{
75 int i;
76 DM_DBG1(("%s - dmhexdump(len=%d):\n", ptitle, (int)len));
77 if (!pbuf)
78 {
79 DM_DBG1(("pbuf is NULL\n"));
80 return;
81 }
82 for (i = 0; i < len; )
83 {
84 if (len - i > 4)
85 {
86 DM_DBG1((" 0x%02x, 0x%02x, 0x%02x, 0x%02x,\n", pbuf[i], pbuf[i+1], pbuf[i+2], pbuf[i+3]));
87 i += 4;
88 }
89 else
90 {
91 DM_DBG1((" 0x%02x,", pbuf[i]));
92 i++;
93 }
94 }
95 DM_DBG1(("\n"));
96}
97#endif /* FDS_ DM */
98
#define DM_DBG1(format)
Definition: dmdefs.h:124
__FBSDID("$FreeBSD$")
osGLOBAL void * dm_memcpy(void *dst, void *src, bit32 count)
osGLOBAL void dmhexdump(const char *ptitle, bit8 *pbuf, int len)
osGLOBAL void * dm_memset(void *s, int c, bit32 n)
#define osGLOBAL
Definition: ostypes.h:147
unsigned int bit32
Definition: ostypes.h:99
unsigned char bit8
Definition: ostypes.h:97
The file defines the constants, data structure, and functions defined by LL API.
The file defines the declaration of tSDK APIs.
The file defines the declaration of OS APIs.