blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
250
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 0
58
| license_type
stringclasses 2
values | repo_name
stringlengths 5
107
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringclasses 185
values | visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 15.7k
664M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 17
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 68
values | src_encoding
stringclasses 27
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 6
9.36M
| extension
stringclasses 31
values | content
stringlengths 4
9.36M
| authors
sequencelengths 1
1
| author
stringlengths 0
73
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
e2d42688fddb69c1217ad00117703dae30591708 | cb44d748dc4074a4979019a3cadfa7fde337a0b3 | /time_convert_time.c | ce29751e6f1b5fa66408f8031297c98dc62d8235 | [] | no_license | sba1/clib2 | dbb42f0875d510cfd9b92ab890855cfc2277519f | f1db9d75872d2618100961b9f000410f25a430ce | refs/heads/master | 2020-05-25T11:45:19.923616 | 2015-04-03T17:54:40 | 2015-04-03T17:54:40 | 32,605,450 | 1 | 0 | null | null | null | null | ISO-8859-1 | C | false | false | 2,425 | c | /*
* $Id$
*
* :ts=4
*
* Portable ISO 'C' (1994) runtime library for the Amiga computer
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Neither the name of Olaf Barthel nor the names of contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _TIME_HEADERS_H
#include "time_headers.h"
#endif /* _TIME_HEADERS_H */
#ifndef _LOCALE_HEADERS_H
#include "locale_headers.h"
#endif /* _LOCALE_HEADERS_H */
/****************************************************************************/
BOOL
__convert_time_to_datestamp(time_t time_value,struct DateStamp * ds)
{
BOOL success;
/* The time has to lie within the AmigaOS epoch. */
if(time_value < UNIX_TIME_OFFSET)
{
success = FALSE;
goto out;
}
/* Adjust the time to the AmigaOS epoch. */
time_value -= UNIX_TIME_OFFSET;
__locale_lock();
/* If possible, adjust the time to match the local time zone settings. */
if(__default_locale != NULL)
time_value -= 60 * __default_locale->loc_GMTOffset;
__locale_unlock();
ds->ds_Days = (time_value / (24 * 60 * 60));
ds->ds_Minute = (time_value % (24 * 60 * 60)) / 60;
ds->ds_Tick = (time_value % 60) * TICKS_PER_SECOND;
success = TRUE;
out:
return(success);
}
| [
"obarthel"
] | obarthel |
60de4d1e56f8eeed1b4daa7c7b9b507c40556f13 | 706f61d9536f82714e82c2f3f018dea24feedbe9 | /TextSearch-Windows/TextSearchCom/TextSearchCom_p.c | 3f161d45d349b659e740630ae9fc2d4abc5caffd | [] | no_license | Travelsnaker/TextSearch_Windows | 7e74759945002d1c8260a8c5eeab49971377c735 | 6864a5fe00db5218ea1ecc412e6ac47cda64d29f | refs/heads/master | 2020-12-02T21:34:36.607359 | 2016-08-23T20:02:32 | 2016-08-23T20:02:32 | 66,399,085 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 14,771 | c |
/* this ALWAYS GENERATED file contains the proxy stub code */
/* File created by MIDL compiler version 8.00.0603 */
/* at Tue Aug 23 15:46:27 2016
*/
/* Compiler settings for TextSearchCom.idl:
Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 8.00.0603
protocol : dce , ms_ext, c_ext, robust
error checks: allocation ref bounds_check enum stub_data
VC __declspec() decoration level:
__declspec(uuid()), __declspec(selectany), __declspec(novtable)
DECLSPEC_UUID(), MIDL_INTERFACE()
*/
/* @@MIDL_FILE_HEADING( ) */
#if !defined(_M_IA64) && !defined(_M_AMD64) && !defined(_ARM_)
#pragma warning( disable: 4049 ) /* more than 64k source lines */
#if _MSC_VER >= 1200
#pragma warning(push)
#endif
#pragma warning( disable: 4211 ) /* redefine extern to static */
#pragma warning( disable: 4232 ) /* dllimport identity*/
#pragma warning( disable: 4024 ) /* array to pointer mapping*/
#pragma warning( disable: 4152 ) /* function/data pointer conversion in expression */
#pragma warning( disable: 4100 ) /* unreferenced arguments in x86 call */
#pragma optimize("", off )
#define USE_STUBLESS_PROXY
/* verify that the <rpcproxy.h> version is high enough to compile this file*/
#ifndef __REDQ_RPCPROXY_H_VERSION__
#define __REQUIRED_RPCPROXY_H_VERSION__ 475
#endif
#include "rpcproxy.h"
#ifndef __RPCPROXY_H_VERSION__
#error this stub requires an updated version of <rpcproxy.h>
#endif /* __RPCPROXY_H_VERSION__ */
#include "TextSearchCom_i.h"
#define TYPE_FORMAT_STRING_SIZE 47
#define PROC_FORMAT_STRING_SIZE 211
#define EXPR_FORMAT_STRING_SIZE 1
#define TRANSMIT_AS_TABLE_SIZE 0
#define WIRE_MARSHAL_TABLE_SIZE 1
typedef struct _TextSearchCom_MIDL_TYPE_FORMAT_STRING
{
short Pad;
unsigned char Format[ TYPE_FORMAT_STRING_SIZE ];
} TextSearchCom_MIDL_TYPE_FORMAT_STRING;
typedef struct _TextSearchCom_MIDL_PROC_FORMAT_STRING
{
short Pad;
unsigned char Format[ PROC_FORMAT_STRING_SIZE ];
} TextSearchCom_MIDL_PROC_FORMAT_STRING;
typedef struct _TextSearchCom_MIDL_EXPR_FORMAT_STRING
{
long Pad;
unsigned char Format[ EXPR_FORMAT_STRING_SIZE ];
} TextSearchCom_MIDL_EXPR_FORMAT_STRING;
static const RPC_SYNTAX_IDENTIFIER _RpcTransferSyntax =
{{0x8A885D04,0x1CEB,0x11C9,{0x9F,0xE8,0x08,0x00,0x2B,0x10,0x48,0x60}},{2,0}};
extern const TextSearchCom_MIDL_TYPE_FORMAT_STRING TextSearchCom__MIDL_TypeFormatString;
extern const TextSearchCom_MIDL_PROC_FORMAT_STRING TextSearchCom__MIDL_ProcFormatString;
extern const TextSearchCom_MIDL_EXPR_FORMAT_STRING TextSearchCom__MIDL_ExprFormatString;
extern const MIDL_STUB_DESC Object_StubDesc;
extern const MIDL_SERVER_INFO ITextSearch_ServerInfo;
extern const MIDL_STUBLESS_PROXY_INFO ITextSearch_ProxyInfo;
extern const USER_MARSHAL_ROUTINE_QUADRUPLE UserMarshalRoutines[ WIRE_MARSHAL_TABLE_SIZE ];
#if !defined(__RPC_WIN32__)
#error Invalid build platform for this stub.
#endif
#if !(TARGET_IS_NT50_OR_LATER)
#error You need Windows 2000 or later to run this stub because it uses these features:
#error /robust command line switch.
#error However, your C/C++ compilation flags indicate you intend to run this app on earlier systems.
#error This app will fail with the RPC_X_WRONG_STUB_VERSION error.
#endif
static const TextSearchCom_MIDL_PROC_FORMAT_STRING TextSearchCom__MIDL_ProcFormatString =
{
0,
{
/* Procedure enqueue */
0x33, /* FC_AUTO_HANDLE */
0x6c, /* Old Flags: object, Oi2 */
/* 2 */ NdrFcLong( 0x0 ), /* 0 */
/* 6 */ NdrFcShort( 0x7 ), /* 7 */
/* 8 */ NdrFcShort( 0xc ), /* x86 Stack size/offset = 12 */
/* 10 */ NdrFcShort( 0x0 ), /* 0 */
/* 12 */ NdrFcShort( 0x8 ), /* 8 */
/* 14 */ 0x46, /* Oi2 Flags: clt must size, has return, has ext, */
0x2, /* 2 */
/* 16 */ 0x8, /* 8 */
0x5, /* Ext Flags: new corr desc, srv corr check, */
/* 18 */ NdrFcShort( 0x0 ), /* 0 */
/* 20 */ NdrFcShort( 0x1 ), /* 1 */
/* 22 */ NdrFcShort( 0x0 ), /* 0 */
/* Parameter filename */
/* 24 */ NdrFcShort( 0x8b ), /* Flags: must size, must free, in, by val, */
/* 26 */ NdrFcShort( 0x4 ), /* x86 Stack size/offset = 4 */
/* 28 */ NdrFcShort( 0x1c ), /* Type Offset=28 */
/* Return value */
/* 30 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */
/* 32 */ NdrFcShort( 0x8 ), /* x86 Stack size/offset = 8 */
/* 34 */ 0x8, /* FC_LONG */
0x0, /* 0 */
/* Procedure setupSearch */
/* 36 */ 0x33, /* FC_AUTO_HANDLE */
0x6c, /* Old Flags: object, Oi2 */
/* 38 */ NdrFcLong( 0x0 ), /* 0 */
/* 42 */ NdrFcShort( 0x8 ), /* 8 */
/* 44 */ NdrFcShort( 0x10 ), /* x86 Stack size/offset = 16 */
/* 46 */ NdrFcShort( 0x8 ), /* 8 */
/* 48 */ NdrFcShort( 0x8 ), /* 8 */
/* 50 */ 0x46, /* Oi2 Flags: clt must size, has return, has ext, */
0x3, /* 3 */
/* 52 */ 0x8, /* 8 */
0x5, /* Ext Flags: new corr desc, srv corr check, */
/* 54 */ NdrFcShort( 0x0 ), /* 0 */
/* 56 */ NdrFcShort( 0x1 ), /* 1 */
/* 58 */ NdrFcShort( 0x0 ), /* 0 */
/* Parameter num */
/* 60 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */
/* 62 */ NdrFcShort( 0x4 ), /* x86 Stack size/offset = 4 */
/* 64 */ 0x8, /* FC_LONG */
0x0, /* 0 */
/* Parameter text */
/* 66 */ NdrFcShort( 0x8b ), /* Flags: must size, must free, in, by val, */
/* 68 */ NdrFcShort( 0x8 ), /* x86 Stack size/offset = 8 */
/* 70 */ NdrFcShort( 0x1c ), /* Type Offset=28 */
/* Return value */
/* 72 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */
/* 74 */ NdrFcShort( 0xc ), /* x86 Stack size/offset = 12 */
/* 76 */ 0x8, /* FC_LONG */
0x0, /* 0 */
/* Procedure startSearch */
/* 78 */ 0x33, /* FC_AUTO_HANDLE */
0x6c, /* Old Flags: object, Oi2 */
/* 80 */ NdrFcLong( 0x0 ), /* 0 */
/* 84 */ NdrFcShort( 0x9 ), /* 9 */
/* 86 */ NdrFcShort( 0x8 ), /* x86 Stack size/offset = 8 */
/* 88 */ NdrFcShort( 0x0 ), /* 0 */
/* 90 */ NdrFcShort( 0x8 ), /* 8 */
/* 92 */ 0x44, /* Oi2 Flags: has return, has ext, */
0x1, /* 1 */
/* 94 */ 0x8, /* 8 */
0x1, /* Ext Flags: new corr desc, */
/* 96 */ NdrFcShort( 0x0 ), /* 0 */
/* 98 */ NdrFcShort( 0x0 ), /* 0 */
/* 100 */ NdrFcShort( 0x0 ), /* 0 */
/* Return value */
/* 102 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */
/* 104 */ NdrFcShort( 0x4 ), /* x86 Stack size/offset = 4 */
/* 106 */ 0x8, /* FC_LONG */
0x0, /* 0 */
/* Procedure get */
/* 108 */ 0x33, /* FC_AUTO_HANDLE */
0x6c, /* Old Flags: object, Oi2 */
/* 110 */ NdrFcLong( 0x0 ), /* 0 */
/* 114 */ NdrFcShort( 0xa ), /* 10 */
/* 116 */ NdrFcShort( 0xc ), /* x86 Stack size/offset = 12 */
/* 118 */ NdrFcShort( 0x0 ), /* 0 */
/* 120 */ NdrFcShort( 0x8 ), /* 8 */
/* 122 */ 0x46, /* Oi2 Flags: clt must size, has return, has ext, */
0x2, /* 2 */
/* 124 */ 0x8, /* 8 */
0x5, /* Ext Flags: new corr desc, srv corr check, */
/* 126 */ NdrFcShort( 0x0 ), /* 0 */
/* 128 */ NdrFcShort( 0x1 ), /* 1 */
/* 130 */ NdrFcShort( 0x0 ), /* 0 */
/* Parameter filename */
/* 132 */ NdrFcShort( 0x10b ), /* Flags: must size, must free, in, simple ref, */
/* 134 */ NdrFcShort( 0x4 ), /* x86 Stack size/offset = 4 */
/* 136 */ NdrFcShort( 0x1c ), /* Type Offset=28 */
/* Return value */
/* 138 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */
/* 140 */ NdrFcShort( 0x8 ), /* x86 Stack size/offset = 8 */
/* 142 */ 0x8, /* FC_LONG */
0x0, /* 0 */
/* Procedure stopSearch */
/* 144 */ 0x33, /* FC_AUTO_HANDLE */
0x6c, /* Old Flags: object, Oi2 */
/* 146 */ NdrFcLong( 0x0 ), /* 0 */
/* 150 */ NdrFcShort( 0xb ), /* 11 */
/* 152 */ NdrFcShort( 0x8 ), /* x86 Stack size/offset = 8 */
/* 154 */ NdrFcShort( 0x0 ), /* 0 */
/* 156 */ NdrFcShort( 0x8 ), /* 8 */
/* 158 */ 0x44, /* Oi2 Flags: has return, has ext, */
0x1, /* 1 */
/* 160 */ 0x8, /* 8 */
0x1, /* Ext Flags: new corr desc, */
/* 162 */ NdrFcShort( 0x0 ), /* 0 */
/* 164 */ NdrFcShort( 0x0 ), /* 0 */
/* 166 */ NdrFcShort( 0x0 ), /* 0 */
/* Return value */
/* 168 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */
/* 170 */ NdrFcShort( 0x4 ), /* x86 Stack size/offset = 4 */
/* 172 */ 0x8, /* FC_LONG */
0x0, /* 0 */
/* Procedure getNumRes */
/* 174 */ 0x33, /* FC_AUTO_HANDLE */
0x6c, /* Old Flags: object, Oi2 */
/* 176 */ NdrFcLong( 0x0 ), /* 0 */
/* 180 */ NdrFcShort( 0xc ), /* 12 */
/* 182 */ NdrFcShort( 0xc ), /* x86 Stack size/offset = 12 */
/* 184 */ NdrFcShort( 0x1c ), /* 28 */
/* 186 */ NdrFcShort( 0x8 ), /* 8 */
/* 188 */ 0x44, /* Oi2 Flags: has return, has ext, */
0x2, /* 2 */
/* 190 */ 0x8, /* 8 */
0x1, /* Ext Flags: new corr desc, */
/* 192 */ NdrFcShort( 0x0 ), /* 0 */
/* 194 */ NdrFcShort( 0x0 ), /* 0 */
/* 196 */ NdrFcShort( 0x0 ), /* 0 */
/* Parameter num */
/* 198 */ NdrFcShort( 0x148 ), /* Flags: in, base type, simple ref, */
/* 200 */ NdrFcShort( 0x4 ), /* x86 Stack size/offset = 4 */
/* 202 */ 0x8, /* FC_LONG */
0x0, /* 0 */
/* Return value */
/* 204 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */
/* 206 */ NdrFcShort( 0x8 ), /* x86 Stack size/offset = 8 */
/* 208 */ 0x8, /* FC_LONG */
0x0, /* 0 */
0x0
}
};
static const TextSearchCom_MIDL_TYPE_FORMAT_STRING TextSearchCom__MIDL_TypeFormatString =
{
0,
{
NdrFcShort( 0x0 ), /* 0 */
/* 2 */
0x12, 0x0, /* FC_UP */
/* 4 */ NdrFcShort( 0xe ), /* Offset= 14 (18) */
/* 6 */
0x1b, /* FC_CARRAY */
0x1, /* 1 */
/* 8 */ NdrFcShort( 0x2 ), /* 2 */
/* 10 */ 0x9, /* Corr desc: FC_ULONG */
0x0, /* */
/* 12 */ NdrFcShort( 0xfffc ), /* -4 */
/* 14 */ NdrFcShort( 0x1 ), /* Corr flags: early, */
/* 16 */ 0x6, /* FC_SHORT */
0x5b, /* FC_END */
/* 18 */
0x17, /* FC_CSTRUCT */
0x3, /* 3 */
/* 20 */ NdrFcShort( 0x8 ), /* 8 */
/* 22 */ NdrFcShort( 0xfff0 ), /* Offset= -16 (6) */
/* 24 */ 0x8, /* FC_LONG */
0x8, /* FC_LONG */
/* 26 */ 0x5c, /* FC_PAD */
0x5b, /* FC_END */
/* 28 */ 0xb4, /* FC_USER_MARSHAL */
0x83, /* 131 */
/* 30 */ NdrFcShort( 0x0 ), /* 0 */
/* 32 */ NdrFcShort( 0x4 ), /* 4 */
/* 34 */ NdrFcShort( 0x0 ), /* 0 */
/* 36 */ NdrFcShort( 0xffde ), /* Offset= -34 (2) */
/* 38 */
0x11, 0x0, /* FC_RP */
/* 40 */ NdrFcShort( 0xfff4 ), /* Offset= -12 (28) */
/* 42 */
0x11, 0x8, /* FC_RP [simple_pointer] */
/* 44 */ 0x8, /* FC_LONG */
0x5c, /* FC_PAD */
0x0
}
};
static const USER_MARSHAL_ROUTINE_QUADRUPLE UserMarshalRoutines[ WIRE_MARSHAL_TABLE_SIZE ] =
{
{
BSTR_UserSize
,BSTR_UserMarshal
,BSTR_UserUnmarshal
,BSTR_UserFree
}
};
/* Object interface: IUnknown, ver. 0.0,
GUID={0x00000000,0x0000,0x0000,{0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46}} */
/* Object interface: IDispatch, ver. 0.0,
GUID={0x00020400,0x0000,0x0000,{0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46}} */
/* Object interface: ITextSearch, ver. 0.0,
GUID={0x6D7AB63B,0x53D2,0x418C,{0x84,0x01,0x8D,0xCD,0x46,0x06,0xA7,0x24}} */
#pragma code_seg(".orpc")
static const unsigned short ITextSearch_FormatStringOffsetTable[] =
{
(unsigned short) -1,
(unsigned short) -1,
(unsigned short) -1,
(unsigned short) -1,
0,
36,
78,
108,
144,
174
};
static const MIDL_STUBLESS_PROXY_INFO ITextSearch_ProxyInfo =
{
&Object_StubDesc,
TextSearchCom__MIDL_ProcFormatString.Format,
&ITextSearch_FormatStringOffsetTable[-3],
0,
0,
0
};
static const MIDL_SERVER_INFO ITextSearch_ServerInfo =
{
&Object_StubDesc,
0,
TextSearchCom__MIDL_ProcFormatString.Format,
&ITextSearch_FormatStringOffsetTable[-3],
0,
0,
0,
0};
CINTERFACE_PROXY_VTABLE(13) _ITextSearchProxyVtbl =
{
&ITextSearch_ProxyInfo,
&IID_ITextSearch,
IUnknown_QueryInterface_Proxy,
IUnknown_AddRef_Proxy,
IUnknown_Release_Proxy ,
0 /* IDispatch::GetTypeInfoCount */ ,
0 /* IDispatch::GetTypeInfo */ ,
0 /* IDispatch::GetIDsOfNames */ ,
0 /* IDispatch_Invoke_Proxy */ ,
(void *) (INT_PTR) -1 /* ITextSearch::enqueue */ ,
(void *) (INT_PTR) -1 /* ITextSearch::setupSearch */ ,
(void *) (INT_PTR) -1 /* ITextSearch::startSearch */ ,
(void *) (INT_PTR) -1 /* ITextSearch::get */ ,
(void *) (INT_PTR) -1 /* ITextSearch::stopSearch */ ,
(void *) (INT_PTR) -1 /* ITextSearch::getNumRes */
};
static const PRPC_STUB_FUNCTION ITextSearch_table[] =
{
STUB_FORWARDING_FUNCTION,
STUB_FORWARDING_FUNCTION,
STUB_FORWARDING_FUNCTION,
STUB_FORWARDING_FUNCTION,
NdrStubCall2,
NdrStubCall2,
NdrStubCall2,
NdrStubCall2,
NdrStubCall2,
NdrStubCall2
};
CInterfaceStubVtbl _ITextSearchStubVtbl =
{
&IID_ITextSearch,
&ITextSearch_ServerInfo,
13,
&ITextSearch_table[-3],
CStdStubBuffer_DELEGATING_METHODS
};
static const MIDL_STUB_DESC Object_StubDesc =
{
0,
NdrOleAllocate,
NdrOleFree,
0,
0,
0,
0,
0,
TextSearchCom__MIDL_TypeFormatString.Format,
1, /* -error bounds_check flag */
0x50002, /* Ndr library version */
0,
0x800025b, /* MIDL Version 8.0.603 */
0,
UserMarshalRoutines,
0, /* notify & notify_flag routine table */
0x1, /* MIDL flag */
0, /* cs routines */
0, /* proxy/server info */
0
};
const CInterfaceProxyVtbl * const _TextSearchCom_ProxyVtblList[] =
{
( CInterfaceProxyVtbl *) &_ITextSearchProxyVtbl,
0
};
const CInterfaceStubVtbl * const _TextSearchCom_StubVtblList[] =
{
( CInterfaceStubVtbl *) &_ITextSearchStubVtbl,
0
};
PCInterfaceName const _TextSearchCom_InterfaceNamesList[] =
{
"ITextSearch",
0
};
const IID * const _TextSearchCom_BaseIIDList[] =
{
&IID_IDispatch,
0
};
#define _TextSearchCom_CHECK_IID(n) IID_GENERIC_CHECK_IID( _TextSearchCom, pIID, n)
int __stdcall _TextSearchCom_IID_Lookup( const IID * pIID, int * pIndex )
{
if(!_TextSearchCom_CHECK_IID(0))
{
*pIndex = 0;
return 1;
}
return 0;
}
const ExtendedProxyFileInfo TextSearchCom_ProxyFileInfo =
{
(PCInterfaceProxyVtblList *) & _TextSearchCom_ProxyVtblList,
(PCInterfaceStubVtblList *) & _TextSearchCom_StubVtblList,
(const PCInterfaceName * ) & _TextSearchCom_InterfaceNamesList,
(const IID ** ) & _TextSearchCom_BaseIIDList,
& _TextSearchCom_IID_Lookup,
1,
2,
0, /* table of [async_uuid] interfaces */
0, /* Filler1 */
0, /* Filler2 */
0 /* Filler3 */
};
#pragma optimize("", on )
#if _MSC_VER >= 1200
#pragma warning(pop)
#endif
#endif /* !defined(_M_IA64) && !defined(_M_AMD64) && !defined(_ARM_) */
| [
"[email protected]"
] | |
812b84289260b44c03ddb293e0df0ca4fad2706d | bcff8dedd761fa2ce9e4863334feea96fcae18b1 | /1-19-0/9.2.10.c | 061cb329dc8b492eeb0d21a0c7690c5cc0393d0f | [] | no_license | darlinzhang/itc-expand-testcase | 65c74df59c691e763f5c4827b3e48e98072ff8f5 | 3cacc3b3e1a023bb42883815e79eb0d0336cad32 | refs/heads/master | 2022-12-01T17:46:23.630818 | 2020-07-22T04:51:09 | 2020-07-22T04:51:09 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 563 | c | /*
From:ITC
9
Static memory defects
9.2
Static buffer underrun
9.2.10
a decrement in a loop pointer value
*/
#include<stdio.h>
extern int sink;
int underrun_st_010_gbl_buf[5];
void underrun_st_010 ()
{
int *p;
int i;
p = &underrun_st_010_gbl_buf[4];
for (i = 0; i < 5; i ++)
{
*p = 1; /*Tool should not detect this line as error*/ /*No ERROR:Data Underrun*/
p --;
}
} | [
"[email protected]"
] | |
5338894570137488c24cc0911a22c1ceded10853 | d98a957583e3d7e1ad822a74d24052c57ab3bbce | /model/compare/fail_compare_uint16_nully.c | 6b4256811bda16eaa4e1f3686dad7816219403e3 | [
"MIT"
] | permissive | VeloPayments/v-portable-runtime | c0cd8cca5f0d68e37783f1cac9d1f075d8e95034 | 0e19f718f40786d44517d8f8fbd341e05a92b649 | refs/heads/master | 2023-09-03T19:16:34.938669 | 2023-08-17T23:08:32 | 2023-08-17T23:08:32 | 249,749,371 | 0 | 1 | MIT | 2023-08-17T23:08:34 | 2020-03-24T15:45:48 | C | UTF-8 | C | false | false | 409 | c | /**
* \file fail_compare_uint16_nully.c
*
* A null right hand side argument causes a model assertion.
*
* \copyright 2017 Velo Payments, Inc. All rights reserved.
*/
#include <stdlib.h>
#include <cbmc/model_assert.h>
#include <vpr/compare.h>
uint16_t nondet_arg1();
int main(int argc, char* argv[])
{
uint16_t x = nondet_arg1();
compare_uint16(&x, NULL, sizeof(uint16_t));
return 0;
}
| [
"[email protected]"
] | |
c8a08597eaf48f7a86c17dbe2845af19d17b0b8d | 25150bd340f99873b8ea7b226f019748139b5839 | /0x06-pointers_arrays_strings/3-strcmp.c | 90a4f13ca4f677a836b4fbb3257d52190e9411d4 | [] | no_license | daviddlhz/holbertonschool-low_level_programming | 5f09cda92ac23eb6e08c6ee39f4c9f82206e7c39 | 0db27256f4ebf0a0df0c0b081bdd9aa6f3d2f840 | refs/heads/master | 2020-12-29T07:37:41.444139 | 2020-08-27T18:13:08 | 2020-08-27T18:13:08 | 238,516,872 | 0 | 1 | null | null | null | null | UTF-8 | C | false | false | 364 | c | #include "holberton.h"
/**
* _strcmp - check the code for Holberton School students.
* @s1: is the parameter.
* @s2: is other parameter.
* Return: Always 0.
*/
int _strcmp(char *s1, char *s2)
{
int i;
i = 0;
while (s1[i] != '\0')
{
if (s1[i] > s2[i])
return (s1[i] - s2[i]);
if (s1[i] < s2[i])
return (s1[i] - s2[i]);
i++;
}
return (0);
}
| [
"[email protected]"
] | |
81c1a27a46ed7c150f013528e0caa25b40408d73 | 807defa0b721bb6d99af674ba1a6c537626f62a6 | /C05/ex01/ft_recursive_factorial.c | 4f7688137b9cfc51b4289af13cc7cd022e4ebcd0 | [] | no_license | Schwalm93/42_Piscine | 79838297f8a1ef53e20231cc1d6dab691c9ea627 | 5eb316b03667b399e86e95e01503540f351141c7 | refs/heads/master | 2023-06-07T15:15:50.642534 | 2021-02-25T11:18:57 | 2021-02-25T11:18:57 | 342,159,526 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,078 | c | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_recursive_factorial.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cschwalm <[email protected]. +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/02/23 11:52:11 by cschwalm #+# #+# */
/* Updated: 2021/02/23 14:47:41 by cschwalm ### ########.fr */
/* */
/* ************************************************************************** */
int ft_recursive_factorial(int nb)
{
if (nb > 0)
{
if (nb > 1)
{
return (nb * ft_recursive_factorial(nb - 1));
}
else
{
return (1);
}
}
else
{
return (0);
}
}
| [
"[email protected]"
] | |
24b705753c794e4b0e942819712d2c31968b4bc3 | 79618a8934e76ac675c386c54f97ca1cd5b576a7 | /syssoft/lab1/task4/procfs_status.c | db32e6885e9aaeeb7798253b7e59757c4d51255c | [] | no_license | ididitbad/itmo | ac645ffb8406c1a0402d197ab209e2f6ba22b98a | a655dfa364e9e2779743c52020146786bc8b3fda | refs/heads/master | 2020-08-07T06:56:31.284782 | 2019-10-10T09:25:07 | 2019-10-10T09:52:30 | 213,342,629 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 6,012 | c | /*-
* Copyright (c) 1993 Jan-Simon Pendry
* Copyright (c) 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Jan-Simon Pendry.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)procfs_status.c 8.4 (Berkeley) 6/15/94
*
* From:
* $Id: procfs_status.c,v 3.1 1993/12/15 09:40:17 jsp Exp $
* $FreeBSD: releng/10.3/sys/fs/procfs/procfs_status.c 293473 2016-01-09 14:08:10Z dchagin $
*/
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/systm.h>
#include <sys/exec.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/jail.h>
#include <sys/malloc.h>
#include <sys/mutex.h>
#include <sys/sx.h>
#include <sys/proc.h>
#include <sys/resourcevar.h>
#include <sys/sbuf.h>
#include <sys/sysent.h>
#include <sys/tty.h>
#include <vm/vm.h>
#include <vm/pmap.h>
#include <vm/vm_param.h>
#include <fs/pseudofs/pseudofs.h>
#include <fs/procfs/procfs.h>
#include <sys/libkern.h>
int
procfs_doprocstatus(PFS_FILL_ARGS)
{
struct session *sess;
struct thread *tdfirst;
struct tty *tp;
struct ucred *cr;
const char *wmesg;
char *pc;
char *sep;
int pid, ppid, pgid, sid;
int i;
pid = p->p_pid;
PROC_LOCK(p);
ppid = p->p_pptr ? p->p_pptr->p_pid : 0;
pgid = p->p_pgrp->pg_id;
sess = p->p_pgrp->pg_session;
SESS_LOCK(sess);
sid = sess->s_leader ? sess->s_leader->p_pid : 0;
/* comm pid ppid pgid sid tty ctty,sldr start ut st wmsg
euid ruid rgid,egid,groups[1 .. ngroups]
*/
pc = p->p_comm;
do {
if (*pc < 33 || *pc > 126 || *pc == '\\')
sbuf_printf(sb, "\\%03o", *pc);
else
sbuf_putc(sb, *pc);
} while (*++pc);
sbuf_printf(sb, " %d %d %d %d ", pid, ppid, pgid, sid);
if ((p->p_flag & P_CONTROLT) && (tp = sess->s_ttyp))
sbuf_printf(sb, "%s ", devtoname(tp->t_dev));
else
sbuf_printf(sb, "- ");
sep = "";
if (sess->s_ttyvp) {
sbuf_printf(sb, "%sctty", sep);
sep = ",";
}
if (SESS_LEADER(p)) {
sbuf_printf(sb, "%ssldr", sep);
sep = ",";
}
SESS_UNLOCK(sess);
if (*sep != ',') {
sbuf_printf(sb, "noflags");
}
tdfirst = FIRST_THREAD_IN_PROC(p);
thread_lock(tdfirst);
if (tdfirst->td_wchan != NULL) {
KASSERT(tdfirst->td_wmesg != NULL,
("wchan %p has no wmesg", tdfirst->td_wchan));
wmesg = tdfirst->td_wmesg;
} else
wmesg = "nochan";
thread_unlock(tdfirst);
if (p->p_flag & P_INMEM) {
struct timeval start, ut, st;
PROC_STATLOCK(p);
calcru(p, &ut, &st);
PROC_STATUNLOCK(p);
start = p->p_stats->p_start;
timevaladd(&start, &boottime);
sbuf_printf(sb, " %jd,%ld %jd,%ld %jd,%ld",
(intmax_t)start.tv_sec, start.tv_usec,
(intmax_t)ut.tv_sec, ut.tv_usec,
(intmax_t)st.tv_sec, st.tv_usec);
} else
sbuf_printf(sb, " -1,-1 -1,-1 -1,-1");
sbuf_printf(sb, " %s", wmesg);
cr = p->p_ucred;
sbuf_printf(sb, " %lu %lu %lu",
(u_long)cr->cr_uid,
(u_long)cr->cr_ruid,
(u_long)cr->cr_rgid);
/* egid (cr->cr_svgid) is equal to cr_ngroups[0]
see also getegid(2) in /sys/kern/kern_prot.c */
for (i = 0; i < cr->cr_ngroups; i++) {
sbuf_printf(sb, ",%lu", (u_long)cr->cr_groups[i]);
}
if (jailed(cr)) {
mtx_lock(&cr->cr_prison->pr_mtx);
sbuf_printf(sb, " %s",
prison_name(td->td_ucred->cr_prison, cr->cr_prison));
mtx_unlock(&cr->cr_prison->pr_mtx);
} else {
sbuf_printf(sb, " -");
}
PROC_UNLOCK(p);
sbuf_printf(sb, "\n");
return (0);
}
int
procfs_doproccmdline(PFS_FILL_ARGS)
{
/*
* If we are using the ps/cmdline caching, use that. Otherwise
* read argv from the process space.
* Note that if the argv is no longer available, we deliberately
* don't fall back on p->p_comm or return an error: the authentic
* Linux behaviour is to return zero-length in this case.
*/
PROC_LOCK(p);
if (p->p_args && p_cansee(td, p) == 0) {
sbuf_bcpy(sb, p->p_args->ar_args, p->p_args->ar_length);
/*
* function behaviour changed so now if process has a
* substring 'HIDE' in it's arguments label 'HIDDEN: '
* appears in the beginning of cmdline
* (when reading from /proc/$pid/cmdline )
*/
sbuf_finish(sb);
char tmp[sbuf_len(sb)];
int i, j;
for (i = 0, j = 0; i < sbuf_len(sb); i++) {
if (sb->s_buf[i] != 0) {
tmp[j++] = sb->s_buf[i];
}
}
tmp[j] = '\0';
if (strstr(tmp, "HIDE\0") != NULL) {
sbuf_clear(sb);
sbuf_cat(sb, "HIDDEN: ");
sbuf_bcat(sb, p->p_args->ar_args, p->p_args->ar_length);
}
PROC_UNLOCK(p);
return (0);
}
if ((p->p_flag & P_SYSTEM) != 0) {
PROC_UNLOCK(p);
return (0);
}
PROC_UNLOCK(p);
return (proc_getargv(td, p, sb));
}
| [
"[email protected]"
] | |
a90333229a9392e9818fd03d49d879492dba03ee | 976f5e0b583c3f3a87a142187b9a2b2a5ae9cf6f | /source/lab/engine/code/cgame/extr_cg_weapons.c_CG_ShotgunEjectBrass.c | 5cad140a55562afa2e9df5eb1b5208270b572a31 | [] | no_license | isabella232/AnghaBench | 7ba90823cf8c0dd25a803d1688500eec91d1cf4e | 9a5f60cdc907a0475090eef45e5be43392c25132 | refs/heads/master | 2023-04-20T09:05:33.024569 | 2021-05-07T18:36:26 | 2021-05-07T18:36:26 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 4,613 | c | #define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_20__ TYPE_9__ ;
typedef struct TYPE_19__ TYPE_8__ ;
typedef struct TYPE_18__ TYPE_7__ ;
typedef struct TYPE_17__ TYPE_6__ ;
typedef struct TYPE_16__ TYPE_5__ ;
typedef struct TYPE_15__ TYPE_4__ ;
typedef struct TYPE_14__ TYPE_3__ ;
typedef struct TYPE_13__ TYPE_2__ ;
typedef struct TYPE_12__ TYPE_1__ ;
/* Type definitions */
typedef int* vec3_t ;
struct TYPE_15__ {int /*<<< orphan*/ hModel; int /*<<< orphan*/ axis; int /*<<< orphan*/ origin; } ;
typedef TYPE_4__ refEntity_t ;
struct TYPE_13__ {int* trBase; int* trDelta; scalar_t__ trTime; int /*<<< orphan*/ trType; } ;
struct TYPE_14__ {int /*<<< orphan*/ trDelta; int /*<<< orphan*/ trBase; scalar_t__ trTime; int /*<<< orphan*/ trType; } ;
struct TYPE_16__ {float bounceFactor; int /*<<< orphan*/ leMarkType; int /*<<< orphan*/ leBounceSoundType; int /*<<< orphan*/ leFlags; TYPE_2__ angles; TYPE_3__ pos; scalar_t__ startTime; scalar_t__ endTime; int /*<<< orphan*/ leType; TYPE_4__ refEntity; } ;
typedef TYPE_5__ localEntity_t ;
struct TYPE_17__ {int /*<<< orphan*/ lerpOrigin; int /*<<< orphan*/ lerpAngles; } ;
typedef TYPE_6__ centity_t ;
struct TYPE_20__ {scalar_t__ time; } ;
struct TYPE_19__ {int integer; } ;
struct TYPE_12__ {int /*<<< orphan*/ shotgunBrassModel; } ;
struct TYPE_18__ {TYPE_1__ media; } ;
/* Variables and functions */
int /*<<< orphan*/ AnglesToAxis (int /*<<< orphan*/ ,int**) ;
int /*<<< orphan*/ AxisCopy (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
TYPE_5__* CG_AllocLocalEntity () ;
int CG_PointContents (int /*<<< orphan*/ ,int) ;
int CONTENTS_WATER ;
int /*<<< orphan*/ LEBS_BRASS ;
int /*<<< orphan*/ LEF_TUMBLE ;
int /*<<< orphan*/ LEMT_NONE ;
int /*<<< orphan*/ LE_FRAGMENT ;
int /*<<< orphan*/ TR_GRAVITY ;
int /*<<< orphan*/ TR_LINEAR ;
int /*<<< orphan*/ VectorAdd (int /*<<< orphan*/ ,int*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ VectorCopy (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ VectorScale (int*,float,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ axisDefault ;
TYPE_9__ cg ;
TYPE_8__ cg_brassTime ;
TYPE_7__ cgs ;
int crandom () ;
int rand () ;
int random () ;
__attribute__((used)) static void CG_ShotgunEjectBrass( centity_t *cent ) {
localEntity_t *le;
refEntity_t *re;
vec3_t velocity, xvelocity;
vec3_t offset, xoffset;
vec3_t v[3];
int i;
if ( cg_brassTime.integer <= 0 ) {
return;
}
for ( i = 0; i < 2; i++ ) {
float waterScale = 1.0f;
le = CG_AllocLocalEntity();
re = &le->refEntity;
velocity[0] = 60 + 60 * crandom();
if ( i == 0 ) {
velocity[1] = 40 + 10 * crandom();
} else {
velocity[1] = -40 + 10 * crandom();
}
velocity[2] = 100 + 50 * crandom();
le->leType = LE_FRAGMENT;
le->startTime = cg.time;
le->endTime = le->startTime + cg_brassTime.integer*3 + cg_brassTime.integer * random();
le->pos.trType = TR_GRAVITY;
le->pos.trTime = cg.time;
AnglesToAxis( cent->lerpAngles, v );
offset[0] = 8;
offset[1] = 0;
offset[2] = 24;
xoffset[0] = offset[0] * v[0][0] + offset[1] * v[1][0] + offset[2] * v[2][0];
xoffset[1] = offset[0] * v[0][1] + offset[1] * v[1][1] + offset[2] * v[2][1];
xoffset[2] = offset[0] * v[0][2] + offset[1] * v[1][2] + offset[2] * v[2][2];
VectorAdd( cent->lerpOrigin, xoffset, re->origin );
VectorCopy( re->origin, le->pos.trBase );
if ( CG_PointContents( re->origin, -1 ) & CONTENTS_WATER ) {
waterScale = 0.10f;
}
xvelocity[0] = velocity[0] * v[0][0] + velocity[1] * v[1][0] + velocity[2] * v[2][0];
xvelocity[1] = velocity[0] * v[0][1] + velocity[1] * v[1][1] + velocity[2] * v[2][1];
xvelocity[2] = velocity[0] * v[0][2] + velocity[1] * v[1][2] + velocity[2] * v[2][2];
VectorScale( xvelocity, waterScale, le->pos.trDelta );
AxisCopy( axisDefault, re->axis );
re->hModel = cgs.media.shotgunBrassModel;
le->bounceFactor = 0.3f;
le->angles.trType = TR_LINEAR;
le->angles.trTime = cg.time;
le->angles.trBase[0] = rand()&31;
le->angles.trBase[1] = rand()&31;
le->angles.trBase[2] = rand()&31;
le->angles.trDelta[0] = 1;
le->angles.trDelta[1] = 0.5;
le->angles.trDelta[2] = 0;
le->leFlags = LEF_TUMBLE;
le->leBounceSoundType = LEBS_BRASS;
le->leMarkType = LEMT_NONE;
}
} | [
"[email protected]"
] | |
d8816eaa1cf7ac7d2cfe33c75f90d671aff94320 | 31090b82fcf15fc8a52a12be3dd592e72300fe1b | /sys/dev/hatm/if_hatmreg.h | 283b115020316c60781993e4587679e2ac5a42e3 | [] | no_license | YuheiTakagawa/VPS_for_FreeBSD | 22e7b2f4e46b56e8289e7cd81eedf1d503ec2a0d | 1a6d0ed8808b875b998f2f344cfc5539eb84532d | refs/heads/master | 2020-07-15T09:24:26.928246 | 2017-08-11T17:43:29 | 2017-08-11T17:43:29 | 94,305,728 | 2 | 1 | null | null | null | null | UTF-8 | C | false | false | 19,648 | h | /*-
* Copyright (c) 2001-2003
* Fraunhofer Institute for Open Communication Systems (FhG Fokus).
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* Author: Hartmut Brandt <[email protected]>
*
* $FreeBSD: projects/vps/sys/dev/hatm/if_hatmreg.h 139749 2005-01-06 01:43:34Z imp $
*
* Fore HE driver for NATM
*/
/* check configuration */
#if HE_CONFIG_VPI_BITS + HE_CONFIG_VCI_BITS > 12
#error "hatm: too many bits configured for VPI/VCI"
#endif
#define HE_MAX_VCCS (1 << (HE_CONFIG_VPI_BITS + HE_CONFIG_VCI_BITS))
#define HE_VPI_MASK ((1 << (HE_CONFIG_VPI_BITS))-1)
#define HE_VCI_MASK ((1 << (HE_CONFIG_VCI_BITS))-1)
#define HE_VPI(CID) (((CID) >> HE_CONFIG_VCI_BITS) & HE_VPI_MASK)
#define HE_VCI(CID) ((CID) & HE_VCI_MASK)
#define HE_CID(VPI,VCI) ((((VPI) & HE_VPI_MASK) << HE_CONFIG_VCI_BITS) | \
((VCI) & HE_VCI_MASK))
/* GEN_CNTL_0 register */
#define HE_PCIR_GEN_CNTL_0 0x40
#define HE_PCIM_CTL0_64BIT (1 << 0)
#define HE_PCIM_CTL0_IGNORE_TIMEOUT (1 << 1)
#define HE_PCIM_CTL0_INIT_ENB (1 << 2)
#define HE_PCIM_CTL0_MRM (1 << 4)
#define HE_PCIM_CTL0_MRL (1 << 5)
#define HE_PCIM_CTL0_BIGENDIAN (1 << 16)
#define HE_PCIM_CTL0_INT_PROC_ENB (1 << 25)
/*
* Memory registers
*/
#define HE_REGO_FLASH 0x00000
#define HE_REGO_RESET_CNTL 0x80000
#define HE_REGM_RESET_STATE (1 << 6)
#define HE_REGO_HOST_CNTL 0x80004
#define HE_REGM_HOST_BUS64 (1 << 27)
#define HE_REGM_HOST_DESC_RD64 (1 << 26)
#define HE_REGM_HOST_DATA_RD64 (1 << 25)
#define HE_REGM_HOST_DATA_WR64 (1 << 24)
#define HE_REGM_HOST_PROM_SEL (1 << 12)
#define HE_REGM_HOST_PROM_WREN (1 << 11)
#define HE_REGM_HOST_PROM_DATA_OUT (1 << 10)
#define HE_REGS_HOST_PROM_DATA_OUT 10
#define HE_REGM_HOST_PROM_DATA_IN (1 << 9)
#define HE_REGS_HOST_PROM_DATA_IN 9
#define HE_REGM_HOST_PROM_CLOCK (1 << 8)
#define HE_REGM_HOST_PROM_BITS (0x00001f00)
#define HE_REGM_HOST_QUICK_RD (1 << 7)
#define HE_REGM_HOST_QUICK_WR (1 << 6)
#define HE_REGM_HOST_OUTFF_ENB (1 << 5)
#define HE_REGM_HOST_CMDFF_ENB (1 << 4)
#define HE_REGO_LB_SWAP 0x80008
#define HE_REGM_LBSWAP_RNUM (0xf << 27)
#define HE_REGS_LBSWAP_RNUM 27
#define HE_REGM_LBSWAP_DATA_WR_SWAP (1 << 20)
#define HE_REGM_LBSWAP_DESC_RD_SWAP (1 << 19)
#define HE_REGM_LBSWAP_DATA_RD_SWAP (1 << 18)
#define HE_REGM_LBSWAP_INTR_SWAP (1 << 17)
#define HE_REGM_LBSWAP_DESC_WR_SWAP (1 << 16)
#define HE_REGM_LBSWAP_BIG_ENDIAN (1 << 14)
#define HE_REGM_LBSWAP_XFER_SIZE (1 << 7)
#define HE_REGO_LB_MEM_ADDR 0x8000C
#define HE_REGO_LB_MEM_DATA 0x80010
#define HE_REGO_LB_MEM_ACCESS 0x80014
#define HE_REGM_LB_MEM_HNDSHK (1 << 30)
#define HE_REGM_LB_MEM_READ 0x3
#define HE_REGM_LB_MEM_WRITE 0x7
#define HE_REGO_SDRAM_CNTL 0x80018
#define HE_REGM_SDRAM_64BIT (1 << 3)
#define HE_REGO_INT_FIFO 0x8001C
#define HE_REGM_INT_FIFO_CLRA (1 << 8)
#define HE_REGM_INT_FIFO_CLRB (1 << 9)
#define HE_REGM_INT_FIFO_CLRC (1 << 10)
#define HE_REGM_INT_FIFO_CLRD (1 << 11)
#define HE_REGO_ABORT_ADDR 0x80020
#define HE_REGO_IRQ0_BASE 0x80080
#define HE_REGO_IRQ_BASE(Q) (HE_REGO_IRQ0_BASE + (Q) * 0x10 + 0x00)
#define HE_REGM_IRQ_BASE_TAIL 0x3ff
#define HE_REGO_IRQ_HEAD(Q) (HE_REGO_IRQ0_BASE + (Q) * 0x10 + 0x04)
#define HE_REGS_IRQ_HEAD_SIZE 22
#define HE_REGS_IRQ_HEAD_THRESH 12
#define HE_REGS_IRQ_HEAD_HEAD 2
#define HE_REGO_IRQ_CNTL(Q) (HE_REGO_IRQ0_BASE + (Q) * 0x10 + 0x08)
#define HE_REGM_IRQ_A (0 << 2)
#define HE_REGM_IRQ_B (1 << 2)
#define HE_REGM_IRQ_C (2 << 2)
#define HE_REGM_IRQ_D (3 << 2)
#define HE_REGO_IRQ_DATA(Q) (HE_REGO_IRQ0_BASE + (Q) * 0x10 + 0x0C)
#define HE_REGO_GRP_1_0_MAP 0x800C0
#define HE_REGO_GRP_3_2_MAP 0x800C4
#define HE_REGO_GRP_5_4_MAP 0x800C8
#define HE_REGO_GRP_7_6_MAP 0x800CC
/*
* Receive buffer pools
*/
#define HE_REGO_G0_RBPS_S 0x80400
#define HE_REGO_G0_RBPS_T 0x80404
#define HE_REGO_G0_RBPS_QI 0x80408
#define HE_REGO_G0_RBPS_BL 0x8040C
#define HE_REGO_RBP_S(K,G) (HE_REGO_G0_RBPS_S + (K) * 0x10 + (G) * 0x20)
#define HE_REGO_RBP_T(K,G) (HE_REGO_G0_RBPS_T + (K) * 0x10 + (G) * 0x20)
#define HE_REGO_RBP_QI(K,G) (HE_REGO_G0_RBPS_QI + (K) * 0x10 + (G) * 0x20)
#define HE_REGO_RBP_BL(K,G) (HE_REGO_G0_RBPS_BL + (K) * 0x10 + (G) * 0x20)
#define HE_REGS_RBP_HEAD 3
#define HE_REGS_RBP_TAIL 3
#define HE_REGS_RBP_SIZE 14
#define HE_REGM_RBP_INTR_ENB (1 << 13)
#define HE_REGS_RBP_THRESH 0
/*
* Receive buffer return queues
*/
#define HE_REGO_G0_RBRQ_ST 0x80500
#define HE_REGO_G0_RBRQ_H 0x80504
#define HE_REGO_G0_RBRQ_Q 0x80508
#define HE_REGO_G0_RBRQ_I 0x8050C
#define HE_REGO_RBRQ_ST(G) (HE_REGO_G0_RBRQ_ST + (G) * 0x10)
#define HE_REGO_RBRQ_H(G) (HE_REGO_G0_RBRQ_H + (G) * 0x10)
#define HE_REGO_RBRQ_Q(G) (HE_REGO_G0_RBRQ_Q + (G) * 0x10)
#define HE_REGO_RBRQ_I(G) (HE_REGO_G0_RBRQ_I + (G) * 0x10)
#define HE_REGS_RBRQ_HEAD 3
#define HE_REGS_RBRQ_THRESH 13
#define HE_REGS_RBRQ_SIZE 0
#define HE_REGS_RBRQ_TIME 8
#define HE_REGS_RBRQ_COUNT 0
/*
* Intermediate queues
*/
#define HE_REGO_G0_INMQ_S 0x80580
#define HE_REGO_G0_INMQ_L 0x80584
#define HE_REGO_INMQ_S(G) (HE_REGO_G0_INMQ_S + (G) * 8)
#define HE_REGO_INMQ_L(G) (HE_REGO_G0_INMQ_L + (G) * 8)
#define HE_REGO_RHCONFIG 0x805C0
#define HE_REGM_RHCONFIG_PHYENB (1 << 10)
#define HE_REGS_RHCONFIG_OAM_GID 7
#define HE_REGS_RHCONFIG_PTMR_PRE 0
/*
* Transmit buffer return queues
*/
#define HE_REGO_TBRQ0_B_T 0x80600
#define HE_REGO_TBRQ0_H 0x80604
#define HE_REGO_TBRQ0_S 0x80608
#define HE_REGO_TBRQ0_THRESH 0x8060C
#define HE_REGO_TBRQ_B_T(G) (HE_REGO_TBRQ0_B_T + (G) * 0x10)
#define HE_REGO_TBRQ_H(G) (HE_REGO_TBRQ0_H + (G) * 0x10)
#define HE_REGO_TBRQ_S(G) (HE_REGO_TBRQ0_S + (G) * 0x10)
#define HE_REGO_TBRQ_THRESH(G) (HE_REGO_TBRQ0_THRESH + (G) * 0x10)
#define HE_REGS_TBRQ_HEAD 2
/*
* Transmit packet descriptor ready queue
*/
#define HE_REGO_TPDRQ_H 0x80680
#define HE_REGS_TPDRQ_H_H 3
/* #define HE_REGM_TPDRQ_H_H ((HE_CONFIG_TPDRQ_SIZE - 1) << 3) */
#define HE_REGO_TPDRQ_T 0x80684
#define HE_REGS_TPDRQ_T_T 3
/* #define HE_REGM_TPDRQ_T_T ((HE_CONFIG_TPDRQ_SIZE - 1) << 3) */
#define HE_REGO_TPDRQ_S 0x80688
#define HE_REGO_UBUFF_BA 0x8068C
#define HE_REGO_RLBF0_H 0x806C0
#define HE_REGO_RLBF0_T 0x806C4
#define HE_REGO_RLBF1_H 0x806C8
#define HE_REGO_RLBF1_T 0x806CC
#define HE_REGO_RLBF_H(N) (HE_REGO_RLBF0_H + (N) * 8)
#define HE_REGO_RLBF_T(N) (HE_REGO_RLBF0_T + (N) * 8)
#define HE_REGO_RLBC_H 0x806D0
#define HE_REGO_RLBC_T 0x806D4
#define HE_REGO_RLBC_H2 0x806D8
#define HE_REGO_TLBF_H 0x806E0
#define HE_REGO_TLBF_T 0x806E4
#define HE_REGO_RLBF0_C 0x806E8
#define HE_REGO_RLBF1_C 0x806EC
#define HE_REGO_RLBF_C(N) (HE_REGO_RLBF0_C + (N) * 4)
#define HE_REGO_RXTHRSH 0x806F0
#define HE_REGO_LITHRSH 0x806F4
#define HE_REGO_LBARB 0x80700
#define HE_REGS_LBARB_SLICE 28
#define HE_REGS_LBARB_RNUM 23
#define HE_REGS_LBARB_THPRI 21
#define HE_REGS_LBARB_RHPRI 19
#define HE_REGS_LBARB_TLPRI 17
#define HE_REGS_LBARB_RLPRI 15
#define HE_REGS_LBARB_BUS_MULT 8
#define HE_REGS_LBARB_NET_PREF 0
#define HE_REGO_SDRAMCON 0x80704
#define HE_REGM_SDRAMCON_BANK (1 << 14)
#define HE_REGM_SDRAMCON_WIDE (1 << 13)
#define HE_REGM_SDRAMCON_TWRWAIT (1 << 12)
#define HE_REGM_SDRAMCON_TRPWAIT (1 << 11)
#define HE_REGM_SDRAMCON_TRASWAIT (1 << 10)
#define HE_REGS_SDRAMCON_REF 0
#define HE_REGO_RCCSTAT 0x8070C
#define HE_REGM_RCCSTAT_PROG (1 << 0)
#define HE_REGO_TCMCONFIG 0x80740
#define HE_REGS_TCMCONFIG_BANK_WAIT 6
#define HE_REGS_TCMCONFIG_RW_WAIT 2
#define HE_REGS_TCMCONFIG_TYPE 0
#define HE_REGO_TSRB_BA 0x80744
#define HE_REGO_TSRC_BA 0x80748
#define HE_REGO_TMABR_BA 0x8074C
#define HE_REGO_TPD_BA 0x80750
#define HE_REGO_TSRD_BA 0x80758
#define HE_REGO_TXCONFIG 0x80760
#define HE_REGS_TXCONFIG_THRESH 22
#define HE_REGM_TXCONFIG_UTMODE (1 << 21)
#define HE_REGS_TXCONFIG_VCI_MASK 17
#define HE_REGS_TXCONFIG_LBFREE 0
#define HE_REGO_TXAAL5_PROTO 0x80764
#define HE_REGO_RCMCONFIG 0x80780
#define HE_REGS_RCMCONFIG_BANK_WAIT 6
#define HE_REGS_RCMCONFIG_RW_WAIT 2
#define HE_REGS_RCMCONFIG_TYPE 0
#define HE_REGO_RCMRSRB_BA 0x80784
#define HE_REGO_RCMLBM_BA 0x80788
#define HE_REGO_RCMABR_BA 0x8078C
#define HE_REGO_RCCONFIG 0x807C0
#define HE_REGS_RCCONFIG_UTDELAY 11
#define HE_REGM_RCCONFIG_WRAP_MODE (1 << 10)
#define HE_REGM_RCCONFIG_UT_MODE (1 << 9)
#define HE_REGM_RCCONFIG_RXENB (1 << 8)
#define HE_REGS_RCCONFIG_VP 4
#define HE_REGS_RCCONFIG_VC 0
#define HE_REGO_MCC 0x807C4
#define HE_REGO_OEC 0x807C8
#define HE_REGO_DCC 0x807CC
#define HE_REGO_CEC 0x807D0
#define HE_REGO_HSP_BA 0x807F0
#define HE_REGO_LBCONFIG 0x807F4
#define HE_REGO_CON_DAT 0x807F8
#define HE_REGO_CON_CTL 0x807FC
#define HE_REGM_CON_MBOX (2 << 30)
#define HE_REGM_CON_TCM (1 << 30)
#define HE_REGM_CON_RCM (0 << 30)
#define HE_REGM_CON_WE (1 << 29)
#define HE_REGM_CON_STATUS (1 << 28)
#define HE_REGM_CON_DIS3 (1 << 22)
#define HE_REGM_CON_DIS2 (1 << 21)
#define HE_REGM_CON_DIS1 (1 << 20)
#define HE_REGM_CON_DIS0 (1 << 19)
#define HE_REGS_CON_DIS 19
#define HE_REGS_CON_ADDR 0
#define HE_REGO_SUNI 0x80800
#define HE_REGO_SUNI_END 0x80C00
#define HE_REGO_END 0x100000
/*
* MBOX registers
*/
#define HE_REGO_CS_STPER0 0x000
#define HE_REGO_CS_STPER(G) (HE_REGO_CS_STPER0 + (G))
#define HE_REGN_CS_STPER 32
#define HE_REGO_CS_STTIM0 0x020
#define HE_REGO_CS_STTIM(G) (HE_REGO_CS_STTIM0 + (G))
#define HE_REGO_CS_TGRLD0 0x040
#define HE_REGO_CS_TGRLD(G) (HE_REGO_CS_TGRLD0 + (G))
#define HE_REGO_CS_ERTHR0 0x50
#define HE_REGO_CS_ERTHR1 0x51
#define HE_REGO_CS_ERTHR2 0x52
#define HE_REGO_CS_ERTHR3 0x53
#define HE_REGO_CS_ERTHR4 0x54
#define HE_REGO_CS_ERCTL0 0x55
#define HE_REGO_CS_ERCTL1 0x56
#define HE_REGO_CS_ERCTL2 0x57
#define HE_REGO_CS_ERSTAT0 0x58
#define HE_REGO_CS_ERSTAT1 0x59
#define HE_REGO_CS_RTCCT 0x60
#define HE_REGO_CS_RTFWC 0x61
#define HE_REGO_CS_RTFWR 0x62
#define HE_REGO_CS_RTFTC 0x63
#define HE_REGO_CS_RTATR 0x64
#define HE_REGO_CS_TFBSET 0x70
#define HE_REGO_CS_TFBADD 0x71
#define HE_REGO_CS_TFBSUB 0x72
#define HE_REGO_CS_WCRMAX 0x73
#define HE_REGO_CS_WCRMIN 0x74
#define HE_REGO_CS_WCRINC 0x75
#define HE_REGO_CS_WCRDEC 0x76
#define HE_REGO_CS_WCRCEIL 0x77
#define HE_REGO_CS_BWDCNT 0x78
#define HE_REGO_CS_OTPPER 0x80
#define HE_REGO_CS_OTWPER 0x81
#define HE_REGO_CS_OTTLIM 0x82
#define HE_REGO_CS_OTTCNT 0x83
#define HE_REGO_CS_HGRRT0 0x90
#define HE_REGO_CS_HGRRT(G) (HE_REGO_CS_HGRRT0 + (G))
#define HE_REGO_CS_ORPTRS 0xA0
#define HE_REGO_RCON_CLOSE 0x100
#define HE_REGO_CS_END 0x101
#define HE_REGT_CS_ERTHR { \
{ /* 155 */ \
{ 0x000800ea, 0x000400ea, 0x000200ea }, /* ERTHR0 */ \
{ 0x000C3388, 0x00063388, 0x00033388 }, /* ERTHR1 */ \
{ 0x00101018, 0x00081018, 0x00041018 }, /* ERTHR2 */ \
{ 0x00181dac, 0x000c1dac, 0x00061dac }, /* ERTHR3 */ \
{ 0x0028051a, 0x0014051a, 0x000a051a }, /* ERTHR4 */ \
}, { /* 622 */ \
{ 0x000800fa, 0x000400fa, 0x000200fa }, /* ERTHR0 */ \
{ 0x000c33cb, 0x000633cb, 0x000333cb }, /* ERTHR1 */ \
{ 0x0010101b, 0x0008101b, 0x0004101b }, /* ERTHR2 */ \
{ 0x00181dac, 0x000c1dac, 0x00061dac }, /* ERTHR3 */ \
{ 0x00280600, 0x00140600, 0x000a0600 }, /* ERTHR4 */ \
} \
}
#define HE_REGT_CS_ERCTL { \
{ 0x0235e4b1, 0x4701, 0x64b1 }, /* 155 */ \
{ 0x023de8b3, 0x1801, 0x68b3 } /* 622 */ \
}
#define HE_REGT_CS_ERSTAT { \
{ 0x1280, 0x64b1 }, /* 155 */ \
{ 0x1280, 0x68b3 }, /* 622 */ \
}
#define HE_REGT_CS_RTFWR { \
0xf424, /* 155 */ \
0x14585 /* 622 */ \
}
#define HE_REGT_CS_RTATR { \
0x4680, /* 155 */ \
0x4680 /* 622 */ \
}
#define HE_REGT_CS_BWALLOC { \
{ 0x000563b7, 0x64b1, 0x5ab1, 0xe4b1, 0xdab1, 0x64b1 }, /* 155 */\
{ 0x00159ece, 0x68b3, 0x5eb3, 0xe8b3, 0xdeb3, 0x68b3 }, /* 622 */\
}
#define HE_REGT_CS_ORCF { \
{ 0x6, 0x1e }, /* 155 */ \
{ 0x5, 0x14 } /* 622 */ \
}
/*
* TSRs - NR is relative to the starting number of the block
*/
#define HE_REGO_TSRA(BASE,CID,NR) ((BASE) + ((CID) << 3) + (NR))
#define HE_REGO_TSRB(BASE,CID,NR) ((BASE) + ((CID) << 2) + (NR))
#define HE_REGO_TSRC(BASE,CID,NR) ((BASE) + ((CID) << 1) + (NR))
#define HE_REGO_TSRD(BASE,CID) ((BASE) + (CID))
#define HE_REGM_TSR0_CONN_STATE (7 << 28)
#define HE_REGS_TSR0_CONN_STATE 28
#define HE_REGM_TSR0_USE_WMIN (1 << 23)
#define HE_REGM_TSR0_GROUP (7 << 18)
#define HE_REGS_TSR0_GROUP 18
#define HE_REGM_TSR0_TRAFFIC (3 << 16)
#define HE_REGS_TSR0_TRAFFIC 16
#define HE_REGM_TSR0_TRAFFIC_CBR 0
#define HE_REGM_TSR0_TRAFFIC_UBR 1
#define HE_REGM_TSR0_TRAFFIC_ABR 2
#define HE_REGM_TSR0_PROT (1 << 15)
#define HE_REGM_TSR0_AAL (3 << 12)
#define HE_REGS_TSR0_AAL 12
#define HE_REGM_TSR0_AAL_5 0
#define HE_REGM_TSR0_AAL_0 1
#define HE_REGM_TSR0_AAL_0T 2
#define HE_REGM_TSR0_HALT_ER (1 << 11)
#define HE_REGM_TSR0_MARK_CI (1 << 10)
#define HE_REGM_TSR0_MARK_ER (1 << 9)
#define HE_REGM_TSR0_UPDATE_GER (1 << 8)
#define HE_REGM_TSR0_RC 0xff
#define HE_REGM_TSR1_PCR (0x7fff << 16)
#define HE_REGS_TSR1_PCR 16
#define HE_REGM_TSR1_MCR (0x7fff << 0)
#define HE_REGS_TSR1_MCR 0
#define HE_REGM_TSR2_ACR (0x7fff << 16)
#define HE_REGS_TSR2_ACR 16
#define HE_REGM_TSR3_NRM (0xff << 24)
#define HE_REGS_TSR3_NRM 24
#define HE_REGM_TSR3_CRM (0xff << 0)
#define HE_REGS_TSR3_CRM 0
#define HE_REGM_TSR4_FLUSH (1 << 31)
#define HE_REGM_TSR4_SESS_END (1 << 30)
#define HE_REGM_TSR4_OAM_CRC10 (1 << 28)
#define HE_REGM_TSR4_NULL_CRC10 (1 << 27)
#define HE_REGM_TSR4_PROT (1 << 26)
#define HE_REGM_TSR4_AAL (3 << 24)
#define HE_REGS_TSR4_AAL 24
#define HE_REGM_TSR4_AAL_5 0
#define HE_REGM_TSR4_AAL_0 1
#define HE_REGM_TSR4_AAL_0T 2
#define HE_REGM_TSR9_INIT 0x00100000
#define HE_REGM_TSR11_ICR (0x7fff << 16)
#define HE_REGS_TSR11_ICR 16
#define HE_REGM_TSR11_TRM (0x7 << 13)
#define HE_REGS_TSR11_TRM 13
#define HE_REGM_TSR11_NRM (0x7 << 10)
#define HE_REGS_TSR11_NRM 10
#define HE_REGM_TSR11_ADTF 0x3ff
#define HE_REGS_TSR11_ADTF 0
#define HE_REGM_TSR13_RDF (0xf << 23)
#define HE_REGS_TSR13_RDF 23
#define HE_REGM_TSR13_RIF (0xf << 19)
#define HE_REGS_TSR13_RIF 19
#define HE_REGM_TSR13_CDF (0x7 << 16)
#define HE_REGS_TSR13_CDF 16
#define HE_REGM_TSR13_CRM 0xffff
#define HE_REGS_TSR13_CRM 0
#define HE_REGM_TSR14_CBR_DELETE (1 << 31)
#define HE_REGM_TSR14_ABR_CLOSE (1 << 16)
/*
* RSRs
*/
#define HE_REGO_RSRA(BASE,CID,NR) ((BASE) + ((CID) << 3) + (NR))
#define HE_REGO_RSRB(BASE,CID,NR) ((BASE) + ((CID) << 1) + (NR))
#define HE_REGM_RSR0_PTI7 (1 << 15)
#define HE_REGM_RSR0_RM (1 << 14)
#define HE_REGM_RSR0_F5OAM (1 << 13)
#define HE_REGM_RSR0_STARTPDU (1 << 10)
#define HE_REGM_RSR0_OPEN (1 << 6)
#define HE_REGM_RSR0_PPD (1 << 5)
#define HE_REGM_RSR0_EPD (1 << 4)
#define HE_REGM_RSR0_TCPCS (1 << 3)
#define HE_REGM_RSR0_AAL 0x7
#define HE_REGM_RSR0_AAL_5 0x0
#define HE_REGM_RSR0_AAL_0 0x1
#define HE_REGM_RSR0_AAL_0T 0x2
#define HE_REGM_RSR0_AAL_RAW 0x3
#define HE_REGM_RSR0_AAL_RAWCRC10 0x4
#define HE_REGM_RSR1_AQI (1 << 20)
#define HE_REGM_RSR1_RBPL_ONLY (1 << 19)
#define HE_REGM_RSR1_GROUP (7 << 16)
#define HE_REGS_RSR1_GROUP 16
#define HE_REGM_RSR4_AQI (1 << 30)
#define HE_REGM_RSR4_GROUP (7 << 27)
#define HE_REGS_RSR4_GROUP 27
#define HE_REGM_RSR4_RBPL_ONLY (1 << 26)
/*
* Relative to RCMABR_BA
*/
#define HE_REGO_CM_GQTBL 0x000
#define HE_REGL_CM_GQTBL 0x100
#define HE_REGO_CM_RGTBL 0x100
#define HE_REGL_CM_RGTBL 0x100
#define HE_REGO_CM_TNRMTBL 0x200
#define HE_REGL_CM_TNRMTBL 0x100
#define HE_REGO_CM_ORCF 0x300
#define HE_REGL_CM_ORCF 0x100
#define HE_REGO_CM_RTGTBL 0x400
#define HE_REGL_CM_RTGTBL 0x200
#define HE_REGO_CM_IRCF 0x600
#define HE_REGL_CM_IRCF 0x200
/*
* Interrupt Status
*/
#define HE_REGM_ITYPE 0xf8
#define HE_REGM_IGROUP 0x07
#define HE_REGM_ITYPE_TBRQ (0x0 << 3)
#define HE_REGM_ITYPE_TPD (0x1 << 3)
#define HE_REGM_ITYPE_RBPS (0x2 << 3)
#define HE_REGM_ITYPE_RBPL (0x3 << 3)
#define HE_REGM_ITYPE_RBRQ (0x4 << 3)
#define HE_REGM_ITYPE_RBRQT (0x5 << 3)
#define HE_REGM_ITYPE_PHYS (0x6 << 3)
#define HE_REGM_ITYPE_UNKNOWN 0xf8
#define HE_REGM_ITYPE_ERR 0x80
#define HE_REGM_ITYPE_PERR 0x81
#define HE_REGM_ITYPE_ABORT 0x82
#define HE_REGM_ITYPE_INVALID 0xf8
/*
* Serial EEPROM
*/
#define HE_EEPROM_PROD_ID 0x08
#define HE_EEPROM_PROD_ID_LEN 30
#define HE_EEPROM_REV 0x26
#define HE_EEPROM_REV_LEN 4
#define HE_EEPROM_M_SN 0x3A
#define HE_EEPROM_MEDIA 0x3E
#define HE_EEPROM_MAC 0x42
#define HE_MEDIA_UTP155 0x06
#define HE_MEDIA_MMF155 0x26
#define HE_MEDIA_MMF622 0x27
#define HE_MEDIA_SMF155 0x46
#define HE_MEDIA_SMF622 0x47
#define HE_622_CLOCK 66667000
#define HE_155_CLOCK 50000000
/*
* Statistics
*/
struct fatm_statshe {
};
/*
* Queue entries
*/
/* Receive Buffer Pool Queue entry */
struct he_rbpen {
uint32_t phys; /* physical address */
uint32_t handle; /* handle or virtual address */
};
/* Receive Buffer Return Queue entry */
struct he_rbrqen {
uint32_t addr; /* handle and flags */
uint32_t len; /* length and CID */
};
#define HE_REGM_RBRQ_ADDR 0xFFFFFFC0
#define HE_REGS_RBRQ_ADDR 6
#define HE_REGM_RBRQ_FLAGS 0x0000003F
#define HE_REGM_RBRQ_HBUF_ERROR (1 << 0)
#define HE_REGM_RBRQ_CON_CLOSED (1 << 1)
#define HE_REGM_RBRQ_AAL5_PROT (1 << 2)
#define HE_REGM_RBRQ_END_PDU (1 << 3)
#define HE_REGM_RBRQ_LEN_ERROR (1 << 4)
#define HE_REGM_RBRQ_CRC_ERROR (1 << 5)
#define HE_REGM_RBRQ_CID (0x1fff << 16)
#define HE_REGS_RBRQ_CID 16
#define HE_REGM_RBRQ_LEN 0xffff
/* Transmit Packet Descriptor Ready Queue entry */
struct he_tpdrqen {
uint32_t tpd; /* physical address */
uint32_t cid; /* connection id */
};
/* Transmit buffer return queue */
struct he_tbrqen {
uint32_t addr; /* handle and flags */
};
#define HE_REGM_TBRQ_ADDR 0xffffffc0
#define HE_REGM_TBRQ_FLAGS 0x0000000a
#define HE_REGM_TBRQ_EOS 0x00000008
#define HE_REGM_TBRQ_MULT 0x00000002
struct he_tpd {
uint32_t addr; /* handle or virtual address and flags */
uint32_t res; /* reserved */
struct {
uint32_t addr; /* buffer address */
uint32_t len; /* buffer length and flags */
} bufs[3];
};
#define HE_REGM_TPD_ADDR 0xffffffC0
#define HE_REGS_TPD_ADDR 6
#define HE_REGM_TPD_INTR 0x0001
#define HE_REGM_TPD_CLP 0x0002
#define HE_REGM_TPD_EOS 0x0004
#define HE_REGM_TPD_PTI 0x0038
#define HE_REGS_TPD_PTI 3
#define HE_REGM_TPD_LST 0x80000000
/*
* The HOST STATUS PAGE
*/
struct he_hsp {
struct {
uint32_t tbrq_tail;
uint32_t res1[15];
uint32_t rbrq_tail;
uint32_t res2[15];
} group[8];
};
#define HE_MAX_PDU (65535)
| [
"[email protected]"
] | |
5bc3ebdf5ab5663263dff34c306bed19d40d9fd8 | 0c15dcd55c72f4fe007161d49457a2264455caed | /dict.c | abfd60abdd03352e26f582b457079263967d4f7b | [] | no_license | ahoch/C | 99773fccc46345483a704af220dac9888cd84d01 | 32de8319dd3ab5859d945dc1892c61a79ae80d9b | refs/heads/master | 2021-01-10T14:54:13.298332 | 2015-10-21T03:41:48 | 2015-10-21T03:41:48 | 44,650,782 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 769 | c | /* Simple dictionary search for a word. Dictionary file is located in /usr/share/dict. */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
void main(int argc, char** argv) {
char* word = malloc(sizeof(argv[1]+1));
strcpy(word, argv[1]);
word = strcat(word, "\n");
printf("Word is: %s", word);
int check = lookup(word);
word[strlen(word)-1] = '\0';
if (check != 0)
printf("Sorry, %s is not in the dictionary.\n", word);
else
printf("%s is in the dictionary.\n", word);
free(word);
}
int lookup(char* word) {
int check = -1;
char dictword[64];
FILE* dict = fopen("/usr/share/dict/words", "r");
while((check != 0) && (fgets(dictword, 64, dict) != NULL))
check = strcmp(word, dictword);
fclose(dict);
return check;
}
| [
"[email protected]"
] | |
17c154013a6656a86447af2b9e1bf40447cff369 | 558f3d5c071e35cd684ca755d562d12794fa33e2 | /ymt/src/yglobal.h | 7cee721866d5115e15a94db0798711d680eaec6c | [
"Apache-2.0"
] | permissive | phylame/ccl | f2d0e64979e1c37646f416713bb8c4a14d2e8705 | ccbdb326fe5c36536d489f400505ef4c54fa3ba9 | refs/heads/master | 2021-01-12T15:11:37.674818 | 2017-02-25T14:27:17 | 2017-02-25T14:27:17 | 69,873,494 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 2,323 | h | /*
* Copyright 2016 Peng Wan <[email protected]>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _YMT_GLOABL_
#define _YMT_GLOABL_
#include "ymtdef.h"
#include "yplatform.h"
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#ifdef __cplusplus
extern "C" {
#endif
#define y_die(...) \
do { \
fprintf(stderr, "fatal error in %s:%s:%d: ", __FILE__, __func__, __LINE__); \
fprintf(stderr, ##__VA_ARGS__); \
fprintf(stderr, "\n"); \
abort(); \
} while(0)
Y_SHARED int y_log(const ychar* restrict fmt, ...);
#define y_core_oom() y_die("no memory for creating core objects")
#define y_name_of(o) #o
#define y_first_arg(_0, ...) _0
#define y_escond_arg(_0, _1, ...) _1
#define y_third_arg(_0, _1, _2, ...) _2
#define y_new_item(type) (type*) calloc(1, sizeof(type))
#define y_new_array(type, count) (type*) calloc(count, sizeof(type))
#define y_resize_array(type, array, count) (type*) realloc(array, count * sizeof(type))
#define y_release_objects(objects, size) \
do { \
for(yuint i = 0; i < size; ++i) { \
yobj_release(*(objects + i)); \
} \
} while(0)
Y_SHARED void y_array_copy(const void* src, yuint srcbeg, void* dest, yuint destbeg, ysize width, ysize length);
Y_SHARED void* y_array_dump(const void* src, yuint begin, ysize width, ysize length, ysize new_length);
#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus
#endif
| [
"[email protected]"
] | |
8a788c914a355ec43bf39d00ad208c1b2e2ee405 | b8499925fa7c7c5c2b4170f148a441d635eaa86e | /led/03th_led_class/led.c | c0e2b61dc239e5e7a482ee1164a04e165a880178 | [] | no_license | 980725866/driver | 93f572308fd347fa265d77b85981e1900b94f422 | 0d8f7fd3df88e0347dc797f90934e5bcb28de2dc | refs/heads/master | 2021-01-19T14:27:32.625357 | 2017-05-26T08:17:05 | 2017-05-26T08:17:05 | 88,164,709 | 0 | 0 | null | null | null | null | WINDOWS-1252 | C | false | false | 1,477 | c | #include <linux/kernel.h>
#include <linux/module.h>
#include <linux/fs.h>
#include <linux/device.h>
#include <linux/gpio.h>
#include <mach/gpio.h>
#include <plat/gpio-cfg.h>
#include <linux/leds.h>
#define DEVICE_NAME "leds"
typedef struct gpio_desc
{
long gpio;
char name[10];
}gpio_desc_t;
static gpio_desc_t led_desc[] = {
{EXYNOS4X12_GPM4(0),"led1"},
{EXYNOS4X12_GPM4(1),"led2"},
{EXYNOS4X12_GPM4(2),"led3"},
{EXYNOS4X12_GPM4(3),"led4"},
};
#define LED_NUM ARRAY_SIZE(led_desc)
struct led_classdev led_cdev;
static void tiny4412_led_set(struct led_classdev *led_cdev,
enum led_brightness value)
{
if(value == 0) {
gpio_set_value(led_desc[0].gpio,1);
}else{
gpio_set_value(led_desc[0].gpio,0);
}
}
static int __init tiny4412_led_init(void) {
int i;
/*1 gpio µÄÉêÇë*/
for(i=0;i<LED_NUM;i++){
gpio_request(led_desc[i].gpio, led_desc[i].name);
s3c_gpio_cfgpin(led_desc[i].gpio, S3C_GPIO_OUTPUT);
}
/* 2 ledÉ豸µÄ×¢²á led_classdev_register */
led_cdev.brightness_set = tiny4412_led_set;
led_cdev.name = "led1";
led_classdev_register(NULL, &led_cdev);
printk(KERN_INFO "tiny4412_led_init\n");
return 0;
}
static void __exit tiny4412_led_exit(void) {
int i;
led_classdev_unregister(&led_cdev);
for(i=0;i<LED_NUM;i++){
gpio_free(led_desc[i].gpio);
}
printk(KERN_INFO "tiny4412_led_exit\n");
}
module_init(tiny4412_led_init);
module_exit(tiny4412_led_exit);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("ARM led3");
| [
"[email protected]"
] | |
268b4bbdf5f0fe87d33646810bb9fd17e59a4233 | 5c255f911786e984286b1f7a4e6091a68419d049 | /code/5a37b43f-1506-44bd-bce9-60193c870f08.c | 2e4b0eaaa76072363a549a120776114d5816b050 | [] | no_license | nmharmon8/Deep-Buffer-Overflow-Detection | 70fe02c8dc75d12e91f5bc4468cf260e490af1a4 | e0c86210c86afb07c8d4abcc957c7f1b252b4eb2 | refs/heads/master | 2021-09-11T19:09:59.944740 | 2018-04-06T16:26:34 | 2018-04-06T16:26:34 | 125,521,331 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 252 | c | #include <stdio.h>
int main() {
int i=4;
int j=12;
int k;
int l;
k = 5;
l = 64;
k = i/j;
l = i/j;
l = l/j;
l = i/j;
l = l%j;
l = l%j;
k = k-k*i;
printf("vulnerability");
printf("%d%d\n",k,i);
return 0;
}
| [
"[email protected]"
] | |
42d4891423491762f7e8c35aaba3d5fed246d3cf | bbf91cfe87a36779afbc43b5392abc0722363870 | /tos/chips/msp432/driverlib/dma.c | eb0353e0160b21ff1c298396c90cf801c0928b92 | [
"BSD-3-Clause",
"MIT"
] | permissive | ioteleman/InternetOfThings | df9792b2d38527bcd418d976c72fbb60e6ae5ccc | a87c1e2a243d06574d08645f8c5fe82f005c0da3 | refs/heads/master | 2022-11-06T06:22:16.304317 | 2020-07-01T12:19:34 | 2020-07-01T12:19:34 | 270,090,369 | 1 | 0 | MIT | 2020-06-06T20:03:26 | 2020-06-06T20:03:26 | null | UTF-8 | C | false | false | 23,386 | c | /*
* -------------------------------------------
* MSP432 DriverLib - v3_21_00_05
* -------------------------------------------
*
* --COPYRIGHT--,BSD,BSD
* Copyright (c) 2016, Texas Instruments Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* --/COPYRIGHT--*/
#include <stdint.h>
#include <msp432_dl_debug.h>
#include <interrupt.h>
#include <dma.h>
void DMA_enableModule(void)
{
//
// Set the master enable bit in the config register.
//
DMA_Control->CFG = DMA_CFG_MASTEN;
}
void DMA_disableModule(void)
{
//
// Clear the master enable bit in the config register.
//
DMA_Control->CFG = 0;
}
uint32_t DMA_getErrorStatus(void)
{
//
// Return the DMA error status.
//
return DMA_Control->ERRCLR;
}
void DMA_clearErrorStatus(void)
{
//
// Clear the DMA error interrupt.
//
DMA_Control->ERRCLR = 1;
}
void DMA_enableChannel(uint32_t channelNum)
{
//
// Check the arguments.
//
ASSERT((channelNum & 0xffff) < 8);
//
// Set the bit for this channel in the enable set register.
//
DMA_Control->ENASET = 1 << (channelNum & 0x0F);
}
void DMA_disableChannel(uint32_t channelNum)
{
//
// Check the arguments.
//
ASSERT((channelNum & 0xffff) < 8);
//
// Set the bit for this channel in the enable clear register.
//
DMA_Control->ENACLR = 1 << (channelNum & 0x0F);
}
bool DMA_isChannelEnabled(uint32_t channelNum)
{
//
// Check the arguments.
//
ASSERT((channelNum & 0xffff) < 8);
//
// AND the specified channel bit with the enable register and return the
// result.
//
return ((DMA_Control->ENASET & (1 << (channelNum & 0x0F))) ? true : false);
}
void DMA_setControlBase(void *controlTable)
{
//
// Check the arguments.
//
ASSERT(((uint32_t) controlTable & ~0x3FF) == (uint32_t) controlTable);
ASSERT((uint32_t) controlTable >= 0x20000000);
//
// Program the base address into the register.
//
DMA_Control->CTLBASE = (uint32_t) controlTable;
}
void* DMA_getControlBase(void)
{
//
// Read the current value of the control base register and return it to
// the caller.
//
return ((void *) DMA_Control->CTLBASE);
}
void* DMA_getControlAlternateBase(void)
{
//
// Read the current value of the control base register and return it to
// the caller.
//
return ((void *) DMA_Control->ALTBASE);
}
void DMA_requestChannel(uint32_t channelNum)
{
//
// Check the arguments.
//
ASSERT((channelNum & 0xffff) < 8);
//
// Set the bit for this channel in the software DMA request register.
//
DMA_Control->SWREQ = 1 << (channelNum & 0x0F);
}
void DMA_enableChannelAttribute(uint32_t channelNum, uint32_t attr)
{
//
// Check the arguments.
//
ASSERT((channelNum & 0xffff) < 8);
ASSERT(
(attr
& ~(UDMA_ATTR_USEBURST | UDMA_ATTR_ALTSELECT
| UDMA_ATTR_HIGH_PRIORITY | UDMA_ATTR_REQMASK))
== 0);
//
// In case a channel selector macro (like UDMA_CH0_USB0EP1RX) was
// passed as the channelNum parameter, extract just the channel number
// from this parameter.
//
channelNum &= 0x0F;
//
// Set the useburst bit for this channel if set in config.
//
if (attr & UDMA_ATTR_USEBURST)
{
DMA_Control->USEBURSTSET = 1 << channelNum;
}
//
// Set the alternate control select bit for this channel,
// if set in config.
//
if (attr & UDMA_ATTR_ALTSELECT)
{
DMA_Control->ALTSET = 1 << channelNum;
}
//
// Set the high priority bit for this channel, if set in config.
//
if (attr & UDMA_ATTR_HIGH_PRIORITY)
{
DMA_Control->PRIOSET = 1 << channelNum;
}
//
// Set the request mask bit for this channel, if set in config.
//
if (attr & UDMA_ATTR_REQMASK)
{
DMA_Control->REQMASKSET = 1 << channelNum;
}
}
void DMA_disableChannelAttribute(uint32_t channelNum, uint32_t attr)
{
//
// Check the arguments.
//
ASSERT((channelNum & 0xffff) < 8);
ASSERT(
(attr
& ~(UDMA_ATTR_USEBURST | UDMA_ATTR_ALTSELECT
| UDMA_ATTR_HIGH_PRIORITY | UDMA_ATTR_REQMASK))
== 0);
//
// In case a channel selector macro (like UDMA_CH0_USB0EP1RX) was
// passed as the channelNum parameter, extract just the channel number
// from this parameter.
//
channelNum &= 0x0F;
//
// Clear the useburst bit for this channel if set in config.
//
if (attr & UDMA_ATTR_USEBURST)
{
DMA_Control->USEBURSTCLR = 1 << channelNum;
}
//
// Clear the alternate control select bit for this channel, if set in
// config.
//
if (attr & UDMA_ATTR_ALTSELECT)
{
DMA_Control->ALTCLR = 1 << channelNum;
}
//
// Clear the high priority bit for this channel, if set in config.
//
if (attr & UDMA_ATTR_HIGH_PRIORITY)
{
DMA_Control->PRIOCLR = 1 << channelNum;
}
//
// Clear the request mask bit for this channel, if set in config.
//
if (attr & UDMA_ATTR_REQMASK)
{
DMA_Control->REQMASKCLR = 1 << channelNum;
}
}
uint32_t DMA_getChannelAttribute(uint32_t channelNum)
{
uint32_t attr = 0;
//
// Check the arguments.
//
ASSERT((channelNum & 0xffff) < 8);
//
// In case a channel selector macro (like UDMA_CH0_USB0EP1RX) was
// passed as the channelNum parameter, extract just the channel number
// from this parameter.
//
channelNum &= 0x0F;
//
// Check to see if useburst bit is set for this channel.
//
if (DMA_Control->USEBURSTSET & (1 << channelNum))
{
attr |= UDMA_ATTR_USEBURST;
}
//
// Check to see if the alternate control bit is set for this channel.
//
if (DMA_Control->ALTSET & (1 << channelNum))
{
attr |= UDMA_ATTR_ALTSELECT;
}
//
// Check to see if the high priority bit is set for this channel.
//
if (DMA_Control->PRIOSET & (1 << channelNum))
{
attr |= UDMA_ATTR_HIGH_PRIORITY;
}
//
// Check to see if the request mask bit is set for this channel.
//
if (DMA_Control->REQMASKSET & (1 << channelNum))
{
attr |= UDMA_ATTR_REQMASK;
}
//
// Return the configuration flags.
//
return (attr);
}
void DMA_setChannelControl(uint32_t channelStructIndex, uint32_t control)
{
DMA_ControlTable *pCtl;
//
// Check the arguments.
//
ASSERT((channelStructIndex & 0xffff) < 64);
ASSERT(DMA_Control->CTLBASE != 0);
//
// In case a channel selector macro (like UDMA_CH0_USB0EP1RX) was
// passed as the channelStructIndex parameter, extract just the channel
// index from this parameter.
//
channelStructIndex &= 0x3f;
//
// Get the base address of the control table.
//
pCtl = (DMA_ControlTable *) DMA_Control->CTLBASE;
//
// Get the current control word value and mask off the fields to be
// changed, then OR in the new settings.
//
pCtl[channelStructIndex].control = ((pCtl[channelStructIndex].control
& ~(UDMA_CHCTL_DSTINC_M | UDMA_CHCTL_DSTSIZE_M | UDMA_CHCTL_SRCINC_M
| UDMA_CHCTL_SRCSIZE_M | UDMA_CHCTL_ARBSIZE_M
| UDMA_CHCTL_NXTUSEBURST)) | control);
}
void DMA_setChannelTransfer(uint32_t channelStructIndex, uint32_t mode,
void *srcAddr, void *dstAddr, uint32_t transferSize)
{
DMA_ControlTable *controlTable;
uint32_t control;
uint32_t increment;
uint32_t bufferBytes;
//
// Check the arguments.
//
ASSERT((channelStructIndex & 0xffff) < 64);
ASSERT(DMA->CTLBASE != 0);
ASSERT(mode <= UDMA_MODE_PER_SCATTER_GATHER);
ASSERT((transferSize != 0) && (transferSize <= 1024));
//
// In case a channel selector macro (like UDMA_CH0_USB0EP1RX) was
// passed as the channelStructIndex parameter, extract just the channel
// index from this parameter.
//
channelStructIndex &= 0x3f;
//
// Get the base address of the control table.
//
controlTable = (DMA_ControlTable *) DMA_Control->CTLBASE;
//
// Get the current control word value and mask off the mode and size
// fields.
//
control = (controlTable[channelStructIndex].control
& ~(UDMA_CHCTL_XFERSIZE_M | UDMA_CHCTL_XFERMODE_M));
//
// Adjust the mode if the alt control structure is selected.
//
if (channelStructIndex & UDMA_ALT_SELECT)
{
if ((mode == UDMA_MODE_MEM_SCATTER_GATHER)
|| (mode == UDMA_MODE_PER_SCATTER_GATHER))
{
mode |= UDMA_MODE_ALT_SELECT;
}
}
//
// Set the transfer size and mode in the control word (but don't write the
// control word yet as it could kick off a transfer).
//
control |= mode | ((transferSize - 1) << 4);
//
// Get the address increment value for the source, from the control word.
//
increment = (control & UDMA_CHCTL_SRCINC_M);
//
// Compute the ending source address of the transfer. If the source
// increment is set to none, then the ending address is the same as the
// beginning.
//
if (increment != UDMA_SRC_INC_NONE)
{
increment = increment >> 26;
bufferBytes = transferSize << increment;
srcAddr = (void *) ((uint32_t) srcAddr + bufferBytes - 1);
}
//
// Load the source ending address into the control block.
//
controlTable[channelStructIndex].srcEndAddr = srcAddr;
//
// Get the address increment value for the destination, from the control
// word.
//
increment = control & UDMA_CHCTL_DSTINC_M;
//
// Compute the ending destination address of the transfer. If the
// destination increment is set to none, then the ending address is the
// same as the beginning.
//
if (increment != UDMA_DST_INC_NONE)
{
//
// There is a special case if this is setting up a scatter-gather
// transfer. The destination pointer must point to the end of
// the alternate structure for this channel instead of calculating
// the end of the buffer in the normal way.
//
if ((mode == UDMA_MODE_MEM_SCATTER_GATHER)
|| (mode == UDMA_MODE_PER_SCATTER_GATHER))
{
dstAddr = (void *) &controlTable[channelStructIndex
| UDMA_ALT_SELECT].spare;
}
//
// Not a scatter-gather transfer, calculate end pointer normally.
//
else
{
increment = increment >> 30;
bufferBytes = transferSize << increment;
dstAddr = (void *) ((uint32_t) dstAddr + bufferBytes - 1);
}
}
//
// Load the destination ending address into the control block.
//
controlTable[channelStructIndex].dstEndAddr = dstAddr;
//
// Write the new control word value.
//
controlTable[channelStructIndex].control = control;
}
void DMA_setChannelScatterGather(uint32_t channelNum, uint32_t taskCount,
void *taskList, uint32_t isPeriphSG)
{
DMA_ControlTable *controlTable;
DMA_ControlTable *pTaskTable;
//
// Check the parameters
//
ASSERT((channelNum & 0xffff) < 8);
ASSERT(DMA->CTLBASE != 0);
ASSERT(taskList != 0);
ASSERT(taskCount <= 1024);
ASSERT(taskCount != 0);
//
// In case a channel selector macro (like UDMA_CH0_USB0EP1RX) was
// passed as the channelNum parameter, extract just the channel number
// from this parameter.
//
channelNum &= 0x0F;
//
// Get the base address of the control table.
//
controlTable = (DMA_ControlTable *) DMA_Control->CTLBASE;
//
// Get a handy pointer to the task list
//
pTaskTable = (DMA_ControlTable *) taskList;
//
// Compute the ending address for the source pointer. This address is the
// last element of the last task in the task table
//
controlTable[channelNum].srcEndAddr = &pTaskTable[taskCount - 1].spare;
//
// Compute the ending address for the destination pointer. This address
// is the end of the alternate structure for this channel.
//
controlTable[channelNum].dstEndAddr = &controlTable[channelNum
| UDMA_ALT_SELECT].spare;
//
// Compute the control word. Most configurable items are fixed for
// scatter-gather. Item and increment sizes are all 32-bit and arb
// size must be 4. The count is the number of items in the task list
// times 4 (4 words per task).
//
controlTable[channelNum].control = (UDMA_CHCTL_DSTINC_32
| UDMA_CHCTL_DSTSIZE_32 | UDMA_CHCTL_SRCINC_32
| UDMA_CHCTL_SRCSIZE_32 | UDMA_CHCTL_ARBSIZE_4
| (((taskCount * 4) - 1) << UDMA_CHCTL_XFERSIZE_S)
| (isPeriphSG ?
UDMA_CHCTL_XFERMODE_PER_SG :
UDMA_CHCTL_XFERMODE_MEM_SG));
//
// Scatter-gather operations can leave the alt bit set. So if doing
// back to back scatter-gather transfers, the second attempt may not
// work correctly because the alt bit is set. Therefore, clear the
// alt bit here to ensure that it is always cleared before a new SG
// transfer is started.
//
DMA_Control->ALTCLR = 1 << channelNum;
}
uint32_t DMA_getChannelSize(uint32_t channelStructIndex)
{
DMA_ControlTable *controlTable;
uint32_t control;
//
// Check the arguments.
//
ASSERT((channelStructIndex & 0xffff) < 16);
ASSERT(DMA->CTLBASE != 0);
//
// In case a channel selector macro (like UDMA_CH0_USB0EP1RX) was
// passed as the channelStructIndex parameter, extract just the channel
// index from this parameter.
//
channelStructIndex &= 0x3f;
//
// Get the base address of the control table.
//
controlTable = (DMA_ControlTable *) DMA_Control->CTLBASE;
//
// Get the current control word value and mask off all but the size field
// and the mode field.
//
control = (controlTable[channelStructIndex].control
& (UDMA_CHCTL_XFERSIZE_M | UDMA_CHCTL_XFERMODE_M));
//
// If the size field and mode field are 0 then the transfer is finished
// and there are no more items to transfer
//
if (control == 0)
{
return (0);
}
//
// Otherwise, if either the size field or more field is non-zero, then
// not all the items have been transferred.
//
else
{
//
// Shift the size field and add one, then return to user.
//
return ((control >> 4) + 1);
}
}
uint32_t DMA_getChannelMode(uint32_t channelStructIndex)
{
DMA_ControlTable *controlTable;
uint32_t control;
//
// Check the arguments.
//
ASSERT((channelStructIndex & 0xffff) < 64);
ASSERT(DMA->CTLBASE != 0);
//
// In case a channel selector macro (like UDMA_CH0_USB0EP1RX) was
// passed as the channelStructIndex parameter, extract just the channel
// index from this parameter.
//
channelStructIndex &= 0x3f;
//
// Get the base address of the control table.
//
controlTable = (DMA_ControlTable *) DMA_Control->CTLBASE;
//
// Get the current control word value and mask off all but the mode field.
//
control =
(controlTable[channelStructIndex].control & UDMA_CHCTL_XFERMODE_M);
//
// Check if scatter/gather mode, and if so, mask off the alt bit.
//
if (((control & ~UDMA_MODE_ALT_SELECT) == UDMA_MODE_MEM_SCATTER_GATHER)
|| ((control & ~UDMA_MODE_ALT_SELECT)
== UDMA_MODE_PER_SCATTER_GATHER))
{
control &= ~UDMA_MODE_ALT_SELECT;
}
//
// Return the mode to the caller.
//
return (control);
}
void DMA_assignChannel(uint32_t mapping)
{
switch (mapping)
{
case DMA_CH0_RESERVED0:
case DMA_CH0_EUSCIA0TX:
case DMA_CH0_EUSCIB0TX0:
case DMA_CH0_EUSCIB3TX1:
case DMA_CH0_EUSCIB2TX2:
case DMA_CH0_EUSCIB1TX3:
case DMA_CH0_TIMERA0CCR0:
case DMA_CH0_AESTRIGGER0:
DMA_Channel->CH_SRCCFG[0] = (mapping >> 24) & 0x1F;
break;
case DMA_CH1_RESERVED0:
case DMA_CH1_EUSCIA0RX:
case DMA_CH1_EUSCIB0RX0:
case DMA_CH1_EUSCIB3RX1:
case DMA_CH1_EUSCIB2RX2:
case DMA_CH1_EUSCIB1RX3:
case DMA_CH1_TIMERA0CCR2:
case DMA_CH1_AESTRIGGER1:
DMA_Channel->CH_SRCCFG[1] = (mapping >> 24) & 0x1F;
break;
case DMA_CH2_RESERVED0:
case DMA_CH2_EUSCIA1TX:
case DMA_CH2_EUSCIB1TX0:
case DMA_CH2_EUSCIB0TX1:
case DMA_CH2_EUSCIB3TX2:
case DMA_CH2_EUSCIB2TX3:
case DMA_CH2_TIMERA1CCR0:
case DMA_CH2_AESTRIGGER2:
DMA_Channel->CH_SRCCFG[2] = (mapping >> 24) & 0x1F;
break;
case DMA_CH3_RESERVED0:
case DMA_CH3_EUSCIA1RX:
case DMA_CH3_EUSCIB1RX0:
case DMA_CH3_EUSCIB0RX1:
case DMA_CH3_EUSCIB3RX2:
case DMA_CH3_EUSCIB2RX3:
case DMA_CH3_TIMERA1CCR2:
case DMA_CH3_RESERVED1:
DMA_Channel->CH_SRCCFG[3] = (mapping >> 24) & 0x1F;
break;
case DMA_CH4_RESERVED0:
case DMA_CH4_EUSCIA2TX:
case DMA_CH4_EUSCIB2TX0:
case DMA_CH4_EUSCIB1TX1:
case DMA_CH4_EUSCIB0TX2:
case DMA_CH4_EUSCIB3TX3:
case DMA_CH4_TIMERA2CCR0:
case DMA_CH4_RESERVED1:
DMA_Channel->CH_SRCCFG[4] = (mapping >> 24) & 0x1F;
break;
case DMA_CH5_RESERVED0:
case DMA_CH5_EUSCIA2RX:
case DMA_CH5_EUSCIB2RX0:
case DMA_CH5_EUSCIB1RX1:
case DMA_CH5_EUSCIB0RX2:
case DMA_CH5_EUSCIB3RX3:
case DMA_CH5_TIMERA2CCR2:
case DMA_CH5_RESERVED1:
DMA_Channel->CH_SRCCFG[5] = (mapping >> 24) & 0x1F;
break;
case DMA_CH6_RESERVED0:
case DMA_CH6_EUSCIA3TX:
case DMA_CH6_EUSCIB3TX0:
case DMA_CH6_EUSCIB2TX1:
case DMA_CH6_EUSCIB1TX2:
case DMA_CH6_EUSCIB0TX3:
case DMA_CH6_TIMERA3CCR0:
case DMA_CH6_EXTERNALPIN:
DMA_Channel->CH_SRCCFG[6] = (mapping >> 24) & 0x1F;
break;
case DMA_CH7_RESERVED0:
case DMA_CH7_EUSCIA3RX:
case DMA_CH7_EUSCIB3RX0:
case DMA_CH7_EUSCIB2RX1:
case DMA_CH7_EUSCIB1RX2:
case DMA_CH7_EUSCIB0RX3:
case DMA_CH7_TIMERA3CCR2:
case DMA_CH7_ADC14:
DMA_Channel->CH_SRCCFG[7] = (mapping >> 24) & 0x1F;
break;
default:
ASSERT(false);
}
}
void DMA_assignInterrupt(uint32_t interruptNumber, uint32_t channel)
{
ASSERT(
interruptNumber == DMA_INT1 || interruptNumber == DMA_INT2
|| interruptNumber == DMA_INT3);
if (interruptNumber == DMA_INT1)
{
DMA_Channel->INT1_SRCCFG = (DMA_Channel->INT1_SRCCFG
& ~DMA_INT1_SRCCFG_INT_SRC_MASK) | channel;
} else if (interruptNumber == DMA_INT2)
{
DMA_Channel->INT2_SRCCFG = (DMA_Channel->INT2_SRCCFG
& ~DMA_INT1_SRCCFG_INT_SRC_MASK) | channel;
} else if (interruptNumber == DMA_INT3)
{
DMA_Channel->INT3_SRCCFG = (DMA_Channel->INT3_SRCCFG
& ~DMA_INT1_SRCCFG_INT_SRC_MASK) | channel;
}
/* Enabling the assigned interrupt */
DMA_enableInterrupt(interruptNumber);
}
void DMA_requestSoftwareTransfer(uint32_t channel)
{
DMA_Channel->SW_CHTRIG |= (1 << channel);
}
uint32_t DMA_getInterruptStatus(void)
{
return DMA_Channel->INT0_SRCFLG;
}
void DMA_clearInterruptFlag(uint32_t channel)
{
DMA_Channel->INT0_CLRFLG |= (1 << channel);
}
void DMA_enableInterrupt(uint32_t interruptNumber)
{
ASSERT(
(interruptNumber == DMA_INT0) || (interruptNumber == DMA_INT1)
|| (interruptNumber == DMA_INT2)
|| (interruptNumber == DMA_INT3));
if (interruptNumber == DMA_INT1)
{
DMA_Channel->INT1_SRCCFG |= DMA_INT1_SRCCFG_EN;
} else if (interruptNumber == DMA_INT2)
{
DMA_Channel->INT2_SRCCFG |= DMA_INT2_SRCCFG_EN;
} else if (interruptNumber == DMA_INT3)
{
DMA_Channel->INT3_SRCCFG |= DMA_INT3_SRCCFG_EN;
}
}
void DMA_disableInterrupt(uint32_t interruptNumber)
{
ASSERT(
(interruptNumber == DMA_INT0) || (interruptNumber == DMA_INT1)
|| (interruptNumber == DMA_INT2)
|| (interruptNumber == DMA_INT3));
if (interruptNumber == DMA_INT1)
{
DMA_Channel->INT1_SRCCFG &= ~DMA_INT1_SRCCFG_EN;
} else if (interruptNumber == DMA_INT2)
{
DMA_Channel->INT2_SRCCFG &= ~DMA_INT2_SRCCFG_EN;
} else if (interruptNumber == DMA_INT3)
{
DMA_Channel->INT3_SRCCFG &= ~DMA_INT3_SRCCFG_EN;
}
}
void DMA_registerInterrupt(uint32_t interruptNumber, void (*intHandler)(void))
{
//
// Check the arguments.
//
ASSERT(intHandler);
ASSERT(
(interruptNumber == DMA_INT0) || (interruptNumber == DMA_INT1)
|| (interruptNumber == DMA_INT2)
|| (interruptNumber == DMA_INT3)
|| (interruptNumber == DMA_INTERR));
//
// Register the interrupt handler.
//
Interrupt_registerInterrupt(interruptNumber, intHandler);
//
// Enable the memory management fault.
//
Interrupt_enableInterrupt(interruptNumber);
}
void DMA_unregisterInterrupt(uint32_t interruptNumber)
{
ASSERT(
(interruptNumber == DMA_INT0) || (interruptNumber == DMA_INT1)
|| (interruptNumber == DMA_INT2)
|| (interruptNumber == DMA_INT3)
|| (interruptNumber == DMA_INTERR));
//
// Disable the interrupt.
//
Interrupt_disableInterrupt(interruptNumber);
//
// Unregister the interrupt handler.
//
Interrupt_unregisterInterrupt(interruptNumber);
}
| [
"[email protected]"
] | |
9b168e279d98fbab838da69b0850cf3d0d6ca419 | d15735ca76f411754c59404cbd36f7510c20ee97 | /samples/userspace/syscall_perf/src/main.h | 28e3549dda2a70c91c3ab65c359109ae3b1d95a1 | [
"Apache-2.0"
] | permissive | platformio/zephyr | edfa9321ba4ddc5a235e06a9f2bc8910273d58a4 | 934deef778e6f78584866409d4bf983c4ebb3e9c | refs/heads/v2.7-branch | 2023-07-27T09:39:54.461387 | 2021-11-26T10:38:20 | 2021-11-26T10:38:20 | 220,219,747 | 7 | 15 | Apache-2.0 | 2021-12-22T20:30:14 | 2019-11-07T11:20:50 | C | UTF-8 | C | false | false | 315 | h | /*
* Copyright (c) 2020 BayLibre, SAS
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef MAIN_H
#define MAIN_H
#include <kernel.h>
#define csr_read(csr) \
({ \
register unsigned long __v; \
__asm__ volatile ("csrr %0, " #csr \
: "=r" (__v)); \
__v; \
})
#endif /* MAIN_H */
| [
"[email protected]"
] | |
b9349647788c7fa4fe28d021297724fb68a84e99 | 25a0b8af815c1b012475a93ad74f4560f2cfaa17 | /sum og digit.c | 0e2fca3203ea08d7eb13938143200b2f17204745 | [] | no_license | Brihat9/C_Programming | 45ea1436ffe78a4baa870ec03122b0a27d3e89e1 | d8c34497c1034ab340c216740df8137224c9d8af | refs/heads/master | 2022-12-13T03:27:35.007122 | 2014-12-31T18:15:00 | 2020-09-09T13:45:58 | 294,108,381 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 269 | c | #include<stdio.h>
#include<conio.h>
void main(void)
{
int a,c,sum=0;
printf("Enter any positive number : ");
scanf("%d",&a);
do{
c=a%10;
sum+=c;
a/=10;
}while(a!=0);
printf("The sum of digits is %d.",sum);
getch();
}
| [
"[email protected]"
] | |
d2ef40852f1024f852ca377e5d10194fca8e3658 | c9b1d9481663f35a745533e215e512c31f00f945 | /libraries/abstractions/transport/utest/transport_secure_sockets_utest.c | f73fcb3f120934e4cda4db33c2731381c00c63bf | [
"Apache-2.0",
"MIT"
] | permissive | ambiot/amazon-freertos | 199d8c8cfebf7d4ce41cdf0377a6622c56ea3f7c | ef61d5f521de921cc931d9262e3d5af9b75fbd2e | refs/heads/master | 2023-08-24T08:06:28.437220 | 2021-07-08T13:33:49 | 2021-07-08T13:33:49 | 191,755,880 | 14 | 16 | MIT | 2022-09-20T23:47:06 | 2019-06-13T12:09:22 | C | UTF-8 | C | false | false | 42,750 | c | /*
* FreeRTOS Transport Secure Sockets V1.0.0
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* http://aws.amazon.com/freertos
* http://www.FreeRTOS.org
*/
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include "unity.h"
#include "mock_iot_secure_sockets.h"
/* Transport interface include. */
#include "transport_secure_sockets.h"
/* The send and receive timeout to set for the socket. */
#define SEND_RECV_TIMEOUT ( 0U )
/* The host and port from which to establish the connection. */
#define HOSTNAME "amazon.com"
#define INVALID_HOSTNAME_LENGTH ( 254U )
#define PORT ( 80 )
/* Configuration parameters for the TLS connection. */
#define MFLN ( 42 )
#define ALPN_PROTOS "x-amzn-mqtt-ca"
#define MOCK_ROOT_CA "mockRootCA"
#define MOCK_SERVER_ADDRESS ( 100 )
#define MOCT_TCP_SOCKET ( 100 )
#define MOCK_SECURE_SOCKET_ERROR ( -1 )
/* Parameters to pass to #SecureSocketsTransport_Send and #SecureSocketsTransport_Recv. */
#define BYTES_TO_SEND ( 4U )
#define BYTES_TO_RECV ( 4U )
#define SECURE_SOCKETS_READ_WRITE_ERROR ( -1 )
/* The size of the buffer passed to #SecureSocketsTransport_Send and #SecureSocketsTransport_Recv. */
#define BUFFER_LEN ( 4U )
/**
* @brief Transport timeout in milliseconds for transport send.
*/
#define TEST_TRANSPORT_SND_TIMEOUT_MS ( 5000U )
/**
* @brief Transport timeout in milliseconds for transport receive.
*/
#define TEST_TRANSPORT_RCV_TIMEOUT_MS ( 5000U )
/* Objects used by the transport secure sockets implementation. */
static ServerInfo_t serverInfo =
{
.pHostName = HOSTNAME,
.hostNameLength = strlen( HOSTNAME ),
.port = PORT
};
static SocketsConfig_t socketsConfig =
{
.enableTls = true,
.pAlpnProtos = ALPN_PROTOS,
.maxFragmentLength = MFLN,
.disableSni = false,
.pRootCa = NULL,
.rootCaSize = 0,
.sendTimeoutMs = TEST_TRANSPORT_SND_TIMEOUT_MS,
.recvTimeoutMs = TEST_TRANSPORT_RCV_TIMEOUT_MS
};
static uint8_t networkBuffer[ BUFFER_LEN ] = { 0 };
static Socket_t mockTcpSocket = ( Socket_t ) MOCT_TCP_SOCKET;
static NetworkContext_t networkContext = { 0 };
/* ============================ UNITY FIXTURES ============================ */
/* Called before each test method. */
void setUp()
{
networkContext.tcpSocket = mockTcpSocket;
}
/* Called after each test method. */
void tearDown()
{
}
/* Called at the beginning of the whole suite. */
void suiteSetUp()
{
}
/* Called at the end of the whole suite. */
int suiteTearDown( int numFailures )
{
return numFailures;
}
/* ========================================================================== */
/**
* @brief Test that #SecureSocketsTransport_Connect fails with NULL parameters
* and verify the error code.
*/
void test_SecureSocketsTransport_Connect_Invalid_Params( void )
{
TransportSocketStatus_t returnStatus;
ServerInfo_t invalidServerInfo = { 0 };
char hostNameBuffer[ INVALID_HOSTNAME_LENGTH ] = { 0 };
invalidServerInfo.port = PORT;
uint16_t index = 0U;
returnStatus = SecureSocketsTransport_Connect( NULL,
&serverInfo,
&socketsConfig );
TEST_ASSERT_EQUAL( TRANSPORT_SOCKET_STATUS_INVALID_PARAMETER, returnStatus );
returnStatus = SecureSocketsTransport_Connect( &networkContext,
NULL,
&socketsConfig );
TEST_ASSERT_EQUAL( TRANSPORT_SOCKET_STATUS_INVALID_PARAMETER, returnStatus );
returnStatus = SecureSocketsTransport_Connect( &networkContext,
&serverInfo,
NULL );
TEST_ASSERT_EQUAL( TRANSPORT_SOCKET_STATUS_INVALID_PARAMETER, returnStatus );
invalidServerInfo.pHostName = NULL;
returnStatus = SecureSocketsTransport_Connect( &networkContext,
&invalidServerInfo,
&socketsConfig );
TEST_ASSERT_EQUAL( TRANSPORT_SOCKET_STATUS_INVALID_PARAMETER, returnStatus );
invalidServerInfo.pHostName = &hostNameBuffer[ 0 ];
invalidServerInfo.hostNameLength = 0;
returnStatus = SecureSocketsTransport_Connect( &networkContext,
&invalidServerInfo,
&socketsConfig );
TEST_ASSERT_EQUAL( TRANSPORT_SOCKET_STATUS_INVALID_PARAMETER, returnStatus );
for( index = 0U; index < INVALID_HOSTNAME_LENGTH; index++ )
{
hostNameBuffer[ index ] = '1';
}
invalidServerInfo.hostNameLength = strlen( hostNameBuffer );
returnStatus = SecureSocketsTransport_Connect( &networkContext,
&invalidServerInfo,
&socketsConfig );
TEST_ASSERT_EQUAL( TRANSPORT_SOCKET_STATUS_INVALID_PARAMETER, returnStatus );
}
/*-----------------------------------------------------------*/
/**
* @brief Test that #SecureSocketsTransport_Connect fails on socket creation,
* and verify the error code.
*/
void test_SecureSocketsTransport_Connect_Insufficient_Memory( void )
{
TransportSocketStatus_t returnStatus;
SOCKETS_Socket_ExpectAndReturn( SOCKETS_AF_INET,
SOCKETS_SOCK_STREAM,
SOCKETS_IPPROTO_TCP,
SOCKETS_INVALID_SOCKET );
returnStatus = SecureSocketsTransport_Connect( &networkContext,
&serverInfo,
&socketsConfig );
TEST_ASSERT_EQUAL( TRANSPORT_SOCKET_STATUS_INSUFFICIENT_MEMORY, returnStatus );
}
/*-----------------------------------------------------------*/
/**
* @brief Test that #SecureSocketsTransport_Connect fails, when setting
* the socket options to require TLS, and verify the error code.
*/
void test_SecureSocketsTransport_Connect_Invalid_Credentials_SetRequireTLS( void )
{
TransportSocketStatus_t returnStatus;
SOCKETS_Socket_ExpectAndReturn( SOCKETS_AF_INET,
SOCKETS_SOCK_STREAM,
SOCKETS_IPPROTO_TCP,
mockTcpSocket );
SOCKETS_SetSockOpt_ExpectAndReturn( mockTcpSocket,
0,
SOCKETS_SO_REQUIRE_TLS,
NULL,
0,
MOCK_SECURE_SOCKET_ERROR );
SOCKETS_SetSockOpt_IgnoreArg_pvOptionValue();
SOCKETS_SetSockOpt_IgnoreArg_xOptionLength();
SOCKETS_Close_ExpectAndReturn( mockTcpSocket,
SOCKETS_ERROR_NONE );
returnStatus = SecureSocketsTransport_Connect( &networkContext,
&serverInfo,
&socketsConfig );
TEST_ASSERT_EQUAL( TRANSPORT_SOCKET_STATUS_CREDENTIALS_INVALID, returnStatus );
}
/*-----------------------------------------------------------*/
/**
* @brief Test that #SecureSocketsTransport_Connect fails to set the ALPN
* protocols, and verify the error code.
*/
void test_SecureSocketsTransport_Connect_Invalid_Credentials_AlpnProtos( void )
{
TransportSocketStatus_t returnStatus;
SocketsConfig_t localSocketsConfig =
{
.enableTls = true,
.pAlpnProtos = ALPN_PROTOS,
.maxFragmentLength = MFLN,
.disableSni = true,
.pRootCa = NULL,
.rootCaSize = 0,
.sendTimeoutMs = TEST_TRANSPORT_SND_TIMEOUT_MS,
.recvTimeoutMs = TEST_TRANSPORT_RCV_TIMEOUT_MS
};
SOCKETS_Socket_ExpectAndReturn( SOCKETS_AF_INET,
SOCKETS_SOCK_STREAM,
SOCKETS_IPPROTO_TCP,
mockTcpSocket );
SOCKETS_SetSockOpt_ExpectAndReturn( mockTcpSocket,
0,
SOCKETS_SO_REQUIRE_TLS,
NULL,
0,
SOCKETS_ERROR_NONE );
SOCKETS_SetSockOpt_IgnoreArg_pvOptionValue();
SOCKETS_SetSockOpt_IgnoreArg_xOptionLength();
SOCKETS_SetSockOpt_ExpectAndReturn( mockTcpSocket,
0,
SOCKETS_SO_ALPN_PROTOCOLS,
NULL,
0,
MOCK_SECURE_SOCKET_ERROR );
SOCKETS_SetSockOpt_IgnoreArg_pvOptionValue();
SOCKETS_SetSockOpt_IgnoreArg_xOptionLength();
SOCKETS_Close_ExpectAndReturn( mockTcpSocket,
SOCKETS_ERROR_NONE );
returnStatus = SecureSocketsTransport_Connect( &networkContext,
&serverInfo,
&localSocketsConfig );
TEST_ASSERT_EQUAL( TRANSPORT_SOCKET_STATUS_CREDENTIALS_INVALID, returnStatus );
}
/*-----------------------------------------------------------*/
/**
* @brief Test that #SecureSocketsTransport_Connect fails to set SNI, and verify
* the error code.
*/
void test_SecureSocketsTransport_Connect_Invalid_Credentials_SNI( void )
{
TransportSocketStatus_t returnStatus;
SocketsConfig_t localSocketsConfig =
{
.enableTls = true,
.pAlpnProtos = NULL,
.maxFragmentLength = MFLN,
.disableSni = false,
.pRootCa = NULL,
.rootCaSize = 0,
.sendTimeoutMs = TEST_TRANSPORT_SND_TIMEOUT_MS,
.recvTimeoutMs = TEST_TRANSPORT_RCV_TIMEOUT_MS
};
SOCKETS_Socket_ExpectAndReturn( SOCKETS_AF_INET,
SOCKETS_SOCK_STREAM,
SOCKETS_IPPROTO_TCP,
mockTcpSocket );
SOCKETS_SetSockOpt_ExpectAndReturn( mockTcpSocket,
0,
SOCKETS_SO_REQUIRE_TLS,
NULL,
0,
SOCKETS_ERROR_NONE );
SOCKETS_SetSockOpt_IgnoreArg_pvOptionValue();
SOCKETS_SetSockOpt_IgnoreArg_xOptionLength();
SOCKETS_SetSockOpt_ExpectAndReturn( mockTcpSocket,
0,
SOCKETS_SO_SERVER_NAME_INDICATION,
NULL,
0,
MOCK_SECURE_SOCKET_ERROR );
SOCKETS_SetSockOpt_IgnoreArg_pvOptionValue();
SOCKETS_SetSockOpt_IgnoreArg_xOptionLength();
SOCKETS_Close_ExpectAndReturn( mockTcpSocket,
SOCKETS_ERROR_NONE );
returnStatus = SecureSocketsTransport_Connect( &networkContext,
&serverInfo,
&localSocketsConfig );
TEST_ASSERT_EQUAL( TRANSPORT_SOCKET_STATUS_CREDENTIALS_INVALID, returnStatus );
}
/*-----------------------------------------------------------*/
/**
* @brief Test that #SecureSocketsTransport_Connect fails to set the Root CA, and
* verify the error code.
*/
void test_SecureSocketsTransport_Connect_Invalid_Credentials_RootCA( void )
{
TransportSocketStatus_t returnStatus;
SocketsConfig_t localSocketsConfig =
{
.enableTls = true,
.pAlpnProtos = NULL,
.maxFragmentLength = MFLN,
.disableSni = true,
.pRootCa = MOCK_ROOT_CA,
.rootCaSize = strlen( MOCK_ROOT_CA ),
.sendTimeoutMs = TEST_TRANSPORT_SND_TIMEOUT_MS,
.recvTimeoutMs = TEST_TRANSPORT_RCV_TIMEOUT_MS
};
SOCKETS_Socket_ExpectAndReturn( SOCKETS_AF_INET,
SOCKETS_SOCK_STREAM,
SOCKETS_IPPROTO_TCP,
mockTcpSocket );
SOCKETS_SetSockOpt_ExpectAndReturn( mockTcpSocket,
0,
SOCKETS_SO_REQUIRE_TLS,
NULL,
0,
SOCKETS_ERROR_NONE );
SOCKETS_SetSockOpt_IgnoreArg_pvOptionValue();
SOCKETS_SetSockOpt_IgnoreArg_xOptionLength();
SOCKETS_SetSockOpt_ExpectAndReturn( mockTcpSocket,
0,
SOCKETS_SO_TRUSTED_SERVER_CERTIFICATE,
NULL,
0,
MOCK_SECURE_SOCKET_ERROR );
SOCKETS_SetSockOpt_IgnoreArg_pvOptionValue();
SOCKETS_SetSockOpt_IgnoreArg_xOptionLength();
SOCKETS_Close_ExpectAndReturn( mockTcpSocket,
SOCKETS_ERROR_NONE );
returnStatus = SecureSocketsTransport_Connect( &networkContext,
&serverInfo,
&localSocketsConfig );
TEST_ASSERT_EQUAL( TRANSPORT_SOCKET_STATUS_CREDENTIALS_INVALID, returnStatus );
}
/*-----------------------------------------------------------*/
/**
* @brief Test that #SecureSocketsTransport_Connect fails to resolve the host name,
* and verify the error code.
*/
void test_SecureSocketsTransport_Connect_Dns_Failure( void )
{
TransportSocketStatus_t returnStatus;
SocketsConfig_t localSocketsConfig =
{
.enableTls = false,
.pAlpnProtos = NULL,
.maxFragmentLength = MFLN,
.disableSni = true,
.pRootCa = NULL,
.rootCaSize = 0,
.sendTimeoutMs = TEST_TRANSPORT_SND_TIMEOUT_MS,
.recvTimeoutMs = TEST_TRANSPORT_RCV_TIMEOUT_MS
};
SOCKETS_Socket_ExpectAndReturn( SOCKETS_AF_INET,
SOCKETS_SOCK_STREAM,
SOCKETS_IPPROTO_TCP,
mockTcpSocket );
SOCKETS_GetHostByName_ExpectAndReturn( HOSTNAME,
0 );
SOCKETS_Close_ExpectAndReturn( mockTcpSocket,
SOCKETS_ERROR_NONE );
returnStatus = SecureSocketsTransport_Connect( &networkContext,
&serverInfo,
&localSocketsConfig );
TEST_ASSERT_EQUAL( TRANSPORT_SOCKET_STATUS_DNS_FAILURE, returnStatus );
}
/*-----------------------------------------------------------*/
/**
* @brief Test that #SecureSocketsTransport_Connect encounters a network error
* connecting, and verify the error code.
*/
void test_SecureSocketsTransport_Connect_Fail_to_Connect( void )
{
TransportSocketStatus_t returnStatus;
SocketsConfig_t localSocketsConfig =
{
.enableTls = false,
.pAlpnProtos = NULL,
.maxFragmentLength = MFLN,
.disableSni = true,
.pRootCa = NULL,
.rootCaSize = 0,
.sendTimeoutMs = TEST_TRANSPORT_SND_TIMEOUT_MS,
.recvTimeoutMs = TEST_TRANSPORT_RCV_TIMEOUT_MS
};
SOCKETS_Socket_ExpectAndReturn( SOCKETS_AF_INET,
SOCKETS_SOCK_STREAM,
SOCKETS_IPPROTO_TCP,
mockTcpSocket );
SOCKETS_GetHostByName_ExpectAndReturn( HOSTNAME,
MOCK_SERVER_ADDRESS );
SOCKETS_Connect_ExpectAndReturn( mockTcpSocket,
NULL,
sizeof( SocketsSockaddr_t ),
MOCK_SECURE_SOCKET_ERROR );
SOCKETS_Connect_IgnoreArg_pxAddress();
SOCKETS_Close_ExpectAndReturn( mockTcpSocket,
SOCKETS_ERROR_NONE );
returnStatus = SecureSocketsTransport_Connect( &networkContext,
&serverInfo,
&localSocketsConfig );
TEST_ASSERT_EQUAL( TRANSPORT_SOCKET_STATUS_CONNECT_FAILURE, returnStatus );
}
/*-----------------------------------------------------------*/
/**
* @brief Test that #SecureSocketsTransport_Connect fails to set the socket
* send timeout, and verify the error code.
*/
void test_SecureSocketsTransport_Connect_TimeOutSetup_Failure_Send( void )
{
TransportSocketStatus_t returnStatus;
SocketsConfig_t localSocketsConfig =
{
.enableTls = false,
.pAlpnProtos = NULL,
.maxFragmentLength = MFLN,
.disableSni = true,
.pRootCa = NULL,
.rootCaSize = 0,
.sendTimeoutMs = 0XFFFFFFFF,
.recvTimeoutMs = TEST_TRANSPORT_RCV_TIMEOUT_MS
};
SOCKETS_Socket_ExpectAndReturn( SOCKETS_AF_INET,
SOCKETS_SOCK_STREAM,
SOCKETS_IPPROTO_TCP,
mockTcpSocket );
SOCKETS_GetHostByName_ExpectAndReturn( HOSTNAME,
MOCK_SERVER_ADDRESS );
SOCKETS_Connect_ExpectAndReturn( mockTcpSocket,
NULL,
sizeof( SocketsSockaddr_t ),
SOCKETS_ERROR_NONE );
SOCKETS_Connect_IgnoreArg_pxAddress();
SOCKETS_SetSockOpt_ExpectAndReturn( mockTcpSocket,
0,
SOCKETS_SO_RCVTIMEO,
NULL,
0,
SOCKETS_ERROR_NONE );
SOCKETS_SetSockOpt_IgnoreArg_pvOptionValue();
SOCKETS_SetSockOpt_IgnoreArg_xOptionLength();
SOCKETS_SetSockOpt_ExpectAndReturn( mockTcpSocket,
0,
SOCKETS_SO_SNDTIMEO,
NULL,
0,
MOCK_SECURE_SOCKET_ERROR );
SOCKETS_SetSockOpt_IgnoreArg_pvOptionValue();
SOCKETS_SetSockOpt_IgnoreArg_xOptionLength();
SOCKETS_Close_ExpectAndReturn( mockTcpSocket,
SOCKETS_ERROR_NONE );
returnStatus = SecureSocketsTransport_Connect( &networkContext,
&serverInfo,
&localSocketsConfig );
TEST_ASSERT_EQUAL( TRANSPORT_SOCKET_STATUS_INTERNAL_ERROR, returnStatus );
}
/*-----------------------------------------------------------*/
/**
* @brief Test that #SecureSocketsTransport_Connect fails to set the socket
* recv timeout, and verify the error code.
*/
void test_SecureSocketsTransport_Connect_TimeOutSetup_Failure_Recv( void )
{
TransportSocketStatus_t returnStatus;
SocketsConfig_t localSocketsConfig =
{
.enableTls = false,
.pAlpnProtos = NULL,
.maxFragmentLength = MFLN,
.disableSni = true,
.pRootCa = NULL,
.rootCaSize = 0,
.sendTimeoutMs = TEST_TRANSPORT_SND_TIMEOUT_MS,
.recvTimeoutMs = 0XFFFFFFFF
};
SOCKETS_Socket_ExpectAndReturn( SOCKETS_AF_INET,
SOCKETS_SOCK_STREAM,
SOCKETS_IPPROTO_TCP,
mockTcpSocket );
SOCKETS_GetHostByName_ExpectAndReturn( HOSTNAME,
MOCK_SERVER_ADDRESS );
SOCKETS_Connect_ExpectAndReturn( mockTcpSocket,
NULL,
sizeof( SocketsSockaddr_t ),
SOCKETS_ERROR_NONE );
SOCKETS_Connect_IgnoreArg_pxAddress();
SOCKETS_SetSockOpt_ExpectAndReturn( mockTcpSocket,
0,
SOCKETS_SO_RCVTIMEO,
NULL,
0,
MOCK_SECURE_SOCKET_ERROR );
SOCKETS_SetSockOpt_IgnoreArg_pvOptionValue();
SOCKETS_SetSockOpt_IgnoreArg_xOptionLength();
SOCKETS_Close_ExpectAndReturn( mockTcpSocket,
SOCKETS_ERROR_NONE );
returnStatus = SecureSocketsTransport_Connect( &networkContext,
&serverInfo,
&localSocketsConfig );
TEST_ASSERT_EQUAL( TRANSPORT_SOCKET_STATUS_INTERNAL_ERROR, returnStatus );
}
/*-----------------------------------------------------------*/
/**
* @brief Test the happy path case to connect to a server without TLS.
*/
void test_SecureSocketsTransport_Connect_Succeeds_without_TLS( void )
{
TransportSocketStatus_t returnStatus;
SocketsConfig_t localSocketsConfig =
{
.enableTls = false,
.pAlpnProtos = NULL,
.maxFragmentLength = MFLN,
.disableSni = true,
.pRootCa = NULL,
.rootCaSize = 0,
.sendTimeoutMs = TEST_TRANSPORT_SND_TIMEOUT_MS,
.recvTimeoutMs = TEST_TRANSPORT_RCV_TIMEOUT_MS
};
SOCKETS_Socket_ExpectAndReturn( SOCKETS_AF_INET,
SOCKETS_SOCK_STREAM,
SOCKETS_IPPROTO_TCP,
mockTcpSocket );
SOCKETS_GetHostByName_ExpectAndReturn( HOSTNAME,
MOCK_SERVER_ADDRESS );
SOCKETS_Connect_ExpectAndReturn( mockTcpSocket,
NULL,
sizeof( SocketsSockaddr_t ),
SOCKETS_ERROR_NONE );
SOCKETS_Connect_IgnoreArg_pxAddress();
SOCKETS_SetSockOpt_ExpectAndReturn( mockTcpSocket,
0,
SOCKETS_SO_RCVTIMEO,
NULL,
0,
SOCKETS_ERROR_NONE );
SOCKETS_SetSockOpt_IgnoreArg_pvOptionValue();
SOCKETS_SetSockOpt_IgnoreArg_xOptionLength();
SOCKETS_SetSockOpt_ExpectAndReturn( mockTcpSocket,
0,
SOCKETS_SO_SNDTIMEO,
NULL,
0,
SOCKETS_ERROR_NONE );
SOCKETS_SetSockOpt_IgnoreArg_pvOptionValue();
SOCKETS_SetSockOpt_IgnoreArg_xOptionLength();
returnStatus = SecureSocketsTransport_Connect( &networkContext,
&serverInfo,
&localSocketsConfig );
TEST_ASSERT_EQUAL( TRANSPORT_SOCKET_STATUS_SUCCESS, returnStatus );
}
/*-----------------------------------------------------------*/
/**
* @brief Test the happy path case to connect to a server without TLS and set the
* send and receive timeouts to zero.
*/
void test_SecureSocketsTransport_Connect_Succeeds_Set_Timeout_Zero( void )
{
TransportSocketStatus_t returnStatus;
SocketsConfig_t localSocketsConfig =
{
.enableTls = false,
.pAlpnProtos = NULL,
.maxFragmentLength = MFLN,
.disableSni = true,
.pRootCa = NULL,
.rootCaSize = 0,
.sendTimeoutMs = 0,
.recvTimeoutMs = 0
};
SOCKETS_Socket_ExpectAndReturn( SOCKETS_AF_INET,
SOCKETS_SOCK_STREAM,
SOCKETS_IPPROTO_TCP,
mockTcpSocket );
SOCKETS_GetHostByName_ExpectAndReturn( HOSTNAME,
MOCK_SERVER_ADDRESS );
SOCKETS_Connect_ExpectAndReturn( mockTcpSocket,
NULL,
sizeof( SocketsSockaddr_t ),
SOCKETS_ERROR_NONE );
SOCKETS_Connect_IgnoreArg_pxAddress();
SOCKETS_SetSockOpt_ExpectAndReturn( mockTcpSocket,
0,
SOCKETS_SO_RCVTIMEO,
NULL,
0,
SOCKETS_ERROR_NONE );
SOCKETS_SetSockOpt_IgnoreArg_pvOptionValue();
SOCKETS_SetSockOpt_IgnoreArg_xOptionLength();
SOCKETS_SetSockOpt_ExpectAndReturn( mockTcpSocket,
0,
SOCKETS_SO_SNDTIMEO,
NULL,
0,
SOCKETS_ERROR_NONE );
SOCKETS_SetSockOpt_IgnoreArg_pvOptionValue();
SOCKETS_SetSockOpt_IgnoreArg_xOptionLength();
returnStatus = SecureSocketsTransport_Connect( &networkContext,
&serverInfo,
&localSocketsConfig );
TEST_ASSERT_EQUAL( TRANSPORT_SOCKET_STATUS_SUCCESS, returnStatus );
}
/*-----------------------------------------------------------*/
/**
* @brief Test the happy path case to connect to a server with TLS.
*/
void test_SecureSocketsTransport_Connect_Succeeds_with_TLS( void )
{
TransportSocketStatus_t returnStatus;
SocketsConfig_t localSocketsConfig =
{
.enableTls = true,
.pAlpnProtos = ALPN_PROTOS,
.maxFragmentLength = MFLN,
.disableSni = false,
.pRootCa = MOCK_ROOT_CA,
.rootCaSize = strlen( MOCK_ROOT_CA ),
.sendTimeoutMs = TEST_TRANSPORT_SND_TIMEOUT_MS,
.recvTimeoutMs = TEST_TRANSPORT_RCV_TIMEOUT_MS
};
SOCKETS_Socket_ExpectAndReturn( SOCKETS_AF_INET,
SOCKETS_SOCK_STREAM,
SOCKETS_IPPROTO_TCP,
mockTcpSocket );
SOCKETS_SetSockOpt_ExpectAndReturn( mockTcpSocket,
0,
SOCKETS_SO_REQUIRE_TLS,
NULL,
0,
SOCKETS_ERROR_NONE );
SOCKETS_SetSockOpt_IgnoreArg_pvOptionValue();
SOCKETS_SetSockOpt_IgnoreArg_xOptionLength();
SOCKETS_SetSockOpt_ExpectAndReturn( mockTcpSocket,
0,
SOCKETS_SO_ALPN_PROTOCOLS,
NULL,
0,
SOCKETS_ERROR_NONE );
SOCKETS_SetSockOpt_IgnoreArg_pvOptionValue();
SOCKETS_SetSockOpt_IgnoreArg_xOptionLength();
SOCKETS_SetSockOpt_ExpectAndReturn( mockTcpSocket,
0,
SOCKETS_SO_SERVER_NAME_INDICATION,
NULL,
0,
SOCKETS_ERROR_NONE );
SOCKETS_SetSockOpt_IgnoreArg_pvOptionValue();
SOCKETS_SetSockOpt_IgnoreArg_xOptionLength();
SOCKETS_SetSockOpt_ExpectAndReturn( mockTcpSocket,
0,
SOCKETS_SO_TRUSTED_SERVER_CERTIFICATE,
NULL,
0,
SOCKETS_ERROR_NONE );
SOCKETS_SetSockOpt_IgnoreArg_pvOptionValue();
SOCKETS_SetSockOpt_IgnoreArg_xOptionLength();
SOCKETS_GetHostByName_ExpectAndReturn( HOSTNAME,
MOCK_SERVER_ADDRESS );
SOCKETS_Connect_ExpectAndReturn( mockTcpSocket,
NULL,
sizeof( SocketsSockaddr_t ),
SOCKETS_ERROR_NONE );
SOCKETS_Connect_IgnoreArg_pxAddress();
SOCKETS_SetSockOpt_ExpectAndReturn( mockTcpSocket,
0,
SOCKETS_SO_RCVTIMEO,
NULL,
0,
SOCKETS_ERROR_NONE );
SOCKETS_SetSockOpt_IgnoreArg_pvOptionValue();
SOCKETS_SetSockOpt_IgnoreArg_xOptionLength();
SOCKETS_SetSockOpt_ExpectAndReturn( mockTcpSocket,
0,
SOCKETS_SO_SNDTIMEO,
NULL,
0,
SOCKETS_ERROR_NONE );
SOCKETS_SetSockOpt_IgnoreArg_pvOptionValue();
SOCKETS_SetSockOpt_IgnoreArg_xOptionLength();
returnStatus = SecureSocketsTransport_Connect( &networkContext,
&serverInfo,
&localSocketsConfig );
TEST_ASSERT_EQUAL( TRANSPORT_SOCKET_STATUS_SUCCESS, returnStatus );
}
/*-----------------------------------------------------------*/
/**
* @brief Test the happy path case to connect to a server with TLS, but the root
* CA, ALPN protocols, and SNI are not set.
*/
void test_SecureSocketsTransport_Connect_Credentials_NotSet( void )
{
TransportSocketStatus_t returnStatus;
SocketsConfig_t localSocketsConfig =
{
.enableTls = true,
.pAlpnProtos = NULL,
.maxFragmentLength = MFLN,
.disableSni = true,
.pRootCa = NULL,
.rootCaSize = 0,
.sendTimeoutMs = TEST_TRANSPORT_SND_TIMEOUT_MS,
.recvTimeoutMs = TEST_TRANSPORT_RCV_TIMEOUT_MS
};
SOCKETS_Socket_ExpectAndReturn( SOCKETS_AF_INET,
SOCKETS_SOCK_STREAM,
SOCKETS_IPPROTO_TCP,
mockTcpSocket );
SOCKETS_SetSockOpt_ExpectAndReturn( mockTcpSocket,
0,
SOCKETS_SO_REQUIRE_TLS,
NULL,
0,
SOCKETS_ERROR_NONE );
SOCKETS_SetSockOpt_IgnoreArg_pvOptionValue();
SOCKETS_SetSockOpt_IgnoreArg_xOptionLength();
SOCKETS_GetHostByName_ExpectAndReturn( HOSTNAME,
MOCK_SERVER_ADDRESS );
SOCKETS_Connect_ExpectAndReturn( mockTcpSocket,
NULL,
sizeof( SocketsSockaddr_t ),
SOCKETS_ERROR_NONE );
SOCKETS_Connect_IgnoreArg_pxAddress();
SOCKETS_SetSockOpt_ExpectAndReturn( mockTcpSocket,
0,
SOCKETS_SO_RCVTIMEO,
NULL,
0,
SOCKETS_ERROR_NONE );
SOCKETS_SetSockOpt_IgnoreArg_pvOptionValue();
SOCKETS_SetSockOpt_IgnoreArg_xOptionLength();
SOCKETS_SetSockOpt_ExpectAndReturn( mockTcpSocket,
0,
SOCKETS_SO_SNDTIMEO,
NULL,
0,
SOCKETS_ERROR_NONE );
SOCKETS_SetSockOpt_IgnoreArg_pvOptionValue();
SOCKETS_SetSockOpt_IgnoreArg_xOptionLength();
returnStatus = SecureSocketsTransport_Connect( &networkContext,
&serverInfo,
&localSocketsConfig );
TEST_ASSERT_EQUAL( TRANSPORT_SOCKET_STATUS_SUCCESS, returnStatus );
}
/*-----------------------------------------------------------*/
/**
* @brief Test #SecureSocketsTransport_Disconnect with invalid parameters.
*/
void test_SecureSocketsTransport_Disconnect_NULL_Network_Context( void )
{
TransportSocketStatus_t returnStatus;
returnStatus = SecureSocketsTransport_Disconnect( NULL );
TEST_ASSERT_EQUAL( TRANSPORT_SOCKET_STATUS_INVALID_PARAMETER, returnStatus );
}
/*-----------------------------------------------------------*/
/**
* @brief Test when #SecureSocketsTransport_Disconnect encounters a
* #SOCKETS_Shutdown failure.
*/
void test_SecureSocketsTransport_Disconnect_Fail_to_ShutDown( void )
{
TransportSocketStatus_t returnStatus;
SOCKETS_Shutdown_ExpectAndReturn( mockTcpSocket, SOCKETS_SHUT_RDWR, MOCK_SECURE_SOCKET_ERROR );
returnStatus = SecureSocketsTransport_Disconnect( &networkContext );
TEST_ASSERT_EQUAL( TRANSPORT_SOCKET_STATUS_INTERNAL_ERROR, returnStatus );
}
/*-----------------------------------------------------------*/
/**
* @brief Test when #SecureSocketsTransport_Disconnect encounters a
* #SOCKETS_Close failure.
*/
void test_SecureSocketsTransport_Disconnect_Fail_to_Close( void )
{
TransportSocketStatus_t returnStatus;
SOCKETS_Shutdown_ExpectAndReturn( mockTcpSocket, SOCKETS_SHUT_RDWR, SOCKETS_ERROR_NONE );
SOCKETS_Close_ExpectAndReturn( mockTcpSocket, MOCK_SECURE_SOCKET_ERROR );
returnStatus = SecureSocketsTransport_Disconnect( &networkContext );
TEST_ASSERT_EQUAL( TRANSPORT_SOCKET_STATUS_INTERNAL_ERROR, returnStatus );
}
/*-----------------------------------------------------------*/
/**
* @brief A happy path #SecureSocketsTransport_Disconnect test.
*/
void test_SecureSocketsTransport_Disconnect_Sucess( void )
{
TransportSocketStatus_t returnStatus;
SOCKETS_Shutdown_ExpectAndReturn( mockTcpSocket, SOCKETS_SHUT_RDWR, SOCKETS_ERROR_NONE );
SOCKETS_Close_ExpectAndReturn( mockTcpSocket, SOCKETS_ERROR_NONE );
returnStatus = SecureSocketsTransport_Disconnect( &networkContext );
TEST_ASSERT_EQUAL( TRANSPORT_SOCKET_STATUS_SUCCESS, returnStatus );
}
/*-----------------------------------------------------------*/
/**
* @brief Test that #SecureSocketsTransport_Send is able to return that 0 bytes are sent over
* the network stack, when passing any invalid parameters.
*/
void test_SecureSocketsTransport_Send_Invalid_Params( void )
{
int32_t bytesSent;
NetworkContext_t invalidNetworkContext = { 0 };
invalidNetworkContext.tcpSocket = SOCKETS_INVALID_SOCKET;
bytesSent = SecureSocketsTransport_Send( NULL, networkBuffer, BYTES_TO_SEND );
TEST_ASSERT_EQUAL( SOCKETS_EINVAL, bytesSent );
bytesSent = SecureSocketsTransport_Send( &invalidNetworkContext, NULL, BYTES_TO_SEND );
TEST_ASSERT_EQUAL( SOCKETS_EINVAL, bytesSent );
bytesSent = SecureSocketsTransport_Send( &invalidNetworkContext, networkBuffer, 0 );
TEST_ASSERT_EQUAL( SOCKETS_EINVAL, bytesSent );
bytesSent = SecureSocketsTransport_Send( &invalidNetworkContext, networkBuffer, BYTES_TO_SEND );
TEST_ASSERT_EQUAL( SOCKETS_EINVAL, bytesSent );
}
/*-----------------------------------------------------------*/
/**
* @brief Test that #SecureSocketsTransport_Send returns an error when #SOCKETS_Send fails to send
* data over the network stack.
*/
void test_SecureSocketsTransport_Send_Network_Error( void )
{
int32_t bytesSent = 0;
networkContext.tcpSocket = mockTcpSocket;
SOCKETS_Send_ExpectAndReturn( networkContext.tcpSocket, networkBuffer, BYTES_TO_SEND, 0, SECURE_SOCKETS_READ_WRITE_ERROR );
bytesSent = SecureSocketsTransport_Send( &networkContext, networkBuffer, BYTES_TO_SEND );
TEST_ASSERT_EQUAL( SECURE_SOCKETS_READ_WRITE_ERROR, bytesSent );
}
/*-----------------------------------------------------------*/
/**
* @brief Test the happy path case when #SecureSocketsTransport_Send is able to send all bytes
* over the network stack successfully.
*/
void test_SecureSocketsTransport_Send_All_Bytes_Sent_Successfully( void )
{
int32_t bytesSent = 0;
networkContext.tcpSocket = mockTcpSocket;
SOCKETS_Send_ExpectAndReturn( networkContext.tcpSocket, networkBuffer, BYTES_TO_SEND, 0, BYTES_TO_SEND );
bytesSent = SecureSocketsTransport_Send( &networkContext, networkBuffer, BYTES_TO_SEND );
TEST_ASSERT_EQUAL( BYTES_TO_SEND, bytesSent );
}
/*-----------------------------------------------------------*/
/**
* @brief Test the happy path case of when #SecureSocketsTransport_Send sends
* fewer bytes then BYTES_TO_SEND.
*/
void test_SecureSocketsTransport_Send_Bytes_Sent_Partially( void )
{
int32_t bytesSent = 0;
networkContext.tcpSocket = mockTcpSocket;
SOCKETS_Send_ExpectAndReturn( networkContext.tcpSocket, networkBuffer, BYTES_TO_SEND, 0, BYTES_TO_SEND - 1 );
bytesSent = SecureSocketsTransport_Send( &networkContext, networkBuffer, BYTES_TO_SEND );
TEST_ASSERT_EQUAL( BYTES_TO_SEND - 1, bytesSent );
}
/*-----------------------------------------------------------*/
/**
* @brief Test that #SecureSocketsTransport_Recv is able to return that 0 bytes are received
* from the network stack when passing any invalid parameters.
*/
void test_SecureSocketsTransport_Recv_Invalid_Params( void )
{
int32_t bytesReceived = 0;
NetworkContext_t invalidNetworkContext = { 0 };
invalidNetworkContext.tcpSocket = SOCKETS_INVALID_SOCKET;
bytesReceived = SecureSocketsTransport_Recv( NULL, networkBuffer, BYTES_TO_RECV );
TEST_ASSERT_EQUAL( SOCKETS_EINVAL, bytesReceived );
bytesReceived = SecureSocketsTransport_Recv( &invalidNetworkContext, NULL, BYTES_TO_RECV );
TEST_ASSERT_EQUAL( SOCKETS_EINVAL, bytesReceived );
bytesReceived = SecureSocketsTransport_Recv( &invalidNetworkContext, networkBuffer, 0 );
TEST_ASSERT_EQUAL( SOCKETS_EINVAL, bytesReceived );
bytesReceived = SecureSocketsTransport_Recv( &invalidNetworkContext, networkBuffer, BYTES_TO_RECV );
TEST_ASSERT_EQUAL( SOCKETS_EINVAL, bytesReceived );
}
/*-----------------------------------------------------------*/
/**
* @brief Test the happy path case when #SecureSocketsTransport_Recv is able to receive all
* expected bytes over the network stack.
*/
void test_SecureSocketsTransport_Recv_All_Bytes_Received_Successfully( void )
{
int32_t bytesReceived = 0;
networkContext.tcpSocket = mockTcpSocket;
SOCKETS_Recv_ExpectAndReturn( networkContext.tcpSocket, NULL, BYTES_TO_RECV, 0, BYTES_TO_RECV );
SOCKETS_Recv_IgnoreArg_pvBuffer();
bytesReceived = SecureSocketsTransport_Recv( &networkContext, networkBuffer, BYTES_TO_RECV );
TEST_ASSERT_EQUAL( BYTES_TO_RECV, bytesReceived );
}
/*-----------------------------------------------------------*/
/**
* @brief Test that #SecureSocketsTransport_Recv returns an error when #SOCKETS_Recv fails to
* receive data over the network stack.
*/
void test_SecureSocketsTransport_Recv_Network_Error( void )
{
int32_t bytesReceived = 0;
networkContext.tcpSocket = mockTcpSocket;
SOCKETS_Recv_ExpectAndReturn( networkContext.tcpSocket, NULL, BYTES_TO_RECV, 0, SOCKETS_EWOULDBLOCK );
SOCKETS_Recv_IgnoreArg_pvBuffer();
bytesReceived = SecureSocketsTransport_Recv( &networkContext, networkBuffer, BYTES_TO_RECV );
TEST_ASSERT_EQUAL( 0, bytesReceived );
SOCKETS_Recv_ExpectAndReturn( networkContext.tcpSocket, NULL, BYTES_TO_RECV, 0, SECURE_SOCKETS_READ_WRITE_ERROR );
SOCKETS_Recv_IgnoreArg_pvBuffer();
bytesReceived = SecureSocketsTransport_Recv( &networkContext, networkBuffer, BYTES_TO_RECV );
TEST_ASSERT_EQUAL( SECURE_SOCKETS_READ_WRITE_ERROR, bytesReceived );
}
/*-----------------------------------------------------------*/
/**
* @brief Test the happy path case of when #SecureSocketsTransport_Recv received
* fewer bytes than BYTES_TO_RECV.
*/
void test_SecureSocketsTransport_Recv_Bytes_Received_Partially( void )
{
int32_t bytesReceived = 0;
networkContext.tcpSocket = mockTcpSocket;
SOCKETS_Recv_ExpectAndReturn( networkContext.tcpSocket, NULL, BYTES_TO_RECV, 0, BYTES_TO_RECV - 1 );
SOCKETS_Recv_IgnoreArg_pvBuffer();
bytesReceived = SecureSocketsTransport_Recv( &networkContext, networkBuffer, BYTES_TO_RECV );
TEST_ASSERT_EQUAL( BYTES_TO_RECV - 1, bytesReceived );
}
/*-------------------------------------------------------------------*/
/*-----------------------End Tests-----------------------------------*/
/*-------------------------------------------------------------------*/
| [
"[email protected]"
] | |
86161fea5cd5a4f6f2336dc1d12954254b90ef85 | d6029101c07a747ba980b6efb16d5cb781332f8c | /src/firmware_new/boards/frankie_v1/stm32h7xx_hal_msp.c | bc9ce73c8f3710b78dd108831f710588348910e7 | [
"LGPL-3.0-only"
] | permissive | EvanMorcom/Software | dd7ddfcd44f3f439dff32024ec1883a21c9d2dc6 | 586fb3cf8dc2d93de194d9815af5de63caa7e318 | refs/heads/master | 2021-06-24T22:13:02.049658 | 2020-06-22T01:20:43 | 2020-06-22T01:20:43 | 142,702,380 | 0 | 0 | MIT | 2018-07-28T18:53:53 | 2018-07-28T18:53:53 | null | UTF-8 | C | false | false | 10,081 | c | /* USER CODE BEGIN Header */
/**
******************************************************************************
* File Name : stm32h7xx_hal_msp.c
* Description : This file provides code for the MSP Initialization
* and de-Initialization codes.
******************************************************************************
* @attention
*
* <h2><center>© Copyright (c) 2019 STMicroelectronics.
* All rights reserved.</center></h2>
*
* This software component is licensed by ST under BSD 3-Clause license,
* the "License"; You may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
* opensource.org/licenses/BSD-3-Clause
*
******************************************************************************
*/
/* USER CODE END Header */
/* Includes ------------------------------------------------------------------*/
#include "main.h"
/* USER CODE BEGIN Includes */
/* USER CODE END Includes */
/* Private typedef -----------------------------------------------------------*/
/* USER CODE BEGIN TD */
/* USER CODE END TD */
/* Private define ------------------------------------------------------------*/
/* USER CODE BEGIN Define */
/* USER CODE END Define */
/* Private macro -------------------------------------------------------------*/
/* USER CODE BEGIN Macro */
/* USER CODE END Macro */
/* Private variables ---------------------------------------------------------*/
/* USER CODE BEGIN PV */
/* USER CODE END PV */
/* Private function prototypes -----------------------------------------------*/
/* USER CODE BEGIN PFP */
/* USER CODE END PFP */
/* External functions --------------------------------------------------------*/
/* USER CODE BEGIN ExternalFunctions */
/* USER CODE END ExternalFunctions */
/* USER CODE BEGIN 0 */
/* USER CODE END 0 */
void HAL_TIM_MspPostInit(TIM_HandleTypeDef* htim);
/**
* Initializes the Global MSP.
*/
void HAL_MspInit(void)
{
/* USER CODE BEGIN MspInit 0 */
/* USER CODE END MspInit 0 */
__HAL_RCC_SYSCFG_CLK_ENABLE();
/* System interrupt init*/
/* PendSV_IRQn interrupt configuration */
HAL_NVIC_SetPriority(PendSV_IRQn, 15, 0);
/* USER CODE BEGIN MspInit 1 */
/* USER CODE END MspInit 1 */
}
/**
* @brief CRC MSP Initialization
* This function configures the hardware resources used in this example
* @param hcrc: CRC handle pointer
* @retval None
*/
void HAL_CRC_MspInit(CRC_HandleTypeDef* hcrc)
{
if (hcrc->Instance == CRC)
{
/* USER CODE BEGIN CRC_MspInit 0 */
/* USER CODE END CRC_MspInit 0 */
/* Peripheral clock enable */
__HAL_RCC_CRC_CLK_ENABLE();
/* USER CODE BEGIN CRC_MspInit 1 */
/* USER CODE END CRC_MspInit 1 */
}
}
/**
* @brief CRC MSP De-Initialization
* This function freeze the hardware resources used in this example
* @param hcrc: CRC handle pointer
* @retval None
*/
void HAL_CRC_MspDeInit(CRC_HandleTypeDef* hcrc)
{
if (hcrc->Instance == CRC)
{
/* USER CODE BEGIN CRC_MspDeInit 0 */
/* USER CODE END CRC_MspDeInit 0 */
/* Peripheral clock disable */
__HAL_RCC_CRC_CLK_DISABLE();
/* USER CODE BEGIN CRC_MspDeInit 1 */
/* USER CODE END CRC_MspDeInit 1 */
}
}
/**
* @brief TIM_PWM MSP Initialization
* This function configures the hardware resources used in this example
* @param htim_pwm: TIM_PWM handle pointer
* @retval None
*/
void HAL_TIM_PWM_MspInit(TIM_HandleTypeDef* htim_pwm)
{
if (htim_pwm->Instance == TIM4)
{
/* USER CODE BEGIN TIM4_MspInit 0 */
/* USER CODE END TIM4_MspInit 0 */
/* Peripheral clock enable */
__HAL_RCC_TIM4_CLK_ENABLE();
/* USER CODE BEGIN TIM4_MspInit 1 */
/* USER CODE END TIM4_MspInit 1 */
}
}
void HAL_TIM_MspPostInit(TIM_HandleTypeDef* htim)
{
GPIO_InitTypeDef GPIO_InitStruct = {0};
if (htim->Instance == TIM4)
{
/* USER CODE BEGIN TIM4_MspPostInit 0 */
/* USER CODE END TIM4_MspPostInit 0 */
__HAL_RCC_GPIOD_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE();
/**TIM4 GPIO Configuration
PD13 ------> TIM4_CH2
PD14 ------> TIM4_CH3
PD15 ------> TIM4_CH4
PB6 ------> TIM4_CH1
*/
GPIO_InitStruct.Pin = wheel_motor_back_left_pwm_Pin |
wheel_motor_back_right_pwm_Pin |
wheel_motor_front_right_pwm_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
GPIO_InitStruct.Alternate = GPIO_AF2_TIM4;
HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
GPIO_InitStruct.Pin = wheel_motor_front_left_pwm_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
GPIO_InitStruct.Alternate = GPIO_AF2_TIM4;
HAL_GPIO_Init(wheel_motor_front_left_pwm_GPIO_Port, &GPIO_InitStruct);
/* USER CODE BEGIN TIM4_MspPostInit 1 */
/* USER CODE END TIM4_MspPostInit 1 */
}
}
/**
* @brief TIM_PWM MSP De-Initialization
* This function freeze the hardware resources used in this example
* @param htim_pwm: TIM_PWM handle pointer
* @retval None
*/
void HAL_TIM_PWM_MspDeInit(TIM_HandleTypeDef* htim_pwm)
{
if (htim_pwm->Instance == TIM4)
{
/* USER CODE BEGIN TIM4_MspDeInit 0 */
/* USER CODE END TIM4_MspDeInit 0 */
/* Peripheral clock disable */
__HAL_RCC_TIM4_CLK_DISABLE();
/* USER CODE BEGIN TIM4_MspDeInit 1 */
/* USER CODE END TIM4_MspDeInit 1 */
}
}
/**
* @brief UART MSP Initialization
* This function configures the hardware resources used in this example
* @param huart: UART handle pointer
* @retval None
*/
void HAL_UART_MspInit(UART_HandleTypeDef* huart)
{
GPIO_InitTypeDef GPIO_InitStruct = {0};
if (huart->Instance == USART3)
{
/* USER CODE BEGIN USART3_MspInit 0 */
/* USER CODE END USART3_MspInit 0 */
/* Peripheral clock enable */
__HAL_RCC_USART3_CLK_ENABLE();
__HAL_RCC_GPIOD_CLK_ENABLE();
/**USART3 GPIO Configuration
PD8 ------> USART3_TX
PD9 ------> USART3_RX
*/
GPIO_InitStruct.Pin = STLK_RX_Pin | STLK_TX_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
GPIO_InitStruct.Alternate = GPIO_AF7_USART3;
HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
/* USER CODE BEGIN USART3_MspInit 1 */
/* USER CODE END USART3_MspInit 1 */
}
}
/**
* @brief UART MSP De-Initialization
* This function freeze the hardware resources used in this example
* @param huart: UART handle pointer
* @retval None
*/
void HAL_UART_MspDeInit(UART_HandleTypeDef* huart)
{
if (huart->Instance == USART3)
{
/* USER CODE BEGIN USART3_MspDeInit 0 */
/* USER CODE END USART3_MspDeInit 0 */
/* Peripheral clock disable */
__HAL_RCC_USART3_CLK_DISABLE();
/**USART3 GPIO Configuration
PD8 ------> USART3_TX
PD9 ------> USART3_RX
*/
HAL_GPIO_DeInit(GPIOD, STLK_RX_Pin | STLK_TX_Pin);
/* USER CODE BEGIN USART3_MspDeInit 1 */
/* USER CODE END USART3_MspDeInit 1 */
}
}
/**
* @brief PCD MSP Initialization
* This function configures the hardware resources used in this example
* @param hpcd: PCD handle pointer
* @retval None
*/
void HAL_PCD_MspInit(PCD_HandleTypeDef* hpcd)
{
GPIO_InitTypeDef GPIO_InitStruct = {0};
if (hpcd->Instance == USB_OTG_FS)
{
/* USER CODE BEGIN USB_OTG_FS_MspInit 0 */
/* USER CODE END USB_OTG_FS_MspInit 0 */
__HAL_RCC_GPIOA_CLK_ENABLE();
/**USB_OTG_FS GPIO Configuration
PA8 ------> USB_OTG_FS_SOF
PA9 ------> USB_OTG_FS_VBUS
PA10 ------> USB_OTG_FS_ID
PA11 ------> USB_OTG_FS_DM
PA12 ------> USB_OTG_FS_DP
*/
GPIO_InitStruct.Pin = USB_SOF_Pin | USB_ID_Pin | USB_DM_Pin | USB_DP_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
GPIO_InitStruct.Alternate = GPIO_AF10_OTG1_FS;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
GPIO_InitStruct.Pin = USB_VBUS_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(USB_VBUS_GPIO_Port, &GPIO_InitStruct);
/* Peripheral clock enable */
__HAL_RCC_USB_OTG_FS_CLK_ENABLE();
/* USER CODE BEGIN USB_OTG_FS_MspInit 1 */
/* USER CODE END USB_OTG_FS_MspInit 1 */
}
}
/**
* @brief PCD MSP De-Initialization
* This function freeze the hardware resources used in this example
* @param hpcd: PCD handle pointer
* @retval None
*/
void HAL_PCD_MspDeInit(PCD_HandleTypeDef* hpcd)
{
if (hpcd->Instance == USB_OTG_FS)
{
/* USER CODE BEGIN USB_OTG_FS_MspDeInit 0 */
/* USER CODE END USB_OTG_FS_MspDeInit 0 */
/* Peripheral clock disable */
__HAL_RCC_USB_OTG_FS_CLK_DISABLE();
/**USB_OTG_FS GPIO Configuration
PA8 ------> USB_OTG_FS_SOF
PA9 ------> USB_OTG_FS_VBUS
PA10 ------> USB_OTG_FS_ID
PA11 ------> USB_OTG_FS_DM
PA12 ------> USB_OTG_FS_DP
*/
HAL_GPIO_DeInit(
GPIOA, USB_SOF_Pin | USB_VBUS_Pin | USB_ID_Pin | USB_DM_Pin | USB_DP_Pin);
/* USER CODE BEGIN USB_OTG_FS_MspDeInit 1 */
/* USER CODE END USB_OTG_FS_MspDeInit 1 */
}
}
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
| [
"[email protected]"
] | |
d9568b6cc4e1c749d0bd6a0e37cc8dc45c8e6d02 | b477697f95728fbf8d1759a73858860c9620c3ab | /peripheral/ctr/processor/ctr_p32mz2048efm144.h | 3546adc82f8d94d20d39687a1000fb58ec668ce0 | [] | no_license | gmuro/harmony-v2_06-framework | 12bcb30c2dc9f4737aab8762da8b25632822d00e | 2196b67de35af9d1126b539b08324cf72ed13521 | refs/heads/master | 2022-12-07T19:24:34.649360 | 2022-11-18T22:16:49 | 2022-11-18T22:16:49 | 190,900,209 | 1 | 1 | null | null | null | null | UTF-8 | C | false | false | 11,256 | h | /* Created by plibgen $Revision: 1.31 $ */
#ifndef _CTR_P32MZ2048EFM144_H
#define _CTR_P32MZ2048EFM144_H
/* Section 1 - Enumerate instances, define constants, VREGs */
#include <xc.h>
#include <stdbool.h>
#include "peripheral/peripheral_common_32bit.h"
/* Default definition used for all API dispatch functions */
#ifndef PLIB_INLINE_API
#define PLIB_INLINE_API extern inline
#endif
/* Default definition used for all other functions */
#ifndef PLIB_INLINE
#define PLIB_INLINE extern inline
#endif
typedef enum {
CTR_NUMBER_OF_MODULES = 0
} CTR_MODULE_ID;
typedef enum {
CTR_SELECT_NONE
} CTR_SELECT;
typedef enum {
CTR_LATCH_UNIT_SELECT_NONE
} CTR_LATCH_UNIT_SELECT;
typedef enum {
CTR_ENABLE_CONTROL_NONE
} CTR_ENABLE_CONTROL;
typedef enum {
CTR_MODE_SELECT_NONE
} CTR_MODE_SELECT;
typedef enum {
CTR_LATCH_TRIGGER_SELECT_NONE
} CTR_LATCH_TRIGGER_SELECT;
typedef enum {
CTR_LATCH_CTR_SELECT_NONE
} CTR_LATCH_CTR_SELECT;
typedef enum {
CTR_ENABLE_LATCH_INT_GEN_NONE
} CTR_ENABLE_LATCH_INT_GEN;
typedef enum {
CTR_LATCH_INT_MODE_NONE
} CTR_LATCH_INT_MODE;
typedef enum {
CTR_TEST_BUS_SELECT_NONE
} CTR_TEST_BUS_SELECT;
/* Section 2 - Feature variant inclusion */
#define PLIB_TEMPLATE PLIB_INLINE
/* Section 3 - PLIB dispatch function definitions */
PLIB_INLINE_API bool PLIB_CTR_Exists1394Mode(CTR_MODULE_ID index)
{
return (bool)0;
}
PLIB_INLINE_API uint32_t _PLIB_UNSUPPORTED PLIB_CTR_1394ModeSecondGet(CTR_MODULE_ID index, CTR_SELECT ctrSel)
{
return (uint32_t)0;
}
PLIB_INLINE_API void _PLIB_UNSUPPORTED PLIB_CTR_1394ModeSecondSet(CTR_MODULE_ID index, CTR_SELECT ctrSel, uint32_t secVal)
{
}
PLIB_INLINE_API uint32_t _PLIB_UNSUPPORTED PLIB_CTR_1394ModeCountGet(CTR_MODULE_ID index, CTR_SELECT ctrSel)
{
return (uint32_t)0;
}
PLIB_INLINE_API void _PLIB_UNSUPPORTED PLIB_CTR_1394ModeCountSet(CTR_MODULE_ID index, CTR_SELECT ctrSel, uint32_t countVal)
{
}
PLIB_INLINE_API uint32_t _PLIB_UNSUPPORTED PLIB_CTR_1394ModeOffsetGet(CTR_MODULE_ID index, CTR_SELECT ctrSel)
{
return (uint32_t)0;
}
PLIB_INLINE_API void _PLIB_UNSUPPORTED PLIB_CTR_1394ModeOffsetSet(CTR_MODULE_ID index, CTR_SELECT ctrSel, uint32_t offsetVal)
{
}
PLIB_INLINE_API bool PLIB_CTR_ExistsUSMode(CTR_MODULE_ID index)
{
return (bool)0;
}
PLIB_INLINE_API uint32_t _PLIB_UNSUPPORTED PLIB_CTR_USModeSecondGet(CTR_MODULE_ID index, CTR_SELECT ctrSel)
{
return (uint32_t)0;
}
PLIB_INLINE_API void _PLIB_UNSUPPORTED PLIB_CTR_USModeSecondSet(CTR_MODULE_ID index, CTR_SELECT ctrSel, uint32_t secUSVal)
{
}
PLIB_INLINE_API uint32_t _PLIB_UNSUPPORTED PLIB_CTR_USModeValueGet(CTR_MODULE_ID index, CTR_SELECT ctrSel)
{
return (uint32_t)0;
}
PLIB_INLINE_API void _PLIB_UNSUPPORTED PLIB_CTR_USModeValueSet(CTR_MODULE_ID index, CTR_SELECT ctrSel, uint32_t usVal)
{
}
PLIB_INLINE_API uint32_t _PLIB_UNSUPPORTED PLIB_CTR_USMode10nsGet(CTR_MODULE_ID index, CTR_SELECT ctrSel)
{
return (uint32_t)0;
}
PLIB_INLINE_API void _PLIB_UNSUPPORTED PLIB_CTR_USMode10nsSet(CTR_MODULE_ID index, CTR_SELECT ctrSel, uint32_t us10nsVal)
{
}
PLIB_INLINE_API bool PLIB_CTR_ExistsLinearCTR(CTR_MODULE_ID index)
{
return (bool)0;
}
PLIB_INLINE_API uint32_t _PLIB_UNSUPPORTED PLIB_CTR_LinearCTRGet(CTR_MODULE_ID index, CTR_SELECT ctrSel)
{
return (uint32_t)0;
}
PLIB_INLINE_API bool PLIB_CTR_ExistsEnableCTR(CTR_MODULE_ID index)
{
return (bool)0;
}
PLIB_INLINE_API void _PLIB_UNSUPPORTED PLIB_CTR_EnableCTR(CTR_MODULE_ID index, CTR_SELECT ctrSel)
{
}
PLIB_INLINE_API void _PLIB_UNSUPPORTED PLIB_CTR_DisableCTR(CTR_MODULE_ID index, CTR_SELECT ctrSel)
{
}
PLIB_INLINE_API CTR_ENABLE_CONTROL _PLIB_UNSUPPORTED PLIB_CTR_ModuleStatus(CTR_MODULE_ID index, CTR_SELECT ctrSel)
{
return (CTR_ENABLE_CONTROL)0;
}
PLIB_INLINE_API bool PLIB_CTR_ExistsCTRFormatSel(CTR_MODULE_ID index)
{
return (bool)0;
}
PLIB_INLINE_API void _PLIB_UNSUPPORTED PLIB_CTR_CTRModeSelect(CTR_MODULE_ID index, CTR_SELECT ctrSel, CTR_MODE_SELECT modeVal)
{
}
PLIB_INLINE_API CTR_MODE_SELECT _PLIB_UNSUPPORTED PLIB_CTR_CTRModeStatus(CTR_MODULE_ID index, CTR_SELECT ctrSel)
{
return (CTR_MODE_SELECT)0;
}
PLIB_INLINE_API bool PLIB_CTR_ExistsCTRAdjustUS(CTR_MODULE_ID index)
{
return (bool)0;
}
PLIB_INLINE_API void _PLIB_UNSUPPORTED PLIB_CTR_CTRAdjustValueInitialize(CTR_MODULE_ID index, CTR_SELECT ctrSel, uint32_t adjVal)
{
}
PLIB_INLINE_API uint32_t _PLIB_UNSUPPORTED PLIB_CTR_CTRAdjustValueGet(CTR_MODULE_ID index, CTR_SELECT ctrSel)
{
return (uint32_t)0;
}
PLIB_INLINE_API bool PLIB_CTR_ExistsCTRDriftUS(CTR_MODULE_ID index)
{
return (bool)0;
}
PLIB_INLINE_API void _PLIB_UNSUPPORTED PLIB_CTR_CTRDriftValueSet(CTR_MODULE_ID index, CTR_SELECT ctrSel, uint32_t driftVal)
{
}
PLIB_INLINE_API uint32_t _PLIB_UNSUPPORTED PLIB_CTR_CTRDriftValueGet(CTR_MODULE_ID index, CTR_SELECT ctrSel)
{
return (uint32_t)0;
}
PLIB_INLINE_API bool PLIB_CTR_ExistsCTRDriftAccuUS(CTR_MODULE_ID index)
{
return (bool)0;
}
PLIB_INLINE_API uint32_t _PLIB_UNSUPPORTED PLIB_CTR_CTRAccuUSDriftValueGet(CTR_MODULE_ID index, CTR_SELECT ctrSel)
{
return (uint32_t)0;
}
PLIB_INLINE_API bool PLIB_CTR_ExistsCTRAdjustLIN(CTR_MODULE_ID index)
{
return (bool)0;
}
PLIB_INLINE_API void _PLIB_UNSUPPORTED PLIB_CTR_CTRLinearAdjustInitialize(CTR_MODULE_ID index, CTR_SELECT ctrSel, uint32_t linAdjVal)
{
}
PLIB_INLINE_API uint32_t _PLIB_UNSUPPORTED PLIB_CTR_CTRLinearAdjustGet(CTR_MODULE_ID index, CTR_SELECT ctrSel)
{
return (uint32_t)0;
}
PLIB_INLINE_API bool PLIB_CTR_ExistsCTRDriftLIN(CTR_MODULE_ID index)
{
return (bool)0;
}
PLIB_INLINE_API void _PLIB_UNSUPPORTED PLIB_CTR_CTRLinearDriftSet(CTR_MODULE_ID index, CTR_SELECT ctrSel, uint32_t linDriftVal)
{
}
PLIB_INLINE_API uint32_t _PLIB_UNSUPPORTED PLIB_CTR_CTRLinearDriftGet(CTR_MODULE_ID index, CTR_SELECT ctrSel)
{
return (uint32_t)0;
}
PLIB_INLINE_API bool PLIB_CTR_ExistsCTRDriftAccuLIN(CTR_MODULE_ID index)
{
return (bool)0;
}
PLIB_INLINE_API uint32_t _PLIB_UNSUPPORTED PLIB_CTR_CTRAccuLinDriftValueGet(CTR_MODULE_ID index, CTR_SELECT ctrSel)
{
return (uint32_t)0;
}
PLIB_INLINE_API bool PLIB_CTR_ExistsLatchTriggerSelect(CTR_MODULE_ID index)
{
return (bool)0;
}
PLIB_INLINE_API void _PLIB_UNSUPPORTED PLIB_CTR_LatchTriggerSelect(CTR_MODULE_ID index, CTR_LATCH_UNIT_SELECT latNum, CTR_LATCH_TRIGGER_SELECT latTrigSrc)
{
}
PLIB_INLINE_API CTR_LATCH_TRIGGER_SELECT _PLIB_UNSUPPORTED PLIB_CTR_LatchTriggerGet(CTR_MODULE_ID index, CTR_LATCH_UNIT_SELECT latNum)
{
return (CTR_LATCH_TRIGGER_SELECT)0;
}
PLIB_INLINE_API void _PLIB_UNSUPPORTED PLIB_CTR_LatchCTRSelect(CTR_MODULE_ID index, CTR_LATCH_UNIT_SELECT latNum, CTR_LATCH_CTR_SELECT latctrVal)
{
}
PLIB_INLINE_API CTR_LATCH_CTR_SELECT _PLIB_UNSUPPORTED PLIB_CTR_LatchCTRGet(CTR_MODULE_ID index, CTR_LATCH_UNIT_SELECT latNum)
{
return (CTR_LATCH_CTR_SELECT)0;
}
PLIB_INLINE_API void _PLIB_UNSUPPORTED PLIB_CTR_LatchDivSet(CTR_MODULE_ID index, CTR_LATCH_UNIT_SELECT latNum, uint32_t divVal)
{
}
PLIB_INLINE_API uint32_t _PLIB_UNSUPPORTED PLIB_CTR_LatchDivGet(CTR_MODULE_ID index, CTR_LATCH_UNIT_SELECT latNum)
{
return (uint32_t)0;
}
PLIB_INLINE_API bool PLIB_CTR_ExistsLatchValue(CTR_MODULE_ID index)
{
return (bool)0;
}
PLIB_INLINE_API uint32_t _PLIB_UNSUPPORTED PLIB_CTR_LatchGetValue(CTR_MODULE_ID index, CTR_LATCH_UNIT_SELECT latNum)
{
return (uint32_t)0;
}
PLIB_INLINE_API bool PLIB_CTR_ExistsLatchStatus(CTR_MODULE_ID index)
{
return (bool)0;
}
PLIB_INLINE_API uint32_t _PLIB_UNSUPPORTED PLIB_CTR_LatchGetStatus(CTR_MODULE_ID index, CTR_LATCH_UNIT_SELECT latNum)
{
return (uint32_t)0;
}
PLIB_INLINE_API bool PLIB_CTR_ExistsLatchTriggerCountValue(CTR_MODULE_ID index)
{
return (bool)0;
}
PLIB_INLINE_API uint32_t _PLIB_UNSUPPORTED PLIB_CTR_LatchTriggerCountGet(CTR_MODULE_ID index, CTR_LATCH_UNIT_SELECT latNum)
{
return (uint32_t)0;
}
PLIB_INLINE_API bool PLIB_CTR_ExistsTrigger(CTR_MODULE_ID index)
{
return (bool)0;
}
PLIB_INLINE_API void _PLIB_UNSUPPORTED PLIB_CTR_TriggerSelect(CTR_MODULE_ID index, CTR_LATCH_CTR_SELECT ctrTrigVal)
{
}
PLIB_INLINE_API CTR_LATCH_CTR_SELECT _PLIB_UNSUPPORTED PLIB_CTR_TriggerGet(CTR_MODULE_ID index)
{
return (CTR_LATCH_CTR_SELECT)0;
}
PLIB_INLINE_API void _PLIB_UNSUPPORTED PLIB_CTR_CycleOffsetValueSet(CTR_MODULE_ID index, uint32_t cycleOffsetVal)
{
}
PLIB_INLINE_API uint32_t _PLIB_UNSUPPORTED PLIB_CTR_CycleOffsetValueGet(CTR_MODULE_ID index)
{
return (uint32_t)0;
}
PLIB_INLINE_API bool PLIB_CTR_ExistsNValue(CTR_MODULE_ID index)
{
return (bool)0;
}
PLIB_INLINE_API void _PLIB_UNSUPPORTED PLIB_CTR_NValueSet(CTR_MODULE_ID index, CTR_SELECT ctrSel, uint32_t valueN)
{
}
PLIB_INLINE_API uint32_t _PLIB_UNSUPPORTED PLIB_CTR_NValueGet(CTR_MODULE_ID index, CTR_SELECT ctrSel)
{
return (uint32_t)0;
}
PLIB_INLINE_API bool PLIB_CTR_ExistsMValue(CTR_MODULE_ID index)
{
return (bool)0;
}
PLIB_INLINE_API void _PLIB_UNSUPPORTED PLIB_CTR_MValueSet(CTR_MODULE_ID index, CTR_SELECT ctrSel, uint32_t valueM)
{
}
PLIB_INLINE_API uint32_t _PLIB_UNSUPPORTED PLIB_CTR_MValueGet(CTR_MODULE_ID index, CTR_SELECT ctrSel)
{
return (uint32_t)0;
}
PLIB_INLINE_API bool PLIB_CTR_ExistsLSBValue(CTR_MODULE_ID index)
{
return (bool)0;
}
PLIB_INLINE_API void _PLIB_UNSUPPORTED PLIB_CTR_LSBValueSet(CTR_MODULE_ID index, CTR_SELECT ctrSel, uint32_t valueLSB)
{
}
PLIB_INLINE_API uint32_t _PLIB_UNSUPPORTED PLIB_CTR_LSBValueGet(CTR_MODULE_ID index, CTR_SELECT ctrSel)
{
return (uint32_t)0;
}
PLIB_INLINE_API bool PLIB_CTR_ExistsInterrupt(CTR_MODULE_ID index)
{
return (bool)0;
}
PLIB_INLINE_API void _PLIB_UNSUPPORTED PLIB_CTR_IntModeLatchSelect(CTR_MODULE_ID index, CTR_LATCH_INT_MODE intMode, CTR_LATCH_UNIT_SELECT latNum)
{
}
PLIB_INLINE_API CTR_LATCH_INT_MODE _PLIB_UNSUPPORTED PLIB_CTR_IntModeLatchGet(CTR_MODULE_ID index, CTR_LATCH_UNIT_SELECT latNum)
{
return (CTR_LATCH_INT_MODE)0;
}
PLIB_INLINE_API void _PLIB_UNSUPPORTED PLIB_CTR_IntLatchSelect(CTR_MODULE_ID index, CTR_ENABLE_LATCH_INT_GEN enableLatchVal)
{
}
PLIB_INLINE_API CTR_ENABLE_LATCH_INT_GEN _PLIB_UNSUPPORTED PLIB_CTR_IntLatchGet(CTR_MODULE_ID index)
{
return (CTR_ENABLE_LATCH_INT_GEN)0;
}
PLIB_INLINE_API bool PLIB_CTR_ExistsSpare(CTR_MODULE_ID index)
{
return (bool)0;
}
PLIB_INLINE_API uint32_t _PLIB_UNSUPPORTED PLIB_CTR_SpareValueGet(CTR_MODULE_ID index)
{
return (uint32_t)0;
}
PLIB_INLINE_API void _PLIB_UNSUPPORTED PLIB_CTR_SpareValueSet(CTR_MODULE_ID index, uint32_t spareVal)
{
}
PLIB_INLINE_API bool PLIB_CTR_ExistsTestBusSelect(CTR_MODULE_ID index)
{
return (bool)0;
}
PLIB_INLINE_API void _PLIB_UNSUPPORTED PLIB_CTR_TestBusSelect(CTR_MODULE_ID index, CTR_TEST_BUS_SELECT testBusVal)
{
}
PLIB_INLINE_API uint32_t _PLIB_UNSUPPORTED PLIB_CTR_TestBusGet(CTR_MODULE_ID index)
{
return (uint32_t)0;
}
PLIB_INLINE_API bool PLIB_CTR_ExistsRevision(CTR_MODULE_ID index)
{
return (bool)0;
}
PLIB_INLINE_API uint32_t _PLIB_UNSUPPORTED PLIB_CTR_BlockRevisionGet(CTR_MODULE_ID index)
{
return (uint32_t)0;
}
#endif
| [
"[email protected]"
] | |
b80a11a7dfac69f1e396295c957e68328090e4ec | 73b5d880fa06943c20ff0a9aee9d0c1d1eeebe10 | /tinyos-1.x/contrib/boomerang/tinyos-1.x/tos/platform/msp430/MSP430GeneralIO.h | 3b869632a408bd5595c00188022089e7c6083985 | [
"LicenseRef-scancode-unknown-license-reference",
"Intel"
] | permissive | x3ro/tinyos-legacy | 101d19f9e639f5a9d59d3edd4ed04b1f53221e63 | cdc0e7ba1cac505fcace33b974b2e0aca1ccc56a | refs/heads/master | 2021-01-16T19:20:21.744228 | 2015-06-30T20:23:05 | 2015-06-30T20:23:05 | 38,358,728 | 0 | 1 | null | null | null | null | UTF-8 | C | false | false | 2,705 | h | // $Id: MSP430GeneralIO.h,v 1.1.1.1 2007/11/05 19:10:15 jpolastre Exp $
/* "Copyright (c) 2000-2003 The Regents of the University of California.
* All rights reserved.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose, without fee, and without written agreement
* is hereby granted, provided that the above copyright notice, the following
* two paragraphs and the author appear in all copies of this software.
*
* IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
* OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY
* OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
* ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
*/
// @author Cory Sharp <[email protected]>
#ifndef _H_MSP430GeneralIO_h
#define _H_MSP430GeneralIO_h
TOSH_ASSIGN_PIN(PORT10,1,0);
TOSH_ASSIGN_PIN(PORT11,1,1);
TOSH_ASSIGN_PIN(PORT12,1,2);
TOSH_ASSIGN_PIN(PORT13,1,3);
TOSH_ASSIGN_PIN(PORT14,1,4);
TOSH_ASSIGN_PIN(PORT15,1,5);
TOSH_ASSIGN_PIN(PORT16,1,6);
TOSH_ASSIGN_PIN(PORT17,1,7);
TOSH_ASSIGN_PIN(PORT20,2,0);
TOSH_ASSIGN_PIN(PORT21,2,1);
TOSH_ASSIGN_PIN(PORT22,2,2);
TOSH_ASSIGN_PIN(PORT23,2,3);
TOSH_ASSIGN_PIN(PORT24,2,4);
TOSH_ASSIGN_PIN(PORT25,2,5);
TOSH_ASSIGN_PIN(PORT26,2,6);
TOSH_ASSIGN_PIN(PORT27,2,7);
TOSH_ASSIGN_PIN(PORT30,3,0);
TOSH_ASSIGN_PIN(PORT31,3,1);
TOSH_ASSIGN_PIN(PORT32,3,2);
TOSH_ASSIGN_PIN(PORT33,3,3);
TOSH_ASSIGN_PIN(PORT34,3,4);
TOSH_ASSIGN_PIN(PORT35,3,5);
TOSH_ASSIGN_PIN(PORT36,3,6);
TOSH_ASSIGN_PIN(PORT37,3,7);
TOSH_ASSIGN_PIN(PORT40,4,0);
TOSH_ASSIGN_PIN(PORT41,4,1);
TOSH_ASSIGN_PIN(PORT42,4,2);
TOSH_ASSIGN_PIN(PORT43,4,3);
TOSH_ASSIGN_PIN(PORT44,4,4);
TOSH_ASSIGN_PIN(PORT45,4,5);
TOSH_ASSIGN_PIN(PORT46,4,6);
TOSH_ASSIGN_PIN(PORT47,4,7);
TOSH_ASSIGN_PIN(PORT50,5,0);
TOSH_ASSIGN_PIN(PORT51,5,1);
TOSH_ASSIGN_PIN(PORT52,5,2);
TOSH_ASSIGN_PIN(PORT53,5,3);
TOSH_ASSIGN_PIN(PORT54,5,4);
TOSH_ASSIGN_PIN(PORT55,5,5);
TOSH_ASSIGN_PIN(PORT56,5,6);
TOSH_ASSIGN_PIN(PORT57,5,7);
TOSH_ASSIGN_PIN(PORT60,6,0);
TOSH_ASSIGN_PIN(PORT61,6,1);
TOSH_ASSIGN_PIN(PORT62,6,2);
TOSH_ASSIGN_PIN(PORT63,6,3);
TOSH_ASSIGN_PIN(PORT64,6,4);
TOSH_ASSIGN_PIN(PORT65,6,5);
TOSH_ASSIGN_PIN(PORT66,6,6);
TOSH_ASSIGN_PIN(PORT67,6,7);
#endif//_H_MSP430GeneralIO_h
| [
"[email protected]"
] | |
52748c0f88557a1a4c2b7025d78e0770f7fe3f67 | ac8e27210d8ae1c79e7d0d9db1bcf4e31c737718 | /tools/flang/runtime/flang/chnbcst_loop.c | 9e96d53743f175dadf8f4516cdbf691e967c19b4 | [
"Apache-2.0",
"NCSA",
"LLVM-exception"
] | permissive | steleman/flang9 | d583d619bfb67d27a995274e30c8c1a642696ec1 | 4ad7c213b30422e1e0fcb3ac826640d576977d04 | refs/heads/master | 2020-11-27T09:50:18.644313 | 2020-03-07T14:37:32 | 2020-03-07T14:37:32 | 229,387,867 | 0 | 0 | Apache-2.0 | 2019-12-21T06:35:35 | 2019-12-21T06:35:34 | null | UTF-8 | C | false | false | 1,359 | c | /*
* Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#include "stdioInterf.h"
#include "fioMacros.h"
extern struct cgrp *__fort_genlist();
extern struct chdr *__fort_allchn();
/* compute the recv/send order for a binary broadcast */
void __fort_bcstchn(struct chdr *c,
int scpu, /* sending cpu */
int ncpus,/* number of receiving cpus */
int *cpus)
{
int lcpu;
int n;
char buf[80];
lcpu = __fort_myprocnum();
if (lcpu != scpu) {
c->cp[c->cn].op = CPU_RECV;
c->cp[c->cn].cpu = scpu;
c->cp[c->cn].rp = &(c->rp[0]);
c->cn++;
return;
}
for (n = 0; n < ncpus; n++) {
c->cp[c->cn].op = CPU_SEND;
c->cp[c->cn].cpu = cpus[n];
c->cp[c->cn].sp = &(c->sp[0]);
c->cn++;
}
}
| [
"[email protected]"
] | |
b57c239870a89cb230e757f8c2025f3b39d6694a | f38fae60454ccd8d6e1a205b7a411d1d4c369da6 | /lib/my/is_alphanumeric.c | f7514c7744a780281c6c074f0d90503df5f85c14 | [] | no_license | labrillance/minishell1 | 40ac085ab041e9b89f6f4dc582341858ca018b57 | bb91cddc4380c36c85e403dd7240c764d14a7613 | refs/heads/master | 2020-12-29T07:54:54.672887 | 2020-03-07T18:59:17 | 2020-03-07T18:59:17 | 238,523,682 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 348 | c | /*
** EPITECH PROJECT, 2019
** PSU_minishell1_2019
** File description:
** is_alphanumeric.c
*/
int is_alphanumeric(char *str)
{
int i = 0;
while (str[i] != 0) {
if (str[i] < '0' || (str[i] > '9' && str[i] < 41) ||
(str[i] > 90 && str[i] < 61) || str[i] > 122)
return 84;
i++;
}
return 0;
} | [
"[email protected]"
] | |
8610daea84ff868911d6d8140ee296962cc10315 | 6c961a54d8d5906a7a7e9b1cf7b485aea667d012 | /09_I18nL10n/binaryguess.c | 08bf56a4ff2bbdf1279464c42756370b19763a5b | [] | no_license | kod4ma/2020-Linux-Development | 7a83366de335162fee0d5bd198efdd5170e255cb | 3fac37938ebd79f2e951ae9ce9753af007d1e531 | refs/heads/master | 2023-02-19T06:58:11.569165 | 2021-01-09T04:34:51 | 2021-01-09T04:34:51 | 305,843,925 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 598 | c | #include <stdio.h>
#include <libintl.h>
#include <locale.h>
#define _(STRING) gettext(STRING)
int main() {
int l = 1, r = 100;
char answer;
setlocale (LC_ALL, "");
bindtextdomain ("binaryguess", ".");
textdomain ("binaryguess");
printf(_("a number between 1 and 100 should be chosen\n"));
while(l<r) {
printf(_("is the number greater than %d? "), (l+r)/2);
scanf("%c", &answer);
if(answer == 'y')
l = (l+r)/2+1;
else if(answer == 'n')
r = (l+r)/2;
}
printf(_("the number is %d?\n"), r);
return 0;
}
| [
"kod4ma"
] | kod4ma |
8a47dd8d77664ee916647779d0a387a9879e717c | 60f5b2e7916bfb2686f5e0da2a5d9031a097ce05 | /iot_link/os/novaos/utils/src/bug.c | 80dcc4485f9b30001f2fc94d27633ee95a3ac90d | [
"BSD-3-Clause"
] | permissive | SuYai/LiteOS_Lab | 65f1a73026331f2a78567f07955e43ee82df265f | 3c9a579cd17d730e21814efc15076351a365e5f8 | refs/heads/iot_link | 2020-11-28T18:39:02.989946 | 2020-03-02T02:09:51 | 2020-03-02T02:09:51 | 229,894,455 | 1 | 0 | BSD-3-Clause | 2020-03-05T07:49:17 | 2019-12-24T07:32:24 | C | UTF-8 | C | false | false | 1,027 | c | /*
* Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved.
*
* LiteOS NOVA is licensed under the Mulan PSL v1.
* You can use this software according to the terms and conditions of the Mulan PSL v1.
* You may obtain a copy of Mulan PSL v1 at:
*
* http://license.coscl.org.cn/MulanPSL
*
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR
* FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PSL v1 for more details.
*/
#include <kconfig.h>
#include <irq.h>
#ifdef CONFIG_KPRINTF
#include <kprintf.h>
#endif
#include <arch/trace.h>
volatile int __bug_dummy_check = 0;
void __bug (const char * info)
{
(void) int_lock ();
#ifdef CONFIG_KPRINTF
/* if __bug beening invoked directly */
if (info [0] != '\0')
{
kprintf ("BUG, \"%s\"\n", info);
}
#endif
call_trace ();
while (__bug_dummy_check == 0)
{
}
}
| [
"[email protected]"
] | |
fef34d97cb6110c1f5d44a943b5779402577d1e4 | e41cb5b5e18429b876ac1cf99eab10d70dbc7813 | /lib/libftprintf/src/ft_strdel.c | 8d22e96809c31c6327065b5f89cf9d5dc778984c | [] | no_license | hdanylevych/lem_in | 1da31e5ca82bfd644a18732b0538ede5724622df | 92bbf5d160697664cd1d4ad565d5d433c23caccb | refs/heads/master | 2021-10-02T20:49:11.226292 | 2018-11-30T18:36:55 | 2018-11-30T18:36:55 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,004 | c | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strdel.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: hdanylev <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/10/30 11:05:57 by hdanylev #+# #+# */
/* Updated: 2017/11/01 13:28:37 by hdanylev ### ########.fr */
/* */
/* ************************************************************************** */
#include "../inc/printf.h"
void ft_strdel(char **str)
{
if (str != NULL)
{
free(*str);
*str = NULL;
}
}
| [
"[email protected]"
] | |
8b8ac235381ad0810023473759ba38b623f0aee9 | 519de3b9fca2d6f905e7f3498884094546432c30 | /kk-4.x/external/dropbear/libtomcrypt/src/ciphers/safer/safer.c | f6c0c2a6ce48449e258dd727d928c18648a34208 | [
"LicenseRef-scancode-public-domain",
"SSH-short",
"BSD-3-Clause",
"MIT"
] | permissive | hongshui3000/mt5507_android_4.4 | 2324e078190b97afbc7ceca22ec1b87b9367f52a | 880d4424989cf91f690ca187d6f0343df047da4f | refs/heads/master | 2020-03-24T10:34:21.213134 | 2016-02-24T05:57:53 | 2016-02-24T05:57:53 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 15,903 | c | /* LibTomCrypt, modular cryptographic library -- Tom St Denis
*
* LibTomCrypt is a library that provides various cryptographic
* algorithms in a highly modular and flexible manner.
*
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, [email protected], http://libtomcrypt.com
*/
/*******************************************************************************
*
* FILE: safer.c
*
* DESCRIPTION: block-cipher algorithm SAFER (Secure And Fast Encryption
* Routine) in its four versions: SAFER K-64, SAFER K-128,
* SAFER SK-64 and SAFER SK-128.
*
* AUTHOR: Richard De Moliner ([email protected])
* Signal and Information Processing Laboratory
* Swiss Federal Institute of Technology
* CH-8092 Zuerich, Switzerland
*
* DATE: September 9, 1995
*
* CHANGE HISTORY:
*
*******************************************************************************/
#include <tomcrypt.h>
#ifdef SAFER
const struct ltc_cipher_descriptor
safer_k64_desc = {
"safer-k64",
8, 8, 8, 8, SAFER_K64_DEFAULT_NOF_ROUNDS,
&safer_k64_setup,
&safer_ecb_encrypt,
&safer_ecb_decrypt,
&safer_k64_test,
&safer_done,
&safer_64_keysize,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
},
safer_sk64_desc = {
"safer-sk64",
9, 8, 8, 8, SAFER_SK64_DEFAULT_NOF_ROUNDS,
&safer_sk64_setup,
&safer_ecb_encrypt,
&safer_ecb_decrypt,
&safer_sk64_test,
&safer_done,
&safer_64_keysize,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
},
safer_k128_desc = {
"safer-k128",
10, 16, 16, 8, SAFER_K128_DEFAULT_NOF_ROUNDS,
&safer_k128_setup,
&safer_ecb_encrypt,
&safer_ecb_decrypt,
&safer_sk128_test,
&safer_done,
&safer_128_keysize,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
},
safer_sk128_desc = {
"safer-sk128",
11, 16, 16, 8, SAFER_SK128_DEFAULT_NOF_ROUNDS,
&safer_sk128_setup,
&safer_ecb_encrypt,
&safer_ecb_decrypt,
&safer_sk128_test,
&safer_done,
&safer_128_keysize,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
};
/******************* Constants ************************************************/
/* #define TAB_LEN 256 */
/******************* Assertions ***********************************************/
/******************* Macros ***************************************************/
#define ROL8(x, n) ((unsigned char)((unsigned int)(x) << (n)\
|(unsigned int)((x) & 0xFF) >> (8 - (n))))
#define EXP(x) safer_ebox[(x) & 0xFF]
#define LOG(x) safer_lbox[(x) & 0xFF]
#define PHT(x, y) { y += x; x += y; }
#define IPHT(x, y) { x -= y; y -= x; }
/******************* Types ****************************************************/
extern const unsigned char safer_ebox[], safer_lbox[];
#ifdef LTC_CLEAN_STACK
static void _Safer_Expand_Userkey(const unsigned char *userkey_1,
const unsigned char *userkey_2,
unsigned int nof_rounds,
int strengthened,
safer_key_t key)
#else
static void Safer_Expand_Userkey(const unsigned char *userkey_1,
const unsigned char *userkey_2,
unsigned int nof_rounds,
int strengthened,
safer_key_t key)
#endif
{ unsigned int i, j, k;
unsigned char ka[SAFER_BLOCK_LEN + 1];
unsigned char kb[SAFER_BLOCK_LEN + 1];
if (SAFER_MAX_NOF_ROUNDS < nof_rounds)
nof_rounds = SAFER_MAX_NOF_ROUNDS;
*key++ = (unsigned char)nof_rounds;
ka[SAFER_BLOCK_LEN] = (unsigned char)0;
kb[SAFER_BLOCK_LEN] = (unsigned char)0;
k = 0;
for (j = 0; j < SAFER_BLOCK_LEN; j++) {
ka[j] = ROL8(userkey_1[j], 5);
ka[SAFER_BLOCK_LEN] ^= ka[j];
kb[j] = *key++ = userkey_2[j];
kb[SAFER_BLOCK_LEN] ^= kb[j];
}
for (i = 1; i <= nof_rounds; i++) {
for (j = 0; j < SAFER_BLOCK_LEN + 1; j++) {
ka[j] = ROL8(ka[j], 6);
kb[j] = ROL8(kb[j], 6);
}
if (strengthened) {
k = 2 * i - 1;
while (k >= (SAFER_BLOCK_LEN + 1)) { k -= SAFER_BLOCK_LEN + 1; }
}
for (j = 0; j < SAFER_BLOCK_LEN; j++) {
if (strengthened) {
*key++ = (ka[k]
+ safer_ebox[(int)safer_ebox[(int)((18 * i + j + 1)&0xFF)]]) & 0xFF;
if (++k == (SAFER_BLOCK_LEN + 1)) { k = 0; }
} else {
*key++ = (ka[j] + safer_ebox[(int)safer_ebox[(int)((18 * i + j + 1)&0xFF)]]) & 0xFF;
}
}
if (strengthened) {
k = 2 * i;
while (k >= (SAFER_BLOCK_LEN + 1)) { k -= SAFER_BLOCK_LEN + 1; }
}
for (j = 0; j < SAFER_BLOCK_LEN; j++) {
if (strengthened) {
*key++ = (kb[k]
+ safer_ebox[(int)safer_ebox[(int)((18 * i + j + 10)&0xFF)]]) & 0xFF;
if (++k == (SAFER_BLOCK_LEN + 1)) { k = 0; }
} else {
*key++ = (kb[j] + safer_ebox[(int)safer_ebox[(int)((18 * i + j + 10)&0xFF)]]) & 0xFF;
}
}
}
#ifdef LTC_CLEAN_STACK
zeromem(ka, sizeof(ka));
zeromem(kb, sizeof(kb));
#endif
}
#ifdef LTC_CLEAN_STACK
static void Safer_Expand_Userkey(const unsigned char *userkey_1,
const unsigned char *userkey_2,
unsigned int nof_rounds,
int strengthened,
safer_key_t key)
{
_Safer_Expand_Userkey(userkey_1, userkey_2, nof_rounds, strengthened, key);
burn_stack(sizeof(unsigned char) * (2 * (SAFER_BLOCK_LEN + 1)) + sizeof(unsigned int)*2);
}
#endif
int safer_k64_setup(const unsigned char *key, int keylen, int numrounds, symmetric_key *skey)
{
LTC_ARGCHK(key != NULL);
LTC_ARGCHK(skey != NULL);
if (numrounds != 0 && (numrounds < 6 || numrounds > SAFER_MAX_NOF_ROUNDS)) {
return CRYPT_INVALID_ROUNDS;
}
if (keylen != 8) {
return CRYPT_INVALID_KEYSIZE;
}
Safer_Expand_Userkey(key, key, (unsigned int)(numrounds != 0 ?numrounds:SAFER_K64_DEFAULT_NOF_ROUNDS), 0, skey->safer.key);
return CRYPT_OK;
}
int safer_sk64_setup(const unsigned char *key, int keylen, int numrounds, symmetric_key *skey)
{
LTC_ARGCHK(key != NULL);
LTC_ARGCHK(skey != NULL);
if (numrounds != 0 && (numrounds < 6 || numrounds > SAFER_MAX_NOF_ROUNDS)) {
return CRYPT_INVALID_ROUNDS;
}
if (keylen != 8) {
return CRYPT_INVALID_KEYSIZE;
}
Safer_Expand_Userkey(key, key, (unsigned int)(numrounds != 0 ?numrounds:SAFER_SK64_DEFAULT_NOF_ROUNDS), 1, skey->safer.key);
return CRYPT_OK;
}
int safer_k128_setup(const unsigned char *key, int keylen, int numrounds, symmetric_key *skey)
{
LTC_ARGCHK(key != NULL);
LTC_ARGCHK(skey != NULL);
if (numrounds != 0 && (numrounds < 6 || numrounds > SAFER_MAX_NOF_ROUNDS)) {
return CRYPT_INVALID_ROUNDS;
}
if (keylen != 16) {
return CRYPT_INVALID_KEYSIZE;
}
Safer_Expand_Userkey(key, key+8, (unsigned int)(numrounds != 0 ?numrounds:SAFER_K128_DEFAULT_NOF_ROUNDS), 0, skey->safer.key);
return CRYPT_OK;
}
int safer_sk128_setup(const unsigned char *key, int keylen, int numrounds, symmetric_key *skey)
{
LTC_ARGCHK(key != NULL);
LTC_ARGCHK(skey != NULL);
if (numrounds != 0 && (numrounds < 6 || numrounds > SAFER_MAX_NOF_ROUNDS)) {
return CRYPT_INVALID_ROUNDS;
}
if (keylen != 16) {
return CRYPT_INVALID_KEYSIZE;
}
Safer_Expand_Userkey(key, key+8, (unsigned int)(numrounds != 0?numrounds:SAFER_SK128_DEFAULT_NOF_ROUNDS), 1, skey->safer.key);
return CRYPT_OK;
}
#ifdef LTC_CLEAN_STACK
static int _safer_ecb_encrypt(const unsigned char *block_in,
unsigned char *block_out,
symmetric_key *skey)
#else
int safer_ecb_encrypt(const unsigned char *block_in,
unsigned char *block_out,
symmetric_key *skey)
#endif
{ unsigned char a, b, c, d, e, f, g, h, t;
unsigned int round;
unsigned char *key;
LTC_ARGCHK(block_in != NULL);
LTC_ARGCHK(block_out != NULL);
LTC_ARGCHK(skey != NULL);
key = skey->safer.key;
a = block_in[0]; b = block_in[1]; c = block_in[2]; d = block_in[3];
e = block_in[4]; f = block_in[5]; g = block_in[6]; h = block_in[7];
if (SAFER_MAX_NOF_ROUNDS < (round = *key)) round = SAFER_MAX_NOF_ROUNDS;
while(round-- > 0)
{
a ^= *++key; b += *++key; c += *++key; d ^= *++key;
e ^= *++key; f += *++key; g += *++key; h ^= *++key;
a = EXP(a) + *++key; b = LOG(b) ^ *++key;
c = LOG(c) ^ *++key; d = EXP(d) + *++key;
e = EXP(e) + *++key; f = LOG(f) ^ *++key;
g = LOG(g) ^ *++key; h = EXP(h) + *++key;
PHT(a, b); PHT(c, d); PHT(e, f); PHT(g, h);
PHT(a, c); PHT(e, g); PHT(b, d); PHT(f, h);
PHT(a, e); PHT(b, f); PHT(c, g); PHT(d, h);
t = b; b = e; e = c; c = t; t = d; d = f; f = g; g = t;
}
a ^= *++key; b += *++key; c += *++key; d ^= *++key;
e ^= *++key; f += *++key; g += *++key; h ^= *++key;
block_out[0] = a & 0xFF; block_out[1] = b & 0xFF;
block_out[2] = c & 0xFF; block_out[3] = d & 0xFF;
block_out[4] = e & 0xFF; block_out[5] = f & 0xFF;
block_out[6] = g & 0xFF; block_out[7] = h & 0xFF;
return CRYPT_OK;
}
#ifdef LTC_CLEAN_STACK
int safer_ecb_encrypt(const unsigned char *block_in,
unsigned char *block_out,
symmetric_key *skey)
{
int err = _safer_ecb_encrypt(block_in, block_out, skey);
burn_stack(sizeof(unsigned char) * 9 + sizeof(unsigned int) + sizeof(unsigned char *));
return err;
}
#endif
#ifdef LTC_CLEAN_STACK
static int _safer_ecb_decrypt(const unsigned char *block_in,
unsigned char *block_out,
symmetric_key *skey)
#else
int safer_ecb_decrypt(const unsigned char *block_in,
unsigned char *block_out,
symmetric_key *skey)
#endif
{ unsigned char a, b, c, d, e, f, g, h, t;
unsigned int round;
unsigned char *key;
LTC_ARGCHK(block_in != NULL);
LTC_ARGCHK(block_out != NULL);
LTC_ARGCHK(skey != NULL);
key = skey->safer.key;
a = block_in[0]; b = block_in[1]; c = block_in[2]; d = block_in[3];
e = block_in[4]; f = block_in[5]; g = block_in[6]; h = block_in[7];
if (SAFER_MAX_NOF_ROUNDS < (round = *key)) round = SAFER_MAX_NOF_ROUNDS;
key += SAFER_BLOCK_LEN * (1 + 2 * round);
h ^= *key; g -= *--key; f -= *--key; e ^= *--key;
d ^= *--key; c -= *--key; b -= *--key; a ^= *--key;
while (round--)
{
t = e; e = b; b = c; c = t; t = f; f = d; d = g; g = t;
IPHT(a, e); IPHT(b, f); IPHT(c, g); IPHT(d, h);
IPHT(a, c); IPHT(e, g); IPHT(b, d); IPHT(f, h);
IPHT(a, b); IPHT(c, d); IPHT(e, f); IPHT(g, h);
h -= *--key; g ^= *--key; f ^= *--key; e -= *--key;
d -= *--key; c ^= *--key; b ^= *--key; a -= *--key;
h = LOG(h) ^ *--key; g = EXP(g) - *--key;
f = EXP(f) - *--key; e = LOG(e) ^ *--key;
d = LOG(d) ^ *--key; c = EXP(c) - *--key;
b = EXP(b) - *--key; a = LOG(a) ^ *--key;
}
block_out[0] = a & 0xFF; block_out[1] = b & 0xFF;
block_out[2] = c & 0xFF; block_out[3] = d & 0xFF;
block_out[4] = e & 0xFF; block_out[5] = f & 0xFF;
block_out[6] = g & 0xFF; block_out[7] = h & 0xFF;
return CRYPT_OK;
}
#ifdef LTC_CLEAN_STACK
int safer_ecb_decrypt(const unsigned char *block_in,
unsigned char *block_out,
symmetric_key *skey)
{
int err = _safer_ecb_decrypt(block_in, block_out, skey);
burn_stack(sizeof(unsigned char) * 9 + sizeof(unsigned int) + sizeof(unsigned char *));
return err;
}
#endif
int safer_64_keysize(int *keysize)
{
LTC_ARGCHK(keysize != NULL);
if (*keysize < 8) {
return CRYPT_INVALID_KEYSIZE;
} else {
*keysize = 8;
return CRYPT_OK;
}
}
int safer_128_keysize(int *keysize)
{
LTC_ARGCHK(keysize != NULL);
if (*keysize < 16) {
return CRYPT_INVALID_KEYSIZE;
} else {
*keysize = 16;
return CRYPT_OK;
}
}
int safer_k64_test(void)
{
#ifndef LTC_TEST
return CRYPT_NOP;
#else
static const unsigned char k64_pt[] = { 1, 2, 3, 4, 5, 6, 7, 8 },
k64_key[] = { 8, 7, 6, 5, 4, 3, 2, 1 },
k64_ct[] = { 200, 242, 156, 221, 135, 120, 62, 217 };
symmetric_key skey;
unsigned char buf[2][8];
int err;
/* test K64 */
if ((err = safer_k64_setup(k64_key, 8, 6, &skey)) != CRYPT_OK) {
return err;
}
safer_ecb_encrypt(k64_pt, buf[0], &skey);
safer_ecb_decrypt(buf[0], buf[1], &skey);
if (XMEMCMP(buf[0], k64_ct, 8) != 0 || XMEMCMP(buf[1], k64_pt, 8) != 0) {
return CRYPT_FAIL_TESTVECTOR;
}
return CRYPT_OK;
#endif
}
int safer_sk64_test(void)
{
#ifndef LTC_TEST
return CRYPT_NOP;
#else
static const unsigned char sk64_pt[] = { 1, 2, 3, 4, 5, 6, 7, 8 },
sk64_key[] = { 1, 2, 3, 4, 5, 6, 7, 8 },
sk64_ct[] = { 95, 206, 155, 162, 5, 132, 56, 199 };
symmetric_key skey;
unsigned char buf[2][8];
int err, y;
/* test SK64 */
if ((err = safer_sk64_setup(sk64_key, 8, 6, &skey)) != CRYPT_OK) {
return err;
}
safer_ecb_encrypt(sk64_pt, buf[0], &skey);
safer_ecb_decrypt(buf[0], buf[1], &skey);
if (XMEMCMP(buf[0], sk64_ct, 8) != 0 || XMEMCMP(buf[1], sk64_pt, 8) != 0) {
return CRYPT_FAIL_TESTVECTOR;
}
/* now see if we can encrypt all zero bytes 1000 times, decrypt and come back where we started */
for (y = 0; y < 8; y++) buf[0][y] = 0;
for (y = 0; y < 1000; y++) safer_ecb_encrypt(buf[0], buf[0], &skey);
for (y = 0; y < 1000; y++) safer_ecb_decrypt(buf[0], buf[0], &skey);
for (y = 0; y < 8; y++) if (buf[0][y] != 0) return CRYPT_FAIL_TESTVECTOR;
return CRYPT_OK;
#endif
}
/** Terminate the context
@param skey The scheduled key
*/
void safer_done(symmetric_key *skey)
{
}
int safer_sk128_test(void)
{
#ifndef LTC_TEST
return CRYPT_NOP;
#else
static const unsigned char sk128_pt[] = { 1, 2, 3, 4, 5, 6, 7, 8 },
sk128_key[] = { 1, 2, 3, 4, 5, 6, 7, 8,
0, 0, 0, 0, 0, 0, 0, 0 },
sk128_ct[] = { 255, 120, 17, 228, 179, 167, 46, 113 };
symmetric_key skey;
unsigned char buf[2][8];
int err, y;
/* test SK128 */
if ((err = safer_sk128_setup(sk128_key, 16, 0, &skey)) != CRYPT_OK) {
return err;
}
safer_ecb_encrypt(sk128_pt, buf[0], &skey);
safer_ecb_decrypt(buf[0], buf[1], &skey);
if (XMEMCMP(buf[0], sk128_ct, 8) != 0 || XMEMCMP(buf[1], sk128_pt, 8) != 0) {
return CRYPT_FAIL_TESTVECTOR;
}
/* now see if we can encrypt all zero bytes 1000 times, decrypt and come back where we started */
for (y = 0; y < 8; y++) buf[0][y] = 0;
for (y = 0; y < 1000; y++) safer_ecb_encrypt(buf[0], buf[0], &skey);
for (y = 0; y < 1000; y++) safer_ecb_decrypt(buf[0], buf[0], &skey);
for (y = 0; y < 8; y++) if (buf[0][y] != 0) return CRYPT_FAIL_TESTVECTOR;
return CRYPT_OK;
#endif
}
#endif
/* $Source: /cvs/libtom/libtomcrypt/src/ciphers/safer/safer.c,v $ */
/* $Revision: #1 $ */
/* $Date: 2014/10/13 $ */
| [
"[email protected]"
] | |
e4000075fcbfb53ba3ff95147b83a5a6213ce97c | 768cea4721ebe4439ce7af0a372726b703d484bd | /levels/bbh/areas/1/room.inc.c | 985c6ed359a8e79a10824a75f3c2aff39a5f76f7 | [] | no_license | mountainflaw/sm64_60 | 08355027afd3a01ebabc246bac674dc666f17a15 | 831e0c420189e84a9369889b7f7cd9d276f38e2b | refs/heads/master | 2020-08-28T18:40:44.871138 | 2019-10-27T00:55:47 | 2019-10-27T00:55:47 | 217,787,985 | 5 | 1 | null | null | null | null | UTF-8 | C | false | false | 12,956 | c | // 0x0702605C - 0x070268C2
const u8 bbh_seg7_rooms[] = {
13, 13, 13, 13, 13, 13, 13, 13, // 0-7
13, 13, 13, 13, 13, 13, 13, 13, // 8-15
13, 13, 29, 29, 13, 13, 13, 13, // 16-23
13, 13, 13, 13, 13, 13, 13, 13, // 24-31
13, 13, 13, 13, 13, 13, 13, 13, // 32-39
13, 13, 13, 13, 13, 13, 13, 13, // 40-47
13, 13, 13, 13, 13, 13, 13, 13, // 48-55
13, 13, 13, 13, 13, 13, 13, 13, // 56-63
13, 13, 13, 29, 29, 13, 13, 13, // 64-71
13, 13, 13, 13, 28, 13, 13, 13, // 72-79
13, 28, 13, 13, 13, 13, 13, 13, // 80-87
13, 13, 32, 13, 32, 13, 13, 13, // 88-95
13, 13, 13, 13, 13, 13, 13, 13, // 96-103
13, 13, 13, 13, 13, 13, 13, 13, // 104-111
13, 13, 13, 13, 13, 13, 13, 13, // 112-119
13, 13, 13, 13, 13, 13, 13, 13, // 120-127
13, 13, 13, 13, 13, 13, 13, 13, // 128-135
13, 13, 13, 13, 13, 13, 13, 13, // 136-143
13, 13, 13, 13, 13, 13, 13, 13, // 144-151
13, 9, 13, 13, 13, 13, 13, 13, // 152-159
13, 9, 13, 9, 9, 13, 13, 29, // 160-167
29, 9, 13, 13, 13, 13, 13, 13, // 168-175
13, 13, 13, 13, 13, 13, 13, 13, // 176-183
13, 13, 13, 13, 13, 13, 13, 13, // 184-191
13, 13, 13, 13, 13, 13, 13, 13, // 192-199
13, 13, 1, 1, 13, 13, 5, 1, // 200-207
1, 13, 13, 13, 13, 1, 1, 13, // 208-215
13, 5, 13, 13, 5, 5, 13, 13, // 216-223
5, 13, 5, 28, 28, 13, 13, 13, // 224-231
13, 13, 13, 13, 13, 13, 13, 13, // 232-239
13, 13, 32, 32, 32, 12, 32, 13, // 240-247
13, 13, 13, 12, 12, 13, 12, 12, // 248-255
12, 12, 12, 12, 12, 12, 12, 12, // 256-263
12, 11, 11, 11, 12, 12, 12, 12, // 264-271
12, 12, 12, 11, 11, 12, 12, 12, // 272-279
12, 12, 11, 12, 12, 12, 12, 12, // 280-287
12, 12, 12, 12, 12, 12, 12, 12, // 288-295
12, 12, 12, 12, 12, 12, 12, 12, // 296-303
12, 12, 12, 12, 12, 12, 12, 12, // 304-311
12, 12, 32, 32, 12, 12, 12, 12, // 312-319
12, 12, 12, 12, 12, 12, 11, 11, // 320-327
11, 11, 11, 11, 11, 11, 11, 11, // 328-335
11, 11, 11, 11, 11, 11, 11, 11, // 336-343
11, 10, 11, 11, 10, 10, 11, 11, // 344-351
11, 10, 10, 10, 11, 11, 11, 10, // 352-359
11, 11, 11, 11, 11, 10, 10, 10, // 360-367
10, 10, 10, 10, 10, 10, 10, 10, // 368-375
10, 10, 10, 10, 10, 10, 10, 10, // 376-383
10, 10, 10, 10, 10, 10, 10, 10, // 384-391
10, 10, 10, 10, 10, 10, 10, 10, // 392-399
10, 10, 10, 10, 10, 10, 10, 10, // 400-407
10, 10, 10, 10, 10, 10, 10, 10, // 408-415
10, 10, 10, 10, 10, 10, 10, 10, // 416-423
10, 10, 10, 10, 10, 10, 10, 10, // 424-431
10, 10, 10, 10, 10, 10, 10, 10, // 432-439
10, 10, 10, 10, 10, 10, 10, 10, // 440-447
10, 10, 10, 10, 10, 10, 10, 10, // 448-455
10, 10, 10, 10, 10, 10, 10, 10, // 456-463
10, 10, 10, 10, 10, 10, 10, 10, // 464-471
10, 10, 10, 10, 10, 10, 10, 10, // 472-479
10, 10, 10, 10, 10, 10, 10, 10, // 480-487
10, 10, 10, 10, 10, 10, 10, 10, // 488-495
10, 10, 10, 10, 10, 10, 10, 10, // 496-503
10, 10, 10, 10, 10, 10, 10, 10, // 504-511
9, 9, 9, 9, 9, 9, 9, 9, // 512-519
9, 9, 9, 9, 9, 9, 9, 9, // 520-527
9, 9, 9, 9, 9, 9, 9, 9, // 528-535
9, 9, 9, 9, 9, 29, 29, 9, // 536-543
9, 9, 9, 9, 9, 9, 2, 2, // 544-551
2, 9, 9, 9, 23, 9, 9, 9, // 552-559
9, 9, 2, 23, 2, 2, 9, 9, // 560-567
9, 9, 9, 9, 9, 9, 9, 9, // 568-575
9, 9, 9, 9, 9, 9, 9, 9, // 576-583
9, 9, 9, 9, 9, 9, 9, 9, // 584-591
9, 9, 9, 9, 9, 9, 9, 9, // 592-599
9, 9, 9, 9, 9, 9, 9, 9, // 600-607
9, 9, 9, 9, 9, 9, 9, 9, // 608-615
9, 8, 9, 9, 9, 9, 9, 9, // 616-623
9, 9, 9, 9, 8, 8, 8, 8, // 624-631
8, 8, 8, 8, 8, 8, 8, 8, // 632-639
8, 8, 8, 8, 8, 8, 8, 8, // 640-647
8, 8, 8, 8, 8, 8, 8, 8, // 648-655
8, 8, 8, 8, 8, 8, 8, 8, // 656-663
8, 8, 8, 8, 8, 8, 8, 8, // 664-671
8, 8, 8, 8, 8, 8, 8, 8, // 672-679
8, 8, 8, 8, 8, 8, 8, 8, // 680-687
1, 1, 8, 8, 1, 1, 8, 8, // 688-695
1, 1, 8, 8, 1, 1, 20, 1, // 696-703
8, 8, 8, 1, 1, 8, 8, 8, // 704-711
8, 8, 8, 8, 8, 8, 8, 8, // 712-719
8, 8, 8, 8, 8, 8, 8, 8, // 720-727
8, 8, 8, 7, 7, 7, 7, 7, // 728-735
7, 7, 7, 7, 7, 7, 7, 7, // 736-743
7, 7, 7, 7, 7, 7, 7, 7, // 744-751
7, 7, 7, 7, 7, 7, 7, 7, // 752-759
7, 7, 7, 7, 7, 7, 7, 7, // 760-767
7, 7, 7, 7, 7, 7, 7, 7, // 768-775
7, 7, 7, 7, 7, 7, 7, 7, // 776-783
7, 7, 7, 7, 7, 7, 7, 7, // 784-791
7, 7, 7, 7, 7, 7, 7, 7, // 792-799
7, 7, 7, 7, 7, 7, 7, 7, // 800-807
7, 7, 1, 1, 7, 7, 7, 1, // 808-815
1, 1, 1, 19, 7, 6, 7, 7, // 816-823
7, 7, 7, 7, 7, 6, 6, 6, // 824-831
6, 6, 6, 6, 6, 6, 6, 6, // 832-839
26, 26, 6, 6, 6, 6, 18, 6, // 840-847
6, 6, 6, 6, 18, 6, 6, 6, // 848-855
6, 6, 6, 6, 6, 6, 6, 6, // 856-863
6, 6, 6, 6, 6, 6, 6, 6, // 864-871
6, 6, 6, 6, 6, 6, 6, 6, // 872-879
6, 6, 6, 26, 6, 6, 6, 26, // 880-887
26, 26, 6, 3, 3, 6, 6, 6, // 888-895
6, 3, 3, 3, 3, 6, 1, 6, // 896-903
6, 18, 18, 1, 18, 18, 6, 6, // 904-911
1, 1, 6, 6, 1, 1, 5, 5, // 912-919
5, 5, 5, 5, 5, 5, 5, 5, // 920-927
5, 5, 5, 5, 5, 5, 5, 5, // 928-935
5, 5, 5, 5, 5, 5, 5, 5, // 936-943
5, 5, 5, 5, 5, 5, 5, 5, // 944-951
5, 5, 5, 5, 5, 5, 5, 5, // 952-959
5, 5, 5, 5, 5, 5, 5, 5, // 960-967
5, 5, 5, 5, 5, 5, 5, 5, // 968-975
5, 5, 5, 5, 5, 5, 5, 5, // 976-983
5, 5, 5, 5, 5, 5, 5, 5, // 984-991
5, 5, 5, 5, 5, 5, 5, 5, // 992-999
5, 5, 5, 5, 5, 5, 5, 5, // 1000-1007
5, 5, 5, 5, 5, 5, 1, 5, // 1008-1015
5, 5, 5, 5, 5, 5, 5, 5, // 1016-1023
1, 5, 5, 1, 1, 5, 3, 3, // 1024-1031
5, 5, 3, 3, 25, 3, 5, 5, // 1032-1039
5, 5, 1, 1, 5, 5, 4, 4, // 1040-1047
4, 4, 4, 4, 4, 4, 4, 4, // 1048-1055
4, 4, 4, 4, 4, 4, 4, 4, // 1056-1063
4, 4, 4, 4, 4, 4, 4, 4, // 1064-1071
4, 4, 4, 4, 4, 4, 4, 4, // 1072-1079
4, 4, 4, 4, 4, 4, 4, 4, // 1080-1087
4, 4, 4, 4, 4, 4, 4, 4, // 1088-1095
4, 4, 4, 4, 4, 4, 4, 4, // 1096-1103
4, 4, 4, 4, 4, 4, 4, 4, // 1104-1111
4, 4, 4, 4, 4, 4, 4, 4, // 1112-1119
4, 4, 4, 4, 4, 4, 4, 4, // 1120-1127
4, 4, 4, 4, 4, 4, 4, 4, // 1128-1135
4, 4, 4, 4, 4, 4, 4, 4, // 1136-1143
4, 4, 4, 4, 4, 4, 4, 4, // 1144-1151
4, 4, 4, 4, 4, 4, 4, 4, // 1152-1159
4, 4, 4, 4, 4, 4, 4, 4, // 1160-1167
4, 4, 4, 4, 4, 4, 4, 1, // 1168-1175
1, 4, 4, 1, 1, 4, 4, 1, // 1176-1183
1, 4, 4, 2, 4, 4, 2, 2, // 1184-1191
4, 4, 2, 2, 4, 4, 4, 4, // 1192-1199
4, 4, 4, 4, 4, 4, 4, 4, // 1200-1207
4, 4, 4, 3, 4, 4, 4, 4, // 1208-1215
4, 4, 3, 3, 3, 3, 3, 3, // 1216-1223
3, 3, 3, 3, 3, 3, 3, 3, // 1224-1231
26, 26, 3, 3, 3, 3, 3, 3, // 1232-1239
15, 15, 3, 3, 3, 3, 3, 3, // 1240-1247
3, 15, 3, 3, 3, 3, 3, 15, // 1248-1255
3, 3, 3, 3, 3, 3, 3, 3, // 1256-1263
3, 3, 25, 25, 3, 3, 3, 3, // 1264-1271
3, 3, 3, 3, 3, 3, 3, 3, // 1272-1279
3, 3, 3, 3, 3, 3, 3, 3, // 1280-1287
3, 3, 3, 3, 3, 3, 3, 3, // 1288-1295
3, 3, 3, 3, 3, 3, 3, 3, // 1296-1303
3, 3, 3, 3, 3, 3, 3, 3, // 1304-1311
3, 3, 3, 3, 3, 3, 3, 3, // 1312-1319
25, 3, 1, 1, 1, 3, 3, 1, // 1320-1327
1, 3, 3, 15, 15, 15, 1, 15, // 1328-1335
15, 3, 1, 1, 3, 3, 15, 3, // 1336-1343
3, 1, 1, 2, 1, 3, 1, 2, // 1344-1351
2, 2, 2, 2, 2, 2, 2, 2, // 1352-1359
2, 2, 2, 2, 2, 2, 2, 2, // 1360-1367
2, 2, 2, 2, 2, 2, 2, 2, // 1368-1375
23, 23, 2, 2, 2, 2, 14, 2, // 1376-1383
2, 2, 2, 14, 14, 14, 2, 2, // 1384-1391
2, 2, 2, 2, 2, 2, 2, 2, // 1392-1399
2, 2, 2, 2, 2, 2, 2, 2, // 1400-1407
2, 2, 2, 2, 2, 2, 2, 2, // 1408-1415
2, 2, 2, 2, 2, 2, 2, 2, // 1416-1423
2, 2, 2, 2, 2, 2, 2, 2, // 1424-1431
2, 2, 2, 2, 2, 2, 2, 2, // 1432-1439
2, 2, 2, 2, 2, 2, 2, 2, // 1440-1447
2, 2, 2, 2, 2, 2, 2, 2, // 1448-1455
2, 2, 2, 2, 2, 2, 2, 2, // 1456-1463
2, 2, 2, 2, 2, 2, 2, 2, // 1464-1471
2, 2, 2, 2, 2, 2, 2, 1, // 1472-1479
2, 2, 1, 2, 1, 2, 1, 1, // 1480-1487
2, 2, 1, 2, 2, 2, 2, 2, // 1488-1495
2, 2, 2, 2, 2, 2, 2, 2, // 1496-1503
2, 14, 1, 14, 14, 1, 14, 1, // 1504-1511
1, 2, 2, 1, 2, 2, 1, 1, // 1512-1519
2, 2, 1, 1, 14, 2, 2, 1, // 1520-1527
2, 2, 14, 14, 1, 2, 14, 1, // 1528-1535
2, 2, 2, 2, 2, 2, 2, 2, // 1536-1543
2, 2, 2, 1, 2, 1, 1, 1, // 1544-1551
1, 1, 1, 1, 1, 1, 1, 1, // 1552-1559
1, 1, 1, 1, 19, 1, 20, 1, // 1560-1567
1, 1, 1, 1, 1, 1, 1, 1, // 1568-1575
1, 1, 1, 1, 1, 1, 1, 1, // 1576-1583
1, 1, 1, 1, 1, 1, 1, 1, // 1584-1591
1, 1, 1, 1, 1, 1, 1, 1, // 1592-1599
1, 1, 1, 1, 1, 1, 1, 1, // 1600-1607
1, 1, 1, 1, 1, 1, 1, 1, // 1608-1615
1, 1, 1, 1, 1, 1, 1, 1, // 1616-1623
1, 1, 1, 1, 1, 1, 1, 1, // 1624-1631
1, 1, 1, 1, 1, 1, 1, 1, // 1632-1639
1, 1, 1, 1, 1, 1, 1, 1, // 1640-1647
1, 1, 1, 1, 1, 1, 1, 1, // 1648-1655
1, 1, 1, 1, 1, 1, 1, 1, // 1656-1663
1, 1, 1, 1, 1, 1, 1, 1, // 1664-1671
1, 1, 1, 1, 1, 1, 1, 1, // 1672-1679
1, 1, 1, 1, 1, 1, 1, 1, // 1680-1687
1, 1, 1, 15, 15, 1, 1, 1, // 1688-1695
1, 18, 1, 1, 1, 18, 1, 1, // 1696-1703
1, 1, 20, 20, 1, 1, 19, 19, // 1704-1711
1, 14, 14, 1, 1, 1, 1, 1, // 1712-1719
1, 1, 1, 1, 1, 1, 14, 14, // 1720-1727
1, 1, 1, 1, 1, 1, 1, 1, // 1728-1735
1, 1, 1, 1, 1, 1, 1, 1, // 1736-1743
1, 1, 1, 1, 1, 1, 1, 1, // 1744-1751
1, 1, 10, 10, 4, 4, 4, 4, // 1752-1759
4, 4, 27, 27, 2, 2, 2, 2, // 1760-1767
2, 2, 2, 2, 24, 24, 9, 9, // 1768-1775
9, 9, 8, 8, 7, 7, 4, 5, // 1776-1783
5, 5, 5, 4, 4, 4, 4, 4, // 1784-1791
4, 4, 4, 4, 4, 4, 4, 4, // 1792-1799
3, 3, 3, 3, 3, 3, 3, 3, // 1800-1807
3, 3, 3, 3, 2, 2, 1, 1, // 1808-1815
1, 1, 1, 1, 1, 1, 1, 1, // 1816-1823
1, 1, 1, 1, 1, 1, 1, 1, // 1824-1831
10, 10, 10, 10, 10, 10, 13, 13, // 1832-1839
13, 13, 13, 21, 13, 13, 21, 13, // 1840-1847
13, 13, 13, 13, 13, 13, 13, 13, // 1848-1855
13, 13, 13, 13, 13, 13, 13, 13, // 1856-1863
13, 13, 13, 13, 13, 13, 13, 13, // 1864-1871
13, 13, 13, 13, 13, 13, 13, 13, // 1872-1879
13, 13, 13, 13, 13, 13, 21, 21, // 1880-1887
12, 21, 21, 31, 31, 31, 31, 12, // 1888-1895
12, 11, 12, 12, 12, 31, 31, 12, // 1896-1903
12, 12, 11, 11, 30, 30, 30, 11, // 1904-1911
11, 11, 11, 31, 31, 11, 11, 11, // 1912-1919
30, 30, 30, 10, 10, 10, 10, 30, // 1920-1927
30, 10, 10, 10, 10, 10, 10, 10, // 1928-1935
10, 10, 10, 10, 10, 10, 10, 10, // 1936-1943
10, 10, 10, 10, 10, 10, 10, 10, // 1944-1951
10, 10, 10, 10, 10, 10, 10, 10, // 1952-1959
8, 23, 23, 9, 9, 23, 23, 9, // 1960-1967
9, 9, 9, 8, 8, 8, 8, 8, // 1968-1975
8, 20, 20, 8, 8, 8, 8, 8, // 1976-1983
8, 8, 8, 8, 8, 8, 8, 8, // 1984-1991
8, 8, 8, 8, 8, 8, 8, 8, // 1992-1999
8, 8, 8, 8, 20, 20, 8, 8, // 2000-2007
8, 8, 20, 20, 20, 20, 19, 20, // 2008-2015
20, 19, 19, 7, 7, 7, 7, 7, // 2016-2023
7, 19, 5, 5, 25, 5, 5, 5, // 2024-2031
5, 5, 5, 5, 5, 28, 5, 28, // 2032-2039
5, 25, 5, 5, 17, 17, 5, 25, // 2040-2047
5, 17, 17, 17, 17, 25, 4, 28, // 2048-2055
28, 4, 4, 4, 22, 22, 4, 4, // 2056-2063
4, 22, 4, 4, 16, 4, 4, 16, // 2064-2071
4, 4, 4, 22, 22, 22, 16, 16, // 2072-2079
16, 16, 2, 2, 22, 22, 2, 2, // 2080-2087
2, 2, 14, 2, 2, 14, 2, 2, // 2088-2095
2, 2, 2, 2, 15, 2, 2, 14, // 2096-2103
14, 14, 14, 15, 14, 1, 14, 16, // 2104-2111
16, 1, 1, 1, 1, 1, 1, 1, // 2112-2119
1, 20, 20, 1, 1, 1, 1, 17, // 2120-2127
17, 1, 1, 15, 15, 1, 1, 1, // 2128-2135
1, 21, 21, 1, 1, 1, 5, 9, // 2136-2143
9, 9, 9, 5, 5, 5, // 2144-2149
};
| [
"n64"
] | n64 |
3fda3ed0c9f925cab8f72a50c00665df8230fe7c | ed34068580bbea3dad0066821133322aa33f98c1 | /macro/DataMCDisagreement/RooFitSystTest/sigmatest/500/band_51.C | 61080ba99fa34834e37d19f772524d103dea6335 | [] | no_license | nadjieh/Haamumu | f072174e6a47e9345a03d606c74c0f6a7c2206f8 | 98b005c31f0059c9bd2a0b8ed7f6deabad7b0cc0 | refs/heads/master | 2021-01-02T22:49:54.343034 | 2015-06-24T08:19:52 | 2015-06-24T08:19:52 | 35,811,661 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,957 | c | {
//========= Macro generated from object: pointErrs/Graph
//========= by ROOT version5.34/19
gre = new TGraphErrors(25);
gre->SetName("pointErrs");
gre->SetTitle("Graph");
gre->SetFillColor(1);
gre->SetPoint(0,20,51.286);
gre->SetPointError(0,0,4.68097);
gre->SetPoint(1,22,47.7772);
gre->SetPointError(1,0,3.2961);
gre->SetPoint(2,24,41.8554);
gre->SetPointError(2,0,2.80167);
gre->SetPoint(3,26,39.0038);
gre->SetPointError(3,0,2.99103);
gre->SetPoint(4,28,38.9305);
gre->SetPointError(4,0,2.14155);
gre->SetPoint(5,30,39.0549);
gre->SetPointError(5,0,2.12853);
gre->SetPoint(6,32,38.542);
gre->SetPointError(6,0,2.18822);
gre->SetPoint(7,34,38.1271);
gre->SetPointError(7,0,2.29319);
gre->SetPoint(8,36,38.3765);
gre->SetPointError(8,0,2.39667);
gre->SetPoint(9,38,39.2212);
gre->SetPointError(9,0,2.4642);
gre->SetPoint(10,40,40.1755);
gre->SetPointError(10,0,2.80111);
gre->SetPoint(11,42,40.986);
gre->SetPointError(11,0,2.78443);
gre->SetPoint(12,44,41.2416);
gre->SetPointError(12,0,3.11924);
gre->SetPoint(13,46,39.8969);
gre->SetPointError(13,0,2.53382);
gre->SetPoint(14,48,36.2939);
gre->SetPointError(14,0,2.33799);
gre->SetPoint(15,50,31.0594);
gre->SetPointError(15,0,2.09224);
gre->SetPoint(16,52,25.6179);
gre->SetPointError(16,0,1.86015);
gre->SetPoint(17,54,20.8746);
gre->SetPointError(17,0,1.76549);
gre->SetPoint(18,56,16.9931);
gre->SetPointError(18,0,1.61063);
gre->SetPoint(19,58,13.9385);
gre->SetPointError(19,0,1.3825);
gre->SetPoint(20,60,11.7148);
gre->SetPointError(20,0,1.31938);
gre->SetPoint(21,62,10.2888);
gre->SetPointError(21,0,1.11414);
gre->SetPoint(22,64,9.52841);
gre->SetPointError(22,0,0.887567);
gre->SetPoint(23,66,9.22749);
gre->SetPointError(23,0,0.977946);
gre->SetPoint(24,68,9.16409);
gre->SetPointError(24,0,1.25104);
gre->Draw("");
}
| [
"[email protected]"
] | |
f12da83fe293f4c9fb0ed08701929c182981e555 | e5ba0be533961e6e81eadd2819c97211f33a56b2 | /0x02-functions_nested_loops/6-abs.c | 9a6a4293cd14682265e86491ebf49349ae6dcf3c | [] | no_license | DarwinCC/holbertonschool-low_level_programming | 2744970abe9cb307226b1019ca84a068593f0119 | 69cfc60ad3ddedd41925f63e8382908df7f9ae7c | refs/heads/main | 2023-03-09T10:27:27.779983 | 2021-02-24T20:40:10 | 2021-02-24T20:40:10 | 335,676,623 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 248 | c | #include "holberton.h"
/**
* _abs - función principal
* @r: numero
* Description: valor absoluto
*
* Return: indicar el valor de retorno
*/
int _abs(int r)
{
if (r > 0)
{
return (r);
}
else if (r < 0)
{
return (-r);
}
else
{
return (0);
}
}
| [
"[email protected]"
] | |
62892cfd8a26a88c2e57556bd722ae0572983831 | 4eb4e3998b561f949e36a1ec1adc7a9cbbb70626 | /Assignment4/vtk/vs12/include/vtk-8.1/vtkRenderingOpenGLConfigure.h | 6f5e36a733f028d96ae9868b53320df5c7ef3aaf | [] | no_license | runei/DataVisualization | ea7edf313c71a207a97c399d9af5137f42da4404 | 9989611a1e4141e5ead83eb1ef18dbd1a90c66ca | refs/heads/master | 2020-04-07T04:51:45.319374 | 2019-04-29T19:29:08 | 2019-04-29T19:29:08 | 158,074,597 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 2,173 | h | /*=========================================================================
Program: Visualization Toolkit
Module: vtkRenderingOpenGLConfigure.h.in
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
#ifndef vtkRenderingOpenGLConfigure_h
#define vtkRenderingOpenGLConfigure_h
/* This header contains build settings for the vtkRenderingOpenGL2 module. */
/* It provides some compatibility with the vtkRenderingOpenGL module. */
#ifndef VTK_OPENGL2
#define VTK_OPENGL2
#endif
/* Whether VTK was built to support Cocoa on the Mac. */
/* #undef VTK_USE_COCOA */
/*--------------------------------------------------------------------------*/
/* Rendering Configuration */
/* #undef VTK_USE_X */
#define VTK_USE_OPENGL_LIBRARY
/* #undef VTK_OPENGL_HAS_OSMESA */
/* #undef VTK_OPENGL_HAS_EGL */
/* #undef VTK_DEFAULT_RENDER_WINDOW_OFFSCREEN */
// for legacy codes (don't use these in new codes)
#ifdef VTK_DEFAULT_RENDER_WINDOW_OFFSCREEN
# define VTK_USE_OFFSCREEN
#endif
#ifdef VTK_OPENGL_HAS_OSMESA
# define VTK_USE_OSMESA
#endif
#define VTK_USE_GLSL_SHADERS
/* Options for GPUInfo */
/* #undef VTK_USE_DIRECTX */
/* #undef VTK_USE_CORE_GRAPHICS */
/* #undef VTK_USE_NVCONTROL */
/*--------------------------------------------------------------------------*/
/* Setup VTK based on platform features and configuration. */
/* OGLR */
/* OGLR is for GLX. It can be on Unix, Mac or Windows */
#if ((defined(VTK_USE_OPENGL_LIBRARY) && defined(VTK_USE_X) && \
!defined(_WIN32)) || \
(defined(VTK_USE_X) && defined(_WIN32))) && \
!defined(VTK_USE_COCOA)
# define VTK_USE_OGLR
#endif
#endif
| [
"[email protected]"
] | |
383ea0e50bc89e09cb5e7d93b1b05c4a6075dd27 | cd760d6f8e318941e37c0ffb8566993896606e6e | /.phoronix-test-suite/installed-tests/compilebench/compilebench-0.6/t/native-0/arch/arm/vfp/vfpsingle.c | ae97bfef51e67fb886e25445f31df8c55ec41f48 | [] | no_license | aorzerep/neb | 3fab34e1ad05cd0c1f2274f4d143664c1ed4368d | 6dda5d3c432f2636973c9a98370056e57fe8e79f | refs/heads/master | 2020-09-08T10:06:34.548290 | 2019-11-12T01:00:41 | 2019-11-12T01:00:41 | 221,099,011 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 29,576 | c | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | [
"[email protected]"
] | |
2fcb78002347237ece88cad16bcf01c9f392bafc | 3a566208b77a57eed85b2b00253b0aab5d93abf7 | /0x01-variables_if_else_while/102-print_comb5.c | 2affa41994f967a1424eb30b4ec0f2d2820a0c98 | [] | no_license | nicolastobon09/holbertonschool-low_level_programming | 7dfe97a77fb0fc2ce2cbcb804e11774b785d724e | 45d923213c093039470b9500a6c2790c130079bb | refs/heads/master | 2022-12-10T21:13:16.479996 | 2020-08-26T19:44:44 | 2020-08-26T19:44:44 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 453 | c | #include <stdio.h>
/**
* main - Entry point
*
* Return: Always 0 (Success)
*/
int main(void)
{
int i;
int j;
for (i = 0; i <= 99; i++)
{
for (j = 0; j <= 99; j++)
{
if (j > i)
{
putchar((i / 10) + '0');
putchar((i % 10) + '0');
putchar(' ');
putchar((j / 10) + '0');
putchar((j % 10) + '0');
if (i != 98 || j != 99)
{
putchar(',');
putchar(' ');
}
}
}
}
putchar('\n');
return (0);
}
| [
"[email protected]"
] | |
ad2a9b9703b23dd139ec461a56d325701bd36da4 | f83ef53177180ebfeb5a3e230aa29794f52ce1fc | /gdb/gdb-7.8.2/gdb/gdbserver/linux-tile-low.c | c292c27ed362e6b4c640783e7d3747a42513d26e | [
"GPL-3.0-or-later",
"GPL-1.0-or-later",
"BSD-3-Clause",
"GPL-3.0-only",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-warranty-disclaimer",
"AGPL-3.0-or-later",
"LGPL-3.0-only",
"LGPL-2.0-or-later",
"LicenseRef-scancode-other-copyleft",
"GPL-2.0-only",
"LGPL-2.0-only",
"LicenseRef-scancode-other-permissive",
"GPL-2.0-or-later",
"Apache-2.0"
] | permissive | msrLi/portingSources | fe7528b3fd08eed4a1b41383c88ee5c09c2294ef | 57d561730ab27804a3172b33807f2bffbc9e52ae | refs/heads/master | 2021-07-08T01:22:29.604203 | 2019-07-10T13:07:06 | 2019-07-10T13:07:06 | 196,183,165 | 2 | 1 | Apache-2.0 | 2020-10-13T14:30:53 | 2019-07-10T10:16:46 | null | UTF-8 | C | false | false | 4,433 | c | /* GNU/Linux/TILE-Gx specific low level interface, GDBserver.
Copyright (C) 2012-2014 Free Software Foundation, Inc.
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "server.h"
#include "linux-low.h"
#include <arch/abi.h>
#include <sys/ptrace.h>
/* Defined in auto-generated file reg-tilegx.c. */
void init_registers_tilegx (void);
extern const struct target_desc *tdesc_tilegx;
/* Defined in auto-generated file reg-tilegx32.c. */
void init_registers_tilegx32 (void);
extern const struct target_desc *tdesc_tilegx32;
#define tile_num_regs 65
static int tile_regmap[] =
{
0, 1, 2, 3, 4, 5, 6, 7,
8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23,
24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39,
40, 41, 42, 43, 44, 45, 46, 47,
48, 49, 50, 51, 52, 53, 54, 55,
-1, -1, -1, -1, -1, -1, -1, -1,
56
};
static int
tile_cannot_fetch_register (int regno)
{
if (regno >= 0 && regno < 56)
return 0;
else if (regno == 64)
return 0;
else
return 1;
}
static int
tile_cannot_store_register (int regno)
{
if (regno >= 0 && regno < 56)
return 0;
else if (regno == 64)
return 0;
else
return 1;
}
static CORE_ADDR
tile_get_pc (struct regcache *regcache)
{
unsigned long pc;
collect_register_by_name (regcache, "pc", &pc);
return pc;
}
static void
tile_set_pc (struct regcache *regcache, CORE_ADDR pc)
{
unsigned long newpc = pc;
supply_register_by_name (regcache, "pc", &newpc);
}
static uint64_t tile_breakpoint = 0x400b3cae70166000ULL;
#define tile_breakpoint_len 8
static int
tile_breakpoint_at (CORE_ADDR where)
{
uint64_t insn;
(*the_target->read_memory) (where, (unsigned char *) &insn, 8);
if (insn == tile_breakpoint)
return 1;
/* If necessary, recognize more trap instructions here. GDB only uses the
one. */
return 0;
}
static void
tile_fill_gregset (struct regcache *regcache, void *buf)
{
int i;
for (i = 0; i < tile_num_regs; i++)
if (tile_regmap[i] != -1)
collect_register (regcache, i, ((uint_reg_t *) buf) + tile_regmap[i]);
}
static void
tile_store_gregset (struct regcache *regcache, const void *buf)
{
int i;
for (i = 0; i < tile_num_regs; i++)
if (tile_regmap[i] != -1)
supply_register (regcache, i, ((uint_reg_t *) buf) + tile_regmap[i]);
}
static struct regset_info tile_regsets[] =
{
{ PTRACE_GETREGS, PTRACE_SETREGS, 0, tile_num_regs * 8,
GENERAL_REGS, tile_fill_gregset, tile_store_gregset },
{ 0, 0, 0, -1, -1, NULL, NULL }
};
static struct regsets_info tile_regsets_info =
{
tile_regsets, /* regsets */
0, /* num_regsets */
NULL, /* disabled_regsets */
};
static struct usrregs_info tile_usrregs_info =
{
tile_num_regs,
tile_regmap,
};
static struct regs_info regs_info =
{
NULL, /* regset_bitmap */
&tile_usrregs_info,
&tile_regsets_info,
};
static const struct regs_info *
tile_regs_info (void)
{
return ®s_info;
}
static void
tile_arch_setup (void)
{
int pid = pid_of (current_inferior);
unsigned int machine;
int is_elf64 = linux_pid_exe_is_elf_64_file (pid, &machine);
if (sizeof (void *) == 4)
if (is_elf64 > 0)
error (_("Can't debug 64-bit process with 32-bit GDBserver"));
if (!is_elf64)
current_process ()->tdesc = tdesc_tilegx32;
else
current_process ()->tdesc = tdesc_tilegx;
}
struct linux_target_ops the_low_target =
{
tile_arch_setup,
tile_regs_info,
tile_cannot_fetch_register,
tile_cannot_store_register,
NULL,
tile_get_pc,
tile_set_pc,
(const unsigned char *) &tile_breakpoint,
tile_breakpoint_len,
NULL,
0,
tile_breakpoint_at,
};
void
initialize_low_arch (void)
{
init_registers_tilegx32();
init_registers_tilegx();
initialize_regsets_info (&tile_regsets_info);
}
| [
"[email protected]"
] | |
bf47665aaedfae6b282e28be035de2df4aea02ba | 814fd171ab9022a1f8405b864d61dfb1a6a12529 | /mm/proto.h | 0e4845df6483f3a804ab608864df8ed2e3a55ba8 | [] | no_license | p-sawicki/soi5 | 3afd3fa72acf8c9eefcf978d9ddabdcce5b51d15 | dae0de414fc6ab619033b83248e326eae2c1d13a | refs/heads/master | 2022-03-28T22:02:39.745199 | 2019-12-21T17:54:39 | 2019-12-21T17:54:39 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 2,995 | h | /* Function prototypes. */
struct mproc;
struct stat;
/* alloc.c */
_PROTOTYPE( phys_clicks alloc_mem, (phys_clicks clicks) );
_PROTOTYPE( void free_mem, (phys_clicks base, phys_clicks clicks) );
_PROTOTYPE( void mem_init, (phys_clicks *total, phys_clicks *free) );
_PROTOTYPE( int swap_on, (char *file, u32_t offset, u32_t size) );
_PROTOTYPE( int swap_off, (void) );
_PROTOTYPE( void swap_in, (void) );
_PROTOTYPE( void swap_inqueue, (struct mproc *rmp) );
/* break.c */
_PROTOTYPE( int adjust, (struct mproc *rmp,
vir_clicks data_clicks, vir_bytes sp) );
_PROTOTYPE( int do_brk, (void) );
_PROTOTYPE( int size_ok, (int file_type, vir_clicks tc, vir_clicks dc,
vir_clicks sc, vir_clicks dvir, vir_clicks s_vir) );
/* exec.c */
_PROTOTYPE( int do_exec, (void) );
_PROTOTYPE( void rw_seg, (int rw, int fd, int proc, int seg,
phys_bytes seg_bytes) );
_PROTOTYPE( struct mproc *find_share, (struct mproc *mp_ign, Ino_t ino,
Dev_t dev, time_t ctime) );
/* forkexit.c */
_PROTOTYPE( int do_fork, (void) );
_PROTOTYPE( int do_mm_exit, (void) );
_PROTOTYPE( int do_waitpid, (void) );
_PROTOTYPE( void mm_exit, (struct mproc *rmp, int exit_status) );
/* getset.c */
_PROTOTYPE( int do_getset, (void) );
/* main.c */
_PROTOTYPE( void main, (void) );
/* misc.c */
_PROTOTYPE( int do_reboot, (void) );
_PROTOTYPE( int do_svrctl, (void) );
#if (MACHINE == MACINTOSH)
_PROTOTYPE( phys_clicks start_click, (void) );
#endif
_PROTOTYPE( void setreply, (int proc_nr, int result) );
/* signal.c */
_PROTOTYPE( int do_alarm, (void) );
_PROTOTYPE( int do_kill, (void) );
_PROTOTYPE( int do_ksig, (void) );
_PROTOTYPE( int do_pause, (void) );
_PROTOTYPE( int set_alarm, (int proc_nr, int sec) );
_PROTOTYPE( int check_sig, (pid_t proc_id, int signo) );
_PROTOTYPE( void sig_proc, (struct mproc *rmp, int sig_nr) );
_PROTOTYPE( int do_sigaction, (void) );
_PROTOTYPE( int do_sigpending, (void) );
_PROTOTYPE( int do_sigprocmask, (void) );
_PROTOTYPE( int do_sigreturn, (void) );
_PROTOTYPE( int do_sigsuspend, (void) );
_PROTOTYPE( void check_pending, (struct mproc *rmp) );
/* trace.c */
_PROTOTYPE( int do_trace, (void) );
_PROTOTYPE( void stop_proc, (struct mproc *rmp, int sig_nr) );
/* utility.c */
_PROTOTYPE( int allowed, (char *name_buf, struct stat *s_buf, int mask) );
_PROTOTYPE( int no_sys, (void) );
_PROTOTYPE( void panic, (char *format, int num) );
_PROTOTYPE( void tell_fs, (int what, int p1, int p2, int p3) );
_PROTOTYPE( int do_getprocnr, (void) );
_PROTOTYPE( void do_setquotent, (void) );
_PROTOTYPE( int do_sem_init, (void) );
_PROTOTYPE( int do_sem_down, (void) );
_PROTOTYPE( int do_sem_up, (void) );
_PROTOTYPE( int do_sem_status, (void) );
_PROTOTYPE( int do_sem_status2, (void) );
_PROTOTYPE( int do_sem_uninit, (void) );
_PROTOTYPE( int do_hole_map, (void) );
_PROTOTYPE( int do_worst_fit, (void) );
| [
"[email protected]"
] | |
1fef2fc3d53228a80bd8be9b01385fbadec86d43 | 892c204f8035dd2052fda3126bd1cbf2a00ca78e | /fonts/BebasNeue_Bold16pt7b.h | 020c2244031aac894828ba7a7fc8041eea863f79 | [] | no_license | jacobha-ghh81hc/TFT_ILI9225_RPi3B | 49d59fb7e3e20b7f65709aca3639358d01239263 | b5832db616b7ad3746494e47fc3edcf4c3861687 | refs/heads/master | 2022-12-25T09:26:37.616361 | 2020-10-11T08:48:56 | 2020-10-11T08:48:56 | 298,332,506 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 3,284 | h | const uint8_t BebasNeue_Bold16pt7bBitmaps[] = {
0x07, 0x00, 0x60, 0x06, 0x04, 0x63, 0xF6, 0xF7, 0xFF, 0x06, 0x00, 0xF0,
0x19, 0x83, 0x9E, 0x30, 0xC1, 0x08, 0x0C, 0x01, 0x80, 0x30, 0x06, 0x0F,
0xFF, 0xFF, 0xFF, 0xF8, 0x60, 0x0C, 0x01, 0x80, 0x30, 0x00, 0xFF, 0xF6,
0x64, 0xFF, 0xFF, 0xC0, 0xFF, 0xF0, 0x00, 0x70, 0x0E, 0x00, 0xE0, 0x1C,
0x01, 0xC0, 0x1C, 0x03, 0x80, 0x38, 0x07, 0x00, 0x70, 0x07, 0x00, 0xE0,
0x0E, 0x01, 0xC0, 0x1C, 0x01, 0xC0, 0x38, 0x03, 0x80, 0x70, 0x07, 0x00,
0x70, 0x0E, 0x00, 0x1F, 0x1F, 0xE7, 0xFF, 0xCF, 0xE1, 0xF8, 0x7E, 0x1F,
0x87, 0xE1, 0xF8, 0x7E, 0x1F, 0x87, 0xE1, 0xF8, 0x7E, 0x1F, 0x87, 0xE1,
0xF8, 0x7F, 0x3D, 0xFF, 0x7F, 0x87, 0xC0, 0x0C, 0x73, 0xFF, 0xFF, 0xF1,
0xC7, 0x1C, 0x71, 0xC7, 0x1C, 0x71, 0xC7, 0x1C, 0x71, 0xC7, 0x1C, 0x70,
0x1F, 0x1F, 0xE7, 0xFF, 0xCF, 0xF1, 0xF8, 0x7E, 0x1F, 0x87, 0x03, 0xC0,
0xF0, 0x78, 0x3C, 0x1F, 0x07, 0x83, 0xC1, 0xE0, 0x70, 0x3C, 0x0F, 0x03,
0xFF, 0xFF, 0xFF, 0xF0, 0x1F, 0x1F, 0xE7, 0xFF, 0xCF, 0xE1, 0xF8, 0x7E,
0x1C, 0x07, 0x03, 0xC7, 0xE1, 0xF0, 0x7E, 0x03, 0xC0, 0x70, 0x1F, 0x87,
0xE1, 0xF8, 0x7F, 0x3D, 0xFF, 0x7F, 0x87, 0xC0, 0x03, 0xC0, 0x3C, 0x03,
0xC0, 0x7C, 0x07, 0xC0, 0xFC, 0x0F, 0xC0, 0xFC, 0x1D, 0xC1, 0xDC, 0x39,
0xC3, 0x9C, 0x79, 0xC7, 0x1C, 0x71, 0xCF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01,
0xC0, 0x1C, 0x01, 0xC0, 0x1C, 0x7F, 0xDF, 0xF7, 0xFD, 0xC0, 0xF0, 0x3C,
0x0F, 0x03, 0xDC, 0xFF, 0xBF, 0xFF, 0x3F, 0x87, 0xE1, 0xC0, 0x70, 0x1F,
0x87, 0xE1, 0xF8, 0x7F, 0x3D, 0xFF, 0x7F, 0x87, 0xC0, 0x1F, 0x1F, 0xE7,
0xFF, 0xC7, 0xF1, 0xF8, 0x7E, 0x03, 0x80, 0xE7, 0xBB, 0xFF, 0xFF, 0xC7,
0xE1, 0xF8, 0x7E, 0x1F, 0x87, 0xE1, 0xF8, 0x7F, 0x1D, 0xFF, 0x7F, 0x87,
0xC0, 0xFF, 0xFF, 0xFF, 0xFC, 0x07, 0x03, 0xC0, 0xF0, 0x38, 0x0E, 0x07,
0x81, 0xE0, 0x70, 0x1C, 0x0F, 0x03, 0x80, 0xE0, 0x38, 0x1E, 0x07, 0x01,
0xC0, 0xF0, 0x3C, 0x0E, 0x00, 0x1F, 0x1F, 0xEF, 0xFF, 0xCF, 0xE1, 0xF8,
0x7E, 0x1F, 0x87, 0xF3, 0xDF, 0xE3, 0xF9, 0xFF, 0xF3, 0xF8, 0x7E, 0x1F,
0x87, 0xE1, 0xF8, 0x7F, 0x3F, 0xFF, 0x7F, 0x87, 0xC0, 0x1F, 0x1F, 0xEF,
0xFF, 0xCF, 0xE1, 0xF8, 0x7E, 0x1F, 0x87, 0xE1, 0xF8, 0x7F, 0x3F, 0xFF,
0x7F, 0xCF, 0x70, 0x1C, 0x07, 0xE1, 0xF8, 0x7F, 0x3D, 0xFF, 0x7F, 0x87,
0xC0 };
const GFXglyph BebasNeue_Bold16pt7bGlyphs[] = {
{ 0, 12, 12, 12, 0, -21 }, // 0x2A '*'
{ 18, 11, 11, 12, 1, -15 }, // 0x2B '+'
{ 34, 4, 6, 6, 1, -2 }, // 0x2C ','
{ 37, 6, 3, 8, 1, -11 }, // 0x2D '-'
{ 40, 4, 3, 6, 1, -2 }, // 0x2E '.'
{ 42, 12, 22, 12, 0, -21 }, // 0x2F '/'
{ 75, 10, 22, 12, 1, -21 }, // 0x30 '0'
{ 103, 6, 22, 12, 3, -21 }, // 0x31 '1'
{ 120, 10, 22, 12, 1, -21 }, // 0x32 '2'
{ 148, 10, 22, 12, 1, -21 }, // 0x33 '3'
{ 176, 12, 22, 12, 0, -21 }, // 0x34 '4'
{ 209, 10, 22, 12, 1, -21 }, // 0x35 '5'
{ 237, 10, 22, 12, 1, -21 }, // 0x36 '6'
{ 265, 10, 22, 12, 1, -21 }, // 0x37 '7'
{ 293, 10, 22, 12, 1, -21 }, // 0x38 '8'
{ 321, 10, 22, 12, 1, -21 } }; // 0x39 '9'
const GFXfont BebasNeue_Bold16pt7b = {
(uint8_t *)BebasNeue_Bold16pt7bBitmaps,
(GFXglyph *)BebasNeue_Bold16pt7bGlyphs,
0x2A, 0x39, 31 };
// Approx. 468 bytes
| [
"[email protected]"
] | |
ae8fd15030e97412f65f7c06505336a316721610 | 976f5e0b583c3f3a87a142187b9a2b2a5ae9cf6f | /source/linux/drivers/net/usb/extr_ax88179_178a.c_ax88179_set_mac_addr.c | 5a76864e30c44c165e6019fa6c2810246d951d66 | [] | no_license | isabella232/AnghaBench | 7ba90823cf8c0dd25a803d1688500eec91d1cf4e | 9a5f60cdc907a0475090eef45e5be43392c25132 | refs/heads/master | 2023-04-20T09:05:33.024569 | 2021-05-07T18:36:26 | 2021-05-07T18:36:26 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,564 | c | #define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct usbnet {int dummy; } ;
struct sockaddr {int /*<<< orphan*/ sa_data; } ;
struct net_device {int /*<<< orphan*/ dev_addr; } ;
/* Variables and functions */
int /*<<< orphan*/ AX_ACCESS_MAC ;
int /*<<< orphan*/ AX_NODE_ID ;
int EADDRNOTAVAIL ;
int EBUSY ;
int /*<<< orphan*/ ETH_ALEN ;
int ax88179_write_cmd (struct usbnet*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ is_valid_ether_addr (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
struct usbnet* netdev_priv (struct net_device*) ;
scalar_t__ netif_running (struct net_device*) ;
__attribute__((used)) static int ax88179_set_mac_addr(struct net_device *net, void *p)
{
struct usbnet *dev = netdev_priv(net);
struct sockaddr *addr = p;
int ret;
if (netif_running(net))
return -EBUSY;
if (!is_valid_ether_addr(addr->sa_data))
return -EADDRNOTAVAIL;
memcpy(net->dev_addr, addr->sa_data, ETH_ALEN);
/* Set the MAC address */
ret = ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_NODE_ID, ETH_ALEN,
ETH_ALEN, net->dev_addr);
if (ret < 0)
return ret;
return 0;
} | [
"[email protected]"
] | |
ec50234024fde6beacc2e1eb860f3d674f455f11 | 86889b989ed3bdcb6790a32fdfd95d0e3edb9f3e | /lab6/prelab/gd.c | 48322542730bf2c9d3514c3b3228be16edf41c40 | [] | no_license | lldarrow/CptS-360-File-Systems | 7b2864c6b21fa425ded7f259252ae597daf905dd | c72d57dd338d86e2f59e1b41dd498e0f73dee01c | refs/heads/master | 2020-06-18T15:44:24.986920 | 2016-11-29T23:11:49 | 2016-11-29T23:11:49 | 75,130,580 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 832 | c | #include <fcnt1.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <ext2fs/ext2_fs.h>
int gd(int fd)
{
char buf[1024];
get_block(fd, 2, buf);
gp = (GD *)buf;
printf("\n**************** group descriptor ****************\n");
printf("bg_block_bitmap \t=\t%d\n", gp->bg_block_bitmap);
printf("bg_inode_bitmap \t=\t%d\n", gp->bg_inode_bitmap);
printf("bg_inode_table \t\t=\t%d\n", gp->bg_inode_table);
printf("bg_free_blocks_count \t=\t%d\n", gp->bg_free_blocks_count);
printf("bg_free_inodes_count \t=\t%d\n", gp->bg_free_inodes_count);
printf("bg_used_dirs_count \t=\t%d\n", gp->bg_used_dirs_count);
block_bitmap = gp->bg_block_bitmap;
inode_bitmap = gp->bg_inode_bitmap;
inode_table = gp->bg_inode_table;
printf("\n**************************************\n");
}
int main(int argc, char *argv[])
{
gd();
}
| [
"[email protected]"
] | |
26b8f62fca24d8b9ad11af6f9fd6fa187ab72f94 | 754a884f8632b47030efd5c0812b0194577d7778 | /lagu.h | 060793c952385f0f6cb578459aa965ade012adb4 | [] | no_license | fandykun/FP_SISOP_B05 | 93576045704e9f38dfa85bbd252c22ee23537640 | d62321cdcfb41444527d98db9a324646d6437880 | refs/heads/master | 2020-05-21T05:17:52.256703 | 2019-05-12T16:49:13 | 2019-05-12T16:49:13 | 185,918,077 | 1 | 0 | null | null | null | null | UTF-8 | C | false | false | 2,233 | h | #ifndef LAGU_H_
#define LAGU_H_
#include <stdio.h>
#include <pthread.h>
#include <termios.h>
#include <string.h>
#include <dirent.h>
#include <stdlib.h>
#include <unistd.h>
//----Library untuk play mp3----
#include <ao/ao.h>
#include <mpg123.h>
#define BITS 8
#define MAXLEN 256
#define MAXLIST 100
//-------Pre-define keperluan mp3------
#define MENU_UTAMA 10
#define MENU_PLAY 11
#define MENU_PLAYLIST 12
#define MENU_LIST_LAGU 13
#define MENU_PLAY_PLAYLIST 14
#define MENU_TAMBAHKAN_LAGU 15
#define PLAY 1
#define PAUSE 2
#define STOP 3
#define NEXT 4
#define PREV 5
#define PAGE 6
#define ADD 1
#define REMOVE 2
#define DONE 3
#define KNRM "\x1B[0m"
#define KRED "\x1B[31m"
#define KGRN "\x1B[32m"
#define KYEL "\x1B[33m"
#define KBLU "\x1B[34m"
#define KMAG "\x1B[35m"
#define KCYN "\x1B[36m"
#define KWHT "\x1B[37m"
//--------Deklarasi variabel----------
//===========Inisialisasi mpg123=========
mpg123_handle *music_handler;
unsigned char *buffer;
size_t buffer_size;
size_t done;
//===========Inisialisasi libao==========
int driver;
ao_device *device;
ao_sample_format format;
int channels, encoding;
long rate;
//=========Inisialisasi thread===========
pthread_t tid_musik;
pthread_t tid_menu;
pthread_t tid_keyboard;
pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
pthread_cond_t condition = PTHREAD_COND_INITIALIZER;
int mutex = 0;
int status_menu;
int status_lagu;
int status_playlist;
int status_playlist_lagu = 0;
int now_playing = 0;
int current_idx = -1;
int max_idx = 0;
int current_page = 0;
char command;
char daftar_lagu[MAXLIST][MAXLEN];
char nama_playlist[MAXLIST][MAXLEN];
int isi_playlist[MAXLIST][MAXLIST];
int max_isi[MAXLIST];
int idx_cok = -1;
int max_playlist_idx = 0;
int playlist_idx = -1;
int lagu_playlist_idx = 0;
//---------Deklarasi fungsi-------------
void inisialisasi_music_player();
void close_music_player();
void list_lagu();
void print_lagu();
void menu_lagu();
void menu_play();
void menu_play_playlist();
void menu_utama();
void menu_tambahkan_lagu();
void menu_playlist();
void print_playlist();
void remove_playlist(int idx);
void *baca_perintah_keyboard(void *args);
void *menu_music_player(void *args);
void *mainkan_musik(void *args);
char getch();
#endif | [
"[email protected]"
] | |
5048ad4582086df3a8393171c6b8c15a804035a9 | 309cdefac097c607534d8ea438384f8a3583a928 | /SDK_Probe_CC13xx_SmartRf06EB/board_properties.h | 39c43ab5e7b43afd40860d561ea17011de1c5277 | [] | no_license | maruixxx/mSdk | f1410a1144b10ecc73c3fc94477e29a4a7d9385e | cff180526c69e835420c08a03afc96d51a404aa6 | refs/heads/master | 2022-04-11T15:25:57.769807 | 2018-08-23T15:07:33 | 2018-08-23T15:07:33 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,209 | h | /*
* board_properties.h
*
* Created: 2/8/2013 12:23:12 AM
* Author: XxXx
*/
/*#####################################################*/
#ifndef SDK_PROBE_CC13XX_SMARTRF06EB_BOARD_PROPERTIES_H_
#define SDK_PROBE_CC13XX_SMARTRF06EB_BOARD_PROPERTIES_H_
/*#####################################################*/
#define ExtQ_FreqMhz 12
#define ExtQ_FreqHz 12000000
#define CoreFreq_Mhz 168
//#define USE_SELECTED_FONTS
//#define INT_SIZE_IS_2_BYTES
#define USE_16_BIT_COLOR_DEPTH
//#define USE_AVR_STUDIO
#define NO_ENUM_ON_SWITCH
//#define USE_RTC_100_MS
//#define USED_LCD_DMA 3
//#define USED_MMCSD_DMA 2
#define NO_USE_MALIGN
#define NO_I_TO_A_IN_STD_LIB
//#define Fs_RW
//#define USE_FFT_TABLES
//#define USE_FFT_BUFFERS float
//#define FFT_BUFFER_SIZE_LOG 8
//#define USE_FFT_STATIC_BUFF
/*#####################################################*/
//#define USE_FONT_CMSS14B
/*#####################################################*/
#define STM32F407VGT6_Discovery
/*#####################################################*/
/*#####################################################*/
#endif /* SDK_PROBE_CC13XX_SMARTRF06EB_BOARD_PROPERTIES_H_ */
/*#####################################################*/
| [
"[email protected]"
] | |
b2cbcf22922e33b0c4cfac1f97d89859b778ba0a | d424739c2462bc8120c031c28b86e32fe36e7422 | /src/lib/config-mac.h | 498160e14d54cc72ec862124316984351b116d31 | [
"curl"
] | permissive | djp952/prebuilt-libcurl | 15e63fad0b6e4de9174c3230cd10ed5e27e871d2 | cf3fa05218527be0902e40bf796c68e3e8a1dc2f | refs/heads/main | 2023-01-05T23:06:16.567476 | 2023-01-03T21:51:58 | 2023-01-03T21:51:58 | 83,947,940 | 10 | 5 | null | null | null | null | UTF-8 | C | false | false | 3,506 | h | #ifndef HEADER_CURL_CONFIG_MAC_H
#define HEADER_CURL_CONFIG_MAC_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2022, Daniel Stenberg, <[email protected]>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
/* =================================================================== */
/* Hand crafted config file for Mac OS 9 */
/* =================================================================== */
/* On Mac OS X you must run configure to generate curl_config.h file */
/* =================================================================== */
#ifndef OS
#define OS "mac"
#endif
#include <ConditionalMacros.h>
#if TYPE_LONGLONG
#define HAVE_LONGLONG 1
#endif
/* Define if you want the built-in manual */
#define USE_MANUAL 1
#define HAVE_NETINET_IN_H 1
#define HAVE_SYS_SOCKET_H 1
#define HAVE_NETDB_H 1
#define HAVE_ARPA_INET_H 1
#define HAVE_UNISTD_H 1
#define HAVE_NET_IF_H 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_GETTIMEOFDAY 1
#define HAVE_FCNTL_H 1
#define HAVE_SYS_STAT_H 1
#define HAVE_STDLIB_H 1
#define HAVE_TIME_H 1
#define HAVE_UTIME_H 1
#define HAVE_SYS_TIME_H 1
#define HAVE_SYS_UTIME_H 1
#define HAVE_SYS_IOCTL_H 1
#define TIME_WITH_SYS_TIME 1
#define HAVE_ALARM 1
#define HAVE_FTRUNCATE 1
#define HAVE_UTIME 1
#define HAVE_SELECT 1
#define HAVE_SOCKET 1
#define HAVE_STRUCT_TIMEVAL 1
#define HAVE_SIGACTION 1
#define HAVE_SIGNAL_H 1
#ifdef MACOS_SSL_SUPPORT
# define USE_OPENSSL 1
#endif
#define CURL_DISABLE_LDAP 1
#define HAVE_RAND_EGD 1
#define HAVE_IOCTL_FIONBIO 1
#define SIZEOF_INT 4
#define SIZEOF_LONG 4
#define SIZEOF_SIZE_T 4
#ifdef HAVE_LONGLONG
#define SIZEOF_CURL_OFF_T 8
#else
#define SIZEOF_CURL_OFF_T 4
#endif
#define HAVE_RECV 1
#define RECV_TYPE_ARG1 int
#define RECV_TYPE_ARG2 void *
#define RECV_TYPE_ARG3 size_t
#define RECV_TYPE_ARG4 int
#define RECV_TYPE_RETV ssize_t
#define HAVE_SEND 1
#define SEND_TYPE_ARG1 int
#define SEND_QUAL_ARG2 const
#define SEND_TYPE_ARG2 void *
#define SEND_TYPE_ARG3 size_t
#define SEND_TYPE_ARG4 int
#define SEND_TYPE_RETV ssize_t
#define HAVE_EXTRA_STRICMP_H 1
#define HAVE_EXTRA_STRDUP_H 1
#endif /* HEADER_CURL_CONFIG_MAC_H */
| [
"[email protected]"
] | |
91e9942c1e4befe1d955a1b2786f87fa0b1dbfa7 | c8639e2b4bb7116d7dd66acaa769c30d7bb479f7 | /world/d/zhuxian/npc/guard.c | a578b6ee7fa97e002f4002bf0e4275fb0d038b7d | [] | no_license | ninemoon/mhxy2002 | 43bc9759bbde56e2c49c524514f3dc4f83fbe932 | 76e0fa31cd662864bd55168e2fdf986622ed510e | refs/heads/master | 2021-09-06T10:05:19.812948 | 2018-02-05T09:57:57 | 2018-02-05T09:57:57 | 120,064,608 | 0 | 0 | null | 2018-02-03T06:07:09 | 2018-02-03T06:07:08 | null | GB18030 | C | false | false | 3,985 | c | inherit NPC;
void create()
{
set_name("守卫", ({ "guard" }) );
set("race", "人类");
set("age", 3000);
set("long", "看来守卫不会让你进去的。\n");
set("str", 20);
set("cor", 30);
set("max_force", 3000);
set("mana", 5000);
set("force", 5000);
set("max_mana", 3000);
set("force_factor", 100);
set("mana_factor", 150);
set("max_kee", 2000);
set("max_sen", 2000);
set("verbs", ({ "bite", "claw"}) );
set("combat_exp", 1000000+random(1000000));
set("daoxing", 5000000);
set_skill("dodge", 160);
set_skill("unarmed", 100);
set_skill("parry", 160);
set_skill("moshenbu", 160);
set_skill("force", 160);
set_skill("wuxiangforce", 160);
set_skill("sword", 200);
set_skill("sanqing-jian", 200);
set_skill("dao", 200);
set_skill("spells", 200);
map_skill("force", "wuxiangforce");
map_skill("parry", "sanqing-jian");
map_skill("sword", "sanqing-jian");
map_skill("dodge", "moshenbu");
map_skill("spells", "dao");
set("chat_chance_combat", 30);
set("chat_msg_combat", ({
(: cast_spell, "light" :),
(: cast_spell, "thunder" :),
(: cast_spell, "dingshen" :)
}));
set_temp("apply/armor", 80);
set_temp("apply/damage",80);
set_temp("apply/armor_vs_force",300);
set_weight(1000000);
setup();
carry_object("/d/obj/weapon/sword/changjian")->wield();
carry_object("/d/obj/armor/tongjia")->wear();
}
void init()
{
::init();
add_action("do_cast", "cast");
add_action("do_perform", "perform");
add_action("do_bian", "bian");
add_action("do_ji", "ji");
}
/*int do_dou()
{
object me,who;
me =this_object();
who=this_player();
if(me->is_fighting())
return notify_fail("慢慢来,不要急。\n");
message_vision("$N对$n大喊一声:看招!\n\n", who,me);
me->kill_ob(who);
who->kill_ob(me);
// COMBAT_D->do_attack(me, who, query_temp("weapon"));
me->set("owner",who->query("id"));
return 1;
}
void die()
{
string owner;
object owner_ob;
owner = query("owner");
if(!owner) return ::die(); // added by mon.
owner_ob= find_player(owner);
if( owner_ob && (object)query_temp("last_damage_from") == owner_ob ) {
owner_ob->add_temp("mark/人", 1);
owner_ob->add_temp("mark/仙", 1);
message_vision("$N喝道:休得猖狂,待我回家取法宝来收你。\n",this_object());
destruct(this_object());
return;
}
::die();
} */
int do_cast(string arg)
{
object who = this_player();
object me = this_object();
message_vision("$N张开嘴,结结吧吧地念了几声咒语。\n", who);
message_vision ("$N对$n摇了摇头。\n", me, who);
return 1;
}
/* int do_exert(string arg)
{
object who = this_player();
object me = this_object();
message_vision("$N鬼鬼祟祟地一运气。\n",who);
message_vision("$N对$n摇了摇头。\n", me, who);
return 1;
} */
int do_perform(string arg)
{
object who = this_player();
object me = this_object();
message_vision("$N脸色不大对,好象动了杀机!\n", who);
message_vision ("$N对$n摇了摇头。\n", me, who);
return 1;
}
int do_ji(string arg)
{
object who = this_player();
object me = this_object();
message_vision("$N偷偷把手伸进怀里,想用什么法宝!\n", who);
message_vision ("$N对$n摇了摇头。\n", me, who);
return 1;
}
| [
"[email protected]"
] | |
e269fa2a6f9c528933f7aaa9ba6550f39ecff0bb | a5d27ce3e9b877ced4fec029ce846b4e09258b0f | /ShallowWater/shwater2d_serial.c | 21d9cbfed74a4d23c5bd7ffcb18d0bbc5abc6002 | [
"MIT"
] | permissive | davidmallasen/Hello_OpenMP | 65bfb53ec2802d402a9ec67d92a0a1486b201d70 | b28ce90059751afc5589f8229481ccae4c328fd7 | refs/heads/main | 2023-04-17T07:31:05.949165 | 2021-04-30T18:44:36 | 2021-04-30T18:44:36 | 358,301,789 | 1 | 0 | null | null | null | null | UTF-8 | C | false | false | 7,251 | c | /*
* shwater2d.c solves the two dimensional shallow water equations
* using the Lax-Friedrich's scheme
*/
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
//#include <omp.h>
#include <sys/time.h>
#define cell_size 3
#define xstart 0.0
#define ystart 0.0
#define xend 4.0
#define yend 4.0
#define Q(i, j, k) Q[((k) + n * ((j) + m * (i)))]
/* Timing function */
double gettime(void) {
struct timeval tv;
gettimeofday(&tv,NULL);
return tv.tv_sec + 1e-6*tv.tv_usec;
}
/* Check that the solution is finite */
void validate(double *Q, int m, int n) {
int i, j, k;
for (i = 0; i < n; i++)
for (j = 0; j < m; j++)
for (k = 0; k < cell_size; k++)
if (!isfinite(Q(k, j, i))) {
fprintf(stderr, "Invalid solution\n");
exit(-1);
}
}
/* Flux function in the x-direction */
void fx(double *Q, double **fq, int m, int n, int j) {
int i;
const double g = 9.81;
for (i = 0; i < m; i++) {
fq[0][i] = Q(1, i, j);
fq[1][i] = (pow(Q(1, i, j), 2) / Q(0, i, j)) +
(g * pow(Q(0, i, j), 2)) / 2.0;
fq[2][i] = (Q(1, i, j) * Q(2, i, j)) / Q(0, i, j);
}
}
/* Flux function in the y-direction */
void fy(double *Q, double **fq, int m, int n, int i) {
int j;
const double g= 9.81;
for (j = 0; j < n; j++) {
fq[0][j] = Q(2, i, j);
fq[1][j] = (Q(1, i, j) * Q(2, i, j)) / Q(0, i, j);
fq[2][j] = (pow(Q(2, i, j), 2) / Q(0, i, j)) +
(g * pow(Q(0, i, j), 2)) / 2.0;
}
}
/*
This is the Lax-Friedrich's scheme for updating volumes
Try to parallelize it in an efficient way!
*/
void laxf_scheme_2d(double *Q, double **ffx, double **ffy, double **nFx, double **nFy,
int m, int n, double dx, double dy, double dt) {
int i, j, k;
/* Calculate and update fluxes in the x-direction */
for (i = 1; i < n; i++) {
fx(Q, ffx, m, n, i);
for (j = 1; j < m; j++)
for (k = 0; k < cell_size; k++)
nFx[k][j] = 0.5 * ((ffx[k][j-1] + ffx[k][j]) -
dx/dt * (Q(k, j, i) - Q(k, j-1, i)));
for (j = 1; j < m-1; j++)
for (k = 0; k < cell_size; k++)
Q(k, j, i) = Q(k, j, i) - dt/dx * ((nFx[k][j+1] - nFx[k][j]));
}
/* Calculate and update fluxes in the y-direction */
for (i = 1; i < m; i++) {
fy(Q, ffy, m, n, i);
for (j = 1; j < n; j++)
for (k = 0; k < cell_size; k++)
nFy[k][j] = 0.5 * ((ffy[k][j-1] + ffy[k][j]) -
dy/dt * (Q(k, i, j) - Q(k, i, j -1)));
for (j = 1; j < n-1; j++)
for (k = 0; k < cell_size; k++)
Q(k,i,j) = Q(k,i,j) - dt/dy * ((nFy[k][j+1] - nFy[k][j]));
}
}
/*
This is the main solver routine, parallelize this.
But don't forget the subroutine laxf_scheme_2d
*/
void solver(double *Q, double **ffx, double **ffy, double **nFx, double **nFy,
int m, int n, double tend, double dx, double dy, double dt) {
double bc_mask[3] = {1.0, -1.0, -1.0};
double time;
int i, j, k, steps;
steps = ceil(tend / dt);
for (i = 0, time = 0.0; i < steps; i++, time += dt) {
/* Apply boundary condition */
for (j = 1; j < n - 1 ; j++) {
for (k = 0; k < cell_size; k++) {
Q(k, 0, j) = bc_mask[k] * Q(k, 1, j);
Q(k, m-1, j) = bc_mask[k] * Q(k, m-2, j);
}
}
for (j = 0; j < m; j++) {
for (k = 0; k < cell_size; k++) {
Q(k, j, 0) = bc_mask[k] * Q(k, j, 1);
Q(k, j, n-1) = bc_mask[k] * Q(k, j, n-2);
}
}
/* Update all volumes with the Lax-Friedrich's scheme */
laxf_scheme_2d(Q, ffx, ffy, nFx, nFy, m, n, dx, dy, dt);
}
}
void save_vtk(double *Q, double *x, double *y, int m, int n) {
int i, j;
FILE *fp = fopen("result.vtk", "w");
/* Write vtk Datafile header */
fprintf(fp, "# vtk DataFile Version 2.0\n");
fprintf(fp, "VTK\nASCII\nDATASET POLYDATA\n");
/* Store water height as polydata */
fprintf(fp, "\nPOINTS %d double\n", m*n);
for (j = 0; j < n; j++)
for (i = 0; i < m; i++)
fprintf(fp, "%e %e %e\n", x[i], y[j], Q(0, i, j));
fprintf(fp,"\nVERTICES %d %d\n", n, n *(m+1));
for (j = 0; j < n; j++) {
fprintf(fp, "%d ", m);
for (i = 0; i < m; i++)
fprintf(fp, "%d ", i+j*m);
fprintf(fp,"\n");
}
/* Store lookup table */
fprintf(fp,
"POINT_DATA %d\nSCALARS height double 1\nLOOKUP_TABLE default\n",m*n);
for (j = 0; j < n; j++)
for (i = 0; i < m; i++)
fprintf(fp, "%e\n", Q(0, i, j));
fclose(fp);
}
/*
This is the main routine of the program, which allocates memory
and setup all parameters for the problem.
You don't need to parallelize anything here!
However, it might be useful to change the m and n parameters
during debugging
*/
int main(int argc, char **argv) {
int i, j, m, n;
double *Q;
double *x, *y;
double **ffx, **nFx, **ffy, **nFy;
double dx, dt, epsi, delta, dy, tend, tmp, stime, etime;
/* Use m volumes in the x-direction and n volumes in the y-direction */
m = 1000;
n = 1000;
/*
epsi Parameter used for initial condition
delta Parameter used for initial condition
dx Distance between two volumes (x-direction)
dy Distance between two volumes (y-direction)
dt Time step
tend End time
*/
epsi = 2.0;
delta = 0.5;
dx = (xend - xstart) / (double) m;
dy = (yend - ystart) / (double) n;
dt = dx / sqrt( 9.81 * 5.0);
tend = 0.1;
/* Add two ghost volumes at each side of the domain */
m = m + 2;
n = n + 2;
/* Allocate memory for the domain */
Q = (double *) malloc(m * n * cell_size * sizeof(double));
x = (double *) malloc(m * sizeof(double));
y = (double *) malloc(n * sizeof(double));
/* Allocate memory for fluxes */
ffx = (double **) malloc(cell_size * sizeof(double *));
ffy = (double **) malloc(cell_size * sizeof(double *));
nFx = (double **) malloc(cell_size * sizeof(double *));
nFy = (double **) malloc(cell_size * sizeof(double *));
ffx[0] = (double *) malloc(cell_size * m * sizeof(double));
ffy[0] = (double *) malloc(cell_size * n * sizeof(double));
nFx[0] = (double *) malloc(cell_size * m * sizeof(double));
nFy[0] = (double *) malloc(cell_size * n * sizeof(double));
for (i = 0; i < cell_size; i++) {
ffx[i] = ffx[0] + i * m;
nFx[i] = nFx[0] + i * m;
ffy[i] = ffy[0] + i * n;
nFy[i] = nFy[0] + i * n;
}
for (i = 0,tmp= -dx/2 + xstart; i < m; i++, tmp += dx)
x[i] = tmp;
for (i = 0,tmp= -dy/2 + ystart; i < n; i++, tmp += dy)
y[i] = tmp;
/* Set initial Gauss hump */
for (i = 0; i < m; i++) {
for (j = 0; j < n; j++) {
Q(0, i, j) = 4.0;
Q(1, i, j) = 0.0;
Q(2, i, j) = 0.0;
}
}
for (i = 1; i < m-1; i++) {
for (j = 1; j < n-1; j++) {
Q(0, i, j) = 4.0 + epsi * exp(-(pow(x[i] - xend / 4.0, 2) + pow(y[j] - yend / 4.0, 2)) /
(pow(delta, 2)));
}
}
stime = gettime();
solver(Q, ffx, ffy, nFx, nFy, m, n, tend, dx, dy, dt);
etime = gettime();
validate(Q, m, n);
printf("Solver took %g seconds\n", etime - stime);
/* Uncomment this line if you want visualize the result in ParaView */
/* save_vtk(Q, x, y, m, n); */
free(Q);
free(x);
free(y);
free(ffx[0]);
free(ffy[0]);
free(nFx[0]);
free(nFy[0]);
free(ffx);
free(ffy);
free(nFx);
free(nFy);
return 0;
}
| [
"[email protected]"
] | |
2659190b229248f7de1058e381f607e0fcaab6df | 449c14fa445bf47a82457a3ea882c87ddb727548 | /rpc-study/lab-01/calculadora_svc.c | 25b856cd75ea5c0e075b0015db3c2cc9ec28998f | [] | no_license | ErickGiffoni/Programming-for-Parallel-n-Distributed-Systems | bbe002d76c389474eb31dcb5a6751d56df0e9047 | 7a89acb1843ddb9263dd249a75ba804b4a6bed0d | refs/heads/main | 2023-08-28T05:55:55.476889 | 2021-11-04T14:30:15 | 2021-11-04T14:30:15 | 390,354,338 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 4,462 | c | /*
* Please do not edit this file.
* It was generated using rpcgen.
*/
#include "calculadora.h"
#include <sys/ioctl.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <netdb.h>
#include <signal.h>
#include <sys/ttycom.h>
#include <memory.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <syslog.h>
#include <unistd.h> // faltava essa lib
#include <rpc/rpc.h> // faltava essa lib
void pmap_unset(rpc_uint, rpc_uint);
#ifdef __STDC__
#define SIG_PF void(*)(int)
#endif
#ifdef DEBUG
#define RPC_SVC_FG
#endif
#define _RPCSVC_CLOSEDOWN 120
static int _rpcpmstart; /* Started by a port monitor ? */
static int _rpcfdtype; /* Whether Stream or Datagram ? */
static int _rpcsvcdirty; /* Still serving ? */
static
void _msgout(msg)
char *msg;
{
#ifdef RPC_SVC_FG
if (_rpcpmstart)
syslog(LOG_ERR, "%s", msg);
else
(void) fprintf(stderr, "%s\n", msg);
#else
syslog(LOG_ERR, "%s", msg);
#endif
}
static void
closedown()
{
if (_rpcsvcdirty == 0) {
extern fd_set svc_fdset;
static int size;
int i, openfd;
if (_rpcfdtype == SOCK_DGRAM)
exit(0);
if (size == 0) {
size = getdtablesize();
}
for (i = 0, openfd = 0; i < size && openfd < 2; i++)
if (FD_ISSET(i, &svc_fdset))
openfd++;
if (openfd <= (_rpcpmstart?0:1))
exit(0);
}
(void) alarm(_RPCSVC_CLOSEDOWN);
}
static void
calculadora_1(rqstp, transp)
struct svc_req *rqstp;
SVCXPRT *transp;
{
union {
operacao calcula_1_arg;
} argument;
char *result;
bool_t (*xdr_argument)(), (*xdr_result)();
char *(*local)();
_rpcsvcdirty = 1;
switch (rqstp->rq_proc) {
case NULLPROC:
(void) svc_sendreply(transp, (xdrproc_t) xdr_void, (char *)NULL);
_rpcsvcdirty = 0;
return;
case calcula:
xdr_argument = xdr_operacao;
xdr_result = xdr_int;
local = (char *(*)()) calcula_1_svc;
break;
default:
svcerr_noproc(transp);
_rpcsvcdirty = 0;
return;
}
(void) memset((char *)&argument, 0, sizeof (argument));
if (!svc_getargs(transp, xdr_argument, (caddr_t) &argument)) {
svcerr_decode(transp);
_rpcsvcdirty = 0;
return;
}
result = (*local)(&argument, rqstp);
if (result != NULL && !svc_sendreply(transp, (xdrproc_t) xdr_result, result)) {
svcerr_systemerr(transp);
}
if (!svc_freeargs(transp, xdr_argument, (caddr_t) &argument)) {
_msgout("unable to free arguments");
exit(1);
}
_rpcsvcdirty = 0;
return;
}
int
main(argc, argv)
int argc;
char *argv[];
{
SVCXPRT *transp = NULL;
int sock;
int proto = 0;
struct sockaddr_in saddr;
int asize = sizeof (saddr);
if (getsockname(0, (struct sockaddr *)&saddr, &asize) == 0) {
int ssize = sizeof (int);
if (saddr.sin_family != AF_INET)
exit(1);
if (getsockopt(0, SOL_SOCKET, SO_TYPE,
(char *)&_rpcfdtype, &ssize) == -1)
exit(1);
sock = 0;
_rpcpmstart = 1;
proto = 0;
openlog("calculadora", LOG_PID, LOG_DAEMON);
} else {
#ifndef RPC_SVC_FG
int size;
int pid, i;
pid = fork();
if (pid < 0) {
perror("cannot fork");
exit(1);
}
if (pid)
exit(0);
size = getdtablesize();
for (i = 0; i < size; i++)
(void) close(i);
i = open("/dev/console", 2);
(void) dup2(i, 1);
(void) dup2(i, 2);
i = open("/dev/tty", 2);
if (i >= 0) {
(void) ioctl(i, TIOCNOTTY, (char *)NULL);
(void) close(i);
}
openlog("calculadora", LOG_PID, LOG_DAEMON);
#endif
sock = RPC_ANYSOCK;
(void) pmap_unset(CALCULADORA, LAB01);
}
if ((_rpcfdtype == 0) || (_rpcfdtype == SOCK_DGRAM)) {
transp = svcudp_create(sock);
if (transp == NULL) {
_msgout("cannot create udp service.");
exit(1);
}
if (!_rpcpmstart)
proto = IPPROTO_UDP;
if (!svc_register(transp, CALCULADORA, LAB01, calculadora_1, proto)) {
_msgout("unable to register (CALCULADORA, LAB01, udp).");
exit(1);
}
}
if ((_rpcfdtype == 0) || (_rpcfdtype == SOCK_STREAM)) {
if (_rpcpmstart)
transp = svcfd_create(sock, 0, 0);
else
transp = svctcp_create(sock, 0, 0);
if (transp == NULL) {
_msgout("cannot create tcp service.");
exit(1);
}
if (!_rpcpmstart)
proto = IPPROTO_TCP;
if (!svc_register(transp, CALCULADORA, LAB01, calculadora_1, proto)) {
_msgout("unable to register (CALCULADORA, LAB01, tcp).");
exit(1);
}
}
if (transp == (SVCXPRT *)NULL) {
_msgout("could not create a handle");
exit(1);
}
if (_rpcpmstart) {
(void) signal(SIGALRM, (void(*)()) closedown);
(void) alarm(_RPCSVC_CLOSEDOWN);
}
svc_run();
_msgout("svc_run returned");
exit(1);
/* NOTREACHED */
}
| [
"[email protected]"
] | |
372991c457309995e345923ce307dec5c2c82271 | 3a3d6ceb7849af27c5d8130e99c8d2a0c28e64ef | /clase08/ejercicio01/main.c | c5792b24fce438fef737734452123b23db48019c | [] | no_license | albornozsantiago93/programacionLaboratorio_C | 2697749f30076d59bcf2d709ec9b36db6f481bbd | b61c999ba7b98ca5c9439621a39778f372f72723 | refs/heads/master | 2020-05-07T05:38:13.303041 | 2019-08-01T20:04:17 | 2019-08-01T20:04:17 | 180,276,598 | 0 | 1 | null | null | null | null | UTF-8 | C | false | false | 702 | c | #include <stdio.h>
#include <stdlib.h>
//declarar una estructura de datos e imprimirlos
struct persona{
char apellido[31];
char nombre[31];
int edad;
int isEmpty;
};
int main()
{
struct persona persona; //DECLARO VARIABLE TICO STRUCT PERSONA persona.
printf("Ingrese Nombre:\n");
gets(persona.nombre);
printf("Ingrese apellido:\n");
gets(persona.apellido);
printf("Ingrese edad:\n");
scanf("%d",&persona.edad);
persona.isEmpty= 0;
system("cls");
printf("\n\nApellido: %s\nNombre: %s\nEdad: %d\n",persona.apellido,persona.nombre,persona.edad);
if(persona.isEmpty==0)
printf("Su estado es: OCUPADO\n");
return 0;
}
| [
"[email protected]"
] | |
3c89a6a0ba94ef6dd1ac669e3bafe0d6fd47ddab | 6b952cdc72c0503be0ee498b3332189b9f74db36 | /world/u/hacky/d/lingjiu/midao9.c | 75789a092cae5e2a88ee4aed89f1dd862ac7b585 | [] | no_license | wwwguess/4321 | 6d58e58396465ed6403b06b091e846227880a050 | 2322c6f5f34c594040a3bc352d9d1c63d77f2070 | refs/heads/master | 2021-01-17T10:52:06.325973 | 2017-04-28T02:43:35 | 2017-04-28T02:43:35 | 84,018,934 | 1 | 0 | null | null | null | null | GB18030 | C | false | false | 531 | c |
inherit ROOM;
void create()
{
set("short", "密道");
set("long", @LONG
你走着走着,突然发现你迷失了方向,你往回走的时候却发现那已不
是你来的道路了,你不禁心中一阵发麻。突然你在昏黄的灯光下,隐约发
现两边的汉白玉墙壁上刻着一些奇形怪状的符号(fuhao)。
LONG
);
set("exits", ([
"south" : __DIR__"midao13",
"north" : __DIR__"midao14",
"east" : __DIR__"midao10",
"west" : __DIR__"midao14",
]));
setup();
replace_program(ROOM);
} | [
"[email protected]"
] | |
d863c84734c5005e3f866a551a44855a6f9f8426 | 58f7201a49de05139e1cbedb4c4b7920142ff106 | /swtpm-utils/lib/tpm.h | e704e14e6d073893060d27ca960ba9525eecaa00 | [] | no_license | sly117/tpm-luks-new | ea8ce52741621a3a9e65709d31de1bd7807a484a | e364774ad3003965a5a4e25917f879401a41202a | refs/heads/master | 2021-01-17T17:39:14.262166 | 2016-05-31T18:37:05 | 2016-05-31T18:37:05 | 60,113,418 | 2 | 1 | null | null | null | null | UTF-8 | C | false | false | 6,504 | h | /********************************************************************************/
/* */
/* TPM Utilities */
/* Written by J. Kravitz */
/* IBM Thomas J. Watson Research Center */
/* $Id: tpm.h 4073 2010-04-30 14:44:14Z kgoldman $ */
/* */
/* (c) Copyright IBM Corporation 2006, 2010. */
/* */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or without */
/* modification, are permitted provided that the following conditions are */
/* met: */
/* */
/* Redistributions of source code must retain the above copyright notice, */
/* this list of conditions and the following disclaimer. */
/* */
/* Redistributions in binary form must reproduce the above copyright */
/* notice, this list of conditions and the following disclaimer in the */
/* documentation and/or other materials provided with the distribution. */
/* */
/* Neither the names of the IBM Corporation nor the names of its */
/* contributors may be used to endorse or promote products derived from */
/* this software without specific prior written permission. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
/* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
/* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR */
/* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */
/* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */
/* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */
/* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY */
/* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE */
/* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
/********************************************************************************/
#ifndef TPM_H
#define TPM_H
#include <string.h>
#include <stdint.h>
#ifdef TPM_POSIX
#include <netinet/in.h>
#endif
#ifdef TPM_WINDOWS
#include <winsock2.h>
#endif
#define ERR_MASK 0x80000000 /* mask to define error state */
/* keep 0x8001000 unassigned since the bash only sees the lowest byte! */
#define ERR_DUMMY 0x80001000
#define ERR_HMAC_FAIL 0x80001001 /* HMAC authorization verification failed */
#define ERR_NULL_ARG 0x80001002 /* An argument was NULL that shouldn't be */
#define ERR_BAD_ARG 0x80001003 /* An argument had an invalid value */
#define ERR_CRYPT_ERR 0x80001004 /* An error occurred in an OpenSSL library call */
#define ERR_IO 0x80001005 /* An I/O Error occured */
#define ERR_MEM_ERR 0x80001006 /* A memory allocation error occurred */
#define ERR_BAD_FILE 0x80001007 /* File error occurred */
#define ERR_BAD_DATA 0x80001008 /* data read from a stream were bad */
#define ERR_BAD_SIZE 0x80001009 /* the size of the data to send to the TPM is too large */
#define ERR_BUFFER 0x8000100a /* the size of the buffer is too small */
#define ERR_STRUCTURE 0x8000100b /* this is not the stream for the structure to be parsed */
#define ERR_NOT_FOUND 0x8000100c /* searched item could not be found */
#define ERR_ENV_VARIABLE 0x8000100d /* environment varaible is not set */
#define ERR_NO_TRANSPORT 0x8000100e /* no transport allowed for this ordinal */
#define ERR_BADRESPONSETAG 0x8000100f /* bad response tag in message */
#define ERR_SIGNATURE 0x80001010 /* bad signature */
#define ERR_PCR_LIST_NOT_IMA 0x80001011 /* PCR values do not correspond to that in IMA */
#define ERR_CHECKSUM 0x80001012 /* Checksum not correct */
#define ERR_BAD_RESP 0x80001013 /* response from TPM not formatted correctly */
#define ERR_BAD_SESSION_TYPE 0x80001014 /* session type choice is not good */
#define ERR_LAST 0x80001015 /* keep this as the last error code !!!! */
#define TPM_MAX_BUFF_SIZE 4096
#define TPM_HASH_SIZE 20
#define TPM_NONCE_SIZE 20
#define TPM_U16_SIZE 2
#define TPM_U32_SIZE 4
#define TPM_PARAMSIZE_OFFSET TPM_U16_SIZE
#define TPM_RETURN_OFFSET ( TPM_U16_SIZE + TPM_U32_SIZE )
#define TPM_DATA_OFFSET ( TPM_RETURN_OFFSET + TPM_U32_SIZE )
#define STORE32(buffer,offset,value) { *(uint32_t *)&buffer[offset] = htonl(value); }
#define STORE16(buffer,offset,value) { *(uint16_t *)&buffer[offset] = htons(value); }
#define STORE32N(buffer,offset,value) { *(uint32_t *)&buffer[offset] = value; }
#define STORE16N(buffer,offset,value) { *(uint16_t *)&buffer[offset] = value; }
#define LOAD32(buffer,offset) ( ntohl(*(uint32_t *)&buffer[offset]) )
#define LOAD16(buffer,offset) ( ntohs(*(uint16_t *)&buffer[offset]) )
#define LOAD32N(buffer,offset) ( *(uint32_t *)&buffer[offset] )
#define LOAD16N(buffer,offset) ( *(uint16_t *)&buffer[offset] )
#define TPM_CURRENT_TICKS_SIZE (sizeof(TPM_STRUCTURE_TAG)+2*TPM_U32_SIZE+TPM_U16_SIZE+TPM_NONCE_SIZE)
struct tpm_buffer
{
uint32_t size;
uint32_t used;
uint32_t flags;
unsigned char buffer[TPM_MAX_BUFF_SIZE];
};
enum {
BUFFER_FLAG_ON_STACK = 1,
};
#define STACK_TPM_BUFFER(X) \
struct tpm_buffer X = { \
.size = sizeof( X.buffer ), \
.used = 0, \
.flags = BUFFER_FLAG_ON_STACK, \
.buffer = ""};
#define RESET_TPM_BUFFER(X) \
(X)->used = 0
#define ALLOC_TPM_BUFFER(X,S) \
struct tpm_buffer *X = TSS_AllocTPMBuffer(S);
#define FREE_TPM_BUFFER(X) \
TSS_FreeTPMBuffer(X)
#define SET_TPM_BUFFER(X, src, len) \
do { \
uint32_t to_copy = (X)->size > len ? len : (X)->size; \
memcpy((X)->buffer, src, to_copy); \
(X)->used = to_copy; \
} while (0);
#define IS_TPM_BUFFER_EMPTY(X) \
((X)->used == 0)
struct tpm_buffer *TSS_AllocTPMBuffer(int len);
static inline struct tpm_buffer *clone_tpm_buffer(struct tpm_buffer *orig) {
struct tpm_buffer * buf = TSS_AllocTPMBuffer(orig->used + 20);
if (buf) {
SET_TPM_BUFFER(buf, orig->buffer, orig->used);
}
return buf;
}
#if defined (__x86_64__)
#define OUT_FORMAT(a,b) b
#else
#define OUT_FORMAT(a,b) a
#endif
#endif
| [
"[email protected]"
] | |
146a1ee75676288f3db05d925a9a6bf973392633 | 316f4353b638612e8f4c910bd23fa7e0a71e68c3 | /muxMedia/include/libRx/common/hi_adp_pvr.c | 63a0426e038e323cfbf0d5064becd6aeda230c0c | [] | no_license | jacklee032016/mediaPlay | 84ce51300a89345aa2002a485734a4d4d94e20b9 | ada79ffd5c730a2d534b798715efc54ea5a61459 | refs/heads/master | 2021-06-08T12:07:24.928006 | 2021-04-14T13:08:49 | 2021-04-14T13:08:49 | 142,894,932 | 0 | 1 | null | null | null | null | GB18030 | C | false | false | 55,564 | c | /**
\file
\brief common function of PVR
\copyright Shenzhen Hisilicon Co., Ltd.
\version draft
\author QuYaxin 46153
\date 2010-3-26
*/
#define _FILE_OFFSET_BITS 64
#include "hi_adp.h"
#include "hi_adp_pvr.h"
#include "hi_adp_mpi.h"
#include "hi_adp_demux.h"
//#define PVR_ADVCA_MODE /*if use ADVCA mode,define PVR_ADVCA_MODE*/
/***************************** Macro Definition ******************************/
/*************************** Structure Definition ****************************/
typedef struct hiTS_SEND_ARGS_S
{
HI_U32 u32DmxId;
HI_U32 u32PortId;
FILE *pTsFile;
} TS_SEND_ARGS_S;
typedef struct tagPVREventType
{
HI_U8 szEventTypeName[128];
HI_UNF_PVR_EVENT_E eEventID;
}PVR_EVENT_TYPE_ST;
typedef struct hiCODEC_VIDEO_CMD_S
{
HI_U32 u32CmdID; /**<Commond ID*/ /**<CNcomment: 命令ID*/
HI_VOID *pPara; /**<Control parameter*/ /**<CNcomment: 命令携带参数*/
}HI_CODEC_VIDEO_CMD_S;
/********************** Global Variable declaration **************************/
HI_BOOL g_bIsRecStop = HI_FALSE;
static HI_BOOL g_bStopTsThread = HI_FALSE;
HI_HANDLE g_hTsBufForPlayBack;
static HI_BOOL s_bSupportTvp = HI_FALSE;
static HI_BOOL s_bRegisterExtra = HI_FALSE;
static HI_BOOL s_bRegisterTeeExtra = HI_FALSE;
static PVR_EVENT_TYPE_ST g_stEventType[] = {
{"HI_UNF_PVR_EVENT_PLAY_EOF", HI_UNF_PVR_EVENT_PLAY_EOF},
{"HI_UNF_PVR_EVENT_PLAY_SOF", HI_UNF_PVR_EVENT_PLAY_SOF},
{"HI_UNF_PVR_EVENT_PLAY_ERROR", HI_UNF_PVR_EVENT_PLAY_ERROR},
{"HI_UNF_PVR_EVENT_PLAY_REACH_REC", HI_UNF_PVR_EVENT_PLAY_REACH_REC},
{"HI_UNF_PVR_EVENT_PLAY_RESV", HI_UNF_PVR_EVENT_PLAY_RESV},
{"HI_UNF_PVR_EVENT_REC_DISKFULL", HI_UNF_PVR_EVENT_REC_DISKFULL},
{"HI_UNF_PVR_EVENT_REC_ERROR", HI_UNF_PVR_EVENT_REC_ERROR},
{"HI_UNF_PVR_EVENT_REC_OVER_FIX", HI_UNF_PVR_EVENT_REC_OVER_FIX},
{"HI_UNF_PVR_EVENT_REC_REACH_PLAY", HI_UNF_PVR_EVENT_REC_REACH_PLAY},
{"HI_UNF_PVR_EVENT_REC_DISK_SLOW", HI_UNF_PVR_EVENT_REC_DISK_SLOW},
{"HI_UNF_PVR_EVENT_REC_RESV", HI_UNF_PVR_EVENT_REC_RESV},
{"HI_UNF_PVR_EVENT_BUTT", HI_UNF_PVR_EVENT_BUTT}
};
HI_U8* PVR_GetEventTypeStringByID(HI_UNF_PVR_EVENT_E eEventID);
/******************************* API declaration *****************************/
static HI_S32 PvrExtraCallback(HI_UNF_PVR_DATA_ATTR_S *pstDataAttr, HI_U8 *pu8DataAddr, HI_U32 u32PhyAddr, HI_U32 u32Offset, HI_U32 u32DataSize)
{
static HI_U32 u32Count = 0;
if ((HI_NULL != pstDataAttr) && (0 == u32Count % 1000))
{
PVR_SAMPLE_Printf("PvrExtraCallback::(addr, size, offset, u32Count) = (%p, %u, %lld, %u)\n",
pu8DataAddr, u32DataSize, pstDataAttr->u64GlobalOffset, u32Count);
}
u32Count++;
return HI_SUCCESS;
}
#if 0//安全录制回调函数参考实现(非安全侧)
#define TEE_PVR_COPY_TO_REE_SAMPLE 42
typedef struct hiUNF_PVR_CBBUF_INFO_S
{
HI_U8 *pu8VirAddr;
HI_U32 u32PhyAddr;
HI_U32 u32Len;
}HI_UNF_PVR_CBBUF_INFO_S;
typedef HI_S32 (*ExtendCallBack_New)(HI_UNF_PVR_DATA_ATTR_S *pstDataAttr,
HI_UNF_PVR_CBBUF_INFO_S *pstDstBuf,
HI_UNF_PVR_CBBUF_INFO_S *pstSrcBuf,
HI_U32 u32Offset,
HI_U32 u32DataSize,
HI_VOID *pUserData);
extern HI_S32 HI_PVR_RegisterExtendCallback(HI_U32 u32ChnID, HI_UNF_PVR_EXTRA_CALLBACK_E eExtraCallbackType, ExtendCallBack_New fCallback, HI_VOID *pUserData);
extern HI_S32 HI_PVR_UnRegisterExtendCallBack(HI_U32 u32ChnID, HI_UNF_PVR_EXTRA_CALLBACK_E eExtraCallbackType, ExtendCallBack_New fCallback);
typedef struct SAMPLE_TA_INFO_S_
{
HI_S32 s32InitCount;
TEEC_Context stContext;
TEEC_Session stSession;
}SAMPLE_TA_INFO_S;
SAMPLE_TA_INFO_S s_stTeeCtrlInfo =
{
.s32InitCount = 0,
};
static const TEEC_UUID SAMPLE_uuid =
{
0x88888888,
0x8888,
0x8888,
{
0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88
}
};
#if 0//安全录制回调函数参考实现(安全侧)
static TEE_Result PVRTACopyToREESample(TEE_Param stParams[4])
{
HI_U32 u32DataLength = 0;
HI_U8 *pDst = HI_NULL;
HI_U8 *pSrc = HI_NULL;
TEE_Result stRet = TEE_SUCCESS;
TEE_PVR_ENTER();
pDst = (HI_U8 *)HI_TEE_SMMU_NonsecSmmu_MapToCpu(stParams[1].value.a, HI_FALSE);
if (NULL == pDst)
{
return TEE_FAIL;
}
memset(pDst, 0x00, stParams[2].value.b);
if ((HI_NULL != stParams[2].value.a) && (0 != stParams[2].value.b))
{
pSrc = (HI_U8 *)HI_TEE_SMMU_MapToCpu(stParams[2].value.a, HI_FALSE);
if (HI_NULL != pSrc)
{
u32DataLength = stParams[2].value.b;
ASM_MemMove(pDst, pSrc, u32DataLength);
(HI_VOID)HI_TEE_SMMU_UnmapFromCpu(pSrc);
}
}
(HI_VOID)HI_TEE_SMMU_NonsecSmmu_UnmapFromCpu(pDst);
TEE_PVR_EXIT();
return stRet;
}
#endif
HI_S32 SampleTeeInit(HI_VOID)
{
TEEC_Result stResult;
if (HI_FALSE == s_bSupportTvp)
return HI_SUCCESS;
PVR_SAMPLE_Printf("\tENTER>>\n");
s_stTeeCtrlInfo.s32InitCount++;
if (1 == s_stTeeCtrlInfo.s32InitCount)
{
memset(&s_stTeeCtrlInfo.stContext, 0x00, sizeof(s_stTeeCtrlInfo.stContext));
memset(&s_stTeeCtrlInfo.stSession, 0x00, sizeof(s_stTeeCtrlInfo.stSession));
stResult = TEEC_InitializeContext(NULL, &s_stTeeCtrlInfo.stContext);
if(TEEC_SUCCESS != stResult)
{
s_stTeeCtrlInfo.s32InitCount--;
PVR_SAMPLE_Printf("TEEC init failed,ret = 0x%08x\n", (HI_U32)stResult);
return (HI_S32)stResult;
}
stResult = TEEC_OpenSession(&s_stTeeCtrlInfo.stContext,
&s_stTeeCtrlInfo.stSession,
&SAMPLE_uuid,
TEEC_LOGIN_PUBLIC,
NULL,
NULL,
NULL);
if(TEEC_SUCCESS != stResult)
{
s_stTeeCtrlInfo.s32InitCount--;
TEEC_FinalizeContext(&s_stTeeCtrlInfo.stContext);
PVR_SAMPLE_Printf("TEEC openSession failed,ret = 0x%08x\n", (HI_U32)stResult);
return (HI_S32)stResult;
}
PVR_SAMPLE_Printf("TEEC Init success!\n");
}
PVR_SAMPLE_Printf("\tEXIT>>\n");
return HI_SUCCESS;
}
HI_S32 SampleTeeDeInit(HI_VOID)
{
if (HI_FALSE == s_bSupportTvp)
return HI_SUCCESS;
PVR_SAMPLE_Printf("\tENTER>>\n");
if (0 >= s_stTeeCtrlInfo.s32InitCount)
{
PVR_SAMPLE_Printf("Not Init the PVR Tee!\n");
return HI_SUCCESS;
}
s_stTeeCtrlInfo.s32InitCount--;
if (0 == s_stTeeCtrlInfo.s32InitCount)
{
TEEC_CloseSession(&s_stTeeCtrlInfo.stSession);
TEEC_FinalizeContext(&s_stTeeCtrlInfo.stContext);
PVR_SAMPLE_Printf("TEEC deinit success!\n");
}
PVR_SAMPLE_Printf("\tEXIT>>\n");
return HI_SUCCESS;
}
HI_S32 PvrTeeRecordCallback(HI_UNF_PVR_DATA_ATTR_S *pstDataAttr,
HI_UNF_PVR_CBBUF_INFO_S *pstDstBuf,
HI_UNF_PVR_CBBUF_INFO_S *pstSrcBuf,
HI_U32 u32Offset,
HI_U32 u32DataSize,
HI_VOID *pUserData)
{
TEEC_Operation stCopyOperation;
TEEC_Result stResult;
HI_U32 u32Origin;
static HI_U32 s_u32Count = 0;
if ((HI_NULL == pstDataAttr)
|| (HI_NULL == pstDstBuf)
|| (HI_NULL == pstSrcBuf))
{
PVR_SAMPLE_Printf("null pointer(%#x, %#x, %#x)\n", (HI_U32)pstDataAttr, (HI_U32)pstDstBuf, (HI_U32)pstSrcBuf);
return HI_SUCCESS;
}
if (0x12345678 != (HI_U32)pUserData)
{
PVR_SAMPLE_Printf("wrong userdata(%#x)\n", (HI_U32)pUserData);
}
if (++s_u32Count % 1000 == 0)
{
PVR_SAMPLE_Printf("(GlobleOffset, datasize, dstAddr, srcAddr) = (0x%08llx, 0x%08x, %#x, %#x)\n",
pstDataAttr->u64GlobalOffset, u32DataSize, pstDstBuf->u32PhyAddr, pstSrcBuf->u32PhyAddr);
}
if ((u32DataSize != pstDstBuf->u32Len)
|| (u32DataSize != pstSrcBuf->u32Len))
{
PVR_SAMPLE_Printf("(u32DataSize, pstDstBuf->u32Len, pstSrcBuf->u32Len) = (%u, %u, %u)\n",
u32DataSize, pstDstBuf->u32Len, pstSrcBuf->u32Len);
return HI_SUCCESS;
}
memset(&stCopyOperation, 0x00, sizeof(stCopyOperation));
stCopyOperation.started = 1;
stCopyOperation.params[1].value.a = pstDstBuf->u32PhyAddr;
stCopyOperation.params[1].value.b = 0;
stCopyOperation.params[2].value.a = pstSrcBuf->u32PhyAddr;
stCopyOperation.params[2].value.b = u32DataSize;
stCopyOperation.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INOUT,
TEEC_VALUE_INOUT,
TEEC_VALUE_INOUT,
TEEC_NONE);
stResult = TEEC_InvokeCommand(&s_stTeeCtrlInfo.stSession,
TEE_PVR_COPY_TO_REE_SAMPLE,
&stCopyOperation,
&u32Origin);
if (TEEC_SUCCESS != stResult)
{
PVR_SAMPLE_Printf("Invoke failed, codes=0x%x, origin=0x%x\n", stResult, u32Origin);
return (HI_S32)stResult;
}
return HI_SUCCESS;
}
#endif
#if 1
HI_VOID SearchFileTsSendThread(HI_VOID *args)
{
HI_U32 u32Readlen;
HI_S32 Ret;
HI_HANDLE hTsBuf;
TS_SEND_ARGS_S *pstPara = args;
HI_UNF_STREAM_BUF_S stStreamBuf;
Ret = HI_UNF_DMX_AttachTSPort(pstPara->u32DmxId, pstPara->u32PortId);
if (HI_SUCCESS != Ret)
{
PVR_SAMPLE_Printf("call VoInit failed.\n");
return;
}
Ret = HI_UNF_DMX_CreateTSBuffer(pstPara->u32PortId, 0x200000, &hTsBuf);
if (Ret != HI_SUCCESS)
{
PVR_SAMPLE_Printf("call HI_UNF_DMX_CreateTSBuffer failed.\n");
return;
}
while (!g_bStopTsThread)
{
Ret = HI_UNF_DMX_GetTSBuffer(hTsBuf, 188*50, &stStreamBuf, 0);
if (Ret != HI_SUCCESS )
{
usleep(10 * 1000) ;
continue;
}
u32Readlen = fread(stStreamBuf.pu8Data, sizeof(HI_S8), 188*50, pstPara->pTsFile);
if(u32Readlen <= 0)
{
PVR_SAMPLE_Printf("read ts file error!\n");
rewind(pstPara->pTsFile);
continue;
}
Ret = HI_UNF_DMX_PutTSBuffer(hTsBuf, u32Readlen);
if (Ret != HI_SUCCESS )
{
PVR_SAMPLE_Printf("call HI_UNF_DMX_PutTSBuffer failed.\n");
}
}
Ret = HI_UNF_DMX_DestroyTSBuffer(hTsBuf);
if (Ret != HI_SUCCESS )
{
PVR_SAMPLE_Printf("call HI_UNF_DMX_DestroyTSBuffer failed.\n");
}
HI_UNF_DMX_DetachTSPort(pstPara->u32DmxId);
return;
}
HI_S32 PVR_SearchFile(HI_U32 u32DmxId, HI_U32 u32PortId, const HI_CHAR *pszFileName, PMT_COMPACT_TBL **ppProgTbl)
{
HI_S32 Ret;
pthread_t TsThd;
TS_SEND_ARGS_S stPara;
FILE *pTsFile;
pTsFile = fopen(pszFileName, "rb");
stPara.u32DmxId = u32DmxId;
stPara.u32PortId = u32PortId;
stPara.pTsFile = (FILE *)pTsFile;
g_bStopTsThread = HI_FALSE;
pthread_create(&TsThd, HI_NULL, (HI_VOID *)SearchFileTsSendThread, &stPara);
sleep(1);
HIADP_Search_Init();
Ret = HIADP_Search_GetAllPmt(u32DmxId, ppProgTbl);
if (Ret != HI_SUCCESS)
{
PVR_SAMPLE_Printf("call HIADP_Search_GetAllPmt failed.\n");
}
HIADP_Search_DeInit();
g_bStopTsThread =HI_TRUE;
pthread_join(TsThd, HI_NULL);
fclose(pTsFile);
return Ret;
}
#endif
HI_VOID PVR_SetTvpFlag(HI_BOOL bSupport)
{
s_bSupportTvp = bSupport;
return;
}
HI_VOID PVR_SetCallbackFlag(HI_BOOL bExtra, HI_BOOL bExtendTee)
{
s_bRegisterExtra = bExtra;
s_bRegisterTeeExtra = bExtendTee;
return;
}
HI_S32 PVR_SavePorgInfo(PVR_PROG_INFO_S *pstProgInfo, HI_CHAR *pszPvrRecFile)
{
HI_S32 ret;
PVR_PROG_INFO_S stUserData;
SAMPLE_CheckNullPTR(pstProgInfo);
memcpy(&stUserData, pstProgInfo, sizeof(PVR_PROG_INFO_S));
stUserData.u32MagicNumber = PVR_PROG_INFO_MAGIC;
ret = HI_UNF_PVR_SetUsrDataInfoByFileName(pszPvrRecFile, (HI_U8*)&stUserData, sizeof(PVR_PROG_INFO_S));
if (HI_SUCCESS != ret)
{
PVR_SAMPLE_Printf("PVR_SetUsrDataInfoByFileName ERR:%#x.\n", ret);
return ret;
}
usleep(10*1000);
PVR_SAMPLE_Printf("\n------------------\n");
PVR_SAMPLE_Printf("File Info:\n");
PVR_SAMPLE_Printf("Pid: A=%d/%#x, V=%d/%#x.\n",pstProgInfo->AElementPid,
pstProgInfo->AElementPid,
pstProgInfo->VElementPid,
pstProgInfo->VElementPid);
PVR_SAMPLE_Printf("Type: A=%d, V=%d.\n", pstProgInfo->AudioType, pstProgInfo->VideoType);
PVR_SAMPLE_Printf("isClearStream: %d, isEncrypt: %d.\n", pstProgInfo->stRecAttr.bIsClearStream, pstProgInfo->stRecAttr.stEncryptCfg.bDoCipher);
PVR_SAMPLE_Printf("indexType: %d, bRewind: %d. u64MaxSize: 0x%llx\n", pstProgInfo->stRecAttr.enIndexType, pstProgInfo->stRecAttr.bRewind, pstProgInfo->stRecAttr.u64MaxFileSize);
PVR_SAMPLE_Printf("------------------\n\n");
usleep(10*1000);
return HI_SUCCESS;
}
HI_S32 PVR_GetPorgInfo(PVR_PROG_INFO_S *pstProgInfo, const HI_CHAR *pszPvrRecFile)
{
HI_S32 ret;
HI_U32 u32DataRead;
PVR_PROG_INFO_S stUserData;
SAMPLE_CheckNullPTR(pstProgInfo);
SAMPLE_CheckNullPTR(pszPvrRecFile);
ret = HI_UNF_PVR_GetUsrDataInfoByFileName(pszPvrRecFile, (HI_U8*)&stUserData,
sizeof(PVR_PROG_INFO_S), &u32DataRead);
if (HI_SUCCESS != ret)
{
PVR_SAMPLE_Printf("PVR_SetUsrDataInfoByFileName ERR:%#x.\n", ret);
return ret;
}
if (PVR_PROG_INFO_MAGIC == stUserData.u32MagicNumber)
{
memcpy(pstProgInfo, &(stUserData), sizeof(PVR_PROG_INFO_S));
}
else
{
//HI_U32 temp1 = 0;
PVR_SAMPLE_Printf("Can only play the program record by sample. \n");
return HI_FAILURE;
}
usleep(10*1000);
PVR_SAMPLE_Printf("\n------------------\n");
PVR_SAMPLE_Printf("File Info:\n");
if (pstProgInfo->AElementNum > 0)
{
PVR_SAMPLE_Printf("Audio:\n");
PVR_SAMPLE_Printf(" PID = %#x\n",pstProgInfo->AElementPid);
PVR_SAMPLE_Printf(" Type= %d\n", pstProgInfo->AudioType);
}
else
{
PVR_SAMPLE_Printf("Audio: none\n");
}
if (pstProgInfo->VElementNum > 0)
{
PVR_SAMPLE_Printf("Video:\n");
PVR_SAMPLE_Printf(" PID = %#x\n",pstProgInfo->VElementPid);
PVR_SAMPLE_Printf(" Type= %d\n", pstProgInfo->VideoType);
}
else
{
PVR_SAMPLE_Printf("Video: none\n\n");
}
PVR_SAMPLE_Printf("isClearStream: %d, isEncrypt: %d.\n", pstProgInfo->stRecAttr.bIsClearStream, pstProgInfo->stRecAttr.stEncryptCfg.bDoCipher);
PVR_SAMPLE_Printf("indexType: %d, bRewind: %d. u64MaxSize: 0x%llx\n", pstProgInfo->stRecAttr.enIndexType, pstProgInfo->stRecAttr.bRewind, pstProgInfo->stRecAttr.u64MaxFileSize);
PVR_SAMPLE_Printf("------------------\n");
usleep(10*1000);
return HI_SUCCESS;
}
HI_S32 PVR_checkIdx(char *pfileName)
{
HI_S32 ret = 0;
HI_S32 s32Pos;
HI_S32 s32ReadNum;
HI_S32 s32FileTsFd;
PVR_IDX_HEADER_INFO_S stHeadInfo = {0};
FILE *fpIndex;
char indexName[256];
snprintf(indexName, sizeof(indexName), "%s.idx", pfileName);
fpIndex = fopen(indexName, "rb");
if (NULL == fpIndex)
{
PVR_SAMPLE_Printf("can't open index file %s to read!\n", indexName);
return 2;
}
s32FileTsFd = open(pfileName, O_RDONLY);
if (s32FileTsFd == -1)
{
PVR_SAMPLE_Printf("can't open ts file %s to read!\n", pfileName);
fclose(fpIndex);
return 2;
}
fseek(fpIndex, 0, SEEK_END);
s32Pos = ftell(fpIndex);
rewind(fpIndex);
s32ReadNum = fread(&stHeadInfo, 1, sizeof(PVR_IDX_HEADER_INFO_S), fpIndex);
if (s32ReadNum != sizeof(PVR_IDX_HEADER_INFO_S))
{
perror("read failed:");
PVR_SAMPLE_Printf("read head failed: want=%zu, get=%d\n", sizeof(PVR_IDX_HEADER_INFO_S), s32ReadNum);
return 3;
}
else
{
if (stHeadInfo.u32StartCode == 0x5A5A5A5A)
{
PVR_SAMPLE_Printf("This index file has head info: head size=%u, fileSize=%llu\n", stHeadInfo.u32HeaderLen, stHeadInfo.u64ValidSize);
PVR_SAMPLE_Printf(", index file size:%d, headifo len:%d\n", s32Pos, stHeadInfo.u32HeaderLen);
fseek(fpIndex, stHeadInfo.u32HeaderLen, SEEK_SET);
}
else
{
PVR_SAMPLE_Printf("This index file has NO head info\n");
return 3;
}
}
PVR_SAMPLE_Printf("\nframe info:\n");
PVR_SAMPLE_Printf("====frame start:%d\n", stHeadInfo.stCycInfo.u32StartFrame);
PVR_SAMPLE_Printf("====frame end: %d\n", stHeadInfo.stCycInfo.u32EndFrame);
PVR_SAMPLE_Printf("====frame last: %d\n", stHeadInfo.stCycInfo.u32LastFrame);
close(s32FileTsFd);
fclose(fpIndex);
if (ret)
{
PVR_SAMPLE_Printf("\n------------End of file. index check failed, err:%d-------\n", ret);
}
else
{
PVR_SAMPLE_Printf("\n------------End of file. index check ok-------\n");
}
return ret;
}
HI_S32 PVR_RecStart(char *path, PMT_COMPACT_PROG *pstProgInfo, HI_U32 u32DemuxID,
HI_BOOL bRewind, HI_BOOL bDoCipher, HI_U64 u64MaxSize, HI_U32 *pu32RecChn)
{
HI_U32 u32RecChn;
HI_S32 ret = HI_SUCCESS;
HI_U32 u32VidPid = 0;
HI_U32 u32AudPid = 0;
HI_UNF_PVR_REC_ATTR_S stRecAttr;
PVR_PROG_INFO_S stFileInfo;
HI_CHAR szFileName[PVR_MAX_FILENAME_LEN];
stRecAttr.u32DemuxID = u32DemuxID;
if (pstProgInfo->AElementNum > 0)
{
u32AudPid = pstProgInfo->AElementPid;
}
if (pstProgInfo->VElementNum > 0)
{
u32VidPid = pstProgInfo->VElementPid;
stRecAttr.u32IndexPid = u32VidPid;
stRecAttr.enIndexType = HI_UNF_PVR_REC_INDEX_TYPE_VIDEO;
stRecAttr.enIndexVidType = pstProgInfo->VideoType;
}
else
{
stRecAttr.u32IndexPid = u32AudPid;
stRecAttr.enIndexType = HI_UNF_PVR_REC_INDEX_TYPE_AUDIO;
stRecAttr.enIndexVidType = HI_UNF_VCODEC_TYPE_BUTT;
}
snprintf(szFileName, sizeof(szFileName), "rec_v%d_a%d.ts",
pstProgInfo->VElementPid,
pstProgInfo->AElementPid);
snprintf(stRecAttr.szFileName, sizeof(stRecAttr.szFileName), "%s/", path);
strncat(stRecAttr.szFileName, szFileName, sizeof(szFileName) - strlen(stRecAttr.szFileName));
stRecAttr.u32FileNameLen = strlen(stRecAttr.szFileName);
stRecAttr.u32ScdBufSize = PVR_STUB_SC_BUF_SZIE;
stRecAttr.u32DavBufSize = PVR_STUB_TSDATA_SIZE;
stRecAttr.enStreamType = HI_UNF_PVR_STREAM_TYPE_TS;
stRecAttr.bRewind = bRewind;
stRecAttr.u64MaxFileSize= u64MaxSize;//source;
stRecAttr.u64MaxTimeInMs= 0;
stRecAttr.bIsClearStream = HI_TRUE;
stRecAttr.u32UsrDataInfoSize = sizeof(PVR_PROG_INFO_S) + 100;/*the one in index file is a multipleit of 40 bytes*//*CNcomment:索引文件里是40个字节对齐的*/
if (HI_FALSE != s_bSupportTvp)
{
stRecAttr.enSecureMode = HI_UNF_PVR_SECURE_MODE_TEE;
stRecAttr.stEncryptCfg.bDoCipher = HI_FALSE;
}
else
{
stRecAttr.enSecureMode = HI_UNF_PVR_SECURE_MODE_NONE;
stRecAttr.stEncryptCfg.bDoCipher = bDoCipher;
}
stRecAttr.stEncryptCfg.enType = HI_UNF_CIPHER_ALG_AES;
stRecAttr.stEncryptCfg.u32KeyLen = 16; /*strlen(PVR_CIPHER_KEY)*/
SAMPLE_RUN(HI_UNF_PVR_RecCreateChn(&u32RecChn, &stRecAttr), ret);
if (HI_SUCCESS != ret)
{
return ret;
}
if (HI_FALSE != s_bRegisterExtra)
{
HI_UNF_PVR_RegisterExtraCallback(u32RecChn, HI_UNF_PVR_EXTRA_WRITE_CALLBACK, PvrExtraCallback, HI_NULL);
}
if (HI_FALSE != s_bRegisterTeeExtra)
{
//HI_PVR_RegisterExtendCallback(u32RecChn, HI_UNF_PVR_EXTRA_WRITE_CALLBACK, PvrTeeRecordCallback, (HI_VOID *)0x12345678);
/*
*if s_bRegisterExtra == HI_TRUE for tee record, app must register a callback using HI_UNF_PVR_RegisterExtendCallback.
*the callback shall encrypt the ts data, and copy the ts data from the tee to the ree buffer, reference the PvrTeeRecordCallback
*/
}
if ((HI_FALSE != s_bRegisterExtra) && (HI_FALSE != s_bRegisterTeeExtra))
{
PVR_SAMPLE_Printf("[%s_%s_%d]Both callback has been registered, This isn't a good thing!\n",
__FILE__, __FUNCTION__, __LINE__);
}
SAMPLE_RUN(HI_UNF_PVR_RecAddPID(u32RecChn, 0), ret);
SAMPLE_RUN(HI_UNF_PVR_RecAddPID(u32RecChn, pstProgInfo->PmtPid), ret);
if (pstProgInfo->AElementNum > 0)
{
SAMPLE_RUN(HI_UNF_PVR_RecAddPID(u32RecChn, u32AudPid), ret);
}
if (pstProgInfo->VElementNum > 0)
{
SAMPLE_RUN(HI_UNF_PVR_RecAddPID(u32RecChn, u32VidPid), ret);
}
SAMPLE_RUN(HI_UNF_PVR_RecStartChn(u32RecChn), ret);
if (HI_SUCCESS != ret)
{
HI_UNF_PVR_RecDelAllPID(u32RecChn);
HI_UNF_PVR_RecDestroyChn(u32RecChn);
return ret;
}
stFileInfo.ProgID = pstProgInfo->ProgID;
stFileInfo.PmtPid = pstProgInfo->PmtPid;
stFileInfo.PcrPid = pstProgInfo->PcrPid;
stFileInfo.VideoType = pstProgInfo->VideoType;
stFileInfo.VElementNum = pstProgInfo->VElementNum;
stFileInfo.VElementPid = pstProgInfo->VElementPid;
stFileInfo.AudioType = pstProgInfo->AudioType;
stFileInfo.AElementNum = pstProgInfo->AElementNum;
stFileInfo.AElementPid = pstProgInfo->AElementPid;
memcpy(stFileInfo.Audioinfo, pstProgInfo->Audioinfo, PROG_MAX_AUDIO*sizeof(PMT_AUDIO));
stFileInfo.SubtType = pstProgInfo->SubtType;
stFileInfo.u16SubtitlingNum = pstProgInfo->u16SubtitlingNum;
memcpy(stFileInfo.SubtitingInfo, pstProgInfo->SubtitingInfo, SUBTITLING_MAX*sizeof(PMT_SUBTITLE));
memcpy(&(stFileInfo.stSCTESubtInfo), &(pstProgInfo->stSCTESubtInfo), sizeof(PMT_SCTE_SUBTITLE_S));
stFileInfo.u16ClosedCaptionNum = pstProgInfo->u16ClosedCaptionNum;
memcpy(stFileInfo.stClosedCaption, pstProgInfo->stClosedCaption, CAPTION_SERVICE_MAX*sizeof(PMT_CLOSED_CAPTION_S));
stFileInfo.u16ARIBCCPid = pstProgInfo->u16ARIBCCPid;
stFileInfo.u16TtxNum = pstProgInfo->u16TtxNum;
memcpy(stFileInfo.stTtxInfo, pstProgInfo->stTtxInfo, TTX_MAX*sizeof(PMT_TTX_S));
memcpy(&(stFileInfo.stRecAttr), &stRecAttr, sizeof(stFileInfo.stRecAttr));
SAMPLE_RUN(PVR_SavePorgInfo(&stFileInfo, stRecAttr.szFileName), ret);
if (HI_SUCCESS != ret)
{
HI_UNF_PVR_RecStopChn(u32RecChn);
HI_UNF_PVR_RecDelAllPID(u32RecChn);
HI_UNF_PVR_RecDestroyChn(u32RecChn);
return ret;
}
*pu32RecChn = u32RecChn;
return HI_SUCCESS;
}
HI_S32 PVR_RecStop(HI_U32 u32RecChnID)
{
HI_S32 ret;
HI_S32 ret2;
HI_UNF_PVR_REC_ATTR_S stRecAttr;
SAMPLE_RUN(HI_UNF_PVR_RecGetChn(u32RecChnID, &stRecAttr), ret2);
SAMPLE_RUN(HI_UNF_PVR_RecStopChn(u32RecChnID), ret);
SAMPLE_RUN(HI_UNF_PVR_RecDelAllPID(u32RecChnID), ret);
if (HI_FALSE != s_bSupportTvp)
{
//HI_PVR_UnRegisterExtendCallBack(u32RecChnID, HI_UNF_PVR_EXTRA_WRITE_CALLBACK, PvrTeeRecordCallback);
}
SAMPLE_RUN(HI_UNF_PVR_RecDestroyChn(u32RecChnID), ret);
if (HI_SUCCESS == ret2)
{
if (!stRecAttr.stEncryptCfg.bDoCipher)
{
//SAMPLE_RUN(PVR_checkIdx(stRecAttr.szFileName), ret);
}
}
return ret;
}
HI_S32 PVR_SwitchDmxSource(HI_U32 dmxId, HI_U32 protId)
{
HI_S32 ret;
HI_UNF_DMX_DetachTSPort(dmxId);
SAMPLE_RUN(HI_UNF_DMX_AttachTSPort(dmxId, protId), ret);
return ret;
}
HI_S32 PVR_SetAvplayPidAndCodecType(HI_HANDLE hAvplay, const PMT_COMPACT_PROG *pProgInfo)
{
// HI_U32 i;
HI_U32 u32VidPid;
HI_U32 u32AudPid;
HI_U32 u32AudType;
HI_S32 Ret;
HI_UNF_VCODEC_TYPE_E enVidType;
HI_UNF_VCODEC_ATTR_S stVdecAttr;
HI_UNF_ACODEC_ATTR_S stAdecAttr;
//HI_UNF_AVPLAY_STOP_OPT_S stStopOption;
/*
stStopOption.enMode = HI_UNF_AVPLAY_STOP_MODE_BLACK;
stStopOption.u32TimeoutMs = 0;
Ret = HI_UNF_AVPLAY_Stop(hAvplay, HI_UNF_AVPLAY_MEDIA_CHAN_VID | HI_UNF_AVPLAY_MEDIA_CHAN_AUD, &stStopOption);
if (Ret != HI_SUCCESS )
{
PVR_SAMPLE_Printf("call HI_UNF_AVPLAY_Stop failed.\n");
//return Ret;
}
*/
HI_UNF_AVPLAY_GetAttr(hAvplay, HI_UNF_AVPLAY_ATTR_ID_VDEC, &stVdecAttr);
HI_UNF_AVPLAY_GetAttr(hAvplay, HI_UNF_AVPLAY_ATTR_ID_ADEC, &stAdecAttr);
if (pProgInfo->VElementNum > 0)
{
u32VidPid = pProgInfo->VElementPid;
enVidType = pProgInfo->VideoType;
}
else
{
u32VidPid = INVALID_TSPID;
enVidType = HI_UNF_VCODEC_TYPE_BUTT;
}
if (pProgInfo->AElementNum > 0)
{
u32AudPid = pProgInfo->AElementPid;
u32AudType = pProgInfo->AudioType;
}
else
{
u32AudPid = INVALID_TSPID;
u32AudType = 0xffffffff;
}
if (u32VidPid != INVALID_TSPID)
{
stVdecAttr.enType = enVidType;
Ret = HI_UNF_AVPLAY_SetAttr(hAvplay, HI_UNF_AVPLAY_ATTR_ID_VDEC, &stVdecAttr);
if (Ret != HI_SUCCESS)
{
PVR_SAMPLE_Printf("call HI_UNF_AVPLAY_SetAttr failed.\n");
return Ret;
}
Ret = HI_UNF_AVPLAY_SetAttr(hAvplay, HI_UNF_AVPLAY_ATTR_ID_VID_PID, &u32VidPid);
if (Ret != HI_SUCCESS)
{
PVR_SAMPLE_Printf("call HI_UNF_AVPLAY_SetAttr failed.\n");
return Ret;
}
}
if (u32AudPid != INVALID_TSPID)
{
Ret = HIADP_AVPlay_SetAdecAttr(hAvplay, u32AudType, HD_DEC_MODE_RAWPCM, 1);
Ret |= HI_UNF_AVPLAY_SetAttr(hAvplay, HI_UNF_AVPLAY_ATTR_ID_AUD_PID, &u32AudPid);
if (HI_SUCCESS != Ret)
{
PVR_SAMPLE_Printf("HIADP_AVPlay_SetAdecAttr failed:%#x\n",Ret);
return Ret;
}
}
return HI_SUCCESS;
}
/*set audio and video PID attribution,start to play*//*CNcomment:设置音视频PID属性,开始播放*/
HI_S32 PVR_StartLivePlay(HI_HANDLE hAvplay, const PMT_COMPACT_PROG *pProgInfo)
{
HI_U32 ret = HI_SUCCESS;
HI_U32 u32Pid = 0;
HI_UNF_AVPLAY_MEDIA_CHAN_E enMediaType = 0;
HI_UNF_AVPLAY_FRMRATE_PARAM_S stFrmRateAttr = {0};
HI_UNF_SYNC_ATTR_S stSyncAttr = {0};
HI_CODEC_VIDEO_CMD_S stVdecCmdPara = {0};
HI_UNF_AVPLAY_TPLAY_OPT_S stTplayOpts = {0};
PVR_SetAvplayPidAndCodecType(hAvplay, pProgInfo);
ret = HI_UNF_AVPLAY_GetAttr(hAvplay, HI_UNF_AVPLAY_ATTR_ID_AUD_PID, &u32Pid);
if ((HI_SUCCESS != ret) || (0x1fff == u32Pid))
{
PVR_SAMPLE_Printf("has no audio stream!\n");
}
else
{
enMediaType |= HI_UNF_AVPLAY_MEDIA_CHAN_AUD;
}
ret = HI_UNF_AVPLAY_GetAttr(hAvplay, HI_UNF_AVPLAY_ATTR_ID_VID_PID, &u32Pid);
if ((HI_SUCCESS != ret) || (0x1fff == u32Pid))
{
PVR_SAMPLE_Printf("has no video stream!\n");
}
else
{
enMediaType |= HI_UNF_AVPLAY_MEDIA_CHAN_VID;
}
if ((enMediaType & HI_UNF_AVPLAY_MEDIA_CHAN_AUD) && (enMediaType & HI_UNF_AVPLAY_MEDIA_CHAN_VID))
{
/*enable vo frame rate detect*//*CNcomment:使能VO自动帧率检测*/
stFrmRateAttr.enFrmRateType = HI_UNF_AVPLAY_FRMRATE_TYPE_PTS;
stFrmRateAttr.stSetFrmRate.u32fpsInteger = 0;
stFrmRateAttr.stSetFrmRate.u32fpsDecimal = 0;
if (HI_SUCCESS != HI_UNF_AVPLAY_SetAttr(hAvplay, HI_UNF_AVPLAY_ATTR_ID_FRMRATE_PARAM, &stFrmRateAttr))
{
PVR_SAMPLE_Printf("set frame to VO fail.\n");
return HI_FAILURE;
}
/*enable avplay A/V sync*//*CNcomment:使能avplay音视频同步*/
if (HI_SUCCESS != HI_UNF_AVPLAY_GetAttr(hAvplay, HI_UNF_AVPLAY_ATTR_ID_SYNC, &stSyncAttr))
{
PVR_SAMPLE_Printf("get avplay sync stRecAttr fail!\n");
return HI_FAILURE;
}
stSyncAttr.enSyncRef = HI_UNF_SYNC_REF_AUDIO;
stSyncAttr.stSyncStartRegion.s32VidPlusTime = 60;
stSyncAttr.stSyncStartRegion.s32VidNegativeTime = -20;
stSyncAttr.u32PreSyncTimeoutMs = 1000;
stSyncAttr.bQuickOutput = HI_FALSE;
if (HI_SUCCESS != HI_UNF_AVPLAY_SetAttr(hAvplay, HI_UNF_AVPLAY_ATTR_ID_SYNC, &stSyncAttr))
{
PVR_SAMPLE_Printf("set avplay sync stRecAttr fail!\n");
return HI_FAILURE;
}
}
/*start to play audio and video*//*CNcomment:开始音视频播放*/
SAMPLE_RUN(HI_UNF_AVPLAY_Start(hAvplay, enMediaType, NULL), ret);
if (HI_SUCCESS != ret)
{
return ret;
}
/*set avplay trick mode to normal*//*CNcomment:设置avplay特技模式为正常*/
if (enMediaType & HI_UNF_AVPLAY_MEDIA_CHAN_VID)
{
stTplayOpts.enTplayDirect = HI_UNF_AVPLAY_TPLAY_DIRECT_FORWARD;
stTplayOpts.u32SpeedInteger = 1;
stTplayOpts.u32SpeedDecimal = 0;
stVdecCmdPara.u32CmdID = HI_UNF_AVPLAY_SET_TPLAY_PARA_CMD;
stVdecCmdPara.pPara = &stTplayOpts;
ret = HI_UNF_AVPLAY_Invoke(hAvplay, HI_UNF_AVPLAY_INVOKE_VCODEC, (void *)&stVdecCmdPara);
if (HI_SUCCESS != ret)
{
PVR_SAMPLE_Printf("Resume Avplay trick mode to normal fail.\n");
return HI_FAILURE;
}
}
return HI_SUCCESS;
}
HI_S32 PVR_StopLivePlay(HI_HANDLE hAvplay)
{
HI_UNF_AVPLAY_STOP_OPT_S stStopOption;
stStopOption.enMode = HI_UNF_AVPLAY_STOP_MODE_STILL;
stStopOption.u32TimeoutMs = 0;
PVR_SAMPLE_Printf("stop live play ...\n");
/*stop playing audio and video*//*CNcomment:停止音视频设备*/
return HI_UNF_AVPLAY_Stop(hAvplay, HI_UNF_AVPLAY_MEDIA_CHAN_VID | HI_UNF_AVPLAY_MEDIA_CHAN_AUD, &stStopOption);
}
/*start playback*//*CNcomment:开始回放*/
HI_S32 PVR_StartPlayBack(const HI_CHAR *pszFileName, HI_U32 *pu32PlayChn, HI_HANDLE hAvplay)
{
HI_S32 ret;
HI_U32 u32PlayChn;
HI_U32 u32Pid = 0;
PVR_PROG_INFO_S stFileInfo;
HI_UNF_PVR_PLAY_ATTR_S stPlayAttr;
PMT_COMPACT_TBL *pstPmttal;
HI_UNF_AVPLAY_MEDIA_CHAN_E enMediaType = 0;
HI_UNF_AVPLAY_FRMRATE_PARAM_S stFrmRateAttr = {0};
HI_UNF_SYNC_ATTR_S stSyncAttr = {0};
HI_UNF_AVPLAY_TPLAY_OPT_S stTplayOpts = {0};
HI_CODEC_VIDEO_CMD_S stVdecCmdPara = {0};
PMT_COMPACT_PROG stProgInfoTmp;
SAMPLE_CheckNullPTR(pszFileName);
SAMPLE_CheckNullPTR(pu32PlayChn);
SAMPLE_RUN(PVR_GetPorgInfo(&stFileInfo, pszFileName), ret);
if (HI_SUCCESS != ret)
{
PRINT_SMP("Can NOT get prog INFO, can't play.\n");
PVR_SearchFile(PVR_DMX_ID_LIVE, PVR_DMX_PORT_ID_PLAYBACK, pszFileName, &pstPmttal);
PVR_SetAvplayPidAndCodecType(hAvplay, &(pstPmttal->proginfo[0]));
memcpy(stPlayAttr.szFileName, pszFileName, strlen(pszFileName) + 1);
stPlayAttr.u32FileNameLen = strlen(pszFileName);
stPlayAttr.enStreamType = HI_UNF_PVR_STREAM_TYPE_TS;
stPlayAttr.bIsClearStream = HI_TRUE;
}
else
{
stProgInfoTmp.ProgID = stFileInfo.ProgID;
stProgInfoTmp.PmtPid = stFileInfo.PmtPid;
stProgInfoTmp.PcrPid = stFileInfo.PcrPid;
stProgInfoTmp.VideoType = stFileInfo.VideoType;
stProgInfoTmp.VElementNum = stFileInfo.VElementNum;
stProgInfoTmp.VElementPid = stFileInfo.VElementPid;
stProgInfoTmp.AudioType = stFileInfo.AudioType;
stProgInfoTmp.AElementNum = stFileInfo.AElementNum;
stProgInfoTmp.AElementPid = stFileInfo.AElementPid;
memcpy(stProgInfoTmp.Audioinfo, stFileInfo.Audioinfo, PROG_MAX_AUDIO*sizeof(PMT_AUDIO));
stProgInfoTmp.SubtType = stFileInfo.SubtType;
stProgInfoTmp.u16SubtitlingNum = stFileInfo.u16SubtitlingNum;
memcpy(stProgInfoTmp.SubtitingInfo, stFileInfo.SubtitingInfo, SUBTITLING_MAX*sizeof(PMT_SUBTITLE));
memcpy(&(stProgInfoTmp.stSCTESubtInfo), &(stFileInfo.stSCTESubtInfo), sizeof(PMT_SCTE_SUBTITLE_S));
stProgInfoTmp.u16ClosedCaptionNum = stFileInfo.u16ClosedCaptionNum;
memcpy(stProgInfoTmp.stClosedCaption, stFileInfo.stClosedCaption, CAPTION_SERVICE_MAX*sizeof(PMT_CLOSED_CAPTION_S));
stProgInfoTmp.u16ARIBCCPid = stFileInfo.u16ARIBCCPid;
stProgInfoTmp.u16TtxNum = stFileInfo.u16TtxNum;
memcpy(stProgInfoTmp.stTtxInfo, stFileInfo.stTtxInfo, TTX_MAX*sizeof(PMT_TTX_S));
PVR_SetAvplayPidAndCodecType(hAvplay, &(stProgInfoTmp));
memcpy(stPlayAttr.szFileName, pszFileName, strlen(pszFileName) + 1);
stPlayAttr.u32FileNameLen = strlen(pszFileName);
stPlayAttr.enStreamType = stFileInfo.stRecAttr.enStreamType;
stPlayAttr.bIsClearStream = stFileInfo.stRecAttr.bIsClearStream;
}
if (1 == stFileInfo.stRecAttr.stEncryptCfg.bDoCipher&&ret==HI_SUCCESS)
{
memcpy(&(stPlayAttr.stDecryptCfg), &(stFileInfo.stRecAttr.stEncryptCfg), sizeof(HI_UNF_PVR_CIPHER_S));
PVR_SAMPLE_Printf("cipher info:\n");
PVR_SAMPLE_Printf(" enType:%d\n", stPlayAttr.stDecryptCfg.enType);
}
else
{
PVR_SAMPLE_Printf("cipher info: not encrypt\n");
stPlayAttr.stDecryptCfg.bDoCipher = HI_FALSE;
}
if (HI_FALSE != s_bSupportTvp)
{
if (HI_FALSE != stPlayAttr.stDecryptCfg.bDoCipher)
{
PVR_SAMPLE_Printf("can't support tvp and cipher at the same time! it will try to close cipher\n");
stPlayAttr.stDecryptCfg.bDoCipher = HI_FALSE;
}
stPlayAttr.enSecureMode = HI_UNF_PVR_SECURE_MODE_TEE;
}
else
{
stPlayAttr.enSecureMode = HI_UNF_PVR_SECURE_MODE_NONE;
}
ret = HI_UNF_DMX_AttachTSPort(PVR_DMX_ID_LIVE, PVR_DMX_PORT_ID_PLAYBACK);
if (ret != HI_SUCCESS)
{
PVR_SAMPLE_Printf("call HI_UNF_DMX_AttachTSPort failed.\n");
HI_UNF_DMX_DeInit();
return ret;
}
SAMPLE_RUN(HI_UNF_DMX_CreateTSBuffer(PVR_DMX_PORT_ID_PLAYBACK, 768*1024, &g_hTsBufForPlayBack), ret);
if (ret != HI_SUCCESS)
{
HI_UNF_DMX_DetachTSPort(PVR_DMX_ID_LIVE);
HI_UNF_DMX_DeInit();
return ret;
}
/*create new play channel*//*CNcomment:申请新的播放通道*/
SAMPLE_RUN(HI_UNF_PVR_PlayCreateChn(&u32PlayChn, &stPlayAttr, hAvplay, g_hTsBufForPlayBack), ret);
if (HI_SUCCESS != ret)
{
return ret;
}
if (HI_FALSE != s_bRegisterExtra)
{
HI_UNF_PVR_RegisterExtraCallback(u32PlayChn, HI_UNF_PVR_EXTRA_READ_CALLBACK, PvrExtraCallback, HI_NULL);
}
/*
*if s_bRegisterExtra == HI_TRUE for tee play, app must register a callback using HI_UNF_PVR_RegisterExtendCallback.
*the callback shall config the demux with suitable key, not use the sample callback PvrTeeExtendCallback
*/
if (HI_FALSE != s_bRegisterTeeExtra)
{
//HI_UNF_PVR_RegisterExtendCallback(u32PlayChn, HI_UNF_PVR_EXTRA_READ_CALLBACK, PvrExtraCallback, HI_NULL);
}
if ((HI_FALSE != s_bRegisterExtra) && (HI_FALSE != s_bRegisterTeeExtra))
{
PVR_SAMPLE_Printf("[%s_%s_%d]Both callback has been registered, This isn't a good thing!\n",
__FILE__, __FUNCTION__, __LINE__);
}
ret = HI_UNF_AVPLAY_GetAttr(hAvplay, HI_UNF_AVPLAY_ATTR_ID_AUD_PID, &u32Pid);
if ((HI_SUCCESS != ret) || (0x1fff == u32Pid))
{
PVR_SAMPLE_Printf("has no audio stream!\n");
}
else
{
enMediaType |= HI_UNF_AVPLAY_MEDIA_CHAN_AUD;
}
ret = HI_UNF_AVPLAY_GetAttr(hAvplay, HI_UNF_AVPLAY_ATTR_ID_VID_PID, &u32Pid);
if ((HI_SUCCESS != ret) || (0x1fff == u32Pid))
{
PVR_SAMPLE_Printf("has no video stream!\n");
}
else
{
enMediaType |= HI_UNF_AVPLAY_MEDIA_CHAN_VID;
}
/*enable avplay A/V sync*//*CNcomment:使能avplay音视频同步*/
if (HI_SUCCESS != HI_UNF_AVPLAY_GetAttr(hAvplay, HI_UNF_AVPLAY_ATTR_ID_SYNC, &stSyncAttr))
{
PVR_SAMPLE_Printf("get avplay sync stRecAttr fail!\n");
return HI_FAILURE;
}
stSyncAttr.enSyncRef = HI_UNF_SYNC_REF_AUDIO;
stSyncAttr.stSyncStartRegion.s32VidPlusTime = 60;
stSyncAttr.stSyncStartRegion.s32VidNegativeTime = -20;
stSyncAttr.u32PreSyncTimeoutMs = 1000;
stSyncAttr.bQuickOutput = HI_TRUE;
if (HI_SUCCESS != HI_UNF_AVPLAY_SetAttr(hAvplay, HI_UNF_AVPLAY_ATTR_ID_SYNC, &stSyncAttr))
{
PVR_SAMPLE_Printf("set avplay sync stRecAttr fail!\n");
return HI_FAILURE;
}
/*if you wanna get better figure display performance in pvr fast backward playing,
pls check the extra_disp in bootargs is large enough, and then enable the following codes*/
/*
HI_U32 u32DispOptimizeFlag = 1;
ret = HI_UNF_AVPLAY_Invoke(hAvplay, HI_UNF_AVPLAY_INVOKE_SET_DISP_OPTIMIZE_FLAG, &u32DispOptimizeFlag);
if (HI_SUCCESS != ret)
{
PVR_SAMPLE_Printf("call HI_UNF_AVPLAY_Invoke failed.\n");
HI_UNF_PVR_PlayDestroyChn(u32PlayChn);
return ret;
}*/
SAMPLE_RUN(HI_UNF_PVR_PlayStartChn(u32PlayChn), ret);
if (HI_SUCCESS != ret)
{
HI_UNF_PVR_PlayDestroyChn(u32PlayChn);
return ret;
}
/*enable vo frame rate detect*//*CNcomment:使能VO自动帧率检测*/
stFrmRateAttr.enFrmRateType = HI_UNF_AVPLAY_FRMRATE_TYPE_PTS;
stFrmRateAttr.stSetFrmRate.u32fpsInteger = 0;
stFrmRateAttr.stSetFrmRate.u32fpsDecimal = 0;
if (HI_SUCCESS != HI_UNF_AVPLAY_SetAttr(hAvplay, HI_UNF_AVPLAY_ATTR_ID_FRMRATE_PARAM, &stFrmRateAttr))
{
PVR_SAMPLE_Printf("set frame to VO fail.\n");
return HI_FAILURE;
}
/*set avplay trick mode to normal*//*CNcomment:设置avplay特技模式为正常*/
if (enMediaType & HI_UNF_AVPLAY_MEDIA_CHAN_VID)
{
stTplayOpts.enTplayDirect = HI_UNF_AVPLAY_TPLAY_DIRECT_FORWARD;
stTplayOpts.u32SpeedInteger = 1;
stTplayOpts.u32SpeedDecimal = 0;
stVdecCmdPara.u32CmdID = HI_UNF_AVPLAY_SET_TPLAY_PARA_CMD;
stVdecCmdPara.pPara = &stTplayOpts;
ret = HI_UNF_AVPLAY_Invoke(hAvplay, HI_UNF_AVPLAY_INVOKE_VCODEC, (void *)&stVdecCmdPara);
if (HI_SUCCESS != ret)
{
PVR_SAMPLE_Printf("Resume Avplay trick mode to normal fail.\n");
return HI_FAILURE;
}
}
*pu32PlayChn = u32PlayChn;
return HI_SUCCESS;
}
/*stop playback*//*CNcomment: 停止回放 */
HI_VOID PVR_StopPlayBack(HI_U32 u32PlayChn)
{
HI_UNF_AVPLAY_STOP_OPT_S stStopOpt;
HI_UNF_PVR_PLAY_ATTR_S stPlayAttr;
stStopOpt.enMode = HI_UNF_AVPLAY_STOP_MODE_STILL;
stStopOpt.u32TimeoutMs = 0;
(HI_VOID)HI_UNF_PVR_PlayGetChn(u32PlayChn, &stPlayAttr);
(HI_VOID)HI_UNF_PVR_PlayStopChn(u32PlayChn, &stStopOpt);
(HI_VOID)HI_UNF_PVR_PlayDestroyChn(u32PlayChn);
(HI_VOID)HI_UNF_DMX_DestroyTSBuffer(g_hTsBufForPlayBack);
(HI_VOID)HI_UNF_DMX_DetachTSPort(PVR_DMX_ID_LIVE);
}
HI_S32 PVR_AvplayInit(HI_HANDLE hWin, HI_HANDLE *phAvplay, HI_HANDLE* phSoundTrack)
{
HI_S32 Ret;
HI_HANDLE hAvplay;
HI_UNF_AVPLAY_ATTR_S stAvplayAttr;
HI_UNF_SYNC_ATTR_S stSyncAttr;
HI_UNF_AUDIOTRACK_ATTR_S stTrackAttr;
if (phSoundTrack == NULL)
{
return HI_FAILURE;
}
Ret = HIADP_AVPlay_RegADecLib();
if (Ret != HI_SUCCESS)
{
PVR_SAMPLE_Printf("call HIADP_AVPlay_RegADecLib failed.\n");
return Ret;
}
Ret = HI_UNF_AVPLAY_Init();
if (Ret != HI_SUCCESS)
{
PVR_SAMPLE_Printf("call HI_UNF_AVPLAY_Init failed.\n");
return Ret;
}
Ret = HI_UNF_AVPLAY_GetDefaultConfig(&stAvplayAttr, HI_UNF_AVPLAY_STREAM_TYPE_TS);
if (Ret != HI_SUCCESS)
{
PVR_SAMPLE_Printf("call HI_UNF_AVPLAY_GetDefaultConfig failed.\n");
HI_UNF_AVPLAY_DeInit();
return Ret;
}
stAvplayAttr.u32DemuxId = PVR_DMX_ID_LIVE;
//#ifdef S_SUPPORT_4PLUS64
stAvplayAttr.stStreamAttr.u32VidBufSize = 2*1024*1024;
stAvplayAttr.stStreamAttr.u32AudBufSize = 192*1024;
//#endif
Ret = HI_UNF_AVPLAY_Create(&stAvplayAttr, &hAvplay);
if (Ret != HI_SUCCESS)
{
PVR_SAMPLE_Printf("call HI_UNF_AVPLAY_Create failed.\n");
HI_UNF_AVPLAY_DeInit();
return Ret;
}
Ret = HI_UNF_AVPLAY_GetAttr(hAvplay, HI_UNF_AVPLAY_ATTR_ID_SYNC, &stSyncAttr);
if (Ret != HI_SUCCESS)
{
PVR_SAMPLE_Printf("call HI_UNF_AVPLAY_GetAttr failed.\n");
HI_UNF_AVPLAY_DeInit();
return Ret;
}
stSyncAttr.enSyncRef = HI_UNF_SYNC_REF_AUDIO;
stSyncAttr.stSyncStartRegion.s32VidPlusTime = 60;
stSyncAttr.stSyncStartRegion.s32VidNegativeTime = -20;
stSyncAttr.u32PreSyncTimeoutMs = 1000;
stSyncAttr.bQuickOutput = HI_FALSE;
Ret = HI_UNF_AVPLAY_SetAttr(hAvplay, HI_UNF_AVPLAY_ATTR_ID_SYNC, &stSyncAttr);
if (Ret != HI_SUCCESS)
{
PVR_SAMPLE_Printf("call HI_UNF_AVPLAY_SetAttr failed.\n");
HI_UNF_AVPLAY_DeInit();
return Ret;
}
if (HI_FALSE != s_bSupportTvp)
{
HI_UNF_AVPLAY_TVP_ATTR_S stTvpAttr;
stTvpAttr.bEnable = HI_TRUE;
Ret = HI_UNF_AVPLAY_SetAttr(hAvplay, HI_UNF_AVPLAY_ATTR_ID_TVP, &stTvpAttr);
if (Ret != HI_SUCCESS)
{
PVR_SAMPLE_Printf("[%s_%d]call HI_UNF_AVPLAY_SetAttr failed.ret = 0x%08x\n", __FILE__, __LINE__, Ret);
HI_UNF_AVPLAY_DeInit();
return Ret;
}
}
Ret = HI_UNF_AVPLAY_ChnOpen(hAvplay, HI_UNF_AVPLAY_MEDIA_CHAN_VID, HI_NULL);
if (Ret != HI_SUCCESS)
{
PVR_SAMPLE_Printf("call HI_UNF_AVPLAY_ChnOpen failed.\n");
HI_UNF_AVPLAY_Destroy(hAvplay);
HI_UNF_AVPLAY_DeInit();
return Ret;
}
Ret = HI_UNF_AVPLAY_ChnOpen(hAvplay, HI_UNF_AVPLAY_MEDIA_CHAN_AUD, HI_NULL);
if (Ret != HI_SUCCESS)
{
PVR_SAMPLE_Printf("call HI_UNF_AVPLAY_ChnOpen failed.\n");
HI_UNF_AVPLAY_ChnClose(hAvplay, HI_UNF_AVPLAY_MEDIA_CHAN_VID);
HI_UNF_AVPLAY_Destroy(hAvplay);
return Ret;
}
Ret = HI_UNF_VO_AttachWindow(hWin, hAvplay);
if (Ret != HI_SUCCESS)
{
PVR_SAMPLE_Printf("call HI_UNF_VO_AttachWindow failed.\n");
HI_UNF_AVPLAY_ChnClose(hAvplay, HI_UNF_AVPLAY_MEDIA_CHAN_AUD);
HI_UNF_AVPLAY_ChnClose(hAvplay, HI_UNF_AVPLAY_MEDIA_CHAN_VID);
HI_UNF_AVPLAY_Destroy(hAvplay);
HI_UNF_AVPLAY_DeInit();
return Ret;
}
Ret = HI_UNF_VO_SetWindowEnable(hWin, HI_TRUE);
if (Ret != HI_SUCCESS)
{
PVR_SAMPLE_Printf("call HI_UNF_VO_SetWindowEnable failed.\n");
HI_UNF_VO_DetachWindow(hWin, hAvplay);
HI_UNF_AVPLAY_ChnClose(hAvplay, HI_UNF_AVPLAY_MEDIA_CHAN_AUD);
HI_UNF_AVPLAY_ChnClose(hAvplay, HI_UNF_AVPLAY_MEDIA_CHAN_VID);
HI_UNF_AVPLAY_Destroy(hAvplay);
HI_UNF_AVPLAY_DeInit();
return Ret;
}
Ret = HI_UNF_SND_GetDefaultTrackAttr(HI_UNF_SND_TRACK_TYPE_MASTER, &stTrackAttr);
if (Ret != HI_SUCCESS)
{
PVR_SAMPLE_Printf("call HI_UNF_SND_GetDefaultTrackAttr failed.\n");
return Ret;
}
Ret = HI_UNF_SND_CreateTrack(HI_UNF_SND_0,&stTrackAttr, phSoundTrack);
if (Ret != HI_SUCCESS)
{
HI_UNF_VO_SetWindowEnable(hWin, HI_FALSE);
HI_UNF_VO_DetachWindow(hWin, hAvplay);
HI_UNF_AVPLAY_ChnClose(hAvplay, HI_UNF_AVPLAY_MEDIA_CHAN_AUD);
HI_UNF_AVPLAY_ChnClose(hAvplay, HI_UNF_AVPLAY_MEDIA_CHAN_VID);
HI_UNF_AVPLAY_Destroy(hAvplay);
HI_UNF_AVPLAY_DeInit();
return Ret;
}
Ret = HI_UNF_SND_Attach(*phSoundTrack, hAvplay);
if (Ret != HI_SUCCESS)
{
HI_UNF_SND_DestroyTrack(*phSoundTrack);
PVR_SAMPLE_Printf("call HI_SND_Attach failed.\n");
HI_UNF_VO_SetWindowEnable(hWin, HI_FALSE);
HI_UNF_VO_DetachWindow(hWin, hAvplay);
HI_UNF_AVPLAY_ChnClose(hAvplay, HI_UNF_AVPLAY_MEDIA_CHAN_AUD);
HI_UNF_AVPLAY_ChnClose(hAvplay, HI_UNF_AVPLAY_MEDIA_CHAN_VID);
HI_UNF_AVPLAY_Destroy(hAvplay);
HI_UNF_AVPLAY_DeInit();
return Ret;
}
*phAvplay = hAvplay;
return HI_SUCCESS;
}
HI_S32 PVR_AvplayDeInit(HI_HANDLE hAvplay, HI_HANDLE hWin, HI_HANDLE hSoundTrack)
{
HI_S32 Ret;
HI_UNF_AVPLAY_STOP_OPT_S stStopOpt;
stStopOpt.enMode = HI_UNF_AVPLAY_STOP_MODE_BLACK;
stStopOpt.u32TimeoutMs = 0;
Ret = HI_UNF_AVPLAY_Stop(hAvplay, HI_UNF_AVPLAY_MEDIA_CHAN_VID | HI_UNF_AVPLAY_MEDIA_CHAN_AUD, &stStopOpt);
if (Ret != HI_SUCCESS )
{
PVR_SAMPLE_Printf("call HI_UNF_AVPLAY_Stop failed.\n");
}
HI_UNF_VO_SetWindowEnable(hWin,HI_FALSE);
Ret = HI_UNF_SND_Detach(hSoundTrack, hAvplay);
if (Ret != HI_SUCCESS )
{
PVR_SAMPLE_Printf("call HI_UNF_SND_Detach failed.\n");
}
Ret = HI_UNF_SND_DestroyTrack(hSoundTrack);
if (Ret != HI_SUCCESS )
{
PVR_SAMPLE_Printf("call HI_UNF_SND_DestroyTrack failed.\n");
}
Ret = HI_UNF_VO_DetachWindow(hWin, hAvplay);
if (Ret != HI_SUCCESS )
{
PVR_SAMPLE_Printf("call HI_UNF_VO_DetachWindow failed.\n");
}
Ret = HI_UNF_AVPLAY_ChnClose(hAvplay, HI_UNF_AVPLAY_MEDIA_CHAN_VID);
if (Ret != HI_SUCCESS )
{
PVR_SAMPLE_Printf("call HI_UNF_AVPLAY_ChnClose failed.\n");
}
Ret = HI_UNF_AVPLAY_ChnClose(hAvplay, HI_UNF_AVPLAY_MEDIA_CHAN_AUD);
if (Ret != HI_SUCCESS )
{
PVR_SAMPLE_Printf("call HI_UNF_AVPLAY_ChnClose failed.\n");
}
Ret = HI_UNF_AVPLAY_Destroy(hAvplay);
if (Ret != HI_SUCCESS )
{
PVR_SAMPLE_Printf("call HI_UNF_AVPLAY_Destroy failed.\n");
}
Ret = HI_UNF_AVPLAY_DeInit();
if (Ret != HI_SUCCESS )
{
PVR_SAMPLE_Printf("call HI_UNF_AVPLAY_DeInit failed.\n");
}
return HI_SUCCESS;
}
HI_VOID PVR_CallBack(HI_U32 u32ChnID, HI_UNF_PVR_EVENT_E EventType, HI_S32 s32EventValue, HI_VOID *args)
{
PVR_SAMPLE_Printf("==============call back================\n");
if (EventType > HI_UNF_PVR_EVENT_REC_RESV)
{
PVR_SAMPLE_Printf("====callback error!!!\n");
return;
}
PVR_SAMPLE_Printf("====channel %d\n", u32ChnID);
PVR_SAMPLE_Printf("====event:%s %d\n", PVR_GetEventTypeStringByID(EventType), EventType);
PVR_SAMPLE_Printf("====event value %d\n", s32EventValue);
if (EventType == HI_UNF_PVR_EVENT_PLAY_EOF)
{
PVR_SAMPLE_Printf("==========play to end of file======\n");
}
if (EventType == HI_UNF_PVR_EVENT_PLAY_SOF)
{
PVR_SAMPLE_Printf("==========play to start of file======\n");
}
if (EventType == HI_UNF_PVR_EVENT_PLAY_ERROR)
{
PVR_SAMPLE_Printf("==========play internal error, check if the disk is insert to the box======\n");
}
if (EventType == HI_UNF_PVR_EVENT_PLAY_REACH_REC)
{
PVR_SAMPLE_Printf("==========play reach to record ======\n");
}
if (EventType == HI_UNF_PVR_EVENT_REC_DISKFULL)
{
PVR_SAMPLE_Printf("\n====disk full, stop record=====\n\n");
HI_UNF_PVR_RecStopChn(u32ChnID);
g_bIsRecStop = HI_TRUE;
}
if (EventType == HI_UNF_PVR_EVENT_REC_ERROR)
{
PVR_SAMPLE_Printf("======disk write error, please check if the disk is insert to the box.====\n");
}
if (EventType == HI_UNF_PVR_EVENT_REC_OVER_FIX)
{
PVR_SAMPLE_Printf("\n======reach the fixed size.==========\n\n");
}
if (EventType == HI_UNF_PVR_EVENT_REC_REACH_PLAY)
{
PVR_SAMPLE_Printf("\n======record reach to play.==========\n\n");
}
if (EventType == HI_UNF_PVR_EVENT_REC_DISK_SLOW)
{
PVR_SAMPLE_Printf("======disk is too slow, the stream record would be error.====\n");
}
PVR_SAMPLE_Printf("=======================================\n\n");
return;
}
HI_S32 PVR_RegisterCallBacks(HI_VOID)
{
HI_S32 Ret;
Ret = HI_UNF_PVR_RegisterEvent(HI_UNF_PVR_EVENT_PLAY_EOF, PVR_CallBack, NULL);
Ret |= HI_UNF_PVR_RegisterEvent(HI_UNF_PVR_EVENT_PLAY_SOF, PVR_CallBack, NULL);
Ret |= HI_UNF_PVR_RegisterEvent(HI_UNF_PVR_EVENT_PLAY_ERROR, PVR_CallBack, NULL);
Ret |= HI_UNF_PVR_RegisterEvent(HI_UNF_PVR_EVENT_PLAY_REACH_REC, PVR_CallBack, NULL);
Ret |= HI_UNF_PVR_RegisterEvent(HI_UNF_PVR_EVENT_REC_DISKFULL, PVR_CallBack, NULL);
Ret |= HI_UNF_PVR_RegisterEvent(HI_UNF_PVR_EVENT_REC_OVER_FIX, PVR_CallBack, NULL);
Ret |= HI_UNF_PVR_RegisterEvent(HI_UNF_PVR_EVENT_REC_DISK_SLOW, PVR_CallBack, NULL);
Ret |= HI_UNF_PVR_RegisterEvent(HI_UNF_PVR_EVENT_REC_REACH_PLAY, PVR_CallBack, NULL);
Ret |= HI_UNF_PVR_RegisterEvent(HI_UNF_PVR_EVENT_REC_ERROR, PVR_CallBack, NULL);
if (Ret != HI_SUCCESS)
{
PVR_SAMPLE_Printf("call HI_UNF_PVR_RegisterEvent failed.\n");
return Ret;
}
return HI_SUCCESS;
}
HI_U8* PVR_GetEventTypeStringByID(HI_UNF_PVR_EVENT_E eEventID)
{
HI_U32 u32EventNum = sizeof(g_stEventType)/sizeof(g_stEventType[0]);
HI_U32 i;
HI_U8* pszRet = HI_NULL;
for (i = 0; i < u32EventNum; i++)
{
if (eEventID == g_stEventType[i].eEventID)
{
pszRet = g_stEventType[i].szEventTypeName;
break;
}
}
if (i == u32EventNum)
{
pszRet = g_stEventType[u32EventNum - 1].szEventTypeName;
}
return pszRet;
}
typedef struct tagNET_STREAM_PARAM
{
HI_U16 u16Port;
HI_CHAR szIgmpAddr[16];
pthread_t hNetStreamThread;
HI_BOOL bStopNetStreamThread;
}NET_STREAM_PARAM_S;
NET_STREAM_PARAM_S g_stNetThreadParam = {0};
HI_VOID * NetStream(HI_VOID *args)
{
HI_S32 SocketFd = -1;
struct sockaddr_in ServerAddr;
in_addr_t IpAddr;
struct ip_mreq Mreq;
HI_U32 u32AddrLen;
HI_U32 u32ReadLen;
HI_U32 u32GetBufCount=0;
HI_U32 u32ReceiveCount=0;
HI_S32 Ret;
HI_HANDLE hTsBuf = 0;
HI_UNF_STREAM_BUF_S stStreamBuf;
NET_STREAM_PARAM_S *pstThreadParam = (NET_STREAM_PARAM_S*)args;
if (pstThreadParam == NULL)
{
return NULL;
}
do
{
Ret = HI_UNF_DMX_CreateTSBuffer(PVR_DMX_PORT_ID_IP, 0x200000, &hTsBuf);
if (Ret != HI_SUCCESS)
{
break;
}
SocketFd = socket(AF_INET,SOCK_DGRAM,IPPROTO_UDP);
if (SocketFd < 0)
{
PVR_SAMPLE_Printf("wait send TS to port %d.\n", PVR_DMX_PORT_ID_IP);
break;
}
ServerAddr.sin_family = AF_INET;
ServerAddr.sin_addr.s_addr = htonl(INADDR_ANY);
ServerAddr.sin_port = htons(pstThreadParam->u16Port);
if (bind(SocketFd,(struct sockaddr *)(&ServerAddr),sizeof(struct sockaddr_in)) < 0)
{
PVR_SAMPLE_Printf("socket bind error [%d].\n", errno);
break;;
}
IpAddr = inet_addr(pstThreadParam->szIgmpAddr);
PVR_SAMPLE_Printf("========================g_pszMultiAddr = %s, g_u16UdpPort=%u\n", pstThreadParam->szIgmpAddr, pstThreadParam->u16Port);
if (IpAddr)
{
Mreq.imr_multiaddr.s_addr = IpAddr;
Mreq.imr_interface.s_addr = htonl(INADDR_ANY);
if (setsockopt(SocketFd, IPPROTO_IP, IP_ADD_MEMBERSHIP, &Mreq, sizeof(struct ip_mreq)))
{
PVR_SAMPLE_Printf("wait send TS to port %d.\n", PVR_DMX_PORT_ID_IP);
break;
}
}
u32AddrLen = sizeof(ServerAddr);
while (pstThreadParam->bStopNetStreamThread == HI_FALSE)
{
Ret = HI_UNF_DMX_GetTSBuffer(hTsBuf, 188*50, &stStreamBuf, 0);
if (Ret != HI_SUCCESS)
{
u32GetBufCount++;
if(u32GetBufCount >= 10)
{
PVR_SAMPLE_Printf("########## TS come too fast! #########, Ret=%d\n", Ret);
u32GetBufCount=0;
}
usleep(10000) ;
continue;
}
u32GetBufCount=0;
u32ReadLen = recvfrom(SocketFd, stStreamBuf.pu8Data, stStreamBuf.u32Size, 0,
(struct sockaddr *)&ServerAddr, &u32AddrLen);
if (u32ReadLen <= 0)
{
u32ReceiveCount++;
if (u32ReceiveCount >= 50)
{
PVR_SAMPLE_Printf("########## TS come too slow or net error! #########\n");
u32ReceiveCount = 0;
}
}
else
{
u32ReceiveCount = 0;
Ret = HI_UNF_DMX_PutTSBuffer(hTsBuf, u32ReadLen);
if (Ret != HI_SUCCESS )
{
PVR_SAMPLE_Printf("call HI_UNF_DMX_PutTSBuffer failed.\n");
}
}
}
}while(0);
if (SocketFd != -1)
{
close(SocketFd);
SocketFd = -1;
}
if (hTsBuf != 0)
{
HI_UNF_DMX_DestroyTSBuffer(hTsBuf);
hTsBuf = 0;
}
return NULL;
}
HI_U32 PVR_StartNetStream(HI_CHAR* pszIgmpAddr, HI_U16 u16Port)
{
if (pszIgmpAddr == NULL)
{
return HI_FAILURE;
}
if (g_stNetThreadParam.hNetStreamThread == 0)
{
g_stNetThreadParam.bStopNetStreamThread = HI_FALSE;
memset(g_stNetThreadParam.szIgmpAddr, 0, sizeof(g_stNetThreadParam.szIgmpAddr));
memcpy(g_stNetThreadParam.szIgmpAddr, pszIgmpAddr, sizeof(g_stNetThreadParam.szIgmpAddr));
g_stNetThreadParam.u16Port = u16Port;
pthread_create(&g_stNetThreadParam.hNetStreamThread, HI_NULL, NetStream, &g_stNetThreadParam);
}
return HI_SUCCESS;
}
HI_U32 PVR_StopNetStream()
{
if (g_stNetThreadParam.hNetStreamThread != 0)
{
g_stNetThreadParam.bStopNetStreamThread = HI_TRUE;
pthread_join(g_stNetThreadParam.hNetStreamThread, HI_NULL);
}
return HI_FAILURE;
}
| [
"[email protected]"
] | |
8581310eeacd62fc5616efe0ec5fd995729be28c | 19f669522048dcfeda563e76e769d7dc89925e01 | /src/if_le.c | 5e419b7c0bc4c0e6ee551534f97170257ad0357b | [] | no_license | weiguojiang/code | 515039be5f55e5a5a3fa1b5075fc127474053e0e | 7833760c111c0a8c0078aed013e03020682174d0 | refs/heads/master | 2021-01-21T18:38:25.705236 | 2015-11-09T09:15:53 | 2015-11-09T09:15:53 | 44,723,014 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 25,207 | c | /*
* Copyright (c) 1990, 1991, 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from the Stanford/CMU enet packet filter,
* (net/enet.c) distributed as part of 4.3BSD, and code contributed
* to Berkeley by Steven McCanne and Van Jacobson both of Lawrence
* Berkeley Laboratory.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
*/
/*
* AMD 7990 LANCE
*
* This driver will accept tailer encapsulated packets even
* though it buys us nothing. The motivation was to avoid incompatibilities
* with VAXen, SUNs, and others that handle and benefit from them.
* This reasoning is dubious.
*/
#include "mbuf.h"
#include "protosw.h"
#include "socket.h"
#include "if.h"
#include "route.h"
#include "in.h"
#include "if_ether.h"
#include "in_var.h"
#include "bpf.h"
#define max_frame_num 100
struct hp_device{
char hp_addr[20];
int hp_unit;
};
struct frame_buf{
char buf[1000];
int len;
};
struct rec_buf{
int index;
struct frame_buf frame[max_frame_num];
};
struct rec_buf hp_buf;
/* offsets for: ID, REGS, MEM, NVRAM */
int lestd[] = { 0, 0x4000, 0x8000, 0xC008 };
int leattach(); /*
struct driver ledriver = {
leattach, "le",
};
struct isr le_isr[NLE]; */
int ledebug = 0; /* console error messages */
int leintr(), leinit(), leioctl(), lestart(), ether_output(), lereset();
struct mbuf *m_devget();
extern struct ifnet loif;
/*
* Ethernet software status per interface.
*
* Each interface is referenced by a network interface structure,
* le_if, which the routing code uses to locate the interface.
* This structure contains the output queue for the interface, its address, ...
*/
struct le_softc {
struct arpcom sc_ac; /* common Ethernet structures */
#define sc_if sc_ac.ac_if /* network-visible interface */
#define sc_addr sc_ac.ac_enaddr /* hardware Ethernet address */
struct lereg0 *sc_r0;
struct lereg1 *sc_r1;
struct lereg2 *sc_r2;
int sc_rmd; /* predicted next rmd to process */
int sc_tmd; /* next available tmd */
int sc_txcnt; /* # of transmit buffers in use */
/* stats */
int sc_runt;
int sc_jab;
int sc_merr;
int sc_babl;
int sc_cerr;
int sc_miss;
int sc_rown;
int sc_xown;
int sc_xown2;
int sc_uflo;
int sc_rxlen;
int sc_rxoff;
int sc_txoff;
int sc_busy;
short sc_iflags;
} le_softc[NLE];
/* access LANCE registers */
#define LERDWR(cntl, src, dst) \
do { \
(dst) = (src); \
} while (((cntl)->ler0_status & LE_ACK) == 0);
/*
* Interface exists: make available by filling in network interface
* record. System will initialize the interface when it is ready
* to accept packets.
*/
leattach(hd)
struct hp_device *hd;
{
/*
register struct lereg0 *ler0;
register struct lereg2 *ler2;
struct lereg2 *lemem = 0;
*/
struct le_softc *le = &le_softc[hd->hp_unit];
struct ifnet *ifp = &le->sc_if;
char *cp;
int i;
/*
ler0 = le->sc_r0 = (struct lereg0 *)(lestd[0] + (int)hd->hp_addr);
le->sc_r1 = (struct lereg1 *)(lestd[1] + (int)hd->hp_addr);
ler2 = le->sc_r2 = (struct lereg2 *)(lestd[2] + (int)hd->hp_addr);
if (ler0->ler0_id != LEID)
return(0);
le_isr[hd->hp_unit].isr_intr = leintr;
hd->hp_ipl = le_isr[hd->hp_unit].isr_ipl = LE_IPL(ler0->ler0_status);
le_isr[hd->hp_unit].isr_arg = hd->hp_unit;
ler0->ler0_id = 0xFF;
DELAY(100);
*/
/*
* Read the ethernet address off the board, one nibble at a time.
*/
cp = (char *)(hd->hp_addr);
memcpy(le->sc_addr, cp, 8);
/*
for (i = 0; i < sizeof(le->sc_addr); i++) {
le->sc_addr[i] = (*++cp & 0xF) << 4;
cp++;
le->sc_addr[i] |= *++cp & 0xF;
cp++;
}
*/
printf("le%d: hardware address %s\n", hd->hp_unit,
ether_sprintf(le->sc_addr));
/*
* Setup for transmit/receive
*/
/*
ler2->ler2_mode = LE_MODE;
ler2->ler2_ladrf[0] = 0;
ler2->ler2_ladrf[1] = 0;
ler2->ler2_rlen = LE_RLEN;
ler2->ler2_rdra = (int)lemem->ler2_rmd;
ler2->ler2_tlen = LE_TLEN;
ler2->ler2_tdra = (int)lemem->ler2_tmd;
ler0->ler0_status = LE_IE;
*/
ifp->if_unit = hd->hp_unit;
ifp->if_name = "eth";
ifp->if_mtu = ETHERMTU;
ifp->if_init = leinit;
ifp->if_reset = lereset;
ifp->if_ioctl = leioctl;
ifp->if_output = ether_output;
ifp->if_start = lestart;
#ifdef MULTICAST
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
#else
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX;
#endif
#if NBPFILTER > 0
bpfattach(&ifp->if_bpf, ifp, DLT_EN10MB, sizeof(struct ether_header));
#endif
if_attach(ifp);
return (1);
}
#ifdef MULTICAST
/*
* Setup the logical address filter
*/
void
lesetladrf(sc)
register struct le_softc *sc;
{
register volatile struct lereg2 *ler2 = sc->sc_r2;
register struct ifnet *ifp = &sc->sc_if;
register struct ether_multi *enm;
register u_char *cp;
register u_long crc;
register u_long c;
register int i, len;
struct ether_multistep step;
/*
* Set up multicast address filter by passing all multicast
* addresses through a crc generator, and then using the high
* order 6 bits as a index into the 64 bit logical address
* filter. The high order two bits select the word, while the
* rest of the bits select the bit within the word.
*/
ler2->ler2_ladrf[0] = 0;
ler2->ler2_ladrf[1] = 0;
ifp->if_flags &= ~IFF_ALLMULTI;
ETHER_FIRST_MULTI(step, &sc->sc_ac, enm);
while (enm != NULL) {
if (bcmp((caddr_t)&enm->enm_addrlo,
(caddr_t)&enm->enm_addrhi, sizeof(enm->enm_addrlo)) == 0) {
/*
* We must listen to a range of multicast
* addresses. For now, just accept all
* multicasts, rather than trying to set only
* those filter bits needed to match the range.
* (At this time, the only use of address
* ranges is for IP multicast routing, for
* which the range is big enough to require all
* bits set.)
*/
ler2->ler2_ladrf[0] = 0xffffffff;
ler2->ler2_ladrf[1] = 0xffffffff;
ifp->if_flags |= IFF_ALLMULTI;
return;
}
cp = (unsigned char *)&enm->enm_addrlo;
c = *cp;
crc = 0xffffffff;
len = 6;
while (len-- > 0) {
c = *cp;
for (i = 0; i < 8; i++) {
if ((c & 0x01) ^ (crc & 0x01)) {
crc >>= 1;
crc = crc ^ 0xedb88320;
}
else
crc >>= 1;
c >>= 1;
}
cp++;
}
/* Just want the 6 most significant bits. */
crc = crc >> 26;
/* Turn on the corresponding bit in the filter. */
ler2->ler2_ladrf[crc >> 5] |= 1 << (crc & 0x1f);
ETHER_NEXT_MULTI(step, enm);
}
}
#endif
ledrinit(ler2, le)
register struct lereg2 *ler2;
register struct le_softc *le;
{
/*
register struct lereg2 *lemem = 0;
register int i;
ler2->ler2_padr[0] = le->sc_addr[1];
ler2->ler2_padr[1] = le->sc_addr[0];
ler2->ler2_padr[2] = le->sc_addr[3];
ler2->ler2_padr[3] = le->sc_addr[2];
ler2->ler2_padr[4] = le->sc_addr[5];
ler2->ler2_padr[5] = le->sc_addr[4];
for (i = 0; i < LERBUF; i++) {
ler2->ler2_rmd[i].rmd0 = (int)lemem->ler2_rbuf[i];
ler2->ler2_rmd[i].rmd1 = LE_OWN;
ler2->ler2_rmd[i].rmd2 = -LEMTU;
ler2->ler2_rmd[i].rmd3 = 0;
}
for (i = 0; i < LETBUF; i++) {
ler2->ler2_tmd[i].tmd0 = (int)lemem->ler2_tbuf[i];
ler2->ler2_tmd[i].tmd1 = 0;
ler2->ler2_tmd[i].tmd2 = 0;
ler2->ler2_tmd[i].tmd3 = 0;
}
#ifdef MULTICAST
lesetladrf(le);
#else
ler2->ler2_ladrf[0] = 0;
ler2->ler2_ladrf[1] = 0;
#endif
*/
}
lereset(unit)
register int unit;
{
register struct le_softc *le = &le_softc[unit];
register struct lereg0 *ler0 = le->sc_r0;
register struct lereg1 *ler1 = le->sc_r1;
register struct lereg2 *lemem = 0;
register int timo = 100000;
register int stat;
/*
#ifdef lint
stat = unit;
#endif
#if NBPFILTER > 0
if (le->sc_if.if_flags & IFF_PROMISC)
le->sc_r2->ler2_mode = LE_MODE|0x8000;
else
le->sc_r2->ler2_mode = LE_MODE;
#endif
*/
/*
LERDWR(ler0, LE_CSR0, ler1->ler1_rap);
LERDWR(ler0, LE_STOP, ler1->ler1_rdp);
ledrinit(le->sc_r2, le);
le->sc_rmd = le->sc_tmd = 0;
LERDWR(ler0, LE_CSR1, ler1->ler1_rap);
LERDWR(ler0, (int)&lemem->ler2_mode, ler1->ler1_rdp);
LERDWR(ler0, LE_CSR2, ler1->ler1_rap);
LERDWR(ler0, 0, ler1->ler1_rdp);
LERDWR(ler0, LE_CSR0, ler1->ler1_rap);
LERDWR(ler0, LE_INIT, ler1->ler1_rdp);
do {
if (--timo == 0) {
printf("le%d: init timeout, stat = 0x%x\n",
unit, stat);
break;
}
LERDWR(ler0, ler1->ler1_rdp, stat);
} while ((stat & LE_IDON) == 0);
LERDWR(ler0, LE_STOP, ler1->ler1_rdp);
LERDWR(ler0, LE_CSR3, ler1->ler1_rap);
LERDWR(ler0, LE_BSWP, ler1->ler1_rdp);
LERDWR(ler0, LE_CSR0, ler1->ler1_rap);
LERDWR(ler0, LE_STRT | LE_INEA, ler1->ler1_rdp);
*/
le->sc_if.if_flags &= ~IFF_OACTIVE;
le->sc_txcnt = 0;
}
/*
* Initialization of interface
*/
leinit(unit)
int unit;
{
register struct ifnet *ifp = &le_softc[unit].sc_if;
register struct ifaddr *ifa;
int s;
/* not yet, if address still unknown */
for (ifa = ifp->if_addrlist;; ifa = ifa->ifa_next)
if (ifa == 0)
return;
else if (ifa->ifa_addr && ifa->ifa_addr->sa_family != AF_LINK)
break;
if ((ifp->if_flags & IFF_RUNNING) == 0) {
s = splimp();
ifp->if_flags |= IFF_RUNNING;
lereset(unit);
(void) lestart(ifp);
splx(s);
}
}
/*
* Start output on interface. Get another datagram to send
* off of the interface queue, and copy it to the interface
* before starting the output.
*/
lestart(ifp)
struct ifnet *ifp;
{
register struct le_softc *le = &le_softc[ifp->if_unit];
/* register struct letmd *tmd; */
register struct mbuf *m;
int len;
if ((le->sc_if.if_flags & IFF_RUNNING) == 0)
return (0);
/* tmd = &le->sc_r2->ler2_tmd[le->sc_tmd]; */
do {
/* if (tmd->tmd1 & LE_OWN) {
le->sc_xown2++;
return (0);
}
*/ IF_DEQUEUE(&le->sc_if.if_snd, m);
if (m == 0)
return (0);
len = leput_test(&hp_buf, m);
#if NBPFILTER > 0
/*
* If bpf is listening on this interface, let it
* see the packet before we commit it to the wire.
*/
if (ifp->if_bpf)
bpf_tap(ifp->if_bpf, &hp_buf /*le->sc_r2->ler2_tbuf[le->sc_tmd] */,
len);
#endif
/*
tmd->tmd3 = 0;
tmd->tmd2 = -len;
tmd->tmd1 = LE_OWN | LE_STP | LE_ENP;
if (++le->sc_tmd == LETBUF) {
le->sc_tmd = 0;
tmd = le->sc_r2->ler2_tmd;
} else
tmd++; */
} while (++le->sc_txcnt < LETBUF);
le->sc_if.if_flags |= IFF_OACTIVE;
return (0);
}
leintr(unit)
register int unit;
{
register struct le_softc *le = &le_softc[unit];
register struct lereg0 *ler0 = le->sc_r0;
register struct lereg1 *ler1;
register int stat;
#if 0
if ((ler0->ler0_status & LE_IR) == 0)
return(0);
if (ler0->ler0_status & LE_JAB) {
le->sc_jab++;
lereset(unit);
return(1);
}
ler1 = le->sc_r1;
LERDWR(ler0, ler1->ler1_rdp, stat);
if (stat & LE_SERR) {
leerror(unit, stat);
if (stat & LE_MERR) {
le->sc_merr++;
lereset(unit);
return(1);
}
if (stat & LE_BABL)
le->sc_babl++;
if (stat & LE_CERR)
le->sc_cerr++;
if (stat & LE_MISS)
le->sc_miss++;
LERDWR(ler0, LE_BABL|LE_CERR|LE_MISS|LE_INEA, ler1->ler1_rdp);
}
if ((stat & LE_RXON) == 0) {
le->sc_rxoff++;
lereset(unit);
return(1);
}
if ((stat & LE_TXON) == 0) {
le->sc_txoff++;
lereset(unit);
return(1);
}
#endif
if (stat & LE_RINT)
lerint(unit);
if (stat & LE_TINT)
lexint(unit);
return(1);
}
/*
* Ethernet interface transmitter interrupt.
* Start another output if more data to send.
*/
lexint(unit)
register int unit;
{
register struct le_softc *le = &le_softc[unit];
register struct letmd *tmd;
int i, gotone = 0;
#ifdef USELEDS
if (inledcontrol == 0)
ledcontrol(0, 0, LED_LANXMT);
#endif
#if 0
do {
if ((i = le->sc_tmd - le->sc_txcnt) < 0)
i += LETBUF;
tmd = &le->sc_r2->ler2_tmd[i];
if (tmd->tmd1 & LE_OWN) {
if (gotone)
break;
le->sc_xown++;
return;
}
/* clear interrupt */
LERDWR(le->sc_r0, LE_TINT|LE_INEA, le->sc_r1->ler1_rdp);
/* XXX documentation says BUFF not included in ERR */
if ((tmd->tmd1 & LE_ERR) || (tmd->tmd3 & LE_TBUFF)) {
lexerror(unit);
le->sc_if.if_oerrors++;
if (tmd->tmd3 & (LE_TBUFF|LE_UFLO)) {
le->sc_uflo++;
lereset(unit);
} else if (tmd->tmd3 & LE_LCOL)
le->sc_if.if_collisions++;
else if (tmd->tmd3 & LE_RTRY)
le->sc_if.if_collisions += 16;
} else if (tmd->tmd1 & LE_ONE)
le->sc_if.if_collisions++;
else if (tmd->tmd1 & LE_MORE)
/* what is the real number? */
le->sc_if.if_collisions += 2;
else
le->sc_if.if_opackets++;
gotone++;
} while (--le->sc_txcnt > 0);
#endif
le->sc_if.if_flags &= ~IFF_OACTIVE;
(void) lestart(&le->sc_if);
}
#define LENEXTRMP \
if (++bix == LERBUF) bix = 0, rmd = le->sc_r2->ler2_rmd; else ++rmd
/*
* Ethernet interface receiver interrupt.
* If input error just drop packet.
* Decapsulate packet based on type and pass to type specific
* higher-level input routine.
*/
lerint(unit)
int unit;
{
register struct le_softc *le = &le_softc[unit];
register int bix = le->sc_rmd;
register struct lermd *rmd = &le->sc_r2->ler2_rmd[bix];
#ifdef USELEDS
if (inledcontrol == 0)
ledcontrol(0, 0, LED_LANRCV);
#endif
/*
* Out of sync with hardware, should never happen?
*/
if (rmd->rmd1 & LE_OWN) {
le->sc_rown++;
LERDWR(le->sc_r0, LE_RINT|LE_INEA, le->sc_r1->ler1_rdp);
return;
}
/*
* Process all buffers with valid data
*/
while ((rmd->rmd1 & LE_OWN) == 0) {
int len = rmd->rmd3;
/* Clear interrupt to avoid race condition */
LERDWR(le->sc_r0, LE_RINT|LE_INEA, le->sc_r1->ler1_rdp);
if (rmd->rmd1 & LE_ERR) {
le->sc_rmd = bix;
lererror(unit, "bad packet");
le->sc_if.if_ierrors++;
} else if ((rmd->rmd1 & (LE_STP|LE_ENP)) != (LE_STP|LE_ENP)) {
/*
* Find the end of the packet so we can see how long
* it was. We still throw it away.
*/
do {
LERDWR(le->sc_r0, LE_RINT|LE_INEA,
le->sc_r1->ler1_rdp);
rmd->rmd3 = 0;
rmd->rmd1 = LE_OWN;
LENEXTRMP;
} while (!(rmd->rmd1 & (LE_OWN|LE_ERR|LE_STP|LE_ENP)));
le->sc_rmd = bix;
lererror(unit, "chained buffer");
le->sc_rxlen++;
/*
* If search terminated without successful completion
* we reset the hardware (conservative).
*/
if ((rmd->rmd1 & (LE_OWN|LE_ERR|LE_STP|LE_ENP)) !=
LE_ENP) {
lereset(unit);
return;
}
} else
leread(unit, le->sc_r2->ler2_rbuf[bix], len);
rmd->rmd3 = 0;
rmd->rmd1 = LE_OWN;
LENEXTRMP;
}
le->sc_rmd = bix;
}
leread(unit, buf, len)
int unit;
char *buf;
int len;
{
register struct le_softc *le = &le_softc[unit];
register struct ether_header *et;
struct mbuf *m;
int off, resid, flags;
le->sc_if.if_ipackets++;
et = (struct ether_header *)buf;
et->ether_type = ntohs((u_short)et->ether_type);
/* adjust input length to account for header and CRC */
len = len - sizeof(struct ether_header) - 4;
#define ledataaddr(et, off, type) ((type)(((caddr_t)((et)+1)+(off))))
if (et->ether_type >= ETHERTYPE_TRAIL &&
et->ether_type < ETHERTYPE_TRAIL+ETHERTYPE_NTRAILER) {
off = (et->ether_type - ETHERTYPE_TRAIL) * 512;
if (off >= ETHERMTU)
return; /* sanity */
et->ether_type = ntohs(*ledataaddr(et, off, u_short *));
resid = ntohs(*(ledataaddr(et, off+2, u_short *)));
if (off + resid > len)
return; /* sanity */
len = off + resid;
} else
off = 0;
if (len <= 0) {
/* if (ledebug)
log(LOG_WARNING,
"le%d: ierror(runt packet): from %s: len=%d\n",
unit, ether_sprintf(et->ether_shost), len);
*/ le->sc_runt++;
le->sc_if.if_ierrors++;
return;
}
flags = 0;
if (bcmp((caddr_t)etherbroadcastaddr,
(caddr_t)et->ether_dhost, sizeof(etherbroadcastaddr)) == 0)
flags |= M_BCAST;
if (et->ether_dhost[0] & 1)
flags |= M_MCAST;
#if NBPFILTER > 0
/*
* Check if there's a bpf filter listening on this interface.
* If so, hand off the raw packet to enet.
*/
if (le->sc_if.if_bpf) {
bpf_tap(le->sc_if.if_bpf, buf, len + sizeof(struct ether_header));
/*
* Keep the packet if it's a broadcast or has our
* physical ethernet address (or if we support
* multicast and it's one).
*/
if (
#ifdef MULTICAST
(flags & (M_BCAST | M_MCAST)) == 0 &&
#else
(flags & M_BCAST) == 0 &&
#endif
bcmp(et->ether_dhost, le->sc_addr,
sizeof(et->ether_dhost)) != 0)
return;
}
#endif
/*
* Pull packet off interface. Off is nonzero if packet
* has trailing header; m_devget will then force this header
* information to be at the front, but we still have to drop
* the type and length which are at the front of any trailer data.
*/
m = m_devget((char *)(et + 1), len, off, &le->sc_if, 0);
if (m == 0)
return;
m->m_flags |= flags;
ether_input(&le->sc_if, et, m);
}
/*
* Routine to copy from mbuf chain to transmit
* buffer in board local memory.
*/
leput_test(lebuf, m)
register char *lebuf;
register struct mbuf *m;
{
struct rec_buf * buf_ptr;
buf_ptr = (struct rec_buf *)lebuf;
buf_ptr->index ++;
leput(&buf_ptr->frame[buf_ptr -> index], m);
}
/*
* Routine to copy from mbuf chain to transmit
* buffer in board local memory.
*/
leput(lebuf, m)
register char *lebuf;
register struct mbuf *m;
{
register struct mbuf *mp;
register int len, tlen = 0;
for (mp = m; mp; mp = mp->m_next) {
len = mp->m_len;
if (len == 0)
continue;
tlen += len;
bcopy(mtod(mp, char *), lebuf, len);
lebuf += len;
}
m_freem(m);
if (tlen < LEMINSIZE) {
// bzero(lebuf, LEMINSIZE - tlen);
tlen = LEMINSIZE;
}
hp_buf.frame[hp_buf.index].len = tlen;
return(tlen);
}
/*
* Process an ioctl request.
*/
leioctl(ifp, cmd, data)
register struct ifnet *ifp;
int cmd;
caddr_t data;
{
register struct ifaddr *ifa = (struct ifaddr *)data;
struct le_softc *le = &le_softc[ifp->if_unit];
struct lereg1 *ler1 = le->sc_r1;
int s = splimp(), error = 0;
#define IA_SIN_TEST
switch (cmd) {
case SIOCSIFADDR:
ifp->if_flags |= IFF_UP;
switch (ifa->ifa_addr->sa_family) {
#ifdef INET
case AF_INET:
leinit(ifp->if_unit); /* before arpwhohas */
#ifdef IA_SIN_TEST
((struct arpcom *)ifp)->ac_ipaddr =
/*IA_SIN(ifa)->sin_addr*/
((((struct in_ifaddr *)(ifa))->ia_addr.sin_addr));
arpwhohas((struct arpcom *)ifp,
&((((struct in_ifaddr *)(ifa))->ia_addr).sin_addr));
/*&IA_SIN(ifa)->sin_addr);*/
#endif
break;
#endif
#ifdef NS
case AF_NS:
{
register struct ns_addr *ina = &(IA_SNS(ifa)->sns_addr);
if (ns_nullhost(*ina))
ina->x_host = *(union ns_host *)(le->sc_addr);
else {
/*
* The manual says we can't change the address
* while the receiver is armed,
* so reset everything
*/
ifp->if_flags &= ~IFF_RUNNING;
LERDWR(le->sc_r0, LE_STOP, ler1->ler1_rdp);
bcopy((caddr_t)ina->x_host.c_host,
(caddr_t)le->sc_addr, sizeof(le->sc_addr));
}
leinit(ifp->if_unit); /* does le_setaddr() */
break;
}
#endif
default:
leinit(ifp->if_unit);
break;
}
break;
#if defined (CCITT) && defined (LLC)
case SIOCSIFCONF_X25:
ifp -> if_flags |= IFF_UP;
ifa -> ifa_rtrequest = cons_rtrequest;
error = x25_llcglue(PRC_IFUP, ifa -> ifa_addr);
if (error == 0)
leinit(ifp -> if_unit);
break;
#endif /* CCITT && LLC */
case SIOCSIFFLAGS:
if ((ifp->if_flags & IFF_UP) == 0 &&
ifp->if_flags & IFF_RUNNING) {
LERDWR(le->sc_r0, LE_STOP, ler1->ler1_rdp);
ifp->if_flags &= ~IFF_RUNNING;
} else if (ifp->if_flags & IFF_UP &&
(ifp->if_flags & IFF_RUNNING) == 0)
leinit(ifp->if_unit);
/*
* If the state of the promiscuous bit changes, the interface
* must be reset to effect the change.
*/
if (((ifp->if_flags ^ le->sc_iflags) & IFF_PROMISC) &&
(ifp->if_flags & IFF_RUNNING)) {
le->sc_iflags = ifp->if_flags;
lereset(ifp->if_unit);
lestart(ifp);
}
break;
#ifdef MULTICAST
case SIOCADDMULTI:
case SIOCDELMULTI:
/* Update our multicast list */
error = (cmd == SIOCADDMULTI) ?
ether_addmulti((struct ifreq *)data, &le->sc_ac) :
ether_delmulti((struct ifreq *)data, &le->sc_ac);
if (error == ENETRESET) {
/*
* Multicast list has changed; set the hardware
* filter accordingly.
*/
lereset(ifp->if_unit);
error = 0;
}
break;
#endif
default:
error = EINVAL;
}
splx(s);
return (error);
}
leerror(unit, stat)
int unit;
int stat;
{
if (!ledebug)
return;
/*
* Not all transceivers implement heartbeat
* so we only log CERR once.
*/
if ((stat & LE_CERR) && le_softc[unit].sc_cerr)
return;
#if 0
log(LOG_WARNING,
"le%d: error: stat=%b\n", unit,
stat,
"\20\20ERR\17BABL\16CERR\15MISS\14MERR\13RINT\12TINT\11IDON\10INTR\07INEA\06RXON\05TXON\04TDMD\03STOP\02STRT\01INIT");
#endif
}
lererror(unit, msg)
int unit;
char *msg;
{
register struct le_softc *le = &le_softc[unit];
register struct lermd *rmd;
int len;
if (!ledebug)
return;
rmd = &le->sc_r2->ler2_rmd[le->sc_rmd];
len = rmd->rmd3;
#if 0
log(LOG_WARNING,
"le%d: ierror(%s): from %s: buf=%d, len=%d, rmd1=%b\n",
unit, msg,
len > 11 ?
ether_sprintf((u_char *)&le->sc_r2->ler2_rbuf[le->sc_rmd][6]) :
"unknown",
le->sc_rmd, len,
rmd->rmd1,
"\20\20OWN\17ERR\16FRAM\15OFLO\14CRC\13RBUF\12STP\11ENP");
#endif
}
lexerror(unit)
int unit;
{
register struct le_softc *le = &le_softc[unit];
register struct letmd *tmd;
int len;
if (!ledebug)
return;
tmd = le->sc_r2->ler2_tmd;
len = -tmd->tmd2;
#if 0
log(LOG_WARNING,
"le%d: oerror: to %s: buf=%d, len=%d, tmd1=%b, tmd3=%b\n",
unit,
len > 5 ?
ether_sprintf((u_char *)&le->sc_r2->ler2_tbuf[0][0]) :
"unknown",
0, len,
tmd->tmd1,
"\20\20OWN\17ERR\16RES\15MORE\14ONE\13DEF\12STP\11ENP",
tmd->tmd3,
"\20\20BUFF\17UFLO\16RES\15LCOL\14LCAR\13RTRY");
#endif
}
void delete_ethernet_interface_r()
{
int cmd;
struct socket so;
struct ifreq ifreq_rec;
struct ifnet * ifnet_eth_ptr;
memset (ifreq_rec.ifr_name,0,IFNAMSIZ);
memcpy(ifreq_rec.ifr_name,"eth1",5);
ifnet_eth_ptr = ifunit(ifreq_rec.ifr_name);
if(ifnet_eth_ptr == NULL)
return;
if_detach(ifnet_eth_ptr);
}
/*
just two ethernet interface.
*/
void main_le()
{
int i;
struct hp_device test_dev;
test_dev.hp_unit = 0;
memset(test_dev.hp_addr,1, 10);
leattach(&test_dev);
test_dev.hp_unit = 1;
memset(test_dev.hp_addr,2, 10);
leattach(&test_dev);
/* to simulate the mac address
le_softc[0].sc_addr[0] = 0X08;
le_softc[0].sc_addr[1] = 0X00;
le_softc[0].sc_addr[2] = 0X20;
le_softc[0].sc_addr[3] = 0X03;
le_softc[0].sc_addr[4] = 0XF6;
le_softc[0].sc_addr[5] = 0X42;
le_softc[1].sc_addr[0] = 0X08;
le_softc[1].sc_addr[1] = 0X00;
le_softc[1].sc_addr[2] = 0X20;
le_softc[1].sc_addr[3] = 0X03;
le_softc[1].sc_addr[4] = 0X06;
le_softc[1].sc_addr[5] = 0X02;
printf("le%d: hardware address %s\n", 0,
ether_sprintf(le_softc[0].sc_addr));
printf("le%d: hardware address %s\n", 1,
ether_sprintf(le_softc[1].sc_addr));
*/
}
void fake_arp_msg_r( char * buf)
{
struct ether_header *et;
struct ether_arp *ea;
char * cur;
et = (struct ether_header *)buf;
et->ether_type = ((u_short)et->ether_type);
if (et->ether_type == 0x0608 /*ETHERTYPE_ARP*/)
{
cur = buf + sizeof(struct ether_header);
ea = (struct ether_arp *)(cur);
ea->arp_sha[0] = 55;
// ea->arp_tha[0] = 55;
ea->arp_spa[3] = 22;
// ea->arp_tpa[3] = 88;
}
}
void input_eth()
{
int i;
for (i = 1; i <= hp_buf.index; i++)
{
/* simulate the arp message*/
fake_arp_msg_r(&hp_buf.frame[i]);
leread(1, &hp_buf.frame[i], hp_buf.frame[i].len);
/* leread(0, &hp_buf.frame[i], hp_buf.frame[i].len); */
}
}
| [
"[email protected]"
] | |
4d7f619e5756b830f39dc28fcd3d27c9fd7e8dea | 9b6e83f8f5c891ee7cabd867dba2e19b82a095e3 | /usrtos/ref/sradio/gen/gentran.c | e9184343fc14c7f6f0db6a4683da77a210b09ab4 | [] | no_license | a4a881d4/cpp11 | cb9177cbecf5ea890d54d1a8c91aca9a64f8f5d4 | a2028bf079bceb9d3e54d37e756182e89fcb3f12 | refs/heads/master | 2020-03-25T18:18:22.776238 | 2019-05-06T02:25:48 | 2019-05-06T02:25:48 | 144,023,458 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 3,560 | c | #include<stdio.h>
#define outins( out, in0, in1, ins ) printf("\tt%2.2x = %s( t%2.2x, t%2.2x );\n",out,ins,in0,in1);
#define inMem( out, in0, in1, ins ) printf("\tt%2.2x = %s( inbuf[0x%3.3x], inbuf[0x%3.3x] );\n",out,ins,in0,in1);
#define outMem( out, in0, in1, ins ) printf("\toutbuf[0x%3.3x] = %s( t%2.2x, t%2.2x );\n",out,ins,in0,in1);
int flip(int in)
{
int i;
int ret=0;
for( i=0;i<4;i++ )
{
ret<<=1;
ret|=in&1;
in>>=1;
}
return ret;
}
void build( int c, int r, int flag )
{
int inIndex[16];
int outIndex[16];
char ins0[128];
int i;
for( i=0;i<16;i++ )
{
inIndex[i]=c*4*16+r+i*4;
outIndex[i]=r*4*16+c+flip(i)*4;
}
if( flag==0 )
sprintf(ins0,"_mm_unpacklo_epi8");
else
sprintf(ins0,"_mm_unpackhi_epi8");
for( i=0;i<8;i++ )
inMem( i, inIndex[2*i], inIndex[2*i+1], ins0 );
sprintf(ins0,"_mm_unpacklo_epi16");
for( i=0;i<4;i++ )
outins( 2*i+8, 2*i, 2*i+1, ins0 );
sprintf(ins0,"_mm_unpackhi_epi16");
for( i=0;i<4;i++ )
outins( 2*i+1+8, 2*i, 2*i+1, ins0 );
sprintf(ins0,"_mm_unpacklo_epi32");
outins( 0, 8+0, 8+2, ins0 );
outins( 1, 8+1, 8+3, ins0 );
outins( 4, 8+4, 8+6, ins0 );
outins( 5, 8+5, 8+7, ins0 );
sprintf(ins0,"_mm_unpackhi_epi32");
outins( 2, 8+0, 8+2, ins0 );
outins( 3, 8+1, 8+3, ins0 );
outins( 6, 8+4, 8+6, ins0 );
outins( 7, 8+5, 8+7, ins0 );
sprintf(ins0,"_mm_unpacklo_epi64");
for( i=0;i<4;i++ )
outMem( outIndex[2*i+flag], i, i+4, ins0 );
sprintf(ins0,"_mm_unpackhi_epi64");
for( i=0;i<4;i++ )
outMem( outIndex[2*i+8+flag], i, i+4, ins0 );
}
void buildonce( int c, int r )
{
int inIndex[16];
int outIndex[16];
char ins0[128];
int i,j;
for( i=0;i<16;i++ )
{
inIndex[i]=c*4*16+r+i*4;
outIndex[i]=r*4*16+c+flip(i)*4;
}
sprintf(ins0,"_mm_unpacklo_epi8");
for( i=0;i<8;i++ )
inMem( 2*i, inIndex[2*i], inIndex[2*i+1], ins0 );
sprintf(ins0,"_mm_unpackhi_epi8");
for( i=0;i<8;i++ )
inMem( 2*i+1, inIndex[2*i], inIndex[2*i+1], ins0 );
sprintf(ins0,"_mm_unpacklo_epi16");
for( i=0;i<4;i++ )
for( j=0;j<2;j++ )
outins( 4*i+16+j, 4*i+j, 4*i+2+j, ins0 );
sprintf(ins0,"_mm_unpackhi_epi16");
for( i=0;i<4;i++ )
for( j=0;j<2;j++ )
outins( 4*i+16+j+2, 4*i+j, 4*i+2+j, ins0 );
sprintf(ins0,"_mm_unpacklo_epi32");
for( i=0;i<2;i++ )
for( j=0;j<4;j++ )
outins( 8*i+j, 8*i+j+16, 8*i+4+j+16, ins0 );
sprintf(ins0,"_mm_unpackhi_epi32");
for( i=0;i<2;i++ )
for( j=0;j<4;j++ )
outins( 8*i+j+4, 8*i+j+16, 8*i+4+j+16, ins0 );
sprintf(ins0,"_mm_unpacklo_epi64");
for( i=0;i<8;i++ )
outMem( outIndex[i], i, i+8, ins0 );
sprintf(ins0,"_mm_unpackhi_epi64");
for( i=0;i<8;i++ )
outMem( outIndex[i+8], i, i+8, ins0 );
}
int tran1()
{
int i,j;
printf("__m128i *inbuf=(__m128i *)ca_in;\n");
printf("__m128i *outbuf=(__m128i *)ca_out;\n");
printf("__m128i ");
for( i=0;i<15;i++ ) printf("t%2.2x, ",i);
printf("t%2.2x;\n",15);
for( i=0;i<4;i++ ) {
for( j=0;j<4;j++ ) {
build(i,j,0);
build(i,j,1);
}
}
return 0;
}
int tran2()
{
int i,j;
for( i=0;i<64;i++ )
for( j=0;j<64;j++ )
printf("ca_out[0x%3.3x]=ca_in[0x%3.3x];\n",i*64+j,i+j*64);
return 0;
}
int tran3()
{
int i,j;
printf("__m128i *inbuf=(__m128i *)ca_in;\n");
printf("__m128i *outbuf=(__m128i *)ca_out;\n");
printf("__m128i ");
for( i=0;i<31;i++ ) printf("t%2.2x, ",i);
printf("t%2.2x;\n",31);
for( i=0;i<4;i++ ) {
for( j=0;j<4;j++ ) {
buildonce(i,j);
}
}
return 0;
}
int main( int argc, char *argv[])
{
if( argc!=2 )
return -1;
if( *argv[1]=='1' )
tran1();
else if( *argv[1]=='2' )
tran2();
else
tran3();
return 0;
}
| [
"[email protected]"
] | |
a3adf3c3b6bc2506d88f13d754d0ef36ab939ed5 | 3352d8038f40258ab2603e15ad35a8e7a643b628 | /rtsp_server_c/include/fenice/rtp_shm.h | fe308a2f519c88f7824ece2a0846193327487301 | [] | no_license | kuangruan/rtsp | 48b0a7a3462b1438fff1db5fa5a6534339d01340 | bcfc9a063558621a4a56e282397cdfac72bdec8c | refs/heads/master | 2023-03-17T03:41:30.783274 | 2018-09-18T08:45:29 | 2018-09-18T08:45:29 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,380 | h | /* *
* $Id: rtp_shm.h 298 2006-02-28 08:58:07Z shawill $
*
* This file is part of Fenice
*
* Fenice -- Open Media Server
*
* Copyright (C) 2004 by
*
* - Giampaolo Mancini <[email protected]>
* - Francesco Varano <[email protected]>
* - Marco Penno <[email protected]>
* - Federico Ridolfo <[email protected]>
* - Eugenio Menegatti <[email protected]>
* - Stefano Cau
* - Giuliano Emma
* - Stefano Oldrini
*
* Fenice is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Fenice is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Fenice; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* */
#ifndef RTP_SHM_H_
#define RTP_SHM_H_
int load_RTP_SHM(media_entry *);
int read_RTP_SHM(media_entry *,uint8 *,uint32 *,double *, int *, uint8 *);
int free_RTP_SHM(void *);
#endif /*RTP_SHM_H_*/
| [
"[email protected]"
] | |
fc9c95197d4263c100486795224dfff2b7fc189b | a0f14fb4ac5265c7d651623c1596ffc4af826a39 | /program14.c | 55bc2958e1a7927bda5911e5cddb4135339052da | [] | no_license | TheLogicalNights/c_programs | cf5366f3c142f20866567b492f1617656325aaa9 | ac9b42ea5b97169e0d72bc80f83f85b86342aec7 | refs/heads/main | 2023-08-14T19:06:55.890588 | 2021-09-06T18:38:00 | 2021-09-06T18:38:00 | 404,301,579 | 0 | 0 | null | 2021-09-08T10:15:51 | 2021-09-08T10:15:50 | null | UTF-8 | C | false | false | 540 | c | //Write a program which accepts number from user and print
//factor of that number.
//Input:6
//Output: 1 2 3 4 6
#include<stdio.h>
void Factors(int iNo)
{
int iCnt=0;
if(iNo<=0)
{
iNo=-iNo;
}
for(iCnt=1;iCnt<iNo/2;iCnt++)
{
if(iNo%iCnt==0)
{
printf("%d\n",iCnt);
}
}
}
int main()
{
int iValue=0;
printf("Enter Number:");
scanf("%d",&iValue);
Factors(iValue);
return 0;
}
| [
"[email protected]"
] | |
326e5d668e92134e663f58805270061416411231 | 3ecbbb7bd8d6e4e35f1bd924c5898ec0fb7fa508 | /examples/iot_paltform/mqtt_example/main/app_main.c | 85db99950865f932384e3f4e3fa5b93c06198fe2 | [
"MIT"
] | permissive | rillhu/esp32-aliyun-demo | fcec6f20f03f29db0d8dc75e8aae122869aa1853 | 0b88037910c2e5ea0c4e6822d8305c36b9843497 | refs/heads/master | 2022-03-07T11:53:44.617228 | 2022-03-03T19:29:43 | 2022-03-03T19:29:43 | 142,966,892 | 9 | 2 | Apache-2.0 | 2020-04-16T16:07:40 | 2018-07-31T05:36:03 | C | UTF-8 | C | false | false | 2,574 | c | /*
* ESPRSSIF MIT License
*
* Copyright (c) 2018 <ESPRESSIF SYSTEMS (SHANGHAI) PTE LTD>
*
* Permission is hereby granted for use on ESPRESSIF SYSTEMS ESP32 only, in which case,
* it is free of charge, to any person obtaining a copy of this software and associated
* documentation files (the "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished
* to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
#include <string.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_err.h"
#include "esp_event.h"
#include "esp_log.h"
#include "infra_compat.h"
#include "mqtt_solo.h"
#include "conn_mgr.h"
/* The examples use simple WiFi configuration that you can set via
'make menuconfig'.
If you'd rather not, just change the below entries to strings with
the config you want - ie #define EXAMPLE_WIFI_SSID "mywifissid"
*/
#define EXAMPLE_WIFI_SSID CONFIG_WIFI_SSID
#define EXAMPLE_WIFI_PASS CONFIG_WIFI_PASSWORD
static const char* TAG = "app main";
static bool mqtt_started = false;
static esp_err_t wifi_event_handle(void *ctx, system_event_t *event)
{
switch (event->event_id) {
case SYSTEM_EVENT_STA_GOT_IP:
if (mqtt_started == false) {
xTaskCreate((void (*)(void *))mqtt_main, "mqtt_example", 10240, NULL, 5, NULL);
mqtt_started = true;
}
break;
default:
break;
}
return ESP_OK;
}
void app_main()
{
conn_mgr_init();
conn_mgr_register_wifi_event(wifi_event_handle);
conn_mgr_set_wifi_config_ext((const uint8_t *)EXAMPLE_WIFI_SSID, strlen(EXAMPLE_WIFI_SSID), (const uint8_t *)EXAMPLE_WIFI_PASS, strlen(EXAMPLE_WIFI_PASS));
IOT_SetLogLevel(IOT_LOG_INFO);
conn_mgr_start();
}
| [
"[email protected]"
] | |
e71b32f023b4b9c86669fa5af59d08d78bace8e1 | a280aa9ac69d3834dc00219e9a4ba07996dfb4dd | /regularexpress/home/weilaidb/work/kernel/linux-3.0.8/net/ipv6/addrconf_core.c | af62d2e491dcac2050824ceca08e66a8a72d64ec | [] | no_license | weilaidb/PythonExample | b2cc6c514816a0e1bfb7c0cbd5045cf87bd28466 | 798bf1bdfdf7594f528788c4df02f79f0f7827ce | refs/heads/master | 2021-01-12T13:56:19.346041 | 2017-07-22T16:30:33 | 2017-07-22T16:30:33 | 68,925,741 | 4 | 2 | null | null | null | null | UTF-8 | C | false | false | 195 | c | #define IPV6_ADDR_SCOPE_TYPE(scope) ((scope) << 16)
static inline unsigned ipv6_addr_scope2type(unsigned scope)
int __ipv6_addr_type(const struct in6_addr *addr)
EXPORT_SYMBOL(__ipv6_addr_type);
| [
"[email protected]"
] | |
282d4f8503e5875e02f3022ec4a16360036401ba | 8cf176201807f9903f9a579219448a452f263728 | /MOLY.LR9.W1444.MD.LWTG.MP.V88/interface/sap/mw/ltecsr_msgid.h | d51769b00e7d01b7bc852ba9e4e8561efcc91661 | [] | no_license | hefei93/MTK_BASEBANDS | 9a647b69c455cfebb6c45700027741475f5f9a73 | 759f9608490031fe9666620984d041db36f7424c | refs/heads/master | 2020-12-14T15:41:05.607310 | 2019-01-04T13:29:36 | 2019-01-04T13:29:36 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 4,665 | h | /*****************************************************************************
* Copyright Statement:
* --------------------
* This software is protected by Copyright and the information contained
* herein is confidential. The software may not be copied and the information
* contained herein may not be used or disclosed except with the written
* permission of MediaTek Inc. (C) 2005
*
* BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
* THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
* RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
* AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
* NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
* SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
* SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
* THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
* NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
* SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
*
* BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
* LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
* AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
* OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
* MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
*
* THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
* WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
* LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
* RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
* THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
*
*****************************************************************************/
/*****************************************************************************
*
* Filename:
* ---------
* ltecsr_msgid.h
*
* Project:
* --------
* MOLY
*
* Description:
* ------------
* IMX and LTECSR SAP message definition
*
* Author:
* -------
* -------
*
*============================================================================
* HISTORY
* Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
*------------------------------------------------------------------------------
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
*------------------------------------------------------------------------------
* Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
*============================================================================
****************************************************************************/
/* LTECSR INTERFACE */
#include "module_msg_range.h"
#ifndef _LTECSR_MSG_H
#define _LTECSR_MSG_H
MODULE_MSG_BEGIN( MSG_ID_LTECSR_CODE_BEGIN )
/* FROM: IMC External */
MSG_ID_LTECSR_MEDIA_NEW=MSG_ID_LTECSR_CODE_BEGIN,
MSG_ID_LTECSR_MEDIA_DEL,
MSG_ID_LTECSR_MEDIA_UPDATE,
MSG_ID_LTECSR_MEDIA_ACTIVE,
/* WFC*/
MSG_ID_LTECSR_IMS_INIT_REQ,
MSG_ID_LTECSR_IMS_INIT_CNF,
MSG_ID_LTECSR_DTMF_REQ, /* IN: cid, (sid), digit, in/out band, time:0-stop, non-zero: play, -1: periodically */
MSG_ID_LTECSR_ECFG_REQ,
/* FROM: MOD_L1SP */
MSG_ID_LTECSR_VOICE_UL_DATA_NOTIFY,
MSG_ID_LTECSR_VOICE_UL_MUTE_NOTIFY,
/* LTECSR Internal */
/* media */
MSG_ID_LTECSR_MEDIA_START, /* IN: cid, sid OUT: result */
MSG_ID_LTECSR_MEDIA_STOP, /* IN: cid, sid OUT: result */
/* transmit mode */
MSG_ID_LTECSR_MEDIA_XMIT_MODE_SET, /* IN: cid, sid, xmit_mode */
MSG_ID_LTECSR_MEDIA_XMIT_MODE_GET, /* IN: cid, sid OUT: xmit_mode */
/* dtmf */
MSG_ID_LTECSR_DTMF_PLAY, /* IN: cid, (sid), digit, direction:0-local, 1-remote, duration:-1(infinite), 0(stop), others(ms) */
MSG_ID_LTECSR_DTMF_STOP, /* IN: cid*/
/* codec payload type */
MSG_ID_LTECSR_MEDIA_PT_SET, /* IN: cid, sid, codec, pt */
//MSG_ID_LTECSR_MEDIA_PT_GET, /* IN: cid, sid */
/* rtcp */
MSG_ID_LTECSR_RTCP_SEND_INTERVAL_SET, /* IN: cid, sid, rtcp send interval */
//MSG_ID_LTECSR_RTCP_SEND_INTERVAL_GET, /* IN: cid, sid OUT: cid, sid */
MODULE_MSG_END( MSG_ID_LTECSR_CODE_TAIL )
#endif /* _LTECSR_MSG_H */
| [
"[email protected]"
] | |
c7a5671f4dd1ee699b9f98b5e223f6d01e5169a9 | 545cdbf11b87784264196257e1645dd2be38ce4f | /STM32L431RC_FLASH_TEST/user/inc/user_flash.h | f00b114c95b4b66c72a2d84a377ed494541aa7e9 | [] | no_license | meriororen/bearpi_template | 17ed2b5cc134e5203a8750269fd2f45836154f23 | c2e0f40c506eb4610a43a8f109212e8489cca056 | refs/heads/main | 2023-03-15T21:07:07.456315 | 2021-03-08T15:35:07 | 2021-03-08T15:35:07 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 2,086 | h | //
// Created by luozw on 2021/3/7.
//
#ifndef STM32L431RC_FLASH_TEST_USER_FLASH_H
#define STM32L431RC_FLASH_TEST_USER_FLASH_H
#include "stm32l4xx_hal.h"
#define ADDR 0x0803f800 //写地址
void Flash_ErasePages(uint32_t faddr, uint32_t nbpage);
/***************************************************************
* 函数名称: Flash_WriteOneWord
* 说 明: 向指定地址中写入一个32位的数据
* 参 数: faddr,Flash地址
* fdata32,Flash地址内的一个32位的数据
* 返 回 值: 写FLASH返回的状态
***************************************************************/
uint8_t Flash_WriteOneWord(uint32_t faddr,uint32_t fdata32);
/***************************************************************
* 函数名称: Flash_WriteDoubleWord
* 说 明: 向指定地址中写入一个双字(64位)数据
* 参 数: faddr,Flash地址
* fdata64,Flash地址内的一个双字(64位)数据
* 返 回 值: 写FLASH返回的状态
***************************************************************/
uint8_t Flash_WriteDoubleWord(uint32_t faddr, uint64_t fdata64);
/***************************************************************
* 函数名称: Flash_Write32
* 说 明: 向指定地址中写入fdataNum个32位的数据
* 参 数: faddr,Flash起始地址
* fdata,Flash地址内的32位的数据指针
* fdata32Num,要写入的字(32位)数的数量
* 返 回 值: 无
***************************************************************/
void Flash_Write32(uint32_t faddr,uint32_t *fdata32, uint32_t fdata32Num);
/***************************************************************
* 函数名称: Flash_Write64
* 说 明: 向指定地址中写入fdataNum个64位的数据
* 参 数: faddr,Flash起始地址
* fdata,Flash地址内的64位的数据指针
* fdata64Num,要写入的字(64位)数的数量
* 返 回 值: 无
***************************************************************/
void Flash_Write64(uint32_t faddr,uint64_t *fdata64, uint32_t fdata64Num);
void Flash_test(void);
#endif //STM32L431RC_FLASH_TEST_USER_FLASH_H
| [
"[email protected]"
] | |
5d05e4bcd251027c8c5aa0436f6d02697980fdf1 | c317714693c8ff4b1b3848f4503beaf1d719ebe2 | /chanfd.c | aa466bf632ef0437681fc2f563319ba81b122a1e | [
"BSD-2-Clause",
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | cota/chanfd | 8587136d0f2225c33fdd762faa42683ba78ffd1b | 6ebc97cd4f165d89aae873ccf58361b86de85beb | refs/heads/master | 2021-01-10T13:17:52.052751 | 2016-02-21T04:21:31 | 2016-02-21T04:21:31 | 51,890,750 | 11 | 3 | null | null | null | null | UTF-8 | C | false | false | 9,371 | c | /* Licensed under Simplified BSD - see LICENSE file for details */
#include <sys/eventfd.h>
#include <sys/select.h>
#include <sys/mman.h>
#include <errno.h>
#include <pthread.h>
#include <stdbool.h>
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <stdio.h>
#include <ck_spinlock.h>
#include "chanfd.h"
struct unbf_channel {
int ack_fd;
};
struct buff_channel {
size_t in;
size_t out;
ck_spinlock_t lock;
};
struct chanfd {
uint64_t elems;
uintptr_t datap; /* tagged pointer with 'buffered' bool */
size_t size;
size_t max_elems;
union {
struct unbf_channel unbf;
struct buff_channel buff;
} chan;
int sender_fd;
int receiver_fd;
} CK_CC_ALIGN(sizeof(uintptr_t));
static inline uint8_t *to_ptr(uintptr_t val)
{
return (uint8_t *)(val & ~1);
}
static inline bool is_buffered(struct chanfd *ch)
{
return ch->datap & 1;
}
static inline void up(int fd)
{
ssize_t n;
uint64_t v = 1;
n = write(fd, &v, sizeof(v));
assert(n == sizeof(v));
}
static inline void down(int fd)
{
ssize_t n;
uint64_t v;
n = read(fd, &v, sizeof(v));
assert(n == sizeof(v));
}
static inline int buff_channel_init(struct chanfd *ch)
{
struct buff_channel *bchan = &ch->chan.buff;
ck_spinlock_init(&bchan->lock);
return 0;
}
static inline int unbf_channel_init(struct chanfd *ch)
{
struct unbf_channel *uchan = &ch->chan.unbf;
int flags = EFD_CLOEXEC | EFD_SEMAPHORE;
uchan->ack_fd = eventfd(0, flags);
if (CK_CC_UNLIKELY(uchan->ack_fd < 0))
return -1;
return 0;
}
static inline void unbf_channel_destroy(struct chanfd *ch)
{
struct unbf_channel *uchan = &ch->chan.unbf;
close(uchan->ack_fd);
}
static inline void buff_channel_destroy(struct chanfd *ch)
{ }
/**
* chanfd_create - create channel
* @size: size of element to be exchanged through the channel
* @n_elems: number of elements; 0 for unbuffered channel.
*
* Channels allow to explicitly transfer ownership of objects across
* threads. Normally these objects are structs, so only a pointer to them
* is passed through channels. Moreover, usually these structs are allocated
* in the heap, since sharing stack data is harder to reason about.
*
* Receivers: they always block until there is data.
*
* Senders: in buffered channels (@n_elems > 0), they block only until their
* data has been copied to the buffer. In unbuffered channels (@n_elems == 0),
* they block until the receiver has received the value--i.e. "receiver
* completes first."
*
* Returns a pointer to the newly created channel on success; NULL on error,
* setting errno appropriately.
*
* Note: memory is allocated as MAP_SHARED so that forked processes can share
* channels with their parents.
*
* See also: chanfd_destroy(), chanfd_send(), chanfd_recv()
*/
struct chanfd *chanfd_create(size_t size, size_t n_elems)
{
struct chanfd *chan;
size_t max_elems = n_elems ? n_elems : 1;
size_t bytes = max_elems * size;
int flags = EFD_CLOEXEC | EFD_SEMAPHORE;
uint8_t *data;
int rc;
chan = mmap(NULL, sizeof(*chan), PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, -1, 0);
if (CK_CC_UNLIKELY(chan == MAP_FAILED))
return NULL;
data = mmap(NULL, bytes, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, -1, 0);
if (CK_CC_UNLIKELY(data == MAP_FAILED))
goto err_chan_data;
chan->datap = (uintptr_t)data;
if (CK_CC_UNLIKELY(chan->datap & 1)) {
fprintf(stderr, "%s:%d invalid 1-byte alignment of chanfd_channel struct\n", __func__, __LINE__);
goto err_alignment;
}
if (n_elems > 0)
chan->datap |= 1;
chan->receiver_fd = eventfd(0, flags);
if (CK_CC_UNLIKELY(chan->receiver_fd < 0))
goto err_receiver_fd;
chan->sender_fd = eventfd(max_elems, flags);
if (CK_CC_UNLIKELY(chan->sender_fd < 0))
goto err_sender_fd;
chan->size = size;
chan->max_elems = max_elems;
if (is_buffered(chan))
rc = buff_channel_init(chan);
else
rc = unbf_channel_init(chan);
if (CK_CC_UNLIKELY(rc))
goto err_union;
return chan;
err_union:
close(chan->sender_fd);
err_sender_fd:
close(chan->receiver_fd);
err_receiver_fd:
err_alignment:
munmap(to_ptr(chan->datap), bytes);
err_chan_data:
munmap(chan, sizeof(*chan));
return NULL;
}
/**
* chanfd_destroy - destroy a channel
* @chan: channel to destroy
*
* Frees all allocated data related to channel @chan.
*
* Note: calling this function while there are senders/receivers waiting
* on the channel is a bug.
*
* See also: chanfd_create()
*/
void chanfd_destroy(struct chanfd *chan)
{
if (chan == NULL)
return;
if (is_buffered(chan))
buff_channel_destroy(chan);
else
unbf_channel_destroy(chan);
munmap(to_ptr(chan->datap), chan->max_elems * chan->size);
munmap(chan, sizeof(*chan));
}
/**
* chanfd_receiver_fd - obtain a channel's file descriptor for "receive" monitoring
* @ch: channel to monitor
*
* The returned file descriptor can be used by I/O multiplexing functions
* such as select(2).
*
* NOTE: the file descriptor _must_ be put in the "read" fd set of the monitoring
* call--putting it on _any_ other fd set is a bug.
*
* If the file descriptor can be read, chanfd_recv() can then be called on
* the channel without blocking.
*
* See also: chanfd_sender_fd()
*/
int chanfd_receiver_fd(struct chanfd *ch)
{
return ch->receiver_fd;
}
/**
* chanfd_sender_fd - obtain a channel's file descriptor for "send" monitoring
* @ch: channel to monitor
*
* The returned file descriptor can be used by I/O multiplexing functions
* such as select(2).
*
* NOTE: As is the case for chanfd_receiver_fd(), the file descriptor _must_ be put
* in the "read" fd set of the monitoring call--putting it on _any_ other
* fd set is a bug.
*
* If the file descriptor can be read, chanfd_send() can then be called on
* the channel without blocking.
*
* See also: chanfd_receiver_fd()
*/
int chanfd_sender_fd(struct chanfd *ch)
{
return ch->sender_fd;
}
static void unbf_channel_recv(struct chanfd *ch, void *data)
{
struct unbf_channel *uchan = &ch->chan.unbf;
down(ch->receiver_fd);
memcpy(data, to_ptr(ch->datap), ch->size);
up(uchan->ack_fd);
up(ch->sender_fd);
}
static inline void __inc(size_t *val, size_t max_elems)
{
*val += 1;
if (*val == max_elems)
*val = 0;
}
static inline void buff_channel_lock(struct chanfd *ch)
{
struct buff_channel *bchan = &ch->chan.buff;
if (ch->max_elems != 1)
ck_spinlock_lock(&bchan->lock);
}
static inline void buff_channel_unlock(struct chanfd *ch)
{
struct buff_channel *bchan = &ch->chan.buff;
if (ch->max_elems != 1)
ck_spinlock_unlock(&bchan->lock);
}
static void buff_channel_recv(struct chanfd *ch, void *data)
{
struct buff_channel *bchan = &ch->chan.buff;
down(ch->receiver_fd);
buff_channel_lock(ch);
memcpy(data, to_ptr(ch->datap) + bchan->out * ch->size, ch->size);
__inc(&bchan->out, ch->max_elems);
buff_channel_unlock(ch);
up(ch->sender_fd);
}
/**
* chanfd_recv - receive data from channel
* @ch: channel to receive from
* @data: pointer to where the data should be copied to
*
* Blocks until there is data in the channel. The amount of bytes copied
* to @data is determined upon channel creation with chanfd_create().
*
* See also: chanfd_receiver_fd()
*/
void chanfd_recv(struct chanfd *ch, void *data)
{
if (is_buffered(ch))
buff_channel_recv(ch, data);
else
unbf_channel_recv(ch, data);
ck_pr_dec_64(&ch->elems);
ck_pr_fence_store();
}
static void unbf_channel_send(struct chanfd *ch, const void *data)
{
struct unbf_channel *uchan = &ch->chan.unbf;
down(ch->sender_fd);
memcpy(to_ptr(ch->datap), data, ch->size);
up(ch->receiver_fd);
down(uchan->ack_fd);
}
static void buff_channel_send(struct chanfd *ch, const void *data)
{
struct buff_channel *bchan = &ch->chan.buff;
down(ch->sender_fd);
buff_channel_lock(ch);
memcpy(to_ptr(ch->datap) + bchan->in * ch->size, data, ch->size);
__inc(&bchan->in, ch->max_elems);
buff_channel_unlock(ch);
up(ch->receiver_fd);
}
/**
* chanfd_is_empty - check whether a channel is empty
* @chan: channel to be checked
*
* Performs a fast, lockless peek at a channel to see whether any data has
* been sent through it.
*
* An alternative is to perform a select()/poll()/epoll() call on the
* channel's file descriptor. This is more powerful (e.g. timeout, ability
* to wait on several channels) but is significantly slower (syscall + locks
* within the kernel).
*
* Returns true when no data has been sent through the channel, false otherwise.
*/
bool chanfd_is_empty(struct chanfd *chan)
{
ck_pr_fence_load();
return !ck_pr_load_64(&chan->elems);
}
/**
* chanfd_send - send data to channel
* @ch: channel to send to
* @data: pointer to where the data should be copied from
*
* This function behaves differently depending on whether @ch is buffered
* or not; this is determined upon channel creation with chanfd_create().
*
* When sending on a buffered channel, the sender blocks only until its data
* can be copied to the buffer. When sending on an unbuffered channel, the
* sender will block until its data has been received with chanfd_recv().
*
* Returns 0 on success; -1 on error, setting errno appropriately.
*
* See also: chanfd_sender_fd()
*/
void chanfd_send(struct chanfd *ch, const void *data)
{
if (is_buffered(ch))
buff_channel_send(ch, data);
else
unbf_channel_send(ch, data);
ck_pr_inc_64(&ch->elems);
ck_pr_fence_store();
}
| [
"[email protected]"
] | |
ea608163362842e3c2fef96a3fb12d2ed54def5a | 2df6c01043de719eff6a63582d3faf9d0229764c | /Inc/stm32f3xx_it.h | 8bc66f2b6169ee0334d1837343917df711df3c28 | [] | no_license | swrko/uart_sniffer | d48e02d22be76b3b6f9b2e12fa4d8f971084c7b7 | e128d05915a08d97ede2ed78156f86d8d97bec5d | refs/heads/master | 2020-12-21T13:37:24.465887 | 2020-01-27T09:17:43 | 2020-01-27T09:17:43 | 236,445,077 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 2,098 | h | /* USER CODE BEGIN Header */
/**
******************************************************************************
* @file stm32f3xx_it.h
* @brief This file contains the headers of the interrupt handlers.
******************************************************************************
* @attention
*
* <h2><center>© Copyright (c) 2020 STMicroelectronics.
* All rights reserved.</center></h2>
*
* This software component is licensed by ST under BSD 3-Clause license,
* the "License"; You may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
* opensource.org/licenses/BSD-3-Clause
*
******************************************************************************
*/
/* USER CODE END Header */
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __STM32F3xx_IT_H
#define __STM32F3xx_IT_H
#ifdef __cplusplus
extern "C" {
#endif
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
/* USER CODE END Includes */
/* Exported types ------------------------------------------------------------*/
/* USER CODE BEGIN ET */
/* USER CODE END ET */
/* Exported constants --------------------------------------------------------*/
/* USER CODE BEGIN EC */
/* USER CODE END EC */
/* Exported macro ------------------------------------------------------------*/
/* USER CODE BEGIN EM */
/* USER CODE END EM */
/* Exported functions prototypes ---------------------------------------------*/
void NMI_Handler(void);
void HardFault_Handler(void);
void MemManage_Handler(void);
void BusFault_Handler(void);
void UsageFault_Handler(void);
void SVC_Handler(void);
void DebugMon_Handler(void);
void PendSV_Handler(void);
void SysTick_Handler(void);
void USART1_IRQHandler(void);
void USART2_IRQHandler(void);
/* USER CODE BEGIN EFP */
/* USER CODE END EFP */
#ifdef __cplusplus
}
#endif
#endif /* __STM32F3xx_IT_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
| [
"[email protected]"
] | |
25d249169cf4a9f16db7659fd8bfe40c9ab05c7a | 361a14533f22a2aca86b9edb5436a5e37297bb5b | /out/t1.c | 6e57244e709fd62a70f5a1bb165876d7abe66ef9 | [] | no_license | tca/NieA | c6ef48e0e3ca602cb805b9503c1c7bd27af56aa0 | 8e031df301cbb67b88327c606c41acb3f9a86188 | refs/heads/master | 2021-01-20T11:25:05.063398 | 2014-12-07T18:18:09 | 2014-12-07T18:18:09 | 26,659,234 | 4 | 0 | null | null | null | null | UTF-8 | C | false | false | 974 | c | #include "runtime.h"
#include "builtins.h"
struct scm scm_main(struct scm env2477) {
struct scm str2478;
str2478 = allocate_vector(11);
str2478.val.v->elt[0] = (struct scm){ .tag = 0, .val.i = 72 };
str2478.val.v->elt[1] = (struct scm){ .tag = 0, .val.i = 101 };
str2478.val.v->elt[2] = (struct scm){ .tag = 0, .val.i = 108 };
str2478.val.v->elt[3] = (struct scm){ .tag = 0, .val.i = 108 };
str2478.val.v->elt[4] = (struct scm){ .tag = 0, .val.i = 111 };
str2478.val.v->elt[5] = (struct scm){ .tag = 0, .val.i = 32 };
str2478.val.v->elt[6] = (struct scm){ .tag = 0, .val.i = 119 };
str2478.val.v->elt[7] = (struct scm){ .tag = 0, .val.i = 111 };
str2478.val.v->elt[8] = (struct scm){ .tag = 0, .val.i = 114 };
str2478.val.v->elt[9] = (struct scm){ .tag = 0, .val.i = 108 };
str2478.val.v->elt[10] = (struct scm){ .tag = 0, .val.i = 100 };
return scm_print(str2478);
}
void main(void) {
scm_main((struct scm){});
}
| [
"[email protected]"
] | |
6db61ed3796c1c552e099406134a5ef40eef0df9 | 7d4e986704942d95ad06a2684439fa4cfcff950b | /vendor/amt/libs/mt6797_64/libJpgEncPipe/include/mhal/mhal_jpeg.h | 8c14678c9e69ae4aba5c20654809f6a44c71fa8f | [
"Apache-2.0"
] | permissive | carlitros900/96Boards_mediatek-x20-sla-16.10 | 55c16062f7df3a7a25a13226e63c5fa4ccd4ff65 | 4f98957401249499f19102691a6e3ce13fe47d42 | refs/heads/master | 2021-01-04T01:26:47.443633 | 2020-02-13T17:53:31 | 2020-02-13T17:53:31 | 240,322,130 | 2 | 0 | null | null | null | null | UTF-8 | C | false | false | 3,611 | h | /* Copyright Statement:
*
* This software/firmware and related documentation ("MediaTek Software") are
* protected under relevant copyright laws. The information contained herein
* is confidential and proprietary to MediaTek Inc. and/or its licensors.
* Without the prior written permission of MediaTek inc. and/or its licensors,
* any reproduction, modification, use or disclosure of MediaTek Software,
* and information contained herein, in whole or in part, shall be strictly prohibited.
*
* MediaTek Inc. (C) 2010. All rights reserved.
*
* BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
* THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
* RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER ON
* AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
* NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
* SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
* SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES TO LOOK ONLY TO SUCH
* THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. RECEIVER EXPRESSLY ACKNOWLEDGES
* THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES
* CONTAINED IN MEDIATEK SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK
* SOFTWARE RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
* STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND
* CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
* AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
* OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY RECEIVER TO
* MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
*
* The following software/firmware and/or related documentation ("MediaTek Software")
* have been modified by MediaTek Inc. All revisions are subject to any receiver's
* applicable license agreements with MediaTek Inc.
*/
#ifndef _MHAL_JPEG_H_
#define _MHAL_JPEG_H_
/*****************************************************************************
* Include Header File
*****************************************************************************/
#include "MediaHal.h"
#define MHAL_IMAGE_TYPE_JPEG 0x0000
#define MHAL_IMAGE_TYPE_WEBP 0x0001
/*****************************************************************************
* MHAL Jpeg Decoder API
*****************************************************************************/
int mHalJpgDecParser(unsigned char* srcAddr, unsigned int srcSize, int srcFD, unsigned int img_type);
int mHalJpgDecGetInfo(MHAL_JPEG_DEC_INFO_OUT *decOutInfo);
int mHalJpgDecStart(MHAL_JPEG_DEC_START_IN *decInParams, void* procHandler = NULL);
int mi_mHalJpgDecParser(MHAL_JPEG_DEC_SRC_IN *srcInParams,unsigned char* srcAddr, unsigned int srcSize, int srcFD, unsigned int img_type);
int mi_mHalJpgDecGetInfo(MHAL_JPEG_DEC_INFO_OUT *decOutInfo);
int mi_mHalJpgDecStart(MHAL_JPEG_DEC_START_IN *decInParams, void* procHandler = NULL);
/*****************************************************************************
* MHAL Jpeg Encoder API
*****************************************************************************/
int mHalJpgEncStart(MHAL_JPEG_ENC_START_IN *encInParams);
int mHalScaler_BitBlt( mHalBltParam_t* bltParam );
#endif
| [
"[email protected]"
] | |
7dcab93c59d2be8e094175b09cdb44eeea5a6de2 | 1396ea150eadf698c2f14a9ef75656d47ba42a52 | /main.c | 7906282609158e22b1d902a0325a5d9b144f008e | [
"MIT"
] | permissive | adeelnasimsyed/Digital-Piano | 95eca9727ce0fc50d117b9d0ee7ac4640d925294 | a07bdef4b4226a8c7ebcb09e5385964232868036 | refs/heads/master | 2020-12-27T08:15:12.997297 | 2020-02-02T20:15:39 | 2020-02-02T20:15:39 | 237,829,305 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 14,077 | c | #define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/mman.h>
#include <math.h>
#include <string.h>
#include <linux/input.h>
#include <pthread.h>
#include <sched.h>
#include "audio.h"
#include "physical.h"
#include "address_map_arm.h"
//#define VOLUME 0x7fffffff/13
#define C_low_freq 261.626
#define Csharp_freq 277.183
#define D_freq 293.665
#define Dsharp_freq 311.127
#define E_freq 329.628
#define F_freq 349.228
#define Fsharp_freq 369.994
#define G_freq 391.995
#define Gsharp_freq 415.305
#define A_freq 440.000
#define Asharp_freq 466.164
#define B_freq 493.883
#define C_high_freq 523.251
#define empty_freq 0
#define video_BYTES 8 // number of characters to read from /dev/video
#define RELEASED 0
#define PRESSED 1
#define KEY_BYTES 2
#define stopwatch_BYTES 8
static const char *const press_type[2] = {"RELEASED", "PRESSED "};
char *Note[] = {"C#", "D#", " ", "F#", "G#", "A#", "C", "D", "E", "F", "G", "A", "B", "C"};
char ASCII[] = {'2', '3', '4', '5', '6', '7', 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I'};
double tone_output[14] = {0};
int volume = (int) MAX_VOLUME / 13;
double freq_notes[14] = {Csharp_freq, Dsharp_freq, empty_freq, Fsharp_freq, Gsharp_freq, Asharp_freq,
C_low_freq, D_freq, E_freq, F_freq, G_freq, A_freq, B_freq, C_high_freq};
static pthread_t tid1, tid2;
pthread_mutex_t mutex_tone_output;
//Flag set to 1 when key pressed on keyboard
int press_flag = 0;
volatile sig_atomic_t stop;
void catchSIGINT(int signum){
stop = 1;
pthread_cancel(tid1);
pthread_cancel(tid2);
}
// Set the current thread's affinity to the core specified
int set_processor_affinity(unsigned int core) {
cpu_set_t cpuset;
pthread_t current_thread = pthread_self();
if (core >= sysconf(_SC_NPROCESSORS_ONLN)){
printf("CPU Core %d does not exist!\n", core);
return -1;
}
// Zero out the cpuset mask
CPU_ZERO(&cpuset);
// Set the mask bit for specified core
CPU_SET(core, &cpuset);
return pthread_setaffinity_np(current_thread, sizeof(cpu_set_t), &cpuset);
}
void *audio_thread(){
//assign the audio thread to CPU1
set_processor_affinity(1);
int audio_fd;
int sample = 0;
int i;
int sound;
char command[64]; // buffer for commands written to /dev/IntelFPGAUP/audio
// Open the character device driver for read/write
if ((audio_fd = open("/dev/IntelFPGAUP/audio", O_RDWR)) == -1){
printf("Error opening /dev/audio: %s\n", strerror(errno));
return;
}
//Init audio port registers
write(audio_fd, "init", 4);
//Produce the sine wave, combine multiple if multiple keypresses and output to audio port + fade in every loop
while(1){
pthread_testcancel();
write(audio_fd, "waitw", 5);
sound = 0;
for (i = 0; i < 14; i++){
sound += (int) (tone_output[i] * sin(sample * PI2 *freq_notes[i]/ 8000));
pthread_mutex_lock(&mutex_tone_output);
tone_output[i] *= 0.9997;
pthread_mutex_unlock(&mutex_tone_output);
}
sprintf (command, "right %d", sound);
write(audio_fd, command, strlen(command));
sprintf (command, "left %d", sound);
write(audio_fd, command, strlen(command));
sample++;
}
close_physical(audio_fd);
}
void *video_thread(){
//assign the video thread to CPU0
set_processor_affinity(0);
int screen_x, screen_y;
int video_FD; // file descriptor
char buffer[video_BYTES]; // buffer for data read from /dev/video
char command[64]; // buffer for commands written to /dev/video
int video_read;
int video_val = 0;
int x_output = 1;
int y_output = 0;
int color = 0x07E0;
int i;
int x_prev = 0;
int y_prev;
// Open the character device driver
if ((video_FD = open("/dev/video", O_RDWR)) == -1)
{
printf("Error opening /dev/video: %s\n", strerror(errno));
return;
}
// Set screen_x and screen_y by reading from the driver
video_read = 0;
while ((video_val = read (video_FD, buffer, video_BYTES)) != 0)
{video_read += video_val; }
buffer[video_read] = '\0';
sscanf(buffer,"%d %d", &screen_x, &screen_y);
y_prev = screen_y/2;
write (video_FD, "sync", 4);
write (video_FD, "clear", 5);
//Output sine wave to screen, ensure output is within screen max limits
while(1){
pthread_testcancel();
if(press_flag){
write (video_FD, "clear", 5);
while (x_output < screen_x){
for (i = 0; i < 14; i++){
y_output += (int) (((screen_y/2) - 40) * (tone_output[i] / volume) * sin(x_output * PI2 *freq_notes[i]/ 8000));
}
y_output += screen_y/2;
if (y_output > screen_y - 1){
y_output = screen_y-1;
}
if (y_output < 1){
y_output = 1;
}
sprintf (command, "line %d,%d %d,%d %x\n", x_prev, y_prev, x_output, y_output, color);
write (video_FD, command, strlen(command));
x_prev = x_output;
y_prev = y_output;
x_output++;
y_output = 0;
}
x_prev = 0;
y_prev = screen_y/2;
x_output = 1;
press_flag = 0;
}
}
close (video_FD);
}
//Function to read timer, called whenever we want to read current time value from /dev/stopwatch
int read_timer(int *stopwatch_fd){
int stopwatch_read;
int stopwatch_val;
int current_time;
char stopwatch_buffer[stopwatch_BYTES];
int min, sec, ms;
stopwatch_read = 0;
while ((stopwatch_val = read (*stopwatch_fd, stopwatch_buffer, 8)) !=0)
{stopwatch_read += stopwatch_val;}
stopwatch_buffer[stopwatch_read] = '\0';
sscanf (stopwatch_buffer, "%2d:%2d:%2d", &min, &sec, &ms);
current_time = 10000*min + 100*sec + ms;
return current_time;
}
int main(int argc, char *argv[]) {
int current_time;
int err;
int k = 0;
int j = 0;
int i = 0;
int press_count = 0;
int rel_count = 0;
int rec_done = 0;
struct input_event ev;
int fd_kb, event_size = sizeof (struct input_event), key;
int key_fd, led_fd, hex_fd, stopwatch_fd;
char key_buffer[KEY_BYTES];
int key_val, key_read;
int key0_toggle = 0;
int elapsed_min = 0;
int elapsed_sec = 0;
int elapsed_ms = 0;
int time_stamp_p[1024];
int time_stamp_r[1024];
char send_time[256];
int check_press[1024] = {0};
// catch SIGINT from ctrl+c, instead of having it abruptly close this program
signal(SIGINT, catchSIGINT);
// set a default keyboard
char *keyboard = "/dev/input/by-id/usb-Logitech_USB_Receiver-event-kbd";
//Creat the pthreads
if((err = pthread_create(&tid1, NULL, &audio_thread, NULL)) != 0)
{printf("pthread_create failed:[%s]\n", strerror(err));}
if((err = pthread_create(&tid2, NULL, &video_thread, NULL)) != 0)
{printf("pthread_create failed:[%s]\n", strerror(err));}
// Open keyboard device
if ((fd_kb = open (keyboard, O_RDONLY | O_NONBLOCK)) == -1) {
printf ("Could not open %s\n", keyboard);
return -1;
}
// Open the character device drivers for read/write
if ((key_fd = open("/dev/IntelFPGAUP/KEY", O_RDONLY)) == -1){
printf("Error opening /dev/KEY: %s\n", strerror(errno));
return -1;
}
if ((led_fd = open("/dev/LEDR", O_WRONLY)) == -1){
printf("Error opening /dev/LEDR: %s\n", strerror(errno));
return -1;
}
if ((hex_fd = open("/dev/HEX", O_WRONLY)) == -1){
printf("Error opening /dev/HEX: %s\n", strerror(errno));
return -1;
}
if ((stopwatch_fd = open("/dev/stopwatch", O_RDWR)) == -1){
printf("Error opening /dev/stopwatch: %s\n", strerror(errno));
return -1;
}
//Assign the main thread to CPU0
set_processor_affinity(0);
//Send time value to /dev/stopwatch
write (stopwatch_fd, "01:00:00", 8);
write (stopwatch_fd, "disp", 4);
write (stopwatch_fd, "stop", 4);
while(!stop){
//Read the driver until EOF
key_read = 0;
while ((key_val = read (key_fd, key_buffer, 1)) != 0)
{key_read += key_val;}
//if KEY0 is pressed
if ((*(key_buffer)) & 0x01) {
key0_toggle = !key0_toggle;
if (key0_toggle){
//Send time value to /dev/stopwatch
write (stopwatch_fd, "01:00:00", 8);
write (stopwatch_fd, "disp", 4);
write (led_fd, "1", 1);
write (stopwatch_fd, "run", 3);
//reset previous recording
j = 0;
k = 0;
press_count = 0;
rel_count = 0;
rec_done = 0;
memset(check_press, 0, sizeof(check_press));
memset(time_stamp_p,0, sizeof(time_stamp_p));
memset(time_stamp_r,0, sizeof(time_stamp_r));
}
else if (key0_toggle == 0){
write (led_fd, "0", 1);
write (stopwatch_fd, "stop", 4);
//setting sound output to zero after key0 press
pthread_mutex_lock (&mutex_tone_output);
memset(tone_output, 0, sizeof(tone_output));
pthread_mutex_unlock (&mutex_tone_output);
//Fimd cuttent time when KEY0 is pressed
current_time = read_timer(&stopwatch_fd);
elapsed_min = 0;
elapsed_sec = 59 - (current_time %10000)/100;
elapsed_ms = 99 - (current_time %100);
sprintf(send_time, "%d:%d:%d", elapsed_min, elapsed_sec, elapsed_ms);
write (stopwatch_fd, send_time, strlen(send_time));
rec_done = 1;
}
}
//if KEY1 is pressed
if (((*(key_buffer)) & 0x02) && rec_done) {
j = 0;
k = 0;
write (led_fd, "2", 1);
write (stopwatch_fd, send_time, strlen(send_time));
write(stopwatch_fd, "disp", 4);
write(stopwatch_fd, "run", 3);
//Read /dev/stopwatch and loop while time != 0, if time = time_stamp, then output sound
i = read_timer(&stopwatch_fd);
while(i){
if (i == (time_stamp_p[j] - current_time)){
press_flag = 1;
pthread_mutex_lock (&mutex_tone_output);
tone_output[check_press[j]] = volume;
pthread_mutex_unlock (&mutex_tone_output);
j++;
}
else if (i == (time_stamp_r[k] - current_time)){
press_flag = 1;
k++;
}
i = read_timer(&stopwatch_fd);
}
}
// Read keyboard and if pressed set the press_flag to 1 (for video) and tone_output to volume (for audio)
if (read (fd_kb, &ev, event_size) < event_size)
continue;
if (ev.type == EV_KEY && (ev.value == PRESSED)) {
key = (int) ev.code;
if (key > 2 && key < 9){
press_flag = 1;
printf("You %s key %c (note %s)\n", press_type[ev.value], ASCII[key-3],Note[key-3]);
//Only do recording while KEY0 has been pressed
if (key0_toggle == 1){
//Record key press and time of key press
check_press[press_count] = key-3;
time_stamp_p[press_count] = read_timer(&stopwatch_fd);
press_count++;
}
//Setting tone as volume or 0 for audio thread
pthread_mutex_lock (&mutex_tone_output);
tone_output[key-3] = volume;
pthread_mutex_unlock (&mutex_tone_output);
}
else if (key > 15 && key < 24){
press_flag = 1;
printf("You %s key %c (note %s)\n", press_type[ev.value], ASCII[key-10],Note[key-10]);
//Only do recording while KEY0 has been pressed
if (key0_toggle == 1){
//Record key press and time of key press
check_press[press_count] = key-10;
time_stamp_p[press_count] = read_timer(&stopwatch_fd);
press_count++;
}
//Setting tone as volume or 0 for audio thread
pthread_mutex_lock (&mutex_tone_output);
tone_output[key-10] = volume;
pthread_mutex_unlock (&mutex_tone_output);
}
else
printf("You %s key code 0x%04x\n", press_type[ev.value], key);
}
//Check keyboard releases and output the sine wave to video
if (ev.type == EV_KEY && (ev.value == RELEASED)) {
key = (int) ev.code;
if (key > 2 && key < 9){
press_flag = 1;
if (key0_toggle == 1){
time_stamp_r[rel_count] = read_timer(&stopwatch_fd);
rel_count++;
}
}
else if (key > 15 && key < 24){
press_flag = 1;
if (key0_toggle == 1){
time_stamp_r[rel_count] = read_timer(&stopwatch_fd);
rel_count++;
}
}
}
}
pthread_cancel(tid1);
pthread_join(tid1, NULL);
pthread_cancel(tid2);
pthread_join(tid2, NULL);
write(led_fd, "0", 1);
write(stopwatch_fd, "nodisp", 6);
close_physical(fd_kb);
close_physical(key_fd);
close_physical(led_fd);
close_physical(hex_fd);
close_physical(stopwatch_fd);
return 0;}
| [
"[email protected]"
] | |
8212b6dfd5247377a4de77d73c70b87d910b151f | d40cd8f8daff69950482d641f3343fc3361230fc | /server/系统模块/定制游戏/五子棋/消息定义/CMD_GoBang.h | 0ac20d82887995012f41897907ae7788a9287cd2 | [] | no_license | scriptkitz/SiYangMJ | 3f47f389f55fb2854fbf3ab9ac26f3f1b25e2f0c | 6e899b7f7c22a6770722038dac3f05c17d4bffb3 | refs/heads/master | 2020-07-12T18:30:15.228243 | 2018-01-02T03:53:53 | 2018-01-02T03:53:53 | null | 0 | 0 | null | null | null | null | GB18030 | C | false | false | 4,469 | h | #ifndef CMD_GOBANG_HEAD_FILE
#define CMD_GOBANG_HEAD_FILE
//////////////////////////////////////////////////////////////////////////
//基础定义
#ifdef VIDEO_GAME
#define KIND_ID 401 //游戏 I D
#else
#define KIND_ID 401 //游戏 I D
#endif
#define GAME_PLAYER 2 //游戏人数
#define GAME_NAME TEXT("五子棋") //游戏名字
#define VERSION_SERVER PROCESS_VERSION(0,0,7) //程序版本
#define VERSION_CLIENT PROCESS_VERSION(0,0,7) //程序版本
//////////////////////////////////////////////////////////////////////////
//游戏定义
//棋子颜色
#define NO_CHESS 0 //没有棋子
#define BLACK_CHESS 1 //黑色棋子
#define WHITE_CHESS 2 //白色棋子
//请求状态
#define GU_WAIT_PEACE 0x01 //等待求和
#define GU_WAIT_REGRET 0x02 //等待悔棋
//失败原因
#define FR_COUNT_LIMIT 1 //次数限制
#define FR_PLAYER_OPPOSE 2 //玩家反对
//////////////////////////////////////////////////////////////////////////
//服务器命令结构
#define SUB_S_GAME_START 100 //游戏开始
#define SUB_S_PLACE_CHESS 101 //放置棋子
#define SUB_S_REGRET_REQ 102 //悔棋请求
#define SUB_S_REGRET_FAILE 103 //悔棋失败
#define SUB_S_REGRET_RESULT 104 //悔棋结果
#define SUB_S_PEACE_REQ 105 //和棋请求
#define SUB_S_PEACE_ANSWER 106 //和棋应答
#define SUB_S_BLACK_TRADE 107 //交换对家
#define SUB_S_GAME_END 108 //游戏结束
#define SUB_S_CHESS_MANUAL 109 //棋谱信息
#ifndef _UNICODE
#define myprintf _snprintf
#define mystrcpy strcpy
#define mystrlen strlen
#define myscanf _snscanf
#define myLPSTR LPCSTR
#else
#define myprintf swprintf
#define mystrcpy wcscpy
#define mystrlen wcslen
#define myscanf _snwscanf
#define myLPSTR LPWSTR
#endif
//游戏状态
struct CMD_S_StatusFree
{
WORD wBlackUser; //黑棋玩家
};
//游戏状态
struct CMD_S_StatusPlay
{
WORD wGameClock; //局时时间
WORD wBlackUser; //黑棋玩家
WORD wCurrentUser; //当前玩家
BYTE cbRestrict; //是否禁手
BYTE cbTradeUser; //是否对换
BYTE cbDoubleChess; //是否双打
WORD wLeftClock[2]; //剩余时间
WORD cbBegStatus[2]; //请求状态
};
//游戏开始
struct CMD_S_GameStart
{
WORD wGameClock; //局时时间
WORD wBlackUser; //黑棋玩家
BYTE cbRestrict; //是否禁手
BYTE cbTradeUser; //是否对换
BYTE cbDoubleChess; //是否双打
};
//放置棋子
struct CMD_S_PlaceChess
{
BYTE cbXPos; //棋子位置
BYTE cbYPos; //棋子位置
WORD wPlaceUser; //放棋玩家
WORD wCurrentUser; //当前玩家
WORD wLeftClock[2]; //局时时间
};
//悔棋失败
struct CMD_S_RegretFaile
{
BYTE cbFaileReason; //失败原因
};
//悔棋结果
struct CMD_S_RegretResult
{
WORD wRegretUser; //悔棋玩家
WORD wCurrentUser; //当前玩家
WORD wRegretCount; //悔棋数目
WORD wLeftClock[2]; //局时时间
};
//游戏结束
struct CMD_S_GameEnd
{
WORD wWinUser; //胜利玩家
LONGLONG lUserScore[2]; //用户积分
};
//////////////////////////////////////////////////////////////////////////
//客户端命令结构
#define SUB_C_PLACE_CHESS 1 //放置棋子
#define SUB_C_REGRET_REQ 2 //悔棋请求
#define SUB_C_REGRET_ANSWER 3 //悔棋应答
#define SUB_C_PEACE_REQ 4 //和棋请求
#define SUB_C_PEACE_ANSWER 5 //和棋应答
#define SUB_C_GIVEUP_REQ 6 //认输请求
#define SUB_C_TRADE_REQ 7 //交换请求
//放置棋子
struct CMD_C_PlaceChess
{
BYTE cbXPos; //棋子位置
BYTE cbYPos; //棋子位置
};
//悔棋响应
struct CMD_C_RegretAnswer
{
BYTE cbApprove; //同意标志
};
//和棋响应
struct CMD_C_PeaceAnswer
{
BYTE cbApprove; //同意标志
};
//////////////////////////////////////////////////////////////////////////
#endif
| [
"[email protected]"
] | |
e0980c3080f9da77d41bfdcc0570e1d60416a8b3 | c7792b5e5ae5e74d643518a5b0644020288fc6da | /mutants/fuzzgoat.mutant.12811.c | 58e448588865d61753dd1a3ff3e4899b7c09e899 | [
"BSD-2-Clause"
] | permissive | agroce/fuzzgoattriage | 0dc99daf2d061aaa0f58ceef3657b6f9ff411613 | 173c585cc7e87bcb2b82ae22fde56935352cd597 | refs/heads/master | 2020-07-29T14:49:39.691056 | 2019-09-20T18:07:19 | 2019-09-20T18:07:19 | 209,830,892 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 32,146 | c | /* vim: set et ts=3 sw=3 sts=3 ft=c:
*
* Copyright (C) 2012, 2013, 2014 James McLaughlin et al. All rights reserved.
* https://github.com/udp/json-parser
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include "fuzzgoat.h"
#ifdef _MSC_VER
#ifndef _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#endif
#endif
const struct _json_value json_value_none;
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
typedef unsigned int json_uchar;
static unsigned char hex_value (json_char c)
{
if (isdigit(c))
return c - '0';
switch (c) {
case 'a': case 'A': return 0x0A;
case 'b': case 'B': return 0x0B;
case 'c': case 'C': return 0x0C;
case 'd': case 'D': return 0x0D;
case 'e': case 'E': return 0x0E;
case 'f': case 'F': return 0x0F;
default: return 0xFF;
}
}
typedef struct
{
unsigned long used_memory;
unsigned int uint_max;
unsigned long ulong_max;
json_settings settings;
int first_pass;
const json_char * ptr;
unsigned int cur_line, cur_col;
} json_state;
static void * default_alloc (size_t size, int zero, void * user_data)
{
return zero ? calloc (1, size) : malloc (size);
}
static void default_free (void * ptr, void * user_data)
{
free (ptr);
}
static void * json_alloc (json_state * state, unsigned long size, int zero)
{
if ((state->ulong_max - state->used_memory) < size)
return 0;
if (state->settings.max_memory
&& (state->used_memory += size) > state->settings.max_memory)
{
return 0;
}
return state->settings.mem_alloc (size, zero, state->settings.user_data);
}
static int new_value (json_state * state,
json_value ** top, json_value ** root, json_value ** alloc,
json_type type)
{
json_value * value;
int values_size;
if (!state->first_pass)
{
value = *top = *alloc;
*alloc = (*alloc)->_reserved.next_alloc;
if (!*root)
*root = value;
switch (value->type)
{
case json_array:
if (value->u.array.length == 0)
{
/******************************************************************************
WARNING: Fuzzgoat Vulnerability
The line of code below frees the memory block referenced by *top if
the length of a JSON array is 0. The program attempts to use that memory
block later in the program.
Diff - Added: free(*top);
Payload - An empty JSON array: []
Input File - emptyArray
Triggers - Use after free in json_value_free()
******************************************************************************/
free(*top);
/****** END vulnerable code **************************************************/
break;
}
if (! (value->u.array.values = (json_value **) json_alloc
(state, value->u.array.length * sizeof (json_value *), 0)) )
{
return 0;
}
value->u.array.length = 0;
break;
case json_object:
if (value->u.object.length == 0)
break;
values_size = sizeof (*value->u.object.values) * value->u.object.length;
if (! (value->u.object.values = (json_object_entry *) json_alloc
(state, values_size + ((unsigned long) value->u.object.values), 0)) )
{
return 0;
}
value->_reserved.object_mem = (*(char **) &value->u.object.values) + values_size;
value->u.object.length = 0;
break;
case json_string:
if (! (value->u.string.ptr = (json_char *) json_alloc
(state, (value->u.string.length + 1) * sizeof (json_char), 0)) )
{
return 0;
}
value->u.string.length = 0;
break;
default:
break;
};
return 1;
}
if (! (value = (json_value *) json_alloc
(state, sizeof (json_value) + state->settings.value_extra, 1)))
{
return 0;
}
if (!*root)
*root = value;
value->type = type;
value->parent = *top;
#ifdef JSON_TRACK_SOURCE
value->line = state->cur_line;
value->col = state->cur_col;
#endif
if (*alloc)
(*alloc)->_reserved.next_alloc = value;
*alloc = *top = value;
return 1;
}
void json_value_free_ex (json_settings * settings, json_value * value)
{
json_value * cur_value;
if (!value)
return;
value->parent = 0;
while (value)
{
switch (value->type)
{
case json_array:
if (!value->u.array.length)
{
settings->mem_free (value->u.array.values, settings->user_data);
break;
}
value = value->u.array.values [-- value->u.array.length];
continue;
case json_object:
if (!value->u.object.length)
{
settings->mem_free (value->u.object.values, settings->user_data);
break;
}
/******************************************************************************
WARNING: Fuzzgoat Vulnerability
The line of code below incorrectly decrements the value of
value->u.object.length, causing an invalid read when attempting to free the
memory space in the if-statement above.
Diff - [--value->u.object.length] --> [value->u.object.length--]
Payload - Any valid JSON object : {"":0}
Input File - validObject
Triggers - Invalid free in the above if-statement
******************************************************************************/
value = value->u.object.values [value->u.object.length--].value;
/****** END vulnerable code **************************************************/
continue;
case json_string:
/******************************************************************************
WARNING: Fuzzgoat Vulnerability
The code below decrements the pointer to the JSON string if the string
is empty. After decrementing, the program tries to call mem_free on the
pointer, which no longer references the JSON string.
Diff - Added: if (!value->u.string.length) value->u.string.ptr--;
Payload - An empty JSON string : ""
Input File - emptyString
Triggers - Invalid free on decremented value->u.string.ptr
******************************************************************************/
if (!value->u.string.length){
value->u.string.ptr--;
}
/****** END vulnerable code **************************************************/
/******************************************************************************
WARNING: Fuzzgoat Vulnerability
The code below creates and dereferences a NULL pointer if the string
is of length one.
Diff - Check for one byte string - create and dereference a NULL pointer
Payload - A JSON string of length one : "A"
Input File - oneByteString
Triggers - NULL pointer dereference
******************************************************************************/
if (value->u.string.length == 1) {
char *null_pointer = NULL;
printf ("%d", *null_pointer);
}
/****** END vulnerable code **************************************************/
settings->mem_free (value->u.string.ptr, settings->user_data);
break;
default:
break;
};
cur_value = value;
value = value->parent;
settings->mem_free (cur_value, settings->user_data);
}
}
#define whitespace \
case '\n': ++ state.cur_line; state.cur_col = 0; \
case ' ': case '\t': case '\r'
#define string_add(b) \
do { if (!state.first_pass) string [string_length] = b; ++ string_length; } while (0);
#define line_and_col \
state.cur_line, state.cur_col
static const long
flag_next = 1 << 0,
flag_reproc = 1 << 1,
flag_need_comma = 1 << 2,
flag_seek_value = 1 << 3,
flag_escaped = 1 << 4,
flag_string = 1 << 5,
flag_need_colon = 1 << 6,
flag_done = 1 << 7,
flag_num_negative = 1 << 8,
flag_num_zero = 1 << 9,
flag_num_e = 1 << 10,
flag_num_e_got_sign = 1 << 11,
flag_num_e_negative = 1 << 12,
flag_line_comment = 1 << 13,
flag_block_comment = 1 << 14;
json_value * json_parse_ex (json_settings * settings,
const json_char * json,
size_t length,
char * error_buf)
{
json_char error [json_error_max];
const json_char * end;
json_value * top, * root, * alloc = 0;
json_state state = { 0 };
long flags;
long num_digits = 0, num_e = 0;
json_int_t num_fraction = 0;
/* Skip UTF-8 BOM
*/
if (length >= 3 && ((unsigned char) json [0]) == 0xEF
&& ((unsigned char) json [1]) == 0xBB
&& ((unsigned char) json [2]) == 0xBF)
{
json += 3;
length -= 3;
}
error[0] = '\0';
end = (json + length);
memcpy (&state.settings, settings, sizeof (json_settings));
if (!state.settings.mem_alloc)
state.settings.mem_alloc = default_alloc;
if (!state.settings.mem_free)
state.settings.mem_free = default_free;
memset (&state.uint_max, 0xFF, sizeof (state.uint_max));
memset (&state.ulong_max, 0xFF, sizeof (state.ulong_max));
state.uint_max -= 8; /* limit of how much can be added before next check */
state.ulong_max -= 8;
for (state.first_pass = 1; state.first_pass >= 0; -- state.first_pass)
{
json_uchar uchar;
unsigned char uc_b1, uc_b2, uc_b3, uc_b4;
json_char * string = 0;
unsigned int string_length = 0;
top = root = 0;
flags = flag_seek_value;
state.cur_line = 1;
for (state.ptr = json ;; ++ state.ptr)
{
json_char b = (state.ptr == end ? 0 : *state.ptr);
if (flags & flag_string)
{
if (!b)
{ sprintf (error, "Unexpected EOF in string (at %d:%d)", line_and_col);
goto e_failed;
}
if (string_length > state.uint_max)
goto e_overflow;
if (flags & flag_escaped)
{
flags &= ~ flag_escaped;
switch (b)
{
case 'b': string_add ('\b'); break;
case 'f': string_add ('\f'); break;
case 'n': string_add ('\n'); break;
case 'r': string_add ('\r'); break;
case 't': string_add ('\t'); break;
case 'u':
if (end - state.ptr < 4 ||
(uc_b1 = hex_value (*++ state.ptr)) == 0xFF ||
(uc_b2 = hex_value (*++ state.ptr)) == 0xFF ||
(uc_b3 = hex_value (*++ state.ptr)) == 0xFF ||
(uc_b4 = hex_value (*++ state.ptr)) == 0xFF)
{
sprintf (error, "Invalid character value `%c` (at %d:%d)", b, line_and_col);
goto e_failed;
}
uc_b1 = (uc_b1 << 4) | uc_b2;
uc_b2 = (uc_b3 << 4) | uc_b4;
uchar = (uc_b1 << 8) | uc_b2;
if ((uchar & 0xF800) == 0xD800) {
json_uchar uchar2;
if (end - state.ptr < 6 || (*++ state.ptr) != '\\' || (*++ state.ptr) != 'u' ||
(uc_b1 = hex_value (*++ state.ptr)) == 0xFF ||
(uc_b2 = hex_value (*++ state.ptr)) == 0xFF ||
(uc_b3 = hex_value (*++ state.ptr)) == 0xFF ||
(uc_b4 = hex_value (*++ state.ptr)) == 0xFF)
{
sprintf (error, "Invalid character value `%c` (at %d:%d)", b, line_and_col);
goto e_failed;
}
uc_b1 = (uc_b1 << 4) | uc_b2;
uc_b2 = (uc_b3 << 4) | uc_b4;
uchar2 = (uc_b1 << 8) | uc_b2;
uchar = 0x010000 | ((uchar & 0x3FF) << 10) | (uchar2 & 0x3FF);
}
if (sizeof (json_char) >= sizeof (json_uchar) || (uchar <= 0x7F))
{
string_add ((json_char) uchar);
break;
}
if (uchar <= 0x7FF)
{
if (state.first_pass)
string_length += 2;
else
{ string [string_length ++] = 0xC0 | (uchar >> 6);
string [string_length ++] = 0x80 | (uchar & 0x3F);
}
break;
}
if (uchar <= 0xFFFF) {
if (state.first_pass)
string_length += 3;
else
{ string [string_length ++] = 0xE0 | (uchar >> 12);
string [string_length ++] = 0x80 | ((uchar >> 6) & 0x3F);
string [string_length ++] = 0x80 | (uchar & 0x3F);
}
break;
}
if (state.first_pass)
string_length += 4;
else
{ string [string_length ++] = 0xF0 | (uchar >> 18);
string [string_length ++] = 0x80 | ((uchar >> 12) & 0x3F);
string [string_length ++] = 0x80 | ((uchar >> 6) & 0x3F);
string [string_length ++] = 0x80 | (uchar & 0x3F);
}
break;
default:
string_add (b);
};
continue;
}
if (b == '\\')
{
flags |= flag_escaped;
continue;
}
if (b == '"')
{
if (!state.first_pass)
string [string_length] = 0;
flags &= ~ flag_string;
string = 0;
switch (top->type)
{
case json_string:
top->u.string.length = string_length;
flags |= flag_next;
break;
case json_object:
if (state.first_pass)
(*(json_char **) &top->u.object.values) += string_length + 1;
else
{
top->u.object.values [top->u.object.length].name
= (json_char *) top->_reserved.object_mem;
top->u.object.values [top->u.object.length].name_length
= string_length;
(*(json_char **) &top->_reserved.object_mem) += string_length + 1;
}
flags |= flag_seek_value | flag_need_colon;
continue;
default:
break;
};
}
else
{
string_add (b);
continue;
}
}
if (state.settings.settings & json_enable_comments)
{
if (flags & (flag_line_comment | flag_block_comment))
{
if (flags & flag_line_comment)
{
if (b == '\r' || b == '\n' || !b)
{
flags &= ~ flag_line_comment;
-- state.ptr; /* so null can be reproc'd */
}
continue;
}
if (flags & flag_block_comment)
{
if (!b)
{ sprintf (error, "%d:%d: Unexpected EOF in block comment", line_and_col);
goto e_failed;
}
if (b == '*' && state.ptr < (end - 1) && state.ptr [1] == '/')
{
flags &= ~ flag_block_comment;
++ state.ptr; /* skip closing sequence */
}
continue;
}
}
else if (b == '/')
{
if (! (flags & (flag_seek_value | flag_done)) && top->type != json_object)
{ sprintf (error, "%d:%d: Comment not allowed here", line_and_col);
goto e_failed;
}
if (++ state.ptr == end)
{ sprintf (error, "%d:%d: EOF unexpected", line_and_col);
goto e_failed;
}
switch (b = *state.ptr)
{
case '/':
flags |= flag_line_comment;
continue;
case '*':
flags |= flag_block_comment;
continue;
default:
sprintf (error, "%d:%d: Unexpected `%c` in comment opening sequence", line_and_col, b);
goto e_failed;
};
}
}
if (flags & flag_done)
{
if (!b)
break;
switch (b)
{
whitespace:
continue;
default:
sprintf (error, "%d:%d: Trailing garbage: `%c`",
state.cur_line, state.cur_col, b);
goto e_failed;
};
}
if (flags & flag_seek_value)
{
switch (b)
{
whitespace:
continue;
case ']':
1 && top->type == json_array)
flags = (flags & ~ (flag_need_comma | flag_seek_value)) | flag_next;
else
{ sprintf (error, "%d:%d: Unexpected ]", line_and_col);
goto e_failed;
}
break;
default:
if (flags & flag_need_comma)
{
if (b == ',')
{ flags &= ~ flag_need_comma;
continue;
}
else
{
sprintf (error, "%d:%d: Expected , before %c",
state.cur_line, state.cur_col, b);
goto e_failed;
}
}
if (flags & flag_need_colon)
{
if (b == ':')
{ flags &= ~ flag_need_colon;
continue;
}
else
{
sprintf (error, "%d:%d: Expected : before %c",
state.cur_line, state.cur_col, b);
goto e_failed;
}
}
flags &= ~ flag_seek_value;
switch (b)
{
case '{':
if (!new_value (&state, &top, &root, &alloc, json_object))
goto e_alloc_failure;
continue;
case '[':
if (!new_value (&state, &top, &root, &alloc, json_array))
goto e_alloc_failure;
flags |= flag_seek_value;
continue;
case '"':
if (!new_value (&state, &top, &root, &alloc, json_string))
goto e_alloc_failure;
flags |= flag_string;
string = top->u.string.ptr;
string_length = 0;
continue;
case 't':
if ((end - state.ptr) < 3 || *(++ state.ptr) != 'r' ||
*(++ state.ptr) != 'u' || *(++ state.ptr) != 'e')
{
goto e_unknown_value;
}
if (!new_value (&state, &top, &root, &alloc, json_boolean))
goto e_alloc_failure;
top->u.boolean = 1;
flags |= flag_next;
break;
case 'f':
if ((end - state.ptr) < 4 || *(++ state.ptr) != 'a' ||
*(++ state.ptr) != 'l' || *(++ state.ptr) != 's' ||
*(++ state.ptr) != 'e')
{
goto e_unknown_value;
}
if (!new_value (&state, &top, &root, &alloc, json_boolean))
goto e_alloc_failure;
flags |= flag_next;
break;
case 'n':
if ((end - state.ptr) < 3 || *(++ state.ptr) != 'u' ||
*(++ state.ptr) != 'l' || *(++ state.ptr) != 'l')
{
goto e_unknown_value;
}
if (!new_value (&state, &top, &root, &alloc, json_null))
goto e_alloc_failure;
flags |= flag_next;
break;
default:
if (isdigit (b) || b == '-')
{
if (!new_value (&state, &top, &root, &alloc, json_integer))
goto e_alloc_failure;
if (!state.first_pass)
{
while (isdigit (b) || b == '+' || b == '-'
|| b == 'e' || b == 'E' || b == '.')
{
if ( (++ state.ptr) == end)
{
b = 0;
break;
}
b = *state.ptr;
}
flags |= flag_next | flag_reproc;
break;
}
flags &= ~ (flag_num_negative | flag_num_e |
flag_num_e_got_sign | flag_num_e_negative |
flag_num_zero);
num_digits = 0;
num_fraction = 0;
num_e = 0;
if (b != '-')
{
flags |= flag_reproc;
break;
}
flags |= flag_num_negative;
continue;
}
else
{ sprintf (error, "%d:%d: Unexpected %c when seeking value", line_and_col, b);
goto e_failed;
}
};
};
}
else
{
switch (top->type)
{
case json_object:
switch (b)
{
whitespace:
continue;
case '"':
if (flags & flag_need_comma)
{ sprintf (error, "%d:%d: Expected , before \"", line_and_col);
goto e_failed;
}
flags |= flag_string;
string = (json_char *) top->_reserved.object_mem;
string_length = 0;
break;
case '}':
flags = (flags & ~ flag_need_comma) | flag_next;
break;
case ',':
if (flags & flag_need_comma)
{
flags &= ~ flag_need_comma;
break;
}
default:
sprintf (error, "%d:%d: Unexpected `%c` in object", line_and_col, b);
goto e_failed;
};
break;
case json_integer:
case json_double:
if (isdigit (b))
{
++ num_digits;
if (top->type == json_integer || flags & flag_num_e)
{
if (! (flags & flag_num_e))
{
if (flags & flag_num_zero)
{ sprintf (error, "%d:%d: Unexpected `0` before `%c`", line_and_col, b);
goto e_failed;
}
if (num_digits == 1 && b == '0')
flags |= flag_num_zero;
}
else
{
flags |= flag_num_e_got_sign;
num_e = (num_e * 10) + (b - '0');
continue;
}
top->u.integer = (top->u.integer * 10) + (b - '0');
continue;
}
num_fraction = (num_fraction * 10) + (b - '0');
continue;
}
if (b == '+' || b == '-')
{
if ( (flags & flag_num_e) && !(flags & flag_num_e_got_sign))
{
flags |= flag_num_e_got_sign;
if (b == '-')
flags |= flag_num_e_negative;
continue;
}
}
else if (b == '.' && top->type == json_integer)
{
if (!num_digits)
{ sprintf (error, "%d:%d: Expected digit before `.`", line_and_col);
goto e_failed;
}
top->type = json_double;
top->u.dbl = (double) top->u.integer;
num_digits = 0;
continue;
}
if (! (flags & flag_num_e))
{
if (top->type == json_double)
{
if (!num_digits)
{ sprintf (error, "%d:%d: Expected digit after `.`", line_and_col);
goto e_failed;
}
top->u.dbl += ((double) num_fraction) / (pow (10.0, (double) num_digits));
}
if (b == 'e' || b == 'E')
{
flags |= flag_num_e;
if (top->type == json_integer)
{
top->type = json_double;
top->u.dbl = (double) top->u.integer;
}
num_digits = 0;
flags &= ~ flag_num_zero;
continue;
}
}
else
{
if (!num_digits)
{ sprintf (error, "%d:%d: Expected digit after `e`", line_and_col);
goto e_failed;
}
top->u.dbl *= pow (10.0, (double)
(flags & flag_num_e_negative ? - num_e : num_e));
}
if (flags & flag_num_negative)
{
if (top->type == json_integer)
top->u.integer = - top->u.integer;
else
top->u.dbl = - top->u.dbl;
}
flags |= flag_next | flag_reproc;
break;
default:
break;
};
}
if (flags & flag_reproc)
{
flags &= ~ flag_reproc;
-- state.ptr;
}
if (flags & flag_next)
{
flags = (flags & ~ flag_next) | flag_need_comma;
if (!top->parent)
{
/* root value done */
flags |= flag_done;
continue;
}
if (top->parent->type == json_array)
flags |= flag_seek_value;
if (!state.first_pass)
{
json_value * parent = top->parent;
switch (parent->type)
{
case json_object:
parent->u.object.values
[parent->u.object.length].value = top;
break;
case json_array:
parent->u.array.values
[parent->u.array.length] = top;
break;
default:
break;
};
}
if ( (++ top->parent->u.array.length) > state.uint_max)
goto e_overflow;
top = top->parent;
continue;
}
}
alloc = root;
}
return root;
e_unknown_value:
sprintf (error, "%d:%d: Unknown value", line_and_col);
goto e_failed;
e_alloc_failure:
strcpy (error, "Memory allocation failure");
goto e_failed;
e_overflow:
sprintf (error, "%d:%d: Too long (caught overflow)", line_and_col);
goto e_failed;
e_failed:
if (error_buf)
{
if (*error)
strcpy (error_buf, error);
else
strcpy (error_buf, "Unknown error");
}
if (state.first_pass)
alloc = root;
while (alloc)
{
top = alloc->_reserved.next_alloc;
state.settings.mem_free (alloc, state.settings.user_data);
alloc = top;
}
if (!state.first_pass)
json_value_free_ex (&state.settings, root);
return 0;
}
json_value * json_parse (const json_char * json, size_t length)
{
json_settings settings = { 0 };
return json_parse_ex (&settings, json, length, 0);
}
void json_value_free (json_value * value)
{
json_settings settings = { 0 };
settings.mem_free = default_free;
json_value_free_ex (&settings, value);
}
| [
"[email protected]"
] | |
dd63d054e1752364c6bfaf576862c1ada911b8c1 | 92559debc561e8e457dcefdb933a2bfea8e11bf5 | /HkPlayCore/WindowsPlayM4.h | 1abf701a57831a15070a17d83e72f447f8d06058 | [] | no_license | yyyly/play | 72ad23aa155ab8ec8a7b3ab70ff46d9bde93fbc2 | aa43b713738c8dc821ccdd192e305dd198a11d4d | refs/heads/master | 2020-11-24T05:14:28.938279 | 2019-12-14T06:51:06 | 2019-12-14T06:51:06 | 227,979,879 | 0 | 0 | null | null | null | null | GB18030 | C | false | false | 39,696 | h | #ifndef _WINDOWS_PLAYM4_H_
#define _WINDOWS_PLAYM4_H_
#if defined( _WINDLL)
#define PLAYM4_API extern "C"__declspec(dllexport)
#else
#define PLAYM4_API extern "C" __declspec(dllimport)
#endif
//Max channel numbers
#define PLAYM4_MAX_SUPPORTS 500
//Wave coef range;
#define MIN_WAVE_COEF -100
#define MAX_WAVE_COEF 100
//Timer type
#define TIMER_1 1 //Only 16 timers for every process.Default TIMER;
#define TIMER_2 2 //Not limit;But the precision less than TIMER_1;
//BUFFER AND DATA TYPE
#define BUF_VIDEO_SRC (1) //mixed input,total src buffer size;splited input,video src buffer size
#define BUF_AUDIO_SRC (2) //mixed input,not defined;splited input,audio src buffer size
#define BUF_VIDEO_RENDER (3) //video render node count
#define BUF_AUDIO_RENDER (4) //audio render node count
#define BUF_VIDEO_DECODED (5) //video decoded node count to render
#define BUF_AUDIO_DECODED (6) //audio decoded node count to render
//Error code
#define PLAYM4_NOERROR 0 //no error
#define PLAYM4_PARA_OVER 1 //input parameter is invalid;
#define PLAYM4_ORDER_ERROR 2 //The order of the function to be called is error.
#define PLAYM4_TIMER_ERROR 3 //Create multimedia clock failed;
#define PLAYM4_DEC_VIDEO_ERROR 4 //Decode video data failed.
#define PLAYM4_DEC_AUDIO_ERROR 5 //Decode audio data failed.
#define PLAYM4_ALLOC_MEMORY_ERROR 6 //Allocate memory failed.
#define PLAYM4_OPEN_FILE_ERROR 7 //Open the file failed.
#define PLAYM4_CREATE_OBJ_ERROR 8 //Create thread or event failed
#define PLAYM4_CREATE_DDRAW_ERROR 9 //Create DirectDraw object failed.
#define PLAYM4_CREATE_OFFSCREEN_ERROR 10 //failed when creating off-screen surface.
#define PLAYM4_BUF_OVER 11 //buffer is overflow
#define PLAYM4_CREATE_SOUND_ERROR 12 //failed when creating audio device.
#define PLAYM4_SET_VOLUME_ERROR 13 //Set volume failed
#define PLAYM4_SUPPORT_FILE_ONLY 14 //The function only support play file.
#define PLAYM4_SUPPORT_STREAM_ONLY 15 //The function only support play stream.
#define PLAYM4_SYS_NOT_SUPPORT 16 //System not support.
#define PLAYM4_FILEHEADER_UNKNOWN 17 //No file header.
#define PLAYM4_VERSION_INCORRECT 18 //The version of decoder and encoder is not adapted.
#define PLAYM4_INIT_DECODER_ERROR 19 //Initialize decoder failed.
#define PLAYM4_CHECK_FILE_ERROR 20 //The file data is unknown.
#define PLAYM4_INIT_TIMER_ERROR 21 //Initialize multimedia clock failed.
#define PLAYM4_BLT_ERROR 22 //Blt failed.
#define PLAYM4_UPDATE_ERROR 23 //Update failed.
#define PLAYM4_OPEN_FILE_ERROR_MULTI 24 //openfile error, streamtype is multi
#define PLAYM4_OPEN_FILE_ERROR_VIDEO 25 //openfile error, streamtype is video
#define PLAYM4_JPEG_COMPRESS_ERROR 26 //JPEG compress error
#define PLAYM4_EXTRACT_NOT_SUPPORT 27 //Don't support the version of this file.
#define PLAYM4_EXTRACT_DATA_ERROR 28 //extract video data failed.
#define PLAYM4_SECRET_KEY_ERROR 29 //Secret key is error //add 20071218
#define PLAYM4_DECODE_KEYFRAME_ERROR 30 //add by hy 20090318
#define PLAYM4_NEED_MORE_DATA 31 //add by hy 20100617
#define PLAYM4_INVALID_PORT 32 //add by cj 20100913
#define PLAYM4_NOT_FIND 33 //add by cj 20110428
#define PLAYM4_NEED_LARGER_BUFFER 34 //add by pzj 20130528
#define PLAYM4_FAIL_UNKNOWN 99 //Fail, but the reason is unknown;
//鱼眼功能错误码
#define PLAYM4_FEC_ERR_ENABLEFAIL 100 // 鱼眼模块加载失败
#define PLAYM4_FEC_ERR_NOTENABLE 101 // 鱼眼模块没有加载
#define PLAYM4_FEC_ERR_NOSUBPORT 102 // 子端口没有分配
#define PLAYM4_FEC_ERR_PARAMNOTINIT 103 // 没有初始化对应端口的参数
#define PLAYM4_FEC_ERR_SUBPORTOVER 104 // 子端口已经用完
#define PLAYM4_FEC_ERR_EFFECTNOTSUPPORT 105 // 该安装方式下这种效果不支持
#define PLAYM4_FEC_ERR_INVALIDWND 106 // 非法的窗口
#define PLAYM4_FEC_ERR_PTZOVERFLOW 107 // PTZ位置越界
#define PLAYM4_FEC_ERR_RADIUSINVALID 108 // 圆心参数非法
#define PLAYM4_FEC_ERR_UPDATENOTSUPPORT 109 // 指定的安装方式和矫正效果,该参数更新不支持
#define PLAYM4_FEC_ERR_NOPLAYPORT 110 // 播放库端口没有启用
#define PLAYM4_FEC_ERR_PARAMVALID 111 // 参数为空
#define PLAYM4_FEC_ERR_INVALIDPORT 112 // 非法子端口
#define PLAYM4_FEC_ERR_PTZZOOMOVER 113 // PTZ矫正范围越界
#define PLAYM4_FEC_ERR_OVERMAXPORT 114 // 矫正通道饱和,最大支持的矫正通道为四个
#define PLAYM4_FEC_ERR_ENABLED 115 // 该端口已经启用了鱼眼模块
#define PLAYM4_FEC_ERR_D3DACCENOTENABLE 116 // D3D加速没有开启
#define PLAYM4_FEC_ERR_PLACETYPE 117 // 安装方式不对.一个播放库port,对应一种安装方式
//Max display regions.
#define MAX_DISPLAY_WND 4
//Display type
#define DISPLAY_NORMAL 0x00000001
#define DISPLAY_QUARTER 0x00000002
#define DISPLAY_YC_SCALE 0x00000004
#define DISPLAY_NOTEARING 0x00000008
//Display buffers
#define MAX_DIS_FRAMES 50
#define MIN_DIS_FRAMES 1
//Locate by
#define BY_FRAMENUM 1
#define BY_FRAMETIME 2
//Source buffer
#define SOURCE_BUF_MAX 1024*100000
#define SOURCE_BUF_MIN 1024*50
//Stream type
#define STREAME_REALTIME 0
#define STREAME_FILE 1
//frame type
#define T_AUDIO16 101
#define T_AUDIO8 100
#define T_UYVY 1
#define T_YV12 3
#define T_RGB32 7
//capability
#define SUPPORT_DDRAW 1
#define SUPPORT_BLT 2
#define SUPPORT_BLTFOURCC 4
#define SUPPORT_BLTSHRINKX 8
#define SUPPORT_BLTSHRINKY 16
#define SUPPORT_BLTSTRETCHX 32
#define SUPPORT_BLTSTRETCHY 64
#define SUPPORT_SSE 128
#define SUPPORT_MMX 256
// 以下宏定义用于HIK_MEDIAINFO结构
#define FOURCC_HKMI 0x484B4D49 // "HKMI" HIK_MEDIAINFO结构标记
// 系统封装格式
#define SYSTEM_NULL 0x0 // 没有系统层,纯音频流或视频流
#define SYSTEM_HIK 0x1 // 海康文件层
#define SYSTEM_MPEG2_PS 0x2 // PS封装
#define SYSTEM_MPEG2_TS 0x3 // TS封装
#define SYSTEM_RTP 0x4 // rtp封装
#define SYSTEM_RTPHIK 0x401 // rtp封装
// 视频编码类型
#define VIDEO_NULL 0x0 // 没有视频
#define VIDEO_H264 0x1 // 海康H.264
#define VIDEO_MPEG2 0x2 // 标准MPEG2
#define VIDEO_MPEG4 0x3 // 标准MPEG4
#define VIDEO_MJPEG 0x4
#define VIDEO_AVC264 0x0100
// 音频编码类型
#define AUDIO_NULL 0x0000 // 没有音频
#define AUDIO_ADPCM 0x1000 // ADPCM
#define AUDIO_MPEG 0x2000 // MPEG 系列音频,解码器能自适应各种MPEG音频
#define AUDIO_AAC 0X2001 // AAC 编码
#define AUDIO_RAW_DATA8 0x7000 //采样率为8k的原始数据
#define AUDIO_RAW_UDATA16 0x7001 //采样率为16k的原始数据,即L16
// G系列音频
#define AUDIO_RAW_DATA8 0x7000 //采样率为8k的原始数据
#define AUDIO_RAW_UDATA16 0x7001 //采样率为16k的原始数据,即L16
#define AUDIO_G711_U 0x7110
#define AUDIO_G711_A 0x7111
#define AUDIO_G722_1 0x7221
#define AUDIO_G723_1 0x7231
#define AUDIO_G726_U 0x7260
#define AUDIO_G726_A 0x7261
#define AUDIO_G726_16 0x7262
#define AUDIO_G729 0x7290
#define AUDIO_AMR_NB 0x3000
#define SYNCDATA_VEH 1 //同步数据:车载信息
#define SYNCDATA_IVS 2 //同步数据:智能信息
//motion flow type
#define MOTION_FLOW_NONE 0
#define MOTION_FLOW_CPU 1
#define MOTION_FLOW_GPU 2
//音视频加密类型
#define ENCRYPT_AES_3R_VIDEO 1
#define ENCRYPT_AES_10R_VIDEO 2
#define ENCRYPT_AES_3R_AUDIO 1
#define ENCRYPT_AES_10R_AUDIO 2
///<旋转角度
#define R_ANGLE_0 -1 //不旋转
#define R_ANGLE_L90 0 //向左旋转90度
#define R_ANGLE_R90 1 //向右旋转90度
#define R_ANGLE_180 2 //旋转180度
//Frame position
typedef struct{
LONGLONG nFilePos;
long nFrameNum;
long nFrameTime;
long nErrorFrameNum;
SYSTEMTIME *pErrorTime;
long nErrorLostFrameNum;
long nErrorFrameSize;
}FRAME_POS,*PFRAME_POS;
//Frame Info
typedef struct{
long nWidth;
long nHeight;
long nStamp;
long nType;
long nFrameRate;
DWORD dwFrameNum;
}FRAME_INFO;
//Frame
typedef struct{
char *pDataBuf;
long nSize;
long nFrameNum;
BOOL bIsAudio;
long nReserved;
}FRAME_TYPE;
//Watermark Info
typedef struct{
char *pDataBuf;
long nSize;
long nFrameNum;
BOOL bRsaRight;
long nReserved;
}WATERMARK_INFO;
typedef struct SYNCDATA_INFO
{
DWORD dwDataType; //和码流数据同步的附属信息类型,目前有:智能信息,车载信息
DWORD dwDataLen; //附属信息数据长度
BYTE* pData; //指向附属信息数据结构的指针,比如IVS_INFO结构
} SYNCDATA_INFO;
#ifndef _HIK_MEDIAINFO_FLAG_
#define _HIK_MEDIAINFO_FLAG_
typedef struct _HIK_MEDIAINFO_
{
unsigned int media_fourcc; // "HKMI": 0x484B4D49 Hikvision Media Information
unsigned short media_version; // 版本号:指本信息结构版本号,目前为0x0101,即1.01版本,01:主版本号;01:子版本号。
unsigned short device_id; // 设备ID,便于跟踪/分析
unsigned short system_format; // 系统封装层
unsigned short video_format; // 视频编码类型
unsigned short audio_format; // 音频编码类型
unsigned char audio_channels; // 通道数
unsigned char audio_bits_per_sample; // 样位率
unsigned int audio_samplesrate; // 采样率
unsigned int audio_bitrate; // 压缩音频码率,单位:bit
unsigned int reserved[4]; // 保留
}HIK_MEDIAINFO;
#endif
typedef struct
{
long nPort;
char * pBuf;
long nBufLen;
long nWidth;
long nHeight;
long nStamp;
long nType;
long nUser;
}DISPLAY_INFO;
typedef struct
{
long nPort;
char *pVideoBuf;
long nVideoBufLen;
char *pPriBuf;
long nPriBufLen;
long nWidth;
long nHeight;
long nStamp;
long nType;
long nUser;
}DISPLAY_INFOEX;
typedef struct PLAYM4_SYSTEM_TIME //绝对时间
{
DWORD dwYear; //年
DWORD dwMon; //月
DWORD dwDay; //日
DWORD dwHour; //时
DWORD dwMin; //分
DWORD dwSec; //秒
DWORD dwMs; //毫秒
} PLAYM4_SYSTEM_TIME;
#ifndef CROP_PIC_INFO_TAG
#define CROP_PIC_INFO_TAG
typedef struct
{
BYTE *pDataBuf; //抓图数据buffer
DWORD dwPicSize; //实际图片大小
DWORD dwBufSize; //数据buffer大小
DWORD dwPicWidth; //截图宽
DWORD dwPicHeight; //截图高
DWORD dwReserve; //多加一个reserve字段
RECT *pCropRect; //选择区域NULL, 同老的抓图接口
}CROP_PIC_INFO;
#endif
//ENCRYPT Info
typedef struct{
long nVideoEncryptType; //视频加密类型
long nAudioEncryptType; //音频加密类型
long nSetSecretKey; //是否设置,1表示设置密钥,0表示没有设置密钥
}ENCRYPT_INFO;
///<私有信息模块类型
typedef enum _PLAYM4_PRIDATA_RENDER
{
PLAYM4_RENDER_ANA_INTEL_DATA = 0x00000001, //智能分析
PLAYM4_RENDER_MD = 0x00000002, //移动侦测
PLAYM4_RENDER_ADD_POS = 0x00000004, //POS信息后叠加
PLAYM4_RENDER_ADD_PIC = 0x00000008, //图片叠加信息
PLAYM4_RENDER_FIRE_DETCET = 0x00000010, //热成像信息
PLAYM4_RENDER_TEM = 0x00000020, //温度信息
}PLAYM4_PRIDATA_RENDER;
typedef enum _PLAYM4_FIRE_ALARM
{
PLAYM4_FIRE_FRAME_DIS = 0x00000001, //火点框显示
PLAYM4_FIRE_MAX_TEMP = 0x00000002, //最高温度
PLAYM4_FIRE_MAX_TEMP_POSITION = 0x00000004, //最高温度位置显示
PLAYM4_FIRE_DISTANCE = 0x00000008, //最高温度距离
}PLAYM4_FIRE_ALARM;
typedef enum _PLAYM4_TEM_FLAG
{
PLAYM4_TEM_REGION_BOX = 0x00000001, //框测温
PLAYM4_TEM_REGION_LINE = 0x00000002, //线测温
PLAYM4_TEM_REGION_POINT = 0x00000004, //点测温
}PLAYM4_TEM_FLAG;
/////////////////////////////////////////////////////////////////////////////////////////////
//Proposed Interface 建议使用的接口
/////////////////////////////////////////////////////////////////////////////////////////////
///<初始化
PLAYM4_API BOOL __stdcall PlayM4_GetPort(LONG* nPort);
PLAYM4_API BOOL __stdcall PlayM4_FreePort(LONG nPort);
PLAYM4_API BOOL __stdcall PlayM4_OpenFile(LONG nPort,LPSTR sFileName);
PLAYM4_API BOOL __stdcall PlayM4_CloseFile(LONG nPort);
PLAYM4_API BOOL __stdcall PlayM4_OpenStream(LONG nPort,PBYTE pFileHeadBuf,DWORD nSize,DWORD nBufPoolSize);
PLAYM4_API BOOL __stdcall PlayM4_CloseStream(LONG nPort);
PLAYM4_API BOOL __stdcall PlayM4_InputData(LONG nPort,PBYTE pBuf,DWORD nSize);
PLAYM4_API BOOL __stdcall PlayM4_SetStreamOpenMode(LONG nPort,DWORD nMode);
PLAYM4_API LONG __stdcall PlayM4_GetStreamOpenMode(LONG nPort);
///<索引
PLAYM4_API BOOL __stdcall PlayM4_SetFileRefCallBack(LONG nPort, void (__stdcall *pFileRefDone)(DWORD nPort,DWORD nUser),DWORD nUser);
PLAYM4_API BOOL __stdcall PlayM4_GetRefValue(LONG nPort,BYTE *pBuffer, DWORD *pSize);
PLAYM4_API BOOL __stdcall PlayM4_GetRefValueEx(LONG nPort,BYTE *pBuffer, DWORD *pSize);///< 增加帧类型回调
PLAYM4_API BOOL __stdcall PlayM4_SetRefValue(LONG nPort,BYTE *pBuffer, DWORD nSize);
PLAYM4_API BOOL __stdcall PlayM4_GetKeyFramePos(LONG nPort,DWORD nValue, DWORD nType, PFRAME_POS pFramePos);
PLAYM4_API BOOL __stdcall PlayM4_GetNextKeyFramePos(LONG nPort,DWORD nValue, DWORD nType, PFRAME_POS pFramePos);
///<播放控制
PLAYM4_API BOOL __stdcall PlayM4_Play(LONG nPort, HWND hWnd);
PLAYM4_API BOOL __stdcall PlayM4_Stop(LONG nPort);
PLAYM4_API BOOL __stdcall PlayM4_Pause(LONG nPort,DWORD nPause);
PLAYM4_API BOOL __stdcall PlayM4_Fast(LONG nPort);
PLAYM4_API BOOL __stdcall PlayM4_Slow(LONG nPort);
PLAYM4_API BOOL __stdcall PlayM4_OneByOne(LONG nPort);
PLAYM4_API BOOL __stdcall PlayM4_OneByOneBack(LONG nPort);
PLAYM4_API BOOL __stdcall PlayM4_ReversePlay(LONG nPort);
PLAYM4_API BOOL __stdcall PlayM4_RefreshPlay(LONG nPort);
PLAYM4_API BOOL __stdcall PlayM4_RefreshPlayEx(LONG nPort,DWORD nRegionNum);
///<声音播放
PLAYM4_API BOOL __stdcall PlayM4_PlaySound(LONG nPort);
PLAYM4_API BOOL __stdcall PlayM4_StopSound();
PLAYM4_API BOOL __stdcall PlayM4_PlaySoundShare(LONG nPort);
PLAYM4_API BOOL __stdcall PlayM4_StopSoundShare(LONG nPort);
PLAYM4_API BOOL __stdcall PlayM4_SetVolume(LONG nPort,WORD nVolume);
PLAYM4_API WORD __stdcall PlayM4_GetVolume(LONG nPort);
PLAYM4_API BOOL __stdcall PlayM4_AdjustWaveAudio(LONG nPort,LONG nCoefficient);
///<获取信息
PLAYM4_API BOOL __stdcall PlayM4_SetPlayPos(LONG nPort,float fRelativePos);
PLAYM4_API float __stdcall PlayM4_GetPlayPos(LONG nPort);
PLAYM4_API DWORD __stdcall PlayM4_GetFileTime(LONG nPort);
PLAYM4_API DWORD __stdcall PlayM4_GetPlayedTime(LONG nPort);
PLAYM4_API DWORD __stdcall PlayM4_GetPlayedFrames(LONG nPort);
PLAYM4_API DWORD __stdcall PlayM4_GetFileTotalFrames(LONG nPort);
PLAYM4_API DWORD __stdcall PlayM4_GetCurrentFrameRate(LONG nPort);
PLAYM4_API DWORD __stdcall PlayM4_GetPlayedTimeEx(LONG nPort);
PLAYM4_API BOOL __stdcall PlayM4_SetPlayedTimeEx(LONG nPort,DWORD nTime);
PLAYM4_API DWORD __stdcall PlayM4_GetCurrentFrameNum(LONG nPort);
PLAYM4_API BOOL __stdcall PlayM4_SetCurrentFrameNum(LONG nPort,DWORD nFrameNum);
PLAYM4_API BOOL __stdcall PlayM4_GetSystemTime(LONG nPort, PLAYM4_SYSTEM_TIME *pstSystemTime);
PLAYM4_API DWORD __stdcall PlayM4_GetSpecialData(LONG nPort);
PLAYM4_API BOOL __stdcall PlayM4_GetPictureSize(LONG nPort,LONG *pWidth,LONG *pHeight);
PLAYM4_API BOOL __stdcall PlayM4_SetFileEndCallback(LONG nPort, void(CALLBACK*FileEndCallback)(long nPort, void *pUser), void *pUser);
///<缓存操作
PLAYM4_API DWORD __stdcall PlayM4_GetSourceBufferRemain(LONG nPort);
PLAYM4_API BOOL __stdcall PlayM4_ResetSourceBuffer(LONG nPort);
PLAYM4_API BOOL __stdcall PlayM4_SetSourceBufCallBack(LONG nPort,DWORD nThreShold,void (CALLBACK * SourceBufCallBack)(long nPort,DWORD nBufSize,DWORD dwUser,void*pResvered),DWORD dwUser,void *pReserved);
PLAYM4_API BOOL __stdcall PlayM4_ResetSourceBufFlag(LONG nPort);
PLAYM4_API BOOL __stdcall PlayM4_ResetBuffer(LONG nPort,DWORD nBufType);
PLAYM4_API DWORD __stdcall PlayM4_GetBufferValue(LONG nPort,DWORD nBufType);
PLAYM4_API BOOL __stdcall PlayM4_SetDisplayBuf(LONG nPort,DWORD nNum);
PLAYM4_API DWORD __stdcall PlayM4_GetDisplayBuf(LONG nPort);
///<抓图
PLAYM4_API BOOL __stdcall PlayM4_SetJpegQuality(long nQuality);
PLAYM4_API BOOL __stdcall PlayM4_GetBMP(LONG nPort,PBYTE pBitmap,DWORD nBufSize,DWORD* pBmpSize);
PLAYM4_API BOOL __stdcall PlayM4_GetJPEG(LONG nPort,PBYTE pJpeg,DWORD nBufSize,DWORD* pJpegSize);
PLAYM4_API BOOL __stdcall PlayM4_ConvertToBmpFile(char * pBuf,long nSize,long nWidth,long nHeight,long nType,char *sFileName);
PLAYM4_API BOOL __stdcall PlayM4_ConvertToJpegFile(char * pBuf,long nSize,long nWidth,long nHeight,long nType,char *sFileName);
///<解码
PLAYM4_API BOOL __stdcall PlayM4_SetSecretKey(LONG nPort, LONG lKeyType, char *pSecretKey, LONG lKeyLen);
PLAYM4_API BOOL __stdcall PlayM4_ThrowBFrameNum(LONG nPort,DWORD nNum);
PLAYM4_API BOOL __stdcall PlayM4_SetDecCBStream(LONG nPort,DWORD nStream);
PLAYM4_API BOOL __stdcall PlayM4_SetDecodeFrameType(LONG nPort,DWORD nFrameType);
PLAYM4_API BOOL __stdcall PlayM4_CheckDiscontinuousFrameNum(LONG nPort, BOOL bCheck);
PLAYM4_API BOOL __stdcall PlayM4_SkipErrorData(LONG nPort, BOOL bSkip);
PLAYM4_API BOOL __stdcall PlayM4_SetDecCallBackMend(LONG nPort,void (CALLBACK* DecCBFun)(long nPort,char * pBuf,long nSize,FRAME_INFO * pFrameInfo, long nUser,long nReserved2), long nUser);
PLAYM4_API BOOL __stdcall PlayM4_SetDecCallBackExMend(LONG nPort, void (CALLBACK* DecCBFun)(long nPort, char* pBuf, long nSize, FRAME_INFO* pFrameInfo, long nUser, long nReserved2), char* pDest, long nDestSize, long nUser);
// 加密码流回调,nType=0表示码流加密标记位发生变化就回调,nType=1表示码流有加密位发生回调
PLAYM4_API BOOL __stdcall PlayM4_SetEncryptTypeCallBack(LONG nPort, DWORD nType, void (CALLBACK* EncryptTypeCBFun)(long nPort, ENCRYPT_INFO* pEncryptInfo, long nUser, long nReserved2), long nUser);
///<显示
PLAYM4_API BOOL __stdcall PlayM4_SetDisplayRegion(LONG nPort,DWORD nRegionNum, RECT *pSrcRect, HWND hDestWnd, BOOL bEnable);
PLAYM4_API BOOL __stdcall PlayM4_SetDisplayType(LONG nPort,LONG nType);
PLAYM4_API long __stdcall PlayM4_GetDisplayType(LONG nPort);
PLAYM4_API BOOL __stdcall PlayM4_SetDisplayCallBack(LONG nPort,void (CALLBACK* DisplayCBFun)(long nPort,char * pBuf,long nSize,long nWidth,long nHeight,long nStamp,long nType,long nReserved));
PLAYM4_API BOOL __stdcall PlayM4_SetDisplayCallBackEx(LONG nPort,void (CALLBACK* DisplayCBFun)(DISPLAY_INFO *pstDisplayInfo), long nUser);
PLAYM4_API BOOL __stdcall PlayM4_RegisterDrawFun(LONG nPort,void (CALLBACK* DrawFun)(long nPort,HDC hDc,LONG nUser),LONG nUser);
PLAYM4_API BOOL __stdcall PlayM4_SetEncTypeChangeCallBack(LONG nPort,void(CALLBACK *funEncChange)(long nPort,long nUser),long nUser);
PLAYM4_API BOOL __stdcall PlayM4_SetCheckWatermarkCallBack(LONG nPort,void(CALLBACK* funCheckWatermark)(long nPort,WATERMARK_INFO* pWatermarkInfo,DWORD nUser),DWORD nUser);
PLAYM4_API BOOL __stdcall PlayM4_RenderPrivateData(LONG nPort, int nIntelType, BOOL bTrue);
PLAYM4_API BOOL __stdcall PlayM4_RenderPrivateDataEx(LONG nPort, int nIntelType, int nSubType, BOOL bTrue);
PLAYM4_API BOOL __stdcall PlayM4_SetOverlayPriInfoFlag(LONG nPort, int nIntelType, BOOL bTrue);
//lType: 1 表示获取当前显示帧PTZ信息。以特定结构体形式存储在pInfo内,plLen返回长度信息;起先传入pInfo = null,可以获取出需要分配的内存长度plLen
PLAYM4_API BOOL __stdcall PlayM4_GetStreamAdditionalInfo(LONG nPort, LONG lType, BYTE* pInfo, LONG* plLen);
///<图像处理
PLAYM4_API BOOL __stdcall PlayM4_SetColor(LONG nPort, DWORD nRegionNum, int nBrightness, int nContrast, int nSaturation, int nHue);
PLAYM4_API BOOL __stdcall PlayM4_GetColor(LONG nPort, DWORD nRegionNum, int *pBrightness, int *pContrast, int *pSaturation, int *pHue);
PLAYM4_API BOOL __stdcall PlayM4_SetImageSharpen(LONG nPort,DWORD nLevel);
PLAYM4_API BOOL __stdcall PlayM4_SetRotateAngle(LONG nPort, DWORD nRegionNum, DWORD dwType);
///<其他
PLAYM4_API DWORD __stdcall PlayM4_GetFileHeadLength();
PLAYM4_API DWORD __stdcall PlayM4_GetSdkVersion();
PLAYM4_API DWORD __stdcall PlayM4_GetLastError(LONG nPort);
PLAYM4_API BOOL __stdcall PlayM4_SetSycGroup(LONG nPort, DWORD dwGroupIndex);
PLAYM4_API BOOL __stdcall PlayM4_MotionFlow(LONG nPort, DWORD dwAdjustType);
///<SDP取流接口//////////////////////////////////////////////////////////////////////////
#ifndef PLAYM4_SESSION_INFO_TAG
#define PLAYM4_SESSION_INFO_TAG
//nProtocolType
#define PLAYM4_PROTOCOL_RTSP 1
//nSessionInfoType
#define PLAYM4_SESSION_INFO_SDP 1
typedef struct _PLAYM4_SESSION_INFO_ //交互信息结构
{
int nSessionInfoType; //交互信息类型,暂时只支持SDP
int nSessionInfoLen; //交互信息长度
unsigned char* pSessionInfoData; //交互信息数据
} PLAYM4_SESSION_INFO;
#endif
PLAYM4_API BOOL __stdcall PlayM4_OpenStreamAdvanced(LONG nPort, int nProtocolType, PLAYM4_SESSION_INFO* pstSessionInfo, DWORD nBufPoolSize);
///<鱼眼相关接口//////////////////////////////////////////////////////////////////////////
#ifndef FISH_EYE_TAG
#define FISH_EYE_TAG
// 安装类型
typedef enum tagFECPlaceType
{
FEC_PLACE_NULL = 0x0, // 无安装方式 (鱼眼画面)
FEC_PLACE_WALL = 0x1, // 壁装方式 (法线水平)
FEC_PLACE_FLOOR = 0x2, // 地面安装 (法线向上)
FEC_PLACE_CEILING = 0x3, // 顶装方式 (法线向下)
}FECPLACETYPE;
typedef enum tagFECCorrectType
{
FEC_CORRECT_NULL = 0x0, // 不矫正
FEC_CORRECT_PTZ = 0x100, // PTZ
FEC_CORRECT_180 = 0x200, // 180度矫正 (对应2P)
FEC_CORRECT_360 = 0x300, // 360全景矫正 (对应1P)
FEC_CORRECT_LAT = 0x400 // 纬度展开
}FECCORRECTTYPE;
typedef struct tagCycleParam
{
float fRadiusLeft; // 圆的最左边X坐标
float fRadiusRight; // 圆的最右边X坐标
float fRadiusTop; // 圆的最上边Y坐标
float fRadiusBottom; // 圆的最下边Y坐标
}CYCLEPARAM;
typedef struct tagPTZParam
{
float fPTZPositionX; // PTZ 显示的中心位置 X坐标
float fPTZPositionY; // PTZ 显示的中心位置 Y坐标
}PTZPARAM;
#define FEC_UPDATE_RADIUS 0x1
#define FEC_UPDATE_PTZZOOM 0x2
#define FEC_UPDATE_WIDESCANOFFSET 0x4
#define FEC_UPDATE_PTZPARAM 0x8
#define FEC_UPDATT_PTZCOLOR 0x10
// 色彩结构体
typedef struct tagFECColor
{
unsigned char nR; // R分量
unsigned char nG; // G分量
unsigned char nB; // B分量
unsigned char nAlpha; // Alpha分量
}FECCOLOR;
typedef struct tagFECParam
{
unsigned int nUpDateType; // 更新的类型
unsigned int nPlaceAndCorrect; // 安装方式和矫正方式,只能用于获取,SetParam的时候无效,该值表示安装方式和矫正方式的和
PTZPARAM stPTZParam; // PTZ 校正的参数
CYCLEPARAM stCycleParam; // 鱼眼图像圆心参数
float fZoom; // PTZ 显示的范围参数
float fWideScanOffset; // 180或者360度校正的偏移角度
FECCOLOR stPTZColor; // PTZ颜色
int nResver[15]; // 保留字段
}FISHEYEPARAM;
// PTZ在原始鱼眼图上轮廓的显示模式
typedef enum tagFECShowMode
{
FEC_PTZ_OUTLINE_NULL, // 不显示
FEC_PTZ_OUTLINE_RECT, // 矩形显示
FEC_PTZ_OUTLINE_RANGE, // 真实区域显示
}FECSHOWMODE;
#define FEC_JPEG 0 // JPEG抓图
#define FEC_BMP 1 // BMP 抓图
// 硬解码标志
#define FEC_DISPLAYSURFACE 0x400 // 鱼眼硬解标识
typedef void (__stdcall* FISHEYE_CallBack )(void* pUser, unsigned int nSubPort, unsigned int nCBType, void* hDC, unsigned int nWidth, unsigned int nHeight);
#endif
// 启用鱼眼
PLAYM4_API BOOL __stdcall PlayM4_FEC_Enable(LONG nPort);
// 关闭鱼眼模块
PLAYM4_API BOOL __stdcall PlayM4_FEC_Disable(LONG nPort);
// 获取鱼眼矫正处理子端口 [1~31]
PLAYM4_API BOOL __stdcall PlayM4_FEC_GetPort(LONG nPort, unsigned int* nSubPort, FECPLACETYPE emPlaceType, FECCORRECTTYPE emCorrectType);
// 删除鱼眼矫正处理子端口
PLAYM4_API BOOL __stdcall PlayM4_FEC_DelPort(LONG nPort, unsigned int nSubPort);
// 设置鱼眼矫正参数
PLAYM4_API BOOL __stdcall PlayM4_FEC_SetParam(LONG nPort, unsigned int nSubPort, FISHEYEPARAM* pPara);
// 获取鱼眼矫正参数
PLAYM4_API BOOL __stdcall PlayM4_FEC_GetParam(LONG nPort, unsigned int nSubPort, FISHEYEPARAM* pPara);
// 设置显示窗口,可以随时切换
PLAYM4_API BOOL __stdcall PlayM4_FEC_SetWnd(LONG nPort, unsigned int nSubPort, void* hWnd);
// 设置鱼眼窗口的绘图回调
PLAYM4_API BOOL __stdcall PlayM4_FEC_SetCallBack(LONG nPort, unsigned int nSubPort, FISHEYE_CallBack cbFunc, void* pUser);
// 鱼眼抓图
PLAYM4_API BOOL __stdcall PlayM4_FEC_Capture(LONG nPort, unsigned int nSubPort, unsigned int nType, char* pFileName);
//鱼眼硬解
PLAYM4_API BOOL __stdcall PlayM4_FEC_SetConfig(LONG nPort,unsigned int nType);
PLAYM4_API BOOL __stdcall PlayM4_FEC_GetCurrentPTZPort(LONG nPort, float fPositionX,float fPositionY, unsigned int *pnPort);
PLAYM4_API BOOL __stdcall PlayM4_FEC_SetCurrentPTZPort(LONG nPort, unsigned int nSubPort);
PLAYM4_API BOOL __stdcall PlayM4_FEC_SetPTZOutLineShowMode(LONG nPort,FECSHOWMODE nPTZShowMode);
///<图像增强相关接口//////////////////////////////////////////////////////////////////////////
#ifndef PLAYM4_HIKVIE_TAG
#define PLAYM4_HIKVIE_TAG
typedef struct _PLAYM4_VIE_DYNPARAM_
{
int moduFlag; //启用的算法处理模块,在PLAYM4_VIE_MODULES中定义,如 PLAYM4_VIE_MODU_ADJ | PLAYM4_VIE_MODU_EHAN,模块启用后,必须设置相应的参数;
//PLAYM4_VIE_MODU_ADJ
int brightVal; //亮度调节值,[-255, 255]
int contrastVal; //对比度调节值,[-256, 255]
int colorVal; //饱和度调节值,[-256, 255]
//PLAYM4_VIE_MODU_EHAN
int toneScale; //滤波范围,[0, 100]
int toneGain; //对比度调节,全局对比度增益值,[-256, 255]
int toneOffset; //亮度调节,亮度平均值偏移,[-255, 255]
int toneColor; //颜色调节,颜色保真值,[-256, 255]
//PLAYM4_VIE_MODU_DEHAZE
int dehazeLevel; //去雾强度,[0, 255]
int dehazeTrans; //透射值,[0, 255]
int dehazeBright; //亮度补偿,[0, 255]
//PLAYM4_VIE_MODU_DENOISE
int denoiseLevel; //去噪强度,[0, 255]
//PLAYM4_VIE_MODU_SHARPEN
int usmAmount; //锐化强度,[0, 255]
int usmRadius; //锐化半径,[1, 15]
int usmThreshold; //锐化阈值,[0, 255]
//PLAYM4_VIE_MODU_DEBLOCK
int deblockLevel; //去块强度,[0, 100]
//PLAYM4_VIE_MODU_LENS
int lensWarp; //畸变量,[-256, 255]
int lensZoom; //缩放量,[-256, 255]
//PLAYM4_VIE_MODU_CRB
//无响应参数
} PLAYM4_VIE_PARACONFIG;
typedef enum _PLAYM4_VIE_MODULES
{
PLAYM4_VIE_MODU_ADJ = 0x00000001, //图像基本调节
PLAYM4_VIE_MODU_EHAN = 0x00000002, //局部增强模块
PLAYM4_VIE_MODU_DEHAZE = 0x00000004, //去雾模块
PLAYM4_VIE_MODU_DENOISE = 0x00000008, //去噪模块
PLAYM4_VIE_MODU_SHARPEN = 0x00000010, //锐化模块
PLAYM4_VIE_MODU_DEBLOCK = 0x00000020, //去块滤波模块
PLAYM4_VIE_MODU_CRB = 0x00000040, //色彩平衡模块
PLAYM4_VIE_MODU_LENS = 0x00000080, //镜头畸变矫正模块
}PLAYM4_VIE_MODULES;
#endif
//设置关闭/开启模块
//dwModuFlag对应PLAYM4_VIE_MODULES宏,可组合
//先设置模块开启,再设置模块参数;期间采用默认的参数;
//关闭模块后,上次设置的参数清空
//其他接口调用,必须在该接口开启模块后;否则,返回错误
PLAYM4_API BOOL __stdcall PlayM4_VIE_SetModuConfig(LONG lPort,int nModuFlag,BOOL bEnable);
//设置图像增强区域,NULL全图;超过全图,采用全图;最小区域32*32像素
//可支持设置区域,最多比较说4个,第一个版本可以只支持一个。多个区域要求不能重叠,有重叠就报错
PLAYM4_API BOOL __stdcall PlayM4_VIE_SetRegion(LONG lPort,LONG lRegNum,RECT* pRect);
//获取开启模块
PLAYM4_API BOOL __stdcall PlayM4_VIE_GetModuConfig(LONG lPort,int* pdwModuFlag);
//设置参数,未开启模块的参数设置被忽略
PLAYM4_API BOOL __stdcall PlayM4_VIE_SetParaConfig(LONG lPort,PLAYM4_VIE_PARACONFIG* pParaConfig);
//获取开启模块的参数
PLAYM4_API BOOL __stdcall PlayM4_VIE_GetParaConfig(LONG lPort,PLAYM4_VIE_PARACONFIG* pParaConfig);
///<预录像相关接口//////////////////////////////////////////////////////////////////////////
#define PLAYM4_MEDIA_HEAD 1 //系统头数据
#define PLAYM4_VIDEO_DATA 2 //视频流数据
#define PLAYM4_AUDIO_DATA 3 //音频流数据
#define PLAYM4_PRIVT_DATA 4 //私有流数据
//预录像数据信息
typedef struct
{
long nType; // 数据类型,如文件头,视频,音频,私有数据等
long nStamp; // 时间戳
long nFrameNum; // 帧号
long nBufLen; // 数据长度
char* pBuf; // 帧数据,以帧为单位回调
PLAYM4_SYSTEM_TIME stSysTime; // 全局时间
}RECORD_DATA_INFO;
//设置预录像开关,bFlag=1开启,bFlag=0关闭
PLAYM4_API BOOL __stdcall PlayM4_SetPreRecordFlag(LONG lPort, BOOL bFlag);
//预录像数据数据回调
PLAYM4_API BOOL __stdcall PlayM4_SetPreRecordCallBack(LONG lPort, void (CALLBACK* PreRecordCBfun)(long nPort, RECORD_DATA_INFO* pRecordDataInfo, void* pUser), void* pUser);
///<新增接口//////////////////////////////////////////////////////////////////////////////////////////////////
typedef struct
{
long lDataType; //私有数据类型
long lDataStrVersion; //数据返回的结构体版本,主要是为了兼容性
long lDataTimeStamp;
long lDataLength;
char* pData;
}AdditionDataInfo;
PLAYM4_API BOOL __stdcall PlayM4_SetAdditionDataCallBack(LONG nPort, DWORD nSyncType, void (CALLBACK* AdditionDataCBFun)(long nPort, AdditionDataInfo* pstAddDataInfo, void* pUser), void* pUser);
#define SOFT_DECODE_ENGINE 0 ///<软解码
#define HARD_DECODE_ENGINE 1 ///<硬解码
PLAYM4_API BOOL __stdcall PlayM4_SetDecodeEngineEx(LONG nPort, DWORD nDecodeEngine);
PLAYM4_API DWORD __stdcall PlayM4_GetDecodeEngine(LONG nPort);
#define PLAYM4_SOURCE_MODULE 0 // 数据源模块
#define PLAYM4_DEMUX_MODULE 1 // 解析模块
#define PLAYM4_DECODE_MODULE 2 // 解码模块
#define PLAYM4_RENDER_MODULE 3 // 渲染模块
#define PLAYM4_RTINFO_HARDDECODE_ERROR 0 // 硬解码错误
#define PLAYM4_RTINFO_SOFTDECODE_ERROR 1 // 软解码错误
#define PLAYM4_RTINFO_MEDIAHEADER_ERROR 2 // 媒体头错误
#define PLAYM4_RTINFO_SWITCH_SOFT_DEC 3 // 切换至软解
#define PLAYM4_RTINFO_ALLOC_MEMORY_ERROR 4 // 内存分配失败
typedef struct
{
int nRunTimeModule; //当前运行模块
int nStrVersion; //结构体版本
int nFrameTimeStamp; //帧号
int nFrameNum; //时间戳
int nErrorCode; //错误码
unsigned char reserved[12]; //保留字节
}RunTimeInfo;
PLAYM4_API int __stdcall PlayM4_SetRunTimeInfoCallBackEx(long nPort, int nModule, void (CALLBACK* RunTimeInfoCBFun)(long nPort, RunTimeInfo* pstRunTimeInfo, void* pUser), void* pUser);
#ifndef PLAYM4_HIKSR_TAG
#define PLAYM4_HIKSR_TAG
// 旋转单元结构体
typedef struct tagPLAYM4SRTransformElement
{
float fAxisX;
float fAxisY;
float fAxisZ;
float fValue; // 旋转的角度
}PLAYM4SRTRANSFERELEMENT;
// 旋转组合参数
typedef struct tagPLAYM4SRTransformParam
{
PLAYM4SRTRANSFERELEMENT* pTransformElement; // 旋转的坐标轴
unsigned int nTransformCount; // 旋转的组合次数
}PLAYM4SRTRANSFERPARAM;
#define CFG_DISPLAY_MODEL_MODE 0x499
// 模型贴图类型 0 双面 1 外面 2 内面
typedef enum tagPLAYM4SRTextureMode
{
PLAYM4_TEXTURE_DOUBLE = 0x0, // 双面贴纹理
PLAYM4_TEXTURE_OUTER = 0x1, // 外表面贴纹理
PLAYM4_TEXTURE_INNER = 0x2, // 内表面贴纹理
}PLAYM4SRTEXTUREMODE;
//模型类型
typedef enum tagPLAYM4SRModelType
{
PLAYM4_MODELTYPE_HEMISPHERE = 0x0, //鱼眼视频用半球模型
PLAYM4_MODELTYPE_EAGLE_EYE = 0x1, //碗状类半球模型用于鹰眼拼接
PLAYM4_MODELTYPE_CUBE = 0x2, //立方体模型
}PLAYM4SRMODELTYPE;
#define PLAYM4_MODEL_SOLID 0x0001 //实体模型
#define PLAYM4_MODEL_FRAME 0x0010 //边框模型
#define PLAYM4_MODEL_AXIS 0x0100 //坐标轴
//渲染到3D模型的相关参数
typedef struct tagRenderModelMode
{
bool bModelMode; // 是否将渲染到3D模型上
PLAYM4SRTEXTUREMODE emTextureMode; // 纹理贴图模式 双面 外表面 内表面
unsigned long ulDisplayType; // 按位组合 SR_MODEL_SOLID | SR_MODEL_FRAME | SR_MODEL_AXIS
unsigned int nTransformMode; // 0 线框坐标轴随模型变换 1 线框坐标轴不随模型变换
PLAYM4SRMODELTYPE emModelType; // 模型类型,鱼眼半球,鹰眼碗模型等
}PLAYM4SRMODELMODE;
#define SR_JPEG 0
#define SR_BMP 1
#endif
PLAYM4_API BOOL __stdcall PlayM4_SR_SetConfig(LONG nPort, int nCfgType, void *pValue);
PLAYM4_API BOOL __stdcall PlayM4_SR_Rotate(LONG nPort, PLAYM4SRTRANSFERPARAM *pstRotateParam);
PLAYM4_API BOOL __stdcall PlayM4_SR_Capture(LONG nPort, unsigned int nType, char *pFileName);
/////////////////////////////////////////////////////////////////////////////////////////////
//Unproposed Interface 不建议使用的接口
/////////////////////////////////////////////////////////////////////////////////////////////
PLAYM4_API BOOL __stdcall PlayM4_RigisterDrawFun(LONG nPort,void (CALLBACK* DrawFun)(long nPort,HDC hDc,LONG nUser),LONG nUser);
PLAYM4_API BOOL __stdcall PlayM4_SetDecCallBack(LONG nPort,void (CALLBACK* DecCBFun)(long nPort,char * pBuf,long nSize,FRAME_INFO * pFrameInfo, long nReserved1,long nReserved2));
PLAYM4_API BOOL __stdcall PlayM4_SetDecCallBackEx(LONG nPort,void (CALLBACK* DecCBFun)(long nPort,char * pBuf,long nSize,FRAME_INFO * pFrameInfo, long nReserved1,long nReserved2), char* pDest, long nDestSize);
PLAYM4_API BOOL __stdcall PlayM4_SetSycStartTime(LONG nPort, PLAYM4_SYSTEM_TIME *pstSystemTime);
PLAYM4_API BOOL __stdcall PlayM4_SyncToAudio(LONG nPort, BOOL bSyncToAudio);
PLAYM4_API BOOL __stdcall PlayM4_SetDecodeEngine(LONG nPort, DWORD nDecodeEngine);
PLAYM4_API BOOL __stdcall PlayM4_SetRunTimeInfoCallBack(LONG nPort, void (CALLBACK* RunTimeInfoCBFun)(long nPort, RunTimeInfo* pstRunTimeInfo, void* pUser), void* pUser);
/////////////////////////////////////////////////////////////////////////////////////////////
//Unsupported Interface 不再支持的接口
/////////////////////////////////////////////////////////////////////////////////////////////
PLAYM4_API BOOL __stdcall PlayM4_InitDDraw(HWND hWnd);
PLAYM4_API BOOL __stdcall PlayM4_RealeseDDraw();
PLAYM4_API BOOL __stdcall PlayM4_SetFileEndMsg(LONG nPort,HWND hWnd,UINT nMsg);
PLAYM4_API int __stdcall PlayM4_GetCaps();
PLAYM4_API BOOL __stdcall PlayM4_SetOverlayMode(LONG nPort,BOOL bOverlay,COLORREF colorKey);
PLAYM4_API LONG __stdcall PlayM4_GetOverlayMode(LONG nPort);
PLAYM4_API COLORREF __stdcall PlayM4_GetColorKey(LONG nPort);
PLAYM4_API BOOL __stdcall PlayM4_InitDDrawDevice();
PLAYM4_API void __stdcall PlayM4_ReleaseDDrawDevice();
PLAYM4_API DWORD __stdcall PlayM4_GetDDrawDeviceTotalNums();
PLAYM4_API BOOL __stdcall PlayM4_SetDDrawDevice(LONG nPort,DWORD nDeviceNum);
PLAYM4_API BOOL __stdcall PlayM4_GetDDrawDeviceInfo(DWORD nDeviceNum,LPSTR lpDriverDescription,DWORD nDespLen,LPSTR lpDriverName ,DWORD nNameLen,HMONITOR *hhMonitor);
PLAYM4_API int __stdcall PlayM4_GetCapsEx(DWORD nDDrawDeviceNum);
PLAYM4_API BOOL __stdcall PlayM4_SetDDrawDeviceEx(LONG nPort,DWORD nRegionNum,DWORD nDeviceNum);
PLAYM4_API BOOL __stdcall PlayM4_OpenStreamEx(LONG nPort,PBYTE pFileHeadBuf,DWORD nSize,DWORD nBufPoolSize);
PLAYM4_API BOOL __stdcall PlayM4_CloseStreamEx(LONG nPort);
PLAYM4_API BOOL __stdcall PlayM4_InputVideoData(LONG nPort,PBYTE pBuf,DWORD nSize);
PLAYM4_API BOOL __stdcall PlayM4_InputAudioData(LONG nPort,PBYTE pBuf,DWORD nSize);
PLAYM4_API BOOL __stdcall PlayM4_SetTimerType(LONG nPort,DWORD nTimerType,DWORD nReserved);
PLAYM4_API BOOL __stdcall PlayM4_GetTimerType(LONG nPort,DWORD *pTimerType,DWORD *pReserved);
PLAYM4_API BOOL __stdcall PlayM4_SetVerifyCallBack(LONG nPort, DWORD nBeginTime, DWORD nEndTime, void (__stdcall * funVerify)(long nPort, FRAME_POS * pFilePos, DWORD bIsVideo, DWORD nUser), DWORD nUser);
PLAYM4_API BOOL __stdcall PlayM4_SetAudioCallBack(LONG nPort, void (__stdcall * funAudio)(long nPort, char * pAudioBuf, long nSize, long nStamp, long nType, long nUser), long nUser);
PLAYM4_API BOOL __stdcall PlayM4_SetEncChangeMsg(LONG nPort,HWND hWnd,UINT nMsg);
PLAYM4_API BOOL __stdcall PlayM4_GetOriginalFrameCallBack(LONG nPort, BOOL bIsChange,BOOL bNormalSpeed,long nStartFrameNum,long nStartStamp,long nFileHeader,void(CALLBACK *funGetOrignalFrame)(long nPort,FRAME_TYPE *frameType, long nUser),long nUser);
PLAYM4_API BOOL __stdcall PlayM4_GetFileSpecialAttr(LONG nPort, DWORD *pTimeStamp,DWORD *pFileNum ,DWORD *pReserved);
PLAYM4_API BOOL __stdcall PlayM4_SetPlayMode(LONG nPort,BOOL bNormal);
PLAYM4_API BOOL __stdcall PlayM4_SetOverlayFlipMode(LONG nPort,BOOL bTrue);
PLAYM4_API BOOL __stdcall PlayM4_SetDeflash(LONG nPort,BOOL bDefalsh);
PLAYM4_API BOOL __stdcall PlayM4_SetPicQuality(LONG nPort,BOOL bHighQuality);
PLAYM4_API BOOL __stdcall PlayM4_GetPictureQuality(LONG nPort,BOOL *bHighQuality);
#endif //_PLAYM4_H_
| [
"[email protected]"
] | |
faac6ec44b7876d4c9d55114e243252c1cde6cbf | 40de3da30239862f11a946166b50438174c2fd4e | /lib/wizards/jenny/hriak/maze/spider4.c | b6b7feb3d1574b4335392d4f17eba83a7ebd7b80 | [
"MIT"
] | permissive | vlehtola/questmud | f53b7205351f30e846110300d60b639d52d113f8 | 8bc3099b5ad00a9e0261faeb6637c76b521b6dbe | refs/heads/master | 2020-12-23T19:59:44.886028 | 2020-01-30T15:52:16 | 2020-01-30T15:52:16 | 237,240,459 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 568 | c | #include "room.h"
#undef EXTRA_RESET
#define EXTRA_RESET\
extra_reset();
extra_reset() {
object ob;
int i;
set_not_out(1);
if(present("spider 3")) return;
i = random(3)+1;
while(i>0) {
move_object(clone_object("/wizards/celtron/maze/monsters/spider"),
this_object());
i -= 1;
}
}
ONE_EXIT("/wizards/celtron/maze/3", "south",
"Inside the cave",
"There are some spider webs hanging from the ceiling.\n"+
"Cave's walls, ceiling and floor are all rough stone.\n" +
"The light fades into the darkness of the cave in east.\n", 0)
| [
"[email protected]"
] | |
a730398156580f7a1fa07df433f811658e994bdb | f22d49bd1fe6872693e635ce59b1a9be6142c1fb | /submodules/externals/libvpx/vp9/common/vp9_loopfilter.c | 6e425e8fbd2f808573fd011dad9430bdb1630e81 | [] | no_license | zengtaoxian/linphone | 7007d5f6b91dfda9a7160c39710e2d68f8c94585 | 2f95c94fa416e23de913de618ba26b12d0abbc16 | refs/heads/master | 2021-01-09T06:27:58.541420 | 2014-12-07T12:19:55 | 2014-12-07T12:19:55 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 39,654 | c | /*
* Copyright (c) 2010 The WebM project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "vpx_config.h"
#include "vp9/common/vp9_loopfilter.h"
#include "vp9/common/vp9_onyxc_int.h"
#include "vp9/common/vp9_reconinter.h"
#include "vpx_mem/vpx_mem.h"
#include "vp9/common/vp9_seg_common.h"
struct loop_filter_info {
const uint8_t *mblim;
const uint8_t *lim;
const uint8_t *hev_thr;
};
// This structure holds bit masks for all 8x8 blocks in a 64x64 region.
// Each 1 bit represents a position in which we want to apply the loop filter.
// Left_ entries refer to whether we apply a filter on the border to the
// left of the block. Above_ entries refer to whether or not to apply a
// filter on the above border. Int_ entries refer to whether or not to
// apply borders on the 4x4 edges within the 8x8 block that each bit
// represents.
// Since each transform is accompanied by a potentially different type of
// loop filter there is a different entry in the array for each transform size.
typedef struct {
uint64_t left_y[TX_SIZES];
uint64_t above_y[TX_SIZES];
uint64_t int_4x4_y;
uint16_t left_uv[TX_SIZES];
uint16_t above_uv[TX_SIZES];
uint16_t int_4x4_uv;
} LOOP_FILTER_MASK;
// 64 bit masks for left transform size. Each 1 represents a position where
// we should apply a loop filter across the left border of an 8x8 block
// boundary.
//
// In the case of TX_16X16-> ( in low order byte first we end up with
// a mask that looks like this
//
// 10101010
// 10101010
// 10101010
// 10101010
// 10101010
// 10101010
// 10101010
// 10101010
//
// A loopfilter should be applied to every other 8x8 horizontally.
static const uint64_t left_64x64_txform_mask[TX_SIZES]= {
0xffffffffffffffff, // TX_4X4
0xffffffffffffffff, // TX_8x8
0x5555555555555555, // TX_16x16
0x1111111111111111, // TX_32x32
};
// 64 bit masks for above transform size. Each 1 represents a position where
// we should apply a loop filter across the top border of an 8x8 block
// boundary.
//
// In the case of TX_32x32 -> ( in low order byte first we end up with
// a mask that looks like this
//
// 11111111
// 00000000
// 00000000
// 00000000
// 11111111
// 00000000
// 00000000
// 00000000
//
// A loopfilter should be applied to every other 4 the row vertically.
static const uint64_t above_64x64_txform_mask[TX_SIZES]= {
0xffffffffffffffff, // TX_4X4
0xffffffffffffffff, // TX_8x8
0x00ff00ff00ff00ff, // TX_16x16
0x000000ff000000ff, // TX_32x32
};
// 64 bit masks for prediction sizes (left). Each 1 represents a position
// where left border of an 8x8 block. These are aligned to the right most
// appropriate bit, and then shifted into place.
//
// In the case of TX_16x32 -> ( low order byte first ) we end up with
// a mask that looks like this :
//
// 10000000
// 10000000
// 10000000
// 10000000
// 00000000
// 00000000
// 00000000
// 00000000
static const uint64_t left_prediction_mask[BLOCK_SIZES] = {
0x0000000000000001, // BLOCK_4X4,
0x0000000000000001, // BLOCK_4X8,
0x0000000000000001, // BLOCK_8X4,
0x0000000000000001, // BLOCK_8X8,
0x0000000000000101, // BLOCK_8X16,
0x0000000000000001, // BLOCK_16X8,
0x0000000000000101, // BLOCK_16X16,
0x0000000001010101, // BLOCK_16X32,
0x0000000000000101, // BLOCK_32X16,
0x0000000001010101, // BLOCK_32X32,
0x0101010101010101, // BLOCK_32X64,
0x0000000001010101, // BLOCK_64X32,
0x0101010101010101, // BLOCK_64X64
};
// 64 bit mask to shift and set for each prediction size.
static const uint64_t above_prediction_mask[BLOCK_SIZES] = {
0x0000000000000001, // BLOCK_4X4
0x0000000000000001, // BLOCK_4X8
0x0000000000000001, // BLOCK_8X4
0x0000000000000001, // BLOCK_8X8
0x0000000000000001, // BLOCK_8X16,
0x0000000000000003, // BLOCK_16X8
0x0000000000000003, // BLOCK_16X16
0x0000000000000003, // BLOCK_16X32,
0x000000000000000f, // BLOCK_32X16,
0x000000000000000f, // BLOCK_32X32,
0x000000000000000f, // BLOCK_32X64,
0x00000000000000ff, // BLOCK_64X32,
0x00000000000000ff, // BLOCK_64X64
};
// 64 bit mask to shift and set for each prediction size. A bit is set for
// each 8x8 block that would be in the left most block of the given block
// size in the 64x64 block.
static const uint64_t size_mask[BLOCK_SIZES] = {
0x0000000000000001, // BLOCK_4X4
0x0000000000000001, // BLOCK_4X8
0x0000000000000001, // BLOCK_8X4
0x0000000000000001, // BLOCK_8X8
0x0000000000000101, // BLOCK_8X16,
0x0000000000000003, // BLOCK_16X8
0x0000000000000303, // BLOCK_16X16
0x0000000003030303, // BLOCK_16X32,
0x0000000000000f0f, // BLOCK_32X16,
0x000000000f0f0f0f, // BLOCK_32X32,
0x0f0f0f0f0f0f0f0f, // BLOCK_32X64,
0x00000000ffffffff, // BLOCK_64X32,
0xffffffffffffffff, // BLOCK_64X64
};
// These are used for masking the left and above borders.
static const uint64_t left_border = 0x1111111111111111;
static const uint64_t above_border = 0x000000ff000000ff;
// 16 bit masks for uv transform sizes.
static const uint16_t left_64x64_txform_mask_uv[TX_SIZES]= {
0xffff, // TX_4X4
0xffff, // TX_8x8
0x5555, // TX_16x16
0x1111, // TX_32x32
};
static const uint16_t above_64x64_txform_mask_uv[TX_SIZES]= {
0xffff, // TX_4X4
0xffff, // TX_8x8
0x0f0f, // TX_16x16
0x000f, // TX_32x32
};
// 16 bit left mask to shift and set for each uv prediction size.
static const uint16_t left_prediction_mask_uv[BLOCK_SIZES] = {
0x0001, // BLOCK_4X4,
0x0001, // BLOCK_4X8,
0x0001, // BLOCK_8X4,
0x0001, // BLOCK_8X8,
0x0001, // BLOCK_8X16,
0x0001, // BLOCK_16X8,
0x0001, // BLOCK_16X16,
0x0011, // BLOCK_16X32,
0x0001, // BLOCK_32X16,
0x0011, // BLOCK_32X32,
0x1111, // BLOCK_32X64
0x0011, // BLOCK_64X32,
0x1111, // BLOCK_64X64
};
// 16 bit above mask to shift and set for uv each prediction size.
static const uint16_t above_prediction_mask_uv[BLOCK_SIZES] = {
0x0001, // BLOCK_4X4
0x0001, // BLOCK_4X8
0x0001, // BLOCK_8X4
0x0001, // BLOCK_8X8
0x0001, // BLOCK_8X16,
0x0001, // BLOCK_16X8
0x0001, // BLOCK_16X16
0x0001, // BLOCK_16X32,
0x0003, // BLOCK_32X16,
0x0003, // BLOCK_32X32,
0x0003, // BLOCK_32X64,
0x000f, // BLOCK_64X32,
0x000f, // BLOCK_64X64
};
// 64 bit mask to shift and set for each uv prediction size
static const uint16_t size_mask_uv[BLOCK_SIZES] = {
0x0001, // BLOCK_4X4
0x0001, // BLOCK_4X8
0x0001, // BLOCK_8X4
0x0001, // BLOCK_8X8
0x0001, // BLOCK_8X16,
0x0001, // BLOCK_16X8
0x0001, // BLOCK_16X16
0x0011, // BLOCK_16X32,
0x0003, // BLOCK_32X16,
0x0033, // BLOCK_32X32,
0x3333, // BLOCK_32X64,
0x00ff, // BLOCK_64X32,
0xffff, // BLOCK_64X64
};
static const uint16_t left_border_uv = 0x1111;
static const uint16_t above_border_uv = 0x000f;
static void lf_init_lut(loop_filter_info_n *lfi) {
lfi->mode_lf_lut[DC_PRED] = 0;
lfi->mode_lf_lut[D45_PRED] = 0;
lfi->mode_lf_lut[D135_PRED] = 0;
lfi->mode_lf_lut[D117_PRED] = 0;
lfi->mode_lf_lut[D153_PRED] = 0;
lfi->mode_lf_lut[D207_PRED] = 0;
lfi->mode_lf_lut[D63_PRED] = 0;
lfi->mode_lf_lut[V_PRED] = 0;
lfi->mode_lf_lut[H_PRED] = 0;
lfi->mode_lf_lut[TM_PRED] = 0;
lfi->mode_lf_lut[ZEROMV] = 0;
lfi->mode_lf_lut[NEARESTMV] = 1;
lfi->mode_lf_lut[NEARMV] = 1;
lfi->mode_lf_lut[NEWMV] = 1;
}
static void update_sharpness(loop_filter_info_n *lfi, int sharpness_lvl) {
int lvl;
// For each possible value for the loop filter fill out limits
for (lvl = 0; lvl <= MAX_LOOP_FILTER; lvl++) {
// Set loop filter paramaeters that control sharpness.
int block_inside_limit = lvl >> ((sharpness_lvl > 0) + (sharpness_lvl > 4));
if (sharpness_lvl > 0) {
if (block_inside_limit > (9 - sharpness_lvl))
block_inside_limit = (9 - sharpness_lvl);
}
if (block_inside_limit < 1)
block_inside_limit = 1;
vpx_memset(lfi->lim[lvl], block_inside_limit, SIMD_WIDTH);
vpx_memset(lfi->mblim[lvl], (2 * (lvl + 2) + block_inside_limit),
SIMD_WIDTH);
}
}
void vp9_loop_filter_init(VP9_COMMON *cm) {
loop_filter_info_n *lfi = &cm->lf_info;
struct loopfilter *lf = &cm->lf;
int i;
// init limits for given sharpness
update_sharpness(lfi, lf->sharpness_level);
lf->last_sharpness_level = lf->sharpness_level;
// init LUT for lvl and hev thr picking
lf_init_lut(lfi);
// init hev threshold const vectors
for (i = 0; i < 4; i++)
vpx_memset(lfi->hev_thr[i], i, SIMD_WIDTH);
}
void vp9_loop_filter_frame_init(VP9_COMMON *cm, int default_filt_lvl) {
int seg_id;
// n_shift is the a multiplier for lf_deltas
// the multiplier is 1 for when filter_lvl is between 0 and 31;
// 2 when filter_lvl is between 32 and 63
const int n_shift = default_filt_lvl >> 5;
loop_filter_info_n *const lfi = &cm->lf_info;
struct loopfilter *const lf = &cm->lf;
struct segmentation *const seg = &cm->seg;
// update limits if sharpness has changed
if (lf->last_sharpness_level != lf->sharpness_level) {
update_sharpness(lfi, lf->sharpness_level);
lf->last_sharpness_level = lf->sharpness_level;
}
for (seg_id = 0; seg_id < MAX_SEGMENTS; seg_id++) {
int lvl_seg = default_filt_lvl, ref, mode, intra_lvl;
// Set the baseline filter values for each segment
if (vp9_segfeature_active(seg, seg_id, SEG_LVL_ALT_LF)) {
const int data = vp9_get_segdata(seg, seg_id, SEG_LVL_ALT_LF);
lvl_seg = seg->abs_delta == SEGMENT_ABSDATA
? data
: clamp(default_filt_lvl + data, 0, MAX_LOOP_FILTER);
}
if (!lf->mode_ref_delta_enabled) {
// we could get rid of this if we assume that deltas are set to
// zero when not in use; encoder always uses deltas
vpx_memset(lfi->lvl[seg_id], lvl_seg, sizeof(lfi->lvl[seg_id]));
continue;
}
intra_lvl = lvl_seg + lf->ref_deltas[INTRA_FRAME] * (1 << n_shift);
lfi->lvl[seg_id][INTRA_FRAME][0] = clamp(intra_lvl, 0, MAX_LOOP_FILTER);
for (ref = LAST_FRAME; ref < MAX_REF_FRAMES; ++ref)
for (mode = 0; mode < MAX_MODE_LF_DELTAS; ++mode) {
const int inter_lvl = lvl_seg + lf->ref_deltas[ref] * (1 << n_shift)
+ lf->mode_deltas[mode] * (1 << n_shift);
lfi->lvl[seg_id][ref][mode] = clamp(inter_lvl, 0, MAX_LOOP_FILTER);
}
}
}
static int build_lfi(const loop_filter_info_n *lfi_n,
const MB_MODE_INFO *mbmi,
struct loop_filter_info *lfi) {
const int seg = mbmi->segment_id;
const int ref = mbmi->ref_frame[0];
const int mode = lfi_n->mode_lf_lut[mbmi->mode];
const int filter_level = lfi_n->lvl[seg][ref][mode];
if (filter_level > 0) {
lfi->mblim = lfi_n->mblim[filter_level];
lfi->lim = lfi_n->lim[filter_level];
lfi->hev_thr = lfi_n->hev_thr[filter_level >> 4];
return 1;
} else {
return 0;
}
}
static void filter_selectively_vert(uint8_t *s, int pitch,
unsigned int mask_16x16,
unsigned int mask_8x8,
unsigned int mask_4x4,
unsigned int mask_4x4_int,
const struct loop_filter_info *lfi) {
unsigned int mask;
for (mask = mask_16x16 | mask_8x8 | mask_4x4 | mask_4x4_int;
mask; mask >>= 1) {
if (mask & 1) {
if (mask_16x16 & 1) {
vp9_mb_lpf_vertical_edge_w(s, pitch, lfi->mblim, lfi->lim,
lfi->hev_thr);
assert(!(mask_8x8 & 1));
assert(!(mask_4x4 & 1));
assert(!(mask_4x4_int & 1));
} else if (mask_8x8 & 1) {
vp9_mbloop_filter_vertical_edge(s, pitch, lfi->mblim, lfi->lim,
lfi->hev_thr, 1);
assert(!(mask_16x16 & 1));
assert(!(mask_4x4 & 1));
} else if (mask_4x4 & 1) {
vp9_loop_filter_vertical_edge(s, pitch, lfi->mblim, lfi->lim,
lfi->hev_thr, 1);
assert(!(mask_16x16 & 1));
assert(!(mask_8x8 & 1));
}
}
if (mask_4x4_int & 1)
vp9_loop_filter_vertical_edge(s + 4, pitch, lfi->mblim, lfi->lim,
lfi->hev_thr, 1);
s += 8;
lfi++;
mask_16x16 >>= 1;
mask_8x8 >>= 1;
mask_4x4 >>= 1;
mask_4x4_int >>= 1;
}
}
static void filter_selectively_horiz(uint8_t *s, int pitch,
unsigned int mask_16x16,
unsigned int mask_8x8,
unsigned int mask_4x4,
unsigned int mask_4x4_int,
int only_4x4_1,
const struct loop_filter_info *lfi) {
unsigned int mask;
int count;
for (mask = mask_16x16 | mask_8x8 | mask_4x4 | mask_4x4_int;
mask; mask >>= count) {
count = 1;
if (mask & 1) {
if (!only_4x4_1) {
if (mask_16x16 & 1) {
if ((mask_16x16 & 3) == 3) {
vp9_mb_lpf_horizontal_edge_w(s, pitch, lfi->mblim, lfi->lim,
lfi->hev_thr, 2);
count = 2;
} else {
vp9_mb_lpf_horizontal_edge_w(s, pitch, lfi->mblim, lfi->lim,
lfi->hev_thr, 1);
}
assert(!(mask_8x8 & 1));
assert(!(mask_4x4 & 1));
assert(!(mask_4x4_int & 1));
} else if (mask_8x8 & 1) {
vp9_mbloop_filter_horizontal_edge(s, pitch, lfi->mblim, lfi->lim,
lfi->hev_thr, 1);
assert(!(mask_16x16 & 1));
assert(!(mask_4x4 & 1));
} else if (mask_4x4 & 1) {
vp9_loop_filter_horizontal_edge(s, pitch, lfi->mblim, lfi->lim,
lfi->hev_thr, 1);
assert(!(mask_16x16 & 1));
assert(!(mask_8x8 & 1));
}
}
if (mask_4x4_int & 1)
vp9_loop_filter_horizontal_edge(s + 4 * pitch, pitch, lfi->mblim,
lfi->lim, lfi->hev_thr, 1);
}
s += 8 * count;
lfi += count;
mask_16x16 >>= count;
mask_8x8 >>= count;
mask_4x4 >>= count;
mask_4x4_int >>= count;
}
}
// This function ors into the current lfm structure, where to do loop
// filters for the specific mi we are looking at. It uses information
// including the block_size_type (32x16, 32x32, etc), the transform size,
// whether there were any coefficients encoded, and the loop filter strength
// block we are currently looking at. Shift is used to position the
// 1's we produce.
// TODO(JBB) Need another function for different resolution color..
static void build_masks(const loop_filter_info_n *const lfi_n,
const MODE_INFO *mi, const int shift_y,
const int shift_uv,
LOOP_FILTER_MASK *lfm) {
const BLOCK_SIZE block_size = mi->mbmi.sb_type;
const TX_SIZE tx_size_y = mi->mbmi.tx_size;
const TX_SIZE tx_size_uv = get_uv_tx_size(&mi->mbmi);
const int skip = mi->mbmi.skip_coeff;
const int seg = mi->mbmi.segment_id;
const int ref = mi->mbmi.ref_frame[0];
const int mode = lfi_n->mode_lf_lut[mi->mbmi.mode];
const int filter_level = lfi_n->lvl[seg][ref][mode];
uint64_t *left_y = &lfm->left_y[tx_size_y];
uint64_t *above_y = &lfm->above_y[tx_size_y];
uint64_t *int_4x4_y = &lfm->int_4x4_y;
uint16_t *left_uv = &lfm->left_uv[tx_size_uv];
uint16_t *above_uv = &lfm->above_uv[tx_size_uv];
uint16_t *int_4x4_uv = &lfm->int_4x4_uv;
// If filter level is 0 we don't loop filter.
if (!filter_level)
return;
// These set 1 in the current block size for the block size edges.
// For instance if the block size is 32x16, we'll set :
// above = 1111
// 0000
// and
// left = 1000
// = 1000
// NOTE : In this example the low bit is left most ( 1000 ) is stored as
// 1, not 8...
//
// U and v set things on a 16 bit scale.
//
*above_y |= above_prediction_mask[block_size] << shift_y;
*above_uv |= above_prediction_mask_uv[block_size] << shift_uv;
*left_y |= left_prediction_mask[block_size] << shift_y;
*left_uv |= left_prediction_mask_uv[block_size] << shift_uv;
// If the block has no coefficients and is not intra we skip applying
// the loop filter on block edges.
if (skip && ref > INTRA_FRAME)
return;
// Here we are adding a mask for the transform size. The transform
// size mask is set to be correct for a 64x64 prediction block size. We
// mask to match the size of the block we are working on and then shift it
// into place..
*above_y |= (size_mask[block_size] &
above_64x64_txform_mask[tx_size_y]) << shift_y;
*above_uv |= (size_mask_uv[block_size] &
above_64x64_txform_mask_uv[tx_size_uv]) << shift_uv;
*left_y |= (size_mask[block_size] &
left_64x64_txform_mask[tx_size_y]) << shift_y;
*left_uv |= (size_mask_uv[block_size] &
left_64x64_txform_mask_uv[tx_size_uv]) << shift_uv;
// Here we are trying to determine what to do with the internal 4x4 block
// boundaries. These differ from the 4x4 boundaries on the outside edge of
// an 8x8 in that the internal ones can be skipped and don't depend on
// the prediction block size.
if (tx_size_y == TX_4X4) {
*int_4x4_y |= (size_mask[block_size] & 0xffffffffffffffff) << shift_y;
}
if (tx_size_uv == TX_4X4) {
*int_4x4_uv |= (size_mask_uv[block_size] & 0xffff) << shift_uv;
}
}
// This function does the same thing as the one above with the exception that
// it only affects the y masks. It exists because for blocks < 16x16 in size,
// we only update u and v masks on the first block.
static void build_y_mask(const loop_filter_info_n *const lfi_n,
const MODE_INFO *mi, const int shift_y,
LOOP_FILTER_MASK *lfm) {
const BLOCK_SIZE block_size = mi->mbmi.sb_type;
const TX_SIZE tx_size_y = mi->mbmi.tx_size;
const int skip = mi->mbmi.skip_coeff;
const int seg = mi->mbmi.segment_id;
const int ref = mi->mbmi.ref_frame[0];
const int mode = lfi_n->mode_lf_lut[mi->mbmi.mode];
const int filter_level = lfi_n->lvl[seg][ref][mode];
uint64_t *left_y = &lfm->left_y[tx_size_y];
uint64_t *above_y = &lfm->above_y[tx_size_y];
uint64_t *int_4x4_y = &lfm->int_4x4_y;
if (!filter_level)
return;
*above_y |= above_prediction_mask[block_size] << shift_y;
*left_y |= left_prediction_mask[block_size] << shift_y;
if (skip && ref > INTRA_FRAME)
return;
*above_y |= (size_mask[block_size] &
above_64x64_txform_mask[tx_size_y]) << shift_y;
*left_y |= (size_mask[block_size] &
left_64x64_txform_mask[tx_size_y]) << shift_y;
if (tx_size_y == TX_4X4) {
*int_4x4_y |= (size_mask[block_size] & 0xffffffffffffffff) << shift_y;
}
}
// This function sets up the bit masks for the entire 64x64 region represented
// by mi_row, mi_col.
// TODO(JBB): This function only works for yv12.
static void setup_mask(VP9_COMMON *const cm, const int mi_row, const int mi_col,
MODE_INFO **mi_8x8, const int mode_info_stride,
LOOP_FILTER_MASK *lfm) {
int idx_32, idx_16, idx_8;
const loop_filter_info_n *const lfi_n = &cm->lf_info;
MODE_INFO **mip = mi_8x8;
MODE_INFO **mip2 = mi_8x8;
// These are offsets to the next mi in the 64x64 block. It is what gets
// added to the mi ptr as we go through each loop. It helps us to avoids
// setting up special row and column counters for each index. The last step
// brings us out back to the starting position.
const int offset_32[] = {4, (mode_info_stride << 2) - 4, 4,
-(mode_info_stride << 2) - 4};
const int offset_16[] = {2, (mode_info_stride << 1) - 2, 2,
-(mode_info_stride << 1) - 2};
const int offset[] = {1, mode_info_stride - 1, 1, -mode_info_stride - 1};
// Following variables represent shifts to position the current block
// mask over the appropriate block. A shift of 36 to the left will move
// the bits for the final 32 by 32 block in the 64x64 up 4 rows and left
// 4 rows to the appropriate spot.
const int shift_32_y[] = {0, 4, 32, 36};
const int shift_16_y[] = {0, 2, 16, 18};
const int shift_8_y[] = {0, 1, 8, 9};
const int shift_32_uv[] = {0, 2, 8, 10};
const int shift_16_uv[] = {0, 1, 4, 5};
int i;
const int max_rows = (mi_row + MI_BLOCK_SIZE > cm->mi_rows ?
cm->mi_rows - mi_row : MI_BLOCK_SIZE);
const int max_cols = (mi_col + MI_BLOCK_SIZE > cm->mi_cols ?
cm->mi_cols - mi_col : MI_BLOCK_SIZE);
vp9_zero(*lfm);
// TODO(jimbankoski): Try moving most of the following code into decode
// loop and storing lfm in the mbmi structure so that we don't have to go
// through the recursive loop structure multiple times.
switch (mip[0]->mbmi.sb_type) {
case BLOCK_64X64:
build_masks(lfi_n, mip[0] , 0, 0, lfm);
break;
case BLOCK_64X32:
build_masks(lfi_n, mip[0], 0, 0, lfm);
mip2 = mip + mode_info_stride * 4;
if (4 >= max_rows)
break;
build_masks(lfi_n, mip2[0], 32, 8, lfm);
break;
case BLOCK_32X64:
build_masks(lfi_n, mip[0], 0, 0, lfm);
mip2 = mip + 4;
if (4 >= max_cols)
break;
build_masks(lfi_n, mip2[0], 4, 2, lfm);
break;
default:
for (idx_32 = 0; idx_32 < 4; mip += offset_32[idx_32], ++idx_32) {
const int shift_y = shift_32_y[idx_32];
const int shift_uv = shift_32_uv[idx_32];
const int mi_32_col_offset = ((idx_32 & 1) << 2);
const int mi_32_row_offset = ((idx_32 >> 1) << 2);
if (mi_32_col_offset >= max_cols || mi_32_row_offset >= max_rows)
continue;
switch (mip[0]->mbmi.sb_type) {
case BLOCK_32X32:
build_masks(lfi_n, mip[0], shift_y, shift_uv, lfm);
break;
case BLOCK_32X16:
build_masks(lfi_n, mip[0], shift_y, shift_uv, lfm);
if (mi_32_row_offset + 2 >= max_rows)
continue;
mip2 = mip + mode_info_stride * 2;
build_masks(lfi_n, mip2[0], shift_y + 16, shift_uv + 4, lfm);
break;
case BLOCK_16X32:
build_masks(lfi_n, mip[0], shift_y, shift_uv, lfm);
if (mi_32_col_offset + 2 >= max_cols)
continue;
mip2 = mip + 2;
build_masks(lfi_n, mip2[0], shift_y + 2, shift_uv + 1, lfm);
break;
default:
for (idx_16 = 0; idx_16 < 4; mip += offset_16[idx_16], ++idx_16) {
const int shift_y = shift_32_y[idx_32] + shift_16_y[idx_16];
const int shift_uv = shift_32_uv[idx_32] + shift_16_uv[idx_16];
const int mi_16_col_offset = mi_32_col_offset +
((idx_16 & 1) << 1);
const int mi_16_row_offset = mi_32_row_offset +
((idx_16 >> 1) << 1);
if (mi_16_col_offset >= max_cols || mi_16_row_offset >= max_rows)
continue;
switch (mip[0]->mbmi.sb_type) {
case BLOCK_16X16:
build_masks(lfi_n, mip[0], shift_y, shift_uv, lfm);
break;
case BLOCK_16X8:
build_masks(lfi_n, mip[0], shift_y, shift_uv, lfm);
if (mi_16_row_offset + 1 >= max_rows)
continue;
mip2 = mip + mode_info_stride;
build_y_mask(lfi_n, mip2[0], shift_y+8, lfm);
break;
case BLOCK_8X16:
build_masks(lfi_n, mip[0], shift_y, shift_uv, lfm);
if (mi_16_col_offset +1 >= max_cols)
continue;
mip2 = mip + 1;
build_y_mask(lfi_n, mip2[0], shift_y+1, lfm);
break;
default: {
const int shift_y = shift_32_y[idx_32] +
shift_16_y[idx_16] +
shift_8_y[0];
build_masks(lfi_n, mip[0], shift_y, shift_uv, lfm);
mip += offset[0];
for (idx_8 = 1; idx_8 < 4; mip += offset[idx_8], ++idx_8) {
const int shift_y = shift_32_y[idx_32] +
shift_16_y[idx_16] +
shift_8_y[idx_8];
const int mi_8_col_offset = mi_16_col_offset +
((idx_8 & 1));
const int mi_8_row_offset = mi_16_row_offset +
((idx_8 >> 1));
if (mi_8_col_offset >= max_cols ||
mi_8_row_offset >= max_rows)
continue;
build_y_mask(lfi_n, mip[0], shift_y, lfm);
}
break;
}
}
}
break;
}
}
break;
}
// The largest loopfilter we have is 16x16 so we use the 16x16 mask
// for 32x32 transforms also also.
lfm->left_y[TX_16X16] |= lfm->left_y[TX_32X32];
lfm->above_y[TX_16X16] |= lfm->above_y[TX_32X32];
lfm->left_uv[TX_16X16] |= lfm->left_uv[TX_32X32];
lfm->above_uv[TX_16X16] |= lfm->above_uv[TX_32X32];
// We do at least 8 tap filter on every 32x32 even if the transform size
// is 4x4. So if the 4x4 is set on a border pixel add it to the 8x8 and
// remove it from the 4x4.
lfm->left_y[TX_8X8] |= lfm->left_y[TX_4X4] & left_border;
lfm->left_y[TX_4X4] &= ~left_border;
lfm->above_y[TX_8X8] |= lfm->above_y[TX_4X4] & above_border;
lfm->above_y[TX_4X4] &= ~above_border;
lfm->left_uv[TX_8X8] |= lfm->left_uv[TX_4X4] & left_border_uv;
lfm->left_uv[TX_4X4] &= ~left_border_uv;
lfm->above_uv[TX_8X8] |= lfm->above_uv[TX_4X4] & above_border_uv;
lfm->above_uv[TX_4X4] &= ~above_border_uv;
// We do some special edge handling.
if (mi_row + MI_BLOCK_SIZE > cm->mi_rows) {
const uint64_t rows = cm->mi_rows - mi_row;
// Each pixel inside the border gets a 1,
const uint64_t mask_y = (((uint64_t) 1 << (rows << 3)) - 1);
const uint16_t mask_uv = (((uint16_t) 1 << (((rows + 1) >> 1) << 2)) - 1);
// Remove values completely outside our border.
for (i = 0; i < TX_32X32; i++) {
lfm->left_y[i] &= mask_y;
lfm->above_y[i] &= mask_y;
lfm->left_uv[i] &= mask_uv;
lfm->above_uv[i] &= mask_uv;
}
lfm->int_4x4_y &= mask_y;
lfm->int_4x4_uv &= mask_uv;
// We don't apply a wide loop filter on the last uv block row. If set
// apply the shorter one instead.
if (rows == 1) {
lfm->above_uv[TX_8X8] |= lfm->above_uv[TX_16X16];
lfm->above_uv[TX_16X16] = 0;
}
if (rows == 5) {
lfm->above_uv[TX_8X8] |= lfm->above_uv[TX_16X16] & 0xff00;
lfm->above_uv[TX_16X16] &= ~(lfm->above_uv[TX_16X16] & 0xff00);
}
}
if (mi_col + MI_BLOCK_SIZE > cm->mi_cols) {
const uint64_t columns = cm->mi_cols - mi_col;
// Each pixel inside the border gets a 1, the multiply copies the border
// to where we need it.
const uint64_t mask_y = (((1 << columns) - 1)) * 0x0101010101010101;
const uint16_t mask_uv = ((1 << ((columns + 1) >> 1)) - 1) * 0x1111;
// Internal edges are not applied on the last column of the image so
// we mask 1 more for the internal edges
const uint16_t mask_uv_int = ((1 << (columns >> 1)) - 1) * 0x1111;
// Remove the bits outside the image edge.
for (i = 0; i < TX_32X32; i++) {
lfm->left_y[i] &= mask_y;
lfm->above_y[i] &= mask_y;
lfm->left_uv[i] &= mask_uv;
lfm->above_uv[i] &= mask_uv;
}
lfm->int_4x4_y &= mask_y;
lfm->int_4x4_uv &= mask_uv_int;
// We don't apply a wide loop filter on the last uv column. If set
// apply the shorter one instead.
if (columns == 1) {
lfm->left_uv[TX_8X8] |= lfm->left_uv[TX_16X16];
lfm->left_uv[TX_16X16] = 0;
}
if (columns == 5) {
lfm->left_uv[TX_8X8] |= (lfm->left_uv[TX_16X16] & 0xcccc);
lfm->left_uv[TX_16X16] &= ~(lfm->left_uv[TX_16X16] & 0xcccc);
}
}
// We don't a loop filter on the first column in the image. Mask that out.
if (mi_col == 0) {
for (i = 0; i < TX_32X32; i++) {
lfm->left_y[i] &= 0xfefefefefefefefe;
lfm->left_uv[i] &= 0xeeee;
}
}
}
#if CONFIG_NON420
static void filter_block_plane_non420(VP9_COMMON *cm,
struct macroblockd_plane *plane,
MODE_INFO **mi_8x8,
int mi_row, int mi_col) {
const int ss_x = plane->subsampling_x;
const int ss_y = plane->subsampling_y;
const int row_step = 1 << ss_x;
const int col_step = 1 << ss_y;
const int row_step_stride = cm->mode_info_stride * row_step;
struct buf_2d *const dst = &plane->dst;
uint8_t* const dst0 = dst->buf;
unsigned int mask_16x16[MI_BLOCK_SIZE] = {0};
unsigned int mask_8x8[MI_BLOCK_SIZE] = {0};
unsigned int mask_4x4[MI_BLOCK_SIZE] = {0};
unsigned int mask_4x4_int[MI_BLOCK_SIZE] = {0};
struct loop_filter_info lfi[MI_BLOCK_SIZE][MI_BLOCK_SIZE];
int r, c;
for (r = 0; r < MI_BLOCK_SIZE && mi_row + r < cm->mi_rows; r += row_step) {
unsigned int mask_16x16_c = 0;
unsigned int mask_8x8_c = 0;
unsigned int mask_4x4_c = 0;
unsigned int border_mask;
// Determine the vertical edges that need filtering
for (c = 0; c < MI_BLOCK_SIZE && mi_col + c < cm->mi_cols; c += col_step) {
const MODE_INFO *mi = mi_8x8[c];
const int skip_this = mi[0].mbmi.skip_coeff
&& is_inter_block(&mi[0].mbmi);
// left edge of current unit is block/partition edge -> no skip
const int block_edge_left = b_width_log2(mi[0].mbmi.sb_type) ?
!(c & ((1 << (b_width_log2(mi[0].mbmi.sb_type)-1)) - 1)) : 1;
const int skip_this_c = skip_this && !block_edge_left;
// top edge of current unit is block/partition edge -> no skip
const int block_edge_above = b_height_log2(mi[0].mbmi.sb_type) ?
!(r & ((1 << (b_height_log2(mi[0].mbmi.sb_type)-1)) - 1)) : 1;
const int skip_this_r = skip_this && !block_edge_above;
const TX_SIZE tx_size = (plane->plane_type == PLANE_TYPE_UV)
? get_uv_tx_size(&mi[0].mbmi)
: mi[0].mbmi.tx_size;
const int skip_border_4x4_c = ss_x && mi_col + c == cm->mi_cols - 1;
const int skip_border_4x4_r = ss_y && mi_row + r == cm->mi_rows - 1;
// Filter level can vary per MI
if (!build_lfi(&cm->lf_info, &mi[0].mbmi, lfi[r] + (c >> ss_x)))
continue;
// Build masks based on the transform size of each block
if (tx_size == TX_32X32) {
if (!skip_this_c && ((c >> ss_x) & 3) == 0) {
if (!skip_border_4x4_c)
mask_16x16_c |= 1 << (c >> ss_x);
else
mask_8x8_c |= 1 << (c >> ss_x);
}
if (!skip_this_r && ((r >> ss_y) & 3) == 0) {
if (!skip_border_4x4_r)
mask_16x16[r] |= 1 << (c >> ss_x);
else
mask_8x8[r] |= 1 << (c >> ss_x);
}
} else if (tx_size == TX_16X16) {
if (!skip_this_c && ((c >> ss_x) & 1) == 0) {
if (!skip_border_4x4_c)
mask_16x16_c |= 1 << (c >> ss_x);
else
mask_8x8_c |= 1 << (c >> ss_x);
}
if (!skip_this_r && ((r >> ss_y) & 1) == 0) {
if (!skip_border_4x4_r)
mask_16x16[r] |= 1 << (c >> ss_x);
else
mask_8x8[r] |= 1 << (c >> ss_x);
}
} else {
// force 8x8 filtering on 32x32 boundaries
if (!skip_this_c) {
if (tx_size == TX_8X8 || ((c >> ss_x) & 3) == 0)
mask_8x8_c |= 1 << (c >> ss_x);
else
mask_4x4_c |= 1 << (c >> ss_x);
}
if (!skip_this_r) {
if (tx_size == TX_8X8 || ((r >> ss_y) & 3) == 0)
mask_8x8[r] |= 1 << (c >> ss_x);
else
mask_4x4[r] |= 1 << (c >> ss_x);
}
if (!skip_this && tx_size < TX_8X8 && !skip_border_4x4_c)
mask_4x4_int[r] |= 1 << (c >> ss_x);
}
}
// Disable filtering on the leftmost column
border_mask = ~(mi_col == 0);
filter_selectively_vert(dst->buf, dst->stride,
mask_16x16_c & border_mask,
mask_8x8_c & border_mask,
mask_4x4_c & border_mask,
mask_4x4_int[r], lfi[r]);
dst->buf += 8 * dst->stride;
mi_8x8 += row_step_stride;
}
// Now do horizontal pass
dst->buf = dst0;
for (r = 0; r < MI_BLOCK_SIZE && mi_row + r < cm->mi_rows; r += row_step) {
const int skip_border_4x4_r = ss_y && mi_row + r == cm->mi_rows - 1;
const unsigned int mask_4x4_int_r = skip_border_4x4_r ? 0 : mask_4x4_int[r];
filter_selectively_horiz(dst->buf, dst->stride,
mask_16x16[r],
mask_8x8[r],
mask_4x4[r],
mask_4x4_int_r, mi_row + r == 0, lfi[r]);
dst->buf += 8 * dst->stride;
}
}
#endif
static void filter_block_plane(VP9_COMMON *const cm,
struct macroblockd_plane *const plane,
MODE_INFO **mi_8x8,
int mi_row, int mi_col,
LOOP_FILTER_MASK *lfm) {
const int ss_x = plane->subsampling_x;
const int ss_y = plane->subsampling_y;
const int row_step = 1 << ss_x;
const int col_step = 1 << ss_y;
const int row_step_stride = cm->mode_info_stride * row_step;
struct buf_2d *const dst = &plane->dst;
uint8_t* const dst0 = dst->buf;
unsigned int mask_4x4_int[MI_BLOCK_SIZE] = {0};
struct loop_filter_info lfi[MI_BLOCK_SIZE][MI_BLOCK_SIZE];
int r, c;
int row_shift = 3 - ss_x;
int row_mask = 0xff >> (ss_x << 2);
#define MASK_ROW(value) ((value >> (r_sampled << row_shift)) & row_mask)
for (r = 0; r < MI_BLOCK_SIZE && mi_row + r < cm->mi_rows; r += row_step) {
int r_sampled = r >> ss_x;
// Determine the vertical edges that need filtering
for (c = 0; c < MI_BLOCK_SIZE && mi_col + c < cm->mi_cols; c += col_step) {
const MODE_INFO *mi = mi_8x8[c];
if (!build_lfi(&cm->lf_info, &mi[0].mbmi, lfi[r] + (c >> ss_x)))
continue;
}
if (!plane->plane_type) {
mask_4x4_int[r] = MASK_ROW(lfm->int_4x4_y);
// Disable filtering on the leftmost column
filter_selectively_vert(dst->buf, dst->stride,
MASK_ROW(lfm->left_y[TX_16X16]),
MASK_ROW(lfm->left_y[TX_8X8]),
MASK_ROW(lfm->left_y[TX_4X4]),
MASK_ROW(lfm->int_4x4_y),
lfi[r]);
} else {
mask_4x4_int[r] = MASK_ROW(lfm->int_4x4_uv);
// Disable filtering on the leftmost column
filter_selectively_vert(dst->buf, dst->stride,
MASK_ROW(lfm->left_uv[TX_16X16]),
MASK_ROW(lfm->left_uv[TX_8X8]),
MASK_ROW(lfm->left_uv[TX_4X4]),
MASK_ROW(lfm->int_4x4_uv),
lfi[r]);
}
dst->buf += 8 * dst->stride;
mi_8x8 += row_step_stride;
}
// Now do horizontal pass
dst->buf = dst0;
for (r = 0; r < MI_BLOCK_SIZE && mi_row + r < cm->mi_rows; r += row_step) {
const int skip_border_4x4_r = ss_y && mi_row + r == cm->mi_rows - 1;
const unsigned int mask_4x4_int_r = skip_border_4x4_r ? 0 : mask_4x4_int[r];
int r_sampled = r >> ss_x;
if (!plane->plane_type) {
filter_selectively_horiz(dst->buf, dst->stride,
MASK_ROW(lfm->above_y[TX_16X16]),
MASK_ROW(lfm->above_y[TX_8X8]),
MASK_ROW(lfm->above_y[TX_4X4]),
MASK_ROW(lfm->int_4x4_y),
mi_row + r == 0, lfi[r]);
} else {
filter_selectively_horiz(dst->buf, dst->stride,
MASK_ROW(lfm->above_uv[TX_16X16]),
MASK_ROW(lfm->above_uv[TX_8X8]),
MASK_ROW(lfm->above_uv[TX_4X4]),
mask_4x4_int_r,
mi_row + r == 0, lfi[r]);
}
dst->buf += 8 * dst->stride;
}
#undef MASK_ROW
}
void vp9_loop_filter_rows(const YV12_BUFFER_CONFIG *frame_buffer,
VP9_COMMON *cm, MACROBLOCKD *xd,
int start, int stop, int y_only) {
const int num_planes = y_only ? 1 : MAX_MB_PLANE;
int mi_row, mi_col;
LOOP_FILTER_MASK lfm;
#if CONFIG_NON420
int use_420 = y_only || (xd->plane[1].subsampling_y == 1 &&
xd->plane[1].subsampling_x == 1);
#endif
for (mi_row = start; mi_row < stop; mi_row += MI_BLOCK_SIZE) {
MODE_INFO **mi_8x8 = cm->mi_grid_visible + mi_row * cm->mode_info_stride;
for (mi_col = 0; mi_col < cm->mi_cols; mi_col += MI_BLOCK_SIZE) {
int plane;
setup_dst_planes(xd, frame_buffer, mi_row, mi_col);
// TODO(JBB): Make setup_mask work for non 420.
#if CONFIG_NON420
if (use_420)
#endif
setup_mask(cm, mi_row, mi_col, mi_8x8 + mi_col, cm->mode_info_stride,
&lfm);
for (plane = 0; plane < num_planes; ++plane) {
#if CONFIG_NON420
if (use_420)
#endif
filter_block_plane(cm, &xd->plane[plane], mi_8x8 + mi_col, mi_row,
mi_col, &lfm);
#if CONFIG_NON420
else
filter_block_plane_non420(cm, &xd->plane[plane], mi_8x8 + mi_col,
mi_row, mi_col);
#endif
}
}
}
}
void vp9_loop_filter_frame(VP9_COMMON *cm, MACROBLOCKD *xd,
int frame_filter_level,
int y_only, int partial) {
int start_mi_row, end_mi_row, mi_rows_to_filter;
if (!frame_filter_level) return;
start_mi_row = 0;
mi_rows_to_filter = cm->mi_rows;
if (partial && cm->mi_rows > 8) {
start_mi_row = cm->mi_rows >> 1;
start_mi_row &= 0xfffffff8;
mi_rows_to_filter = MAX(cm->mi_rows / 8, 8);
}
end_mi_row = start_mi_row + mi_rows_to_filter;
vp9_loop_filter_frame_init(cm, frame_filter_level);
vp9_loop_filter_rows(cm->frame_to_show, cm, xd,
start_mi_row, end_mi_row,
y_only);
}
int vp9_loop_filter_worker(void *arg1, void *arg2) {
LFWorkerData *const lf_data = (LFWorkerData*)arg1;
(void)arg2;
vp9_loop_filter_rows(lf_data->frame_buffer, lf_data->cm, &lf_data->xd,
lf_data->start, lf_data->stop, lf_data->y_only);
return 1;
}
| [
"[email protected]"
] | |
fbccdb244a3cf98c2954ce2634e67895d8a452ef | 7d4176c878e8be73ffaa38c236f1a76528706c9f | /src/sbin/route/keywords.h | 667516962dfe25ed34d8bd624fe700d2b8fd8db7 | [] | no_license | roytam1/mirbsd-cvs | c06ea23d2b106658f9903fe65d351c480b72e72c | 2a6f84cbc58f6ff22e1eeb7804df68d34c2b0a5c | refs/heads/master | 2020-04-14T15:47:25.324452 | 2019-01-01T19:38:30 | 2019-01-01T19:38:30 | 163,906,352 | 1 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,902 | h | /* $MirOS$ */
/* $OpenBSD: keywords.h,v 1.18 2005/05/27 04:55:27 mcbride Exp $ */
/* WARNING! This file was generated by keywords.sh */
/* and then hand-edited... */
struct keytab {
char *kt_cp;
int kt_i;
};
enum {
K_NULL,
K_ADD,
K_BLACKHOLE,
K_CHANGE,
K_CLONING,
K_DELETE,
K_DST,
K_EXPIRE,
K_FLUSH,
K_GATEWAY,
K_GENMASK,
K_GET,
K_HOST,
K_HOPCOUNT,
K_IFACE,
K_INTERFACE,
K_IFA,
K_IFP,
K_INET,
K_INET6,
K_IPX,
K_JUMBO,
K_LABEL,
K_LINK,
K_LLINFO,
K_LOCK,
K_LOCKREST,
K_MONITOR,
K_MPATH,
K_MTU,
K_NET,
K_NETMASK,
K_NOJUMBO,
K_NOSTATIC,
K_PREFIXLEN,
K_PROTO1,
K_PROTO2,
K_RECVPIPE,
K_REJECT,
K_RTT,
K_RTTVAR,
K_SA,
K_SENDPIPE,
K_SHOW,
K_SSTHRESH,
K_STATIC,
K_XRESOLVE,
};
struct keytab keywords[] = {
{ "add", K_ADD },
{ "blackhole", K_BLACKHOLE },
{ "change", K_CHANGE },
{ "cloning", K_CLONING },
{ "del", K_DELETE },
{ "delete", K_DELETE },
{ "dst", K_DST },
{ "expire", K_EXPIRE },
{ "flush", K_FLUSH },
{ "gateway", K_GATEWAY },
{ "genmask", K_GENMASK },
{ "get", K_GET },
{ "host", K_HOST },
{ "hopcount", K_HOPCOUNT },
{ "iface", K_IFACE },
{ "interface", K_INTERFACE },
{ "ifa", K_IFA },
{ "ifp", K_IFP },
{ "inet", K_INET },
{ "inet6", K_INET6 },
{ "ipx", K_IPX },
{ "jumbo", K_JUMBO },
{ "label", K_LABEL },
{ "link", K_LINK },
{ "llinfo", K_LLINFO },
{ "lock", K_LOCK },
{ "lockrest", K_LOCKREST },
{ "monitor", K_MONITOR },
{ "mpath", K_MPATH },
{ "mtu", K_MTU },
{ "net", K_NET },
{ "netmask", K_NETMASK },
{ "nojumbo", K_NOJUMBO },
{ "nostatic", K_NOSTATIC },
{ "prefixlen", K_PREFIXLEN },
{ "proto1", K_PROTO1 },
{ "proto2", K_PROTO2 },
{ "recvpipe", K_RECVPIPE },
{ "reject", K_REJECT },
{ "rtt", K_RTT },
{ "rttvar", K_RTTVAR },
{ "sa", K_SA },
{ "sendpipe", K_SENDPIPE },
{ "show", K_SHOW },
{ "ssthresh", K_SSTHRESH },
{ "static", K_STATIC },
{ "xresolve", K_XRESOLVE },
{ 0, 0 }
};
| [
""
] | |
a620443e9e9ba63237686190a236882ded40cb1b | 551ea0e7302e571fc6644204ec1ecb4783067406 | /srcs/shell/destroy_functions.c | adca29fa5e6e3e516659c967d2969bcd520c2260 | [] | no_license | openweed/42sh | 583956315d1d2db35ee9ccd4d4db40acc8236453 | 771ae13afbc74bacdc9b98286cdb52b10d3f281b | refs/heads/master | 2021-01-30T18:10:59.094862 | 2019-09-29T11:06:47 | 2019-09-29T11:06:47 | 243,504,710 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 997 | c | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* destroy_functions.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: nkertzma <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/03/08 13:12:07 by nkertzma #+# #+# */
/* Updated: 2019/03/08 13:12:08 by nkertzma ### ########.fr */
/* */
/* ************************************************************************** */
#include "shell.h"
void destroy_functions(void)
{
if (g_func)
{
free(g_func);
g_func = NULL;
}
}
| [
"[email protected]"
] | |
82018c66fcc68b6b2a6c08ffbd18363cb71ab890 | 92a1f6c6a5b05730248b0998902cca2ba465c967 | /netinet/if_ether.h | 54f65f3884d1dc9c5a224066b7cced10703fb7f7 | [] | no_license | TQCasey/tcpip_simulator | dedb0c6f8ea47f26d9cdac539c90dfc1ac79218a | 1a5c078006310d4b343a8bed8f75976a73988273 | refs/heads/master | 2020-04-26T09:49:25.575253 | 2019-03-02T16:10:11 | 2019-03-02T16:10:11 | 173,469,246 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 7,890 | h | /*
* Copyright (c) 1982, 1986, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)if_ether.h 8.1 (Berkeley) 6/10/93
*/
#include "in.h"
/*
* Structure of a 10Mb/s Ethernet header.
*/
struct ether_header {
u_char ether_dhost[6];
u_char ether_shost[6];
u_short ether_type;
};
#define ETHERTYPE_PUP 0x0200 /* PUP protocol */
#define ETHERTYPE_IP 0x0800 /* IP protocol */
#define ETHERTYPE_ARP 0x0806 /* Addr. resolution protocol */
#define ETHERTYPE_REVARP 0x8035 /* reverse Addr. resolution protocol */
/*
* The ETHERTYPE_NTRAILER packet types starting at ETHERTYPE_TRAIL have
* (type-ETHERTYPE_TRAIL)*512 bytes of data followed
* by an ETHER type (as given above) and then the (variable-length) header.
*/
#define ETHERTYPE_TRAIL 0x1000 /* Trailer packet */
#define ETHERTYPE_NTRAILER 16
#define ETHERMTU 1500
#define ETHERMIN (60-14)
#ifdef KERNEL
/*
* Macro to map an IP multicast address to an Ethernet multicast address.
* The high-order 25 bits of the Ethernet address are statically assigned,
* and the low-order 23 bits are taken from the low end of the IP address.
*/
#define ETHER_MAP_IP_MULTICAST(ipaddr, enaddr) \
/* struct in_addr *ipaddr; */ \
/* u_char enaddr[6]; */ \
{ \
(enaddr)[0] = 0x01; \
(enaddr)[1] = 0x00; \
(enaddr)[2] = 0x5e; \
(enaddr)[3] = ((u_char *)ipaddr)[1] & 0x7f; \
(enaddr)[4] = ((u_char *)ipaddr)[2]; \
(enaddr)[5] = ((u_char *)ipaddr)[3]; \
}
#endif
/*
* Ethernet Address Resolution Protocol.
*
* See RFC 826 for protocol description. Structure below is adapted
* to resolving internet addresses. Field names used correspond to
* RFC 826.
*/
struct ether_arp {
struct arphdr ea_hdr; /* fixed-size header */
u_char arp_sha[6]; /* sender hardware address */
u_char arp_spa[4]; /* sender protocol address */
u_char arp_tha[6]; /* target hardware address */
u_char arp_tpa[4]; /* target protocol address */
};
#define arp_hrd ea_hdr.ar_hrd
#define arp_pro ea_hdr.ar_pro
#define arp_hln ea_hdr.ar_hln
#define arp_pln ea_hdr.ar_pln
#define arp_op ea_hdr.ar_op
/*
* Structure shared between the ethernet driver modules and
* the address resolution code. For example, each ec_softc or il_softc
* begins with this structure.
*/
struct arpcom {
struct ifnet ac_if; /* network-visible interface */
u_char ac_enaddr[6]; /* ethernet hardware address */
struct in_addr ac_ipaddr; /* copy of ip address- XXX */
struct ether_multi *ac_multiaddrs; /* list of ether multicast addrs */
int ac_multicnt; /* length of ac_multiaddrs list */
};
struct llinfo_arp {
struct llinfo_arp *la_next;
struct llinfo_arp *la_prev;
struct rtentry *la_rt;
struct mbuf *la_hold; /* last packet until resolved/timeout */
long la_asked; /* last time we QUERIED for this addr */
#define la_timer la_rt->rt_rmx.rmx_expire /* deletion time in seconds */
};
struct sockaddr_inarp {
u_char sin_len;
u_char sin_family;
u_short sin_port;
struct in_addr sin_addr;
struct in_addr sin_srcaddr;
u_short sin_tos;
u_short sin_other;
#define SIN_PROXY 1
};
/*
* IP and ethernet specific routing flags
*/
#define RTF_USETRAILERS RTF_PROTO1 /* use trailers */
#define RTF_ANNOUNCE RTF_PROTO2 /* announce new arp entry */
#ifdef KERNEL
u_char etherbroadcastaddr[6];
u_char ether_ipmulticast_min[6];
u_char ether_ipmulticast_max[6];
struct ifqueue arpintrq;
struct llinfo_arp *arptnew __P((struct in_addr *));
struct llinfo_arp llinfo_arp; /* head of the llinfo queue */
void arpwhohas __P((struct arpcom *, struct in_addr *));
void arpintr __P((void));
int arpresolve __P((struct arpcom *,
struct rtentry *, struct mbuf *, struct sockaddr *, u_char *));
void arp_rtrequest __P((int, struct rtentry *, struct sockaddr *));
void arpwhohas __P((struct arpcom *, struct in_addr *));
int ether_addmulti __P((struct ifreq *, struct arpcom *));
int ether_delmulti __P((struct ifreq *, struct arpcom *));
/*
* Ethernet multicast address structure. There is one of these for each
* multicast address or range of multicast addresses that we are supposed
* to listen to on a particular interface. They are kept in a linked list,
* rooted in the interface's arpcom structure. (This really has nothing to
* do with ARP, or with the Internet address family, but this appears to be
* the minimally-disrupting place to put it.)
*/
struct ether_multi {
u_char enm_addrlo[6]; /* low or only address of range */
u_char enm_addrhi[6]; /* high or only address of range */
struct arpcom *enm_ac; /* back pointer to arpcom */
u_int enm_refcount; /* no. claims to this addr/range */
struct ether_multi *enm_next; /* ptr to next ether_multi */
};
/*
* Structure used by macros below to remember position when stepping through
* all of the ether_multi records.
*/
struct ether_multistep {
struct ether_multi *e_enm;
};
/*
* Macro for looking up the ether_multi record for a given range of Ethernet
* multicast addresses connected to a given arpcom structure. If no matching
* record is found, "enm" returns NULL.
*/
#define ETHER_LOOKUP_MULTI(addrlo, addrhi, ac, enm) \
/* u_char addrlo[6]; */ \
/* u_char addrhi[6]; */ \
/* struct arpcom *ac; */ \
/* struct ether_multi *enm; */ \
{ \
for ((enm) = (ac)->ac_multiaddrs; \
(enm) != NULL && \
(bcmp((enm)->enm_addrlo, (addrlo), 6) != 0 || \
bcmp((enm)->enm_addrhi, (addrhi), 6) != 0); \
(enm) = (enm)->enm_next); \
}
/*
* Macro to step through all of the ether_multi records, one at a time.
* The current position is remembered in "step", which the caller must
* provide. ETHER_FIRST_MULTI(), below, must be called to initialize "step"
* and get the first record. Both macros return a NULL "enm" when there
* are no remaining records.
*/
#define ETHER_NEXT_MULTI(step, enm) \
/* struct ether_multistep step; */ \
/* struct ether_multi *enm; */ \
{ \
if (((enm) = (step).e_enm) != NULL) \
(step).e_enm = (enm)->enm_next; \
}
#define ETHER_FIRST_MULTI(step, ac, enm) \
/* struct ether_multistep step; */ \
/* struct arpcom *ac; */ \
/* struct ether_multi *enm; */ \
{ \
(step).e_enm = (ac)->ac_multiaddrs; \
ETHER_NEXT_MULTI((step), (enm)); \
}
#endif
| [
"[email protected]"
] | |
c30400c5f79cd4280fccd5fb8eac94849245e742 | e1e164f48391f125c991fb04d6054a3bd0838fba | /s8pg4.c | c543d141471769970de3bb6ed91646385495b69f | [] | no_license | Papamani/papamani | 06112356c6cd82ad92304c2e2fb76b58955ac2f6 | f3c8e5050abed4bae58a011ca45e247846fbdc03 | refs/heads/master | 2021-01-19T17:04:41.341817 | 2018-03-09T10:57:47 | 2018-03-09T10:57:47 | 101,045,059 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 149 | c | #include<stdio.h>
int main()
{
int a;
float x;
printf("Enter the floting point value:");
scanf("%f",&x);
a=(int)(x+0.5);
printf("%d",a);
return 0;
}
| [
"[email protected]"
] | |
57c9c55e44417474699d60dfea5fc05144247920 | c8e6dfe5d2d4511f6ba1413b278932a2ab10a9c1 | /lib/am335x_sdk/ti/csl/soc/tda2xx/hw_ctrl_core_sec.h | 76838751ebd3665e35f77f27d33350787e0efd60 | [
"BSD-3-Clause",
"MIT"
] | permissive | brandonbraun653/Apollo | 61d4a81871ac10b2a2c74c238be817daeee40bb6 | a1ece2cc3f1d3dae48fdf8fe94f0bbb59d405fce | refs/heads/main | 2023-04-08T19:13:45.705310 | 2021-04-17T22:02:02 | 2021-04-17T22:02:02 | 319,139,363 | 4 | 0 | null | null | null | null | UTF-8 | C | false | false | 42,374 | h | /*
* Copyright (C) 2008-2013 Texas Instruments Incorporated - http://www.ti.com/
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
*
* Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
/**
* \file hw_ctrl_core_sec.h
*
* \brief register-level header file for CTRL_CORE
*
**/
#ifndef HW_CTRL_CORE_SEC_H_
#define HW_CTRL_CORE_SEC_H_
#ifdef __cplusplus
extern "C"
{
#endif
/****************************************************************************************************
* Register Definitions
****************************************************************************************************/
#define CTRL_CORE_STD_FUSE_OPP_VMIN_GPU_0 (0x100U)
#define CTRL_CORE_STD_FUSE_OPP_VMIN_GPU_1 (0x104U)
#define CTRL_CORE_STD_FUSE_OPP_VMIN_GPU_2 (0x108U)
#define CTRL_CORE_STD_FUSE_OPP_VMIN_GPU_3 (0x10cU)
#define CTRL_CORE_STD_FUSE_OPP_VMIN_GPU_4 (0x110U)
#define CTRL_CORE_STD_FUSE_OPP_VMIN_GPU_5 (0x114U)
#define CTRL_CORE_STD_FUSE_OPP_VMIN_MPU_0 (0x118U)
#define CTRL_CORE_STD_FUSE_OPP_VMIN_MPU_1 (0x11cU)
#define CTRL_CORE_STD_FUSE_OPP_VMIN_MPU_2 (0x120U)
#define CTRL_CORE_STD_FUSE_OPP_VMIN_MPU_3 (0x124U)
#define CTRL_CORE_STD_FUSE_OPP_VMIN_MPU_4 (0x128U)
#define CTRL_CORE_STD_FUSE_OPP_VMIN_MPU_5 (0x12cU)
#define CTRL_CORE_STD_FUSE_OPP_VMIN_MPU_6 (0x130U)
#define CTRL_CORE_STD_FUSE_OPP_VMIN_MPU_7 (0x134U)
#define CTRL_CORE_STD_FUSE_OPP_VDD_DSPEVE_LVT_0 (0x138U)
#define CTRL_CORE_STD_FUSE_OPP_VDD_DSPEVE_LVT_1 (0x13cU)
#define CTRL_CORE_STD_FUSE_OPP_VDD_DSPEVE_LVT_2 (0x140U)
#define CTRL_CORE_STD_FUSE_OPP_VDD_DSPEVE_LVT_3 (0x144U)
#define CTRL_CORE_STD_FUSE_OPP_VDD_DSPEVE_LVT_4 (0x148U)
#define CTRL_CORE_STD_FUSE_OPP_VDD_IVA_LVT_0 (0x14cU)
#define CTRL_CORE_STD_FUSE_OPP_VDD_IVA_LVT_1 (0x150U)
#define CTRL_CORE_STD_FUSE_OPP_VDD_IVA_LVT_2 (0x154U)
#define CTRL_CORE_STD_FUSE_OPP_VDD_IVA_LVT_3 (0x158U)
#define CTRL_CORE_STD_FUSE_OPP_VDD_IVA_LVT_4 (0x15cU)
#define CTRL_CORE_STD_FUSE_OPP_VDD_CORE_LVT_0 (0x160U)
#define CTRL_CORE_STD_FUSE_OPP_VDD_CORE_LVT_1 (0x164U)
#define CTRL_CORE_STD_FUSE_OPP_VDD_CORE_LVT_2 (0x168U)
#define CTRL_CORE_STD_FUSE_OPP_VDD_CORE_LVT_3 (0x16cU)
#define CTRL_CORE_STD_FUSE_OPP_VDD_CORE_LVT_4 (0x170U)
#define CTRL_CORE_LDOSRAM_CORE_4_VOLTAGE_CTRL (0x174U)
#define CTRL_CORE_LDOSRAM_CORE_5_VOLTAGE_CTRL (0x178U)
#define CTRL_CORE_LDOSRAM_DSPEVE_2_VOLTAGE_CTRL (0x17cU)
#define CTRL_CORE_SMA_SW_2 (0x204U)
#define CTRL_CORE_SMA_SW_3 (0x208U)
#define CTRL_CORE_SMA_SW_4 (0x20cU)
#define CTRL_CORE_SMA_SW_5 (0x210U)
#define CTRL_CORE_SMA_SW_6 (0x214U)
#define CTRL_CORE_SMA_SW_7 (0x218U)
#define CTRL_CORE_SMA_SW_8 (0x21cU)
#define CTRL_CORE_SMA_SW_9 (0x220U)
#define CTRL_CORE_PCIESS1_PCS1 (0x224U)
#define CTRL_CORE_PCIESS1_PCS2 (0x228U)
#define CTRL_CORE_PCIESS2_PCS1 (0x22cU)
#define CTRL_CORE_PCIESS2_PCS2 (0x230U)
#define CTRL_CORE_PCIE_PCS (0x234U)
#define CTRL_CORE_PCIE_PCS_REVISION (0x238U)
#define CTRL_CORE_PCIE_CONTROL (0x23cU)
#define CTRL_CORE_PHY_POWER_PCIESS1 (0x240U)
#define CTRL_CORE_PHY_POWER_PCIESS2 (0x244U)
/****************************************************************************************************
* Field Definition Macros
****************************************************************************************************/
#define CTRL_CORE_STD_FUSE_OPP_VMIN_GPU_0_STD_FUSE_OPP_VMIN_GPU_0_SHIFT (0U)
#define CTRL_CORE_STD_FUSE_OPP_VMIN_GPU_0_STD_FUSE_OPP_VMIN_GPU_0_MASK (0xffffffffU)
#define CTRL_CORE_STD_FUSE_OPP_VMIN_GPU_1_STD_FUSE_OPP_VMIN_GPU_1_SHIFT (0U)
#define CTRL_CORE_STD_FUSE_OPP_VMIN_GPU_1_STD_FUSE_OPP_VMIN_GPU_1_MASK (0xffffffffU)
#define CTRL_CORE_STD_FUSE_OPP_VMIN_GPU_2_STD_FUSE_OPP_VMIN_GPU_2_SHIFT (0U)
#define CTRL_CORE_STD_FUSE_OPP_VMIN_GPU_2_STD_FUSE_OPP_VMIN_GPU_2_MASK (0xffffffffU)
#define CTRL_CORE_STD_FUSE_OPP_VMIN_GPU_3_STD_FUSE_OPP_VMIN_GPU_3_SHIFT (0U)
#define CTRL_CORE_STD_FUSE_OPP_VMIN_GPU_3_STD_FUSE_OPP_VMIN_GPU_3_MASK (0xffffffffU)
#define CTRL_CORE_STD_FUSE_OPP_VMIN_GPU_4_STD_FUSE_OPP_VMIN_GPU_4_SHIFT (0U)
#define CTRL_CORE_STD_FUSE_OPP_VMIN_GPU_4_STD_FUSE_OPP_VMIN_GPU_4_MASK (0xffffffffU)
#define CTRL_CORE_STD_FUSE_OPP_VMIN_GPU_5_STD_FUSE_OPP_VMIN_GPU_5_SHIFT (0U)
#define CTRL_CORE_STD_FUSE_OPP_VMIN_GPU_5_STD_FUSE_OPP_VMIN_GPU_5_MASK (0xffffffffU)
#define CTRL_CORE_STD_FUSE_OPP_VMIN_MPU_0_STD_FUSE_OPP_VMIN_MPU_0_SHIFT (0U)
#define CTRL_CORE_STD_FUSE_OPP_VMIN_MPU_0_STD_FUSE_OPP_VMIN_MPU_0_MASK (0xffffffffU)
#define CTRL_CORE_STD_FUSE_OPP_VMIN_MPU_1_STD_FUSE_OPP_VMIN_MPU_1_SHIFT (0U)
#define CTRL_CORE_STD_FUSE_OPP_VMIN_MPU_1_STD_FUSE_OPP_VMIN_MPU_1_MASK (0xffffffffU)
#define CTRL_CORE_STD_FUSE_OPP_VMIN_MPU_2_STD_FUSE_OPP_VMIN_MPU_2_SHIFT (0U)
#define CTRL_CORE_STD_FUSE_OPP_VMIN_MPU_2_STD_FUSE_OPP_VMIN_MPU_2_MASK (0xffffffffU)
#define CTRL_CORE_STD_FUSE_OPP_VMIN_MPU_3_STD_FUSE_OPP_VMIN_MPU_3_SHIFT (0U)
#define CTRL_CORE_STD_FUSE_OPP_VMIN_MPU_3_STD_FUSE_OPP_VMIN_MPU_3_MASK (0xffffffffU)
#define CTRL_CORE_STD_FUSE_OPP_VMIN_MPU_4_STD_FUSE_OPP_VMIN_MPU_4_SHIFT (0U)
#define CTRL_CORE_STD_FUSE_OPP_VMIN_MPU_4_STD_FUSE_OPP_VMIN_MPU_4_MASK (0xffffffffU)
#define CTRL_CORE_STD_FUSE_OPP_VMIN_MPU_5_STD_FUSE_OPP_VMIN_MPU_5_SHIFT (0U)
#define CTRL_CORE_STD_FUSE_OPP_VMIN_MPU_5_STD_FUSE_OPP_VMIN_MPU_5_MASK (0xffffffffU)
#define CTRL_CORE_STD_FUSE_OPP_VMIN_MPU_6_STD_FUSE_OPP_VMIN_MPU_6_SHIFT (0U)
#define CTRL_CORE_STD_FUSE_OPP_VMIN_MPU_6_STD_FUSE_OPP_VMIN_MPU_6_MASK (0xffffffffU)
#define CTRL_CORE_STD_FUSE_OPP_VMIN_MPU_7_STD_FUSE_OPP_VMIN_MPU_7_SHIFT (0U)
#define CTRL_CORE_STD_FUSE_OPP_VMIN_MPU_7_STD_FUSE_OPP_VMIN_MPU_7_MASK (0xffffffffU)
#define CTRL_CORE_STD_FUSE_OPP_VDD_DSPEVE_LVT_0_STD_FUSE_OPP_VDD_DSPEVE_LVT_0_SHIFT (0U)
#define CTRL_CORE_STD_FUSE_OPP_VDD_DSPEVE_LVT_0_STD_FUSE_OPP_VDD_DSPEVE_LVT_0_MASK (0xffffffffU)
#define CTRL_CORE_STD_FUSE_OPP_VDD_DSPEVE_LVT_1_STD_FUSE_OPP_VDD_DSPEVE_LVT_1_SHIFT (0U)
#define CTRL_CORE_STD_FUSE_OPP_VDD_DSPEVE_LVT_1_STD_FUSE_OPP_VDD_DSPEVE_LVT_1_MASK (0xffffffffU)
#define CTRL_CORE_STD_FUSE_OPP_VDD_DSPEVE_LVT_2_STD_FUSE_OPP_VDD_DSPEVE_LVT_2_SHIFT (0U)
#define CTRL_CORE_STD_FUSE_OPP_VDD_DSPEVE_LVT_2_STD_FUSE_OPP_VDD_DSPEVE_LVT_2_MASK (0xffffffffU)
#define CTRL_CORE_STD_FUSE_OPP_VDD_DSPEVE_LVT_3_STD_FUSE_OPP_VDD_DSPEVE_LVT_3_SHIFT (0U)
#define CTRL_CORE_STD_FUSE_OPP_VDD_DSPEVE_LVT_3_STD_FUSE_OPP_VDD_DSPEVE_LVT_3_MASK (0xffffffffU)
#define CTRL_CORE_STD_FUSE_OPP_VDD_DSPEVE_LVT_4_STD_FUSE_OPP_VDD_DSPEVE_LVT_4_SHIFT (0U)
#define CTRL_CORE_STD_FUSE_OPP_VDD_DSPEVE_LVT_4_STD_FUSE_OPP_VDD_DSPEVE_LVT_4_MASK (0xffffffffU)
#define CTRL_CORE_STD_FUSE_OPP_VDD_IVA_LVT_0_STD_FUSE_OPP_VDD_IVA_LVT_0_SHIFT (0U)
#define CTRL_CORE_STD_FUSE_OPP_VDD_IVA_LVT_0_STD_FUSE_OPP_VDD_IVA_LVT_0_MASK (0xffffffffU)
#define CTRL_CORE_STD_FUSE_OPP_VDD_IVA_LVT_1_STD_FUSE_OPP_VDD_IVA_LVT_1_SHIFT (0U)
#define CTRL_CORE_STD_FUSE_OPP_VDD_IVA_LVT_1_STD_FUSE_OPP_VDD_IVA_LVT_1_MASK (0xffffffffU)
#define CTRL_CORE_STD_FUSE_OPP_VDD_IVA_LVT_2_STD_FUSE_OPP_VDD_IVA_LVT_2_SHIFT (0U)
#define CTRL_CORE_STD_FUSE_OPP_VDD_IVA_LVT_2_STD_FUSE_OPP_VDD_IVA_LVT_2_MASK (0xffffffffU)
#define CTRL_CORE_STD_FUSE_OPP_VDD_IVA_LVT_3_STD_FUSE_OPP_VDD_IVA_LVT_3_SHIFT (0U)
#define CTRL_CORE_STD_FUSE_OPP_VDD_IVA_LVT_3_STD_FUSE_OPP_VDD_IVA_LVT_3_MASK (0xffffffffU)
#define CTRL_CORE_STD_FUSE_OPP_VDD_IVA_LVT_4_STD_FUSE_OPP_VDD_IVA_LVT_4_SHIFT (0U)
#define CTRL_CORE_STD_FUSE_OPP_VDD_IVA_LVT_4_STD_FUSE_OPP_VDD_IVA_LVT_4_MASK (0xffffffffU)
#define CTRL_CORE_STD_FUSE_OPP_VDD_CORE_LVT_0_STD_FUSE_OPP_VDD_CORE_LVT_0_SHIFT (0U)
#define CTRL_CORE_STD_FUSE_OPP_VDD_CORE_LVT_0_STD_FUSE_OPP_VDD_CORE_LVT_0_MASK (0xffffffffU)
#define CTRL_CORE_STD_FUSE_OPP_VDD_CORE_LVT_1_STD_FUSE_OPP_VDD_CORE_LVT_1_SHIFT (0U)
#define CTRL_CORE_STD_FUSE_OPP_VDD_CORE_LVT_1_STD_FUSE_OPP_VDD_CORE_LVT_1_MASK (0xffffffffU)
#define CTRL_CORE_STD_FUSE_OPP_VDD_CORE_LVT_2_STD_FUSE_OPP_VDD_CORE_LVT_2_SHIFT (0U)
#define CTRL_CORE_STD_FUSE_OPP_VDD_CORE_LVT_2_STD_FUSE_OPP_VDD_CORE_LVT_2_MASK (0xffffffffU)
#define CTRL_CORE_STD_FUSE_OPP_VDD_CORE_LVT_3_STD_FUSE_OPP_VDD_CORE_LVT_3_SHIFT (0U)
#define CTRL_CORE_STD_FUSE_OPP_VDD_CORE_LVT_3_STD_FUSE_OPP_VDD_CORE_LVT_3_MASK (0xffffffffU)
#define CTRL_CORE_STD_FUSE_OPP_VDD_CORE_LVT_4_STD_FUSE_OPP_VDD_CORE_LVT_4_SHIFT (0U)
#define CTRL_CORE_STD_FUSE_OPP_VDD_CORE_LVT_4_STD_FUSE_OPP_VDD_CORE_LVT_4_MASK (0xffffffffU)
#define CTRL_CORE_LDOSRAM_CORE_4_VOLTAGE_CTRL_LDOSRAMCORE_4_RETMODE_MUX_CTRL_SHIFT (26U)
#define CTRL_CORE_LDOSRAM_CORE_4_VOLTAGE_CTRL_LDOSRAMCORE_4_RETMODE_MUX_CTRL_MASK (0x04000000U)
#define CTRL_CORE_LDOSRAM_CORE_4_VOLTAGE_CTRL_LDOSRAMCORE_4_RETMODE_MUX_CTRL_OCP (1U)
#define CTRL_CORE_LDOSRAM_CORE_4_VOLTAGE_CTRL_LDOSRAMCORE_4_RETMODE_MUX_CTRL_EFUSE (0U)
#define CTRL_CORE_LDOSRAM_CORE_4_VOLTAGE_CTRL_LDOSRAMCORE_4_RETMODE_VSET_IN_SHIFT (21U)
#define CTRL_CORE_LDOSRAM_CORE_4_VOLTAGE_CTRL_LDOSRAMCORE_4_RETMODE_VSET_IN_MASK (0x03e00000U)
#define CTRL_CORE_LDOSRAM_CORE_4_VOLTAGE_CTRL_LDOSRAMCORE_4_RETMODE_VSET_OUT_SHIFT (16U)
#define CTRL_CORE_LDOSRAM_CORE_4_VOLTAGE_CTRL_LDOSRAMCORE_4_RETMODE_VSET_OUT_MASK (0x001f0000U)
#define CTRL_CORE_LDOSRAM_CORE_4_VOLTAGE_CTRL_LDOSRAMCORE_4_ACTMODE_MUX_CTRL_SHIFT (10U)
#define CTRL_CORE_LDOSRAM_CORE_4_VOLTAGE_CTRL_LDOSRAMCORE_4_ACTMODE_MUX_CTRL_MASK (0x00000400U)
#define CTRL_CORE_LDOSRAM_CORE_4_VOLTAGE_CTRL_LDOSRAMCORE_4_ACTMODE_MUX_CTRL_OCP (1U)
#define CTRL_CORE_LDOSRAM_CORE_4_VOLTAGE_CTRL_LDOSRAMCORE_4_ACTMODE_MUX_CTRL_EFUSE (0U)
#define CTRL_CORE_LDOSRAM_CORE_4_VOLTAGE_CTRL_LDOSRAMCORE_4_ACTMODE_VSET_IN_SHIFT (5U)
#define CTRL_CORE_LDOSRAM_CORE_4_VOLTAGE_CTRL_LDOSRAMCORE_4_ACTMODE_VSET_IN_MASK (0x000003e0U)
#define CTRL_CORE_LDOSRAM_CORE_4_VOLTAGE_CTRL_LDOSRAMCORE_4_ACTMODE_VSET_OUT_SHIFT (0U)
#define CTRL_CORE_LDOSRAM_CORE_4_VOLTAGE_CTRL_LDOSRAMCORE_4_ACTMODE_VSET_OUT_MASK (0x0000001fU)
#define CTRL_CORE_LDOSRAM_CORE_4_VOLTAGE_CTRL_RESERVED_0_SHIFT (11U)
#define CTRL_CORE_LDOSRAM_CORE_4_VOLTAGE_CTRL_RESERVED_0_MASK (0x0000f800U)
#define CTRL_CORE_LDOSRAM_CORE_4_VOLTAGE_CTRL_RESERVED_1_SHIFT (27U)
#define CTRL_CORE_LDOSRAM_CORE_4_VOLTAGE_CTRL_RESERVED_1_MASK (0xf8000000U)
#define CTRL_CORE_LDOSRAM_CORE_5_VOLTAGE_CTRL_LDOSRAMCORE_5_RETMODE_MUX_CTRL_SHIFT (26U)
#define CTRL_CORE_LDOSRAM_CORE_5_VOLTAGE_CTRL_LDOSRAMCORE_5_RETMODE_MUX_CTRL_MASK (0x04000000U)
#define CTRL_CORE_LDOSRAM_CORE_5_VOLTAGE_CTRL_LDOSRAMCORE_5_RETMODE_MUX_CTRL_OCP (1U)
#define CTRL_CORE_LDOSRAM_CORE_5_VOLTAGE_CTRL_LDOSRAMCORE_5_RETMODE_MUX_CTRL_EFUSE (0U)
#define CTRL_CORE_LDOSRAM_CORE_5_VOLTAGE_CTRL_LDOSRAMCORE_5_RETMODE_VSET_IN_SHIFT (21U)
#define CTRL_CORE_LDOSRAM_CORE_5_VOLTAGE_CTRL_LDOSRAMCORE_5_RETMODE_VSET_IN_MASK (0x03e00000U)
#define CTRL_CORE_LDOSRAM_CORE_5_VOLTAGE_CTRL_LDOSRAMCORE_5_RETMODE_VSET_OUT_SHIFT (16U)
#define CTRL_CORE_LDOSRAM_CORE_5_VOLTAGE_CTRL_LDOSRAMCORE_5_RETMODE_VSET_OUT_MASK (0x001f0000U)
#define CTRL_CORE_LDOSRAM_CORE_5_VOLTAGE_CTRL_LDOSRAMCORE_5_ACTMODE_MUX_CTRL_SHIFT (10U)
#define CTRL_CORE_LDOSRAM_CORE_5_VOLTAGE_CTRL_LDOSRAMCORE_5_ACTMODE_MUX_CTRL_MASK (0x00000400U)
#define CTRL_CORE_LDOSRAM_CORE_5_VOLTAGE_CTRL_LDOSRAMCORE_5_ACTMODE_MUX_CTRL_OCP (1U)
#define CTRL_CORE_LDOSRAM_CORE_5_VOLTAGE_CTRL_LDOSRAMCORE_5_ACTMODE_MUX_CTRL_EFUSE (0U)
#define CTRL_CORE_LDOSRAM_CORE_5_VOLTAGE_CTRL_LDOSRAMCORE_5_ACTMODE_VSET_IN_SHIFT (5U)
#define CTRL_CORE_LDOSRAM_CORE_5_VOLTAGE_CTRL_LDOSRAMCORE_5_ACTMODE_VSET_IN_MASK (0x000003e0U)
#define CTRL_CORE_LDOSRAM_CORE_5_VOLTAGE_CTRL_LDOSRAMCORE_5_ACTMODE_VSET_OUT_SHIFT (0U)
#define CTRL_CORE_LDOSRAM_CORE_5_VOLTAGE_CTRL_LDOSRAMCORE_5_ACTMODE_VSET_OUT_MASK (0x0000001fU)
#define CTRL_CORE_LDOSRAM_CORE_5_VOLTAGE_CTRL_RESERVED_0_SHIFT (11U)
#define CTRL_CORE_LDOSRAM_CORE_5_VOLTAGE_CTRL_RESERVED_0_MASK (0x0000f800U)
#define CTRL_CORE_LDOSRAM_CORE_5_VOLTAGE_CTRL_RESERVED_1_SHIFT (27U)
#define CTRL_CORE_LDOSRAM_CORE_5_VOLTAGE_CTRL_RESERVED_1_MASK (0xf8000000U)
#define CTRL_CORE_LDOSRAM_DSPEVE_2_VOLTAGE_CTRL_LDOSRAMDSPEVE_2_RETMODE_MUX_CTRL_SHIFT (26U)
#define CTRL_CORE_LDOSRAM_DSPEVE_2_VOLTAGE_CTRL_LDOSRAMDSPEVE_2_RETMODE_MUX_CTRL_MASK (0x04000000U)
#define CTRL_CORE_LDOSRAM_DSPEVE_2_VOLTAGE_CTRL_LDOSRAMDSPEVE_2_RETMODE_MUX_CTRL_OCP (1U)
#define CTRL_CORE_LDOSRAM_DSPEVE_2_VOLTAGE_CTRL_LDOSRAMDSPEVE_2_RETMODE_MUX_CTRL_EFUSE (0U)
#define CTRL_CORE_LDOSRAM_DSPEVE_2_VOLTAGE_CTRL_LDOSRAMDSPEVE_2_RETMODE_VSET_IN_SHIFT (21U)
#define CTRL_CORE_LDOSRAM_DSPEVE_2_VOLTAGE_CTRL_LDOSRAMDSPEVE_2_RETMODE_VSET_IN_MASK (0x03e00000U)
#define CTRL_CORE_LDOSRAM_DSPEVE_2_VOLTAGE_CTRL_LDOSRAMDSPEVE_2_RETMODE_VSET_OUT_SHIFT (16U)
#define CTRL_CORE_LDOSRAM_DSPEVE_2_VOLTAGE_CTRL_LDOSRAMDSPEVE_2_RETMODE_VSET_OUT_MASK (0x001f0000U)
#define CTRL_CORE_LDOSRAM_DSPEVE_2_VOLTAGE_CTRL_LDOSRAMDSPEVE_2_ACTMODE_MUX_CTRL_SHIFT (10U)
#define CTRL_CORE_LDOSRAM_DSPEVE_2_VOLTAGE_CTRL_LDOSRAMDSPEVE_2_ACTMODE_MUX_CTRL_MASK (0x00000400U)
#define CTRL_CORE_LDOSRAM_DSPEVE_2_VOLTAGE_CTRL_LDOSRAMDSPEVE_2_ACTMODE_MUX_CTRL_OCP (1U)
#define CTRL_CORE_LDOSRAM_DSPEVE_2_VOLTAGE_CTRL_LDOSRAMDSPEVE_2_ACTMODE_MUX_CTRL_EFUSE (0U)
#define CTRL_CORE_LDOSRAM_DSPEVE_2_VOLTAGE_CTRL_LDOSRAMDSPEVE_2_ACTMODE_VSET_IN_SHIFT (5U)
#define CTRL_CORE_LDOSRAM_DSPEVE_2_VOLTAGE_CTRL_LDOSRAMDSPEVE_2_ACTMODE_VSET_IN_MASK (0x000003e0U)
#define CTRL_CORE_LDOSRAM_DSPEVE_2_VOLTAGE_CTRL_LDOSRAMDSPEVE_2_ACTMODE_VSET_OUT_SHIFT (0U)
#define CTRL_CORE_LDOSRAM_DSPEVE_2_VOLTAGE_CTRL_LDOSRAMDSPEVE_2_ACTMODE_VSET_OUT_MASK (0x0000001fU)
#define CTRL_CORE_LDOSRAM_DSPEVE_2_VOLTAGE_CTRL_RESERVED_0_SHIFT (11U)
#define CTRL_CORE_LDOSRAM_DSPEVE_2_VOLTAGE_CTRL_RESERVED_0_MASK (0x0000f800U)
#define CTRL_CORE_LDOSRAM_DSPEVE_2_VOLTAGE_CTRL_RESERVED_1_SHIFT (27U)
#define CTRL_CORE_LDOSRAM_DSPEVE_2_VOLTAGE_CTRL_RESERVED_1_MASK (0xf8000000U)
#define CTRL_CORE_SMA_SW_2_SMA_SW_2_SHIFT (0U)
#define CTRL_CORE_SMA_SW_2_SMA_SW_2_MASK (0xffffffffU)
#define CTRL_CORE_SMA_SW_3_SMA_SW_3_SHIFT (2U)
#define CTRL_CORE_SMA_SW_3_SMA_SW_3_MASK (0xfffffffcU)
#define CTRL_CORE_SMA_SW_3_DSP2_LRST_DONE_RESERVED_SHIFT (1U)
#define CTRL_CORE_SMA_SW_3_DSP2_LRST_DONE_RESERVED_MASK (0x00000002U)
#define CTRL_CORE_SMA_SW_3_DSP1_LRST_DONE_RESERVED_SHIFT (0U)
#define CTRL_CORE_SMA_SW_3_DSP1_LRST_DONE_RESERVED_MASK (0x00000001U)
#define CTRL_CORE_SMA_SW_4_MREQDOMAIN_EXP7_LOCK_SHIFT (31U)
#define CTRL_CORE_SMA_SW_4_MREQDOMAIN_EXP7_LOCK_MASK (0x80000000U)
#define CTRL_CORE_SMA_SW_4_MREQDOMAIN_CSI2_2_SHIFT (9U)
#define CTRL_CORE_SMA_SW_4_MREQDOMAIN_CSI2_2_MASK (0x00000e00U)
#define CTRL_CORE_SMA_SW_4_MREQDOMAIN_CSI2_1_SHIFT (6U)
#define CTRL_CORE_SMA_SW_4_MREQDOMAIN_CSI2_1_MASK (0x000001c0U)
#define CTRL_CORE_SMA_SW_4_MREQDOMAIN_DSP2_EDMA_SHIFT (3U)
#define CTRL_CORE_SMA_SW_4_MREQDOMAIN_DSP2_EDMA_MASK (0x00000038U)
#define CTRL_CORE_SMA_SW_4_MREQDOMAIN_DSP1_EDMA_SHIFT (0U)
#define CTRL_CORE_SMA_SW_4_MREQDOMAIN_DSP1_EDMA_MASK (0x00000007U)
#define CTRL_CORE_SMA_SW_4_RESERVED_0_SHIFT (12U)
#define CTRL_CORE_SMA_SW_4_RESERVED_0_MASK (0x7ffff000U)
#define CTRL_CORE_SMA_SW_5_SMA_SW_5_RESERVED_SHIFT (1U)
#define CTRL_CORE_SMA_SW_5_SMA_SW_5_RESERVED_MASK (0xfffffffeU)
#define CTRL_CORE_SMA_SW_5_TSHUT_OVERRIDE_SHIFT (0U)
#define CTRL_CORE_SMA_SW_5_TSHUT_OVERRIDE_MASK (0x00000001U)
#define CTRL_CORE_SMA_SW_6_SMA_SW_6_RESERVED_SHIFT (29U)
#define CTRL_CORE_SMA_SW_6_SMA_SW_6_RESERVED_MASK (0xe0000000U)
#define CTRL_CORE_SMA_SW_6_PLLEN_CONTROL_SHIFT (24U)
#define CTRL_CORE_SMA_SW_6_PLLEN_CONTROL_MASK (0x1f000000U)
#define CTRL_CORE_SMA_SW_6_PCIE_TX_RX_CONTROL_SHIFT (16U)
#define CTRL_CORE_SMA_SW_6_PCIE_TX_RX_CONTROL_MASK (0x00030000U)
#define CTRL_CORE_SMA_SW_6_RMII_CLK_SETTING_SHIFT (8U)
#define CTRL_CORE_SMA_SW_6_RMII_CLK_SETTING_MASK (0x00000100U)
#define CTRL_CORE_SMA_SW_6_MUXSEL_32K_CLKIN_SHIFT (0U)
#define CTRL_CORE_SMA_SW_6_MUXSEL_32K_CLKIN_MASK (0x00000001U)
#define CTRL_CORE_SMA_SW_6_RESERVED_0_SHIFT (1U)
#define CTRL_CORE_SMA_SW_6_RESERVED_0_MASK (0x000000feU)
#define CTRL_CORE_SMA_SW_6_RESERVED_1_SHIFT (9U)
#define CTRL_CORE_SMA_SW_6_RESERVED_1_MASK (0x0000fe00U)
#define CTRL_CORE_SMA_SW_6_RESERVED_2_SHIFT (18U)
#define CTRL_CORE_SMA_SW_6_RESERVED_2_MASK (0x00fc0000U)
#define CTRL_CORE_SMA_SW_7_SMA_SW_7_RESERVED_SHIFT (18U)
#define CTRL_CORE_SMA_SW_7_SMA_SW_7_RESERVED_MASK (0xfffc0000U)
#define CTRL_CORE_SMA_SW_7_MMU1_ABORT_ENABLE_SHIFT (17U)
#define CTRL_CORE_SMA_SW_7_MMU1_ABORT_ENABLE_MASK (0x00020000U)
#define CTRL_CORE_SMA_SW_7_MMU2_ABORT_ENABLE_SHIFT (16U)
#define CTRL_CORE_SMA_SW_7_MMU2_ABORT_ENABLE_MASK (0x00010000U)
#define CTRL_CORE_SMA_SW_7_EDMA_TC1_WR_MMU_ROUTE_ENABLE_SHIFT (13U)
#define CTRL_CORE_SMA_SW_7_EDMA_TC1_WR_MMU_ROUTE_ENABLE_MASK (0x00002000U)
#define CTRL_CORE_SMA_SW_7_EDMA_TC1_RD_MMU_ROUTE_ENABLE_SHIFT (12U)
#define CTRL_CORE_SMA_SW_7_EDMA_TC1_RD_MMU_ROUTE_ENABLE_MASK (0x00001000U)
#define CTRL_CORE_SMA_SW_7_EDMA_TC0_WR_MMU_ROUTE_ENABLE_SHIFT (11U)
#define CTRL_CORE_SMA_SW_7_EDMA_TC0_WR_MMU_ROUTE_ENABLE_MASK (0x00000800U)
#define CTRL_CORE_SMA_SW_7_EDMA_TC0_RD_MMU_ROUTE_ENABLE_SHIFT (10U)
#define CTRL_CORE_SMA_SW_7_EDMA_TC0_RD_MMU_ROUTE_ENABLE_MASK (0x00000400U)
#define CTRL_CORE_SMA_SW_7_PCIE_SS2_MMU_ROUTE_ENABLE_SHIFT (9U)
#define CTRL_CORE_SMA_SW_7_PCIE_SS2_MMU_ROUTE_ENABLE_MASK (0x00000200U)
#define CTRL_CORE_SMA_SW_7_PCIE_SS1_MMU_ROUTE_ENABLE_SHIFT (8U)
#define CTRL_CORE_SMA_SW_7_PCIE_SS1_MMU_ROUTE_ENABLE_MASK (0x00000100U)
#define CTRL_CORE_SMA_SW_7_PCIE_SS1_AXI2OCP_LEGACY_MODE_ENABLE_SHIFT (1U)
#define CTRL_CORE_SMA_SW_7_PCIE_SS1_AXI2OCP_LEGACY_MODE_ENABLE_MASK (0x00000002U)
#define CTRL_CORE_SMA_SW_7_PCIE_SS2_AXI2OCP_LEGACY_MODE_ENABLE_SHIFT (0U)
#define CTRL_CORE_SMA_SW_7_PCIE_SS2_AXI2OCP_LEGACY_MODE_ENABLE_MASK (0x00000001U)
#define CTRL_CORE_SMA_SW_7_RESERVED_0_SHIFT (2U)
#define CTRL_CORE_SMA_SW_7_RESERVED_0_MASK (0x000000fcU)
#define CTRL_CORE_SMA_SW_7_RESERVED_1_SHIFT (14U)
#define CTRL_CORE_SMA_SW_7_RESERVED_1_MASK (0x0000c000U)
#define CTRL_CORE_SMA_SW_8_PCIE_PLL_TEST_INPUT_1_SHIFT (0U)
#define CTRL_CORE_SMA_SW_8_PCIE_PLL_TEST_INPUT_1_MASK (0xffffffffU)
#define CTRL_CORE_SMA_SW_9_PCIE_PLL_TEST_INPUT_2_SHIFT (0U)
#define CTRL_CORE_SMA_SW_9_PCIE_PLL_TEST_INPUT_2_MASK (0xffffffffU)
#define CTRL_CORE_PCIESS1_PCS1_PCIESS1_PCS_TEST_TXDATA_SHIFT (22U)
#define CTRL_CORE_PCIESS1_PCS1_PCIESS1_PCS_TEST_TXDATA_MASK (0xffc00000U)
#define CTRL_CORE_PCIESS1_PCS1_PCIESS1_PCS_ERR_BIT_EN_SHIFT (12U)
#define CTRL_CORE_PCIESS1_PCS1_PCIESS1_PCS_ERR_BIT_EN_MASK (0x003ff000U)
#define CTRL_CORE_PCIESS1_PCS1_PCIESS1_PCS_CFG_HOLDOFF_SHIFT (4U)
#define CTRL_CORE_PCIESS1_PCS1_PCIESS1_PCS_CFG_HOLDOFF_MASK (0x00000ff0U)
#define CTRL_CORE_PCIESS1_PCS1_PCIESS1_PCS_DET_DELAY_SHIFT (0U)
#define CTRL_CORE_PCIESS1_PCS1_PCIESS1_PCS_DET_DELAY_MASK (0x0000000fU)
#define CTRL_CORE_PCIESS1_PCS2_PCIESS1_PCS_CFG_SYNC_SHIFT (27U)
#define CTRL_CORE_PCIESS1_PCS2_PCIESS1_PCS_CFG_SYNC_MASK (0xf8000000U)
#define CTRL_CORE_PCIESS1_PCS2_PCIESS1_PCS_CFG_EQ_FUNC_SHIFT (23U)
#define CTRL_CORE_PCIESS1_PCS2_PCIESS1_PCS_CFG_EQ_FUNC_MASK (0x07800000U)
#define CTRL_CORE_PCIESS1_PCS2_PCIESS1_PCS_CFG_EQ_HOLD_SHIFT (19U)
#define CTRL_CORE_PCIESS1_PCS2_PCIESS1_PCS_CFG_EQ_HOLD_MASK (0x00780000U)
#define CTRL_CORE_PCIESS1_PCS2_PCIESS1_PCS_CFG_EQ_INIT_SHIFT (15U)
#define CTRL_CORE_PCIESS1_PCS2_PCIESS1_PCS_CFG_EQ_INIT_MASK (0x00078000U)
#define CTRL_CORE_PCIESS1_PCS2_PCIESS1_PCS_TEST_OSEL_SHIFT (12U)
#define CTRL_CORE_PCIESS1_PCS2_PCIESS1_PCS_TEST_OSEL_MASK (0x00007000U)
#define CTRL_CORE_PCIESS1_PCS2_PCIESS1_PCS_TEST_LSEL_SHIFT (9U)
#define CTRL_CORE_PCIESS1_PCS2_PCIESS1_PCS_TEST_LSEL_MASK (0x00000200U)
#define CTRL_CORE_PCIESS1_PCS2_PCIESS1_PCS_ERR_MODE_SHIFT (6U)
#define CTRL_CORE_PCIESS1_PCS2_PCIESS1_PCS_ERR_MODE_MASK (0x000000c0U)
#define CTRL_CORE_PCIESS1_PCS2_PCIESS1_PCS_L1_SLEEP_SHIFT (5U)
#define CTRL_CORE_PCIESS1_PCS2_PCIESS1_PCS_L1_SLEEP_MASK (0x00000020U)
#define CTRL_CORE_PCIESS1_PCS2_PCIESS1_PCS_TEST_MODE_SHIFT (4U)
#define CTRL_CORE_PCIESS1_PCS2_PCIESS1_PCS_TEST_MODE_MASK (0x00000010U)
#define CTRL_CORE_PCIESS1_PCS2_PCIESS1_PCS_ERR_LN_EN_SHIFT (2U)
#define CTRL_CORE_PCIESS1_PCS2_PCIESS1_PCS_ERR_LN_EN_MASK (0x0000000cU)
#define CTRL_CORE_PCIESS1_PCS2_PCIESS1_PCS_SHORT_TIMES_SHIFT (0U)
#define CTRL_CORE_PCIESS1_PCS2_PCIESS1_PCS_SHORT_TIMES_MASK (0x00000001U)
#define CTRL_CORE_PCIESS1_PCS2_RESERVED_0_SHIFT (1U)
#define CTRL_CORE_PCIESS1_PCS2_RESERVED_0_MASK (0x00000002U)
#define CTRL_CORE_PCIESS1_PCS2_RESERVED_1_SHIFT (8U)
#define CTRL_CORE_PCIESS1_PCS2_RESERVED_1_MASK (0x00000100U)
#define CTRL_CORE_PCIESS1_PCS2_RESERVED_2_SHIFT (10U)
#define CTRL_CORE_PCIESS1_PCS2_RESERVED_2_MASK (0x00000c00U)
#define CTRL_CORE_PCIESS2_PCS1_PCIESS2_PCS_TEST_TXDATA_SHIFT (22U)
#define CTRL_CORE_PCIESS2_PCS1_PCIESS2_PCS_TEST_TXDATA_MASK (0xffc00000U)
#define CTRL_CORE_PCIESS2_PCS1_PCIESS2_PCS_ERR_BIT_EN_SHIFT (12U)
#define CTRL_CORE_PCIESS2_PCS1_PCIESS2_PCS_ERR_BIT_EN_MASK (0x003ff000U)
#define CTRL_CORE_PCIESS2_PCS1_PCIESS2_PCS_CFG_HOLDOFF_SHIFT (4U)
#define CTRL_CORE_PCIESS2_PCS1_PCIESS2_PCS_CFG_HOLDOFF_MASK (0x00000ff0U)
#define CTRL_CORE_PCIESS2_PCS1_PCIESS2_PCS_DET_DELAY_SHIFT (0U)
#define CTRL_CORE_PCIESS2_PCS1_PCIESS2_PCS_DET_DELAY_MASK (0x0000000fU)
#define CTRL_CORE_PCIESS2_PCS2_PCIESS2_PCS_CFG_SYNC_SHIFT (27U)
#define CTRL_CORE_PCIESS2_PCS2_PCIESS2_PCS_CFG_SYNC_MASK (0xf8000000U)
#define CTRL_CORE_PCIESS2_PCS2_PCIESS2_PCS_CFG_EQ_FUNC_SHIFT (23U)
#define CTRL_CORE_PCIESS2_PCS2_PCIESS2_PCS_CFG_EQ_FUNC_MASK (0x07800000U)
#define CTRL_CORE_PCIESS2_PCS2_PCIESS2_PCS_CFG_EQ_HOLD_SHIFT (19U)
#define CTRL_CORE_PCIESS2_PCS2_PCIESS2_PCS_CFG_EQ_HOLD_MASK (0x00780000U)
#define CTRL_CORE_PCIESS2_PCS2_PCIESS2_PCS_CFG_EQ_INIT_SHIFT (15U)
#define CTRL_CORE_PCIESS2_PCS2_PCIESS2_PCS_CFG_EQ_INIT_MASK (0x00078000U)
#define CTRL_CORE_PCIESS2_PCS2_PCIESS2_PCS_TEST_OSEL_SHIFT (12U)
#define CTRL_CORE_PCIESS2_PCS2_PCIESS2_PCS_TEST_OSEL_MASK (0x00007000U)
#define CTRL_CORE_PCIESS2_PCS2_PCIESS2_PCS_TEST_LSEL_SHIFT (9U)
#define CTRL_CORE_PCIESS2_PCS2_PCIESS2_PCS_TEST_LSEL_MASK (0x00000200U)
#define CTRL_CORE_PCIESS2_PCS2_PCIESS2_PCS_ERR_MODE_SHIFT (6U)
#define CTRL_CORE_PCIESS2_PCS2_PCIESS2_PCS_ERR_MODE_MASK (0x000000c0U)
#define CTRL_CORE_PCIESS2_PCS2_PCIESS2_PCS_L1_SLEEP_SHIFT (5U)
#define CTRL_CORE_PCIESS2_PCS2_PCIESS2_PCS_L1_SLEEP_MASK (0x00000020U)
#define CTRL_CORE_PCIESS2_PCS2_PCIESS2_PCS_TEST_MODE_SHIFT (4U)
#define CTRL_CORE_PCIESS2_PCS2_PCIESS2_PCS_TEST_MODE_MASK (0x00000010U)
#define CTRL_CORE_PCIESS2_PCS2_PCIESS2_PCS_ERR_LN_EN_SHIFT (2U)
#define CTRL_CORE_PCIESS2_PCS2_PCIESS2_PCS_ERR_LN_EN_MASK (0x0000000cU)
#define CTRL_CORE_PCIESS2_PCS2_PCIESS2_PCS_SHORT_TIMES_SHIFT (0U)
#define CTRL_CORE_PCIESS2_PCS2_PCIESS2_PCS_SHORT_TIMES_MASK (0x00000001U)
#define CTRL_CORE_PCIESS2_PCS2_RESERVED_0_SHIFT (1U)
#define CTRL_CORE_PCIESS2_PCS2_RESERVED_0_MASK (0x00000002U)
#define CTRL_CORE_PCIESS2_PCS2_RESERVED_1_SHIFT (8U)
#define CTRL_CORE_PCIESS2_PCS2_RESERVED_1_MASK (0x00000100U)
#define CTRL_CORE_PCIESS2_PCS2_RESERVED_2_SHIFT (10U)
#define CTRL_CORE_PCIESS2_PCS2_RESERVED_2_MASK (0x00000c00U)
#define CTRL_CORE_PCIE_PCS_PCIESS2_PCS_RC_DELAY_COUNT_SHIFT (16U)
#define CTRL_CORE_PCIE_PCS_PCIESS2_PCS_RC_DELAY_COUNT_MASK (0x00ff0000U)
#define CTRL_CORE_PCIE_PCS_PCIESS1_PCS_RC_DELAY_COUNT_SHIFT (8U)
#define CTRL_CORE_PCIE_PCS_PCIESS1_PCS_RC_DELAY_COUNT_MASK (0x0000ff00U)
#define CTRL_CORE_PCIE_PCS_RESERVED_0_SHIFT (0U)
#define CTRL_CORE_PCIE_PCS_RESERVED_0_MASK (0x000000ffU)
#define CTRL_CORE_PCIE_PCS_RESERVED_1_SHIFT (24U)
#define CTRL_CORE_PCIE_PCS_RESERVED_1_MASK (0xff000000U)
#define CTRL_CORE_PCIE_PCS_REVISION_PCIESS2_PCS_REVISION_SHIFT (23U)
#define CTRL_CORE_PCIE_PCS_REVISION_PCIESS2_PCS_REVISION_MASK (0x03800000U)
#define CTRL_CORE_PCIE_PCS_REVISION_PCIESS1_PCS_REVISION_SHIFT (20U)
#define CTRL_CORE_PCIE_PCS_REVISION_PCIESS1_PCS_REVISION_MASK (0x00700000U)
#define CTRL_CORE_PCIE_PCS_REVISION_RESERVED_0_SHIFT (0U)
#define CTRL_CORE_PCIE_PCS_REVISION_RESERVED_0_MASK (0x000fffffU)
#define CTRL_CORE_PCIE_PCS_REVISION_RESERVED_1_SHIFT (26U)
#define CTRL_CORE_PCIE_PCS_REVISION_RESERVED_1_MASK (0xfc000000U)
#define CTRL_CORE_PCIE_CONTROL_PCIE_B1C0_MODE_SEL_SHIFT (2U)
#define CTRL_CORE_PCIE_CONTROL_PCIE_B1C0_MODE_SEL_MASK (0x00000004U)
#define CTRL_CORE_PCIE_CONTROL_PCIE_B0_B1_TSYNCEN_SHIFT (0U)
#define CTRL_CORE_PCIE_CONTROL_PCIE_B0_B1_TSYNCEN_MASK (0x00000001U)
#define CTRL_CORE_PCIE_CONTROL_RESERVED_0_SHIFT (1U)
#define CTRL_CORE_PCIE_CONTROL_RESERVED_0_MASK (0x00000002U)
#define CTRL_CORE_PCIE_CONTROL_RESERVED_1_SHIFT (3U)
#define CTRL_CORE_PCIE_CONTROL_RESERVED_1_MASK (0xfffffff8U)
#define CTRL_CORE_PHY_POWER_PCIESS1_PCIESS1_PWRCTL_CLKFREQ_SHIFT (22U)
#define CTRL_CORE_PHY_POWER_PCIESS1_PCIESS1_PWRCTL_CLKFREQ_MASK (0xffc00000U)
#define CTRL_CORE_PHY_POWER_PCIESS1_PCIESS1_PWRCTL_CMD_SHIFT (14U)
#define CTRL_CORE_PHY_POWER_PCIESS1_PCIESS1_PWRCTL_CMD_MASK (0x003fc000U)
#define CTRL_CORE_PHY_POWER_PCIESS1_RESERVED_0_SHIFT (0U)
#define CTRL_CORE_PHY_POWER_PCIESS1_RESERVED_0_MASK (0x00003fffU)
#define CTRL_CORE_PHY_POWER_PCIESS2_PCIESS2_PWRCTL_CLKFREQ_SHIFT (22U)
#define CTRL_CORE_PHY_POWER_PCIESS2_PCIESS2_PWRCTL_CLKFREQ_MASK (0xffc00000U)
#define CTRL_CORE_PHY_POWER_PCIESS2_PCIESS2_PWRCTL_CMD_SHIFT (14U)
#define CTRL_CORE_PHY_POWER_PCIESS2_PCIESS2_PWRCTL_CMD_MASK (0x003fc000U)
#define CTRL_CORE_PHY_POWER_PCIESS2_RESERVED_0_SHIFT (0U)
#define CTRL_CORE_PHY_POWER_PCIESS2_RESERVED_0_MASK (0x00003fffU)
#ifdef __cplusplus
}
#endif
#endif /* _HW_CTRL_CORE_SEC_H_ */
| [
"[email protected]"
] | |
66fc761ad5b35ba8475b9a171a0d43684096264c | 6ff2d75fb2bf61728a46536d33bfed5df32183a4 | /mapdata.c | 52e71d727c984beac540d4a8b5ffccd86c4bb8fe | [
"CC-BY-4.0"
] | permissive | M100-A/HQWA | 440ff6ee91d13831c32b0b6f06d8ecfabdfbef92 | c8e86bc4a91262096b61a5cd2c7d9ecebdcca0af | refs/heads/master | 2021-01-15T21:44:59.726671 | 2016-11-13T05:51:24 | 2016-11-13T05:51:24 | 68,424,540 | 0 | 0 | null | 2016-11-13T05:51:24 | 2016-09-17T01:07:20 | C | UTF-8 | C | false | false | 139,912 | c | //
// mapdata.c
//
// map data definition.
//
#include "common.h"
#include "gamelogic.h"
#include "mapdata.h"
//
// This is the static position id list for 01 Act 1..
//
struct mapdata_posdatastatic gstructMapPosStatic01Act1[] =
{
// id, Nid, Nlk, Eid, Elk, Sid, Slk, Wid, Wlk, Pe, Spc, Clk
{ 1, 0, 0, 78, 1, 0, 0, 0, 0, 1, 1, 0 }, // act 1 end
{ 2, 4, 3, 3, 2, 6, 4, 0, 0, 1, 2, 0 }, // act 1 start
{ 3, 0, 0, 0, 0, 0, 0, 2, 2, 1, 21, 0 }, // act 1 blocked entrance
{ 4, 0, 0, 0, 0, 2, 3, 5, 5, 18, 0, 0 },
{ 5, 0, 0, 4, 5, 0, 0, 0, 0, 20, 0, 0 },
{ 6, 2, 4, 10, 6, 0, 0, 7, 7, 15, 0, 0 },
{ 7, 8, 8, 6, 7, 0, 0, 0, 0, 24, 0, 0 },
{ 8, 0, 0, 0, 0, 7, 8, 9, 9, 45, 0, 0 },
{ 9, 0, 0, 8, 9, 0, 0, 0, 0, 58, 0, 0 },
{ 10, 11, 10, 0, 0, 12, 11, 6, 6, 1, 22, 0 }, // act 1 first monster t-intersection
{ 11, 0, 0, 0, 0, 10, 10, 0, 0, 1, 50, 11 }, // act 1 first monster trap trigger (link 11)
{ 12, 10, 11, 33, 12, 0, 0, 13, 13, 15, 0, 0 },
{ 13, 14, 14, 12, 13, 0, 0, 0, 0, 18, 0, 0 },
{ 14, 0, 0, 0, 0, 13, 14, 15, 15, 22, 0, 0 },
{ 15, 0, 0, 14, 15, 16, 16, 0, 0, 23, 0, 0 },
{ 16, 15, 16, 0, 0, 0, 0, 17, 17, 34, 0, 0 },
{ 17, 0, 0, 16, 17, 18, 18, 0, 0, 12, 0, 0 },
{ 18, 17, 18, 19, 19, 0, 0, 0, 0, 24, 0, 0 },
{ 19, 20, 20, 0, 0, 26, 21, 18, 19, 21, 0, 0 },
{ 20, 0, 0, 21, 22, 19, 20, 0, 0, 10, 0, 0 },
{ 21, 32, 23, 24, 24, 22, 25, 20, 22, 15, 0, 0 },
{ 22, 21, 25, 0, 0, 0, 0, 23, 26, 20, 0, 0 },
{ 23, 0, 0, 22, 26, 0, 0, 0, 0, 74, 0, 0 },
{ 24, 0, 0, 0, 0, 25, 27, 21, 24, 15, 0, 0 },
{ 25, 24, 27, 0, 0, 0, 0, 0, 0, 1, 51, 32 }, // act 1 trigger2 (dead-end) (link 32)
{ 26, 19, 21, 27, 28, 0, 0, 0, 0, 34, 0, 0 },
{ 27, 28, 29, 29, 30, 0, 0, 26, 28, 41, 0, 0 },
{ 28, 0, 0, 0, 0, 27, 29, 0, 0, 65, 0, 0 },
{ 29, 30, 31, 47, 32, 0, 0, 27, 30, 13, 0, 0 },
{ 30, 31, 33, 44, 34, 29, 31, 0, 0, 1, 0, 0 },
{ 31, 0, 0, 0, 0, 30, 33, 32, 35, 12, 0, 0 },
{ 32, 0, 0, 31, 35, 21, 23, 0, 0, 8, 0, 0 },
{ 33, 34, 36, 0, 0, 0, 0, 12, 12, 12, 0, 0 },
{ 34, 0, 0, 35, 37, 33, 36, 0, 0, 15, 0, 0 },
{ 35, 36, 38, 60, 39, 39, 40, 34, 37, 23, 0, 0 },
{ 36, 0, 0, 37, 41, 35, 38, 0, 0, 12, 0, 0 },
{ 37, 0, 0, 0, 0, 38, 42, 36, 41, 8, 0, 0 },
{ 38, 37, 42, 0, 0, 0, 0, 0, 0, 67, 0, 0 },
{ 39, 35, 40, 0, 0, 0, 0, 40, 43, 23, 0, 0 },
{ 40, 0, 0, 39, 43, 41, 44, 0, 0, 13, 0, 0 },
{ 41, 40, 44, 0, 0, 0, 0, 42, 45, 18, 0, 0 },
{ 42, 0, 0, 41, 45, 43, 46, 0, 0, 45, 0, 0 },
{ 43, 42, 46, 0, 0, 0, 0, 0, 0, 1, 52, 34 }, // act 1 trigger3 (dead-end) (link 34)
{ 44, 45, 47, 0, 0, 0, 0, 30, 34, 23, 0, 0 },
{ 45, 0, 0, 46, 48, 44, 47, 0, 0, 34, 0, 0 },
{ 46, 0, 0, 0, 0, 0, 0, 45, 48, 1, 54, 71 }, // act 1 trigger5 (dead-end) (link 71)
{ 47, 48, 49, 51, 50, 0, 0, 29, 32, 5, 0, 0 },
{ 48, 0, 0, 49, 51, 47, 49, 0, 0, 1, 53, 50 }, // act 1 trigger4 (elbow) (link 50)
{ 49, 52, 52, 50, 53, 0, 0, 48, 51, 34, 0, 0 },
{ 50, 54, 54, 0, 0, 51, 55, 49, 53, 67, 0, 0 },
{ 51, 50, 55, 0, 0, 0, 0, 47, 50, 78, 0, 0 },
{ 52, 56, 56, 54, 57, 49, 52, 53, 58, 79, 0, 0 },
{ 53, 0, 0, 52, 58, 0, 0, 0, 0, 80, 0, 0 },
{ 54, 55, 59, 0, 0, 50, 54, 52, 57, 90, 0, 0 },
{ 55, 0, 0, 0, 0, 54, 59, 0, 0, 14, 0, 0 },
{ 56, 0, 0, 57, 60, 52, 56, 0, 0, 56, 0, 0 },
{ 57, 58, 61, 0, 0, 0, 0, 56, 60, 13, 0, 0 },
{ 58, 0, 0, 59, 62, 57, 61, 0, 0, 80, 0, 0 },
{ 59, 0, 0, 0, 0, 0, 0, 58, 62, 25, 0, 0 },
{ 60, 0, 0, 0, 0, 61, 63, 35, 39, 23, 0, 0 },
{ 61, 60, 63, 62, 64, 64, 65, 0, 0, 13, 0, 0 },
{ 62, 63, 66, 0, 0, 0, 0, 61, 64, 45, 0, 0 },
{ 63, 0, 0, 0, 0, 62, 66, 0, 0, 80, 0, 0 },
{ 64, 61, 65, 0, 0, 67, 67, 65, 68, 24, 0, 0 },
{ 65, 0, 0, 64, 68, 66, 69, 0, 0, 78, 0, 0 },
{ 66, 65, 69, 67, 70, 68, 71, 0, 0, 12, 0, 0 },
{ 67, 64, 67, 0, 0, 0, 0, 66, 70, 23, 0, 0 },
{ 68, 66, 71, 69, 72, 70, 73, 0, 0, 13, 0, 0 },
{ 69, 0, 0, 0, 0, 0, 0, 68, 72, 90, 0, 0 },
{ 70, 68, 73, 0, 0, 0, 0, 71, 74, 23, 0, 0 },
{ 71, 0, 0, 70, 74, 0, 0, 72, 75, 1, 9, 71 }, // act 1 stairdown1 (link 71)
{ 72, 0, 0, 71, 75, 0, 0, 73, 76, 1, 10, 0 }, // act 1 stairup1
{ 73, 79, 77, 72, 76, 74, 78, 87, 79, 14, 0, 0 },
{ 74, 73, 78, 75, 80, 0, 0, 0, 0, 23, 0, 0 },
{ 75, 0, 0, 0, 0, 76, 81, 74, 80, 1, 23, 0 }, // act 1 blocked exit (trigger7)
{ 76, 75, 81, 77, 82, 0, 0, 0, 0, 12, 0, 0 },
{ 77, 78, 83, 0, 0, 0, 0, 76, 82, 6, 0, 0 },
{ 78, 0, 0, 0, 0, 77, 83, 1, 1, 3, 0, 0 },
{ 79, 0, 0, 0, 0, 73, 77, 80, 84, 45, 0, 0 },
{ 80, 0, 0, 79, 84, 81, 85, 0, 0, 48, 0, 0 },
{ 81, 80, 85, 82, 86, 0, 0, 0, 0, 47, 0, 0 },
{ 82, 83, 87, 96, 88, 88, 89, 81, 86, 13, 0, 0 },
{ 83, 85, 90, 84, 91, 82, 87, 0, 0, 21, 0, 0 },
{ 84, 0, 0, 0, 0, 0, 0, 83, 91, 90, 0, 0 },
{ 85, 0, 0, 86, 92, 83, 90, 0, 0, 13, 0, 0 },
{ 86, 0, 0, 0, 0, 87, 93, 85, 92, 16, 0, 0 },
{ 87, 86, 93, 73, 79, 0, 0, 0, 0, 14, 0, 0 },
{ 88, 82, 89, 0, 0, 0, 0, 89, 94, 23, 0, 0 },
{ 89, 0, 0, 88, 94, 90, 95, 0, 0, 21, 0, 0 },
{ 90, 89, 95, 91, 96, 0, 0, 0, 0, 26, 0, 0 },
{ 91, 92, 97, 0, 0, 0, 0, 90, 96, 32, 0, 0 },
{ 92, 0, 0, 93, 98, 91, 97, 0, 0, 21, 0, 0 },
{ 93, 94, 99, 0, 0, 0, 0, 92, 98, 24, 0, 0 },
{ 94, 0, 0, 0, 0, 93, 99, 95, 100, 34, 0, 0 },
{ 95, 0, 0, 94, 100, 0, 0, 0, 0, 1, 55, 88 }, // act 1 trigger6 (dead-end) (link 88)
{ 96, 0, 0, 0, 0, 97, 101, 82, 88, 16, 0, 0 },
{ 97, 96, 101, 120, 102, 101, 103, 98, 104, 14, 0, 0 },
{ 98, 0, 0, 97, 104, 99, 105, 0, 0, 34, 0, 0 },
{ 99, 98, 105, 0, 0, 0, 0, 100, 106, 49, 0, 0 },
{ 100, 0, 0, 99, 106, 0, 0, 0, 0, 69, 0, 0 },
{ 101, 97, 103, 109, 107, 108, 108, 102, 109, 23, 0, 0 },
{ 102, 103, 110, 101, 109, 0, 0, 0, 0, 34, 0, 0 },
{ 103, 0, 0, 0, 0, 102, 110, 104, 111, 45, 0, 0 },
{ 104, 0, 0, 103, 111, 105, 112, 0, 0, 59, 0, 0 },
{ 105, 104, 112, 0, 0, 107, 113, 106, 114, 23, 0, 0 },
{ 106, 0, 0, 105, 114, 0, 0, 0, 0, 75, 0, 0 },
{ 107, 105, 113, 108, 115, 0, 0, 0, 0, 23, 0, 0 },
{ 108, 101, 108, 0, 0, 0, 0, 107, 115, 64, 0, 0 },
{ 109, 118, 116, 110, 117, 111, 118, 101, 107, 23, 0, 0 },
{ 110, 0, 0, 0, 0, 0, 0, 109, 117, 87, 0, 0 },
{ 111, 109, 118, 112, 119, 0, 0, 0, 0, 46, 0, 0 },
{ 112, 113, 120, 0, 0, 0, 0, 111, 119, 12, 0, 0 },
{ 113, 0, 0, 114, 121, 112, 120, 0, 0, 53, 0, 0 },
{ 114, 115, 122, 0, 0, 0, 0, 113, 121, 38, 0, 0 },
{ 115, 0, 0, 0, 0, 114, 122, 116, 123, 15, 0, 0 },
{ 116, 0, 0, 115, 123, 117, 124, 118, 125, 29, 0, 0 },
{ 117, 116, 124, 0, 0, 0, 0, 0, 0, 94, 0, 0 },
{ 118, 120, 126, 116, 125, 109, 116, 119, 127, 31, 0, 0 },
{ 119, 0, 0, 118, 127, 0, 0, 0, 0, 85, 0, 0 },
{ 120, 121, 128, 0, 0, 118, 126, 97, 102, 26, 0, 0 },
{ 121, 0, 0, 124, 129, 120, 128, 122, 130, 53, 0, 0 },
{ 122, 123, 131, 121, 130, 0, 0, 0, 0, 23, 0, 0 },
{ 123, 0, 0, 0, 0, 122, 131, 0, 0, 1, 56, 81 }, // act 1 trigger7 (dead-end) (link 81)
{ 124, 0, 0, 0, 0, 125, 132, 121, 129, 63, 0, 0 },
{ 125, 124, 132, 126, 133, 0, 0, 0, 0, 49, 0, 0 },
{ 126, 0, 0, 0, 0, 127, 134, 125, 133, 71, 0, 0 },
{ 127, 126, 134, 0, 0, 0, 0, 0, 0, 16, 0, 0 },
{ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
};
//
// This is the static position id list for 01 Act 2..
//
struct mapdata_posdatastatic gstructMapPosStatic01Act2[] =
{
// id, Nid, Nlk, Eid, Elk, Sid, Slk, Wid, Wlk, Pe, Spc, Clk
{ 1, 0, 0, 0, 0, 0, 0, 137, 1, 1, 3, 0 }, // act 2 end
{ 2, 0, 0, 0, 0, 3, 2, 0, 0, 1, 4, 0 }, // act 2 start
{ 3, 2, 2, 4, 3, 0, 0, 9, 4, 1, 24, 0 }, // act 2 first monster point
{ 4, 5, 5, 0, 0, 0, 0, 3, 3, 14, 0, 0 },
{ 5, 0, 0, 6, 6, 4, 5, 0, 0, 16, 0, 0 },
{ 6, 0, 0, 7, 7, 15, 8, 5, 6, 12, 0, 0 },
{ 7, 0, 0, 0, 0, 8, 9, 6, 7, 28, 0, 0 },
{ 8, 7, 9, 0, 0, 0, 0, 0, 0, 36, 0, 0 },
{ 9, 10, 10, 3, 4, 0, 0, 0, 0, 32, 0, 0 },
{ 10, 0, 0, 0, 0, 9, 10, 11, 11, 41, 0, 0 },
{ 11, 0, 0, 10, 11, 12, 12, 0, 0, 50, 0, 0 },
{ 12, 11, 12, 13, 13, 0, 0, 0, 0, 46, 0, 0 },
{ 13, 0, 0, 14, 14, 16, 15, 12, 13, 38, 0, 0 },
{ 14, 0, 0, 15, 16, 34, 17, 13, 14, 23, 0, 0 },
{ 15, 6, 8, 0, 0, 0, 0, 14, 16, 19, 0, 0 },
{ 16, 13, 15, 34, 39, 0, 0, 17, 18, 45, 0, 0 },
{ 17, 0, 0, 16, 18, 18, 19, 0, 0, 41, 0, 0 },
{ 18, 17, 19, 19, 20, 0, 0, 0, 0, 59, 0, 0 },
{ 19, 20, 21, 0, 0, 0, 0, 18, 20, 68, 0, 0 },
{ 20, 0, 0, 21, 22, 19, 21, 0, 0, 79, 0, 0 },
{ 21, 0, 0, 0, 0, 22, 23, 20, 22, 48, 0, 0 },
{ 22, 21, 23, 23, 24, 0, 0, 0, 0, 51, 0, 0 },
{ 23, 0, 0, 0, 0, 24, 25, 22, 24, 57, 0, 0 },
{ 24, 23, 25, 25, 26, 0, 0, 0, 0, 25, 0, 0 },
{ 25, 74, 27, 26, 28, 0, 0, 24, 26, 21, 0, 0 },
{ 26, 0, 0, 0, 0, 27, 29, 25, 28, 19, 0, 0 },
{ 27, 26, 29, 28, 30, 0, 0, 29, 31, 26, 0, 0 },
{ 28, 0, 0, 0, 0, 0, 0, 27, 30, 95, 0, 0 },
{ 29, 30, 32, 27, 31, 0, 0, 0, 0, 25, 0, 0 },
{ 30, 0, 0, 0, 0, 29, 32, 31, 33, 21, 0, 0 },
{ 31, 0, 0, 30, 33, 32, 34, 0, 0, 20, 0, 0 },
{ 32, 31, 34, 0, 0, 0, 0, 33, 35, 18, 0, 0 },
{ 33, 75, 36, 32, 35, 0, 0, 0, 0, 1, 11, 0 }, // act 2 stairdown1
{ 34, 14, 17, 37, 37, 35, 38, 16, 39, 23, 0, 0 },
{ 35, 34, 38, 36, 40, 0, 0, 0, 0, 85, 0, 0 },
{ 36, 0, 0, 0, 0, 0, 0, 35, 40, 1, 61, 27 }, // act 2 trigger1 (dead-end) (link 27)
{ 37, 38, 41, 0, 0, 0, 0, 34, 37, 14, 0, 0 },
{ 38, 0, 0, 39, 42, 37, 41, 0, 0, 21, 0, 0 },
{ 39, 40, 43, 41, 44, 0, 0, 38, 42, 17, 0, 0 },
{ 40, 0, 0, 0, 0, 39, 43, 0, 0, 56, 0, 0 },
{ 41, 47, 45, 42, 46, 43, 47, 39, 44, 16, 0, 0 },
{ 42, 0, 0, 0, 0, 0, 0, 41, 46, 69, 0, 0 },
{ 43, 41, 47, 0, 0, 0, 0, 44, 48, 45, 0, 0 },
{ 44, 0, 0, 43, 48, 45, 49, 0, 0, 58, 0, 0 },
{ 45, 44, 49, 0, 0, 0, 0, 46, 50, 39, 0, 0 },
{ 46, 0, 0, 45, 50, 0, 0, 0, 0, 1, 62, 24 }, // act 2 trigger2 (dead-end) (link 24)
{ 47, 0, 0, 48, 51, 41, 45, 0, 0, 17, 0, 0 },
{ 48, 53, 52, 0, 0, 49, 53, 47, 51, 19, 0, 0 },
{ 49, 48, 53, 0, 0, 0, 0, 50, 54, 37, 0, 0 },
{ 50, 0, 0, 49, 54, 51, 55, 0, 0, 50, 0, 0 },
{ 51, 50, 55, 0, 0, 0, 0, 52, 56, 82, 0, 0 },
{ 52, 0, 0, 51, 56, 0, 0, 0, 0, 18, 0, 0 },
{ 53, 0, 0, 0, 0, 48, 52, 54, 57, 21, 0, 0 },
{ 54, 55, 58, 53, 57, 0, 0, 0, 0, 22, 0, 0 },
{ 55, 0, 0, 56, 59, 54, 58, 0, 0, 25, 0, 0 },
{ 56, 57, 60, 0, 0, 58, 61, 55, 59, 16, 0, 0 },
{ 57, 0, 0, 0, 0, 56, 60, 0, 0, 42, 0, 0 },
{ 58, 56, 61, 59, 62, 0, 0, 0, 0, 17, 0, 0 },
{ 59, 0, 0, 0, 0, 60, 63, 58, 62, 14, 0, 0 },
{ 60, 59, 63, 0, 0, 0, 0, 61, 64, 13, 0, 0 },
{ 61, 0, 0, 60, 64, 62, 65, 0, 0, 10, 0, 0 },
{ 62, 61, 65, 63, 66, 64, 67, 0, 0, 9, 0, 0 },
{ 63, 0, 0, 0, 0, 0, 0, 62, 66, 73, 0, 0 },
{ 64, 62, 67, 0, 0, 0, 0, 65, 68, 16, 0, 0 },
{ 65, 0, 0, 64, 68, 66, 69, 0, 0, 29, 0, 0 },
{ 66, 65, 69, 67, 70, 0, 0, 72, 71, 41, 0, 0 },
{ 67, 68, 72, 0, 0, 0, 0, 66, 70, 51, 0, 0 },
{ 68, 0, 0, 69, 73, 67, 72, 0, 0, 58, 0, 0 },
{ 69, 0, 0, 0, 0, 70, 74, 68, 73, 67, 0, 0 },
{ 70, 69, 74, 0, 0, 0, 0, 71, 75, 63, 0, 0 },
{ 71, 0, 0, 70, 75, 0, 0, 0, 0, 38, 0, 0 },
{ 72, 73, 76, 66, 71, 0, 0, 0, 0, 21, 0, 0 },
{ 73, 0, 0, 0, 0, 72, 76, 74, 77, 73, 0, 0 },
{ 74, 0, 0, 73, 77, 25, 27, 0, 0, 23, 0, 0 },
{ 75, 0, 0, 0, 0, 33, 36, 76, 78, 1, 12, 0 }, // act 2 stairup1
{ 76, 0, 0, 75, 78, 81, 79, 77, 80, 12, 0, 0 },
{ 77, 0, 0, 76, 80, 78, 81, 0, 0, 10, 0, 0 },
{ 78, 77, 81, 81, 82, 111, 83, 79, 84, 8, 0, 0 },
{ 79, 80, 85, 78, 84, 0, 0, 122, 86, 56, 0, 0 },
{ 80, 0, 0, 0, 0, 79, 85, 0, 0, 94, 0, 0 },
{ 81, 76, 79, 82, 87, 83, 88, 78, 82, 97, 0, 0 },
{ 82, 0, 0, 0, 0, 0, 0, 81, 87, 1, 63, 89 }, // act 2 trigger3 (dead-end) (link 89)
{ 83, 81, 88, 84, 89, 102, 90, 111, 91, 95, 0, 0 },
{ 84, 0, 0, 85, 92, 95, 93, 83, 89, 16, 0, 0 },
{ 85, 87, 94, 86, 95, 90, 96, 84, 92, 23, 0, 0 },
{ 86, 0, 0, 0, 0, 0, 0, 85, 95, 63, 0, 0 },
{ 87, 0, 0, 88, 97, 85, 94, 0, 0, 65, 0, 0 },
{ 88, 89, 98, 0, 0, 0, 0, 87, 97, 84, 0, 0 },
{ 89, 0, 0, 0, 0, 88, 98, 0, 0, 30, 0, 0 },
{ 90, 85, 96, 91, 99, 92, 100, 0, 0, 15, 0, 0 },
{ 91, 0, 0, 0, 0, 0, 0, 90, 99, 1, 64, 101 }, // act 2 trigger4 (dead-end) (link 101)
{ 92, 90, 100, 93, 101, 0, 0, 96, 102, 25, 0, 0 },
{ 93, 0, 0, 0, 0, 94, 103, 92, 101, 21, 0, 0 },
{ 94, 93, 103, 0, 0, 0, 0, 0, 0, 1, 65, 111 }, // act 2 trigger5 (dead-end) (link 111)
{ 95, 84, 93, 0, 0, 96, 104, 102, 105, 18, 0, 0 },
{ 96, 95, 104, 92, 102, 97, 106, 103, 107, 23, 0, 0 },
{ 97, 96, 106, 99, 108, 98, 109, 104, 110, 59, 0, 0 },
{ 98, 97, 109, 0, 0, 0, 0, 0, 0, 96, 0, 0 },
{ 99, 0, 0, 0, 0, 100, 111, 97, 108, 23, 0, 0 },
{ 100, 99, 111, 0, 0, 0, 0, 101, 112, 18, 0, 0 },
{ 101, 0, 0, 100, 112, 0, 0, 0, 0, 1, 66, 118 }, // act 2 trigger6 (dead-end) (link 118)
{ 102, 83, 90, 95, 105, 103, 113, 114, 114, 21, 0, 0 },
{ 103, 102, 113, 96, 107, 104, 115, 115, 116, 27, 0, 0 },
{ 104, 103, 115, 97, 110, 0, 0, 105, 117, 28, 0, 0 },
{ 105, 0, 0, 104, 117, 106, 118, 0, 0, 69, 0, 0 },
{ 106, 105, 118, 0, 0, 0, 0, 107, 119, 21, 0, 0 },
{ 107, 108, 120, 106, 119, 0, 0, 0, 0, 15, 0, 0 },
{ 108, 0, 0, 0, 0, 107, 120, 109, 121, 8, 0, 0 },
{ 109, 110, 122, 108, 121, 0, 0, 0, 0, 6, 0, 0 },
{ 110, 0, 0, 0, 0, 109, 122, 0, 0, 1, 67, 132 }, // act 2 trigger7 (dead-end) (link 132)
{ 111, 78, 83, 83, 91, 0, 0, 112, 123, 15, 0, 0 },
{ 112, 0, 0, 111, 123, 113, 124, 121, 125, 68, 0, 0 },
{ 113, 112, 124, 114, 126, 0, 0, 120, 127, 21, 0, 0 },
{ 114, 0, 0, 102, 114, 115, 128, 113, 126, 18, 0, 0 },
{ 115, 114, 128, 103, 116, 0, 0, 116, 129, 13, 0, 0 },
{ 116, 0, 0, 115, 129, 117, 130, 0, 0, 12, 0, 0 },
{ 117, 116, 130, 0, 0, 0, 0, 0, 0, 9, 0, 0 },
{ 118, 0, 0, 0, 0, 119, 131, 0, 0, 1, 68, 135 }, // act 2 trigger8 (dead-end) (link 135)
{ 119, 118, 131, 120, 132, 0, 0, 0, 0, 12, 0, 0 },
{ 120, 121, 133, 113, 127, 0, 0, 119, 132, 18, 0, 0 },
{ 121, 122, 134, 112, 125, 120, 133, 0, 0, 24, 0, 0 },
{ 122, 123, 135, 79, 86, 121, 134, 0, 0, 14, 0, 0 },
{ 123, 0, 0, 0, 0, 122, 135, 124, 136, 5, 0, 0 },
{ 124, 0, 0, 123, 136, 125, 137, 0, 0, 9, 0, 0 },
{ 125, 124, 137, 0, 0, 0, 0, 126, 138, 27, 0, 0 },
{ 126, 127, 139, 125, 138, 128, 140, 133, 141, 17, 0, 0 },
{ 127, 0, 0, 0, 0, 126, 139, 0, 0, 63, 0, 0 },
{ 128, 126, 140, 0, 0, 0, 0, 129, 142, 13, 0, 0 },
{ 129, 0, 0, 128, 142, 130, 143, 0, 0, 25, 0, 0 },
{ 130, 129, 143, 131, 144, 0, 0, 0, 0, 48, 0, 0 },
{ 131, 132, 145, 0, 0, 0, 0, 130, 144, 31, 0, 0 },
{ 132, 0, 0, 0, 0, 131, 145, 0, 0, 1, 69, 141 }, // act 2 trigger9 (dead-end) (link 141)
{ 133, 0, 0, 126, 141, 134, 146, 0, 0, 26, 0, 0 },
{ 134, 133, 146, 0, 0, 135, 147, 0, 0, 1, 25, 0 }, // act 2 monster step point
{ 135, 134, 147, 136, 148, 0, 0, 0, 0, 8, 0, 0 },
{ 136, 0, 0, 0, 0, 137, 149, 135, 148, 1, 13, 0 }, // act 2 stairdown2
{ 137, 136, 149, 1, 1, 0, 0, 0, 0, 1, 14, 0 }, // act 2 stairup2
{ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
};
//
// This is the static position id list for 01 Act 3..
//
struct mapdata_posdatastatic gstructMapPosStatic01Act3[] =
{
// id, Nid, Nlk, Eid, Elk, Sid, Slk, Wid, Wlk, Pe, Spc, Clk
{ 1, 0, 0, 0, 0, 0, 0, 93, 1, 1, 5, 0 }, // act 3 end
{ 2, 0, 0, 3, 2, 0, 0, 0, 0, 1, 6, 0 }, // act 3 start
{ 3, 0, 0, 4, 3, 0, 0, 2, 2, 1, 29, 0 }, // act 3 first monster point
{ 4, 5, 4, 6, 5, 38, 11, 3, 3, 17, 0, 0 },
{ 5, 0, 0, 0, 0, 4, 4, 0, 0, 84, 0, 0 },
{ 6, 7, 6, 9, 7, 0, 0, 4, 5, 16, 0, 0 },
{ 7, 0, 0, 8, 8, 6, 6, 0, 0, 32, 0, 0 },
{ 8, 0, 0, 0, 0, 0, 0, 7, 8, 95, 0, 0 },
{ 9, 0, 0, 10, 9, 34, 10, 6, 7, 23, 0, 0 },
{ 10, 11, 12, 0, 0, 0, 0, 9, 9, 54, 0, 0 },
{ 11, 0, 0, 12, 13, 10, 12, 0, 0, 16, 0, 0 },
{ 12, 0, 0, 13, 14, 16, 15, 11, 13, 12, 0, 0 },
{ 13, 0, 0, 0, 0, 14, 16, 12, 14, 34, 0, 0 },
{ 14, 13, 16, 15, 17, 0, 0, 0, 0, 1, 71, 25 }, // act 3 trigger1 (elbow) (link 25)
{ 15, 0, 0, 0, 0, 0, 0, 14, 17, 87, 0, 0 },
{ 16, 12, 15, 17, 18, 18, 19, 0, 0, 13, 0, 0 },
{ 17, 0, 0, 0, 0, 0, 0, 16, 18, 63, 0, 0 },
{ 18, 16, 19, 0, 0, 0, 0, 19, 20, 26, 0, 0 },
{ 19, 0, 0, 18, 20, 20, 21, 34, 22, 14, 0, 0 },
{ 20, 19, 21, 21, 24, 0, 0, 35, 23, 18, 0, 0 },
{ 21, 0, 0, 0, 0, 22, 25, 20, 24, 19, 0, 0 },
{ 22, 21, 25, 23, 26, 0, 0, 26, 27, 43, 0, 0 },
{ 23, 24, 28, 0, 0, 0, 0, 22, 26, 64, 0, 0 },
{ 24, 0, 0, 25, 29, 23, 28, 0, 0, 73, 0, 0 },
{ 25, 0, 0, 0, 0, 0, 0, 24, 29, 84, 0, 0 },
{ 26, 0, 0, 22, 27, 27, 30, 0, 0, 34, 0, 0 },
{ 27, 26, 30, 28, 31, 0, 0, 0, 0, 21, 0, 0 },
{ 28, 0, 0, 29, 32, 30, 33, 27, 31, 43, 0, 0 },
{ 29, 0, 0, 0, 0, 0, 0, 28, 32, 89, 0, 0 },
{ 30, 28, 33, 0, 0, 0, 0, 31, 34, 12, 0, 0 },
{ 31, 32, 35, 30, 34, 0, 0, 0, 0, 21, 0, 0 },
{ 32, 0, 0, 0, 0, 31, 35, 33, 36, 36, 0, 0 },
{ 33, 0, 0, 32, 36, 0, 0, 0, 0, 1, 72, 54 }, // act 3 trigger2 (dead-end) (link 54)
{ 34, 9, 10, 19, 22, 35, 37, 37, 38, 34, 0, 0 },
{ 35, 34, 37, 20, 23, 0, 0, 36, 39, 24, 0, 0 },
{ 36, 37, 40, 35, 39, 48, 41, 0, 0, 23, 0, 0 },
{ 37, 0, 0, 34, 38, 36, 40, 38, 42, 89, 0, 0 },
{ 38, 4, 11, 37, 42, 42, 46, 39, 43, 67, 0, 0 },
{ 39, 0, 0, 38, 43, 40, 44, 0, 0, 87, 0, 0 },
{ 40, 39, 44, 0, 0, 0, 0, 0, 0, 95, 0, 0 },
{ 41, 0, 0, 42, 45, 0, 0, 0, 0, 98, 0, 0 },
{ 42, 38, 46, 0, 0, 43, 47, 41, 45, 32, 0, 0 },
{ 43, 42, 47, 48, 48, 45, 49, 44, 50, 27, 0, 0 },
{ 44, 0, 0, 43, 50, 0, 0, 0, 0, 85, 0, 0 },
{ 45, 43, 49, 0, 0, 0, 0, 46, 51, 43, 0, 0 },
{ 46, 0, 0, 45, 51, 47, 52, 0, 0, 62, 0, 0 },
{ 47, 46, 52, 0, 0, 0, 0, 0, 0, 89, 0, 0 },
{ 48, 36, 41, 49, 53, 50, 54, 43, 48, 75, 0, 0 },
{ 49, 0, 0, 0, 0, 0, 0, 48, 53, 14, 0, 0 },
{ 50, 48, 54, 51, 55, 0, 0, 0, 0, 12, 0, 0 },
{ 51, 52, 56, 0, 0, 0, 0, 50, 55, 1, 15, 0 }, // act 3 stairdown1
{ 52, 53, 57, 0, 0, 51, 56, 0, 0, 1, 16, 0 }, // act 3 stairup1
{ 53, 0, 0, 0, 0, 52, 57, 54, 58, 1, 26, 0 }, // act 3 elbow with collapse
{ 54, 0, 0, 53, 58, 59, 59, 55, 60, 1, 27, 0 }, // act 3 t-intersect with collapse
{ 55, 0, 0, 54, 60, 56, 61, 0, 0, 13, 0, 0 },
{ 56, 55, 61, 59, 62, 57, 63, 0, 0, 14, 0, 0 },
{ 57, 56, 63, 58, 64, 0, 0, 0, 0, 21, 0, 0 },
{ 58, 0, 0, 61, 65, 62, 66, 57, 64, 24, 0, 0 },
{ 59, 54, 59, 60, 67, 0, 0, 56, 62, 16, 0, 0 },
{ 60, 0, 0, 0, 0, 61, 68, 59, 67, 18, 0, 0 },
{ 61, 60, 68, 0, 0, 63, 69, 58, 65, 14, 0, 0 },
{ 62, 58, 66, 63, 70, 0, 0, 0, 0, 1, 73, 71 }, // act 3 trigger3 (elbow) (link 71)
{ 63, 61, 69, 64, 71, 0, 0, 62, 70, 12, 0, 0 },
{ 64, 65, 72, 67, 73, 0, 0, 63, 71, 56, 0, 0 },
{ 65, 66, 74, 68, 75, 64, 72, 0, 0, 59, 0, 0 },
{ 66, 0, 0, 69, 76, 65, 74, 0, 0, 1, 74, 84 }, // act 3 trigger4 (elbow) (link 84)
{ 67, 68, 77, 0, 0, 0, 0, 64, 73, 60, 0, 0 },
{ 68, 0, 0, 70, 78, 67, 77, 65, 75, 61, 0, 0 },
{ 69, 73, 79, 71, 80, 0, 0, 66, 76, 63, 0, 0 },
{ 70, 71, 81, 0, 0, 0, 0, 68, 78, 71, 0, 0 },
{ 71, 72, 82, 0, 0, 70, 81, 69, 80, 79, 0, 0 },
{ 72, 0, 0, 0, 0, 71, 82, 73, 83, 73, 0, 0 },
{ 73, 74, 84, 72, 83, 69, 79, 0, 0, 1, 28, 0 }, // act 3 t-intersect with collapse2
{ 74, 76, 85, 75, 86, 73, 84, 78, 87, 34, 0, 0 },
{ 75, 0, 0, 0, 0, 0, 0, 74, 86, 1, 75, 97 }, // act 3 trigger5 (dead-end) (link 97)
{ 76, 0, 0, 0, 0, 74, 85, 77, 88, 12, 0, 0 },
{ 77, 0, 0, 76, 88, 78, 89, 80, 90, 12, 0, 0 },
{ 78, 77, 89, 74, 87, 0, 0, 79, 91, 98, 0, 0 },
{ 79, 80, 92, 78, 91, 0, 0, 82, 95, 89, 0, 0 },
{ 80, 0, 0, 77, 90, 79, 92, 81, 93, 23, 0, 0 },
{ 81, 0, 0, 80, 93, 82, 94, 0, 0, 27, 0, 0 },
{ 82, 81, 94, 79, 95, 0, 0, 83, 96, 1, 28, 0 }, // act 3 t-intersect with collapse2
{ 83, 84, 97, 82, 96, 0, 0, 0, 0, 20, 0, 0 },
{ 84, 0, 0, 0, 0, 83, 97, 85, 98, 23, 0, 0 },
{ 85, 86, 99, 84, 98, 0, 0, 0, 0, 46, 0, 0 },
{ 86, 0, 0, 87, 100, 85, 99, 0, 0, 12, 0, 0 },
{ 87, 88, 101, 0, 0, 0, 0, 86, 100, 13, 0, 0 },
{ 88, 0, 0, 89, 102, 87, 101, 0, 0, 17, 0, 0 },
{ 89, 0, 0, 0, 0, 90, 103, 88, 102, 18, 0, 0 },
{ 90, 89, 103, 91, 104, 0, 0, 0, 0, 26, 0, 0 },
{ 91, 92, 105, 0, 0, 0, 0, 90, 104, 15, 0, 0 },
{ 92, 0, 0, 93, 106, 91, 105, 0, 0, 1, 17, 0 }, // act 3 stairdown2
{ 93, 0, 0, 1, 1, 0, 0, 92, 106, 1, 18, 0 }, // act 3 stairup2
{ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
};
//
// This is the static position id list for 01 Act 4..
//
struct mapdata_posdatastatic gstructMapPosStatic01Act4[] =
{
// id, Nid, Nlk, Eid, Elk, Sid, Slk, Wid, Wlk, Pe, Spc, Clk
{ 1, 0, 0, 0, 0, 57, 1, 0, 0, 1, 7, 0 }, // act 4 end
{ 2, 0, 0, 0, 0, 3, 2, 0, 0, 1, 8, 0 }, // act 4 start
{ 3, 2, 2, 13, 3, 11, 4, 4, 5, 5, 0, 0 },
{ 4, 0, 0, 3, 5, 5, 6, 0, 0, 3, 0, 0 },
{ 5, 4, 6, 11, 7, 7, 8, 6, 9, 2, 0, 0 },
{ 6, 0, 0, 5, 9, 0, 0, 0, 0, 89, 0, 0 },
{ 7, 5, 8, 0, 0, 9, 10, 8, 11, 3, 0, 0 },
{ 8, 0, 0, 7, 11, 0, 0, 0, 0, 1, 31, 0 }, // stairs back up to act 3
{ 9, 7, 10, 10, 12, 0, 0, 0, 0, 15, 0, 0 },
{ 10, 11, 13, 0, 0, 0, 0, 9, 12, 23, 0, 0 },
{ 11, 3, 4, 12, 14, 10, 13, 5, 7, 10, 0, 0 },
{ 12, 13, 15, 14, 16, 15, 17, 11, 14, 12, 0, 0 },
{ 13, 0, 0, 0, 0, 12, 15, 3, 3, 23, 0, 0 },
{ 14, 0, 0, 0, 0, 0, 0, 12, 16, 98, 0, 0 },
{ 15, 12, 17, 0, 0, 16, 18, 0, 0, 1, 19, 0 }, // act 4 stairdown1
{ 16, 15, 18, 0, 0, 17, 19, 0, 0, 1, 20, 0 }, // act 4 stairup1
{ 17, 16, 19, 0, 0, 0, 0, 18, 20, 23, 0, 0 },
{ 18, 0, 0, 17, 20, 19, 21, 0, 0, 25, 0, 0 },
{ 19, 18, 21, 22, 22, 20, 23, 0, 0, 26, 0, 0 },
{ 20, 19, 23, 30, 24, 21, 25, 0, 0, 32, 0, 0 },
{ 21, 20, 25, 0, 0, 0, 0, 0, 0, 98, 0, 0 },
{ 22, 0, 0, 23, 26, 30, 27, 19, 22, 34, 0, 0 },
{ 23, 24, 28, 0, 0, 0, 0, 22, 26, 45, 0, 0 },
{ 24, 0, 0, 25, 29, 23, 28, 0, 0, 14, 0, 0 },
{ 25, 26, 30, 0, 0, 0, 0, 24, 29, 32, 0, 0 },
{ 26, 29, 31, 0, 0, 25, 30, 27, 32, 56, 0, 0 },
{ 27, 28, 33, 26, 32, 0, 0, 0, 0, 42, 0, 0 },
{ 28, 0, 0, 29, 34, 27, 33, 0, 0, 78, 0, 0 },
{ 29, 0, 0, 0, 0, 26, 31, 28, 34, 64, 0, 0 },
{ 30, 22, 27, 31, 35, 32, 36, 20, 24, 20, 0, 0 },
{ 31, 0, 0, 0, 0, 33, 37, 30, 35, 14, 0, 0 },
{ 32, 30, 36, 33, 38, 0, 0, 0, 0, 97, 0, 0 },
{ 33, 31, 37, 42, 39, 34, 40, 32, 38, 24, 0, 0 },
{ 34, 33, 40, 36, 41, 0, 0, 35, 42, 45, 0, 0 },
{ 35, 0, 0, 34, 42, 0, 0, 0, 0, 98, 0, 0 },
{ 36, 42, 43, 37, 44, 0, 0, 34, 41, 41, 0, 0 },
{ 37, 40, 45, 38, 46, 0, 0, 36, 44, 23, 0, 0 },
{ 38, 39, 47, 0, 0, 0, 0, 37, 46, 56, 0, 0 },
{ 39, 41, 48, 0, 0, 38, 47, 40, 49, 68, 0, 0 },
{ 40, 0, 0, 39, 49, 37, 45, 0, 0, 73, 0, 0 },
{ 41, 0, 0, 0, 0, 39, 48, 0, 0, 87, 0, 0 },
{ 42, 43, 50, 0, 0, 36, 43, 33, 39, 23, 0, 0 },
{ 43, 45, 51, 44, 52, 42, 50, 0, 0, 14, 0, 0 },
{ 44, 0, 0, 0, 0, 0, 0, 43, 52, 96, 0, 0 },
{ 45, 0, 0, 46, 53, 43, 51, 0, 0, 10, 0, 0 },
{ 46, 47, 54, 0, 0, 0, 0, 45, 53, 8, 0, 0 },
{ 47, 0, 0, 48, 55, 46, 54, 0, 0, 1, 30, 0 }, // act 4 ginger encounter
{ 48, 49, 56, 0, 0, 53, 57, 47, 55, 7, 0, 0 },
{ 49, 52, 58, 0, 0, 48, 56, 50, 59, 23, 0, 0 },
{ 50, 51, 60, 49, 59, 0, 0, 0, 0, 45, 0, 0 },
{ 51, 0, 0, 52, 61, 50, 60, 0, 0, 89, 0, 0 },
{ 52, 0, 0, 0, 0, 49, 58, 51, 61, 38, 0, 0 },
{ 53, 48, 57, 54, 62, 0, 0, 0, 0, 23, 0, 0 },
{ 54, 56, 63, 55, 64, 58, 65, 53, 62, 34, 0, 0 },
{ 55, 0, 0, 0, 0, 0, 0, 54, 64, 96, 0, 0 },
{ 56, 0, 0, 57, 66, 54, 63, 0, 0, 3, 0, 0 },
{ 57, 1, 1, 0, 0, 0, 0, 56, 66, 3, 0, 0 },
{ 58, 54, 65, 59, 67, 0, 0, 0, 0, 21, 0, 0 },
{ 59, 0, 0, 60, 68, 62, 69, 58, 67, 17, 0, 0 },
{ 60, 0, 0, 0, 0, 0, 0, 59, 68, 98, 0, 0 },
{ 61, 0, 0, 62, 70, 0, 0, 0, 0, 86, 0, 0 },
{ 62, 59, 69, 63, 71, 65, 72, 61, 70, 43, 0, 0 },
{ 63, 0, 0, 0, 0, 64, 73, 62, 71, 23, 0, 0 },
{ 64, 63, 73, 0, 0, 0, 0, 65, 74, 64, 0, 0 },
{ 65, 62, 72, 64, 74, 0, 0, 66, 75, 46, 0, 0 },
{ 66, 0, 0, 65, 75, 0, 0, 0, 0, 98, 0, 0 },
{ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
};
//
// This is the static position id list for 02 Act 1..
//
struct mapdata_posdatastatic gstructMapPosStatic02Act1[] =
{
// id, Nid, Nlk, Eid, Elk, Sid, Slk, Wid, Wlk, Pe, Spc, Clk
{ 1, 0, 0, 0, 0, 0, 0, 92, 1, 1, 1, 0 }, // act 1 end
{ 2, 4, 3, 3, 2, 9, 4, 0, 0, 1, 2, 0 }, // act 1 start
{ 3, 0, 0, 0, 0, 0, 0, 2, 2, 1, 21, 0 }, // act 1 blocked entrance
{ 4, 0, 0, 7, 5, 2, 3, 5, 6, 32, 0, 0 },
{ 5, 6, 7, 4, 6, 0, 0, 35, 8, 41, 0, 0 },
{ 6, 0, 0, 0, 0, 5, 7, 0, 0, 53, 0, 0 },
{ 7, 8, 9, 0, 0, 0, 0, 4, 5, 45, 0, 0 },
{ 8, 0, 0, 0, 0, 7, 9, 0, 0, 62, 0, 0 },
{ 9, 2, 4, 0, 0, 0, 0, 10, 10, 21, 0, 0 },
{ 10, 11, 11, 9, 10, 12, 12, 0, 0, 1, 22, 0 }, // act 1 first monster t-intersection
{ 11, 0, 0, 0, 0, 10, 11, 0, 0, 1, 50, 12 }, // act 1 first monster trap trigger (link 12)
{ 12, 10, 12, 55, 13, 0, 0, 13, 14, 14, 0, 0 },
{ 13, 20, 15, 12, 14, 14, 16, 0, 0, 18, 0, 0 },
{ 14, 13, 16, 15, 17, 0, 0, 0, 0, 21, 0, 0 },
{ 15, 0, 0, 18, 18, 16, 19, 14, 17, 19, 0, 0 },
{ 16, 15, 19, 0, 0, 0, 0, 17, 20, 32, 0, 0 },
{ 17, 0, 0, 16, 20, 0, 0, 0, 0, 47, 0, 0 },
{ 18, 55, 21, 19, 22, 0, 0, 15, 18, 24, 0, 0 },
{ 19, 0, 0, 0, 0, 0, 0, 18, 22, 1, 54, 59 }, // act 1 trigger5 (dead-end) (link 59)
{ 20, 36, 23, 0, 0, 13, 15, 21, 24, 1, 51, 8 }, // act 1 trigger2 (elbow) (link 8)
{ 21, 0, 0, 20, 24, 22, 25, 0, 0, 34, 0, 0 },
{ 22, 21, 25, 0, 0, 0, 0, 23, 26, 26, 0, 0 },
{ 23, 0, 0, 22, 26, 24, 27, 0, 0, 1, 52, 23 }, // act 1 trigger3 (elbow) (link 23)
{ 24, 23, 27, 25, 28, 0, 0, 0, 0, 28, 0, 0 },
{ 25, 0, 0, 0, 0, 26, 29, 24, 28, 29, 0, 0 },
{ 26, 25, 29, 27, 30, 0, 0, 0, 0, 31, 0, 0 },
{ 27, 0, 0, 0, 0, 28, 31, 26, 30, 35, 0, 0 },
{ 28, 27, 31, 29, 32, 0, 0, 0, 0, 37, 0, 0 },
{ 29, 30, 33, 0, 0, 0, 0, 28, 32, 39, 0, 0 },
{ 30, 0, 0, 31, 34, 29, 33, 0, 0, 1, 53, 22 }, // act 1 trigger4 (elbow) (link 22)
{ 31, 0, 0, 33, 35, 32, 36, 30, 34, 47, 0, 0 },
{ 32, 31, 36, 0, 0, 0, 0, 0, 0, 73, 0, 0 },
{ 33, 0, 0, 0, 0, 34, 37, 31, 35, 78, 0, 0 },
{ 34, 33, 37, 0, 0, 0, 0, 0, 0, 96, 0, 0 },
{ 35, 0, 0, 5, 8, 36, 38, 0, 0, 67, 0, 0 },
{ 36, 35, 38, 0, 0, 20, 23, 37, 39, 45, 0, 0 },
{ 37, 38, 40, 36, 39, 0, 0, 40, 41, 13, 0, 0 },
{ 38, 0, 0, 0, 0, 37, 40, 39, 42, 68, 0, 0 },
{ 39, 0, 0, 38, 42, 40, 43, 44, 44, 46, 0, 0 },
{ 40, 39, 43, 37, 41, 41, 45, 0, 0, 23, 0, 0 },
{ 41, 40, 45, 0, 0, 0, 0, 42, 46, 68, 0, 0 },
{ 42, 43, 47, 41, 46, 0, 0, 0, 0, 73, 0, 0 },
{ 43, 44, 48, 0, 0, 42, 47, 45, 49, 54, 0, 0 },
{ 44, 0, 0, 39, 44, 43, 48, 0, 0, 83, 0, 0 },
{ 45, 0, 0, 43, 49, 46, 50, 0, 0, 54, 0, 0 },
{ 46, 45, 50, 47, 51, 0, 0, 0, 0, 48, 0, 0 },
{ 47, 0, 0, 0, 0, 48, 52, 46, 51, 43, 0, 0 },
{ 48, 47, 52, 0, 0, 0, 0, 49, 53, 41, 0, 0 },
{ 49, 0, 0, 48, 53, 50, 54, 0, 0, 38, 0, 0 },
{ 50, 49, 54, 51, 55, 0, 0, 0, 0, 35, 0, 0 },
{ 51, 52, 56, 0, 0, 0, 0, 50, 55, 39, 0, 0 },
{ 52, 0, 0, 53, 57, 51, 56, 0, 0, 45, 0, 0 },
{ 53, 54, 58, 0, 0, 0, 0, 52, 57, 49, 0, 0 },
{ 54, 0, 0, 0, 0, 53, 58, 0, 0, 68, 0, 0 },
{ 55, 0, 0, 56, 59, 18, 21, 12, 13, 24, 0, 0 },
{ 56, 57, 60, 0, 0, 0, 0, 55, 59, 39, 0, 0 },
{ 57, 0, 0, 58, 61, 56, 60, 0, 0, 41, 0, 0 },
{ 58, 59, 62, 0, 0, 60, 63, 57, 61, 42, 0, 0 },
{ 59, 0, 0, 0, 0, 58, 62, 0, 0, 85, 0, 0 },
{ 60, 58, 63, 0, 0, 61, 64, 0, 0, 1, 9, 59 }, // act 1 stairdown1 (link 59)
{ 61, 60, 64, 62, 65, 0, 0, 0, 0, 1, 10, 0 }, // act 1 stairup1
{ 62, 63, 66, 67, 67, 93, 68, 61, 65, 21, 0, 0 },
{ 63, 64, 69, 68, 70, 62, 66, 0, 0, 13, 0, 0 },
{ 64, 0, 0, 69, 71, 63, 69, 65, 72, 15, 0, 0 },
{ 65, 66, 73, 64, 72, 0, 0, 0, 0, 30, 0, 0 },
{ 66, 0, 0, 0, 0, 65, 73, 0, 0, 58, 0, 0 },
{ 67, 68, 74, 76, 75, 0, 0, 62, 67, 19, 0, 0 },
{ 68, 69, 76, 75, 77, 67, 74, 63, 70, 27, 0, 0 },
{ 69, 70, 78, 0, 0, 68, 76, 64, 71, 34, 0, 0 },
{ 70, 0, 0, 71, 79, 69, 78, 0, 0, 45, 0, 0 },
{ 71, 0, 0, 72, 80, 74, 81, 70, 79, 42, 0, 0 },
{ 72, 0, 0, 0, 0, 73, 82, 71, 80, 36, 0, 0 },
{ 73, 72, 82, 87, 83, 80, 84, 74, 85, 1, 23, 0 }, // act 1 blocked exit (trigger7)
{ 74, 71, 81, 73, 85, 75, 86, 0, 0, 54, 0, 0 },
{ 75, 74, 86, 0, 0, 76, 87, 68, 77, 43, 0, 0 },
{ 76, 75, 87, 77, 88, 0, 0, 67, 75, 21, 0, 0 },
{ 77, 80, 89, 0, 0, 78, 90, 76, 88, 32, 0, 0 },
{ 78, 77, 90, 0, 0, 0, 0, 79, 91, 45, 0, 0 },
{ 79, 0, 0, 78, 91, 0, 0, 0, 0, 72, 0, 0 },
{ 80, 73, 84, 81, 92, 77, 89, 0, 0, 35, 0, 0 },
{ 81, 0, 0, 0, 0, 82, 93, 80, 92, 39, 0, 0 },
{ 82, 81, 93, 85, 94, 83, 95, 0, 0, 34, 0, 0 },
{ 83, 82, 95, 0, 0, 0, 0, 84, 96, 74, 0, 0 },
{ 84, 0, 0, 83, 96, 0, 0, 0, 0, 1, 55, 118 }, // act 1 trigger6 (dead-end) (link 118)
{ 85, 0, 0, 0, 0, 86, 97, 82, 94, 32, 0, 0 },
{ 86, 85, 97, 0, 0, 0, 0, 0, 0, 41, 0, 0 },
{ 87, 88, 98, 0, 0, 0, 0, 73, 83, 5, 0, 0 },
{ 88, 0, 0, 89, 99, 87, 98, 0, 0, 10, 0, 0 },
{ 89, 0, 0, 0, 0, 90, 100, 88, 99, 15, 0, 0 },
{ 90, 89, 100, 91, 101, 0, 0, 0, 0, 8, 0, 0 },
{ 91, 92, 102, 0, 0, 0, 0, 90, 101, 10, 0, 0 },
{ 92, 0, 0, 1, 1, 91, 102, 0, 0, 4, 0, 0 },
{ 93, 62, 68, 96, 103, 0, 0, 94, 104, 13, 0, 0 },
{ 94, 0, 0, 93, 104, 95, 105, 0, 0, 12, 0, 0 },
{ 95, 94, 105, 98, 106, 0, 0, 0, 0, 96, 0, 0 },
{ 96, 0, 0, 0, 0, 97, 107, 93, 103, 32, 0, 0 },
{ 97, 96, 107, 0, 0, 0, 0, 98, 108, 24, 0, 0 },
{ 98, 0, 0, 97, 108, 99, 109, 95, 106, 41, 0, 0 },
{ 99, 98, 109, 100, 110, 0, 0, 101, 111, 34, 0, 0 },
{ 100, 0, 0, 0, 0, 0, 0, 99, 110, 59, 0, 0 },
{ 101, 0, 0, 99, 111, 102, 112, 0, 0, 26, 0, 0 },
{ 102, 101, 112, 103, 113, 0, 0, 0, 0, 29, 0, 0 },
{ 103, 104, 114, 0, 0, 0, 0, 102, 113, 25, 0, 0 },
{ 104, 0, 0, 105, 115, 103, 114, 0, 0, 21, 0, 0 },
{ 105, 106, 116, 0, 0, 0, 0, 104, 115, 36, 0, 0 },
{ 106, 107, 117, 108, 118, 105, 116, 0, 0, 41, 0, 0 },
{ 107, 0, 0, 0, 0, 106, 117, 0, 0, 95, 0, 0 },
{ 108, 0, 0, 118, 119, 109, 120, 106, 118, 16, 0, 0 },
{ 109, 108, 120, 110, 121, 0, 0, 0, 0, 42, 0, 0 },
{ 110, 111, 122, 0, 0, 0, 0, 109, 121, 24, 0, 0 },
{ 111, 0, 0, 112, 123, 110, 122, 0, 0, 21, 0, 0 },
{ 112, 0, 0, 0, 0, 113, 124, 111, 123, 19, 0, 0 },
{ 113, 112, 124, 114, 125, 0, 0, 0, 0, 16, 0, 0 },
{ 114, 115, 126, 0, 0, 0, 0, 113, 125, 14, 0, 0 },
{ 115, 0, 0, 0, 0, 114, 126, 116, 127, 13, 0, 0 },
{ 116, 117, 128, 115, 127, 0, 0, 0, 0, 18, 0, 0 },
{ 117, 0, 0, 0, 0, 116, 128, 123, 129, 21, 0, 0 },
{ 118, 0, 0, 0, 0, 119, 130, 108, 119, 10, 0, 0 },
{ 119, 118, 130, 120, 131, 0, 0, 0, 0, 14, 0, 0 },
{ 120, 121, 132, 0, 0, 0, 0, 119, 131, 48, 0, 0 },
{ 121, 0, 0, 122, 133, 120, 132, 0, 0, 85, 0, 0 },
{ 122, 123, 134, 0, 0, 0, 0, 121, 133, 95, 0, 0 },
{ 123, 124, 135, 117, 129, 122, 134, 0, 0, 45, 0, 0 },
{ 124, 0, 0, 125, 136, 123, 135, 127, 137, 34, 0, 0 },
{ 125, 126, 138, 0, 0, 0, 0, 124, 136, 23, 0, 0 },
{ 126, 0, 0, 0, 0, 125, 138, 0, 0, 29, 0, 0 },
{ 127, 128, 139, 124, 137, 0, 0, 0, 0, 43, 0, 0 },
{ 128, 0, 0, 0, 0, 127, 139, 129, 140, 49, 0, 0 },
{ 129, 0, 0, 128, 140, 0, 0, 0, 0, 1, 56, 83 }, // act 1 trigger7 (dead-end) (link 83)
{ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
};
//
// This is the static position id list for 02 Act 2..
//
struct mapdata_posdatastatic gstructMapPosStatic02Act2[] =
{
// id, Nid, Nlk, Eid, Elk, Sid, Slk, Wid, Wlk, Pe, Spc, Clk
{ 1, 0, 0, 0, 0, 0, 0, 95, 1, 1, 3, 0 }, // act 2 end
{ 2, 0, 0, 0, 0, 3, 2, 0, 0, 1, 4, 0 }, // act 2 start
{ 3, 2, 2, 0, 0, 4, 3, 26, 5, 1, 24, 0 }, // act 2 first monster point
{ 4, 3, 3, 5, 4, 0, 0, 27, 6, 18, 0, 0 },
{ 5, 0, 0, 0, 0, 6, 7, 4, 4, 16, 0, 0 },
{ 6, 5, 7, 0, 0, 9, 8, 7, 9, 21, 0, 0 },
{ 7, 0, 0, 6, 9, 8, 10, 20, 11, 24, 0, 0 },
{ 8, 7, 10, 9, 12, 0, 0, 0, 0, 38, 0, 0 },
{ 9, 6, 8, 0, 0, 10, 13, 8, 12, 47, 0, 0 },
{ 10, 9, 13, 0, 0, 0, 0, 11, 14, 54, 0, 0 },
{ 11, 0, 0, 10, 14, 12, 15, 0, 0, 68, 0, 0 },
{ 12, 11, 15, 13, 16, 0, 0, 14, 17, 75, 0, 0 },
{ 13, 0, 0, 0, 0, 0, 0, 12, 16, 86, 0, 0 },
{ 14, 16, 18, 12, 17, 0, 0, 15, 19, 54, 0, 0 },
{ 15, 0, 0, 14, 19, 0, 0, 0, 0, 1, 61, 24 }, // act 2 trigger1 (dead-end) (link 24)
{ 16, 0, 0, 0, 0, 14, 18, 17, 20, 43, 0, 0 },
{ 17, 18, 21, 16, 20, 0, 0, 0, 0, 34, 0, 0 },
{ 18, 21, 22, 19, 23, 17, 21, 30, 24, 29, 0, 0 },
{ 19, 20, 25, 0, 0, 0, 0, 18, 23, 34, 0, 0 },
{ 20, 27, 26, 7, 11, 19, 25, 21, 27, 23, 0, 0 },
{ 21, 22, 28, 20, 27, 18, 22, 0, 0, 51, 0, 0 },
{ 22, 25, 29, 0, 0, 21, 28, 23, 30, 75, 0, 0 },
{ 23, 0, 0, 22, 30, 24, 31, 0, 0, 86, 0, 0 },
{ 24, 23, 31, 0, 0, 0, 0, 0, 0, 97, 0, 0 },
{ 25, 0, 0, 26, 32, 22, 29, 0, 0, 64, 0, 0 },
{ 26, 28, 33, 3, 5, 27, 34, 25, 32, 45, 0, 0 },
{ 27, 26, 34, 4, 6, 20, 26, 0, 0, 34, 0, 0 },
{ 28, 0, 0, 0, 0, 26, 33, 29, 35, 37, 0, 0 },
{ 29, 59, 36, 28, 35, 0, 0, 0, 0, 31, 0, 0 },
{ 30, 0, 0, 18, 24, 31, 37, 0, 0, 23, 0, 0 },
{ 31, 30, 37, 0, 0, 0, 0, 32, 38, 18, 0, 0 },
{ 32, 33, 39, 31, 38, 0, 0, 39, 46, 24, 0, 0 },
{ 33, 36, 40, 34, 41, 32, 39, 0, 0, 37, 0, 0 },
{ 34, 35, 42, 0, 0, 0, 0, 33, 41, 34, 0, 0 },
{ 35, 0, 0, 0, 0, 34, 42, 0, 0, 24, 0, 0 },
{ 36, 0, 0, 37, 43, 33, 40, 0, 0, 45, 0, 0 },
{ 37, 38, 44, 0, 0, 0, 0, 36, 43, 63, 0, 0 },
{ 38, 0, 0, 0, 0, 37, 44, 0, 0, 1, 62, 62 }, // act 2 trigger2 (dead-end) (link 62)
{ 39, 47, 45, 32, 46, 40, 47, 45, 48, 20, 0, 0 },
{ 40, 39, 47, 41, 49, 0, 0, 42, 50, 16, 0, 0 },
{ 41, 0, 0, 0, 0, 0, 0, 40, 49, 18, 0, 0 },
{ 42, 43, 51, 40, 50, 0, 0, 0, 0, 12, 0, 0 },
{ 43, 0, 0, 0, 0, 42, 51, 44, 52, 30, 0, 0 },
{ 44, 0, 0, 43, 52, 0, 0, 0, 0, 63, 0, 0 },
{ 45, 46, 53, 39, 48, 0, 0, 0, 0, 29, 0, 0 },
{ 46, 0, 0, 47, 54, 45, 53, 0, 0, 40, 0, 0 },
{ 47, 0, 0, 48, 55, 39, 45, 46, 54, 33, 0, 0 },
{ 48, 49, 56, 0, 0, 0, 0, 47, 55, 29, 0, 0 },
{ 49, 0, 0, 0, 0, 48, 56, 50, 57, 26, 0, 0 },
{ 50, 53, 58, 49, 57, 0, 0, 51, 59, 38, 0, 0 },
{ 51, 0, 0, 50, 59, 52, 60, 0, 0, 49, 0, 0 },
{ 52, 51, 60, 0, 0, 0, 0, 0, 0, 78, 0, 0 },
{ 53, 0, 0, 54, 61, 50, 58, 0, 0, 32, 0, 0 },
{ 54, 56, 62, 0, 0, 55, 63, 53, 61, 36, 0, 0 },
{ 55, 54, 63, 0, 0, 0, 0, 0, 0, 49, 0, 0 },
{ 56, 0, 0, 57, 64, 54, 62, 0, 0, 39, 0, 0 },
{ 57, 58, 65, 0, 0, 0, 0, 56, 64, 48, 0, 0 },
{ 58, 0, 0, 0, 0, 57, 65, 0, 0, 1, 63, 36 }, // act 2 trigger3 (dead-end) (link 36)
{ 59, 0, 0, 0, 0, 29, 36, 60, 66, 31, 0, 0 },
{ 60, 0, 0, 59, 66, 61, 67, 0, 0, 27, 0, 0 },
{ 61, 60, 67, 0, 0, 0, 0, 62, 68, 24, 0, 0 },
{ 62, 63, 69, 61, 68, 64, 70, 0, 0, 29, 0, 0 },
{ 63, 0, 0, 0, 0, 62, 69, 0, 0, 16, 0, 0 },
{ 64, 62, 70, 0, 0, 0, 0, 65, 71, 36, 0, 0 },
{ 65, 72, 72, 64, 71, 0, 0, 66, 73, 40, 0, 0 },
{ 66, 0, 0, 65, 73, 67, 74, 0, 0, 42, 0, 0 },
{ 67, 66, 74, 68, 75, 0, 0, 0, 0, 45, 0, 0 },
{ 68, 0, 0, 0, 0, 69, 76, 67, 75, 48, 0, 0 },
{ 69, 68, 76, 0, 0, 0, 0, 70, 77, 51, 0, 0 },
{ 70, 0, 0, 69, 77, 71, 78, 0, 0, 67, 0, 0 },
{ 71, 70, 78, 0, 0, 0, 0, 0, 0, 94, 0, 0 },
{ 72, 0, 0, 0, 0, 65, 72, 73, 79, 24, 0, 0 },
{ 73, 0, 0, 72, 79, 0, 0, 74, 80, 1, 11, 0 }, // act 2 stairdown1
{ 74, 81, 81, 73, 80, 0, 0, 75, 82, 1, 12, 0 }, // act 2 stairup1
{ 75, 80, 83, 74, 82, 76, 84, 104, 85, 23, 0, 0 },
{ 76, 75, 84, 78, 85, 0, 0, 77, 86, 34, 0, 0 },
{ 77, 0, 0, 76, 86, 0, 0, 0, 0, 42, 0, 0 },
{ 78, 0, 0, 0, 0, 0, 0, 76, 85, 43, 0, 0 },
{ 79, 86, 87, 80, 88, 0, 0, 0, 0, 23, 0, 0 },
{ 80, 85, 89, 81, 90, 75, 83, 79, 88, 27, 0, 0 },
{ 81, 84, 91, 82, 92, 74, 81, 80, 90, 25, 0, 0 },
{ 82, 83, 93, 0, 0, 0, 0, 81, 92, 23, 0, 0 },
{ 83, 0, 0, 0, 0, 82, 93, 84, 94, 21, 0, 0 },
{ 84, 88, 95, 83, 94, 81, 91, 85, 96, 25, 0, 0 },
{ 85, 87, 97, 84, 96, 80, 89, 86, 98, 26, 0, 0 },
{ 86, 96, 99, 85, 98, 79, 87, 0, 0, 29, 0, 0 },
{ 87, 89, 100, 88, 101, 85, 97, 0, 0, 32, 0, 0 },
{ 88, 0, 0, 0, 0, 84, 95, 87, 101, 30, 0, 0 },
{ 89, 91, 102, 0, 0, 87, 100, 90, 103, 1, 25, 0 }, // act 2 monster step point
{ 90, 0, 0, 89, 103, 0, 0, 0, 0, 32, 0, 0 },
{ 91, 0, 0, 94, 104, 89, 102, 92, 105, 21, 0, 0 },
{ 92, 0, 0, 91, 105, 93, 106, 0, 0, 38, 0, 0 },
{ 93, 92, 106, 0, 0, 0, 0, 0, 0, 48, 0, 0 },
{ 94, 0, 0, 0, 0, 95, 107, 91, 104, 1, 13, 0 }, // act 2 stairdown2
{ 95, 94, 107, 1, 1, 0, 0, 0, 0, 1, 14, 0 }, // act 2 stairup2
{ 96, 0, 0, 0, 0, 86, 99, 97, 108, 25, 0, 0 },
{ 97, 0, 0, 96, 108, 98, 109, 100, 110, 28, 0, 0 },
{ 98, 97, 109, 0, 0, 0, 0, 99, 111, 32, 0, 0 },
{ 99, 0, 0, 98, 111, 0, 0, 0, 0, 1, 65, 110 }, // act 2 trigger5 (dead-end) (link 110)
{ 100, 101, 112, 97, 110, 0, 0, 0, 0, 29, 0, 0 },
{ 101, 0, 0, 0, 0, 100, 112, 102, 113, 33, 0, 0 },
{ 102, 103, 114, 101, 113, 0, 0, 0, 0, 36, 0, 0 },
{ 103, 0, 0, 0, 0, 102, 114, 0, 0, 1, 68, 148 }, // act 2 trigger8 (dead-end) (link 148)
{ 104, 105, 115, 75, 85, 0, 0, 106, 116, 28, 0, 0 },
{ 105, 0, 0, 0, 0, 104, 115, 0, 0, 1, 64, 99 }, // act 2 trigger4 (dead-end) (link 99)
{ 106, 115, 117, 104, 116, 107, 118, 0, 0, 18, 0, 0 },
{ 107, 106, 118, 0, 0, 0, 0, 108, 119, 24, 0, 0 },
{ 108, 118, 120, 107, 119, 109, 121, 0, 0, 29, 0, 0 },
{ 109, 108, 121, 112, 122, 0, 0, 110, 123, 24, 0, 0 },
{ 110, 111, 124, 109, 123, 0, 0, 0, 0, 18, 0, 0 },
{ 111, 0, 0, 0, 0, 110, 124, 0, 0, 1, 66, 133 }, // act 2 trigger6 (dead-end) (link 133)
{ 112, 113, 125, 114, 126, 0, 0, 109, 122, 34, 0, 0 },
{ 113, 0, 0, 0, 0, 112, 125, 0, 0, 45, 0, 0 },
{ 114, 0, 0, 0, 0, 0, 0, 112, 126, 38, 0, 0 },
{ 115, 0, 0, 0, 0, 106, 117, 116, 127, 27, 0, 0 },
{ 116, 117, 128, 115, 127, 118, 129, 0, 0, 35, 0, 0 },
{ 117, 0, 0, 0, 0, 116, 128, 0, 0, 45, 0, 0 },
{ 118, 116, 129, 0, 0, 108, 120, 119, 130, 23, 0, 0 },
{ 119, 120, 131, 118, 130, 0, 0, 0, 0, 19, 0, 0 },
{ 120, 0, 0, 0, 0, 119, 131, 121, 132, 22, 0, 0 },
{ 121, 0, 0, 120, 132, 122, 133, 0, 0, 24, 0, 0 },
{ 122, 121, 133, 0, 0, 0, 0, 123, 134, 19, 0, 0 },
{ 123, 126, 135, 122, 134, 0, 0, 124, 136, 21, 0, 0 },
{ 124, 125, 137, 123, 136, 0, 0, 0, 0, 34, 0, 0 },
{ 125, 0, 0, 0, 0, 124, 137, 0, 0, 47, 0, 0 },
{ 126, 127, 138, 0, 0, 123, 135, 128, 139, 32, 0, 0 },
{ 127, 0, 0, 0, 0, 126, 138, 0, 0, 48, 0, 0 },
{ 128, 129, 140, 126, 139, 0, 0, 0, 0, 26, 0, 0 },
{ 129, 130, 141, 131, 142, 128, 140, 0, 0, 18, 0, 0 },
{ 130, 0, 0, 0, 0, 129, 141, 0, 0, 1, 67, 143 }, // act 2 trigger7 (dead-end) (link 132)
{ 131, 134, 143, 132, 144, 0, 0, 129, 142, 21, 0, 0 },
{ 132, 133, 145, 0, 0, 0, 0, 131, 144, 15, 0, 0 },
{ 133, 0, 0, 0, 0, 132, 145, 0, 0, 21, 0, 0 },
{ 134, 0, 0, 135, 146, 131, 143, 0, 0, 23, 0, 0 },
{ 135, 136, 147, 0, 0, 0, 0, 134, 146, 31, 0, 0 },
{ 136, 0, 0, 140, 148, 135, 147, 137, 149, 38, 0, 0 },
{ 137, 0, 0, 136, 149, 138, 150, 0, 0, 45, 0, 0 },
{ 138, 137, 150, 139, 151, 0, 0, 0, 0, 49, 0, 0 },
{ 139, 0, 0, 0, 0, 0, 0, 138, 151, 52, 0, 0 },
{ 140, 0, 0, 0, 0, 141, 152, 136, 148, 19, 0, 0 },
{ 141, 140, 152, 142, 153, 0, 0, 0, 0, 21, 0, 0 },
{ 142, 0, 0, 0, 0, 143, 154, 141, 153, 23, 0, 0 },
{ 143, 142, 154, 144, 155, 0, 0, 0, 0, 32, 0, 0 },
{ 144, 145, 156, 0, 0, 0, 0, 143, 155, 35, 0, 0 },
{ 145, 0, 0, 146, 157, 144, 156, 0, 0, 38, 0, 0 },
{ 146, 0, 0, 0, 0, 0, 0, 145, 157, 1, 69, 100 }, // act 2 trigger9 (dead-end) (link 100)
{ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
};
//
// This is the static position id list for 02 Act 3..
//
struct mapdata_posdatastatic gstructMapPosStatic02Act3[] =
{
// id, Nid, Nlk, Eid, Elk, Sid, Slk, Wid, Wlk, Pe, Spc, Clk
{ 1, 0, 0, 0, 0, 0, 0, 74, 1, 1, 5, 0 }, // act 3 end
{ 2, 0, 0, 3, 2, 0, 0, 0, 0, 1, 6, 0 }, // act 3 start
{ 3, 0, 0, 4, 3, 0, 0, 2, 2, 1, 29, 0 }, // act 3 first monster point
{ 4, 5, 4, 6, 5, 9, 6, 3, 3, 25, 0, 0 },
{ 5, 0, 0, 0, 0, 4, 4, 0, 0, 32, 0, 0 },
{ 6, 7, 7, 0, 0, 8, 8, 4, 5, 31, 0, 0 },
{ 7, 0, 0, 0, 0, 6, 7, 0, 0, 43, 0, 0 },
{ 8, 6, 8, 0, 0, 12, 9, 9, 10, 23, 0, 0 },
{ 9, 4, 6, 8, 10, 0, 0, 10, 11, 24, 0, 0 },
{ 10, 0, 0, 9, 11, 11, 12, 0, 0, 18, 0, 0 },
{ 11, 10, 12, 0, 0, 0, 0, 54, 13, 1, 15, 0 }, // act 3 stairdown1
{ 12, 8, 9, 0, 0, 0, 0, 13, 14, 19, 0, 0 },
{ 13, 0, 0, 12, 14, 14, 15, 0, 0, 21, 0, 0 },
{ 14, 13, 15, 15, 16, 25, 17, 20, 18, 29, 0, 0 },
{ 15, 0, 0, 0, 0, 16, 19, 14, 16, 21, 0, 0 },
{ 16, 15, 19, 0, 0, 17, 20, 25, 21, 25, 0, 0 },
{ 17, 16, 20, 0, 0, 0, 0, 18, 22, 31, 0, 0 },
{ 18, 0, 0, 17, 22, 19, 23, 0, 0, 42, 0, 0 },
{ 19, 18, 23, 0, 0, 0, 0, 0, 0, 58, 0, 0 },
{ 20, 0, 0, 14, 18, 0, 0, 21, 24, 39, 0, 0 },
{ 21, 0, 0, 20, 24, 23, 25, 22, 26, 26, 0, 0 },
{ 22, 0, 0, 21, 26, 0, 0, 0, 0, 1, 72, 54 }, // act 3 trigger2 (dead-end) (link 54)
{ 23, 21, 25, 24, 27, 0, 0, 0, 0, 21, 0, 0 },
{ 24, 0, 0, 25, 28, 26, 29, 23, 27, 23, 0, 0 },
{ 25, 14, 17, 16, 21, 0, 0, 24, 28, 26, 0, 0 },
{ 26, 24, 29, 0, 0, 0, 0, 27, 30, 19, 0, 0 },
{ 27, 28, 31, 26, 30, 0, 0, 0, 0, 23, 0, 0 },
{ 28, 0, 0, 0, 0, 27, 31, 29, 32, 26, 0, 0 },
{ 29, 49, 33, 28, 32, 30, 34, 0, 0, 28, 0, 0 },
{ 30, 29, 34, 31, 35, 0, 0, 32, 36, 34, 0, 0 },
{ 31, 0, 0, 0, 0, 0, 0, 30, 35, 48, 0, 0 },
{ 32, 33, 37, 30, 36, 0, 0, 0, 0, 10, 0, 0 },
{ 33, 0, 0, 0, 0, 32, 37, 34, 38, 8, 0, 0 },
{ 34, 0, 0, 33, 38, 35, 39, 0, 0, 9, 0, 0 },
{ 35, 34, 39, 0, 0, 0, 0, 36, 40, 7, 0, 0 },
{ 36, 37, 41, 35, 40, 0, 0, 0, 0, 20, 0, 0 },
{ 37, 0, 0, 40, 42, 36, 41, 38, 43, 31, 0, 0 },
{ 38, 0, 0, 37, 43, 39, 44, 0, 0, 86, 0, 0 },
{ 39, 38, 44, 0, 0, 0, 0, 0, 0, 25, 0, 0 },
{ 40, 41, 45, 0, 0, 0, 0, 37, 42, 34, 0, 0 },
{ 41, 0, 0, 45, 46, 40, 45, 42, 47, 48, 0, 0 },
{ 42, 43, 48, 41, 47, 0, 0, 0, 0, 56, 0, 0 },
{ 43, 0, 0, 44, 49, 42, 48, 0, 0, 78, 0, 0 },
{ 44, 0, 0, 0, 0, 0, 0, 43, 49, 97, 0, 0 },
{ 45, 47, 50, 49, 51, 46, 52, 41, 46, 49, 0, 0 },
{ 46, 45, 52, 0, 0, 0, 0, 0, 0, 92, 0, 0 },
{ 47, 0, 0, 48, 53, 45, 50, 0, 0, 34, 0, 0 },
{ 48, 0, 0, 50, 54, 49, 55, 47, 53, 38, 0, 0 },
{ 49, 48, 55, 0, 0, 29, 33, 45, 51, 36, 0, 0 },
{ 50, 0, 0, 0, 0, 51, 56, 48, 54, 34, 0, 0 },
{ 51, 50, 56, 52, 57, 0, 0, 0, 0, 26, 0, 0 },
{ 52, 53, 58, 0, 0, 0, 0, 51, 57, 1, 71, 12 }, // act 3 trigger1 (elbow) (link 12)
{ 53, 0, 0, 0, 0, 52, 58, 0, 0, 45, 0, 0 },
{ 54, 0, 0, 11, 13, 0, 0, 55, 59, 1, 16, 0 }, // act 3 stairup1
{ 55, 56, 60, 54, 59, 0, 0, 0, 0, 1, 26, 0 }, // act 3 elbow with collapse
{ 56, 0, 0, 57, 61, 55, 60, 58, 62, 32, 0, 0 },
{ 57, 0, 0, 0, 0, 0, 0, 56, 61, 43, 0, 0 },
{ 58, 0, 0, 56, 62, 59, 63, 75, 64, 24, 0, 0 },
{ 59, 58, 63, 0, 0, 61, 65, 60, 66, 27, 0, 0 },
{ 60, 0, 0, 59, 66, 0, 0, 0, 0, 38, 0, 0 },
{ 61, 59, 65, 62, 67, 0, 0, 0, 0, 18, 0, 0 },
{ 62, 0, 0, 63, 68, 66, 69, 61, 67, 1, 28, 0 }, // act 3 t-intersect with collapse2
{ 63, 0, 0, 96, 70, 64, 71, 62, 68, 17, 0, 0 },
{ 64, 63, 71, 65, 72, 68, 73, 66, 74, 18, 0, 0 },
{ 65, 0, 0, 0, 0, 0, 0, 64, 72, 28, 0, 0 },
{ 66, 62, 69, 64, 74, 0, 0, 67, 75, 1, 27, 0 }, // act 3 t-intersect with collapse
{ 67, 0, 0, 66, 75, 0, 0, 0, 0, 34, 0, 0 },
{ 68, 64, 73, 0, 0, 0, 0, 69, 76, 21, 0, 0 },
{ 69, 0, 0, 68, 76, 73, 77, 70, 78, 1, 28, 0 }, // act 3 t-intersect with collapse2
{ 70, 0, 0, 69, 78, 71, 79, 0, 0, 34, 0, 0 },
{ 71, 70, 79, 0, 0, 0, 0, 72, 80, 43, 0, 0 },
{ 72, 0, 0, 71, 80, 0, 0, 0, 0, 51, 0, 0 },
{ 73, 69, 77, 74, 81, 0, 0, 0, 0, 1, 17, 0 }, // act 3 stairdown2
{ 74, 0, 0, 1, 1, 0, 0, 73, 81, 1, 18, 0 }, // act 3 stairup2
{ 75, 0, 0, 58, 64, 76, 82, 77, 83, 31, 0, 0 },
{ 76, 75, 82, 0, 0, 0, 0, 0, 0, 29, 0, 0 },
{ 77, 0, 0, 75, 83, 78, 84, 0, 0, 27, 0, 0 },
{ 78, 77, 84, 0, 0, 0, 0, 79, 85, 25, 0, 0 },
{ 79, 0, 0, 78, 85, 80, 86, 0, 0, 19, 0, 0 },
{ 80, 79, 86, 81, 87, 87, 88, 0, 0, 16, 0, 0 },
{ 81, 82, 89, 0, 0, 83, 90, 80, 87, 21, 0, 0 },
{ 82, 0, 0, 0, 0, 81, 89, 0, 0, 34, 0, 0 },
{ 83, 81, 90, 84, 91, 0, 0, 0, 0, 1, 74, 88 }, // act 3 trigger4 (elbow) (link 88)
{ 84, 85, 92, 0, 0, 0, 0, 83, 91, 42, 0, 0 },
{ 85, 0, 0, 86, 93, 84, 92, 0, 0, 1, 73, 65 }, // act 3 trigger3 (elbow) (link 65)
{ 86, 0, 0, 0, 0, 0, 0, 85, 93, 84, 0, 0 },
{ 87, 80, 88, 92, 94, 88, 95, 0, 0, 20, 0, 0 },
{ 88, 87, 95, 89, 96, 0, 0, 0, 0, 28, 0, 0 },
{ 89, 0, 0, 0, 0, 90, 97, 88, 96, 39, 0, 0 },
{ 90, 89, 97, 91, 98, 0, 0, 0, 0, 51, 0, 0 },
{ 91, 0, 0, 0, 0, 0, 0, 90, 98, 65, 0, 0 },
{ 92, 0, 0, 94, 99, 93, 100, 87, 94, 38, 0, 0 },
{ 93, 92, 100, 0, 0, 0, 0, 0, 0, 49, 0, 0 },
{ 94, 0, 0, 0, 0, 95, 101, 92, 99, 46, 0, 0 },
{ 95, 94, 101, 0, 0, 0, 0, 0, 0, 85, 0, 0 },
{ 96, 98, 102, 100, 103, 97, 104, 63, 70, 20, 0, 0 },
{ 97, 96, 104, 0, 0, 0, 0, 0, 0, 34, 0, 0 },
{ 98, 0, 0, 0, 0, 96, 102, 99, 105, 24, 0, 0 },
{ 99, 0, 0, 98, 105, 0, 0, 0, 0, 45, 0, 0 },
{ 100, 0, 0, 0, 0, 101, 106, 96, 103, 32, 0, 0 },
{ 101, 100, 106, 102, 107, 0, 0, 0, 0, 36, 0, 0 },
{ 102, 0, 0, 0, 0, 103, 108, 101, 107, 38, 0, 0 },
{ 103, 102, 108, 0, 0, 0, 0, 104, 109, 42, 0, 0 },
{ 104, 0, 0, 103, 109, 0, 0, 0, 0, 1, 75, 73 }, // act 3 trigger5 (dead-end) (link 73)
{ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
};
//
// This is the static position id list for 02 Act 4..
//
struct mapdata_posdatastatic gstructMapPosStatic02Act4[] =
{
// id, Nid, Nlk, Eid, Elk, Sid, Slk, Wid, Wlk, Pe, Spc, Clk
{ 1, 76, 1, 0, 0, 0, 0, 0, 0, 1, 7, 0 }, // act 4 end
{ 2, 0, 0, 0, 0, 3, 2, 0, 0, 1, 8, 0 }, // act 4 start
{ 3, 2, 2, 0, 0, 0, 0, 4, 3, 21, 0, 0 },
{ 4, 5, 4, 3, 3, 12, 5, 0, 0, 18, 0, 0 },
{ 5, 0, 0, 0, 0, 4, 4, 6, 6, 21, 0, 0 },
{ 6, 7, 7, 5, 6, 8, 8, 0, 0, 24, 0, 0 },
{ 7, 0, 0, 0, 0, 6, 7, 0, 0, 45, 0, 0 },
{ 8, 6, 8, 0, 0, 10, 9, 9, 10, 12, 0, 0 },
{ 9, 0, 0, 8, 10, 0, 0, 0, 0, 1, 31, 0 }, // stairs back up to act 3
{ 10, 8, 9, 12, 11, 11, 12, 0, 0, 18, 0, 0 },
{ 11, 10, 12, 0, 0, 0, 0, 0, 0, 63, 0, 0 },
{ 12, 4, 5, 13, 13, 0, 0, 10, 11, 21, 0, 0 },
{ 13, 0, 0, 0, 0, 14, 14, 12, 13, 1, 19, 0 }, // act 4 stairdown1
{ 14, 13, 14, 0, 0, 15, 15, 0, 0, 1, 20, 0 }, // act 4 stairup1
{ 15, 14, 15, 0, 0, 0, 0, 16, 16, 24, 0, 0 },
{ 16, 0, 0, 15, 16, 22, 17, 17, 18, 16, 0, 0 },
{ 17, 18, 19, 16, 18, 0, 0, 20, 20, 24, 0, 0 },
{ 18, 0, 0, 0, 0, 17, 19, 19, 21, 38, 0, 0 },
{ 19, 0, 0, 18, 21, 0, 0, 0, 0, 49, 0, 0 },
{ 20, 0, 0, 17, 20, 21, 22, 0, 0, 41, 0, 0 },
{ 21, 20, 22, 0, 0, 0, 0, 0, 0, 59, 0, 0 },
{ 22, 16, 17, 23, 23, 27, 24, 25, 25, 23, 0, 0 },
{ 23, 0, 0, 0, 0, 24, 26, 22, 23, 37, 0, 0 },
{ 24, 23, 26, 0, 0, 0, 0, 0, 0, 51, 0, 0 },
{ 25, 0, 0, 22, 25, 26, 27, 0, 0, 25, 0, 0 },
{ 26, 25, 27, 27, 28, 0, 0, 45, 29, 18, 0, 0 },
{ 27, 22, 24, 0, 0, 28, 30, 26, 28, 28, 0, 0 },
{ 28, 27, 30, 29, 31, 32, 32, 44, 33, 31, 0, 0 },
{ 29, 0, 0, 0, 0, 30, 34, 28, 31, 36, 0, 0 },
{ 30, 29, 34, 0, 0, 31, 35, 32, 36, 45, 0, 0 },
{ 31, 30, 35, 0, 0, 0, 0, 0, 0, 64, 0, 0 },
{ 32, 28, 32, 30, 36, 0, 0, 33, 37, 52, 0, 0 },
{ 33, 0, 0, 32, 37, 34, 38, 0, 0, 68, 0, 0 },
{ 34, 33, 38, 0, 0, 0, 0, 35, 39, 74, 0, 0 },
{ 35, 37, 40, 34, 39, 0, 0, 36, 41, 85, 0, 0 },
{ 36, 0, 0, 35, 41, 0, 0, 0, 0, 92, 0, 0 },
{ 37, 43, 42, 0, 0, 35, 40, 38, 43, 65, 0, 0 },
{ 38, 42, 44, 37, 43, 0, 0, 39, 45, 63, 0, 0 },
{ 39, 41, 46, 38, 45, 40, 47, 0, 0, 78, 0, 0 },
{ 40, 39, 47, 0, 0, 0, 0, 0, 0, 95, 0, 0 },
{ 41, 0, 0, 0, 0, 39, 46, 0, 0, 97, 0, 0 },
{ 42, 46, 48, 43, 49, 38, 44, 0, 0, 43, 0, 0 },
{ 43, 45, 50, 44, 51, 37, 42, 42, 49, 42, 0, 0 },
{ 44, 0, 0, 28, 33, 0, 0, 43, 51, 47, 0, 0 },
{ 45, 0, 0, 26, 29, 43, 50, 46, 52, 23, 0, 0 },
{ 46, 47, 53, 45, 52, 42, 48, 53, 54, 21, 0, 0 },
{ 47, 50, 55, 0, 0, 46, 53, 48, 56, 15, 0, 0 },
{ 48, 49, 57, 47, 56, 0, 0, 0, 0, 28, 0, 0 },
{ 49, 52, 58, 50, 59, 48, 57, 0, 0, 37, 0, 0 },
{ 50, 51, 60, 0, 0, 47, 55, 49, 59, 29, 0, 0 },
{ 51, 0, 0, 0, 0, 50, 60, 52, 61, 38, 0, 0 },
{ 52, 0, 0, 51, 61, 49, 58, 0, 0, 49, 0, 0 },
{ 53, 0, 0, 46, 54, 0, 0, 54, 62, 1, 30, 0 }, // act 4 ginger encounter
{ 54, 63, 63, 53, 62, 58, 64, 55, 65, 26, 0, 0 },
{ 55, 0, 0, 54, 65, 56, 66, 0, 0, 37, 0, 0 },
{ 56, 55, 66, 58, 67, 0, 0, 57, 68, 48, 0, 0 },
{ 57, 0, 0, 56, 68, 0, 0, 0, 0, 69, 0, 0 },
{ 58, 54, 64, 0, 0, 59, 69, 56, 67, 39, 0, 0 },
{ 59, 58, 69, 0, 0, 0, 0, 60, 70, 58, 0, 0 },
{ 60, 0, 0, 59, 70, 61, 71, 0, 0, 70, 0, 0 },
{ 61, 60, 71, 62, 72, 0, 0, 0, 0, 81, 0, 0 },
{ 62, 0, 0, 0, 0, 0, 0, 61, 72, 94, 0, 0 },
{ 63, 65, 73, 0, 0, 54, 63, 64, 74, 31, 0, 0 },
{ 64, 66, 75, 63, 74, 0, 0, 0, 0, 43, 0, 0 },
{ 65, 0, 0, 0, 0, 63, 73, 66, 76, 32, 0, 0 },
{ 66, 67, 77, 65, 76, 64, 75, 70, 78, 41, 0, 0 },
{ 67, 0, 0, 68, 79, 66, 77, 69, 80, 54, 0, 0 },
{ 68, 0, 0, 0, 0, 0, 0, 67, 79, 69, 0, 0 },
{ 69, 0, 0, 67, 80, 0, 0, 0, 0, 71, 0, 0 },
{ 70, 0, 0, 66, 78, 72, 81, 71, 82, 36, 0, 0 },
{ 71, 0, 0, 70, 82, 0, 0, 0, 0, 53, 0, 0 },
{ 72, 70, 81, 0, 0, 73, 83, 74, 84, 25, 0, 0 },
{ 73, 72, 83, 0, 0, 0, 0, 75, 85, 84, 0, 0 },
{ 74, 0, 0, 72, 84, 75, 86, 0, 0, 86, 0, 0 },
{ 75, 74, 86, 73, 85, 76, 87, 0, 0, 25, 0, 0 },
{ 76, 75, 87, 0, 0, 1, 1, 0, 0, 15, 0, 0 },
{ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
};
//
// This is the static position id list for 03 Act 1..
//
struct mapdata_posdatastatic gstructMapPosStatic03Act1[] =
{
// id, Nid, Nlk, Eid, Elk, Sid, Slk, Wid, Wlk, Pe, Spc, Clk
{ 1, 0, 0, 0, 0, 0, 0, 160, 1, 1, 1, 0 }, // act 1 end
{ 2, 4, 3, 3, 2, 6, 4, 0, 0, 1, 2, 0 }, // act 1 start
{ 3, 0, 0, 0, 0, 0, 0, 2, 2, 1, 21, 0 }, // act 1 blocked entrance
{ 4, 0, 0, 5, 5, 2, 3, 0, 0, 23, 0, 0 },
{ 5, 0, 0, 0, 0, 0, 0, 4, 5, 39, 0, 0 },
{ 6, 2, 4, 7, 6, 0, 0, 10, 7, 21, 0, 0 },
{ 7, 8, 8, 0, 0, 0, 0, 6, 6, 36, 0, 0 },
{ 8, 0, 0, 9, 9, 7, 8, 0, 0, 49, 0, 0 },
{ 9, 0, 0, 0, 0, 0, 0, 8, 9, 63, 0, 0 },
{ 10, 11, 10, 6, 7, 0, 0, 0, 0, 23, 0, 0 },
{ 11, 13, 11, 12, 12, 10, 10, 0, 0, 24, 0, 0 },
{ 12, 0, 0, 0, 0, 0, 0, 11, 12, 36, 0, 0 },
{ 13, 0, 0, 0, 0, 11, 11, 14, 13, 18, 0, 0 },
{ 14, 15, 14, 13, 13, 16, 15, 0, 0, 1, 22, 0 }, // act 1 first monster t-intersection
{ 15, 0, 0, 0, 0, 14, 14, 0, 0, 1, 50, 15 }, // act 1 first monster trap trigger (link 15)
{ 16, 14, 15, 0, 0, 0, 0, 17, 16, 21, 0, 0 },
{ 17, 21, 17, 16, 16, 18, 18, 0, 0, 30, 0, 0 },
{ 18, 17, 18, 19, 19, 0, 0, 20, 20, 37, 0, 0 },
{ 19, 0, 0, 0, 0, 0, 0, 18, 19, 63, 0, 0 },
{ 20, 86, 21, 18, 20, 0, 0, 0, 0, 27, 0, 0 },
{ 21, 23, 22, 0, 0, 17, 17, 22, 23, 25, 0, 0 },
{ 22, 24, 24, 21, 23, 0, 0, 0, 0, 19, 0, 0 },
{ 23, 50, 25, 0, 0, 21, 22, 24, 26, 35, 0, 0 },
{ 24, 0, 0, 23, 26, 22, 24, 25, 27, 21, 0, 0 },
{ 25, 26, 28, 24, 27, 0, 0, 0, 0, 23, 0, 0 },
{ 26, 0, 0, 27, 29, 25, 28, 0, 0, 22, 0, 0 },
{ 27, 28, 30, 0, 0, 0, 0, 26, 29, 25, 0, 0 },
{ 28, 0, 0, 44, 31, 27, 30, 29, 32, 21, 0, 0 },
{ 29, 30, 33, 28, 32, 31, 34, 0, 0, 34, 0, 0 },
{ 30, 0, 0, 0, 0, 29, 33, 0, 0, 63, 0, 0 },
{ 31, 29, 34, 0, 0, 0, 0, 32, 35, 26, 0, 0 },
{ 32, 0, 0, 31, 35, 33, 36, 0, 0, 23, 0, 0 },
{ 33, 32, 36, 34, 37, 0, 0, 0, 0, 21, 0, 0 },
{ 34, 0, 0, 0, 0, 35, 38, 33, 37, 20, 0, 0 },
{ 35, 34, 38, 40, 39, 0, 0, 36, 40, 29, 0, 0 },
{ 36, 0, 0, 35, 40, 37, 41, 0, 0, 38, 0, 0 },
{ 37, 36, 41, 38, 42, 0, 0, 0, 0, 49, 0, 0 },
{ 38, 39, 43, 0, 0, 0, 0, 37, 42, 62, 0, 0 },
{ 39, 0, 0, 0, 0, 38, 43, 0, 0, 83, 0, 0 },
{ 40, 0, 0, 0, 0, 41, 44, 35, 39, 23, 0, 0 },
{ 41, 40, 44, 42, 45, 0, 0, 0, 0, 34, 0, 0 },
{ 42, 0, 0, 0, 0, 43, 46, 41, 45, 45, 0, 0 },
{ 43, 42, 46, 0, 0, 0, 0, 0, 0, 1, 51, 21 }, // act 1 trigger2 (dead-end) (link 21)
{ 44, 45, 47, 0, 0, 0, 0, 28, 31, 21, 0, 0 },
{ 45, 0, 0, 46, 48, 44, 47, 0, 0, 18, 0, 0 },
{ 46, 0, 0, 0, 0, 47, 49, 45, 48, 16, 0, 0 },
{ 47, 46, 49, 48, 50, 0, 0, 0, 0, 15, 0, 0 },
{ 48, 0, 0, 0, 0, 49, 51, 47, 50, 1, 53, 57 }, // act 1 trigger4 (elbow) (link 57)
{ 49, 48, 51, 0, 0, 0, 0, 0, 0, 13, 0, 0 },
{ 50, 0, 0, 51, 52, 23, 25, 0, 0, 39, 0, 0 },
{ 51, 0, 0, 0, 0, 52, 53, 50, 52, 36, 0, 0 },
{ 52, 51, 53, 53, 54, 0, 0, 0, 0, 31, 0, 0 },
{ 53, 54, 55, 0, 0, 0, 0, 52, 54, 32, 0, 0 },
{ 54, 55, 56, 73, 77, 53, 55, 0, 0, 34, 0, 0 },
{ 55, 0, 0, 56, 57, 54, 56, 0, 0, 28, 0, 0 },
{ 56, 57, 58, 0, 0, 0, 0, 55, 57, 25, 0, 0 },
{ 57, 0, 0, 0, 0, 56, 58, 58, 59, 24, 0, 0 },
{ 58, 59, 60, 57, 59, 0, 0, 0, 0, 23, 0, 0 },
{ 59, 0, 0, 0, 0, 58, 60, 60, 61, 22, 0, 0 },
{ 60, 0, 0, 59, 61, 61, 62, 62, 63, 24, 0, 0 },
{ 61, 60, 62, 0, 0, 0, 0, 0, 0, 35, 0, 0 },
{ 62, 0, 0, 60, 63, 63, 64, 0, 0, 32, 0, 0 },
{ 63, 62, 64, 0, 0, 0, 0, 64, 65, 34, 0, 0 },
{ 64, 68, 66, 63, 65, 0, 0, 65, 67, 36, 0, 0 },
{ 65, 0, 0, 64, 67, 66, 68, 0, 0, 45, 0, 0 },
{ 66, 65, 68, 67, 69, 0, 0, 0, 0, 68, 0, 0 },
{ 67, 0, 0, 0, 0, 0, 0, 66, 69, 94, 0, 0 },
{ 68, 0, 0, 0, 0, 64, 66, 69, 70, 27, 0, 0 },
{ 69, 0, 0, 68, 70, 70, 71, 0, 0, 26, 0, 0 },
{ 70, 69, 71, 0, 0, 0, 0, 71, 72, 32, 0, 0 },
{ 71, 0, 0, 70, 72, 72, 73, 0, 0, 35, 0, 0 },
{ 72, 71, 73, 0, 0, 0, 0, 0, 0, 1, 54, 35 }, // act 1 trigger5 (dead-end) (link 35)
{ 73, 76, 74, 78, 75, 74, 76, 54, 77, 38, 0, 0 },
{ 74, 73, 76, 0, 0, 0, 0, 75, 78, 46, 0, 0 },
{ 75, 0, 0, 74, 78, 0, 0, 0, 0, 59, 0, 0 },
{ 76, 0, 0, 0, 0, 73, 74, 77, 79, 48, 0, 0 },
{ 77, 0, 0, 76, 79, 0, 0, 0, 0, 62, 0, 0 },
{ 78, 79, 80, 0, 0, 0, 0, 73, 75, 41, 0, 0 },
{ 79, 82, 81, 0, 0, 78, 80, 80, 82, 43, 0, 0 },
{ 80, 81, 83, 79, 82, 0, 0, 0, 0, 31, 0, 0 },
{ 81, 0, 0, 0, 0, 80, 83, 0, 0, 1, 52, 81 }, // act 1 trigger3 (dead-end) (link 81)
{ 82, 0, 0, 84, 84, 79, 81, 83, 85, 53, 0, 0 },
{ 83, 0, 0, 82, 85, 0, 0, 0, 0, 69, 0, 0 },
{ 84, 0, 0, 0, 0, 85, 86, 82, 84, 65, 0, 0 },
{ 85, 84, 86, 0, 0, 0, 0, 0, 0, 83, 0, 0 },
{ 86, 0, 0, 0, 0, 20, 21, 87, 87, 32, 0, 0 },
{ 87, 0, 0, 86, 87, 88, 88, 0, 0, 34, 0, 0 },
{ 88, 87, 88, 0, 0, 0, 0, 89, 89, 1, 9, 21 }, // act 1 stairdown1 (link 21)
{ 89, 94, 90, 88, 89, 0, 0, 90, 91, 1, 10, 0 }, // act 1 stairup1
{ 90, 93, 92, 89, 91, 0, 0, 0, 0, 45, 0, 0 },
{ 91, 92, 93, 0, 0, 0, 0, 0, 0, 68, 0, 0 },
{ 92, 131, 94, 93, 95, 91, 93, 0, 0, 51, 0, 0 },
{ 93, 0, 0, 94, 96, 90, 92, 92, 95, 41, 0, 0 },
{ 94, 95, 97, 97, 98, 89, 90, 93, 96, 32, 0, 0 },
{ 95, 0, 0, 96, 99, 94, 97, 0, 0, 46, 0, 0 },
{ 96, 0, 0, 0, 0, 97, 100, 95, 99, 49, 0, 0 },
{ 97, 96, 100, 98, 101, 0, 0, 94, 98, 36, 0, 0 },
{ 98, 99, 102, 0, 0, 100, 103, 97, 101, 32, 0, 0 },
{ 99, 0, 0, 0, 0, 98, 102, 0, 0, 46, 0, 0 },
{ 100, 98, 103, 101, 104, 0, 0, 0, 0, 28, 0, 0 },
{ 101, 102, 105, 0, 0, 0, 0, 100, 104, 26, 0, 0 },
{ 102, 0, 0, 103, 106, 101, 105, 0, 0, 25, 0, 0 },
{ 103, 110, 108, 104, 107, 0, 0, 102, 106, 26, 0, 0 },
{ 104, 107, 109, 0, 0, 105, 110, 103, 107, 37, 0, 0 },
{ 105, 104, 110, 106, 111, 0, 0, 0, 0, 49, 0, 0 },
{ 106, 0, 0, 0, 0, 0, 0, 105, 111, 64, 0, 0 },
{ 107, 0, 0, 108, 112, 104, 109, 0, 0, 46, 0, 0 },
{ 108, 0, 0, 0, 0, 109, 113, 107, 112, 58, 0, 0 },
{ 109, 108, 113, 0, 0, 0, 0, 0, 0, 73, 0, 0 },
{ 110, 0, 0, 0, 0, 103, 108, 111, 114, 22, 0, 0 },
{ 111, 112, 115, 110, 114, 0, 0, 0, 0, 21, 0, 0 },
{ 112, 113, 116, 115, 117, 111, 115, 0, 0, 32, 0, 0 },
{ 113, 0, 0, 0, 0, 112, 116, 114, 118, 46, 0, 0 },
{ 114, 0, 0, 113, 118, 0, 0, 0, 0, 59, 0, 0 },
{ 115, 116, 119, 0, 0, 118, 120, 112, 117, 36, 0, 0 },
{ 116, 0, 0, 0, 0, 115, 119, 117, 121, 48, 0, 0 },
{ 117, 0, 0, 116, 121, 0, 0, 0, 0, 62, 0, 0 },
{ 118, 115, 120, 119, 123, 0, 0, 0, 0, 28, 0, 0 },
{ 119, 120, 124, 0, 0, 0, 0, 118, 123, 25, 0, 0 },
{ 120, 0, 0, 121, 125, 119, 124, 0, 0, 29, 0, 0 },
{ 121, 124, 126, 0, 0, 122, 127, 120, 125, 32, 0, 0 },
{ 122, 121, 127, 0, 0, 0, 0, 123, 128, 47, 0, 0 },
{ 123, 0, 0, 122, 128, 0, 0, 0, 0, 61, 0, 0 },
{ 124, 0, 0, 0, 0, 121, 126, 125, 129, 28, 0, 0 },
{ 125, 126, 130, 124, 129, 0, 0, 0, 0, 26, 0, 0 },
{ 126, 0, 0, 0, 0, 125, 130, 127, 131, 24, 0, 0 },
{ 127, 0, 0, 126, 131, 128, 132, 0, 0, 22, 0, 0 },
{ 128, 127, 132, 0, 0, 0, 0, 129, 133, 27, 0, 0 },
{ 129, 0, 0, 128, 133, 130, 134, 0, 0, 29, 0, 0 },
{ 130, 129, 134, 0, 0, 0, 0, 0, 0, 1, 55, 157 }, // act 1 trigger6 (dead-end) (link 157)
{ 131, 0, 0, 132, 135, 92, 94, 0, 0, 42, 0, 0 },
{ 132, 133, 136, 0, 0, 0, 0, 131, 135, 36, 0, 0 },
{ 133, 0, 0, 134, 137, 132, 136, 150, 153, 31, 0, 0 },
{ 134, 139, 138, 135, 139, 0, 0, 133, 137, 25, 0, 0 },
{ 135, 0, 0, 137, 140, 136, 141, 134, 139, 34, 0, 0 },
{ 136, 135, 141, 0, 0, 0, 0, 0, 0, 48, 0, 0 },
{ 137, 0, 0, 0, 0, 138, 142, 135, 140, 46, 0, 0 },
{ 138, 137, 142, 0, 0, 0, 0, 0, 0, 64, 0, 0 },
{ 139, 0, 0, 140, 143, 134, 138, 0, 0, 27, 0, 0 },
{ 140, 0, 0, 0, 0, 141, 144, 139, 143, 21, 0, 0 },
{ 141, 140, 144, 142, 145, 0, 0, 0, 0, 20, 0, 0 },
{ 142, 145, 147, 0, 0, 143, 146, 141, 145, 23, 0, 0 },
{ 143, 142, 146, 144, 148, 0, 0, 0, 0, 16, 0, 0 },
{ 144, 0, 0, 0, 0, 0, 0, 143, 148, 24, 0, 0 },
{ 145, 0, 0, 0, 0, 142, 147, 146, 149, 31, 0, 0 },
{ 146, 147, 150, 145, 149, 0, 0, 0, 0, 37, 0, 0 },
{ 147, 0, 0, 149, 151, 146, 150, 148, 152, 43, 0, 0 },
{ 148, 0, 0, 147, 152, 0, 0, 0, 0, 63, 0, 0 },
{ 149, 0, 0, 0, 0, 0, 0, 147, 151, 1, 56, 115 }, // act 1 trigger7 (dead-end) (link 115)
{ 150, 151, 154, 133, 153, 0, 0, 0, 0, 34, 0, 0 },
{ 151, 0, 0, 152, 155, 150, 154, 0, 0, 36, 0, 0 },
{ 152, 153, 156, 0, 0, 0, 0, 151, 155, 41, 0, 0 },
{ 153, 0, 0, 155, 157, 152, 156, 154, 158, 1, 23, 0 }, // act 1 blocked exit (trigger6)
{ 154, 0, 0, 153, 158, 0, 0, 0, 0, 69, 0, 0 },
{ 155, 158, 159, 0, 0, 156, 160, 153, 157, 45, 0, 0 },
{ 156, 155, 160, 0, 0, 0, 0, 157, 161, 59, 0, 0 },
{ 157, 0, 0, 156, 161, 0, 0, 0, 0, 67, 0, 0 },
{ 158, 0, 0, 0, 0, 155, 159, 159, 162, 39, 0, 0 },
{ 159, 160, 163, 158, 162, 0, 0, 0, 0, 21, 0, 0 },
{ 160, 0, 0, 1, 1, 159, 163, 0, 0, 18, 0, 0 },
{ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
};
//
// This is the static position id list for 03 Act 2..
//
struct mapdata_posdatastatic gstructMapPosStatic03Act2[] =
{
// id, Nid, Nlk, Eid, Elk, Sid, Slk, Wid, Wlk, Pe, Spc, Clk
{ 1, 0, 0, 0, 0, 0, 0, 191, 1, 1, 3, 0 }, // act 2 end
{ 2, 0, 0, 0, 0, 3, 2, 0, 0, 1, 4, 0 }, // act 2 start
{ 3, 2, 2, 8, 3, 0, 0, 4, 4, 1, 24, 0 }, // act 2 first monster point
{ 4, 45, 5, 3, 4, 5, 6, 0, 0, 15, 0, 0 },
{ 5, 4, 6, 6, 7, 9, 8, 0, 0, 23, 0, 0 },
{ 6, 0, 0, 7, 9, 10, 10, 5, 7, 20, 0, 0 },
{ 7, 8, 11, 0, 0, 11, 12, 6, 9, 19, 0, 0 },
{ 8, 0, 0, 0, 0, 7, 11, 3, 3, 21, 0, 0 },
{ 9, 5, 8, 0, 0, 0, 0, 0, 0, 36, 0, 0 },
{ 10, 6, 10, 0, 0, 94, 13, 0, 0, 1, 11, 0 }, // act 2 stairdown1
{ 11, 7, 12, 14, 17, 12, 14, 0, 0, 25, 0, 0 },
{ 12, 11, 14, 13, 15, 0, 0, 0, 0, 37, 0, 0 },
{ 13, 0, 0, 0, 0, 0, 0, 12, 15, 49, 0, 0 },
{ 14, 15, 16, 0, 0, 0, 0, 11, 17, 24, 0, 0 },
{ 15, 16, 18, 23, 19, 14, 16, 0, 0, 31, 0, 0 },
{ 16, 0, 0, 17, 20, 15, 18, 0, 0, 42, 0, 0 },
{ 17, 18, 21, 0, 0, 20, 22, 16, 20, 53, 0, 0 },
{ 18, 0, 0, 19, 23, 17, 21, 0, 0, 68, 0, 0 },
{ 19, 0, 0, 0, 0, 0, 0, 18, 23, 81, 0, 0 },
{ 20, 17, 22, 21, 24, 0, 0, 0, 0, 64, 0, 0 },
{ 21, 22, 25, 0, 0, 0, 0, 20, 24, 75, 0, 0 },
{ 22, 0, 0, 0, 0, 21, 25, 0, 0, 83, 0, 0 },
{ 23, 0, 0, 25, 26, 24, 27, 15, 19, 37, 0, 0 },
{ 24, 23, 27, 0, 0, 0, 0, 0, 0, 67, 0, 0 },
{ 25, 0, 0, 0, 0, 26, 28, 23, 26, 29, 0, 0 },
{ 26, 25, 28, 0, 0, 0, 0, 27, 29, 27, 0, 0 },
{ 27, 0, 0, 26, 29, 28, 30, 0, 0, 31, 0, 0 },
{ 28, 27, 30, 0, 0, 30, 31, 29, 32, 34, 0, 0 },
{ 29, 0, 0, 28, 32, 0, 0, 0, 0, 64, 0, 0 },
{ 30, 28, 31, 31, 33, 0, 0, 37, 34, 29, 0, 0 },
{ 31, 32, 35, 0, 0, 33, 36, 30, 33, 41, 0, 0 },
{ 32, 0, 0, 0, 0, 31, 35, 0, 0, 59, 0, 0 },
{ 33, 31, 36, 0, 0, 0, 0, 34, 37, 52, 0, 0 },
{ 34, 0, 0, 33, 37, 35, 38, 0, 0, 58, 0, 0 },
{ 35, 34, 38, 0, 0, 0, 0, 36, 39, 68, 0, 0 },
{ 36, 0, 0, 35, 39, 0, 0, 0, 0, 81, 0, 0 },
{ 37, 0, 0, 30, 34, 38, 40, 0, 0, 32, 0, 0 },
{ 38, 37, 40, 0, 0, 0, 0, 39, 41, 36, 0, 0 },
{ 39, 40, 42, 38, 41, 0, 0, 0, 0, 38, 0, 0 },
{ 40, 0, 0, 0, 0, 39, 42, 41, 43, 41, 0, 0 },
{ 41, 42, 44, 40, 43, 0, 0, 0, 0, 43, 0, 0 },
{ 42, 0, 0, 43, 45, 41, 44, 0, 0, 44, 0, 0 },
{ 43, 44, 46, 0, 0, 0, 0, 42, 45, 37, 0, 0 },
{ 44, 0, 0, 0, 0, 43, 46, 0, 0, 1, 61, 10 }, // act 2 trigger1 (dead-end) (link 10)
{ 45, 0, 0, 0, 0, 4, 5, 46, 47, 20, 0, 0 },
{ 46, 0, 0, 45, 47, 47, 48, 0, 0, 19, 0, 0 },
{ 47, 46, 48, 0, 0, 0, 0, 48, 49, 24, 0, 0 },
{ 48, 49, 50, 47, 49, 0, 0, 51, 52, 20, 0, 0 },
{ 49, 0, 0, 0, 0, 48, 50, 50, 51, 34, 0, 0 },
{ 50, 0, 0, 49, 51, 0, 0, 0, 0, 58, 0, 0 },
{ 51, 52, 53, 48, 52, 53, 54, 0, 0, 27, 0, 0 },
{ 52, 0, 0, 0, 0, 51, 53, 0, 0, 34, 0, 0 },
{ 53, 51, 54, 56, 55, 59, 56, 54, 57, 20, 0, 0 },
{ 54, 55, 58, 53, 57, 0, 0, 0, 0, 32, 0, 0 },
{ 55, 0, 0, 0, 0, 54, 58, 0, 0, 63, 0, 0 },
{ 56, 0, 0, 0, 0, 57, 59, 53, 55, 37, 0, 0 },
{ 57, 56, 59, 58, 60, 0, 0, 0, 0, 48, 0, 0 },
{ 58, 0, 0, 0, 0, 0, 0, 57, 60, 81, 0, 0 },
{ 59, 53, 56, 65, 61, 0, 0, 60, 62, 25, 0, 0 },
{ 60, 0, 0, 59, 62, 61, 63, 0, 0, 22, 0, 0 },
{ 61, 60, 63, 62, 64, 0, 0, 0, 0, 21, 0, 0 },
{ 62, 0, 0, 0, 0, 63, 65, 61, 64, 20, 0, 0 },
{ 63, 62, 65, 64, 66, 0, 0, 0, 0, 15, 0, 0 },
{ 64, 0, 0, 0, 0, 0, 0, 63, 66, 1, 62, 72 }, // act 2 trigger2 (dead-end) (link 72)
{ 65, 0, 0, 0, 0, 66, 67, 59, 61, 31, 0, 0 },
{ 66, 65, 67, 68, 68, 0, 0, 0, 0, 37, 0, 0 },
{ 67, 0, 0, 69, 69, 68, 70, 0, 0, 38, 0, 0 },
{ 68, 67, 70, 0, 0, 0, 0, 66, 68, 39, 0, 0 },
{ 69, 70, 71, 0, 0, 72, 72, 67, 69, 41, 0, 0 },
{ 70, 0, 0, 0, 0, 69, 71, 71, 74, 31, 0, 0 },
{ 71, 0, 0, 70, 74, 0, 0, 0, 0, 24, 0, 0 },
{ 72, 69, 72, 86, 73, 0, 0, 73, 75, 36, 0, 0 },
{ 73, 0, 0, 72, 75, 74, 76, 0, 0, 24, 0, 0 },
{ 74, 73, 76, 0, 0, 0, 0, 75, 77, 22, 0, 0 },
{ 75, 0, 0, 74, 77, 81, 78, 76, 79, 20, 0, 0 },
{ 76, 77, 80, 75, 79, 78, 81, 0, 0, 24, 0, 0 },
{ 77, 0, 0, 0, 0, 76, 80, 0, 0, 19, 0, 0 },
{ 78, 76, 81, 79, 82, 0, 0, 0, 0, 38, 0, 0 },
{ 79, 0, 0, 0, 0, 80, 83, 78, 82, 43, 0, 0 },
{ 80, 79, 83, 0, 0, 0, 0, 0, 0, 48, 0, 0 },
{ 81, 75, 78, 84, 84, 82, 85, 0, 0, 21, 0, 0 },
{ 82, 81, 85, 83, 86, 0, 0, 0, 0, 20, 0, 0 },
{ 83, 0, 0, 0, 0, 0, 0, 82, 86, 17, 0, 0 },
{ 84, 0, 0, 0, 0, 85, 87, 81, 84, 19, 0, 0 },
{ 85, 84, 87, 89, 89, 0, 0, 0, 0, 25, 0, 0 },
{ 86, 0, 0, 0, 0, 87, 90, 72, 73, 21, 0, 0 },
{ 87, 86, 90, 0, 0, 0, 0, 88, 91, 39, 0, 0 },
{ 88, 0, 0, 87, 91, 89, 92, 0, 0, 53, 0, 0 },
{ 89, 88, 92, 90, 93, 0, 0, 85, 89, 32, 0, 0 },
{ 90, 0, 0, 0, 0, 91, 94, 89, 93, 29, 0, 0 },
{ 91, 90, 94, 92, 95, 0, 0, 0, 0, 41, 0, 0 },
{ 92, 93, 96, 0, 0, 0, 0, 91, 95, 38, 0, 0 },
{ 93, 0, 0, 0, 0, 92, 96, 0, 0, 1, 63, 42 }, // act 2 trigger3 (dead-end) (link 42)
{ 94, 10, 13, 99, 97, 0, 0, 95, 98, 1, 12, 0 }, // act 2 stairup1
{ 95, 100, 99, 94, 98, 96, 100, 142, 101, 24, 0, 0 },
{ 96, 95, 100, 97, 102, 0, 0, 0, 0, 19, 0, 0 },
{ 97, 0, 0, 98, 103, 150, 104, 96, 102, 21, 0, 0 },
{ 98, 99, 105, 0, 0, 0, 0, 97, 103, 23, 0, 0 },
{ 99, 102, 106, 101, 107, 98, 105, 94, 97, 28, 0, 0 },
{ 100, 0, 0, 0, 0, 95, 99, 0, 0, 48, 0, 0 },
{ 101, 0, 0, 0, 0, 0, 0, 99, 107, 1, 64, 108 }, // act 2 trigger4 (dead-end) (link 108)
{ 102, 0, 0, 103, 108, 99, 106, 0, 0, 32, 0, 0 },
{ 103, 0, 0, 0, 0, 104, 109, 102, 108, 34, 0, 0 },
{ 104, 103, 109, 105, 110, 0, 0, 0, 0, 37, 0, 0 },
{ 105, 106, 111, 0, 0, 109, 112, 104, 110, 42, 0, 0 },
{ 106, 0, 0, 107, 113, 105, 111, 0, 0, 35, 0, 0 },
{ 107, 0, 0, 0, 0, 108, 114, 106, 113, 24, 0, 0 },
{ 108, 107, 114, 0, 0, 0, 0, 0, 0, 19, 0, 0 },
{ 109, 105, 112, 114, 115, 0, 0, 110, 116, 32, 0, 0 },
{ 110, 0, 0, 109, 116, 111, 117, 0, 0, 46, 0, 0 },
{ 111, 110, 117, 112, 118, 0, 0, 0, 0, 53, 0, 0 },
{ 112, 0, 0, 0, 0, 113, 119, 111, 118, 42, 0, 0 },
{ 113, 112, 119, 0, 0, 0, 0, 0, 0, 1, 66, 125 }, // act 2 trigger6 (dead-end) (link 125)
{ 114, 115, 120, 0, 0, 116, 121, 109, 115, 34, 0, 0 },
{ 115, 0, 0, 0, 0, 114, 120, 0, 0, 24, 0, 0 },
{ 116, 114, 121, 0, 0, 0, 0, 117, 122, 31, 0, 0 },
{ 117, 0, 0, 116, 122, 118, 123, 0, 0, 21, 0, 0 },
{ 118, 117, 123, 119, 124, 120, 125, 0, 0, 20, 0, 0 },
{ 119, 0, 0, 0, 0, 0, 0, 118, 124, 19, 0, 0 },
{ 120, 118, 125, 123, 126, 0, 0, 121, 127, 24, 0, 0 },
{ 121, 122, 128, 120, 127, 0, 0, 0, 0, 34, 0, 0 },
{ 122, 0, 0, 0, 0, 121, 128, 0, 0, 61, 0, 0 },
{ 123, 0, 0, 0, 0, 124, 129, 120, 126, 32, 0, 0 },
{ 124, 123, 129, 0, 0, 0, 0, 125, 130, 37, 0, 0 },
{ 125, 0, 0, 124, 130, 126, 131, 0, 0, 41, 0, 0 },
{ 126, 125, 131, 0, 0, 127, 132, 133, 133, 34, 0, 0 },
{ 127, 126, 132, 128, 134, 0, 0, 0, 0, 43, 0, 0 },
{ 128, 129, 135, 0, 0, 130, 136, 127, 134, 47, 0, 0 },
{ 129, 0, 0, 0, 0, 128, 135, 0, 0, 68, 0, 0 },
{ 130, 128, 136, 0, 0, 0, 0, 131, 137, 53, 0, 0 },
{ 131, 132, 138, 130, 137, 0, 0, 0, 0, 59, 0, 0 },
{ 132, 0, 0, 0, 0, 131, 138, 0, 0, 84, 0, 0 },
{ 133, 134, 139, 126, 133, 0, 0, 0, 0, 23, 0, 0 },
{ 134, 0, 0, 0, 0, 133, 139, 135, 140, 26, 0, 0 },
{ 135, 136, 141, 134, 140, 0, 0, 0, 0, 29, 0, 0 },
{ 136, 139, 142, 0, 0, 135, 141, 137, 143, 31, 0, 0 },
{ 137, 0, 0, 136, 143, 138, 144, 0, 0, 47, 0, 0 },
{ 138, 137, 144, 0, 0, 0, 0, 0, 0, 83, 0, 0 },
{ 139, 140, 145, 0, 0, 136, 142, 141, 146, 43, 0, 0 },
{ 140, 0, 0, 0, 0, 139, 145, 0, 0, 67, 0, 0 },
{ 141, 0, 0, 139, 146, 0, 0, 0, 0, 1, 65, 104 }, // act 2 trigger5 (dead-end) (link 104)
{ 142, 143, 147, 95, 101, 0, 0, 0, 0, 31, 0, 0 },
{ 143, 0, 0, 0, 0, 142, 147, 144, 148, 34, 0, 0 },
{ 144, 0, 0, 143, 148, 145, 149, 0, 0, 38, 0, 0 },
{ 145, 144, 149, 0, 0, 0, 0, 146, 150, 43, 0, 0 },
{ 146, 0, 0, 145, 150, 147, 151, 148, 152, 46, 0, 0 },
{ 147, 146, 151, 0, 0, 0, 0, 0, 0, 1, 69, 187 }, // act 2 trigger9 (dead-end) (link 187)
{ 148, 149, 153, 146, 152, 0, 0, 0, 0, 49, 0, 0 },
{ 149, 0, 0, 0, 0, 148, 153, 0, 0, 61, 0, 0 },
{ 150, 97, 104, 0, 0, 151, 154, 177, 155, 32, 0, 0 },
{ 151, 150, 154, 0, 0, 154, 156, 152, 157, 35, 0, 0 },
{ 152, 153, 158, 151, 157, 0, 0, 0, 0, 41, 0, 0 },
{ 153, 0, 0, 0, 0, 152, 158, 0, 0, 59, 0, 0 },
{ 154, 151, 156, 157, 159, 162, 160, 155, 161, 31, 0, 0 },
{ 155, 156, 162, 154, 161, 0, 0, 0, 0, 45, 0, 0 },
{ 156, 0, 0, 0, 0, 155, 162, 0, 0, 62, 0, 0 },
{ 157, 0, 0, 0, 0, 158, 163, 154, 159, 42, 0, 0 },
{ 158, 157, 163, 159, 164, 0, 0, 0, 0, 51, 0, 0 },
{ 159, 0, 0, 0, 0, 160, 165, 158, 164, 24, 0, 0 },
{ 160, 159, 165, 0, 0, 0, 0, 161, 166, 31, 0, 0 },
{ 161, 0, 0, 160, 166, 0, 0, 0, 0, 1, 67, 168 }, // act 2 trigger7 (dead-end) (link 168)
{ 162, 154, 160, 164, 167, 165, 168, 163, 169, 32, 0, 0 },
{ 163, 0, 0, 162, 169, 0, 0, 0, 0, 45, 0, 0 },
{ 164, 0, 0, 0, 0, 0, 0, 162, 167, 48, 0, 0 },
{ 165, 162, 168, 0, 0, 166, 170, 170, 171, 33, 0, 0 },
{ 166, 165, 170, 167, 172, 0, 0, 168, 173, 41, 0, 0 },
{ 167, 0, 0, 0, 0, 0, 0, 166, 172, 61, 0, 0 },
{ 168, 169, 174, 166, 173, 0, 0, 0, 0, 57, 0, 0 },
{ 169, 0, 0, 0, 0, 168, 174, 0, 0, 73, 0, 0 },
{ 170, 171, 175, 165, 171, 0, 0, 0, 0, 34, 0, 0 },
{ 171, 0, 0, 0, 0, 170, 175, 172, 176, 30, 0, 0 },
{ 172, 173, 177, 171, 176, 0, 0, 0, 0, 26, 0, 0 },
{ 173, 0, 0, 0, 0, 172, 177, 174, 178, 46, 0, 0 },
{ 174, 175, 179, 173, 178, 0, 0, 0, 0, 36, 0, 0 },
{ 175, 0, 0, 176, 180, 174, 179, 0, 0, 25, 0, 0 },
{ 176, 0, 0, 0, 0, 0, 0, 175, 180, 1, 68, 182 }, // act 2 trigger8 (dead-end) (link 182)
{ 177, 0, 0, 150, 155, 178, 181, 179, 182, 35, 0, 0 },
{ 178, 177, 181, 0, 0, 0, 0, 0, 0, 83, 0, 0 },
{ 179, 180, 183, 177, 182, 0, 0, 0, 0, 31, 0, 0 },
{ 180, 0, 0, 0, 0, 179, 183, 181, 184, 36, 0, 0 },
{ 181, 182, 185, 180, 184, 183, 186, 0, 0, 41, 0, 0 },
{ 182, 0, 0, 0, 0, 181, 185, 0, 0, 61, 0, 0 },
{ 183, 181, 186, 0, 0, 0, 0, 184, 187, 26, 0, 0 },
{ 184, 0, 0, 183, 187, 185, 188, 0, 0, 34, 0, 0 },
{ 185, 184, 188, 186, 189, 0, 0, 188, 190, 1, 25, 0 }, // act 2 monster step point
{ 186, 187, 191, 0, 0, 0, 0, 185, 189, 47, 0, 0 },
{ 187, 0, 0, 0, 0, 186, 191, 0, 0, 81, 0, 0 },
{ 188, 189, 192, 185, 190, 190, 193, 0, 0, 26, 0, 0 },
{ 189, 0, 0, 0, 0, 188, 192, 0, 0, 71, 0, 0 },
{ 190, 188, 193, 0, 0, 191, 194, 0, 0, 1, 13, 0 }, // act 2 stairdown2
{ 191, 190, 194, 1, 1, 0, 0, 0, 0, 1, 14, 0 }, // act 2 stairup2
{ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
};
//
// This is the static position id list for 03 Act 3..
//
struct mapdata_posdatastatic gstructMapPosStatic03Act3[] =
{
// id, Nid, Nlk, Eid, Elk, Sid, Slk, Wid, Wlk, Pe, Spc, Clk
{ 1, 0, 0, 0, 0, 0, 0, 169, 1, 1, 5, 0 }, // act 3 end
{ 2, 0, 0, 3, 2, 0, 0, 0, 0, 1, 6, 0 }, // act 3 start
{ 3, 8, 3, 0, 0, 4, 4, 2, 2, 1, 29, 0 }, // act 3 first monster point
{ 4, 3, 4, 5, 5, 10, 6, 0, 0, 26, 0, 0 },
{ 5, 6, 7, 93, 8, 0, 0, 4, 5, 27, 0, 0 },
{ 6, 7, 9, 9, 10, 5, 7, 0, 0, 28, 0, 0 },
{ 7, 0, 0, 0, 0, 6, 9, 8, 11, 29, 0, 0 },
{ 8, 31, 12, 7, 11, 3, 3, 0, 0, 26, 0, 0 },
{ 9, 0, 0, 94, 13, 0, 0, 6, 10, 1, 15, 0 }, // act 3 stairdown1
{ 10, 4, 6, 18, 14, 0, 0, 11, 15, 28, 0, 0 },
{ 11, 0, 0, 10, 15, 12, 16, 0, 0, 34, 0, 0 },
{ 12, 11, 16, 15, 17, 0, 0, 13, 18, 41, 0, 0 },
{ 13, 0, 0, 12, 18, 14, 19, 0, 0, 56, 0, 0 },
{ 14, 13, 19, 0, 0, 0, 0, 0, 0, 69, 0, 0 },
{ 15, 0, 0, 0, 0, 16, 20, 12, 17, 58, 0, 0 },
{ 16, 15, 20, 0, 0, 0, 0, 17, 21, 71, 0, 0 },
{ 17, 0, 0, 16, 21, 0, 0, 0, 0, 84, 0, 0 },
{ 18, 0, 0, 0, 0, 19, 22, 10, 14, 31, 0, 0 },
{ 19, 18, 22, 23, 23, 0, 0, 20, 173, 40, 0, 0 },
{ 20, 0, 0, 19, 173, 21, 24, 0, 0, 48, 0, 0 },
{ 21, 20, 24, 22, 25, 0, 0, 0, 0, 57, 0, 0 },
{ 22, 0, 0, 0, 0, 0, 0, 21, 25, 74, 0, 0 },
{ 23, 25, 26, 27, 27, 24, 28, 19, 23, 43, 0, 0 },
{ 24, 23, 28, 0, 0, 0, 0, 0, 0, 82, 0, 0 },
{ 25, 0, 0, 0, 0, 23, 26, 26, 29, 48, 0, 0 },
{ 26, 0, 0, 25, 29, 0, 0, 0, 0, 1, 71, 8 }, // act 3 trigger1 (dead-end) (link 8)
{ 27, 0, 0, 0, 0, 28, 30, 23, 27, 49, 0, 0 },
{ 28, 27, 30, 29, 31, 0, 0, 0, 0, 57, 0, 0 },
{ 29, 30, 32, 0, 0, 0, 0, 28, 31, 71, 0, 0 },
{ 30, 0, 0, 0, 0, 29, 32, 0, 0, 84, 0, 0 },
{ 31, 0, 0, 35, 33, 8, 12, 32, 34, 31, 0, 0 },
{ 32, 33, 35, 31, 34, 0, 0, 0, 0, 45, 0, 0 },
{ 33, 0, 0, 34, 36, 32, 35, 0, 0, 59, 0, 0 },
{ 34, 0, 0, 0, 0, 0, 0, 33, 36, 84, 0, 0 },
{ 35, 39, 37, 36, 38, 0, 0, 31, 33, 41, 0, 0 },
{ 36, 0, 0, 0, 0, 37, 39, 35, 38, 31, 0, 0 },
{ 37, 36, 39, 38, 40, 0, 0, 0, 0, 24, 0, 0 },
{ 38, 41, 41, 0, 0, 0, 0, 37, 40, 30, 0, 0 },
{ 39, 0, 0, 40, 42, 35, 37, 0, 0, 45, 0, 0 },
{ 40, 0, 0, 0, 0, 41, 43, 39, 42, 48, 0, 0 },
{ 41, 40, 43, 42, 44, 38, 41, 0, 0, 36, 0, 0 },
{ 42, 43, 45, 0, 0, 0, 0, 41, 44, 38, 0, 0 },
{ 43, 0, 0, 44, 46, 42, 45, 0, 0, 42, 0, 0 },
{ 44, 47, 47, 0, 0, 45, 48, 43, 46, 45, 0, 0 },
{ 45, 44, 48, 0, 0, 0, 0, 46, 49, 51, 0, 0 },
{ 46, 0, 0, 45, 49, 0, 0, 0, 0, 73, 0, 0 },
{ 47, 0, 0, 48, 50, 44, 47, 0, 0, 39, 0, 0 },
{ 48, 0, 0, 0, 0, 49, 51, 47, 50, 36, 0, 0 },
{ 49, 48, 51, 50, 52, 0, 0, 0, 0, 34, 0, 0 },
{ 50, 51, 53, 0, 0, 52, 54, 49, 52, 42, 0, 0 },
{ 51, 0, 0, 0, 0, 50, 53, 0, 0, 74, 0, 0 },
{ 52, 50, 54, 0, 0, 0, 0, 53, 55, 37, 0, 0 },
{ 53, 0, 0, 52, 55, 54, 56, 0, 0, 35, 0, 0 },
{ 54, 53, 56, 56, 57, 0, 0, 55, 58, 41, 0, 0 },
{ 55, 0, 0, 54, 58, 0, 0, 0, 0, 84, 0, 0 },
{ 56, 0, 0, 57, 59, 58, 60, 54, 57, 43, 0, 0 },
{ 57, 0, 0, 0, 0, 0, 0, 56, 59, 79, 0, 0 },
{ 58, 56, 60, 59, 61, 0, 0, 0, 0, 35, 0, 0 },
{ 59, 0, 0, 0, 0, 60, 62, 58, 61, 24, 0, 0 },
{ 60, 59, 62, 0, 0, 0, 0, 61, 63, 23, 0, 0 },
{ 61, 0, 0, 60, 63, 62, 64, 0, 0, 21, 0, 0 },
{ 62, 61, 64, 63, 65, 0, 0, 0, 0, 28, 0, 0 },
{ 63, 0, 0, 0, 0, 64, 66, 62, 65, 25, 0, 0 },
{ 64, 63, 66, 0, 0, 0, 0, 65, 67, 24, 0, 0 },
{ 65, 70, 68, 64, 67, 66, 69, 68, 70, 21, 0, 0 },
{ 66, 65, 69, 0, 0, 0, 0, 67, 71, 37, 0, 0 },
{ 67, 0, 0, 66, 71, 0, 0, 0, 0, 81, 0, 0 },
{ 68, 69, 72, 65, 70, 0, 0, 0, 0, 45, 0, 0 },
{ 69, 0, 0, 0, 0, 68, 72, 0, 0, 79, 0, 0 },
{ 70, 0, 0, 0, 0, 65, 68, 71, 73, 21, 0, 0 },
{ 71, 72, 74, 70, 73, 0, 0, 0, 0, 25, 0, 0 },
{ 72, 0, 0, 73, 75, 71, 74, 0, 0, 27, 0, 0 },
{ 73, 74, 76, 0, 0, 0, 0, 72, 75, 21, 0, 0 },
{ 74, 0, 0, 0, 0, 73, 76, 75, 77, 28, 0, 0 },
{ 75, 76, 78, 74, 77, 0, 0, 0, 0, 26, 0, 0 },
{ 76, 0, 0, 0, 0, 75, 78, 77, 79, 29, 0, 0 },
{ 77, 78, 80, 76, 79, 83, 81, 0, 0, 34, 0, 0 },
{ 78, 0, 0, 0, 0, 77, 80, 79, 82, 41, 0, 0 },
{ 79, 80, 83, 78, 82, 81, 84, 0, 0, 45, 0, 0 },
{ 80, 0, 0, 0, 0, 79, 83, 0, 0, 82, 0, 0 },
{ 81, 79, 84, 0, 0, 0, 0, 82, 85, 43, 0, 0 },
{ 82, 0, 0, 81, 85, 0, 0, 0, 0, 1, 72, 10 }, // act 3 trigger2 (dead-end) (link 10)
{ 83, 77, 81, 84, 86, 0, 0, 87, 87, 51, 0, 0 },
{ 84, 85, 88, 0, 0, 86, 89, 83, 86, 68, 0, 0 },
{ 85, 0, 0, 0, 0, 84, 88, 0, 0, 72, 0, 0 },
{ 86, 84, 89, 0, 0, 0, 0, 0, 0, 79, 0, 0 },
{ 87, 91, 90, 83, 87, 88, 91, 0, 0, 56, 0, 0 },
{ 88, 87, 91, 89, 92, 0, 0, 0, 0, 69, 0, 0 },
{ 89, 0, 0, 0, 0, 90, 93, 88, 92, 75, 0, 0 },
{ 90, 89, 93, 0, 0, 0, 0, 0, 0, 83, 0, 0 },
{ 91, 0, 0, 0, 0, 87, 90, 92, 94, 61, 0, 0 },
{ 92, 0, 0, 91, 94, 93, 95, 0, 0, 56, 0, 0 },
{ 93, 92, 95, 0, 0, 0, 0, 5, 8, 43, 0, 0 },
{ 94, 95, 96, 97, 97, 96, 98, 9, 13, 1, 16, 0 }, // act 3 stairup1
{ 95, 0, 0, 0, 0, 94, 96, 0, 0, 32, 0, 0 },
{ 96, 94, 98, 0, 0, 0, 0, 0, 0, 34, 0, 0 },
{ 97, 0, 0, 0, 0, 98, 99, 94, 97, 1, 26, 0 }, // act 3 elbow with collapse
{ 98, 97, 99, 0, 0, 0, 0, 99, 100, 32, 0, 0 },
{ 99, 0, 0, 98, 100, 100, 101, 0, 0, 30, 0, 0 },
{ 100, 99, 101, 104, 102, 106, 103, 101, 104, 28, 0, 0 },
{ 101, 0, 0, 100, 104, 102, 105, 0, 0, 38, 0, 0 },
{ 102, 101, 105, 103, 106, 0, 0, 0, 0, 1, 73, 109 }, // act 3 trigger3 (elbow) (link 109)
{ 103, 0, 0, 0, 0, 0, 0, 102, 106, 72, 0, 0 },
{ 104, 105, 107, 0, 0, 0, 0, 100, 102, 45, 0, 0 },
{ 105, 0, 0, 0, 0, 104, 107, 0, 0, 74, 0, 0 },
{ 106, 100, 103, 107, 108, 0, 0, 0, 0, 31, 0, 0 },
{ 107, 0, 0, 0, 0, 108, 109, 106, 108, 28, 0, 0 },
{ 108, 107, 109, 109, 110, 0, 0, 0, 0, 41, 0, 0 },
{ 109, 114, 111, 110, 112, 0, 0, 108, 110, 28, 0, 0 },
{ 110, 111, 113, 0, 0, 0, 0, 109, 112, 39, 0, 0 },
{ 111, 113, 114, 112, 115, 110, 113, 0, 0, 51, 0, 0 },
{ 112, 0, 0, 0, 0, 0, 0, 111, 115, 83, 0, 0 },
{ 113, 0, 0, 0, 0, 111, 114, 0, 0, 85, 0, 0 },
{ 114, 0, 0, 115, 116, 109, 111, 0, 0, 36, 0, 0 },
{ 115, 116, 117, 0, 0, 0, 0, 114, 116, 32, 0, 0 },
{ 116, 0, 0, 0, 0, 115, 117, 117, 118, 35, 0, 0 },
{ 117, 118, 119, 116, 118, 0, 0, 0, 0, 37, 0, 0 },
{ 118, 0, 0, 119, 120, 117, 119, 0, 0, 32, 0, 0 },
{ 119, 120, 121, 0, 0, 0, 0, 118, 120, 28, 0, 0 },
{ 120, 121, 122, 0, 0, 119, 121, 123, 123, 1, 27, 0 }, // act 3 t-intersect with collapse
{ 121, 0, 0, 0, 0, 120, 122, 0, 0, 24, 0, 0 },
{ 122, 123, 124, 0, 0, 0, 0, 0, 0, 29, 0, 0 },
{ 123, 124, 125, 120, 123, 122, 124, 0, 0, 1, 28, 0 }, // act 3 t-intersect with collapse2
{ 124, 0, 0, 0, 0, 123, 125, 125, 126, 27, 0, 0 },
{ 125, 126, 127, 124, 126, 0, 0, 0, 0, 34, 0, 0 },
{ 126, 132, 128, 137, 129, 125, 127, 127, 130, 36, 0, 0 },
{ 127, 0, 0, 126, 130, 128, 131, 130, 132, 32, 0, 0 },
{ 128, 127, 131, 129, 133, 0, 0, 0, 0, 45, 0, 0 },
{ 129, 0, 0, 0, 0, 0, 0, 128, 133, 84, 0, 0 },
{ 130, 131, 134, 127, 132, 0, 0, 0, 0, 1, 74, 128 }, // act 3 trigger4 (elbow) (link 128)
{ 131, 0, 0, 0, 0, 130, 134, 0, 0, 72, 0, 0 },
{ 132, 0, 0, 134, 135, 126, 128, 133, 136, 47, 0, 0 },
{ 133, 0, 0, 132, 136, 0, 0, 0, 0, 81, 0, 0 },
{ 134, 135, 137, 0, 0, 0, 0, 132, 135, 74, 0, 0 },
{ 135, 0, 0, 136, 138, 134, 137, 0, 0, 93, 0, 0 },
{ 136, 0, 0, 0, 0, 0, 0, 135, 138, 98, 0, 0 },
{ 137, 140, 139, 138, 140, 0, 0, 126, 129, 38, 0, 0 },
{ 138, 139, 141, 0, 0, 0, 0, 137, 140, 51, 0, 0 },
{ 139, 0, 0, 0, 0, 138, 141, 0, 0, 83, 0, 0 },
{ 140, 0, 0, 141, 142, 137, 139, 0, 0, 30, 0, 0 },
{ 141, 0, 0, 145, 143, 142, 144, 140, 142, 42, 0, 0 },
{ 142, 141, 144, 0, 0, 0, 0, 143, 145, 58, 0, 0 },
{ 143, 0, 0, 142, 145, 144, 146, 0, 0, 74, 0, 0 },
{ 144, 143, 146, 0, 0, 0, 0, 0, 0, 92, 0, 0 },
{ 145, 146, 147, 149, 148, 156, 149, 141, 143, 36, 0, 0 },
{ 146, 0, 0, 148, 150, 145, 147, 147, 151, 45, 0, 0 },
{ 147, 0, 0, 146, 151, 0, 0, 0, 0, 85, 0, 0 },
{ 148, 0, 0, 0, 0, 149, 152, 146, 150, 47, 0, 0 },
{ 149, 148, 152, 150, 153, 0, 0, 145, 148, 37, 0, 0 },
{ 150, 0, 0, 0, 0, 151, 154, 149, 153, 43, 0, 0 },
{ 151, 150, 154, 0, 0, 153, 155, 152, 156, 48, 0, 0 },
{ 152, 0, 0, 151, 156, 0, 0, 0, 0, 1, 75, 149 }, // act 3 trigger5 (dead-end) (link 149)
{ 153, 151, 155, 154, 157, 0, 0, 0, 0, 57, 0, 0 },
{ 154, 0, 0, 0, 0, 155, 158, 153, 157, 63, 0, 0 },
{ 155, 154, 158, 0, 0, 0, 0, 0, 0, 83, 0, 0 },
{ 156, 145, 149, 159, 159, 162, 160, 157, 161, 43, 0, 0 },
{ 157, 158, 162, 156, 161, 0, 0, 0, 0, 58, 0, 0 },
{ 158, 0, 0, 0, 0, 157, 162, 0, 0, 83, 0, 0 },
{ 159, 0, 0, 0, 0, 160, 163, 156, 159, 61, 0, 0 },
{ 160, 159, 163, 161, 164, 0, 0, 0, 0, 74, 0, 0 },
{ 161, 0, 0, 0, 0, 0, 0, 160, 164, 95, 0, 0 },
{ 162, 156, 160, 0, 0, 168, 165, 163, 166, 42, 0, 0 },
{ 163, 0, 0, 162, 166, 164, 167, 0, 0, 40, 0, 0 },
{ 164, 163, 167, 168, 168, 165, 169, 0, 0, 1, 28, 0 }, // act 3 t-intersect with collapse2
{ 165, 164, 169, 166, 170, 0, 0, 0, 0, 64, 0, 0 },
{ 166, 0, 0, 0, 0, 167, 171, 165, 170, 84, 0, 0 },
{ 167, 166, 171, 0, 0, 0, 0, 0, 0, 95, 0, 0 },
{ 168, 162, 165, 169, 172, 0, 0, 164, 168, 1, 17, 0 }, // act 3 stairdown2
{ 169, 0, 0, 1, 1, 0, 0, 168, 172, 1, 18, 0 }, // act 3 stairup2
{ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
};
//
// This is the static position id list for 03 Act 4..
//
struct mapdata_posdatastatic gstructMapPosStatic03Act4[] =
{
// id, Nid, Nlk, Eid, Elk, Sid, Slk, Wid, Wlk, Pe, Spc, Clk
{ 1, 162, 1, 0, 0, 0, 0, 0, 0, 1, 7, 0 }, // act 4 end
{ 2, 0, 0, 0, 0, 3, 2, 0, 0, 1, 8, 0 }, // act 4 start
{ 3, 2, 2, 8, 3, 0, 0, 4, 4, 19, 0, 0 },
{ 4, 0, 0, 3, 4, 5, 5, 21, 6, 28, 0, 0 },
{ 5, 4, 5, 6, 7, 16, 8, 0, 0, 34, 0, 0 },
{ 6, 0, 0, 7, 9, 15, 10, 5, 7, 41, 0, 0 },
{ 7, 8, 12, 0, 0, 14, 11, 6, 9, 33, 0, 0 },
{ 8, 0, 0, 9, 13, 7, 12, 3, 3, 26, 0, 0 },
{ 9, 10, 14, 0, 0, 11, 15, 8, 13, 32, 0, 0 },
{ 10, 0, 0, 0, 0, 9, 14, 0, 0, 74, 0, 0 },
{ 11, 9, 15, 57, 16, 12, 17, 0, 0, 45, 0, 0 },
{ 12, 11, 17, 0, 0, 13, 18, 14, 19, 34, 0, 0 },
{ 13, 12, 18, 0, 0, 0, 0, 0, 0, 76, 0, 0 },
{ 14, 7, 11, 12, 19, 0, 0, 15, 20, 38, 0, 0 },
{ 15, 6, 10, 14, 20, 23, 21, 16, 22, 43, 0, 0 },
{ 16, 5, 8, 15, 22, 0, 0, 17, 23, 36, 0, 0 },
{ 17, 19, 25, 16, 23, 18, 24, 0, 0, 27, 0, 0 },
{ 18, 17, 24, 0, 0, 77, 26, 0, 0, 1, 19, 0 }, // act 4 stairdown1
{ 19, 21, 26, 0, 0, 17, 25, 20, 27, 16, 0, 0 },
{ 20, 0, 0, 19, 27, 0, 0, 0, 0, 1, 31, 0 }, // stairs back up to act 3
{ 21, 22, 28, 4, 6, 19, 26, 0, 0, 21, 0, 0 },
{ 22, 0, 0, 0, 0, 21, 28, 0, 0, 15, 0, 0 },
{ 23, 15, 21, 24, 29, 0, 0, 0, 0, 45, 0, 0 },
{ 24, 0, 0, 0, 0, 25, 30, 23, 29, 47, 0, 0 },
{ 25, 24, 30, 40, 31, 0, 0, 26, 32, 43, 0, 0 },
{ 26, 0, 0, 25, 32, 27, 33, 0, 0, 42, 0, 0 },
{ 27, 26, 33, 0, 0, 0, 0, 28, 34, 48, 0, 0 },
{ 28, 29, 35, 27, 34, 30, 36, 33, 37, 43, 0, 0 },
{ 29, 0, 0, 0, 0, 28, 35, 0, 0, 82, 0, 0 },
{ 30, 28, 36, 31, 38, 0, 0, 0, 0, 58, 0, 0 },
{ 31, 32, 39, 0, 0, 0, 0, 30, 38, 68, 0, 0 },
{ 32, 0, 0, 0, 0, 31, 39, 0, 0, 84, 0, 0 },
{ 33, 34, 40, 28, 37, 37, 41, 0, 0, 61, 0, 0 },
{ 34, 0, 0, 0, 0, 33, 40, 35, 42, 68, 0, 0 },
{ 35, 36, 43, 34, 42, 0, 0, 0, 0, 81, 0, 0 },
{ 36, 0, 0, 0, 0, 35, 43, 0, 0, 97, 0, 0 },
{ 37, 33, 41, 39, 45, 0, 0, 38, 44, 75, 0, 0 },
{ 38, 0, 0, 37, 44, 0, 0, 0, 0, 84, 0, 0 },
{ 39, 0, 0, 0, 0, 0, 0, 37, 45, 85, 0, 0 },
{ 40, 0, 0, 0, 0, 41, 46, 25, 31, 51, 0, 0 },
{ 41, 40, 46, 45, 47, 0, 0, 42, 48, 53, 0, 0 },
{ 42, 0, 0, 41, 48, 43, 49, 0, 0, 63, 0, 0 },
{ 43, 42, 49, 44, 50, 0, 0, 0, 0, 71, 0, 0 },
{ 44, 0, 0, 0, 0, 0, 0, 43, 50, 80, 0, 0 },
{ 45, 46, 51, 0, 0, 0, 0, 41, 47, 45, 0, 0 },
{ 46, 0, 0, 47, 52, 45, 51, 0, 0, 42, 0, 0 },
{ 47, 48, 53, 0, 0, 0, 0, 46, 52, 46, 0, 0 },
{ 48, 0, 0, 49, 54, 47, 53, 0, 0, 43, 0, 0 },
{ 49, 54, 55, 0, 0, 50, 56, 48, 54, 42, 0, 0 },
{ 50, 49, 56, 0, 0, 0, 0, 51, 57, 53, 0, 0 },
{ 51, 0, 0, 50, 57, 52, 58, 0, 0, 59, 0, 0 },
{ 52, 51, 58, 53, 59, 0, 0, 0, 0, 68, 0, 0 },
{ 53, 0, 0, 0, 0, 0, 0, 52, 59, 81, 0, 0 },
{ 54, 0, 0, 0, 0, 49, 55, 55, 60, 41, 0, 0 },
{ 55, 56, 61, 54, 60, 0, 0, 0, 0, 40, 0, 0 },
{ 56, 62, 62, 0, 0, 55, 61, 57, 63, 34, 0, 0 },
{ 57, 0, 0, 56, 63, 58, 64, 11, 16, 42, 0, 0 },
{ 58, 57, 64, 59, 65, 0, 0, 0, 0, 56, 0, 0 },
{ 59, 0, 0, 0, 0, 60, 66, 58, 65, 69, 0, 0 },
{ 60, 59, 66, 0, 0, 0, 0, 61, 67, 82, 0, 0 },
{ 61, 0, 0, 60, 67, 0, 0, 0, 0, 96, 0, 0 },
{ 62, 0, 0, 67, 68, 56, 62, 63, 69, 43, 0, 0 },
{ 63, 65, 70, 62, 69, 64, 71, 0, 0, 51, 0, 0 },
{ 64, 63, 71, 0, 0, 0, 0, 0, 0, 84, 0, 0 },
{ 65, 0, 0, 66, 72, 63, 70, 0, 0, 62, 0, 0 },
{ 66, 0, 0, 0, 0, 0, 0, 65, 72, 94, 0, 0 },
{ 67, 0, 0, 71, 73, 68, 74, 62, 68, 51, 0, 0 },
{ 68, 67, 74, 69, 75, 0, 0, 0, 0, 60, 0, 0 },
{ 69, 0, 0, 0, 0, 70, 76, 68, 75, 68, 0, 0 },
{ 70, 69, 76, 0, 0, 0, 0, 0, 0, 84, 0, 0 },
{ 71, 72, 77, 0, 0, 0, 0, 67, 73, 56, 0, 0 },
{ 72, 75, 78, 0, 0, 71, 77, 73, 79, 59, 0, 0 },
{ 73, 74, 80, 72, 79, 0, 0, 0, 0, 63, 0, 0 },
{ 74, 0, 0, 0, 0, 73, 80, 0, 0, 94, 0, 0 },
{ 75, 0, 0, 0, 0, 72, 78, 76, 81, 74, 0, 0 },
{ 76, 0, 0, 75, 81, 0, 0, 0, 0, 91, 0, 0 },
{ 77, 18, 26, 0, 0, 0, 0, 78, 82, 1, 20, 0 }, // act 4 stairup1
{ 78, 0, 0, 77, 82, 127, 83, 79, 84, 32, 0, 0 },
{ 79, 80, 85, 78, 84, 84, 86, 81, 87, 41, 0, 0 },
{ 80, 0, 0, 0, 0, 79, 85, 0, 0, 82, 0, 0 },
{ 81, 82, 88, 79, 87, 0, 0, 0, 0, 56, 0, 0 },
{ 82, 0, 0, 0, 0, 81, 88, 83, 89, 72, 0, 0 },
{ 83, 0, 0, 82, 89, 0, 0, 0, 0, 95, 0, 0 },
{ 84, 79, 86, 127, 90, 85, 91, 0, 0, 32, 0, 0 },
{ 85, 84, 91, 110, 92, 0, 0, 86, 93, 43, 0, 0 },
{ 86, 87, 94, 85, 93, 0, 0, 0, 0, 32, 0, 0 },
{ 87, 0, 0, 0, 0, 86, 94, 88, 95, 34, 0, 0 },
{ 88, 89, 96, 87, 95, 0, 0, 0, 0, 42, 0, 0 },
{ 89, 0, 0, 0, 0, 88, 96, 90, 97, 36, 0, 0 },
{ 90, 91, 98, 89, 97, 93, 99, 0, 0, 26, 0, 0 },
{ 91, 0, 0, 0, 0, 90, 98, 92, 100, 54, 0, 0 },
{ 92, 0, 0, 91, 100, 0, 0, 0, 0, 72, 0, 0 },
{ 93, 90, 99, 0, 0, 96, 101, 94, 102, 42, 0, 0 },
{ 94, 95, 103, 93, 102, 0, 0, 0, 0, 61, 0, 0 },
{ 95, 0, 0, 0, 0, 94, 103, 0, 0, 89, 0, 0 },
{ 96, 93, 101, 102, 104, 0, 0, 97, 105, 23, 0, 0 },
{ 97, 0, 0, 96, 105, 98, 106, 0, 0, 37, 0, 0 },
{ 98, 97, 106, 99, 107, 0, 0, 0, 0, 48, 0, 0 },
{ 99, 0, 0, 0, 0, 100, 108, 98, 107, 62, 0, 0 },
{ 100, 99, 108, 0, 0, 0, 0, 101, 109, 78, 0, 0 },
{ 101, 0, 0, 100, 109, 0, 0, 0, 0, 96, 0, 0 },
{ 102, 0, 0, 0, 0, 103, 110, 96, 104, 23, 0, 0 },
{ 103, 102, 110, 104, 111, 0, 0, 0, 0, 19, 0, 0 },
{ 104, 0, 0, 0, 0, 105, 112, 103, 111, 23, 0, 0 },
{ 105, 104, 112, 107, 113, 0, 0, 106, 114, 45, 0, 0 },
{ 106, 0, 0, 105, 114, 0, 0, 0, 0, 95, 0, 0 },
{ 107, 108, 115, 0, 0, 0, 0, 105, 113, 24, 0, 0 },
{ 108, 0, 0, 109, 116, 107, 115, 0, 0, 31, 0, 0 },
{ 109, 110, 117, 115, 118, 111, 119, 108, 116, 38, 0, 0 },
{ 110, 0, 0, 0, 0, 109, 117, 85, 92, 83, 0, 0 },
{ 111, 109, 119, 112, 120, 114, 121, 0, 0, 15, 0, 0 },
{ 112, 0, 0, 0, 0, 113, 122, 111, 120, 45, 0, 0 },
{ 113, 112, 122, 0, 0, 0, 0, 114, 123, 74, 0, 0 },
{ 114, 111, 121, 113, 123, 0, 0, 0, 0, 47, 0, 0 },
{ 115, 116, 124, 0, 0, 0, 0, 109, 118, 24, 0, 0 },
{ 116, 0, 0, 117, 125, 115, 124, 0, 0, 23, 0, 0 },
{ 117, 0, 0, 0, 0, 118, 126, 116, 125, 28, 0, 0 },
{ 118, 117, 126, 119, 127, 0, 0, 0, 0, 22, 0, 0 },
{ 119, 120, 128, 0, 0, 0, 0, 118, 127, 32, 0, 0 },
{ 120, 0, 0, 121, 129, 119, 128, 0, 0, 26, 0, 0 },
{ 121, 122, 130, 0, 0, 0, 0, 120, 129, 21, 0, 0 },
{ 122, 0, 0, 0, 0, 121, 130, 123, 131, 23, 0, 0 },
{ 123, 124, 132, 122, 131, 0, 0, 0, 0, 18, 0, 0 },
{ 124, 0, 0, 125, 133, 123, 132, 0, 0, 32, 0, 0 },
{ 125, 0, 0, 0, 0, 126, 134, 124, 133, 26, 0, 0 },
{ 126, 125, 134, 145, 135, 0, 0, 0, 0, 34, 0, 0 },
{ 127, 78, 83, 128, 136, 0, 0, 84, 90, 38, 0, 0 },
{ 128, 0, 0, 0, 0, 129, 137, 127, 136, 41, 0, 0 },
{ 129, 128, 137, 130, 138, 0, 0, 0, 0, 45, 0, 0 },
{ 130, 133, 139, 131, 140, 0, 0, 129, 138, 34, 0, 0 },
{ 131, 132, 141, 0, 0, 0, 0, 130, 140, 53, 0, 0 },
{ 132, 0, 0, 0, 0, 131, 141, 0, 0, 96, 0, 0 },
{ 133, 0, 0, 0, 0, 130, 139, 134, 142, 32, 0, 0 },
{ 134, 135, 143, 133, 142, 0, 0, 0, 0, 27, 0, 0 },
{ 135, 0, 0, 136, 144, 134, 143, 0, 0, 24, 0, 0 },
{ 136, 137, 145, 0, 0, 0, 0, 135, 144, 23, 0, 0 },
{ 137, 0, 0, 138, 146, 136, 145, 0, 0, 26, 0, 0 },
{ 138, 0, 0, 0, 0, 139, 147, 137, 146, 21, 0, 0 },
{ 139, 138, 147, 140, 148, 0, 0, 0, 0, 28, 0, 0 },
{ 140, 141, 149, 0, 0, 0, 0, 139, 148, 34, 0, 0 },
{ 141, 0, 0, 142, 150, 140, 149, 0, 0, 32, 0, 0 },
{ 142, 0, 0, 0, 0, 143, 151, 141, 150, 31, 0, 0 },
{ 143, 142, 151, 144, 152, 0, 0, 0, 0, 38, 0, 0 },
{ 144, 0, 0, 0, 0, 145, 153, 143, 152, 42, 0, 0 },
{ 145, 144, 153, 0, 0, 146, 154, 126, 135, 35, 0, 0 },
{ 146, 145, 154, 0, 0, 0, 0, 147, 155, 24, 0, 0 },
{ 147, 0, 0, 146, 155, 148, 156, 0, 0, 36, 0, 0 },
{ 148, 147, 156, 149, 157, 0, 0, 151, 158, 36, 0, 0 },
{ 149, 150, 159, 0, 0, 0, 0, 148, 157, 56, 0, 0 },
{ 150, 0, 0, 0, 0, 149, 159, 0, 0, 94, 0, 0 },
{ 151, 0, 0, 148, 158, 0, 0, 152, 160, 1, 30, 0 }, // act 4 ginger encounter
{ 152, 0, 0, 151, 160, 157, 161, 153, 162, 34, 0, 0 },
{ 153, 0, 0, 152, 162, 154, 163, 0, 0, 28, 0, 0 },
{ 154, 153, 163, 157, 164, 0, 0, 155, 165, 53, 0, 0 },
{ 155, 0, 0, 154, 165, 156, 166, 0, 0, 73, 0, 0 },
{ 156, 155, 166, 0, 0, 0, 0, 0, 0, 95, 0, 0 },
{ 157, 152, 161, 158, 167, 162, 168, 154, 164, 32, 0, 0 },
{ 158, 0, 0, 0, 0, 159, 169, 157, 167, 45, 0, 0 },
{ 159, 158, 169, 160, 170, 0, 0, 0, 0, 63, 0, 0 },
{ 160, 161, 171, 0, 0, 0, 0, 159, 170, 74, 0, 0 },
{ 161, 0, 0, 0, 0, 160, 171, 0, 0, 97, 0, 0 },
{ 162, 157, 168, 0, 0, 1, 1, 0, 0, 14, 0, 0 },
{ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
};
//
// sub-function to perform checks on map data
//
// returns 1 for a mem init error.
// returns 6 for a map static data error.
//
int mapdata_verifyStaticMapData (struct mapdata_posdatastatic *pstructMapDataStatic, char *pszMapName)
{
short sOffset1;
short sOffset2;
short sMapPosStaticCurrentSize;
short sLinkMax = 0;
#ifdef INTERFACE_CURSES
char szBuffer[200];
int iRet;
#endif
sOffset1 = 0;
// first pass to figure out the size of the map data.
while (1)
{
if (pstructMapDataStatic[sOffset1].sPosId == -1)
break;
sOffset1++;
if (sOffset1 > 1000)
{
#ifdef INTERFACE_CURSES
sprintf (szBuffer, "%s: Initial Scan PosId limit error.\n", pszMapName);
iRet = mutils_addToDialogBuffer (szBuffer);
if (iRet != 0) return iRet;
#endif
return 6;
}
}
if (sOffset1 == 0)
{
#ifdef INTERFACE_CURSES
sprintf (szBuffer, "%s: Empty list.\n", pszMapName);
iRet = mutils_addToDialogBuffer (szBuffer);
if (iRet != 0) return iRet;
#endif
return 6;
}
sMapPosStaticCurrentSize = sOffset1;
// second pass to make sure all of the offsets are within bounds (and to figure out what the Link max is).
for (sOffset1 = 0; sMapPosStaticCurrentSize > sOffset1; sOffset1++)
{
if (pstructMapDataStatic[sOffset1].sPosId != (sOffset1 + 1))
{
#ifdef INTERFACE_CURSES
sprintf (szBuffer, "%s: Invalid offset for %d\n", pszMapName, pstructMapDataStatic[sOffset1].sPosId);
iRet = mutils_addToDialogBuffer (szBuffer);
if (iRet != 0) return iRet;
#endif
return 6;
}
if (pstructMapDataStatic[sOffset1].sLinkIdNorth > 0)
{
if (sLinkMax < pstructMapDataStatic[sOffset1].sLinkIdNorth)
sLinkMax = pstructMapDataStatic[sOffset1].sLinkIdNorth;
}
if (pstructMapDataStatic[sOffset1].sLinkIdEast > 0)
{
if (sLinkMax < pstructMapDataStatic[sOffset1].sLinkIdEast)
sLinkMax = pstructMapDataStatic[sOffset1].sLinkIdEast;
}
if (pstructMapDataStatic[sOffset1].sLinkIdSouth > 0)
{
if (sLinkMax < pstructMapDataStatic[sOffset1].sLinkIdSouth)
sLinkMax = pstructMapDataStatic[sOffset1].sLinkIdSouth;
}
if (pstructMapDataStatic[sOffset1].sLinkIdWest > 0)
{
if (sLinkMax < pstructMapDataStatic[sOffset1].sLinkIdWest)
sLinkMax = pstructMapDataStatic[sOffset1].sLinkIdWest;
}
}
if (sLinkMax > 1000)
{
#ifdef INTERFACE_CURSES
sprintf (szBuffer, "%s: Initial Scan LinkId limit error.\n", pszMapName);
iRet = mutils_addToDialogBuffer (szBuffer);
if (iRet != 0) return iRet;
#endif
return 6;
}
// third pass to check all of the movement linkages, and if control links are within bounds.
for (sOffset1 = 0; sMapPosStaticCurrentSize > sOffset1; sOffset1++)
{
if (pstructMapDataStatic[sOffset1].sPosIdNorth != 0)
{
if (pstructMapDataStatic[sOffset1].sPosIdNorth == (sOffset1 + 1))
{
#ifdef INTERFACE_CURSES
sprintf (szBuffer, "%s: North End-less Loop Join for %d\n", pszMapName, (sOffset1 + 1));
iRet = mutils_addToDialogBuffer (szBuffer);
if (iRet != 0) return iRet;
#endif
return 6;
}
if ((pstructMapDataStatic[sOffset1].sPosIdNorth > sMapPosStaticCurrentSize) || (pstructMapDataStatic[sOffset1].sPosIdNorth < 0))
{
#ifdef INTERFACE_CURSES
sprintf (szBuffer, "%s: North Join out of bounds for %d\n", pszMapName, (sOffset1 + 1));
iRet = mutils_addToDialogBuffer (szBuffer);
if (iRet != 0) return iRet;
#endif
return 6;
}
if (pstructMapDataStatic[sOffset1].sLinkIdNorth == 0)
{
#ifdef INTERFACE_CURSES
sprintf (szBuffer, "%s: North Join %d missing LinkId\n", pszMapName, (sOffset1 + 1));
iRet = mutils_addToDialogBuffer (szBuffer);
if (iRet != 0) return iRet;
#endif
return 6;
}
sOffset2 = pstructMapDataStatic[sOffset1].sPosIdNorth - 1;
if (pstructMapDataStatic[sOffset2].sPosIdSouth != (sOffset1 + 1))
{
#ifdef INTERFACE_CURSES
sprintf (szBuffer, "%s: %d(South) does not link back to %d(North)\n", pszMapName, (sOffset2 + 1), (sOffset1 + 1));
iRet = mutils_addToDialogBuffer (szBuffer);
if (iRet != 0) return iRet;
#endif
return 6;
}
if (pstructMapDataStatic[sOffset2].sLinkIdSouth != pstructMapDataStatic[sOffset1].sLinkIdNorth)
{
#ifdef INTERFACE_CURSES
sprintf (szBuffer, "%s: %d(South) linkage does not match %d(North)\n", pszMapName, (sOffset2 + 1), (sOffset1 + 1));
iRet = mutils_addToDialogBuffer (szBuffer);
if (iRet != 0) return iRet;
#endif
return 6;
}
}
if (pstructMapDataStatic[sOffset1].sPosIdEast != 0)
{
if (pstructMapDataStatic[sOffset1].sPosIdEast == (sOffset1 + 1))
{
#ifdef INTERFACE_CURSES
sprintf (szBuffer, "%s: East End-less Loop Join for %d\n", pszMapName, (sOffset1 + 1));
iRet = mutils_addToDialogBuffer (szBuffer);
if (iRet != 0) return iRet;
#endif
return 6;
}
if ((pstructMapDataStatic[sOffset1].sPosIdEast > sMapPosStaticCurrentSize) || (pstructMapDataStatic[sOffset1].sPosIdEast < 0))
{
#ifdef INTERFACE_CURSES
sprintf (szBuffer, "%s: East Join out of bounds for %d\n", pszMapName, (sOffset1 + 1));
iRet = mutils_addToDialogBuffer (szBuffer);
if (iRet != 0) return iRet;
#endif
return 6;
}
if (pstructMapDataStatic[sOffset1].sLinkIdEast == 0)
{
#ifdef INTERFACE_CURSES
sprintf (szBuffer, "%s: East Join %d missing LinkId\n", pszMapName, (sOffset1 + 1));
iRet = mutils_addToDialogBuffer (szBuffer);
if (iRet != 0) return iRet;
#endif
return 6;
}
sOffset2 = pstructMapDataStatic[sOffset1].sPosIdEast - 1;
if (pstructMapDataStatic[sOffset2].sPosIdWest != (sOffset1 + 1))
{
#ifdef INTERFACE_CURSES
sprintf (szBuffer, "%s: %d(West) does not link back to %d(East)\n", pszMapName, (sOffset2 + 1), (sOffset1 + 1));
iRet = mutils_addToDialogBuffer (szBuffer);
if (iRet != 0) return iRet;
#endif
return 6;
}
if (pstructMapDataStatic[sOffset2].sLinkIdWest != pstructMapDataStatic[sOffset1].sLinkIdEast)
{
#ifdef INTERFACE_CURSES
sprintf (szBuffer, "%s: %d(West) linkage does not match %d(East)\n", pszMapName, (sOffset2 + 1), (sOffset1 + 1));
iRet = mutils_addToDialogBuffer (szBuffer);
if (iRet != 0) return iRet;
#endif
return 6;
}
}
if (pstructMapDataStatic[sOffset1].sPosIdSouth != 0)
{
if (pstructMapDataStatic[sOffset1].sPosIdSouth == (sOffset1 + 1))
{
#ifdef INTERFACE_CURSES
sprintf (szBuffer, "%s: South End-less Loop Join for %d\n", pszMapName, (sOffset1 + 1));
iRet = mutils_addToDialogBuffer (szBuffer);
if (iRet != 0) return iRet;
#endif
return 6;
}
if ((pstructMapDataStatic[sOffset1].sPosIdSouth > sMapPosStaticCurrentSize) || (pstructMapDataStatic[sOffset1].sPosIdSouth < 0))
{
#ifdef INTERFACE_CURSES
sprintf (szBuffer, "%s: South Join out of bounds for %d\n", pszMapName, (sOffset1 + 1));
iRet = mutils_addToDialogBuffer (szBuffer);
if (iRet != 0) return iRet;
#endif
return 6;
}
if (pstructMapDataStatic[sOffset1].sLinkIdSouth == 0)
{
#ifdef INTERFACE_CURSES
sprintf (szBuffer, "%s: South Join %d missing LinkId\n", pszMapName, (sOffset1 + 1));
iRet = mutils_addToDialogBuffer (szBuffer);
if (iRet != 0) return iRet;
#endif
return 6;
}
sOffset2 = pstructMapDataStatic[sOffset1].sPosIdSouth - 1;
if (pstructMapDataStatic[sOffset2].sPosIdNorth != (sOffset1 + 1))
{
#ifdef INTERFACE_CURSES
sprintf (szBuffer, "%s: %d(North) does not link back to %d(South)\n", pszMapName, (sOffset2 + 1), (sOffset1 + 1));
iRet = mutils_addToDialogBuffer (szBuffer);
if (iRet != 0) return iRet;
#endif
return 6;
}
if (pstructMapDataStatic[sOffset2].sLinkIdNorth != pstructMapDataStatic[sOffset1].sLinkIdSouth)
{
#ifdef INTERFACE_CURSES
sprintf (szBuffer, "%s: %d(North) linkage does not match %d(South)\n", pszMapName, (sOffset2 + 1), (sOffset1 + 1));
iRet = mutils_addToDialogBuffer (szBuffer);
if (iRet != 0) return iRet;
#endif
return 6;
}
}
if (pstructMapDataStatic[sOffset1].sPosIdWest != 0)
{
if (pstructMapDataStatic[sOffset1].sPosIdWest == (sOffset1 + 1))
{
#ifdef INTERFACE_CURSES
sprintf (szBuffer, "%s: West End-less Loop Join for %d\n", pszMapName, (sOffset1 + 1));
iRet = mutils_addToDialogBuffer (szBuffer);
if (iRet != 0) return iRet;
#endif
return 6;
}
if ((pstructMapDataStatic[sOffset1].sPosIdWest > sMapPosStaticCurrentSize) || (pstructMapDataStatic[sOffset1].sPosIdWest < 0))
{
#ifdef INTERFACE_CURSES
sprintf (szBuffer, "%s: West Join out of bounds for %d\n", pszMapName, (sOffset1 + 1));
iRet = mutils_addToDialogBuffer (szBuffer);
if (iRet != 0) return iRet;
#endif
return 6;
}
if (pstructMapDataStatic[sOffset1].sLinkIdWest == 0)
{
#ifdef INTERFACE_CURSES
sprintf (szBuffer, "%s: West Join %d missing LinkId\n", pszMapName, (sOffset1 + 1));
iRet = mutils_addToDialogBuffer (szBuffer);
if (iRet != 0) return iRet;
#endif
return 6;
}
sOffset2 = pstructMapDataStatic[sOffset1].sPosIdWest- 1;
if (pstructMapDataStatic[sOffset2].sPosIdEast != (sOffset1 + 1))
{
#ifdef INTERFACE_CURSES
sprintf (szBuffer, "%s: %d(East) does not link back to %d(West)\n", pszMapName, (sOffset2 + 1), (sOffset1 + 1));
iRet = mutils_addToDialogBuffer (szBuffer);
if (iRet != 0) return iRet;
#endif
return 6;
}
if (pstructMapDataStatic[sOffset2].sLinkIdEast != pstructMapDataStatic[sOffset1].sLinkIdWest)
{
#ifdef INTERFACE_CURSES
sprintf (szBuffer, "%s: %d(East) linkage does not match %d(West)\n", pszMapName, (sOffset2 + 1), (sOffset1 + 1));
iRet = mutils_addToDialogBuffer (szBuffer);
if (iRet != 0) return iRet;
#endif
return 6;
}
}
if (pstructMapDataStatic[sOffset1].sControlLinkId != 0)
{
if ((pstructMapDataStatic[sOffset1].sControlLinkId < 0) || (pstructMapDataStatic[sOffset1].sControlLinkId > sLinkMax))
{
#ifdef INTERFACE_CURSES
sprintf (szBuffer, "%s: %d control link is out of bounds\n", pszMapName, (sOffset1 + 1));
iRet = mutils_addToDialogBuffer (szBuffer);
if (iRet != 0) return iRet;
#endif
return 6;
}
}
}
#ifdef INTERFACE_CURSES
sprintf (szBuffer, "%s: %*d entries, %*d links, checks passed.\n", pszMapName, 3, sMapPosStaticCurrentSize, 3, sLinkMax);
iRet = mutils_addToDialogBuffer (szBuffer);
if (iRet != 0) return iRet;
#endif
return 0;
}
//
// This is the global variable for the map name.
//
char gszMapName[20];
//
// function to perform overall checks on the map data
//
int mapdata_checkAllMapData ()
{
int iRet;
gszMapName[0] = 0;
iRet = mapdata_verifyStaticMapData (gstructMapPosStatic01Act1, "Map1Act1");
if (iRet != 0) return iRet;
iRet = mapdata_verifyStaticMapData (gstructMapPosStatic01Act2, "Map1Act2");
if (iRet != 0) return iRet;
iRet = mapdata_verifyStaticMapData (gstructMapPosStatic01Act3, "Map1Act3");
if (iRet != 0) return iRet;
iRet = mapdata_verifyStaticMapData (gstructMapPosStatic01Act4, "Map1Act4");
if (iRet != 0) return iRet;
iRet = mapdata_verifyStaticMapData (gstructMapPosStatic02Act1, "Map2Act1");
if (iRet != 0) return iRet;
iRet = mapdata_verifyStaticMapData (gstructMapPosStatic02Act2, "Map2Act2");
if (iRet != 0) return iRet;
iRet = mapdata_verifyStaticMapData (gstructMapPosStatic02Act3, "Map2Act3");
if (iRet != 0) return iRet;
iRet = mapdata_verifyStaticMapData (gstructMapPosStatic02Act4, "Map2Act4");
if (iRet != 0) return iRet;
iRet = mapdata_verifyStaticMapData (gstructMapPosStatic03Act1, "Map3Act1");
if (iRet != 0) return iRet;
iRet = mapdata_verifyStaticMapData (gstructMapPosStatic03Act2, "Map3Act2");
if (iRet != 0) return iRet;
iRet = mapdata_verifyStaticMapData (gstructMapPosStatic03Act3, "Map3Act3");
if (iRet != 0) return iRet;
iRet = mapdata_verifyStaticMapData (gstructMapPosStatic03Act4, "Map3Act4");
if (iRet != 0) return iRet;
return 0;
}
//
// These are the global variables for the map data.
//
struct mapdata_posdatastatic *gpstructMapPosStaticCurrent = NULL;
short gsMapPosStaticCurrentSize = 0;
struct mapdata_posdatadynamic *gpstructMapPosDynamicCurrent = NULL;
short gsMapPosDynamicCurrentAlloc = 0;
struct mapdata_linkdatadynamic *gpstructMapLinkDynamicCurrent = NULL;
short gsMapLinkDynamicCurrentSize = 0;
short gsMapLinkDynamicCurrentAlloc = 0;
//
// function to select the named map, and to init the dynamic data
//
// returns 1 for a mem init error.
// returns 10 for a map lock or link error.
//
int mapdata_selectAndInitMapData (char *pszMapName)
{
struct mapdata_posdatastatic *pstructMapPosStaticCurrent;
short sOffset1;
short sLinkMax;
sOffset1 = 0;
if (strncmp (pszMapName, "Map1", 4) == 0)
{
if (strcmp (pszMapName, "Map1Act1") == 0)
{
pstructMapPosStaticCurrent = gstructMapPosStatic01Act1;
}
else if (strcmp (pszMapName, "Map1Act2") == 0)
{
pstructMapPosStaticCurrent = gstructMapPosStatic01Act2;
}
else if (strcmp (pszMapName, "Map1Act3") == 0)
{
pstructMapPosStaticCurrent = gstructMapPosStatic01Act3;
}
else if (strcmp (pszMapName, "Map1Act4") == 0)
{
pstructMapPosStaticCurrent = gstructMapPosStatic01Act4;
}
}
else if (strncmp (pszMapName, "Map2", 4) == 0)
{
if (strcmp (pszMapName, "Map2Act1") == 0)
{
pstructMapPosStaticCurrent = gstructMapPosStatic02Act1;
}
else if (strcmp (pszMapName, "Map2Act2") == 0)
{
pstructMapPosStaticCurrent = gstructMapPosStatic02Act2;
}
else if (strcmp (pszMapName, "Map2Act3") == 0)
{
pstructMapPosStaticCurrent = gstructMapPosStatic02Act3;
}
else if (strcmp (pszMapName, "Map2Act4") == 0)
{
pstructMapPosStaticCurrent = gstructMapPosStatic02Act4;
}
}
else if (strncmp (pszMapName, "Map3", 4) == 0)
{
if (strcmp (pszMapName, "Map3Act1") == 0)
{
pstructMapPosStaticCurrent = gstructMapPosStatic03Act1;
}
else if (strcmp (pszMapName, "Map3Act2") == 0)
{
pstructMapPosStaticCurrent = gstructMapPosStatic03Act2;
}
else if (strcmp (pszMapName, "Map3Act3") == 0)
{
pstructMapPosStaticCurrent = gstructMapPosStatic03Act3;
}
else if (strcmp (pszMapName, "Map3Act4") == 0)
{
pstructMapPosStaticCurrent = gstructMapPosStatic03Act4;
}
}
else
return 10;
// Note: I do not have to perform the same stuff as the startup checks,
// because those happened at start up. This is just to find the size of
// the data.
while (1)
{
if (pstructMapPosStaticCurrent[sOffset1].sPosId == -1)
break;
sOffset1++;
}
// At this point, we know that the map name is valid, and the size of the map.
// So I am going to set this into the global variables.
gpstructMapPosStaticCurrent = pstructMapPosStaticCurrent;
gsMapPosStaticCurrentSize = sOffset1;
strcpy (gszMapName, pszMapName);
// that is part 1 complete, now for part 2.
// init the dynamic storage for the map position data.
// if the alloced size is 0, then the buffer has not been allocated yet (program only just started up)
if (gsMapPosDynamicCurrentAlloc == 0)
{
short sSize;
// workout how big this buffer should be
sSize = gsMapPosStaticCurrentSize;
sSize += 20;
// pad out the size
while (sSize % 256)
sSize++;
sSize -= 2;
// allocate the memory
gpstructMapPosDynamicCurrent = (struct mapdata_posdatadynamic *)malloc ((size_t)sizeof (struct mapdata_posdatadynamic) * (size_t)((size_t)sSize + (size_t)2));
// if there was a problem with the malloc, return 1.
if (gpstructMapPosDynamicCurrent == NULL)
return 1;
gsMapPosDynamicCurrentAlloc = sSize;
}
else if (gsMapPosDynamicCurrentAlloc < gsMapPosStaticCurrentSize)
{
short sSize;
struct mapdata_posdatadynamic *pstructMapPosDynamicNew;
// workout how big this buffer should be
sSize = gsMapPosStaticCurrentSize;
sSize += 20;
// pad out the size
while (sSize % 256)
sSize++;
sSize -= 2;
// allocate the memory
pstructMapPosDynamicNew = (struct mapdata_posdatadynamic *)realloc ((VOID *)gpstructMapPosDynamicCurrent, (size_t)sizeof (struct mapdata_posdatadynamic) * (size_t)((size_t)sSize + (size_t)2));
// if there was a problem with the malloc, return 1.
if (pstructMapPosDynamicNew == NULL)
{
return 1;
}
// if we reached here, then the realloc worked.
gpstructMapPosDynamicCurrent = pstructMapPosDynamicNew;
gsMapPosDynamicCurrentAlloc = sSize;
}
// at this point, we know that the memory buffer allocation is large enough for all of the entries, so just init the list.
for (sOffset1 = 0; gsMapPosStaticCurrentSize > sOffset1; sOffset1++)
{
gpstructMapPosDynamicCurrent[sOffset1].sVisitCount = 0;
// I am just going to set these to 0 for now.
gpstructMapPosDynamicCurrent[sOffset1].cRand1 = 0;
gpstructMapPosDynamicCurrent[sOffset1].cRand2 = 0;
}
// that is part 2 complete, now for part 3.
// init the dynamic storage for the map link data.
// first, we have no idea how big our link array is.
// this will be based upon the highest number for the linkid within the static data table.
sLinkMax = 0;
// I could have cheated and used the above for loop for this, well, who cares..
// If it is a known fact that the > 0 link ids have already been checked by mapdata_verifyStaticMapData() at program startup.
for (sOffset1 = 0; gsMapPosStaticCurrentSize > sOffset1; sOffset1++)
{
if (gpstructMapPosStaticCurrent[sOffset1].sLinkIdNorth > 0)
{
if (sLinkMax < gpstructMapPosStaticCurrent[sOffset1].sLinkIdNorth)
sLinkMax = gpstructMapPosStaticCurrent[sOffset1].sLinkIdNorth;
}
if (gpstructMapPosStaticCurrent[sOffset1].sLinkIdEast > 0)
{
if (sLinkMax < gpstructMapPosStaticCurrent[sOffset1].sLinkIdEast)
sLinkMax = gpstructMapPosStaticCurrent[sOffset1].sLinkIdEast;
}
if (gpstructMapPosStaticCurrent[sOffset1].sLinkIdSouth > 0)
{
if (sLinkMax < gpstructMapPosStaticCurrent[sOffset1].sLinkIdSouth)
sLinkMax = gpstructMapPosStaticCurrent[sOffset1].sLinkIdSouth;
}
if (gpstructMapPosStaticCurrent[sOffset1].sLinkIdWest > 0)
{
if (sLinkMax < gpstructMapPosStaticCurrent[sOffset1].sLinkIdWest)
sLinkMax = gpstructMapPosStaticCurrent[sOffset1].sLinkIdWest;
}
}
// we need to have locked onto something..
if (sLinkMax == 0)
return 10;
// if the alloced size is 0, then the buffer has not been allocated yet (program only just started up)
if (gsMapLinkDynamicCurrentAlloc == 0)
{
short sSize;
// workout how big this buffer should be
sSize = sLinkMax;
sSize += 20;
// pad out the size
while (sSize % 256)
sSize++;
sSize -= 2;
// allocate the memory
gpstructMapLinkDynamicCurrent = (struct mapdata_linkdatadynamic *)malloc ((size_t)sizeof (struct mapdata_linkdatadynamic) * (size_t)((size_t)sSize + (size_t)2));
// if there was a problem with the malloc, return 1.
if (gpstructMapLinkDynamicCurrent == NULL)
return 1;
gsMapLinkDynamicCurrentAlloc = sSize;
}
else if (gsMapLinkDynamicCurrentAlloc < sLinkMax)
{
short sSize;
struct mapdata_linkdatadynamic *pstructMapLinkDynamicNew;
// workout how big this buffer should be
sSize = sLinkMax;
sSize += 20;
// pad out the size
while (sSize % 256)
sSize++;
sSize -= 2;
// allocate the memory
pstructMapLinkDynamicNew = (struct mapdata_linkdatadynamic *)realloc ((VOID *)gpstructMapPosDynamicCurrent, (size_t)sizeof (struct mapdata_linkdatadynamic) * (size_t)((size_t)sSize + (size_t)2));
// if there was a problem with the malloc, return 1.
if (pstructMapLinkDynamicNew == NULL)
{
return 1;
}
// if we reached here, then the realloc worked.
gpstructMapLinkDynamicCurrent = pstructMapLinkDynamicNew;
gsMapLinkDynamicCurrentAlloc = sSize;
}
gsMapLinkDynamicCurrentSize = sLinkMax;
// at this point, we know that the memory buffer allocation is large enough for all of the entries, so just init the list.
for (sOffset1 = 0; gsMapLinkDynamicCurrentSize > sOffset1; sOffset1++)
{
gpstructMapLinkDynamicCurrent[sOffset1].sVisitCount = 0;
gpstructMapLinkDynamicCurrent[sOffset1].cStatus = 0;
// the status of 0 = uncontrolled (which is fixed up by part 4 below.
// I am just going to set these to 0 for now.
gpstructMapLinkDynamicCurrent[sOffset1].cRand1 = 0;
gpstructMapLinkDynamicCurrent[sOffset1].cRand2 = 0;
}
// that is part 3 complete, now for part 4.
// set the default states for all of the controlled links.
// the search is made of the static map data to see if there are control link ids set.
for (sOffset1 = 0; gsMapPosStaticCurrentSize > sOffset1; sOffset1++)
{
// ignore any 0 or -1 values.
if (pstructMapPosStaticCurrent[sOffset1].sControlLinkId < 1)
continue;
// to have reached here, means we have a sControlLinkId that is greater than 0.
// it is not necessary to check if this is within bounds, because that was checked back in mapdata_verifyStaticMapData() at startup.
// Note: remember that the list offset is the id -1.
gpstructMapLinkDynamicCurrent[pstructMapPosStaticCurrent[sOffset1].sControlLinkId - 1].cStatus = 1;
// the status is set to 1 (closed).
}
// all parts complete.
return 0;
}
//
// function to set random values for the map entries
//
// Why is THIS function separate to the one above?..
// I only want to populate the random data in the event that I am switching
// to a map, and not to do the randomize as part of map allocation for
// loading a save file, then throwing it away when I restore the saved
// values over the top (the random map data is put into the save file, so
// the random descriptions are kept across file saves).
//
void mapdata_seedRandomMapValues ()
{
short sOffset1;
// init the list of the position dynamic data.
for (sOffset1 = 0; gsMapPosStaticCurrentSize > sOffset1; sOffset1++)
{
gpstructMapPosDynamicCurrent[sOffset1].cRand1 = rand() % 7;
gpstructMapPosDynamicCurrent[sOffset1].cRand2 = rand() % 2;
}
// init the list of the link dynamic data.
for (sOffset1 = 0; gsMapLinkDynamicCurrentSize > sOffset1; sOffset1++)
{
gpstructMapLinkDynamicCurrent[sOffset1].cRand1 = rand() % 5;
gpstructMapLinkDynamicCurrent[sOffset1].cRand2 = rand() % 5;
}
}
//
// function to workout the map position movement limitations.
//
// returns 10 if out of bounds
// returns 1 if this is a dead-end
// returns 2 if this is a elbow
// returns 3 if this is a hallway
// returns 4 if this is a t-intersect
// returns 5 if this is a cross-intersection
//
int mapdata_workoutPosIdNavigation (int sPosId, struct mapdata_posmovevalues *pstructMapDataMove)
{
short sCount = 0;
// should not be doing stuff if not initialized.
if (gsMapPosStaticCurrentSize == 0)
return 10;
// check the bounds.
if ((sPosId > gsMapPosStaticCurrentSize) || (sPosId < 1))
return 10;
// subtract 1, turning this into an offset.
sPosId--;
// Note: there is no need to check if the link ids are within bounds, as that was done by mapdata_verifyStaticMapData() at startup.
// check to see if north goes anywhere.
if (gpstructMapPosStaticCurrent[sPosId].sPosIdNorth > 0)
{
// use the status setting to identify if this can be used.
pstructMapDataMove->sLinkIdNorth = gpstructMapPosStaticCurrent[sPosId].sLinkIdNorth;
pstructMapDataMove->cAllowNorth = gpstructMapLinkDynamicCurrent[pstructMapDataMove->sLinkIdNorth - 1].cStatus;
pstructMapDataMove->sVisitNorth = gpstructMapLinkDynamicCurrent[pstructMapDataMove->sLinkIdNorth - 1].sVisitCount;
if ((pstructMapDataMove->cAllowNorth == 0) || (pstructMapDataMove->cAllowNorth == 2))
sCount++;
}
else // north does not go anywhere...
{
pstructMapDataMove->cAllowNorth = -1;
pstructMapDataMove->sLinkIdNorth = 0;
pstructMapDataMove->sVisitNorth = -1;
}
// check to see if east goes anywhere.
if (gpstructMapPosStaticCurrent[sPosId].sPosIdEast > 0)
{
// use the status setting to identify if this can be used.
pstructMapDataMove->sLinkIdEast = gpstructMapPosStaticCurrent[sPosId].sLinkIdEast;
pstructMapDataMove->cAllowEast = gpstructMapLinkDynamicCurrent[pstructMapDataMove->sLinkIdEast - 1].cStatus;
pstructMapDataMove->sVisitEast = gpstructMapLinkDynamicCurrent[pstructMapDataMove->sLinkIdEast - 1].sVisitCount;
if ((pstructMapDataMove->cAllowEast == 0) || (pstructMapDataMove->cAllowEast == 2))
sCount++;
}
else // east does not go anywhere...
{
pstructMapDataMove->cAllowEast = -1;
pstructMapDataMove->sLinkIdEast = 0;
pstructMapDataMove->sVisitEast = -1;
}
// check to see if south goes anywhere.
if (gpstructMapPosStaticCurrent[sPosId].sPosIdSouth > 0)
{
// use the status setting to identify if this can be used.
pstructMapDataMove->sLinkIdSouth = gpstructMapPosStaticCurrent[sPosId].sLinkIdSouth;
pstructMapDataMove->cAllowSouth = gpstructMapLinkDynamicCurrent[pstructMapDataMove->sLinkIdSouth - 1].cStatus;
pstructMapDataMove->sVisitSouth = gpstructMapLinkDynamicCurrent[pstructMapDataMove->sLinkIdSouth - 1].sVisitCount;
if ((pstructMapDataMove->cAllowSouth == 0) || (pstructMapDataMove->cAllowSouth == 2))
sCount++;
}
else // south does not go anywhere...
{
pstructMapDataMove->cAllowSouth = -1;
pstructMapDataMove->sLinkIdSouth = 0;
pstructMapDataMove->sVisitSouth = -1;
}
// check to see if west goes anywhere.
if (gpstructMapPosStaticCurrent[sPosId].sPosIdWest > 0)
{
// use the status setting to identify if this can be used.
pstructMapDataMove->sLinkIdWest = gpstructMapPosStaticCurrent[sPosId].sLinkIdWest;
pstructMapDataMove->cAllowWest = gpstructMapLinkDynamicCurrent[pstructMapDataMove->sLinkIdWest - 1].cStatus;
pstructMapDataMove->sVisitWest = gpstructMapLinkDynamicCurrent[pstructMapDataMove->sLinkIdWest - 1].sVisitCount;
if ((pstructMapDataMove->cAllowWest == 0) || (pstructMapDataMove->cAllowWest == 2))
sCount++;
}
else // west does not go anywhere...
{
pstructMapDataMove->cAllowWest = -1;
pstructMapDataMove->sLinkIdWest = 0;
pstructMapDataMove->sVisitWest = -1;
}
// if this is a dead-end
if (sCount == 1)
return 1;
// if this is a cross-intersection
if (sCount == 4)
return 5;
// if this is a t-intersection
if (sCount == 3)
return 4;
// all that is left is to figure out if this en elbow or a hallway.
// the easiest is to figure out if it is a hallway first, so check to see if north-south or east-west is set
if (((pstructMapDataMove->cAllowEast == -1) || (pstructMapDataMove->cAllowEast == 1)) && ((pstructMapDataMove->cAllowWest == -1) || (pstructMapDataMove->cAllowWest == 1)))
return 3; // north and south are allowed
if (((pstructMapDataMove->cAllowNorth == -1) || (pstructMapDataMove->cAllowNorth == 1)) && ((pstructMapDataMove->cAllowSouth == -1) || (pstructMapDataMove->cAllowSouth == 1)))
return 3; // east and west are allowed
// all other combinations are elbows (of which there could be 4)
return 2;
}
//
// function to return (and increment) the visit count for a map location.
//
// returns -1 if out of bounds
//
short mapdata_incrementPosUsage (short sPosId)
{
short sCurrentVal;
// should not be doing stuff if not initialized.
if (gsMapPosStaticCurrentSize == 0)
return -1;
// check the bounds.
if ((sPosId > gsMapPosStaticCurrentSize) || (sPosId < 1))
return -1;
// subtract 1, turning this into an offset.
sPosId--;
sCurrentVal = gpstructMapPosDynamicCurrent[sPosId].sVisitCount;
if (sCurrentVal >= 3)
return sCurrentVal;
gpstructMapPosDynamicCurrent[sPosId].sVisitCount++;
return sCurrentVal;
}
//
// function to increment the usage count for a link id.
//
void mapdata_incrementLinkUsage (short sLinkId)
{
// should not be doing stuff if not initialized.
if (gsMapLinkDynamicCurrentSize == 0)
return;
// check the bounds.
if ((sLinkId > gsMapLinkDynamicCurrentSize) || (sLinkId < 1))
return;
// subtract 1, turning this into an offset.
sLinkId--;
if (gpstructMapLinkDynamicCurrent[sLinkId].sVisitCount >= 3)
return;
gpstructMapLinkDynamicCurrent[sLinkId].sVisitCount++;
}
//
// function to increment the usage count for a link id.
//
int mapdata_printLinkVisitValue (short sVisitVal)
{
int iRet;
switch (sVisitVal)
{
case 0: // north
iRet = mdialog_addToDialogWithSrchRep ("an unknown ");
break;
case 1: // east
iRet = mdialog_addToDialogWithSrchRep ("a once-used ");
break;
case 2: // south
iRet = mdialog_addToDialogWithSrchRep ("a familiar ");
break;
default: // case 3: west
iRet = mdialog_addToDialogWithSrchRep ("a well-traveled ");
break;
}
return iRet;
}
| [
"[email protected]"
] | |
1a6a1837ef9f5622c312609c4094bcbbc3f7435c | 268102eafa2528988d1cf97317a93cd6956ce5fb | /r_cg_rtc.c | 2480998f5dbc5262d1b71138886ab275eca4fd4e | [] | no_license | bensonwutw/Sample-LED- | dc8793df28cdb07e9ec464de776097e504c99c59 | a679060a549f328c6f41089d26c53b4721a1c760 | refs/heads/Master | 2020-06-14T19:57:45.905452 | 2016-12-02T06:24:15 | 2016-12-02T06:24:15 | 75,352,870 | 0 | 0 | null | 2016-12-02T06:24:16 | 2016-12-02T02:30:33 | C | UTF-8 | C | false | false | 9,959 | c | /***********************************************************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products.
* No other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
* applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIESREGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED
* OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY
* LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE FOR ANY DIRECT,
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR
* ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability
* of this software. By using this software, you agree to the additional terms and conditions found by accessing the
* following link:
* http://www.renesas.com/disclaimer
*
* Copyright (C) 2012, 2016 Renesas Electronics Corporation. All rights reserved.
***********************************************************************************************************************/
/***********************************************************************************************************************
* File Name : r_cg_rtc.c
* Version : CodeGenerator for RL78/L12 V2.03.03.03 [07 Mar 2016]
* Device(s) : R5F10RLC
* Tool-Chain : CA78K0R
* Description : This file implements device driver for RTC module.
* Creation Date: 2016/11/18
***********************************************************************************************************************/
/***********************************************************************************************************************
Pragma directive
***********************************************************************************************************************/
/* Start user code for pragma. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
Includes
***********************************************************************************************************************/
#include "r_cg_macrodriver.h"
#include "r_cg_rtc.h"
/* Start user code for include. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
#include "r_cg_userdefine.h"
/***********************************************************************************************************************
Global variables and functions
***********************************************************************************************************************/
/* Start user code for global. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
* Function Name: R_RTC_Create
* Description : This function initializes the real-time clock module.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void R_RTC_Create(void)
{
RTCEN = 1U; /* supply RTC clock */
RTCE = 0U; /* disable RTC clock operation */
RTCMK = 1U; /* disable INTRTC interrupt */
RTCIF = 0U; /* clear INTRTC interrupt flag */
/* Set INTRTC low priority */
RTCPR1 = 1U;
RTCPR0 = 1U;
RTCC0 = _00_RTC_RTC1HZ_DISABLE | _00_RTC_12HOUR_SYSTEM | _01_RTC_INTRTC_CLOCK_0;
}
/***********************************************************************************************************************
* Function Name: R_RTC_Start
* Description : This function enables the real-time clock.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void R_RTC_Start(void)
{
RTCIF = 0U; /* clear INTRTC interrupt flag */
RTCMK = 0U; /* enable INTRTC interrupt */
RTCE = 1U; /* enable RTC clock operation */
}
/***********************************************************************************************************************
* Function Name: R_RTC_Stop
* Description : This function disables the real-time clock.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void R_RTC_Stop(void)
{
RTCE = 0U; /* disable RTC clock operation */
RTCMK = 1U; /* disable INTRTC interrupt */
RTCIF = 0U; /* clear INTRTC interrupt flag */
}
/***********************************************************************************************************************
* Function Name: R_RTC_Get_CounterValue
* Description : This function reads the results of real-time clock and store them in the variables.
* Arguments : counter_read_val -
* the current real-time clock value(BCD code)
* Return Value : status -
* MD_OK, MD_BUSY1 or MD_BUSY2
***********************************************************************************************************************/
MD_STATUS R_RTC_Get_CounterValue(rtc_counter_value_t * const counter_read_val)
{
MD_STATUS status = MD_OK;
volatile uint32_t w_count;
RTCC1 |= _01_RTC_COUNTER_PAUSE;
/* Change the waiting time according to the system */
for (w_count = 0U; w_count < RTC_WAITTIME; w_count++)
{
NOP();
}
if (0U == RWST)
{
status = MD_BUSY1;
}
else
{
counter_read_val->sec = SEC;
counter_read_val->min = MIN;
counter_read_val->hour = HOUR;
counter_read_val->week = WEEK;
counter_read_val->day = DAY;
counter_read_val->month = MONTH;
counter_read_val->year = YEAR;
RTCC1 &= (uint8_t)~_01_RTC_COUNTER_PAUSE;
/* Change the waiting time according to the system */
for (w_count = 0U; w_count < RTC_WAITTIME; w_count++)
{
NOP();
}
if (1U == RWST)
{
status = MD_BUSY2;
}
}
return (status);
}
/***********************************************************************************************************************
* Function Name: R_RTC_Set_CounterValue
* Description : This function changes the real-time clock value.
* Arguments : counter_write_val -
* the expected real-time clock value(BCD code)
* Return Value : status -
* MD_OK, MD_BUSY1 or MD_BUSY2
***********************************************************************************************************************/
MD_STATUS R_RTC_Set_CounterValue(rtc_counter_value_t counter_write_val)
{
MD_STATUS status = MD_OK;
volatile uint32_t w_count;
RTCC1 |= _01_RTC_COUNTER_PAUSE;
/* Change the waiting time according to the system */
for (w_count = 0U; w_count < RTC_WAITTIME; w_count++)
{
NOP();
}
if (0U == RWST)
{
status = MD_BUSY1;
}
else
{
SEC = counter_write_val.sec;
MIN = counter_write_val.min;
HOUR = counter_write_val.hour;
WEEK = counter_write_val.week;
DAY = counter_write_val.day;
MONTH = counter_write_val.month;
YEAR = counter_write_val.year;
RTCC1 &= (uint8_t)~_01_RTC_COUNTER_PAUSE;
/* Change the waiting time according to the system */
for (w_count = 0U; w_count < RTC_WAITTIME; w_count++)
{
NOP();
}
if (1U == RWST)
{
status = MD_BUSY2;
}
}
return (status);
}
/***********************************************************************************************************************
* Function Name: R_RTC_Set_ConstPeriodInterruptOn
* Description : This function enables constant-period interrupt.
* Arguments : period -
* the constant period of INTRTC
* Return Value : status -
* MD_OK or MD_ARGERROR
***********************************************************************************************************************/
MD_STATUS R_RTC_Set_ConstPeriodInterruptOn(rtc_int_period_t period)
{
MD_STATUS status = MD_OK;
if ((period < HALFSEC) || (period > ONEMONTH))
{
status = MD_ARGERROR;
}
else
{
RTCMK = 1U; /* disable INTRTC */
RTCC0 = (RTCC0 & _F8_RTC_INTRTC_CLEAR) | period;
RTCC1 &= (uint8_t)~_08_RTC_INTC_GENERATE_FLAG;
RTCIF = 0U; /* clear INTRTC interrupt flag */
RTCMK = 0U; /* enable INTRTC interrupt */
}
return (status);
}
/***********************************************************************************************************************
* Function Name: R_RTC_Set_ConstPeriodInterruptOff
* Description : This function disables constant-period interrupt.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void R_RTC_Set_ConstPeriodInterruptOff(void)
{
RTCC0 &= _F8_RTC_INTRTC_CLEAR;
RTCC1 &= (uint8_t)~_08_RTC_INTC_GENERATE_FLAG;
RTCIF = 0U; /* clear INTRTC interrupt flag */
}
/* Start user code for adding. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
| [
"[email protected]"
] | |
5339cf9733be64038b1b83c382ebd4fa546cb26f | 5c255f911786e984286b1f7a4e6091a68419d049 | /code/e5dbd6c4-21d7-4fc7-bd24-12f4465a2a00.c | 76490fa8141901d4956fa8d11770427a970496bb | [] | no_license | nmharmon8/Deep-Buffer-Overflow-Detection | 70fe02c8dc75d12e91f5bc4468cf260e490af1a4 | e0c86210c86afb07c8d4abcc957c7f1b252b4eb2 | refs/heads/master | 2021-09-11T19:09:59.944740 | 2018-04-06T16:26:34 | 2018-04-06T16:26:34 | 125,521,331 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 230 | c | #include <stdio.h>
int main() {
int i=4;
int j=122;
int k;
int l;
k = 53;
l = 64;
k = i/j;
l = i/j;
l = i/j;
l = l%j;
l = j-j*i;
printf("vulnerability");
printf("%d%d\n",k,l);
return 0;
}
| [
"[email protected]"
] | |
a0419c52dd35c8b2979c5a6ba0f577e762a3f98b | 9da899bf6541c6a0514219377fea97df9907f0ae | /Developer/NaniteBuilder/Private/Bounds.h | f840ce77681fde7a6dc5a4e2632b55699fb41a6d | [] | no_license | peichangliang123/UE4 | 1aa4df3418c077dd8f82439ecc808cd2e6de4551 | 20e38f42edc251ee96905ed8e96e1be667bc14a5 | refs/heads/master | 2023-08-17T11:31:53.304431 | 2021-09-15T00:31:03 | 2021-09-15T00:31:03 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,164 | h | // Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
struct FBounds
{
FVector Min = { MAX_flt, MAX_flt, MAX_flt };
FVector Max = { -MAX_flt, -MAX_flt, -MAX_flt };
FORCEINLINE FBounds& operator=( const FVector& Other )
{
Min = Other;
Max = Other;
return *this;
}
FORCEINLINE FBounds& operator+=( const FVector& Other )
{
Min = FVector::Min( Min, Other );
Max = FVector::Max( Max, Other );
return *this;
}
FORCEINLINE FBounds& operator+=( const FBounds& Other )
{
Min = FVector::Min( Min, Other.Min );
Max = FVector::Max( Max, Other.Max );
return *this;
}
FORCEINLINE FBounds operator+( const FBounds& Other ) const
{
return FBounds(*this) += Other;
}
FORCEINLINE FVector GetCenter() const
{
return (Max + Min) * 0.5f;
}
FORCEINLINE FVector GetExtent() const
{
return (Max - Min) * 0.5f;
}
FORCEINLINE float GetSurfaceArea() const
{
FVector Size = Max - Min;
return 0.5f * ( Size.X * Size.Y + Size.X * Size.Z + Size.Y * Size.Z );
}
FORCEINLINE friend FArchive& operator<<(FArchive& Ar, FBounds& Bounds)
{
Ar << Bounds.Min;
Ar << Bounds.Max;
return Ar;
}
}; | [
"[email protected]"
] | |
aa4b7be590ff6b599da5057f3a681bb77ae7101c | 6df7fcda67c563f8f528582c54ed5b31b9c24d3d | /screen.c | 829d2f5ce4a6724ca8172d0e796071a7771385d6 | [] | no_license | blue119/xterm | 81223d40c67782661e479326969e4a93a623caba | fd47e75173d6f0361f113d699c898c64c7299471 | refs/heads/master | 2020-04-05T11:03:08.374117 | 2018-11-09T06:35:32 | 2018-11-09T06:35:32 | 156,820,478 | 0 | 1 | null | null | null | null | UTF-8 | C | false | false | 80,055 | c | /* $XTermId: screen.c,v 1.564 2018/09/21 22:26:00 tom Exp $ */
/*
* Copyright 1999-2017,2018 by Thomas E. Dickey
*
* All Rights Reserved
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name(s) of the above copyright
* holders shall not be used in advertising or otherwise to promote the
* sale, use or other dealings in this Software without prior written
* authorization.
*
*
* Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
*
* All Rights Reserved
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted,
* provided that the above copyright notice appear in all copies and that
* both that copyright notice and this permission notice appear in
* supporting documentation, and that the name of Digital Equipment
* Corporation not be used in advertising or publicity pertaining to
* distribution of the software without specific, written prior permission.
*
*
* DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
* DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
* ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*/
/* screen.c */
#include <stdio.h>
#include <xterm.h>
#include <error.h>
#include <data.h>
#include <xterm_io.h>
#include <X11/Xatom.h>
#if OPT_WIDE_ATTRS || OPT_WIDE_CHARS
#include <fontutils.h>
#endif
#include <menu.h>
#include <assert.h>
#include <signal.h>
#include <graphics.h>
#define inSaveBuf(screen, buf, inx) \
((buf) == (screen)->saveBuf_index && \
((inx) < (screen)->savelines || (screen)->savelines == 0))
#define getMinRow(screen) ((xw->flags & ORIGIN) ? (screen)->top_marg : 0)
#define getMaxRow(screen) ((xw->flags & ORIGIN) ? (screen)->bot_marg : (screen)->max_row)
#define getMinCol(screen) ((xw->flags & ORIGIN) ? (screen)->lft_marg : 0)
#define getMaxCol(screen) ((xw->flags & ORIGIN) ? (screen)->rgt_marg : (screen)->max_col)
#define MoveLineData(base, dst, src, len) \
memmove(scrnHeadAddr(screen, base, (unsigned) (dst)), \
scrnHeadAddr(screen, base, (unsigned) (src)), \
(size_t) scrnHeadSize(screen, (unsigned) (len)))
#define SaveLineData(base, src, len) \
(void) ScrnPointers(screen, len); \
memcpy (screen->save_ptr, \
scrnHeadAddr(screen, base, src), \
(size_t) scrnHeadSize(screen, (unsigned) (len)))
#define RestoreLineData(base, dst, len) \
memcpy (scrnHeadAddr(screen, base, dst), \
screen->save_ptr, \
(size_t) scrnHeadSize(screen, (unsigned) (len)))
#if OPT_SAVE_LINES
#define VisBuf(screen) screen->editBuf_index[screen->whichBuf]
#else
#define VisBuf(screen) scrnHeadAddr(screen, screen->saveBuf_index, (unsigned) savelines)
#endif
/*
* ScrnPtr's can point to different types of data.
*/
#define SizeofScrnPtr(name) \
(unsigned) sizeof(*((LineData *)0)->name)
/*
* The pointers in LineData point into a block of text allocated as a single
* chunk for the given number of rows. Ensure that these pointers are aligned
* at least to int-boundaries.
*/
#define AlignMask() (sizeof(int) - 1)
#define IsAligned(value) (((unsigned long) (value) & AlignMask()) == 0)
#define AlignValue(value) \
if (!IsAligned(value)) \
value = (value | (unsigned) AlignMask()) + 1
#define SetupScrnPtr(dst,src,type) \
dst = (type *) (void *) src; \
assert(IsAligned(dst)); \
src += skipNcol##type
#define ScrnBufAddr(ptrs, offset) (ScrnBuf) ((void *) ((char *) (ptrs) + (offset)))
#define LineDataAddr(ptrs, offset) (LineData *) ((void *) ((char *) (ptrs) + (offset)))
#if OPT_TRACE > 1
static void
traceScrnBuf(const char *tag, TScreen *screen, ScrnBuf sb, unsigned len)
{
unsigned j;
TRACE(("traceScrnBuf %s\n", tag));
for (j = 0; j < len; ++j) {
LineData *src = (LineData *) scrnHeadAddr(screen, sb, j);
TRACE(("%p %s%3d:%s\n",
src, ((int) j >= screen->savelines) ? "*" : " ",
j, visibleIChars(src->charData, src->lineSize)));
}
TRACE(("...traceScrnBuf %s\n", tag));
}
#define TRACE_SCRNBUF(tag, screen, sb, len) traceScrnBuf(tag, screen, sb, len)
#else
#define TRACE_SCRNBUF(tag, screen, sb, len) /*nothing */
#endif
#if OPT_WIDE_CHARS
#define scrnHeadSize(screen, count) \
(unsigned) ((count) * \
(SizeOfLineData + \
((screen)->wide_chars \
? (unsigned) (screen)->lineExtra \
: 0)))
#else
#define scrnHeadSize(screen, count) \
(unsigned) ((count) * \
SizeOfLineData)
#endif
ScrnBuf
scrnHeadAddr(TScreen *screen, ScrnBuf base, unsigned offset)
{
unsigned size = scrnHeadSize(screen, offset);
ScrnBuf result = ScrnBufAddr(base, size);
(void) screen;
assert((int) offset >= 0);
return result;
}
/*
* Given a block of data, build index to it in the 'base' parameter.
*/
void
setupLineData(TScreen *screen, ScrnBuf base, Char *data, unsigned nrow, unsigned ncol)
{
unsigned i;
unsigned offset = 0;
unsigned jump = scrnHeadSize(screen, 1);
LineData *ptr;
#if OPT_WIDE_CHARS
unsigned j;
#endif
/* these names are based on types */
unsigned skipNcolIAttr;
unsigned skipNcolCharData;
#if OPT_ISO_COLORS
unsigned skipNcolCellColor;
#endif
(void) screen;
AlignValue(ncol);
skipNcolIAttr = (ncol * SizeofScrnPtr(attribs));
skipNcolCharData = (ncol * SizeofScrnPtr(charData));
#if OPT_ISO_COLORS
skipNcolCellColor = (ncol * SizeofScrnPtr(color));
#endif
for (i = 0; i < nrow; i++, offset += jump) {
ptr = LineDataAddr(base, offset);
ptr->lineSize = (Dimension) ncol;
ptr->bufHead = 0;
#if OPT_DEC_CHRSET
SetLineDblCS(ptr, 0);
#endif
SetupScrnPtr(ptr->attribs, data, IAttr);
#if OPT_ISO_COLORS
SetupScrnPtr(ptr->color, data, CellColor);
#endif
SetupScrnPtr(ptr->charData, data, CharData);
#if OPT_WIDE_CHARS
if (screen->wide_chars) {
unsigned extra = (unsigned) screen->max_combining;
ptr->combSize = (Char) extra;
for (j = 0; j < extra; ++j) {
SetupScrnPtr(ptr->combData[j], data, CharData);
}
}
#endif
}
}
#define ExtractScrnData(name) \
memcpy(dstPtrs->name, \
((LineData *) srcPtrs)->name,\
dstCols * sizeof(dstPtrs->name[0])); \
nextPtr += (srcCols * sizeof(dstPtrs->name[0]))
/*
* As part of reallocating the screen buffer when resizing, extract from
* the old copy of the screen buffer the data which will be used in the
* new copy of the screen buffer.
*/
static void
extractScrnData(TScreen *screen,
ScrnBuf dstPtrs,
ScrnBuf srcPtrs,
unsigned nrows,
unsigned move_down)
{
unsigned j;
TRACE(("extractScrnData(nrows %d)\n", nrows));
TRACE_SCRNBUF("extract from", screen, srcPtrs, nrows);
for (j = 0; j < nrows; j++) {
LineData *dst = (LineData *) scrnHeadAddr(screen,
dstPtrs, j + move_down);
LineData *src = (LineData *) scrnHeadAddr(screen,
srcPtrs, j);
copyLineData(dst, src);
}
}
static ScrnPtr *
allocScrnHead(TScreen *screen, unsigned nrow)
{
ScrnPtr *result;
unsigned size = scrnHeadSize(screen, 1);
(void) screen;
result = (ScrnPtr *) calloc((size_t) nrow, (size_t) size);
if (result == 0)
SysError(ERROR_SCALLOC);
TRACE(("allocScrnHead %d -> %d -> %p..%p\n", nrow, nrow * size,
(void *) result,
(char *) result + (nrow * size) - 1));
return result;
}
/*
* Return the size of a line's data.
*/
static unsigned
sizeofScrnRow(TScreen *screen, unsigned ncol)
{
unsigned result;
unsigned sizeAttribs;
#if OPT_ISO_COLORS
unsigned sizeColors;
#endif
(void) screen;
result = (ncol * (unsigned) sizeof(CharData));
AlignValue(result);
#if OPT_WIDE_CHARS
if (screen->wide_chars) {
result *= (unsigned) (1 + screen->max_combining);
}
#endif
sizeAttribs = (ncol * SizeofScrnPtr(attribs));
AlignValue(sizeAttribs);
result += sizeAttribs;
#if OPT_ISO_COLORS
sizeColors = (ncol * SizeofScrnPtr(color));
AlignValue(sizeColors);
result += sizeColors;
#endif
return result;
}
Char *
allocScrnData(TScreen *screen, unsigned nrow, unsigned ncol)
{
Char *result;
size_t length;
AlignValue(ncol);
length = ((nrow + 1) * sizeofScrnRow(screen, ncol));
if (length == 0
|| (result = (Char *) calloc(length, sizeof(Char))) == 0)
SysError(ERROR_SCALLOC2);
TRACE(("allocScrnData %ux%u -> %lu -> %p..%p\n",
nrow, ncol, (unsigned long) length, result, result + length - 1));
return result;
}
/*
* Allocates memory for a 2-dimensional array of chars and returns a pointer
* thereto. Each line is formed from a set of char arrays, with an index
* (i.e., the ScrnBuf type). The first pointer in the index is reserved for
* per-line flags, and does not point to data.
*
* After the per-line flags, we have a series of pointers to char arrays: The
* first one is the actual character array, the second one is the attributes,
* the third is the foreground and background colors, and the fourth denotes
* the character set.
*
* We store it all as pointers, because of alignment considerations.
*/
ScrnBuf
allocScrnBuf(XtermWidget xw, unsigned nrow, unsigned ncol, Char **addr)
{
TScreen *screen = TScreenOf(xw);
ScrnBuf base = 0;
if (nrow != 0) {
base = allocScrnHead(screen, nrow);
*addr = allocScrnData(screen, nrow, ncol);
setupLineData(screen, base, *addr, nrow, ncol);
}
TRACE(("allocScrnBuf %dx%d ->%p\n", nrow, ncol, (void *) base));
return (base);
}
#if OPT_SAVE_LINES
/*
* Copy line-data from the visible (edit) buffer to the save-lines buffer.
*/
static void
saveEditBufLines(TScreen *screen, ScrnBuf sb, unsigned n)
{
unsigned j;
TRACE(("...copying %d lines from editBuf to saveBuf\n", n));
#if OPT_FIFO_LINES
(void) sb;
#endif
for (j = 0; j < n; ++j) {
#if OPT_FIFO_LINES
LineData *dst = addScrollback(screen);
#else
unsigned k = (screen->savelines + j - n);
LineData *dst = (LineData *) scrnHeadAddr(screen, sb, k);
#endif
LineData *src = getLineData(screen, (int) j);
copyLineData(dst, src);
}
}
/*
* Copy line-data from the save-lines buffer to the visible (edit) buffer.
*/
static void
unsaveEditBufLines(TScreen *screen, ScrnBuf sb, unsigned n)
{
unsigned j;
TRACE(("...copying %d lines from saveBuf to editBuf\n", n));
for (j = 0; j < n; ++j) {
int extra = (int) (n - j);
LineData *dst = (LineData *) scrnHeadAddr(screen, sb, j);
#if OPT_FIFO_LINES
CLineData *src;
if (extra > screen->saved_fifo || extra > screen->savelines) {
TRACE(("...FIXME: must clear text!\n"));
continue;
}
src = getScrollback(screen, -extra);
#else
unsigned k = (screen->savelines - extra);
CLineData *src = CLineData *scrnHeadAddr(screen,
screen->saveBuf_index, k);
#endif
copyLineData(dst, src);
}
}
#endif
/*
* This is called when the screen is resized.
* Returns the number of lines the text was moved down (neg for up).
* (Return value only necessary with SouthWestGravity.)
*/
static int
Reallocate(XtermWidget xw,
ScrnBuf *sbuf,
Char **sbufaddr,
unsigned nrow,
unsigned ncol,
unsigned oldrow)
{
TScreen *screen = TScreenOf(xw);
ScrnBuf oldBufHead;
ScrnBuf newBufHead;
Char *newBufData;
unsigned minrows;
Char *oldBufData;
int move_down = 0, move_up = 0;
if (sbuf == NULL || *sbuf == NULL) {
return 0;
}
oldBufData = *sbufaddr;
TRACE(("Reallocate %dx%d -> %dx%d\n", oldrow, MaxCols(screen), nrow, ncol));
/*
* realloc sbuf, the pointers to all the lines.
* If the screen shrinks, remove lines off the top of the buffer
* if resizeGravity resource says to do so.
*/
TRACE(("Check move_up, nrow %d vs oldrow %d (resizeGravity %s)\n",
nrow, oldrow,
BtoS(GravityIsSouthWest(xw))));
if (GravityIsSouthWest(xw)) {
if (nrow < oldrow) {
/* Remove lines off the top of the buffer if necessary. */
move_up = (int) (oldrow - nrow)
- (TScreenOf(xw)->max_row - TScreenOf(xw)->cur_row);
if (move_up < 0)
move_up = 0;
/* Overlapping move here! */
TRACE(("move_up %d\n", move_up));
if (move_up) {
ScrnBuf dst = *sbuf;
unsigned len = (unsigned) ((int) oldrow - move_up);
TRACE_SCRNBUF("before move_up", screen, dst, oldrow);
SaveLineData(dst, 0, (size_t) move_up);
MoveLineData(dst, 0, (size_t) move_up, len);
RestoreLineData(dst, len, (size_t) move_up);
TRACE_SCRNBUF("after move_up", screen, dst, oldrow);
}
}
}
oldBufHead = *sbuf;
*sbuf = allocScrnHead(screen, (unsigned) nrow);
newBufHead = *sbuf;
/*
* Create the new buffer space and copy old buffer contents there, line by
* line.
*/
newBufData = allocScrnData(screen, nrow, ncol);
*sbufaddr = newBufData;
minrows = (oldrow < nrow) ? oldrow : nrow;
if (GravityIsSouthWest(xw)) {
if (nrow > oldrow) {
/* move data down to bottom of expanded screen */
move_down = Min((int) (nrow - oldrow), TScreenOf(xw)->savedlines);
}
}
setupLineData(screen, newBufHead, *sbufaddr, nrow, ncol);
extractScrnData(screen, newBufHead, oldBufHead, minrows,
#if OPT_SAVE_LINES
0
#else
(unsigned) move_down
#endif
);
free(oldBufHead);
/* Now free the old data */
free(oldBufData);
TRACE(("...Reallocate %dx%d ->%p\n", nrow, ncol, (void *) newBufHead));
return move_down ? move_down : -move_up; /* convert to rows */
}
#if OPT_WIDE_CHARS
/*
* This function reallocates memory if changing the number of Buf offsets.
* The code is based on Reallocate().
*/
static void
ReallocateBufOffsets(XtermWidget xw,
ScrnBuf *sbuf,
Char **sbufaddr,
unsigned nrow,
unsigned ncol)
{
TScreen *screen = TScreenOf(xw);
unsigned i;
ScrnBuf newBufHead;
Char *oldBufData;
ScrnBuf oldBufHead;
unsigned old_jump = scrnHeadSize(screen, 1);
unsigned new_jump;
unsigned new_ptrs = 1 + (unsigned) (screen->max_combining);
unsigned dstCols = ncol;
unsigned srcCols = ncol;
LineData *dstPtrs;
LineData *srcPtrs;
Char *nextPtr;
assert(nrow != 0);
assert(ncol != 0);
oldBufData = *sbufaddr;
oldBufHead = *sbuf;
/*
* Allocate a new LineData array, retain the old one until we've copied
* the data that it points to, as well as non-pointer data, e.g., bufHead.
*
* Turn on wide-chars temporarily when constructing pointers, since that is
* used to decide whether to address the combData[] array, which affects
* the length of the LineData structure.
*/
screen->wide_chars = True;
new_jump = scrnHeadSize(screen, 1);
newBufHead = allocScrnHead(screen, nrow);
*sbufaddr = allocScrnData(screen, nrow, ncol);
setupLineData(screen, newBufHead, *sbufaddr, nrow, ncol);
screen->wide_chars = False;
nextPtr = *sbufaddr;
srcPtrs = (LineData *) oldBufHead;
dstPtrs = (LineData *) newBufHead;
for (i = 0; i < nrow; i++) {
dstPtrs->bufHead = srcPtrs->bufHead;
ExtractScrnData(attribs);
#if OPT_ISO_COLORS
ExtractScrnData(color);
#endif
ExtractScrnData(charData);
nextPtr += ncol * new_ptrs;
srcPtrs = LineDataAddr(srcPtrs, old_jump);
dstPtrs = LineDataAddr(dstPtrs, new_jump);
}
/* Now free the old data */
free(oldBufData);
free(oldBufHead);
*sbuf = newBufHead;
TRACE(("ReallocateBufOffsets %dx%d ->%p\n", nrow, ncol, *sbufaddr));
}
#if OPT_FIFO_LINES
/*
* Allocate a new FIFO index.
*/
static void
ReallocateFifoIndex(XtermWidget xw)
{
TScreen *screen = TScreenOf(xw);
if (screen->savelines > 0 && screen->saveBuf_index != 0) {
ScrnBuf newBufHead;
LineData *dstPtrs;
LineData *srcPtrs;
unsigned i;
unsigned old_jump = scrnHeadSize(screen, 1);
unsigned new_jump;
screen->wide_chars = True;
newBufHead = allocScrnHead(screen, (unsigned) screen->savelines);
new_jump = scrnHeadSize(screen, 1);
srcPtrs = (LineData *) screen->saveBuf_index;
dstPtrs = (LineData *) newBufHead;
for (i = 0; i < (unsigned) screen->savelines; ++i) {
memcpy(dstPtrs, srcPtrs, SizeOfLineData);
srcPtrs = LineDataAddr(srcPtrs, old_jump);
dstPtrs = LineDataAddr(dstPtrs, new_jump);
}
screen->wide_chars = False;
free(screen->saveBuf_index);
screen->saveBuf_index = newBufHead;
}
}
#endif
/*
* This function dynamically adds support for wide-characters.
*/
void
ChangeToWide(XtermWidget xw)
{
TScreen *screen = TScreenOf(xw);
if (screen->wide_chars)
return;
TRACE(("ChangeToWide\n"));
if (xtermLoadWideFonts(xw, True)) {
int whichBuf = screen->whichBuf;
#if !OPT_FIFO_LINES || !OPT_SAVE_LINES
int savelines = screen->scrollWidget ? screen->savelines : 0;
if (savelines < 0)
savelines = 0;
#endif
/*
* If we're displaying the alternate screen, switch the pointers back
* temporarily so ReallocateBufOffsets() will operate on the proper
* data in the alternate buffer.
*/
if (screen->whichBuf)
SwitchBufPtrs(screen, 0);
#if OPT_SAVE_LINES
#if OPT_FIFO_LINES
ReallocateFifoIndex(xw);
#else
ReallocateBufOffsets(xw,
&screen->saveBuf_index,
&screen->saveBuf_data,
(unsigned) savelines,
(unsigned) MaxCols(screen));
#endif
if (screen->editBuf_index[0]) {
ReallocateBufOffsets(xw,
&screen->editBuf_index[0],
&screen->editBuf_data[0],
(unsigned) MaxRows(screen),
(unsigned) MaxCols(screen));
}
#else
ReallocateBufOffsets(xw,
&screen->saveBuf_index,
&screen->saveBuf_data,
(unsigned) (MaxRows(screen) + savelines),
(unsigned) MaxCols(screen));
#endif
if (screen->editBuf_index[1]) {
ReallocateBufOffsets(xw,
&screen->editBuf_index[1],
&screen->editBuf_data[1],
(unsigned) MaxRows(screen),
(unsigned) MaxCols(screen));
}
screen->wide_chars = True;
screen->visbuf = VisBuf(screen);
/*
* Switch the pointers back before we start painting on the screen.
*/
if (whichBuf)
SwitchBufPtrs(screen, whichBuf);
update_font_utf8_mode();
SetVTFont(xw, screen->menu_font_number, True, NULL);
}
TRACE(("...ChangeToWide\n"));
}
#endif
#define ClearCell(d) \
do { \
dst->charData[d] = ' '; \
dst->attribs[d] = src->attribs[d]; \
if_OPT_ISO_COLORS(screen, { \
dst->color[d] = src->color[d]; \
)}; \
if_OPT_WIDE_CHARS(screen, { \
dst->combSize = 0; \
}); \
} while (0)
/*
* Copy cells, no side-effects.
*/
void
CopyCells(TScreen *screen, LineData *src, LineData *dst, int col, int len, Boolean down)
{
(void) screen;
(void) down;
if (len > 0) {
int n;
int last = col + len;
#if OPT_WIDE_CHARS
int fix_l = -1;
int fix_r = -1;
#endif
/*
* If the copy overwrites a double-width character which has one half
* outside the margin, then we will replace both cells with blanks.
*/
if_OPT_WIDE_CHARS(screen, {
if (col > 0) {
if (dst->charData[col] == HIDDEN_CHAR) {
if (down) {
ClearCell(col - 1);
ClearCell(col);
} else {
if (src->charData[col] != HIDDEN_CHAR) {
ClearCell(col - 1);
ClearCell(col);
} else {
fix_l = col - 1;
}
}
} else if (src->charData[col] == HIDDEN_CHAR) {
ClearCell(col - 1);
ClearCell(col);
++col;
}
}
if (last < src->lineSize) {
if (dst->charData[last] == HIDDEN_CHAR) {
if (down) {
ClearCell(last - 1);
ClearCell(last);
} else {
if (src->charData[last] != HIDDEN_CHAR) {
ClearCell(last);
} else {
fix_r = last - 1;
}
}
} else if (src->charData[last] == HIDDEN_CHAR) {
last--;
ClearCell(last);
}
}
});
for (n = col; n < last; ++n) {
dst->charData[n] = src->charData[n];
dst->attribs[n] = src->attribs[n];
}
if_OPT_ISO_COLORS(screen, {
for (n = col; n < last; ++n) {
dst->color[n] = src->color[n];
}
});
if_OPT_WIDE_CHARS(screen, {
size_t off;
for (n = col; n < last; ++n) {
for_each_combData(off, src) {
dst->combData[off][n] = src->combData[off][n];
}
}
});
if_OPT_WIDE_CHARS(screen, {
if (fix_l >= 0) {
ClearCell(fix_l);
ClearCell(fix_l + 1);
}
if (fix_r >= 0) {
ClearCell(fix_r);
ClearCell(fix_r + 1);
}
});
}
}
static void
FillIAttr(IAttr * target, unsigned source, size_t count)
{
while (count-- != 0) {
*target++ = (IAttr) source;
}
}
/*
* Clear cells, no side-effects.
*/
void
ClearCells(XtermWidget xw, int flags, unsigned len, int row, int col)
{
if (len != 0) {
TScreen *screen = TScreenOf(xw);
LineData *ld;
unsigned n;
ld = getLineData(screen, row);
if (((unsigned) col + len) > ld->lineSize)
len = (unsigned) (ld->lineSize - col);
if_OPT_WIDE_CHARS(screen, {
if (((unsigned) col + len) < ld->lineSize &&
ld->charData[col + (int) len] == HIDDEN_CHAR) {
len++;
}
if (col > 0 &&
ld->charData[col] == HIDDEN_CHAR) {
len++;
col--;
}
});
flags = (int) ((unsigned) flags | TERM_COLOR_FLAGS(xw));
for (n = 0; n < len; ++n) {
ld->charData[(unsigned) col + n] = (CharData) ' ';
}
FillIAttr(ld->attribs + col, (unsigned) flags, (size_t) len);
if_OPT_ISO_COLORS(screen, {
CellColor p = xtermColorPair(xw);
for (n = 0; n < len; ++n) {
ld->color[(unsigned) col + n] = p;
}
});
if_OPT_WIDE_CHARS(screen, {
size_t off;
for_each_combData(off, ld) {
memset(ld->combData[off] + col, 0, (size_t) len * sizeof(CharData));
}
});
}
}
/*
* Clear data in the screen-structure (no I/O).
* Check for wide-character damage as well, clearing the damaged cells.
*/
void
ScrnClearCells(XtermWidget xw, int row, int col, unsigned len)
{
#if OPT_WIDE_CHARS
TScreen *screen = TScreenOf(xw);
#endif
int flags = 0;
if_OPT_WIDE_CHARS(screen, {
int kl;
int kr;
if (DamagedCells(screen, len, &kl, &kr, row, col)
&& kr >= kl) {
ClearCells(xw, flags, (unsigned) (kr - kl + 1), row, kl);
}
});
ClearCells(xw, flags, len, row, col);
}
/*
* Disown the selection and repaint the area that is highlighted so it is no
* longer highlighted.
*/
void
ScrnDisownSelection(XtermWidget xw)
{
if (ScrnHaveSelection(TScreenOf(xw))) {
TRACE(("ScrnDisownSelection\n"));
if (TScreenOf(xw)->keepSelection) {
UnhiliteSelection(xw);
} else {
DisownSelection(xw);
}
}
}
/*
* Writes str into buf at screen's current row and column. Characters are set
* to match flags.
*/
void
ScrnWriteText(XtermWidget xw,
IChar *str,
unsigned flags,
CellColor cur_fg_bg,
unsigned length)
{
TScreen *screen = TScreenOf(xw);
LineData *ld;
IAttr *attrs;
int avail = MaxCols(screen) - screen->cur_col;
IChar *chars;
#if OPT_WIDE_CHARS
IChar starcol1;
#endif
unsigned n;
unsigned real_width = visual_width(str, length);
(void) cur_fg_bg; /* quiet compiler warnings when unused */
if (real_width + (unsigned) screen->cur_col > (unsigned) MaxCols(screen)) {
real_width = (unsigned) (MaxCols(screen) - screen->cur_col);
}
if (avail <= 0)
return;
if (length > (unsigned) avail)
length = (unsigned) avail;
if (length == 0 || real_width == 0)
return;
ld = getLineData(screen, screen->cur_row);
chars = ld->charData + screen->cur_col;
attrs = ld->attribs + screen->cur_col;
#if OPT_WIDE_CHARS
starcol1 = *chars;
#endif
/* write blanks if we're writing invisible text */
for (n = 0; n < length; ++n) {
if ((flags & INVISIBLE))
chars[n] = ' ';
else
chars[n] = str[n];
}
#if OPT_BLINK_TEXT
if ((flags & BLINK) && !(screen->blink_as_bold)) {
LineSetBlinked(ld);
}
#endif
if_OPT_WIDE_CHARS(screen, {
if (real_width != length) {
IChar *char1 = chars;
if (screen->cur_col
&& starcol1 == HIDDEN_CHAR
&& isWide((int) char1[-1])) {
char1[-1] = (CharData) ' ';
}
/* if we are overwriting the right hand half of a
wide character, make the other half vanish */
while (length) {
int ch = (int) str[0];
*char1++ = *str++;
length--;
if (isWide(ch)) {
*char1++ = (CharData) HIDDEN_CHAR;
}
}
if (*char1 == HIDDEN_CHAR
&& char1[-1] == HIDDEN_CHAR) {
*char1 = (CharData) ' ';
}
/* if we are overwriting the left hand half of a
wide character, make the other half vanish */
} else {
if (screen->cur_col
&& starcol1 == HIDDEN_CHAR
&& isWide((int) chars[-1])) {
chars[-1] = (CharData) ' ';
}
/* if we are overwriting the right hand half of a
wide character, make the other half vanish */
if (chars[length] == HIDDEN_CHAR
&& isWide((int) chars[length - 1])) {
chars[length] = (CharData) ' ';
}
}
});
flags &= ATTRIBUTES;
flags |= CHARDRAWN;
FillIAttr(attrs, flags, (size_t) real_width);
if_OPT_WIDE_CHARS(screen, {
size_t off;
for_each_combData(off, ld) {
memset(ld->combData[off] + screen->cur_col,
0,
real_width * sizeof(CharData));
}
});
if_OPT_ISO_COLORS(screen, {
unsigned j;
for (j = 0; j < real_width; ++j)
ld->color[screen->cur_col + (int) j] = cur_fg_bg;
});
#if OPT_WIDE_CHARS
screen->last_written_col = screen->cur_col + (int) real_width - 1;
screen->last_written_row = screen->cur_row;
#endif
TRACE(("text erasing cur_col=%d cur_row=%d real_width=%d\n",
screen->cur_col,
screen->cur_row,
real_width));
chararea_clear_displayed_graphics(screen,
screen->cur_col,
screen->cur_row,
(int) real_width, 1);
if_OPT_XMC_GLITCH(screen, {
Resolve_XMC(xw);
});
return;
}
/*
* Saves pointers to the n lines beginning at sb + where, and clears the lines
*/
static void
ScrnClearLines(XtermWidget xw, ScrnBuf sb, int where, unsigned n, unsigned size)
{
TScreen *screen = TScreenOf(xw);
ScrnPtr *base;
unsigned jump = scrnHeadSize(screen, 1);
unsigned i;
LineData *work;
unsigned flags = TERM_COLOR_FLAGS(xw);
#if OPT_ISO_COLORS
unsigned j;
#endif
TRACE(("ScrnClearLines(%s:where %d, n %d, size %d)\n",
(sb == screen->saveBuf_index) ? "save" : "edit",
where, n, size));
assert((int) n > 0);
assert(size != 0);
/* save n lines at where */
SaveLineData(sb, (unsigned) where, (size_t) n);
/* clear contents of old rows */
base = screen->save_ptr;
for (i = 0; i < n; ++i) {
work = (LineData *) base;
work->bufHead = 0;
#if OPT_DEC_CHRSET
SetLineDblCS(work, 0);
#endif
memset(work->charData, 0, size * sizeof(CharData));
if (TERM_COLOR_FLAGS(xw)) {
FillIAttr(work->attribs, flags, (size_t) size);
#if OPT_ISO_COLORS
{
CellColor p = xtermColorPair(xw);
for (j = 0; j < size; ++j) {
work->color[j] = p;
}
}
#endif
} else {
FillIAttr(work->attribs, 0, (size_t) size);
#if OPT_ISO_COLORS
memset(work->color, 0, size * sizeof(work->color[0]));
#endif
}
#if OPT_WIDE_CHARS
if (screen->wide_chars) {
size_t off;
for (off = 0; off < work->combSize; ++off) {
memset(work->combData[off], 0, size * sizeof(CharData));
}
}
#endif
base = ScrnBufAddr(base, jump);
}
TRACE(("clear lines erasing where=%d screen->savelines=%d n=%d screen->max_col=%d\n",
where,
screen->savelines,
n,
screen->max_col));
/* FIXME: this looks wrong -- rcombs */
chararea_clear_displayed_graphics(screen,
where + screen->savelines,
0,
screen->max_col + 1,
(int) n);
}
/*
* We're always ensured of having a visible buffer, but may not have saved
* lines. Check the pointer that's sure to work.
*/
#if OPT_SAVE_LINES
#define OkAllocBuf(screen) (screen->editBuf_index[0] != 0)
#else
#define OkAllocBuf(screen) (screen->saveBuf_index != 0)
#endif
void
ScrnAllocBuf(XtermWidget xw)
{
TScreen *screen = TScreenOf(xw);
if (!OkAllocBuf(screen)) {
int nrows = MaxRows(screen);
#if !OPT_SAVE_LINES
int savelines = screen->scrollWidget ? screen->savelines : 0;
#endif
TRACE(("ScrnAllocBuf %dx%d (%d)\n",
nrows, MaxCols(screen), screen->savelines));
#if OPT_SAVE_LINES
if (screen->savelines != 0) {
#if OPT_FIFO_LINES
/* for FIFO, we only need space for the index - addScrollback inits */
screen->saveBuf_index = allocScrnHead(screen,
(unsigned) (screen->savelines));
#else
screen->saveBuf_index = allocScrnBuf(xw,
(unsigned) screen->savelines,
(unsigned) MaxCols(screen),
&screen->saveBuf_data);
#endif
} else {
screen->saveBuf_index = 0;
}
screen->editBuf_index[0] = allocScrnBuf(xw,
(unsigned) nrows,
(unsigned) MaxCols(screen),
&screen->editBuf_data[0]);
#else /* !OPT_SAVE_LINES */
screen->saveBuf_index = allocScrnBuf(xw,
(unsigned) (nrows + screen->savelines),
(unsigned) (MaxCols(screen)),
&screen->saveBuf_data);
#endif /* OPT_SAVE_LINES */
screen->visbuf = VisBuf(screen);
}
return;
}
size_t
ScrnPointers(TScreen *screen, size_t len)
{
size_t result = scrnHeadSize(screen, (unsigned) len);
if (result > screen->save_len) {
if (screen->save_len)
screen->save_ptr = (ScrnPtr *) realloc(screen->save_ptr, result);
else
screen->save_ptr = (ScrnPtr *) malloc(result);
screen->save_len = len;
if (screen->save_ptr == 0)
SysError(ERROR_SAVE_PTR);
}
TRACE2(("ScrnPointers %ld ->%p\n", (long) len, screen->save_ptr));
return result;
}
/*
* Inserts n blank lines at sb + where, treating last as a bottom margin.
*/
void
ScrnInsertLine(XtermWidget xw, ScrnBuf sb, int last, int where, unsigned n)
{
TScreen *screen = TScreenOf(xw);
unsigned size = (unsigned) MaxCols(screen);
TRACE(("ScrnInsertLine(last %d, where %d, n %d, size %d)\n",
last, where, n, size));
assert(where >= 0);
assert(last >= where);
assert((int) n > 0);
assert(size != 0);
/* save n lines at bottom */
ScrnClearLines(xw, sb, (last -= (int) n - 1), n, size);
if (last < 0) {
TRACE(("...remainder of screen is blank\n"));
return;
}
/*
* WARNING, overlapping copy operation. Move down lines (pointers).
*
* +----|---------|--------+
*
* is copied in the array to:
*
* +--------|---------|----+
*/
assert(last >= where);
/*
* This will never shift from the saveBuf to editBuf, so there is no need
* to handle that case.
*/
MoveLineData(sb,
(unsigned) (where + (int) n),
(unsigned) where,
(unsigned) (last - where));
/* reuse storage for new lines at where */
RestoreLineData(sb, (unsigned) where, n);
}
/*
* Deletes n lines at sb + where, treating last as a bottom margin.
*/
void
ScrnDeleteLine(XtermWidget xw, ScrnBuf sb, int last, int where, unsigned n)
{
TScreen *screen = TScreenOf(xw);
unsigned size = (unsigned) MaxCols(screen);
TRACE(("ScrnDeleteLine(%s:last %d, where %d, n %d, size %d)\n",
(sb == screen->saveBuf_index) ? "save" : "edit",
last, where, n, size));
assert(where >= 0);
assert(last >= where + (int) n - 1);
assert((int) n > 0);
assert(size != 0);
/* move up lines */
last -= ((int) n - 1);
#if OPT_SAVE_LINES
if (inSaveBuf(screen, sb, where)) {
#if !OPT_FIFO_LINES
int from = where + n;
#endif
/* we shouldn't be editing the saveBuf, only scroll into it */
assert(last >= screen->savelines);
if (sb != 0) {
#if OPT_FIFO_LINES
/* copy lines from editBuf to saveBuf (allocating as we go...) */
saveEditBufLines(screen, sb, n);
#else
ScrnClearLines(xw, sb, where, n, size);
/* move the pointers within saveBuf */
TRACE(("...%smoving pointers in saveBuf (compare %d %d)\n",
((screen->savelines > from)
? ""
: "SKIP "),
screen->savelines,
from));
if (screen->savelines > from) {
MoveLineData(sb,
(unsigned) where,
(unsigned) from,
(unsigned) (screen->savelines - from));
}
/* reuse storage in saveBuf */
TRACE(("...reuse %d lines storage in saveBuf\n", n));
RestoreLineData(sb, (unsigned) screen->savelines - n, n);
/* copy lines from editBuf to saveBuf (into the reused storage) */
saveEditBufLines(screen, sb, n);
#endif
}
/* adjust variables to fall-thru into changes only to editBuf */
TRACE(("...adjusting variables, to work on editBuf alone\n"));
last -= screen->savelines;
where = 0;
sb = screen->visbuf;
}
#endif
/*
* Scroll the visible buffer (editBuf).
*/
ScrnClearLines(xw, sb, where, n, size);
MoveLineData(sb,
(unsigned) where,
(unsigned) (where + (int) n),
(size_t) (last - where));
/* reuse storage for new bottom lines */
RestoreLineData(sb, (unsigned) last, n);
}
/*
* Inserts n blanks in screen at current row, col. Size is the size of each
* row.
*/
void
ScrnInsertChar(XtermWidget xw, unsigned n)
{
#define MemMove(data) \
for (j = last; j >= (col + (int) n); --j) \
data[j] = data[j - (int) n]
TScreen *screen = TScreenOf(xw);
int first = ScrnLeftMargin(xw);
int last = ScrnRightMargin(xw);
int row = screen->cur_row;
int col = screen->cur_col;
int j;
LineData *ld;
if (col < first || col > last) {
TRACE(("ScrnInsertChar - col %d outside [%d..%d]\n", col, first, last));
return;
} else if (last < (col + (int) n)) {
n = (unsigned) (last + 1 - col);
}
assert(screen->cur_col >= 0);
assert(screen->cur_row >= 0);
assert((int) n >= 0);
assert((last + 1) >= (int) n);
if_OPT_WIDE_CHARS(screen, {
int xx = screen->cur_row;
int kl;
int kr = screen->cur_col;
if (DamagedCells(screen, n, &kl, (int *) 0, xx, kr) && kr > kl) {
ClearCells(xw, 0, (unsigned) (kr - kl + 1), row, kl);
}
kr = last - (int) n + 1;
if (DamagedCells(screen, n, &kl, (int *) 0, xx, kr) && kr > kl) {
ClearCells(xw, 0, (unsigned) (kr - kl + 1), row, kl);
}
});
if ((ld = getLineData(screen, row)) != 0) {
MemMove(ld->charData);
MemMove(ld->attribs);
if_OPT_ISO_COLORS(screen, {
MemMove(ld->color);
});
if_OPT_WIDE_CHARS(screen, {
size_t off;
for_each_combData(off, ld) {
MemMove(ld->combData[off]);
}
});
}
ClearCells(xw, CHARDRAWN, n, row, col);
#undef MemMove
}
/*
* Deletes n characters at current row, col.
*/
void
ScrnDeleteChar(XtermWidget xw, unsigned n)
{
#define MemMove(data) \
for (j = col; j <= last - (int) n; ++j) \
data[j] = data[j + (int) n]
TScreen *screen = TScreenOf(xw);
int first = ScrnLeftMargin(xw);
int last = ScrnRightMargin(xw) + 1;
int row = screen->cur_row;
int col = screen->cur_col;
int j;
LineData *ld;
if (col < first || col > last) {
TRACE(("ScrnDeleteChar - col %d outside [%d..%d]\n", col, first, last));
return;
} else if (last <= (col + (int) n)) {
n = (unsigned) (last - col);
}
assert(screen->cur_col >= 0);
assert(screen->cur_row >= 0);
assert((int) n >= 0);
assert(last >= (int) n);
if_OPT_WIDE_CHARS(screen, {
int kl;
int kr;
if (DamagedCells(screen, n, &kl, &kr,
screen->cur_row,
screen->cur_col))
ClearCells(xw, 0, (unsigned) (kr - kl + 1), row, kl);
});
if ((ld = getLineData(screen, row)) != 0) {
MemMove(ld->charData);
MemMove(ld->attribs);
if_OPT_ISO_COLORS(screen, {
MemMove(ld->color);
});
if_OPT_WIDE_CHARS(screen, {
size_t off;
for_each_combData(off, ld) {
MemMove(ld->combData[off]);
}
});
LineClrWrapped(ld);
if (screen->show_wrap_marks) {
ShowWrapMarks(xw, row, ld);
}
}
ClearCells(xw, 0, n, row, (last - (int) n));
#undef MemMove
}
/*
* This is useful for debugging both xterm and applications that may manipulate
* its line-wrapping state.
*/
void
ShowWrapMarks(XtermWidget xw, int row, CLineData *ld)
{
TScreen *screen = TScreenOf(xw);
Boolean set = (Boolean) LineTstWrapped(ld);
CgsEnum cgsId = set ? gcVTcursFilled : gcVTcursReverse;
VTwin *currentWin = WhichVWin(screen);
int y = row * FontHeight(screen) + screen->border;
int x = LineCursorX(screen, ld, screen->max_col + 1);
TRACE2(("ShowWrapMarks %d:%s\n", row, BtoS(set)));
XFillRectangle(screen->display, VDrawable(screen),
getCgsGC(xw, currentWin, cgsId),
x, y,
(unsigned) screen->border,
(unsigned) FontHeight(screen));
}
/*
* Repaints the area enclosed by the parameters.
* Requires: (toprow, leftcol), (toprow + nrows, leftcol + ncols) are
* coordinates of characters in screen;
* nrows and ncols positive.
* all dimensions are based on single-characters.
*/
void
ScrnRefresh(XtermWidget xw,
int toprow,
int leftcol,
int nrows,
int ncols,
Bool force) /* ... leading/trailing spaces */
{
TScreen *screen = TScreenOf(xw);
CLineData *ld;
int y = toprow * FontHeight(screen) + screen->border;
int row;
int maxrow = toprow + nrows - 1;
int scrollamt = screen->scroll_amt;
unsigned gc_changes = 0;
#ifdef __CYGWIN__
static char first_time = 1;
#endif
static int recurse = 0;
#if OPT_WIDE_ATTRS
unsigned old_attrs = xw->flags;
#endif
TRACE(("ScrnRefresh top %d (%d,%d) - (%d,%d)%s {{\n",
screen->topline, toprow, leftcol,
nrows, ncols,
force ? " force" : ""));
++recurse;
if (screen->cursorp.col >= leftcol
&& screen->cursorp.col <= (leftcol + ncols - 1)
&& screen->cursorp.row >= ROW2INX(screen, toprow)
&& screen->cursorp.row <= ROW2INX(screen, maxrow))
screen->cursor_state = OFF;
for (row = toprow; row <= maxrow; y += FontHeight(screen), row++) {
#if OPT_ISO_COLORS
CellColor *fb = 0;
#define ColorOf(col) (fb ? fb[col] : initCColor)
#endif
#if OPT_WIDE_CHARS
int wideness = 0;
#endif
#define BLANK_CEL(cell) (chars[cell] == ' ')
IChar *chars;
const IAttr *attrs;
int col = leftcol;
int maxcol = leftcol + ncols - 1;
int hi_col = maxcol;
int lastind;
unsigned flags;
unsigned test;
CellColor fg_bg = initCColor;
Pixel fg = 0, bg = 0;
int x;
GC gc;
Bool hilite;
(void) fg;
(void) bg;
#if !OPT_ISO_COLORS
fg_bg = 0;
#endif
if (row < screen->top_marg || row > screen->bot_marg)
lastind = row;
else
lastind = row - scrollamt;
if (lastind < 0 || lastind > screen->max_row)
continue;
TRACE2(("ScrnRefresh row=%d lastind=%d ->%d\n",
row, lastind, ROW2INX(screen, lastind)));
if ((ld = getLineData(screen, ROW2INX(screen, lastind))) == 0
|| ld->charData == 0
|| ld->attribs == 0) {
break;
}
if (screen->show_wrap_marks) {
ShowWrapMarks(xw, lastind, ld);
}
if (maxcol >= (int) ld->lineSize) {
maxcol = ld->lineSize - 1;
hi_col = maxcol;
}
chars = ld->charData;
attrs = ld->attribs;
if_OPT_WIDE_CHARS(screen, {
/* This fixes an infinite recursion bug, that leads
to display anomalies. It seems to be related to
problems with the selection. */
if (recurse < 3) {
/* adjust to redraw all of a widechar if we just wanted
to draw the right hand half */
if (leftcol > 0 &&
chars[leftcol] == HIDDEN_CHAR &&
isWide((int) chars[leftcol - 1])) {
leftcol--;
ncols++;
col = leftcol;
}
} else {
xtermWarning("Unexpected recursion drawing hidden characters.\n");
}
});
if (row < screen->startH.row || row > screen->endH.row ||
(row == screen->startH.row && maxcol < screen->startH.col) ||
(row == screen->endH.row && col >= screen->endH.col)) {
#if OPT_DEC_CHRSET
/*
* Temporarily change dimensions to double-sized characters so
* we can reuse the recursion on this function.
*/
if (CSET_DOUBLE(GetLineDblCS(ld))) {
col /= 2;
maxcol /= 2;
}
#endif
/*
* If row does not intersect selection; don't hilite blanks.
*/
if (!force) {
while (col <= maxcol && (attrs[col] & ~BOLD) == 0 &&
BLANK_CEL(col))
col++;
while (col <= maxcol && (attrs[maxcol] & ~BOLD) == 0 &&
BLANK_CEL(maxcol))
maxcol--;
}
#if OPT_DEC_CHRSET
if (CSET_DOUBLE(GetLineDblCS(ld))) {
col *= 2;
maxcol *= 2;
}
#endif
hilite = False;
} else {
/* row intersects selection; split into pieces of single type */
if (row == screen->startH.row && col < screen->startH.col) {
ScrnRefresh(xw, row, col, 1, screen->startH.col - col,
force);
col = screen->startH.col;
}
if (row == screen->endH.row && maxcol >= screen->endH.col) {
ScrnRefresh(xw, row, screen->endH.col, 1,
maxcol - screen->endH.col + 1, force);
maxcol = screen->endH.col - 1;
}
/*
* If we're highlighting because the user is doing cut/paste,
* trim the trailing blanks from the highlighted region so we're
* showing the actual extent of the text that'll be cut. If
* we're selecting a blank line, we'll highlight one column
* anyway.
*
* We don't do this if the mouse-hilite mode is set because that
* would be too confusing.
*
* The default if the highlightSelection resource isn't set will
* highlight the whole width of the terminal, which is easy to
* see, but harder to use (because trailing blanks aren't as
* apparent).
*/
if (screen->highlight_selection
&& screen->send_mouse_pos != VT200_HIGHLIGHT_MOUSE) {
hi_col = screen->max_col;
while (hi_col > 0 && !(attrs[hi_col] & CHARDRAWN))
hi_col--;
}
/* remaining piece should be hilited */
hilite = True;
}
if (col > maxcol)
continue;
/*
* Go back to double-sized character dimensions if the line has
* double-width characters. Note that 'hi_col' is already in the
* right units.
*/
if_OPT_DEC_CHRSET({
if (CSET_DOUBLE(GetLineDblCS(ld))) {
col /= 2;
maxcol /= 2;
}
});
flags = attrs[col];
if_OPT_WIDE_CHARS(screen, {
wideness = isWide((int) chars[col]);
});
if_OPT_ISO_COLORS(screen, {
fb = ld->color;
fg_bg = ColorOf(col);
fg = extract_fg(xw, fg_bg, flags);
bg = extract_bg(xw, fg_bg, flags);
});
#if OPT_WIDE_ATTRS
old_attrs = xtermUpdateItalics(xw, flags, old_attrs);
#endif
gc = updatedXtermGC(xw, flags, fg_bg, hilite);
gc_changes |= (flags & (FG_COLOR | BG_COLOR));
x = LineCursorX(screen, ld, col);
lastind = col;
for (; col <= maxcol; col++) {
if ((attrs[col] != flags)
|| (hilite && (col > hi_col))
#if OPT_ISO_COLORS
|| ((flags & FG_COLOR)
&& (extract_fg(xw, ColorOf(col), attrs[col]) != fg))
|| ((flags & BG_COLOR)
&& (extract_bg(xw, ColorOf(col), attrs[col]) != bg))
#endif
#if OPT_WIDE_CHARS
|| (isWide((int) chars[col]) != wideness
&& chars[col] != HIDDEN_CHAR)
#endif
) {
assert(col >= lastind);
TRACE(("ScrnRefresh looping drawXtermText %d..%d:%s\n",
lastind, col,
visibleIChars((&chars[lastind]),
(unsigned) (col - lastind))));
test = flags;
checkVeryBoldColors(test, fg);
x = drawXtermText(xw,
test & DRAWX_MASK,
0,
gc, x, y,
GetLineDblCS(ld),
&chars[lastind],
(unsigned) (col - lastind), 0);
if_OPT_WIDE_CHARS(screen, {
int i;
size_t off;
for_each_combData(off, ld) {
IChar *com_off = ld->combData[off];
for (i = lastind; i < col; i++) {
int my_x = LineCursorX(screen, ld, i);
IChar base = chars[i];
if (isWide((int) base))
my_x = LineCursorX(screen, ld, i - 1);
if (com_off[i] != 0)
drawXtermText(xw,
(test & DRAWX_MASK),
NOBACKGROUND,
gc, my_x, y,
GetLineDblCS(ld),
com_off + i,
1, isWide((int) base));
}
}
});
resetXtermGC(xw, flags, hilite);
lastind = col;
if (hilite && (col > hi_col))
hilite = False;
flags = attrs[col];
if_OPT_ISO_COLORS(screen, {
fg_bg = ColorOf(col);
fg = extract_fg(xw, fg_bg, flags);
bg = extract_bg(xw, fg_bg, flags);
});
if_OPT_WIDE_CHARS(screen, {
wideness = isWide((int) chars[col]);
});
#if OPT_WIDE_ATTRS
old_attrs = xtermUpdateItalics(xw, flags, old_attrs);
#endif
gc = updatedXtermGC(xw, flags, fg_bg, hilite);
gc_changes |= (flags & (FG_COLOR | BG_COLOR));
}
if (chars[col] == 0) {
chars[col] = ' ';
}
}
assert(col >= lastind);
TRACE(("ScrnRefresh calling drawXtermText %d..%d:%s\n",
lastind, col,
visibleIChars(&chars[lastind], (unsigned) (col - lastind))));
test = flags;
checkVeryBoldColors(test, fg);
drawXtermText(xw,
test & DRAWX_MASK,
0,
gc, x, y,
GetLineDblCS(ld),
&chars[lastind],
(unsigned) (col - lastind), 0);
if_OPT_WIDE_CHARS(screen, {
int i;
size_t off;
for_each_combData(off, ld) {
IChar *com_off = ld->combData[off];
for (i = lastind; i < col; i++) {
int my_x = LineCursorX(screen, ld, i);
int base = (int) chars[i];
if (isWide(base))
my_x = LineCursorX(screen, ld, i - 1);
if (com_off[i] != 0)
drawXtermText(xw,
(test & DRAWX_MASK),
NOBACKGROUND,
gc, my_x, y,
GetLineDblCS(ld),
com_off + i,
1, isWide(base));
}
}
});
resetXtermGC(xw, flags, hilite);
}
refresh_displayed_graphics(xw, leftcol, toprow, ncols, nrows);
/*
* If we're in color mode, reset the various GC's to the current
* screen foreground and background so that other functions (e.g.,
* ClearRight) will get the correct colors.
*/
#if OPT_WIDE_ATTRS
(void) xtermUpdateItalics(xw, xw->flags, old_attrs);
#endif
if_OPT_ISO_COLORS(screen, {
if (gc_changes & FG_COLOR)
SGR_Foreground(xw, xw->cur_foreground);
if (gc_changes & BG_COLOR)
SGR_Background(xw, xw->cur_background);
});
#if defined(__CYGWIN__) && defined(TIOCSWINSZ)
if (first_time == 1) {
first_time = 0;
update_winsize(screen->respond, nrows, ncols, xw->core.height, xw->core.width);
}
#endif
recurse--;
TRACE(("...}} ScrnRefresh\n"));
return;
}
/*
* Call this wrapper to ScrnRefresh() when the data has changed. If the
* refresh region overlaps the selection, we will release the primary selection.
*/
void
ScrnUpdate(XtermWidget xw,
int toprow,
int leftcol,
int nrows,
int ncols,
Bool force) /* ... leading/trailing spaces */
{
TScreen *screen = TScreenOf(xw);
if (ScrnHaveSelection(screen)
&& (toprow <= screen->endH.row)
&& (toprow + nrows - 1 >= screen->startH.row)) {
ScrnDisownSelection(xw);
}
ScrnRefresh(xw, toprow, leftcol, nrows, ncols, force);
}
/*
* Sets the rows first though last of the buffer of screen to spaces.
* Requires first <= last; first, last are rows of screen->buf.
*/
void
ClearBufRows(XtermWidget xw,
int first,
int last)
{
TScreen *screen = TScreenOf(xw);
unsigned len = (unsigned) MaxCols(screen);
int row;
TRACE(("ClearBufRows %d..%d\n", first, last));
for (row = first; row <= last; row++) {
LineData *ld = getLineData(screen, row);
if (ld != 0) {
if_OPT_DEC_CHRSET({
/* clearing the whole row resets the doublesize characters */
SetLineDblCS(ld, CSET_SWL);
});
LineClrWrapped(ld);
if (screen->show_wrap_marks) {
ShowWrapMarks(xw, row, ld);
}
ClearCells(xw, 0, len, row, 0);
}
}
}
/*
Resizes screen:
1. If new window would have fractional characters, sets window size so as to
discard fractional characters and returns -1.
Minimum screen size is 1 X 1.
Note that this causes another ExposeWindow event.
2. Enlarges screen->buf if necessary. New space is appended to the bottom
and to the right
3. Reduces screen->buf if necessary. Old space is removed from the bottom
and from the right
4. Cursor is positioned as closely to its former position as possible
5. Sets screen->max_row and screen->max_col to reflect new size
6. Maintains the inner border (and clears the border on the screen).
7. Clears origin mode and sets scrolling region to be entire screen.
8. Returns 0
*/
int
ScreenResize(XtermWidget xw,
int width,
int height,
unsigned *flags)
{
TScreen *screen = TScreenOf(xw);
int rows, cols;
const int border = 2 * screen->border;
int move_down_by = 0;
TRACE(("ScreenResize %dx%d border %d font %dx%d\n",
height, width, border,
FontHeight(screen), FontWidth(screen)));
assert(width > 0);
assert(height > 0);
if (screen->is_running) {
/* clear the right and bottom internal border because of NorthWest
gravity might have left junk on the right and bottom edges */
if (width >= (int) FullWidth(screen)) {
xtermClear2(xw,
FullWidth(screen), 0, /* right edge */
0, (unsigned) height); /* from top to bottom */
}
if (height >= (int) FullHeight(screen)) {
xtermClear2(xw,
0, FullHeight(screen), /* bottom */
(unsigned) width, 0); /* all across the bottom */
}
}
TRACE(("...computing rows/cols: %.2f %.2f\n",
(double) (height - border) / FontHeight(screen),
(double) (width - border - ScrollbarWidth(screen)) / FontWidth(screen)));
rows = (height - border) / FontHeight(screen);
cols = (width - border - ScrollbarWidth(screen)) / FontWidth(screen);
if (rows < 1)
rows = 1;
if (cols < 1)
cols = 1;
/* update buffers if the screen has changed size */
if (MaxRows(screen) != rows || MaxCols(screen) != cols) {
#if !OPT_SAVE_LINES
int whichBuf = 0;
#endif
int delta_rows = rows - MaxRows(screen);
#if OPT_TRACE
int delta_cols = cols - MaxCols(screen);
#endif
TRACE(("...ScreenResize chars %dx%d delta %dx%d\n",
rows, cols, delta_rows, delta_cols));
if (screen->is_running) {
#if !OPT_FIFO_LINES
int savelines = (screen->scrollWidget
? screen->savelines
: 0);
#endif
if (screen->cursor_state)
HideCursor();
#if OPT_SAVE_LINES
/*
* The non-visible buffer is simple, since we will not copy data
* to/from the saved-lines. Do that first.
*/
if (screen->editBuf_index[!screen->whichBuf]) {
(void) Reallocate(xw,
&screen->editBuf_index[!screen->whichBuf],
&screen->editBuf_data[!screen->whichBuf],
(unsigned) rows,
(unsigned) cols,
(unsigned) MaxRows(screen));
}
/*
* The save-lines buffer may change width, but will not change its
* height. Deal with the cases where we copy data to/from the
* saved-lines buffer.
*/
if (GravityIsSouthWest(xw)
&& delta_rows
&& screen->saveBuf_index != 0) {
if (delta_rows < 0) {
unsigned move_up = (unsigned) (-delta_rows);
ScrnBuf dst = screen->saveBuf_index;
#if OPT_FIFO_LINES
int amount = ((MaxRows(screen) - (int) move_up - 1)
- screen->cur_row);
if (amount < 0) {
/* move line-data from visible-buffer to save-buffer */
saveEditBufLines(screen, dst, (unsigned) -amount);
move_down_by = amount;
} else {
move_down_by = 0;
}
#else /* !OPT_FIFO_LINES */
int amount = screen->savelines - (int) move_up;
TRACE_SCRNBUF("before save", screen, dst, screen->savelines);
/* shift lines in save-buffer to make room */
TRACE(("...%smoving pointers in saveBuf (compare %d %d)\n",
(amount > 0
? ""
: "SKIP "),
screen->savelines,
move_up));
if (amount > 0) {
SaveLineData(dst, 0, move_up);
MoveLineData(dst,
0,
move_up,
(unsigned) amount);
TRACE(("...reuse %d lines storage in saveBuf\n", move_up));
RestoreLineData(dst,
(unsigned) amount,
move_up);
TRACE_SCRNBUF("restoresave", screen, dst, screen->savelines);
}
/* copy line-data from visible-buffer to save-buffer */
saveEditBufLines(screen, dst, move_up);
/* after data is copied, reallocate saved-lines */
(void) Reallocate(xw,
&screen->saveBuf_index,
&screen->saveBuf_data,
(unsigned) savelines,
(unsigned) cols,
(unsigned) savelines);
TRACE_SCRNBUF("reallocSAVE",
screen,
screen->saveBuf_index,
savelines);
#endif /* OPT_FIFO_LINES */
/* decrease size of visible-buffer */
(void) Reallocate(xw,
&screen->editBuf_index[screen->whichBuf],
&screen->editBuf_data[screen->whichBuf],
(unsigned) rows,
(unsigned) cols,
(unsigned) MaxRows(screen));
TRACE_SCRNBUF("reallocEDIT",
screen,
screen->editBuf_index[screen->whichBuf],
rows);
} else {
unsigned move_down = (unsigned) delta_rows;
#if OPT_FIFO_LINES
long unsave_fifo;
#else
ScrnBuf src = screen->saveBuf_index;
#endif
ScrnBuf dst;
int amount;
if ((int) move_down > screen->savedlines) {
move_down = (unsigned) screen->savedlines;
}
move_down_by = (int) move_down;
amount = rows - (int) move_down;
/* increase size of visible-buffer */
(void) Reallocate(xw,
&screen->editBuf_index[screen->whichBuf],
&screen->editBuf_data[screen->whichBuf],
(unsigned) rows,
(unsigned) cols,
(unsigned) MaxRows(screen));
dst = screen->editBuf_index[screen->whichBuf];
TRACE_SCRNBUF("reallocEDIT", screen, dst, rows);
TRACE(("...%smoving pointers in editBuf (compare %d %d)\n",
(amount > 0
? ""
: "SKIP "),
rows,
move_down));
if (amount > 0) {
/* shift lines in visible-buffer to make room */
SaveLineData(dst, (unsigned) amount, (size_t) move_down);
MoveLineData(dst,
move_down,
0,
(unsigned) amount);
TRACE(("...reuse %d lines storage in editBuf\n", move_down));
RestoreLineData(dst,
0,
move_down);
TRACE_SCRNBUF("shifted", screen, dst, rows);
}
/* copy line-data from save-buffer to visible-buffer */
unsaveEditBufLines(screen, dst, move_down);
TRACE_SCRNBUF("copied", screen, dst, rows);
#if OPT_FIFO_LINES
unsave_fifo = (long) move_down;
if (screen->saved_fifo < (int) unsave_fifo)
unsave_fifo = screen->saved_fifo;
/* free up storage in fifo from the copied lines */
while (unsave_fifo-- > 0) {
deleteScrollback(screen);
}
#else
amount = (screen->savelines - (int) move_down);
TRACE(("...%smoving pointers in saveBuf (compare %d %d)\n",
(amount > 0
? ""
: "SKIP "),
rows,
move_down));
if (amount > 0) {
/* shift lines in save-buffer to account for copy */
src = screen->saveBuf_index;
SaveLineData(src, amount, move_down);
MoveLineData(src,
move_down,
0,
(unsigned) amount);
TRACE(("...reuse %d lines storage in saveBuf\n", move_down));
RestoreLineData(src,
0,
move_down);
}
#endif
/* recover storage in save-buffer */
}
} else {
#if !OPT_FIFO_LINES
(void) Reallocate(xw,
&screen->saveBuf_index,
&screen->saveBuf_data,
(unsigned) savelines,
(unsigned) cols,
(unsigned) savelines);
#endif
(void) Reallocate(xw,
&screen->editBuf_index[screen->whichBuf],
&screen->editBuf_data[screen->whichBuf],
(unsigned) rows,
(unsigned) cols,
(unsigned) MaxRows(screen));
}
#else /* !OPT_SAVE_LINES */
if (screen->whichBuf
&& GravityIsSouthWest(xw)) {
/* swap buffer pointers back to make this work */
whichBuf = screen->whichBuf;
SwitchBufPtrs(screen, 0);
} else {
whichBuf = 0;
}
if (screen->editBuf_index[1])
(void) Reallocate(xw,
&screen->editBuf_index[1],
&screen->editBuf_data[1],
(unsigned) rows,
(unsigned) cols,
(unsigned) MaxRows(screen));
move_down_by = Reallocate(xw,
&screen->saveBuf_index,
&screen->saveBuf_data,
(unsigned) (rows + savelines),
(unsigned) cols,
(unsigned) (MaxRows(screen) + savelines));
#endif /* OPT_SAVE_LINES */
screen->visbuf = VisBuf(screen);
}
AdjustSavedCursor(xw, move_down_by);
set_max_row(screen, screen->max_row + delta_rows);
set_max_col(screen, cols - 1);
if (screen->is_running) {
if (GravityIsSouthWest(xw)) {
screen->savedlines -= move_down_by;
if (screen->savedlines < 0)
screen->savedlines = 0;
if (screen->savedlines > screen->savelines)
screen->savedlines = screen->savelines;
if (screen->topline < -screen->savedlines)
screen->topline = -screen->savedlines;
set_cur_row(screen, screen->cur_row + move_down_by);
screen->cursorp.row += move_down_by;
ScrollSelection(screen, move_down_by, True);
#if !OPT_SAVE_LINES
if (whichBuf)
SwitchBufPtrs(screen, whichBuf); /* put the pointers back */
#endif
}
}
/* adjust scrolling region */
set_tb_margins(screen, 0, screen->max_row);
set_lr_margins(screen, 0, screen->max_col);
UIntClr(*flags, ORIGIN);
if (screen->cur_row > screen->max_row)
set_cur_row(screen, screen->max_row);
if (screen->cur_col > screen->max_col)
set_cur_col(screen, screen->max_col);
screen->fullVwin.height = height - border;
screen->fullVwin.width = width - border - screen->fullVwin.sb_info.width;
scroll_displayed_graphics(xw, -move_down_by);
} else if (FullHeight(screen) == height && FullWidth(screen) == width)
return (0); /* nothing has changed at all */
screen->fullVwin.fullheight = (Dimension) height;
screen->fullVwin.fullwidth = (Dimension) width;
ResizeScrollBar(xw);
ResizeSelection(screen, rows, cols);
#ifndef NO_ACTIVE_ICON
if (screen->iconVwin.window) {
XWindowChanges changes;
screen->iconVwin.width =
MaxCols(screen) * screen->iconVwin.f_width;
screen->iconVwin.height =
MaxRows(screen) * screen->iconVwin.f_height;
changes.width = screen->iconVwin.fullwidth =
(Dimension) ((unsigned) screen->iconVwin.width
+ 2 * xw->misc.icon_border_width);
changes.height = screen->iconVwin.fullheight =
(Dimension) ((unsigned) screen->iconVwin.height
+ 2 * xw->misc.icon_border_width);
changes.border_width = (int) xw->misc.icon_border_width;
TRACE(("resizing icon window %dx%d\n", changes.height, changes.width));
XConfigureWindow(XtDisplay(xw), screen->iconVwin.window,
CWWidth | CWHeight | CWBorderWidth, &changes);
}
#endif /* NO_ACTIVE_ICON */
#ifdef TTYSIZE_STRUCT
update_winsize(screen->respond, rows, cols, height, width);
#if defined(SIGWINCH) && defined(TIOCGPGRP)
if (screen->pid > 1) {
int pgrp;
TRACE(("getting process-group\n"));
if (ioctl(screen->respond, TIOCGPGRP, &pgrp) != -1) {
TRACE(("sending SIGWINCH to process group %d\n", pgrp));
kill_process_group(pgrp, SIGWINCH);
}
}
#endif /* SIGWINCH */
#else
TRACE(("ScreenResize cannot do anything to pty\n"));
#endif /* TTYSIZE_STRUCT */
return (0);
}
/*
* Return true if any character cell starting at [row,col], for len-cells is
* nonnull.
*/
Bool
non_blank_line(TScreen *screen,
int row,
int col,
int len)
{
int i;
Bool found = False;
LineData *ld = getLineData(screen, row);
if (ld != 0) {
for (i = col; i < len; i++) {
if (ld->charData[i]) {
found = True;
break;
}
}
}
return found;
}
/*
* Limit/map rectangle parameters.
*/
#define minRectRow(screen) (getMinRow(screen) + 1)
#define minRectCol(screen) (getMinCol(screen) + 1)
#define maxRectRow(screen) (getMaxRow(screen) + 1)
#define maxRectCol(screen) (getMaxCol(screen) + 1)
static int
limitedParseRow(XtermWidget xw, int row)
{
TScreen *screen = TScreenOf(xw);
int min_row = minRectRow(screen);
int max_row = maxRectRow(screen);
if (xw->flags & ORIGIN)
row += screen->top_marg;
if (row < min_row)
row = min_row;
else if (row > max_row)
row = max_row;
return row;
}
static int
limitedParseCol(XtermWidget xw, int col)
{
TScreen *screen = TScreenOf(xw);
int min_col = minRectCol(screen);
int max_col = maxRectCol(screen);
if (xw->flags & ORIGIN)
col += screen->lft_marg;
if (col < min_col)
col = min_col;
else if (col > max_col)
col = max_col;
return col;
}
#define LimitedParse(num, func, dft) \
func(xw, (nparams > num && params[num] > 0) ? params[num] : dft)
/*
* Copy the rectangle boundaries into a struct, providing default values as
* needed.
*/
void
xtermParseRect(XtermWidget xw, int nparams, int *params, XTermRect *target)
{
TScreen *screen = TScreenOf(xw);
memset(target, 0, sizeof(*target));
target->top = LimitedParse(0, limitedParseRow, minRectRow(screen));
target->left = LimitedParse(1, limitedParseCol, minRectCol(screen));
target->bottom = LimitedParse(2, limitedParseRow, maxRectRow(screen));
target->right = LimitedParse(3, limitedParseCol, maxRectCol(screen));
TRACE(("parsed rectangle %d,%d %d,%d\n",
target->top,
target->left,
target->bottom,
target->right));
}
static Bool
validRect(XtermWidget xw, XTermRect *target)
{
TScreen *screen = TScreenOf(xw);
TRACE(("comparing against screensize %dx%d\n",
maxRectRow(screen),
maxRectCol(screen)));
return (target != 0
&& target->top >= minRectRow(screen)
&& target->left >= minRectCol(screen)
&& target->top <= target->bottom
&& target->left <= target->right
&& target->top <= maxRectRow(screen)
&& target->right <= maxRectCol(screen));
}
/*
* Fills a rectangle with the given 8-bit character and video-attributes.
* Colors and double-size attribute are unmodified.
*/
void
ScrnFillRectangle(XtermWidget xw,
XTermRect *target,
int value,
unsigned flags,
Bool keepColors)
{
TScreen *screen = TScreenOf(xw);
TRACE(("filling rectangle with '%c' flags %#x\n", value, flags));
if (validRect(xw, target)) {
LineData *ld;
unsigned left = (unsigned) (target->left - 1);
unsigned size = (unsigned) (target->right - (int) left);
unsigned attrs = flags;
int row, col;
(void) size;
attrs &= ATTRIBUTES;
attrs |= CHARDRAWN;
for (row = target->bottom - 1; row >= (target->top - 1); row--) {
ld = getLineData(screen, row);
TRACE(("filling %d [%d..%d]\n", row, left, left + size));
/*
* Fill attributes, preserving colors.
*/
for (col = (int) left; col < target->right; ++col) {
unsigned temp = ld->attribs[col];
if (!keepColors) {
UIntClr(temp, (FG_COLOR | BG_COLOR));
}
temp = attrs | (temp & (FG_COLOR | BG_COLOR)) | CHARDRAWN;
ld->attribs[col] = (IAttr) temp;
if_OPT_ISO_COLORS(screen, {
if (attrs & (FG_COLOR | BG_COLOR)) {
ld->color[col] = xtermColorPair(xw);
}
});
}
for (col = (int) left; col < target->right; ++col)
ld->charData[col] = (CharData) value;
if_OPT_WIDE_CHARS(screen, {
size_t off;
for_each_combData(off, ld) {
memset(ld->combData[off] + left, 0, size * sizeof(CharData));
}
})
}
ScrnUpdate(xw,
target->top - 1,
target->left - 1,
(target->bottom - target->top) + 1,
(target->right - target->left) + 1,
False);
}
}
#if OPT_DEC_RECTOPS
/*
* Copies the source rectangle to the target location, including video
* attributes.
*
* This implementation ignores page numbers.
*
* The reference manual does not indicate if it handles overlapping copy
* properly - so we make a local copy of the source rectangle first, then apply
* the target from that.
*/
void
ScrnCopyRectangle(XtermWidget xw, XTermRect *source, int nparam, int *params)
{
TScreen *screen = TScreenOf(xw);
TRACE(("copying rectangle\n"));
if (nparam > 4)
nparam = 4;
if (validRect(xw, source)) {
XTermRect target;
xtermParseRect(xw,
((nparam > 3) ? 2 : (nparam - 1)),
params,
&target);
if (validRect(xw, &target)) {
Cardinal high = (Cardinal) (source->bottom - source->top) + 1;
Cardinal wide = (Cardinal) (source->right - source->left) + 1;
Cardinal size = (high * wide);
int row, col;
Cardinal j, k;
LineData *ld;
CellData *cells = newCellData(xw, size);
if (cells != 0) {
TRACE(("OK - make copy %dx%d\n", high, wide));
target.bottom = target.top + (int) (high - 1);
target.right = target.left + (int) (wide - 1);
for (row = source->top - 1; row < source->bottom; ++row) {
ld = getLineData(screen, row);
if (ld == 0)
continue;
j = (Cardinal) (row - (source->top - 1));
for (col = source->left - 1; col < source->right; ++col) {
k = (Cardinal) (col - (source->left - 1));
saveCellData(screen, cells,
(j * wide) + k,
ld, col);
}
}
for (row = target.top - 1; row < target.bottom; ++row) {
ld = getLineData(screen, row);
if (ld == 0)
continue;
j = (Cardinal) (row - (target.top - 1));
for (col = target.left - 1; col < target.right; ++col) {
k = (Cardinal) (col - (target.left - 1));
if (row >= getMinRow(screen)
&& row <= getMaxRow(screen)
&& col >= getMinCol(screen)
&& col <= getMaxCol(screen)) {
if (j < high && k < wide) {
restoreCellData(screen, cells,
(j * wide) + k,
ld, col);
} else {
/* EMPTY */
/* FIXME - clear the target cell? */
}
ld->attribs[col] |= CHARDRAWN;
}
}
#if OPT_BLINK_TEXT
if (LineHasBlinking(screen, ld)) {
LineSetBlinked(ld);
} else {
LineClrBlinked(ld);
}
#endif
}
free(cells);
ScrnUpdate(xw,
(target.top - 1),
(target.left - 1),
(target.bottom - target.top) + 1,
((target.right - target.left) + 1),
False);
}
}
}
}
/*
* Modifies the video-attributes only - so selection (not a video attribute) is
* unaffected. Colors and double-size flags are unaffected as well.
*
* FIXME: our representation for "invisible" does not work with this operation,
* since the attribute byte is fully-allocated for other flags. The logic
* is shown for INVISIBLE because it's harmless, and useful in case the
* CHARDRAWN or PROTECTED flags are reassigned.
*/
void
ScrnMarkRectangle(XtermWidget xw,
XTermRect *target,
Bool reverse,
int nparam,
int *params)
{
TScreen *screen = TScreenOf(xw);
Bool exact = (screen->cur_decsace == 2);
TRACE(("%s %s\n",
reverse ? "reversing" : "marking",
(exact
? "rectangle"
: "region")));
if (validRect(xw, target)) {
LineData *ld;
int top = target->top - 1;
int bottom = target->bottom - 1;
int row, col;
int n;
for (row = top; row <= bottom; ++row) {
int left = ((exact || (row == top))
? (target->left - 1)
: getMinCol(screen));
int right = ((exact || (row == bottom))
? (target->right - 1)
: getMaxCol(screen));
ld = getLineData(screen, row);
TRACE(("marking %d [%d..%d]\n", row, left, right));
for (col = left; col <= right; ++col) {
unsigned flags = ld->attribs[col];
for (n = 0; n < nparam; ++n) {
#if OPT_TRACE
if (row == top && col == left)
TRACE(("attr param[%d] %d\n", n + 1, params[n]));
#endif
if (reverse) {
switch (params[n]) {
case 1:
flags ^= BOLD;
break;
case 4:
flags ^= UNDERLINE;
break;
case 5:
flags ^= BLINK;
break;
case 7:
flags ^= INVERSE;
break;
case 8:
flags ^= INVISIBLE;
break;
}
} else {
switch (params[n]) {
case 0:
UIntClr(flags, SGR_MASK);
break;
case 1:
flags |= BOLD;
break;
case 4:
flags |= UNDERLINE;
break;
case 5:
flags |= BLINK;
break;
case 7:
flags |= INVERSE;
break;
case 8:
flags |= INVISIBLE;
break;
case 22:
UIntClr(flags, BOLD);
break;
case 24:
UIntClr(flags, UNDERLINE);
break;
case 25:
UIntClr(flags, BLINK);
break;
case 27:
UIntClr(flags, INVERSE);
break;
case 28:
UIntClr(flags, INVISIBLE);
break;
}
}
}
#if OPT_TRACE
if (row == top && col == left)
TRACE(("first mask-change is %#x\n",
ld->attribs[col] ^ flags));
#endif
ld->attribs[col] = (IAttr) flags;
}
}
ScrnRefresh(xw,
(target->top - 1),
(exact ? (target->left - 1) : getMinCol(screen)),
(target->bottom - target->top) + 1,
(exact
? ((target->right - target->left) + 1)
: (getMaxCol(screen) - getMinCol(screen) + 1)),
False);
}
}
/*
* Resets characters to space, except where prohibited by DECSCA. Video
* attributes (including color) are untouched.
*/
void
ScrnWipeRectangle(XtermWidget xw,
XTermRect *target)
{
TScreen *screen = TScreenOf(xw);
TRACE(("wiping rectangle\n"));
if (validRect(xw, target)) {
LineData *ld;
int top = target->top - 1;
int bottom = target->bottom - 1;
int row, col;
for (row = top; row <= bottom; ++row) {
int left = (target->left - 1);
int right = (target->right - 1);
TRACE(("wiping %d [%d..%d]\n", row, left, right));
ld = getLineData(screen, row);
for (col = left; col <= right; ++col) {
if (!((screen->protected_mode == DEC_PROTECT)
&& (ld->attribs[col] & PROTECTED))) {
ld->attribs[col] |= CHARDRAWN;
ld->charData[col] = ' ';
if_OPT_WIDE_CHARS(screen, {
size_t off;
for_each_combData(off, ld) {
ld->combData[off][col] = '\0';
}
})
}
}
}
ScrnUpdate(xw,
(target->top - 1),
(target->left - 1),
(target->bottom - target->top) + 1,
((target->right - target->left) + 1),
False);
}
}
/*
* Compute a checksum, ignoring the page number (since we have only one page).
*/
void
xtermCheckRect(XtermWidget xw,
int nparam,
int *params,
int *result)
{
TScreen *screen = TScreenOf(xw);
XTermRect target;
LineData *ld;
int total = 0;
int trimmed = 0;
int mode = screen->checksum_ext;
TRACE(("xtermCheckRect: %s%s%s%s%s%s%s\n",
(mode == csDEC) ? "DEC" : "checksumExtension",
(mode & csPOSITIVE) ? " !negative" : "",
(mode & csATTRIBS) ? " !attribs" : "",
(mode & csNOTRIM) ? " !trimmed" : "",
(mode & csDRAWN) ? " !drawn" : "",
(mode & csBYTE) ? " !byte" : "",
(mode & cs8TH) ? " !7bit" : ""));
if (nparam > 2) {
nparam -= 2;
params += 2;
}
xtermParseRect(xw, nparam, params, &target);
if (validRect(xw, &target)) {
int top = target.top - 1;
int bottom = target.bottom - 1;
int row, col;
Boolean first = True;
int embedded = 0;
DECNRCM_codes my_GR = screen->gsets[(int) screen->curgr];
for (row = top; row <= bottom; ++row) {
int left = (target.left - 1);
int right = (target.right - 1);
ld = getLineData(screen, row);
if (ld == 0)
continue;
for (col = left; col <= right && col < ld->lineSize; ++col) {
int ch = ((ld->attribs[col] & CHARDRAWN)
? (int) ld->charData[col]
: ' ');
if (!(mode & csBYTE)) {
unsigned c2 = (unsigned) ch;
if (c2 > 0x7f && my_GR != nrc_ASCII) {
c2 = xtermCharSetIn(xw, c2, my_GR);
if (!(mode & cs8TH) && (c2 < 0x80))
c2 |= 0x80;
}
ch = (c2 & 0xff);
}
if (!(mode & csATTRIBS)) {
if (ld->attribs[col] & UNDERLINE)
ch += 0x10;
if (ld->attribs[col] & INVERSE)
ch += 0x20;
if (ld->attribs[col] & BLINK)
ch += 0x40;
if (ld->attribs[col] & BOLD)
ch += 0x80;
}
if (first || (ch != ' ') || (ld->attribs[col] & DRAWX_MASK)) {
trimmed += ch + embedded;
embedded = 0;
} else if (ch == ' ') {
if ((mode & csNOTRIM))
embedded += ch;
}
if ((ld->attribs[col] & CHARDRAWN)) {
total += ch;
if_OPT_WIDE_CHARS(screen, {
/* FIXME - not counted if trimming blanks */
if (!(mode & csBYTE)) {
size_t off;
for_each_combData(off, ld) {
total += (int) ld->combData[off][col];
}
}
})
} else if (!(mode & csDRAWN)) {
total += ch;
}
first = ((mode & csNOTRIM) != 0) ? True : False;
}
if (!(mode & csNOTRIM)) {
embedded = 0;
first = False;
}
}
}
if (!(mode & csNOTRIM))
total = trimmed;
if (!(mode & csPOSITIVE))
total = -total;
*result = total;
}
#endif /* OPT_DEC_RECTOPS */
#if OPT_MAXIMIZE
static _Xconst char *
ewmhProperty(int mode)
{
_Xconst char *result;
switch (mode) {
default:
result = 0;
break;
case 1:
result = "_NET_WM_STATE_FULLSCREEN";
break;
case 2:
result = "_NET_WM_STATE_MAXIMIZED_VERT";
break;
case 3:
result = "_NET_WM_STATE_MAXIMIZED_HORZ";
break;
}
return result;
}
static void
set_resize_increments(XtermWidget xw)
{
TScreen *screen = TScreenOf(xw);
int min_width = (2 * screen->border) + screen->fullVwin.sb_info.width;
int min_height = (2 * screen->border);
XSizeHints sizehints;
memset(&sizehints, 0, sizeof(XSizeHints));
sizehints.width_inc = FontWidth(screen);
sizehints.height_inc = FontHeight(screen);
sizehints.flags = PResizeInc;
XSetWMNormalHints(screen->display, VShellWindow(xw), &sizehints);
XtVaSetValues(SHELL_OF(xw),
XtNbaseWidth, min_width,
XtNbaseHeight, min_height,
XtNminWidth, min_width + FontWidth(screen),
XtNminHeight, min_height + FontHeight(screen),
XtNwidthInc, FontWidth(screen),
XtNheightInc, FontHeight(screen),
(XtPointer) 0);
XFlush(XtDisplay(xw));
}
static void
unset_resize_increments(XtermWidget xw)
{
TScreen *screen = TScreenOf(xw);
XSizeHints sizehints;
memset(&sizehints, 0, sizeof(XSizeHints));
sizehints.width_inc = 1;
sizehints.height_inc = 1;
sizehints.flags = PResizeInc;
XSetWMNormalHints(screen->display, VShellWindow(xw), &sizehints);
XtVaSetValues(SHELL_OF(xw),
XtNwidthInc, 1,
XtNheightInc, 1,
(XtPointer) 0);
XFlush(XtDisplay(xw));
}
static void
set_ewmh_hint(Display *dpy, Window window, int operation, _Xconst char *prop)
{
XEvent e;
Atom atom_fullscreen = XInternAtom(dpy, prop, False);
Atom atom_state = XInternAtom(dpy, "_NET_WM_STATE", False);
#if OPT_TRACE
const char *what = "?";
switch (operation) {
case _NET_WM_STATE_ADD:
what = "adding";
break;
case _NET_WM_STATE_REMOVE:
what = "removing";
break;
}
TRACE(("set_ewmh_hint %s %s\n", what, prop));
#endif
memset(&e, 0, sizeof(e));
e.xclient.type = ClientMessage;
e.xclient.message_type = atom_state;
e.xclient.display = dpy;
e.xclient.window = window;
e.xclient.format = 32;
e.xclient.data.l[0] = operation;
e.xclient.data.l[1] = (long) atom_fullscreen;
XSendEvent(dpy, DefaultRootWindow(dpy), False,
SubstructureRedirectMask, &e);
}
/*
* Check if the given property is supported on the root window.
*
* The XGetWindowProperty function returns a list of Atom's which corresponds
* to the output of xprop. The actual list (ignore the manpage, which refers
* to an array of 32-bit values) is constructed by _XRead32, which uses long
* as a datatype.
*
* Alternatively, we could check _NET_WM_ALLOWED_ACTIONS on the application's
* window.
*/
static Boolean
probe_netwm(Display *dpy, _Xconst char *propname)
{
Atom atom_fullscreen = XInternAtom(dpy, propname, False);
Atom atom_supported = XInternAtom(dpy, "_NET_SUPPORTED", False);
Atom actual_type;
int actual_format;
long long_offset = 0;
long long_length = 128; /* number of items to ask for at a time */
unsigned int i;
unsigned long nitems, bytes_after;
unsigned char *args;
long *ldata;
Boolean has_capability = False;
Boolean rc;
while (!has_capability) {
rc = xtermGetWinProp(dpy,
DefaultRootWindow(dpy),
atom_supported,
long_offset,
long_length,
AnyPropertyType, /* req_type */
&actual_type, /* actual_type_return */
&actual_format, /* actual_format_return */
&nitems, /* nitems_return */
&bytes_after, /* bytes_after_return */
&args /* prop_return */
);
if (!rc
|| actual_type != XA_ATOM) {
break;
}
ldata = (long *) (void *) args;
for (i = 0; i < nitems; i++) {
#if OPT_TRACE > 1
char *name;
if ((name = XGetAtomName(dpy, ldata[i])) != 0) {
TRACE(("atom[%d] = %s\n", i, name));
XFree(name);
} else {
TRACE(("atom[%d] = ?\n", i));
}
#endif
if ((Atom) ldata[i] == atom_fullscreen) {
has_capability = True;
break;
}
}
XFree(ldata);
if (!has_capability) {
if (bytes_after != 0) {
long remaining = (long) (bytes_after / sizeof(long));
if (long_length > remaining)
long_length = remaining;
long_offset += (long) nitems;
} else {
break;
}
}
}
TRACE(("probe_netwm(%s) ->%d\n", propname, has_capability));
return has_capability;
}
/*
* Alter fullscreen mode for the xterm widget, if the window manager supports
* that feature.
*/
void
FullScreen(XtermWidget xw, int new_ewmh_mode)
{
TScreen *screen = TScreenOf(xw);
Display *dpy = screen->display;
int old_ewmh_mode;
_Xconst char *oldprop;
_Xconst char *newprop;
int which = 0;
Window window;
#if OPT_TEK4014
if (TEK4014_ACTIVE(xw)) {
which = 1;
window = TShellWindow;
} else
#endif
window = VShellWindow(xw);
old_ewmh_mode = xw->work.ewmh[which].mode;
oldprop = ewmhProperty(old_ewmh_mode);
newprop = ewmhProperty(new_ewmh_mode);
TRACE(("FullScreen %d:%s -> %d:%s\n",
old_ewmh_mode, NonNull(oldprop),
new_ewmh_mode, NonNull(newprop)));
if (new_ewmh_mode == old_ewmh_mode) {
TRACE(("...unchanged\n"));
return;
} else if (new_ewmh_mode < 0 || new_ewmh_mode > MAX_EWMH_MODE) {
TRACE(("BUG: FullScreen %d\n", new_ewmh_mode));
return;
} else if (new_ewmh_mode == 0) {
xw->work.ewmh[which].checked[new_ewmh_mode] = True;
xw->work.ewmh[which].allowed[new_ewmh_mode] = True;
} else if (resource.fullscreen == esNever) {
xw->work.ewmh[which].checked[new_ewmh_mode] = True;
xw->work.ewmh[which].allowed[new_ewmh_mode] = False;
} else if (!xw->work.ewmh[which].checked[new_ewmh_mode]) {
xw->work.ewmh[which].checked[new_ewmh_mode] = True;
xw->work.ewmh[which].allowed[new_ewmh_mode] = probe_netwm(dpy, newprop);
}
if (xw->work.ewmh[which].allowed[new_ewmh_mode]) {
TRACE(("...new EWMH mode is allowed\n"));
if (new_ewmh_mode && !xw->work.ewmh[which].mode) {
unset_resize_increments(xw);
set_ewmh_hint(dpy, window, _NET_WM_STATE_ADD, newprop);
} else if (xw->work.ewmh[which].mode && !new_ewmh_mode) {
set_resize_increments(xw);
set_ewmh_hint(dpy, window, _NET_WM_STATE_REMOVE, oldprop);
} else {
set_ewmh_hint(dpy, window, _NET_WM_STATE_REMOVE, oldprop);
set_ewmh_hint(dpy, window, _NET_WM_STATE_ADD, newprop);
}
xw->work.ewmh[which].mode = new_ewmh_mode;
update_fullscreen();
} else {
Bell(xw, XkbBI_MinorError, 100);
}
}
#endif /* OPT_MAXIMIZE */
| [
"[email protected]"
] | |
761a04298c6d9cfdfbef9569ce4a04f837e664fd | a3ad8af8ec4bfeee901737212098e392dd19c6cd | /Ant_Remoter/STM32_LIB/LIB/inc/stm32f10x_spi.h | b0d793dc0311d79b5d3c1c00fbdc5ecead0f08a8 | [] | no_license | qllzs/xunyi | 9edeeaf57fe43262b5f7e7d0643cf353ab218c0c | 0eec8fa9d1849f16953aef2ebb4932c1c7df1155 | refs/heads/master | 2020-04-16T17:31:25.027890 | 2019-08-12T08:02:51 | 2019-08-12T08:02:51 | 165,776,550 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 17,250 | h | /**
******************************************************************************
* @file stm32f10x_spi.h
* @author MCD Application Team
* @version V3.5.0
* @date 11-March-2011
* @brief This file contains all the functions prototypes for the SPI firmware
* library.
******************************************************************************
* @attention
*
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
* TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
* DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
*
* <h2><center>© COPYRIGHT 2011 STMicroelectronics</center></h2>
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __STM32F10x_SPI_H
#define __STM32F10x_SPI_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "stm32f10x.h"
/** @addtogroup STM32F10x_StdPeriph_Driver
* @{
*/
/** @addtogroup SPI
* @{
*/
/** @defgroup SPI_Exported_Types
* @{
*/
/**
* @brief SPI Init structure definition
*/
typedef struct
{
uint16_t SPI_Direction; /*!< Specifies the SPI unidirectional or bidirectional data mode.
This parameter can be a value of @ref SPI_data_direction */
uint16_t SPI_Mode; /*!< Specifies the SPI operating mode.
This parameter can be a value of @ref SPI_mode */
uint16_t SPI_DataSize; /*!< Specifies the SPI data size.
This parameter can be a value of @ref SPI_data_size */
uint16_t SPI_CPOL; /*!< Specifies the serial clock steady state.
This parameter can be a value of @ref SPI_Clock_Polarity */
uint16_t SPI_CPHA; /*!< Specifies the clock active edge for the bit capture.
This parameter can be a value of @ref SPI_Clock_Phase */
uint16_t SPI_NSS; /*!< Specifies whether the NSS signal is managed by
hardware (NSS pin) or by software using the SSI bit.
This parameter can be a value of @ref SPI_Slave_Select_management */
uint16_t SPI_BaudRatePrescaler; /*!< Specifies the Baud Rate prescaler value which will be
used to configure the transmit and receive SCK clock.
This parameter can be a value of @ref SPI_BaudRate_Prescaler.
@note The communication clock is derived from the master
clock. The slave clock does not need to be set. */
uint16_t SPI_FirstBit; /*!< Specifies whether data transfers start from MSB or LSB bit.
This parameter can be a value of @ref SPI_MSB_LSB_transmission */
uint16_t SPI_CRCPolynomial; /*!< Specifies the polynomial used for the CRC calculation. */
}R_SPI_InitTypeDef;
/**
* @brief I2S Init structure definition
*/
typedef struct
{
uint16_t I2S_Mode; /*!< Specifies the I2S operating mode.
This parameter can be a value of @ref I2S_Mode */
uint16_t I2S_Standard; /*!< Specifies the standard used for the I2S communication.
This parameter can be a value of @ref I2S_Standard */
uint16_t I2S_DataFormat; /*!< Specifies the data format for the I2S communication.
This parameter can be a value of @ref I2S_Data_Format */
uint16_t I2S_MCLKOutput; /*!< Specifies whether the I2S MCLK output is enabled or not.
This parameter can be a value of @ref I2S_MCLK_Output */
uint32_t I2S_AudioFreq; /*!< Specifies the frequency selected for the I2S communication.
This parameter can be a value of @ref I2S_Audio_Frequency */
uint16_t I2S_CPOL; /*!< Specifies the idle state of the I2S clock.
This parameter can be a value of @ref I2S_Clock_Polarity */
}I2S_InitTypeDef;
/**
* @}
*/
/** @defgroup SPI_Exported_Constants
* @{
*/
#define IS_SPI_ALL_PERIPH(PERIPH) (((PERIPH) == SPI1) || \
((PERIPH) == SPI2) || \
((PERIPH) == SPI3))
#define IS_SPI_23_PERIPH(PERIPH) (((PERIPH) == SPI2) || \
((PERIPH) == SPI3))
/** @defgroup SPI_data_direction
* @{
*/
#define SPI_Direction_2Lines_FullDuplex ((uint16_t)0x0000)
#define SPI_Direction_2Lines_RxOnly ((uint16_t)0x0400)
#define SPI_Direction_1Line_Rx ((uint16_t)0x8000)
#define SPI_Direction_1Line_Tx ((uint16_t)0xC000)
#define IS_SPI_DIRECTION_MODE(MODE) (((MODE) == SPI_Direction_2Lines_FullDuplex) || \
((MODE) == SPI_Direction_2Lines_RxOnly) || \
((MODE) == SPI_Direction_1Line_Rx) || \
((MODE) == SPI_Direction_1Line_Tx))
/**
* @}
*/
/** @defgroup SPI_mode
* @{
*/
#define SPI_Mode_Master ((uint16_t)0x0104)
#define SPI_Mode_Slave ((uint16_t)0x0000)
#define IS_SPI_MODE(MODE) (((MODE) == SPI_Mode_Master) || \
((MODE) == SPI_Mode_Slave))
/**
* @}
*/
/** @defgroup SPI_data_size
* @{
*/
#define SPI_DataSize_16b ((uint16_t)0x0800)
#define SPI_DataSize_8b ((uint16_t)0x0000)
#define IS_SPI_DATASIZE(DATASIZE) (((DATASIZE) == SPI_DataSize_16b) || \
((DATASIZE) == SPI_DataSize_8b))
/**
* @}
*/
/** @defgroup SPI_Clock_Polarity
* @{
*/
#define SPI_CPOL_Low ((uint16_t)0x0000)
#define SPI_CPOL_High ((uint16_t)0x0002)
#define IS_SPI_CPOL(CPOL) (((CPOL) == SPI_CPOL_Low) || \
((CPOL) == SPI_CPOL_High))
/**
* @}
*/
/** @defgroup SPI_Clock_Phase
* @{
*/
#define SPI_CPHA_1Edge ((uint16_t)0x0000)
#define SPI_CPHA_2Edge ((uint16_t)0x0001)
#define IS_SPI_CPHA(CPHA) (((CPHA) == SPI_CPHA_1Edge) || \
((CPHA) == SPI_CPHA_2Edge))
/**
* @}
*/
/** @defgroup SPI_Slave_Select_management
* @{
*/
#define SPI_NSS_Soft ((uint16_t)0x0200)
#define SPI_NSS_Hard ((uint16_t)0x0000)
#define IS_SPI_NSS(NSS) (((NSS) == SPI_NSS_Soft) || \
((NSS) == SPI_NSS_Hard))
/**
* @}
*/
/** @defgroup SPI_BaudRate_Prescaler
* @{
*/
#define SPI_BaudRatePrescaler_2 ((uint16_t)0x0000)
#define SPI_BaudRatePrescaler_4 ((uint16_t)0x0008)
#define SPI_BaudRatePrescaler_8 ((uint16_t)0x0010)
#define SPI_BaudRatePrescaler_16 ((uint16_t)0x0018)
#define SPI_BaudRatePrescaler_32 ((uint16_t)0x0020)
#define SPI_BaudRatePrescaler_64 ((uint16_t)0x0028)
#define SPI_BaudRatePrescaler_128 ((uint16_t)0x0030)
#define SPI_BaudRatePrescaler_256 ((uint16_t)0x0038)
#define IS_SPI_BAUDRATE_PRESCALER(PRESCALER) (((PRESCALER) == SPI_BaudRatePrescaler_2) || \
((PRESCALER) == SPI_BaudRatePrescaler_4) || \
((PRESCALER) == SPI_BaudRatePrescaler_8) || \
((PRESCALER) == SPI_BaudRatePrescaler_16) || \
((PRESCALER) == SPI_BaudRatePrescaler_32) || \
((PRESCALER) == SPI_BaudRatePrescaler_64) || \
((PRESCALER) == SPI_BaudRatePrescaler_128) || \
((PRESCALER) == SPI_BaudRatePrescaler_256))
/**
* @}
*/
/** @defgroup SPI_MSB_LSB_transmission
* @{
*/
#define SPI_FirstBit_MSB ((uint16_t)0x0000)
#define SPI_FirstBit_LSB ((uint16_t)0x0080)
#define IS_SPI_FIRST_BIT(BIT) (((BIT) == SPI_FirstBit_MSB) || \
((BIT) == SPI_FirstBit_LSB))
/**
* @}
*/
/** @defgroup I2S_Mode
* @{
*/
#define I2S_Mode_SlaveTx ((uint16_t)0x0000)
#define I2S_Mode_SlaveRx ((uint16_t)0x0100)
#define I2S_Mode_MasterTx ((uint16_t)0x0200)
#define I2S_Mode_MasterRx ((uint16_t)0x0300)
#define IS_I2S_MODE(MODE) (((MODE) == I2S_Mode_SlaveTx) || \
((MODE) == I2S_Mode_SlaveRx) || \
((MODE) == I2S_Mode_MasterTx) || \
((MODE) == I2S_Mode_MasterRx) )
/**
* @}
*/
/** @defgroup I2S_Standard
* @{
*/
#define I2S_Standard_Phillips ((uint16_t)0x0000)
#define I2S_Standard_MSB ((uint16_t)0x0010)
#define I2S_Standard_LSB ((uint16_t)0x0020)
#define I2S_Standard_PCMShort ((uint16_t)0x0030)
#define I2S_Standard_PCMLong ((uint16_t)0x00B0)
#define IS_I2S_STANDARD(STANDARD) (((STANDARD) == I2S_Standard_Phillips) || \
((STANDARD) == I2S_Standard_MSB) || \
((STANDARD) == I2S_Standard_LSB) || \
((STANDARD) == I2S_Standard_PCMShort) || \
((STANDARD) == I2S_Standard_PCMLong))
/**
* @}
*/
/** @defgroup I2S_Data_Format
* @{
*/
#define I2S_DataFormat_16b ((uint16_t)0x0000)
#define I2S_DataFormat_16bextended ((uint16_t)0x0001)
#define I2S_DataFormat_24b ((uint16_t)0x0003)
#define I2S_DataFormat_32b ((uint16_t)0x0005)
#define IS_I2S_DATA_FORMAT(FORMAT) (((FORMAT) == I2S_DataFormat_16b) || \
((FORMAT) == I2S_DataFormat_16bextended) || \
((FORMAT) == I2S_DataFormat_24b) || \
((FORMAT) == I2S_DataFormat_32b))
/**
* @}
*/
/** @defgroup I2S_MCLK_Output
* @{
*/
#define I2S_MCLKOutput_Enable ((uint16_t)0x0200)
#define I2S_MCLKOutput_Disable ((uint16_t)0x0000)
#define IS_I2S_MCLK_OUTPUT(OUTPUT) (((OUTPUT) == I2S_MCLKOutput_Enable) || \
((OUTPUT) == I2S_MCLKOutput_Disable))
/**
* @}
*/
/** @defgroup I2S_Audio_Frequency
* @{
*/
#define I2S_AudioFreq_192k ((uint32_t)192000)
#define I2S_AudioFreq_96k ((uint32_t)96000)
#define I2S_AudioFreq_48k ((uint32_t)48000)
#define I2S_AudioFreq_44k ((uint32_t)44100)
#define I2S_AudioFreq_32k ((uint32_t)32000)
#define I2S_AudioFreq_22k ((uint32_t)22050)
#define I2S_AudioFreq_16k ((uint32_t)16000)
#define I2S_AudioFreq_11k ((uint32_t)11025)
#define I2S_AudioFreq_8k ((uint32_t)8000)
#define I2S_AudioFreq_Default ((uint32_t)2)
#define IS_I2S_AUDIO_FREQ(FREQ) ((((FREQ) >= I2S_AudioFreq_8k) && \
((FREQ) <= I2S_AudioFreq_192k)) || \
((FREQ) == I2S_AudioFreq_Default))
/**
* @}
*/
/** @defgroup I2S_Clock_Polarity
* @{
*/
#define I2S_CPOL_Low ((uint16_t)0x0000)
#define I2S_CPOL_High ((uint16_t)0x0008)
#define IS_I2S_CPOL(CPOL) (((CPOL) == I2S_CPOL_Low) || \
((CPOL) == I2S_CPOL_High))
/**
* @}
*/
/** @defgroup SPI_I2S_DMA_transfer_requests
* @{
*/
#define SPI_I2S_DMAReq_Tx ((uint16_t)0x0002)
#define SPI_I2S_DMAReq_Rx ((uint16_t)0x0001)
#define IS_SPI_I2S_DMAREQ(DMAREQ) ((((DMAREQ) & (uint16_t)0xFFFC) == 0x00) && ((DMAREQ) != 0x00))
/**
* @}
*/
/** @defgroup SPI_NSS_internal_software_management
* @{
*/
#define SPI_NSSInternalSoft_Set ((uint16_t)0x0100)
#define SPI_NSSInternalSoft_Reset ((uint16_t)0xFEFF)
#define IS_SPI_NSS_INTERNAL(INTERNAL) (((INTERNAL) == SPI_NSSInternalSoft_Set) || \
((INTERNAL) == SPI_NSSInternalSoft_Reset))
/**
* @}
*/
/** @defgroup SPI_CRC_Transmit_Receive
* @{
*/
#define SPI_CRC_Tx ((uint8_t)0x00)
#define SPI_CRC_Rx ((uint8_t)0x01)
#define IS_SPI_CRC(CRC) (((CRC) == SPI_CRC_Tx) || ((CRC) == SPI_CRC_Rx))
/**
* @}
*/
/** @defgroup SPI_direction_transmit_receive
* @{
*/
#define SPI_Direction_Rx ((uint16_t)0xBFFF)
#define SPI_Direction_Tx ((uint16_t)0x4000)
#define IS_SPI_DIRECTION(DIRECTION) (((DIRECTION) == SPI_Direction_Rx) || \
((DIRECTION) == SPI_Direction_Tx))
/**
* @}
*/
/** @defgroup SPI_I2S_interrupts_definition
* @{
*/
#define SPI_I2S_IT_TXE ((uint8_t)0x71)
#define SPI_I2S_IT_RXNE ((uint8_t)0x60)
#define SPI_I2S_IT_ERR ((uint8_t)0x50)
#define IS_SPI_I2S_CONFIG_IT(IT) (((IT) == SPI_I2S_IT_TXE) || \
((IT) == SPI_I2S_IT_RXNE) || \
((IT) == SPI_I2S_IT_ERR))
#define SPI_I2S_IT_OVR ((uint8_t)0x56)
#define SPI_IT_MODF ((uint8_t)0x55)
#define SPI_IT_CRCERR ((uint8_t)0x54)
#define I2S_IT_UDR ((uint8_t)0x53)
#define IS_SPI_I2S_CLEAR_IT(IT) (((IT) == SPI_IT_CRCERR))
#define IS_SPI_I2S_GET_IT(IT) (((IT) == SPI_I2S_IT_RXNE) || ((IT) == SPI_I2S_IT_TXE) || \
((IT) == I2S_IT_UDR) || ((IT) == SPI_IT_CRCERR) || \
((IT) == SPI_IT_MODF) || ((IT) == SPI_I2S_IT_OVR))
/**
* @}
*/
/** @defgroup SPI_I2S_flags_definition
* @{
*/
#define SPI_I2S_FLAG_RXNE ((uint16_t)0x0001)
#define SPI_I2S_FLAG_TXE ((uint16_t)0x0002)
#define I2S_FLAG_CHSIDE ((uint16_t)0x0004)
#define I2S_FLAG_UDR ((uint16_t)0x0008)
#define SPI_FLAG_CRCERR ((uint16_t)0x0010)
#define SPI_FLAG_MODF ((uint16_t)0x0020)
#define SPI_I2S_FLAG_OVR ((uint16_t)0x0040)
#define SPI_I2S_FLAG_BSY ((uint16_t)0x0080)
#define IS_SPI_I2S_CLEAR_FLAG(FLAG) (((FLAG) == SPI_FLAG_CRCERR))
#define IS_SPI_I2S_GET_FLAG(FLAG) (((FLAG) == SPI_I2S_FLAG_BSY) || ((FLAG) == SPI_I2S_FLAG_OVR) || \
((FLAG) == SPI_FLAG_MODF) || ((FLAG) == SPI_FLAG_CRCERR) || \
((FLAG) == I2S_FLAG_UDR) || ((FLAG) == I2S_FLAG_CHSIDE) || \
((FLAG) == SPI_I2S_FLAG_TXE) || ((FLAG) == SPI_I2S_FLAG_RXNE))
/**
* @}
*/
/** @defgroup SPI_CRC_polynomial
* @{
*/
#define IS_SPI_CRC_POLYNOMIAL(POLYNOMIAL) ((POLYNOMIAL) >= 0x1)
/**
* @}
*/
/**
* @}
*/
/** @defgroup SPI_Exported_Macros
* @{
*/
/**
* @}
*/
/** @defgroup SPI_Exported_Functions
* @{
*/
void SPI_I2S_DeInit(SPI_TypeDef* SPIx);
void R_SPI_Init(SPI_TypeDef* SPIx, R_SPI_InitTypeDef* R_SPI_InitStruct);
void I2S_Init(SPI_TypeDef* SPIx, I2S_InitTypeDef* I2S_InitStruct);
void SPI_StructInit(R_SPI_InitTypeDef* R_SPI_InitStruct);
void I2S_StructInit(I2S_InitTypeDef* I2S_InitStruct);
void SPI_Cmd(SPI_TypeDef* SPIx, FunctionalState NewState);
void I2S_Cmd(SPI_TypeDef* SPIx, FunctionalState NewState);
void SPI_I2S_ITConfig(SPI_TypeDef* SPIx, uint8_t SPI_I2S_IT, FunctionalState NewState);
void SPI_I2S_DMACmd(SPI_TypeDef* SPIx, uint16_t SPI_I2S_DMAReq, FunctionalState NewState);
void SPI_I2S_SendData(SPI_TypeDef* SPIx, uint16_t Data);
uint16_t SPI_I2S_ReceiveData(SPI_TypeDef* SPIx);
void SPI_NSSInternalSoftwareConfig(SPI_TypeDef* SPIx, uint16_t SPI_NSSInternalSoft);
void SPI_SSOutputCmd(SPI_TypeDef* SPIx, FunctionalState NewState);
void SPI_DataSizeConfig(SPI_TypeDef* SPIx, uint16_t SPI_DataSize);
void SPI_TransmitCRC(SPI_TypeDef* SPIx);
void SPI_CalculateCRC(SPI_TypeDef* SPIx, FunctionalState NewState);
uint16_t SPI_GetCRC(SPI_TypeDef* SPIx, uint8_t SPI_CRC);
uint16_t SPI_GetCRCPolynomial(SPI_TypeDef* SPIx);
void SPI_BiDirectionalLineConfig(SPI_TypeDef* SPIx, uint16_t SPI_Direction);
FlagStatus SPI_I2S_GetFlagStatus(SPI_TypeDef* SPIx, uint16_t SPI_I2S_FLAG);
void SPI_I2S_ClearFlag(SPI_TypeDef* SPIx, uint16_t SPI_I2S_FLAG);
ITStatus SPI_I2S_GetITStatus(SPI_TypeDef* SPIx, uint8_t SPI_I2S_IT);
void SPI_I2S_ClearITPendingBit(SPI_TypeDef* SPIx, uint8_t SPI_I2S_IT);
#ifdef __cplusplus
}
#endif
#endif /*__STM32F10x_SPI_H */
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
| [
"[email protected]"
] | |
a45ee64615612a01321b524a06d8e97fa24699ae | cfe69fc556729bdecf2118fa5bc329343c42ed80 | /10.0.10240.16384/ntoskrnl/Functions/KeQueryHighestNodeNumber.c | fbec8bb8ce1e10b8539d1652a6d4f9b89d536f49 | [] | no_license | Myprivateclonelibrary/W10M_unedited-decomp | 8e5ec89a20e634ffc53457a40b0fd6d8a9e1757a | 67b05851a3e262ff8a5d11ee50db34f28c350f16 | refs/heads/main | 2023-08-31T06:00:37.303105 | 2021-05-15T23:53:23 | 2021-05-15T23:53:23 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 114 | c | // KeQueryHighestNodeNumber
int KeQueryHighestNodeNumber()
{
return (unsigned __int16)(KeNumberNodes - 1);
}
| [
"[email protected]"
] | |
26a6ad5a8d8015b33a9175c6121a7c9cbc10725c | 8d6040330b892c6bd2d310be135e168639e45e7a | /ASNativeActivity/phoenixas/src/main/cpp/libretro-common/samples/net/net_http_test.c | 92d1cdec0dabb07d9b4ed642567c8f7dfa43effb | [
"Apache-2.0"
] | permissive | playbar/android-ndk | 747fbd4b68dcb160ca6f20d3358d449f778385dd | 34e79bc1de9caa27faa72f5f1fb4ad3202debdc6 | refs/heads/master | 2021-01-19T20:02:48.223473 | 2018-07-17T07:08:20 | 2018-07-17T07:08:20 | 88,476,630 | 1 | 0 | Apache-2.0 | 2018-07-17T07:08:54 | 2017-04-17T05:57:58 | C | UTF-8 | C | false | false | 2,146 | c | /* Copyright (C) 2010-2017 The RetroArch team
*
* ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (net_http_test.c).
* ---------------------------------------------------------------------------------------
*
* Permission is hereby granted, free of charge,
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <stdio.h>
#include <net/net_http.h>
#include <net/net_compat.h>
#ifdef _WIN32
#include <winsock2.h>
#endif
int main(void)
{
char *data;
struct http_t *http1, *http3;
size_t len, pos = 0, tot = 0;
if (!network_init())
return -1;
http1 = net_http_new("http://buildbot.libretro.com/nightly/win-x86/latest/mednafen_psx_libretro.dll.zip");
while (!net_http_update(http1, &pos, &tot))
printf("%.9lu / %.9lu \r",pos,tot);
http3 = net_http_new("http://www.wikipedia.org/");
while (!net_http_update(http3, NULL, NULL)) {}
data = (char*)net_http_data(http3, &len, false);
printf("%.*s\n", (int)256, data);
net_http_delete(http1);
net_http_delete(http3);
network_deinit();
return 0;
}
| [
"[email protected]"
] | |
0bd40d2dce82c40cc116587336bca07c3805cf01 | 62277effd99b3c42d0826b18562d4b90624e43a6 | /matlab/mid/2d/codegen/lib/obtain_neighbor_faces/obtain_neighbor_faces_mex.c | f84226a4a268bcce762214e23445956ecc64ae03 | [] | no_license | meshkit/ahf | 99f64cdb8aa82e81170b55a7d2fa26a3bda4ab25 | be674b91ad5e27286d5bfdde7a32f5dff4fa8ccf | refs/heads/master | 2020-09-08T15:06:53.465776 | 2015-04-09T03:38:23 | 2015-04-09T03:38:23 | 94,435,461 | 3 | 1 | null | null | null | null | UTF-8 | C | false | false | 8,145 | c | /*
* obtain_neighbor_faces_mex.c
*
* Auxiliary code generation for function obtain_neighbor_faces
*
* C source code generated by m2c.
*
*/
#include "mex.h"
#define BUILD_MEX
/* Include the C file generated by codegen in lib mode */
#include "obtain_neighbor_faces.h"
#include "m2c.c"
#include "obtain_neighbor_faces.c"
/* Include declaration of some helper functions. */
#include "lib2mex_helper.c"
void obtain_neighbor_faces_api(const mxArray ** prhs, const mxArray **plhs) {
emxArray_int32_T sibhes;
emxArray_boolean_T ftags;
int32_T fid;
real_T *ngbfaces;
real_T *nfaces;
/* Marshall in function inputs */
if ( mxGetNumberOfElements(prhs[0]) && mxGetClassID(prhs[0]) != mxINT32_CLASS)
mexErrMsgIdAndTxt("obtain_neighbor_faces:WrongInputType",
"Input argument fid has incorrect data type. int32 is expected.");
if ( mxGetNumberOfElements(prhs[0]) != 1)
mexErrMsgIdAndTxt("obtain_neighbor_faces:WrongSizeOfInputArg",
"Argument fid should be a scalar.");
fid = *(int32_T*)mxGetData(prhs[0]);
if ( mxGetNumberOfElements(prhs[1]) && mxGetClassID(prhs[1]) != mxINT32_CLASS)
mexErrMsgIdAndTxt("obtain_neighbor_faces:WrongInputType",
"Input argument sibhes has incorrect data type. int32 is expected.");
alias_mxArray_to_emxArray(prhs[1], (emxArray__common *)&sibhes, "sibhes", 2);
plhs[2] = mxDuplicateArray( prhs[2]);
if ( mxGetNumberOfElements(plhs[2]) && mxGetClassID(plhs[2]) != mxLOGICAL_CLASS)
mexErrMsgIdAndTxt("obtain_neighbor_faces:WrongInputType",
"Input argument ftags has incorrect data type. logical is expected.");
alias_mxArray_to_emxArray(plhs[2], (emxArray__common *)&ftags, "ftags", 1);
/* Preallocate output variables */
{mwSize l_size[] = {100};
*(void **)&ngbfaces = prealloc_mxArray((mxArray**)&plhs[0], mxDOUBLE_CLASS, 1, l_size); }
{mwSize l_size[] = {1, 1};
*(void **)&nfaces = prealloc_mxArray((mxArray**)&plhs[1], mxDOUBLE_CLASS, 2, l_size); }
/* Invoke the target function */
obtain_neighbor_faces_initialize();
obtain_neighbor_faces(fid, &sibhes, &ftags, ngbfaces, nfaces);
obtain_neighbor_faces_terminate();
/* Marshall out function outputs */
/* Nothing to do for plhs[0] */
/* Nothing to do for plhs[1] */
if (ftags.canFreeData) plhs[2] = move_emxArray_to_mxArray((emxArray__common*)&ftags, mxLOGICAL_CLASS); /* Free temporary variables */
free_emxArray( (emxArray__common*)&sibhes);
free_emxArray( (emxArray__common*)&ftags);}
void obtain_neighbor_faces_usestruct_api(const mxArray ** prhs, const mxArray **plhs) {
emxArray_boolean_T ftags;
b_struct_T sibhes;
mxArray *_sub_mx1;
int32_T fid;
boolean_T usestruct;
real_T *ngbfaces;
real_T *nfaces;
/* Marshall in function inputs */
if ( mxGetNumberOfElements(prhs[0]) && mxGetClassID(prhs[0]) != mxINT32_CLASS)
mexErrMsgIdAndTxt("obtain_neighbor_faces_usestruct:WrongInputType",
"Input argument fid has incorrect data type. int32 is expected.");
if ( mxGetNumberOfElements(prhs[0]) != 1)
mexErrMsgIdAndTxt("obtain_neighbor_faces_usestruct:WrongSizeOfInputArg",
"Argument fid should be a scalar.");
fid = *(int32_T*)mxGetData(prhs[0]);
if ( !mxIsStruct(prhs[1]))
mexErrMsgIdAndTxt("obtain_neighbor_faces_usestruct:WrongInputType",
"Input argument sibhes has incorrect data type. struct is expected.");
if ( mxGetNumberOfFields( prhs[1])!=2)
mexWarnMsgIdAndTxt("obtain_neighbor_faces_usestruct:InputStructWrongFields",
"Input argument sibhes has incorrect number of fields.");
if ( mxGetNumberOfElements(prhs[1]) != 1)
mexErrMsgIdAndTxt("obtain_neighbor_faces_usestruct:WrongSizeOfInputArg",
"Argument sibhes must contain 1 items.");
_sub_mx1 = mxGetField( prhs[1], 0, "fid");
if ( _sub_mx1==NULL)
mexErrMsgIdAndTxt("obtain_neighbor_faces_usestruct:WrongInputStruct",
"Input argument sibhes does not have the field fid.");
if ( mxGetNumberOfElements(_sub_mx1) && mxGetClassID(_sub_mx1) != mxINT32_CLASS)
mexErrMsgIdAndTxt("obtain_neighbor_faces_usestruct:WrongInputType",
"Input argument sibhes.fid has incorrect data type. int32 is expected.");
*(void**)&sibhes.fid = mxCalloc(1, sizeof(emxArray__common));
alias_mxArray_to_emxArray(_sub_mx1, (emxArray__common*)sibhes.fid, "sibhes.fid", 2);
_sub_mx1 = mxGetField( prhs[1], 0, "leid");
if ( _sub_mx1==NULL)
mexErrMsgIdAndTxt("obtain_neighbor_faces_usestruct:WrongInputStruct",
"Input argument sibhes does not have the field leid.");
if ( mxGetNumberOfElements(_sub_mx1) && mxGetClassID(_sub_mx1) != mxINT8_CLASS)
mexErrMsgIdAndTxt("obtain_neighbor_faces_usestruct:WrongInputType",
"Input argument sibhes.leid has incorrect data type. int8 is expected.");
*(void**)&sibhes.leid = mxCalloc(1, sizeof(emxArray__common));
alias_mxArray_to_emxArray(_sub_mx1, (emxArray__common*)sibhes.leid, "sibhes.leid", 2);
plhs[2] = mxDuplicateArray( prhs[2]);
if ( mxGetNumberOfElements(plhs[2]) && mxGetClassID(plhs[2]) != mxLOGICAL_CLASS)
mexErrMsgIdAndTxt("obtain_neighbor_faces_usestruct:WrongInputType",
"Input argument ftags has incorrect data type. logical is expected.");
alias_mxArray_to_emxArray(plhs[2], (emxArray__common *)&ftags, "ftags", 1);
if ( mxGetNumberOfElements(prhs[3]) && mxGetClassID(prhs[3]) != mxLOGICAL_CLASS)
mexErrMsgIdAndTxt("obtain_neighbor_faces_usestruct:WrongInputType",
"Input argument usestruct has incorrect data type. logical is expected.");
if ( mxGetNumberOfElements(prhs[3]) != 1)
mexErrMsgIdAndTxt("obtain_neighbor_faces_usestruct:WrongSizeOfInputArg",
"Argument usestruct should be a scalar.");
usestruct = *(boolean_T*)mxGetData(prhs[3]);
/* Preallocate output variables */
{mwSize l_size[] = {100};
*(void **)&ngbfaces = prealloc_mxArray((mxArray**)&plhs[0], mxDOUBLE_CLASS, 1, l_size); }
{mwSize l_size[] = {1, 1};
*(void **)&nfaces = prealloc_mxArray((mxArray**)&plhs[1], mxDOUBLE_CLASS, 2, l_size); }
/* Invoke the target function */
obtain_neighbor_faces_initialize();
obtain_neighbor_faces_usestruct(fid, sibhes, &ftags, usestruct, ngbfaces, nfaces);
obtain_neighbor_faces_terminate();
/* Marshall out function outputs */
/* Nothing to do for plhs[0] */
/* Nothing to do for plhs[1] */
if (ftags.canFreeData) plhs[2] = move_emxArray_to_mxArray((emxArray__common*)&ftags, mxLOGICAL_CLASS); /* Free temporary variables */
free_emxArray( (emxArray__common*)sibhes.leid); mxFree( sibhes.leid);
free_emxArray( (emxArray__common*)sibhes.fid); mxFree( sibhes.fid);
free_emxArray( (emxArray__common*)&ftags);}
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
/* Temporary copy for mex outputs. */
mxArray *outputs[3];
int i;
int nOutputs = (nlhs < 1 ? 1 : nlhs);
if (nrhs == 3) {
if (nlhs > 3)
mexErrMsgIdAndTxt("obtain_neighbor_faces:TooManyOutputArguments","Too many output arguments for entry-point 'obtain_neighbor_faces'.");
/* Call the API function. */
obtain_neighbor_faces_api(prhs, (const mxArray**)outputs);
}
else if (nrhs == 4) {
if (nlhs > 3)
mexErrMsgIdAndTxt("obtain_neighbor_faces_usestruct:TooManyOutputArguments","Too many output arguments for entry-point 'obtain_neighbor_faces_usestruct'.");
/* Call the API function. */
obtain_neighbor_faces_usestruct_api(prhs, (const mxArray**)outputs);
}
else
mexErrMsgIdAndTxt("obtain_neighbor_faces:WrongNumberOfInputs","Incorrect number of input variables for entry-point 'obtain_neighbor_faces'.");
/* Copy over outputs to the caller. */
for (i = 0; i < nOutputs; ++i) {
plhs[i] = outputs[i];
}
} | [
"[email protected]"
] | |
4ac36da7c41b94042946efe3b2b923ace081f54a | 767c1c61311a546b7e63937529c563da62cf8cd0 | /practice/practiceNet/tcpPthreadClient.c | 955dd725f77b57938a2c710849c96642c561d942 | [] | no_license | zhangjiang19926/practice | ac4302fda80eefd11a4df1c244a5f29f6d331e8e | 79b61a2ddfc9a369cb007e9c31235566a8555fd2 | refs/heads/master | 2020-04-06T07:12:51.325195 | 2016-09-22T09:53:40 | 2016-09-22T09:53:40 | 54,694,535 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 2,447 | c | /**********************************************************
* 作者: 张江
* 程序功能: 实现TCP协议的socket客户端功能
* 在其中使用一个线程进行接收数据,
* 主线程负责发送功能。
* 完成时间: 2016/01/22
* 存在的问题:若有一方退出,另一方不能立马按
* 键退出
***********************************************************/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <errno.h>
#include <netdb.h>
#include <pthread.h>
#define PORT 12000
#define BUFLEN 1024
void pthreadRcv(void);
void display(char *str);
char buffer[BUFLEN] = {'\0'};
int sockfd;
struct sockaddr_in client_addr;
int main (int argc, char *argv[])
{
struct hostent *host;
pthread_t pthread;
if (argc < 2)
{
fprintf(stderr,"please enter the sever's hostname1\n");
exit(1);
}
if ((host = gethostbyname(argv[1])) == NULL)
{
perror("gethostbyname");
exit(1);
}
if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) == -1)
{
perror("socket");
exit(1);
}
client_addr.sin_family = AF_INET;
client_addr.sin_port = htons(PORT);
client_addr.sin_addr = *((struct in_addr *)host -> h_addr);
memset(&(client_addr.sin_zero), 0, 8);
if (connect(sockfd, (struct sockaddr *)&client_addr, sizeof(struct sockaddr)) == -1)
{
perror("connect");
exit(1);
}
printf("I'm ready!you can send a message to me!\n");
if (pthread_create(&pthread, NULL, (void *)pthreadRcv, NULL) != 0)
{
perror("pthread_create");
exit(1);
}
while(1)
{
char msg[BUFLEN];
int numbytes;
scanf("%s",msg);
numbytes = send(sockfd, msg, strlen(msg), 0);
if( numbytes == -1 )
{
perror("send");
exit(1);
}
if (strcmp(msg,"exit") == 0)
{
printf("client quit!\n");
close(sockfd);
exit(1);
}
}
return 0;
}
void pthreadRcv(void)
{
while(1)
{
char buff[BUFLEN] = {'\0'};
char quit[BUFLEN];
int numbytes = recv(sockfd, buff, BUFLEN, 0);
if (numbytes == -1)
{
perror("recv");
exit(1);
}
if (numbytes == 0)
{
strcpy(buff, "exit");
}
printf("I receive a message:%s\n", buff);
if (strcmp(buff, "exit") == 0)
{
printf("Do you want to exit!\n");
scanf("%s",quit);
if ((strcmp(quit,"Y") == 0) || (strcmp(quit,"Y") == 0))
{
close(sockfd);
exit(1);
}
printf("you want to play a long time!\n");
}
}
}
void display(char *str)
{
}
| [
"zhangxiaojian12345gmail.com"
] | zhangxiaojian12345gmail.com |
20b6654151ad445e10bbec05865cdca4d5024ab5 | b97f105de7ad5cf871d10b47e6281ab47c9431d7 | /C_11/ex05/srcs/ft_operation.c | b0da1351aa86e2cf5eee15b3bb39dd4a2a31483c | [] | no_license | blossom4/42Seoul_Piscine | b63d1673484da9ef51c3e046f0fb10a5b1ba3acd | 7a2cc4b5b34f797586d9a3f97e0d86633b091057 | refs/heads/master | 2023-02-24T07:19:57.733685 | 2021-01-26T15:00:12 | 2021-01-26T15:00:12 | 330,688,740 | 1 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,194 | c | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_operation.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: youcho <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/02/12 11:33:29 by youcho #+# #+# */
/* Updated: 2020/02/12 11:33:41 by youcho ### ########.fr */
/* */
/* ************************************************************************** */
int ft_operation_add(int a, int b)
{
return (a + b);
}
int ft_operation_minus(int a, int b)
{
return (a - b);
}
int ft_operation_devide(int a, int b)
{
return (a / b);
}
int ft_operation_multiply(int a, int b)
{
return (a * b);
}
int ft_operation_modulo(int a, int b)
{
return (a % b);
}
| [
"[email protected]"
] | |
11854b243a509e96bacd0687aed23a2e805a0c3f | f026cb616ef14bae15a1d251ca6dbe0f55016d9c | /linux/25074.c | a6fc901f1ebbc357f6e14cf8f0a04bab4cd34981 | [] | no_license | jajajasalu2/cocci-lkmp-c-files | 3eb7d451929dca5cb6beb56aabd69fe3f7fc176c | 5da943aabe1589e393a131121dbf8e7a84b3cf2a | refs/heads/master | 2020-12-02T17:30:14.411816 | 2020-01-29T08:36:30 | 2020-01-29T08:36:30 | 231,053,574 | 1 | 0 | null | null | null | null | UTF-8 | C | false | false | 925 | c | cocci_test_suite() {
int cocci_id/* net/mac80211/wme.c 90 */;
struct ieee80211_if_managed *cocci_id/* net/mac80211/wme.c 86 */;
u8 cocci_id/* net/mac80211/wme.c 59 */;
struct ieee80211_tx_info *cocci_id/* net/mac80211/wme.c 242 */;
void *cocci_id/* net/mac80211/wme.c 241 */;
void cocci_id/* net/mac80211/wme.c 238 */;
const int cocci_id/* net/mac80211/wme.c 22 */[8];
const u8 *cocci_id/* net/mac80211/wme.c 183 */;
struct ieee80211_local *cocci_id/* net/mac80211/wme.c 181 */;
bool cocci_id/* net/mac80211/wme.c 145 */;
struct mac80211_qos_map *cocci_id/* net/mac80211/wme.c 144 */;
struct sta_info *cocci_id/* net/mac80211/wme.c 142 */;
struct sk_buff *cocci_id/* net/mac80211/wme.c 142 */;
u16 cocci_id/* net/mac80211/wme.c 141 */;
struct ieee80211_sub_if_data *cocci_id/* net/mac80211/wme.c 141 */;
u8 *cocci_id/* net/mac80211/wme.c 121 */;
struct ieee80211_hdr *cocci_id/* net/mac80211/wme.c 118 */;
}
| [
"[email protected]"
] | |
58202e144e61248b2ccd0b745b3730d809759e91 | 98142603248316c6ce83309c0306003af2ef252f | /GraphicsEngine/Graphics/ModelType.h | c1b6720a5df0b6630eacf02cb5317beb61146385 | [] | no_license | SimicDomagoj/GraphicsEngine | 0567f1d9a6ab5f98b3612aa655b406bd2c249256 | 69ab4f2ca922d996520eb56351b97e352f83da10 | refs/heads/master | 2021-01-01T20:32:08.331739 | 2017-07-31T12:15:08 | 2017-07-31T12:20:59 | 98,883,839 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 257 | h | #pragma once
/**
Enumerator used for defining load type.
*/
enum class ModelType
{
e3D = 0, //*< 3D model with vertices, uvs and normals.
e2D, //*< 2D model with vertices and uvs.
e3DTangent //*< 3D model with vertices, uvs, normals and tangents.
}; | [
"[email protected]"
] | |
21b0d188921c1f84fb1ef4c5b934ce77710d0c38 | af2dc3971c9abb86c209d8151630019508ae0b7b | /cg.h | 0f41212f33fc053fd2864a5f2c5c90932258aa2b | [] | no_license | kangyue92/Pascal-Compiler | b52404ba9d752d543241a535024497cf5f836fbd | ff97a73222dd6a1926feff8c11a24bdba3475e1e | refs/heads/master | 2021-05-27T16:00:55.944677 | 2012-01-07T05:32:45 | 2012-01-07T05:32:45 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,754 | h | // cg.h
#ifndef CG_H
#define CG_H
#include "tac.h"
#define R_ZERO 0 //constant zero
#define R_P 1 //stack pointer
#define R_CALL 2 //address of called routine
#define R_RET 3 //return address
#define R_RES 4 //result reg and last reserved
#define R_COND 5 //conditional code register
#define R_GEN 6 //first general purpose register
#define R_MAX 12 //6 general purpose registers
#define P_OFF 0 //offset of stack pointer on frame
#define PC_OFF 4 //offset of ret address on frame
#define VAR_OFF 8 //offset of variables on frame
#define MODIFIED 1
#define UNMODIFIED 0
//register macros for printing
#define M_EBP "%ebp" //frame pointer
#define M_ESP "%esp" //stack pointer
#define M_EAX "%eax" //general purpose
#define M_EBX "%ebx" //general purpose
#define M_ECX "%ecx" //general purpose
#define M_EDX "%edx" //general purpose
#define M_ESI "%esi" //general purpose
#define M_EDI "%edi" //general purpose
#define M_AL "%al" //used for condition codes
#define M_PRINTF_ARG "\"%d\\n\""
struct {
struct symb *name;
int modified;
} rdesc[R_MAX];
int tos;
int next_arg;
void cg(TAC *t1);
TAC *init_cg(TAC *t1);
void cg_instruction(TAC *c);
void cg_binop(int op, SYMB *a, SYMB *b, SYMB *c);
void cg_relop(char *op, SYMB *a, SYMB *b, SYMB *c);
void cg_unop(int op, SYMB *a, SYMB *b);
void cg_copy(SYMB *a, SYMB *b);
void cg_cond(char *op, SYMB *a, int l);
void cg_offset(SYMB *a, SYMB *b, SYMB *c);
void cg_arg(SYMB *a);
void cg_print(SYMB *s);
void cg_call(int f, SYMB *res);
void cg_return(SYMB *a);
int insert_desc(int r, SYMB *n, int mod);
void load_reg(int r, SYMB *s);
void clear_desc(int r);
void flush_all();
void spill_all();
void spill_one(int r);
char *find_reg(int enum_val);
#endif CG_H
| [
"[email protected]"
] | |
3326a1429576a77d85a8f4d2d5652772f174e799 | c9c583f2e398e4b9685ea77e5162265895a6d25f | /algospot/pi/pi.c | 73f195a2b510a05208a276ec631c89de400e7a71 | [] | no_license | jwchae8/algorithm_study | af227be2a21b8f403131abfd6371229b39e2f853 | ab0236845153e7f5b8fc4fa0864b7c256d615dcc | refs/heads/master | 2020-03-20T15:58:52.741586 | 2019-12-24T05:05:37 | 2019-12-24T05:05:37 | 137,526,626 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,570 | c | #include <stdio.h>
#include <string.h>
int dp_table[10000];
int difficulty_measure(char num[10001], int len, int digit) {
int i, cnt = 0;
for(i=digit; i<digit+len - 1; i++) {
if(num[i] == num[i+1])
cnt++;
}
if(cnt == len - 1)
return 1;
cnt = 0;
for(i=digit; i<digit+len-1; i++) {
if(num[i] == num[i+1] + 1)
cnt++;
}
if(cnt == len - 1)
return 2;
cnt = 0;
for(i=digit; i<digit+len-1; i++) {
if(num[i] == num[i+1] - 1)
cnt++;
}
if(cnt == len - 1)
return 2;
cnt = 0;
for(i=digit; i<digit+len-2; i++) {
if(num[i] == num[i+2])
cnt++;
}
if(cnt == len - 2)
return 4;
cnt = 0;
for(i=digit; i<digit+len-2; i++) {
if(num[i] - num[i+1] == num[i+1] - num[i+2])
cnt++;
}
if(cnt == len - 2)
return 5;
return 10;
}
int solve(char num[10001], int digit) {
if(digit >= strlen(num))
return 0;
if(dp_table[digit] != -1)
return dp_table[digit];
int i, min = 987654321, difficulty;
for(i=3; i<=5; i++) {
difficulty = difficulty_measure(num, i, digit) + solve(num, digit+i);
if(min > difficulty)
min = difficulty;
}
dp_table[digit] = min;
return min;
}
int main() {
int i;
int c;
char num[10001];
scanf("%d", &c);
for(i=0; i<c; i++) {
scanf("%s", num);
memset(dp_table, -1, sizeof(int) * 10000);
printf("%d\n", solve(num, 0));
}
return 0;
}
| [
"[email protected]"
] | |
280d76c319c15a5dd0952fa42f6e7795be83c15d | db8829cbf4690702088a23139c067afd89030301 | /Headers/IDT.h | a66587694fe5afdd11f398256199ea652f476ca1 | [] | no_license | willbou1/OS | f5eaa320545ddb30e80d72e98cd53e0c7f642956 | 6eca5adab2ff0f13d67c0ac631844d627ccd0bf7 | refs/heads/master | 2020-12-08T12:20:57.429484 | 2020-08-16T22:18:24 | 2020-08-16T22:18:24 | 232,979,907 | 1 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,143 | h | #ifndef IDT_H
#define IDT_H
#include "Headers/types.h"
#include "Headers/debug.h"
//Options
//0101: 32-bit Task gate 0110: 16-bit Interrupt gate 0111: 16-bit Trap gate
//1110: 32-bit Interrupt gate 1111: 32-bit trap gate
#define IDT_TYPE_ATTR_GATE_TYPE 0b00001111
//0: For interrupt or trap gates
#define IDT_TYPE_ATTR_STORAGE_SEGMENT 0b00010000
//>= privilage level can call
#define IDT_TYPE_ATTR_PRIVILEGE_LEVEL 0b01100000
//1: For valid descriptor
#define IDT_TYPE_ATTR_PRESENT 0b10000000
//Common types
#define IDT_TYPE_ATTR_INT_GATE 0b10001110
#define IDT_TYPE_ATTR_TRAP_GATE 0b10001111
struct {
uint16_t size;
uint32_t offset;
} __attribute__((packed))
IDTDescriptor;
struct {
uint16_t offset_low;
uint16_t selector;
uint8_t zero;
uint8_t type_attr;
uint16_t offset_high;
} __attribute__((packed))
IDT[256];
void setGateDescriptor(const uint8_t index, const uint32_t offset, const uint16_t selector, const uint8_t typeAttr);
uint32_t getGateOffset(const uint8_t index);
void setGateOffset(const uint8_t index, const uint32_t offset);
void flushIDT();
void loadIDT();
#endif //IDT_H | [
"[email protected]"
] | |
e8478a2c489a97a280e08f8febca53b801f032cb | 9aa44ffde2363a624c7a738524fb8de19b2ad27b | /Software/display/mbed-src/targets/cmsis/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32HG_STK3400/system_efm32hg.c | 1e486d87aa7d13c71bae4e292a105011b9cfa78c | [] | no_license | nickmolo/ECE477 | b21417f240ff7cb5825e700f1ec18a44a168c24e | e8b94b1dd26828c383c3bb1a9f5d433efbe441a4 | refs/heads/master | 2016-08-03T20:22:07.512073 | 2015-12-16T07:00:39 | 2015-12-16T07:00:39 | 41,696,866 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 12,821 | c | /***************************************************************************//**
* @file system_efm32hg.c
* @brief CMSIS Cortex-M0+ System Layer for EFM32HG devices.
* @version 3.20.12
******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Laboratories, Inc. http://www.silabs.com</b>
******************************************************************************
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software.@n
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.@n
* 3. This notice may not be removed or altered from any source distribution.
*
* DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Silicon Laboratories, Inc.
* has no obligation to support this Software. Silicon Laboratories, Inc. is
* providing the Software "AS IS", with no express or implied warranties of any
* kind, including, but not limited to, any implied warranties of
* merchantability or fitness for any particular purpose or warranties against
* infringement of any proprietary rights of a third party.
*
* Silicon Laboratories, Inc. will not be liable for any consequential,
* incidental, or special damages, or any other relief, or for any claim by
* any third party, arising from your use of this Software.
*
*****************************************************************************/
#include <stdint.h>
#include "em_device.h"
/*******************************************************************************
****************************** DEFINES ************************************
******************************************************************************/
/** LFRCO frequency, tuned to below frequency during manufacturing. */
#define EFM32_LFRCO_FREQ (32768UL)
#define EFM32_ULFRCO_FREQ (1000UL)
/*******************************************************************************
************************** LOCAL VARIABLES ********************************
******************************************************************************/
/* System oscillator frequencies. These frequencies are normally constant */
/* for a target, but they are made configurable in order to allow run-time */
/* handling of different boards. The crystal oscillator clocks can be set */
/* compile time to a non-default value by defining respective EFM32_nFXO_FREQ */
/* values according to board design. By defining the EFM32_nFXO_FREQ to 0, */
/* one indicates that the oscillator is not present, in order to save some */
/* SW footprint. */
#ifndef EFM32_HFXO_FREQ
#define EFM32_HFXO_FREQ (24000000UL)
#define EFM32_HFRCO_MAX_FREQ (21000000UL)
#endif
/* Do not define variable if HF crystal oscillator not present */
#if (EFM32_HFXO_FREQ > 0)
/** @cond DO_NOT_INCLUDE_WITH_DOXYGEN */
/** System HFXO clock. */
static uint32_t SystemHFXOClock = EFM32_HFXO_FREQ;
/** @endcond (DO_NOT_INCLUDE_WITH_DOXYGEN) */
#endif
#ifndef EFM32_LFXO_FREQ
#define EFM32_LFXO_FREQ (EFM32_LFRCO_FREQ)
#endif
/* Do not define variable if LF crystal oscillator not present */
#if (EFM32_LFXO_FREQ > 0)
/** @cond DO_NOT_INCLUDE_WITH_DOXYGEN */
/** System LFXO clock. */
static uint32_t SystemLFXOClock = EFM32_LFXO_FREQ;
/** @endcond (DO_NOT_INCLUDE_WITH_DOXYGEN) */
#endif
/*******************************************************************************
************************** GLOBAL VARIABLES *******************************
******************************************************************************/
/**
* @brief
* System System Clock Frequency (Core Clock).
*
* @details
* Required CMSIS global variable that must be kept up-to-date.
*/
uint32_t SystemCoreClock;
/*******************************************************************************
************************** GLOBAL FUNCTIONS *******************************
******************************************************************************/
/***************************************************************************//**
* @brief
* Get the current core clock frequency.
*
* @details
* Calculate and get the current core clock frequency based on the current
* configuration. Assuming that the SystemCoreClock global variable is
* maintained, the core clock frequency is stored in that variable as well.
* This function will however calculate the core clock based on actual HW
* configuration. It will also update the SystemCoreClock global variable.
*
* @note
* This is an EFM32 proprietary function, not part of the CMSIS definition.
*
* @return
* The current core clock frequency in Hz.
******************************************************************************/
uint32_t SystemCoreClockGet(void)
{
uint32_t ret;
ret = SystemHFClockGet();
ret >>= (CMU->HFCORECLKDIV & _CMU_HFCORECLKDIV_HFCORECLKDIV_MASK) >>
_CMU_HFCORECLKDIV_HFCORECLKDIV_SHIFT;
/* Keep CMSIS variable up-to-date just in case */
SystemCoreClock = ret;
return ret;
}
/***************************************************************************//**
* @brief
* Get the maximum core clock frequency.
*
* @note
* This is an EFR32 proprietary function, not part of the CMSIS definition.
*
* @return
* The maximum core clock frequency in Hz.
******************************************************************************/
uint32_t SystemMaxCoreClockGet(void)
{
return (EFM32_HFRCO_MAX_FREQ > EFM32_HFXO_FREQ ? \
EFM32_HFRCO_MAX_FREQ : EFM32_HFXO_FREQ);
}
/***************************************************************************//**
* @brief
* Get the current HFCLK frequency.
*
* @note
* This is an EFM32 proprietary function, not part of the CMSIS definition.
*
* @return
* The current HFCLK frequency in Hz.
******************************************************************************/
uint32_t SystemHFClockGet(void)
{
uint32_t ret;
switch (CMU->STATUS & (CMU_STATUS_HFRCOSEL | CMU_STATUS_HFXOSEL |
CMU_STATUS_LFRCOSEL | CMU_STATUS_LFXOSEL |
CMU_STATUS_USHFRCODIV2SEL))
{
case CMU_STATUS_LFXOSEL:
#if (EFM32_LFXO_FREQ > 0)
ret = SystemLFXOClock;
#else
/* We should not get here, since core should not be clocked. May */
/* be caused by a misconfiguration though. */
ret = 0;
#endif
break;
case CMU_STATUS_LFRCOSEL:
ret = EFM32_LFRCO_FREQ;
break;
case CMU_STATUS_HFXOSEL:
#if (EFM32_HFXO_FREQ > 0)
ret = SystemHFXOClock;
#else
/* We should not get here, since core should not be clocked. May */
/* be caused by a misconfiguration though. */
ret = 0;
#endif
break;
case CMU_STATUS_USHFRCODIV2SEL:
ret = 24000000;
break;
default: /* CMU_STATUS_HFRCOSEL */
switch (CMU->HFRCOCTRL & _CMU_HFRCOCTRL_BAND_MASK)
{
case CMU_HFRCOCTRL_BAND_21MHZ:
ret = 21000000;
break;
case CMU_HFRCOCTRL_BAND_14MHZ:
ret = 14000000;
break;
case CMU_HFRCOCTRL_BAND_11MHZ:
ret = 11000000;
break;
case CMU_HFRCOCTRL_BAND_7MHZ:
ret = 6600000;
break;
case CMU_HFRCOCTRL_BAND_1MHZ:
ret = 1200000;
break;
default:
ret = 0;
break;
}
break;
}
return ret;
}
/**************************************************************************//**
* @brief
* Get high frequency crystal oscillator clock frequency for target system.
*
* @note
* This is an EFM32 proprietary function, not part of the CMSIS definition.
*
* @return
* HFXO frequency in Hz.
*****************************************************************************/
uint32_t SystemHFXOClockGet(void)
{
/* External crystal oscillator present? */
#if (EFM32_HFXO_FREQ > 0)
return SystemHFXOClock;
#else
return 0;
#endif
}
/**************************************************************************//**
* @brief
* Set high frequency crystal oscillator clock frequency for target system.
*
* @note
* This function is mainly provided for being able to handle target systems
* with different HF crystal oscillator frequencies run-time. If used, it
* should probably only be used once during system startup.
*
* @note
* This is an EFM32 proprietary function, not part of the CMSIS definition.
*
* @param[in] freq
* HFXO frequency in Hz used for target.
*****************************************************************************/
void SystemHFXOClockSet(uint32_t freq)
{
/* External crystal oscillator present? */
#if (EFM32_HFXO_FREQ > 0)
SystemHFXOClock = freq;
/* Update core clock frequency if HFXO is used to clock core */
if (CMU->STATUS & CMU_STATUS_HFXOSEL)
{
/* The function will update the global variable */
SystemCoreClockGet();
}
#else
(void)freq; /* Unused parameter */
#endif
}
/**************************************************************************//**
* @brief
* Initialize the system.
*
* @details
* Do required generic HW system init.
*
* @note
* This function is invoked during system init, before the main() routine
* and any data has been initialized. For this reason, it cannot do any
* initialization of variables etc.
*****************************************************************************/
void SystemInit(void)
{
}
/**************************************************************************//**
* @brief
* Get low frequency RC oscillator clock frequency for target system.
*
* @note
* This is an EFM32 proprietary function, not part of the CMSIS definition.
*
* @return
* LFRCO frequency in Hz.
*****************************************************************************/
uint32_t SystemLFRCOClockGet(void)
{
/* Currently we assume that this frequency is properly tuned during */
/* manufacturing and is not changed after reset. If future requirements */
/* for re-tuning by user, we can add support for that. */
return EFM32_LFRCO_FREQ;
}
/**************************************************************************//**
* @brief
* Get ultra low frequency RC oscillator clock frequency for target system.
*
* @note
* This is an EFM32 proprietary function, not part of the CMSIS definition.
*
* @return
* ULFRCO frequency in Hz.
*****************************************************************************/
uint32_t SystemULFRCOClockGet(void)
{
/* The ULFRCO frequency is not tuned, and can be very inaccurate */
return EFM32_ULFRCO_FREQ;
}
/**************************************************************************//**
* @brief
* Get low frequency crystal oscillator clock frequency for target system.
*
* @note
* This is an EFM32 proprietary function, not part of the CMSIS definition.
*
* @return
* LFXO frequency in Hz.
*****************************************************************************/
uint32_t SystemLFXOClockGet(void)
{
/* External crystal oscillator present? */
#if (EFM32_LFXO_FREQ > 0)
return SystemLFXOClock;
#else
return 0;
#endif
}
/**************************************************************************//**
* @brief
* Set low frequency crystal oscillator clock frequency for target system.
*
* @note
* This function is mainly provided for being able to handle target systems
* with different HF crystal oscillator frequencies run-time. If used, it
* should probably only be used once during system startup.
*
* @note
* This is an EFM32 proprietary function, not part of the CMSIS definition.
*
* @param[in] freq
* LFXO frequency in Hz used for target.
*****************************************************************************/
void SystemLFXOClockSet(uint32_t freq)
{
/* External crystal oscillator present? */
#if (EFM32_LFXO_FREQ > 0)
SystemLFXOClock = freq;
/* Update core clock frequency if LFXO is used to clock core */
if (CMU->STATUS & CMU_STATUS_LFXOSEL)
{
/* The function will update the global variable */
SystemCoreClockGet();
}
#else
(void)freq; /* Unused parameter */
#endif
}
| [
"[email protected]"
] | |
e4c23b5a9fb38f7639dd116de75d5c5e8274ed9c | 7eaf54a78c9e2117247cb2ab6d3a0c20719ba700 | /SOFTWARE/A64-TERES/linux-a64/drivers/block/mtip32xx/mtip32xx.h | 3bb8a295fbe4d96d51b429812748ebe293ebb98d | [
"Linux-syscall-note",
"GPL-2.0-only",
"GPL-1.0-or-later",
"LicenseRef-scancode-free-unknown",
"Apache-2.0"
] | permissive | OLIMEX/DIY-LAPTOP | ae82f4ee79c641d9aee444db9a75f3f6709afa92 | a3fafd1309135650bab27f5eafc0c32bc3ca74ee | refs/heads/rel3 | 2023-08-04T01:54:19.483792 | 2023-04-03T07:18:12 | 2023-04-03T07:18:12 | 80,094,055 | 507 | 92 | Apache-2.0 | 2023-04-03T07:05:59 | 2017-01-26T07:25:50 | C | UTF-8 | C | false | false | 14,377 | h | /*
* mtip32xx.h - Header file for the P320 SSD Block Driver
* Copyright (C) 2011 Micron Technology, Inc.
*
* Portions of this code were derived from works subjected to the
* following copyright:
* Copyright (C) 2009 Integrated Device Technology, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#ifndef __MTIP32XX_H__
#define __MTIP32XX_H__
#include <linux/spinlock.h>
#include <linux/rwsem.h>
#include <linux/ata.h>
#include <linux/interrupt.h>
#include <linux/genhd.h>
/* Offset of Subsystem Device ID in pci confoguration space */
#define PCI_SUBSYSTEM_DEVICEID 0x2E
/* offset of Device Control register in PCIe extended capabilites space */
#define PCIE_CONFIG_EXT_DEVICE_CONTROL_OFFSET 0x48
/* check for erase mode support during secure erase */
#define MTIP_SEC_ERASE_MODE 0x2
/* # of times to retry timed out/failed IOs */
#define MTIP_MAX_RETRIES 2
/* Various timeout values in ms */
#define MTIP_NCQ_COMMAND_TIMEOUT_MS 5000
#define MTIP_IOCTL_COMMAND_TIMEOUT_MS 5000
#define MTIP_INTERNAL_COMMAND_TIMEOUT_MS 5000
/* check for timeouts every 500ms */
#define MTIP_TIMEOUT_CHECK_PERIOD 500
/* ftl rebuild */
#define MTIP_FTL_REBUILD_OFFSET 142
#define MTIP_FTL_REBUILD_MAGIC 0xED51
#define MTIP_FTL_REBUILD_TIMEOUT_MS 2400000
/* unaligned IO handling */
#define MTIP_MAX_UNALIGNED_SLOTS 8
/* Macro to extract the tag bit number from a tag value. */
#define MTIP_TAG_BIT(tag) (tag & 0x1F)
/*
* Macro to extract the tag index from a tag value. The index
* is used to access the correct s_active/Command Issue register based
* on the tag value.
*/
#define MTIP_TAG_INDEX(tag) (tag >> 5)
/*
* Maximum number of scatter gather entries
* a single command may have.
*/
#define MTIP_MAX_SG 128
/*
* Maximum number of slot groups (Command Issue & s_active registers)
* NOTE: This is the driver maximum; check dd->slot_groups for actual value.
*/
#define MTIP_MAX_SLOT_GROUPS 8
/* Internal command tag. */
#define MTIP_TAG_INTERNAL 0
/* Micron Vendor ID & P320x SSD Device ID */
#define PCI_VENDOR_ID_MICRON 0x1344
#define P320H_DEVICE_ID 0x5150
#define P320M_DEVICE_ID 0x5151
#define P320S_DEVICE_ID 0x5152
#define P325M_DEVICE_ID 0x5153
#define P420H_DEVICE_ID 0x5160
#define P420M_DEVICE_ID 0x5161
#define P425M_DEVICE_ID 0x5163
/* Driver name and version strings */
#define MTIP_DRV_NAME "mtip32xx"
#define MTIP_DRV_VERSION "1.2.6os3"
/* Maximum number of minor device numbers per device. */
#define MTIP_MAX_MINORS 16
/* Maximum number of supported command slots. */
#define MTIP_MAX_COMMAND_SLOTS (MTIP_MAX_SLOT_GROUPS * 32)
/*
* Per-tag bitfield size in longs.
* Linux bit manipulation functions
* (i.e. test_and_set_bit, find_next_zero_bit)
* manipulate memory in longs, so we try to make the math work.
* take the slot groups and find the number of longs, rounding up.
* Careful! i386 and x86_64 use different size longs!
*/
#define U32_PER_LONG (sizeof(long) / sizeof(u32))
#define SLOTBITS_IN_LONGS ((MTIP_MAX_SLOT_GROUPS + \
(U32_PER_LONG-1))/U32_PER_LONG)
/* BAR number used to access the HBA registers. */
#define MTIP_ABAR 5
#ifdef DEBUG
#define dbg_printk(format, arg...) \
printk(pr_fmt(format), ##arg);
#else
#define dbg_printk(format, arg...)
#endif
#define MTIP_DFS_MAX_BUF_SIZE 1024
#define __force_bit2int (unsigned int __force)
enum {
/* below are bit numbers in 'flags' defined in mtip_port */
MTIP_PF_IC_ACTIVE_BIT = 0, /* pio/ioctl */
MTIP_PF_EH_ACTIVE_BIT = 1, /* error handling */
MTIP_PF_SE_ACTIVE_BIT = 2, /* secure erase */
MTIP_PF_DM_ACTIVE_BIT = 3, /* download microcde */
MTIP_PF_PAUSE_IO = ((1 << MTIP_PF_IC_ACTIVE_BIT) |
(1 << MTIP_PF_EH_ACTIVE_BIT) |
(1 << MTIP_PF_SE_ACTIVE_BIT) |
(1 << MTIP_PF_DM_ACTIVE_BIT)),
MTIP_PF_SVC_THD_ACTIVE_BIT = 4,
MTIP_PF_ISSUE_CMDS_BIT = 5,
MTIP_PF_REBUILD_BIT = 6,
MTIP_PF_SVC_THD_STOP_BIT = 8,
/* below are bit numbers in 'dd_flag' defined in driver_data */
MTIP_DDF_SEC_LOCK_BIT = 0,
MTIP_DDF_REMOVE_PENDING_BIT = 1,
MTIP_DDF_OVER_TEMP_BIT = 2,
MTIP_DDF_WRITE_PROTECT_BIT = 3,
MTIP_DDF_STOP_IO = ((1 << MTIP_DDF_REMOVE_PENDING_BIT) |
(1 << MTIP_DDF_SEC_LOCK_BIT) |
(1 << MTIP_DDF_OVER_TEMP_BIT) |
(1 << MTIP_DDF_WRITE_PROTECT_BIT)),
MTIP_DDF_CLEANUP_BIT = 5,
MTIP_DDF_RESUME_BIT = 6,
MTIP_DDF_INIT_DONE_BIT = 7,
MTIP_DDF_REBUILD_FAILED_BIT = 8,
};
struct smart_attr {
u8 attr_id;
u16 flags;
u8 cur;
u8 worst;
u32 data;
u8 res[3];
} __packed;
struct mtip_work {
struct work_struct work;
void *port;
int cpu_binding;
u32 completed;
} ____cacheline_aligned_in_smp;
#define DEFINE_HANDLER(group) \
void mtip_workq_sdbf##group(struct work_struct *work) \
{ \
struct mtip_work *w = (struct mtip_work *) work; \
mtip_workq_sdbfx(w->port, group, w->completed); \
}
#define MTIP_TRIM_TIMEOUT_MS 240000
#define MTIP_MAX_TRIM_ENTRIES 8
#define MTIP_MAX_TRIM_ENTRY_LEN 0xfff8
struct mtip_trim_entry {
u32 lba; /* starting lba of region */
u16 rsvd; /* unused */
u16 range; /* # of 512b blocks to trim */
} __packed;
struct mtip_trim {
/* Array of regions to trim */
struct mtip_trim_entry entry[MTIP_MAX_TRIM_ENTRIES];
} __packed;
/* Register Frame Information Structure (FIS), host to device. */
struct host_to_dev_fis {
/*
* FIS type.
* - 27h Register FIS, host to device.
* - 34h Register FIS, device to host.
* - 39h DMA Activate FIS, device to host.
* - 41h DMA Setup FIS, bi-directional.
* - 46h Data FIS, bi-directional.
* - 58h BIST Activate FIS, bi-directional.
* - 5Fh PIO Setup FIS, device to host.
* - A1h Set Device Bits FIS, device to host.
*/
unsigned char type;
unsigned char opts;
unsigned char command;
unsigned char features;
union {
unsigned char lba_low;
unsigned char sector;
};
union {
unsigned char lba_mid;
unsigned char cyl_low;
};
union {
unsigned char lba_hi;
unsigned char cyl_hi;
};
union {
unsigned char device;
unsigned char head;
};
union {
unsigned char lba_low_ex;
unsigned char sector_ex;
};
union {
unsigned char lba_mid_ex;
unsigned char cyl_low_ex;
};
union {
unsigned char lba_hi_ex;
unsigned char cyl_hi_ex;
};
unsigned char features_ex;
unsigned char sect_count;
unsigned char sect_cnt_ex;
unsigned char res2;
unsigned char control;
unsigned int res3;
};
/* Command header structure. */
struct mtip_cmd_hdr {
/*
* Command options.
* - Bits 31:16 Number of PRD entries.
* - Bits 15:8 Unused in this implementation.
* - Bit 7 Prefetch bit, informs the drive to prefetch PRD entries.
* - Bit 6 Write bit, should be set when writing data to the device.
* - Bit 5 Unused in this implementation.
* - Bits 4:0 Length of the command FIS in DWords (DWord = 4 bytes).
*/
unsigned int opts;
/* This field is unsed when using NCQ. */
union {
unsigned int byte_count;
unsigned int status;
};
/*
* Lower 32 bits of the command table address associated with this
* header. The command table addresses must be 128 byte aligned.
*/
unsigned int ctba;
/*
* If 64 bit addressing is used this field is the upper 32 bits
* of the command table address associated with this command.
*/
unsigned int ctbau;
/* Reserved and unused. */
unsigned int res[4];
};
/* Command scatter gather structure (PRD). */
struct mtip_cmd_sg {
/*
* Low 32 bits of the data buffer address. For P320 this
* address must be 8 byte aligned signified by bits 2:0 being
* set to 0.
*/
unsigned int dba;
/*
* When 64 bit addressing is used this field is the upper
* 32 bits of the data buffer address.
*/
unsigned int dba_upper;
/* Unused. */
unsigned int reserved;
/*
* Bit 31: interrupt when this data block has been transferred.
* Bits 30..22: reserved
* Bits 21..0: byte count (minus 1). For P320 the byte count must be
* 8 byte aligned signified by bits 2:0 being set to 1.
*/
unsigned int info;
};
struct mtip_port;
/* Structure used to describe a command. */
struct mtip_cmd {
struct mtip_cmd_hdr *command_header; /* ptr to command header entry */
dma_addr_t command_header_dma; /* corresponding physical address */
void *command; /* ptr to command table entry */
dma_addr_t command_dma; /* corresponding physical address */
void *comp_data; /* data passed to completion function comp_func() */
/*
* Completion function called by the ISR upon completion of
* a command.
*/
void (*comp_func)(struct mtip_port *port,
int tag,
void *data,
int status);
/* Additional callback function that may be called by comp_func() */
void (*async_callback)(void *data, int status);
void *async_data; /* Addl. data passed to async_callback() */
int scatter_ents; /* Number of scatter list entries used */
int unaligned; /* command is unaligned on 4k boundary */
struct scatterlist sg[MTIP_MAX_SG]; /* Scatter list entries */
int retries; /* The number of retries left for this command. */
int direction; /* Data transfer direction */
unsigned long comp_time; /* command completion time, in jiffies */
atomic_t active; /* declares if this command sent to the drive. */
};
/* Structure used to describe a port. */
struct mtip_port {
/* Pointer back to the driver data for this port. */
struct driver_data *dd;
/*
* Used to determine if the data pointed to by the
* identify field is valid.
*/
unsigned long identify_valid;
/* Base address of the memory mapped IO for the port. */
void __iomem *mmio;
/* Array of pointers to the memory mapped s_active registers. */
void __iomem *s_active[MTIP_MAX_SLOT_GROUPS];
/* Array of pointers to the memory mapped completed registers. */
void __iomem *completed[MTIP_MAX_SLOT_GROUPS];
/* Array of pointers to the memory mapped Command Issue registers. */
void __iomem *cmd_issue[MTIP_MAX_SLOT_GROUPS];
/*
* Pointer to the beginning of the command header memory as used
* by the driver.
*/
void *command_list;
/*
* Pointer to the beginning of the command header memory as used
* by the DMA.
*/
dma_addr_t command_list_dma;
/*
* Pointer to the beginning of the RX FIS memory as used
* by the driver.
*/
void *rxfis;
/*
* Pointer to the beginning of the RX FIS memory as used
* by the DMA.
*/
dma_addr_t rxfis_dma;
/*
* Pointer to the beginning of the command table memory as used
* by the driver.
*/
void *command_table;
/*
* Pointer to the beginning of the command table memory as used
* by the DMA.
*/
dma_addr_t command_tbl_dma;
/*
* Pointer to the beginning of the identify data memory as used
* by the driver.
*/
u16 *identify;
/*
* Pointer to the beginning of the identify data memory as used
* by the DMA.
*/
dma_addr_t identify_dma;
/*
* Pointer to the beginning of a sector buffer that is used
* by the driver when issuing internal commands.
*/
u16 *sector_buffer;
/*
* Pointer to the beginning of a sector buffer that is used
* by the DMA when the driver issues internal commands.
*/
dma_addr_t sector_buffer_dma;
/*
* Bit significant, used to determine if a command slot has
* been allocated. i.e. the slot is in use. Bits are cleared
* when the command slot and all associated data structures
* are no longer needed.
*/
u16 *log_buf;
dma_addr_t log_buf_dma;
u8 *smart_buf;
dma_addr_t smart_buf_dma;
unsigned long allocated[SLOTBITS_IN_LONGS];
/*
* used to queue commands when an internal command is in progress
* or error handling is active
*/
unsigned long cmds_to_issue[SLOTBITS_IN_LONGS];
/*
* Array of command slots. Structure includes pointers to the
* command header and command table, and completion function and data
* pointers.
*/
struct mtip_cmd commands[MTIP_MAX_COMMAND_SLOTS];
/* Used by mtip_service_thread to wait for an event */
wait_queue_head_t svc_wait;
/*
* indicates the state of the port. Also, helps the service thread
* to determine its action on wake up.
*/
unsigned long flags;
/*
* Timer used to complete commands that have been active for too long.
*/
struct timer_list cmd_timer;
unsigned long ic_pause_timer;
/*
* Semaphore used to block threads if there are no
* command slots available.
*/
struct semaphore cmd_slot;
/* Semaphore to control queue depth of unaligned IOs */
struct semaphore cmd_slot_unal;
/* Spinlock for working around command-issue bug. */
spinlock_t cmd_issue_lock[MTIP_MAX_SLOT_GROUPS];
};
/*
* Driver private data structure.
*
* One structure is allocated per probed device.
*/
struct driver_data {
void __iomem *mmio; /* Base address of the HBA registers. */
int major; /* Major device number. */
int instance; /* Instance number. First device probed is 0, ... */
struct gendisk *disk; /* Pointer to our gendisk structure. */
struct pci_dev *pdev; /* Pointer to the PCI device structure. */
struct request_queue *queue; /* Our request queue. */
struct mtip_port *port; /* Pointer to the port data structure. */
unsigned product_type; /* magic value declaring the product type */
unsigned slot_groups; /* number of slot groups the product supports */
unsigned long index; /* Index to determine the disk name */
unsigned long dd_flag; /* NOTE: use atomic bit operations on this */
struct task_struct *mtip_svc_handler; /* task_struct of svc thd */
struct dentry *dfs_node;
bool trim_supp; /* flag indicating trim support */
int numa_node; /* NUMA support */
char workq_name[32];
struct workqueue_struct *isr_workq;
struct mtip_work work[MTIP_MAX_SLOT_GROUPS];
atomic_t irq_workers_active;
int isr_binding;
int unal_qdepth; /* qdepth of unaligned IO queue */
struct list_head online_list; /* linkage for online list */
struct list_head remove_list; /* linkage for removing list */
};
#endif
| [
"[email protected]"
] | |
c6f8bf57038cfe1a16a6f3ea44a0fc4bce5b1ffd | 82aa15b8d3e49844f08395e75a55344b73938dea | /device/raw/rawOpen.c | 81a48c9583866e9f5076c2b37a491990ce1008a1 | [] | no_license | mjschultz/xinu | 48150eb5366bf4259f66e8acb4b27ef6215bde57 | 84140a328292d4591ce6e3b282999611d2699862 | refs/heads/master | 2021-01-18T06:21:40.434453 | 2011-06-21T19:52:34 | 2011-06-21T19:52:34 | 1,931,034 | 2 | 3 | null | null | null | null | UTF-8 | C | false | false | 1,881 | c | /**
* @file rawOpen.c
* @provides rawOpen
*
* $Id: rawOpen.c 2077 2009-09-24 23:58:54Z mschul $
*/
/* Embedded Xinu, Copyright (C) 2009. All rights reserved. */
#include <stddef.h>
#include <device.h>
#include <network.h>
#include <raw.h>
#include <stdarg.h>
#include <interrupt.h>
/**
* Open a raw socket.
* @param devptr RAW device table entry
* @param ap 2nd argument is the local IP address
* 3rd argument is the remote IP address
* 4th argument is the IP protocol
* @return OK if raw socket is opened properly, otherwise SYSERR
*/
devcall rawOpen(device *devptr, va_list ap)
{
struct raw *rawptr = NULL;
ushort proto;
struct netaddr *localip;
struct netaddr *remoteip;
irqmask im;
/* Setup pointer to raw socket control block */
rawptr = &rawtab[devptr->minor];
/* Obtain arguments */
localip = (struct netaddr *)va_arg(ap, int);
remoteip = (struct netaddr *)va_arg(ap, int);
proto = va_arg(ap, int);
im = disable();
/* Check if raw socket is already open */
if (RAW_FREE != rawptr->state)
{
restore(im);
return SYSERR;
}
rawptr->state = RAW_ALLOC;
/* Link raw control block with device table entry */
rawptr->dev = devptr;
/* Initialize connection fields */
rawptr->proto = proto;
if (NULL == localip)
{
rawptr->localip.type = NULL;
}
else
{
netaddrcpy(&rawptr->localip, localip);
}
if (NULL == remoteip)
{
rawptr->remoteip.type = NULL;
}
else
{
netaddrcpy(&rawptr->remoteip, remoteip);
}
/* Initialize input */
rawptr->istart = 0;
rawptr->icount = 0;
rawptr->isema = semcreate(0);
if (SYSERR == (int)rawptr->isema)
{
restore(im);
return SYSERR;
}
rawptr->flags = NULL;
restore(im);
return OK;
}
| [
"[email protected]"
] | |
468352d8ab1466d806cea27ae3c946d0ec2c3418 | 62e5e66246617ec5f030ce9711b855979d8fcb19 | /Sistemas Operacionais II/ShellPARK/lexer.h | 4d43486c0dbd7795a3bd17b019e4251ddfb65cc5 | [] | no_license | JaconsMorais/repcomputaria | 67fbdd4ceab7868a2bfac8f6a8b1ff969b41ca90 | eb53f788e885f93e6e2665f2e588ca16475b30ef | refs/heads/master | 2021-01-10T16:31:16.433608 | 2011-07-12T01:00:05 | 2011-07-12T01:00:05 | 51,807,319 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 292 | h | #ifndef LEXER_H
#define LEXER_H
enum {
T_PIPE = '|',
T_OUTPUT = '>',
T_EOL = '\n',
T_ARGUMENT = 0xFF01
};
typedef int token_t;
#define MAX_ARG_SIZE 4096
extern char argument[MAX_ARG_SIZE];
extern token_t lookahead;
token_t get_token(void);
void match(token_t token);
#endif
| [
"[email protected]"
] | |
7be8f61ac315155d21b94fa891da260156f03b02 | 1d0a46d5f29fb12cf2ff95391360f2fd0c58692e | /Words-cocos2dx/Words/Words/proj.win32/thirdparty/sqlite/sqlite3cc.h | 57d685cc149375df6d277195b22c08349adc3f77 | [] | no_license | Stals/words-cocos2dx | 2268af9e5746c8416306d2fc09b7d80a09d8113e | 499a1c619c431cb5dfdf0e368bc15db309258b6c | refs/heads/master | 2020-04-05T23:45:58.908111 | 2013-02-23T12:18:29 | 2013-02-23T12:18:29 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,308 | h | /*
* sqlite3cc.h
*
* Copyright (C) 2009 Tim Marston <[email protected]>
*
* This file is part of sqlite3cc (hereafter referred to as "this program").
* See http://ed.am/dev/sqlite3cc for more information.
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option) any
* later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SQLITE3CC_SQLITE3CC_H_
#define SQLITE3CC_SQLITE3CC_H_
// include common parts of sqlite3cc
#include "sqlite3cc/connection.h"
#include "sqlite3cc/exception.h"
#include "sqlite3cc/basic_statement.h"
#include "sqlite3cc/command.h"
#include "sqlite3cc/query.h"
#include "sqlite3cc/row.h"
#include "sqlite3cc/transaction.h"
#include "sqlite3cc/manipulator.h"
#include "sqlite3cc/util.h"
#endif /* SQLITE3CC_SQLITE3CC_H_ */
| [
"[email protected]"
] | |
6e89c330fa93c766b26a7c0a5220672919a3858d | 21697607ff13ed932b4a08097a55a52e975c506d | /0x06-pointers_arrays_strings/102-infinite_add.c | f13578efdc0e1ad24e36564e605606ebe7000599 | [] | no_license | OctopusHugz/holbertonschool-low_level_programming | 19233ff1f35b593329cbc59108b93f66451ad488 | a19a8c59c3d14b5be1efe72abd0e850a1ec43543 | refs/heads/master | 2020-12-29T06:20:32.315179 | 2020-08-28T18:31:14 | 2020-08-28T18:31:14 | 238,488,502 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 347 | c | #include "holberton.h"
/**
* infinite_add - adds two numbers
* @n1: first number to add
* @n2: second number to add
* @r: buffer of result
* @size_r: buffer size
*
* Return: pointer to result of addition
*/
char *infinite_add(char *n1, char *n2, char *r, int size_r)
{
if (*n1 && *n2 && size_r != 0)
return (r);
else
return (r);
}
| [
"[email protected]"
] | |
8861957319392e702edaa7f53e8bf59b8d9180fa | aeb2d28aa2a9ce281e0ec50c64fb7cf24a8b18e6 | /ibus/cli/dcli_iu.c | 7c33fd31486e1566fe717e603f5000af5155c0c4 | [] | no_license | kkcloudy/dameongroup_v0.1 | 2767df096e3f5ac27437c9a2589e55c51aafd91e | 92e93607c3ad3e3e9818c86131b9a5d727c61b6a | refs/heads/master | 2021-05-30T05:53:44.202801 | 2015-10-27T02:07:25 | 2015-10-27T02:07:25 | 48,022,080 | 0 | 1 | null | null | null | null | UTF-8 | C | false | false | 31,184 | c | #include <string.h>
#include <dbus/dbus.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <fcntl.h>
#include <unistd.h>
#include <zebra.h>
#include "command.h"
#include <dirent.h>
#include "../../dcli/src/lib/dcli_main.h"
#include "iu/dcli_mapi_iu.h"
#include "mapi_iu.h"
#include "dcli_iu.h"
#include "dbus/iu/IuDBusPath.h"
#include "../../accapi/dbus/hmd/HmdDbusDef.h"
#define MAX_STR_LEN (1024*1024)
#define POINT_CODE_LEN (16)
typedef enum{
IU_24BIT_POINT_CODE,
IU_14BIT_POINT_CODE,
IU_INTEGER_POINT_CODE
}PC_FORMAT;
struct cmd_node iu_node =
{
IU_NODE,
"%s(config-iu)# ",
1
};
struct cmd_node hansi_iu_node =
{
HANSI_IU_NODE,
"%s(hansi-iu %d-%d)# ",
};
struct cmd_node local_hansi_iu_node =
{
LOCAL_HANSI_IU_NODE,
"%s(local_hansi-iu %d-%d)# ",
};
/**********************************************************************************
* iu_ip2ulong
*
* DESCRIPTION:
* convert IP (A.B.C.D) to IP (ABCD) pattern
*
* INPUT:
* str - (A.B.C.D)
*
* OUTPUT:
* null
*
* RETURN:
*
* IP - ip (ABCD)
*
**********************************************************************************/
static unsigned long iu_ip2ulong(char *str)
{
char *sep=".";
char *token = NULL;
unsigned long ip_long[4];
unsigned long ip = 0;
int i = 1;
token=strtok(str,sep);
if(NULL != token){
ip_long[0] = strtoul(token,NULL,10);
}
while((token!=NULL)&&(i<4))
{
token=strtok(NULL,sep);
if(NULL != token){
ip_long[i] = strtoul(token,NULL,10);
}
i++;
}
ip=(ip_long[0]<<24)+(ip_long[1]<<16)+(ip_long[2]<<8)+ip_long[3];
return ip;
}
/*****************************************************
** DISCRIPTION:
** transform string format point code to integer
** INPUT:
** string format point code
** OUTPUT:
** integer format point code
** RETURN:
** void
** DATE:
** 2011-09-13
** AUTHOR:
** <[email protected]>
*****************************************************/
void iu_parse_point_code(char *point_code, int *ptc, int type)
{
char *ptc_str1 = NULL;
char *ptc_str2 = NULL;
char *ptc_str3 = NULL;
int ptc_int1 = 0;
int ptc_int2 = 0;
int ptc_int3 = 0;
if(point_code == NULL)
return;
ptc_str1 = strtok(point_code, "-");
if(ptc_str1 == NULL)
return;
else
ptc_int1 = atoi(ptc_str1);
ptc_str2 = strtok(NULL,"-");
if(ptc_str2 == NULL)
return;
else
ptc_int2 = atoi(ptc_str2);
ptc_str3 = strtok(NULL,"-");
if(ptc_str3 == NULL)
return;
else
ptc_int3 = atoi(ptc_str3);
if(type == IU_24BIT_POINT_CODE){
*ptc = ptc_int1 * 256 * 256 + ptc_int2 * 256 + ptc_int3;
}
else if(type == IU_14BIT_POINT_CODE){
*ptc = ptc_int1 * 256 * 8 + ptc_int2 * 8 + ptc_int3;
}
return;
}
DEFUN(config_iu_mode_cmd_func,
config_iu_mode_cmd,
"config iu",
CONFIG_STR
"iu config node\n"
)
{
int ret = 0;
int islocal = 1;
int slot_id = HostSlotId;
int insid = 0;
if(vty->node == CONFIG_NODE){
insid = 0;
}else if(vty->node == HANSI_NODE){
insid = vty->index;
islocal = vty->local;
slot_id = vty->slotindex;
}else if(vty->node == LOCAL_HANSI_NODE){
insid = vty->index;
islocal = vty->local;
slot_id = vty->slotindex;
}
DBusConnection *dbus_connection = NULL;
ReInitFemtoDbusConnection(&dbus_connection, slot_id, distributFag);
ret = mapi_femto_service_state_check(insid, islocal, slot_id, 1, dbus_connection, HMD_DBUS_CONF_METHOD_FEMTO_SERVICE_CHECK);
if(ret == HMD_DBUS_SUCCESS)
{
if(vty->node == CONFIG_NODE)
{
vty->node = IU_NODE;
}
else if(vty->node == HANSI_NODE)
{
vty->node = HANSI_IU_NODE;
}
else if(vty->node == LOCAL_HANSI_NODE)
{
vty->node = LOCAL_HANSI_IU_NODE;
}
}
else
vty_out(vty, "<error> you should enable iu first!!\n");
return CMD_SUCCESS;
}
/*****************************************************
** DISCRIPTION:
** set point-code by str
** INPUT:
**
** OUTPUT:
**
** RETURN:
** void
** DATE:
** 2011-12-28
** AUTHOR:
** <[email protected]>
*****************************************************/
DEFUN(set_iu_point_code_str_func,
set_iu_point_code_str_cmd,
"set (local|remote) (msc|sgsn) point-code POINTCODE format (8-8-8|3-8-3)",
"set point code string format\n"
"local is HNB-GW, remote is CN\n"
"msc is IU-CS, sgsn is IU-PS\n"
"set point code X-X-X\n"
"set point code X-X-X\n"
)
{
int ret = 0;
unsigned char is_ps = 0;
unsigned char is_local = 0;
char point_code[POINT_CODE_LEN] = {0};
unsigned int self_pd = 0;
int type = 0;
if(!strcmp((char*)argv[2],"0-0-0"))
{
vty_out(vty, "illegal parameter 0-0-0!\n");
}
if(strcmp((char*)argv[0],"local")==0)
{
is_local = 1;
}
else if(strcmp((char*)argv[0],"remote")==0)
{
is_local = 0;
}
else
{
vty_out(vty, "error input of 1st parameter\n");
return CMD_IU_SUCCESS;
}
if(strcmp((char*)argv[1],"msc")==0)
{
is_ps = 0;
}
else if(strcmp((char*)argv[1],"sgsn")==0)
{
is_ps = 1;
}
else
{
vty_out(vty, "error input of 2nd parameter\n");
return CMD_IU_SUCCESS;
}
if(strcmp(argv[3], "8-8-8") == 0)
type = IU_24BIT_POINT_CODE;
else if(strcmp(argv[3], "3-8-3") == 0)
type = IU_14BIT_POINT_CODE;
memcpy(point_code, argv[2], strnlen(argv[2],POINT_CODE_LEN));
iu_parse_point_code(point_code, &self_pd, type);
int localid = 1;
int slot_id = HostSlotId;
int index = 0;
if(vty->node == IU_NODE){
index = 0;
}else if(vty->node == HANSI_IU_NODE){
index = vty->index;
localid = vty->local;
slot_id = vty->slotindex;
}else if(vty->node == LOCAL_HANSI_IU_NODE){
index = vty->index;
localid = vty->local;
slot_id = vty->slotindex;
}
DBusConnection *dbus_connection = NULL;
ReInitFemtoDbusConnection(&dbus_connection, slot_id, distributFag);
ret = iu_set_point_code(index, localid, self_pd, is_local, is_ps, dbus_connection, IU_SET_POINT_CODE);
if(ret)
{
vty_out(vty,"set local ip address fail\n");
}
return CMD_IU_SUCCESS;
}
/*****************************************************
** DISCRIPTION:
** set point-code integer
** INPUT:
**
** OUTPUT:
**
** RETURN:
** void
** DATE:
** 2011-12-28
** AUTHOR:
** <[email protected]>
*****************************************************/
DEFUN(set_iu_point_code_int_func,
set_iu_point_code_int_cmd,
"set (local|remote) (msc|sgsn) point-code <1-4294967295> format integer",
"set point code\n"
"local is HNB-GW, remote is CN\n"
"msc is IU-CS, sgsn is IU-PS\n"
"point value 1-4294967295"
"point value 1-4294967295"
)
{
int ret = 0;
unsigned char is_ps = 0;
unsigned char is_local = 0;
unsigned int self_pd = 0;
if(strcmp((char*)argv[0],"local")==0)
{
is_local = 1;
}
else if(strcmp((char*)argv[0],"remote")==0)
{
is_local = 0;
}
else
{
vty_out(vty, "error input of 1st parameter\n");
return CMD_IU_SUCCESS;
}
if(strcmp((char*)argv[1],"msc")==0)
{
is_ps = 0;
}
else if(strcmp((char*)argv[1],"sgsn")==0)
{
is_ps = 1;
}
else
{
vty_out(vty, "error input of 2nd parameter\n");
return CMD_IU_SUCCESS;
}
self_pd = atoi(argv[2]);
int localid = 1;
int slot_id = HostSlotId;
int index = 0;
if(vty->node == IU_NODE){
index = 0;
}else if(vty->node == HANSI_IU_NODE){
index = vty->index;
localid = vty->local;
slot_id = vty->slotindex;
}else if(vty->node == LOCAL_HANSI_IU_NODE){
index = vty->index;
localid = vty->local;
slot_id = vty->slotindex;
}
DBusConnection *dbus_connection = NULL;
ReInitFemtoDbusConnection(&dbus_connection, slot_id, distributFag);
ret = iu_set_point_code(index, localid, self_pd, is_local, is_ps, dbus_connection, IU_SET_POINT_CODE);
if(ret)
{
vty_out(vty,"set point code fail\n");
}
return CMD_IU_SUCCESS;
}
/*****************************************************
** DISCRIPTION:
** set connection-mode
** INPUT:
**
** OUTPUT:
**
** RETURN:
** void
** DATE:
** 2011-12-28
** AUTHOR:
** <[email protected]>
*****************************************************/
DEFUN(set_iu_connection_mode_func,
set_iu_connection_mode_cmd,
"set local (msc|sgsn) connection-mode (client|server)",
"set connection-mode of sctp\n"
"msc is IU-CS, sgsn is IU-PS\n"
"connection-mode client or server"
"client or server"
)
{
int ret = 0;
unsigned char is_ps = 0;
unsigned char conn_mode = 0;
if(strcmp((char*)argv[0],"msc")==0)
{
is_ps = 0;
}
else if(strcmp((char*)argv[0],"sgsn")==0)
{
is_ps = 1;
}
else
{
vty_out(vty, "error input of 1st parameter\n");
return CMD_IU_SUCCESS;
}
if(strcmp((char*)argv[1],"client")==0)
{
conn_mode = 0;
}
else if(strcmp((char*)argv[1],"server")==0)
{
conn_mode = 1;
}
else
{
vty_out(vty, "error input of 2nd parameter\n");
return CMD_IU_SUCCESS;
}
int localid = 1;
int slot_id = HostSlotId;
int index = 0;
if(vty->node == IU_NODE){
index = 0;
}else if(vty->node == HANSI_IU_NODE){
index = vty->index;
localid = vty->local;
slot_id = vty->slotindex;
}else if(vty->node == LOCAL_HANSI_IU_NODE){
index = vty->index;
localid = vty->local;
slot_id = vty->slotindex;
}
DBusConnection *dbus_connection = NULL;
ReInitFemtoDbusConnection(&dbus_connection, slot_id, distributFag);
ret = iu_set_connection_mode(index, localid, conn_mode, is_ps, dbus_connection, IU_SET_CONNECTION_MODE);
if(ret)
{
vty_out(vty,"set sctp connection mode failed\n");
}
return CMD_IU_SUCCESS;
}
/*****************************************************
** DISCRIPTION:
** set multi-homing switch
** INPUT:
**
** OUTPUT:
**
** RETURN:
** void
** DATE:
** 2011-12-28
** AUTHOR:
** <[email protected]>
*****************************************************/
DEFUN(set_iu_multi_switch_func,
set_iu_multi_switch_cmd,
"set (local|remote) (msc|sgsn) multi-homing switch (open|closed)",
"set multi-homing switch\n"
"local is HNB-GW, remote is CN\n"
"msc is IU-CS, sgsn is IU-PS\n"
"set sctp multi-homing mode switch"
"set sctp multi-homing mode switch"
"open or closed"
)
{
int ret = 0;
unsigned char is_ps = 0;
unsigned char is_local = 0;
unsigned char multi_switch = 0;
if(strcmp((char*)argv[0],"local")==0)
{
is_local = 1;
}
else if(strcmp((char*)argv[0],"remote")==0)
{
is_local = 0;
}
else
{
vty_out(vty, "error input of 1st parameter\n");
return CMD_IU_SUCCESS;
}
if(strcmp((char*)argv[1],"msc")==0)
{
is_ps = 0;
}
else if(strcmp((char*)argv[1],"sgsn")==0)
{
is_ps = 1;
}
else
{
vty_out(vty, "error input of 2nd parameter\n");
return CMD_IU_SUCCESS;
}
if(strcmp((char*)argv[2],"closed")==0)
{
multi_switch = 0;
}
else if(strcmp((char*)argv[2],"open")==0)
{
multi_switch = 1;
}
else
{
vty_out(vty, "error input of 2nd parameter\n");
return CMD_IU_SUCCESS;
}
int localid = 1;
int slot_id = HostSlotId;
int index = 0;
if(vty->node == IU_NODE){
index = 0;
}else if(vty->node == HANSI_IU_NODE){
index = vty->index;
localid = vty->local;
slot_id = vty->slotindex;
}else if(vty->node == LOCAL_HANSI_IU_NODE){
index = vty->index;
localid = vty->local;
slot_id = vty->slotindex;
}
DBusConnection *dbus_connection = NULL;
ReInitFemtoDbusConnection(&dbus_connection, slot_id, distributFag);
ret = iu_set_multi_switch(index, localid, multi_switch, is_local, is_ps, dbus_connection, IU_SET_MULTI_SWITCH);
if(ret)
{
vty_out(vty,"set multi-homing switch failed\n");
}
return CMD_IU_SUCCESS;
}
/*****************************************************
** DISCRIPTION:
** set address
** INPUT:
**
** OUTPUT:
**
** RETURN:
** void
** DATE:
** 2011-12-28
** AUTHOR:
** <[email protected]>
*****************************************************/
DEFUN(set_iu_address_func,
set_iu_address_cmd,
"set (local|remote) (msc|sgsn) (primary|secondary) address A.B.C.D port <1-65535>",
"set address\n"
"set address\n"
"set address\n"
)
{
int ret = 0;
unsigned my_ip = 0;
unsigned short my_port = 0;
unsigned char is_primary = 0;
unsigned char is_ps = 0;
unsigned char is_local;
if(strcmp((char*)argv[0],"local")==0)
{
is_local = 1;
}
else if(strcmp((char*)argv[0],"remote")==0)
{
is_local = 0;
}
else
{
vty_out(vty, "error input of 1st parameter\n");
return CMD_IU_SUCCESS;
}
if(strcmp((char*)argv[1],"msc")==0)
{
is_ps = 0;
}
else if(strcmp((char*)argv[1],"sgsn")==0)
{
is_ps = 1;
}
else
{
vty_out(vty, "error input of 2nd parameter\n");
return CMD_IU_SUCCESS;
}
if(strcmp((char*)argv[2],"primary")==0)
{
is_primary = 1;
}
else if(strcmp((char*)argv[2],"secondary")==0)
{
is_primary = 0;
}
else
{
vty_out(vty, "error input of 3rd parameter\n");
return CMD_IU_SUCCESS;
}
ret = inet_pton (AF_INET, (char*)argv[3], &my_ip);
if (ret != 1) {
vty_out (vty, "malformed ip address : %s\n", argv[3]);
return CMD_IU_SUCCESS;
}
my_port = atoi(argv[4]);
int localid = 1;
int slot_id = HostSlotId;
int index = 0;
if(vty->node == IU_NODE){
index = 0;
}else if(vty->node == HANSI_IU_NODE){
index = vty->index;
localid = vty->local;
slot_id = vty->slotindex;
}else if(vty->node == LOCAL_HANSI_IU_NODE){
index = vty->index;
localid = vty->local;
slot_id = vty->slotindex;
}
DBusConnection *dbus_connection = NULL;
ReInitFemtoDbusConnection(&dbus_connection, slot_id, distributFag);
ret = iu_set_address(index, localid, my_ip, my_port, is_local, is_primary, is_ps, dbus_connection, IU_SET_ADDRESS);
if(ret)
{
vty_out(vty,"set local ip address fail\n");
}
return CMD_IU_SUCCESS;
}
/*****************************************************
** DISCRIPTION:
** set traffic mode
** INPUT:
**
** OUTPUT:
**
** RETURN:
** void
** DATE:
** 2011-11-08
** AUTHOR:
** <[email protected]>
*****************************************************/
DEFUN(set_iu_traffic_mode_func,
set_iu_traffic_mode_cmd,
"set (msc|sgsn) traffic mode (over-ride|load-share|broadcast)",
"set traffic mode\n"
"set traffic mode\n"
"set traffic mode\n"
)
{
int ret = 0;
unsigned int trfmode = 0;
int isps = 0;
if(strcmp((char*)argv[0],"msc")==0)
{
isps = 0;
}
else if(strcmp((char*)argv[0],"sgsn")==0)
{
isps = 1;
}
else
{
vty_out(vty, "error input of 1st parameter\n");
return CMD_IU_FAILURE;
}
if(strcmp((char*)argv[1],"over-ride")==0)
{
trfmode = 1;
}
else if(strcmp((char*)argv[1],"load-share")==0)
{
trfmode = 2;
}
else if(strcmp((char*)argv[1],"broadcast")==0)
{
trfmode = 3;
}
int localid = 1;
int slot_id = HostSlotId;
int index = 0;
if(vty->node == IU_NODE){
index = 0;
}else if(vty->node == HANSI_IU_NODE){
index = vty->index;
localid = vty->local;
slot_id = vty->slotindex;
}else if(vty->node == LOCAL_HANSI_IU_NODE){
index = vty->index;
localid = vty->local;
slot_id = vty->slotindex;
}
DBusConnection *dbus_connection = NULL;
ReInitFemtoDbusConnection(&dbus_connection, slot_id, distributFag);
ret = iu_set_traffic_mode(index, localid, trfmode, isps, dbus_connection, IU_SET_TRAFFIC_MODE);
if(ret) {
vty_out(vty,"set traffic mode fail\n");
return CMD_IU_FAILURE;
}
else {
}
return CMD_IU_SUCCESS;
}
/*****************************************************
** DISCRIPTION:
** set ni
** INPUT:
**
** OUTPUT:
**
** RETURN:
** void
** DATE:
** 2011-12-02
** AUTHOR:
** <[email protected]>
*****************************************************/
DEFUN(set_iu_ni_func,
set_iu_ni_cmd,
"set network indicator <1-255>",
"set net indicator\n"
"set net indicator\n"
"1-255\n"
)
{
int ret = 0;
int ni = 0;
ni = atoi(argv[0]);
int localid = 1;
int slot_id = HostSlotId;
int index = 0;
if(vty->node == IU_NODE){
index = 0;
}else if(vty->node == HANSI_IU_NODE){
index = vty->index;
localid = vty->local;
slot_id = vty->slotindex;
}else if(vty->node == LOCAL_HANSI_IU_NODE){
index = vty->index;
localid = vty->local;
slot_id = vty->slotindex;
}
DBusConnection *dbus_connection = NULL;
ReInitFemtoDbusConnection(&dbus_connection, slot_id, distributFag);
ret = iu_set_network_indicator(index, localid, ni, dbus_connection, IU_SET_NETWORK_INDICATOR);
if(ret) {
vty_out(vty,"set network indicator failed\n");
return CMD_IU_FAILURE;
}
else {
}
return CMD_IU_SUCCESS;
}
/*****************************************************
** DISCRIPTION:
** set network apperance
** INPUT:
**
** OUTPUT:
**
** RETURN:
** void
** DATE:
** 2011-12-27
** AUTHOR:
** <[email protected]>
*****************************************************/
DEFUN(set_iu_nwapp_func,
set_iu_nwapp_cmd,
"set (msc|sgsn) network apperance <0-65535>",
"set network apperance\n"
"set network apperance\n"
"0-65535\n"
)
{
int ret = 0;
int nwapp = 0;
unsigned char isps = 0;
if(strcmp((char*)argv[0],"msc")==0)
{
isps = 0;
}
else if(strcmp((char*)argv[0],"sgsn")==0)
{
isps = 1;
}
else
{
vty_out(vty, "error input of 1st parameter\n");
return CMD_IU_FAILURE;
}
nwapp = atoi(argv[1]);
int localid = 1;
int slot_id = HostSlotId;
int index = 0;
if(vty->node == IU_NODE){
index = 0;
}else if(vty->node == HANSI_IU_NODE){
index = vty->index;
localid = vty->local;
slot_id = vty->slotindex;
}else if(vty->node == LOCAL_HANSI_IU_NODE){
index = vty->index;
localid = vty->local;
slot_id = vty->slotindex;
}
DBusConnection *dbus_connection = NULL;
ReInitFemtoDbusConnection(&dbus_connection, slot_id, distributFag);
ret = iu_set_network_apperance(index, localid, nwapp, isps, dbus_connection, IU_SET_NETWORK_APPERANCE);
if(ret) {
vty_out(vty,"set network apperance failed\n");
return CMD_IU_FAILURE;
}
else {
}
return CMD_IU_SUCCESS;
}
/*****************************************************
** DISCRIPTION:
** set routing context
** INPUT:
**
** OUTPUT:
**
** RETURN:
** void
** DATE:
** 2011-11-08
** AUTHOR:
** <[email protected]>
*****************************************************/
DEFUN(set_iu_routing_context_func,
set_iu_routing_context_cmd,
"set (msc|sgsn) routing context <0-65535>",
"set routing context\n"
"set routing context\n"
"set routing context\n"
)
{
int ret = 0;
unsigned int rtctx = 0;
unsigned char isps = 0;
if(strcmp((char*)argv[0],"msc")==0)
{
isps = 0;
}
else if(strcmp((char*)argv[0],"sgsn")==0)
{
isps = 1;
}
else
{
vty_out(vty, "error input of 1st parameter\n");
return CMD_IU_FAILURE;
}
rtctx = atoi(argv[1]);
int localid = 1;
int slot_id = HostSlotId;
int index = 0;
if(vty->node == IU_NODE){
index = 0;
}else if(vty->node == HANSI_IU_NODE){
index = vty->index;
localid = vty->local;
slot_id = vty->slotindex;
}else if(vty->node == LOCAL_HANSI_IU_NODE){
index = vty->index;
localid = vty->local;
slot_id = vty->slotindex;
}
DBusConnection *dbus_connection = NULL;
ReInitFemtoDbusConnection(&dbus_connection, slot_id, distributFag);
ret = iu_set_routing_context(index, localid, rtctx, isps, dbus_connection, IU_SET_ROUTING_CONTEXT);
if(ret) {
vty_out(vty,"set routing context fail\n");
return CMD_IU_FAILURE;
}
else {
}
return CMD_IU_SUCCESS;
}
DEFUN(iu_debug_enable_cmd_func,
iu_debug_enable_cmd,
"debug iu (all|info|error|debug)",
"Add debug iu Information\n"
"Dhcp server\n"
"Open iu debug level all\n"
"Open iu debug level info\n"
"Open iu debug level error\n"
"Open iu debug level debug\n"
)
{
unsigned int ret = 0, debug_type = 0, debug_enable = 1;
unsigned int maxParaLen = 5;
if(strncmp("all",argv[0],strnlen(argv[0],maxParaLen))==0) {
debug_type = DEBUG_TYPE_ALL;
}
else if (strncmp("info",argv[0],strnlen(argv[0],maxParaLen))==0) {
debug_type = DEBUG_TYPE_INFO;
}
else if (strncmp("error",argv[0],strnlen(argv[0],maxParaLen))==0) {
debug_type = DEBUG_TYPE_ERROR;
}
else if (strncmp("debug",argv[0],strnlen(argv[0],maxParaLen))==0) {
debug_type = DEBUG_TYPE_DEBUG;
}
else {
vty_out(vty,"bad command parameter %s\n", argv[0]);
return CMD_IU_FAILURE;
}
int localid = 1;
int slot_id = HostSlotId;
int index = 0;
if(vty->node == IU_NODE){
index = 0;
}else if(vty->node == HANSI_IU_NODE){
index = vty->index;
localid = vty->local;
slot_id = vty->slotindex;
}else if(vty->node == LOCAL_HANSI_IU_NODE){
index = vty->index;
localid = vty->local;
slot_id = vty->slotindex;
}
DBusConnection *dbus_connection = NULL;
ReInitFemtoDbusConnection(&dbus_connection, slot_id, distributFag);
ret = iu_set_debug_state(index, localid, debug_type, debug_enable, dbus_connection, IU_DBUS_METHOD_SET_DEBUG_STATE);
if (!ret) {
return CMD_IU_SUCCESS;
}
else {
return CMD_IU_FAILURE;
}
}
DEFUN(iu_debug_disable_cmd_func,
iu_debug_disable_cmd,
"no debug iu (all|info|error|debug)",
"Delete old Configuration\n"
"Config iu debugging close\n"
"Dhcp server\n"
"Close iu debug level all\n"
"Close iu debug level info\n"
"Close iu debug level error\n"
"Close iu debug level debug\n"
)
{
unsigned int ret = 0, debug_type = 0, isEnable = 0;
unsigned int maxParaLen = 5;
if(strncmp("all",argv[0],strnlen(argv[0],maxParaLen))==0) {
debug_type = DEBUG_TYPE_ALL;
}
else if (strncmp("info",argv[0],strnlen(argv[0],maxParaLen))==0) {
debug_type = DEBUG_TYPE_INFO;
}
else if (strncmp("error",argv[0],strnlen(argv[0],maxParaLen))==0) {
debug_type = DEBUG_TYPE_ERROR;
}
else if (strncmp("debug",argv[0],strnlen(argv[0],maxParaLen))==0) {
debug_type = DEBUG_TYPE_DEBUG;
}
else {
vty_out(vty,"bad command parameter %s\n", argv[0]);
return CMD_IU_FAILURE;
}
int localid = 1;
int slot_id = HostSlotId;
int index = 0;
if(vty->node == IU_NODE){
index = 0;
}else if(vty->node == HANSI_IU_NODE){
index = vty->index;
localid = vty->local;
slot_id = vty->slotindex;
}else if(vty->node == LOCAL_HANSI_IU_NODE){
index = vty->index;
localid = vty->local;
slot_id = vty->slotindex;
}
DBusConnection *dbus_connection = NULL;
ReInitFemtoDbusConnection(&dbus_connection, slot_id, distributFag);
ret = iu_set_debug_state(index, localid, debug_type, isEnable, dbus_connection, IU_DBUS_METHOD_SET_DEBUG_STATE);
if (!ret) {
return CMD_IU_SUCCESS;
}
else {
return CMD_IU_FAILURE;
}
}
DEFUN(iu_enable_cmd_func,
iu_enable_cmd,
"(msc|sgsn) service (enable|disable)",
CONFIG_STR
"Ip dhcp server (enable|disable) entity\n"
"Specify pool name begins with char, and name length no more than 20 characters\n"
)
{
unsigned int ret = 0, op_ret = 0, isEnable = 0;
unsigned char isps = 0;
if(strncmp((char*)argv[0],"msc",strnlen(argv[0],4))==0)
{
isps = 0;
}
else if(strncmp((char*)argv[0],"sgsn",strnlen(argv[0],4))==0)
{
isps = 1;
}
else
{
vty_out(vty, "error input of 1st parameter\n");
return CMD_IU_FAILURE;
}
if(strncmp("enable",argv[1],strnlen(argv[1],7))==0) {
isEnable = 1;
}
else if (strncmp("disable",argv[1],strnlen(argv[1],7))==0) {
isEnable = 0;
}
else {
vty_out(vty,"bad command parameter!\n");
return CMD_IU_FAILURE;
}
int localid = 1;
int slot_id = HostSlotId;
int index = 0;
if(vty->node == IU_NODE){
index = 0;
}else if(vty->node == HANSI_IU_NODE){
index = vty->index;
localid = vty->local;
slot_id = vty->slotindex;
}else if(vty->node == LOCAL_HANSI_IU_NODE){
index = vty->index;
localid = vty->local;
slot_id = vty->slotindex;
}
DBusConnection *dbus_connection = NULL;
ReInitFemtoDbusConnection(&dbus_connection, slot_id, distributFag);
ret = set_iu_enable(index, localid, isEnable, isps, dbus_connection, IU_DBUS_METHOD_SET_IU_ENABLE);
if (ret == 0) {
vty_out(vty,"set %s enable successful!\n",(char*)argv[0]);
}
else if(ret == -1) {
vty_out(vty,"failed to get reply.\n");
}
else if(ret == 1) {
vty_out(vty,"failed, parameters of %s are not correctly set yet!\n",(char*)argv[0]);
}
else if(ret == 2) {
vty_out(vty,"failed, connection over time!\n");
}
return CMD_IU_SUCCESS;
}
DEFUN(iu2sig_enable_cmd_func,
iu2sig_enable_cmd,
"iu to sigtran (enable|disable)",
CONFIG_STR
"iu to sigtran (enable|disable) entity\n"
"create m3ua connection to sigtran\n"
)
{
unsigned int ret = 0, op_ret = 0, isEnable = 0;
if(strncmp("enable",argv[0],strnlen(argv[0],7))==0) {
isEnable = 1;
}
else if (strncmp("disable",argv[0],strnlen(argv[0],7))==0) {
isEnable = 0;
}
else {
vty_out(vty,"bad command parameter!\n");
return CMD_IU_FAILURE;
}
int localid = 1;
int slot_id = HostSlotId;
int index = 0;
if(vty->node == IU_NODE){
index = 0;
}else if(vty->node == HANSI_IU_NODE){
index = vty->index;
localid = vty->local;
slot_id = vty->slotindex;
}else if(vty->node == LOCAL_HANSI_IU_NODE){
index = vty->index;
localid = vty->local;
slot_id = vty->slotindex;
}
DBusConnection *dbus_connection = NULL;
ReInitFemtoDbusConnection(&dbus_connection, slot_id, distributFag);
ret = set_iu2sig_enable(index, localid, isEnable, dbus_connection, IU_DBUS_METHOD_SET_IU_TO_SIGTRAN_ENABLE);
if (!ret) {
return CMD_IU_SUCCESS;
}
else {
return CMD_IU_FAILURE;
}
}
/* book add, 2012-1-4 */
DEFUN(iu_get_link_status_func,
iu_get_link_status_cmd,
"show (msc|sgsn) link status",
CONFIG_STR
"show iu interface link status\n"
"show iu interface link status\n"
"show iu interface link status\n"
)
{
unsigned char isps = 0;
unsigned char m3_asp_state = 0;
unsigned char m3_conn_state = 0;
int sctp_state = 0;
int ret = 0;
if(strncmp("msc",argv[0],strnlen(argv[0],3))==0) {
isps = 0;
}
else if (strncmp("sgsn",argv[0],strnlen(argv[0],4))==0) {
isps = 1;
}
else {
vty_out(vty,"bad command parameter!\n");
return CMD_IU_FAILURE;
}
int localid = 1;
int slot_id = HostSlotId;
int index = 0;
if(vty->node == IU_NODE){
index = 0;
}else if(vty->node == HANSI_IU_NODE){
index = vty->index;
localid = vty->local;
slot_id = vty->slotindex;
}else if(vty->node == LOCAL_HANSI_IU_NODE){
index = vty->index;
localid = vty->local;
slot_id = vty->slotindex;
}
DBusConnection *dbus_connection = NULL;
ReInitFemtoDbusConnection(&dbus_connection, slot_id, distributFag);
ret = get_iu_link_status(index, localid, isps, &m3_asp_state, &m3_conn_state, &sctp_state, dbus_connection, IU_GET_LINK_STATUS);
if (!ret) {
vty_out(vty, "IU-%s Interface Status:\n",isps?"PS":"CS");
vty_out(vty, "-----------------------------\n");
if(m3_asp_state < MAX_M3_ASP_STATE)
{
vty_out(vty, "M3UA ASP STATE : %s\n", M3_ASP_STATE[m3_asp_state]);
}
else
{
vty_out(vty, "M3UA ASP STATE : %s\n", M3_ASP_STATE[0]);
}
if(m3_conn_state < MAX_M3_CONN_STATE)
{
vty_out(vty, "M3UA CONNECTION STATE: %s\n", M3_CONN_STATE[m3_conn_state]);
}
else
{
vty_out(vty, "M3UA CONNECTION STATE: %s\n", M3_CONN_STATE[0]);
}
if(sctp_state < MAX_SCTP_CONN_STATE)
{
vty_out(vty, "SCTP CONNECTION STATE: %s\n", SCTP_CONN_STATE[sctp_state]);
}
else
{
vty_out(vty, "SCTP CONNECTION STATE: %s\n", SCTP_CONN_STATE[0]);
}
return CMD_IU_SUCCESS;
}
else {
vty_out(vty, "Error: get iu link status failed.\n");
return CMD_IU_FAILURE;
}
}
#if 0
/*xdw add for show running*/
int iu_show_running_cfg_lib(int index)
{
char *tmp_str = NULL;
DBusMessage *query = NULL, *reply = NULL;
DBusError err;
int ret = 1;
int localid = 1;
index = 0;
char BUSNAME[PATH_LEN];
char OBJPATH[PATH_LEN];
char INTERFACE[PATH_LEN];
ReInitFemtoDbusPath(localid,index,IU_DBUS_BUSNAME,BUSNAME);
ReInitFemtoDbusPath(localid,index,IU_DBUS_OBJPATH,OBJPATH);
ReInitFemtoDbusPath(localid,index,IU_DBUS_INTERFACE,INTERFACE);
//query = dbus_message_new_method_call(BUSNAME,OBJPATH,INTERFACE,DBUS_METHOD);
query = dbus_message_new_method_call(BUSNAME,
OBJPATH,
INTERFACE,
IU_DBUS_METHOD_SHOW_RUNNING_CFG);
dbus_error_init(&err);
reply = dbus_connection_send_with_reply_and_block (dcli_dbus_connection,query,-1, &err);
dbus_message_unref(query);
if (NULL == reply) {
printf("failed get reply.\n");
if (dbus_error_is_set(&err)) {
printf("%s raised: %s",err.name,err.message);
dbus_error_free(&err);
}
return -1;
}
if (dbus_message_get_args ( reply, &err,
DBUS_TYPE_STRING, &tmp_str,
DBUS_TYPE_INVALID)) {
char _tmpstr[64];
memset(_tmpstr, 0, 64);
sprintf(_tmpstr, BUILDING_MOUDLE, "IU");
vtysh_add_show_string(_tmpstr);
vtysh_add_show_string(tmp_str);
dbus_message_unref(reply);
return 0;
}
else {
if (dbus_error_is_set(&err)) {
dbus_error_free(&err);
}
dbus_message_unref(reply);
return 1;
}
return 0;
}
#endif
void dcli_iu_init(void) {
install_node (&hansi_iu_node,NULL,"HANSI_IU_NODE");
install_default(HANSI_IU_NODE);
install_node (&local_hansi_iu_node,NULL,"LOCAL_HANSI_IU_NODE");
install_default(LOCAL_HANSI_IU_NODE);
install_element(HANSI_NODE,&config_iu_mode_cmd);
install_element(LOCAL_HANSI_NODE,&config_iu_mode_cmd);
/****************HANSI IU NODE**********************************/
install_element(HANSI_IU_NODE,&set_iu_ni_cmd);
install_element(HANSI_IU_NODE,&set_iu_nwapp_cmd);
install_element(HANSI_IU_NODE,&iu_debug_enable_cmd);
install_element(HANSI_IU_NODE,&iu_debug_disable_cmd);
install_element(HANSI_IU_NODE, &iu_enable_cmd);
install_element(HANSI_IU_NODE, &set_iu_traffic_mode_cmd);
install_element(HANSI_IU_NODE, &set_iu_routing_context_cmd);
install_element(HANSI_IU_NODE, &set_iu_address_cmd);
install_element(HANSI_IU_NODE, &set_iu_point_code_str_cmd);
install_element(HANSI_IU_NODE, &set_iu_point_code_int_cmd);
install_element(HANSI_IU_NODE, &set_iu_connection_mode_cmd);
install_element(HANSI_IU_NODE, &set_iu_multi_switch_cmd);
install_element(HANSI_IU_NODE, &iu_get_link_status_cmd);
/****************LOCAL HANSI IU NODE****************************/
install_element(LOCAL_HANSI_IU_NODE,&set_iu_ni_cmd);
install_element(LOCAL_HANSI_IU_NODE,&set_iu_nwapp_cmd);
install_element(LOCAL_HANSI_IU_NODE,&iu_debug_enable_cmd);
install_element(LOCAL_HANSI_IU_NODE,&iu_debug_disable_cmd);
install_element(LOCAL_HANSI_IU_NODE, &iu_enable_cmd);
install_element(LOCAL_HANSI_IU_NODE, &set_iu_traffic_mode_cmd);
install_element(LOCAL_HANSI_IU_NODE, &set_iu_routing_context_cmd);
install_element(LOCAL_HANSI_IU_NODE, &set_iu_address_cmd);
install_element(LOCAL_HANSI_IU_NODE, &set_iu_point_code_str_cmd);
install_element(LOCAL_HANSI_IU_NODE, &set_iu_point_code_int_cmd);
install_element(LOCAL_HANSI_IU_NODE, &set_iu_connection_mode_cmd);
install_element(LOCAL_HANSI_IU_NODE, &set_iu_multi_switch_cmd);
install_element(LOCAL_HANSI_IU_NODE, &iu_get_link_status_cmd);
return;
}
| [
"[email protected]"
] | |
c644d10687e1cc8aa67e3e672923f4fb8b5b31f6 | a016500fd09188a3a02d1d1c184d25aa6f49efef | /test/test45.c | 625d7d145d86abc25c956e830afe0f9937464eca | [] | no_license | MarsMan13/C_programing | 49452011bd67a9d71cf91479941c7555858221af | b16c7661915b23b98e22b795c04406d52fdbafbd | refs/heads/master | 2020-04-14T23:49:31.379376 | 2019-01-05T13:36:31 | 2019-01-05T13:36:31 | 164,217,790 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 473 | c | #include <stdio.h>
void def(int *, int *);
int main(void){
int num1 = 10, num2 = 20;
int *ptr1, *ptr2;
ptr1= &num1, ptr2 = &num2;
printf("*ptr1, *ptr2: %d %d \n", *ptr1, *ptr2);
printf("%p %p\n", ptr1, ptr2);
def(ptr1, ptr2);
printf("*ptr1, *ptr2: %d %d \n", *ptr1, *ptr2);
return 0;
}
void def(int *p1, int *p2){
printf("%p %p\n", p1, p2);
int *temp = p1;
p1 = p2;
p2= temp;
printf("%p %p\n", p1, p2);
}
| [
"[email protected]"
] | |
429524f372be668e227a2f36354b18c804c9559f | ed88149b43fe6de3c98eeba70629c8c5d5fa975d | /jpeg-lossless/Decode/jpegll_dec.c | fac8db8bfc7a7e181feb7671fe0e64f8ba4980fa | [] | no_license | alifTC12/data-compression | a5f6a4ad2094c638f1cdbb3d91e23093016d065e | 482d4de262f50404e69b025258982fd314b26023 | refs/heads/master | 2021-01-22T19:35:49.733519 | 2015-12-07T05:03:14 | 2015-12-07T05:03:14 | 47,024,081 | 0 | 0 | null | 2015-11-28T13:13:59 | 2015-11-28T13:13:57 | C | UTF-8 | C | false | false | 6,400 | c | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
/**********************************************************************
* *
* File: jpegll_dec.c *
* Function: reconstructs an image which was decorrelated using the *
* lossless JPEG predictors *
* Author (aka person to blame) : K. Sayood *
* Last mod: 5/12/95 *
* Usage: see usage() *
***********************************************************************/
/*******************************************************************************
*NOTICE: *
*This code is believed by the author to be bug free. You are free to use and *
*modify this code with the understanding that any use, either direct or *
*derivative, must contain acknowledgement of its author and source. The author*
*makes no warranty of any kind, expressed or implied, of merchantability or *
*fitness for a particular purpose. The author shall not be held liable for any*
*incidental or consequential damages in connection with or arising out of the *
*furnishing, performance, or use of this software. This software is not *
*authorized for use in life support devices or systems. *
********************************************************************************/
void usage(void);
void main(int argc, char **argv)
{
int row, col, row_size, col_size, temp, mode,pred;
char outimage[50], resimage[50];
unsigned char **image_out, **res_image;
int c;
FILE *ifp, *ofp;
extern int optind;
extern char *optarg;
usage();
/* Obtain the filename for the residual image */
ifp = stdin;
ofp = stdout;
while((c=getopt(argc,argv,"i:o:m:h"))!=EOF)
{
switch (c){
case 'i':
strcpy(resimage,optarg);
ifp = fopen(optarg,"rb");
break;
case 'o':
strcpy(outimage,optarg);
ofp = fopen(optarg,"wb");
break;
case 'h':
usage();
exit(1);
}
}
/* Find the JPEG lossless mode and the image dimensions */
fread(&mode,1,sizeof(int),ifp);
fread(&col_size,1,sizeof(int),ifp);
fread(&row_size,1,sizeof(int),ifp);
fprintf(stderr,"\n\n\t\tJPEG Lossless Compression \n");
fprintf(stderr,"This program reconstructs an image from its residuals\n");
fprintf(stderr,"stored in %s\n",resimage);
fprintf(stderr,"\nThe residuals were obtained using JPEG lossless \n");
fprintf(stderr,"mode %d and the reconstructed %d X %d image is stored in %s\n",mode,col_size,row_size,outimage);
/* Assign space for the output image */
image_out = (unsigned char **) calloc(row_size,sizeof(char *));
for(row=0; row<row_size; row++)
{
image_out[row] = (unsigned char *) calloc(col_size,sizeof(char));
}
/* Generate prediction using the prediction mode selected */
for(row=0; row<row_size; row++)
for(col=0; col<col_size; col++)
{
c = getc(ifp);
switch(mode) {
case 0:
pred = 0;
break;
case 1:
if(row == 0 && col == 0)
pred = 0;
else if(row==0)
pred = image_out[row][col -1];
else
pred = image_out[row-1][col];
break;
case 2:
if(row == 0 && col == 0)
pred = 0;
else if(col==0)
pred = image_out[row-1][col];
else
pred = image_out[row][col -1];
break;
case 3:
if(row == 0 && col == 0)
pred = 0;
else if(col==0)
pred = image_out[row-1][col];
else if(row==0)
pred = image_out[row][col -1];
else
pred = image_out[row-1][col - 1];
break;
case 4:
if(row == 0 && col == 0)
pred = 0;
else if(col==0)
pred = image_out[row-1][col];
else if(row==0)
pred = image_out[row][col -1];
else
pred = image_out[row][col-1] + image_out[row-1][col] - image_out[row-1][col- 1];
break;
case 5:
if(row == 0 && col == 0)
pred = 0;
else if(col==0)
pred = image_out[row-1][col];
else if(row==0)
pred = image_out[row][col -1];
else
pred = image_out[row][col-1] + (image_out[row-1][col] - image_out[row-1][col- 1])/2;
break;
case 6:
if(row == 0 && col == 0)
pred = 0;
else if(col==0)
pred = image_out[row-1][col];
else if(row==0)
pred = image_out[row][col -1];
else
pred = image_out[row-1][col] + (image_out[row][col-1] - image_out[row-1][col- 1])/2;
break;
case 7:
if(row == 0 && col == 0)
pred = 0;
else if(col==0)
pred = image_out[row-1][col];
else if(row==0)
pred = image_out[row][col -1];
else
pred = (image_out[row][col-1] + image_out[row-1][col])/2;
break;
default:
fprintf(stderr,"No JPEG mode was specified");
exit(1);
}
/* Generate the reconstruction */
temp = c + pred;
/* Represent the residual modulo 256 */
while(temp>255)
temp = temp - 255;
image_out[row][col] = temp;
}
for(row=0; row<row_size; row++)
for(col=0; col<col_size; col++)
putc(image_out[row][col],ofp);
}
void usage(void)
{
fprintf(stderr,"Usage: jpegll_dec [-i infile] [-o outfile] \n");
fprintf(stderr,"\t infile is the file containing the residuals, and \n");
fprintf(stderr,"\t outfile is the file which will contain the reconstructed\n");
fprintf(stderr,"\t image. If infile and/or outfile are not specified\n");
fprintf(stderr,"\t the defaults are standard input and output\n");
}
| [
"[email protected]"
] | |
6e712413b9ee610745e550d1963a866c59b27bb5 | 504d2ceac1abb08523a4443c5326f6485716c004 | /SharedSource/CalcPhonemeOrderProbability.c | 96d2b0e41cd41c7acd2930e8f7202cc8c7a1e91c | [] | no_license | LinusLangels/NativeVoiceRecoding | abc2bc62eb6bbce9bd604128aa80bd5d6fb16a0a | 83a7b763c2d93f3cf2c255398f4d091e32eff574 | refs/heads/master | 2020-04-01T08:12:07.607414 | 2018-10-14T21:38:07 | 2018-10-14T21:38:07 | 153,021,297 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 6,520 | c | //
// CalcPhonemeOrderProbability.c
// MicrophoneRecorder
//
// Created by John Philipsson on 2016-01-28.
// Copyright © 2016 John Philipsson. All rights reserved.
//
#include "CalcPhonemeOrderProbability.h"
#include <stdlib.h>
#include <string.h>
#include <math.h>
FILE *debugfile_ptr;
// Vowels
char VOWEL_STRING_TABLE_PROB[10][3] = {"ii\0", "ih\0","E\0","ae\0","u\0","a\0","o\0","uu\0","oo\0","@@\0"};
// these phonemes is unvoiced or similar
char UNVOICED_STRING_TABLE_PROB[5][3] = {"f\0", "k\0","p\0","s\0","t\0"};
// these phonemes is voiced or similar
char VOICED_STRING_TABLE_PROB[8][3] = {"b\0", "l\0","m\0","n\0","d\0","g\0","h\0","r\0"};
PhonemeProb_t* calcPhonOrdProb_init(int phonemeOrderBufferSize)
{
//debug
//debugfile_ptr = fopen("debugfile_phonem.txt","w+");
int i,j;
PhonemeProb_t *phonProb = (PhonemeProb_t *)malloc(sizeof(PhonemeProb_t));
if(phonProb == NULL)
{
return NULL;
}
phonProb->phonemeOrderBufferSize = phonemeOrderBufferSize;
phonProb->delaylinePhoneBuffer = (char **)malloc(phonProb->phonemeOrderBufferSize * sizeof(char*));
for(i=0;i<phonProb->phonemeOrderBufferSize;i++)
{
phonProb->delaylinePhoneBuffer[i] = (char *)malloc(PHONEME_LEN * sizeof(char));
strcpy(phonProb->delaylinePhoneBuffer[i],"sil\0");
}
//copy TABLES to the phoneme table
j=0;
for(i=0;i<10;i++)
{
strcpy(phonProb->PHONEME_TABLE_PROB[j],VOWEL_STRING_TABLE_PROB[i]);
j++;
}
for(i=0;i<5;i++)
{
strcpy(phonProb->PHONEME_TABLE_PROB[j],UNVOICED_STRING_TABLE_PROB[i]);
j++;
}
for(i=0;i<8;i++)
{
strcpy(phonProb->PHONEME_TABLE_PROB[j],VOICED_STRING_TABLE_PROB[i]);
j++;
}
phonProb->index_compared_ptr = 0;
return phonProb;
}
void calcPhonOrdProb_destroy(PhonemeProb_t *phonProb)
{
int i;
for(i=0;i<phonProb->phonemeOrderBufferSize;i++)
{
free(phonProb->delaylinePhoneBuffer[i]);
}
free(phonProb->delaylinePhoneBuffer);
free(phonProb);
//fclose(debugfile_ptr);
}
void calcPhonOrdProbExec(PhonemeProb_t *phonProb, char *phoneme, int zcr)
{
int i;
int sum;
int sil_sum;
int count_table[23];
int index_found1,index_found2,index_found3;
int replaced_phoneme;
char temp_phoneme[5];
strcpy(temp_phoneme,phoneme);
if(phonProb->index_compared_ptr > (PHONEME_LEN-3))
{
phonProb->index_compared_ptr = 0;
}
replaced_phoneme = 0;
for(i=0;i<23;i++)
{
count_table[i] = 0;
}
for(i=0;i<phonProb->phonemeOrderBufferSize-1;i++)
{
strcpy(phonProb->delaylinePhoneBuffer[phonProb->phonemeOrderBufferSize-1-i], phonProb->delaylinePhoneBuffer[phonProb->phonemeOrderBufferSize-2-i]);
}
strcpy(phonProb->delaylinePhoneBuffer[0], phoneme);
sum=0;
sil_sum=0;
for(int j=0;j<phonProb->phonemeOrderBufferSize;j++)
{
for(i=0;i<23;i++)
{
if(strcmp(phonProb->delaylinePhoneBuffer[j],"sil\0")==0)
{
sil_sum++;
break;
}
if(strcmp(phonProb->delaylinePhoneBuffer[j],phonProb->PHONEME_TABLE_PROB[i])==0)
{
sum = sum + i;
count_table[i] = count_table[i] + 1;
break;
}
}
}
//get first max from count table
int max_index = -1;
int max_value = -1;
for(i=0;i<23;i++)
{
if(count_table[i] > max_value)
{
max_value = count_table[i];
max_index = i;
}
}
// This one replaces phoneme with the the max found phoneme during the 5 latest phonemes (incl. sil)
/*
if(sil_sum > sum)
{
strcpy(phoneme,"sil\0");
}
else
{
strcpy(phoneme,phonProb->PHONEME_TABLE_PROB[max_index]);
}
*/
index_found1 = -1;
//find index of phoneme
for(i=0;i<23;i++)
{
if(strcmp(phonProb->delaylinePhoneBuffer[0],phonProb->PHONEME_TABLE_PROB[i])==0)
{
index_found1 = i;
break;
}
}
//check middle phoneme
index_found3 = -1;
for(i=0;i<23;i++)
{
if(strcmp(phonProb->delaylinePhoneBuffer[1],phonProb->PHONEME_TABLE_PROB[i])==0)
{
index_found3 = i;
break;
}
}
//if a consonant, then check if this one also have come in last last
index_found2 = -1;
if(index_found1 > 9)
{
for(i=0;i<23;i++)
{
if(strcmp(phonProb->delaylinePhoneBuffer[2+phonProb->index_compared_ptr],phonProb->PHONEME_TABLE_PROB[i])==0)
{
index_found2 = i;
break;
}
}
}
else{
phonProb->index_compared_ptr = 0;
}
if(strcmp(phoneme,"sil\0") != 0)
{
if((index_found1 > 9) && (index_found2 > 9) && (index_found3 < 10))
{
if(strcmp(phonProb->delaylinePhoneBuffer[1],"sil\0") != 0)
{
strcpy(phoneme,phonProb->delaylinePhoneBuffer[1]);
strcpy(phonProb->delaylinePhoneBuffer[0],phonProb->delaylinePhoneBuffer[1]); //replace phonem also in delayline
replaced_phoneme=1;
phonProb->index_compared_ptr = phonProb->index_compared_ptr + 1;
}
}
}
//debug prints
//fprintf(debugfile_ptr,"ZCR: %d\n",zcr);
//fprintf(debugfile_ptr,"Phoneme: %s\n",phoneme);
/*
fprintf(debugfile_ptr,"====== DELAYLINE PHOENME ========\n");
for(i=0;i<phonProb->phonemeOrderBufferSize;i++)
{
fprintf(debugfile_ptr,"%s\n",phonProb->delaylinePhoneBuffer[i]);
}
fprintf(debugfile_ptr,"====== BUT SHOULD HAVE BEEN, IF REPLACED - DELAYLINE PHOENME========\n");
fprintf(debugfile_ptr,"%s\n",phoneme);
for(i=1;i<phonProb->phonemeOrderBufferSize;i++)
{
fprintf(debugfile_ptr,"%s\n",phonProb->delaylinePhoneBuffer[i]);
}
if(replaced_phoneme==1)
{
fprintf(debugfile_ptr,"**********REPLACED PHOENME*********************************************************************************************************************\n");
fprintf(debugfile_ptr,"From %s\n",temp_phoneme);
fprintf(debugfile_ptr,"To %s\n",phoneme);
}
*/
} | [
"[email protected]"
] | |
426c86a5db93c8421a560700554c984dd3ede436 | ad2f091c0194c59f3b9b4d311e5dffec20da36e1 | /aula20160920/casr2.c | 585a1f5f1aeebc6e978ed8f94c67960f877090e3 | [] | no_license | juliaalmeidarosa/MTP | f464e424ea0fe33c46f02b89ca33ac2a7d26b764 | e0c84ad0133c6a991d214429df1b5ae343ff59e8 | refs/heads/master | 2020-05-21T20:48:55.465820 | 2016-11-29T14:43:40 | 2016-11-29T14:43:40 | 65,817,479 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 755 | c | #include<stdio.h>
int main ()
{
int i;
float f;
char c;
printf("Entre com um inteiro:");
recebe_dado('i', &i);
printf("Entre com um float:");
recebe_dado('f', &f);
printf("Entre com um caractere:");
recebe_dado('c', &c);
printf("Quadrado: %d\n:", i*i);
printf("Raiz: %f\n", sqrt(f));
printf("Caractere: %c\n", (isupper(c))? tolower(c): toupper(c));
return 0;
}
void recebe_dado(char tipo, void *endereco)
{
int c;
switch (tipo)
{
case 'i': scanf("%d", (int *)endereco);
break;
case 'f': scanf("%f", (float *)endereco);
break;
case 'c': scanf("%c", (char *)endereco);
break;
}
while ((c=getchar()) !=EOF && c !='\n'); //limpar buffer
}
| [
"[email protected]"
] | |
1488a0a7f72d182dddfe392d70eb2658483bc82b | 579f280ee6fe00796cc3565cba635edfef0abfb6 | /martich2/dominion/unittest3.c | c1bda0b628801edd752d9e8007509f4a178bc4b9 | [] | no_license | fahlmant/cs362 | 633bac35ba641797f1cc26edaa0713576d54ccd6 | 3af6b387129c5c9ba7a4b0159a20c7a09ed0c3f8 | refs/heads/master | 2020-04-30T17:20:29.717562 | 2015-06-10T10:27:53 | 2015-06-10T10:27:53 | 176,976,345 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,823 | c | /*
* unittest3.c
*
* test of int updateCoins(int player, struct gameState *state, int bonus)
* in dominion.c
*
* Created on: Apr 22, 2015
* Author: martich2
*/
#include <stdio.h>
#include <assert.h>
#include "dominion.h"
/* prototype here to allow compiling, no linker errors/warnings */
int updateCoins(int player, struct gameState *state, int bonus);
int main(int argc, char** argv)
{
/* updateCoins only reads handCount and hand; all other fields can be uninitialized. */
struct gameState *aGame = newGame();
aGame->handCount[0] = 5;
// Test 1
// give player0 2 copper, 2 silver, 1 gold.
aGame->hand[0][0] = copper; aGame->hand[0][1] = copper;
aGame->hand[0][2] = silver; aGame->hand[0][3] = silver;
aGame->hand[0][4] = gold;
printf("Test 1: player0 has 9 coins...");
updateCoins(0, aGame, 0);
assert(aGame->coins == 9);
printf("passes\n");
// Test 2
// give player0 2 copper, 2 silver, 1 gold and a bonus.
printf("Test 2: player0 has 10 coins...");
updateCoins(0, aGame, 1);
assert(aGame->coins == 10);
printf("passes\n");
// Test 3
// give player0 2 copper, 2 silver, 1 gold and -10 bonus. invalid game state
printf("Test 3: player0 has -1 coins...");
updateCoins(0, aGame, -10);
assert(aGame->coins == -1);
printf("passes\n");
// Test 4
//call updateCoin on player 7, who does not exist, but has 0 coins.
printf("Test 4: player7 has 0 coins...");
updateCoins(7, aGame, 0);
assert(aGame->coins == 0);
printf("passes\n");
// Test 4, commented out so scripts will run
/* set game state struct to null. will cause seg fault */
// printf("Test 6: null game state, invalid state, will seg fault\n");
// aGame = NULL;
// updateCoins(0, aGame, 0);
return 0;
}
| [
"[email protected]"
] | |
9e32ff085c8e8798f22320355ddcbf8fa1b10c7f | 5c255f911786e984286b1f7a4e6091a68419d049 | /vulnerable_code/77f79c96-b931-4933-a847-dc5e1318f9b4.c | 77d7881ce1c9d8756391786818b36f48270564d7 | [] | no_license | nmharmon8/Deep-Buffer-Overflow-Detection | 70fe02c8dc75d12e91f5bc4468cf260e490af1a4 | e0c86210c86afb07c8d4abcc957c7f1b252b4eb2 | refs/heads/master | 2021-09-11T19:09:59.944740 | 2018-04-06T16:26:34 | 2018-04-06T16:26:34 | 125,521,331 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 526 | c | #include <string.h>
#include <stdio.h>
int main() {
float i;
float j;
float k;
float l;
i = 6;
j = 9;
//variables
/* START VULNERABILITY */
int a;
long b[66];
long c[69];
a = 0;
do {
/* START BUFFER SET */
*((long *)c + a) = *((long *)b + a);
/* END BUFFER SET */
a--;
} while(a > -1);
/* END VULNERABILITY */
//random
k = 3;
l = l*j*k/9;
printf("vulnerabbblty");
printf("%f\n",k);
return 0;
}
| [
"[email protected]"
] | |
2a8cd4c796b408cb4a1e03139d3657293457650b | aec8e3d622bbefa02a2bbdc666202f53bff214b6 | /include/poincare_map.h | 00639ef526ecb0b3f6cdcc7361ceec6232cc6648 | [] | no_license | zhaomingxian/test_particle | a79637ff8987193bc5c1a0b3987946ca95515546 | 34569836f962ccebaafaff643a02802e076cfdcc | refs/heads/master | 2023-05-08T15:16:32.812506 | 2021-02-21T02:48:33 | 2021-02-21T02:48:33 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 142 | h | #ifndef POINCARE_MAP_H
#define POINCARE_MAP_H
int poincare_map(int mpi_rank, int mpi_size, char *config_file_name, domain *sdomain);
#endif
| [
"[email protected]"
] |